Belle II Software light-2406-ragdoll
MCParticleGraph::GraphParticle Class Reference

Class to represent Particle data in graph. More...

#include <MCParticleGraph.h>

Inheritance diagram for MCParticleGraph::GraphParticle:
Collaboration diagram for MCParticleGraph::GraphParticle:

Public Types

enum  StatusBit {
  c_PrimaryParticle = 1 << 0 ,
  c_StableInGenerator = 1 << 1 ,
  c_LeftDetector = 1 << 2 ,
  c_StoppedInDetector = 1 << 3 ,
  c_IsVirtual = 1 << 4 ,
  c_Initial = 1 << 5 ,
  c_IsISRPhoton = 1 << 6 ,
  c_IsFSRPhoton = 1 << 7 ,
  c_IsPHOTOSPhoton = 1 << 8 ,
  c_IsRadiativePhoton = c_IsISRPhoton | c_IsFSRPhoton | c_IsPHOTOSPhoton
}
 Exception is thrown if the requested index for the last child is out of range. More...
 

Public Member Functions

GraphParticleoperator= (const MCParticle &particle)
 Assign the values of an existing MCParticle to this GraphParticle.
 
void decaysInto (GraphParticle &daughter)
 Tells the graph that this particle decays into daughter.
 
void comesFrom (GraphParticle &mother)
 Tells the graph that this particle is a decay product of mother.
 
void setFirstDaughter (int daughter)
 Set the 1-based index of the first daughter, 0 means no daughters.
 
void setLastDaughter (int daughter)
 Set the 1-based index of the last daughter, 0 means no daughters.
 
void setIgnore (bool ignore=true)
 Set or remove the ignore flag.
 
bool getIgnore () const
 Get the ignore flag.
 
void setTrackID (int trackID)
 Set the track ID for the particle.
 
int getTrackID () const
 Returns the track ID assigned to this MCParticle.
 
int getPDG () const
 Return PDG code of particle.
 
unsigned int getStatus (unsigned short int bitmask=USHRT_MAX) const
 Return status code of particle.
 
bool hasStatus (unsigned short int bitmask) const
 Return if specific status bit is set.
 
float getMass () const
 Return the particle mass in GeV.
 
float getCharge () const
 Return the particle charge defined in TDatabasePDG.
 
float getEnergy () const
 Return particle energy in GeV.
 
bool hasValidVertex () const
 Indication whether vertex and time information is useful or just default.
 
float getProductionTime () const
 Return production time in ns.
 
float getDecayTime () const
 Return the decay time in ns.
 
float getLifetime () const
 Return the lifetime in ns.
 
ROOT::Math::XYZVector getVertex () const
 Return production vertex position, shorthand for getProductionVertex().
 
ROOT::Math::XYZVector getProductionVertex () const
 Return production vertex position.
 
ROOT::Math::XYZVector getMomentum () const
 Return momentum.
 
ROOT::Math::PxPyPzEVector get4Vector () const
 Return 4Vector of particle.
 
ROOT::Math::XYZVector getDecayVertex () const
 Return decay vertex.
 
int getIndex () const
 Get 1-based index of the particle in the corresponding MCParticle list.
 
int getArrayIndex () const
 Get 0-based index of the particle in the corresponding MCParticle list.
 
int getFirstDaughter () const
 Get 1-based index of first daughter, 0 if no daughters.
 
int getLastDaughter () const
 Get 1-based index of last daughter, 0 if no daughters.
 
std::vector< Belle2::MCParticle * > getDaughters () const
 Get vector of all daughter particles, empty vector if none.
 
const MCParticlegetDaughter (int i) const
 Return i-th daughter.
 
int getNDaughters () const
 Return number of daughter MCParticles.
 
MCParticlegetMother () const
 Returns a pointer to the mother particle.
 
int getSecondaryPhysicsProcess () const
 Returns the physics process type of a secondary particle.
 
Const::DetectorSet getSeenInDetector () const
 Return the seen-in flags of the entire Belle II subdetectors for an MC particle.
 
bool hasSeenInDetector (Const::DetectorSet set) const
 Return if the seen-in flag for a specific subdetector is set or not.
 
bool isVirtual () const
 Check if particle is virtual.
 
bool isInitial () const
 Check if particle is an initial particle such as ISR.
 
bool isPrimaryParticle () const
 Check if particle is a primary particle which was created by the generator (and not, for example material interaction)
 
void setPDG (int pdg)
 Set PDG code of the particle.
 
void setMassFromPDG ()
 Sets the mass for the particle from the particle's PDG code.
 
void setStatus (unsigned short int status)
 Set Status code for the particle.
 
void addStatus (unsigned short int bitmask)
 Add bitmask to current status.
 
void removeStatus (unsigned short int bitmask)
 Remove bitmask from current status.
 
void setMass (float mass)
 Set particle mass.
 
void setEnergy (float energy)
 Set energy.
 
void setValidVertex (bool valid)
 Set indication wether vertex and time information is valid or just default.
 
void setProductionTime (float time)
 Set production time.
 
void setDecayTime (float time)
 Set decay time.
 
void setProductionVertex (const ROOT::Math::XYZVector &vertex)
 Set production vertex position.
 
void setProductionVertex (float x, float y, float z)
 Set production vertex position.
 
void setMomentum (const ROOT::Math::XYZVector &momentum)
 Set particle momentum.
 
void setMomentum (float px, float py, float pz)
 Set particle momentum.
 
void set4Vector (const ROOT::Math::PxPyPzEVector &p4)
 Sets the 4Vector of particle.
 
void setDecayVertex (const ROOT::Math::XYZVector &vertex)
 Set decay vertex.
 
void setDecayVertex (float x, float y, float z)
 Set decay vertex.
 
void setSecondaryPhysicsProcess (int physicsProcess)
 Sets the physics process type of a secondary particle.
 
void setSeenInDetector (Const::DetectorSet set)
 Set the seen-in flags for the entire Belle II subdetectors for an Monte Carlo particle.
 
void addSeenInDetector (Const::DetectorSet set)
 Flag/Add a bit if the MC particle is seen in a specific subdetector.
 
void removeSeenInDetector (Const::DetectorSet set)
 Unflag/Remove the bit if the MC particle is not seen in a specific subdetector.
 
void fixParticleList () const
 Search the DataStore for the corresponding MCParticle array.
 
void setVirtual ()
 Set particle to virtual.
 
void setInitial ()
 Set particle to initial.
 
virtual std::string getName () const override
 Return name of this particle.
 
virtual std::string getInfoHTML () const override
 Return a short summary of this object's contents in HTML format.
 
const MCParticlegetParticleFromGeneralizedIndexString (const std::string &generalizedIndex) const
 Explores the decay tree of the MC particle and returns the (grand^n)daughter identified by a generalized index.
 
