9 #include <analysis/dataobjects/Particle.h>
10 #include <analysis/dataobjects/ParticleExtraInfoMap.h>
12 #include <analysis/ClusterUtility/ClusterUtils.h>
14 #include <mdst/dataobjects/KLMCluster.h>
15 #include <mdst/dataobjects/MCParticle.h>
16 #include <mdst/dataobjects/PIDLikelihood.h>
17 #include <mdst/dataobjects/Track.h>
18 #include <mdst/dataobjects/TrackFitResult.h>
19 #include <mdst/dataobjects/V0.h>
20 #include <mdst/dbobjects/CollisionBoostVector.h>
21 #include <mdst/dbobjects/CollisionInvariantMass.h>
23 #include <framework/datastore/StoreArray.h>
24 #include <framework/datastore/StoreObjPtr.h>
25 #include <framework/database/DBObjPtr.h>
26 #include <framework/logging/Logger.h>
27 #include <framework/utilities/HTML.h>
28 #include <framework/utilities/Conversion.h>
30 #include <TClonesArray.h>
31 #include <TDatabasePDG.h>
32 #include <TMatrixFSym.h>
33 #include <Math/Boost.h>
40 #include <boost/algorithm/string.hpp>
43 using namespace ROOT::Math;
46 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
47 m_pValue(nan(
"")), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0),
48 m_arrayPointer(nullptr)
55 m_pdgCode(pdgCode), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
56 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
70 EFlavorType flavorType,
71 const EParticleSourceObject source,
72 const unsigned mdstIndex) :
73 m_pdgCode(pdgCode), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
74 m_pValue(-1), m_flavorType(flavorType), m_particleSource(source), m_properties(0), m_arrayPointer(nullptr)
91 EFlavorType flavorType,
92 const std::vector<int>& daughterIndices,
93 TClonesArray* arrayPointer) :
94 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
96 m_daughterIndices(daughterIndices),
97 m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0),
98 m_properties(0), m_arrayPointer(arrayPointer)
111 if (!daughterIndices.empty()) {
114 B2FATAL(
"Composite Particle (with daughters) was constructed outside StoreArray without specifying daughter array!");
124 EFlavorType flavorType,
125 const std::vector<int>& daughterIndices,
126 const int properties,
127 TClonesArray* arrayPointer) :
128 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
130 m_daughterIndices(daughterIndices),
131 m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0),
132 m_arrayPointer(arrayPointer)
146 if (!daughterIndices.empty()) {
149 B2FATAL(
"Composite Particle (with daughters) was constructed outside StoreArray without specifying daughter array!");
160 EFlavorType flavorType,
161 const std::vector<int>& daughterIndices,
162 const int properties,
163 const std::vector<int>& daughterProperties,
164 TClonesArray* arrayPointer) :
165 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
167 m_daughterIndices(daughterIndices),
168 m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0),
169 m_daughterProperties(daughterProperties),
170 m_arrayPointer(arrayPointer)
184 if (!daughterIndices.empty()) {
187 B2FATAL(
"Composite Particle (with daughters) was constructed outside StoreArray without specifying daughter array!");
195 Particle(track ? track->getArrayIndex() : 0, track ? track->getTrackFitResultWithClosestMass(chargedStable) : nullptr,
203 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
204 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
206 if (!trackFit)
return;
217 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr)
218 B2FATAL(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
226 m_pdgCode(type.getPDGCode()), m_mass(type.getMass()), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
227 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
229 if (!eclCluster)
return;
240 m_px = clustermom.Px();
241 m_py = clustermom.Py();
242 m_pz = clustermom.Pz();
270 TMatrixD scaledJacobi(4, 6);
274 for (
int irow = 0; irow < 4; irow++) {
275 for (
int icol = 0; icol < 6; icol++) {
276 if (icol != 0 && irow != 3) {
296 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
297 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
299 if (!klmCluster)
return;
322 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
323 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
325 if (!mcParticle)
return;
358 const int crid = cluster->getConnectedRegionId();
359 const int clusterid = cluster->getClusterId();
362 B2ERROR(
"Particle is of type = ECLCluster has identifier not set and no relation to ECLCluster.\n"
363 "This has happen because old microDST is analysed with newer version of software.");
382 const int crid = cluster->getConnectedRegionId();
383 const int clusterid = cluster->getClusterId();
384 identifier = 1000 * crid + clusterid;
386 B2ERROR(
"Particle is of type = ECLCluster has identifier not set and no relation to ECLCluster.\n"
387 "This has happen because old microDST is analysed with newer version of software.");
401 if (m.GetNrows() != c_DimMatrix || m.GetNcols() != c_DimMatrix) {
403 B2WARNING(
"Error Matrix is not 7x7 ");
415 if (m.GetNrows() != 4 || m.GetNcols() != 6) {
417 B2WARNING(
"Jacobi Matrix is not 4x6 ");
426 TMatrixFSym m(c_DimMatrix);
429 for (
int irow = 0; irow < c_DimMatrix; irow++) {
430 for (
int icol = irow; icol < c_DimMatrix; icol++) {
431 m(irow, icol) = m(icol, irow) =
m_errMatrix[element];
446 full.GetSub(0, 3, mom,
"S");
458 full.GetSub(4, 6, pos,
"S");
469 PxPyPzEVector pMother;
471 pMother = mother->get4Vector();
475 pMother.SetE(cmsMass->getMass());
476 pMother = Boost(cmsBoost->getBoost()) * pMother;
478 pMother = boost * pMother;
481 PxPyPzEVector pDaughter;
488 pDaughter = daughter->get4Vector();
491 pDaughter = boost * pDaughter;
496 XYZVector pDaughterNormal(pDaughter0.Vect().Cross(pDaughter1.Vect()));
497 pDaughter.SetPxPyPzE(pDaughterNormal.X(), pDaughterNormal.Y(), pDaughterNormal.Z(), 0);
501 double mag2 = pMother.P2() * pDaughter.P2();
502 if (mag2 <= 0)
return std::numeric_limits<double>::quiet_NaN();
503 return -pMother.Vect().Dot(pDaughter.Vect()) /
sqrt(mag2);
510 B2ERROR(
"No daughter of particle 'name' with index 'iDaughter' for calculation of helicity angle"
512 return std::numeric_limits<double>::quiet_NaN();
517 Boost boost(daughter->get4Vector().BoostToCM());
523 if (daughter->getNDaughters() <= iGrandDaughter) {
524 B2ERROR(
"No grand daughter of daughter 'iDaughter' of particle 'name' with index 'iGrandDaughter' for calculation of helicity angle"
526 return std::numeric_limits<double>::quiet_NaN();
530 PxPyPzEVector pGrandDaughter = boost * daughter->getDaughter(iGrandDaughter)->get4Vector();
532 double mag2 = pMother.P2() * pGrandDaughter.P2();
533 if (mag2 <= 0)
return std::numeric_limits<double>::quiet_NaN();
534 return -pMother.Vect().Dot(pGrandDaughter.Vect()) /
sqrt(mag2);
541 B2ERROR(
"Cannot calculate acoplanarity of particle 'name' because the number of daughters is not 2"
543 return std::numeric_limits<double>::quiet_NaN();
548 B2ERROR(
"Cannot calculate acoplanarity of particle 'name' because the number of grand daughters is not 2"
551 return std::numeric_limits<double>::quiet_NaN();
558 PxPyPzEVector pDaughter0 = boost * daughter0->
get4Vector();
560 PxPyPzEVector pDaughter1 = boost * daughter1->
get4Vector();
564 XYZVector normal0 = pDaughter0.Vect().Cross(pGrandDaughter0.Vect());
565 XYZVector normal1 = -pDaughter1.Vect().Cross(pGrandDaughter1.Vect());
566 double result = acos(normal0.Unit().Dot(normal1.Unit()));
567 if (normal0.Cross(normal1).Dot(pDaughter0.Vect()) < 0) result = -result;
603 if (TDatabasePDG::Instance()->GetParticle(pdgCode) ==
nullptr)
604 B2FATAL(
"PDG=" << pdgCode <<
" ***code unknown to TDatabasePDG");
605 m_mass = TDatabasePDG::Instance()->GetParticle(pdgCode)->Mass() ;
610 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
611 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
614 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Mass();
619 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
620 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
623 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Lifetime();
628 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
629 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
632 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Charge() / 3.0;
644 std::vector<Particle*> daughters(nDaughters);
647 for (
unsigned i = 0; i < nDaughters; i++)
655 std::vector<const Particle*> fspDaughters;
663 std::vector<const Particle*> allDaughters;
671 std::vector<int> mdstIndices;
674 if (fsp->getParticleSource() == source)
675 mdstIndices.push_back(fsp->getMdstArrayIndex());
733 isReplaced = daughter->replaceDaughterRecursively(oldDaughter, newDaughter);
748 for (
auto& thisFSP : thisFSPs)
749 for (
auto& otherFSP : otherFSPs)
750 if (thisFSP->getMdstSource() == otherFSP->getMdstSource())
770 std::vector<int> thisDecayChain(nDaughters * 2);
771 std::vector<int> othrDecayChain(nDaughters * 2);
773 for (
unsigned i = 0; i < nDaughters; i++) {
782 sort(thisDecayChain.begin(), thisDecayChain.end());
783 sort(othrDecayChain.begin(), othrDecayChain.end());
785 for (
unsigned i = 0; i < thisDecayChain.size(); i++)
786 if (thisDecayChain[i] != othrDecayChain[i])
794 if (!doDetailedComparison)
802 B2WARNING(
"Something went wrong: MCParticle is being compared to a non MC Particle. Please check your script!\n"
803 " If the MCParticle <-> Particle comparison happens in the RestOfEventBuilder,\n"
804 " the Rest Of Event may contain signal side particles.");
861 auto* selfrelated = this->getRelatedTo<TrackFitResult>();
862 if (selfrelated && !isnan(selfrelated->getPValue()))
868 return selftrack->getTrackFitResultWithClosestMass(
904 const ECLCluster* bestTrackMatchedCluster =
nullptr;
905 double highestEnergy = -1.0;
914 bestTrackMatchedCluster = &cluster;
917 return bestTrackMatchedCluster;
926 if (!cluster)
return 0;
952 const MCParticle* related = this->getRelated<MCParticle>();
963 std::vector<std::string> generalizedIndexes;
964 boost::split(generalizedIndexes, generalizedIndex, boost::is_any_of(
":"));
966 if (generalizedIndexes.empty()) {
967 B2WARNING(
"Generalized index of daughter particle is empty. Skipping.");
978 for (
auto& indexString : generalizedIndexes) {
982 dauIndex = Belle2::convertString<int>(indexString);
983 }
catch (std::invalid_argument&) {
984 B2WARNING(
"Found the string " << indexString <<
"instead of a daughter index.");
989 if (dauIndex >=
int(currentPart->
getNDaughters()) or dauIndex < 0) {
990 B2WARNING(
"Daughter index out of range" <<
LogVar(
"Daughter index", dauIndex));
991 B2WARNING(
"Trying to access non-existing particle.");
995 currentPart = dauPart;
1020 constexpr
unsigned order[] = {c_X, c_Y, c_Z, c_Px, c_Py, c_Pz};
1022 TMatrixFSym errMatrix(c_DimMatrix);
1023 for (
int i = 0; i < 6; i++) {
1024 for (
int j = i; j < 6; j++) {
1027 errMatrix(order[j], order[i]) = errMatrix(order[i], order[j]) = cov6(i, j);
1048 constexpr
unsigned compMom[] = {c_Px, c_Py, c_Pz};
1049 constexpr
unsigned compPos[] = {c_X, c_Y, c_Z};
1052 for (
unsigned int i : compMom) {
1054 for (
int k = 0; k < 3; k++) {
1055 Cov += errMatrix(i, compMom[k]) * dEdp[k];
1057 errMatrix(i, c_E) = Cov;
1061 for (
unsigned int comp : compPos) {
1063 for (
int k = 0; k < 3; k++) {
1064 Cov += errMatrix(comp, compMom[k]) * dEdp[k];
1066 errMatrix(c_E, comp) = Cov;
1071 for (
int i = 0; i < 3; i++) {
1072 Cov += errMatrix(compMom[i], compMom[i]) * dEdp[i] * dEdp[i];
1074 for (
int i = 0; i < 3; i++) {
1075 int k = (i + 1) % 3;
1076 Cov += 2 * errMatrix(compMom[i], compMom[k]) * dEdp[i] * dEdp[k];
1078 errMatrix(c_E, c_E) = Cov;
1098 for (
int irow = 0; irow < c_DimMatrix; irow++) {
1099 for (
int icol = irow; icol < c_DimMatrix; icol++) {
1109 for (
int irow = 0; irow < 4; irow++) {
1110 for (
int icol = 0; icol < 6; icol++) {
1122 fspDaughters.push_back(
this);
1163 int q3 = nnn % 10; nnn /= 10;
1164 int q2 = nnn % 10; nnn /= 10;
1171 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->GetName();
1181 std::vector<std::string> out;
1185 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1187 for (
auto const& ee : map) out.push_back(ee.first);
1194 std::stringstream stream;
1195 stream << std::setprecision(4);
1198 stream <<
" <b>PDGCode</b>=" <<
m_pdgCode;
1199 stream <<
" <b>Charge</b>=" <<
getCharge();
1200 stream <<
" <b>PDGMass</b>=" <<
getPDGMass();
1210 stream <<
" <b>daughterIndices</b>: ";
1212 stream << daughterIndex <<
", ";
1218 stream <<
" <b>daughter PDGCodes</b>: ";
1221 if (p) {stream << p->getPDGCode() <<
", ";}
1222 else {stream <<
"?, ";}
1227 stream <<
" <b>mass</b>=" <<
m_mass;
1231 stream <<
" <b>p</b>=" <<
getP();
1240 stream <<
" <b>p-value of fit</b> (if done): ";
1244 stream <<
" <b>error matrix</b> (px, py, pz, E, x, y ,z):<br>";
1247 stream <<
" <b>extra info</b>=( ";
1250 if (!extraInfoMap) {
1251 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1255 for (
const auto& pair : map) {
1256 if (pair.second < nVars) {
1257 stream << pair.first <<
"=" <<
m_extraInfo[pair.second] <<
" ";
1262 stream <<
") " <<
"<br>";
1264 return stream.str();
1275 if (!extraInfoMap) {
1276 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1278 unsigned int index = extraInfoMap->getIndex(mapID, name);
1293 throw std::runtime_error(std::string(
"getExtraInfo: Value '") + name +
"' not found in Particle!");
1298 if (!extraInfoMap) {
1299 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1301 unsigned int index = extraInfoMap->getIndex(mapID, name);
1303 throw std::runtime_error(std::string(
"getExtraInfo: Value '") + name +
"' not found in Particle!");
1321 throw std::runtime_error(std::string(
"setExtraInfo: Value '") + name +
"' not found in Particle!");
1326 if (!extraInfoMap) {
1327 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1329 unsigned int index = extraInfoMap->getIndex(mapID, name);
1331 throw std::runtime_error(std::string(
"setExtraInfo: Value '") + name +
"' not found in Particle!");
1340 throw std::runtime_error(std::string(
"addExtraInfo: Value '") + name +
"' already set!");
1346 unsigned int mapID = extraInfoMap->getMapForNewVar(name);
1352 unsigned int mapID = extraInfoMap->getMapForNewVar(name, oldMapID, insertIndex);
1360 bool recursive,
bool includeSelf)
const
1362 std::queue<const Particle*> qq;
1371 while (!qq.empty()) {
1373 if (
function(p))
return true;
1377 if (recursive || p ==
this)
1378 for (
size_t i = 0; i < p->getNDaughters(); ++i) qq.push(p->getDaughter(i));
1386 int PDGCode = absPDGCode * chargeSign;
1402 const auto track = this->
getTrack();
1409 auto trackFitResults = track->getTrackFitResults();
1410 auto it_maxPValue = std::max_element(std::begin(trackFitResults), std::end(trackFitResults),
1411 [](
auto tfrAndM1,
auto tfrAndM2) {
return tfrAndM1.second->getPValue() < tfrAndM2.second->getPValue();});
1413 return trackFitResults[std::distance(std::begin(trackFitResults), it_maxPValue)];
1420 if (!trackFit)
return false;
Class to provide momentum-related information from ECLClusters.
const TMatrixDSym GetCovarianceMatrix7x7FromCluster(const ECLCluster *cluster, const TMatrixD &jacobiMatrix)
Returns 7x7 covariance matrix (px, py, pz, E, x, y, z)
const ROOT::Math::PxPyPzEVector Get4MomentumFromCluster(const ECLCluster *cluster, ECLCluster::EHypothesisBit hypo)
Returns four momentum vector.
const TMatrixD GetJacobiMatrix4x6FromCluster(const ECLCluster *cluster, ECLCluster::EHypothesisBit hypo)
Returns 4x6 Jacobi matrix (px, py, pz, E)
const TMatrixDSym GetIPPositionCovarianceMatrix()
Returns default IP position covariance matrix from beam parameters.
const ROOT::Math::XYZVector GetIPPosition()
Returns default IP position from beam parameters.
Provides a type-safe way to pass members of the chargedStableSet set.
The ParticleType class for identifying different particle types.
int getPDGCode() const
PDG code.
static const ParticleType pi0
neutral pion particle
static const ChargedStable muon
muon particle
static const ParticleSet chargedStableSet
set of charged stable particles
static const ParticleType Klong
K^0_L particle.
static const ParticleType Kshort
K^0_S particle.
static const ParticleType photon
photon particle
static const ChargedStable electron
electron particle
Class for accessing objects in the database.
bool isTrack() const
Return true if the cluster matches with track.
int getConnectedRegionId() const
Return connected region id.
@ c_nPhotons
CR is split into n photons (N1)
ROOT::Math::PxPyPzEVector getMomentum() const
Get momentum.
A Class to store the Monte Carlo particle information.
float getMass() const
Return the particle mass in GeV.
ROOT::Math::XYZVector getVertex() const
Return production vertex position, shorthand for getProductionVertex().
int getArrayIndex() const
Get 0-based index of the particle in the corresponding MCParticle list.
int getPDG() const
Return PDG code of particle.
ROOT::Math::XYZVector getMomentum() const
Return momentum.
Class to collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM aimed for output to mdst includes...
Const::ChargedStable getMostLikely(const double *fractions=0, Const::PIDDetectorSet set=Const::PIDDetectorSet::set()) const
Return most likely particle among chargedStableSet; if prior fractions not given equal prior probabil...
std::map< std::string, unsigned int > IndexMap
string -> index map.
Class to store reconstructed particles.
void removeExtraInfo()
Remove all stored extra info fields.
double getPx() const
Returns x component of momentum.
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...
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)
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.
TClonesArray * getArrayPointer() const
Returns the pointer to the store array which holds the daughter particles.
double getPz() const
Returns z component of momentum.
std::vector< std::string > getExtraInfoNames() const
get a list of the extra info names
bool isCopyOf(const Particle *oParticle, bool doDetailedComparison=false) const
Returns true if this Particle and oParticle are copies of each other.
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 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.
unsigned m_mdstIndex
0-based index of MDST store array object
void setFlavorType()
sets m_flavorType using m_pdgCode
double getEnergy() const
Returns total energy.
int getMdstSource() const
Returns unique identifier of final state particle (needed in particle combiner)
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...
double m_py
momentum component y
double m_x
position component x
double m_px
momentum component x
std::pair< Const::ChargedStable, const TrackFitResult * > getMostLikelyTrackFitResult() const
For a (track-based) particle, returns the charged stable mass hypothesis associated to the most proba...
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).
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.
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 ...
unsigned getNDaughters(void) const
Returns number of daughter particles.
std::vector< Belle2::Particle * > getDaughters() const
Returns a vector of pointers to daughter particles.
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)
EFlavorType m_flavorType
flavor type.
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.
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
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 setJacobiMatrix(const TMatrixF &jacobiMatrix)
Sets 4x6 jacobi matrix.
double getPDGLifetime() const
Returns particle nominal lifetime.
void setMomentumVertexErrorMatrix(const TMatrixFSym &errMatrix)
Sets 7x7 error matrix.
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.
@ 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.
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...
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
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,...
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.
std::string getInfo() const
Return a short summary of this object's contents in raw text format.
bool create(bool replace=false)
Create a default object in the data store.
Accessor to arrays stored in the data store.
Type-safe access to single objects in the data store.
Values of the result of a track fit with a given particle hypothesis.
short getChargeSign() const
Return track charge (1 or -1).
double getPValue() const
Getter for Chi2 Probability of the track fit.
TMatrixDSym getCovariance6() const
Position and Momentum Covariance Matrix.
Const::ParticleType getParticleType() const
Getter for ParticleType of the mass hypothesis of the track fit.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
ROOT::Math::XYZVector getPosition() const
Getter for vector of position at closest approach of track in r/phi projection.
Class that bundles various TrackFitResults.
Object holding information for V0s.
Class to store variables with their name which were sent to the logging service.
double sqrt(double a)
sqrt for double
std::string getString(const TMatrixFBase &matrix, int precision=2, bool color=true)
get HTML table representing a matrix.
Abstract base class for different kinds of events.