91 cout << __func__ <<
' ' << slice <<
" start" << endl;
95 auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
98 auto isMC = metainfo.Get<
bool>(
"flags",
"isMC");
99 auto year = metainfo.Get<
int>(
"flags",
"year");
102 RecEvent * recEvt =
nullptr;
103 GenEvent * genEvt =
nullptr;
104 vector<RecJet> * recJets =
nullptr;
105 tIn->SetBranchAddress(
"recEvent", &recEvt);
107 tIn->SetBranchAddress(
"genEvent", &genEvt);
108 tIn->SetBranchAddress(
"met", &
met);
109 tIn->SetBranchAddress(
"recJets", &recJets);
111 metainfo.Set<
bool>(
"corrections",
"METfilters",
true);
112 MissingET::Filters metfilters(
year);
116 MissingET::FractionCut beforeCut(
"beforeMETcut"),
117 afterCut(
"afterMETcut");
119 ControlPlots METbefore(
"METbefore"),
120 METafterAllMETfilters(
"METafterAllMETfilters"),
121 METafterMETfraction(
"METafterMETfraction"),
122 METafterAllMETfiltersAndMETfraction(
"METafterAllMETfiltersAndMETfraction");
124 vector<ControlPlots> METfilters;
125 for (TString METname: metfilters.METnames)
126 METfilters.push_back(ControlPlots(METname));
128 auto totRecWgt = [&](
size_t i) {
129 return (
isMC ? genEvt->weights.front().v : 1) * recEvt->weights.at(i).v;
132 for (
DT::Looper looper(tIn, slice); looper(); ++looper) {
136 beforeCut.Fill(
met, recJets, totRecWgt(0));
137 METbefore(*recJets, totRecWgt(0));
140 afterCut.Fill(
met, recJets, totRecWgt(0));
141 METafterMETfraction(*recJets, totRecWgt(0));
144 for (
size_t ibit = 0; ibit < metfilters.METbitsToApply.size(); ++ibit) {
145 bool bit =
met->
Bit.at(ibit);
147 METfilters.at(ibit)(*recJets, totRecWgt(0));
154 metfilters(
met, recEvt);
156 METafterAllMETfilters(*recJets, totRecWgt(0));
159 METafterAllMETfiltersAndMETfraction(*recJets, totRecWgt(0));
164 beforeCut.Write(fOut.get());
165 afterCut.Write(fOut.get());
166 METbefore.Write(fOut.get());
167 METafterMETfraction.Write(fOut.get());
168 METafterAllMETfilters.Write(fOut.get());
169 METafterAllMETfiltersAndMETfraction.Write(fOut.get());
171 for (
auto& filt: METfilters)
172 filt.Write(fOut.get());
174 metainfo.Set<
bool>(
"git",
"complete",
true);
178 cout << __func__ <<
' ' << slice <<
" end" << endl;