void addRelationTo (const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
 Add a relation from this object to another object (with caching).
 
void addRelationTo (const TObject *object, float weight=1.0, const std::string &namedRelation="") const
 Add a relation from this object to another object (no caching, can be quite slow).
 
void copyRelations (const RelationsInterface< BASE > *sourceObj)
 Copies all relations of sourceObj (pointing from or to sourceObj) to this object (including weights).
 
template<class TO >
RelationVector< TO > getRelationsTo (const std::string &name="", const std::string &namedRelation="") const
 Get the relations that point from this object to another store array.
 
template<class FROM >
RelationVector< FROM > getRelationsFrom (const std::string &name="", const std::string &namedRelation="") const
 Get the relations that point from another store array to this object.
 
template<class T >
RelationVector< T > getRelationsWith (const std::string &name="", const std::string &namedRelation="") const
 Get the relations between this object and another store array.
 
template<class TO >
TO * getRelatedTo (const std::string &name="", const std::string &namedRelation="") const
 Get the object to which this object has a relation.
 
template<class FROM >
FROM * getRelatedFrom (const std::string &name="", const std::string &namedRelation="") const
 Get the object from which this object has a relation.
 
template<class T >
T * getRelated (const std::string &name="", const std::string &namedRelation="") const
 Get the object to or from which this object has a relation.
 
template<class TO >
std::pair< TO *, float > getRelatedToWithWeight (const std::string &name="", const std::string &namedRelation="") const
 Get first related object & weight of relation pointing to an array.
 
template<class FROM >
std::pair< FROM *, float > getRelatedFromWithWeight (const std::string &name="", const std::string &namedRelation="") const
 Get first related object & weight of relation pointing from an array.
 
template<class T >
std::pair< T *, float > getRelatedWithWeight (const std::string &name="", const std::string &namedRelation="") const
 Get first related object & weight of relation pointing from/to an array.
 
std::string getInfo () const
 Return a short summary of this object's contents in raw text format.
 
std::string getArrayName () const
 Get name of array this object is stored in, or "" if not found.
 

Protected Member Functions

 ClassDefOverride (MCParticle, 5)
 A Class to store the Monte Carlo particle information.
 
TClonesArray * getArrayPointer () const
 Returns the pointer to the raw DataStore array holding this object (protected since these arrays are easy to misuse).
 

Protected Attributes

TClonesArray * m_plist
 Internal pointer to DataStore Array containing particles belonging to this collection.
 
int m_index
 transient pointer to particle list
 
unsigned short int m_status
 transient 1-based index of particle
 
int m_pdg
 PDG-Code of the particle.
 
float m_mass
 mass of the particle
 
float m_energy
 energy of the particle
 
float m_momentum_x
 momentum of particle, x component
 
float m_momentum_y
 momentum of particle, y component
 
float m_momentum_z
 momentum of particle, z component
 
bool m_validVertex
 indication wether vertex and time information is useful or just default
 
float m_productionTime
 production time
 
float m_productionVertex_x
 production vertex of particle, x component
 
float m_productionVertex_y
 production vertex of particle, y component
 
float m_productionVertex_z
 production vertex of particle, z component
 
float m_decayTime
 decay time
 
float m_decayVertex_x
 decay vertex of particle, x component
 
float m_decayVertex_y
 decay vertex of particle, y component
 
float m_decayVertex_z
 decay vertex of particle, z component
 
int m_mother
 1-based index of the mother particle
 
int m_firstDaughter
 1-based index of first daughter particle in collection, 0 if no daughters
 
int m_lastDaughter
 1-based index of last daughter particle in collection, 0 if no daughters
 
int m_secondaryPhysicsProcess
 physics process type of a secondary particle
 
Const::DetectorSet m_seenIn
 Each bit is a seen-in flag for the corresoponding subdetector of Belle II.
 

Static Protected Attributes

static const double c_epsilon = 10e-7
 limit of precision for two doubles to be the same.
 

Private Member Functions

 GraphParticle ()=delete
 No default constructor.
 
 GraphParticle (const GraphParticle &)=delete
 No copy constructor.
 
 GraphParticle (TClonesArray *, const MCParticle &)
 Hide MCParticle "almost copy" constructor.
 
 GraphParticle (MCParticleGraph *graph, unsigned int vertexId)
 Internally used constructor.
 
void setIndex (int index)
 Set the 1-based index of the particle.
 
 ClassDef (RelationsInterface, 0)
 defines interface for accessing relations of objects in StoreArray.
 

Private Attributes

MCParticleGraphm_graph {0}
 internal pointer to the graph this particle belongs to
 
unsigned int m_vertexId {0}
 vertex id in the graph
 
bool m_ignore {false}
 ignore particle when writing MCParticle list ?
 
bool m_primary {true}
 Is this a primary particle ?
 
int m_trackID {0}
 The track ID from geant4 that created this particle.
 
DataStore::StoreEntrym_cacheDataStoreEntry
 Cache of the data store entry to which this object belongs.
 
int m_cacheArrayIndex
 Cache of the index in the TClonesArray to which this object belongs.
 

Friends

class MCParticleGraph
 
class ParticleSorter
 

Detailed Description

Class to represent Particle data in graph.

This is an extended version of the MCParticle class, allowing to set index and daughter indices as well as adding decay information. Use MCParticleGraph::addParticle() to add a new particle to the graph.

Definition at line 75 of file MCParticleGraph.h.

Member Enumeration Documentation

◆ StatusBit

enum StatusBit
inherited

Exception is thrown if the requested index for the last child is out of range.

Exception is thrown if no pointer to the particle list was set. Exception is thrown if the pdg value of the MCParticle is not known to the internal database (TDatabasePDG). The status information for the MCParticle.

Enumerator
c_PrimaryParticle 

bit 0: Particle is primary particle.

For example, All the particles from the generator.

c_StableInGenerator 

bit 1: Particle is stable, i.e., not decaying in the generator.


c_LeftDetector 

bit 2: Particle left the detector (the simulation volume).

c_StoppedInDetector 

bit 3: Particle was stopped in the detector (the simulation volume).

c_IsVirtual 

bit 4: Particle is virtual and not going to Geant4.

Exchange boson, off-shell, unknown to Geant4, etc.

c_Initial 

bit 5: Particle is initial such as e+ or e- and not going to Geant4

c_IsISRPhoton 

bit 6: Particle is from initial state radiation

c_IsFSRPhoton 

bit 7: Particle is from finial state radiation

c_IsPHOTOSPhoton 

bit 8: Particle is an radiative photon from PHOTOS

c_IsRadiativePhoton 

combined flag to test whether the particle is radiative

Definition at line 45 of file MCParticle.h.

45 {
47 c_PrimaryParticle = 1 << 0,
49 c_StableInGenerator = 1 << 1,
51 c_LeftDetector = 1 << 2,
53 c_StoppedInDetector = 1 << 3,
55 c_IsVirtual = 1 << 4,
57 c_Initial = 1 << 5,
59 c_IsISRPhoton = 1 << 6,
61 c_IsFSRPhoton = 1 << 7,
63 c_IsPHOTOSPhoton = 1 << 8,
66 };
@ c_IsFSRPhoton
bit 7: Particle is from finial state radiation
Definition: MCParticle.h:61
@ c_Initial
bit 5: Particle is initial such as e+ or e- and not going to Geant4
Definition: MCParticle.h:57
@ c_IsPHOTOSPhoton
bit 8: Particle is an radiative photon from PHOTOS
Definition: MCParticle.h:63
@ c_IsRadiativePhoton
combined flag to test whether the particle is radiative
Definition: MCParticle.h:65
@ c_PrimaryParticle
bit 0: Particle is primary particle.
Definition: MCParticle.h:47
@ c_LeftDetector
bit 2: Particle left the detector (the simulation volume).
Definition: MCParticle.h:51
@ c_IsVirtual
bit 4: Particle is virtual and not going to Geant4.
Definition: MCParticle.h:55
@ c_StableInGenerator
bit 1: Particle is stable, i.e., not decaying in the generator.
Definition: MCParticle.h:49
@ c_StoppedInDetector
bit 3: Particle was stopped in the detector (the simulation volume).
Definition: MCParticle.h:53
@ c_IsISRPhoton
bit 6: Particle is from initial state radiation
Definition: MCParticle.h:59

Constructor & Destructor Documentation

◆ GraphParticle() [1/3]

GraphParticle ( )
privatedelete

No default constructor.

This class gets instantiated by MCParticleGraph::addParticle()

◆ GraphParticle() [2/3]

GraphParticle ( TClonesArray *  ,
const MCParticle  
)
inlineprivate

Hide MCParticle "almost copy" constructor.

Definition at line 172 of file MCParticleGraph.h.

172{}

◆ GraphParticle() [3/3]

GraphParticle ( MCParticleGraph graph,
unsigned int  vertexId 
)
inlineprivate

Internally used constructor.

Create a new Particle with given index and a pointer to the containing graph.

Parameters
graphPointer to the graph the particle is part of.
vertexIdThe vertex id of the particle in the graph.

Definition at line 180 of file MCParticleGraph.h.

180 : MCParticle(),
181 m_graph(graph), m_vertexId(vertexId)
182 {
183 //The pointer to the TClonesArray the MCParticle is stored in makes no
184 //sense inside the Graph so we set it to some invalid value to avoid
185 //the MCParticle::fixParticleList() to complain
186 m_plist = (TClonesArray*) - 1;
187 }
unsigned int m_vertexId
vertex id in the graph
MCParticleGraph * m_graph
internal pointer to the graph this particle belongs to
MCParticle()
Default constructor for ROOT.
Definition: MCParticle.h:72
TClonesArray * m_plist
Internal pointer to DataStore Array containing particles belonging to this collection.
Definition: MCParticle.h:532

Member Function Documentation

◆ addRelationTo() [1/2]

void addRelationTo ( const RelationsInterface< BASE > *  object,
float  weight = 1.0,
const std::string &  namedRelation = "" 
) const
inlineinherited

Add a relation from this object to another object (with caching).

Parameters
objectThe object to which the relation should point.
weightThe weight of the relation.
namedRelationAdditional name for the relation, or "" for the default naming

Definition at line 142 of file RelationsObject.h.

143 {
144 if (object)
146 object, object->m_cacheDataStoreEntry, object->m_cacheArrayIndex, weight, namedRelation);
147 }
void addRelation(const TObject *fromObject, StoreEntry *&fromEntry, int &fromIndex, const TObject *toObject, StoreEntry *&toEntry, int &toIndex, float weight, const std::string &namedRelation)
Add a relation from an object in a store array to another object in a store array.
Definition: DataStore.cc:492
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54
DataStore::StoreEntry * m_cacheDataStoreEntry
Cache of the data store entry to which this object belongs.
int m_cacheArrayIndex
Cache of the index in the TClonesArray to which this object belongs.

