91 cout << __func__ <<
' ' << slice <<
" start" << endl;
94 auto tIn = flow.GetInputTree(
inputs, slice);
95 auto [fOut, tOut] = flow.GetOutput(output);
98 auto isMC = metainfo.Get<
bool>(
"flags",
"isMC");
99 auto year = metainfo.Get<
int>(
"flags",
"year");
101 auto gEv =
isMC ? flow.GetBranchReadOnly<GenEvent>(
"genEvent") :
nullptr;
102 auto rEv = flow.GetBranchReadOnly<RecEvent>(
"recEvent");
103 auto met = flow.GetBranchReadOnly<MET >(
"met" );
104 auto recJets = flow.GetBranchReadOnly<vector<RecJet>>(
"recJets");
106 metainfo.Set<
bool>(
"corrections",
"METfilters",
true);
107 MissingET::Filters metfilters(
year);
111 MissingET::FractionCut beforeCut(
"beforeMETcut"),
112 afterCut(
"afterMETcut");
114 ControlPlots METbefore(
"METbefore"),
115 METafterAllMETfilters(
"METafterAllMETfilters"),
116 METafterMETfraction(
"METafterMETfraction"),
117 METafterAllMETfiltersAndMETfraction(
"METafterAllMETfiltersAndMETfraction");
119 vector<ControlPlots> METfilters;
120 for (TString METname: metfilters.METnames)
121 METfilters.push_back(ControlPlots(METname));
123 auto totRecWgt = [&](
size_t i) {
124 return (
isMC ? gEv->weights.front().v : 1) * rEv->weights.at(i).v;
127 for (
DT::Looper looper(tIn); looper(); ++looper) {
131 beforeCut.Fill(
met, recJets, totRecWgt(0));
132 METbefore(*recJets, totRecWgt(0));
135 afterCut.Fill(
met, recJets, totRecWgt(0));
136 METafterMETfraction(*recJets, totRecWgt(0));
139 for (
size_t ibit = 0; ibit < metfilters.METbitsToApply.size(); ++ibit) {
140 bool bit =
met->
Bit.at(ibit);
142 METfilters.at(ibit)(*recJets, totRecWgt(0));
149 metfilters(
met, rEv);
151 METafterAllMETfilters(*recJets, totRecWgt(0));
154 METafterAllMETfiltersAndMETfraction(*recJets, totRecWgt(0));
156 if (steering &
DT::fill) tOut->Fill();
159 beforeCut.Write(fOut);
160 afterCut.Write(fOut);
161 METbefore.Write(fOut);
162 METafterMETfraction.Write(fOut);
163 METafterAllMETfilters.Write(fOut);
164 METafterAllMETfiltersAndMETfraction.Write(fOut);
166 for (
auto& filt: METfilters)
169 metainfo.Set<
bool>(
"git",
"complete",
true);
171 cout << __func__ <<
' ' << slice <<
" end" << endl;