Belle II Software  release-05-02-19
VXDDedxPIDModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Jake Bennett, Christian Pulvermacher
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <reconstruction/modules/VXDDedxPID/VXDDedxPIDModule.h>
12 #include <reconstruction/modules/VXDDedxPID/HelixHelper.h>
13 
14 #include <framework/gearbox/Const.h>
15 
16 #include <vxd/geometry/GeoCache.h>
17 
18 #include <genfit/MaterialEffects.h>
19 
20 #include <TH2F.h>
21 
22 #include <memory>
23 #include <cassert>
24 #include <cmath>
25 #include <algorithm>
26 
27 using namespace Belle2;
28 using namespace Dedx;
29 
30 REG_MODULE(VXDDedxPID)
31 
33 {
34  setPropertyFlags(c_ParallelProcessingCertified);
35 
36  //Set module properties
37  setDescription("Extract dE/dx and corresponding log-likelihood from fitted tracks and hits in the SVD and PXD.");
38 
39  //Parameter definitions
40  addParam("useIndividualHits", m_useIndividualHits,
41  "Include PDF value for each hit in likelihood. If false, the truncated mean of dedx values for the detectors will be used.", false);
42  // no need to define highest and lowest truncated value as we always remove higest two dE/dx value from the 8 dE/dx value
43  addParam("onlyPrimaryParticles", m_onlyPrimaryParticles, "Only save data for primary particles (as determined by MC truth)", false);
44  addParam("usePXD", m_usePXD, "Use PXDClusters for dE/dx calculation", false);
45  addParam("useSVD", m_useSVD, "Use SVDClusters for dE/dx calculation", true);
46  addParam("trackDistanceThreshold", m_trackDistanceThreshhold,
47  "Use a faster helix parametrisation, with corrections as soon as the approximation is more than ... cm off.", double(4.0));
48  addParam("enableDebugOutput", m_enableDebugOutput, "Option to write out debugging information to DedxTracks (DataStore objects).",
49  false);
50  addParam("ignoreMissingParticles", m_ignoreMissingParticles, "Ignore particles for which no PDFs are found", false);
51 
52  m_eventID = -1;
53  m_trackID = 0;
54 }
55 
57 
59 {
60  //load dedx:momentum PDFs
61  if (!m_DBDedxPDFs) B2FATAL("No VXD Dedx PDFS available");
62  int nBinsXPXD, nBinsYPXD;
63  double xMinPXD, xMaxPXD, yMinPXD, yMaxPXD;
64  nBinsXPXD = nBinsYPXD = -1;
65  xMinPXD = xMaxPXD = yMinPXD = yMaxPXD = 0.0;
66 
67  int nBinsXSVD, nBinsYSVD;
68  double xMinSVD, xMaxSVD, yMinSVD, yMaxSVD;
69  nBinsXSVD = nBinsYSVD = -1;
70  xMinSVD = xMaxSVD = yMinSVD = yMaxSVD = 0.0;
71 
72  for (unsigned int iPart = 0; iPart < 6; iPart++) {
73  const int pdgCode = Const::chargedStableSet.at(iPart).getPDGCode();
74  const TH2F* svd_pdf = m_DBDedxPDFs->getSVDPDF(iPart, !m_useIndividualHits);
75  const TH2F* pxd_pdf = m_DBDedxPDFs->getPXDPDF(iPart, !m_useIndividualHits);
76 
77  if (pxd_pdf->GetEntries() == 0 || svd_pdf->GetEntries() == 0) {
78  if (m_ignoreMissingParticles)
79  continue;
80  B2FATAL("Couldn't find PDF for PDG " << pdgCode);
81  }
82 
83  //check that PXD PDFs have the same dimensions and same binning
84  const double epsFactor = 1e-5;
85  if (nBinsXPXD == -1 and nBinsYPXD == -1) {
86  nBinsXPXD = pxd_pdf->GetNbinsX();
87  nBinsYPXD = pxd_pdf->GetNbinsY();
88  xMinPXD = pxd_pdf->GetXaxis()->GetXmin();
89  xMaxPXD = pxd_pdf->GetXaxis()->GetXmax();
90  yMinPXD = pxd_pdf->GetYaxis()->GetXmin();
91  yMaxPXD = pxd_pdf->GetYaxis()->GetXmax();
92  } else if (nBinsXPXD != pxd_pdf->GetNbinsX()
93  or nBinsYPXD != pxd_pdf->GetNbinsY()
94  or fabs(xMinPXD - pxd_pdf->GetXaxis()->GetXmin()) > epsFactor * xMaxPXD
95  or fabs(xMaxPXD - pxd_pdf->GetXaxis()->GetXmax()) > epsFactor * xMaxPXD
96  or fabs(yMinPXD - pxd_pdf->GetYaxis()->GetXmin()) > epsFactor * yMaxPXD
97  or fabs(yMaxPXD - pxd_pdf->GetYaxis()->GetXmax()) > epsFactor * yMaxPXD) {
98  B2FATAL("PDF for PDG " << pdgCode << ", PXD has binning/dimensions differing from previous PDF.");
99  }
100 
101  //check that SVD PDFs have the same dimensions and same binning
102  if (nBinsXSVD == -1 and nBinsYSVD == -1) {
103  nBinsXSVD = svd_pdf->GetNbinsX();
104  nBinsYSVD = svd_pdf->GetNbinsY();
105  xMinSVD = svd_pdf->GetXaxis()->GetXmin();
106  xMaxSVD = svd_pdf->GetXaxis()->GetXmax();
107  yMinSVD = svd_pdf->GetYaxis()->GetXmin();
108  yMaxSVD = svd_pdf->GetYaxis()->GetXmax();
109  } else if (nBinsXSVD != svd_pdf->GetNbinsX()
110  or nBinsYSVD != svd_pdf->GetNbinsY()
111  or fabs(xMinSVD - svd_pdf->GetXaxis()->GetXmin()) > epsFactor * xMaxSVD
112  or fabs(xMaxSVD - svd_pdf->GetXaxis()->GetXmax()) > epsFactor * xMaxSVD
113  or fabs(yMinSVD - svd_pdf->GetYaxis()->GetXmin()) > epsFactor * yMaxSVD
114  or fabs(yMaxSVD - svd_pdf->GetYaxis()->GetXmax()) > epsFactor * yMaxSVD) {
115  B2FATAL("PDF for PDG " << pdgCode << ", PXD has binning/dimensions differing from previous PDF.");
116  }
117  }
118 }
119 
121 {
122 
123  // required inputs
124  m_tracks.isRequired();
125  m_recoTracks.isRequired();
126 
127  //optional inputs
128  m_mcparticles.isOptional();
129  m_tracks.optionalRelationTo(m_mcparticles);
130 
131  if (m_useSVD)
132  m_svdClusters.isRequired();
133  else
134  m_svdClusters.isOptional();
135  if (m_usePXD)
136  m_pxdClusters.isRequired();
137  else
138  m_pxdClusters.isOptional();
139 
140  // register optional outputs
141  if (m_enableDebugOutput) {
142  m_dedxTracks.registerInDataStore();
143  m_tracks.registerRelationTo(m_dedxTracks);
144  }
145 
146  // register outputs
147  m_dedxLikelihoods.registerInDataStore();
148  m_tracks.registerRelationTo(m_dedxLikelihoods);
149 
150  m_DBDedxPDFs.addCallback([this]() {checkPDFs();});
151  checkPDFs();
152 
153 
154  // create instances here to not confuse profiling
156 
157  if (!genfit::MaterialEffects::getInstance()->isInitialized()) {
158  B2FATAL("Need to have SetupGenfitExtrapolationModule in path before this one.");
159  }
160 }
161 
163 {
164  // go through Tracks
165  // get fitresult and gftrack and do extrapolations, save corresponding dE/dx and likelihood values
166  // get genfit::TrackCand through genfit::Track::getCand()
167  // get hit indices through genfit::TrackCand::getHit(...)
168  // create one VXDDedxTrack per fitresult/gftrack
169  //create one DedkLikelihood per Track (plus rel)
170  m_eventID++;
171 
172  // inputs
173  const int numMCParticles = m_mcparticles.getEntries();
174 
175  // **************************************************
176  //
177  // LOOP OVER TRACKS
178  //
179  // **************************************************
180 
181  for (const auto& track : m_tracks) {
182  m_trackID++;
183 
184  std::shared_ptr<VXDDedxTrack> dedxTrack = std::make_shared<VXDDedxTrack>();
185  dedxTrack->m_eventID = m_eventID;
186  dedxTrack->m_trackID = m_trackID;
187 
188  // load the pion fit hypothesis or the hypothesis which is the closest in mass to a pion
189  // the tracking will not always successfully fit with a pion hypothesis
190  const TrackFitResult* fitResult = track.getTrackFitResultWithClosestMass(Const::pion);
191  if (!fitResult) {
192  B2WARNING("No related fit for track ...");
193  continue;
194  }
195 
196  if ((m_enableDebugOutput or m_onlyPrimaryParticles) and numMCParticles != 0) {
197  // find MCParticle corresponding to this track
198  const MCParticle* mcpart = track.getRelatedTo<MCParticle>();
199 
200  if (mcpart) {
201  if (m_onlyPrimaryParticles && !mcpart->hasStatus(MCParticle::c_PrimaryParticle)) {
202  continue; //not a primary particle, ignore
203  }
204 
205  //add some MC truths to VXDDedxTrack object
206  dedxTrack->m_pdg = mcpart->getPDG();
207  const MCParticle* mother = mcpart->getMother();
208  dedxTrack->m_motherPDG = mother ? mother->getPDG() : 0;
209 
210  const TVector3 trueMomentum = mcpart->getMomentum();
211  dedxTrack->m_pTrue = trueMomentum.Mag();
212  }
213  }
214 
215  // get momentum (at origin) from fit result
216  const TVector3& trackPos = fitResult->getPosition();
217  const TVector3& trackMom = fitResult->getMomentum();
218  dedxTrack->m_p = trackMom.Mag();
219  dedxTrack->m_cosTheta = trackMom.CosTheta();
220  dedxTrack->m_charge = fitResult->getChargeSign();
221 
222  // dE/dx values will be calculated using associated RecoTrack
223  const RecoTrack* recoTrack = track.getRelatedTo<RecoTrack>();
224  if (!recoTrack) {
225  B2WARNING("No related track for this fit...");
226  continue;
227  }
228 
229  // Check to see if the track is pruned. We use the cardinal representation for this, as we do not expect that one
230  // representation is pruned whereas the other is not.
231  if (recoTrack->getTrackFitStatus()->isTrackPruned()) {
232  B2ERROR("GFTrack is pruned, please run VXDDedxPID only on unpruned tracks! Skipping this track.");
233  continue;
234  }
235 
236  //used for PXD/SVD hits
237  const HelixHelper helixAtOrigin(trackPos, trackMom, dedxTrack->m_charge);
238 
239  if (m_usePXD) {
240  const std::vector<PXDCluster*>& pxdClusters = recoTrack->getPXDHitList();
241  saveSiHits(dedxTrack.get(), helixAtOrigin, pxdClusters);
242  }
243 
244  if (m_useSVD) {
245  const std::vector<SVDCluster*>& svdClusters = recoTrack->getSVDHitList();
246  saveSiHits(dedxTrack.get(), helixAtOrigin, svdClusters);
247  }
248 
249  if (dedxTrack->dedx.empty()) {
250  B2DEBUG(50, "Found track with no hits, ignoring.");
251  continue;
252  }
253 
254  // calculate likelihoods for truncated mean
255  if (!m_useIndividualHits) {
256  for (int detector = 0; detector <= c_SVD; detector++) {
257  if (!detectorEnabled(static_cast<Detector>(detector)))
258  continue; //unwanted detector
259 
260  if (detector == 0) savePXDLogLikelihood(dedxTrack->m_vxdLogl, dedxTrack->m_p, dedxTrack->m_dedxAvgTruncated[detector]);
261  else if (detector == 1) saveSVDLogLikelihood(dedxTrack->m_vxdLogl, dedxTrack->m_p, dedxTrack->m_dedxAvgTruncated[detector]);
262  }
263  }
264 
265  if (m_enableDebugOutput) {
266  // add a few last things to the VXDDedxTrack
267  const int numDedx = dedxTrack->dedx.size();
268  dedxTrack->m_nHits = numDedx;
269  // no need to define lowedgetruncated and highedgetruncated as we always remove the highest 2 dE/dx values from 8 dE/dx value
270 
271  dedxTrack->m_nHitsUsed = numDedx - 2;
272 
273  // now book the information for this track
274  VXDDedxTrack* newVXDDedxTrack = m_dedxTracks.appendNew(*dedxTrack);
275  track.addRelationTo(newVXDDedxTrack);
276  }
277 
278  // save VXDDedxLikelihood
279  VXDDedxLikelihood* likelihoodObj = m_dedxLikelihoods.appendNew(dedxTrack->m_vxdLogl);
280  track.addRelationTo(likelihoodObj);
281 
282  } // end of loop over tracks
283 }
284 
286 {
287 
288  B2DEBUG(50, "VXDDedxPIDModule exiting after processing " << m_trackID <<
289  " tracks in " << m_eventID + 1 << " events.");
290 }
291 // calculateMeans need some change as we always remove highest 2 dE/dx values
292 void VXDDedxPIDModule::calculateMeans(double* mean, double* truncatedMean, double* truncatedMeanErr,
293  const std::vector<double>& dedx) const
294 {
295  // Calculate the truncated average by skipping only highest two value
296  std::vector<double> sortedDedx = dedx;
297  std::sort(sortedDedx.begin(), sortedDedx.end());
298 
299  double truncatedMeanTmp = 0.0;
300  double meanTmp = 0.0;
301  double sumOfSquares = 0.0;
302  const int numDedx = sortedDedx.size();
303 
304 
305  for (int i = 0; i < numDedx; i++) {
306  meanTmp += sortedDedx[i];
307  }
308  if (numDedx != 0) {
309  meanTmp /= numDedx;
310  }
311 
312  for (int i = 0; i < numDedx - 2; i++) {
313  truncatedMeanTmp += sortedDedx[i];
314  sumOfSquares += sortedDedx[i] * sortedDedx[i];
315  }
316  if (numDedx - 2 != 0) {
317  truncatedMeanTmp /= numDedx - 2;
318  }
319 
320  *mean = meanTmp;
321  *truncatedMean = truncatedMeanTmp;
322 
323  if (numDedx - 2 > 1) {
324  *truncatedMeanErr = sqrt(sumOfSquares / double(numDedx - 2) - truncatedMeanTmp * truncatedMeanTmp) / double(
325  (numDedx - 2) - 1);
326  } else {
327  *truncatedMeanErr = 0;
328  }
329 }
330 
332 {
334  const VXD::SensorInfoBase& sensor = geo.get(hit->getSensorID());
335 
336  const TVector3 localPos(hit->getU(), hit->getV(), 0.0); //z-component is height over the center of the detector plane
337  const TVector3& globalPos = sensor.pointToGlobal(localPos);
338  const TVector3& localMomentum = helix->momentum(helix->pathLengthToPoint(globalPos));
339 
340  const TVector3& sensorNormal = sensor.vectorToGlobal(TVector3(0.0, 0.0, 1.0));
341  const double angle = sensorNormal.Angle(localMomentum); //includes theta and phi components
342 
343  //I'm assuming there's only one hit per sensor, there are _very_ rare exceptions to that (most likely curlers)
344  return TMath::Min(sensor.getWidth(), sensor.getThickness() / fabs(cos(angle)));
345 }
346 
347 
349 {
351  const VXD::SensorInfoBase& sensor = geo.get(hit->getSensorID());
352 
353  TVector3 a, b;
354  if (hit->isUCluster()) {
355  const float u = hit->getPosition();
356  a = sensor.pointToGlobal(TVector3(sensor.getBackwardWidth() / sensor.getWidth(0) * u, -0.5 * sensor.getLength(), 0.0));
357  b = sensor.pointToGlobal(TVector3(sensor.getForwardWidth() / sensor.getWidth(0) * u, +0.5 * sensor.getLength(), 0.0));
358  } else {
359  const float v = hit->getPosition();
360  a = sensor.pointToGlobal(TVector3(-0.5 * sensor.getWidth(v), v, 0.0));
361  b = sensor.pointToGlobal(TVector3(+0.5 * sensor.getWidth(v), v, 0.0));
362  }
363  const double pathLength = helix->pathLengthToLine(a, b);
364  const TVector3& localMomentum = helix->momentum(pathLength);
365 
366  const TVector3& sensorNormal = sensor.vectorToGlobal(TVector3(0.0, 0.0, 1.0));
367  const double angle = sensorNormal.Angle(localMomentum); //includes theta and phi components
368 
369  return TMath::Min(sensor.getWidth(), sensor.getThickness() / fabs(cos(angle)));
370 }
371 
372 
373 template <class HitClass> void VXDDedxPIDModule::saveSiHits(VXDDedxTrack* track, const HelixHelper& helix,
374  const std::vector<HitClass*>& hits) const
375 {
376  const int numHits = hits.size();
377  if (numHits == 0)
378  return;
379 
381 
382  //figure out which detector to assign hits to
383  const int currentDetector = geo.get(hits.front()->getSensorID()).getType();
384  assert(currentDetector == VXD::SensorInfoBase::PXD or currentDetector == VXD::SensorInfoBase::SVD);
385  assert(currentDetector <= 1); //used as array index
386 
387  std::vector<double> siliconDedx; //used for averages
388  siliconDedx.reserve(numHits);
389 
390  VxdID prevSensor;
391  for (int i = 0; i < numHits; i++) {
392  const HitClass* hit = hits[i];
393  if (!hit) {
394  B2ERROR("Added hit is a null pointer!");
395  continue;
396  }
397  const VxdID& currentSensor = hit->getSensorID();
398  int layer = -1;
399  if (m_enableDebugOutput) {
400  layer = -currentSensor.getLayerNumber();
401  assert(layer >= -6 && layer < 0);
402  }
403 
404  //active medium traversed, in cm (can traverse one sensor at most)
405  //assumption: Si detectors are close enough to the origin that helix is still accurate
406  const double totalDistance = getTraversedLength(hit, &helix);
407  const float charge = hit->getCharge();
408  const float dedx = charge / totalDistance;
409  if (dedx <= 0) {
410  B2WARNING("dE/dx is " << dedx << " in layer " << layer);
411  } else if (i == 0 or prevSensor != currentSensor) { //only save once per sensor (u and v hits share charge!)
412  prevSensor = currentSensor;
413  //store data
414  siliconDedx.push_back(dedx);
415  track->m_dedxAvg[currentDetector] += dedx;
416  track->addDedx(layer, totalDistance, dedx);
417  if (m_useIndividualHits) {
418  if (currentDetector == 0) savePXDLogLikelihood(track->m_vxdLogl, track->m_p, dedx);
419  else if (currentDetector == 1) saveSVDLogLikelihood(track->m_vxdLogl, track->m_p, dedx);
420  }
421  }
422 
423  if (m_enableDebugOutput) {
424  track->addHit(currentSensor, layer, charge, totalDistance, dedx);
425  }
426  }
427 
428  //save averages averages
429  if (!m_useIndividualHits or m_enableDebugOutput) {
430  calculateMeans(&(track->m_dedxAvg[currentDetector]),
431  &(track->m_dedxAvgTruncated[currentDetector]),
432  &(track->m_dedxAvgTruncatedErr[currentDetector]),
433  siliconDedx);
434  }
435 }
436 
437 void VXDDedxPIDModule::savePXDLogLikelihood(double(&logl)[Const::ChargedStable::c_SetSize], double p, float dedx) const
438 {
439  //all pdfs have the same dimensions
440  const TH2F* pdf = m_DBDedxPDFs->getPXDPDF(0, !m_useIndividualHits);
441  const Int_t binX = pdf->GetXaxis()->FindFixBin(p);
442  const Int_t binY = pdf->GetYaxis()->FindFixBin(dedx);
443 
444  for (unsigned int iPart = 0; iPart < Const::ChargedStable::c_SetSize; iPart++) {
445  pdf = m_DBDedxPDFs->getPXDPDF(iPart, !m_useIndividualHits);
446  if (pdf->GetEntries() == 0) //might be NULL if m_ignoreMissingParticles is set
447  continue;
448  double probability = 0.0;
449 
450  //check if this is still in the histogram, take overflow bin otherwise
451  if (binX < 1 or binX > pdf->GetNbinsX()
452  or binY < 1 or binY > pdf->GetNbinsY()) {
453  probability = pdf->GetBinContent(binX, binY);
454  } else {
455  //in normal histogram range. Of course ROOT has a bug that Interpolate()
456  //is not declared as const but it does not modify the internal state so
457  //fine, const_cast it is.
458  probability = const_cast<TH2F*>(pdf)->Interpolate(p, dedx);
459  }
460 
461  if (probability != probability)
462  B2ERROR("probability NAN for a track with p=" << p << " and dedx=" << dedx);
463 
464  //my pdfs aren't perfect...
465  if (probability == 0.0)
466  probability = m_useIndividualHits ? (1e-5) : (1e-3); //likelihoods for truncated mean are much higher
467 
468  logl[iPart] += log(probability);
469  }
470 }
471 
472 void VXDDedxPIDModule::saveSVDLogLikelihood(double(&logl)[Const::ChargedStable::c_SetSize], double p, float dedx) const
473 {
474  //all pdfs have the same dimensions
475  const TH2F* pdf = m_DBDedxPDFs->getSVDPDF(0, !m_useIndividualHits);
476  const Int_t binX = pdf->GetXaxis()->FindFixBin(p);
477  const Int_t binY = pdf->GetYaxis()->FindFixBin(dedx);
478 
479  for (unsigned int iPart = 0; iPart < Const::ChargedStable::c_SetSize; iPart++) {
480  pdf = m_DBDedxPDFs->getSVDPDF(iPart, !m_useIndividualHits);
481  if (pdf->GetEntries() == 0) //might be NULL if m_ignoreMissingParticles is set
482  continue;
483  double probability = 0.0;
484 
485  //check if this is still in the histogram, take overflow bin otherwise
486  if (binX < 1 or binX > pdf->GetNbinsX()
487  or binY < 1 or binY > pdf->GetNbinsY()) {
488  probability = pdf->GetBinContent(binX, binY);
489  } else {
490  //in normal histogram range. Of course ROOT has a bug that Interpolate()
491  //is not declared as const but it does not modify the internal state so
492  //fine, const_cast it is.
493  probability = const_cast<TH2F*>(pdf)->Interpolate(p, dedx);
494  }
495 
496  if (probability != probability)
497  B2ERROR("probability NAN for a track with p=" << p << " and dedx=" << dedx);
498 
499  //my pdfs aren't perfect...
500  if (probability == 0.0)
501  probability = m_useIndividualHits ? (1e-5) : (1e-3); //likelihoods for truncated mean are much higher
502 
503  logl[iPart] += log(probability);
504  }
505 }
Belle2::VXDDedxTrack::m_cosTheta
double m_cosTheta
cos(theta) for the track
Definition: VXDDedxTrack.h:155
Belle2::Const::ChargedStable::c_SetSize
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:491
Belle2::RecoTrack::getTrackFitStatus
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...
Definition: RecoTrack.h:537
Belle2::HelixHelper::pathLengthToLine
double pathLengthToLine(const TVector3 &a, const TVector3 &b) const
returns the path length (along the helix) to the helix point closest to the line going through points...
Definition: HelixHelper.h:98
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::HelixHelper::momentum
TVector3 momentum(double s=0) const
momentum of the particle, at the helix point corresponding to a flown path length s (from poca).
Definition: HelixHelper.h:120
genfit::FitStatus::isTrackPruned
bool isTrackPruned() const
Has the track been pruned after the fit?
Definition: FitStatus.h:116
Belle2::TrackFitResult::getMomentum
TVector3 getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
Definition: TrackFitResult.h:116
Belle2::RecoTrack::getSVDHitList
std::vector< Belle2::RecoTrack::UsedSVDHit * > getSVDHitList() const
Return an unsorted list of svd hits.
Definition: RecoTrack.h:449
Belle2::VXD::GeoCache::get
static const SensorInfoBase & get(Belle2::VxdID id)
Return a reference to the SensorInfo of a given SensorID.
Definition: GeoCache.h:141
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::VXDDedxPIDModule::getTraversedLength
static double getTraversedLength(const PXDCluster *hit, const HelixHelper *helix)
returns traversed length through active medium of given PXDCluster.
Definition: VXDDedxPIDModule.cc:331
Belle2::VXDDedxPIDModule
Extract dE/dx from fitted tracks.
Definition: VXDDedxPIDModule.h:62
Belle2::VXDDedxTrack::m_motherPDG
double m_motherPDG
MC PID of mother particle.
Definition: VXDDedxTrack.h:163
Belle2::VXDDedxPIDModule::checkPDFs
void checkPDFs()
Check the pdfs for consistency everytime they change in the database.
Definition: VXDDedxPIDModule.cc:58
Belle2::Const::chargedStableSet
static const ParticleSet chargedStableSet
set of charged stable particles
Definition: Const.h:494
Belle2::HelixHelper
Helper class representing a helical track.
Definition: HelixHelper.h:39
Belle2::VXDDedxTrack::m_p
double m_p
momentum at the IP
Definition: VXDDedxTrack.h:154
Belle2::VXD::SensorInfoBase
Base class to provide Sensor Information for PXD and SVD.
Definition: SensorInfoBase.h:40
Belle2::Const::ParticleType::getPDGCode
int getPDGCode() const
PDG code.
Definition: Const.h:349
Belle2::VXDDedxTrack
Debug output for VXDDedxPID module.
Definition: VXDDedxTrack.h:38
Belle2::VXDDedxTrack::m_nHitsUsed
short m_nHitsUsed
number of hits on this track used in the truncated mean
Definition: VXDDedxTrack.h:160
Belle2::VXDDedxTrack::m_vxdLogl
double m_vxdLogl[Const::ChargedStable::c_SetSize]
log likelihood for each particle, not including momentum prior
Definition: VXDDedxTrack.h:170
Belle2::TrackFitResult
Values of the result of a track fit with a given particle hypothesis.
Definition: TrackFitResult.h:59
Belle2::VXDDedxTrack::m_dedxAvgTruncated
double m_dedxAvgTruncated[2]
dE/dx truncated mean per track
Definition: VXDDedxTrack.h:167
Belle2::TrackFitResult::getPosition
TVector3 getPosition() const
Getter for vector of position at closest approach of track in r/phi projection.
Definition: TrackFitResult.h:109
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::MCParticle::hasStatus
bool hasStatus(unsigned short int bitmask) const
Return if specific status bit is set.
Definition: MCParticle.h:140
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::VXDDedxTrack::m_nHits
short m_nHits
number of hits on this track
Definition: VXDDedxTrack.h:159
Belle2::Const::pion
static const ChargedStable pion
charged pion particle
Definition: Const.h:535
Belle2::VXDDedxPIDModule::calculateMeans
void calculateMeans(double *mean, double *truncatedMean, double *truncatedMeanErr, const std::vector< double > &dedx) const
Save arithmetic and truncated mean for the 'dedx' values.
Definition: VXDDedxPIDModule.cc:292
Belle2::VXDDedxPIDModule::savePXDLogLikelihood
void savePXDLogLikelihood(double(&logl)[Const::ChargedStable::c_SetSize], double p, float dedx) const
for all particles in the PXD, save log-likelihood values into 'logl'.
Definition: VXDDedxPIDModule.cc:437
Belle2::VXDDedxPIDModule::saveSiHits
void saveSiHits(VXDDedxTrack *track, const HelixHelper &helix, const std::vector< HitClass * > &hits) const
save energy loss and hit information from SVD/PXDHits to track
Definition: VXDDedxPIDModule.cc:373
Belle2::VXD::GeoCache::getInstance
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:215
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::VXDDedxLikelihood
Container for likelihoods obtained by the VXD dE/dx PID (VXDDedxPIDModule).
Definition: VXDDedxLikelihood.h:34
Belle2::Const::ParticleSet::at
const ParticleType & at(unsigned int index) const
Return particle at given index, or end() if out of range.
Definition: Const.h:425
Belle2::MCParticle::getPDG
int getPDG() const
Return PDG code of particle.
Definition: MCParticle.h:123
Belle2::VXDDedxTrack::m_trackID
int m_trackID
ID number of the Track.
Definition: VXDDedxTrack.h:139
Belle2::MCParticle::getMother
MCParticle * getMother() const
Returns a pointer to the mother particle.
Definition: MCParticle.h:593
Belle2::PXDCluster
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Definition: PXDCluster.h:41
Belle2::VXDDedxTrack::m_charge
short m_charge
particle charge from tracking (+1 or -1)
Definition: VXDDedxTrack.h:156
Belle2::VXD::SensorInfoBase::SVD
@ SVD
SVD Sensor.
Definition: SensorInfoBase.h:45
Belle2::VXDDedxPIDModule::terminate
virtual void terminate() override
End of the event processing.
Definition: VXDDedxPIDModule.cc:285
Belle2::SVDCluster
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:38
Belle2::VXD::SensorInfoBase::PXD
@ PXD
PXD Sensor.
Definition: SensorInfoBase.h:44
Belle2::VXDDedxPIDModule::initialize
virtual void initialize() override
Initialize the module.
Definition: VXDDedxPIDModule.cc:120
Belle2::VXDDedxTrack::m_pdg
double m_pdg
MC PID.
Definition: VXDDedxTrack.h:162
Belle2::VXD::SensorInfoBase::getType
SensorType getType() const
Return the Type of the Sensor.
Definition: SensorInfoBase.h:83
Belle2::VXD::GeoCache
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
Definition: GeoCache.h:41
Belle2::MCParticle::getMomentum
TVector3 getMomentum() const
Return momentum.
Definition: MCParticle.h:209
Belle2::VXDDedxTrack::m_pTrue
double m_pTrue
MC true momentum.
Definition: VXDDedxTrack.h:164
Belle2::MCParticle
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:43
Belle2::VxdID::getLayerNumber
baseType getLayerNumber() const
Get the layer id.
Definition: VxdID.h:106
Belle2::HelixHelper::pathLengthToPoint
double pathLengthToPoint(const TVector3 &p) const
returns the path length (along the helix) to the helix point closest to p.
Definition: HelixHelper.h:79
Belle2::VXDDedxTrack::dedx
std::vector< double > dedx
extracted dE/dx (arb.
Definition: VXDDedxTrack.h:149
Belle2::TrackFitResult::getChargeSign
short getChargeSign() const
Return track charge (1 or -1).
Definition: TrackFitResult.h:160
Belle2::MCParticle::c_PrimaryParticle
@ c_PrimaryParticle
bit 0: Particle is primary particle.
Definition: MCParticle.h:58
Belle2::VXDDedxPIDModule::saveSVDLogLikelihood
void saveSVDLogLikelihood(double(&logl)[Const::ChargedStable::c_SetSize], double p, float dedx) const
for all particles in the SVD, save log-likelihood values into 'logl'.
Definition: VXDDedxPIDModule.cc:472
Belle2::VXDDedxPIDModule::~VXDDedxPIDModule
virtual ~VXDDedxPIDModule()
Destructor.
Definition: VXDDedxPIDModule.cc:56
Belle2::VXDDedxTrack::m_eventID
int m_eventID
event in which this Track was found
Definition: VXDDedxTrack.h:138
Belle2::VXDDedxPIDModule::event
virtual void event() override
This method is called for each event.
Definition: VXDDedxPIDModule.cc:162
Belle2::RecoTrack::getPXDHitList
std::vector< Belle2::RecoTrack::UsedPXDHit * > getPXDHitList() const
Return an unsorted list of pxd hits.
Definition: RecoTrack.h:452