Belle II Software development
|
This is a general purpose class for collecting reconstructed MDST data objects that are not used in reconstruction of given Particle – referred also as Rest Of the Event. More...
#include <RestOfEvent.h>
Classes | |
struct | Mask |
Structure of Rest of Event mask. More... | |
Public Member Functions | |
RestOfEvent (int pdgCode=0, bool isNested=false, bool isFromMC=false, bool useKLMEnergy=false, bool builtWithMostLikely=false) | |
Default constructor. | |
void | addParticles (const std::vector< const Particle * > &particle) |
Add StoreArray indices of given Particles to the list of unused particles in the event. | |
void | setPDGCode (int pdgCode) |
Sets the PDG code of the rest of event. | |
Particle * | convertToParticle (const std::string &maskName=c_defaultMaskName, int pdgCode=0, bool isSelfConjugated=true) |
Converts ROE to Particle and adds it to StoreArray. | |
int | getPDGCode () const |
Gets the PDG code of the rest of event. | |
bool | hasParticle (const Particle *particle, const std::string &maskName=c_defaultMaskName) const |
Check if ROE has StoreArray index of given to the list of unused tracks in the event. | |
void | initializeMask (const std::string &name, const std::string &origin="unknown") |
Initialize new mask. | |
void | updateMaskWithCuts (const std::string &name, const std::shared_ptr< Variable::Cut > &trackCut=nullptr, const std::shared_ptr< Variable::Cut > &eclCut=nullptr, const std::shared_ptr< Variable::Cut > &klmCut=nullptr, bool updateExisting=false) |
Update mask with cuts. | |
void | excludeParticlesFromMask (const std::string &maskName, const std::vector< const Particle * > &particles, Particle::EParticleSourceObject listType, bool discard) |
Update mask by keeping or excluding particles. | |
bool | hasMask (const std::string &name) const |
True if this ROE object has mask. | |
void | updateMaskWithV0 (const std::string &name, const Particle *particleV0) |
Update mask with composite particle. | |
bool | checkCompatibilityOfMaskAndV0 (const std::string &name, const Particle *particleV0) |
Check if V0 can be added, maybe should be moved to private. | |
bool | getIsNested () const |
Returns true if the ROE is nested. | |
bool | isBuiltWithMostLikely () const |
Returns true if the ROE was built with most-likely particle lists. | |
std::vector< const Particle * > | getParticles (const std::string &maskName=c_defaultMaskName, bool unpackComposite=true) const |
Get all Particles from ROE mask. | |
std::vector< const Particle * > | getPhotons (const std::string &maskName=c_defaultMaskName, bool unpackComposite=true) const |
Get photons from ROE mask. | |
std::vector< const Particle * > | getHadrons (const std::string &maskName=c_defaultMaskName, bool unpackComposite=true) const |
Get hadrons from ROE mask. | |
std::vector< const Particle * > | getChargedParticles (const std::string &maskName=c_defaultMaskName, unsigned int pdg=0, bool unpackComposite=true) const |
Get charged particles from ROE mask. | |
ROOT::Math::PxPyPzEVector | get4Vector (const std::string &maskName=c_defaultMaskName) const |
Get 4-momentum vector all (no mask) or a subset (use mask) of all Tracks and ECLClusters in ROE. | |
ROOT::Math::PxPyPzEVector | get4VectorNeutralECLClusters (const std::string &maskName=c_defaultMaskName) const |
Get 4-momentum vector all (no mask) or a subset (use mask) of all ECLClusters in ROE. | |
int | getNTracks (const std::string &maskName=c_defaultMaskName) const |
Get number of all (no mask) or a subset (use mask) of all Tracks in ROE. | |
int | getNECLClusters (const std::string &maskName=c_defaultMaskName) const |
Get number of all (no mask) or a subset (use mask) of all ECLclusters in ROE. | |
int | getNKLMClusters (const std::string &maskName=c_defaultMaskName) const |
Get number of all remaining KLM clusters. | |
std::vector< std::string > | getMaskNames () const |
Get vector of all mask names of the ROE object. | |
void | print (const std::string &maskName=c_defaultMaskName, bool unpackComposite=true) const |
Prints the contents of a RestOfEvent object to screen. | |
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. | |
virtual std::string | getName () const |
Return a short name that describes this object, e.g. | |
virtual std::string | getInfoHTML () const |
Return a short summary of this object's contents in HTML format. | |
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. | |
int | getArrayIndex () const |
Returns this object's array index (in StoreArray), or -1 if not found. | |
Static Public Attributes | |
static constexpr const char * | c_defaultMaskName = "all" |
Default mask name. | |
Protected Member Functions | |
TClonesArray * | getArrayPointer () const |
Returns the pointer to the raw DataStore array holding this object (protected since these arrays are easy to misuse). | |
Private Member Functions | |
bool | isInParticleList (const Particle *roeParticle, const std::vector< const Particle * > &particlesToUpdate) const |
Checks if a particle has its copy in the provided list. | |
Mask * | findMask (const std::string &name) |
Helper method to find ROE mask. | |
void | printIndices (const std::string &maskName=c_defaultMaskName, bool unpackComposite=true, const std::string &tab=" - ") const |
Prints indices in the given set in a single line. | |
ClassDef (RelationsInterface, 0) | |
defines interface for accessing relations of objects in StoreArray. | |
Private Attributes | |
std::set< int > | m_particleIndices |
StoreArray indices to unused particles. | |
std::vector< Mask > | m_masks |
List of the ROE masks. | |
int | m_pdgCode |
PDG code of the 'ROE particle' if we are going to create one. | |
bool | m_isNested |
Nested ROE indicator. | |
bool | m_isFromMC |
MC ROE indicator. | |
bool | m_useKLMEnergy |
Include KLM energy into ROE 4-vector. | |
bool | m_builtWithMostLikely |
indicates whether most-likely particle lists were used in build of ROE | |
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. | |
This is a general purpose class for collecting reconstructed MDST data objects that are not used in reconstruction of given Particle – referred also as Rest Of the Event.
From remaining photons, K_L0 and charged particles, etc., we infer for example the decay vertex and flavor of the tagging B meson, which are needed in measurements of t-dependent CP violation, or we determine whether or not the rest of the event is consistent with some B decay that involves neutrinos after we have reconstructed Btag hadronically or semileptonically. Remaining charged tracks and unused energy deposits are for example also needed in calculation of continuum suppression variables, like Kakuno-Super-Fox-Wolfram moments. The RestOfEvent class should be used as an input in all these cases.
The RestOfEvent object is created for given existing Particle object by the RestOfEventBuilder module and are related between each other with the basf2 relation.
Internally, the RestOfEvent class holds only StoreArray indices of all unused MDST particles. Indices are stored in std::set and not std::vector, since the former ensures uniqueness of all its elements.
Definition at line 57 of file RestOfEvent.h.
|
inlineexplicit |
Default constructor.
All private members are set to 0 (all vectors are empty).
Definition at line 179 of file RestOfEvent.h.
void addParticles | ( | const std::vector< const Particle * > & | particle | ) |
Add StoreArray indices of given Particles to the list of unused particles in the event.
particle | Reference to a vector of unused Particles |
Definition at line 24 of file RestOfEvent.cc.
|
inlineinherited |
Add a relation from this object to another object (with caching).
object | The object to which the relation should point. |
weight | The weight of the relation. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 142 of file RelationsObject.h.
|
inlineinherited |
Add a relation from this object to another object (no caching, can be quite slow).
object | The object to which the relation should point. |
weight | The weight of the relation. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 155 of file RelationsObject.h.
bool checkCompatibilityOfMaskAndV0 | ( | const std::string & | name, |
const Particle * | particleV0 | ||
) |
Check if V0 can be added, maybe should be moved to private.
Definition at line 268 of file RestOfEvent.cc.
Particle * convertToParticle | ( | const std::string & | maskName = c_defaultMaskName , |
int | pdgCode = 0 , |
||
bool | isSelfConjugated = true |
||
) |
Converts ROE to Particle and adds it to StoreArray.
maskName | Name of the ROE mask to use for 4-vector and daughters |
pdgCode | PDG code |
isSelfConjugated | is the particle self-conjugated |
Definition at line 443 of file RestOfEvent.cc.
|
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.
void excludeParticlesFromMask | ( | const std::string & | maskName, |
const std::vector< const Particle * > & | particles, | ||
Particle::EParticleSourceObject | listType, | ||
bool | discard | ||
) |
Update mask by keeping or excluding particles.
maskName | Name of the mask to work with |
particles | Reference to particle collection |
listType | ParticleSourceObject of the collection |
discard | Update the ROE mask by passing or discarding particles in the provided particle list |
Definition at line 154 of file RestOfEvent.cc.
|
private |
Helper method to find ROE mask.
Definition at line 322 of file RestOfEvent.cc.
ROOT::Math::PxPyPzEVector get4Vector | ( | const std::string & | maskName = c_defaultMaskName | ) | const |
Get 4-momentum vector all (no mask) or a subset (use mask) of all Tracks and ECLClusters in ROE.
maskName | Name of mask |
Definition at line 306 of file RestOfEvent.cc.
ROOT::Math::PxPyPzEVector get4VectorNeutralECLClusters | ( | const std::string & | maskName = c_defaultMaskName | ) | const |
Get 4-momentum vector all (no mask) or a subset (use mask) of all ECLClusters in ROE.
maskName | Name of mask |
Definition at line 356 of file RestOfEvent.cc.
|
inlineinherited |
Returns this object's array index (in StoreArray), or -1 if not found.
Definition at line 385 of file RelationsObject.h.
|
inlineinherited |
Get name of array this object is stored in, or "" if not found.
Definition at line 377 of file RelationsObject.h.
|
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.
std::vector< const Particle * > getChargedParticles | ( | const std::string & | maskName = c_defaultMaskName , |
unsigned int | pdg = 0 , |
||
bool | unpackComposite = true |
||
) | const |
Get charged particles from ROE mask.
maskName | Name of mask |
pdg | absolute value of PDG code of charged particle |
unpackComposite | return daughters of composite particles |
Definition at line 108 of file RestOfEvent.cc.
std::vector< const Particle * > getHadrons | ( | const std::string & | maskName = c_defaultMaskName , |
bool | unpackComposite = true |
||
) | const |
Get hadrons from ROE mask.
maskName | Name of mask |
unpackComposite | return daughters of composite particles |
Definition at line 96 of file RestOfEvent.cc.
|
inlineinherited |
Return a short summary of this object's contents in raw text format.
Returns the contents of getInfoHTML() while translating line-breaks etc.
Definition at line 370 of file RelationsObject.h.
|
inlinevirtualinherited |
Return a short summary of this object's contents in HTML format.
Reimplement this in your own class to provide useful output for display or debugging purposes. For example, you might do something like:
Reimplemented in Particle, Cluster, MCParticle, PIDLikelihood, SoftwareTriggerResult, Track, TrackFitResult, TRGSummary, and RecoTrack.
Definition at line 362 of file RelationsObject.h.
|
inline |
std::vector< std::string > getMaskNames | ( | ) | const |
Get vector of all mask names of the ROE object.
Definition at line 380 of file RestOfEvent.cc.
|
inlinevirtualinherited |
Return a short name that describes this object, e.g.
pi+ for an MCParticle.
Reimplemented in Particle, MCParticle, and SpacePoint.
Definition at line 344 of file RelationsObject.h.
int getNECLClusters | ( | const std::string & | maskName = c_defaultMaskName | ) | const |
Get number of all (no mask) or a subset (use mask) of all ECLclusters in ROE.
maskName | Name of mask |
Definition at line 339 of file RestOfEvent.cc.
int getNKLMClusters | ( | const std::string & | maskName = c_defaultMaskName | ) | const |
Get number of all remaining KLM clusters.
maskName | Name of mask |
Definition at line 350 of file RestOfEvent.cc.
int getNTracks | ( | const std::string & | maskName = c_defaultMaskName | ) | const |
Get number of all (no mask) or a subset (use mask) of all Tracks in ROE.
maskName | Name of mask |
Definition at line 333 of file RestOfEvent.cc.
std::vector< const Particle * > getParticles | ( | const std::string & | maskName = c_defaultMaskName , |
bool | unpackComposite = true |
||
) | const |
Get all Particles from ROE mask.
maskName | Name of mask |
unpackComposite | return daughters of composite particles |
Definition at line 45 of file RestOfEvent.cc.
|
inline |
Gets the PDG code of the rest of event.
Definition at line 211 of file RestOfEvent.h.
std::vector< const Particle * > getPhotons | ( | const std::string & | maskName = c_defaultMaskName , |
bool | unpackComposite = true |
||
) | const |
Get photons from ROE mask.
maskName | Name of mask |
unpackComposite | return daughters of composite particles |
Definition at line 84 of file RestOfEvent.cc.
|
inlineinherited |
Get the object to or from which this object has a relation.
T | The class of objects to or from which the relation points. |
name | The 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. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 278 of file RelationsObject.h.
|
inlineinherited |
Get the object from which this object has a relation.
FROM | The class of objects from which the relation points. |
name | The 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. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 263 of file RelationsObject.h.
|
inlineinherited |
Get first related object & weight of relation pointing from an array.
FROM | The class of objects from which the relation points. |
name | The 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. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 314 of file RelationsObject.h.
|
inlineinherited |
Get the object to which this object has a relation.
TO | The class of objects to which the relation points. |
name | The 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. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 248 of file RelationsObject.h.
|
inlineinherited |
Get first related object & weight of relation pointing to an array.
TO | The class of objects to which the relation points. |
name | The 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. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 297 of file RelationsObject.h.
|
inlineinherited |
Get first related object & weight of relation pointing from/to an array.
T | The class of objects to or from which the relation points. |
name | The 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. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 331 of file RelationsObject.h.
|
inlineinherited |
Get the relations that point from another store array to this object.
FROM | The class of objects from which the relations point. |
name | The 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. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 212 of file RelationsObject.h.
|
inlineinherited |
Get the relations that point from this object to another store array.
TO | The class of objects to which the relations point. |
name | The 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. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 197 of file RelationsObject.h.
|
inlineinherited |
Get the relations between this object and another store array.
Relations in both directions are returned.
T | The class of objects to or from which the relations point. |
name | The 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. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 230 of file RelationsObject.h.
bool hasMask | ( | const std::string & | name | ) | const |
True if this ROE object has mask.
name | Name of the mask to work with |
Definition at line 297 of file RestOfEvent.cc.
bool hasParticle | ( | const Particle * | particle, |
const std::string & | maskName = c_defaultMaskName |
||
) | const |
Check if ROE has StoreArray index of given to the list of unused tracks in the event.
particle | Pointer to the Particle |
maskName | Name of the mask to work with |
Definition at line 124 of file RestOfEvent.cc.
void initializeMask | ( | const std::string & | name, |
const std::string & | origin = "unknown" |
||
) |
Initialize new mask.
name | Name of the mask to work with |
origin | origin of the creator module |
Definition at line 134 of file RestOfEvent.cc.
|
inline |
Returns true if the ROE was built with most-likely particle lists.
Definition at line 271 of file RestOfEvent.h.
|
private |
Checks if a particle has its copy in the provided list.
Definition at line 370 of file RestOfEvent.cc.
void print | ( | const std::string & | maskName = c_defaultMaskName , |
bool | unpackComposite = true |
||
) | const |
Prints the contents of a RestOfEvent object to screen.
Definition at line 391 of file RestOfEvent.cc.
|
private |
Prints indices in the given set in a single line.
Definition at line 426 of file RestOfEvent.cc.
|
inline |
Sets the PDG code of the rest of event.
Definition at line 196 of file RestOfEvent.h.
void updateMaskWithCuts | ( | const std::string & | name, |
const std::shared_ptr< Variable::Cut > & | trackCut = nullptr , |
||
const std::shared_ptr< Variable::Cut > & | eclCut = nullptr , |
||
const std::shared_ptr< Variable::Cut > & | klmCut = nullptr , |
||
bool | updateExisting = false |
||
) |
Update mask with cuts.
name | Name of the mask to work with |
trackCut | Cut on Track particles |
eclCut | Cut on ECL particles |
klmCut | Cut on KLM particles |
updateExisting | Update existing mask if true or not if false |
Definition at line 191 of file RestOfEvent.cc.
void updateMaskWithV0 | ( | const std::string & | name, |
const Particle * | particleV0 | ||
) |
Update mask with composite particle.
name | Name of the mask to work with |
particleV0 | Pointer to composite particle |
Definition at line 231 of file RestOfEvent.cc.
|
staticconstexpr |
Default mask name.
Definition at line 60 of file RestOfEvent.h.
|
private |
indicates whether most-likely particle lists were used in build of ROE
Definition at line 368 of file RestOfEvent.h.
|
mutableprivateinherited |
Cache of the index in the TClonesArray to which this object belongs.
Definition at line 432 of file RelationsObject.h.
|
mutableprivateinherited |
Cache of the data store entry to which this object belongs.
Definition at line 429 of file RelationsObject.h.
|
private |
MC ROE indicator.
Definition at line 366 of file RestOfEvent.h.
|
private |
Nested ROE indicator.
Definition at line 365 of file RestOfEvent.h.
|
private |
List of the ROE masks.
Definition at line 363 of file RestOfEvent.h.
|
private |
StoreArray indices to unused particles.
Definition at line 362 of file RestOfEvent.h.
|
private |
PDG code of the 'ROE particle' if we are going to create one.
Definition at line 364 of file RestOfEvent.h.
|
private |
Include KLM energy into ROE 4-vector.
Definition at line 367 of file RestOfEvent.h.