9#include <b2bii/modules/B2BIIMdstInput/B2BIIConvertMdstModule.h>
11#include <framework/datastore/StoreObjPtr.h>
12#include <framework/datastore/RelationArray.h>
13#include <framework/database/Database.h>
14#include <framework/pcore/ProcHandler.h>
16#include <mdst/dataobjects/HitPatternVXD.h>
17#include <mdst/dataobjects/HitPatternCDC.h>
18#include <mdst/dataobjects/ECLCluster.h>
21#include <framework/gearbox/Unit.h>
22#include <framework/gearbox/Const.h>
23#include <framework/geometry/B2Vector3.h>
24#include <framework/geometry/VectorUtil.h>
25#include <analysis/dataobjects/ParticleExtraInfoMap.h>
28#include <framework/dataobjects/EventMetaData.h>
29#include <framework/dataobjects/Helix.h>
30#include <framework/dataobjects/UncertainHelix.h>
33#include <b2bii/utility/BelleMdstToGenHepevt.h>
36#include <Math/RotationY.h>
37#include <Math/Vector3D.h>
38#include <Math/Vector4D.h>
39#include <Math/Point3D.h>
40#include <Math/VectorUtil.h>
48#include "belle_legacy/eid/eid.h"
52#include "belle_legacy/kid/kid_acc.h"
53#include "belle_legacy/kid/kid_cdc.h"
57#include "belle_legacy/findKs/findKs.h"
60#ifdef HAVE_NISKSFINDER
61#include "belle_legacy/nisKsFinder/nisKsFinder.h"
65#include "belle_legacy/findLambda/findLambda.h"
68#include "belle_legacy/benergy/BeamEnergy.h"
69#include "belle_legacy/ip/IpProfile.h"
70#include "belle_legacy/tables/evtcls.h"
71#include "belle_legacy/tables/trg.h"
81bool approximatelyEqual(
float a,
float b,
float epsilon)
83 return fabs(a - b) <= ((fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
86double adjustAngleRange(
double phi)
88 phi = phi - int(phi / TMath::TwoPi()) * TMath::TwoPi();
89 return phi - int(phi / TMath::Pi()) * TMath::TwoPi();
92void fill7x7ErrorMatrix(
const TrackFitResult* tfr, TMatrixDSym& error7x7,
const double mass,
const double bField)
96 double d0 = tfr->
getD0();
102 double alpha = tfr->
getHelix().getAlpha(bField);
104 double cosPhi0 = TMath::Cos(phi0);
105 double sinPhi0 = TMath::Sin(phi0);
109 rho = 1.0 / alpha / omega;
113 double energy = TMath::Sqrt(mass * mass + (1.0 + tanl * tanl) * rho * rho);
125 const int iOmega = 2;
129 TMatrixD jacobian(7, 5);
132 jacobian(iPx, iPhi0) = - fabs(rho) * sinPhi0;
133 jacobian(iPx, iOmega) = -
charge * rho * rho * cosPhi0 * alpha;
134 jacobian(iPy, iPhi0) = fabs(rho) * cosPhi0;
135 jacobian(iPy, iOmega) = -
charge * rho * rho * sinPhi0 * alpha;
136 jacobian(iPz, iOmega) = -
charge * rho * rho * tanl * alpha;
137 jacobian(iPz, iTanl) = fabs(rho);
138 if (omega != 0 && energy != 0) {
139 jacobian(iE, iOmega) = - (1.0 + tanl * tanl) * rho * rho / omega / energy;
140 jacobian(iE, iTanl) = tanl * rho * rho / energy;
142 jacobian(iE, iOmega) = (DBL_MAX);
143 jacobian(iE, iTanl) = (DBL_MAX);
145 jacobian(iX, iD0) = sinPhi0;
146 jacobian(iX, iPhi0) = d0 * cosPhi0;
147 jacobian(iY, iD0) = - cosPhi0;
148 jacobian(iY, iPhi0) = d0 * sinPhi0;
149 jacobian(iZ, iZ0) = 1.0;
153 error7x7 = error5x5.Similarity(jacobian);
165 m_mcMatchingMode(c_Direct)
168 setDescription(
"Converts Belle mDST objects (Panther tables and records) to Belle II mDST objects.");
171 "Convert beam parameters or use information stored in "
172 "Belle II database.",
true);
174 "Use 6x6 (position, momentum) covariance matrix for charged tracks instead of 5x5 (helix parameters) covariance matrix",
false);
176 "MC matching mode: 'Direct', or 'GeneratorLevel'",
177 std::string(
"Direct"));
179 "clusters with a E9/E25 value above this threshold are classified as neutral even if tracks are matched to their connected region (matchType == 2)",
183 addParam(
"nisKsInfo",
m_nisEnable,
"Flag to switch on conversion of nisKsFinder info",
true);
185 addParam(
"TrkExtra",
m_convertTrkExtra,
" Flag to switch on conversion of first_x,y,z and last_x,y,z from Mdst_trk_fit",
true);
186 addParam(
"convertNbar",
m_convertNbar,
" Flag to switch on conversion of nbar:mdst (copy from gamma:mdst)",
false);
190 B2DEBUG(1,
"B2BIIConvertMdst: Constructor done.");
208 B2INFO(
"B2BIIConvertMdst: initialized.");
210 B2WARNING(
"nisKsFinder output has been disabled. ksnbVLike, ksnbNoLam, ksnbStandard will not be converted.");
215 B2DEBUG(99,
"[B2BIIConvertMdstModule::initializeDataStore] initialization of DataStore started");
222 m_v0s.registerInDataStore();
265 B2DEBUG(99,
"[B2BIIConvertMdstModule::initializeDataStore] initialization of DataStore ended");
271 B2DEBUG(99,
"B2BIIConvertMdst: beginRun called.");
275 Belle::BeamEnergy::begin_run();
277 Belle::BeamEnergy::dump();
280 Belle::IpProfile::begin_run();
282 Belle::IpProfile::dump();
283 bool usableIP = Belle::IpProfile::usable();
284 B2DEBUG(99,
"B2BIIConvertMdst: IpProfile is usable = " << usableIP);
289 Belle::eid::init_data();
290 Belle::eid::show_use(
"ALL");
299 Belle::Belle_event_Manager& evman = Belle::Belle_event_Manager::get_manager();
300 Belle::Belle_event& evt = evman[0];
302 if (evt.ExpMC() == 2)
315 B2INFO(
"No database entry for this run yet, create one");
324 B2ERROR(
"BeamParameters from condition database are different from converted "
325 "ones, overriding database. Did you make sure the globaltag B2BII is used?");
327 B2INFO(
"BeamSpot, BoostVector, and InvariantMass from condition database are different from converted "
328 "ones, overriding database");
331 B2FATAL(
"Cannot reliably override the Database content in parallel processing "
332 "mode, please run the conversion in single processing mode");
388 const double Eher = Belle::BeamEnergy::E_HER();
389 const double Eler = Belle::BeamEnergy::E_LER();
390 const double crossingAngle = Belle::BeamEnergy::Cross_angle();
391 const double angleLer = M_PI;
392 const double angleHer = crossingAngle;
394 TMatrixDSym covariance(3);
395 HepLorentzVector p_beam = Belle::BeamEnergy::p_beam();
398 ROOT::Math::PxPyPzEVector P_her(0.0, 0.0, TMath::Sqrt(Eher * Eher - mass_e * mass_e), Eher);
399 ROOT::Math::RotationY rotateAroundYAxis(angleHer);
400 P_her = rotateAroundYAxis(P_her);
401 ROOT::Math::PxPyPzEVector P_ler(0.0, 0.0, TMath::Sqrt(Eler * Eler - mass_e * mass_e), Eler);
402 rotateAroundYAxis.SetAngle(angleLer);
403 P_ler = rotateAroundYAxis(P_ler);
406 ROOT::Math::PxPyPzEVector P_beam = P_her + P_ler;
408 ROOT::Math::PxPyPzEVector momentumHER = P_her;
409 ROOT::Math::VectorUtil::boost(momentumHER, -P_beam.BoostToCM());
410 double angleXZ = std::atan(momentumHER.X() / momentumHER.Z());
411 double angleYZ = std::atan(momentumHER.Y() / momentumHER.Z());
418 B2DEBUG(99,
"Beam Energy: E_HER = " << Eher <<
"; E_LER = " << Eler <<
"; angle = " << crossingAngle);
419 B2DEBUG(99,
"Beam Momentum (pre-convert) : P_X = " << p_beam.px() <<
"; P_Y = " << p_beam.py() <<
"; P_Z = " << p_beam.pz());
420 B2DEBUG(99,
"Beam Momentum (post-convert) : P_X = " << P_beam.Px() <<
"; P_Y = " << P_beam.Py() <<
"; P_Z = " << P_beam.Pz());
426 if (!Belle::IpProfile::usable()) {
431 TVector3(std::numeric_limits<double>::quiet_NaN(),
432 std::numeric_limits<double>::quiet_NaN(),
433 std::numeric_limits<double>::quiet_NaN()
434 ), TMatrixTSym<double>()
440 CLHEP::HepSymMatrix ipErr;
443 ip = Belle::IpProfile::position();
444 ipErr = Belle::IpProfile::position_err();
447 Belle::IpProfile::set_evtbin_number();
451 ip = Belle::IpProfile::e_position();
452 ipErr = Belle::IpProfile::e_position_err();
457 TMatrixDSym cov(ipErr.num_col());
458 for (
int i = 0; i < ipErr.num_row(); ++i) {
459 for (
int j = 0; j < ipErr.num_col(); ++j) {
460 cov(i, j) = ipErr(i + 1, j + 1);
472 Belle::Mdst_charged_Manager& m = Belle::Mdst_charged_Manager::get_manager();
473 for (Belle::Mdst_charged_Manager::iterator chargedIterator = m.begin(); chargedIterator != m.end(); ++chargedIterator) {
474 Belle::Mdst_charged belleTrack = *chargedIterator;
476 Belle::Mdst_trk& trk = belleTrack.trk();
477 bool foundValidTrackFitResult =
false;
478 for (
int mhyp = 0 ; mhyp <
c_nHyp; ++mhyp) {
479 Belle::Mdst_trk_fit& trk_fit = trk.mhyp(mhyp);
481 double pValue = TMath::Prob(trk_fit.chisq(), trk_fit.ndf());
482 if (std::isnan(pValue))
continue;
483 foundValidTrackFitResult =
true;
485 if (not foundValidTrackFitResult)
continue;
499 const Belle::Gen_hepevt& hep0 = get_hepevt(belleTrack);
502 const Belle::Gen_hepevt* hep =
nullptr;
508 hep = &gen_level(hep0);
516 tracksToMCParticles.
add(track->getArrayIndex(), matchedMCParticle);
520 B2DEBUG(99,
"Can not find MCParticle corresponding to this gen_hepevt (Panther ID = " << hep->get_ID() <<
")");
521 B2DEBUG(99,
"Gen_hepevt: Panther ID = " << hep->get_ID() <<
"; idhep = " << hep->idhep() <<
"; isthep = " << hep->isthep());
531 ksPList->initialize(310, ksPList.
getName());
536 lambda0PList->initialize(3122, lambda0PList.
getName());
539 antiLambda0PList.
create();
540 antiLambda0PList->initialize(-3122, antiLambda0PList.
getName());
542 antiLambda0PList->bindAntiParticleList(*lambda0PList);
547 convGammaPList->initialize(22, convGammaPList.
getName());
550 Belle::Mdst_vee2_Manager& m = Belle::Mdst_vee2_Manager::get_manager();
551 for (Belle::Mdst_vee2_Manager::iterator vee2Iterator = m.begin(); vee2Iterator != m.end(); ++vee2Iterator) {
552 Belle::Mdst_vee2 belleV0 = *vee2Iterator;
555 Belle::Mdst_charged belleTrackP = belleV0.chgd(0);
557 Belle::Mdst_charged belleTrackM = belleV0.chgd(1);
565 switch (belleV0.kind()) {
591 B2WARNING(
"Conversion of vee2 candidate of unknown kind! kind = " << belleV0.kind());
595 int trackID[2] = {0, 0};
597 Belle::Mdst_charged_Manager& charged_mag = Belle::Mdst_charged_Manager::get_manager();
598 for (std::vector<Belle::Mdst_charged>::iterator chgIterator = charged_mag.begin(); chgIterator != charged_mag.end();
600 if (belleV0.chgd(0).get_ID() >= 1 && trackID[0] == 0 && belleV0.chgd(0).get_ID() == chgIterator->get_ID()) {
601 trackID[0] = (int)(chgIterator->get_ID());
604 if (belleV0.chgd(1).get_ID() >= 1 && trackID[1] == 0 && belleV0.chgd(1).get_ID() == chgIterator->get_ID()) {
605 trackID[1] = (int)(chgIterator->get_ID());
611 if (std::max(trackID[0], trackID[1]) >
m_tracks.getEntries())
continue;
613 HepPoint3D dauPivot(belleV0.vx(), belleV0.vy(), belleV0.vz());
614 int trackFitPIndex = -1;
615 int trackFitMIndex = -1;
617 CLHEP::HepLorentzVector momentumP;
618 CLHEP::HepSymMatrix error7x7P(7, 0);
620 TMatrixFSym errMatrixP(7);
621 CLHEP::HepLorentzVector momentumM;
622 CLHEP::HepSymMatrix error7x7M(7, 0);
624 TMatrixFSym errMatrixM(7);
625 CLHEP::HepSymMatrix error5x5(5, 0);
626 if (trackID[0] >= 1) {
627 if (belleV0.daut()) {
628 std::vector<float> helixParam(5);
629 std::vector<float> helixError(15);
632 auto trackFitP =
m_trackFitResults.appendNew(helixParam, helixError, pTypeP, 0.5, -1, -1, 0);
633 trackFitPIndex = trackFitP->getArrayIndex();
640 for (
unsigned i = 0; i < 7; i++)
641 for (
unsigned j = 0; j < 7; j++)
642 errMatrixP(i, j) = error7x7P[i][j];
644 daughterP =
Particle(trackID[0] - 1, tmpTFR, pTypeP);
645 daughterP.
updateMomentum(ROOT::Math::PxPyPzEVector(momentumP.px(), momentumP.py(), momentumP.pz(), momentumP.e()),
646 ROOT::Math::XYZVector(positionP.x(), positionP.y(), positionP.z()),
650 Belle::Mdst_trk_fit& trk_fit = charged_mag[trackID[0] - 1].trk().mhyp(belleHypP);
651 double pValue = TMath::Prob(trk_fit.chisq(), trk_fit.ndf());
652 if (std::isnan(pValue))
continue;
654 std::vector<float> helixParam(5);
655 std::vector<float> helixError(15);
659 if (helixParam[2] == 0) {
660 B2WARNING(
"Helix parameter for curvature == 0. Skipping Track! The parameter is: " << helixParam[2] <<
"...");
664 auto trackFitP =
m_trackFitResults.appendNew(helixParam, helixError, pTypeP, pValue, -1, -1, 0);
666 trackFitPIndex = trackFitP->getArrayIndex();
668 daughterP =
Particle(trackID[0] - 1, trackFitP, pTypeP);
671 helixParam, error5x5,
672 momentumP, positionP, error7x7P);
674 for (
unsigned i = 0; i < 7; i++)
675 for (
unsigned j = 0; j < 7; j++)
676 errMatrixP(i, j) = error7x7P[i][j];
678 daughterP.
updateMomentum(ROOT::Math::PxPyPzEVector(momentumP.px(), momentumP.py(), momentumP.pz(), momentumP.e()),
679 ROOT::Math::XYZVector(positionP.x(), positionP.y(), positionP.z()),
683 if (trackID[1] >= 1) {
684 if (belleV0.daut()) {
685 std::vector<float> helixParam(5);
686 std::vector<float> helixError(15);
689 auto trackFitM =
m_trackFitResults.appendNew(helixParam, helixError, pTypeM, 0.5, -1, -1, 0);
690 trackFitMIndex = trackFitM->getArrayIndex();
696 for (
unsigned i = 0; i < 7; i++)
697 for (
unsigned j = 0; j < 7; j++)
698 errMatrixM(i, j) = error7x7M[i][j];
700 daughterM =
Particle(trackID[1] - 1, tmpTFR, pTypeM);
701 daughterM.
updateMomentum(ROOT::Math::PxPyPzEVector(momentumM.px(), momentumM.py(), momentumM.pz(), momentumM.e()),
702 ROOT::Math::XYZVector(positionM.x(), positionM.y(), positionM.z()),
706 Belle::Mdst_trk_fit& trk_fit = charged_mag[trackID[1] - 1].trk().mhyp(belleHypM);
707 double pValue = TMath::Prob(trk_fit.chisq(), trk_fit.ndf());
708 if (std::isnan(pValue))
continue;
710 std::vector<float> helixParam(5);
711 std::vector<float> helixError(15);
715 if (helixParam[2] == 0) {
716 B2WARNING(
"Helix parameter for curvature == 0. Skipping Track! The parameter is: " << helixParam[2] <<
"...");
720 auto trackFitM =
m_trackFitResults.appendNew(helixParam, helixError, pTypeM, pValue, -1, -1, 0);
722 trackFitMIndex = trackFitM->getArrayIndex();
724 daughterM =
Particle(trackID[1] - 1, trackFitM, pTypeM);
727 helixParam, error5x5,
728 momentumM, positionM, error7x7M);
730 for (
unsigned i = 0; i < 7; i++)
731 for (
unsigned j = 0; j < 7; j++)
732 errMatrixM(i, j) = error7x7M[i][j];
734 daughterM.
updateMomentum(ROOT::Math::PxPyPzEVector(momentumM.px(), momentumM.py(), momentumM.pz(), momentumM.e()),
735 ROOT::Math::XYZVector(positionM.x(), positionM.y(), positionM.z()),
746 m_v0s.appendNew(std::make_pair(trackP, trackFitP), std::make_pair(trackM, trackFitM), belleV0.vx(), belleV0.vy(), belleV0.vz());
758 newDaugP->addRelationTo(mcParticleP);
765 ROOT::Math::PxPyPzEVector v0Momentum(belleV0.px(), belleV0.py(), belleV0.pz(), belleV0.energy());
766 ROOT::Math::XYZVector v0Vertex(belleV0.vx(), belleV0.vy(), belleV0.vz());
772 auto appendVertexFitInfo = [](Belle::Mdst_vee2 & _belle_V0,
Particle & _belle2_V0) {
774 _belle2_V0.addExtraInfo(
"chiSquared", _belle_V0.chisq());
776 _belle2_V0.addExtraInfo(
"ndf", 1);
778 double prob = TMath::Prob(_belle_V0.chisq(), 1);
779 _belle2_V0.setPValue(prob);
783 if (belleV0.kind() == 1) {
788 appendVertexFitInfo(belleV0, KS);
790 ksPList->addParticle(newV0);
793 Belle::FindKs belleKSFinder;
794 belleKSFinder.candidates(belleV0, Belle::IpProfile::position(1));
831 }
else if (belleV0.kind() == 2) {
836 appendVertexFitInfo(belleV0, Lambda0);
838 lambda0PList->addParticle(newV0);
841 Belle::FindLambda lambdaFinder;
842 lambdaFinder.candidates(belleV0, Belle::IpProfile::position(1));
843 newV0->
addExtraInfo(
"goodLambda", lambdaFinder.goodLambda());
844 }
else if (belleV0.kind() == 3) {
845 Particle antiLambda0(v0Momentum, -3122);
849 appendVertexFitInfo(belleV0, antiLambda0);
851 antiLambda0PList->addParticle(newV0);
854 Belle::FindLambda lambdaFinder;
855 lambdaFinder.candidates(belleV0, Belle::IpProfile::position(1));
856 newV0->
addExtraInfo(
"goodLambda", lambdaFinder.goodLambda());
857 }
else if (belleV0.kind() == 4) {
862 appendVertexFitInfo(belleV0, gamma);
864 convGammaPList->addParticle(newV0);
868 if (belleV0.kind() > 0 and belleV0.kind() <= 3) {
869 Belle::nisKsFinder ksnb;
870 double protIDP =
atcPID(pidP, 2, 4);
871 double protIDM =
atcPID(pidM, 2, 4);
872 ksnb.candidates(belleV0, Belle::IpProfile::position(1), momentumP, protIDP, protIDM);
877 if (belleV0.kind() == 1)
893 Belle::Gen_hepevt_Manager& genMgr = Belle::Gen_hepevt_Manager::get_manager();
894 if (genMgr.count() == 0)
897 typedef std::pair<MCParticleGraph::GraphParticle*, Belle::Gen_hepevt> halfFamily;
898 halfFamily currFamily;
900 std::queue < halfFamily > heritancesQueue;
906 for (Belle::Gen_hepevt_Manager::iterator genIterator = genMgr.begin();
907 genIterator != genMgr.end(); ++genIterator) {
908 Belle::Gen_hepevt hep = *genIterator;
910 if (!(hep.moFirst() == 0 && hep.moLast() == 0))
918 for (
int iDaughter = hep.daFirst(); iDaughter <= hep.daLast();
920 if (iDaughter == 0) {
921 B2DEBUG(95,
"Trying to access generated daughter with Panther ID == 0");
924 currFamily.first = graphParticle;
925 currFamily.second = genMgr(Belle::Panther_ID(iDaughter));
926 heritancesQueue.push(currFamily);
931 while (!heritancesQueue.empty()) {
932 currFamily = heritancesQueue.front();
933 heritancesQueue.pop();
936 Belle::Gen_hepevt& currDaughter = currFamily.second;
939 if (currDaughter.idhep() == 0)
953 int nGrandChildren = currDaughter.daLast() - currDaughter.daFirst() + 1;
955 if (nGrandChildren > 0 && currDaughter.daFirst() != 0) {
956 for (
int igrandchild = currDaughter.daFirst(); igrandchild <= currDaughter.daLast(); ++igrandchild) {
957 if (igrandchild == 0) {
958 B2DEBUG(95,
"Trying to access generated daughter with Panther ID == 0");
962 family.first = graphDaughter;
963 family.second = genMgr(Belle::Panther_ID(igrandchild));
964 heritancesQueue.push(family);
982 Belle::Mdst_ecl_Manager& ecl_manager = Belle::Mdst_ecl_Manager::get_manager();
983 Belle::Mdst_ecl_aux_Manager& ecl_aux_manager = Belle::Mdst_ecl_aux_Manager::get_manager();
985 for (Belle::Mdst_ecl_Manager::iterator eclIterator = ecl_manager.begin(); eclIterator != ecl_manager.end(); ++eclIterator) {
988 Belle::Mdst_ecl mdstEcl = *eclIterator;
989 Belle::Mdst_ecl_aux mdstEclAux(ecl_aux_manager(mdstEcl.get_ID()));
1000 B2EclCluster->setConnectedRegionId(B2EclCluster->getArrayIndex() + 1);
1001 B2EclCluster->setClusterId(1);
1008 const Belle::Gen_hepevt& hep0 = get_hepevt(mdstEcl);
1011 const Belle::Gen_hepevt* hep =
nullptr;
1017 hep = &gen_level(hep0);
1024 eclClustersToMCParticles.
add(B2EclCluster->getArrayIndex(), matchedMCParticleID);
1027 B2DEBUG(79,
"Cannot find MCParticle corresponding to this gen_hepevt (Panther ID = " << hep->get_ID() <<
")");
1028 B2DEBUG(79,
"Gen_hepevt: Panther ID = " << hep->get_ID() <<
"; idhep = " << hep->idhep() <<
"; isthep = " << hep->isthep());
1041 Belle::Mdst_klm_cluster_Manager& klm_cluster_manager = Belle::Mdst_klm_cluster_Manager::get_manager();
1043 for (Belle::Mdst_klm_cluster_Manager::iterator klmC_Ite = klm_cluster_manager.begin(); klmC_Ite != klm_cluster_manager.end();
1047 Belle::Mdst_klm_cluster mdstKlm_cluster = *klmC_Ite;
1071 plist->initialize(22,
"gamma:mdst");
1074 Belle::Mdst_gamma_Manager& gamma_manager = Belle::Mdst_gamma_Manager::get_manager();
1076 for (Belle::Mdst_gamma_Manager::iterator gammaIterator = gamma_manager.begin(); gammaIterator != gamma_manager.end();
1080 Belle::Mdst_gamma mdstGamma = *gammaIterator;
1081 Belle::Mdst_ecl mdstEcl = mdstGamma.ecl();
1095 plist->addParticle(B2Gamma);
1102 if (matchedMCParticle)
1113 B2DEBUG(99,
"Getting gamma:mdst in copyNbarFromGamma");
1115 for (
const Particle& gamma : *plist_gamma) {
1116 auto* eclCluster = gamma.getECLCluster();
1119 B2DEBUG(99,
"Copying anti-n0:mdst from gamma:mdst");
1121 plist->addParticle(nbar);
1128 if (matchedMCParticle)
1138 plist->initialize(111,
"pi0:mdst");
1141 Belle::Mdst_pi0_Manager& pi0_manager = Belle::Mdst_pi0_Manager::get_manager();
1142 for (Belle::Mdst_pi0_Manager::iterator pi0Iterator = pi0_manager.begin(); pi0Iterator != pi0_manager.end(); ++pi0Iterator) {
1145 Belle::Mdst_pi0 mdstPi0 = *pi0Iterator;
1146 Belle::Mdst_gamma mdstGamma1 = mdstPi0.gamma(0);
1147 Belle::Mdst_gamma mdstGamma2 = mdstPi0.gamma(1);
1148 if (!mdstGamma1 || !mdstGamma2)
1151 ROOT::Math::PxPyPzEVector p4(mdstPi0.px(), mdstPi0.py(), mdstPi0.pz(), mdstPi0.energy());
1159 if (!B2Gamma1 || !B2Gamma2)
1173 double prob = TMath::Prob(mdstPi0.chisq(), 1);
1177 plist->addParticle(B2Pi0);
1190 plist->initialize(
Const::Klong.getPDGCode(),
"K_L0:mdst");
1192 Belle::Mdst_klong_Manager& klong_manager = Belle::Mdst_klong_Manager::get_manager();
1193 for (Belle::Mdst_klong_Manager::iterator klong_Ite = klong_manager.begin(); klong_Ite != klong_manager.end(); ++klong_Ite) {
1196 Belle::Mdst_klong mdstKlong = *klong_Ite;
1197 Belle::Mdst_klm_cluster mdstKlm = mdstKlong.klmc();
1209 B2KlmCluster->
setClusterPosition(mdstKlong.cos_x(), mdstKlong.cos_y(), mdstKlong.cos_z());
1216 plist->addParticle(B2Klong);
1227 Belle::Gen_hepevt_Manager& GenMgr = Belle::Gen_hepevt_Manager::get_manager();
1228 const double dang(15. / 180.*M_PI);
1230 for (Belle::Gen_hepevt_Manager::iterator klong_hep_it = GenMgr.begin(); klong_hep_it != GenMgr.end(); ++klong_hep_it) {
1234 CLHEP::HepLorentzVector gp4(klong_hep_it->PX(), klong_hep_it->PY(), klong_hep_it->PZ(), klong_hep_it->E());
1236 int bestRecKlongID(0);
1238 for (Belle::Mdst_klong_Manager::iterator klong_rec_it = klong_manager.begin(); klong_rec_it != klong_manager.end();
1242 if ((*klong_rec_it).ecl())
1244 CLHEP::Hep3Vector klp3(klong_rec_it->cos_x(), klong_rec_it->cos_y(), klong_rec_it->cos_z());
1246 if (cos(gp4.theta() - klp3.theta()) > cos(dang) && cos(gp4.phi() - klp3.phi()) > cos(dang)) {
1248 double tmp_sum = cos(gp4.theta() - klp3.theta()) + cos(gp4.phi() - klp3.phi());
1249 if (tmp_sum > sum) {
1258 particlesToMCParticles.
add(bestRecKlongID, matchedMCParticleID);
1273 Belle::Evtcls_flag_Manager& EvtFlagMgr = Belle::Evtcls_flag_Manager::get_manager();
1274 Belle::Evtcls_flag2_Manager& EvtFlag2Mgr = Belle::Evtcls_flag2_Manager::get_manager();
1277 Belle::Evtcls_hadronic_flag_Manager& EvtHadFlagMgr = Belle::Evtcls_hadronic_flag_Manager::get_manager();
1279 std::string name =
"evtcls_flag";
1280 std::string name_had =
"evtcls_hadronic_flag";
1282 std::vector<Belle::Evtcls_flag>::iterator eflagIterator = EvtFlagMgr.begin();
1283 std::vector<Belle::Evtcls_flag2>::iterator eflag2Iterator = EvtFlag2Mgr.begin();
1284 std::vector<Belle::Evtcls_hadronic_flag>::iterator ehadflagIterator = EvtHadFlagMgr.begin();
1287 std::vector<int> flag(20);
1288 for (
int index = 0; index < 20; ++index) {
1290 if (index == 14 || index == 16)
continue;
1291 std::string iVar = name + std::to_string(index);
1294 m_evtInfo->addExtraInfo(iVar, (*eflagIterator).flag(index));
1297 m_evtInfo->addExtraInfo(iVar, (*eflag2Iterator).flag(index - 10));
1299 B2DEBUG(99,
"evtcls_flag(" << index <<
") = " <<
m_evtInfo->getExtraInfo(iVar));
1303 for (
int index = 0; index < 6; ++index) {
1304 std::string iVar = name_had + std::to_string(index);
1305 m_evtInfo->addExtraInfo(iVar, (*ehadflagIterator).hadronic_flag(index));
1306 B2DEBUG(99,
"evtcls_hadronic_flag(" << index <<
") = " <<
m_evtInfo->getExtraInfo(iVar));
1321 if (
event->getExperiment() <= 27) {
1323 Belle::Rectrg_summary_Manager& RecTrgSummaryMgr = Belle::Rectrg_summary_Manager::get_manager();
1324 std::vector<Belle::Rectrg_summary>::iterator eflagIterator = RecTrgSummaryMgr.begin();
1325 std::string name_summary =
"rectrg_summary_m_final";
1328 for (
int index = 0; index < 2; ++index) {
1329 std::string iVar = name_summary + std::to_string(index);
1330 m_evtInfo->addExtraInfo(iVar, (*eflagIterator).final(index));
1331 B2DEBUG(99,
"m_final(" << index <<
") = " <<
m_evtInfo->getExtraInfo(iVar));
1335 Belle::Rectrg_summary3_Manager& RecTrgSummary3Mgr = Belle::Rectrg_summary3_Manager::get_manager();
1337 std::string name_summary3 =
"rectrg_summary3_m_final";
1339 std::vector<Belle::Rectrg_summary3>::iterator eflagIterator3 = RecTrgSummary3Mgr.begin();
1342 for (
int index = 0; index < 3; ++index) {
1343 std::string iVar = name_summary3 + std::to_string(index);
1344 m_evtInfo->addExtraInfo(iVar, (*eflagIterator3).final(index));
1345 B2DEBUG(99,
"m_final(" << index <<
") = " <<
m_evtInfo->getExtraInfo(iVar));
1359 static Belle::kid_acc acc_pdf(0);
1362 const double pmass[5] = { 0.00051099907, 0.105658389, 0.13956995, 0.493677, 0.93827231 };
1364 CLHEP::Hep3Vector mom(chg.px(), chg.py(), chg.pz());
1365 double cos_theta = mom.cosTheta();
1366 double pval = mom.mag();
1368 double npe = chg.acc().photo_electron();
1369 double beta = pval /
sqrt(pval * pval + pmass[idp] * pmass[idp]);
1370 double pdfval = acc_pdf.npe2pdf(cos_theta, beta, npe);
1378 CLHEP::Hep3Vector mom(chg.px(), chg.py(), chg.pz());
1379 double pval = mom.mag();
1381 Belle::kid_cdc kidCdc(5);
1382 float factor0 = kidCdc.factor0();
1383 float factor1 = kidCdc.factor1(idp, pval);
1385 if (factor0 == 1.0 && factor1 == 1.0)
return chg.trk().pid(idp);
1387 double m = chg.trk().dEdx() / factor0;
1388 double e = chg.trk().dEdx_exp(idp) * factor1;
1389 double s = chg.trk().sigma_dEdx(idp);
1390 double val = 1. /
sqrt(2.*M_PI) / s * exp(-0.5 * (m - e) * (m - e) / s / s);
1397 bool discard_allzero)
1399 if (discard_allzero) {
1400 const double max_l = *std::max_element(likelihoods, likelihoods +
c_nHyp);
1406 for (
int i = 0; i <
c_nHyp; i++) {
1407 float logl = log(likelihoods[i]);
1417 track->addRelationTo(pid);
1423 double likelihoods[
c_nHyp];
1427 for (
int i = 0; i <
c_nHyp; i++) {
1428 accL[i] = tofL[i] = cdcL[i] = 1.0;
1432 const auto& acc = belleTrack.acc();
1433 if (acc and acc.quality() == 0) {
1434 for (
int i = 0; i <
c_nHyp; i++)
1435 accL[i] = likelihoods[i] =
acc_pid(belleTrack, i);
1442 const Belle::Mdst_tof& tof = belleTrack.tof();
1443 if (tof and tof.quality() == 0) {
1444 for (
int i = 0; i <
c_nHyp; i++)
1445 tofL[i] = likelihoods[i] = tof.pid(i);
1452 const Belle::Mdst_trk& trk = belleTrack.trk();
1453 if (trk.dEdx() > 0) {
1454 for (
int i = 0; i <
c_nHyp; i++) {
1455 likelihoods[i] = trk.pid(i);
1456 cdcL[i] =
cdc_pid(belleTrack, i);
1470 Belle::eid electronID(belleTrack);
1471 float eclID_e_pdf = electronID.pdf_e_ecl();
1472 float eclID_h_pdf = electronID.pdf_h_ecl();
1473 float atcID_e_pdf = electronID.atc_pid_pdf(
true, accL, tofL, cdcL);
1474 float atcID_h_pdf = electronID.atc_pid_pdf(
false, accL, tofL, cdcL);
1477 float eclProb = eclID_e_pdf / (eclID_e_pdf + eclID_h_pdf);
1478 float atcProb = atcID_e_pdf / (atcID_e_pdf + atcID_h_pdf);
1480 if (atcProb > 0.999999) atcProb = 0.999999;
1482 double eidCombinedSig = eclProb * atcProb;
1483 double eidCombinedBkg = (1. - eclProb) * (1. - atcProb);
1485 likelihoods[0] = eidCombinedSig;
1487 likelihoods[2] = eidCombinedBkg;
1501 int muid_trackid = belleTrack.muid_ID();
1505 Belle::Mdst_klm_mu_ex_Manager& ex_mgr = Belle::Mdst_klm_mu_ex_Manager::get_manager();
1506 Belle::Mdst_klm_mu_ex& ex = ex_mgr(Belle::Panther_ID(muid_trackid));
1509 if (ex.Chi_2() > 0) {
1511 likelihoods[1] = ex.Muon_likelihood();
1512 likelihoods[2] = ex.Pion_likelihood();
1513 likelihoods[3] = ex.Kaon_likelihood();
1518 for (
int i = 0; i < 5; i++)
1519 if (likelihoods[i] < 0)
1545 std::vector<float>& helixParams,
1546 CLHEP::HepSymMatrix& error5x5,
1547 CLHEP::HepLorentzVector& momentum,
1549 CLHEP::HepSymMatrix& error7x7,
const double dPhi)
1555 CLHEP::HepVector a(5);
1556 a[0] = trk_fit.helix(0);
1557 a[1] = trk_fit.helix(1);
1558 a[2] = trk_fit.helix(2);
1559 a[3] = trk_fit.helix(3);
1560 a[4] = trk_fit.helix(4);
1561 CLHEP::HepSymMatrix Ea(5, 0);
1562 Ea[0][0] = trk_fit.error(0);
1563 Ea[1][0] = trk_fit.error(1);
1564 Ea[1][1] = trk_fit.error(2);
1565 Ea[2][0] = trk_fit.error(3);
1566 Ea[2][1] = trk_fit.error(4);
1567 Ea[2][2] = trk_fit.error(5);
1568 Ea[3][0] = trk_fit.error(6);
1569 Ea[3][1] = trk_fit.error(7);
1570 Ea[3][2] = trk_fit.error(8);
1571 Ea[3][3] = trk_fit.error(9);
1572 Ea[4][0] = trk_fit.error(10);
1573 Ea[4][1] = trk_fit.error(11);
1574 Ea[4][2] = trk_fit.error(12);
1575 Ea[4][3] = trk_fit.error(13);
1576 Ea[4][4] = trk_fit.error(14);
1578 Belle::Helix helix(pivot, a, Ea);
1581 if (helix.kappa() > 0)
1586 if (newPivot.x() != 0. || newPivot.y() != 0. || newPivot.z() != 0.) {
1587 helix.pivot(newPivot);
1588 momentum = helix.momentum(dPhi, mass, position, error7x7);
1590 if (pivot.x() != 0. || pivot.y() != 0. || pivot.z() != 0.) {
1592 momentum = helix.momentum(dPhi, mass, position, error7x7);
1594 momentum = helix.momentum(dPhi, mass, position, error7x7);
1605 std::vector<float>& helixParams, std::vector<float>& helixError)
1611 CLHEP::HepVector a(5);
1612 a[0] = trk_fit.helix(0);
1613 a[1] = trk_fit.helix(1);
1614 a[2] = trk_fit.helix(2);
1615 a[3] = trk_fit.helix(3);
1616 a[4] = trk_fit.helix(4);
1617 CLHEP::HepSymMatrix Ea(5, 0);
1618 Ea[0][0] = trk_fit.error(0);
1619 Ea[1][0] = trk_fit.error(1);
1620 Ea[1][1] = trk_fit.error(2);
1621 Ea[2][0] = trk_fit.error(3);
1622 Ea[2][1] = trk_fit.error(4);
1623 Ea[2][2] = trk_fit.error(5);
1624 Ea[3][0] = trk_fit.error(6);
1625 Ea[3][1] = trk_fit.error(7);
1626 Ea[3][2] = trk_fit.error(8);
1627 Ea[3][3] = trk_fit.error(9);
1628 Ea[4][0] = trk_fit.error(10);
1629 Ea[4][1] = trk_fit.error(11);
1630 Ea[4][2] = trk_fit.error(12);
1631 Ea[4][3] = trk_fit.error(13);
1632 Ea[4][4] = trk_fit.error(14);
1634 Belle::Helix helix(pivot, a, Ea);
1636 if (newPivot.x() != 0. || newPivot.y() != 0. || newPivot.z() != 0.) {
1637 helix.pivot(newPivot);
1639 if (pivot.x() != 0. || pivot.y() != 0. || pivot.z() != 0.) {
1644 CLHEP::HepSymMatrix error5x5(5, 0);
1647 unsigned int size = 5;
1648 unsigned int counter = 0;
1649 for (
unsigned int i = 0; i < size; i++)
1650 for (
unsigned int j = i; j < size; j++)
1651 helixError[counter++] = error5x5[i][j];
1656 CLHEP::HepVector a(5);
1657 CLHEP::HepSymMatrix Ea(5, 0);
1663 helixParams[0] = a[0];
1666 helixParams[1] = adjustAngleRange(a[1] + TMath::Pi() / 2.0);
1672 helixParams[3] = a[3];
1675 helixParams[4] = a[4];
1677 unsigned int size = 5;
1678 for (
unsigned int i = 0; i < size; i++) {
1679 for (
unsigned int j = 0; j < size; j++) {
1680 error5x5[i][j] = Ea[i][j];
1686 if (std::isinf(error5x5[i][j])) {
1687 B2DEBUG(99,
"Helix covariance matrix element found to be infinite. Setting value to DBL_MAX/2.0.");
1688 error5x5[i][j] = DBL_MAX / 2.0;
1696 Belle::Mdst_trk& trk = belleTrack.trk();
1698 for (
int mhyp = 0 ; mhyp <
c_nHyp; ++mhyp) {
1699 Belle::Mdst_trk_fit& trk_fit = trk.mhyp(mhyp);
1701 double pValue = TMath::Prob(trk_fit.chisq(), trk_fit.ndf());
1702 if (std::isnan(pValue))
continue;
1705 double thisMass = pType.
getMass();
1708 std::vector<float> helixParam(5);
1710 CLHEP::HepSymMatrix error5x5(5, 0);
1712 CLHEP::HepLorentzVector momentum;
1714 CLHEP::HepSymMatrix error7x7(7, 0);
1719 helixParam, error5x5,
1720 momentum, position, error7x7, 0.0);
1722 std::vector<float> helixError(15);
1723 unsigned int size = 5;
1724 unsigned int counter = 0;
1725 for (
unsigned int i = 0; i < size; i++)
1726 for (
unsigned int j = i; j < size; j++)
1727 helixError[counter++] = error5x5[i][j];
1734 for (
unsigned int i = 0; i < 3; i++)
1735 cdcNHits += trk_fit.nhits(i);
1743 double path_length = 0;
1744 double tof_sigma = 0;
1748 double dedx = trk.dEdx();
1749 short dedx_qual = trk.quality_dedx();
1751 const Belle::Mdst_tof& tof_obj = belleTrack.tof();
1753 tof = tof_obj.tof();
1754 path_length = tof_obj.path_length();
1755 tof_qual = tof_obj.quality();
1756 tof_sigma = tof_obj.sigma_tof();
1759 const Belle::Mdst_acc& acc_obj = belleTrack.acc();
1761 acc_ph = acc_obj.photo_electron();
1762 acc_qual = acc_obj.quality();
1766 auto cdcExtraInfo =
m_belleTrkExtra.appendNew(trk_fit.first_x(), trk_fit.first_y(), trk_fit.first_z(),
1767 trk_fit.last_x(), trk_fit.last_y(), trk_fit.last_z(),
1768 tof, path_length, tof_qual, tof_sigma,
1769 acc_ph, acc_qual, dedx, dedx_qual);
1770 track->addRelationTo(cdcExtraInfo);
1773 int svdHitPattern = trk_fit.hit_svd();
1777 std::bitset<32> svdBitSet(svdHitPattern);
1781 unsigned short svdLayers;
1785 std::bitset<32> svdUMask(
static_cast<std::string
>(
"00000000000000000000000000000011"));
1787 std::bitset<32> svdVMask;
1790 if (
event->getExperiment() <= 27) {
1791 svdVMask = svdUMask << 6;
1794 svdVMask = svdUMask << 8;
1799 for (
unsigned short layerId = 0; layerId < svdLayers; layerId++) {
1800 unsigned short uHits = (svdBitSet & svdUMask).count();
1801 unsigned short vHits = (svdBitSet & svdVMask).count();
1802 patternVxd.
setSVDLayer(layerId + 3, uHits, vHits);
1811 TMatrixDSym cartesianCovariance(6);
1812 for (
unsigned i = 0; i < 7; i++) {
1815 for (
unsigned j = 0; j < 7; j++) {
1823 BFIELD, cartesianCovariance, pValue);
1825 TMatrixDSym helixCovariance = helixFromCartesian.
getCovariance();
1828 for (
unsigned int i = 0; i < 5; ++i)
1829 for (
unsigned int j = i; j < 5; ++j)
1830 helixError[counter++] = helixCovariance(i, j);
1835 track->setTrackFitResultIndex(pType, trackFit->getArrayIndex());
1863 B2WARNING(
"Trying to convert Gen_hepevt with idhep = " << idHep <<
1864 ". This should never happen.");
1867 mcParticle->
setPDG(idHep);
1870 if (genHepevt.isthep() > 0) {
1874 mcParticle->
setMass(genHepevt.M());
1876 ROOT::Math::PxPyPzEVector p4(genHepevt.PX(), genHepevt.PY(), genHepevt.PZ(), genHepevt.E());
1883 if (genHepevt.daFirst() > 0) {
1884 Belle::Gen_hepevt_Manager& genMgr = Belle::Gen_hepevt_Manager::get_manager();
1885 Belle::Gen_hepevt daughterParticle = genMgr(Belle::Panther_ID(genHepevt.daFirst()));
1890 mcParticle->
setDecayTime(std::numeric_limits<float>::infinity());
1907 eclCluster->
setPhi(ecl.phi());
1909 eclCluster->
setR(ecl.r());
1912 double covarianceMatrix[6];
1913 covarianceMatrix[0] = ecl.error(0);
1914 covarianceMatrix[1] = ecl.error(1);
1915 covarianceMatrix[2] = ecl.error(2);
1916 covarianceMatrix[3] = ecl.error(3);
1917 covarianceMatrix[4] = ecl.error(4);
1918 covarianceMatrix[5] = ecl.error(5);
1921 eclCluster->
setLAT(eclAux.width());
1928 float prop2 = eclAux.property(2);
1931 std::memcpy(&property2, &prop2,
sizeof(
int));
1934 tdccount = property2 & 0xffff;
1935 eclCluster->
setTime(tdccount);
1943 const double m_extRadius(125.0);
1944 const double m_extZFWD(196.0);
1945 const double m_extZBWD(-102.2);
1946 double minDist(10000);
1950 double eclClusterR_surface = m_extRadius / sin(eclCluster->
getTheta());
1951 if (reg == 1) {eclClusterR_surface = m_extZFWD / cos(eclCluster->
getTheta());}
1952 else if (reg == 3) {eclClusterR_surface = m_extZBWD / cos(eclCluster->
getTheta());}
1954 ROOT::Math::XYZVector eclCluster_surface_position(0, 0, 0);
1955 VectorUtil::setMagThetaPhi(eclCluster_surface_position, eclClusterR_surface, eclCluster->
getTheta(), eclCluster->
getPhi());
1957 for (
const auto& track :
m_tracks) {
1960 if (trackFit == NULL) {
continue;}
1962 const double z0 = trackFit->
getZ0();
1969 const double lHelixRadius = h.getArcLength2DAtCylindricalR(m_extRadius) > 0 ? h.getArcLength2DAtCylindricalR(m_extRadius) : 999999.;
1972 const double lFWD = (m_extZFWD - z0) / tanlambda > 0 ? (m_extZFWD - z0) / tanlambda : 999999.;
1975 const double lBWD = (m_extZBWD - z0) / tanlambda > 0 ? (m_extZBWD - z0) / tanlambda : 999999.;
1978 const double l = std::min(std::min(lHelixRadius, lFWD), lBWD);
1980 B2DEBUG(50, lHelixRadius <<
" " << lFWD <<
" " << lBWD <<
" -> " << l);
1982 ROOT::Math::XYZVector ext_helix = h.getPositionAtArcLength2D(l);
1983 double helixExtR_surface = m_extRadius / sin(ext_helix.Theta());
1984 if (l == lFWD) { helixExtR_surface = m_extZFWD / cos(ext_helix.Theta());}
1985 else if (l == lBWD) { helixExtR_surface = m_extZBWD / cos(ext_helix.Theta());}
1987 ROOT::Math::XYZVector helixExt_surface_position(0, 0, 0);
1988 VectorUtil::setMagThetaPhi(helixExt_surface_position, helixExtR_surface, ext_helix.Theta(), ext_helix.Phi());
1990 double distance = (eclCluster_surface_position - helixExt_surface_position).
R();
1991 if (distance < minDist) {minDist = distance;}
1993 if (minDist > 9999) minDist = -1;
2000 klmCluster->
setLayers(klm_cluster.layers());
2013 Belle::Mdst_ecl_trk_Manager& m = Belle::Mdst_ecl_trk_Manager::get_manager();
2014 Belle::Mdst_charged_Manager& chgMg = Belle::Mdst_charged_Manager::get_manager();
2019 std::vector<int> insert_order_types = {1, 2, 0};
2020 for (
auto& insert_type : insert_order_types) {
2021 for (Belle::Mdst_ecl_trk_Manager::iterator ecltrkIterator = m.begin(); ecltrkIterator != m.end(); ++ecltrkIterator) {
2022 Belle::Mdst_ecl_trk mECLTRK = *ecltrkIterator;
2024 if (mECLTRK.type() != insert_type)
2027 Belle::Mdst_ecl mdstEcl = mECLTRK.ecl();
2028 Belle::Mdst_trk mTRK = mECLTRK.trk();
2036 for (Belle::Mdst_charged_Manager::iterator chgIterator = chgMg.begin(); chgIterator != chgMg.end(); ++chgIterator) {
2037 Belle::Mdst_charged mChar = *chgIterator;
2038 Belle::Mdst_trk mTRK_in_charged = mChar.trk();
2040 if (mTRK_in_charged.get_ID() == mTRK.get_ID()) {
2042 tracksToECLClusters.
add(mChar.get_ID() - 1, mdstEcl.get_ID() - 1, 1.0);
2057 Belle::Mdst_klm_cluster_Manager& klm_cluster_manager = Belle::Mdst_klm_cluster_Manager::get_manager();
2060 for (Belle::Mdst_klm_cluster_Manager::iterator klmC_Ite = klm_cluster_manager.begin(); klmC_Ite != klm_cluster_manager.end();
2063 Belle::Mdst_klm_cluster mdstKlm_cluster = *klmC_Ite;
2064 Belle::Mdst_trk mTRK = mdstKlm_cluster.trk();
2065 Belle::Mdst_ecl mECL = mdstKlm_cluster.ecl();
2067 if (mTRK) klmClustersToTracks.
add(mdstKlm_cluster.get_ID() - 1, mTRK.get_ID() - 1);
2068 if (mECL) klmClustersToEclClusters.
add(mdstKlm_cluster.get_ID() - 1, mECL.get_ID() - 1);
2085 const int mask = 0x00f00000;
2086 int high_bits =
id & mask;
2087 if (high_bits == 0 || high_bits == mask)
return id;
2147 int bellePDGCode = belleMC.idhep();
2148 int belleIIPDGCode = mcP->
getPDG();
2150 if (bellePDGCode == 0)
2151 B2WARNING(
"[B2BIIConvertMdstModule] " << objectName <<
" matched to Gen_hepevt with idhep = 0.");
2153 if (bellePDGCode != belleIIPDGCode)
2154 B2WARNING(
"[B2BIIConvertMdstModule] " << objectName <<
" matched to different MCParticle! " << bellePDGCode <<
" vs. " <<
2157 const double belleMomentum[] = { belleMC.PX(), belleMC.PY(), belleMC.PZ() };
2160 for (
unsigned i = 0; i < 3; i++) {
2161 double relDev = (belle2Momentum[i] - belleMomentum[i]) / belleMomentum[i];
2163 if (relDev > 1e-3) {
2164 B2WARNING(
"[B2BIIConvertMdstModule] " << objectName <<
" matched to different MCParticle!");
2165 B2INFO(
" - Gen_hepevt [" << bellePDGCode <<
"] px/py/pz = " << belleMC.PX() <<
"/" << belleMC.PY() <<
"/" << belleMC.PZ());
2166 B2INFO(
" - TrackFitResult [" << belleIIPDGCode <<
"] px/py/pz = " << mcP->
get4Vector().Px() <<
"/" << mcP->
get4Vector().Py() <<
"/"
2174 CLHEP::HepLorentzVector& momentum,
HepPoint3D& position, CLHEP::HepSymMatrix& error)
2176 const HepPoint3D pivot(vee.vx(), vee.vy(), vee.vz());
2177 CLHEP::HepVector a(5);
2178 CLHEP::HepSymMatrix Ea(5, 0);
2180 a[0] = vee.daut().helix_p(0); a[1] = vee.daut().helix_p(1);
2181 a[2] = vee.daut().helix_p(2); a[3] = vee.daut().helix_p(3);
2182 a[4] = vee.daut().helix_p(4);
2183 Ea[0][0] = vee.daut().error_p(0); Ea[1][0] = vee.daut().error_p(1);
2184 Ea[1][1] = vee.daut().error_p(2); Ea[2][0] = vee.daut().error_p(3);
2185 Ea[2][1] = vee.daut().error_p(4); Ea[2][2] = vee.daut().error_p(5);
2186 Ea[3][0] = vee.daut().error_p(6); Ea[3][1] = vee.daut().error_p(7);
2187 Ea[3][2] = vee.daut().error_p(8); Ea[3][3] = vee.daut().error_p(9);
2188 Ea[4][0] = vee.daut().error_p(10); Ea[4][1] = vee.daut().error_p(11);
2189 Ea[4][2] = vee.daut().error_p(12); Ea[4][3] = vee.daut().error_p(13);
2190 Ea[4][4] = vee.daut().error_p(14);
2192 a[0] = vee.daut().helix_m(0); a[1] = vee.daut().helix_m(1);
2193 a[2] = vee.daut().helix_m(2); a[3] = vee.daut().helix_m(3);
2194 a[4] = vee.daut().helix_m(4);
2195 Ea[0][0] = vee.daut().error_m(0); Ea[1][0] = vee.daut().error_m(1);
2196 Ea[1][1] = vee.daut().error_m(2); Ea[2][0] = vee.daut().error_m(3);
2197 Ea[2][1] = vee.daut().error_m(4); Ea[2][2] = vee.daut().error_m(5);
2198 Ea[3][0] = vee.daut().error_m(6); Ea[3][1] = vee.daut().error_m(7);
2199 Ea[3][2] = vee.daut().error_m(8); Ea[3][3] = vee.daut().error_m(9);
2200 Ea[4][0] = vee.daut().error_m(10); Ea[4][1] = vee.daut().error_m(11);
2201 Ea[4][2] = vee.daut().error_m(12); Ea[4][3] = vee.daut().error_m(13);
2202 Ea[4][4] = vee.daut().error_m(14);
2205 Belle::Helix helix(pivot, a, Ea);
2208 momentum = helix.momentum(0., pType.
getMass(), position, error);
2212 std::vector<float>& helixError)
2214 const HepPoint3D pivot(vee.vx(), vee.vy(), vee.vz());
2215 CLHEP::HepVector a(5);
2216 CLHEP::HepSymMatrix Ea(5, 0);
2218 a[0] = vee.daut().helix_p(0); a[1] = vee.daut().helix_p(1);
2219 a[2] = vee.daut().helix_p(2); a[3] = vee.daut().helix_p(3);
2220 a[4] = vee.daut().helix_p(4);
2221 Ea[0][0] = vee.daut().error_p(0);
2222 Ea[1][0] = vee.daut().error_p(1);
2223 Ea[1][1] = vee.daut().error_p(2);
2224 Ea[2][0] = vee.daut().error_p(3);
2225 Ea[2][1] = vee.daut().error_p(4);
2226 Ea[2][2] = vee.daut().error_p(5);
2227 Ea[3][0] = vee.daut().error_p(6);
2228 Ea[3][1] = vee.daut().error_p(7);
2229 Ea[3][2] = vee.daut().error_p(8);
2230 Ea[3][3] = vee.daut().error_p(9);
2231 Ea[4][0] = vee.daut().error_p(10);
2232 Ea[4][1] = vee.daut().error_p(11);
2233 Ea[4][2] = vee.daut().error_p(12);
2234 Ea[4][3] = vee.daut().error_p(13);
2235 Ea[4][4] = vee.daut().error_p(14);
2237 a[0] = vee.daut().helix_m(0); a[1] = vee.daut().helix_m(1);
2238 a[2] = vee.daut().helix_m(2); a[3] = vee.daut().helix_m(3);
2239 a[4] = vee.daut().helix_m(4);
2240 Ea[0][0] = vee.daut().error_m(0);
2241 Ea[1][0] = vee.daut().error_m(1);
2242 Ea[1][1] = vee.daut().error_m(2);
2243 Ea[2][0] = vee.daut().error_m(3);
2244 Ea[2][1] = vee.daut().error_m(4);
2245 Ea[2][2] = vee.daut().error_m(5);
2246 Ea[3][0] = vee.daut().error_m(6);
2247 Ea[3][1] = vee.daut().error_m(7);
2248 Ea[3][2] = vee.daut().error_m(8);
2249 Ea[3][3] = vee.daut().error_m(9);
2250 Ea[4][0] = vee.daut().error_m(10);
2251 Ea[4][1] = vee.daut().error_m(11);
2252 Ea[4][2] = vee.daut().error_m(12);
2253 Ea[4][3] = vee.daut().error_m(13);
2254 Ea[4][4] = vee.daut().error_m(14);
2257 Belle::Helix helix(pivot, a, Ea);
2262 CLHEP::HepSymMatrix error5x5(5, 0);
2265 unsigned int size = 5;
2266 unsigned int counter = 0;
2267 for (
unsigned int i = 0; i < size; i++)
2268 for (
unsigned int j = i; j < size; j++)
2269 helixError[counter++] = error5x5[i][j];
2274 const CLHEP::HepSymMatrix& error,
2275 const short int charge,
2278 const uint64_t hitPatternCDCInitializer,
2279 const uint32_t hitPatternVXDInitializer,
2282 ROOT::Math::XYZVector pos(position.x(), position.y(), position.z());
2283 ROOT::Math::XYZVector mom(momentum.px(), momentum.py(), momentum.pz());
2285 TMatrixDSym errMatrix(6);
2286 for (
unsigned i = 0; i < 7; i++) {
2289 for (
unsigned j = 0; j < 7; j++) {
2300 return TrackFitResult(pos, mom, errMatrix, charge, pType, pValue,
BFIELD, hitPatternCDCInitializer, hitPatternVXDInitializer, ndf);
2305 if (!pid)
return 0.5;
2312 if (acc_sig + acc_bkg > 0.0)
2313 acc = acc_sig / (acc_sig + acc_bkg);
2320 double tof_all = tof_sig + tof_bkg;
2322 tof = tof_sig / tof_all;
2323 if (tof < 0.001) tof = 0.001;
2324 if (tof > 0.999) tof = 0.999;
2332 double cdc_all = cdc_sig + cdc_bkg;
2334 cdc = cdc_sig / cdc_all;
2335 if (cdc < 0.001) cdc = 0.001;
2336 if (cdc > 0.999) cdc = 0.999;
2340 double pid_sig = acc * tof * cdc;
2341 double pid_bkg = (1. - acc) * (1. - tof) * (1. - cdc);
2343 return pid_sig / (pid_sig + pid_bkg);
2349 B2DEBUG(99,
"B2BIIConvertMdst: endRun done.");
2355 B2DEBUG(99,
"B2BIIConvertMdst: terminate called");
void belleVeeDaughterHelix(const Belle::Mdst_vee2 &vee, const int charge, std::vector< float > &helixParam, std::vector< float > &helixError)
obtains the helix parameters of the vee daughters
double atcPID(const PIDLikelihood *pid, int sigHyp, int bkgHyp)
calculates atc_pid(3,1,5,sigHyp,bkgHyp).prob() from converted PIDLikelihood
void convertMdstGammaTable()
Reads all entries of Mdst_Gamma Panther table, creates a particle list 'gamma:mdst' and adds them to ...
B2BIIConvertMdstModule()
Constructor.
std::map< int, int > mdstKlmToKLMCluster
map of Mdst_klm Panther IDs and corresponding KLMCluster StoreArray indices
void copyNbarFromGamma()
Copies Particles in 'gamma:mdst' with energy > 0.5 GeV to be anti-n0:mdst.
void convertMdstChargedTable()
Reads and converts all entries of Mdst_charged (Mdst_trk and Mdst_trk_fit) Panther table to Track (Tr...
void setTracksToECLClustersRelations()
Sets Track -> ECLCluster relations.
OptionalDBObjPtr< CollisionBoostVector > m_collisionBoostVectorDB
CollisionBoostVector for boost vector.
StoreObjPtr< EventExtraInfo > m_evtInfo
Event Extra Info.
const int ERRMCONV[7]
CONVERSION OF TRACK ERROR MATRIX ELEMENTS.
CollisionAxisCMS m_collisionAxisCMS
CollisionAxisCMS of the beam.
StoreArray< KLMCluster > m_klmClusters
KLM clusters.
void belleVeeDaughterToCartesian(const Belle::Mdst_vee2 &vee, const int charge, const Const::ParticleType &pType, CLHEP::HepLorentzVector &momentum, HepPoint3D &position, CLHEP::HepSymMatrix &error)
Fills 4-momentum, position and 7x7 error matrix from Belle Vee daughter.
@ c_Direct
Direct matching.
@ c_GeneratorLevel
Match to generator-level particles.
virtual void initialize() override
Initialize the module.
void setLikelihoods(PIDLikelihood *pid, Const::EDetector det, double likelihoods[c_nHyp], bool discard_allzero=false)
Add given Belle likelihoods (not log-likelihoods, in Belle hypothesis order) for given detector to pi...
OptionalDBObjPtr< CollisionAxisCMS > m_collisionAxisCMSDB
CollisionAxisCMS.
StoreArray< V0 > m_v0s
V0-particles.
virtual void event() override
Called for each event.
void convertGenHepEvtTable()
Reads and converts all entries of Gen_hepevt Panther table to MCParticle dataobjects and adds them to...
double cdc_pid(const Belle::Mdst_charged &chg, int idp)
Returns CDC likelihood for given hypothesis idp.
void convertRecTrgTable()
Reads and converts m_final from rectrg_summary3.
void setKLMClustersRelations()
Sets KLMCluster -> Track and ECLCluster relations.
bool m_convertEvtcls
Flag to switch on conversion of Evtcls table.
const double KAPPA2OMEGA
Conversion factor for Kappa -> Omega helix parameters.
double computeTrkMinDistanceBelle(ECLCluster *eclCluster)
calculate the minimal distance between a cluster and a set of tracks on the ECL surface.
virtual void endRun() override
Called when the current run is finished.
bool m_nisEnable
Flag to switch on conversion of nisKsFinder info.
StoreArray< TrackFitResult > m_trackFitResults
Track fir results.
BeamSpot m_beamSpot
Interaction Point of the beam.
StoreArray< Particle > m_particles
Particles.
virtual void terminate() override
Terminates the module.
OptionalDBObjPtr< CollisionInvariantMass > m_collisionInvMDB
CollisionInvariantMass for Invariant Mass of Beam.
void convertHelix(Belle::Helix &helix, std::vector< float > &helixParams, CLHEP::HepSymMatrix &error5x5)
Converts Belle's Helix parameters and it's covariance matrix to Belle II's version.
void convertMdstPi0Table()
Reads all entries of Mdst_Pi0 Panther table, creates a particle list 'pi0:mdst' and adds them to Stor...
std::map< int, int > genHepevtToMCParticle
map of Gen_hepevt Panther IDs and corresponding MCParticle StoreArray indices
void testMCRelation(const Belle::Gen_hepevt &belleMC, const MCParticle *mcP, const std::string &objectName)
Checks if the reconstructed object (Track, ECLCluster, ...) was matched to the same MCParticle.
bool m_convertNbar
Flag to create anti-n0:mdst list from gamma:mdst.
void convertIPProfile(bool beginRun=false)
Stores the IPProfiles in BeamSpot (currently in DataStore)
void convertMdstECLObject(const Belle::Mdst_ecl &ecl, const Belle::Mdst_ecl_aux &eclAux, ECLCluster *eclCluster)
Converts Mdst_ecl(_aux) record to ECLCluster object.
CollisionInvariantMass m_collisionInvM
CollisionInvariantMass for the invariant mass of the beam.
bool m_convertBeamParameters
Convert beam parameters or use information stored in Belle II database.
static double acc_pid(const Belle::Mdst_charged &chg, int idp)
Returns ACC likelihood for given hypothesis idp.
virtual void beginRun() override
Module functions to be called from event process.
StoreArray< Track > m_tracks
Tracks.
void convertBeamEnergy()
Stores beam parameters (energy, angles) in CollisionInvariantMass and CollisionBoostVector (currently...
void convertPIDData(const Belle::Mdst_charged &belleTrack, const Track *track)
Get PID information for belleTrack and add it to PIDLikelihood (with relation from track).
void convertMdstKLMObject(const Belle::Mdst_klm_cluster &klm, KLMCluster *klmCluster)
Converts Mdst_klm_cluster record to KLMCluster object.
Belle2::MCParticleGraph m_particleGraph
MCParticle Graph to build Belle2 MC Particles.
void convertMdstKLongTable()
Reads all entries of Mdst_Klong Panther table, creates a particle list 'K_L0:mdst' and adds them to S...
OptionalDBObjPtr< BeamSpot > m_beamSpotDB
BeamSpot for IP.
bool m_realData
flag that tells whether given data sample is for real data or MC
StoreArray< ECLCluster > m_eclClusters
ECL clusters.
void convertGenHepevtObject(const Belle::Gen_hepevt &genHepevt, MCParticleGraph::GraphParticle *mcParticle)
Converts Gen_hepevt record to MCParticleGraph object.
void initializeDataStore()
Initializes Belle II DataStore.
void convertMdstECLTable()
Reads and converts all entries of Mdst_ecl(_aux) Panther table to ECLCluster dataobjects and adds the...
CollisionBoostVector m_collisionBoostVector
CollisionBoostVector for bosst vector of the beam.
std::string m_mcMatchingModeString
MC matching mode.
int m_lastIPProfileBin
variable to tell us which IPProfile bin was active last time we looked
void convertMdstKLMTable()
Reads and converts all entries of Mdst_klm_cluster Panther table to KLMCluster dataobjects and adds t...
bool m_convertRecTrg
Flag to switch on conversion of rectrg_summary3.
std::map< int, int > mdstGammaToParticle
map of gamma Panther IDs and corresponding Particle StoreArray indices
static const Const::ChargedStable c_belleHyp_to_chargedStable[c_nHyp]
maps Belle hypotheses to Const::ChargedStable (from http://belle.kek.jp/secured/wiki/doku....
std::map< int, int > mdstKlongToParticle
map of Klong Panther IDs and corresponding Particle StoreArray indices
double m_matchType2E9oE25Threshold
E9/E25 threshold value clusters with a value above this threshold are classified as neutral even if t...
void convertMdstChargedObject(const Belle::Mdst_charged &belleTrack, Track *track)
Converts Mdst_charged (Mdst_trk(_fit)) record to Track (TrackFitResult) object.
StoreArray< MCParticle > m_mcParticles
MC particles.
void convertMdstVee2Table()
Reads and converts all entries of Mdst_vee2 Panther table to V0 dataobjects and adds them to StoreArr...
StoreArray< PIDLikelihood > m_pidLikelihoods
output PIDLikelihood array.
std::map< int, int > mdstEclToECLCluster
map of Mdst_ecl Panther IDs and corresponding ECLCluster StoreArray indices
TrackFitResult createTrackFitResult(const CLHEP::HepLorentzVector &momentum, const HepPoint3D &position, const CLHEP::HepSymMatrix &error, const short int charge, const Const::ParticleType &pType, const float pValue, const uint64_t hitPatternCDCInitializer, const uint32_t hitPatternVXDInitializer, const uint16_t ndf)
Creates TrackFitResult and fills it.
virtual ~B2BIIConvertMdstModule() override
Destructor.
const double BFIELD
B filed in TESLA.
MCMatchingMode m_mcMatchingMode
C matching mode.
StoreArray< BelleTrkExtra > m_belleTrkExtra
Belle CDC extra information.
bool m_use6x6CovarianceMatrix4Tracks
flag that tells which form of covariance matrix should be used in the conversion of charged tracks
int recoverMoreThan24bitIDHEP(int id)
Helper function to recover falsely set idhep info in GenHepEvt list.
bool m_convertTrkExtra
Flag to switch on conversion of first(last)_{x,y,z} of mdst_trk_fit.
int getHelixParameters(const Belle::Mdst_trk_fit &trk_fit, const double mass, const HepPoint3D &newPivot, std::vector< float > &helixParams, CLHEP::HepSymMatrix &error5x5, CLHEP::HepLorentzVector &momentum, HepPoint3D &position, CLHEP::HepSymMatrix &error7x7, const double dPhi=0.0)
Fills Helix parameters (converted to Belle II version), 5x5 error matrix, 4-momentum,...
static const int c_nHyp
Number of Belle track hypotheses (see c_belleHyp_to_chargedStable).
void convertEvtclsTable()
Reads and converts all entries of evtcls Panther table.
This class contains the beam spot position and size modeled as a gaussian distribution in space.
void setIP(const TVector3 &ipPosition, const TMatrixDSym &covariance)
Set the IP position and its error matrix.
This class contains the measured values of the orientation of the collision axis in the CM system obt...
double getAngleYZ() const
Get the mean YZ angle of the HER beam in the CM frame obtained by pure boost.
void setSpread(const TMatrixDSym &spreadCovariance, double spreadXZunc, double spreadYZunc, double spreadPhiUnc)
Set spread covariance and uncertainties of the eigenvalues of this matrix.
double getAngleXZ() const
Get the mean XZ angle of the HER beam in the CM frame obtained by pure boost.
void setAngles(double angleXZ, double angleYZ, const TMatrixDSym ¢erCovariance)
Set the central values and uncertainty of them.
This class contains the measured average boost vector vec(beta) = (beta_x, beta_y,...
void setBoost(const TVector3 &boost, const TMatrixDSym &covariance)
Set the boost vector and its error matrix.
This class contains the measured average center-of-mass energy, which is equal to the invariant mass ...
void setMass(double mass, double error, double spread)
Set the CMS energy and its uncertainty.
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.
double getMass() const
Particle mass.
A class for sets of detector IDs whose content is limited to restricted set of valid detector IDs.
static const ChargedStable muon
muon particle
EDetector
Enum for identifying the detector components (detector and subdetector).
static const ChargedStable pion
charged pion particle
static const ParticleType Klong
K^0_L particle.
static const double speedOfLight
[cm/ns]
static const double electronMass
electron mass
static const ChargedStable proton
proton particle
static const ParticleType antiNeutron
Anti-neutron particle.
static const ChargedStable kaon
charged kaon particle
static const ParticleType photon
photon particle
static const ChargedStable electron
electron particle
static const ChargedStable deuteron
deuteron particle
void setE9oE21(double E9oE21)
Set E9/E21 energy ratio.
void addHypothesis(EHypothesisBit bitmask)
Add bitmask to current hypothesis.
void setTheta(double theta)
Set Theta of Shower (radian).
void setPhi(double phi)
Set Phi of Shower (radian).
double getPhi() const
Return Corrected Phi of Shower (radian).
void setdeltaL(double deltaL)
Set deltaL for shower shape.
void setEnergyHighestCrystal(double energyhighestcrystal)
Set energy of highest energetic crystal (GeV).
void setEnergyRaw(double energyraw)
Set Incorrect Energy deposited (GeV).
void setTime(double time)
Set time information.
void setCovarianceMatrix(double covArray[6])
Set covariance matrix (3x3), i.e.
void setMinTrkDistance(double distance)
Set distance between cluster COG and track extrapolation to ECL.
int getDetectorRegion() const
Return detector region: 0: below acceptance, 1: FWD, 2: BRL, 3: BWD, 11: FWDGAP, 13: BWDGAP.
void setLAT(double LAT)
Set Lateral distribution parameter.
double getEnergy(EHypothesisBit hypothesis) const
Return Energy (GeV).
void setNumberOfCrystals(double noc)
Set number of crystals (sum of weights).
void setEnergy(double energy)
Set Corrected Energy (GeV).
double getTheta() const
Return Corrected Theta of Shower (radian).
void setIsTrack(bool istrack)
Set m_isTrack true if the cluster matches with a track.
@ c_nPhotons
CR is split into n photons (N1)
@ c_neutralHadron
CR is reconstructed as a neutral hadron (N2)
void setR(double r)
Set R (in cm).
Hit pattern of CDC hits within a track.
void setNHits(unsigned short nHits)
Sets the 8 MSBs to the total number of hits in the CDC.
ULong64_t getInteger() const
Getter for underlying integer type.
Hit pattern of the VXD within a track.
unsigned int getInteger() const
Getter for the underlying integer.
void setSVDLayer(const unsigned short layerId, unsigned short uHits, unsigned short vHits)
Set the number of hits in a specific layer of the SVD.
A class that describes the interval of experiments/runs for which an object in the database is valid.
void setLayers(int layers)
Set number of layers with hits.
void setClusterPosition(float globalX, float globalY, float globalZ)
Set global position.
void setInnermostLayer(int innermostLayer)
Set number of the innermost layer with hits.
Class to represent Particle data in graph.
void decaysInto(GraphParticle &daughter)
Tells the graph that this particle decays into daughter.
size_t size() const
Return the number of particles in the graph.
void generateList(const std::string &name="", int options=c_setNothing)
Generates the MCParticle list and stores it in the StoreArray with the given name.
A Class to store the Monte Carlo particle information.
@ c_PrimaryParticle
bit 0: Particle is primary particle.
void setDecayTime(float time)
Set decay time.
void setMass(float mass)
Set particle mass.
void setDecayVertex(const ROOT::Math::XYZVector &vertex)
Set decay vertex.
void setValidVertex(bool valid)
Set indication whether vertex and time information is valid or just default.
void setProductionVertex(const ROOT::Math::XYZVector &vertex)
Set production vertex position.
ROOT::Math::PxPyPzEVector get4Vector() const
Return 4Vector of particle.
void setPDG(int pdg)
Set PDG code of the particle.
int getPDG() const
Return PDG code of particle.
void set4Vector(const ROOT::Math::PxPyPzEVector &p4)
Sets the 4Vector of particle.
void setStatus(unsigned short int status)
Set Status code for the particle.
void setProductionTime(float time)
Set production time.
void setDescription(const std::string &description)
Sets the description of the module.
Class to collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM aimed for output to mdst includes...
Class to store reconstructed particles.
void appendDaughter(const Particle *daughter, const bool updateType=true, const int daughterProperty=c_Ordinary)
Appends index of daughter to daughters index array.
void setVertex(const ROOT::Math::XYZVector &vertex)
Sets position (decay vertex)
void addExtraInfo(const std::string &name, double value)
Sets the user-defined data of given name to the given value.
void setPValue(double pValue)
Sets chi^2 probability of fit.
void updateMomentum(const ROOT::Math::PxPyPzEVector &p4, const ROOT::Math::XYZVector &vertex, const TMatrixFSym &errMatrix, double pValue)
Sets Lorentz vector, position, 7x7 error matrix and p-value.
static bool parallelProcessingUsed()
Returns true if multiple processes have been spawned, false in single-core mode.
Low-level class to create/modify relations between StoreArrays.
void add(index_type from, index_type to, weight_type weight=1.0)
Add a new element to the relation.
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
const std::string & getName() const
Return name under which the object is saved in the DataStore.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
bool create(bool replace=false)
Create a default object in the data store.
T * appendNew()
Construct a new T object at the end of the array.
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
Type-safe access to single objects in the data store.
Values of the result of a track fit with a given particle hypothesis.
Helix getHelix() const
Conversion to framework Helix (without covariance).
TMatrixDSym getCovariance5() const
Getter for covariance matrix of perigee parameters in matrix form.
short getChargeSign() const
Return track charge (1 or -1).
double getOmega() const
Getter for omega.
double getD0() const
Getter for d0.
double getTanLambda() const
Getter for tanLambda.
double getZ0() const
Getter for z0.
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.
double getPhi0() const
Getter for phi0.
Class that bundles various TrackFitResults.
This class represents an ideal helix in perigee parameterization including the covariance matrix of t...
const TMatrixDSym & getCovariance() const
Getter for covariance matrix of perigee parameters in matrix form.
static const double mm
[millimeters]
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
static Database & Instance()
Instance of a singleton Database.
static DBStore & Instance()
Instance of a singleton DBStore.
bool storeData(const std::string &name, TObject *object, const IntervalOfValidity &iov)
Store an object in the database.
void addConstantOverride(const std::string &name, TObject *obj, bool oneRun=false)
Add constant override payload.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
B2Vector3< double > B2Vector3D
typedef for common usage with double
double sqrt(double a)
sqrt for double
void clear()
Reset particles and decay information to make the class reusable.
GraphParticle & addParticle()
Add new particle to the graph.
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Abstract base class for different kinds of events.