Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
Evt Struct Reference

The Evt class respresent a Monte Carlo (MC) event as well as an offline event. More...

#include <Evt.hh>

Inheritance diagram for Evt:
AAObject TObject

Public Member Functions

 Evt ()
 
void print (std::ostream &out=std::cout) const
 Print event. More...
 
double get_ns ()
 Get UTC time. More...
 
void clear ()
 Reset event. More...
 
void clear_hits ()
 Clear the hit vectors and all the references to hits in the tracks. More...
 
double getMCtime (const Hit &h)
 Get the original Monte-Carlo-time of the hit. More...
 
Hitget_hit_by_id (int req_id, bool use_mc_hits=false)
 Get pointer to hit with given identifier. More...
 
std::vector< Trk * > primary_trks ()
 Get all the tracks that are 'primary'. More...
 
Trkneutrino ()
 Get a pointer to the (first) neutrino from the MC track list. More...
 
Trkprimary_neutrino ()
 Get a pointer to primary neutrino from the MC track list. More...
 
Trkleading_lepton ()
 Get a pointer to leading lepton from the MC track list. More...
 
Trkget_parent_of (Trk &child)
 Get the (first) parent of the track 'child'. More...
 
int idx (const std::string &key) const
 Get index in user data of the item with given key. More...
 
bool haveusr (const std::string &key) const
 Check availability of user data of the item with given key. More...
 
int idxusr_checked (const std::string &key) const
 Get index in user data of the item with given key. More...
 
double getusr (const std::string &key) const
 Get user data item with given key. More...
 
void setusr (const std::string &key, double value)
 Set user data item with given key. More...
 
bool delusr (const std::string &key)
 Remove (first) user data item with given key. More...
 
void clearusr ()
 Clear user data. More...
 
void printusr (std::ostream &out=std::cout)
 Print user data (i.e. More...
 
const char * __str__ () const
 Get class name. More...
 

Public Attributes

int id
 offline event identifier More...
 
int det_id
 detector identifier from DAQ More...
 
int mc_id
 identifier of the MC event (as found in ascii or antcc file). More...
 
int run_id
 DAQ run identifier. More...
 
int mc_run_id
 MC run identifier. More...
 
int frame_index
 from the raw data More...
 
ULong64_t trigger_mask
 trigger mask from raw data (i.e. the trigger bits) More...
 
ULong64_t trigger_counter
 trigger counter More...
 
unsigned int overlays
 number of overlaying triggered events More...
 
TTimeStamp t
 UTC time of the start of the timeslice the event came from. More...
 
std::vector< Hithits
 list of hits More...
 
std::vector< Trktrks
 list of reconstructed tracks (can be several because of prefits,showers, etc). More...
 
std::vector< double > w
 MC: Weights w[0]=w1, w[1]=w2, w[2]]=w3 (see e.g. Tag list) More...
 
std::vector< double > w2list
 MC: factors that make up w[1]=w2 (see e.g. Tag list) More...
 
std::vector< double > w3list
 MC: atmospheric flux information. More...
 
double mc_t
 MC: time of the mc event. More...
 
std::vector< Hitmc_hits
 MC: list of MC truth hits. More...
 
std::vector< Trkmc_trks
 MC: list of MC truth tracks. More...
 
TString comment
 user can use this as he/she likes More...
 
int index
 user can use this as he/she likes More...
 
int flags
 user can use this as he/she likes More...
 
std::vector< double > usr
 user data More...
 
std::vector< std::string > usr_names
 user keys More...
 
TObjectany
 Pointer to "any" user data. More...
 

Detailed Description

The Evt class respresent a Monte Carlo (MC) event as well as an offline event.


Some data from the online (DAQ) event are copied.

Definition at line 19 of file Evt.hh.

Constructor & Destructor Documentation

Evt::Evt ( )
inline

Definition at line 54 of file Evt.hh.

