The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
More...
#include <Trk.hh>
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition at line 12 of file Trk.hh.
◆ Trk()
Default constructor.
Definition at line 37 of file Trk.hh.
◆ read()
void Trk::read |
( |
const Trk & |
t | ) |
|
|
inline |
Read track (useful in python).
- Parameters
-
Definition at line 44 of file Trk.hh.
◆ write()
void Trk::write |
( |
Trk & |
t | ) |
const |
|
inline |
Write track (useful in python).
- Parameters
-
Definition at line 51 of file Trk.hh.
◆ distance_to() [1/2]
double Trk::distance_to |
( |
const Trk & |
t | ) |
const |
|
inline |
Get distance of closes approach to another track.
- Parameters
-
- Returns
- distance
Definition at line 60 of file Trk.hh.
64 const double d = (
pos -
t.pos ).dot(
v );
◆ distance_to() [2/2]
double Trk::distance_to |
( |
const Vec & |
p = Vec() | ) |
const |
|
inline |
Get distance to given position.
- Parameters
-
- Returns
- distance
Definition at line 74 of file Trk.hh.
77 double dz =
v.dot(
dir);
78 return v.dot(
v) - dz*dz;
◆ name()
std::string Trk::name |
( |
| ) |
const |
|
inline |
Get the name of the MC particle type.
- Returns
- name
Definition at line 86 of file Trk.hh.
88 TParticlePDG* p = TDatabasePDG::Instance()->GetParticle(
type );
◆ is_primary()
bool Trk::is_primary |
( |
| ) |
const |
|
inline |
Check if this is a primary particle (i.e.
has not mother).
- Returns
- true if primary; else false
Definition at line 98 of file Trk.hh.
◆ is_neutrino()
bool Trk::is_neutrino |
( |
| ) |
const |
|
inline |
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 110 of file Trk.hh.
112 const unsigned t = abs(
type);
113 return t == 12 ||
t == 14 ||
t == 16;
◆ is_lepton()
bool Trk::is_lepton |
( |
| ) |
const |
|
inline |
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 123 of file Trk.hh.
125 const unsigned t = abs(
type);
126 return t == 11 ||
t == 13 ||
t == 15;
◆ is_muon()
bool Trk::is_muon |
( |
| ) |
const |
|
inline |
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 136 of file Trk.hh.
136 {
return abs(
type)==13; }
◆ is_orphan()
bool Trk::is_orphan |
( |
| ) |
const |
|
inline |
Check if this is an orphan.
If a particle's (intermediate) mother has been deleted from the track-list (the 3rd digit of status==1).
- Returns
- true if orphan; else false
Definition at line 145 of file Trk.hh.
147 return (
status / 100) % 10 == 1;
◆ 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 156 of file Trk.hh.
160 for(
auto&
t : mctrks )
162 if (
t.mother_id ==
id )
r.push_back( &
t );
◆ print()
void Trk::print |
( |
std::ostream & |
out | ) |
const |
|
inline |
Print track.
- Parameters
-
Definition at line 172 of file Trk.hh.
174 out <<
"Trk: id=" <<
id <<
" pos=";
pos.
print(out);
176 out <<
" t=" <<
t <<
" E=" <<
E <<
" pdg-type=" <<
type;
◆ 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.
◆ 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.
44 return idx( key ) >= 0;
◆ 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.
59 THROW(
Exception,
"No user data for key " << key <<
" in aanet object of type " <<
this -> ClassName());
◆ 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.
74 const int i =
idx( key );
78 THROW(
Exception,
"No user data for key " << key <<
" in aanet object of type " <<
this -> ClassName());
81 if (
unsigned(i) >=
usr.size() )
83 THROW(
Exception,
"Warning: inconsistent user data " << i <<
" >= " <<
usr.size());
◆ 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.
112 usr.push_back( value );
◆ 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.
129 if ( i < 0 )
return false;
131 usr.erase (
usr.begin() + i );
◆ 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.
154 for (
unsigned i=0; i<
n ;i++)
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;
◆ __str__()
const char* AAObject::__str__ |
( |
| ) |
const |
|
inlineinherited |
Get class name.
- Returns
- class name
Definition at line 175 of file AAObject.hh.
175 {
return Class_Name(); }
◆ id
track identifier
Definition at line 14 of file Trk.hh.
◆ pos
postion of the track at time t
Definition at line 15 of file Trk.hh.
◆ dir
track direction
Definition at line 16 of file Trk.hh.
track time (when the particle is at pos )
Definition at line 17 of file Trk.hh.
Energy (either MC truth or reconstructed)
Definition at line 18 of file Trk.hh.
◆ len
length, if applicable
Definition at line 20 of file Trk.hh.
◆ lik
likelihood or lambda value (for aafit, lambda)
Definition at line 21 of file Trk.hh.
◆ type
MC: particle type in PDG encoding.
Definition at line 22 of file Trk.hh.
◆ rec_type
identifyer for the overall fitting algorithm/chain/strategy
Definition at line 23 of file Trk.hh.
◆ rec_stages
list of identifyers of succesfull fitting stages resulting in this track
Definition at line 24 of file Trk.hh.
◆ status
MC status code.
Definition at line 26 of file Trk.hh.
◆ mother_id
MC id of the parent particle.
Definition at line 27 of file Trk.hh.
◆ fitinf
◆ hit_ids
list of associated hit-ids (corresponds to Hit::id).
Definition at line 30 of file Trk.hh.
◆ error_matrix
(5x5) error covariance matrix (stored as linear vector)
Definition at line 31 of file Trk.hh.
◆ comment
use as you like
Definition at line 32 of file Trk.hh.
◆ usr
◆ usr_names
◆ any
Pointer to "any" user data.
Definition at line 177 of file AAObject.hh.
The documentation for this struct was generated from the following file: