37 bool dbgLevel =
false;
39 if (dbgLevel) std::cout <<
"--> HLTJetCalcEfficiencyAndRate: Calculate jet trigger efficiency and rate" << std::endl;
42 TIter next_run(
f->GetListOfKeys());
44 while ((key_run =
dynamic_cast<TKey*
> (next_run())) != 0) {
45 if (!key_run->IsFolder())
continue;
46 run_dir = key_run->GetName();
47 if (!run_dir.Contains(
"run")) {
52 std::string run_dir2 = run_dir.Data();
57 TString jetmon_dir = run_dir +
"/HLT/JetMon";
60 TString akt4topo_dir = jetmon_dir +
"/AntiKt4TopoJets/TrigEff";
65 if (!(
dir =
f->GetDirectory(akt4topo_dir))) {
66 std::cerr <<
"--> HLTJetCalcEfficiencyAndRate: directory " << akt4topo_dir <<
" not found." << std::endl;
75 std::vector<TString> effobs;
76 effobs.push_back(
"_Eff_vs_pt");
77 effobs.push_back(
"_Eff_vs_eta");
78 effobs.push_back(
"_Eff_vs_phi");
80 std::vector<TString> TrigItems;
86 TrigItems.push_back(
"EF_fj30");
87 TrigItems.push_back(
"EF_j30");
88 TrigItems.push_back(
"EF_j240");
96 TrigItems.push_back(
"L1_FJ10");
97 TrigItems.push_back(
"L1_J10");
98 TrigItems.push_back(
"L1_J75");
109 TrigItems.push_back(
"L2_fj25");
110 TrigItems.push_back(
"L2_j25");
111 TrigItems.push_back(
"L2_j95");
117 TString snum, sden, hnumname;
120 hnumname = (*itT) + (*itO) +
"_num";
121 snum = akt4topo_dir +
"/" + hnumname;
122 sden = akt4topo_dir +
"/" + (*itT) + (*itO) +
"_den";
125 if (dbgLevel) std::cerr <<
"--> HLTJetPostProcess: no such histogram " << snum << std::endl;
128 if (dbgLevel) std::cerr <<
"--> HLTJetPostProcess: no such histogram " << sden << std::endl;
131 if (
f->Get(snum) &&
f->Get(sden)) {
132 hnum =
dynamic_cast<TH1F*
>(
f->Get(snum));
134 hden =
dynamic_cast<TH1F*
>(
f->Get(sden));
137 Int_t nbins_num = hnum->GetNbinsX();
138 Int_t nbins_den = hden->GetNbinsX();
139 if (nbins_num != nbins_den) {
140 if (dbgLevel) std::cerr <<
"--> HLTJetPostProcess: cannot divide histogram " << hnum->GetName()
141 <<
" by " << hden->GetName() <<
". Different number of bins." << std::endl;
146 hnum->Divide(hnum, hden, 1., 1.,
"B");
149 hnum->Write(
"", TObject::kOverwrite);
207 if (hnum == 0 || hden == 0)
return -1;
209 Int_t nbins_num = hnum->GetNbinsX();
210 Int_t nbins_den = hden->GetNbinsX();
212 if (nbins_num != nbins_den)
return -2;
214 if (hden->GetEntries() == 0)
return -3;
217 for (Int_t
i = -1;
i <= nbins_num; ++
i) {
218 float n = hden->GetBinContent(
i);
219 if (
n == 0)
continue;
220 float k = hnum->GetBinContent(
i);
221 if (
k < 0 ||
n < 0) {
223 <<
" for histograms " << hnum->GetName() <<
" , " << hden->GetName() << std::endl;
226 float num1 = (
k + 1) * (
k + 2);
227 float den1 = (
n + 2) * (
n + 3);
228 float num2 = (
k + 1) * (
k + 1);
229 float den2 = (
n + 2) * (
n + 2);
230 float variance = num1 / den1 - num2 / den2;
231 float err = sqrt(variance);
234 Int_t num_err = (Int_t)
errors.size();
236 if (num_err != nbins_num)
retval = -4;