54  :
55  id(0), det_id(0), mc_id(0), run_id(0), mc_run_id(0), frame_index(0),
57  overlays(0), t(0), mc_t(0), index(0), flags(0) {}
ULong64_t trigger_counter
trigger counter
Definition: Evt.hh:30
int frame_index
from the raw data
Definition: Evt.hh:28
unsigned int overlays
number of overlaying triggered events
Definition: Evt.hh:31
int mc_run_id
MC run identifier.
Definition: Evt.hh:26
int mc_id
identifier of the MC event (as found in ascii or antcc file).
Definition: Evt.hh:23
int run_id
DAQ run identifier.
Definition: Evt.hh:25
double mc_t
MC: time of the mc event.
Definition: Evt.hh:43
int det_id
detector identifier from DAQ
Definition: Evt.hh:22
TTimeStamp t
UTC time of the start of the timeslice the event came from.
Definition: Evt.hh:32
int flags
user can use this as he/she likes
Definition: Evt.hh:50
int index
user can use this as he/she likes
Definition: Evt.hh:49
int id
offline event identifier
Definition: Evt.hh:21
ULong64_t trigger_mask
trigger mask from raw data (i.e. the trigger bits)
Definition: Evt.hh:29

Member Function Documentation

void Evt::print ( std::ostream &  out = std::cout) const
inline

Print event.

Parameters
outoutput stream

Definition at line 65 of file Evt.hh.

66  {
67  out << "Evt: id=" << id <<
68  " run_id=" << run_id <<
69  " #hits=" << hits.size() <<
70  " #mc_hits=" << mc_hits.size() <<
71  " #trks=" << trks.size() <<
72  " #mc_trks=" << mc_trks.size() << std::endl;
73  }
int run_id
DAQ run identifier.
Definition: Evt.hh:25
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
Definition: Evt.hh:36
std::vector< Hit > mc_hits
MC: list of MC truth hits.
Definition: Evt.hh:44
std::vector< Hit > hits
list of hits
Definition: Evt.hh:35
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:45
double Evt::get_ns ( )
inline

Get UTC time.

Returns
time [ns]

Definition at line 81 of file Evt.hh.

82  {
83  return this->t.GetSec()*1e9 + this->t.GetNanoSec();
84  }
TTimeStamp t
UTC time of the start of the timeslice the event came from.
Definition: Evt.hh:32
void Evt::clear ( )
inline

Reset event.

Definition at line 89 of file Evt.hh.

90  {
91  *this = Evt();
92  }
Evt()
Definition: Evt.hh:54
void Evt::clear_hits ( )
inline

Clear the hit vectors and all the references to hits in the tracks.

Definition at line 97 of file Evt.hh.

98  {
99  hits.clear();
100  mc_hits.clear();
101  for (auto& t: trks ) t.hit_ids.clear();
102  for (auto& t: mc_trks ) t.hit_ids.clear();
103  }
TTimeStamp t
UTC time of the start of the timeslice the event came from.
Definition: Evt.hh:32
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
Definition: Evt.hh:36
std::vector< Hit > mc_hits
MC: list of MC truth hits.
Definition: Evt.hh:44
std::vector< Hit > hits
list of hits
Definition: Evt.hh:35
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:45
double Evt::getMCtime ( const Hit h)
inline

Get the original Monte-Carlo-time of the hit.

Apply a correction to the hit time from the DAQ, so that the time returned by this fucntion matches the original time used in the Monte Carlo event.

Parameters
hhit
Returns
time [ns]

Definition at line 116 of file Evt.hh.

117  {
118  return h.t+this->get_ns() - this->mc_t;
119  }
double get_ns()
Get UTC time.
Definition: Evt.hh:81
double mc_t
MC: time of the mc event.
Definition: Evt.hh:43
double t
hit time (from calibration or MC truth)
Definition: Hit.hh:23
Hit* Evt::get_hit_by_id ( int  req_id,
bool  use_mc_hits = false 
)
inline

Get pointer to hit with given identifier.


This method throws a run-time exception if no hit is available.

Parameters
req_idhit identifier
use_mc_hitsoption to use MC hit
Returns
pointer to hit.

Definition at line 129 of file Evt.hh.

