12 #include <reconstruction/modules/MdstPID/MdstPIDModule.h>
15 #include <framework/gearbox/Const.h>
16 #include <framework/logging/Logger.h>
17 #include <klm/muid/MuidElementNumbers.h>
35 setDescription(
"Create MDST PID format (PIDLikelihood objects) from subdetector PID info.");
36 setPropertyFlags(c_ParallelProcessingCertified);
39 MdstPIDModule::~MdstPIDModule()
43 void MdstPIDModule::initialize()
48 m_tracks.isRequired();
49 m_pidLikelihoods.registerInDataStore();
50 m_tracks.registerRelationTo(m_pidLikelihoods);
53 m_topLikelihoods.isOptional();
54 m_arichLikelihoods.isOptional();
55 m_cdcDedxLikelihoods.isOptional();
56 m_vxdDedxLikelihoods.isOptional();
57 m_eclLikelihoods.isOptional();
62 void MdstPIDModule::beginRun()
66 void MdstPIDModule::endRun()
70 void MdstPIDModule::terminate()
74 void MdstPIDModule::event()
77 for (
int itra = 0; itra < m_tracks.getEntries(); ++itra) {
80 const Track* track = m_tracks[itra];
83 m_pid = m_pidLikelihoods.appendNew();
84 track->addRelationTo(m_pid);
88 if (top) setLikelihoods(top);
92 if (arich) setLikelihoods(arich);
96 if (cdcdedx) setLikelihoods(cdcdedx);
100 if (vxddedx) setLikelihoods(vxddedx);
104 if (ecl) setLikelihoods(ecl);
108 if (muid) setLikelihoods(muid);
117 if (logl->
getFlag() != 1)
return;
119 for (
const auto& chargedStable : Const::chargedStableSet) {
120 m_pid->setLogLikelihood(Const::TOP, chargedStable, logl->
getLogL(chargedStable));
128 if (logl->
getFlag() != 1)
return;
130 for (
const auto& chargedStable : Const::chargedStableSet) {
131 m_pid->setLogLikelihood(Const::ARICH, chargedStable, logl->
getLogL(chargedStable));
140 for (
const auto& chargedStable : Const::chargedStableSet) {
141 m_pid->setLogLikelihood(Const::CDC, chargedStable, logl->
getLogL(chargedStable));
150 for (
const auto& chargedStable : Const::chargedStableSet) {
151 m_pid->setLogLikelihood(Const::SVD, chargedStable, logl->
getLogL(chargedStable));
160 for (
const auto& chargedStable : Const::chargedStableSet) {
161 m_pid->setLogLikelihood(Const::ECL, chargedStable, logl->
getLogLikelihood(chargedStable));
169 if (abs(muid->getPDGCode()) != abs(Const::muon.getPDGCode())) {
170 B2WARNING(
"MdstPID, KLMMuidLikelihood: extrapolation with other than muon hypothesis ignored");
174 if (muid->getOutcome() == MuidElementNumbers::c_NotReached)
177 if (muid->getJunkPDFValue())
180 for (
const auto& chargedStable : Const::chargedStableSet) {
181 m_pid->setLogLikelihood(Const::KLM, chargedStable, muid->getLogL(chargedStable.getPDGCode()));