Jpp  pmt_effective_area_update_2
the software that should make you happy
 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...
 
void clear ()
 Reset event. More...
 
void clear_hits ()
 Clear the hit vectors and all the references to hits in the tracks. More...
 
std::vector< const Trk * > primary_trks () const
 Return a vector with const pointers to the tracks that are 'primary'. More...
 
std::vector< Trk * > primary_trks ()
 Return a vector of pointers to tracks that are 'primary'. More...
 
const Trkneutrino () const
 Get a const pointer to the (first) neutrino from the MC track list. More...
 
Trkneutrino ()
 Get a pointer to the (first) neutrino from the MC track list. More...
 
const Trkprimary_neutrino () const
 Get a const pointer to primary neutrino from the MC track list. More...
 
Trkprimary_neutrino ()
 Get a pointer to primary neutrino from the MC track list. More...
 
const Trkleading_lepton () const
 Get a const pointer to the first leading lepton from the MC track list. More...
 
Trkleading_lepton ()
 Get a pointer to leading lepton from the MC track list. More...
 
const Trkget_parent_of (const Trk &child) const
 Get a const pointer to the (first) parent of the track 'child'. More...
 
Trkget_parent_of (const Trk &child)
 Get a pointer ot 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...
 

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 timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00) 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...
 
TTimeStamp mc_event_time
 MC: true generation time (UTC) of the event, (default: 01 Jan 1970 00:00:00) More...
 
double mc_t
 MC: time where the mc-event was put in the timeslice, since start of run (offset+frameidx*timeslice_duration) 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 55 of file Evt.hh.

55  :
56  id(0), det_id(0), mc_id(0), run_id(0), mc_run_id(0), frame_index(0),
58  overlays(0), t(0), mc_event_time(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
TTimeStamp mc_event_time
MC: true generation time (UTC) of the event, (default: 01 Jan 1970 00:00:00)
Definition: Evt.hh:43
int run_id
DAQ run identifier.
Definition: Evt.hh:25
double mc_t
MC: time where the mc-event was put in the timeslice, since start of run (offset+frameidx*timeslice_d...
Definition: Evt.hh:44
int det_id
detector identifier from DAQ
Definition: Evt.hh:22
TTimeStamp t
UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00) ...
Definition: Evt.hh:32
int flags
user can use this as he/she likes
Definition: Evt.hh:51
int index
user can use this as he/she likes
Definition: Evt.hh:50
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 66 of file Evt.hh.

67  {
68  out << "Evt: id=" << id <<
69  " run_id=" << run_id <<
70  " #hits=" << hits.size() <<
71  " #mc_hits=" << mc_hits.size() <<
72  " #trks=" << trks.size() <<
73  " #mc_trks=" << mc_trks.size() << std::endl;
74  }
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:45
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:46
void Evt::clear ( )
inline

Reset event.

Definition at line 80 of file Evt.hh.

81  {
82  *this = Evt();
83  }
Evt()
Definition: Evt.hh:55
void Evt::clear_hits ( )
inline

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

Definition at line 88 of file Evt.hh.

89  {
90  hits.clear();
91  mc_hits.clear();
92  for (auto& t : trks ) t.hit_ids.clear();
93  for (auto& t : mc_trks ) t.hit_ids.clear();
94  }
TTimeStamp t
UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00) ...
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:45
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:46
std::vector<const Trk*> Evt::primary_trks ( ) const
inline

Return a vector with const pointers to the tracks that are 'primary'.


Here, primary means the tracks have no parents.

This method only works if MC parent-child relations are availabe.

Returns
list of pointers to primary tracks

Definition at line 107 of file Evt.hh.

108  {
110  for (auto& t : mc_trks )
111  {
112  if ( t.is_primary() ) r.push_back(&t);
113  }
114  return r;
115  }
data_type r[M+1]
Definition: JPolint.hh:742
TTimeStamp t
UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00) ...
Definition: Evt.hh:32
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:46
std::vector<Trk*> Evt::primary_trks ( )
inline

Return a vector of pointers to tracks that are 'primary'.


Here, primary means the tracks have no parents.

Returns
list of pointers to primary tracks

Definition at line 124 of file Evt.hh.

125  {
127  for (auto& t : mc_trks )
128  {
129  if ( t.is_primary() ) r.push_back(&t);
130  }
131  return r;
132  }
data_type r[M+1]
Definition: JPolint.hh:742
TTimeStamp t
UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00) ...
Definition: Evt.hh:32
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:46
const Trk* Evt::neutrino ( ) const
inline

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

Returns
pointer to neutrino (nullptr if no neutrino is in the list)

Definition at line 140 of file Evt.hh.

141  {
142  for (auto& t : mc_trks )
143  {
144  if ( t.is_neutrino() ) return &t;
145  }
146  return nullptr;
147  }
TTimeStamp t
UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00) ...
Definition: Evt.hh:32
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:46
Trk* Evt::neutrino ( )
inline

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

