Jpp 20.0.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
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 ()
 Default constructor.
 
void print (std::ostream &out=std::cout) const
 Print event.
 
void clear ()
 Reset event.
 
void clear_hits ()
 Clear the hit vectors and all the references to hits in the tracks.
 
std::vector< const Trk * > primary_trks () const
 Return a vector with const pointers to the tracks that are 'primary'.
 
std::vector< Trk * > primary_trks ()
 Return a vector of pointers to tracks that are 'primary'.
 
const Trkneutrino () const
 Get a const pointer to the (first) neutrino from the MC track list.
 
Trkneutrino ()
 Get a pointer to the (first) neutrino from the MC track list.
 
const Trkprimary_neutrino () const
 Get a const pointer to primary neutrino from the MC track list.
 
Trkprimary_neutrino ()
 Get a pointer to primary neutrino from the MC track list.
 
const Trkleading_lepton () const
 Get a const pointer to the first leading lepton from the MC track list.
 
Trkleading_lepton ()
 Get a pointer to leading lepton from the MC track list.
 
const Trkget_parent_of (const Trk &child) const
 Get a const pointer to the (first) parent of the track 'child'.
 
Trkget_parent_of (const Trk &child)
 Get a pointer ot the (first) parent of the track 'child'.
 
int idx (const std::string &key) const
 Get index in user data of the item with given key.
 
bool haveusr (const std::string &key) const
 Check availability of user data of the item with given key.
 
int idxusr_checked (const std::string &key) const
 Get index in user data of the item with given key.
 
double getusr (const std::string &key) const
 Get user data item with given key.
 
void setusr (const std::string &key, double value)
 Set user data item with given key.
 
bool delusr (const std::string &key)
 Remove (first) user data item with given key.
 
void clearusr ()
 Clear user data.
 
void printusr (std::ostream &out=std::cout)
 Print user data (i.e.
 

Static Public Member Functions

static void actionAtFileOpen (int version)
 Action method at file open.
 

Public Attributes

int id
 offline event identifier
 
int det_id
 detector identifier from DAQ
 
int mc_id
 identifier of the MC event (as found in ascii or antcc file).
 
int run_id
 DAQ run identifier.
 
int mc_run_id
 MC run identifier.
 
int frame_index
 from the raw data
 
ULong64_t trigger_mask
 trigger mask from raw data (i.e. the trigger bits)
 
ULong64_t trigger_counter
 trigger counter
 
unsigned int overlays
 number of overlaying triggered events
 
TTimeStamp t
 UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00)
 
uuid_t header_uuid
 UUID of header containing the event-weight information.
 
std::vector< Hithits
 list of hits
 
std::vector< Trktrks
 list of reconstructed tracks (can be several because of prefits,showers, etc).
 
std::vector< double > w
 MC: Weights w[0]=w1, w[1]=w2, w[2]=w3 (see e.g. Tag list or km3net-dataformat/definitions)
 
std::vector< double > w2list
 MC: factors that make up w[1]=w2 (see e.g. Tag list or km3net-dataformat/definitions)
 
std::vector< double > w3list
 MC: atmospheric flux information.
 
TTimeStamp mc_event_time
 MC: true generation time (UTC) of the event, (default: 01 Jan 1970 00:00:00)
 
double mc_t
 MC: time where the mc-event was put in the timeslice, since start of run (offset+frameidx*timeslice_duration)
 
std::vector< Hitmc_hits
 MC: list of MC truth hits.
 
std::vector< Trkmc_trks
 MC: list of MC truth tracks.
 
TString comment
 user can use this as he/she likes
 
int index
 user can use this as he/she likes
 
int flags
 user can use this as he/she likes
 
std::vector< double > usr
 user data
 
std::vector< std::string > usr_names
 user keys
 
TObjectany
 Pointer to "any" user data.
 

Static Public Attributes

static int ROOT_IO_VERSION = -1
 Streamer version as obtained from ROOT file.
 

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 20 of file Evt.hh.

Constructor & Destructor Documentation

◆ Evt()

Evt::Evt ( )
inline

Default constructor.

Definition at line 60 of file Evt.hh.

