11#include <framework/datastore/RelationsObject.h>
12#include <framework/gearbox/Const.h>
13#include <mdst/dataobjects/ECLCluster.h>
15#include <Math/Vector3D.h>
16#include <Math/Vector4D.h>
17#include <TMatrixFfwd.h>
18#include <TMatrixFSymfwd.h>
102 enum {c_DimPosition = 3, c_DimMomentum = 4, c_DimMatrix = 7,
103 c_SizeMatrix = c_DimMatrix * (c_DimMatrix + 1) / 2
110 enum {c_Px, c_Py, c_Pz, c_E, c_X, c_Y, c_Z};
141 Particle(
const ROOT::Math::PxPyPzEVector& momentum,
const int pdgCode);
152 Particle(
const ROOT::Math::PxPyPzEVector& momentum,
156 const unsigned mdstIndex);
167 Particle(
const ROOT::Math::PxPyPzEVector& momentum,
170 const std::vector<int>& daughterIndices,
171 TClonesArray* arrayPointer =
nullptr);
183 Particle(
const ROOT::Math::PxPyPzEVector& momentum,
186 const std::vector<int>& daughterIndices,
188 TClonesArray* arrayPointer =
nullptr);
201 Particle(
const ROOT::Math::PxPyPzEVector& momentum,
204 const std::vector<int>& daughterIndices,
206 const std::vector<int>& daughterProperties,
207 TClonesArray* arrayPointer =
nullptr);
387 const ROOT::Math::XYZVector& vertex,
388 const TMatrixFSym& errMatrix,
409 void appendDaughter(
const Particle* daughter,
const bool updateType =
true,
const int daughterProperty = c_Ordinary);
633 return ROOT::Math::XYZVector(
m_x,
m_y,
m_z);
767 bool recursive =
true,
bool includeSelf =
true)
const;
826 bool isCopyOf(
const Particle* oParticle,
bool doDetailedComparison =
false)
const;
893 std::string
getName()
const override;
941 void setExtraInfo(
const std::string& name,
double value);
947 void addExtraInfo(
const std::string& name,
double value);
1040 void fillFSPDaughters(std::vector<const Belle2::Particle*>& fspDaughters)
const;
1048 void fillAllDaughters(std::vector<const Belle2::Particle*>& allDaughters)
const;
Provides a type-safe way to pass members of the chargedStableSet set.
The ParticleType class for identifying different particle types.
static const ParticleType neutron
neutron particle
static const ChargedStable muon
muon particle
static const ChargedStable pion
charged pion particle
static const ParticleType Klong
K^0_L particle.
static const ChargedStable proton
proton particle
static const ChargedStable kaon
charged kaon particle
static const ParticleType photon
photon particle
static const ChargedStable electron
electron particle
static const ChargedStable deuteron
deuteron particle
EHypothesisBit
The hypothesis bits for this ECLCluster (Connected region (CR) is split using this hypothesis.
@ c_nPhotons
CR is split into n photons (N1)
@ c_neutralHadron
CR is reconstructed as a neutral hadron (N2)
@ c_none
None as initializer.
A Class to store the Monte Carlo particle information.
Class to collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM aimed for output to mdst includes...
Specialised SelectSubset<Particle> that also fixes daughter indices and all ParticleLists.
Class to store reconstructed particles.
void setProperty(const int properties)
sets m_properties
void removeExtraInfo()
Remove all stored extra info fields.
double getPx() const
Returns x component of momentum.
ClassDefOverride(Particle, 17)
Class to store reconstructed particles.
void updateJacobiMatrix()
Propagate the photon energy scaling to jacobian elements that were calculated using energy.
TMatrixFSym getVertexErrorMatrix() const
Returns the 3x3 position error sub-matrix.
bool isMostLikely() const
Returns true if the (track-based) particle is created with its most likely mass hypothesis based on P...
const KLMCluster * getKLMCluster() const
Returns the pointer to the KLMCluster object that was used to create this Particle (ParticleType == c...
double m_momentumSmearingFactor
momentum smearing factor
bool replaceDaughter(const Particle *oldDaughter, Particle *newDaughter)
Replace index of given daughter with new daughter, return true if a replacement is made.
const Track * getTrack() const
Returns the pointer to the Track object that was used to create this Particle (ParticleType == c_Trac...
void setMomentumPositionErrorMatrix(const TrackFitResult *trackFit)
Sets the momentum, position and error matrix for this particle (created from charged Track)
const std::vector< int > & getDaughterIndices() const
Returns a vector of store array indices of daughter particles.
void storeErrorMatrix(const TMatrixFSym &errMatrix)
Stores 7x7 error matrix into private member m_errMatrix.
bool forEachDaughter(const std::function< bool(const Particle *)> &function, bool recursive=true, bool includeSelf=true) const
Apply a function to all daughters of this particle.
std::vector< const Belle2::Particle * > getFinalStateDaughters() const
Returns a vector of pointers to Final State daughter particles.
const MCParticle * getMCParticle() const
Returns the pointer to the MCParticle object that was used to create this Particle (ParticleType == c...
void appendDaughter(const Particle *daughter, const bool updateType=true, const int daughterProperty=c_Ordinary)
Appends index of daughter to daughters index array.
const ECLCluster * getECLCluster() const
Returns the pointer to the ECLCluster object that was used to create this Particle (if ParticleType =...
void setExtraInfo(const std::string &name, double value)
Sets the user-defined data of given name to the given value.
EParticleSourceObject
particle source enumerators
double m_pValue
chi^2 probability of the fit.
double m_pz
momentum component z
int m_pdgCodeUsedForFit
PDG code used for the track fit.
double m_momentumScale
effective momentum scale factor
std::string getName() const override
Return name of this particle.
bool overlapsWith(const Particle *oParticle) const
Returns true if final state ancestors of oParticle overlap.
double getCosHelicityDaughter(unsigned iDaughter, unsigned iGrandDaughter=0) const
Returns cosine of the helicity angle of the given daughter defined by given grand daughter.
double getPz() const
Returns z component of momentum.
std::vector< std::string > getExtraInfoNames() const
get a list of the extra info names
double getX() const
Returns x component of vertex position.
bool isCopyOf(const Particle *oParticle, bool doDetailedComparison=false) const
Returns true if this Particle and oParticle are copies of each other.
const std::vector< int > & getDaughterProperties() const
Returns a vector of properties of daughter particles.
void writeExtraInfo(const std::string &name, const double value)
Sets the user defined extraInfo.
void setVertex(const ROOT::Math::XYZVector &vertex)
Sets position (decay vertex)
std::vector< int > getMdstArrayIndices(EParticleSourceObject type) const
Returns a vector of StoreArray indices of given MDST dataobjects.
double m_jacobiMatrix[c_SizeMatrix]
error matrix (1D representation)
void resetJacobiMatrix()
Resets 4x6 error matrix All elements are set to 0.0.
void set4VectorDividingByMomentumScaling(const ROOT::Math::PxPyPzEVector &p4)
Sets Lorentz vector dividing by the momentum scaling factor.
void storeJacobiMatrix(const TMatrixF &jacobiMatrix)
Stores 4x6 Jacobi matrix into private member m_jacobiMatrix.
bool isMostLikelyTrackFitResult() const
Returns true if the (track-based) particle is created with its most likely mass hypothesis based on T...
std::vector< double > m_extraInfo
Stores associated user defined values.
double getEffectiveMomentumScale() const
Returns effective momentum scale which is the product of the momentum scaling and smearing factors.
unsigned m_mdstIndex
0-based index of MDST store array object
double getPValue() const
Returns chi^2 probability of fit if done or -1.
void setFlavorType()
sets m_flavorType using m_pdgCode
double getEnergy() const
Returns total energy.
void setMomentumScalingFactor(double momentumScalingFactor)
Sets momentum scaling.
int getMdstSource() const
Returns unique identifier of final state particle (needed in particle combiner)
ROOT::Math::XYZVector getVertex() const
Returns vertex position (POCA for charged, IP for neutral FS particles)
void fillAllDaughters(std::vector< const Belle2::Particle * > &allDaughters) const
Fill all generations' daughters into a vector.
bool hasExtraInfo(const std::string &name) const
Return whether the extra info with the given name is set.
std::string getInfoHTML() const override
Return a short summary of this object's contents in HTML format.
void setMdstArrayIndex(const int arrayIndex)
set mdst array index
const Particle * getParticleFromGeneralizedIndexString(const std::string &generalizedIndex) const
Explores the decay tree of the particle and returns the (grand^n)daughter identified by a generalized...
unsigned getMdstArrayIndex(void) const
Returns 0-based index of MDST store array object (0 for composite particles)
double m_py
momentum component y
int getPDGCodeUsedForFit() const
Return the always positive PDG code which was used for the track fit (if there was a track fit) of th...
double m_x
position component x
double m_px
momentum component x
double getMomentumLossCorrectionFactor() const
Returns effect of energy correction on the particle momentum.
std::pair< Const::ChargedStable, const TrackFitResult * > getMostLikelyTrackFitResult() const
For a (track-based) particle, returns the charged stable mass hypothesis associated to the most proba...
EFlavorType getFlavorType() const
Returns flavor type of the decay (for FS particles: flavor type of particle)
void fillFSPDaughters(std::vector< const Belle2::Particle * > &fspDaughters) const
Fill final state particle daughters into a vector.
const PIDLikelihood * getPIDLikelihood() const
Returns the pointer to the PIDLikelihood object that is related to the Track, which was used to creat...
const V0 * getV0() const
Returns the pointer to the V0 object that was used to create this Particle (if ParticleType == c_V0).
TClonesArray * m_arrayPointer
Internal pointer to DataStore array containing the daughters of this particle.
EParticleSourceObject m_particleSource
(mdst) source of particle
void fillDecayChain(std::vector< int > &decayChain) const
Fill vector with (PDGCode, MdstSource) pairs for the entire decay chain.
int getPDGCode(void) const
Returns PDG code.
double getPy() const
Returns y component of momentum.
bool wasExactFitHypothesisUsed() const
Returns true if the type represented by this Particle object was used use as a mass hypothesis during...
int getProperty() const
Returns particle property as a bit pattern The values are defined in the PropertyFlags enum and descr...
double getCosHelicity(const Particle *mother=nullptr) const
Returns cosine of the helicity angle The helicity angle is defined in the rest frame of the particle ...
double m_momentumScalingFactor
momentum scaling factor
unsigned getNDaughters(void) const
Returns number of daughter particles.
std::vector< Belle2::Particle * > getDaughters() const
Returns a vector of pointers to daughter particles.
TClonesArray * getArrayPointer() const
Returns the pointer to the store array which holds the daughter particles.
double getZ() const
Returns z component of vertex position.
void resetErrorMatrix()
Resets 7x7 error matrix All elements are set to 0.0.
double getPDGMass(void) const
Returns uncertainty on the invariant mass (requires valid momentum error matrix)
void setMomentumSmearingFactor(double momentumSmearingFactor)
Sets momentum smearing.
EFlavorType m_flavorType
flavor type.
double m_energyLossCorrection
energy loss correction.
int generatePDGCodeFromCharge(const int chargedSign, const Const::ChargedStable &chargedStable)
Generate the PDG code with correct sign, using the charge.
double getCharge(void) const
Returns particle charge.
ROOT::Math::PxPyPzEVector get4Vector() const
Returns Lorentz vector.
void appendDaughter(int particleIndex, const bool updateType=true)
Appends index of daughter to daughters index array.
Particle()
Default constructor.
TMatrixFSym getMomentumErrorMatrix() const
Returns the 4x4 momentum error matrix.
double m_mass
particle (invariant) mass
std::vector< const Belle2::Particle * > getAllDaughters() const
Returns a vector of pointers to all generations' daughter particles.
double getAcoplanarity() const
Returns acoplanarity angle defined as the angle between the decay planes of the grand daughters in th...
std::vector< int > m_daughterProperties
daughter particle properties
double m_errMatrix[c_SizeMatrix]
error matrix (1D representation)
std::vector< int > m_daughterIndices
daughter particle indices
double getY() const
Returns y component of vertex position.
void addExtraInfo(const std::string &name, double value)
Sets the user-defined data of given name to the given value.
void set4Vector(const ROOT::Math::PxPyPzEVector &p4)
Sets Lorentz vector.
void setEnergyLossCorrection(double energyLossCorrection)
Sets Energy loss correction.
void setJacobiMatrix(const TMatrixF &jacobiMatrix)
Sets 4x6 jacobi matrix.
int getExtraInfoMap() const
Return the id of the associated ParticleExtraInfoMap or -1 if no map is set.
double getPDGLifetime() const
Returns particle nominal lifetime.
void setMomentumVertexErrorMatrix(const TMatrixFSym &errMatrix)
Sets 7x7 error matrix.
ROOT::Math::XYZVector getMomentum() const
Returns momentum vector.
void setPValue(double pValue)
Sets chi^2 probability of fit.
EParticleSourceObject getParticleSource() const
Returns particle source as defined with enum EParticleSourceObject.
void updateMass(const int pdgCode)
Updates particle mass with the mass of the particle corresponding to the given PDG.
double m_z
position component z
void print() const
Prints the contents of a Particle object to standard output.
void updateMomentum(const ROOT::Math::PxPyPzEVector &p4, const ROOT::Math::XYZVector &vertex, const TMatrixFSym &errMatrix, double pValue)
Sets Lorentz vector, position, 7x7 error matrix and p-value.
EFlavorType
describes flavor type, see getFlavorType().
@ c_Unflavored
Is its own antiparticle or we don't know whether it is a particle/antiparticle.
@ c_Flavored
Is either particle or antiparticle.
TMatrixFSym getMomentumVertexErrorMatrix() const
Returns 7x7 error matrix.
PropertyFlags
Flags that describe the particle property, which are used in the MC matching.
@ c_IsIgnoreNeutrino
Is the particle MC matched with the ignore missing neutrino flag set?
@ c_IsIgnoreRadiatedPhotons
Is the particle MC matched with the ignore radiated photon flag set?
@ c_IsIgnoreGamma
Is the particle MC matched with the ignore missing gamma flag set?
@ c_IsUnspecified
Ordinary particles.
@ c_IsIgnoreBrems
Is the particle MC matched with the ignore added Brems gamma flag set?
@ c_IsIgnoreDecayInFlight
Is the particle MC matched with the ignore DecayInFlight flag set?
@ c_IsIgnoreMisID
Is the particle MC matched with the ignore MisID flag set?
@ c_IsIgnoreIntermediate
Is the particle MC matched with the ignore intermediate resonances flag set?
@ c_IsIgnoreMassive
Is the particle MC matched with the ignore missing massive particle flag set?
double getEnergyLossCorrection() const
Returns Energy Loss Correction.
double getECLClusterEnergy() const
Returns the energy of the ECLCluster for the particle.
const TrackFitResult * getTrackFitResult() const
Returns the pointer to the TrackFitResult that was used to create this Particle (ParticleType == c_Tr...
double getMomentumMagnitude() const
Returns momentum magnitude.
void removeDaughter(const Particle *daughter, const bool updateType=true)
Removes index of daughter from daughters index array.
double getP() const
Returns momentum magnitude (same as getMomentumMagnitude but with shorter name)
double m_y
position component y
void setPDGCode(const int pdg)
Sets PDG code.
unsigned int getExtraInfoSize() const
Return the size of the extra info array.
int m_identifier
Identifier that can be used to identify whether the particle is unique or is a copy or representation...
int m_properties
particle property
const Particle * getDaughter(unsigned i) const
Returns a pointer to the i-th daughter particle.
double getExtraInfo(const std::string &name) const
Return given value if set.
ECLCluster::EHypothesisBit getECLClusterEHypothesisBit() const
Returns the ECLCluster EHypothesisBit for this Particle.
bool replaceDaughterRecursively(const Particle *oldDaughter, Particle *newDaughter)
Apply replaceDaughter to all Particles in the decay tree by looping recursively through it,...
double getMass() const
Returns invariant mass (= nominal for FS particles)
Defines interface for accessing relations of objects in StoreArray.
TClonesArray * getArrayPointer() const
Returns the pointer to the raw DataStore array holding this object (protected since these arrays are ...
Values of the result of a track fit with a given particle hypothesis.
Class that bundles various TrackFitResults.
Object holding information for V0s.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.