Obtain photon plots.
123 cout << __func__ <<
' ' << slice <<
" start" << endl;
126 auto tIn = flow.GetInputTree(
inputs, slice);
127 auto [fOut,tOut] = flow.GetOutput(output);
130 auto isMC = metainfo.Get<
bool>(
"flags",
"isMC");
132 BOOST_THROW_EXCEPTION( invalid_argument(
"Only for MC samples") );
134 auto recEvt = flow.GetBranchReadOnly<RecEvent>(
"recEvent");
135 auto genEvt = flow.GetBranchReadOnly<GenEvent>(
"genEvent");
137 auto recPhotons = flow.GetBranchReadOnly<vector<RecPhoton>>(
"recPhotons");
138 auto genPhotons = flow.GetBranchReadOnly<vector<GenPhoton>>(
"genPhotons");
140 map<TString, PerformanceHist> histograms;
141 for (TString level: {
"rec",
"gen"})
142 for (TString region: {
"barrel",
"endcaps"}) {
143 TString
name = region +
'_' + level;
144 histograms.insert({
name, PerformanceHist(
name)});
146 histograms.insert({
name, PerformanceHist(
name)});
149 vector<double> eff_binning {0, 10, 20, 35, 50, 65, 80, 100, 120, 150, 200, 500};
150 TEfficiency barrel_eff_pt(
"barrel_eff_pt",
"", eff_binning.size()-1, eff_binning.data()),
151 endcaps_eff_pt(
"endcaps_eff_pt",
"", eff_binning.size()-1, eff_binning.data());
153 for (
DT::Looper looper(tIn); looper(); ++looper) {
158 for (
const auto& genPhoton : *genPhotons) {
159 const float maxBarrelAbsEta = 1.48,
160 maxEndcapAbsEta = 3.0;
161 const float minPt = 20;
163 if (genPhoton.CorrPt() <
minPt)
continue;
166 double w_gen_ev = genEvt->weights.front(),
167 w_rec_ev = recEvt->weights.front();
170 if (abs(genPhoton.CorrP4().Eta()) < maxBarrelAbsEta)
171 Fill(genPhoton, *recPhotons,
minPt, 0., maxBarrelAbsEta,
172 w_gen_ev, w_rec_ev, histograms,
"barrel", barrel_eff_pt);
174 else if (abs(genPhoton.CorrP4().Eta()) < maxEndcapAbsEta)
175 Fill(genPhoton, *recPhotons,
minPt, maxBarrelAbsEta, maxEndcapAbsEta,
176 w_gen_ev, w_rec_ev, histograms,
"endcaps", endcaps_eff_pt);
180 for (
auto& h: histograms)
181 h.second.Write(fOut);
183 for (
auto eff: {&barrel_eff_pt, &endcaps_eff_pt}) {
184 eff->SetDirectory(fOut);
188 metainfo.Set<
bool>(
"git",
"complete",
true);
190 cout << __func__ <<
' ' << slice <<
" stop" << endl;