42 assert(fs::exists(file));
43 auto f = make_unique<TFile>(file.c_str(),
"READ");
45 int firsttrigger = triggers_lumi.begin()->first;
47 for (
auto trigger_lumi: triggers_lumi) {
48 int trigger = trigger_lumi.first,
49 turnon = trigger_lumi.second.turnon;
51 const char *
method = trigger == firsttrigger ?
"TnP" :
"emulation";
52 auto hIn = unique_ptr<TH2>(
f->Get<TH2>(Form(
"%s/HLT%d/efficiency",
method, trigger)));
53 if (hIn.get() ==
nullptr) {
54 cerr <<
red <<
"No efficiency found for trigger " << trigger <<
normal <<
'\n';
58 cout <<
"Getting efficiency for trigger " << trigger <<
": " << hIn.get() << endl;
60 assert(hIn->GetNbinsX() ==
h->GetNbinsX());
62 int I =
h->GetXaxis()->FindBin(turnon);
64 for (
int iy = 1; iy <=
nYbins; ++iy)
65 for (
int ipt = I; ipt <=
h->GetNbinsX(); ++ipt) {
66 double content = hIn->GetBinContent(ipt, iy),
67 error = hIn->GetBinError (ipt, iy);
68 h->SetBinContent(ipt, iy, content);
69 h->SetBinError (ipt, iy, error );
72 auto name = Form(
"HLT%d", trigger);
73 auto hContrib =
dynamic_cast<TH2*
>(hIn->Clone(
name));
74 hContrib->SetDirectory(0);
81 auto lasttrigger = prev(triggers_lumi.end())->first;
82 for (
int iy = 1; iy <=
nYbins; ++iy) {
83 double turnon = triggers_lumi.at(lasttrigger).turnon;
84 int ipt =
h->GetXaxis()->FindBin(turnon);
87 while (ipt <= h->GetNbinsX()) {
88 double content =
h->GetBinContent(ipt, iy);
89 if (content > 0.9995)
break;
93 while (ipt <= h->GetNbinsX()) {
94 h->SetBinContent(ipt,iy,1);
95 h->SetBinError (ipt,iy,0);