9 |
|
|
10 |
#include "RigFillCut.h" |
#include "RigFillCut.h" |
11 |
|
|
12 |
|
RigFillCut::RigFillCut(const char *cutName, const char* rigBinListFileName, float thresholdCoeff) : |
13 |
|
PamCut(cutName), _binning(0), _histogram(0, 0, 0), _thresholdCoeff(thresholdCoeff) { |
14 |
|
|
15 |
|
ifstream rigBinList; |
16 |
|
rigBinList.open(rigBinListFileName); |
17 |
|
TString bin; |
18 |
|
|
19 |
|
while (!rigBinList.eof()) { |
20 |
|
rigBinList >> bin; |
21 |
|
if (bin != "") { |
22 |
|
_binning.push_back(bin.Atof()); |
23 |
|
#ifdef DEBUGPAMCUT |
24 |
|
cout << "Bin: " << bin.Atof() << endl; |
25 |
|
#endif |
26 |
|
} |
27 |
|
} |
28 |
|
|
29 |
|
rigBinList.close(); |
30 |
|
|
31 |
|
_histogram.Resize(_binning.size() - 1, _binning.size() - 1, 0); |
32 |
|
|
33 |
|
#ifdef DEBUGPAMCUT |
34 |
|
cout << "\nNumber of bins: " << _binning.size() << endl; |
35 |
|
#endif |
36 |
|
} |
37 |
|
|
38 |
int RigFillCut::Check(PamLevel2 *event) { |
int RigFillCut::Check(PamLevel2 *event) { |
39 |
|
|
40 |
float rigThreshold = _thresholdCoeff * event->GetOrbitalInfo()->GetCutoffSVL(); |
float rigThreshold = _thresholdCoeff * event->GetOrbitalInfo()->GetCutoffSVL(); |
58 |
float rig = event->GetTrack(0)->GetTrkTrack()->GetRigidity(); |
float rig = event->GetTrack(0)->GetTrkTrack()->GetRigidity(); |
59 |
|
|
60 |
//Bin identification: value must be less than (<) bin maximum |
//Bin identification: value must be less than (<) bin maximum |
61 |
|
|
62 |
int i = 1; |
int i = 1; |
63 |
while (rig >= _binning[i]) { |
while (rig >= _binning[i]) { |
64 |
i++; |
i++; |
65 |
} |
} |
66 |
i--; |
i--; |
67 |
|
|
68 |
// cout << _binning[i] << " < " << rig << " < " << _binning[i+1] << endl; |
// cout << _binning[i] << " < " << rig << " < " << _binning[i+1] << endl; |
69 |
|
|
70 |
int j = 1; |
int j = 1; |
71 |
while (rigThreshold >= _binning[j]) { |
while (rigThreshold >= _binning[j]) { |
73 |
} |
} |
74 |
j--; |
j--; |
75 |
|
|
76 |
// cout << _binning[j] << " < " << rigCutoff << " < " << _binning[j+1] << endl; |
// cout << _binning[j] << " < " << rigCutoff << " < " << _binning[j+1] << endl; |
77 |
// cout << endl; |
// cout << endl; |
78 |
|
|
79 |
_histogram[i][j]++; |
_histogram[i][j]++; |
80 |
} |
} |