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>
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_trackFitResultIndex(0),
49 m_arrayPointer(nullptr)
56 m_pdgCode(pdgCode), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
57 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_trackFitResultIndex(0), m_properties(0),
58 m_arrayPointer(nullptr)
74 const unsigned mdstIndex) :
75 m_pdgCode(pdgCode), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
76 m_pValue(-1), m_flavorType(flavorType), m_particleSource(source), m_trackFitResultIndex(0), m_properties(0), m_arrayPointer(nullptr)
94 const std::vector<int>& daughterIndices,
95 TClonesArray* arrayPointer) :
96 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
98 m_daughterIndices(daughterIndices),
99 m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_trackFitResultIndex(0),
100 m_properties(0), m_arrayPointer(arrayPointer)
113 if (!daughterIndices.empty()) {
116 B2FATAL(
"Composite Particle (with daughters) was constructed outside StoreArray without specifying daughter array!");
127 const std::vector<int>& daughterIndices,
128 const int properties,
129 TClonesArray* arrayPointer) :
130 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
132 m_daughterIndices(daughterIndices),
133 m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_trackFitResultIndex(0),
134 m_arrayPointer(arrayPointer)
148 if (!daughterIndices.empty()) {
151 B2FATAL(
"Composite Particle (with daughters) was constructed outside StoreArray without specifying daughter array!");
163 const std::vector<int>& daughterIndices,
164 const int properties,
165 const std::vector<int>& daughterProperties,
166 TClonesArray* arrayPointer) :
167 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
169 m_daughterIndices(daughterIndices),
170 m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_trackFitResultIndex(0),
171 m_daughterProperties(daughterProperties),
172 m_arrayPointer(arrayPointer)
186 if (!daughterIndices.empty()) {
189 B2FATAL(
"Composite Particle (with daughters) was constructed outside StoreArray without specifying daughter array!");
197 Particle(track ? track->getArrayIndex() : 0, track ? track->getTrackFitResultWithClosestMass(chargedStable) : nullptr,
205 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
206 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_trackFitResultIndex(0), m_properties(0),
207 m_arrayPointer(nullptr)
209 if (!trackFit)
return;
220 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr)
221 B2FATAL(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
229 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
230 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_trackFitResultIndex(0), m_properties(0),
231 m_arrayPointer(nullptr)
247 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr)
248 B2FATAL(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
256 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),
257 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
259 if (!eclCluster)
return;
270 m_px = clustermom.Px();
271 m_py = clustermom.Py();
272 m_pz = clustermom.Pz();
300 TMatrixD scaledJacobi(4, 6);
304 for (
int irow = 0; irow < 4; irow++) {
305 for (
int icol = 0; icol < 6; icol++) {
306 if (icol != 0 && irow != 3) {
326 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
327 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
329 if (!klmCluster)
return;
352 m_pdgCode(0), m_mass(0), m_px(0), m_py(0), m_pz(0), m_x(0), m_y(0), m_z(0),
353 m_pValue(-1), m_flavorType(c_Unflavored), m_particleSource(c_Undefined), m_mdstIndex(0), m_properties(0), m_arrayPointer(nullptr)
355 if (!mcParticle)
return;
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 identifier = cluster->getUniqueClusterId();
412 B2ERROR(
"Particle is of type = ECLCluster has identifier not set and no relation to ECLCluster.\n"
413 "This has happen because old microDST is analysed with newer version of software.");
427 if (m.GetNrows() != c_DimMatrix || m.GetNcols() != c_DimMatrix) {
429 B2WARNING(
"Error Matrix is not 7x7 ");
441 if (m.GetNrows() != 4 || m.GetNcols() != 6) {
443 B2WARNING(
"Jacobi Matrix is not 4x6 ");
452 TMatrixFSym m(c_DimMatrix);
455 for (
int irow = 0; irow < c_DimMatrix; irow++) {
456 for (
int icol = irow; icol < c_DimMatrix; icol++) {
457 m(irow, icol) = m(icol, irow) =
m_errMatrix[element];
472 full.GetSub(0, 3, mom,
"S");
484 full.GetSub(4, 6, pos,
"S");
495 PxPyPzEVector pMother;
501 pMother.SetE(cmsMass->getMass());
502 pMother = Boost(cmsBoost->getBoost()) * pMother;
504 pMother = boost * pMother;
507 PxPyPzEVector pDaughter;
514 pDaughter = daughter->get4Vector();
517 pDaughter = boost * pDaughter;
522 XYZVector pDaughterNormal(pDaughter0.Vect().Cross(pDaughter1.Vect()));
523 pDaughter.SetPxPyPzE(pDaughterNormal.X(), pDaughterNormal.Y(), pDaughterNormal.Z(), 0);
527 double mag2 = pMother.P2() * pDaughter.P2();
528 if (mag2 <= 0)
return std::numeric_limits<double>::quiet_NaN();
529 return -pMother.Vect().Dot(pDaughter.Vect()) / sqrt(mag2);
536 B2ERROR(
"No daughter of particle 'name' with index 'iDaughter' for calculation of helicity angle"
538 return std::numeric_limits<double>::quiet_NaN();
543 Boost boost(daughter->get4Vector().BoostToCM());
549 if (daughter->getNDaughters() <= iGrandDaughter) {
550 B2ERROR(
"No grand daughter of daughter 'iDaughter' of particle 'name' with index 'iGrandDaughter' for calculation of helicity angle"
552 return std::numeric_limits<double>::quiet_NaN();
556 PxPyPzEVector pGrandDaughter = boost * daughter->getDaughter(iGrandDaughter)->get4Vector();
558 double mag2 = pMother.P2() * pGrandDaughter.P2();
559 if (mag2 <= 0)
return std::numeric_limits<double>::quiet_NaN();
560 return -pMother.Vect().Dot(pGrandDaughter.Vect()) / sqrt(mag2);
567 B2ERROR(
"Cannot calculate acoplanarity of particle 'name' because the number of daughters is not 2"
569 return std::numeric_limits<double>::quiet_NaN();
574 B2ERROR(
"Cannot calculate acoplanarity of particle 'name' because the number of grand daughters is not 2"
577 return std::numeric_limits<double>::quiet_NaN();
584 PxPyPzEVector pDaughter0 = boost * daughter0->
get4Vector();
586 PxPyPzEVector pDaughter1 = boost * daughter1->
get4Vector();
590 XYZVector normal0 = pDaughter0.Vect().Cross(pGrandDaughter0.Vect());
591 XYZVector normal1 = -pDaughter1.Vect().Cross(pGrandDaughter1.Vect());
592 double result = acos(normal0.Unit().Dot(normal1.Unit()));
593 if (normal0.Cross(normal1).Dot(pDaughter0.Vect()) < 0) result = -result;
629 if (TDatabasePDG::Instance()->GetParticle(pdgCode) ==
nullptr)
630 B2FATAL(
"PDG=" << pdgCode <<
" ***code unknown to TDatabasePDG");
631 m_mass = TDatabasePDG::Instance()->GetParticle(pdgCode)->Mass() ;
636 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
637 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
640 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Mass();
645 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
646 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
649 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Lifetime();
654 if (TDatabasePDG::Instance()->GetParticle(
m_pdgCode) ==
nullptr) {
655 B2ERROR(
"PDG=" <<
m_pdgCode <<
" ***code unknown to TDatabasePDG");
658 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->Charge() / 3.0;
670 std::vector<Particle*> daughters(nDaughters);
673 for (
unsigned i = 0; i < nDaughters; i++)
681 std::vector<const Particle*> fspDaughters;
689 std::vector<const Particle*> allDaughters;
697 std::vector<int> mdstIndices;
700 if (fsp->getParticleSource() == source)
701 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])
825 if (trackIndex == motherTrackIndex || trackIndex == daughterTrackIndex)
834 if (trackIndex == motherTrackIndex || trackIndex == daughterTrackIndex)
840 if (!doDetailedComparison)
848 B2WARNING(
"Something went wrong: MCParticle is being compared to a non MC Particle. Please check your script!\n"
849 " If the MCParticle <-> Particle comparison happens in the RestOfEventBuilder,\n"
850 " the Rest Of Event may contain signal side particles.");
866 if (trackIndex == motherTrackIndex || trackIndex == daughterTrackIndex)
875 if (trackIndex == motherTrackIndex || trackIndex == daughterTrackIndex)
927 auto* selfrelated = this->getRelatedTo<TrackFitResult>();
928 if (selfrelated && !isnan(selfrelated->getPValue()))
939 return selftrack->getTrackFitResultWithClosestMass(
984 const ECLCluster* bestTrackMatchedCluster =
nullptr;
985 double highestEnergy = -1.0;
994 bestTrackMatchedCluster = &cluster;
997 return bestTrackMatchedCluster;
1006 if (!cluster)
return 0;
1032 const MCParticle* related = this->getRelated<MCParticle>();
1043 std::vector<std::string> generalizedIndexes;
1044 boost::split(generalizedIndexes, generalizedIndex, boost::is_any_of(
":"));
1046 if (generalizedIndexes.empty()) {
1047 B2WARNING(
"Generalized index of daughter particle is empty. Skipping.");
1055 const Particle* currentPart =
this;
1058 for (
auto& indexString : generalizedIndexes) {
1062 dauIndex = Belle2::convertString<int>(indexString);
1063 }
catch (std::invalid_argument&) {
1064 B2WARNING(
"Found the string " << indexString <<
"instead of a daughter index.");
1069 if (dauIndex >=
int(currentPart->
getNDaughters()) or dauIndex < 0) {
1070 B2WARNING(
"Daughter index out of range" <<
LogVar(
"Daughter index", dauIndex));
1071 B2WARNING(
"Trying to access non-existing particle.");
1075 currentPart = dauPart;
1100 constexpr unsigned order[] = {c_X, c_Y, c_Z, c_Px, c_Py, c_Pz};
1102 TMatrixFSym errMatrix(c_DimMatrix);
1103 for (
int i = 0; i < 6; i++) {
1104 for (
int j = i; j < 6; j++) {
1107 errMatrix(order[j], order[i]) = errMatrix(order[i], order[j]) = cov6(i, j);
1128 constexpr unsigned compMom[] = {c_Px, c_Py, c_Pz};
1129 constexpr unsigned compPos[] = {c_X, c_Y, c_Z};
1132 for (
unsigned int i : compMom) {
1134 for (
int k = 0; k < 3; k++) {
1135 Cov += errMatrix(i, compMom[k]) * dEdp[k];
1137 errMatrix(i, c_E) = Cov;
1141 for (
unsigned int comp : compPos) {
1143 for (
int k = 0; k < 3; k++) {
1144 Cov += errMatrix(comp, compMom[k]) * dEdp[k];
1146 errMatrix(c_E, comp) = Cov;
1151 for (
int i = 0; i < 3; i++) {
1152 Cov += errMatrix(compMom[i], compMom[i]) * dEdp[i] * dEdp[i];
1154 for (
int i = 0; i < 3; i++) {
1155 int k = (i + 1) % 3;
1156 Cov += 2 * errMatrix(compMom[i], compMom[k]) * dEdp[i] * dEdp[k];
1158 errMatrix(c_E, c_E) = Cov;
1178 for (
int irow = 0; irow < c_DimMatrix; irow++) {
1179 for (
int icol = irow; icol < c_DimMatrix; icol++) {
1189 for (
int irow = 0; irow < 4; irow++) {
1190 for (
int icol = 0; icol < 6; icol++) {
1202 fspDaughters.push_back(
this);
1243 int q3 = nnn % 10; nnn /= 10;
1244 int q2 = nnn % 10; nnn /= 10;
1251 return TDatabasePDG::Instance()->GetParticle(
m_pdgCode)->GetName();
1261 std::vector<std::string> out;
1265 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1267 for (
auto const& ee : map) out.push_back(ee.first);
1274 std::stringstream stream;
1275 stream << std::setprecision(4);
1278 stream <<
" <b>PDGCode</b>=" <<
m_pdgCode;
1279 stream <<
" <b>Charge</b>=" <<
getCharge();
1280 stream <<
" <b>PDGMass</b>=" <<
getPDGMass();
1290 stream <<
" <b>daughterIndices</b>: ";
1292 stream << daughterIndex <<
", ";
1298 stream <<
" <b>daughter PDGCodes</b>: ";
1301 if (p) {stream << p->getPDGCode() <<
", ";}
1302 else {stream <<
"?, ";}
1307 stream <<
" <b>mass</b>=" <<
m_mass;
1311 stream <<
" <b>p</b>=" <<
getP();
1323 stream <<
" <b>p-value of fit</b> (if done): ";
1327 stream <<
" <b>error matrix</b> (px, py, pz, E, x, y ,z):<br>";
1330 stream <<
" <b>extra info</b>=( ";
1333 if (!extraInfoMap) {
1334 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1338 for (
const auto& pair : map) {
1339 if (pair.second < nVars) {
1340 stream << pair.first <<
"=" <<
m_extraInfo[pair.second] <<
" ";
1345 stream <<
") " <<
"<br>";
1347 return stream.str();
1358 if (!extraInfoMap) {
1359 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1361 unsigned int index = extraInfoMap->getIndex(mapID, name);
1376 throw std::runtime_error(std::string(
"getExtraInfo: Value '") + name +
"' not found in Particle!");
1381 if (!extraInfoMap) {
1382 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1384 unsigned int index = extraInfoMap->getIndex(mapID, name);
1386 throw std::runtime_error(std::string(
"getExtraInfo: Value '") + name +
"' not found in Particle!");
1404 throw std::runtime_error(std::string(
"setExtraInfo: Value '") + name +
"' not found in Particle!");
1409 if (!extraInfoMap) {
1410 B2FATAL(
"ParticleExtraInfoMap not available, but needed for storing extra info in Particle!");
1412 unsigned int index = extraInfoMap->getIndex(mapID, name);
1414 throw std::runtime_error(std::string(
"setExtraInfo: Value '") + name +
"' not found in Particle!");
1423 throw std::runtime_error(std::string(
"addExtraInfo: Value '") + name +
"' already set!");
1429 unsigned int mapID = extraInfoMap->getMapForNewVar(name);
1435 unsigned int mapID = extraInfoMap->getMapForNewVar(name, oldMapID, insertIndex);
1443 bool recursive,
bool includeSelf)
const
1445 std::queue<const Particle*> qq;
1454 while (!qq.empty()) {
1456 if (function(p))
return true;
1460 if (recursive || p ==
this)
1461 for (
size_t i = 0; i < p->getNDaughters(); ++i) qq.push(p->getDaughter(i));
1469 int PDGCode = absPDGCode * chargeSign;
1485 const auto track = this->
getTrack();
1492 auto trackFitResults = track->getTrackFitResults();
1493 auto it_maxPValue = std::max_element(std::begin(trackFitResults), std::end(trackFitResults),
1494 [](
auto tfrAndM1,
auto tfrAndM2) {
return tfrAndM1.second->getPValue() < tfrAndM2.second->getPValue();});
1496 return trackFitResults[std::distance(std::begin(trackFitResults), it_maxPValue)];
1503 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.
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.