Belle II Software development
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
16namespace Belle2 {
26 friend class CDCDedxPIDModule;
27 friend class CDCDedxScanModule;
28 friend class CDCDedxCorrectionModule;
29 friend class CDCDedxPIDCreatorModule;
30
31 public:
32
36 m_cosTheta(0), m_p(0), m_pCDC(0), m_length(0.0), m_injring(-1), m_injtime(-1),
37 m_track(0), m_charge(0), m_pdg(-999), m_mcmass(0), m_motherPDG(0), m_pTrue(0), m_cosThetaTrue(0),
40 {
42
43 // set default values for all particles
44 for (unsigned int i = 0; i < Const::ChargedStable::c_SetSize; i++) {
45 m_predmean[i] = 0.0;
46 m_predres[i] = 0.0;
47 m_cdcChi[i] = -999.;
48 m_cdcLogl[i] = 0.0;
49 }
50 }
51
53 void addDedx(int nhitscombined, int wirelongesthit, int layer, double distance, double dedxValue)
54 {
55 m_lNHitsCombined.push_back(nhitscombined);
56 m_lWireLongestHit.push_back(wirelongesthit);
57 m_lLayer.push_back(layer);
58 m_lPath.push_back(distance);
59 m_lDedx.push_back(dedxValue);
60
61 m_length += distance;
62 }
63
65 void addHit(int lwire, int wire, int layer, double doca, double docaRS, double enta, double entaRS,
66 int adcCount, int adcbaseCount, double dE, double path, double dedx, double cellHeight, double cellHalfWidth,
67 int driftT, double driftD, double driftDRes, double wiregain, double twodcor,
68 double onedcor, int foundByTrackFinder, double weightPionHypo, double weightKaonHypo, double weightProtHypo)
69 {
70
71 m_hLWire.push_back(lwire);
72 m_hWire.push_back(wire);
73 m_hLayer.push_back(layer);
74 m_hPath.push_back(path);
75 m_hDedx.push_back(dedx);
76 m_hADCCount.push_back(adcCount);
77 m_hADCBaseCount.push_back(adcbaseCount);
78 m_hDoca.push_back(doca);
79 m_hDocaRS.push_back(docaRS);
80 m_hEnta.push_back(enta);
81 m_hEntaRS.push_back(entaRS);
82 m_hDriftT.push_back(driftT);
83 m_hdE.push_back(dE);
84 m_hCellHeight.push_back(cellHeight);
85 m_hCellHalfWidth.push_back(cellHalfWidth);
86 m_hDriftD.push_back(driftD);
87 m_hDriftDRes.push_back(driftDRes);
88 m_hWireGain.push_back(wiregain);
89 m_hTwodCor.push_back(twodcor);
90 m_hOnedCor.push_back(onedcor);
91 m_hFoundByTrackFinder.push_back(foundByTrackFinder);
92 m_hWeightPionHypo.push_back(weightPionHypo);
93 m_hWeightKaonHypo.push_back(weightKaonHypo);
94 m_hWeightProtHypo.push_back(weightProtHypo);
95 }
96
98 double trackID() const { return m_track; }
99
101 double getPDG() const { return m_pdg; }
102
104 double getDedx() const { return m_dedxAvgTruncated; }
105
107 double getDedxNoSat() const { return m_dedxAvgTruncatedNoSat; }
108
110 double getDedxError() const { return m_dedxAvgTruncatedErr; }
111
113 double getDedxMean() const { return m_dedxAvg; }
114
116 std::vector< double > getDedxList() const { return m_hDedx; }
117
119 double getMomentum() const { return m_pCDC; }
120
122 double getCosTheta() const { return m_cosTheta; }
123
125 int getCharge() const { return m_charge; }
126
128 double getInjectionTime() const { return m_injtime; }
129
131 double getInjectionRing() const { return m_injring; }
132
134 double getLength() const { return m_length; }
135
137 double getCosineCorrection() const { return m_cosCor; }
138
140 double getCosEdgeCorrection() const { return m_cosEdgeCor; }
141
143 double getRunGain() const { return m_runGain; }
144
146 double getScaleFactor() const { return m_scale; }
147
149 double getTimeMean() const { return m_timeGain; }
150
152 double getTimeReso() const { return m_timeReso; }
153
155 double getSimulatedDedx() const { return m_simDedx; }
156
158 void setDedx(double mean) { m_dedxAvgTruncated = mean; }
159
161 void setDedxNoSat(double mean) { m_dedxAvgTruncatedNoSat = mean; }
162
164 void setDedxError(double error) { m_dedxAvgTruncatedErr = error; }
165
167 void setDedxMean(double mean) { m_dedxAvg = mean; }
168
170 void setSimulatedDedx(double dedx) { m_simDedx = dedx; }
171
172
173 // Layer level
175 int getNLayerHits() const { return m_lDedx.size(); }
176
178 double getNLayerHitsUsed() const { return m_lNHitsUsed; }
179
181 int getNHitsCombined(int i) const { return m_lNHitsCombined[i]; }
182
184 int getWireLongestHit(int i) const { return m_lWireLongestHit[i]; }
185
187 int getLayer(int i) const { return m_lLayer[i]; }
188
190 double getLayerPath(int i) const { return m_lPath[i]; }
191
193 double getLayerDedx(int i) const { return m_lDedx[i]; }
194
196 void setLayerDedx(int i, double dedx) { m_lDedx[i] = dedx; }
197
198
199 // Hit level
201 int size() const { return m_hDedx.size(); }
202
204 int getWireInLayer(int i) const { return m_hLWire[i]; }
205
207 int getWire(int i) const { return m_hWire[i]; }
208
210 int getHitLayer(int i) const { return m_hLayer[i]; }
211
213 double getPath(int i) const { return m_hPath[i]; }
214
216 double getDedx(int i) const { return m_hDedx[i]; }
217
219 int getADCCount(int i) const { return m_hADCCount[i]; }
220
222 int getADCBaseCount(int i) const { return m_hADCBaseCount[i]; }
223
225 double getNonLADCCorrection(int i) const { return (m_hADCBaseCount[i] * 1.0) / m_hADCCount[i]; }
226
228 double getDoca(int i) const { return m_hDoca[i]; }
229
231 double getEnta(int i) const { return m_hEnta[i]; }
232
234 double getDocaRS(int i) const { return m_hDocaRS[i]; }
235
237 double getEntaRS(int i) const { return m_hEntaRS[i]; }
238
240 int getDriftT(int i) const { return m_hDriftT[i]; }
241
243 double getDE(int i) const { return m_hdE[i]; }
244
246 double getCellHeight(int i) const { return m_hCellHeight[i]; }
247
249 double getCellHalfWidth(int i) const { return m_hCellHalfWidth[i]; }
250
252 double getDriftD(int i) const { return m_hDriftD[i]; }
253
255 double getDriftDRes(int i) const { return m_hDriftDRes[i]; }
256
258 double getWireGain(int i) const { return m_hWireGain[i]; }
259
261 double getTwoDCorrection(int i) const { return m_hTwodCor[i]; }
262
264 double getOneDCorrection(int i) const { return m_hOnedCor[i]; }
265
268 int getFoundByTrackFinder(int i) const { return m_hFoundByTrackFinder[i]; }
269
271 double getWeightPionHypo(int i) const { return m_hWeightPionHypo[i]; }
272
274 double getWeightKaonHypo(int i) const { return m_hWeightKaonHypo[i]; }
275
277 double getWeightProtonHypo(int i) const { return m_hWeightProtHypo[i]; }
278
280 double getChi(int i) const { return m_cdcChi[i]; }
281
283 double getPmean(int i) const { return m_predmean[i]; }
284
286 double getPreso(int i) const { return m_predres[i]; }
287
289 void setDedx(int i, double dedx) { m_hDedx[i] = dedx; }
290
291 private:
292
293 // hit level information
294 std::vector<int> m_hLWire;
295 std::vector<int> m_hWire;
296 std::vector<int> m_hLayer;
297 std::vector<double> m_hPath;
298 std::vector<double> m_hDedx;
299 std::vector<int> m_hADCCount;
300 std::vector<int> m_hADCBaseCount;
301 std::vector<double> m_hDoca;
302 std::vector<double> m_hEnta;
303 std::vector<double> m_hDocaRS;
304 std::vector<double> m_hEntaRS;
305 std::vector<double> m_hdE;
306 std::vector<int> m_hDriftT;
307 std::vector<double> m_hDriftD;
308 std::vector<double> m_hDriftDRes;
309 std::vector<int> m_hFoundByTrackFinder;
310 std::vector<double> m_hWeightPionHypo;
311 std::vector<double> m_hWeightKaonHypo;
312 std::vector<double> m_hWeightProtHypo;
314 std::vector<double> m_hCellHeight;
315 std::vector<double> m_hCellHalfWidth;
317 // track level information
318 double m_cosTheta;
319 double m_p;
320 double m_pCDC;
321 double m_length;
322 double m_injring;
323 double m_injtime;
327 // dE/dx simulation
328 double m_pdg;
329 double m_mcmass;
330 double m_motherPDG;
331 double m_pTrue;
333 double m_simDedx;
335 // calibration constants
338 std::vector<double> m_hWireGain;
339 std::vector<double> m_hTwodCor;
340 std::vector<double> m_hOnedCor;
342 double m_scale;
343 double m_cosCor;
345 double m_runGain;
346 double m_timeGain;
347 double m_timeReso;
349 // track level dE/dx measurements
352 double m_dedxAvg;
358 // layer level information (just don't mix with the hit arrays)
359 std::vector<int> m_lNHitsCombined;
360 std::vector<int> m_lWireLongestHit;
361 std::vector<int> m_lLayer;
362 std::vector<double> m_lPath;
363 std::vector<double> m_lDedx;
367 };
369}
This module may be used to apply the corrections to dE/dx per the calibration constants.
Module that creates PID likelihoods from CDC hit information stored in CDCDedxHits using parameterize...
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:340
double m_cdcChi[Const::ChargedStable::c_SetSize]
chi values for each particle type
Definition: CDCDedxTrack.h:350
std::vector< double > m_hDocaRS
distance of closest approach to sense wire after rescalling cell L=W
Definition: CDCDedxTrack.h:303
std::vector< double > m_hDoca
distance of closest approach to sense wire
Definition: CDCDedxTrack.h:301
std::vector< int > m_lWireLongestHit
wire id for the longest hit in the layer
Definition: CDCDedxTrack.h:360
std::vector< double > m_hDedx
charge per path length (dE/dx)
Definition: CDCDedxTrack.h:298
double m_mcmass
MC PID mass.
Definition: CDCDedxTrack.h:329
std::vector< double > m_hCellHeight
height of the CDC cell
Definition: CDCDedxTrack.h:314
double getTimeMean() const
Return the injection gain for this track.
Definition: CDCDedxTrack.h:149
int getHitLayer(int i) const
Return the (global) layer number for a hit.
Definition: CDCDedxTrack.h:210
int getADCBaseCount(int i) const
Return the base adcCount (no non-linearity) for this hit.
Definition: CDCDedxTrack.h:222
double m_cosEdgeCor
calibration cosine edge correction
Definition: CDCDedxTrack.h:344
double getSimulatedDedx() const
Get the track-level MC dE/dx mean for this track.
Definition: CDCDedxTrack.h:155
int getADCCount(int i) const
Return the adcCount for this hit.
Definition: CDCDedxTrack.h:219
std::vector< double > m_hEnta
entrance angle in CDC cell
Definition: CDCDedxTrack.h:302
double m_dedxAvgTruncated
dE/dx truncated mean per track
Definition: CDCDedxTrack.h:353
void setDedx(int i, double dedx)
Set the dE/dx value for this hit.
Definition: CDCDedxTrack.h:289
double m_p
momentum at the IP
Definition: CDCDedxTrack.h:319
void setDedxError(double error)
Set the error on the dE/dx truncated mean for this track.
Definition: CDCDedxTrack.h:164
double getDriftDRes(int i) const
Return the drift distance resolution for this hit.
Definition: CDCDedxTrack.h:255
double m_dedxAvgTruncatedErr
standard deviation of m_dedxAvgTruncated
Definition: CDCDedxTrack.h:355
double getDedxMean() const
Get the dE/dx mean for this track.
Definition: CDCDedxTrack.h:113
double getDriftD(int i) const
Return the drift distance for this hit.
Definition: CDCDedxTrack.h:252
void setSimulatedDedx(double dedx)
Set the track level MC dE/dx mean for this track.
Definition: CDCDedxTrack.h:170
int getLayer(int i) const
Return the (global) layer number for a layer hit.
Definition: CDCDedxTrack.h:187
std::vector< int > m_hLayer
layer number
Definition: CDCDedxTrack.h:296
double m_dedxAvgTruncatedNoSat
dE/dx truncated mean per track without the saturation correction
Definition: CDCDedxTrack.h:354
double getDoca(int i) const
Return the distance of closest approach to the sense wire for this hit.
Definition: CDCDedxTrack.h:228
double getDedx() const
Get dE/dx truncated mean for this track.
Definition: CDCDedxTrack.h:104
double getPath(int i) const
Return the path length through the cell for this hit.
Definition: CDCDedxTrack.h:213
int getWireInLayer(int i) const
Return the sensor ID for this hit: wire number in the layer.
Definition: CDCDedxTrack.h:204
std::vector< int > m_hADCCount
adcCount per hit
Definition: CDCDedxTrack.h:299
double getPmean(int i) const
Return the PID (predicted mean) value.
Definition: CDCDedxTrack.h:283
std::vector< double > m_hWeightKaonHypo
weight for kaon hypothesis from KalmanFitterInfo
Definition: CDCDedxTrack.h:311
double getOneDCorrection(int i) const
Return the 1D correction for this hit.
Definition: CDCDedxTrack.h:264
int getWireLongestHit(int i) const
Return the wire number of the longest hit per layer.
Definition: CDCDedxTrack.h:184
CDCDedxTrack()
Default constructor.
Definition: CDCDedxTrack.h:34
double getWeightKaonHypo(int i) const
Return the max weights from KalmanFitterInfo using kaon hypothesis.
Definition: CDCDedxTrack.h:274
int m_lNHitsUsed
number of hits on this track used for truncated mean
Definition: CDCDedxTrack.h:364
double m_simDedx
track level MC dE/dx truncated mean
Definition: CDCDedxTrack.h:333
std::vector< int > m_hADCBaseCount
adcCount base count (uncorrected) per hit
Definition: CDCDedxTrack.h:300
void setDedx(double mean)
Set the dE/dx truncated average for this track.
Definition: CDCDedxTrack.h:158
double getCosineCorrection() const
Return the cosine correction for this track.
Definition: CDCDedxTrack.h:137
double getEntaRS(int i) const
Return rescaled enta value for cell height=width assumption.
Definition: CDCDedxTrack.h:237
double getLayerDedx(int i) const
Return the total dE/dx for this layer.
Definition: CDCDedxTrack.h:193
double getCellHalfWidth(int i) const
Return the half-width of the CDC cell.
Definition: CDCDedxTrack.h:249
std::vector< int > m_hLWire
wire ID within the layer
Definition: CDCDedxTrack.h:294
std::vector< int > m_hDriftT
drift time for each hit
Definition: CDCDedxTrack.h:306
std::vector< int > m_hFoundByTrackFinder
the 'found by track finder' flag for the given hit
Definition: CDCDedxTrack.h:309
double m_cosCor
calibration cosine correction
Definition: CDCDedxTrack.h:343
double getPDG() const
Get the identity of the particle.
Definition: CDCDedxTrack.h:101
std::vector< double > m_hTwodCor
calibration 2-D correction (indexed on number of hits)
Definition: CDCDedxTrack.h:339
std::vector< double > m_hWeightPionHypo
weight for pion hypothesis from KalmanFitterInfo
Definition: CDCDedxTrack.h:310
void setDedxMean(double mean)
Set the dE/dx mean for this track.
Definition: CDCDedxTrack.h:167
std::vector< double > m_hDriftD
drift distance for each hit
Definition: CDCDedxTrack.h:307
std::vector< double > m_hDriftDRes
drift distance resolution for each hit
Definition: CDCDedxTrack.h:308
std::vector< double > m_hPath
path length in the CDC cell
Definition: CDCDedxTrack.h:297
double m_predres[Const::ChargedStable::c_SetSize]
predicted dE/dx resolution
Definition: CDCDedxTrack.h:337
double getTwoDCorrection(int i) const
Return the 2D correction for this hit.
Definition: CDCDedxTrack.h:261
double m_motherPDG
MC PID of mother particle.
Definition: CDCDedxTrack.h:330
double m_runGain
calibration run gain
Definition: CDCDedxTrack.h:345
void addDedx(int nhitscombined, int wirelongesthit, int layer, double distance, double dedxValue)
add dE/dx information for a CDC layer
Definition: CDCDedxTrack.h:53
double m_timeGain
calibration injection time gain
Definition: CDCDedxTrack.h:346
std::vector< int > m_lNHitsCombined
number of hits combined in the layer
Definition: CDCDedxTrack.h:359
double getPreso(int i) const
Return the PID (predicted reso) value.
Definition: CDCDedxTrack.h:286
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:65
int getNLayerHits() const
Return the number of layer hits for this track.
Definition: CDCDedxTrack.h:175
int getFoundByTrackFinder(int i) const
Return the TrackFinder which added the given hit to track.
Definition: CDCDedxTrack.h:268
int getDriftT(int i) const
Return the drift time for this hit.
Definition: CDCDedxTrack.h:240
double getCosTheta() const
Return cos(theta) for this track.
Definition: CDCDedxTrack.h:122
std::vector< double > m_lPath
distance flown through active medium in current segment
Definition: CDCDedxTrack.h:362
double m_timeReso
calibration injection time gain
Definition: CDCDedxTrack.h:347
double getInjectionRing() const
Return cos(theta) for this track.
Definition: CDCDedxTrack.h:131
double m_pdg
MC PID.
Definition: CDCDedxTrack.h:328
int getCharge() const
Return the charge for this track.
Definition: CDCDedxTrack.h:125
double m_cosTheta
cos(theta) for the track
Definition: CDCDedxTrack.h:318
double getWireGain(int i) const
Return the wire gain for this hit.
Definition: CDCDedxTrack.h:258
double getWeightPionHypo(int i) const
Return the max weights from KalmanFitterInfo using pion hypothesis.
Definition: CDCDedxTrack.h:271
double getTimeReso() const
Return the injection reso for this track.
Definition: CDCDedxTrack.h:152
int getWire(int i) const
Return the sensor ID for this hit: wire number for CDC (0-14336)
Definition: CDCDedxTrack.h:207
double m_scale
scale factor to make electrons ~1
Definition: CDCDedxTrack.h:342
std::vector< double > m_hWeightProtHypo
weight for proton hypothesis from KalmanFitterInfo
Definition: CDCDedxTrack.h:312
double getDocaRS(int i) const
Return rescaled doca value for cell height=width assumption.
Definition: CDCDedxTrack.h:234
std::vector< double > m_hEntaRS
entrance angle in CDC cell after rescalling cell L=W
Definition: CDCDedxTrack.h:304
double m_pCDC
momentum at the inner layer of the CDC
Definition: CDCDedxTrack.h:320
double m_length
total distance travelled by the track
Definition: CDCDedxTrack.h:321
double m_injring
injection ring type of track's event
Definition: CDCDedxTrack.h:322
double getCosEdgeCorrection() const
Return the cosine correction for this track.
Definition: CDCDedxTrack.h:140
double m_cdcLogl[Const::ChargedStable::c_SetSize]
log likelihood for each particle, not including momentum prior
Definition: CDCDedxTrack.h:351
std::vector< double > m_hWireGain
calibration hit gain (indexed on number of hits)
Definition: CDCDedxTrack.h:338
double getRunGain() const
Return the run gain for this track.
Definition: CDCDedxTrack.h:143
std::vector< double > getDedxList() const
Return the vector of dE/dx values for this track.
Definition: CDCDedxTrack.h:116
ClassDef(CDCDedxTrack, 18)
Debug output for CDCDedxPID module.
double m_dedxAvg
dE/dx mean value per track
Definition: CDCDedxTrack.h:352
void setLayerDedx(int i, double dedx)
Set the total dE/dx for this layer.
Definition: CDCDedxTrack.h:196
double getNonLADCCorrection(int i) const
Return the factor introduce for adcCount (non-linearity) correction.
Definition: CDCDedxTrack.h:225
void setDedxNoSat(double mean)
Set the dE/dx truncated average without the saturation correction for this track.
Definition: CDCDedxTrack.h:161
int m_charge
particle charge from tracking (+1 or -1)
Definition: CDCDedxTrack.h:325
std::vector< double > m_hCellHalfWidth
half-width of the CDC cell
Definition: CDCDedxTrack.h:315
double getDedxError() const
Get the error on the dE/dx truncated mean for this track.
Definition: CDCDedxTrack.h:110
double getWeightProtonHypo(int i) const
Return the max weights from KalmanFitterInfo using proton hypothesis.
Definition: CDCDedxTrack.h:277
double getEnta(int i) const
Return the entrance angle in the CDC cell for this hit.
Definition: CDCDedxTrack.h:231
double getInjectionTime() const
Return cos(theta) for this track.
Definition: CDCDedxTrack.h:128
double m_pTrue
MC true momentum.
Definition: CDCDedxTrack.h:331
int m_track
ID number of the Track.
Definition: CDCDedxTrack.h:324
double getDedx(int i) const
Return the dE/dx value for this hit.
Definition: CDCDedxTrack.h:216
double trackID() const
Return the track ID.
Definition: CDCDedxTrack.h:98
double m_injtime
time since last injection of track's event
Definition: CDCDedxTrack.h:323
double m_predmean[Const::ChargedStable::c_SetSize]
predicted dE/dx truncated mean
Definition: CDCDedxTrack.h:336
double getLayerPath(int i) const
Return the distance travelled in this layer.
Definition: CDCDedxTrack.h:190
std::vector< int > m_hWire
continuous wire ID in the CDC
Definition: CDCDedxTrack.h:295
double getChi(int i) const
Return the PID (chi) value.
Definition: CDCDedxTrack.h:280
std::vector< double > m_hdE
charge per hit
Definition: CDCDedxTrack.h:305
std::vector< double > m_lDedx
extracted dE/dx (arb.
Definition: CDCDedxTrack.h:363
double m_cosThetaTrue
MC true cos(theta)
Definition: CDCDedxTrack.h:332
double getScaleFactor() const
Return the scale factor for this track.
Definition: CDCDedxTrack.h:146
double getLength() const
Return the total path length for this track.
Definition: CDCDedxTrack.h:134
double getCellHeight(int i) const
Return the height of the CDC cell.
Definition: CDCDedxTrack.h:246
double getDE(int i) const
Return the ionization charge collected for this hit.
Definition: CDCDedxTrack.h:243
int getNHitsCombined(int i) const
Return the number of hits combined per layer.
Definition: CDCDedxTrack.h:181
double getDedxNoSat() const
Get dE/dx truncated mean without the saturation correction for this track.
Definition: CDCDedxTrack.h:107
int size() const
Return the number of hits for this track.
Definition: CDCDedxTrack.h:201
std::vector< int > m_lLayer
layer id corresponding to dedx
Definition: CDCDedxTrack.h:361
double getNLayerHitsUsed() const
Return the number of hits used to determine the truncated mean.
Definition: CDCDedxTrack.h:178
double getMomentum() const
Return the track momentum valid in the CDC.
Definition: CDCDedxTrack.h:119
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:615
Defines interface for accessing relations of objects in StoreArray.
Abstract base class for different kinds of events.