38 std::string inputMETCollectionLabel(inputMETLabel_.label());
46 if (isCaloMET) caloMETsToken_ = consumes<reco::CaloMETCollection> (inputMETLabel_);
47 if (isPFMET) pfMETsToken_ = consumes<reco::PFMETCollection> (inputMETLabel_);
48 if(isMiniAODMET) patMETToken_ = consumes<pat::METCollection> (inputMETLabel_);
49 if (isGenMET) genMETsToken_ = consumes<reco::GenMETCollection> (inputMETLabel_);
51 genMETsTrueToken_ = consumes<reco::GenMETCollection> (
edm::InputTag(
"genMetTrue"));
52 genMETsCaloToken_ = consumes<reco::GenMETCollection> (
edm::InputTag(
"genMetCalo"));
67 mMETDifference_GenMETTrue =
nullptr;
68 mMETDeltaPhi_GenMETTrue =
nullptr;
69 mMETDifference_GenMETCalo =
nullptr;
70 mMETDeltaPhi_GenMETCalo =
nullptr;
73 mMETUnc_JetResUp =
nullptr;
74 mMETUnc_JetResDown =
nullptr;
75 mMETUnc_JetEnUp =
nullptr;
76 mMETUnc_JetEnDown =
nullptr;
77 mMETUnc_MuonEnUp =
nullptr;
78 mMETUnc_MuonEnDown =
nullptr;
79 mMETUnc_ElectronEnUp =
nullptr;
80 mMETUnc_ElectronEnDown =
nullptr;
81 mMETUnc_TauEnUp =
nullptr;
82 mMETUnc_TauEnDown =
nullptr;
83 mMETUnc_UnclusteredEnUp =
nullptr;
84 mMETUnc_UnclusteredEnDown =
nullptr;
85 mMETUnc_PhotonEnUp =
nullptr;
86 mMETUnc_PhotonEnDown =
nullptr;
90 mCaloMaxEtInEmTowers =
nullptr;
91 mCaloMaxEtInHadTowers =
nullptr;
92 mCaloEtFractionHadronic =
nullptr;
93 mCaloEmEtFraction =
nullptr;
94 mCaloHadEtInHB =
nullptr;
95 mCaloHadEtInHO =
nullptr;
96 mCaloHadEtInHE =
nullptr;
97 mCaloHadEtInHF =
nullptr;
98 mCaloEmEtInHF =
nullptr;
99 mCaloSETInpHF =
nullptr;
100 mCaloSETInmHF =
nullptr;
101 mCaloEmEtInEE =
nullptr;
102 mCaloEmEtInEB =
nullptr;
106 mNeutralEMEtFraction=
nullptr;
107 mNeutralHadEtFraction=
nullptr;
108 mChargedEMEtFraction=
nullptr;
109 mChargedHadEtFraction=
nullptr;
110 mMuonEtFraction=
nullptr;
111 mInvisibleEtFraction=
nullptr;
116 mMETDifference_GenMETTrue_MET0to20=
nullptr;
117 mMETDifference_GenMETTrue_MET20to40=
nullptr;
118 mMETDifference_GenMETTrue_MET40to60=
nullptr;
119 mMETDifference_GenMETTrue_MET60to80=
nullptr;
120 mMETDifference_GenMETTrue_MET80to100=
nullptr;
121 mMETDifference_GenMETTrue_MET100to150=
nullptr;
122 mMETDifference_GenMETTrue_MET150to200=
nullptr;
123 mMETDifference_GenMETTrue_MET200to300=
nullptr;
124 mMETDifference_GenMETTrue_MET300to400=
nullptr;
125 mMETDifference_GenMETTrue_MET400to500=
nullptr;
126 mMETDifference_GenMETTrue_MET500=
nullptr;
136 mNvertex = ibooker.
book1D(
"Nvertex",
"Nvertex",80,0,80);
137 mMEx = ibooker.
book1D(
"MEx",
"MEx",160,-800,800);
138 mMEy = ibooker.
book1D(
"MEy",
"MEy",160,-800,800);
139 mMETSig = ibooker.
book1D(
"METSig",
"METSig",25,0,24.5);
140 mMET = ibooker.
book1D(
"MET",
"MET (20 GeV binning)" , 100,0,2000);
141 mMETFine = ibooker.
book1D(
"METFine",
"MET (2 GeV binning)" , 1000,0,2000);
142 mMET_Nvtx = ibooker.
bookProfile(
"MET_Nvtx",
"MET vs. nvtx", 60, 0., 60., 0., 2000.,
" ");
143 mMETPhi = ibooker.
book1D(
"METPhi",
"METPhi",80,-4,4);
144 mSumET = ibooker.
book1D(
"SumET" ,
"SumET" , 200,0,4000);
145 mMETDifference_GenMETTrue = ibooker.
book1D(
"METDifference_GenMETTrue",
"METDifference_GenMETTrue", 500,-500,500);
146 mMETDeltaPhi_GenMETTrue = ibooker.
book1D(
"METDeltaPhi_GenMETTrue",
"METDeltaPhi_GenMETTrue", 80,0,4);
149 mMETUnc_JetResUp = ibooker.
book1D(
"METUnc_JetResUp",
"METUnc_JetResUp", 200, -10, 10);
150 mMETUnc_JetResDown = ibooker.
book1D(
"METUnc_JetResDown",
"METUnc_JetResDown", 200, -10, 10);
151 mMETUnc_JetEnUp = ibooker.
book1D(
"METUnc_JetEnUp",
"METUnc_JetEnUp", 200, -10, 10);
152 mMETUnc_JetEnDown = ibooker.
book1D(
"METUnc_JetEnDown",
"METUnc_JetEnDown", 200, -10, 10);
153 mMETUnc_MuonEnUp = ibooker.
book1D(
"METUnc_MuonEnUp",
"METUnc_MuonEnUp", 200, -10, 10);
154 mMETUnc_MuonEnDown = ibooker.
book1D(
"METUnc_MuonEnDown",
"METUnc_MuonEnDown", 200, -10, 10);
155 mMETUnc_ElectronEnUp = ibooker.
book1D(
"METUnc_ElectronEnUp",
"METUnc_ElectronEnUp", 200, -10, 10);
156 mMETUnc_ElectronEnDown = ibooker.
book1D(
"METUnc_ElectronEnDown",
"METUnc_ElectronEnDown", 200, -10, 10);
157 mMETUnc_TauEnUp = ibooker.
book1D(
"METUnc_TauEnUp",
"METUnc_TauEnUp", 200, -10, 10);
158 mMETUnc_TauEnDown = ibooker.
book1D(
"METUnc_TauEnDown",
"METUnc_TauEnDown", 200, -10, 10);
159 mMETUnc_UnclusteredEnUp = ibooker.
book1D(
"METUnc_UnclusteredEnUp",
"METUnc_UnclusteredEnUp", 200, -10, 10);
160 mMETUnc_UnclusteredEnDown = ibooker.
book1D(
"METUnc_UnclusteredEnDown",
"METUnc_UnclusteredEnDown", 200, -10, 10);
161 mMETUnc_PhotonEnUp = ibooker.
book1D(
"METUnc_UnclusteredEnDown",
"METUnc_UnclusteredEnDown", 200, -10, 10);
162 mMETUnc_PhotonEnDown = ibooker.
book1D(
"METUnc_PhotonEnDown",
"METUnc_PhotonEnDown", 200, -10, 10);
166 mMETDifference_GenMETCalo = ibooker.
book1D(
"METDifference_GenMETCalo",
"METDifference_GenMETCalo", 500,-500,500);
167 mMETDeltaPhi_GenMETCalo = ibooker.
book1D(
"METDeltaPhi_GenMETCalo",
"METDeltaPhi_GenMETCalo", 80,0,4);
170 mMETDifference_GenMETTrue_MET0to20 = ibooker.
book1D(
"METResolution_GenMETTrue_MET0to20" ,
"METResolution_GenMETTrue_MET0to20" , 500,-500,500);
171 mMETDifference_GenMETTrue_MET20to40 = ibooker.
book1D(
"METResolution_GenMETTrue_MET20to40" ,
"METResolution_GenMETTrue_MET20to40" , 500,-500,500);
172 mMETDifference_GenMETTrue_MET40to60 = ibooker.
book1D(
"METResolution_GenMETTrue_MET40to60" ,
"METResolution_GenMETTrue_MET40to60" , 500,-500,500);
173 mMETDifference_GenMETTrue_MET60to80 = ibooker.
book1D(
"METResolution_GenMETTrue_MET60to80" ,
"METResolution_GenMETTrue_MET60to80" , 500,-500,500);
174 mMETDifference_GenMETTrue_MET80to100 = ibooker.
book1D(
"METResolution_GenMETTrue_MET80to100" ,
"METResolution_GenMETTrue_MET80to100" , 500,-500,500);
175 mMETDifference_GenMETTrue_MET100to150 = ibooker.
book1D(
"METResolution_GenMETTrue_MET100to150",
"METResolution_GenMETTrue_MET100to150", 500,-500,500);
176 mMETDifference_GenMETTrue_MET150to200 = ibooker.
book1D(
"METResolution_GenMETTrue_MET150to200",
"METResolution_GenMETTrue_MET150to200", 500,-500,500);
177 mMETDifference_GenMETTrue_MET200to300 = ibooker.
book1D(
"METResolution_GenMETTrue_MET200to300",
"METResolution_GenMETTrue_MET200to300", 500,-500,500);
178 mMETDifference_GenMETTrue_MET300to400 = ibooker.
book1D(
"METResolution_GenMETTrue_MET300to400",
"METResolution_GenMETTrue_MET300to400", 500,-500,500);
179 mMETDifference_GenMETTrue_MET400to500 = ibooker.
book1D(
"METResolution_GenMETTrue_MET400to500",
"METResolution_GenMETTrue_MET400to500", 500,-500,500);
180 mMETDifference_GenMETTrue_MET500 = ibooker.
book1D(
"METResolution_GenMETTrue_MET500",
"METResolution_GenMETTrue_MET500", 500,-500,500);
183 mCaloMaxEtInEmTowers = ibooker.
book1D(
"CaloMaxEtInEmTowers",
"CaloMaxEtInEmTowers",300,0,1500);
184 mCaloMaxEtInHadTowers = ibooker.
book1D(
"CaloMaxEtInHadTowers",
"CaloMaxEtInHadTowers",300,0,1500);
185 mCaloEtFractionHadronic = ibooker.
book1D(
"CaloEtFractionHadronic",
"CaloEtFractionHadronic",100,0,1);
186 mCaloEmEtFraction = ibooker.
book1D(
"CaloEmEtFraction",
"CaloEmEtFraction",100,0,1);
187 mCaloHadEtInHB = ibooker.
book1D(
"CaloHadEtInHB",
"CaloHadEtInHB", 200, 0, 2000);
188 mCaloHadEtInHE = ibooker.
book1D(
"CaloHadEtInHE",
"CaloHadEtInHE", 100, 0, 500);
189 mCaloHadEtInHO = ibooker.
book1D(
"CaloHadEtInHO",
"CaloHadEtInHO", 100, 0, 200);
190 mCaloHadEtInHF = ibooker.
book1D(
"CaloHadEtInHF",
"CaloHadEtInHF", 100, 0, 200);
191 mCaloSETInpHF = ibooker.
book1D(
"CaloSETInpHF",
"CaloSETInpHF",100, 0, 500);
192 mCaloSETInmHF = ibooker.
book1D(
"CaloSETInmHF",
"CaloSETInmHF",100, 0, 500);
193 mCaloEmEtInEE = ibooker.
book1D(
"CaloEmEtInEE",
"CaloEmEtInEE",100, 0, 500);
194 mCaloEmEtInEB = ibooker.
book1D(
"CaloEmEtInEB",
"CaloEmEtInEB",100, 0, 500);
195 mCaloEmEtInHF = ibooker.
book1D(
"CaloEmEtInHF",
"CaloEmEtInHF",100, 0, 500);
199 mNeutralEMEtFraction = ibooker.
book1D(
"GenNeutralEMEtFraction",
"GenNeutralEMEtFraction", 120, 0.0, 1.2 );
200 mNeutralHadEtFraction = ibooker.
book1D(
"GenNeutralHadEtFraction",
"GenNeutralHadEtFraction", 120, 0.0, 1.2 );
201 mChargedEMEtFraction = ibooker.
book1D(
"GenChargedEMEtFraction",
"GenChargedEMEtFraction", 120, 0.0, 1.2);
202 mChargedHadEtFraction = ibooker.
book1D(
"GenChargedHadEtFraction",
"GenChargedHadEtFraction", 120, 0.0,1.2);
203 mMuonEtFraction = ibooker.
book1D(
"GenMuonEtFraction",
"GenMuonEtFraction", 120, 0.0, 1.2 );
204 mInvisibleEtFraction = ibooker.
book1D(
"GenInvisibleEtFraction",
"GenInvisibleEtFraction", 120, 0.0, 1.2 );
207 if (isPFMET || isMiniAODMET){
208 mPFphotonEtFraction = ibooker.
book1D(
"photonEtFraction",
"photonEtFraction", 100, 0, 1);
209 mPFneutralHadronEtFraction = ibooker.
book1D(
"neutralHadronEtFraction",
"neutralHadronEtFraction", 100, 0, 1);
210 mPFelectronEtFraction = ibooker.
book1D(
"electronEtFraction",
"electronEtFraction", 100, 0, 1);
211 mPFchargedHadronEtFraction = ibooker.
book1D(
"chargedHadronEtFraction",
"chargedHadronEtFraction", 100, 0, 1);
212 mPFHFHadronEtFraction = ibooker.
book1D(
"HFHadronEtFraction",
"HFHadronEtFraction", 100, 0, 1);
213 mPFmuonEtFraction = ibooker.
book1D(
"muonEtFraction",
"muonEtFraction", 100, 0, 1);
214 mPFHFEMEtFraction = ibooker.
book1D(
"HFEMEtFraction",
"HFEMEtFraction", 100, 0, 1);
217 mPFphotonEt = ibooker.
book1D(
"photonEt",
"photonEt", 100, 0, 1000);
218 mPFneutralHadronEt = ibooker.
book1D(
"neutralHadronEt",
"neutralHadronEt", 100, 0, 1000);
219 mPFelectronEt = ibooker.
book1D(
"electronEt",
"electronEt", 100, 0, 1000);
220 mPFchargedHadronEt = ibooker.
book1D(
"chargedHadronEt",
"chargedHadronEt", 100, 0, 1000);
221 mPFmuonEt = ibooker.
book1D(
"muonEt",
"muonEt", 100, 0, 1000);
222 mPFHFHadronEt = ibooker.
book1D(
"HFHadronEt",
"HFHadronEt", 100, 0, 500);
223 mPFHFEMEt = ibooker.
book1D(
"HFEMEt",
"HFEMEt", 100, 0, 300);
237 std::cout << __FUNCTION__ <<
":" << __LINE__ <<
":pvHandle handle not found!" << std::endl;
240 const int nvtx = pvHandle->size();
241 mNvertex->Fill(nvtx);
249 if (isCaloMET) iEvent.
getByToken(caloMETsToken_, caloMETs);
250 if (isPFMET) iEvent.
getByToken(pfMETsToken_, pfMETs);
251 if (isGenMET) iEvent.
getByToken(genMETsToken_, genMETs);
252 if (isMiniAODMET) iEvent.
getByToken(patMETToken_, patMET);
253 if ((isCaloMET) and !caloMETs.
isValid())
return;
254 if ((isPFMET) and !pfMETs.
isValid())
return;
255 if ((isGenMET) and !genMETs.
isValid())
return;
256 if ((isMiniAODMET) and !patMET.
isValid())
return;
259 if (isCaloMET) { met = caloMETs->front();}
260 if (isPFMET) { met = pfMETs->front() ;}
261 if (isGenMET) { met = genMETs->front() ;}
262 if (isMiniAODMET) { met = patMET->front() ;}
264 const double SumET = met.
sumEt();
265 const double METSig = met.
mEtSig();
266 const double MET = met.
pt();
267 const double MEx = met.
px();
268 const double MEy = met.
py();
269 const double METPhi = met.
phi();
274 mMET_Nvtx->Fill((
double)nvtx, MET);
275 mMETPhi->Fill(METPhi);
277 mMETSig->Fill(METSig);
282 bool isvalidgenmet=
false;
286 iEvent.
getByToken(genMETsTrueToken_, genTrue);
290 genMetTrue = &(genmetcol->front());
293 genMetTrue=patMET->front().genMET();
298 double genMET = genMetTrue->
pt();
299 double genMETPhi = genMetTrue->
phi();
301 mMETDifference_GenMETTrue->Fill( MET - genMET );
302 mMETDeltaPhi_GenMETTrue->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
306 if (MET > 0 && MET < 20) mMETDifference_GenMETTrue_MET0to20->Fill( MET - genMET );
307 else if (MET > 20 && MET < 40) mMETDifference_GenMETTrue_MET20to40->Fill( MET - genMET );
308 else if (MET > 40 && MET < 60) mMETDifference_GenMETTrue_MET40to60->Fill( MET - genMET );
309 else if (MET > 60 && MET < 80) mMETDifference_GenMETTrue_MET60to80->Fill( MET - genMET );
310 else if (MET > 80 && MET <100) mMETDifference_GenMETTrue_MET80to100->Fill( MET - genMET );
311 else if (MET >100 && MET <150) mMETDifference_GenMETTrue_MET100to150->Fill( MET - genMET );
312 else if (MET >150 && MET <200) mMETDifference_GenMETTrue_MET150to200->Fill( MET - genMET );
313 else if (MET >200 && MET <300) mMETDifference_GenMETTrue_MET200to300->Fill( MET - genMET );
314 else if (MET >300 && MET <400) mMETDifference_GenMETTrue_MET300to400->Fill( MET - genMET );
315 else if (MET >400 && MET <500) mMETDifference_GenMETTrue_MET400to500->Fill( MET - genMET );
316 else if (MET >500) mMETDifference_GenMETTrue_MET500->Fill( MET - genMET );
319 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task: genMetTrue";
324 iEvent.
getByToken(genMETsCaloToken_, genCalo);
328 const double genMET = genMetCalo->
pt();
329 const double genMETPhi = genMetCalo->
phi();
331 mMETDifference_GenMETCalo->Fill( MET - genMET );
332 mMETDeltaPhi_GenMETCalo->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
334 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task: genMetCalo";
344 const double caloEmEtFraction = calomet->
emEtFraction();
345 const double caloHadEtInHB = calomet->
hadEtInHB();
346 const double caloHadEtInHO = calomet->
hadEtInHO();
347 const double caloHadEtInHE = calomet->
hadEtInHE();
348 const double caloHadEtInHF = calomet->
hadEtInHF();
349 const double caloEmEtInEB = calomet->
emEtInEB();
350 const double caloEmEtInEE = calomet->
emEtInEE();
351 const double caloEmEtInHF = calomet->
emEtInHF();
355 mCaloMaxEtInEmTowers->Fill(caloMaxEtInEMTowers);
356 mCaloMaxEtInHadTowers->Fill(caloMaxEtInHadTowers);
357 mCaloEtFractionHadronic->Fill(caloEtFractionHadronic);
358 mCaloEmEtFraction->Fill(caloEmEtFraction);
359 mCaloHadEtInHB->Fill(caloHadEtInHB);
360 mCaloHadEtInHO->Fill(caloHadEtInHO);
361 mCaloHadEtInHE->Fill(caloHadEtInHE);
362 mCaloHadEtInHF->Fill(caloHadEtInHF);
363 mCaloEmEtInEB->Fill(caloEmEtInEB);
364 mCaloEmEtInEE->Fill(caloEmEtInEE);
365 mCaloEmEtInHF->Fill(caloEmEtInHF);
366 mCaloSETInpHF->Fill(caloSETInpHF);
367 mCaloSETInmHF->Fill(caloSETInmHF);
373 genmet = &(genMETs->front());
382 mNeutralEMEtFraction->Fill( NeutralEMEtFraction );
383 mNeutralHadEtFraction->Fill( NeutralHadEtFraction );
384 mChargedEMEtFraction->Fill( ChargedEMEtFraction );
385 mChargedHadEtFraction->Fill( ChargedHadEtFraction );
386 mMuonEtFraction->Fill( MuonEtFraction );
387 mInvisibleEtFraction->Fill( InvisibleEtFraction );
393 mPFphotonEt->Fill(pfmet->
photonEt());
401 mPFmuonEt->Fill(pfmet->
muonEt());
405 mPFHFEMEt->Fill(pfmet->
HFEMEt());
410 const pat::MET *patmet = &(patMET->front());
Analysis-level MET class.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double HFEMEtFraction() const
double ChargedHadEtFraction() const
double CaloSETInmHF() const
double MuonEtFraction() const
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double maxEtInHadTowers() const
double neutralHadronEtFraction() const
double px() const final
x coordinate of momentum vector
genmet
do same things for GEN
double MuonEtFraction() const
double pt() const final
transverse momentum
double NeutralEMFraction() const
double ChargedEMEtFraction() const
genMetCalo
____________________________________________________________________________||
double maxEtInEmTowers() const
double Type6EtFraction() const
double Type7EtFraction() const
double NeutralHadEtFraction() const
bool isPFMET() const
True if this pat::MET was made from a reco::pfMET.
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
double HFHadronEtFraction() const
double muonEtFraction() const
void setCurrentFolder(std::string const &fullpath)
double HFHadronEt() const
double photonEtFraction() const
double ChargedEMEtFraction() const
MonitorElement * book1D(Args &&...args)
double CaloSETInpHF() const
double InvisibleEtFraction() const
double shiftedPt(METUncertainty shift, METCorrectionLevel level=Type1) const
double electronEt() const
double etFractionHadronic() const
T const * product() const
double py() const final
y coordinate of momentum vector
double NeutralEMEtFraction() const
double electronEtFraction() const
double chargedHadronEtFraction() const
genMetTrue
____________________________________________________________________________||
METTester(const edm::ParameterSet &)
double NeutralHadEtFraction() const
double neutralHadronEt() const
void analyze(const edm::Event &, const edm::EventSetup &) override
double ChargedHadEtFraction() const
double phi() const final
momentum azimuthal angle
double emEtFraction() const
double chargedHadronEt() const