37 std::string inputMETCollectionLabel(inputMETLabel_.label());
42 isMiniAODMET = (
std::string(
"miniaod") == METType_);
46 caloMETsToken_ = consumes<reco::CaloMETCollection>(inputMETLabel_);
48 pfMETsToken_ = consumes<reco::PFMETCollection>(inputMETLabel_);
50 patMETToken_ = consumes<pat::METCollection>(inputMETLabel_);
52 genMETsToken_ = consumes<reco::GenMETCollection>(inputMETLabel_);
54 genMETsTrueToken_ = consumes<reco::GenMETCollection>(
edm::InputTag(
"genMetTrue"));
55 genMETsCaloToken_ = consumes<reco::GenMETCollection>(
edm::InputTag(
"genMetCalo"));
70 mMETDifference_GenMETTrue =
nullptr;
71 mMETDeltaPhi_GenMETTrue =
nullptr;
72 mMETDifference_GenMETCalo =
nullptr;
73 mMETDeltaPhi_GenMETCalo =
nullptr;
76 mMETUnc_JetResUp =
nullptr;
77 mMETUnc_JetResDown =
nullptr;
78 mMETUnc_JetEnUp =
nullptr;
79 mMETUnc_JetEnDown =
nullptr;
80 mMETUnc_MuonEnUp =
nullptr;
81 mMETUnc_MuonEnDown =
nullptr;
82 mMETUnc_ElectronEnUp =
nullptr;
83 mMETUnc_ElectronEnDown =
nullptr;
84 mMETUnc_TauEnUp =
nullptr;
85 mMETUnc_TauEnDown =
nullptr;
86 mMETUnc_UnclusteredEnUp =
nullptr;
87 mMETUnc_UnclusteredEnDown =
nullptr;
88 mMETUnc_PhotonEnUp =
nullptr;
89 mMETUnc_PhotonEnDown =
nullptr;
92 mCaloMaxEtInEmTowers =
nullptr;
93 mCaloMaxEtInHadTowers =
nullptr;
94 mCaloEtFractionHadronic =
nullptr;
95 mCaloEmEtFraction =
nullptr;
96 mCaloHadEtInHB =
nullptr;
97 mCaloHadEtInHO =
nullptr;
98 mCaloHadEtInHE =
nullptr;
99 mCaloHadEtInHF =
nullptr;
100 mCaloEmEtInHF =
nullptr;
101 mCaloSETInpHF =
nullptr;
102 mCaloSETInmHF =
nullptr;
103 mCaloEmEtInEE =
nullptr;
104 mCaloEmEtInEB =
nullptr;
107 mNeutralEMEtFraction =
nullptr;
108 mNeutralHadEtFraction =
nullptr;
109 mChargedEMEtFraction =
nullptr;
110 mChargedHadEtFraction =
nullptr;
111 mMuonEtFraction =
nullptr;
112 mInvisibleEtFraction =
nullptr;
117 mMETDifference_GenMETTrue_MET0to20 =
nullptr;
118 mMETDifference_GenMETTrue_MET20to40 =
nullptr;
119 mMETDifference_GenMETTrue_MET40to60 =
nullptr;
120 mMETDifference_GenMETTrue_MET60to80 =
nullptr;
121 mMETDifference_GenMETTrue_MET80to100 =
nullptr;
122 mMETDifference_GenMETTrue_MET100to150 =
nullptr;
123 mMETDifference_GenMETTrue_MET150to200 =
nullptr;
124 mMETDifference_GenMETTrue_MET200to300 =
nullptr;
125 mMETDifference_GenMETTrue_MET300to400 =
nullptr;
126 mMETDifference_GenMETTrue_MET400to500 =
nullptr;
127 mMETDifference_GenMETTrue_MET500 =
nullptr;
132 mNvertex = ibooker.
book1D(
"Nvertex",
"Nvertex", 80, 0, 80);
133 mMEx = ibooker.
book1D(
"MEx",
"MEx", 160, -800, 800);
134 mMEy = ibooker.
book1D(
"MEy",
"MEy", 160, -800, 800);
135 mMETSig = ibooker.
book1D(
"METSig",
"METSig", 25, 0, 24.5);
136 mMET = ibooker.
book1D(
"MET",
"MET (20 GeV binning)", 100, 0, 2000);
137 mMETFine = ibooker.
book1D(
"METFine",
"MET (2 GeV binning)", 1000, 0, 2000);
138 mMET_Nvtx = ibooker.
bookProfile(
"MET_Nvtx",
"MET vs. nvtx", 60, 0., 60., 0., 2000.,
" ");
139 mMETPhi = ibooker.
book1D(
"METPhi",
"METPhi", 80, -4, 4);
140 mSumET = ibooker.
book1D(
"SumET",
"SumET", 200, 0, 4000);
141 mMETDifference_GenMETTrue = ibooker.
book1D(
"METDifference_GenMETTrue",
"METDifference_GenMETTrue", 500, -500, 500);
142 mMETDeltaPhi_GenMETTrue = ibooker.
book1D(
"METDeltaPhi_GenMETTrue",
"METDeltaPhi_GenMETTrue", 80, 0, 4);
145 mMETUnc_JetResUp = ibooker.
book1D(
"METUnc_JetResUp",
"METUnc_JetResUp", 200, -10, 10);
146 mMETUnc_JetResDown = ibooker.
book1D(
"METUnc_JetResDown",
"METUnc_JetResDown", 200, -10, 10);
147 mMETUnc_JetEnUp = ibooker.
book1D(
"METUnc_JetEnUp",
"METUnc_JetEnUp", 200, -10, 10);
148 mMETUnc_JetEnDown = ibooker.
book1D(
"METUnc_JetEnDown",
"METUnc_JetEnDown", 200, -10, 10);
149 mMETUnc_MuonEnUp = ibooker.
book1D(
"METUnc_MuonEnUp",
"METUnc_MuonEnUp", 200, -10, 10);
150 mMETUnc_MuonEnDown = ibooker.
book1D(
"METUnc_MuonEnDown",
"METUnc_MuonEnDown", 200, -10, 10);
151 mMETUnc_ElectronEnUp = ibooker.
book1D(
"METUnc_ElectronEnUp",
"METUnc_ElectronEnUp", 200, -10, 10);
152 mMETUnc_ElectronEnDown = ibooker.
book1D(
"METUnc_ElectronEnDown",
"METUnc_ElectronEnDown", 200, -10, 10);
153 mMETUnc_TauEnUp = ibooker.
book1D(
"METUnc_TauEnUp",
"METUnc_TauEnUp", 200, -10, 10);
154 mMETUnc_TauEnDown = ibooker.
book1D(
"METUnc_TauEnDown",
"METUnc_TauEnDown", 200, -10, 10);
155 mMETUnc_UnclusteredEnUp = ibooker.
book1D(
"METUnc_UnclusteredEnUp",
"METUnc_UnclusteredEnUp", 200, -10, 10);
156 mMETUnc_UnclusteredEnDown = ibooker.
book1D(
"METUnc_UnclusteredEnDown",
"METUnc_UnclusteredEnDown", 200, -10, 10);
157 mMETUnc_PhotonEnUp = ibooker.
book1D(
"METUnc_UnclusteredEnDown",
"METUnc_UnclusteredEnDown", 200, -10, 10);
158 mMETUnc_PhotonEnDown = ibooker.
book1D(
"METUnc_PhotonEnDown",
"METUnc_PhotonEnDown", 200, -10, 10);
161 mMETDifference_GenMETCalo = ibooker.
book1D(
"METDifference_GenMETCalo",
"METDifference_GenMETCalo", 500, -500, 500);
162 mMETDeltaPhi_GenMETCalo = ibooker.
book1D(
"METDeltaPhi_GenMETCalo",
"METDeltaPhi_GenMETCalo", 80, 0, 4);
165 mMETDifference_GenMETTrue_MET0to20 =
166 ibooker.
book1D(
"METResolution_GenMETTrue_MET0to20",
"METResolution_GenMETTrue_MET0to20", 500, -500, 500);
167 mMETDifference_GenMETTrue_MET20to40 =
168 ibooker.
book1D(
"METResolution_GenMETTrue_MET20to40",
"METResolution_GenMETTrue_MET20to40", 500, -500, 500);
169 mMETDifference_GenMETTrue_MET40to60 =
170 ibooker.
book1D(
"METResolution_GenMETTrue_MET40to60",
"METResolution_GenMETTrue_MET40to60", 500, -500, 500);
171 mMETDifference_GenMETTrue_MET60to80 =
172 ibooker.
book1D(
"METResolution_GenMETTrue_MET60to80",
"METResolution_GenMETTrue_MET60to80", 500, -500, 500);
173 mMETDifference_GenMETTrue_MET80to100 =
174 ibooker.
book1D(
"METResolution_GenMETTrue_MET80to100",
"METResolution_GenMETTrue_MET80to100", 500, -500, 500);
175 mMETDifference_GenMETTrue_MET100to150 =
176 ibooker.
book1D(
"METResolution_GenMETTrue_MET100to150",
"METResolution_GenMETTrue_MET100to150", 500, -500, 500);
177 mMETDifference_GenMETTrue_MET150to200 =
178 ibooker.
book1D(
"METResolution_GenMETTrue_MET150to200",
"METResolution_GenMETTrue_MET150to200", 500, -500, 500);
179 mMETDifference_GenMETTrue_MET200to300 =
180 ibooker.
book1D(
"METResolution_GenMETTrue_MET200to300",
"METResolution_GenMETTrue_MET200to300", 500, -500, 500);
181 mMETDifference_GenMETTrue_MET300to400 =
182 ibooker.
book1D(
"METResolution_GenMETTrue_MET300to400",
"METResolution_GenMETTrue_MET300to400", 500, -500, 500);
183 mMETDifference_GenMETTrue_MET400to500 =
184 ibooker.
book1D(
"METResolution_GenMETTrue_MET400to500",
"METResolution_GenMETTrue_MET400to500", 500, -500, 500);
185 mMETDifference_GenMETTrue_MET500 =
186 ibooker.
book1D(
"METResolution_GenMETTrue_MET500",
"METResolution_GenMETTrue_MET500", 500, -500, 500);
189 mCaloMaxEtInEmTowers = ibooker.
book1D(
"CaloMaxEtInEmTowers",
"CaloMaxEtInEmTowers", 300, 0, 1500);
190 mCaloMaxEtInHadTowers = ibooker.
book1D(
"CaloMaxEtInHadTowers",
"CaloMaxEtInHadTowers", 300, 0, 1500);
191 mCaloEtFractionHadronic = ibooker.
book1D(
"CaloEtFractionHadronic",
"CaloEtFractionHadronic", 100, 0, 1);
192 mCaloEmEtFraction = ibooker.
book1D(
"CaloEmEtFraction",
"CaloEmEtFraction", 100, 0, 1);
193 mCaloHadEtInHB = ibooker.
book1D(
"CaloHadEtInHB",
"CaloHadEtInHB", 200, 0, 2000);
194 mCaloHadEtInHE = ibooker.
book1D(
"CaloHadEtInHE",
"CaloHadEtInHE", 100, 0, 500);
195 mCaloHadEtInHO = ibooker.
book1D(
"CaloHadEtInHO",
"CaloHadEtInHO", 100, 0, 200);
196 mCaloHadEtInHF = ibooker.
book1D(
"CaloHadEtInHF",
"CaloHadEtInHF", 100, 0, 200);
197 mCaloSETInpHF = ibooker.
book1D(
"CaloSETInpHF",
"CaloSETInpHF", 100, 0, 500);
198 mCaloSETInmHF = ibooker.
book1D(
"CaloSETInmHF",
"CaloSETInmHF", 100, 0, 500);
199 mCaloEmEtInEE = ibooker.
book1D(
"CaloEmEtInEE",
"CaloEmEtInEE", 100, 0, 500);
200 mCaloEmEtInEB = ibooker.
book1D(
"CaloEmEtInEB",
"CaloEmEtInEB", 100, 0, 500);
201 mCaloEmEtInHF = ibooker.
book1D(
"CaloEmEtInHF",
"CaloEmEtInHF", 100, 0, 500);
205 mNeutralEMEtFraction = ibooker.
book1D(
"GenNeutralEMEtFraction",
"GenNeutralEMEtFraction", 120, 0.0, 1.2);
206 mNeutralHadEtFraction = ibooker.
book1D(
"GenNeutralHadEtFraction",
"GenNeutralHadEtFraction", 120, 0.0, 1.2);
207 mChargedEMEtFraction = ibooker.
book1D(
"GenChargedEMEtFraction",
"GenChargedEMEtFraction", 120, 0.0, 1.2);
208 mChargedHadEtFraction = ibooker.
book1D(
"GenChargedHadEtFraction",
"GenChargedHadEtFraction", 120, 0.0, 1.2);
209 mMuonEtFraction = ibooker.
book1D(
"GenMuonEtFraction",
"GenMuonEtFraction", 120, 0.0, 1.2);
210 mInvisibleEtFraction = ibooker.
book1D(
"GenInvisibleEtFraction",
"GenInvisibleEtFraction", 120, 0.0, 1.2);
213 if (isPFMET || isMiniAODMET) {
214 mPFphotonEtFraction = ibooker.
book1D(
"photonEtFraction",
"photonEtFraction", 100, 0, 1);
215 mPFneutralHadronEtFraction = ibooker.
book1D(
"neutralHadronEtFraction",
"neutralHadronEtFraction", 100, 0, 1);
216 mPFelectronEtFraction = ibooker.
book1D(
"electronEtFraction",
"electronEtFraction", 100, 0, 1);
217 mPFchargedHadronEtFraction = ibooker.
book1D(
"chargedHadronEtFraction",
"chargedHadronEtFraction", 100, 0, 1);
218 mPFHFHadronEtFraction = ibooker.
book1D(
"HFHadronEtFraction",
"HFHadronEtFraction", 100, 0, 1);
219 mPFmuonEtFraction = ibooker.
book1D(
"muonEtFraction",
"muonEtFraction", 100, 0, 1);
220 mPFHFEMEtFraction = ibooker.
book1D(
"HFEMEtFraction",
"HFEMEtFraction", 100, 0, 1);
223 mPFphotonEt = ibooker.
book1D(
"photonEt",
"photonEt", 100, 0, 1000);
224 mPFneutralHadronEt = ibooker.
book1D(
"neutralHadronEt",
"neutralHadronEt", 100, 0, 1000);
225 mPFelectronEt = ibooker.
book1D(
"electronEt",
"electronEt", 100, 0, 1000);
226 mPFchargedHadronEt = ibooker.
book1D(
"chargedHadronEt",
"chargedHadronEt", 100, 0, 1000);
227 mPFmuonEt = ibooker.
book1D(
"muonEt",
"muonEt", 100, 0, 1000);
228 mPFHFHadronEt = ibooker.
book1D(
"HFHadronEt",
"HFHadronEt", 100, 0, 500);
229 mPFHFEMEt = ibooker.
book1D(
"HFEMEt",
"HFEMEt", 100, 0, 300);
238 iEvent.getByToken(pvToken_, pvHandle);
240 std::cout << __FUNCTION__ <<
":" << __LINE__ <<
":pvHandle handle not found!" << std::endl;
243 const int nvtx = pvHandle->size();
244 mNvertex->Fill(nvtx);
253 iEvent.getByToken(caloMETsToken_, caloMETs);
255 iEvent.getByToken(pfMETsToken_, pfMETs);
257 iEvent.getByToken(genMETsToken_, genMETs);
259 iEvent.getByToken(patMETToken_, patMET);
260 if ((isCaloMET) and !caloMETs.
isValid())
262 if ((isPFMET) and !pfMETs.
isValid())
264 if ((isGenMET) and !genMETs.
isValid())
266 if ((isMiniAODMET) and !patMET.
isValid())
271 met = caloMETs->front();
274 met = pfMETs->front();
277 met = genMETs->front();
280 met = patMET->front();
283 const double SumET =
met.sumEt();
284 const double METSig =
met.mEtSig();
285 const double MET =
met.pt();
286 const double MEx =
met.px();
287 const double MEy =
met.py();
288 const double METPhi =
met.phi();
293 mMET_Nvtx->Fill((
double)nvtx,
MET);
294 mMETPhi->Fill(METPhi);
296 mMETSig->Fill(METSig);
300 bool isvalidgenmet =
false;
304 iEvent.getByToken(genMETsTrueToken_, genTrue);
306 isvalidgenmet =
true;
312 isvalidgenmet =
true;
319 mMETDifference_GenMETTrue->Fill(
MET - genMET);
320 mMETDeltaPhi_GenMETTrue->Fill(TMath::ACos(TMath::Cos(METPhi - genMETPhi)));
325 mMETDifference_GenMETTrue_MET0to20->Fill(
MET - genMET);
326 else if (
MET > 20 &&
MET < 40)
327 mMETDifference_GenMETTrue_MET20to40->Fill(
MET - genMET);
328 else if (
MET > 40 &&
MET < 60)
329 mMETDifference_GenMETTrue_MET40to60->Fill(
MET - genMET);
330 else if (
MET > 60 &&
MET < 80)
331 mMETDifference_GenMETTrue_MET60to80->Fill(
MET - genMET);
332 else if (
MET > 80 &&
MET < 100)
333 mMETDifference_GenMETTrue_MET80to100->Fill(
MET - genMET);
334 else if (
MET > 100 &&
MET < 150)
335 mMETDifference_GenMETTrue_MET100to150->Fill(
MET - genMET);
336 else if (
MET > 150 &&
MET < 200)
337 mMETDifference_GenMETTrue_MET150to200->Fill(
MET - genMET);
338 else if (
MET > 200 &&
MET < 300)
339 mMETDifference_GenMETTrue_MET200to300->Fill(
MET - genMET);
340 else if (
MET > 300 &&
MET < 400)
341 mMETDifference_GenMETTrue_MET300to400->Fill(
MET - genMET);
342 else if (
MET > 400 &&
MET < 500)
343 mMETDifference_GenMETTrue_MET400to500->Fill(
MET - genMET);
345 mMETDifference_GenMETTrue_MET500->Fill(
MET - genMET);
348 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task: genMetTrue";
353 iEvent.getByToken(genMETsCaloToken_, genCalo);
360 mMETDifference_GenMETCalo->Fill(
MET - genMET);
361 mMETDeltaPhi_GenMETCalo->Fill(TMath::ACos(TMath::Cos(METPhi - genMETPhi)));
363 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task: genMetCalo";
373 const double caloEmEtFraction = calomet->
emEtFraction();
374 const double caloHadEtInHB = calomet->
hadEtInHB();
375 const double caloHadEtInHO = calomet->
hadEtInHO();
376 const double caloHadEtInHE = calomet->
hadEtInHE();
377 const double caloHadEtInHF = calomet->
hadEtInHF();
378 const double caloEmEtInEB = calomet->
emEtInEB();
379 const double caloEmEtInEE = calomet->
emEtInEE();
380 const double caloEmEtInHF = calomet->
emEtInHF();
384 mCaloMaxEtInEmTowers->Fill(caloMaxEtInEMTowers);
385 mCaloMaxEtInHadTowers->Fill(caloMaxEtInHadTowers);
386 mCaloEtFractionHadronic->Fill(caloEtFractionHadronic);
387 mCaloEmEtFraction->Fill(caloEmEtFraction);
388 mCaloHadEtInHB->Fill(caloHadEtInHB);
389 mCaloHadEtInHO->Fill(caloHadEtInHO);
390 mCaloHadEtInHE->Fill(caloHadEtInHE);
391 mCaloHadEtInHF->Fill(caloHadEtInHF);
392 mCaloEmEtInEB->Fill(caloEmEtInEB);
393 mCaloEmEtInEE->Fill(caloEmEtInEE);
394 mCaloEmEtInHF->Fill(caloEmEtInHF);
395 mCaloSETInpHF->Fill(caloSETInpHF);
396 mCaloSETInmHF->Fill(caloSETInmHF);
401 genmet = &(genMETs->front());
403 const double NeutralEMEtFraction =
genmet->NeutralEMEtFraction();
404 const double NeutralHadEtFraction =
genmet->NeutralHadEtFraction();
405 const double ChargedEMEtFraction =
genmet->ChargedEMEtFraction();
406 const double ChargedHadEtFraction =
genmet->ChargedHadEtFraction();
407 const double MuonEtFraction =
genmet->MuonEtFraction();
408 const double InvisibleEtFraction =
genmet->InvisibleEtFraction();
410 mNeutralEMEtFraction->Fill(NeutralEMEtFraction);
411 mNeutralHadEtFraction->Fill(NeutralHadEtFraction);
412 mChargedEMEtFraction->Fill(ChargedEMEtFraction);
413 mChargedHadEtFraction->Fill(ChargedHadEtFraction);
414 mMuonEtFraction->Fill(MuonEtFraction);
415 mInvisibleEtFraction->Fill(InvisibleEtFraction);
420 mPFphotonEt->Fill(pfmet->
photonEt());
428 mPFmuonEt->Fill(pfmet->
muonEt());
432 mPFHFEMEt->Fill(pfmet->
HFEMEt());
436 const pat::MET *patmet = &(patMET->front());
Analysis-level MET class.
double Type6EtFraction() const
double maxEtInEmTowers() const
T getParameter(std::string const &) const
double neutralHadronEt() const
bool isPFMET() const
True if this pat::MET was made from a reco::pfMET.
double chargedHadronEt() const
virtual void setCurrentFolder(std::string const &fullpath)
double chargedHadronEtFraction() const
double ChargedEMEtFraction() const
genmet
do same things for GEN
T const * product() const
double neutralHadronEtFraction() const
double etFractionHadronic() const
double HFHadronEtFraction() const
double HFHadronEt() const
double electronEt() const
genMetCalo
____________________________________________________________________________||
double Type7EtFraction() const
double CaloSETInpHF() const
T getUntrackedParameter(std::string const &, T const &) const
double HFEMEtFraction() const
double emEtFraction() const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
double maxEtInHadTowers() const
Log< level::Info, false > LogInfo
double NeutralHadEtFraction() const
double electronEtFraction() const
double ChargedHadEtFraction() const
double photonEtFraction() const
METTester(const edm::ParameterSet &)
void analyze(const edm::Event &, const edm::EventSetup &) override
double NeutralEMFraction() const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
double CaloSETInmHF() const
double muonEtFraction() const
double shiftedPt(METUncertainty shift, METCorrectionLevel level=Type1) const
double MuonEtFraction() const