29 TDirectory* off_dir,
const TString& pathNum,
30 const TString& pathEff,
const std::vector<TString>&
varName) {
32 std::string chain_path =
getPath(trig_dir);
33 std::string offline_path =
getPath(off_dir);
36 TString basePath = chain_path +
"/PassedChain/";
37 if (
f->cd(basePath.Data()) == 0) {
38 std::cerr <<
"----> HLTEgammaPostProcess: basePath not found in "
39 << chain_path <<
", skipping now!\n";
46 TH1F* histo_matrix[3][3];
50 std::cerr <<
"----> HLTEgammaPostProcess: Too many variables "
51 <<
"used in " << chain_path +
"/PassedChain/" + pathEff
52 <<
" for bootstrap efficiencies, skipping now!\n";
58 for (
uint iVar = 0; iVar <
varName.size(); ++iVar) {
60 TString numName = basePath + pathNum +
"eg" +
varName[iVar];
61 TString denName = offline_path +
"/" +
"eg" +
varName[iVar];
62 TString effName = basePath + pathEff +
"eg" +
varName[iVar];
66 std::cerr <<
"----> HLTEgammaPostProcess: Histogram "
67 << numName <<
" does not exist in file "
68 <<
f->GetName() <<
" - skipping!\n";
72 std::cerr <<
"----> HLTEgammaPostProcess: Histogram "
73 << denName <<
" does not exist in file "
74 <<
f->GetName() <<
" - skipping!\n";
78 std::cerr <<
"----> HLTEgammaPostProcess: Histogram "
79 << effName <<
" does not exist in file "
80 <<
f->GetName() <<
" - skipping!\n";
89 histo_matrix[iVar][0] = (
TH1F*) (
f->Get(numName.Data()));
90 histo_matrix[iVar][1] = (
TH1F*) (
f->Get(denName.Data()));
91 histo_matrix[iVar][2] = (
TH1F*) (
f->Get(effName.Data()));
94 TString writePath = basePath + pathEff;
95 f->cd(writePath.Data());
98 histo_matrix[iVar][2]->Divide(histo_matrix[iVar][0], histo_matrix[iVar][1],
100 histo_matrix[iVar][2]->Scale(100.);
101 if (histo_matrix[iVar][2]->Write(
"",
102 TObject::kOverwrite) ==
103 0) std::cerr <<
"----> HLTEgammaPostProcess: Efficiency histogram "
105 " not written! Histogram will be buggy!\n";
117 const TString& pathPre,
const TString& pathRej,
118 const std::vector<TString>& objStage,
119 const std::vector<TString>&
varName) {
120 std::string chain_path =
getPath(trig_dir);
127 TString basePath = chain_path +
"/PassedChain/";
128 if (
f->cd(basePath.Data()) == 0) {
129 std::cerr <<
"----> HLTEgammaPostProcess: basePath not found in "
130 << chain_path <<
", skipping now!\n";
138 TH1F* histo_tensor[5][3][3];
141 if (objStage.size() > 5) {
142 std::cerr <<
"----> HLTEgammaPostProcess: Too many chain stages "
143 <<
"found in " << chain_path <<
" for relative efficiencies, bailing it!\n";
147 std::cerr <<
"----> HLTEgammaPostProcess: Too many variables "
148 <<
"used in " << chain_path <<
" for relative efficiencies, bailing out!\n";
154 for (
uint iVar = 0; iVar <
varName.size(); ++iVar) {
156 for (
uint iStg = 1; iStg < objStage.size(); ++iStg) {
158 TString preName = basePath + pathPre + objStage[iStg - 1] +
varName[iVar];
159 TString rejName = basePath + pathPre + objStage[iStg] +
varName[iVar];
160 TString effName = basePath + pathRej + objStage[iStg] +
varName[iVar];
163 std::cerr <<
"----> HLTEgammaPostProcess: Histogram "
164 << rejName <<
" does not exist in file "
165 <<
f->GetName() <<
" - skipping it!\n";
169 std::cerr <<
"----> HLTEgammaPostProcess: Histogram "
170 << preName <<
" does not exist in file "
171 <<
f->GetName() <<
" - skipping it!\n";
175 std::cerr <<
"----> HLTEgammaPostProcess: Histogram "
176 << effName <<
" does not exist in file "
177 <<
f->GetName() <<
" - skipping it!\n";
186 histo_tensor[iStg][iVar][0] = (
TH1F*) (
f->Get(rejName.Data()));
187 histo_tensor[iStg][iVar][1] = (
TH1F*) (
f->Get(preName.Data()));
188 histo_tensor[iStg][iVar][2] = (
TH1F*) (
f->Get(effName.Data()));
191 TString writePath = basePath + pathRej;
192 f->cd(writePath.Data());
195 histo_tensor[iStg][iVar][2]->Divide(histo_tensor[iStg][iVar][0], histo_tensor[iStg][iVar][1],
197 histo_tensor[iStg][iVar][2]->Scale(100.);
198 if (histo_tensor[iStg][iVar][2]->Write(
"", TObject::kOverwrite) == 0) std::cerr
199 <<
"---->HLTEgammaPostProcess: Relative efficiency histogram "
200 << effName <<
" not written! Histograms will be buggy!\n";