Belle II Software  release-06-01-15
CDCDedxTrack.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <framework/datastore/RelationsObject.h>
12 #include <framework/gearbox/Const.h>
13 
14 #include <vector>
15 
16 namespace Belle2 {
25  class CDCDedxTrack : public RelationsObject {
26  friend class CDCDedxPIDModule;
27  friend class CDCDedxScanModule;
28  friend class CDCDedxCorrectionModule;
29 
30  public:
31 
35  m_track(0), m_charge(0), m_cosTheta(0), m_p(0), m_pCDC(0),
36  m_length(0.0), m_pdg(-999), m_mcmass(0), m_motherPDG(0), m_pTrue(0), m_cosThetaTrue(0),
37  m_scale(0), m_cosCor(0), m_cosEdgeCor(0), m_runGain(0),
38  m_lNHitsUsed(0)
39  {
41 
42  // set default values for all particles
43  for (unsigned int i = 0; i < Const::ChargedStable::c_SetSize; i++) {
44  m_predmean[i] = 0.0;
45  m_predres[i] = 0.0;
46  m_cdcChi[i] = -999.;
47  m_cdcLogl[i] = 0.0;
48  }
49  }
50 
52  void addDedx(int nhitscombined, int wirelongesthit, int layer, double distance, double dedxValue)
53  {
54  m_lNHitsCombined.push_back(nhitscombined);
55  m_lWireLongestHit.push_back(wirelongesthit);
56  m_lLayer.push_back(layer);
57  m_lPath.push_back(distance);
58  m_lDedx.push_back(dedxValue);
59 
60  m_length += distance;
61  }
62 
64  void addHit(int lwire, int wire, int layer, double doca, double docaRS, double enta, double entaRS,
65  int adcCount, int adcbaseCount, double dE, double path, double dedx, double cellHeight, double cellHalfWidth,
66  int driftT, double driftD, double driftDRes, double wiregain, double twodcor,
67  double onedcor, int foundByTrackFinder, double weightPionHypo, double weightKaonHypo, double weightProtHypo)
68  {
69 
70  m_hLWire.push_back(lwire);
71  m_hWire.push_back(wire);
72  m_hLayer.push_back(layer);
73  m_hPath.push_back(path);
74  m_hDedx.push_back(dedx);
75  m_hADCCount.push_back(adcCount);
76  m_hADCBaseCount.push_back(adcbaseCount);
77  m_hDoca.push_back(doca);
78  m_hDocaRS.push_back(docaRS);
79  m_hEnta.push_back(enta);
80  m_hEntaRS.push_back(entaRS);
81  m_hDriftT.push_back(driftT);
82  m_hdE.push_back(dE);
83  m_hCellHeight.push_back(cellHeight);
84  m_hCellHalfWidth.push_back(cellHalfWidth);
85  m_hDriftD.push_back(driftD);
86  m_hDriftDRes.push_back(driftDRes);
87  m_hWireGain.push_back(wiregain);
88  m_hTwodCor.push_back(twodcor);
89  m_hOnedCor.push_back(onedcor);
90  m_hFoundByTrackFinder.push_back(foundByTrackFinder);
91  m_hWeightPionHypo.push_back(weightPionHypo);
92  m_hWeightKaonHypo.push_back(weightKaonHypo);
93  m_hWeightProtHypo.push_back(weightProtHypo);
94  }
95 
97  double trackID() const { return m_track; }
98 
100  double getPDG() const { return m_pdg; }
101 
103  double getDedx() const { return m_dedxAvgTruncated; }
104 
106  double getDedxNoSat() const { return m_dedxAvgTruncatedNoSat; }
107 
109  double getDedxError() const { return m_dedxAvgTruncatedErr; }
110 
112  double getDedxMean() const { return m_dedxAvg; }
113 
115  std::vector< double > getDedxList() const { return m_hDedx; }
116 
118  double getMomentum() const { return m_pCDC; }
119 
121  double getCosTheta() const { return m_cosTheta; }
122 
124  int getCharge() const { return m_charge; }
125 
127  double getLength() const { return m_length; }
128 
130  double getCosineCorrection() const { return m_cosCor; }
131 
133  double getCosEdgeCorrection() const { return m_cosEdgeCor; }
134 
136  double getRunGain() const { return m_runGain; }
137 
139  double getSimulatedDedx() const { return m_simDedx; }
140 
142  void setDedx(double mean) { m_dedxAvgTruncated = mean; }
143 
145  void setDedxNoSat(double mean) { m_dedxAvgTruncatedNoSat = mean; }
146 
148  void setDedxError(double error) { m_dedxAvgTruncatedErr = error; }
149 
151  void setDedxMean(double mean) { m_dedxAvg = mean; }
152 
154  void setSimulatedDedx(double dedx) { m_simDedx = dedx; }
155 
156 
157  // Layer level
159  int getNLayerHits() const { return m_lDedx.size(); }
160 
162  double getNLayerHitsUsed() const { return m_lNHitsUsed; }
163 
165  int getNHitsCombined(int i) const { return m_lNHitsCombined[i]; }
166 
168  int getWireLongestHit(int i) const { return m_lWireLongestHit[i]; }
169 
171  int getLayer(int i) const { return m_lLayer[i]; }
172 
174  double getLayerPath(int i) const { return m_lPath[i]; }
175 
177  double getLayerDedx(int i) const { return m_lDedx[i]; }
178 
180  void setLayerDedx(int i, double dedx) { m_lDedx[i] = dedx; }
181 
182 
183  // Hit level
185  int size() const { return m_hDedx.size(); }
186 
188  int getWireInLayer(int i) const { return m_hLWire[i]; }
189 
191  int getWire(int i) const { return m_hWire[i]; }
192 
194  int getHitLayer(int i) const { return m_hLayer[i]; }
195 
197  double getPath(int i) const { return m_hPath[i]; }
198 
200  double getDedx(int i) const { return m_hDedx[i]; }
201 
203  int getADCCount(int i) const { return m_hADCCount[i]; }
204 
206  int getADCBaseCount(int i) const { return m_hADCBaseCount[i]; }
207 
209  double getNonLADCCorrection(int i) const { return (m_hADCBaseCount[i] * 1.0) / m_hADCCount[i]; }
210 
212  double getDoca(int i) const { return m_hDoca[i]; }
213 
215  double getEnta(int i) const { return m_hEnta[i]; }
216 
218  double getDocaRS(int i) const { return m_hDocaRS[i]; }
219 
221  double getEntaRS(int i) const { return m_hEntaRS[i]; }
222 
224  int getDriftT(int i) const { return m_hDriftT[i]; }
225 
227  double getDE(int i) const { return m_hdE[i]; }
228 
230  double getCellHeight(int i) const { return m_hCellHeight[i]; }
231 
233  double getCellHalfWidth(int i) const { return m_hCellHalfWidth[i]; }
234 
236  double getDriftD(int i) const { return m_hDriftD[i]; }
237 
239  double getDriftDRes(int i) const { return m_hDriftDRes[i]; }
240 
242  double getWireGain(int i) const { return m_hWireGain[i]; }
243 
245  double getTwoDCorrection(int i) const { return m_hTwodCor[i]; }
246 
248  double getOneDCorrection(int i) const { return m_hOnedCor[i]; }
249 
252  int getFoundByTrackFinder(int i) const { return m_hFoundByTrackFinder[i]; }
253 
255  double getWeightPionHypo(int i) const { return m_hWeightPionHypo[i]; }
256 
258  double getWeightKaonHypo(int i) const { return m_hWeightKaonHypo[i]; }
259 
261  double getWeightProtonHypo(int i) const { return m_hWeightProtHypo[i]; }
262 
264  double getChi(int i) const { return m_cdcChi[i]; }
265 
267  double getPmean(int i) const { return m_predmean[i]; }
268 
270  double getPreso(int i) const { return m_predres[i]; }
271 
273  void setDedx(int i, double dedx) { m_hDedx[i] = dedx; }
274 
275  private:
276 
277  // track level information
278  int m_track;
279  int m_charge;
280  double m_cosTheta;
281  double m_p;
282  double m_pCDC;
283  double m_length;
285  // dE/dx simulation
286  double m_pdg;
287  double m_mcmass;
288  double m_motherPDG;
289  double m_pTrue;
290  double m_cosThetaTrue;
291  double m_simDedx;
293  // calibration constants
294  double m_scale;
295  double m_cosCor;
296  double m_cosEdgeCor;
297  double m_runGain;
298  std::vector<double> m_hWireGain;
299  std::vector<double> m_hTwodCor;
300  std::vector<double> m_hOnedCor;
304  // track level dE/dx measurements
305  double m_dedxAvg;
313  // layer level information (just don't mix with the hit arrays)
315  std::vector<int> m_lNHitsCombined;
316  std::vector<int> m_lWireLongestHit;
317  std::vector<int> m_lLayer;
318  std::vector<double> m_lPath;
319  std::vector<double> m_lDedx;
321  // hit level information
322  std::vector<int> m_hLWire;
323  std::vector<int> m_hWire;
324  std::vector<int> m_hLayer;
325  std::vector<double> m_hPath;
326  std::vector<double> m_hDedx;
327  std::vector<int> m_hADCCount;
328  std::vector<int> m_hADCBaseCount;
329  std::vector<double> m_hDoca;
330  std::vector<double> m_hEnta;
331  std::vector<double> m_hDocaRS;
332  std::vector<double> m_hEntaRS;
333  std::vector<double> m_hdE;
334  std::vector<int> m_hDriftT;
335  std::vector<double> m_hDriftD;
336  std::vector<double> m_hDriftDRes;
337  std::vector<int> m_hFoundByTrackFinder;
338  std::vector<double> m_hWeightPionHypo;
339  std::vector<double> m_hWeightKaonHypo;
340  std::vector<double> m_hWeightProtHypo;
342  std::vector<double> m_hCellHeight;
343  std::vector<double> m_hCellHalfWidth;
346  };
348 }
This module may be used to apply the corrections to dE/dx per the calibration constants.
Extract CDC dE/dx information from fitted tracks.
This class performs the same function as CDCDedxPIDModule, but does so without using real objects fro...
Debug output for CDCDedxPID module.
Definition: CDCDedxTrack.h:25
std::vector< double > m_hOnedCor
calibration 1-D correction (indexed on number of hits)
Definition: CDCDedxTrack.h:300
double m_cdcChi[Const::ChargedStable::c_SetSize]
chi values for each particle type
Definition: CDCDedxTrack.h:309
std::vector< double > m_hDocaRS
distance of closest approach to sense wire after rescalling cell L=W
Definition: CDCDedxTrack.h:331
std::vector< double > m_hDoca
distance of closest approach to sense wire
Definition: CDCDedxTrack.h:329
std::vector< int > m_lWireLongestHit
wire id for the longest hit in the layer
Definition: CDCDedxTrack.h:316
std::vector< double > m_hDedx
charge per path length (dE/dx)
Definition: CDCDedxTrack.h:326
double m_mcmass
MC PID mass.
Definition: CDCDedxTrack.h:287
std::vector< double > m_hCellHeight
height of the CDC cell
Definition: CDCDedxTrack.h:342
int getHitLayer(int i) const
Return the (global) layer number for a hit.
Definition: CDCDedxTrack.h:194
int getADCBaseCount(int i) const
Return the base adcCount (no non-linearity) for this hit.
Definition: CDCDedxTrack.h:206
double m_cosEdgeCor
calibration cosine edge correction
Definition: CDCDedxTrack.h:296
double getSimulatedDedx() const
Get the track-level MC dE/dx mean for this track.
Definition: CDCDedxTrack.h:139
int getADCCount(int i) const
Return the adcCount for this hit.
Definition: CDCDedxTrack.h:203
std::vector< double > m_hEnta
entrance angle in CDC cell
Definition: CDCDedxTrack.h:330
double m_dedxAvgTruncated
dE/dx truncated mean per track
Definition: CDCDedxTrack.h:306
void setDedx(int i, double dedx)
Set the dE/dx value for this hit.
Definition: CDCDedxTrack.h:273
double m_p
momentum at the IP
Definition: CDCDedxTrack.h:281
void setDedxError(double error)
Set the error on the dE/dx truncated mean for this track.
Definition: CDCDedxTrack.h:148
double getDriftDRes(int i) const
Return the drift distance resolution for this hit.
Definition: CDCDedxTrack.h:239
double m_dedxAvgTruncatedErr
standard deviation of m_dedxAvgTruncated
Definition: CDCDedxTrack.h:308
double getDedxMean() const
Get the dE/dx mean for this track.
Definition: CDCDedxTrack.h:112
double getDriftD(int i) const
Return the drift distance for this hit.
Definition: CDCDedxTrack.h:236
void setSimulatedDedx(double dedx)
Set the track level MC dE/dx mean for this track.
Definition: CDCDedxTrack.h:154
int getLayer(int i) const
Return the (global) layer number for a layer hit.
Definition: CDCDedxTrack.h:171
std::vector< int > m_hLayer
layer number
Definition: CDCDedxTrack.h:324
double m_dedxAvgTruncatedNoSat
dE/dx truncated mean per track without the saturation correction
Definition: CDCDedxTrack.h:307
double getDoca(int i) const
Return the distance of closest approach to the sense wire for this hit.
Definition: CDCDedxTrack.h:212
double getDedx() const
Get dE/dx truncated mean for this track.
Definition: CDCDedxTrack.h:103
double getPath(int i) const
Return the path length through the cell for this hit.
Definition: CDCDedxTrack.h:197
int getWireInLayer(int i) const
Return the sensor ID for this hit: wire number in the layer.
Definition: CDCDedxTrack.h:188
std::vector< int > m_hADCCount
adcCount per hit
Definition: CDCDedxTrack.h:327
double getPmean(int i) const
Return the PID (predicted mean) value.
Definition: CDCDedxTrack.h:267
std::vector< double > m_hWeightKaonHypo
weight for kaon hypothesis from KalmanFitterInfo
Definition: CDCDedxTrack.h:339
double getOneDCorrection(int i) const
Return the 1D correction for this hit.
Definition: CDCDedxTrack.h:248
int getWireLongestHit(int i) const
Return the wire number of the longest hit per layer.
Definition: CDCDedxTrack.h:168
CDCDedxTrack()
Default constructor.
Definition: CDCDedxTrack.h:33
double getWeightKaonHypo(int i) const
Return the max weights from KalmanFitterInfo using kaon hypothesis.
Definition: CDCDedxTrack.h:258
int m_lNHitsUsed
number of hits on this track used for truncated mean
Definition: CDCDedxTrack.h:314
double m_simDedx
track level MC dE/dx truncated mean
Definition: CDCDedxTrack.h:291
std::vector< int > m_hADCBaseCount
adcCount base count (uncorrected) per hit
Definition: CDCDedxTrack.h:328
void setDedx(double mean)
Set the dE/dx truncated average for this track.
Definition: CDCDedxTrack.h:142
double getCosineCorrection() const
Return the cosine correction for this track.
Definition: CDCDedxTrack.h:130
double getEntaRS(int i) const
Return rescaled enta value for cell height=width assumption.
Definition: CDCDedxTrack.h:221
double getLayerDedx(int i) const
Return the total dE/dx for this layer.
Definition: CDCDedxTrack.h:177
double getCellHalfWidth(int i) const
Return the half-width of the CDC cell.
Definition: CDCDedxTrack.h:233
ClassDef(CDCDedxTrack, 16)
Debug output for CDCDedxPID module.
std::vector< int > m_hLWire
wire ID within the layer
Definition: CDCDedxTrack.h:322
std::vector< int > m_hDriftT
drift time for each hit
Definition: CDCDedxTrack.h:334
std::vector< int > m_hFoundByTrackFinder
the 'found by track finder' flag for the given hit
Definition: CDCDedxTrack.h:337
double m_cosCor
calibration cosine correction
Definition: CDCDedxTrack.h:295
double getPDG() const
Get the identity of the particle.
Definition: CDCDedxTrack.h:100
std::vector< double > m_hTwodCor
calibration 2-D correction (indexed on number of hits)
Definition: CDCDedxTrack.h:299
std::vector< double > m_hWeightPionHypo
weight for pion hypothesis from KalmanFitterInfo
Definition: CDCDedxTrack.h:338
void setDedxMean(double mean)
Set the dE/dx mean for this track.
Definition: CDCDedxTrack.h:151
std::vector< double > m_hDriftD
drift distance for each hit
Definition: CDCDedxTrack.h:335
std::vector< double > m_hDriftDRes
drift distance resolution for each hit
Definition: CDCDedxTrack.h:336
std::vector< double > m_hPath
path length in the CDC cell
Definition: CDCDedxTrack.h:325
double m_predres[Const::ChargedStable::c_SetSize]
predicted dE/dx resolution
Definition: CDCDedxTrack.h:302
double getTwoDCorrection(int i) const
Return the 2D correction for this hit.
Definition: CDCDedxTrack.h:245
double m_motherPDG
MC PID of mother particle.
Definition: CDCDedxTrack.h:288
double m_runGain
calibration run gain
Definition: CDCDedxTrack.h:297
void addDedx(int nhitscombined, int wirelongesthit, int layer, double distance, double dedxValue)
add dE/dx information for a CDC layer
Definition: CDCDedxTrack.h:52
std::vector< int > m_lNHitsCombined
number of hits combined in the layer
Definition: CDCDedxTrack.h:315
double getPreso(int i) const
Return the PID (predicted reso) value.
Definition: CDCDedxTrack.h:270
void addHit(int lwire, int wire, int layer, double doca, double docaRS, double enta, double entaRS, int adcCount, int adcbaseCount, double dE, double path, double dedx, double cellHeight, double cellHalfWidth, int driftT, double driftD, double driftDRes, double wiregain, double twodcor, double onedcor, int foundByTrackFinder, double weightPionHypo, double weightKaonHypo, double weightProtHypo)
Add a single hit to the object.
Definition: CDCDedxTrack.h:64
int getNLayerHits() const
Return the number of layer hits for this track.
Definition: CDCDedxTrack.h:159
int getFoundByTrackFinder(int i) const
Return the TrackFinder which added the given hit to track.
Definition: CDCDedxTrack.h:252
int getDriftT(int i) const
Return the drift time for this hit.
Definition: CDCDedxTrack.h:224
double getCosTheta() const
Return cos(theta) for this track.
Definition: CDCDedxTrack.h:121
std::vector< double > m_lPath
distance flown through active medium in current segment
Definition: CDCDedxTrack.h:318
double m_pdg
MC PID.
Definition: CDCDedxTrack.h:286
int getCharge() const
Return the charge for this track.
Definition: CDCDedxTrack.h:124
double m_cosTheta
cos(theta) for the track
Definition: CDCDedxTrack.h:280
double getWireGain(int i) const
Return the wire gain for this hit.
Definition: CDCDedxTrack.h:242
double getWeightPionHypo(int i) const
Return the max weights from KalmanFitterInfo using pion hypothesis.
Definition: CDCDedxTrack.h:255
int getWire(int i) const
Return the sensor ID for this hit: wire number for CDC (0-14336)
Definition: CDCDedxTrack.h:191
double m_scale
scale factor to make electrons ~1
Definition: CDCDedxTrack.h:294
std::vector< double > m_hWeightProtHypo
weight for proton hypothesis from KalmanFitterInfo
Definition: CDCDedxTrack.h:340
double getDocaRS(int i) const
Return rescaled doca value for cell height=width assumption.
Definition: CDCDedxTrack.h:218
std::vector< double > m_hEntaRS
entrance angle in CDC cell after rescalling cell L=W
Definition: CDCDedxTrack.h:332
double m_pCDC
momentum at the inner layer of the CDC
Definition: CDCDedxTrack.h:282
double m_length
total distance travelled by the track
Definition: CDCDedxTrack.h:283
double getCosEdgeCorrection() const
Return the cosine correction for this track.
Definition: CDCDedxTrack.h:133
double m_cdcLogl[Const::ChargedStable::c_SetSize]
log likelihood for each particle, not including momentum prior
Definition: CDCDedxTrack.h:310
std::vector< double > m_hWireGain
calibration hit gain (indexed on number of hits)
Definition: CDCDedxTrack.h:298
double getRunGain() const
Return the run gain for this track.
Definition: CDCDedxTrack.h:136
std::vector< double > getDedxList() const
Return the vector of dE/dx values for this track.
Definition: CDCDedxTrack.h:115
double m_dedxAvg
dE/dx mean value per track
Definition: CDCDedxTrack.h:305
void setLayerDedx(int i, double dedx)
Set the total dE/dx for this layer.
Definition: CDCDedxTrack.h:180
double getNonLADCCorrection(int i) const
Return the factor introduce for adcCount (non-linearity) correction.
Definition: CDCDedxTrack.h:209
void setDedxNoSat(double mean)
Set the dE/dx truncated average without the saturation correction for this track.
Definition: CDCDedxTrack.h:145
int m_charge
particle charge from tracking (+1 or -1)
Definition: CDCDedxTrack.h:279
std::vector< double > m_hCellHalfWidth
half-width of the CDC cell
Definition: CDCDedxTrack.h:343
double getDedxError() const
Get the error on the dE/dx truncated mean for this track.
Definition: CDCDedxTrack.h:109
double getWeightProtonHypo(int i) const
Return the max weights from KalmanFitterInfo using proton hypothesis.
Definition: CDCDedxTrack.h:261
double getEnta(int i) const
Return the entrance angle in the CDC cell for this hit.
Definition: CDCDedxTrack.h:215
double m_pTrue
MC true momentum.
Definition: CDCDedxTrack.h:289
int m_track
ID number of the Track.
Definition: CDCDedxTrack.h:278
double getDedx(int i) const
Return the dE/dx value for this hit.
Definition: CDCDedxTrack.h:200
double trackID() const
Return the track ID.
Definition: CDCDedxTrack.h:97
double m_predmean[Const::ChargedStable::c_SetSize]
predicted dE/dx truncated mean
Definition: CDCDedxTrack.h:301
double getLayerPath(int i) const
Return the distance travelled in this layer.
Definition: CDCDedxTrack.h:174
std::vector< int > m_hWire
continuous wire ID in the CDC
Definition: CDCDedxTrack.h:323
double getChi(int i) const
Return the PID (chi) value.
Definition: CDCDedxTrack.h:264
std::vector< double > m_hdE
charge per hit
Definition: CDCDedxTrack.h:333
std::vector< double > m_lDedx
extracted dE/dx (arb.
Definition: CDCDedxTrack.h:319
double m_cosThetaTrue
MC true cos(theta)
Definition: CDCDedxTrack.h:290
double getLength() const
Return the total path length for this track.
Definition: CDCDedxTrack.h:127
double getCellHeight(int i) const
Return the height of the CDC cell.
Definition: CDCDedxTrack.h:230
double getDE(int i) const
Return the ionization charge collected for this hit.
Definition: CDCDedxTrack.h:227
int getNHitsCombined(int i) const
Return the number of hits combined per layer.
Definition: CDCDedxTrack.h:165
double getDedxNoSat() const
Get dE/dx truncated mean without the saturation correction for this track.
Definition: CDCDedxTrack.h:106
int size() const
Return the number of hits for this track.
Definition: CDCDedxTrack.h:185
std::vector< int > m_lLayer
layer id corresponding to dedx
Definition: CDCDedxTrack.h:317
double getNLayerHitsUsed() const
Return the number of hits used to determine the truncated mean.
Definition: CDCDedxTrack.h:162
double getMomentum() const
Return the track momentum valid in the CDC.
Definition: CDCDedxTrack.h:118
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:496
Defines interface for accessing relations of objects in StoreArray.
Abstract base class for different kinds of events.