◆ addRelationTo() [2/2]

void addRelationTo ( const TObject *  object,
float  weight = 1.0,
const std::string &  namedRelation = "" 
) const
inlineinherited

Add a relation from this object to another object (no caching, can be quite slow).

Parameters
objectThe object to which the relation should point.
weightThe weight of the relation.
namedRelationAdditional name for the relation, or "" for the default naming

Definition at line 155 of file RelationsObject.h.

156 {
157 StoreEntry* toEntry = nullptr;
158 int toIndex = -1;
159 DataStore::Instance().addRelation(this, m_cacheDataStoreEntry, m_cacheArrayIndex, object, toEntry, toIndex, weight, namedRelation);
160 }

◆ addSeenInDetector()

void addSeenInDetector ( Const::DetectorSet  set)
inlineinherited

Flag/Add a bit if the MC particle is seen in a specific subdetector.

Parameters
setThe ID for Belle II subdetector(s), in either Const::DetectorSet or Const::EDetector format

Definition at line 480 of file MCParticle.h.

480{ m_seenIn += set; }
Const::DetectorSet m_seenIn
Each bit is a seen-in flag for the corresoponding subdetector of Belle II.
Definition: MCParticle.h:567

◆ addStatus()

void addStatus ( unsigned short int  bitmask)
inlineinherited

Add bitmask to current status.

Parameters
bitmaskThe status code which should be added to the existing MonteCarlo particle status code.

Definition at line 353 of file MCParticle.h.

353{ m_status |= bitmask; }
unsigned short int m_status
transient 1-based index of particle
Definition: MCParticle.h:540

◆ comesFrom()

void comesFrom ( GraphParticle mother)
inline

Tells the graph that this particle is a decay product of mother.

Parameters
motherThe mother particle of this particle.

Definition at line 105 of file MCParticleGraph.h.

105{ m_graph->addDecay(mother, *this); }
void addDecay(GraphParticle &mother, GraphParticle &daughter)
Add decay information between two particles.

◆ copyRelations()

void copyRelations ( const RelationsInterface< BASE > *  sourceObj)
inlineinherited

Copies all relations of sourceObj (pointing from or to sourceObj) to this object (including weights).

Useful if you want to make a complete copy of a StoreArray object to make modifications to it, but retain all information on linked objects.

Note: this only works if sourceObj inherits from the same base (e.g. RelationsObject), and only for related objects that also inherit from the same base.

Definition at line 170 of file RelationsObject.h.

171 {
172 if (!sourceObj)
173 return;
174 auto fromRels = sourceObj->getRelationsFrom<RelationsInterface<BASE>>("ALL");
175 for (unsigned int iRel = 0; iRel < fromRels.size(); iRel++) {
176 fromRels.object(iRel)->addRelationTo(this, fromRels.weight(iRel));
177 }
178
179 auto toRels = sourceObj->getRelationsTo<RelationsInterface<BASE>>("ALL");
180 for (unsigned int iRel = 0; iRel < toRels.size(); iRel++) {
181 this->addRelationTo(toRels.object(iRel), toRels.weight(iRel));
182 }
183 }
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).

◆ decaysInto()

void decaysInto ( GraphParticle daughter)
inline

Tells the graph that this particle decays into daughter.

Parameters
daughterThe daughter particle in which this particle decays.

Definition at line 99 of file MCParticleGraph.h.

99{ m_graph->addDecay(*this, daughter); }

◆ fixParticleList()

void fixParticleList ( ) const
inherited

Search the DataStore for the corresponding MCParticle array.

This function should not be needed by normal users and is called automatically if the pointer to the particle list is not set when needed, e.g. after deserialization.

Definition at line 82 of file MCParticle.cc.

83{
84 if (m_plist != 0) return;
85
86 TClonesArray* plist(0);
87
88 //Search default location
89 //TODO: this could be replaced with RelationsObject::getArrayIndex()/getArrayName()
90 StoreArray<MCParticle> MCParticles;
91 if (MCParticles && MCParticles.getPtr()->IndexOf(this) >= 0) {
92 plist = MCParticles.getPtr();
93 } else {
94 //Search all StoreArrays which happen to store MCParticles
96 for (DataStore::StoreEntryConstIter iter = map.begin(); iter != map.end(); ++iter) {
97 TClonesArray* value = dynamic_cast<TClonesArray*>(iter->second.ptr);
98 if (value && value->GetClass() == Class() && value->IndexOf(this) >= 0) {
99 plist = value;
100 break;
101 }
102 }
103 }
104 //Could not find any collection, raise exception
105 if (!plist) {
106 B2ERROR("Could not determine StoreArray the MCParticle belongs to !");
107 throw NoParticleListSetError();
108 }
109
110 //Set plist pointer and index for whole array
111 for (int i = 0; i < plist->GetEntriesFast(); i++) {
112 MCParticle& mc = *(static_cast<MCParticle*>(plist->At(i)));
113 mc.m_plist = plist;
114 mc.m_index = i + 1;
115 }
116}
StoreEntryMap::const_iterator StoreEntryConstIter
const_iterator for a StoreEntry map.
Definition: DataStore.h:89
StoreEntryMap & getStoreEntryMap(EDurability durability)
Get a reference to the object/array map.
Definition: DataStore.h:325
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
Definition: DataStore.h:59
std::map< std::string, StoreEntry > StoreEntryMap
Map for StoreEntries.
Definition: DataStore.h:87
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
TClonesArray * getPtr() const
Raw access to the underlying TClonesArray.
Definition: StoreArray.h:311

◆ get4Vector()

ROOT::Math::PxPyPzEVector get4Vector ( ) const
inlineinherited

Return 4Vector of particle.

Returns
The 4-vector of the MonteCarlo particle.

Definition at line 207 of file MCParticle.h.

208 {
209 return ROOT::Math::PxPyPzEVector(m_momentum_x, m_momentum_y, m_momentum_z, m_energy);
210 }
float m_energy
energy of the particle
Definition: MCParticle.h:543
float m_momentum_x
momentum of particle, x component
Definition: MCParticle.h:544
float m_momentum_z
momentum of particle, z component
Definition: MCParticle.h:546
float m_momentum_y
momentum of particle, y component
Definition: MCParticle.h:545

