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>
43using 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)
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)
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!");
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!");
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;
360 B2ERROR(
"Particle is of type = ECLCluster has identifier not set and no relation to ECLCluster.\n"
361 "This has happen because old microDST is analysed with newer version of software.");
380 identifier = cluster->getUniqueClusterId();
382 B2ERROR(
"Particle is of type = ECLCluster has identifier not set and no relation to ECLCluster.\n"
383 "This has happen because old microDST is analysed with newer version of software.");
397 if (m.GetNrows() != c_DimMatrix || m.GetNcols() != c_DimMatrix) {
399 B2WARNING(
"Error Matrix is not 7x7 ");
411 if (m.GetNrows() != 4 || m.GetNcols() != 6) {
413 B2WARNING(
"Jacobi Matrix is not 4x6 ");
422 TMatrixFSym m(c_DimMatrix);
425 for (
int irow = 0; irow < c_DimMatrix; irow++) {
426 for (
int icol = irow; icol < c_DimMatrix; icol++) {
427 m(irow, icol) = m(icol, irow) =
m_errMatrix[element];
442 full.GetSub(0, 3, mom,
"S");
454 full.GetSub(4, 6, pos,
"S");
465 PxPyPzEVector pMother;
471 pMother.SetE(cmsMass->getMass());
472 pMother = Boost(cmsBoost->getBoost()) * pMother;
474 pMother = boost * pMother;
477 PxPyPzEVector pDaughter;
484 pDaughter = daughter->get4Vector();
487 pDaughter = boost * pDaughter;
492 XYZVector pDaughterNormal(pDaughter0.Vect().Cross(pDaughter1.Vect()));
493 pDaughter.SetPxPyPzE(pDaughterNormal.X(), pDaughterNormal.Y(), pDaughterNormal.Z(), 0);
497 double mag2 = pMother.P2() * pDaughter.P2();
498 if (mag2 <= 0)
return std::numeric_limits<double>::quiet_NaN();
499 return -pMother.Vect().Dot(pDaughter.Vect()) / sqrt(mag2);
506 B2ERROR(
"No daughter of particle 'name' with index 'iDaughter' for calculation of helicity angle"
508 return std::numeric_limits<double>::quiet_NaN();
513 Boost boost(daughter->get4Vector().BoostToCM());
519 if (daughter->getNDaughters() <= iGrandDaughter) {
520 B2ERROR(
"No grand daughter of daughter 'iDaughter' of particle 'name' with index 'iGrandDaughter' for calculation of helicity angle"
522 return std::numeric_limits<double>::quiet_NaN();
526 PxPyPzEVector pGrandDaughter = boost * daughter->getDaughter(iGrandDaughter)->get4Vector();
528 double mag2 = pMother.P2() * pGrandDaughter.P2();
529 if (mag2 <= 0)
return std::numeric_limits<double>::quiet_NaN();
530 return -pMother.Vect().Dot(pGrandDaughter.Vect()) / sqrt(mag2);
537 B2ERROR(
"Cannot calculate acoplanarity of particle 'name' because the number of daughters is not 2"
539 return std::numeric_limits<double>::quiet_NaN();
544 B2ERROR(
"Cannot calculate acoplanarity of particle 'name' because the number of grand daughters is not 2"
547 return std::numeric_limits<double>::quiet_NaN();
554 PxPyPzEVector pDaughter0 = boost * daughter0->
get4Vector();
556 PxPyPzEVector pDaughter1 = boost * daughter1->
get4Vector();
560 XYZVector normal0 = pDaughter0.Vect().Cross(pGrandDaughter0.Vect());
561 XYZVector normal1 = -pDaughter1.Vect().Cross(pGrandDaughter1.Vect());
562 double result = acos(normal0.Unit().Dot(normal1.Unit()));
563 if (normal0.Cross(normal1).Dot(pDaughter0.Vect()) < 0) result = -result;
599 if (TDatabasePDG::Instance()->GetParticle(pdgCode) ==
nullptr)
600 B2FATAL(
"PDG=" << pdgCode <<
" ***code unknown to TDatabasePDG");
601 m_mass = TDatabasePDG::Instance()->GetParticle(pdgCode)->Mass() ;
606 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
607 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
610 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Mass();
615 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
616 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
619 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Lifetime();
624 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
625 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
628 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Charge() / 3.0;
640 std::vector<Particle*> daughters(nDaughters);
643 for (
unsigned i = 0; i < nDaughters; i++)
651 std::vector<const Particle*> fspDaughters;
659 std::vector<const Particle*> allDaughters;
667 std::vector<int> mdstIndices;
670 if (fsp->getParticleSource() == source)
671 mdstIndices.push_back(fsp->getMdstArrayIndex());
729 isReplaced = daughter->replaceDaughterRecursively(oldDaughter, newDaughter);
744 for (
auto& thisFSP : thisFSPs)
745 for (
auto& otherFSP : otherFSPs)
746 if (thisFSP->getMdstSource() == otherFSP->getMdstSource())
766 std::vector<int> thisDecayChain(nDaughters * 2);
767 std::vector<int> othrDecayChain(nDaughters * 2);
769 for (
unsigned i = 0; i < nDaughters; i++) {
778 sort(thisDecayChain.begin(), thisDecayChain.end());
779 sort(othrDecayChain.begin(), othrDecayChain.end());
781 for (
unsigned i = 0; i < thisDecayChain.size(); i++)
782 if (thisDecayChain[i] != othrDecayChain[i])
790 if (!doDetailedComparison)
798 B2WARNING(
"Something went wrong: MCParticle is being compared to a non MC Particle. Please check your script!\n"
799 " If the MCParticle <-> Particle comparison happens in the RestOfEventBuilder,\n"
800 " the Rest Of Event may contain signal side particles.");
857 auto* selfrelated = this->getRelatedTo<TrackFitResult>();
858 if (selfrelated && !isnan(selfrelated->getPValue()))
864 return selftrack->getTrackFitResultWithClosestMass(
900 const ECLCluster* bestTrackMatchedCluster =
nullptr;
901 double highestEnergy = -1.0;
910 bestTrackMatchedCluster = &cluster;
913 return bestTrackMatchedCluster;
922 if (!cluster)
return 0;
948 const MCParticle* related = this->getRelated<MCParticle>();
959 std::vector<std::string> generalizedIndexes;
960 boost::split(generalizedIndexes, generalizedIndex, boost::is_any_of(
":"));
962 if (generalizedIndexes.empty()) {
963 B2WARNING(
"Generalized index of daughter particle is empty. Skipping.");
974 for (
auto& indexString : generalizedIndexes) {
978 dauIndex = Belle2::convertString<int>(indexString);
979 }
catch (std::invalid_argument&) {
980 B2WARNING(
"Found the string " << indexString <<
"instead of a daughter index.");
985 if (dauIndex >=
int(currentPart->
getNDaughters()) or dauIndex < 0) {
986 B2WARNING(
"Daughter index out of range" <<
LogVar(
"Daughter index", dauIndex));
987 B2WARNING(
"Trying to access non-existing particle.");
991 currentPart = dauPart;
1016 constexpr unsigned order[] = {c_X, c_Y, c_Z, c_Px, c_Py, c_Pz};
1018 TMatrixFSym errMatrix(c_DimMatrix);
1019 for (
int i = 0; i < 6; i++) {
1020 for (
int j = i; j < 6; j++) {
1023 errMatrix(order[j], order[i]) = errMatrix(order[i], order[j]) = cov6(i, j);
1044 constexpr unsigned compMom[] = {c_Px, c_Py, c_Pz};
1045 constexpr unsigned compPos[] = {c_X, c_Y, c_Z};
1048 for (
unsigned int i : compMom) {
1050 for (
int k = 0; k < 3; k++) {
1051 Cov += errMatrix(i, compMom[k]) * dEdp[k];
1053 errMatrix(i, c_E) = Cov;
1057 for (
unsigned int comp : compPos) {
1059 for (
int k = 0; k < 3; k++) {
1060 Cov += errMatrix(comp, compMom[k]) * dEdp[k];
1062 errMatrix(c_E, comp) = Cov;
1067 for (
int i = 0; i < 3; i++) {
1068 Cov += errMatrix(compMom[i], compMom[i]) * dEdp[i] * dEdp[i];
1070 for (
int i = 0; i < 3; i++) {
1071 int k = (i + 1) % 3;
1072 Cov += 2 * errMatrix(compMom[i], compMom[k]) * dEdp[i] * dEdp[k];
1074 errMatrix(c_E, c_E) = Cov;
1094 for (
int irow = 0; irow < c_DimMatrix; irow++) {
1095 for (
int icol = irow; icol < c_DimMatrix; icol++) {
1105 for (
int irow = 0; irow < 4; irow++) {
1106 for (
int icol = 0; icol < 6; icol++) {
1118 fspDaughters.push_back(
this);
1159 int q3 = nnn % 10; nnn /= 10;
1160 int q2 = nnn % 10; nnn /= 10;
1167 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->GetName();
1177 std::vector<std::string> out;
1181 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1183 for (
auto const& ee : map) out.push_back(ee.first);
1190 std::stringstream stream;
1191 stream << std::setprecision(4);
1194 stream <<
" <b>PDGCode</b>=" <<
m_pdgCode;
1195 stream <<
" <b>Charge</b>=" <<
getCharge();
1196 stream <<
" <b>PDGMass</b>=" <<
getPDGMass();
1206 stream <<
" <b>daughterIndices</b>: ";
1208 stream << daughterIndex <<
", ";
1214 stream <<
" <b>daughter PDGCodes</b>: ";
1217 if (p) {stream << p->getPDGCode() <<
", ";}
1218 else {stream <<
"?, ";}
1223 stream <<
" <b>mass</b>=" <<
m_mass;
1227 stream <<
" <b>p</b>=" <<
getP();
1239 stream <<
" <b>p-value of fit</b> (if done): ";
1243 stream <<
" <b>error matrix</b> (px, py, pz, E, x, y ,z):<br>";
1246 stream <<
" <b>extra info</b>=( ";
1249 if (!extraInfoMap) {
1250 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1254 for (
const auto& pair : map) {
1255 if (pair.second < nVars) {
1256 stream << pair.first <<
"=" <<
m_extraInfo[pair.second] <<
" ";
1261 stream <<
") " <<
"<br>";
1263 return stream.str();
1274 if (!extraInfoMap) {
1275 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1277 unsigned int index = extraInfoMap->getIndex(mapID, name);
1292 throw std::runtime_error(std::string(
"getExtraInfo: Value '") + name +
"' not found in Particle!");
1297 if (!extraInfoMap) {
1298 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1300 unsigned int index = extraInfoMap->getIndex(mapID, name);
1302 throw std::runtime_error(std::string(
"getExtraInfo: Value '") + name +
"' not found in Particle!");
1320 throw std::runtime_error(std::string(
"setExtraInfo: Value '") + name +
"' not found in Particle!");
1325 if (!extraInfoMap) {
1326 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1328 unsigned int index = extraInfoMap->getIndex(mapID, name);
1330 throw std::runtime_error(std::string(
"setExtraInfo: Value '") + name +
"' not found in Particle!");
1339 throw std::runtime_error(std::string(
"addExtraInfo: Value '") + name +
"' already set!");
1345 unsigned int mapID = extraInfoMap->getMapForNewVar(name);
1351 unsigned int mapID = extraInfoMap->getMapForNewVar(name, oldMapID, insertIndex);
1359 bool recursive,
bool includeSelf)
const
1361 std::queue<const Particle*> qq;
1370 while (!qq.empty()) {
1372 if (function(p))
return true;
1376 if (recursive || p ==
this)
1377 for (
size_t i = 0; i < p->getNDaughters(); ++i) qq.push(p->getDaughter(i));
1385 int PDGCode = absPDGCode * chargeSign;
1401 const auto track = this->
getTrack();
1408 auto trackFitResults = track->getTrackFitResults();
1409 auto it_maxPValue = std::max_element(std::begin(trackFitResults), std::end(trackFitResults),
1410 [](
auto tfrAndM1,
auto tfrAndM2) {
return tfrAndM1.second->getPValue() < tfrAndM2.second->getPValue();});
1412 return trackFitResults[std::distance(std::begin(trackFitResults), it_maxPValue)];
1419 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=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).
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
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.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
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.
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.