10#include <cdc/variables/DedxVariables.h>
11#include <analysis/VariableManager/Manager.h>
14#include <framework/gearbox/Const.h>
15#include <framework/logging/Logger.h>
16#include <framework/utilities/Conversion.h>
19#include <analysis/dataobjects/Particle.h>
20#include <mdst/dataobjects/Track.h>
21#include <cdc/dataobjects/CDCDedxTrack.h>
38 const Track* track = particle->getTrack();
53 double CDCdedx(
const Particle* part)
59 return dedxTrack->getDedx();
63 double CDCdedxnosat(
const Particle* part)
69 return dedxTrack->getDedxNoSat();
73 double pCDC(
const Particle* part)
79 return dedxTrack->getMomentum();
83 double costhCDC(
const Particle* part)
89 return dedxTrack->getCosTheta();
94 double CDCdEdx_nhits(
const Particle* part)
100 return dedxTrack->size();
104 double CDCdEdx_lnhits(
const Particle* part)
110 return dedxTrack->getNLayerHits();
114 double CDCdEdx_lnhitsused(
const Particle* part)
120 return dedxTrack->getNLayerHitsUsed();
126 if (arguments.size() < 2) {
127 B2ERROR(
"Min two arguments required to get variables related chi, predicted mean and reso");
134 }
catch (std::invalid_argument& e) {
135 B2ERROR(
"First argument of variable must be a variable name (chi or pmean or preso)");
141 pdgCode = Belle2::convertString<int>(arguments[1]);
142 }
catch (std::invalid_argument& e) {
143 B2ERROR(
"Second argument of variable must be a PDG code");
149 else if (abs(pdgCode) ==
Const::muon.getPDGCode())index = 1;
150 else if (abs(pdgCode) ==
Const::pion.getPDGCode())index = 2;
151 else if (abs(pdgCode) ==
Const::kaon.getPDGCode())index = 3;
152 else if (abs(pdgCode) ==
Const::proton.getPDGCode())index = 4;
155 auto func = [index, var](
const Particle * part) ->
double {
159 return std::numeric_limits<float>::quiet_NaN();
162 if (var ==
"chi")
return dedxTrack->getChi(index);
163 else if (var ==
"pmean")
return dedxTrack->getPmean(index);
164 else if (var ==
"preso")
return dedxTrack->getPreso(index);
165 else return std::numeric_limits<float>::quiet_NaN();
171 double CDCdEdx_chiE(
const Particle* part)
174 return std::get<double>(pidFunction(part));
177 double CDCdEdx_chiMu(
const Particle* part)
180 return std::get<double>(pidFunction(part));
183 double CDCdEdx_chiPi(
const Particle* part)
186 return std::get<double>(pidFunction(part));
189 double CDCdEdx_chiK(
const Particle* part)
192 return std::get<double>(pidFunction(part));
195 double CDCdEdx_chiP(
const Particle* part)
198 return std::get<double>(pidFunction(part));
201 double CDCdEdx_chiD(
const Particle* part)
204 return std::get<double>(pidFunction(part));
207 VARIABLE_GROUP(
"CDC dEdx");
209 REGISTER_VARIABLE(
"CDCdEdx", CDCdedx,
"CDC dE/dx truncated mean");
210 REGISTER_VARIABLE(
"CDCdEdxnosat", CDCdedxnosat,
211 "CDC dE/dx truncated mean without saturation correction (NA for current track level MC)");
212 REGISTER_VARIABLE(
"pCDC", pCDC,
"Momentum valid in the CDC");
213 REGISTER_VARIABLE(
"costhCDC", costhCDC,
"costheta valid in the CDC");
214 REGISTER_VARIABLE(
"CDCdEdx_nhits", CDCdEdx_nhits,
"total hits of dedx track");
215 REGISTER_VARIABLE(
"CDCdEdx_lnhits", CDCdEdx_lnhits,
"layer hits for dedx track");
216 REGISTER_VARIABLE(
"CDCdEdx_lnhitsused", CDCdEdx_lnhitsused,
"truncated hits of dedx track");
218 REGISTER_METAVARIABLE(
"CDCdEdx_PIDvars(var,PDG) var (= chi or pmean or preso) and PDG is of charged particles", CDCdEdx_PIDvars,
219 "advance CDC dEdx PID related variables for charged particle", Manager::VariableDataType::c_double);
221 REGISTER_VARIABLE(
"CDCdEdx_chiE", CDCdEdx_chiE,
"Chi value of electrons from CDC dEdx");
222 REGISTER_VARIABLE(
"CDCdEdx_chiMu", CDCdEdx_chiMu,
"Chi value of muons from CDC dEdx");
223 REGISTER_VARIABLE(
"CDCdEdx_chiPi", CDCdEdx_chiPi,
"Chi value of pions from CDC dEdx");
224 REGISTER_VARIABLE(
"CDCdEdx_chiK", CDCdEdx_chiK,
"Chi value of kaons from CDC dEdx");
225 REGISTER_VARIABLE(
"CDCdEdx_chiP", CDCdEdx_chiP,
"Chi value of protons from CDC dEdx");
226 REGISTER_VARIABLE(
"CDCdEdx_chiD", CDCdEdx_chiD,
"Chi value of duetrons from CDC dEdx");
Debug output for CDCDedxPID module.
static const ChargedStable muon
muon particle
static const ChargedStable pion
charged pion particle
static const ChargedStable proton
proton particle
static const ChargedStable kaon
charged kaon particle
static const ChargedStable electron
electron particle
static const ChargedStable deuteron
deuteron particle
Class to store reconstructed particles.
Class that bundles various TrackFitResults.
std::function< VarVariant(const Particle *)> FunctionPtr
functions stored take a const Particle* and return VarVariant.
CDCDedxTrack const * getDedxFromParticle(Particle const *particle)
CDC dEdx value from particle.
Abstract base class for different kinds of events.