◆ getArrayIndex()

int getArrayIndex ( ) const
inlineinherited

Get 0-based index of the particle in the corresponding MCParticle list.

This is the function for users who want to use the indices of the TClonesArray. To get the corresponding mother and daughter indices use ->getMother()->getArrayIndex().

Returns
The index of the MonteCarlo particle in the corresponding MCParticle array Careful: These indices do not follow the standard from (Fortran) generators, where the first particle has index 1. In the array the first particle has index 0.

Definition at line 244 of file MCParticle.h.

244{ fixParticleList(); return m_index - 1; }
void fixParticleList() const
Search the DataStore for the corresponding MCParticle array.
Definition: MCParticle.cc:82
int m_index
transient pointer to particle list
Definition: MCParticle.h:538

◆ getArrayName()

std::string getArrayName ( ) const
inlineinherited

Get name of array this object is stored in, or "" if not found.

Definition at line 377 of file RelationsObject.h.

378 {
381 }
bool findStoreEntry(const TObject *object, StoreEntry *&entry, int &index)
Find an object in an array in the data store.
Definition: DataStore.cc:398
std::string name
Name of the entry.
Definition: StoreEntry.h:53

◆ getArrayPointer()

TClonesArray * getArrayPointer ( ) const
inlineprotectedinherited

Returns the pointer to the raw DataStore array holding this object (protected since these arrays are easy to misuse).

Definition at line 418 of file RelationsObject.h.

419 {
422 return nullptr;
424 }
TClonesArray * getPtrAsArray() const
Return ptr cast to TClonesArray.
Definition: StoreEntry.cc:83

◆ getCharge()

float getCharge ( ) const
inherited

Return the particle charge defined in TDatabasePDG.

Returns
The charge of the particle in units of q(positron).

Definition at line 36 of file MCParticle.cc.

37{
38 // Geant4 "optical photon" (m_pdg == 0) is not known to TDatabasePDG::Instance().
39 if (m_pdg == 0) {
40 return 0.0;
41 }
42
43 if (TDatabasePDG::Instance()->GetParticle(m_pdg) == nullptr) {
44 B2ERROR("PDG=" << m_pdg << " ***code unknown to TDatabasePDG");
45 return 0.0;
46 }
47
48 return TDatabasePDG::Instance()->GetParticle(m_pdg)->Charge() / 3.0;
49}
int m_pdg
PDG-Code of the particle.
Definition: MCParticle.h:541

◆ getDaughter()

const MCParticle * getDaughter ( int  i) const
inherited

Return i-th daughter.

Definition at line 67 of file MCParticle.cc.

68{
69 if (i >= getNDaughters()) {
70 return nullptr;
71 }
72 return getDaughters().at(i);
73}
std::vector< Belle2::MCParticle * > getDaughters() const
Get vector of all daughter particles, empty vector if none.
Definition: MCParticle.cc:52
int getNDaughters() const
Return number of daughter MCParticles.
Definition: MCParticle.cc:75

◆ getDaughters()

vector< MCParticle * > getDaughters ( ) const
inherited

Get vector of all daughter particles, empty vector if none.

Throws an exception of type LastChildIndexOutOfRangError if the last daughter is out of the index range.

Returns
A list of all daughter particles. The list is empty if the MonteCarlo particle doesn't have any daughters.

Definition at line 52 of file MCParticle.cc.

53{
54 vector<MCParticle*> result;
55 if (m_firstDaughter > 0) {
57 if (m_lastDaughter > m_plist->GetEntriesFast()) throw LastChildIndexOutOfRangError();
58 TClonesArray& plist = *m_plist;
59 result.reserve(m_lastDaughter - m_firstDaughter + 1);
60 for (int i = m_firstDaughter - 1; i < m_lastDaughter; i++) {
61 result.push_back(static_cast<MCParticle*>(plist[i]));
62 }
63 }
64 return result;
65}
int m_lastDaughter
1-based index of last daughter particle in collection, 0 if no daughters
Definition: MCParticle.h:562
int m_firstDaughter
1-based index of first daughter particle in collection, 0 if no daughters
Definition: MCParticle.h:561

◆ getDecayTime()

float getDecayTime ( ) const
inlineinherited

Return the decay time in ns.

Returns
The timestamp of the decay of the MonteCarlo particle in ns. If the particle is stable the time is set to infinity. If the particle crosses the simulation volume boundary, it is set to the crossing time.

Definition at line 168 of file MCParticle.h.

168{ return m_decayTime; }
float m_decayTime
decay time
Definition: MCParticle.h:555

◆ getDecayVertex()

ROOT::Math::XYZVector getDecayVertex ( ) const
inlineinherited

Return decay vertex.

Returns
The decay vertex of the MonteCarlo particle in cm. If the particle crosses the simulation volume boundary, it is set to the crossing position.

Definition at line 219 of file MCParticle.h.

220 {
221 return ROOT::Math::XYZVector(m_decayVertex_x, m_decayVertex_y, m_decayVertex_z);
222 }
float m_decayVertex_z
decay vertex of particle, z component
Definition: MCParticle.h:558
float m_decayVertex_x
decay vertex of particle, x component
Definition: MCParticle.h:556
float m_decayVertex_y
decay vertex of particle, y component
Definition: MCParticle.h:557

◆ getEnergy()

float getEnergy ( ) const
inlineinherited

Return particle energy in GeV.

Returns
Returns the particle energy in GeV.

Definition at line 147 of file MCParticle.h.

147{ return m_energy; }

◆ getFirstDaughter()

int getFirstDaughter ( ) const
inlineinherited

Get 1-based index of first daughter, 0 if no daughters.

Returns
The index of the first daughter of the MonteCarlo particle. The index is 0 if the MonteCarlo particle doesn't have any daughters.

Definition at line 251 of file MCParticle.h.

251{ return m_firstDaughter; }

◆ getIgnore()

bool getIgnore ( ) const
inline

Get the ignore flag.

Returns
whether the ignore flag is set

Definition at line 139 of file MCParticleGraph.h.

139{ return m_ignore; }
bool m_ignore
ignore particle when writing MCParticle list ?

◆ getIndex()

int getIndex ( ) const
inlineinherited

Get 1-based index of the particle in the corresponding MCParticle list.

This is used by the MCParticle Graph.

Returns
The index of the MonteCarlo particle in the corresponding MCParticle list (starts with 1)

Definition at line 230 of file MCParticle.h.

230{ fixParticleList(); return m_index; }

◆ getInfo()

std::string getInfo ( ) const
inlineinherited

Return a short summary of this object's contents in raw text format.

Returns the contents of getInfoHTML() while translating line-breaks etc.

Note
: You don't need to implement this function (it's not virtual), getInfoHTML() is enough.

Definition at line 370 of file RelationsObject.h.

371 {
373 }
virtual std::string getInfoHTML() const
Return a short summary of this object's contents in HTML format.
std::string htmlToPlainText(const std::string &html)
See RelationsObject::getInfo()

◆ getInfoHTML()

std::string getInfoHTML ( ) const
overridevirtualinherited

Return a short summary of this object's contents in HTML format.

Reimplemented from RelationsInterface< BASE >.

Definition at line 125 of file MCParticle.cc.

