Belle II Software light-2406-ragdoll
|
Functions to perform Monte Carlo matching for reconstructed Particles. More...
#include <MCMatching.h>
Public Types | |
enum | MCErrorFlags { c_Correct = 0 , c_MissFSR = 1 , c_MissingResonance = 2 , c_DecayInFlight = 4 , c_MissNeutrino = 8 , c_MissGamma = 16 , c_MissMassiveParticle = 32 , c_MissKlong = 64 , c_MisID = 128 , c_AddedWrongParticle = 256 , c_InternalError = 512 , c_MissPHOTOS = 1024 , c_AddedRecoBremsPhoton = 2048 } |
Flags that describe different reconstruction errors. More... | |
Static Public Member Functions | |
static std::string | explainFlags (unsigned int flags) |
Return string with all human-readable flags, e.g. | |
static bool | setMCTruth (const Belle2::Particle *particle) |
This is the main function of MC matching algorithm. | |
static int | getMCErrors (const Belle2::Particle *particle, const Belle2::MCParticle *mcParticle=nullptr) |
Returns quality indicator of the match as a bit pattern where the individual bits indicate the the type of mismatch. | |
static int | setMCErrorsExtraInfo (Belle2::Particle *particle, const Belle2::MCParticle *mcParticle) |
Sets error flags in extra-info (also returns it). | |
static void | fillGenMothers (const Belle2::MCParticle *mcP, std::vector< int > &genMCPMothers) |
Fills vector with array (1-based) indices of all generator ancestors of given MCParticle. | |
static int | findCommonMother (const Belle2::MCParticle *mcP, const std::vector< int > &firstMothers, int lastMother) |
Finds a mother of mcP that is in firstMothers, from [lastMother, end]. | |
static bool | isFSP (int pdg) |
Returns true if given PDG code indicates a FSP. | |
static bool | isFSR (const Belle2::MCParticle *p) |
Returns true if given MCParticle is a final state radiation (FSR) photon based on MCParticle::c_IsFSRPhoton. | |
static bool | isFSRLegacy (const Belle2::MCParticle *p) |
Returns true if given MCParticle is a final state radiation (FSR) photon. | |
static bool | isRadiativePhoton (const Belle2::MCParticle *p) |
Returns true if given MCParticle is a radiative photon. | |
static int | getMissingParticleFlags (const Belle2::Particle *particle, const Belle2::MCParticle *mcParticle) |
Determines which daughters of 'mcParticle' are not reconstructed by any daughter of 'particle'. | |
static int | getFlagsOfFSP (const Particle *particle, const MCParticle *mcParticle) |
Returns flags of given Final State Particle. | |
static int | getFlagsOfDaughters (const Particle *daughter, const MCParticle *mcParticle) |
Returns flags of daughters of given particle. | |
static int | getFlagsOfBremsPhotonDaughter (const Particle *daughter, const MCParticle *mcParticle, const std::vector< const MCParticle * > &genParts) |
Returns flags of given daughter which is a brems photon. | |
static int | getNumberOfDaughtersWithoutNeutrinos (const MCParticle *mcParticle) |
Determines the number of daughter particles which are not neutrinos. | |
static int | countMissingParticle (const Belle2::Particle *particle, const Belle2::MCParticle *mcParticle, const std::vector< int > &daughterPDG) |
Count the number of missing daughters of the 'particle'. | |
static int | getFlagsIgnoredByProperty (const Belle2::Particle *particle) |
Returns the flags ignored by PropertyFlags of given particle. | |
static int | makeDaughterAcceptMask (int daughterProperty) |
Returns the daughter mask from given daughterProperty. | |
Static Public Attributes | |
static const std::string | c_extraInfoMCErrors = "mcErrors" |
Name of extra-info field stored in Particle. | |
Functions to perform Monte Carlo matching for reconstructed Particles.
End users should usually not need to run these functions directly, but can use the matchMCTruth() python function in modularAnalysis (or the MCMatching module). Afterwards, Particles have relations to the matched MCParticle.
Different MCErrorFlags flags can be queried using getMCErrors(), or the associated 'mcErrors' variable (available via VariablesToNtuple, the MCTruth ntuple tool, etc.). For checking if a Particle is correctly reconstructed, the 'isSignal' variable can be used.
Definition at line 28 of file MCMatching.h.
enum MCErrorFlags |
Flags that describe different reconstruction errors.
Enumerator | |
---|---|
c_Correct | This Particle and all its daughters are perfectly reconstructed. |
c_MissFSR | A Final State Radiation (FSR) photon is not reconstructed (based on MCParticle::c_IsFSRPhoton). |
c_MissingResonance | The associated MCParticle decay contained additional non-final-state particles (e.g. a rho) that weren't reconstructed. This is probably O.K. in most cases |
c_DecayInFlight | A Particle was reconstructed from the secondary decay product of the actual particle. This means that a wrong hypothesis was used to reconstruct it, which e.g. for tracks might mean a pion hypothesis was used for a secondary electron. |
c_MissNeutrino | A neutrino is missing (not reconstructed). |
c_MissGamma | A photon (not FSR) is missing (not reconstructed). |
c_MissMassiveParticle | A generated massive FSP is missing (not reconstructed). |
c_MissKlong | A Klong is missing (not reconstructed). |
c_MisID | One of the charged final state particles is mis-identified, i.e. PDG != mcPDG. This can be due to the mis-identification of particle type (i.e. abs(PDG) != abs(mcPDG)) and/or the wrong charge assignment (i.e. charge != mcCharge). |
c_AddedWrongParticle | A non-FSP Particle has wrong PDG code, meaning one of the daughters (or their daughters) belongs to another Particle. |
c_InternalError | There was an error in MC matching. Not a valid match. Might indicate fake/background track or cluster. |
c_MissPHOTOS | A photon created by PHOTOS was not reconstructed (based on MCParticle::c_IsPHOTOSPhoton) |
c_AddedRecoBremsPhoton | A photon added with the bremsstrahlung recovery tools (correctBrems or correctBremsBelle) has no MC particle assigned, or it doesn't belong to the decay chain. |
Definition at line 33 of file MCMatching.h.
|
static |
Count the number of missing daughters of the 'particle'.
Definition at line 561 of file MCMatching.cc.
|
static |
Return string with all human-readable flags, e.g.
explainFlags(402) returns "c_MissingResonance | c_MissGamma | c_MisID | c_AddedWrongParticle".
Can also be used from Python:
Definition at line 26 of file MCMatching.cc.
|
static |
Fills vector with array (1-based) indices of all generator ancestors of given MCParticle.
mcP | pointer to the MCParticle |
genMCPMothers | pointer to the generator ancestors MCParticle |
Definition at line 61 of file MCMatching.cc.
|
static |
Finds a mother of mcP that is in firstMothers, from [lastMother, end].
To actually find the common mother of all daughters, each time this function is called for a daughter particle, specify the return value from the last call for lastMother.
Note: this looks like an ideal case for applying a more sophisticated algorithm for LCA (lowest common ancestor) problems. However, our trees aren't very large, so additional preprocessing might slow this down (I saw this when experimenting with the algorithm). This might still be worth looking into if an algorithm with inexpensive preprocessing were used, or the preprocessing was done only once per event. See http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=lowestCommonAncestor for an interesting introduction to related algorithms.
Definition at line 70 of file MCMatching.cc.
|
static |
Returns the flags ignored by PropertyFlags of given particle.
Only c_isIgnored... flags are considered. c_isUnspecified is already considered in setMCErrorsExtraInfo function.
Definition at line 588 of file MCMatching.cc.
|
static |
Returns flags of given daughter which is a brems photon.
Special treatment for brems is done.
daughter | |
mcParticle | (this is MC mother of daughter) |
genParts | vector of MC (n*grand-)daughters |
Definition at line 409 of file MCMatching.cc.
|
static |
Returns flags of daughters of given particle.
daughter | |
mcParticle |
Definition at line 371 of file MCMatching.cc.
|
static |
Returns flags of given Final State Particle.
particle | |
mcParticle |
Definition at line 343 of file MCMatching.cc.
|
static |
Returns quality indicator of the match as a bit pattern where the individual bits indicate the the type of mismatch.
The values are defined in the MCErrorFlags enum and described in detail there.
A return value equal to c_Correct == 0 indicates a perfect MC match (everything OK).
The value is also stored inside the Particle's extra-info fields (so it is calculated only once per candidate).
particle | pointer to the particle. setMCTruth() must have been called previously (usually via the MCMatching module)! |
mcParticle | pointer to the matched MCParticle. Can be specified to avoid repeated lookups. |
Definition at line 282 of file MCMatching.cc.
|
static |
Determines which daughters of 'mcParticle' are not reconstructed by any daughter of 'particle'.
Definition at line 502 of file MCMatching.cc.
|
static |
Determines the number of daughter particles which are not neutrinos.
Needed to handle the special case tau -> rho nu correctly.
mcParticle |
Definition at line 435 of file MCMatching.cc.
|
static |
Returns true if given PDG code indicates a FSP.
Definition at line 448 of file MCMatching.cc.
|
static |
Returns true if given MCParticle is a final state radiation (FSR) photon based on MCParticle::c_IsFSRPhoton.
Assumes PDG code of p is 22.
Definition at line 469 of file MCMatching.cc.
|
static |
Returns true if given MCParticle is a final state radiation (FSR) photon.
This is a legacy version of isFSR(const Belle2::MCParticle* p) function that works on MC samples without MCParticle::c_IsFSRPhoton and MCParticle::c_IsPHOTOSPhoton properly set (for example Belle MC).
Definition at line 474 of file MCMatching.cc.
|
static |
Returns true if given MCParticle is a radiative photon.
Assumes PDG code of p is 22.
Definition at line 495 of file MCMatching.cc.
|
static |
Returns the daughter mask from given daughterProperty.
Definition at line 597 of file MCMatching.cc.
|
static |
Sets error flags in extra-info (also returns it).
Users should use getMCErrors(), which only calculates this information when necessary.
Definition at line 293 of file MCMatching.cc.
|
static |
This is the main function of MC matching algorithm.
When executed the algorithm searches for first common generated mother (MCParticle) of this particle's daughters. If such MCParticle is found the Particle -> MCParticle relation is set between them. If the relation between daughter particles and matched generated MC particle does not exist the algorithm sets it also for them.
particle | pointer to the Particle to be mc-matched |
Definition at line 86 of file MCMatching.cc.
|
static |
Name of extra-info field stored in Particle.
Definition at line 30 of file MCMatching.h.