Returns
const pointer to neutrino (nullptr if no neutrino is in the list)

Definition at line 155 of file Evt.hh.

156  {
157  // see Effective C++, Scott Meyers, ISBN-13: 9780321334879.
158  return const_cast<Trk *>(static_cast<const Evt &>(*this).neutrino() );
159  }
const Trk * neutrino() const
Get a const pointer to the (first) neutrino from the MC track list.
Definition: Evt.hh:140
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:13
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:19
const Trk* Evt::primary_neutrino ( ) const
inline

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

Only works if MC parent-child relations are availabe.

Returns
const pointer to primary neutrino (may be nullptr)

Definition at line 169 of file Evt.hh.

170  {
171  for ( auto& t : mc_trks )
172  {
173  if ( t.is_neutrino() and t.is_primary() ) return &t;
174  }
175  return nullptr;
176  }
TTimeStamp t
UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00) ...
Definition: Evt.hh:32
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:46
Trk* Evt::primary_neutrino ( )
inline

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

Only works if MC parent-child relations are availabe.

Returns
pointer to primary neutrino

Definition at line 185 of file Evt.hh.

186  {
187  return const_cast<Trk *>(static_cast<const Evt &>(*this).primary_neutrino() );
188  }
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:13
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:19
const Trk * primary_neutrino() const
Get a const pointer to primary neutrino from the MC track list.
Definition: Evt.hh:169
const Trk* Evt::leading_lepton ( ) const
inline

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

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

Only works if MC parent-child relations are availabe.

Returns
pointer to leadig lepton (may be nullptr in case not found)

Definition at line 199 of file Evt.hh.

200  {
201  const Trk* nu = primary_neutrino();
202  if (!nu) return nullptr;
203 
204  for (auto& t : mc_trks )
205  {
206  if ( t.is_lepton() &&
207  t.mother_id == nu->id &&
208  !t.is_orphan() ) return &t;
209  }
210  return nullptr;
211  }
int id
track identifier
Definition: Trk.hh:15
TTimeStamp t
UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00) ...
Definition: Evt.hh:32
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:13
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:46
const Trk * primary_neutrino() const
Get a const pointer to primary neutrino from the MC track list.
Definition: Evt.hh:169
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.

Only works if MC parent-child relations are availabe.

Returns
pointer to leadig lepton (may be nullptr in case not found)

Definition at line 221 of file Evt.hh.

222  {
223  return const_cast<Trk *>(static_cast<const Evt &>(*this).leading_lepton() );
224  }
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:13
const Trk * leading_lepton() const
Get a const pointer to the first leading lepton from the MC track list.
Definition: Evt.hh:199
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:19
const Trk* Evt::get_parent_of ( const Trk child) const
inline

Get a const pointer to the (first) parent of the track 'child'.


This method return nullptr if no parent is found.

Parameters
childchild particle
Returns
pointer to parent

Definition at line 233 of file Evt.hh.

234  {
235  for (auto& t : mc_trks )
236  {
237  if (child.mother_id == t.id ) return &t;
238  }
239  return nullptr;
240  }
int mother_id
MC id of the parent particle.
Definition: Trk.hh:28
TTimeStamp t
UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00) ...
Definition: Evt.hh:32
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:46
Trk* Evt::get_parent_of ( const Trk child)
inline

Get a pointer ot the (first) parent of the track 'child'.


This method return nullptr if no parent is found.

Parameters
childchild particle
Returns
pointer to parent

Definition at line 251 of file Evt.hh.

252  {
253  return const_cast<Trk *>(static_cast<const Evt &>(*this).get_parent_of(child) );
254  }
const Trk * get_parent_of(const Trk &child) const
Get a const pointer to the (first) parent of the track &#39;child&#39;.
Definition: Evt.hh:233
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:13
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:19
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:742
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 Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
alias put_queue eval echo n
Definition: qlib.csh:19
std::vector< double > usr
user data
Definition: AAObject.hh:20

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 timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00)

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.

TTimeStamp Evt::mc_event_time

MC: true generation time (UTC) of the event, (default: 01 Jan 1970 00:00:00)

Definition at line 43 of file Evt.hh.

double Evt::mc_t

MC: time where the mc-event was put in the timeslice, since start of run (offset+frameidx*timeslice_duration)

Definition at line 44 of file Evt.hh.

std::vector<Hit> Evt::mc_hits

MC: list of MC truth hits.

Definition at line 45 of file Evt.hh.

std::vector<Trk> Evt::mc_trks

MC: list of MC truth tracks.

Definition at line 46 of file Evt.hh.

TString Evt::comment

user can use this as he/she likes

Definition at line 49 of file Evt.hh.

int Evt::index

user can use this as he/she likes

Definition at line 50 of file Evt.hh.

int Evt::flags

user can use this as he/she likes

Definition at line 51 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 171 of file AAObject.hh.


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