126{
127 std::stringstream out;
128 out << "<b>Charge</b>=" << (int)getCharge();
129 out << ", <b>PDG</b>=" << getPDG();
130 out << " (" << getName() << ")";
131 out << "<br>";
132 out << "<b>isPrimaryParticle</b>=" << isPrimaryParticle();
133 out << ",<b>isInitial</b>=" << isInitial();
134 out << ",<b>isVirtual</b>=" << isVirtual();
135 out << "<br>";
136
137 out << "<b>pT</b>=" << getMomentum().Rho();
138 out << ", <b>pZ</b>=" << m_momentum_z;
139 out << "<br>";
140 std::string unitType = HTML::chooseUnitOfLength(getProductionVertex());
141 int precision = 3;
142 out << "<b>V</b>=" << HTML::getStringConvertToUnit(getProductionVertex(), precision, unitType);
143
144 const MCParticle* mom = getMother();
145 if (mom) {
146 out << "<br>";
147 out << "<b>Mother</b>: " << mom->getArrayName() << "[" << mom->getArrayIndex() << "] (" << mom->getName() << ")";
148 }
149 return out.str();
150}
virtual std::string getName() const override
Return name of this particle.
Definition: MCParticle.cc:117
int getArrayIndex() const
Get 0-based index of the particle in the corresponding MCParticle list.
Definition: MCParticle.h:244
ROOT::Math::XYZVector getProductionVertex() const
Return production vertex position.
Definition: MCParticle.h:189
float getCharge() const
Return the particle charge defined in TDatabasePDG.
Definition: MCParticle.cc:36
int getPDG() const
Return PDG code of particle.
Definition: MCParticle.h:112
ROOT::Math::XYZVector getMomentum() const
Return momentum.
Definition: MCParticle.h:198
std::string getArrayName() const
Get name of array this object is stored in, or "" if not found.
bool isInitial() const
Check if particle is an initial particle such as ISR.
Definition: MCParticle.h:590
MCParticle * getMother() const
Returns a pointer to the mother particle.
Definition: MCParticle.h:600
bool isPrimaryParticle() const
Check if particle is a primary particle which was created by the generator (and not,...
Definition: MCParticle.h:595
bool isVirtual() const
Check if particle is virtual.
Definition: MCParticle.h:575
std::string getStringConvertToUnit(const ROOT::Math::XYZVector &vec, int precision=2, const std::string &unitType="cm")
get a string with vector coordinates: (x, y, z).
Definition: HTML.cc:85
std::string chooseUnitOfLength(const ROOT::Math::XYZVector &vec)
get a string with a unit type to convert a vector, so that it is easily readable.
Definition: HTML.cc:102

◆ getLastDaughter()

int getLastDaughter ( ) const
inlineinherited

Get 1-based index of last daughter, 0 if no daughters.

Returns
The index of the last daughter of the MonteCarlo particle. The index is 0 if the MonteCarlo particle doesn't have any daughters.

Definition at line 259 of file MCParticle.h.

259{ return m_lastDaughter; }

◆ getLifetime()

float getLifetime ( ) const
inlineinherited

Return the lifetime in ns.

A convenient method to get the lifetime of the MonteCarlo particle.

Returns
The lifetime of the MonteCarlo particle in ns. If the particle crosses the simulation volume boundary, it is set to the time spent inside the volume.

Definition at line 177 of file MCParticle.h.

177{ return m_decayTime - m_productionTime; }
float m_productionTime
production time
Definition: MCParticle.h:550

◆ getMass()

float getMass ( ) const
inlineinherited

Return the particle mass in GeV.

Returns
The mass of the particle in GeV.

Definition at line 135 of file MCParticle.h.

135{ return m_mass; }
float m_mass
mass of the particle
Definition: MCParticle.h:542

◆ getMomentum()

ROOT::Math::XYZVector getMomentum ( ) const
inlineinherited

Return momentum.

Returns
The momentum of the MonteCarlo particle in GeV.

Definition at line 198 of file MCParticle.h.

199 {
200 return ROOT::Math::XYZVector(m_momentum_x, m_momentum_y, m_momentum_z);
201 }

◆ getName()

std::string getName ( ) const
overridevirtualinherited

Return name of this particle.

Reimplemented from RelationsInterface< BASE >.

Definition at line 117 of file MCParticle.cc.

118{
119 const TParticlePDG* p = TDatabasePDG::Instance()->GetParticle(m_pdg);
120 if (p)
121 return p->GetName();
122 else //handle unknown PDG codes
123 return std::to_string(m_pdg);
124}

◆ getNDaughters()

int getNDaughters ( ) const
inherited

Return number of daughter MCParticles.

Definition at line 75 of file MCParticle.cc.

76{
77 if (getFirstDaughter() == 0) //no daughters
78 return 0;
79 return getLastDaughter() - getFirstDaughter() + 1;
80}
int getLastDaughter() const
Get 1-based index of last daughter, 0 if no daughters.
Definition: MCParticle.h:259
int getFirstDaughter() const
Get 1-based index of first daughter, 0 if no daughters.
Definition: MCParticle.h:251

◆ getParticleFromGeneralizedIndexString()

const MCParticle * getParticleFromGeneralizedIndexString ( const std::string &  generalizedIndex) const
inherited

Explores the decay tree of the MC particle and returns the (grand^n)daughter identified by a generalized index.

The generalized index consists of a colon-separated list of daughter indexes, starting from the root particle: 0:1:3 identifies the fourth daughter (3) of the second daughter (1) of the first daughter (0) of the mother particle. This method mirrors the method used in the Particle class.

Parameters
generalizedIndexthe generalized index of the particle to be returned
Returns
a particle in the decay tree of the root particle.

Definition at line 152 of file MCParticle.cc.

153{
154 // Split the generalizedIndex string in a vector of strings.
155 std::vector<std::string> generalizedIndexes;
156 boost::split(generalizedIndexes, generalizedIndex, boost::is_any_of(":"));
157
158 if (generalizedIndexes.empty()) {
159 B2WARNING("Generalized index of MC daughter particle is empty. Skipping.");
160 return nullptr;
161 }
162
163 // To explore a decay tree of unknown depth, we need a place to store
164 // both the root particle and the daughter particle at each iteration
165 const MCParticle* dauPart =
166 nullptr; // This will be eventually returned
167 const MCParticle* currentPart = this; // This is the root particle of the next iteration
168
169 // Loop over the generalizedIndexes until you get to the particle you want
170 for (auto& indexString : generalizedIndexes) {
171 // indexString is a string. First try to convert it into an int
172 int dauIndex = 0;
173 try {
174 dauIndex = Belle2::convertString<int>(indexString);
175 } catch (std::invalid_argument&) {
176 B2WARNING("Found the string " << indexString << "instead of a daughter index.");
177 return nullptr;
178 }
179
180 // Check that the daughter index is smaller than the number of daughters of the current root particle
181 if (dauIndex >= int(currentPart->getNDaughters()) or dauIndex < 0) {
182 B2WARNING("Daughter index out of range" << LogVar("daughter index", dauIndex));
183 B2WARNING("Trying to access non-existing particle.");
184 return nullptr;
185 } else {
186 dauPart = currentPart->getDaughter(dauIndex); // Pick the particle indicated by the generalizedIndex
187 currentPart = dauPart;
188 }
189 }
190 return dauPart;
191}
const MCParticle * getDaughter(int i) const
Return i-th daughter.
Definition: MCParticle.cc:67
Class to store variables with their name which were sent to the logging service.

◆ getPDG()

int getPDG ( ) const
inlineinherited

Return PDG code of particle.

Returns
The PDG code of the MonteCarlo particle.

Definition at line 112 of file MCParticle.h.

112{ return m_pdg; }

◆ getProductionTime()

float getProductionTime ( ) const
inlineinherited

Return production time in ns.

Returns
The timestamp of the MonteCarlo particle production in ns.

Definition at line 159 of file MCParticle.h.

159{ return m_productionTime; }

◆ getProductionVertex()

ROOT::Math::XYZVector getProductionVertex ( ) const
inlineinherited

Return production vertex position.

Returns
The production vertex of the MonteCarlo particle in cm.

Definition at line 189 of file MCParticle.h.

190 {
191 return ROOT::Math::XYZVector(m_productionVertex_x, m_productionVertex_y, m_productionVertex_z);
192 }
float m_productionVertex_x
production vertex of particle, x component
Definition: MCParticle.h:551
float m_productionVertex_z
production vertex of particle, z component
Definition: MCParticle.h:553
float m_productionVertex_y
production vertex of particle, y component
Definition: MCParticle.h:552

◆ getRelated()

T * getRelated ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the object to or from which this object has a relation.

Template Parameters
TThe class of objects to or from which the relation points.
Parameters
nameThe name of the store array to or from which the relation points. If empty the default store array name for class T will be used. If the special name "ALL" is given all store arrays containing objects of type T are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
The first related object or a null pointer.

Definition at line 278 of file RelationsObject.h.

279 {
281 T::Class(), name, namedRelation).object);
282 }
@ c_BothSides
Combination of c_FromSide and c_ToSide.
Definition: DataStore.h:79
Belle2::RelationEntry getRelationWith(ESearchSide searchSide, const TObject *object, StoreEntry *&entry, int &index, const TClass *withClass, const std::string &withName, const std::string &namedRelation)
Get the first relation between an object and another object in a store array.
Definition: DataStore.cc:597
TObject * object
Pointer to the object.
Definition: RelationEntry.h:32

◆ getRelatedFrom()

FROM * getRelatedFrom ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the object from which this object has a relation.

Template Parameters
FROMThe class of objects from which the relation points.
Parameters
nameThe name of the store array from which the relation points. If empty the default store array name for class FROM will be used. If the special name "ALL" is given all store arrays containing objects of type FROM are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
The first related object or a null pointer.

Definition at line 263 of file RelationsObject.h.

264 {
266 m_cacheArrayIndex, FROM::Class(), name, namedRelation).object);
267 }
@ c_FromSide
Return relations/objects pointed from (to a given object).
Definition: DataStore.h:77

◆ getRelatedFromWithWeight()

std::pair< FROM *, float > getRelatedFromWithWeight ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get first related object & weight of relation pointing from an array.

Template Parameters
FROMThe class of objects from which the relation points.
Parameters
nameThe name of the store array from which the relation points. If empty the default store array name for class FROM will be used. If the special name "ALL" is given all store arrays containing objects of type FROM are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
Pair of first related object and the relation weight, or (NULL, 1.0) if none found.

Definition at line 314 of file RelationsObject.h.

316 {
318 FROM::Class(), name, namedRelation);
319 return std::make_pair(static_cast<FROM*>(entry.object), entry.weight);
320 }

◆ getRelatedTo()

TO * getRelatedTo ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the object to which this object has a relation.

Template Parameters
TOThe class of objects to which the relation points.
Parameters
nameThe name of the store array to which the relation points. If empty the default store array name for class TO will be used. If the special name "ALL" is given all store arrays containing objects of type TO are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
The first related object or a null pointer.

Definition at line 248 of file RelationsObject.h.

249 {
251 TO::Class(), name, namedRelation).object);
252 }
@ c_ToSide
Return relations/objects pointed to (from a given object).
Definition: DataStore.h:78

◆ getRelatedToWithWeight()

std::pair< TO *, float > getRelatedToWithWeight ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get first related object & weight of relation pointing to an array.

Template Parameters
TOThe class of objects to which the relation points.
Parameters
nameThe name of the store array to which the relation points. If empty the default store array name for class TO will be used. If the special name "ALL" is given all store arrays containing objects of type TO are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
Pair of first related object and the relation weight, or (NULL, 1.0) if none found.

Definition at line 297 of file RelationsObject.h.

299 {
301 TO::Class(), name, namedRelation);
302 return std::make_pair(static_cast<TO*>(entry.object), entry.weight);
303 }

◆ getRelatedWithWeight()

std::pair< T *, float > getRelatedWithWeight ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get first related object & weight of relation pointing from/to an array.

Template Parameters
TThe class of objects to or from which the relation points.
Parameters
nameThe name of the store array to or from which the relation points. If empty the default store array name for class T will be used. If the special name "ALL" is given all store arrays containing objects of type T are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
Pair of first related object and the relation weight, or (NULL, 1.0) if none found.

Definition at line 331 of file RelationsObject.h.

333 {
335 T::Class(), name, namedRelation);
336 return std::make_pair(static_cast<T*>(entry.object), entry.weight);
337 }

◆ getRelationsFrom()

RelationVector< FROM > getRelationsFrom ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the relations that point from another store array to this object.

Template Parameters
FROMThe class of objects from which the relations point.
Parameters
nameThe name of the store array from which the relations point. If empty the default store array name for class FROM will be used. If the special name "ALL" is given all store arrays containing objects of type FROM are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
A vector of relations.

Definition at line 212 of file RelationsObject.h.

214 {
216 m_cacheArrayIndex, FROM::Class(), name, namedRelation));
217 }
RelationVector< T > getRelationsWith(const std::string &name="", const std::string &namedRelation="") const
Get the relations between this object and another store array.

◆ getRelationsTo()

RelationVector< TO > getRelationsTo ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the relations that point from this object to another store array.

Template Parameters
TOThe class of objects to which the relations point.
Parameters
nameThe name of the store array to which the relations point. If empty the default store array name for class TO will be used. If the special name "ALL" is given all store arrays containing objects of type TO are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
A vector of relations.

Definition at line 197 of file RelationsObject.h.

198 {
200 m_cacheArrayIndex, TO::Class(), name, namedRelation));
201 }

◆ getRelationsWith()

RelationVector< T > getRelationsWith ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the relations between this object and another store array.

Relations in both directions are returned.

Template Parameters
TThe class of objects to or from which the relations point.
Parameters
nameThe name of the store array to or from which the relations point. If empty the default store array name for class T will be used. If the special name "ALL" is given all store arrays containing objects of type T are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
A vector of relations.

Definition at line 230 of file RelationsObject.h.

231 {
233 m_cacheArrayIndex, T::Class(), name, namedRelation));
234 }

◆ getSecondaryPhysicsProcess()

int getSecondaryPhysicsProcess ( ) const
inlineinherited

Returns the physics process type of a secondary particle.

Returns
Returns an integer indicating the physics process type of a secondary particle. 0 if the particle is primary. -1 if no information is found. For the details, see the Geant4 package: (*G4Track)->GetCreatorProcess()->GetProcessSubType() processes/electromagnetic/utils/include/G4EmProcessSubType.hh processes/hadronic/management/include/G4HadronicProcessType.hh processes/decay/include/G4DecayProcessType.hh

Definition at line 297 of file MCParticle.h.

int m_secondaryPhysicsProcess
physics process type of a secondary particle
Definition: MCParticle.h:565

◆ getSeenInDetector()

Const::DetectorSet getSeenInDetector ( ) const
inlineinherited

Return the seen-in flags of the entire Belle II subdetectors for an MC particle.

Returns
Returns the entire seen-in flags

Definition at line 303 of file MCParticle.h.

303{ return m_seenIn; }

◆ getStatus()

unsigned int getStatus ( unsigned short int  bitmask = USHRT_MAX) const
inlineinherited

Return status code of particle.

Parameters
bitmaskTakes an optional bitmask that is compared to the status of the particle.
Returns
Returns the status code of the particle. If a bitmask is given and it matches the the status it returns the value of the bitmask and 0 if not.

Definition at line 122 of file MCParticle.h.

122{ return m_status & bitmask; }

◆ getTrackID()

int getTrackID ( ) const
inline

Returns the track ID assigned to this MCParticle.

Returns
The ID of the Geant4 track which created this particle.

Definition at line 154 of file MCParticleGraph.h.

154{ return m_trackID; }
int m_trackID
The track ID from geant4 that created this particle.

◆ getVertex()

ROOT::Math::XYZVector getVertex ( ) const
inlineinherited

Return production vertex position, shorthand for getProductionVertex().

Returns
The production vertex of the MonteCarlo particle in cm.

Definition at line 183 of file MCParticle.h.

183{ return getProductionVertex(); }

◆ hasSeenInDetector()

bool hasSeenInDetector ( Const::DetectorSet  set) const
inlineinherited

