CMS 3D CMS Logo

METTester.cc
Go to the documentation of this file.
1 // author: Mike Schmitt, University of Florida
2 // first version 8/24/2006
3 // modification: Bobby Scurlock
4 // date: 03.11.2006
5 // note: added RMS(METx) vs SumET capability
6 // modification: Rick Cavanaugh
7 // date: 05.11.2006
8 // note: cleaned up constructor and beginJob, removed int conv. warning
9 // added configuration params
10 // modification: Mike Schmitt
11 // date: 02.28.2007
12 // note: code rewrite. Now uses STL map for monitoring element container.
13 // modification: Bobby Scurlock
14 // date: 04.03.2007
15 // note: Eliminated automated resolution fitting. This is now done in a ROOT
16 // script.
17 
18 // date: 02.04.2009
19 // note: Added option to use fine binning or course binning for histos
20 //
21 // modification: Samantha Hewamanage, Florida International University
22 // date: 01.30.2012
23 // note: Added few hists for various nvtx ranges to study PU effects.
24 // Cleaned up the code by making it readable and const'ing the
25 // variables that should be changed.
26 // Changed the number of bins from odd to even. Odd number of bins
27 // makes it impossible to rebin a hist.
28 #include "METTester.h"
29 using namespace reco;
30 using namespace std;
31 using namespace edm;
32 
34  inputMETLabel_ = iConfig.getParameter<edm::InputTag>("InputMETLabel");
35  METType_ = iConfig.getUntrackedParameter<std::string>("METType");
36 
37  std::string inputMETCollectionLabel(inputMETLabel_.label());
38 
39  isCaloMET = (std::string("calo") == METType_);
40  isPFMET = (std::string("pf") == METType_);
41  isGenMET = (std::string("gen") == METType_);
42  isMiniAODMET = (std::string("miniaod") == METType_);
43 
44  pvToken_ = consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("PrimaryVertices"));
45  if (isCaloMET)
46  caloMETsToken_ = consumes<reco::CaloMETCollection>(inputMETLabel_);
47  if (isPFMET)
48  pfMETsToken_ = consumes<reco::PFMETCollection>(inputMETLabel_);
49  if (isMiniAODMET)
50  patMETToken_ = consumes<pat::METCollection>(inputMETLabel_);
51  if (isGenMET)
52  genMETsToken_ = consumes<reco::GenMETCollection>(inputMETLabel_);
53  if (!isMiniAODMET) {
54  genMETsTrueToken_ = consumes<reco::GenMETCollection>(edm::InputTag("genMetTrue"));
55  genMETsCaloToken_ = consumes<reco::GenMETCollection>(edm::InputTag("genMetCalo"));
56  }
57 
58  // Events variables
59  mNvertex = nullptr;
60 
61  // Common variables
62  mMEx = nullptr;
63  mMEy = nullptr;
64  mMETSig = nullptr;
65  mMET = nullptr;
66  mMETFine = nullptr;
67  mMET_Nvtx = nullptr;
68  mMETPhi = nullptr;
69  mSumET = nullptr;
70  mMETDifference_GenMETTrue = nullptr;
71  mMETDeltaPhi_GenMETTrue = nullptr;
72  mMETDifference_GenMETCalo = nullptr;
73  mMETDeltaPhi_GenMETCalo = nullptr;
74 
75  // MET Uncertainities: Only for MiniAOD
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;
90 
91  // CaloMET variables
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;
105 
106  // GenMET variables
107  mNeutralEMEtFraction = nullptr;
108  mNeutralHadEtFraction = nullptr;
109  mChargedEMEtFraction = nullptr;
110  mChargedHadEtFraction = nullptr;
111  mMuonEtFraction = nullptr;
112  mInvisibleEtFraction = nullptr;
113 
114  // MET variables
115 
116  // PFMET variables
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;
128 }
129 void METTester::bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const & /* iSetup */) {
130  ibooker.setCurrentFolder("JetMET/METValidation/" + inputMETLabel_.label());
131 
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); // 10GeV
141  mMETDifference_GenMETTrue = ibooker.book1D("METDifference_GenMETTrue", "METDifference_GenMETTrue", 500, -500, 500);
142  mMETDeltaPhi_GenMETTrue = ibooker.book1D("METDeltaPhi_GenMETTrue", "METDeltaPhi_GenMETTrue", 80, 0, 4);
143 
144  if (isMiniAODMET) {
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);
159  }
160  if (!isMiniAODMET) {
161  mMETDifference_GenMETCalo = ibooker.book1D("METDifference_GenMETCalo", "METDifference_GenMETCalo", 500, -500, 500);
162  mMETDeltaPhi_GenMETCalo = ibooker.book1D("METDeltaPhi_GenMETCalo", "METDeltaPhi_GenMETCalo", 80, 0, 4);
163  }
164  if (!isGenMET) {
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);
187  }
188  if (isCaloMET) {
189  mCaloMaxEtInEmTowers = ibooker.book1D("CaloMaxEtInEmTowers", "CaloMaxEtInEmTowers", 300, 0, 1500); // 5GeV
190  mCaloMaxEtInHadTowers = ibooker.book1D("CaloMaxEtInHadTowers", "CaloMaxEtInHadTowers", 300, 0, 1500); // 5GeV
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); // 5GeV
194  mCaloHadEtInHE = ibooker.book1D("CaloHadEtInHE", "CaloHadEtInHE", 100, 0, 500); // 5GeV
195  mCaloHadEtInHO = ibooker.book1D("CaloHadEtInHO", "CaloHadEtInHO", 100, 0, 200); // 5GeV
196  mCaloHadEtInHF = ibooker.book1D("CaloHadEtInHF", "CaloHadEtInHF", 100, 0, 200); // 5GeV
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); // 5GeV
200  mCaloEmEtInEB = ibooker.book1D("CaloEmEtInEB", "CaloEmEtInEB", 100, 0, 500); // 5GeV
201  mCaloEmEtInHF = ibooker.book1D("CaloEmEtInHF", "CaloEmEtInHF", 100, 0, 500); // 5GeV
202  }
203 
204  if (isGenMET) {
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);
211  }
212 
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);
221 
222  if (!isMiniAODMET) {
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);
230  }
231  }
232 }
233 
235  const edm::EventSetup &iSetup) { // int counter(0);
236 
238  iEvent.getByToken(pvToken_, pvHandle);
239  if (!pvHandle.isValid()) {
240  std::cout << __FUNCTION__ << ":" << __LINE__ << ":pvHandle handle not found!" << std::endl;
241  assert(false);
242  }
243  const int nvtx = pvHandle->size();
244  mNvertex->Fill(nvtx);
245  // Collections for all MET collections
246 
251 
252  if (isCaloMET)
253  iEvent.getByToken(caloMETsToken_, caloMETs);
254  if (isPFMET)
255  iEvent.getByToken(pfMETsToken_, pfMETs);
256  if (isGenMET)
257  iEvent.getByToken(genMETsToken_, genMETs);
258  if (isMiniAODMET)
259  iEvent.getByToken(patMETToken_, patMET);
260  if ((isCaloMET) and !caloMETs.isValid())
261  return;
262  if ((isPFMET) and !pfMETs.isValid())
263  return;
264  if ((isGenMET) and !genMETs.isValid())
265  return;
266  if ((isMiniAODMET) and !patMET.isValid())
267  return;
268 
269  reco::MET met;
270  if (isCaloMET) {
271  met = caloMETs->front();
272  }
273  if (isPFMET) {
274  met = pfMETs->front();
275  }
276  if (isGenMET) {
277  met = genMETs->front();
278  }
279  if (isMiniAODMET) {
280  met = patMET->front();
281  }
282 
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();
289  mMEx->Fill(MEx);
290  mMEy->Fill(MEy);
291  mMET->Fill(MET);
292  mMETFine->Fill(MET);
293  mMET_Nvtx->Fill((double)nvtx, MET);
294  mMETPhi->Fill(METPhi);
295  mSumET->Fill(SumET);
296  mMETSig->Fill(METSig);
297 
298  // Get Generated MET for Resolution plots
299  const reco::GenMET *genMetTrue = nullptr;
300  bool isvalidgenmet = false;
301 
302  if (!isMiniAODMET) {
304  iEvent.getByToken(genMETsTrueToken_, genTrue);
305  if (genTrue.isValid()) {
306  isvalidgenmet = true;
307  const GenMETCollection *genmetcol = genTrue.product();
308  genMetTrue = &(genmetcol->front());
309  }
310  } else {
311  genMetTrue = patMET->front().genMET();
312  isvalidgenmet = true;
313  }
314 
315  if (isvalidgenmet) {
316  double genMET = genMetTrue->pt();
317  double genMETPhi = genMetTrue->phi();
318 
319  mMETDifference_GenMETTrue->Fill(MET - genMET);
320  mMETDeltaPhi_GenMETTrue->Fill(TMath::ACos(TMath::Cos(METPhi - genMETPhi)));
321 
322  if (!isGenMET) {
323  // pfMET resolution in pfMET bins : Sam, Feb, 2012
324  if (MET > 0 && MET < 20)
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);
344  else if (MET > 500)
345  mMETDifference_GenMETTrue_MET500->Fill(MET - genMET);
346 
347  } else {
348  edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task: genMetTrue";
349  }
350  }
351  if (!isMiniAODMET) {
353  iEvent.getByToken(genMETsCaloToken_, genCalo);
354  if (genCalo.isValid()) {
355  const GenMETCollection *genmetcol = genCalo.product();
356  const GenMET *genMetCalo = &(genmetcol->front());
357  const double genMET = genMetCalo->pt();
358  const double genMETPhi = genMetCalo->phi();
359 
360  mMETDifference_GenMETCalo->Fill(MET - genMET);
361  mMETDeltaPhi_GenMETCalo->Fill(TMath::ACos(TMath::Cos(METPhi - genMETPhi)));
362  } else {
363  edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task: genMetCalo";
364  }
365  }
366  if (isCaloMET) {
367  const reco::CaloMET *calomet = &(caloMETs->front());
368  // ==========================================================
369  // Reconstructed MET Information
370  const double caloMaxEtInEMTowers = calomet->maxEtInEmTowers();
371  const double caloMaxEtInHadTowers = calomet->maxEtInHadTowers();
372  const double caloEtFractionHadronic = calomet->etFractionHadronic();
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();
381  const double caloSETInpHF = calomet->CaloSETInpHF();
382  const double caloSETInmHF = calomet->CaloSETInmHF();
383 
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);
397  }
398  if (isGenMET) {
399  const GenMET *genmet;
400  // Get Generated MET
401  genmet = &(genMETs->front());
402 
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();
409 
410  mNeutralEMEtFraction->Fill(NeutralEMEtFraction);
411  mNeutralHadEtFraction->Fill(NeutralHadEtFraction);
412  mChargedEMEtFraction->Fill(ChargedEMEtFraction);
413  mChargedHadEtFraction->Fill(ChargedHadEtFraction);
414  mMuonEtFraction->Fill(MuonEtFraction);
415  mInvisibleEtFraction->Fill(InvisibleEtFraction);
416  }
417  if (isPFMET) {
418  const reco::PFMET *pfmet = &(pfMETs->front());
419  mPFphotonEtFraction->Fill(pfmet->photonEtFraction());
420  mPFphotonEt->Fill(pfmet->photonEt());
421  mPFneutralHadronEtFraction->Fill(pfmet->neutralHadronEtFraction());
422  mPFneutralHadronEt->Fill(pfmet->neutralHadronEt());
423  mPFelectronEtFraction->Fill(pfmet->electronEtFraction());
424  mPFelectronEt->Fill(pfmet->electronEt());
425  mPFchargedHadronEtFraction->Fill(pfmet->chargedHadronEtFraction());
426  mPFchargedHadronEt->Fill(pfmet->chargedHadronEt());
427  mPFmuonEtFraction->Fill(pfmet->muonEtFraction());
428  mPFmuonEt->Fill(pfmet->muonEt());
429  mPFHFHadronEtFraction->Fill(pfmet->HFHadronEtFraction());
430  mPFHFHadronEt->Fill(pfmet->HFHadronEt());
431  mPFHFEMEtFraction->Fill(pfmet->HFEMEtFraction());
432  mPFHFEMEt->Fill(pfmet->HFEMEt());
433  // Reconstructed MET Information
434  }
435  if (isMiniAODMET) {
436  const pat::MET *patmet = &(patMET->front());
437  mMETUnc_JetResUp->Fill(MET - patmet->shiftedPt(pat::MET::JetResUp));
438  mMETUnc_JetResDown->Fill(MET - patmet->shiftedPt(pat::MET::JetResDown));
439  mMETUnc_JetEnUp->Fill(MET - patmet->shiftedPt(pat::MET::JetEnUp));
440  mMETUnc_JetEnDown->Fill(MET - patmet->shiftedPt(pat::MET::JetEnDown));
441  mMETUnc_MuonEnUp->Fill(MET - patmet->shiftedPt(pat::MET::MuonEnUp));
442  mMETUnc_MuonEnDown->Fill(MET - patmet->shiftedPt(pat::MET::MuonEnDown));
443  mMETUnc_ElectronEnUp->Fill(MET - patmet->shiftedPt(pat::MET::ElectronEnUp));
444  mMETUnc_ElectronEnDown->Fill(MET - patmet->shiftedPt(pat::MET::ElectronEnDown));
445  mMETUnc_TauEnUp->Fill(MET - patmet->shiftedPt(pat::MET::TauEnUp));
446  mMETUnc_TauEnDown->Fill(MET - patmet->shiftedPt(pat::MET::TauEnDown));
447  mMETUnc_UnclusteredEnUp->Fill(MET - patmet->shiftedPt(pat::MET::UnclusteredEnUp));
448  mMETUnc_UnclusteredEnDown->Fill(MET - patmet->shiftedPt(pat::MET::UnclusteredEnDown));
449  mMETUnc_PhotonEnUp->Fill(MET - patmet->shiftedPt(pat::MET::PhotonEnUp));
450  mMETUnc_PhotonEnDown->Fill(MET - patmet->shiftedPt(pat::MET::PhotonEnDown));
451 
452  if (patmet->isPFMET()) {
453  mPFphotonEtFraction->Fill(patmet->NeutralEMFraction());
454  mPFneutralHadronEtFraction->Fill(patmet->NeutralHadEtFraction());
455  mPFelectronEtFraction->Fill(patmet->ChargedEMEtFraction());
456  mPFchargedHadronEtFraction->Fill(patmet->ChargedHadEtFraction());
457  mPFmuonEtFraction->Fill(patmet->MuonEtFraction());
458  mPFHFHadronEtFraction->Fill(patmet->Type6EtFraction()); // HFHadrons
459  mPFHFEMEtFraction->Fill(patmet->Type7EtFraction()); // HFEMEt
460  }
461  }
462 }
Analysis-level MET class.
Definition: MET.h:43
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double hadEtInHE() const
Definition: CaloMET.h:51
Collection of Gen MET.
double HFEMEtFraction() const
Definition: PFMET.h:47
double hadEtInHF() const
Definition: CaloMET.h:53
double ChargedHadEtFraction() const
Definition: MET.h:140
double CaloSETInmHF() const
Definition: CaloMET.h:65
double MuonEtFraction() const
Definition: MET.h:141
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
double maxEtInHadTowers() const
Definition: CaloMET.h:40
double neutralHadronEtFraction() const
Definition: PFMET.h:32
double px() const final
x coordinate of momentum vector
genmet
do same things for GEN
double muonEt() const
Definition: PFMET.h:42
double MuonEtFraction() const
Definition: GenMET.h:57
double pt() const final
transverse momentum
double NeutralEMFraction() const
Definition: MET.h:137
double ChargedEMEtFraction() const
Definition: MET.h:139
genMetCalo
____________________________________________________________________________||
double maxEtInEmTowers() const
Definition: CaloMET.h:38
double Type6EtFraction() const
Definition: MET.h:142
double Type7EtFraction() const
Definition: MET.h:143
double NeutralHadEtFraction() const
Definition: MET.h:138
bool isPFMET() const
True if this pat::MET was made from a reco::pfMET.
Definition: MET.h:89
double mEtSig() const
Definition: MET.h:58
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: METTester.cc:129
double HFHadronEtFraction() const
Definition: PFMET.h:44
int iEvent
Definition: GenABIO.cc:224
double sumEt() const
Definition: MET.h:56
double muonEtFraction() const
Definition: PFMET.h:41
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
double HFHadronEt() const
Definition: PFMET.h:45
Definition: MET.h:42
double photonEtFraction() const
Definition: PFMET.h:29
double ChargedEMEtFraction() const
Definition: GenMET.h:39
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
double emEtInEB() const
Definition: CaloMET.h:55
bool isValid() const
Definition: HandleBase.h:74
double CaloSETInpHF() const
Definition: CaloMET.h:63
double InvisibleEtFraction() const
Definition: GenMET.h:63
double HFEMEt() const
Definition: PFMET.h:48
double shiftedPt(METUncertainty shift, METCorrectionLevel level=Type1) const
Definition: MET.h:180
double hadEtInHO() const
Definition: CaloMET.h:49
double electronEt() const
Definition: PFMET.h:36
double etFractionHadronic() const
Definition: CaloMET.h:42
T const * product() const
Definition: Handle.h:74
double photonEt() const
Definition: PFMET.h:30
met
===> hadronic RAZOR
double py() const final
y coordinate of momentum vector
double NeutralEMEtFraction() const
Definition: GenMET.h:33
double emEtInEE() const
Definition: CaloMET.h:57
double electronEtFraction() const
Definition: PFMET.h:35
double chargedHadronEtFraction() const
Definition: PFMET.h:38
fixed size matrix
HLT enums.
genMetTrue
____________________________________________________________________________||
METTester(const edm::ParameterSet &)
Definition: METTester.cc:33
double NeutralHadEtFraction() const
Definition: GenMET.h:45
double emEtInHF() const
Definition: CaloMET.h:59
double neutralHadronEt() const
Definition: PFMET.h:33
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: METTester.cc:234
double ChargedHadEtFraction() const
Definition: GenMET.h:51
double phi() const final
momentum azimuthal angle
double hadEtInHB() const
Definition: CaloMET.h:47
double emEtFraction() const
Definition: CaloMET.h:45
double chargedHadronEt() const
Definition: PFMET.h:39
Definition: Run.h:45