60 :
61 id(0), det_id(0), mc_id(0), run_id(0), mc_run_id(0), frame_index(0),
63 overlays(0), t(0), mc_event_time(0), mc_t(0), index(0), flags(0)
64 {
65 uuid_clear(this->header_uuid);
66 }
int mc_id
identifier of the MC event (as found in ascii or antcc file).
Definition Evt.hh:24
int frame_index
from the raw data
Definition Evt.hh:29
int run_id
DAQ run identifier.
Definition Evt.hh:26
ULong64_t trigger_mask
trigger mask from raw data (i.e. the trigger bits)
Definition Evt.hh:30
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:47
int index
user can use this as he/she likes
Definition Evt.hh:53
int mc_run_id
MC run identifier.
Definition Evt.hh:27
int flags
user can use this as he/she likes
Definition Evt.hh:54
int det_id
detector identifier from DAQ
Definition Evt.hh:23
ULong64_t trigger_counter
trigger counter
Definition Evt.hh:31
int id
offline event identifier
Definition Evt.hh:22
TTimeStamp mc_event_time
MC: true generation time (UTC) of the event, (default: 01 Jan 1970 00:00:00)
Definition Evt.hh:46
TTimeStamp t
UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00)
Definition Evt.hh:33
uuid_t header_uuid
UUID of header containing the event-weight information.
Definition Evt.hh:35
unsigned int overlays
number of overlaying triggered events
Definition Evt.hh:32

Member Function Documentation

◆ print()

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

Print event.

Parameters
outoutput stream

Definition at line 74 of file Evt.hh.

75 {
76 out << "Evt: id=" << id <<
77 " run_id=" << run_id <<
78 " #hits=" << hits.size() <<
79 " #mc_hits=" << mc_hits.size() <<
80 " #trks=" << trks.size() <<
81 " #mc_trks=" << mc_trks.size() << std::endl;
82 }
std::vector< Hit > hits
list of hits
Definition Evt.hh:38
std::vector< Hit > mc_hits
MC: list of MC truth hits.
Definition Evt.hh:48
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition Evt.hh:49
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
Definition Evt.hh:39

◆ clear()

void Evt::clear ( )
inline

Reset event.

Definition at line 88 of file Evt.hh.

89 {
90 *this = Evt();
91 }
Evt()
Default constructor.
Definition Evt.hh:60

◆ clear_hits()

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 }

◆ primary_trks() [1/2]

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 114 of file Evt.hh.

115 {
117 for (auto& t : mc_trks )
118 {
119 if ( t.is_primary() ) r.push_back(&t);
120 }
121 return r;
122 }

◆ primary_trks() [2/2]

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 131 of file Evt.hh.

132 {
134 for (auto& t : mc_trks )
135 {
136 if ( t.is_primary() ) r.push_back(&t);
137 }
138 return r;
139 }

◆ neutrino() [1/2]

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 147 of file Evt.hh.

148 {
149 for (auto& t : mc_trks )
150 {
151 if ( t.is_neutrino() ) return &t;
152 }
153 return nullptr;
154 }

◆ neutrino() [2/2]

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 162 of file Evt.hh.

163 {
164 // see Effective C++, Scott Meyers, ISBN-13: 9780321334879.
165 return const_cast<Trk *>(static_cast<const Evt &>(*this).neutrino() );
166 }
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
const Trk * neutrino() const
Get a const pointer to the (first) neutrino from the MC track list.
Definition Evt.hh:147
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition Trk.hh:15

◆ primary_neutrino() [1/2]

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 176 of file Evt.hh.

177 {
178 for ( auto& t : mc_trks )
179 {
180 if ( t.is_neutrino() and t.is_primary() ) return &t;
181 }
182 return nullptr;
183 }

◆ primary_neutrino() [2/2]

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 192 of file Evt.hh.

193 {
194 return const_cast<Trk *>(static_cast<const Evt &>(*this).primary_neutrino() );
195 }
const Trk * primary_neutrino() const
Get a const pointer to primary neutrino from the MC track list.
Definition Evt.hh:176

◆ leading_lepton() [1/2]

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 206 of file Evt.hh.

207 {
208 const Trk* nu = primary_neutrino();
209 if (!nu) return nullptr;
210
211 for (auto& t : mc_trks )
212 {
213 if ( t.is_lepton() &&
214 t.mother_id == nu->id &&
215 !t.is_orphan() ) return &t;
216 }
217 return nullptr;
218 }
int id
track identifier
Definition Trk.hh:16

◆ leading_lepton() [2/2]

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 228 of file Evt.hh.

229 {
230 return const_cast<Trk *>(static_cast<const Evt &>(*this).leading_lepton() );
231 }
const Trk * leading_lepton() const
Get a const pointer to the first leading lepton from the MC track list.
Definition Evt.hh:206

◆ get_parent_of() [1/2]

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 240 of file Evt.hh.

