Auxiliary class to set-up Trk.
More...
#include <JSirene.hh>
|
| JTrk_t (const int id, const int type, const int mother_id, const Vec &pos, const Vec &dir, const double t, const double E) |
| Constructor.
|
|
void | read (const Trk &t) |
| Read track (useful in python).
|
|
void | write (Trk &t) const |
| Write track (useful in python).
|
|
std::string | name () const |
| Get the name of the MC particle type.
|
|
bool | is_primary () const |
| Check if this is a primary particle.
|
|
bool | is_finalstate () const |
| Test whether given particle is a final state inside the detector.
|
|
bool | is_neutrino () const |
| Check if this is a netrino.
|
|
bool | is_e () const |
| Check if this is an electron or positron.
|
|
bool | is_muon () const |
| Check if this is a muon.
|
|
bool | is_tau () const |
| Check if this is a tau.
|
|
bool | is_lepton () const |
| Check if this is a charged lepton.
|
|
bool | is_orphan () const |
| Check if this is an orphan (i.e.
|
|
std::vector< Trk * > | get_daughters (std::vector< Trk > &mctrks) |
| Get list of of pointers to tracks, all of which have their mother identifier set to identifier of this track.
|
|
void | print (std::ostream &out=std::cout) const |
| Print track.
|
|
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.
|
|
|
int | id |
| track identifier
|
|
Vec | pos |
| postion [m] of the track at time t
|
|
Vec | dir |
| track direction
|
|
double | t |
| track time [ns] (when the particle is at pos )
|
|
double | E |
| Energy [GeV] (either MC truth or reconstructed)
|
|
double | len |
| length, if applicable [m]
|
|
double | lik |
| likelihood or lambda value (for aafit, lambda)
|
|
int | type |
| MC: particle type in PDG encoding.
|
|
int | rec_type |
| identifier of the fitting algorithm/chain/strategy, see km3net-dataformat/definitions/reconstruction.csv
|
|
std::vector< int > | rec_stages |
| list of identifyers of succesfull fitting stages resulting in this track
|
|
int | status |
| MC status code, see km3net-dataformat/definitions/trkmembers.csv for values.
|
|
int | mother_id |
| MC id of the parent particle.
|
|
int | counter |
| used by CORSIKA7 MC generation to store interaction counters, see CORSIKA Userguide
|
|
std::vector< double > | fitinf |
| place to store additional fit info, see km3net-dataformat/definitions/fitparameters.csv
|
|
std::vector< int > | hit_ids |
| list of associated hit-ids (corresponds to Hit::id).
|
|
std::vector< double > | error_matrix |
| (NxN) error covariance matrix for fit parameters (stored as linear vector)
|
|
std::string | comment |
| use as you like
|
|
std::vector< double > | usr |
| user data
|
|
std::vector< std::string > | usr_names |
| user keys
|
|
TObject * | any |
| Pointer to "any" user data.
|
|
Auxiliary class to set-up Trk.
Definition at line 188 of file JSirene.hh.
◆ JTrk_t()
JSIRENE::JTrk_t::JTrk_t |
( |
const int | id, |
|
|
const int | type, |
|
|
const int | mother_id, |
|
|
const Vec & | pos, |
|
|
const Vec & | dir, |
|
|
const double | t, |
|
|
const double | E ) |
|
inline |
Constructor.
- Parameters
-
id | identifier |
type | type |
mother_id | mother identifier |
pos | position |
dir | direction |
t | time [ns] |
E | energy [GeV] |
Definition at line 202 of file JSirene.hh.
209 {
217 }
int type
MC: particle type in PDG encoding.
double E
Energy [GeV] (either MC truth or reconstructed)
double t
track time [ns] (when the particle is at pos )
int mother_id
MC id of the parent particle.
Vec pos
postion [m] of the track at time t
◆ read()
void Trk::read |
( |
const Trk & | t | ) |
|
|
inlineinherited |
Read track (useful in python).
- Parameters
-
Definition at line 50 of file Trk.hh.
◆ write()
void Trk::write |
( |
Trk & | t | ) |
const |
|
inlineinherited |
Write track (useful in python).
- Parameters
-
Definition at line 57 of file Trk.hh.
◆ name()
std::string Trk::name |
( |
| ) |
const |
|
inlineinherited |
Get the name of the MC particle type.
- Returns
- name
Definition at line 65 of file Trk.hh.
66 {
67 TParticlePDG* p = TDatabasePDG::Instance()->GetParticle(
type );
68 if (!p)
return "unnamed state ("+ std::to_string(
type)+
")";
69 return p->GetName();
70 }
◆ is_primary()
bool Trk::is_primary |
( |
| ) |
const |
|
inlineinherited |
Check if this is a primary particle.
- Returns
- true if primary; else false
Definition at line 77 of file Trk.hh.
78 {
80 }
int status
MC status code, see km3net-dataformat/definitions/trkmembers.csv for values.
static const int TRK_ST_PRIMARYCOSMIC
initial state cosmic ray ('track_primary' tag in evt files from corant).
static const int TRK_ST_PRIMARYNEUTRINO
initial state neutrino ('neutrino' tag in evt files from gseagen and genhen).
◆ is_finalstate()
bool Trk::is_finalstate |
( |
| ) |
const |
|
inlineinherited |
Test whether given particle is a final state inside the detector.
- Returns
- true if particle is final state; else false
Definition at line 87 of file Trk.hh.
88 {
90 }
static const int TRK_ST_FINALSTATE
for MC: the particle must be processed by detector simulation ('track_in' tag in evt files)....
◆ is_neutrino()
bool Trk::is_neutrino |
( |
| ) |
const |
|
inlineinherited |
Check if this is a netrino.
Note that its is checked if the PDG type is a nu-e, nu-mu or nu-tau.
- Returns
- true if neutrino; else false
Definition at line 99 of file Trk.hh.
◆ is_e()
Check if this is an electron or positron.
- Returns
- true if this is an electron or positron
Definition at line 109 of file Trk.hh.
110 {
111 return type == kElectron ||
type == kPositron;
112 }
◆ is_muon()
bool Trk::is_muon |
( |
| ) |
const |
|
inlineinherited |
Check if this is a muon.
Note that its is checked if the PDG type is a (anti-)muon.
- Returns
- true if muon; else false
Definition at line 121 of file Trk.hh.
122 {
123 return type == kMuonMinus ||
type == kMuonPlus;
124 }
◆ is_tau()
bool Trk::is_tau |
( |
| ) |
const |
|
inlineinherited |
Check if this is a tau.
Note that its is checked if the PDG type is a (anti-)tau.
- Returns
- true if tau; else false
Definition at line 133 of file Trk.hh.
134 {
135 return type == kTauMinus ||
type == kTauPlus;
136 }
◆ is_lepton()
bool Trk::is_lepton |
( |
| ) |
const |
|
inlineinherited |
Check if this is a charged lepton.
Note that its is checked if the PDG type is a (anti-)electron, (anti-)muon or (anti-)tua.
- Returns
- true if charged lepton; else false
Definition at line 145 of file Trk.hh.
146 {
148 }
bool is_tau() const
Check if this is a tau.
bool is_e() const
Check if this is an electron or positron.
bool is_muon() const
Check if this is a muon.
◆ is_orphan()
bool Trk::is_orphan |
( |
| ) |
const |
|
inlineinherited |
Check if this is an orphan (i.e.
no mother).
- Returns
- true if orphan; else false
Definition at line 155 of file Trk.hh.
156 {
158 }
static const int TRK_MOTHER_NONE
mother id of a particle if it has no parent
◆ get_daughters()
Get list of of pointers to tracks, all of which have their mother identifier set to identifier of this track.
- Parameters
-
mctrks | list of input tracks |
- Returns
- list of pointers to tracks
Definition at line 166 of file Trk.hh.
167 {
169
170 for(
auto&
t : mctrks )
171 {
172 if (
t.mother_id ==
id ) r.push_back( &
t );
173 }
174 return r;
175 }
◆ print()
void Trk::print |
( |
std::ostream & | out = std::cout | ) |
const |
|
inlineinherited |
Print track.
- Parameters
-
Definition at line 182 of file Trk.hh.
183 {
184 out <<
"Trk: id=" <<
id <<
" pos=";
pos.
print(out);
186 out <<
" t=" <<
t <<
" E=" <<
E <<
" pdg-type=" <<
type;
187 }
void print(std::ostream &out=std::cout) const
Print vector.
◆ idx()
int AAObject::idx |
( |
const std::string & | key | ) |
const |
|
inlineinherited |
Get index in user data of the item with given key.
- Parameters
-
- Returns
- index (-1 if key does not exists)
Definition at line 29 of file AAObject.hh.
30 {
34 }
std::vector< std::string > usr_names
user keys
◆ haveusr()
bool AAObject::haveusr |
( |
const std::string & | key | ) |
const |
|
inlineinherited |
Check availability of user data of the item with given key.
- Parameters
-
- 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.
◆ 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
-
- Returns
- index (-1 if key does not exists)
Definition at line 54 of file AAObject.hh.
55 {
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.
◆ 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
-
- 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
87 }
std::vector< double > usr
user data
◆ setusr()
void AAObject::setusr |
( |
const std::string & | key, |
|
|
double | value ) |
|
inlineinherited |
Set user data item with given key.
- Parameters
-
Definition at line 95 of file AAObject.hh.
96 {
98 if (i < 0)
99 {
101 {
102
104 }
105 else
106 {
107
109 }
110
112 usr.push_back( value );
113 }
114 else
115 {
117 }
118 }
◆ delusr()
bool AAObject::delusr |
( |
const std::string & | key | ) |
|
|
inlineinherited |
Remove (first) user data item with given key.
- Parameters
-
- Returns
- true if data have been removed; else false
Definition at line 126 of file AAObject.hh.
127 {
129 if ( i < 0 ) return false;
130
131 usr.erase (
usr.begin() + i );
133 return true;
134 }
◆ clearusr()
void AAObject::clearusr |
( |
| ) |
|
|
inlineinherited |
◆ printusr()
void AAObject::printusr |
( |
std::ostream & | out = std::cout | ) |
|
|
inlineinherited |
Print user data (i.e.
list of all pairs of keys and values).
- Parameters
-
Definition at line 150 of file AAObject.hh.
151 {
153
154 for (
unsigned i = 0; i <
n ; i++)
155 {
156 std::string name = "(unnamed)";
158 out << i << " \t " << name << " : \t ";
159 if ( i <
usr.size() ) out <<
usr[i] << std::endl;
160 else out << "(none)" << std::endl;
161 }
162 }
◆ id
track identifier
Definition at line 16 of file Trk.hh.
◆ pos
postion [m] of the track at time t
Definition at line 17 of file Trk.hh.
◆ dir
track direction
Definition at line 18 of file Trk.hh.
track time [ns] (when the particle is at pos )
Definition at line 19 of file Trk.hh.
Energy [GeV] (either MC truth or reconstructed)
Definition at line 20 of file Trk.hh.
◆ len
length, if applicable [m]
Definition at line 22 of file Trk.hh.
◆ lik
likelihood or lambda value (for aafit, lambda)
Definition at line 23 of file Trk.hh.
◆ type
MC: particle type in PDG encoding.
Definition at line 24 of file Trk.hh.
◆ rec_type
identifier of the fitting algorithm/chain/strategy, see km3net-dataformat/definitions/reconstruction.csv
Definition at line 25 of file Trk.hh.
◆ rec_stages
list of identifyers of succesfull fitting stages resulting in this track
Definition at line 26 of file Trk.hh.
◆ status
MC status code, see km3net-dataformat/definitions/trkmembers.csv for values.
Definition at line 28 of file Trk.hh.
◆ mother_id
MC id of the parent particle.
Definition at line 29 of file Trk.hh.
◆ counter
◆ fitinf
place to store additional fit info, see km3net-dataformat/definitions/fitparameters.csv
Definition at line 32 of file Trk.hh.
◆ hit_ids
list of associated hit-ids (corresponds to Hit::id).
Definition at line 33 of file Trk.hh.
◆ error_matrix
(NxN) error covariance matrix for fit parameters (stored as linear vector)
Definition at line 34 of file Trk.hh.
◆ comment
use as you like
Definition at line 35 of file Trk.hh.
◆ usr
◆ usr_names
◆ any
Pointer to "any" user data.
Definition at line 171 of file AAObject.hh.
The documentation for this struct was generated from the following file: