10 #include <reconstruction/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 <reconstruction/dataobjects/CDCDedxTrack.h>
22 #include <reconstruction/dataobjects/VXDDedxTrack.h>
39 const Track* track = particle->getTrack();
57 const Track* track = particle->getTrack();
72 double CDCdedx(
const Particle* part)
78 return dedxTrack->getDedx();
82 double CDCdedxnosat(
const Particle* part)
88 return dedxTrack->getDedxNoSat();
92 double pCDC(
const Particle* part)
98 return dedxTrack->getMomentum();
102 double costhCDC(
const Particle* part)
108 return dedxTrack->getCosTheta();
113 double CDCdEdx_nhits(
const Particle* part)
119 return dedxTrack->size();
123 double CDCdEdx_lnhits(
const Particle* part)
129 return dedxTrack->getNLayerHits();
133 double CDCdEdx_lnhitsused(
const Particle* part)
139 return dedxTrack->getNLayerHitsUsed();
145 if (arguments.size() < 2) {
146 B2ERROR(
"Min two arguments required to get variables related chi, predicted mean and reso");
153 }
catch (std::invalid_argument& e) {
154 B2ERROR(
"First argument of variable must be a variable name (chi or pmean or preso)");
160 pdgCode = Belle2::convertString<int>(arguments[1]);
161 }
catch (std::invalid_argument& e) {
162 B2ERROR(
"Second argument of variable must be a PDG code");
168 else if (abs(pdgCode) ==
Const::muon.getPDGCode())index = 1;
169 else if (abs(pdgCode) ==
Const::pion.getPDGCode())index = 2;
170 else if (abs(pdgCode) ==
Const::kaon.getPDGCode())index = 3;
171 else if (abs(pdgCode) ==
Const::proton.getPDGCode())index = 4;
174 auto func = [index, var](
const Particle * part) ->
double {
178 return std::numeric_limits<float>::quiet_NaN();
180 if (var ==
"chi")
return dedxTrack->getChi(index);
181 else if (var ==
"pmean")
return dedxTrack->getPmean(index);
182 else if (var ==
"preso")
return dedxTrack->getPreso(index);
183 else return std::numeric_limits<float>::quiet_NaN();
189 double CDCdEdx_chiE(
const Particle* part)
194 double CDCdEdx_chiMu(
const Particle* part)
199 double CDCdEdx_chiPi(
const Particle* part)
204 double CDCdEdx_chiK(
const Particle* part)
209 double CDCdEdx_chiP(
const Particle* part)
214 double CDCdEdx_chiD(
const Particle* part)
220 double SVD_p(
const Particle* part)
226 return dedxTrack->getMomentum();
230 double SVD_pTrue(
const Particle* part)
236 return dedxTrack->getTrueMomentum();
240 double SVDdedx(
const Particle* part)
246 return dedxTrack->getDedx(Const::EDetector::SVD);
250 double SVD_CosTheta(
const Particle* part)
256 return dedxTrack->getCosTheta();
259 double SVD_nHits(
const Particle* part)
265 return dedxTrack->size();
269 VARIABLE_GROUP(
"Dedx");
271 REGISTER_VARIABLE(
"CDCdEdx", CDCdedx,
"CDC dE/dx truncated mean");
272 REGISTER_VARIABLE(
"CDCdEdxnosat", CDCdedxnosat,
273 "CDC dE/dx truncated mean without saturation correction (NA for current track level MC)");
274 REGISTER_VARIABLE(
"pCDC", pCDC,
"Momentum valid in the CDC");
275 REGISTER_VARIABLE(
"costhCDC", costhCDC,
"costheta valid in the CDC");
276 REGISTER_VARIABLE(
"CDCdEdx_nhits", CDCdEdx_nhits,
"total hits of dedx track");
277 REGISTER_VARIABLE(
"CDCdEdx_lnhits", CDCdEdx_lnhits,
"layer hits for dedx track");
278 REGISTER_VARIABLE(
"CDCdEdx_lnhitsused", CDCdEdx_lnhitsused,
"truncated hits of dedx track");
280 REGISTER_VARIABLE(
"CDCdEdx_PIDvars(var,PDG) var (= chi or pmean or preso) and PDG is of charged particles", CDCdEdx_PIDvars,
281 "advance CDC dEdx PID related variables for charged particle");
283 REGISTER_VARIABLE(
"CDCdEdx_chiE", CDCdEdx_chiE,
"Chi value of electrons from CDC dEdx");
284 REGISTER_VARIABLE(
"CDCdEdx_chiMu", CDCdEdx_chiMu,
"Chi value of muons from CDC dEdx");
285 REGISTER_VARIABLE(
"CDCdEdx_chiPi", CDCdEdx_chiPi,
"Chi value of pions from CDC dEdx");
286 REGISTER_VARIABLE(
"CDCdEdx_chiK", CDCdEdx_chiK,
"Chi value of kaons from CDC dEdx");
287 REGISTER_VARIABLE(
"CDCdEdx_chiP", CDCdEdx_chiP,
"Chi value of protons from CDC dEdx");
288 REGISTER_VARIABLE(
"CDCdEdx_chiD", CDCdEdx_chiD,
"Chi value of duetrons from CDC dEdx");
291 REGISTER_VARIABLE(
"SVDdEdx", SVDdedx,
"SVD dE/dx truncated mean");
292 REGISTER_VARIABLE(
"pSVD", SVD_p,
"momentum valid in the SVD");
293 REGISTER_VARIABLE(
"SVD_pTrue", SVD_pTrue,
"true MC momentum valid in the SVD");
294 REGISTER_VARIABLE(
"SVD_CosTheta", SVD_CosTheta,
"cos(theta) of the track valid in the SVD");
295 REGISTER_VARIABLE(
"SVD_nHits", SVD_nHits,
"number of hits of the track valid in the SVD");
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.
Debug output for VXDDedxPID module.
const Var * getVariable(std::string name)
Get the variable belonging to the given key.
static Manager & Instance()
get singleton instance.
std::function< double(const Particle *)> FunctionPtr
NOTE: the python interface is documented manually in analysis/doc/Variables.rst (because we use ROOT ...
VXDDedxTrack const * getSVDDedxFromParticle(Particle const *particle)
SVD dEdx value from particle.
CDCDedxTrack const * getDedxFromParticle(Particle const *particle)
CDC dEdx value from particle.
Abstract base class for different kinds of events.
FunctionPtr function
Pointer to function.