Return if the seen-in flag for a specific subdetector is set or not.

Parameters
setThe ID for Belle II subdetector(s), in either Const::DetectorSet or Const::EDetector format.
Returns
Returns true if the corresponding bit is set.

Definition at line 310 of file MCParticle.h.

310{ return m_seenIn.contains(set); }
bool contains(const DetectorSet &set) const
Check whether this set contains another set.
Definition: Const.h:235

◆ hasStatus()

bool hasStatus ( unsigned short int  bitmask) const
inlineinherited

Return if specific status bit is set.

Parameters
bitmaskThe bitmask which is compared to the status of the particle.
Returns
Returns true if the bitmask matches the status code of the particle.

Definition at line 129 of file MCParticle.h.

129{ return (m_status & bitmask) == bitmask; }

◆ hasValidVertex()

bool hasValidVertex ( ) const
inlineinherited

Indication whether vertex and time information is useful or just default.

Returns
Returns True if the vertex and time information is useful.

Definition at line 153 of file MCParticle.h.

153{ return m_validVertex; }
bool m_validVertex
indication wether vertex and time information is useful or just default
Definition: MCParticle.h:548

◆ operator=()

GraphParticle & operator= ( const MCParticle particle)
inline

Assign the values of an existing MCParticle to this GraphParticle.

This assignment will leave all bookkeeping members of the GraphParticle untouched (decays, ignore status, track id) but will assign all values/flags from the MCParticle.

Parameters
particleParticle which values (momentum, energy, mass, vertex, etc.) shall be assigned

Definition at line 85 of file MCParticleGraph.h.

86 {
87 MCParticle::operator=(particle);
88 //The pointer to the TClonesArray the MCParticle is stored in makes no
89 //sense inside the Graph so we set it to some invalid value to avoid
90 //the MCParticle::fixParticleList() to complain
91 m_plist = (TClonesArray*) - 1;
92 return *this;
93 }
RelationsInterface & operator=(const RelationsInterface &relationsInterface)
Assignment operator.

◆ removeSeenInDetector()

void removeSeenInDetector ( Const::DetectorSet  set)
inlineinherited

Unflag/Remove the bit if the MC particle is not seen in a specific subdetector.

Parameters
setThe ID for Belle II subdetector(s), in either Const::DetectorSet or Const::EDetector format

Definition at line 486 of file MCParticle.h.

486{ m_seenIn -= set; }

◆ removeStatus()

void removeStatus ( unsigned short int  bitmask)
inlineinherited

Remove bitmask from current status.

Parameters
bitmaskThe status code which should be removed from the existing MonteCarlo particle status code.

Definition at line 360 of file MCParticle.h.

360{ m_status &= (~bitmask); }

◆ set4Vector()

void set4Vector ( const ROOT::Math::PxPyPzEVector &  p4)
inlineinherited

Sets the 4Vector of particle.

Parameters
p44Vector

Definition at line 438 of file MCParticle.h.

439 {
440 m_momentum_x = p4.px(); m_momentum_y = p4.py(); m_momentum_z = p4.pz(); m_energy = p4.energy();
441 }

◆ setDecayTime()

void setDecayTime ( float  time)
inlineinherited

Set decay time.

Parameters
timeThe timestamp of the decay of the MonteCarlo time.

Definition at line 390 of file MCParticle.h.

390{ m_decayTime = time; }

◆ setDecayVertex() [1/2]

void setDecayVertex ( const ROOT::Math::XYZVector &  vertex)
inlineinherited

Set decay vertex.

Parameters
vertexThe position of the decay vertex given as XYZVector.

Definition at line 447 of file MCParticle.h.

448 {
449 m_decayVertex_x = vertex.X(); m_decayVertex_y = vertex.Y(), m_decayVertex_z = vertex.Z();
450 }

◆ setDecayVertex() [2/2]

void setDecayVertex ( float  x,
float  y,
float  z 
)
inlineinherited

Set decay vertex.

The position of the decay vertex is given as three float parameters.

Parameters
xThe x position of the decay vertex.
yThe y position of the decay vertex.
zThe z position of the decay vertex.

Definition at line 459 of file MCParticle.h.

460 {
462 }

◆ setEnergy()

void setEnergy ( float  energy)
inlineinherited

Set energy.

Parameters
energyThe energy of the MonteCarlo particle.

Definition at line 372 of file MCParticle.h.

372{ m_energy = energy; }

◆ setFirstDaughter()

void setFirstDaughter ( int  daughter)
inline

Set the 1-based index of the first daughter, 0 means no daughters.

Will be reset when sorting the particle graph and will be set according to the information given with decaysInto() and comesFrom().

Parameters
daughterThe index of the first daughter particle. Set to 0 for no daughters.

Definition at line 114 of file MCParticleGraph.h.

114{ m_firstDaughter = daughter; }

◆ setIgnore()

void setIgnore ( bool  ignore = true)
inline

Set or remove the ignore flag.

If ignore is set, this particle will not be written to the MCParticle list and all its daughters without ignore flag will be attributed to all parents of this particle.

Parameters
ignoreSet to true to ignore this particle when creating the MCParticle list.

Definition at line 132 of file MCParticleGraph.h.

132{ m_ignore = ignore; }

◆ setIndex()

void setIndex ( int  index)
inlineprivate

Set the 1-based index of the particle.

Parameters
indexThe index of the particle.

Definition at line 193 of file MCParticleGraph.h.

193{ m_index = index; }

◆ setInitial()

void setInitial ( )
inlineinherited

Set particle to initial.

(A bit more convinient)

Definition at line 505 of file MCParticle.h.

void addStatus(unsigned short int bitmask)
Add bitmask to current status.
Definition: MCParticle.h:353

◆ setLastDaughter()

void setLastDaughter ( int  daughter)
inline

Set the 1-based index of the last daughter, 0 means no daughters.

See also
setFirstDaughter()
Parameters
daughterThe index of the last daughter particle. Set to 0 for no daughters.

Definition at line 122 of file MCParticleGraph.h.

122{ m_lastDaughter = daughter; }

◆ setMass()

void setMass ( float  mass)
inlineinherited

Set particle mass.

Parameters
massThe MonteCarlo particle mass.

Definition at line 366 of file MCParticle.h.

366{ m_mass = mass; }

◆ setMassFromPDG()

void setMassFromPDG ( )
inherited

Sets the mass for the particle from the particle's PDG code.

Definition at line 28 of file MCParticle.cc.

29{
30 if (TDatabasePDG::Instance()->GetParticle(m_pdg) == nullptr)
31 throw(ParticlePDGNotKnownError() << m_pdg);
32 m_mass = TDatabasePDG::Instance()->GetParticle(m_pdg)->Mass();
33}

◆ setMomentum() [1/2]

void setMomentum ( const ROOT::Math::XYZVector &  momentum)
inlineinherited

Set particle momentum.

Parameters
momentumThe momentum of the MonteCarlo particle given as XYZVector.

Definition at line 417 of file MCParticle.h.

418 {
419 m_momentum_x = momentum.X(); m_momentum_y = momentum.Y(), m_momentum_z = momentum.Z();
420 }

◆ setMomentum() [2/2]

void setMomentum ( float  px,
float  py,
float  pz 
)
inlineinherited

Set particle momentum.

The momentum of the MonteCarlo particle is given as three float parameters.

Parameters
pxThe x component of the momentum vector.
pyThe y component of the momentum vector.
pzThe z component of the momentum vector.

Definition at line 429 of file MCParticle.h.

430 {
431 m_momentum_x = px, m_momentum_y = py; m_momentum_z = pz;
432 }

◆ setPDG()

void setPDG ( int  pdg)
inlineinherited

Set PDG code of the particle.

Parameters
pdgThe PDG code of the MonteCarlo particle.

Definition at line 335 of file MCParticle.h.

335{ m_pdg = pdg; }

◆ setProductionTime()

void setProductionTime ( float  time)
inlineinherited

