9#include <analysis/dataobjects/Particle.h>
10#include <analysis/dataobjects/ParticleExtraInfoMap.h>
12#include <analysis/ClusterUtility/ClusterUtils.h>
14#include <mdst/dataobjects/Kink.h>
15#include <mdst/dataobjects/KLMCluster.h>
16#include <mdst/dataobjects/MCParticle.h>
17#include <mdst/dataobjects/PIDLikelihood.h>
18#include <mdst/dataobjects/Track.h>
19#include <mdst/dataobjects/TrackFitResult.h>
20#include <mdst/dataobjects/V0.h>
21#include <mdst/dbobjects/CollisionBoostVector.h>
22#include <mdst/dbobjects/CollisionInvariantMass.h>
24#include <framework/datastore/StoreArray.h>
25#include <framework/datastore/StoreObjPtr.h>
26#include <framework/database/DBObjPtr.h>
27#include <framework/logging/Logger.h>
28#include <framework/utilities/HTML.h>
29#include <framework/utilities/Conversion.h>
31#include <TClonesArray.h>
32#include <TDatabasePDG.h>
33#include <TMatrixFSym.h>
34#include <Math/Boost.h>
41#include <boost/algorithm/string.hpp>
44using namespace ROOT::Math;
47 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
48 m_pValue(nan(
"")), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_trackFitResultIndex(0),
50 m_arrayPointer(nullptr)
57 m_pdgCode(pdgCode), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
58 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_trackFitResultIndex(0), m_properties(0),
59 m_arrayPointer(nullptr)
75 const unsigned mdstIndex) :
76 m_pdgCode(pdgCode), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
77 m_pValue(-1), m_flavorType(flavorType), m_particleSource(source), m_trackFitResultIndex(0), m_properties(0), m_arrayPointer(nullptr)
95 const std::vector<int>& daughterIndices,
96 TClonesArray* arrayPointer) :
97 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
99 m_daughterIndices(daughterIndices),
100 m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_trackFitResultIndex(0),
101 m_properties(0), m_arrayPointer(arrayPointer)
114 if (!daughterIndices.empty()) {
117 B2FATAL(
"Composite Particle (with daughters) was constructed outside StoreArray without specifying daughter array!");
128 const std::vector<int>& daughterIndices,
129 const int properties,
130 TClonesArray* arrayPointer) :
131 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
133 m_daughterIndices(daughterIndices),
134 m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_trackFitResultIndex(0),
135 m_arrayPointer(arrayPointer)
149 if (!daughterIndices.empty()) {
152 B2FATAL(
"Composite Particle (with daughters) was constructed outside StoreArray without specifying daughter array!");
164 const std::vector<int>& daughterIndices,
165 const int properties,
166 const std::vector<int>& daughterProperties,
167 TClonesArray* arrayPointer) :
168 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
170 m_daughterIndices(daughterIndices),
171 m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_trackFitResultIndex(0),
172 m_daughterProperties(daughterProperties),
173 m_arrayPointer(arrayPointer)
187 if (!daughterIndices.empty()) {
190 B2FATAL(
"Composite Particle (with daughters) was constructed outside StoreArray without specifying daughter array!");
198 Particle(track ? track->getArrayIndex() : 0, track ? track->getTrackFitResultWithClosestMass(chargedStable) : nullptr,
206 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
207 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_trackFitResultIndex(0), m_properties(0),
208 m_arrayPointer(nullptr)
210 if (!trackFit)
return;
221 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr)
222 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_trackFitResultIndex(0), m_properties(0),
232 m_arrayPointer(nullptr)
248 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr)
249 B2FATAL(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
257 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),
258 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
260 if (!eclCluster)
return;
271 m_px = clustermom.Px();
272 m_py = clustermom.Py();
273 m_pz = clustermom.Pz();
301 TMatrixD scaledJacobi(4, 6);
305 for (
int irow = 0; irow < 4; irow++) {
306 for (
int icol = 0; icol < 6; icol++) {
307 if (icol != 0 && irow != 3) {
327 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
328 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
330 if (!klmCluster)
return;
353 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
354 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
356 if (!mcParticle)
return;
391 B2ERROR(
"Particle is of type = ECLCluster has identifier not set and no relation to ECLCluster.\n"
392 "This has happen because old microDST is analysed with newer version of software.");
411 identifier = cluster->getUniqueClusterId();
413 B2ERROR(
"Particle is of type = ECLCluster has identifier not set and no relation to ECLCluster.\n"
414 "This has happen because old microDST is analysed with newer version of software.");
428 if (m.GetNrows() != c_DimMatrix || m.GetNcols() != c_DimMatrix) {
430 B2WARNING(
"Error Matrix is not 7x7 ");
442 if (m.GetNrows() != 4 || m.GetNcols() != 6) {
444 B2WARNING(
"Jacobi Matrix is not 4x6 ");
453 TMatrixFSym m(c_DimMatrix);
456 for (
int irow = 0; irow < c_DimMatrix; irow++) {
457 for (
int icol = irow; icol < c_DimMatrix; icol++) {
458 m(irow, icol) = m(icol, irow) =
m_errMatrix[element];
473 full.GetSub(0, 3, mom,
"S");
485 full.GetSub(4, 6, pos,
"S");
496 PxPyPzEVector pMother;
502 pMother.SetE(cmsMass->getMass());
503 pMother = Boost(cmsBoost->getBoost()) * pMother;
505 pMother = boost * pMother;
508 PxPyPzEVector pDaughter;
515 pDaughter = daughter->get4Vector();
518 pDaughter = boost * pDaughter;
523 XYZVector pDaughterNormal(pDaughter0.Vect().Cross(pDaughter1.Vect()));
524 pDaughter.SetPxPyPzE(pDaughterNormal.X(), pDaughterNormal.Y(), pDaughterNormal.Z(), 0);
528 double mag2 = pMother.P2() * pDaughter.P2();
529 if (mag2 <= 0)
return std::numeric_limits<double>::quiet_NaN();
530 return -pMother.Vect().Dot(pDaughter.Vect()) /
sqrt(mag2);
537 B2ERROR(
"No daughter of particle 'name' with index 'iDaughter' for calculation of helicity angle"
539 return std::numeric_limits<double>::quiet_NaN();
544 Boost boost(daughter->get4Vector().BoostToCM());
550 if (daughter->getNDaughters() <= iGrandDaughter) {
551 B2ERROR(
"No grand daughter of daughter 'iDaughter' of particle 'name' with index 'iGrandDaughter' for calculation of helicity angle"
553 return std::numeric_limits<double>::quiet_NaN();
557 PxPyPzEVector pGrandDaughter = boost * daughter->getDaughter(iGrandDaughter)->get4Vector();
559 double mag2 = pMother.P2() * pGrandDaughter.P2();
560 if (mag2 <= 0)
return std::numeric_limits<double>::quiet_NaN();
561 return -pMother.Vect().Dot(pGrandDaughter.Vect()) /
sqrt(mag2);
568 B2ERROR(
"Cannot calculate acoplanarity of particle 'name' because the number of daughters is not 2"
570 return std::numeric_limits<double>::quiet_NaN();
575 B2ERROR(
"Cannot calculate acoplanarity of particle 'name' because the number of grand daughters is not 2"
578 return std::numeric_limits<double>::quiet_NaN();
585 PxPyPzEVector pDaughter0 = boost * daughter0->
get4Vector();
587 PxPyPzEVector pDaughter1 = boost * daughter1->
get4Vector();
591 XYZVector normal0 = pDaughter0.Vect().Cross(pGrandDaughter0.Vect());
592 XYZVector normal1 = -pDaughter1.Vect().Cross(pGrandDaughter1.Vect());
593 double result = acos(normal0.Unit().Dot(normal1.Unit()));
594 if (normal0.Cross(normal1).Dot(pDaughter0.Vect()) < 0) result = -result;
630 if (TDatabasePDG::Instance()->GetParticle(pdgCode) ==
nullptr)
631 B2FATAL(
"PDG=" << pdgCode <<
" ***code unknown to TDatabasePDG");
632 m_mass = TDatabasePDG::Instance()->GetParticle(pdgCode)->Mass() ;
637 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
638 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
641 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Mass();
646 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
647 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
650 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Lifetime();
655 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
656 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
659 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Charge() / 3.0;
671 std::vector<Particle*> daughters(nDaughters);
674 for (
unsigned i = 0; i < nDaughters; i++)
682 std::vector<const Particle*> fspDaughters;
690 std::vector<const Particle*> allDaughters;
698 std::vector<int> mdstIndices;
701 if (fsp->getParticleSource() == source)
702 mdstIndices.push_back(fsp->getMdstArrayIndex());
760 isReplaced = daughter->replaceDaughterRecursively(oldDaughter, newDaughter);
775 for (
auto& thisFSP : thisFSPs)
776 for (
auto& otherFSP : otherFSPs)
777 if (thisFSP->getMdstSource() == otherFSP->getMdstSource())
797 std::vector<int> thisDecayChain(nDaughters * 2);
798 std::vector<int> othrDecayChain(nDaughters * 2);
800 for (
unsigned i = 0; i < nDaughters; i++) {
809 sort(thisDecayChain.begin(), thisDecayChain.end());
810 sort(othrDecayChain.begin(), othrDecayChain.end());
812 for (
unsigned i = 0; i < thisDecayChain.size(); i++)
813 if (thisDecayChain[i] != othrDecayChain[i])
826 if (trackIndex == motherTrackIndex || trackIndex == daughterTrackIndex)
835 if (trackIndex == motherTrackIndex || trackIndex == daughterTrackIndex)
841 if (!doDetailedComparison)
849 B2WARNING(
"Something went wrong: MCParticle is being compared to a non MC Particle. Please check your script!\n"
850 " If the MCParticle <-> Particle comparison happens in the RestOfEventBuilder,\n"
851 " the Rest Of Event may contain signal side particles.");
867 if (trackIndex == motherTrackIndex || trackIndex == daughterTrackIndex)
876 if (trackIndex == motherTrackIndex || trackIndex == daughterTrackIndex)
928 auto* selfrelated = this->getRelatedTo<TrackFitResult>();
929 if (selfrelated && !std::isnan(selfrelated->getPValue()))
940 return selftrack->getTrackFitResultWithClosestMass(
985 const ECLCluster* bestTrackMatchedCluster =
nullptr;
986 double highestEnergy = -1.0;
995 bestTrackMatchedCluster = &cluster;
998 return bestTrackMatchedCluster;
1007 if (!cluster)
return 0;
1033 const MCParticle* related = this->getRelated<MCParticle>();
1044 std::vector<std::string> generalizedIndexes;
1045 boost::split(generalizedIndexes, generalizedIndex, boost::is_any_of(
":"));
1047 if (generalizedIndexes.empty()) {
1048 B2WARNING(
"Generalized index of daughter particle is empty. Skipping.");
1056 const Particle* currentPart =
this;
1059 for (
auto& indexString : generalizedIndexes) {
1063 dauIndex = Belle2::convertString<int>(indexString);
1064 }
catch (std::invalid_argument&) {
1065 B2WARNING(
"Found the string " << indexString <<
"instead of a daughter index.");
1070 if (dauIndex >=
int(currentPart->
getNDaughters()) or dauIndex < 0) {
1071 B2WARNING(
"Daughter index out of range" <<
LogVar(
"Daughter index", dauIndex));
1072 B2WARNING(
"Trying to access non-existing particle.");
1076 currentPart = dauPart;
1101 constexpr unsigned order[] = {c_X, c_Y, c_Z, c_Px, c_Py, c_Pz};
1103 TMatrixFSym errMatrix(c_DimMatrix);
1104 for (
int i = 0; i < 6; i++) {
1105 for (
int j = i; j < 6; j++) {
1108 errMatrix(order[j], order[i]) = errMatrix(order[i], order[j]) = cov6(i, j);
1129 constexpr unsigned compMom[] = {c_Px, c_Py, c_Pz};
1130 constexpr unsigned compPos[] = {c_X, c_Y, c_Z};
1133 for (
unsigned int i : compMom) {
1135 for (
int k = 0; k < 3; k++) {
1136 Cov += errMatrix(i, compMom[k]) * dEdp[k];
1138 errMatrix(i, c_E) = Cov;
1142 for (
unsigned int comp : compPos) {
1144 for (
int k = 0; k < 3; k++) {
1145 Cov += errMatrix(comp, compMom[k]) * dEdp[k];
1147 errMatrix(c_E, comp) = Cov;
1152 for (
int i = 0; i < 3; i++) {
1153 Cov += errMatrix(compMom[i], compMom[i]) * dEdp[i] * dEdp[i];
1155 for (
int i = 0; i < 3; i++) {
1156 int k = (i + 1) % 3;
1157 Cov += 2 * errMatrix(compMom[i], compMom[k]) * dEdp[i] * dEdp[k];
1159 errMatrix(c_E, c_E) = Cov;
1179 for (
int irow = 0; irow < c_DimMatrix; irow++) {
1180 for (
int icol = irow; icol < c_DimMatrix; icol++) {
1190 for (
int irow = 0; irow < 4; irow++) {
1191 for (
int icol = 0; icol < 6; icol++) {
1203 fspDaughters.push_back(
this);
1244 int q3 = nnn % 10; nnn /= 10;
1245 int q2 = nnn % 10; nnn /= 10;
1252 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->GetName();
1262 std::vector<std::string> out;
1266 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1268 for (
auto const& ee : map) out.push_back(ee.first);
1275 std::stringstream stream;
1276 stream << std::setprecision(4);
1279 stream <<
" <b>PDGCode</b>=" <<
m_pdgCode;
1280 stream <<
" <b>Charge</b>=" <<
getCharge();
1281 stream <<
" <b>PDGMass</b>=" <<
getPDGMass();
1291 stream <<
" <b>daughterIndices</b>: ";
1293 stream << daughterIndex <<
", ";
1299 stream <<
" <b>daughter PDGCodes</b>: ";
1302 if (p) {stream << p->getPDGCode() <<
", ";}
1303 else {stream <<
"?, ";}
1308 stream <<
" <b>mass</b>=" <<
m_mass;
1312 stream <<
" <b>p</b>=" <<
getP();
1324 stream <<
" <b>p-value of fit</b> (if done): ";
1328 stream <<
" <b>error matrix</b> (px, py, pz, E, x, y ,z):<br>";
1331 stream <<
" <b>extra info</b>=( ";
1334 if (!extraInfoMap) {
1335 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1339 for (
const auto& pair : map) {
1340 if (pair.second < nVars) {
1341 stream << pair.first <<
"=" <<
m_extraInfo[pair.second] <<
" ";
1346 stream <<
") " <<
"<br>";
1348 return stream.str();
1359 if (!extraInfoMap) {
1360 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1362 unsigned int index = extraInfoMap->getIndex(mapID, name);
1377 throw std::runtime_error(std::string(
"getExtraInfo: Value '") + name +
"' not found in Particle!");
1382 if (!extraInfoMap) {
1383 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1385 unsigned int index = extraInfoMap->getIndex(mapID, name);
1387 throw std::runtime_error(std::string(
"getExtraInfo: Value '") + name +
"' not found in Particle!");
1405 throw std::runtime_error(std::string(
"setExtraInfo: Value '") + name +
"' not found in Particle!");
1410 if (!extraInfoMap) {
1411 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1413 unsigned int index = extraInfoMap->getIndex(mapID, name);
1415 throw std::runtime_error(std::string(
"setExtraInfo: Value '") + name +
"' not found in Particle!");
1424 throw std::runtime_error(std::string(
"addExtraInfo: Value '") + name +
"' already set!");
1430 unsigned int mapID = extraInfoMap->getMapForNewVar(name);
1436 unsigned int mapID = extraInfoMap->getMapForNewVar(name, oldMapID, insertIndex);
1444 bool recursive,
bool includeSelf)
const
1446 std::queue<const Particle*> qq;
1455 while (!qq.empty()) {
1457 if (function(p))
return true;
1461 if (recursive || p ==
this)
1462 for (
size_t i = 0; i < p->getNDaughters(); ++i) qq.push(p->getDaughter(i));
1470 int PDGCode = absPDGCode * chargeSign;
1486 const auto track = this->
getTrack();
1493 auto trackFitResults = track->getTrackFitResults();
1494 auto it_maxPValue = std::max_element(std::begin(trackFitResults), std::end(trackFitResults),
1495 [](
auto tfrAndM1,
auto tfrAndM2) {
return tfrAndM1.second->getPValue() < tfrAndM2.second->getPValue();});
1497 return trackFitResults[std::distance(std::begin(trackFitResults), it_maxPValue)];
1504 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.
Object holding information for Kinks.
short getDaughterTrackIndex() const
Get index of the daughter Track (it is the same as mother's in case of track splitting).
short getMotherTrackIndex() const
Get index of the mother Track.
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=nullptr, 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.
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).
const Kink * getKink() const
Returns the pointer to the Kink object that was used to create this Particle (if ParticleType == c_Ki...
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.
TClonesArray * getArrayPointer() const
Returns the pointer to the store array which holds the 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.
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.
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
unsigned m_trackFitResultIndex
0-based index of related TrackFitResult, relevant for kinks
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.
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.
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.