1 |
pam-fi |
1.1 |
/* |
2 |
|
|
* RigFillCut.cpp |
3 |
|
|
* |
4 |
|
|
* Created on: 27-mar-2009 |
5 |
|
|
* Author: Nicola Mori, S. Ricciarini |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
/*! @file RigFillCut.cpp The TrkRigGeoCut class implementation file */ |
9 |
|
|
|
10 |
|
|
#include "RigFillCut.h" |
11 |
|
|
|
12 |
pam-fi |
1.2 |
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 |
pam-fi |
1.1 |
int RigFillCut::Check(PamLevel2 *event) { |
39 |
|
|
|
40 |
|
|
float rigThreshold = _thresholdCoeff * event->GetOrbitalInfo()->GetCutoffSVL(); |
41 |
|
|
|
42 |
|
|
if (rigThreshold > _binning[_binning.size() - 1] || rigThreshold < _binning[0]) { |
43 |
|
|
return THRESHRIGOUT; |
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
float rig = event->GetTrack(0)->GetTrkTrack()->GetRigidity(); |
47 |
|
|
|
48 |
pam-fi |
1.3 |
if (rig >= _binning[_binning.size() - 1] || rig < _binning[0]) { |
49 |
pam-fi |
1.1 |
return RIGOUT; |
50 |
|
|
} |
51 |
|
|
|
52 |
|
|
return CUTOK; |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
void RigFillCut::OnGood(PamLevel2 *event) { |
56 |
|
|
|
57 |
|
|
float rigThreshold = _thresholdCoeff * event->GetOrbitalInfo()->GetCutoffSVL(); |
58 |
|
|
float rig = event->GetTrack(0)->GetTrkTrack()->GetRigidity(); |
59 |
|
|
|
60 |
|
|
//Bin identification: value must be less than (<) bin maximum |
61 |
pam-fi |
1.2 |
|
62 |
pam-fi |
1.1 |
int i = 1; |
63 |
|
|
while (rig >= _binning[i]) { |
64 |
|
|
i++; |
65 |
|
|
} |
66 |
|
|
i--; |
67 |
|
|
|
68 |
pam-fi |
1.2 |
// cout << _binning[i] << " < " << rig << " < " << _binning[i+1] << endl; |
69 |
pam-fi |
1.1 |
|
70 |
|
|
int j = 1; |
71 |
|
|
while (rigThreshold >= _binning[j]) { |
72 |
|
|
j++; |
73 |
|
|
} |
74 |
|
|
j--; |
75 |
|
|
|
76 |
pam-fi |
1.2 |
// cout << _binning[j] << " < " << rigCutoff << " < " << _binning[j+1] << endl; |
77 |
|
|
// cout << endl; |
78 |
pam-fi |
1.1 |
|
79 |
|
|
_histogram[i][j]++; |
80 |
|
|
} |