98 |
errGraph.SetMarkerStyle(7); |
errGraph.SetMarkerStyle(7); |
99 |
errGraph.GetYaxis()->SetRangeUser(0, 1.2); |
errGraph.GetYaxis()->SetRangeUser(0, 1.2); |
100 |
|
|
101 |
if (_errMethod == EFFRIG_ROOT) { |
if (_errMethod == EFFERR_ROOT) { |
102 |
double binning[_bins.size()]; |
double binning[_bins.size()]; |
103 |
for (unsigned int i = 0; i < _bins.size(); i++) |
for (unsigned int i = 0; i < _bins.size(); i++) |
104 |
binning[i] = _bins[i]; |
binning[i] = _bins[i]; |
106 |
TH1I pass("pass", "pass", _bins.size() - 1, binning); |
TH1I pass("pass", "pass", _bins.size() - 1, binning); |
107 |
TH1I total("total", "total", _bins.size() - 1, binning); |
TH1I total("total", "total", _bins.size() - 1, binning); |
108 |
for (unsigned int i = 0; i < _selVector.size(); i++) { |
for (unsigned int i = 0; i < _selVector.size(); i++) { |
|
cout << (binning[i + 1] + binning[i]) / 2. << " " << det[i] << " " << sel[i] << endl; |
|
109 |
for (int j = 0; j < det[i]; j++) |
for (int j = 0; j < det[i]; j++) |
110 |
pass.Fill((binning[i + 1] + binning[i]) / 2.); |
pass.Fill((binning[i + 1] + binning[i]) / 2.); |
111 |
for (int j = 0; j < sel[i]; j++) |
for (int j = 0; j < sel[i]; j++) |
116 |
Double_t graphX; |
Double_t graphX; |
117 |
double currBin; |
double currBin; |
118 |
int currPoint = 0; |
int currPoint = 0; |
119 |
//cout << errGraph.GetN() << " " << pass.GetNbinsX() << " " << total.GetNbinsX() << endl; |
|
120 |
for (unsigned int i = 0; i < _selVector.size(); i++) { |
for (unsigned int i = 0; i < _selVector.size(); i++) { |
121 |
errGraph.GetPoint(currPoint, graphX, eff[i]); |
errGraph.GetPoint(currPoint, graphX, eff[i]); |
122 |
currBin = (binning[i + 1] + binning[i]) / 2.; |
currBin = (binning[i + 1] + binning[i]) / 2.; |
133 |
} |
} |
134 |
|
|
135 |
} |
} |
136 |
if (_errMethod == EFFRIG_SERGIO) { |
if (_errMethod == EFFERR_SERGIO) { |
137 |
for (unsigned int i = 0; i < _selVector.size(); i++) { |
for (unsigned int i = 0; i < _selVector.size(); i++) { |
138 |
efficiency_(&(sel[i]), &(det[i]), &(eff[i]), &(errLow[i]), &(errHigh[i])); |
efficiency_(&(sel[i]), &(det[i]), &(eff[i]), &(errLow[i]), &(errHigh[i])); |
139 |
|
|
140 |
|
float R = (_bins[i] + _bins[i + 1]) / 2.; |
141 |
|
float halfBin = (_bins[i + 1] - _bins[i]) / 2.; |
142 |
|
errGraph.SetPoint(i, R, eff[i]); |
143 |
|
errGraph.SetPointError(i, halfBin, halfBin, errLow[i], errHigh[i]); |
144 |
|
|
145 |
} |
} |
146 |
|
|
147 |
} |
} |
148 |
|
|
149 |
// Write the output files |
// Write the output files |
150 |
if (_outFileBase != "") { |
if (_outFileBase != "") { |
151 |
ofstream outTextFile((_outFileBase + "-eff-rig.txt").Data(), ios_base::out); |
ofstream outTextFile((_outFileBase + "-" + GetName() + "-rig.txt").Data(), ios_base::out); |
152 |
streamsize newPrec = 4; |
streamsize newPrec = 4; |
153 |
outTextFile.precision(newPrec); |
outTextFile.precision(newPrec); |
154 |
outTextFile.setf(ios::fixed, ios::floatfield); |
outTextFile.setf(ios::fixed, ios::floatfield); |
155 |
for (unsigned int i = 0; i < _selVector.size(); i++) { |
for (unsigned int i = 0; i < _selVector.size(); i++) { |
156 |
outTextFile << setw(10) << _detVector[i] << setw(10) << _selVector[i]; |
outTextFile << setw(10) << _bins[i] << setw(10) << _bins[i + 1] << setw(10) << _detVector[i] << setw(10) |
157 |
|
<< _selVector[i]; |
158 |
if (_selVector[i] != 0) |
if (_selVector[i] != 0) |
159 |
outTextFile << setw(10) << eff[i] << setw(10) << errLow[i] << setw(10) << errHigh[i] << "\n"; |
outTextFile << setw(10) << eff[i] << setw(10) << errLow[i] << setw(10) << errHigh[i] << "\n"; |
160 |
else |
else |
163 |
} |
} |
164 |
|
|
165 |
outTextFile.close(); |
outTextFile.close(); |
166 |
if (_errMethod == EFFRIG_ROOT) { |
|
167 |
TFile outRootFile((_outFileBase + "-eff-rig.root"), "RECREATE"); |
TFile outRootFile((_outFileBase + "-" + GetName() + "-rig.root"), "RECREATE"); |
168 |
outRootFile.cd(); |
outRootFile.cd(); |
169 |
errGraph.Write(); |
errGraph.Write(); |
170 |
outRootFile.Close(); |
outRootFile.Close(); |
171 |
} |
|
172 |
} |
} |
173 |
|
|
174 |
} |
} |