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");
230 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
231 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
233 if (!trackFit)
return;
244 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr)
245 B2FATAL(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
254 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),
255 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
257 if (!eclCluster)
return;
268 m_px = clustermom.Px();
269 m_py = clustermom.Py();
270 m_pz = clustermom.Pz();
298 TMatrixD scaledJacobi(4, 6);
302 for (
int irow = 0; irow < 4; irow++) {
303 for (
int icol = 0; icol < 6; icol++) {
304 if (icol != 0 && irow != 3) {
324 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
325 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
327 if (!klmCluster)
return;
350 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
351 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
353 if (!mcParticle)
return;
386 const int crid = cluster->getConnectedRegionId();
387 const int clusterid = cluster->getClusterId();
390 B2ERROR(
"Particle is of type = ECLCluster has identifier not set and no relation to ECLCluster.\n"
391 "This has happen because old microDST is analysed with newer version of software.");
410 const int crid = cluster->getConnectedRegionId();
411 const int clusterid = cluster->getClusterId();
412 identifier = 1000 * crid + clusterid;
414 B2ERROR(
"Particle is of type = ECLCluster has identifier not set and no relation to ECLCluster.\n"
415 "This has happen because old microDST is analysed with newer version of software.");
429 if (m.GetNrows() != c_DimMatrix || m.GetNcols() != c_DimMatrix) {
431 B2WARNING(
"Error Matrix is not 7x7 ");
443 if (m.GetNrows() != 4 || m.GetNcols() != 6) {
445 B2WARNING(
"Jacobi Matrix is not 4x6 ");
454 TMatrixFSym m(c_DimMatrix);
457 for (
int irow = 0; irow < c_DimMatrix; irow++) {
458 for (
int icol = irow; icol < c_DimMatrix; icol++) {
459 m(irow, icol) = m(icol, irow) =
m_errMatrix[element];
474 full.GetSub(0, 3, mom,
"S");
486 full.GetSub(4, 6, pos,
"S");
497 PxPyPzEVector pMother;
503 pMother.SetE(cmsMass->getMass());
504 pMother = Boost(cmsBoost->getBoost()) * pMother;
506 pMother = boost * pMother;
509 PxPyPzEVector pDaughter;
516 pDaughter = daughter->get4Vector();
519 pDaughter = boost * pDaughter;
524 XYZVector pDaughterNormal(pDaughter0.Vect().Cross(pDaughter1.Vect()));
525 pDaughter.SetPxPyPzE(pDaughterNormal.X(), pDaughterNormal.Y(), pDaughterNormal.Z(), 0);
529 double mag2 = pMother.P2() * pDaughter.P2();
530 if (mag2 <= 0)
return std::numeric_limits<double>::quiet_NaN();
531 return -pMother.Vect().Dot(pDaughter.Vect()) / sqrt(mag2);
538 B2ERROR(
"No daughter of particle 'name' with index 'iDaughter' for calculation of helicity angle"
540 return std::numeric_limits<double>::quiet_NaN();
545 Boost boost(daughter->get4Vector().BoostToCM());
551 if (daughter->getNDaughters() <= iGrandDaughter) {
552 B2ERROR(
"No grand daughter of daughter 'iDaughter' of particle 'name' with index 'iGrandDaughter' for calculation of helicity angle"
554 return std::numeric_limits<double>::quiet_NaN();
558 PxPyPzEVector pGrandDaughter = boost * daughter->getDaughter(iGrandDaughter)->get4Vector();
560 double mag2 = pMother.P2() * pGrandDaughter.P2();
561 if (mag2 <= 0)
return std::numeric_limits<double>::quiet_NaN();
562 return -pMother.Vect().Dot(pGrandDaughter.Vect()) / sqrt(mag2);
569 B2ERROR(
"Cannot calculate acoplanarity of particle 'name' because the number of daughters is not 2"
571 return std::numeric_limits<double>::quiet_NaN();
576 B2ERROR(
"Cannot calculate acoplanarity of particle 'name' because the number of grand daughters is not 2"
579 return std::numeric_limits<double>::quiet_NaN();
586 PxPyPzEVector pDaughter0 = boost * daughter0->
get4Vector();
588 PxPyPzEVector pDaughter1 = boost * daughter1->
get4Vector();
592 XYZVector normal0 = pDaughter0.Vect().Cross(pGrandDaughter0.Vect());
593 XYZVector normal1 = -pDaughter1.Vect().Cross(pGrandDaughter1.Vect());
594 double result = acos(normal0.Unit().Dot(normal1.Unit()));
595 if (normal0.Cross(normal1).Dot(pDaughter0.Vect()) < 0) result = -result;
631 if (TDatabasePDG::Instance()->GetParticle(pdgCode) ==
nullptr)
632 B2FATAL(
"PDG=" << pdgCode <<
" ***code unknown to TDatabasePDG");
633 m_mass = TDatabasePDG::Instance()->GetParticle(pdgCode)->Mass() ;
638 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
639 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
642 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Mass();
647 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
648 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
651 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Lifetime();
656 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
657 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
660 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Charge() / 3.0;
672 std::vector<Particle*> daughters(nDaughters);
675 for (
unsigned i = 0; i < nDaughters; i++)
683 std::vector<const Particle*> fspDaughters;
691 std::vector<const Particle*> allDaughters;
699 std::vector<int> mdstIndices;
702 if (fsp->getParticleSource() == source)
703 mdstIndices.push_back(fsp->getMdstArrayIndex());
759 isReplaced = daughter->replaceDaughterRecursively(oldDaughter, newDaughter);
774 for (
auto& thisFSP : thisFSPs)
775 for (
auto& otherFSP : otherFSPs)
776 if (thisFSP->getMdstSource() == otherFSP->getMdstSource())
796 std::vector<int> thisDecayChain(nDaughters * 2);
797 std::vector<int> othrDecayChain(nDaughters * 2);
799 for (
unsigned i = 0; i < nDaughters; i++) {
808 sort(thisDecayChain.begin(), thisDecayChain.end());
809 sort(othrDecayChain.begin(), othrDecayChain.end());
811 for (
unsigned i = 0; i < thisDecayChain.size(); i++)
812 if (thisDecayChain[i] != othrDecayChain[i])
820 if (!doDetailedComparison)
828 B2WARNING(
"Something went wrong: MCParticle is being compared to a non MC Particle. Please check your script!\n"
829 " If the MCParticle <-> Particle comparison happens in the RestOfEventBuilder,\n"
830 " the Rest Of Event may contain signal side particles.");
887 auto* selfrelated = this->getRelatedTo<TrackFitResult>();
888 if (selfrelated && !isnan(selfrelated->getPValue()))
894 return selftrack->getTrackFitResultWithClosestMass(
930 const ECLCluster* bestTrackMatchedCluster =
nullptr;
931 double highestEnergy = -1.0;
940 bestTrackMatchedCluster = &cluster;
943 return bestTrackMatchedCluster;
952 if (!cluster)
return 0;
978 const MCParticle* related = this->getRelated<MCParticle>();
989 std::vector<std::string> generalizedIndexes;
990 boost::split(generalizedIndexes, generalizedIndex, boost::is_any_of(
":"));
992 if (generalizedIndexes.empty()) {
993 B2WARNING(
"Generalized index of daughter particle is empty. Skipping.");
1001 const Particle* currentPart =
this;
1004 for (
auto& indexString : generalizedIndexes) {
1008 dauIndex = Belle2::convertString<int>(indexString);
1009 }
catch (std::invalid_argument&) {
1010 B2WARNING(
"Found the string " << indexString <<
"instead of a daughter index.");
1015 if (dauIndex >=
int(currentPart->
getNDaughters()) or dauIndex < 0) {
1016 B2WARNING(
"Daughter index out of range" <<
LogVar(
"Daughter index", dauIndex));
1017 B2WARNING(
"Trying to access non-existing particle.");
1021 currentPart = dauPart;
1046 constexpr
unsigned order[] = {c_X, c_Y, c_Z, c_Px, c_Py, c_Pz};
1048 TMatrixFSym errMatrix(c_DimMatrix);
1049 for (
int i = 0; i < 6; i++) {
1050 for (
int j = i; j < 6; j++) {
1053 errMatrix(order[j], order[i]) = errMatrix(order[i], order[j]) = cov6(i, j);
1074 constexpr
unsigned compMom[] = {c_Px, c_Py, c_Pz};
1075 constexpr
unsigned compPos[] = {c_X, c_Y, c_Z};
1078 for (
unsigned int i : compMom) {
1080 for (
int k = 0; k < 3; k++) {
1081 Cov += errMatrix(i, compMom[k]) * dEdp[k];
1083 errMatrix(i, c_E) = Cov;
1087 for (
unsigned int comp : compPos) {
1089 for (
int k = 0; k < 3; k++) {
1090 Cov += errMatrix(comp, compMom[k]) * dEdp[k];
1092 errMatrix(c_E, comp) = Cov;
1097 for (
int i = 0; i < 3; i++) {
1098 Cov += errMatrix(compMom[i], compMom[i]) * dEdp[i] * dEdp[i];
1100 for (
int i = 0; i < 3; i++) {
1101 int k = (i + 1) % 3;
1102 Cov += 2 * errMatrix(compMom[i], compMom[k]) * dEdp[i] * dEdp[k];
1104 errMatrix(c_E, c_E) = Cov;
1124 for (
int irow = 0; irow < c_DimMatrix; irow++) {
1125 for (
int icol = irow; icol < c_DimMatrix; icol++) {
1135 for (
int irow = 0; irow < 4; irow++) {
1136 for (
int icol = 0; icol < 6; icol++) {
1148 fspDaughters.push_back(
this);
1189 int q3 = nnn % 10; nnn /= 10;
1190 int q2 = nnn % 10; nnn /= 10;
1197 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->GetName();
1207 std::vector<std::string> out;
1211 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1213 for (
auto const& ee : map) out.push_back(ee.first);
1220 std::stringstream stream;
1221 stream << std::setprecision(4);
1224 stream <<
" <b>PDGCode</b>=" <<
m_pdgCode;
1225 stream <<
" <b>Charge</b>=" <<
getCharge();
1226 stream <<
" <b>PDGMass</b>=" <<
getPDGMass();
1236 stream <<
" <b>daughterIndices</b>: ";
1238 stream << daughterIndex <<
", ";
1244 stream <<
" <b>daughter PDGCodes</b>: ";
1247 if (p) {stream << p->getPDGCode() <<
", ";}
1248 else {stream <<
"?, ";}
1253 stream <<
" <b>mass</b>=" <<
m_mass;
1257 stream <<
" <b>p</b>=" <<
getP();
1266 stream <<
" <b>p-value of fit</b> (if done): ";
1270 stream <<
" <b>error matrix</b> (px, py, pz, E, x, y ,z):<br>";
1273 stream <<
" <b>extra info</b>=( ";
1276 if (!extraInfoMap) {
1277 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1281 for (
const auto& pair : map) {
1282 if (pair.second < nVars) {
1283 stream << pair.first <<
"=" <<
m_extraInfo[pair.second] <<
" ";
1288 stream <<
") " <<
"<br>";
1290 return stream.str();
1301 if (!extraInfoMap) {
1302 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1304 unsigned int index = extraInfoMap->getIndex(mapID, name);
1319 throw std::runtime_error(std::string(
"getExtraInfo: Value '") + name +
"' not found in Particle!");
1324 if (!extraInfoMap) {
1325 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1327 unsigned int index = extraInfoMap->getIndex(mapID, name);
1329 throw std::runtime_error(std::string(
"getExtraInfo: Value '") + name +
"' not found in Particle!");
1347 throw std::runtime_error(std::string(
"setExtraInfo: Value '") + name +
"' not found in Particle!");
1352 if (!extraInfoMap) {
1353 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1355 unsigned int index = extraInfoMap->getIndex(mapID, name);
1357 throw std::runtime_error(std::string(
"setExtraInfo: Value '") + name +
"' not found in Particle!");
1366 throw std::runtime_error(std::string(
"addExtraInfo: Value '") + name +
"' already set!");
1372 unsigned int mapID = extraInfoMap->getMapForNewVar(name);
1378 unsigned int mapID = extraInfoMap->getMapForNewVar(name, oldMapID, insertIndex);
1386 bool recursive,
bool includeSelf)
const
1388 std::queue<const Particle*> qq;
1397 while (!qq.empty()) {
1399 if (
function(p))
return true;
1403 if (recursive || p ==
this)
1404 for (
size_t i = 0; i < p->getNDaughters(); ++i) qq.push(p->getDaughter(i));
1412 int PDGCode = absPDGCode * chargeSign;
1428 const auto track = this->
getTrack();
1435 auto trackFitResults = track->getTrackFitResults();
1436 auto it_maxPValue = std::max_element(std::begin(trackFitResults), std::end(trackFitResults),
1437 [](
auto tfrAndM1,
auto tfrAndM2) {
return tfrAndM1.second->getPValue() < tfrAndM2.second->getPValue();});
1439 return trackFitResults[std::distance(std::begin(trackFitResults), it_maxPValue)];
1446 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...
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.
bool replaceDaughter(const Particle *oldDaughter, const Particle *newDaughter)
Replace index of given daughter with new daughter, return true if a replacement is made.
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...
bool replaceDaughterRecursively(const Particle *oldDaughter, const Particle *newDaughter)
Apply replaceDaughter to all Particles in the decay tree by looping recursively through it,...
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.
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.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
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.
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.