32 TFile*
f = TFile::Open(inFilename.c_str(),
"UPDATE");
35 if (
f == 0 || !
f->IsOpen()) {
49 if (
f->GetSize() < 1000.) {
63 TIter next_run(
f->GetListOfKeys());
67 while ((key_run =
dynamic_cast<TKey*
>(next_run())) != 0) {
68 TObject* obj_run = key_run->ReadObj();
69 TDirectory* tdir_run =
dynamic_cast<TDirectory*
>(obj_run);
78 std::string runDirName(tdir_run->GetName());
81 if (runDirName.find(
"run") == std::string::npos) {
87 TString taumonDirName = runDirName +
"/HLT/TauMon";
88 TDirectory* taumonDir(0);
89 if (!(taumonDir =
f->GetDirectory(taumonDirName))) {
100 std::vector<TString> lvlName;
101 lvlName.push_back(
"L1");
102 lvlName.push_back(
"L2");
103 lvlName.push_back(
"EF");
105 std::vector< std::pair< int, int > > ratioIndex;
106 ratioIndex.push_back(std::make_pair(2, 0));
107 ratioIndex.push_back(std::make_pair(1, 0));
108 ratioIndex.push_back(std::make_pair(2, 1));
112 std::vector<TString> varName0;
113 varName0.push_back(
"Pt");
114 varName0.push_back(
"Eta");
115 varName0.push_back(
"Phi");
116 varName0.push_back(
"Nvtx");
118 std::vector<TString> lvlNameO;
119 lvlNameO.push_back(
"L1");
120 lvlNameO.push_back(
"L2");
121 lvlNameO.push_back(
"EF");
122 lvlNameO.push_back(
"");
124 std::vector< std::pair< int, int > > ratioIndexO;
125 ratioIndexO.push_back(std::make_pair(0, 3));
126 ratioIndexO.push_back(std::make_pair(1, 3));
127 ratioIndexO.push_back(std::make_pair(2, 3));
131 TIter next_trig(taumonDir->GetListOfKeys());
133 while ((key_trig =
dynamic_cast<TKey*
>(next_trig())) != 0) {
134 TObject* obj_trig = key_trig->ReadObj();
135 TDirectory* dir_trig =
dynamic_cast<TDirectory*
>(obj_trig);
136 if (!dir_trig)
continue;
140 HLTTauPostProcess(
f, dir_trig,
"/RelativeEfficiency",
"/RelativeEfficiency/Efficiency",
141 lvlName,
varName, ratioIndex, 1);
143 lvlNameO, varName0, ratioIndexO, 2);
144 HLTTauPostProcess(
f, dir_trig,
"/OfflineRatio/BDTMedium",
"/OfflineRatio/Ratio/BDTMedium",
145 lvlNameO, varName0, ratioIndexO, 2,
"BDTMedium");
155 TString pathApp, TString pathAppEff,
156 const std::vector<TString>& lvlN,
const std::vector<TString>& varN,
157 const std::vector< std::pair< int, int > >& ratioIndex,
int nameStyle,
166 TString basePath =
path + pathApp +
"/";
167 if (
f->cd(basePath.Data()) == 0) {
173 TH1F* hRoI[100][100];
174 for (
unsigned int iLvl = 0; iLvl < lvlN.size(); iLvl++) {
175 for (
unsigned int iVar = 0; iVar < varN.size(); iVar++) {
177 if (nameStyle == 1) hName = basePath +
"h" + lvlN[iLvl] +
"RoI" + varN[iVar] + (iLvl == 0 ?
"Denom" :
"Num") + nameApp;
178 if (nameStyle == 2) hName = basePath +
"hTau" + varN[iVar] + lvlN[iLvl] + nameApp;
183 hRoI[iLvl][iVar] = (
TH1F*) (
f->Get(hName.Data()))->Clone();
188 basePath +=
path + pathAppEff +
"/";
189 f->cd(basePath.Data());
190 TH1F* hEff[100][100];
191 for (
unsigned int iVar = 0; iVar < varN.size(); iVar++) {
192 for (
unsigned int iRatio = 0; iRatio < ratioIndex.size(); iRatio++) {
195 hName = basePath +
"h" +
196 lvlN[ ratioIndex[ iRatio ].first ] +
"vs" + lvlN[ ratioIndex[ iRatio ].second ] +
197 varN[iVar] +
"Efficiency" + nameApp;
200 hName = basePath +
"h" +
201 lvlN[ ratioIndex[ iRatio ].first ] +
"OfflineRatio" +
202 varN[iVar] + nameApp;
206 hEff[iRatio][iVar] = (
TH1F*) (
f->Get(hName.Data()));
207 hEff[iRatio][iVar]->Divide(hRoI[ ratioIndex[ iRatio ].
first ][iVar],
208 hRoI[ ratioIndex[ iRatio ].
second ][iVar],
211 hEff[iRatio][iVar]->Write(
"", TObject::kOverwrite);