241 {
242 for (auto& t : mc_trks )
243 {
244 if (child.mother_id == t.id ) return &t;
245 }
246 return nullptr;
247 }
int mother_id
MC id of the parent particle.
Definition Trk.hh:29

◆ get_parent_of() [2/2]

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 258 of file Evt.hh.

259 {
260 return const_cast<Trk *>(static_cast<const Evt &>(*this).get_parent_of(child) );
261 }
const Trk * get_parent_of(const Trk &child) const
Get a const pointer to the (first) parent of the track 'child'.
Definition Evt.hh:240

◆ actionAtFileOpen()

static void Evt::actionAtFileOpen ( int version)
inlinestatic

Action method at file open.

Parameters
versionversion

Definition at line 269 of file Evt.hh.

270 {
271 ROOT_IO_VERSION = version;
272 }
static int ROOT_IO_VERSION
Streamer version as obtained from ROOT file.
Definition Evt.hh:274

◆ idx()

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

◆ haveusr()

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

◆ idxusr_checked()

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.
General exception.
Definition Exception.hh:13

◆ getusr()

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 }
std::vector< double > usr
user data
Definition AAObject.hh:20

◆ setusr()

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 }

◆ delusr()

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 }

◆ clearusr()

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 }

◆ printusr()

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 }
const int n
Definition JPolint.hh:791

Member Data Documentation

◆ id

int Evt::id

offline event identifier

Definition at line 22 of file Evt.hh.

◆ det_id

int Evt::det_id

detector identifier from DAQ

Definition at line 23 of file Evt.hh.

◆ mc_id

int Evt::mc_id

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

Definition at line 24 of file Evt.hh.

◆ run_id

int Evt::run_id

DAQ run identifier.

Definition at line 26 of file Evt.hh.

◆ mc_run_id

int Evt::mc_run_id

MC run identifier.

Definition at line 27 of file Evt.hh.

◆ frame_index

int Evt::frame_index

from the raw data

Definition at line 29 of file Evt.hh.

◆ trigger_mask

ULong64_t Evt::trigger_mask

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

Definition at line 30 of file Evt.hh.

◆ trigger_counter

ULong64_t Evt::trigger_counter

trigger counter

Definition at line 31 of file Evt.hh.

◆ overlays

unsigned int Evt::overlays

number of overlaying triggered events

Definition at line 32 of file Evt.hh.

◆ t

TTimeStamp Evt::t

UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00)

Definition at line 33 of file Evt.hh.

◆ header_uuid

uuid_t Evt::header_uuid

UUID of header containing the event-weight information.

Definition at line 35 of file Evt.hh.

◆ hits

std::vector<Hit> Evt::hits

list of hits

Definition at line 38 of file Evt.hh.

◆ trks

std::vector<Trk> Evt::trks

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

Definition at line 39 of file Evt.hh.

◆ w

std::vector<double> Evt::w

MC: Weights w[0]=w1, w[1]=w2, w[2]=w3 (see e.g. Tag list or km3net-dataformat/definitions)

Definition at line 42 of file Evt.hh.

◆ w2list

std::vector<double> Evt::w2list

MC: factors that make up w[1]=w2 (see e.g. Tag list or km3net-dataformat/definitions)

Definition at line 43 of file Evt.hh.

◆ w3list

std::vector<double> Evt::w3list

MC: atmospheric flux information.

Definition at line 44 of file Evt.hh.

◆ mc_event_time

TTimeStamp Evt::mc_event_time

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

Definition at line 46 of file Evt.hh.

◆ mc_t

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 47 of file Evt.hh.

◆ mc_hits

std::vector<Hit> Evt::mc_hits

MC: list of MC truth hits.

Definition at line 48 of file Evt.hh.

◆ mc_trks

std::vector<Trk> Evt::mc_trks

MC: list of MC truth tracks.

Definition at line 49 of file Evt.hh.

◆ comment

TString Evt::comment

user can use this as he/she likes

Definition at line 52 of file Evt.hh.

◆ index

int Evt::index

user can use this as he/she likes

Definition at line 53 of file Evt.hh.

◆ flags

int Evt::flags

user can use this as he/she likes

Definition at line 54 of file Evt.hh.

◆ ROOT_IO_VERSION

int Evt::ROOT_IO_VERSION = -1
static

Streamer version as obtained from ROOT file.

Definition at line 274 of file Evt.hh.

◆ usr

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

user data

Definition at line 20 of file AAObject.hh.

◆ usr_names

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

user keys

Definition at line 21 of file AAObject.hh.

◆ any

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 files: