12 |
#include "TGraphAsymmErrors.h" |
#include "TGraphAsymmErrors.h" |
13 |
|
|
14 |
extern "C" { |
extern "C" { |
15 |
bool efficiency_(Int_t*, Int_t*, Double_t*, Double_t*, Double_t*); |
/*! @brief Fortran routine by Sergio Ricciarini which computes errors on the efficiency. |
16 |
|
* |
17 |
|
* This routine has been developed to carefully evaluate the error bars on the efficiency, |
18 |
|
* which must have a value between 0 and 1. See the appendix of Sergio's PhD thesis for more |
19 |
|
* details. |
20 |
|
* The important thing is that the computed efficiency will have the unphysical value 1.1 |
21 |
|
* if there are less than 8 events in the efficiency sample (eg., the sample used to compute the |
22 |
|
* efficiency). This is necessary to have a reliable estimate of the errors. |
23 |
|
* |
24 |
|
* @param sel Pointer to an Int_t variable containing the number of events in the efficiency sample. |
25 |
|
* @param det Pointer to an Int_t variable containing the number of events in the efficiency sample |
26 |
|
* which satisfied the set of cuts for which the efficiency is being measured. |
27 |
|
* @param eff Pointer to a Double_t variable where the computed efficiency will be returned. |
28 |
|
* @param errLow Pointer to a Double_t variable where the length of the lower error bar will |
29 |
|
* be returned. |
30 |
|
* @param errHigh Pointer to a Double_t variable where the length of the upper error bar will |
31 |
|
* be returned. |
32 |
|
* @return Not clear at this point... ignore it. |
33 |
|
*/ |
34 |
|
bool efficiency_(Int_t* sel, Int_t* det, Double_t* eff, Double_t* errLow, Double_t* errHigh); |
35 |
} |
} |
36 |
|
|
37 |
EffRigCollection::EffRigCollection(const char *collectionName, TString outFileBase, TString rigBinsFile, int errMethod) : |
EffRigCollection::EffRigCollection(const char *collectionName, TString outFileBase, TString rigBinsFile, int errMethod, bool owns) : |
38 |
EffCollection(collectionName, outFileBase, errMethod), _bins(0), _selVector(0), _detVector(0), _outUp(0), _outDown(0) { |
EffCollection(collectionName, outFileBase, errMethod, owns), _bins(0), _selVector(0), _detVector(0), _outUp(0), _outDown(0) { |
39 |
|
|
40 |
ifstream rigBinListFile; |
ifstream rigBinListFile; |
41 |
rigBinListFile.open(rigBinsFile); |
rigBinListFile.open(rigBinsFile); |
117 |
errGraph.SetMarkerStyle(7); |
errGraph.SetMarkerStyle(7); |
118 |
errGraph.GetYaxis()->SetRangeUser(0, 1.2); |
errGraph.GetYaxis()->SetRangeUser(0, 1.2); |
119 |
|
|
120 |
|
|
121 |
if (_errMethod == EFFERR_ROOT) { |
if (_errMethod == EFFERR_ROOT) { |
122 |
double binning[_bins.size()]; |
double binning[_bins.size()]; |
123 |
for (unsigned int i = 0; i < _bins.size(); i++) |
for (unsigned int i = 0; i < _bins.size(); i++) |
176 |
outTextFile << setw(10) << _bins[i] << setw(10) << _bins[i + 1] << setw(10) << _detVector[i] << setw(10) |
outTextFile << setw(10) << _bins[i] << setw(10) << _bins[i + 1] << setw(10) << _detVector[i] << setw(10) |
177 |
<< _selVector[i]; |
<< _selVector[i]; |
178 |
if (_selVector[i] != 0) |
if (_selVector[i] != 0) |
179 |
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]; |
180 |
else |
else |
181 |
outTextFile << setw(10) << 0. << setw(10) << 0. << setw(10) << 0. << endl; |
outTextFile << setw(10) << 0. << setw(10) << 0. << setw(10) << 0.; |
182 |
|
if (i < _selVector.size() - 1) //Avoids to print an empty line at the end of the file |
183 |
|
outTextFile << endl; |
184 |
|
|
185 |
} |
} |
186 |
|
|