130  {
131  std::vector<Hit>& col = use_mc_hits? mc_hits : hits;
132 
133  if ( req_id < int(col.size()) ) // try to see if we are lucky
134  {
135  if ( col[req_id].id == req_id ) return &(col[id]);
136  }
137 
138  for( auto& h: col )
139  {
140  if ( h.id == req_id ) return &(col[id]);
141  }
142 
143  THROW(Exception, "Could not find hit with id=" << req_id);
144  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
General exception.
Definition: Exception.hh:13
std::vector< Hit > mc_hits
MC: list of MC truth hits.
Definition: Evt.hh:44
int id
offline event identifier
Definition: Evt.hh:21
std::vector< Hit > hits
list of hits
Definition: Evt.hh:35
std::vector<Trk*> Evt::primary_trks ( )
inline

Get all the tracks that are 'primary'.


Here, primary means the tracks have no parents.

Note that this method only works if MC parent-child relations are availabe.

Returns
list of pointers to primary tracks

Definition at line 155 of file Evt.hh.

156  {
158  for(auto& t: mc_trks )
159  {
160  if ( t.is_primary() ) r.push_back(&t);
161  }
162  return r;
163  }
data_type r[M+1]
Definition: JPolint.hh:709
TTimeStamp t
UTC time of the start of the timeslice the event came from.
Definition: Evt.hh:32
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:45
Trk* Evt::neutrino ( )
inline

Get a pointer to the (first) neutrino from the MC track list.

Returns
pointers to neutrino (may be NULL)

Definition at line 170 of file Evt.hh.

171  {
172  for(auto& t: mc_trks )
173  {
174  if ( t.is_neutrino() ) return &t;
175  }
176  return nullptr;
177  }
TTimeStamp t
UTC time of the start of the timeslice the event came from.
Definition: Evt.hh:32
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:45
Trk* Evt::primary_neutrino ( )
inline

Get a pointer to primary neutrino from the MC track list.

Note that this method only works if MC parent-child relations are availabe.

Returns
pointer to primary neutrino (may be NULL)

Definition at line 186 of file Evt.hh.

187  {
188  for( auto& t : mc_trks )
189  {
190  if ( t.is_neutrino() and t.is_primary() ) return &t;
191  }
192  return nullptr;
193  }
TTimeStamp t
UTC time of the start of the timeslice the event came from.
Definition: Evt.hh:32
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:45
Trk* Evt::leading_lepton ( )
inline

Get a pointer to leading lepton from the MC track list.

Here, leading means the lepton that has a neutrino as mother.

Note that this method only works if MC parent-child relations are availabe.

Returns
pointer to leadig lepton (may be NULL)

Definition at line 203 of file Evt.hh.

204  {
205  int nu_id = primary_neutrino()->id;
206 
207  for(auto& t: mc_trks )
208  {
209  if ( t.is_lepton() &&
210  t.mother_id == nu_id &&
211  !t.is_orphan() ) return &t;
212  }
213  return nullptr;
214  }
Trk * primary_neutrino()
Get a pointer to primary neutrino from the MC track list.
Definition: Evt.hh:186
int id
track identifier
Definition: Trk.hh:14
TTimeStamp t
UTC time of the start of the timeslice the event came from.
Definition: Evt.hh:32
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:45
Trk* Evt::get_parent_of ( Trk child)
inline

Get the (first) parent of the track 'child'.


This method throws a run-time exception if no parent is available.

Parameters
childchild particle
Returns
pointer to parent

Definition at line 223 of file Evt.hh.

224  {
225  for(auto& t: mc_trks )
226  {
227  if (child.mother_id == t.id ) return &t;
228  }
229  THROW(Exception, "Failed to find parent of track" << child.id << " mother_id="<< child.mother_id);
230  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
int mother_id
MC id of the parent particle.
Definition: Trk.hh:27
int id
track identifier
Definition: Trk.hh:14
TTimeStamp t
UTC time of the start of the timeslice the event came from.
Definition: Evt.hh:32
General exception.
Definition: Exception.hh:13
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:45
int AAObject::idx ( const std::string &  key) const
inlineinherited

Get index in user data of the item with given key.

Parameters
keykey
Returns
index (-1 if key does not exists)

Definition at line 29 of file AAObject.hh.

30  {
31  auto i = std::find (usr_names.begin(), usr_names.end(), key );
32  if (i == usr_names.end()) return -1;
33  return i - usr_names.begin();
34  }
std::vector< std::string > usr_names
user keys
Definition: AAObject.hh:21
bool AAObject::haveusr ( const std::string &  key) const
inlineinherited

Check availability of user data of the item with given key.

Parameters
keykey
Returns
true if available; else false

Definition at line 42 of file AAObject.hh.

43  {
44  return idx( key ) >= 0;
45  }
int idx(const std::string &key) const
Get index in user data of the item with given key.
Definition: AAObject.hh:29
int AAObject::idxusr_checked ( const std::string &  key) const
inlineinherited

Get index in user data of the item with given key.


This method throws a run-time exception if no user data are available.

Parameters
keykey
Returns
index (-1 if key does not exists)

Definition at line 54 of file AAObject.hh.

55  {
56  int r = idx( key );
57  if (r < 0)
58  {
59  THROW(Exception, "No user data for key " << key << " in aanet object of type " << this -> ClassName());
60  }
61  return r;
62  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
data_type r[M+1]
Definition: JPolint.hh:709
int idx(const std::string &key) const
Get index in user data of the item with given key.
Definition: AAObject.hh:29
General exception.
Definition: Exception.hh:13
double AAObject::getusr ( const std::string &  key) const
inlineinherited

Get user data item with given key.


This method throws a run-time exception if no user data are available.

Parameters
keykey
Returns
value

Definition at line 72 of file AAObject.hh.

73  {
74  const int i = idx( key );
75 
76  if ( i < 0 )
77  {
78  THROW(Exception, "No user data for key " << key << " in aanet object of type " << this -> ClassName());
79  }
80 
81  if ( unsigned(i) >= usr.size() )
82  {
83  THROW(Exception, "Warning: inconsistent user data " << i << " >= " << usr.size());
84  }
85 
86  return usr[i];
87  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
int idx(const std::string &key) const
Get index in user data of the item with given key.
Definition: AAObject.hh:29
General exception.
Definition: Exception.hh:13
std::vector< double > usr
user data
Definition: AAObject.hh:20
void AAObject::setusr ( const std::string &  key,
double  value 
)
inlineinherited

Set user data item with given key.


Parameters
keykey
valuevalue

Definition at line 95 of file AAObject.hh.

96  {
97  int i = idx( key );
98  if (i < 0)
99  {
100  if ( usr.size() < usr_names.size() )
101  {
102  // this should not happen, but let's just add empty data
103  usr.resize( usr_names.size() );
104  }
105  else
106  {
107  // this is possible, add empty ("") names
108  usr_names.resize( usr.size() );
109  }
110 
111  usr_names.push_back( key );
112  usr.push_back( value );
113  }
114  else
115  {
116  usr[i] = value;
117  }
118  }
std::vector< std::string > usr_names
user keys
Definition: AAObject.hh:21
int idx(const std::string &key) const
Get index in user data of the item with given key.
Definition: AAObject.hh:29
std::vector< double > usr
user data
Definition: AAObject.hh:20
bool AAObject::delusr ( const std::string &  key)
inlineinherited

Remove (first) user data item with given key.


Parameters
keykey
Returns
true if data have been removed; else false

Definition at line 126 of file AAObject.hh.

127  {
128  int i = idx( key );
129  if ( i < 0 ) return false;
130 
131  usr.erase ( usr.begin() + i );
132  usr_names.erase( usr_names.begin() + i );
133  return true;
134  }
std::vector< std::string > usr_names
user keys
Definition: AAObject.hh:21
int idx(const std::string &key) const
Get index in user data of the item with given key.
Definition: AAObject.hh:29
std::vector< double > usr
user data
Definition: AAObject.hh:20
void AAObject::clearusr ( )
inlineinherited

Clear user data.

Definition at line 139 of file AAObject.hh.

140  {
141  usr.resize(0);
142  usr_names.resize(0);
143  }
std::vector< std::string > usr_names
user keys
Definition: AAObject.hh:21
std::vector< double > usr
user data
Definition: AAObject.hh:20
void AAObject::printusr ( std::ostream &  out = std::cout)
inlineinherited

Print user data (i.e.

list of all pairs of keys and values).

Parameters
outoutput stream

Definition at line 150 of file AAObject.hh.

151  {
152  unsigned n = std::max( usr.size(), usr_names.size() );
153 
154  for (unsigned i=0; i< n ;i++)
155  {
156  std::string name = "(unnamed)";
157  if ( i < usr_names.size() && usr_names[i] != "" ) name = usr_names[i];
158  out << i << " \t " << name << " : \t ";
159  if ( i < usr.size() ) out << usr[i] << std::endl;
160  else out << "(none)" << std::endl;
161  }
162  }
std::vector< std::string > usr_names
user keys
Definition: AAObject.hh:21
then echo n User name
Definition: JCookie.sh:45
alias put_queue eval echo n
Definition: qlib.csh:19
std::vector< double > usr
user data
Definition: AAObject.hh:20
const char* AAObject::__str__ ( ) const
inlineinherited

Get class name.

Returns
class name

Definition at line 175 of file AAObject.hh.

175 { return Class_Name(); }

Member Data Documentation

int Evt::id

offline event identifier

Definition at line 21 of file Evt.hh.

int Evt::det_id

detector identifier from DAQ

Definition at line 22 of file Evt.hh.

int Evt::mc_id

identifier of the MC event (as found in ascii or antcc file).

Definition at line 23 of file Evt.hh.

int Evt::run_id

DAQ run identifier.

Definition at line 25 of file Evt.hh.

int Evt::mc_run_id

MC run identifier.

Definition at line 26 of file Evt.hh.

int Evt::frame_index

from the raw data

Definition at line 28 of file Evt.hh.

ULong64_t Evt::trigger_mask

trigger mask from raw data (i.e. the trigger bits)

Definition at line 29 of file Evt.hh.

ULong64_t Evt::trigger_counter

trigger counter

Definition at line 30 of file Evt.hh.

unsigned int Evt::overlays

number of overlaying triggered events

Definition at line 31 of file Evt.hh.

TTimeStamp Evt::t

UTC time of the start of the timeslice the event came from.

Definition at line 32 of file Evt.hh.

std::vector<Hit> Evt::hits

list of hits

Definition at line 35 of file Evt.hh.

std::vector<Trk> Evt::trks

list of reconstructed tracks (can be several because of prefits,showers, etc).

Definition at line 36 of file Evt.hh.

std::vector<double> Evt::w

MC: Weights w[0]=w1, w[1]=w2, w[2]]=w3 (see e.g. Tag list)

Definition at line 39 of file Evt.hh.

std::vector<double> Evt::w2list

MC: factors that make up w[1]=w2 (see e.g. Tag list)

Definition at line 40 of file Evt.hh.

std::vector<double> Evt::w3list

MC: atmospheric flux information.

Definition at line 41 of file Evt.hh.

double Evt::mc_t

MC: time of the mc event.

Definition at line 43 of file Evt.hh.

std::vector<Hit> Evt::mc_hits

MC: list of MC truth hits.

Definition at line 44 of file Evt.hh.

std::vector<Trk> Evt::mc_trks

MC: list of MC truth tracks.

Definition at line 45 of file Evt.hh.

TString Evt::comment

user can use this as he/she likes

Definition at line 48 of file Evt.hh.

int Evt::index

user can use this as he/she likes

Definition at line 49 of file Evt.hh.

int Evt::flags

user can use this as he/she likes

Definition at line 50 of file Evt.hh.

std::vector<double> AAObject::usr
inherited

user data

Definition at line 20 of file AAObject.hh.

std::vector<std::string> AAObject::usr_names
inherited

user keys

Definition at line 21 of file AAObject.hh.

TObject* AAObject::any
inherited

Pointer to "any" user data.

Definition at line 177 of file AAObject.hh.


The documentation for this struct was generated from the following file: