9#include <reconstruction/modules/CDCDedxPID/CDCDedxPIDModule.h>
11#include <reconstruction/dataobjects/DedxConstants.h>
12#include <reconstruction/modules/CDCDedxPID/LineHelper.h>
14#include <framework/gearbox/Const.h>
16#include <cdc/dataobjects/CDCHit.h>
17#include <cdc/dataobjects/CDCRecoHit.h>
19#include <cdc/translators/LinearGlobalADCCountTranslator.h>
20#include <cdc/translators/RealisticTDCCountTranslator.h>
22#include <cdc/geometry/CDCGeometryPar.h>
23#include <tracking/dataobjects/RecoHitInformation.h>
25#include <genfit/AbsTrackRep.h>
26#include <genfit/Exception.h>
27#include <genfit/MaterialEffects.h>
28#include <genfit/KalmanFitterInfo.h>
48 setDescription(
"Extract dE/dx and corresponding log-likelihood from fitted tracks and hits in the CDC.");
52 "Use parameterized means and resolutions to determine PID values. If false, lookup table PDFs are used.",
true);
54 "Portion of events with low dE/dx that should be discarded",
double(0.05));
56 "Portion of events with high dE/dx that should be discarded",
double(0.25));
58 "Whether to use the back half of curlers",
false);
60 "Option to write out debugging information to CDCDedxTracks (DataStore objects).",
true);
62 "If using lookup table PDFs, include PDF value for each hit in likelihood. If false, the truncated mean of dedx values will be used.",
65 "Ignore particles for which no PDFs are found",
false);
67 "ONLY USEFUL FOR MC: Use track-level MC. If false, use hit-level MC",
true);
69 "ONLY USEFUL FOR MC: Only save data for primary particles",
false);
76 if (!
m_DBDedxPDFs) B2FATAL(
"No Dedx pdfs found in database");
79 double xMin, xMax, yMin, yMax;
81 xMin = xMax = yMin = yMax = 0.0;
82 for (
unsigned int iPart = 0; iPart < 6; iPart++) {
86 if (pdf->GetEntries() == 0) {
89 B2FATAL(
"Couldn't find PDF for PDG " << pdgCode);
93 const double epsFactor = 1e-5;
94 if (nBinsX == -1 and nBinsY == -1) {
95 nBinsX = pdf->GetNbinsX();
96 nBinsY = pdf->GetNbinsY();
97 xMin = pdf->GetXaxis()->GetXmin();
98 xMax = pdf->GetXaxis()->GetXmax();
99 yMin = pdf->GetYaxis()->GetXmin();
100 yMax = pdf->GetYaxis()->GetXmax();
101 }
else if (nBinsX != pdf->GetNbinsX()
102 or nBinsY != pdf->GetNbinsY()
103 or fabs(xMin - pdf->GetXaxis()->GetXmin()) > epsFactor * xMax
104 or fabs(xMax - pdf->GetXaxis()->GetXmax()) > epsFactor * xMax
105 or fabs(yMin - pdf->GetYaxis()->GetXmin()) > epsFactor * yMax
106 or fabs(yMax - pdf->GetYaxis()->GetXmax()) > epsFactor * yMax) {
107 B2FATAL(
"PDF for PDG " << pdgCode <<
" has binning/dimensions differing from previous PDF.");
138 for (
int i = 1; i < 9; ++i) {
144 B2WARNING(
"No dE/dx mean parameters!");
145 for (
int i = 0; i < 15; ++i)
150 B2WARNING(
"No dE/dx sigma parameters!");
151 for (
int i = 0; i < 12; ++i)
157 B2WARNING(
"No hadron correction parameters!");
158 for (
int i = 0; i < 4; ++i)
166 if (!genfit::MaterialEffects::getInstance()->isInitialized()) {
167 B2FATAL(
"Need to have SetupGenfitExtrapolationModule in path before this one.");
195 for (
const auto& track :
m_tracks) {
196 std::shared_ptr<CDCDedxTrack> dedxTrack = std::make_shared<CDCDedxTrack>();
197 dedxTrack->m_track = mtrack++;
203 B2WARNING(
"No related fit for track ...");
218 dedxTrack->m_mcmass = mcpart->
getMass();
220 dedxTrack->m_motherPDG = mother ? mother->
getPDG() : 0;
222 const ROOT::Math::XYZVector trueMomentum = mcpart->
getMomentum();
223 dedxTrack->m_pTrue = trueMomentum.R();
224 dedxTrack->m_cosThetaTrue = cos(trueMomentum.Theta());
227 dedxTrack->m_pdg = -999;
231 const ROOT::Math::XYZVector& trackMom = fitResult->
getMomentum();
232 dedxTrack->m_p = trackMom.R();
233 bool nomom = (dedxTrack->m_p != dedxTrack->m_p);
234 double costh = std::cos(std::atan(1 / fitResult->
getCotTheta()));
237 costh = cos(trackMom.Theta());
240 dedxTrack->m_cosTheta = costh;
241 dedxTrack->m_charge = charge;
243 double injring = -1.0, injtime = -1.0;
245 if (m_TTDInfo.
isValid() && m_TTDInfo->hasInjection()) {
246 injring = m_TTDInfo->isHER();
247 injtime = m_TTDInfo->getTimeSinceLastInjectionInMicroSeconds();
249 dedxTrack->m_injring = injring;
250 dedxTrack->m_injtime = injtime;
255 B2WARNING(
"No related track for this fit...");
261 B2ERROR(
"GFTrack is pruned, please run CDCDedxPID only on unpruned tracks! Skipping this track.");
278 if ((abs(costh + 0.860) < 0.010) || (abs(costh - 0.955) <= 0.005))isEdge =
true;
281 bool isvalidTime =
true;
282 if (injtime < 0 || injring < 0)isvalidTime =
false;
287 double layerdE = 0.0;
288 double layerdx = 0.0;
290 int nhitscombined = 0;
291 int wirelongesthit = 0;
292 double longesthit = 0;
297 const std::vector< genfit::AbsTrackRep* >& gftrackRepresentations = recoTrack->
getRepresentations();
299 for (std::vector< genfit::TrackPoint* >::const_iterator tp = gftrackPoints.begin();
300 tp != gftrackPoints.end(); ++tp) {
303 genfit::AbsMeasurement* aAbsMeasurementPtr = (*tp)->getRawMeasurement(0);
305 if (!cdcRecoHit)
continue;
307 if (!cdcHit)
continue;
311 const genfit::AbsFitterInfo* fi = (*tp)->getFitterInfo();
313 B2DEBUG(29,
"No fitter info, skipping...");
324 int foundByTrackFinder = 0;
329 double weightPionHypo = 0;
330 double weightProtHypo = 0;
331 double weightKaonHypo = 0;
333 for (std::vector<genfit::AbsTrackRep* >::const_iterator trep = gftrackRepresentations.begin();
334 trep != gftrackRepresentations.end(); ++trep) {
335 const int pdgCode = TMath::Abs((*trep)->getPDG());
340 const genfit::KalmanFitterInfo* kalmanFitterInfo = (*tp)->getKalmanFitterInfo(*trep);
341 if (kalmanFitterInfo == NULL) {
347 std::vector<double> weights = kalmanFitterInfo->getWeights();
348 const double maxWeight = weights[0] > weights[1] ? weights[0] : weights[1];
349 if (pdgCode ==
Const::pion.getPDGCode()) weightPionHypo = maxWeight;
350 else if (pdgCode ==
Const::kaon.getPDGCode()) weightKaonHypo = maxWeight;
351 else if (pdgCode ==
Const::proton.getPDGCode()) weightProtHypo = maxWeight;
356 int currentLayer = (superlayer == 0) ? layer : (8 + (superlayer - 1) * 6 + layer);
357 int nextLayer = currentLayer;
360 const int iwire = (superlayer == 0) ? 160 * layer + wire :
m_nLayerWires[superlayer - 1] + (160 + 32 *
361 (superlayer - 1)) * layer + wire;
364 const bool lastHit = (tp + 1 == gftrackPoints.end());
365 bool lastHitInCurrentLayer = lastHit;
368 genfit::AbsMeasurement* aAbsMeasurementPtrNext = (*(tp + 1))->getRawMeasurement(0);
371 if (!nextcdcRecoHit || !(cdcRecoHit->
getCDCHit()) || !((*(tp + 1))->getFitterInfo())) {
375 const int nextILayer = nextcdcHit->
getILayer();
377 nextLayer = (nextSuperlayer == 0) ? nextILayer : (8 + (nextSuperlayer - 1) * 6 + nextILayer);
378 lastHitInCurrentLayer = (nextLayer != currentLayer);
382 const ROOT::Math::XYZVector& wirePosF = cdcgeo.
wireForwardPosition(wireID, CDCGeometryPar::c_Aligned);
390 double topHeight = outer - wirePosF.Rho();
391 double bottomHeight = wirePosF.Rho() - inner;
392 double cellHeight = topHeight + bottomHeight;
393 double topHalfWidth = M_PI * outer / nWires;
394 double bottomHalfWidth = M_PI * inner / nWires;
395 double cellHalfWidth = M_PI * wirePosF.Rho() / nWires;
406 const genfit::MeasuredStateOnPlane& mop = fi->getFittedState();
410 const TVector3& pocaMom = mop.getMom();
411 if (tp == gftrackPoints.begin() || cdcMom == 0) {
412 cdcMom = pocaMom.
Mag();
413 dedxTrack->m_pCDC = cdcMom;
416 dedxTrack->m_p = cdcMom;
425 B2Vector3D pocaOnWire = mop.getPlane()->getO();
428 B2Vector3D B2WireDoca = fittedPoca - pocaOnWire;
431 double doca = B2WireDoca.
Perp();
432 double phidiff = fittedPoca.
Phi() - pocaOnWire.
Phi();
435 if (phidiff > -3.1416 && (phidiff < 0 || phidiff > 3.1416)) doca *= -1;
438 const double px = pocaMom.X();
439 const double py = pocaMom.Y();
440 const double wx = pocaOnWire.
X();
441 const double wy = pocaOnWire.
Y();
442 const double cross = wx * py - wy * px;
443 const double dot = wx * px + wy * py;
444 double entAng = atan2(cross,
dot);
447 double cellR = 2 * cellHalfWidth / cellHeight;
449 if (std::abs(2 *
atan(1) - std::abs(entAng)) < 0.01)tana = 100 * (entAng / std::abs(entAng));
450 else tana = std::tan(entAng);
451 double docaRS = doca * std::sqrt((1 + cellR * cellR * tana * tana) / (1 + tana * tana));
452 double entAngRS = std::atan(tana / cellR);
457 && numMCParticles == 0) ?
m_DBNonlADC->getCorrectedADC(adcbaseCount, currentLayer) : adcbaseCount;
459 double hitCharge = translator.
getCharge(adcCount, wireID,
false, pocaOnWire.
Z(), pocaMom.Phi());
463 double dadcCount = 1.0 * adcCount;
464 if (dedxTrack->m_scale != 0) dadcCount /= dedxTrack->m_scale;
467 double driftDRealistic = realistictdc.
getDriftLength(driftT, wireID, 0,
true, pocaOnWire.
Z(), pocaMom.Phi(), pocaMom.Theta());
468 double driftDRealisticRes = realistictdc.
getDriftLengthResolution(driftDRealistic, wireID,
true, pocaOnWire.
Z(), pocaMom.Phi(),
472 double celldx = c.dx(doca, entAng);
478 double normDocaRS = docaRS / cellHalfWidth;
480 && numMCParticles == 0) ?
m_DB2DCell->getMean(currentLayer, normDocaRS, entAngRS) : 1.0;
488 double correction = dedxTrack->m_runGain * dedxTrack->m_cosCor * dedxTrack->m_cosEdgeCor * dedxTrack->m_timeGain * wiregain *
494 if (correction != 0) dadcCount = dadcCount / correction;
497 double cellDedx = (dadcCount / celldx);
500 if (nomom) cellDedx *= std::sin(std::atan(1 / fitResult->
getCotTheta()));
501 else cellDedx *= std::sin(trackMom.Theta());
504 dedxTrack->addHit(wire, iwire, currentLayer, doca, docaRS, entAng, entAngRS,
505 adcCount, adcbaseCount, hitCharge, celldx, cellDedx, cellHeight, cellHalfWidth, driftT,
506 driftDRealistic, driftDRealisticRes, wiregain, twodcor, onedcor,
507 foundByTrackFinder, weightPionHypo, weightKaonHypo, weightProtHypo);
512 if (correction != 0) {
514 layerdE += dadcCount;
517 if (celldx > longesthit) {
519 wirelongesthit = iwire;
524 }
catch (genfit::Exception&) {
525 B2WARNING(
"Track: " << mtrack <<
": genfit::MeasuredStateOnPlane exception...");
530 if (lastHitInCurrentLayer) {
532 double totalDistance;
533 if (nomom) totalDistance = layerdx / std::sin(std::atan(1 / fitResult->
getCotTheta()));
534 else totalDistance = layerdx / std::sin(trackMom.Theta());
535 double layerDedx = layerdE / totalDistance;
539 dedxTrack->addDedx(nhitscombined, wirelongesthit, currentLayer, totalDistance, layerDedx);
543 saveLookupLogl(dedxTrack->m_cdcLogl, dedxTrack->m_pCDC, layerDedx);
560 if (dedxTrack->m_lDedx.empty()) {
561 B2DEBUG(29,
"Found track with no hits, ignoring.");
565 const int numDedx = dedxTrack->m_lDedx.size();
569 dedxTrack->m_lNHitsUsed = highEdgeTrunc - lowEdgeTrunc;
579 &(dedxTrack->m_dedxAvgTruncatedNoSat),
580 &(dedxTrack->m_dedxAvgTruncatedErr),
584 if (numMCParticles == 0)
585 dedxTrack->m_dedxAvgTruncated =
D2I(costh,
I2D(costh, 1.00) / 1.00 * dedxTrack->m_dedxAvgTruncatedNoSat);
586 else dedxTrack->m_dedxAvgTruncated = dedxTrack->m_dedxAvgTruncatedNoSat;
590 if (numMCParticles != 0 && dedxTrack->m_mcmass > 0 && dedxTrack->m_pTrue != 0) {
592 double mean =
getMean(dedxTrack->m_pCDC / dedxTrack->m_mcmass);
593 double sigma =
getSigma(mean, dedxTrack->m_lNHitsUsed,
594 dedxTrack->m_cosTheta, dedxTrack->m_timeReso);
595 dedxTrack->m_simDedx = gRandom->Gaus(mean, sigma);
596 while (dedxTrack->m_simDedx < 0)
597 dedxTrack->m_simDedx = gRandom->Gaus(mean, sigma);
599 dedxTrack->m_dedxAvgTruncated = dedxTrack->m_simDedx;
603 saveChiValue(dedxTrack->m_cdcChi, dedxTrack->m_predmean, dedxTrack->m_predres, dedxTrack->m_pCDC, dedxTrack->m_dedxAvgTruncated,
604 dedxTrack->m_cosTheta, dedxTrack->m_lNHitsUsed, dedxTrack->m_timeReso);
606 saveLookupLogl(dedxTrack->m_cdcLogl, dedxTrack->m_pCDC, dedxTrack->m_dedxAvgTruncated);
614 pidvalues[pdgIter.getIndex()] = -0.5 * dedxTrack->m_cdcChi[pdgIter.getIndex()] * dedxTrack->m_cdcChi[pdgIter.getIndex()];
618 pidvalues[pdgIter.getIndex()] = dedxTrack->m_cdcLogl[pdgIter.getIndex()];
623 track.addRelationTo(likelihoodObj);
628 track.addRelationTo(newCDCDedxTrack);
637 B2DEBUG(29,
"CDCDedxPIDModule exiting");
641 const std::vector<double>& dedx)
const
645 std::vector<double> sortedDedx = dedx;
646 std::sort(sortedDedx.begin(), sortedDedx.end());
647 sortedDedx.erase(std::remove(sortedDedx.begin(), sortedDedx.end(), 0), sortedDedx.end());
648 sortedDedx.shrink_to_fit();
650 double truncatedMeanTmp = 0.0;
651 double meanTmp = 0.0;
652 double sumOfSquares = 0.0;
653 int numValuesTrunc = 0;
654 const int numDedx = sortedDedx.size();
659 for (
int i = 0; i < numDedx; i++) {
660 meanTmp += sortedDedx[i];
661 if (i >= lowEdgeTrunc and i < highEdgeTrunc) {
662 truncatedMeanTmp += sortedDedx[i];
663 sumOfSquares += sortedDedx[i] * sortedDedx[i];
671 if (numValuesTrunc != 0) {
672 truncatedMeanTmp /= numValuesTrunc;
674 truncatedMeanTmp = meanTmp;
678 *truncatedMean = truncatedMeanTmp;
680 if (numValuesTrunc > 1) {
681 *truncatedMeanErr =
sqrt(sumOfSquares /
double(numValuesTrunc) - truncatedMeanTmp * truncatedMeanTmp) / double(
684 *truncatedMeanErr = 0;
692 const Int_t binX = pdf->GetXaxis()->FindFixBin(p);
693 const Int_t binY = pdf->GetYaxis()->FindFixBin(dedx);
697 if (pdf->GetEntries() == 0) {
698 B2WARNING(
"NO CDC PDFS...");
701 double probability = 0.0;
704 if (binX < 1 or binX > pdf->GetNbinsX()
705 or binY < 1 or binY > pdf->GetNbinsY()) {
706 probability = pdf->GetBinContent(binX, binY);
711 probability =
const_cast<TH2F*
>(pdf)->Interpolate(p, dedx);
714 if (probability != probability)
715 B2ERROR(
"probability NAN for a track with p=" << p <<
" and dedx=" << dedx);
718 if (probability == 0.0)
720 logl[iPart] += log(probability);
726 double absCosTheta = fabs(cosTheta);
728 if (projection == 0) {
729 B2WARNING(
"Something wrong with dE/dx hadron constants!");
733 double chargeDensity = D / projection;
735 double denominator = 1 +
m_hadronpars[1] * chargeDensity;
737 if (denominator == 0) {
738 B2WARNING(
"Something wrong with dE/dx hadron constants!");
742 double I = D *
m_hadronpars[4] * numerator / denominator;
748 double absCosTheta = fabs(cosTheta);
752 B2WARNING(
"Something wrong with dE/dx hadron constants!");
760 if (b == 0 && a == 0) {
761 B2WARNING(
"both a and b coefficiants for hadron correction are 0");
765 double discr = b * b - 4.0 * a * c;
767 B2WARNING(
"negative discriminant; return uncorrectecd value");
771 double D = (a != 0) ? (-b +
sqrt(discr)) / (2.0 * a) : -c / b;
773 B2WARNING(
"D is less 0! will try another solution");
774 D = (a != 0) ? (-b -
sqrt(discr)) / (2.0 * a) : -c / b;
776 B2WARNING(
"D is still less 0! just return uncorrectecd value");
792 f = par[1] * std::pow(std::sqrt(x[0] * x[0] + 1), par[3]) / std::pow(x[0], par[3]) *
793 (par[2] - par[5] * std::log(1 / x[0])) - par[4] + std::exp(par[6] + par[7] * x[0]);
794 else if (par[0] == 2)
795 f = par[1] * std::pow(x[0], 3) + par[2] * x[0] * x[0] + par[3] * x[0] + par[4];
796 else if (par[0] == 3)
797 f = -1.0 * par[1] * std::log(par[4] + std::pow(1 / x[0], par[2])) + par[3];
806 double A = 0, B = 0, C = 0;
814 double x[1]; x[0] = bg;
819 parsA[0] = 1; parsB[0] = 2; parsC[0] = 3;
820 for (
int i = 0; i < 15; ++i) {
822 else if (i < 11) parsB[i % 7 + 1] =
m_meanpars[i];
831 return (A * partA + B * partB + C * partC);
842 f = par[1] + par[2] * x[0];
843 }
else if (par[0] == 2) {
844 f = par[1] * std::pow(x[0], 4) + par[2] * std::pow(x[0], 3) +
845 par[3] * x[0] * x[0] + par[4] * x[0] + par[5];
846 }
else if (par[0] == 3) {
847 f = par[1] * exp(-0.5 * pow(((x[0] - par[2]) / par[3]), 2)) +
848 par[4] * pow(x[0], 6) + par[5] * pow(x[0], 5) + par[6] * pow(x[0], 4) +
849 par[7] * pow(x[0], 3) + par[8] * x[0] * x[0] + par[9] * x[0] + par[10];
865 dedxpar[0] = 1; nhitpar[0] = 2; cospar[0] = 3;
866 for (
int i = 0; i < 10; ++i) {
878 int nhit_min = 8, nhit_max = 37;
880 if (nhit < nhit_min) {
883 }
else if (nhit > nhit_max) {
891 return (corDedx * corCos * corNHit * timereso);
896 double cos,
int nhit,
double timereso)
const
901 double bg = p / pdgIter.getMass();
905 double sigma =
getSigma(mean, nhit, cos, timereso);
907 predmean[pdgIter.getIndex()] = mean;
908 predsigma[pdgIter.getIndex()] = sigma;
911 if (sigma != 0) chi[pdgIter.getIndex()] = ((dedx - mean) / (sigma));
DataType Phi() const
The azimuth angle.
DataType Z() const
access variable Z (= .at(2) without boundary check)
DataType X() const
access variable X (= .at(0) without boundary check)
DataType Y() const
access variable Y (= .at(1) without boundary check)
DataType Mag() const
The magnitude (rho in spherical coordinate system).
DataType Perp() const
The transverse component (R in cylindrical coordinate system).
Container for likelihoods obtained by the CDC dE/dx PID (CDCDedxPIDModule).
double I2D(double cosTheta, double I) const
hadron saturation parameterization part 1
double D2I(double cosTheta, double D) const
hadron saturation parameterization part 2
double getMean(double bg) const
calculate the predicted mean using the parameterized resolution
virtual ~CDCDedxPIDModule()
Destructor.
std::vector< double > m_hadronpars
hadron saturation parameters
DBObjPtr< CDCDedxRunGain > m_DBRunGain
Run gain DB object.
double sigmaCurve(double *x, const double *par, int version) const
parameterized resolution for predictions
DBObjPtr< CDCDedxMeanPars > m_DBMeanPars
dE/dx mean parameters
virtual void initialize() override
Initialize the module.
DBObjPtr< CDCDedxHadronCor > m_DBHadronCor
hadron saturation parameters
virtual void event() override
This method is called for each event.
double m_removeHighest
Portion of highest dE/dx values that should be discarded for truncated mean.
StoreArray< CDCDedxLikelihood > m_dedxLikelihoods
Output array of CDCDedxLikelihoods.
DBObjPtr< CDCDedxCosineEdge > m_DBCosEdgeCor
non-linearly ACD correction DB object
StoreArray< MCParticle > m_mcparticles
Optional array of input MCParticles.
void saveLookupLogl(double(&logl)[Const::ChargedStable::c_SetSize], double p, double dedx)
for all particles, save log-likelihood values into 'logl'.
DBObjPtr< CDCDedxADCNonLinearity > m_DBNonlADC
non-linearly ACD correction DB object
DBObjPtr< CDCDedx1DCell > m_DB1DCell
1D correction DB object
void checkPDFs()
Check the pdfs for consistency every time they change in the database.
virtual void terminate() override
End of the event processing.
void saveChiValue(double(&chi)[Const::ChargedStable::c_SetSize], double(&predmean)[Const::ChargedStable::c_SetSize], double(&predres)[Const::ChargedStable::c_SetSize], double p, double dedx, double cos, int nhit, double timereso) const
for all particles, save chi values into 'chi'.
double meanCurve(double *x, double *par, int version) const
parameterized beta-gamma curve for predicted means
std::vector< double > m_sigmapars
dE/dx resolution parameters
void calculateMeans(double *mean, double *truncatedMean, double *truncatedMeanErr, const std::vector< double > &dedx) const
Save arithmetic and truncated mean for the 'dedx' values.
DBObjPtr< CDCDedx2DCell > m_DB2DCell
2D correction DB object
double getSigma(double dedx, double nhit, double cos, double timereso) const
calculate the predicted resolution using the parameterized resolution
DBObjPtr< CDCDedxCosineCor > m_DBCosineCor
Electron saturation correction DB object.
bool m_ignoreMissingParticles
Ignore particles for which no PDFs are found.
StoreArray< Track > m_tracks
Required array of input Tracks.
int m_nLayerWires[9]
number of wires per layer: needed for wire gain calibration
CDCDedxPIDModule()
Default constructor.
bool m_onlyPrimaryParticles
Only save data for primary particles (as determined by MC truth)
DBObjPtr< CDCdEdxPDFs > m_DBDedxPDFs
DB object for dedx:momentum PDFs.
DBObjPtr< CDCDedxSigmaPars > m_DBSigmaPars
dE/dx resolution parameters
DBObjPtr< CDCDedxWireGain > m_DBWireGains
Wire gain DB object.
std::vector< double > m_meanpars
dE/dx mean parameters
bool m_backHalfCurlers
Whether to use the back half of curlers.
bool m_trackLevel
Whether to use track-level or hit-level MC.
StoreArray< RecoTrack > m_recoTracks
Required array of input RecoTracks.
bool m_useIndividualHits
Include PDF value for each hit in likelihood.
bool m_usePrediction
Whether to use parameterized means and resolutions or lookup tables.
double m_removeLowest
Portion of lowest dE/dx values that should be discarded for truncated mean.
StoreArray< CDCDedxTrack > m_dedxTracks
Output array of CDCDedxTracks.
bool m_enableDebugOutput
Whether to save information on tracks and associated hits and dE/dx values in DedxTrack objects.
DBObjPtr< CDCDedxInjectionTime > m_DBInjectTime
time gain/reso DB object
DBObjPtr< CDCDedxScaleFactor > m_DBScaleFactor
Scale factor to make electrons ~1.
Debug output for CDCDedxPID module.
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
short getTDCCount() const
Getter for TDC count.
unsigned short getADCCount() const
Getter for integrated charge.
unsigned short getISuperLayer() const
Getter for iSuperLayer.
unsigned short getILayer() const
Getter for iLayer.
This class is used to transfer CDC information to the track fit.
WireID getWireID() const
Getter for WireID object.
const CDCHit * getCDCHit() const
get the pointer to the CDCHit object that was used to create this CDCRecoHit object.
The Class for CDC Geometry Parameters.
const B2Vector3D wireForwardPosition(uint layerId, int cellId, EWirePosition set=c_Base) const
Returns the forward position of the input sense wire.
unsigned nWiresInLayer(int layerId) const
Returns wire numbers in a layer.
const double * innerRadiusWireLayer() const
Returns an array of inner radius of wire layers.
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
const double * outerRadiusWireLayer() const
Returns an array of outer radius of wire layers.
This class simply assumes a linear translation through (0,0)
float getCharge(unsigned short adcCount, const WireID &, bool, float, float)
just multiply with the conversion factor and return.
Translator mirroring the realistic Digitization.
double getDriftLength(unsigned short tdcCount, const WireID &wireID=WireID(), double timeOfFlightEstimator=0, bool leftRight=false, double z=0, double alpha=0, double theta=static_cast< double >(TMath::Pi()/2.), unsigned short adcCount=0) override
Get Drift length.
double getDriftLengthResolution(double driftLength, const WireID &wireID=WireID(), bool leftRight=false, double z=0, double alpha=0, double=static_cast< double >(TMath::Pi()/2.)) override
Get position resolution^2 corresponding to the drift length from getDriftLength of this class.
Provides a type-safe way to pass members of the chargedStableSet set.
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
A set of ParticleType objects, with defined order.
const ParticleType & at(unsigned int index) const
Return particle at given index, or end() if out of range.
int getPDGCode() const
PDG code.
static const ParticleSet chargedStableSet
set of charged stable particles
static const ChargedStable pion
charged pion particle
static const ChargedStable proton
proton particle
static const ChargedStable kaon
charged kaon particle
A class to hold the geometry of a cell.
A collection of classes that are useful for making a simple path length correction to the dE/dx measu...
A Class to store the Monte Carlo particle information.
@ c_PrimaryParticle
bit 0: Particle is primary particle.
float getMass() const
Return the particle mass in GeV.
bool hasStatus(unsigned short int bitmask) const
Return if specific status bit is set.
int m_pdg
PDG-Code of the particle.
int getPDG() const
Return PDG code of particle.
ROOT::Math::XYZVector getMomentum() const
Return momentum.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
This is the Reconstruction Event-Data Model Track.
const std::vector< genfit::AbsTrackRep * > & getRepresentations() const
Return a list of track representations. You are not allowed to modify or delete them!
RecoHitInformation * getRecoHitInformation(HitType *hit) const
Return the reco hit information for a generic hit from the storeArray.
const genfit::FitStatus * getTrackFitStatus(const genfit::AbsTrackRep *representation=nullptr) const
Return the track fit status for the given representation or for the cardinal one. You are not allowed...
const std::vector< genfit::TrackPoint * > & getHitPointsWithMeasurement() const
Return a list of measurements and track points, which can be used e.g. to extrapolate....
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
int getEntries() const
Get the number of objects in the array.
Type-safe access to single objects in the data store.
bool isValid() const
Check whether the object was created.
Values of the result of a track fit with a given particle hypothesis.
short getChargeSign() const
Return track charge (1 or -1).
double getCotTheta() const
Getter for tanLambda with CDF naming convention.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
Class to identify a wire inside the CDC.
unsigned short getIWire() const
Getter for wire within the layer.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
double atan(double a)
atan for double
double sqrt(double a)
sqrt for double
T dot(GeneralVector< T > a, GeneralVector< T > b)
dot product of two general vectors
MCParticle * getMother() const
Returns a pointer to the mother particle.
Abstract base class for different kinds of events.