Set production time.

Parameters
timeThe timestamp of the production of the MonteCarlo particle.

Definition at line 384 of file MCParticle.h.

384{ m_productionTime = time; }

◆ setProductionVertex() [1/2]

void setProductionVertex ( const ROOT::Math::XYZVector &  vertex)
inlineinherited

Set production vertex position.

Parameters
vertexThe position of the production vertex given as XYZVector.

Definition at line 396 of file MCParticle.h.

397 {
398 m_productionVertex_x = vertex.X(); m_productionVertex_y = vertex.Y(), m_productionVertex_z = vertex.Z();
399 }

◆ setProductionVertex() [2/2]

void setProductionVertex ( float  x,
float  y,
float  z 
)
inlineinherited

Set production vertex position.

The position of the production vertex is given as three float parameters.

Parameters
xThe x position of the production vertex.
yThe y position of the production vertex.
zThe z position of the production vertex.

Definition at line 408 of file MCParticle.h.

◆ setSecondaryPhysicsProcess()

void setSecondaryPhysicsProcess ( int  physicsProcess)
inlineinherited

Sets the physics process type of a secondary particle.

Parameters
physicsProcessphysics process type as an integer number for a secondary particle.

Definition at line 468 of file MCParticle.h.

468{ m_secondaryPhysicsProcess = physicsProcess; }

◆ setSeenInDetector()

void setSeenInDetector ( Const::DetectorSet  set)
inlineinherited

Set the seen-in flags for the entire Belle II subdetectors for an Monte Carlo particle.

Parameters
setThe ID for Belle II subdetector(s), in either Const::DetectorSet or Const::EDetector format

Definition at line 474 of file MCParticle.h.

474{ m_seenIn = set; }

◆ setStatus()

void setStatus ( unsigned short int  status)
inlineinherited

Set Status code for the particle.

Parameters
statusThe status code of the MonteCarlo particle.

Definition at line 346 of file MCParticle.h.

346{ m_status = status; }

◆ setTrackID()

void setTrackID ( int  trackID)
inline

Set the track ID for the particle.

The track ID is used to build the relationship between MCParticles and created Hits.

Parameters
trackIDThe ID of the Geant4 track which created this MCParticle.

Definition at line 147 of file MCParticleGraph.h.

147{ m_trackID = trackID; }

◆ setValidVertex()

void setValidVertex ( bool  valid)
inlineinherited

Set indication wether vertex and time information is valid or just default.

Parameters
validSet to true if the vertex is valid.

Definition at line 378 of file MCParticle.h.

378{ m_validVertex = valid; }

◆ setVirtual()

void setVirtual ( )
inlineinherited

Set particle to virtual.

(A bit more convinient)

Definition at line 500 of file MCParticle.h.

Friends And Related Function Documentation

◆ MCParticleGraph

friend class MCParticleGraph
friend

Definition at line 201 of file MCParticleGraph.h.

◆ ParticleSorter

friend class ParticleSorter
friend

Definition at line 202 of file MCParticleGraph.h.

Member Data Documentation

◆ c_epsilon

const double c_epsilon = 10e-7
staticprotectedinherited

limit of precision for two doubles to be the same.

Definition at line 563 of file MCParticle.h.

◆ m_cacheArrayIndex

int m_cacheArrayIndex
mutableprivateinherited

Cache of the index in the TClonesArray to which this object belongs.

Definition at line 432 of file RelationsObject.h.

◆ m_cacheDataStoreEntry

DataStore::StoreEntry* m_cacheDataStoreEntry
mutableprivateinherited

Cache of the data store entry to which this object belongs.

Definition at line 429 of file RelationsObject.h.

◆ m_decayTime

float m_decayTime
protectedinherited

decay time

Definition at line 555 of file MCParticle.h.

◆ m_decayVertex_x

float m_decayVertex_x
protectedinherited

decay vertex of particle, x component

Definition at line 556 of file MCParticle.h.

◆ m_decayVertex_y

float m_decayVertex_y
protectedinherited

decay vertex of particle, y component

Definition at line 557 of file MCParticle.h.

◆ m_decayVertex_z

float m_decayVertex_z
protectedinherited

decay vertex of particle, z component

Definition at line 558 of file MCParticle.h.

◆ m_energy

float m_energy
protectedinherited

energy of the particle

Definition at line 543 of file MCParticle.h.

◆ m_firstDaughter

int m_firstDaughter
protectedinherited

1-based index of first daughter particle in collection, 0 if no daughters

Definition at line 561 of file MCParticle.h.

◆ m_graph

MCParticleGraph* m_graph {0}
private

internal pointer to the graph this particle belongs to

Definition at line 195 of file MCParticleGraph.h.

◆ m_ignore

bool m_ignore {false}
private

ignore particle when writing MCParticle list ?

Definition at line 197 of file MCParticleGraph.h.

◆ m_index

int m_index
protectedinherited

transient pointer to particle list

1-based index of the particle, will be set automatically after deserialisation if needed.

Definition at line 538 of file MCParticle.h.

◆ m_lastDaughter

int m_lastDaughter
protectedinherited

1-based index of last daughter particle in collection, 0 if no daughters

Definition at line 562 of file MCParticle.h.

◆ m_mass

float m_mass
protectedinherited

mass of the particle

Definition at line 542 of file MCParticle.h.

◆ m_momentum_x

float m_momentum_x
protectedinherited

momentum of particle, x component

Definition at line 544 of file MCParticle.h.

◆ m_momentum_y

float m_momentum_y
protectedinherited

momentum of particle, y component

Definition at line 545 of file MCParticle.h.

◆ m_momentum_z

float m_momentum_z
protectedinherited

momentum of particle, z component

Definition at line 546 of file MCParticle.h.

◆ m_mother

int m_mother
protectedinherited

1-based index of the mother particle

Definition at line 560 of file MCParticle.h.

◆ m_pdg

int m_pdg
protectedinherited

PDG-Code of the particle.

Definition at line 541 of file MCParticle.h.

◆ m_plist

TClonesArray* m_plist
protectedinherited

Internal pointer to DataStore Array containing particles belonging to this collection.

This is a transient member and will not be written to file. The pointer will be set correctly on first access after deserialisation

Definition at line 532 of file MCParticle.h.

◆ m_primary

bool m_primary {true}
private

Is this a primary particle ?

Definition at line 198 of file MCParticleGraph.h.

◆ m_productionTime

float m_productionTime
protectedinherited

production time

Definition at line 550 of file MCParticle.h.

◆ m_productionVertex_x

float m_productionVertex_x
protectedinherited

production vertex of particle, x component

Definition at line 551 of file MCParticle.h.

◆ m_productionVertex_y

float m_productionVertex_y
protectedinherited

production vertex of particle, y component

Definition at line 552 of file MCParticle.h.

◆ m_productionVertex_z

float m_productionVertex_z
protectedinherited

production vertex of particle, z component

Definition at line 553 of file MCParticle.h.

◆ m_secondaryPhysicsProcess

int m_secondaryPhysicsProcess
protectedinherited

physics process type of a secondary particle

Definition at line 565 of file MCParticle.h.

◆ m_seenIn

Const::DetectorSet m_seenIn
protectedinherited

Each bit is a seen-in flag for the corresoponding subdetector of Belle II.

Definition at line 567 of file MCParticle.h.

◆ m_status

unsigned short int m_status
protectedinherited

transient 1-based index of particle

status code

Definition at line 540 of file MCParticle.h.

◆ m_trackID

int m_trackID {0}
private

The track ID from geant4 that created this particle.

Definition at line 199 of file MCParticleGraph.h.

◆ m_validVertex

bool m_validVertex
protectedinherited

indication wether vertex and time information is useful or just default

Definition at line 548 of file MCParticle.h.

◆ m_vertexId

unsigned int m_vertexId {0}
private

vertex id in the graph

Definition at line 196 of file MCParticleGraph.h.


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