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 = 0;
68 mMETDeltaPhi_GenMETTrue = 0;
69 mMETDifference_GenMETCalo = 0;
70 mMETDeltaPhi_GenMETCalo = 0;
74 mMETUnc_JetResDown = 0;
76 mMETUnc_JetEnDown = 0;
78 mMETUnc_MuonEnDown = 0;
79 mMETUnc_ElectronEnUp = 0;
80 mMETUnc_ElectronEnDown = 0;
82 mMETUnc_TauEnDown = 0;
83 mMETUnc_UnclusteredEnUp = 0;
84 mMETUnc_UnclusteredEnDown = 0;
85 mMETUnc_PhotonEnUp = 0;
86 mMETUnc_PhotonEnDown = 0;
90 mCaloMaxEtInEmTowers = 0;
91 mCaloMaxEtInHadTowers = 0;
92 mCaloEtFractionHadronic = 0;
93 mCaloEmEtFraction = 0;
106 mNeutralEMEtFraction=0;
107 mNeutralHadEtFraction=0;
108 mChargedEMEtFraction=0;
109 mChargedHadEtFraction=0;
111 mInvisibleEtFraction=0;
116 mMETDifference_GenMETTrue_MET0to20=0;
117 mMETDifference_GenMETTrue_MET20to40=0;
118 mMETDifference_GenMETTrue_MET40to60=0;
119 mMETDifference_GenMETTrue_MET60to80=0;
120 mMETDifference_GenMETTrue_MET80to100=0;
121 mMETDifference_GenMETTrue_MET100to150=0;
122 mMETDifference_GenMETTrue_MET150to200=0;
123 mMETDifference_GenMETTrue_MET200to300=0;
124 mMETDifference_GenMETTrue_MET300to400=0;
125 mMETDifference_GenMETTrue_MET400to500=0;
126 mMETDifference_GenMETTrue_MET500=0;
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
virtual double pt() const final
transverse momentum
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
genmet
do same things for GEN
double MuonEtFraction() const
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.
virtual double phi() const final
momentum azimuthal angle
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
double HFHadronEtFraction() const
double muonEtFraction() const
double HFHadronEt() const
virtual double px() const final
x coordinate of momentum vector
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
void setCurrentFolder(const std::string &fullpath)
double etFractionHadronic() const
T const * product() const
double NeutralEMEtFraction() const
double electronEtFraction() const
double chargedHadronEtFraction() const
genMetTrue
____________________________________________________________________________||
METTester(const edm::ParameterSet &)
double NeutralHadEtFraction() const
double neutralHadronEt() const
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
double ChargedHadEtFraction() const
virtual double py() const final
y coordinate of momentum vector
double emEtFraction() const
double chargedHadronEt() const