CMS 3D CMS Logo

DataCertificationJetMET.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DQMOffline/JetMET
4 // Class: DataCertificationJetMET
5 //
6 // Original Author: "Frank Chlebana"
7 // Created: Sun Oct 5 13:57:25 CDT 2008
8 //
9 
13 
14 // Some switches
15 //
16 // constructors and destructor
17 //
19  // now do what ever initialization is needed
20  inputMETLabelRECO_ = iConfig.getParameter<edm::InputTag>("METTypeRECO");
21  inputMETLabelRECOUncleaned_ = iConfig.getParameter<edm::InputTag>("METTypeRECOUncleaned");
22  inputMETLabelMiniAOD_ = iConfig.getParameter<edm::InputTag>("METTypeMiniAOD");
23  inputJetLabelRECO_ = iConfig.getParameter<edm::InputTag>("JetTypeRECO");
24  inputJetLabelMiniAOD_ = iConfig.getParameter<edm::InputTag>("JetTypeMiniAOD");
25 
26  nbinsPV_ = iConfig.getParameter<int>("pVBin");
27  nPVMin_ = iConfig.getParameter<double>("pVMin");
28  nPVMax_ = iConfig.getParameter<double>("pVMax");
29 
30  etaBin_ = iConfig.getParameter<int>("etaBin");
31  etaMin_ = iConfig.getParameter<double>("etaMin");
32  etaMax_ = iConfig.getParameter<double>("etaMax");
33 
34  ptBin_ = iConfig.getParameter<int>("ptBin");
35  ptMin_ = iConfig.getParameter<double>("ptMin");
36  ptMax_ = iConfig.getParameter<double>("ptMax");
37 
38  // -----------------------------------------
39  // verbose_ 0: suppress printouts
40  // 1: show printouts
41  verbose_ = conf_.getUntrackedParameter<int>("Verbose", 0);
45 
46  jetTests[0][0] = conf_.getUntrackedParameter<bool>("pfBarrelJetMeanTest", true);
47  jetTests[0][1] = conf_.getUntrackedParameter<bool>("pfBarrelJetKSTest", false);
48  jetTests[1][0] = conf_.getUntrackedParameter<bool>("pfEndcapJetMeanTest", true);
49  jetTests[1][1] = conf_.getUntrackedParameter<bool>("pfEndcapJetKSTest", false);
50  jetTests[2][0] = conf_.getUntrackedParameter<bool>("pfForwardJetMeanTest", true);
51  jetTests[2][1] = conf_.getUntrackedParameter<bool>("pfForwardJetKSTest", false);
52  jetTests[3][0] = conf_.getUntrackedParameter<bool>("caloJetMeanTest", true);
53  jetTests[3][1] = conf_.getUntrackedParameter<bool>("caloJetKSTest", false);
54  jetTests[4][0] = conf_.getUntrackedParameter<bool>("jptJetMeanTest", true);
55  jetTests[4][1] = conf_.getUntrackedParameter<bool>("jptJetKSTest", false);
56 
57  metTests[0][0] = conf_.getUntrackedParameter<bool>("caloMETMeanTest", true);
58  metTests[0][1] = conf_.getUntrackedParameter<bool>("caloMETKSTest", false);
59  metTests[1][0] = conf_.getUntrackedParameter<bool>("pfMETMeanTest", true);
60  metTests[1][1] = conf_.getUntrackedParameter<bool>("pfMETKSTest", false);
61  metTests[2][0] = conf_.getUntrackedParameter<bool>("tcMETMeanTest", true);
62  metTests[2][1] = conf_.getUntrackedParameter<bool>("tcMETKSTest", false);
63 
64  isHI = conf_.getUntrackedParameter<bool>("isHI", false);
65 
66  if (verbose_)
67  std::cout << ">>> Constructor (DataCertificationJetMET) <<<" << std::endl;
68 
69  // -----------------------------------------
70  //
71 }
72 
74  // do anything here that needs to be done at desctruction time
75  // (e.g. close files, deallocate resources etc.)
76  if (verbose_)
77  std::cout << ">>> Deconstructor (DataCertificationJetMET) <<<" << std::endl;
78 }
79 
80 // ------------ method called right after a run ends ------------
82  //put RECO vs MiniAODDir first ->first MET
83  std::vector<std::string> subDirVecMET;
84  std::string RunDirMET = "JetMET/MET/";
85  iget_.setCurrentFolder(RunDirMET);
86  subDirVecMET = iget_.getSubdirs();
87  bool found_METreco_dir = false;
88  bool found_METminiaod_dir = false;
89  //check if proper directories are inside the files
90  for (int i = 0; i < int(subDirVecMET.size()); i++) {
91  ibook_.setCurrentFolder(subDirVecMET[i]);
92  if ((subDirVecMET[i] + "/Cleaned") == (RunDirMET + inputMETLabelRECO_.label() + "/Cleaned")) {
93  found_METreco_dir = true;
94  }
95  if (((subDirVecMET[i] + "/Uncleaned") == (RunDirMET + inputMETLabelRECOUncleaned_.label() + "/Uncleaned")) ||
96  ((subDirVecMET[i] + "/Uncleaned") == (RunDirMET + inputMETLabelMiniAOD_.label() + "/Uncleaned"))) {
97  //check filters in uncleaned directory
98  std::string rundirMET_reco = "";
99  if ((subDirVecMET[i] + "/Uncleaned") == (RunDirMET + inputMETLabelRECOUncleaned_.label() + "/Uncleaned")) {
100  rundirMET_reco = RunDirMET + inputMETLabelRECOUncleaned_.label() + "/Uncleaned";
101  } else {
102  rundirMET_reco = RunDirMET + inputMETLabelMiniAOD_.label() + "/Uncleaned";
103  }
104  MonitorElement* mMET_Reco = iget_.get(rundirMET_reco + "/" + "MET");
105  MonitorElement* mMET_Reco_HBHENoiseFilter = iget_.get(rundirMET_reco + "/" + "MET_HBHENoiseFilter");
106  MonitorElement* mMET_Reco_CSCTightHaloFilter = iget_.get(rundirMET_reco + "/" + "MET_CSCTightHaloFilter");
107  MonitorElement* mMET_Reco_eeBadScFilter = iget_.get(rundirMET_reco + "/" + "MET_eeBadScFilter");
108  MonitorElement* mMET_Reco_HBHEIsoNoiseFilter = iget_.get(rundirMET_reco + "/" + "MET_HBHEIsoNoiseFilter");
109  MonitorElement* mMET_Reco_CSCTightHalo2015Filter = iget_.get(rundirMET_reco + "/" + "MET_CSCTightHalo2015Filter");
110  MonitorElement* mMET_Reco_EcalDeadCellTriggerFilter =
111  iget_.get(rundirMET_reco + "/" + "MET_EcalDeadCellTriggerFilter");
112  MonitorElement* mMET_Reco_EcalDeadCellBoundaryFilter =
113  iget_.get(rundirMET_reco + "/" + "MET_EcalDeadCellBoundaryFilter");
114  MonitorElement* mMET_Reco_HcalStripHaloFilter = iget_.get(rundirMET_reco + "/" + "MET_HcalStripHaloFilter");
115  ibook_.setCurrentFolder(rundirMET_reco);
117  ibook_.book1D("MET_EffHBHENoiseFilter", (TH1F*)mMET_Reco_HBHENoiseFilter->getRootObject());
118  for (int i = 0; i <= (mMET_Reco->getNbinsX() + 1); i++) {
119  if (mMET_Reco->getBinContent(i) != 0) {
121  i, mMET_Reco_HBHENoiseFilter->getBinContent(i) / mMET_Reco->getBinContent(i));
122  } else {
124  }
125  }
127  ibook_.book1D("MET_EffCSCTightHaloFilter", (TH1F*)mMET_Reco_CSCTightHaloFilter->getRootObject());
128  for (int i = 0; i <= (mMET_Reco->getNbinsX() + 1); i++) {
129  if (mMET_Reco->getBinContent(i) != 0) {
131  i, mMET_Reco_CSCTightHaloFilter->getBinContent(i) / mMET_Reco->getBinContent(i));
132  } else {
134  }
135  }
136  mMET_EffeeBadScFilter = ibook_.book1D("MET_EffeeBadScFilter", (TH1F*)mMET_Reco_eeBadScFilter->getRootObject());
137  for (int i = 0; i <= (mMET_Reco->getNbinsX() + 1); i++) {
138  if (mMET_Reco->getBinContent(i) != 0) {
140  mMET_Reco_eeBadScFilter->getBinContent(i) / mMET_Reco->getBinContent(i));
141  } else {
143  }
144  }
146  ibook_.book1D("MET_EffHBHEIsoNoiseFilter", (TH1F*)mMET_Reco_HBHEIsoNoiseFilter->getRootObject());
147  for (int i = 0; i <= (mMET_Reco->getNbinsX() + 1); i++) {
148  if (mMET_Reco->getBinContent(i) != 0) {
150  i, mMET_Reco_HBHEIsoNoiseFilter->getBinContent(i) / mMET_Reco->getBinContent(i));
151  } else {
153  }
154  }
156  ibook_.book1D("MET_EffCSCTightHalo2015Filter", (TH1F*)mMET_Reco_CSCTightHalo2015Filter->getRootObject());
157  for (int i = 0; i <= (mMET_Reco->getNbinsX() + 1); i++) {
158  if (mMET_Reco->getBinContent(i) != 0) {
160  i, mMET_Reco_CSCTightHalo2015Filter->getBinContent(i) / mMET_Reco->getBinContent(i));
161  } else {
163  }
164  }
165  mMET_EffEcalDeadCellTriggerFilter = ibook_.book1D("MET_EffEcalDeadCellTriggerFilter",
166  (TH1F*)mMET_Reco_EcalDeadCellTriggerFilter->getRootObject());
167  for (int i = 0; i <= (mMET_Reco->getNbinsX() + 1); i++) {
168  if (mMET_Reco->getBinContent(i) != 0) {
170  i, mMET_Reco_EcalDeadCellTriggerFilter->getBinContent(i) / mMET_Reco->getBinContent(i));
171  } else {
173  }
174  }
175  mMET_EffEcalDeadCellBoundaryFilter = ibook_.book1D("MET_EffEcalDeadCellBoundaryFilter",
176  (TH1F*)mMET_Reco_EcalDeadCellBoundaryFilter->getRootObject());
177  for (int i = 0; i <= (mMET_Reco->getNbinsX() + 1); i++) {
178  if (mMET_Reco->getBinContent(i) != 0) {
180  i, mMET_Reco_EcalDeadCellBoundaryFilter->getBinContent(i) / mMET_Reco->getBinContent(i));
181  } else {
183  }
184  }
186  ibook_.book1D("MET_EffHcalStripHaloFilter", (TH1F*)mMET_Reco_HcalStripHaloFilter->getRootObject());
187  for (int i = 0; i <= (mMET_Reco->getNbinsX() + 1); i++) {
188  if (mMET_Reco->getBinContent(i) != 0) {
190  i, mMET_Reco_HcalStripHaloFilter->getBinContent(i) / mMET_Reco->getBinContent(i));
191  } else {
193  }
194  }
195  }
196  if ((subDirVecMET[i] + "/Cleaned") == (RunDirMET + inputMETLabelMiniAOD_.label() + "/Cleaned")) {
197  found_METminiaod_dir = true;
198  }
199  }
200  if (found_METreco_dir && found_METminiaod_dir) {
201  std::string rundirMET_reco = RunDirMET + inputMETLabelRECO_.label() + "/Cleaned";
202  std::string rundirMET_miniaod = RunDirMET + inputMETLabelMiniAOD_.label() + "/Cleaned";
203  MonitorElement* mMET_Reco = iget_.get(rundirMET_reco + "/" + "MET");
204  MonitorElement* mMEy_Reco = iget_.get(rundirMET_reco + "/" + "MEy");
205  MonitorElement* mSumET_Reco = iget_.get(rundirMET_reco + "/" + "SumET");
206  MonitorElement* mMETPhi_Reco = iget_.get(rundirMET_reco + "/" + "METPhi");
207  MonitorElement* mMET_logx_Reco = iget_.get(rundirMET_reco + "/" + "MET_logx");
208  MonitorElement* mSumET_logx_Reco = iget_.get(rundirMET_reco + "/" + "SumET_logx");
209  MonitorElement* mChargedHadronEtFraction_Reco = iget_.get(rundirMET_reco + "/" + "PfChargedHadronEtFraction");
210  MonitorElement* mNeutralHadronEtFraction_Reco = iget_.get(rundirMET_reco + "/" + "PfNeutralHadronEtFraction");
211  MonitorElement* mPhotonEtFraction_Reco = iget_.get(rundirMET_reco + "/" + "PfPhotonEtFraction");
212  MonitorElement* mHFHadronEtFraction_Reco = iget_.get(rundirMET_reco + "/" + "PfHFHadronEtFraction");
213  MonitorElement* mHFEMEtFraction_Reco = iget_.get(rundirMET_reco + "/" + "PfHFEMEtFraction");
214  MonitorElement* mMET_nVtx_profile_Reco = iget_.get(rundirMET_reco + "/" + "MET_profile");
215  MonitorElement* mSumET_nVtx_profile_Reco = iget_.get(rundirMET_reco + "/" + "SumET_profile");
216  MonitorElement* mChargedHadronEtFraction_nVtx_profile_Reco =
217  iget_.get(rundirMET_reco + "/" + "PfChargedHadronEtFraction_profile");
218  MonitorElement* mNeutralHadronEtFraction_nVtx_profile_Reco =
219  iget_.get(rundirMET_reco + "/" + "PfNeutralHadronEtFraction_profile");
220  MonitorElement* mPhotonEtFraction_nVtx_profile_Reco =
221  iget_.get(rundirMET_reco + "/" + "PfPhotonEtFraction_profile");
222 
223  std::vector<MonitorElement*> me_MET_Reco;
224  me_MET_Reco.push_back(mMET_Reco);
225  me_MET_Reco.push_back(mMEy_Reco);
226  me_MET_Reco.push_back(mSumET_Reco);
227  me_MET_Reco.push_back(mMETPhi_Reco);
228  me_MET_Reco.push_back(mMET_logx_Reco);
229  me_MET_Reco.push_back(mSumET_logx_Reco);
230  me_MET_Reco.push_back(mChargedHadronEtFraction_Reco);
231  me_MET_Reco.push_back(mNeutralHadronEtFraction_Reco);
232  me_MET_Reco.push_back(mPhotonEtFraction_Reco);
233  me_MET_Reco.push_back(mHFHadronEtFraction_Reco);
234  me_MET_Reco.push_back(mHFEMEtFraction_Reco);
235  me_MET_Reco.push_back(mMET_nVtx_profile_Reco);
236  me_MET_Reco.push_back(mSumET_nVtx_profile_Reco);
237  me_MET_Reco.push_back(mChargedHadronEtFraction_nVtx_profile_Reco);
238  me_MET_Reco.push_back(mNeutralHadronEtFraction_nVtx_profile_Reco);
239  me_MET_Reco.push_back(mPhotonEtFraction_nVtx_profile_Reco);
240 
241  MonitorElement* mMET_MiniAOD = iget_.get(rundirMET_miniaod + "/" + "MET");
242  MonitorElement* mMEy_MiniAOD = iget_.get(rundirMET_miniaod + "/" + "MEy");
243  MonitorElement* mSumET_MiniAOD = iget_.get(rundirMET_miniaod + "/" + "SumET");
244  MonitorElement* mMETPhi_MiniAOD = iget_.get(rundirMET_miniaod + "/" + "METPhi");
245  MonitorElement* mMET_logx_MiniAOD = iget_.get(rundirMET_miniaod + "/" + "MET_logx");
246  MonitorElement* mSumET_logx_MiniAOD = iget_.get(rundirMET_miniaod + "/" + "SumET_logx");
247  MonitorElement* mChargedHadronEtFraction_MiniAOD = iget_.get(rundirMET_miniaod + "/" + "PfChargedHadronEtFraction");
248  MonitorElement* mNeutralHadronEtFraction_MiniAOD = iget_.get(rundirMET_miniaod + "/" + "PfNeutralHadronEtFraction");
249  MonitorElement* mPhotonEtFraction_MiniAOD = iget_.get(rundirMET_miniaod + "/" + "PfPhotonEtFraction");
250  MonitorElement* mHFHadronEtFraction_MiniAOD = iget_.get(rundirMET_miniaod + "/" + "PfHFHadronEtFraction");
251  MonitorElement* mHFEMEtFraction_MiniAOD = iget_.get(rundirMET_miniaod + "/" + "PfHFEMEtFraction");
252  MonitorElement* mMET_nVtx_profile_MiniAOD = iget_.get(rundirMET_miniaod + "/" + "MET_profile");
253  MonitorElement* mSumET_nVtx_profile_MiniAOD = iget_.get(rundirMET_miniaod + "/" + "SumET_profile");
254  MonitorElement* mChargedHadronEtFraction_nVtx_profile_MiniAOD =
255  iget_.get(rundirMET_miniaod + "/" + "PfChargedHadronEtFraction_profile");
256  MonitorElement* mNeutralHadronEtFraction_nVtx_profile_MiniAOD =
257  iget_.get(rundirMET_miniaod + "/" + "PfNeutralHadronEtFraction_profile");
258  MonitorElement* mPhotonEtFraction_nVtx_profile_MiniAOD =
259  iget_.get(rundirMET_miniaod + "/" + "PfPhotonEtFraction_profile");
260 
261  std::vector<MonitorElement*> me_MET_MiniAOD;
262  me_MET_MiniAOD.push_back(mMET_MiniAOD);
263  me_MET_MiniAOD.push_back(mMEy_MiniAOD);
264  me_MET_MiniAOD.push_back(mSumET_MiniAOD);
265  me_MET_MiniAOD.push_back(mMETPhi_MiniAOD);
266  me_MET_MiniAOD.push_back(mMET_logx_MiniAOD);
267  me_MET_MiniAOD.push_back(mSumET_logx_MiniAOD);
268  me_MET_MiniAOD.push_back(mChargedHadronEtFraction_MiniAOD);
269  me_MET_MiniAOD.push_back(mNeutralHadronEtFraction_MiniAOD);
270  me_MET_MiniAOD.push_back(mPhotonEtFraction_MiniAOD);
271  me_MET_MiniAOD.push_back(mHFHadronEtFraction_MiniAOD);
272  me_MET_MiniAOD.push_back(mHFEMEtFraction_MiniAOD);
273  me_MET_MiniAOD.push_back(mMET_nVtx_profile_MiniAOD);
274  me_MET_MiniAOD.push_back(mSumET_nVtx_profile_MiniAOD);
275  me_MET_MiniAOD.push_back(mChargedHadronEtFraction_nVtx_profile_MiniAOD);
276  me_MET_MiniAOD.push_back(mNeutralHadronEtFraction_nVtx_profile_MiniAOD);
277  me_MET_MiniAOD.push_back(mPhotonEtFraction_nVtx_profile_MiniAOD);
278 
279  ibook_.setCurrentFolder(RunDirMET + "MiniAOD_over_RECO");
280  mMET_MiniAOD_over_Reco = ibook_.book1D("MET_MiniAOD_over_RECO", (TH1F*)mMET_Reco->getRootObject());
281  mMEy_MiniAOD_over_Reco = ibook_.book1D("MEy_MiniAOD_over_RECO", (TH1F*)mMEy_Reco->getRootObject());
282  mSumET_MiniAOD_over_Reco = ibook_.book1D("SumET_MiniAOD_over_RECO", (TH1F*)mSumET_Reco->getRootObject());
283  mMETPhi_MiniAOD_over_Reco = ibook_.book1D("METPhi_MiniAOD_over_RECO", (TH1F*)mMETPhi_Reco->getRootObject());
284  mMET_logx_MiniAOD_over_Reco = ibook_.book1D("MET_logx_MiniAOD_over_RECO", (TH1F*)mMET_logx_Reco->getRootObject());
286  ibook_.book1D("SumET_logx_MiniAOD_over_RECO", (TH1F*)mSumET_logx_Reco->getRootObject());
287  mChargedHadronEtFraction_MiniAOD_over_Reco = ibook_.book1D("PfChargedHadronEtFraction_MiniAOD_over_RECO",
288  (TH1F*)mChargedHadronEtFraction_Reco->getRootObject());
289  mNeutralHadronEtFraction_MiniAOD_over_Reco = ibook_.book1D("PfNeutralHadronEtFraction_MiniAOD_over_RECO",
290  (TH1F*)mNeutralHadronEtFraction_Reco->getRootObject());
292  ibook_.book1D("PfPhotonEtFraction_MiniAOD_over_RECO", (TH1F*)mPhotonEtFraction_Reco->getRootObject());
294  ibook_.book1D("PfHFHadronEtFraction_MiniAOD_over_RECO", (TH1F*)mHFHadronEtFraction_Reco->getRootObject());
296  ibook_.book1D("PfHFEMEtFraction_MiniAOD_over_RECO", (TH1F*)mHFEMEtFraction_Reco->getRootObject());
297  //use same parameters defining X-Axis of the profiles
299  ibook_.book1D("MET_profile_MiniAOD_over_RECO", "MET_vs_nVtx", nbinsPV_, nPVMin_, nPVMax_);
301  ibook_.book1D("SumET_profile_MiniAOD_over_RECO", "SumET_vs_nVtx", nbinsPV_, nPVMin_, nPVMax_);
303  ibook_.book1D("PfChargedHadronEtFraction_profile_MiniAOD_over_RECO",
304  "PfChargedHadronEtFraction_vs_nVtx",
305  nbinsPV_,
306  nPVMin_,
307  nPVMax_);
309  ibook_.book1D("PfNeutralHadronEtFraction_profile_MiniAOD_over_RECO",
310  "PfNeutralHadronEtFraction_vs_nVtx",
311  nbinsPV_,
312  nPVMin_,
313  nPVMax_);
315  "PfPhotonEtFraction_profile_MiniAOD_over_RECO", "PfPhotonEtFraction_vs_nVtx", nbinsPV_, nPVMin_, nPVMax_);
316 
317  std::vector<MonitorElement*> me_MET_MiniAOD_over_Reco;
318  me_MET_MiniAOD_over_Reco.push_back(mMET_MiniAOD_over_Reco);
319  me_MET_MiniAOD_over_Reco.push_back(mMEy_MiniAOD_over_Reco);
320  me_MET_MiniAOD_over_Reco.push_back(mSumET_MiniAOD_over_Reco);
321  me_MET_MiniAOD_over_Reco.push_back(mMETPhi_MiniAOD_over_Reco);
322  me_MET_MiniAOD_over_Reco.push_back(mMET_logx_MiniAOD_over_Reco);
323  me_MET_MiniAOD_over_Reco.push_back(mSumET_logx_MiniAOD_over_Reco);
324  me_MET_MiniAOD_over_Reco.push_back(mChargedHadronEtFraction_MiniAOD_over_Reco);
325  me_MET_MiniAOD_over_Reco.push_back(mNeutralHadronEtFraction_MiniAOD_over_Reco);
326  me_MET_MiniAOD_over_Reco.push_back(mPhotonEtFraction_MiniAOD_over_Reco);
327  me_MET_MiniAOD_over_Reco.push_back(mHFHadronEtFraction_MiniAOD_over_Reco);
328  me_MET_MiniAOD_over_Reco.push_back(mHFEMEtFraction_MiniAOD_over_Reco);
329  me_MET_MiniAOD_over_Reco.push_back(mMET_nVtx_profile_MiniAOD_over_Reco);
330  me_MET_MiniAOD_over_Reco.push_back(mSumET_nVtx_profile_MiniAOD_over_Reco);
331  me_MET_MiniAOD_over_Reco.push_back(mChargedHadronEtFraction_nVtx_profile_MiniAOD_over_Reco);
332  me_MET_MiniAOD_over_Reco.push_back(mNeutralHadronEtFraction_nVtx_profile_MiniAOD_over_Reco);
333  me_MET_MiniAOD_over_Reco.push_back(mPhotonEtFraction_nVtx_profile_MiniAOD_over_Reco);
334 
335  for (unsigned int j = 0; j < me_MET_MiniAOD_over_Reco.size(); j++) {
336  MonitorElement* monMETReco = me_MET_Reco[j];
337  if (monMETReco && monMETReco->getRootObject()) {
338  MonitorElement* monMETMiniAOD = me_MET_MiniAOD[j];
339  if (monMETMiniAOD && monMETMiniAOD->getRootObject()) {
340  MonitorElement* monMETMiniAOD_over_RECO = me_MET_MiniAOD_over_Reco[j];
341  if (monMETMiniAOD_over_RECO && monMETMiniAOD_over_RECO->getRootObject()) {
342  for (int i = 0; i <= (monMETMiniAOD_over_RECO->getNbinsX() + 1); i++) {
343  if (monMETReco->getBinContent(i) != 0) {
344  monMETMiniAOD_over_RECO->setBinContent(i,
345  monMETMiniAOD->getBinContent(i) / monMETReco->getBinContent(i));
346  } else if (monMETMiniAOD->getBinContent(i) != 0) {
347  monMETMiniAOD_over_RECO->setBinContent(i, -0.5);
348  }
349  }
350  }
351  }
352  }
353  }
354  } //check for RECO and MiniAOD directories
355 
356  //put RECO vs MiniAODDir first ->second Jets
357  std::vector<std::string> subDirVecJet;
358  //go only for cleaned directory
359  std::string RunDirJet = "JetMET/Jet/";
360  iget_.setCurrentFolder(RunDirJet);
361  subDirVecJet = iget_.getSubdirs();
362  bool found_Jetreco_dir = false;
363  bool found_Jetminiaod_dir = false;
364  for (int i = 0; i < int(subDirVecJet.size()); i++) {
365  ibook_.setCurrentFolder(subDirVecJet[i]);
366  if (subDirVecJet[i] == (RunDirJet + "Cleaned" + inputJetLabelRECO_.label())) {
367  found_Jetreco_dir = true;
368  }
369  if (subDirVecJet[i] == (RunDirJet + "Cleaned" + inputJetLabelMiniAOD_.label())) {
370  found_Jetminiaod_dir = true;
371  }
372  }
373  if (found_Jetreco_dir && found_Jetminiaod_dir) {
374  std::string rundirJet_reco = RunDirJet + "Cleaned" + inputJetLabelRECO_.label();
375  std::string rundirJet_miniaod = RunDirJet + "Cleaned" + inputJetLabelMiniAOD_.label();
376 
377  MonitorElement* mPt_Reco = iget_.get(rundirJet_reco + "/" + "Pt");
378  MonitorElement* mEta_Reco = iget_.get(rundirJet_reco + "/" + "Eta");
379  MonitorElement* mPhi_Reco = iget_.get(rundirJet_reco + "/" + "Phi");
380  MonitorElement* mNjets_Reco = iget_.get(rundirJet_reco + "/" + "NJets");
381  MonitorElement* mPt_uncor_Reco = iget_.get(rundirJet_reco + "/" + "Pt_uncor");
382  MonitorElement* mEta_uncor_Reco = iget_.get(rundirJet_reco + "/" + "Eta_uncor");
383  MonitorElement* mPhi_uncor_Reco = iget_.get(rundirJet_reco + "/" + "Phi_uncor");
384  MonitorElement* mJetEnergyCorr_Reco = iget_.get(rundirJet_reco + "/" + "JetEnergyCorr");
385  MonitorElement* mJetEnergyCorrVSeta_Reco = iget_.get(rundirJet_reco + "/" + "JetEnergyCorrVSEta");
386  MonitorElement* mDPhi_Reco = iget_.get(rundirJet_reco + "/" + "DPhi");
387  MonitorElement* mLooseJIDPassFractionVSeta_Reco = iget_.get(rundirJet_reco + "/" + "JetIDPassFractionVSeta");
388  MonitorElement* mPt_Barrel_Reco = iget_.get(rundirJet_reco + "/" + "Pt_Barrel");
389  MonitorElement* mPt_EndCap_Reco = iget_.get(rundirJet_reco + "/" + "Pt_EndCap");
390  MonitorElement* mPt_Forward_Reco = iget_.get(rundirJet_reco + "/" + "Pt_Forward");
391  MonitorElement* mMVAPUJIDDiscriminant_lowPt_Barrel_Reco =
392  iget_.get(rundirJet_reco + "/" + "MVAPUJIDDiscriminant_lowPt_Barrel");
393  MonitorElement* mMVAPUJIDDiscriminant_lowPt_EndCap_Reco =
394  iget_.get(rundirJet_reco + "/" + "MVAPUJIDDiscriminant_lowPt_EndCap");
395  MonitorElement* mMVAPUJIDDiscriminant_lowPt_Forward_Reco =
396  iget_.get(rundirJet_reco + "/" + "MVAPUJIDDiscriminant_lowPt_Forward");
397  MonitorElement* mMVAPUJIDDiscriminant_mediumPt_EndCap_Reco =
398  iget_.get(rundirJet_reco + "/" + "MVAPUJIDDiscriminant_mediumPt_EndCap");
399  MonitorElement* mMVAPUJIDDiscriminant_highPt_Barrel_Reco =
400  iget_.get(rundirJet_reco + "/" + "MVAPUJIDDiscriminant_highPt_Barrel");
401  MonitorElement* mCHFracVSpT_Barrel_Reco = iget_.get(rundirJet_reco + "/" + "CHFracVSpT_Barrel");
402  MonitorElement* mNHFracVSpT_EndCap_Reco = iget_.get(rundirJet_reco + "/" + "NHFracVSpT_EndCap");
403  MonitorElement* mPhFracVSpT_Barrel_Reco = iget_.get(rundirJet_reco + "/" + "PhFracVSpT_Barrel");
404  MonitorElement* mHFHFracVSpT_Forward_Reco = iget_.get(rundirJet_reco + "/" + "HFHFracVSpT_Forward");
405  MonitorElement* mHFEFracVSpT_Forward_Reco = iget_.get(rundirJet_reco + "/" + "HFEFracVSpT_Forward");
406  MonitorElement* mCHFrac_Reco = iget_.get(rundirJet_reco + "/DiJet/" + "CHFrac");
407  MonitorElement* mNHFrac_Reco = iget_.get(rundirJet_reco + "/DiJet/" + "NHFrac");
408  MonitorElement* mPhFrac_Reco = iget_.get(rundirJet_reco + "/DiJet/" + "PhFrac");
409  MonitorElement* mChargedMultiplicity_Reco = iget_.get(rundirJet_reco + "/DiJet/" + "ChargedMultiplicity");
410  MonitorElement* mNeutralMultiplicity_Reco = iget_.get(rundirJet_reco + "/DiJet/" + "NeutralMultiplicity");
411  MonitorElement* mMuonMultiplicity_Reco = iget_.get(rundirJet_reco + "/DiJet/" + "MuonMultiplicity");
412  MonitorElement* mNeutralFraction_Reco = iget_.get(rundirJet_reco + "/DiJet/" + "NeutralConstituentsFraction");
413 
414  std::vector<MonitorElement*> me_Jet_Reco;
415  me_Jet_Reco.push_back(mPt_Reco);
416  me_Jet_Reco.push_back(mEta_Reco);
417  me_Jet_Reco.push_back(mPhi_Reco);
418  me_Jet_Reco.push_back(mNjets_Reco);
419  me_Jet_Reco.push_back(mPt_uncor_Reco);
420  me_Jet_Reco.push_back(mEta_uncor_Reco);
421  me_Jet_Reco.push_back(mPhi_uncor_Reco);
422  me_Jet_Reco.push_back(mJetEnergyCorr_Reco);
423  me_Jet_Reco.push_back(mJetEnergyCorrVSeta_Reco);
424  me_Jet_Reco.push_back(mDPhi_Reco);
425  me_Jet_Reco.push_back(mLooseJIDPassFractionVSeta_Reco);
426  me_Jet_Reco.push_back(mPt_Barrel_Reco);
427  me_Jet_Reco.push_back(mPt_EndCap_Reco);
428  me_Jet_Reco.push_back(mPt_Forward_Reco);
429  me_Jet_Reco.push_back(mMVAPUJIDDiscriminant_lowPt_Barrel_Reco);
430  me_Jet_Reco.push_back(mMVAPUJIDDiscriminant_lowPt_EndCap_Reco);
431  me_Jet_Reco.push_back(mMVAPUJIDDiscriminant_lowPt_Forward_Reco);
432  me_Jet_Reco.push_back(mMVAPUJIDDiscriminant_mediumPt_EndCap_Reco);
433  me_Jet_Reco.push_back(mMVAPUJIDDiscriminant_highPt_Barrel_Reco);
434  me_Jet_Reco.push_back(mCHFracVSpT_Barrel_Reco);
435  me_Jet_Reco.push_back(mNHFracVSpT_EndCap_Reco);
436  me_Jet_Reco.push_back(mPhFracVSpT_Barrel_Reco);
437  me_Jet_Reco.push_back(mHFHFracVSpT_Forward_Reco);
438  me_Jet_Reco.push_back(mHFEFracVSpT_Forward_Reco);
439  me_Jet_Reco.push_back(mCHFrac_Reco);
440  me_Jet_Reco.push_back(mNHFrac_Reco);
441  me_Jet_Reco.push_back(mPhFrac_Reco);
442  me_Jet_Reco.push_back(mChargedMultiplicity_Reco);
443  me_Jet_Reco.push_back(mNeutralMultiplicity_Reco);
444  me_Jet_Reco.push_back(mMuonMultiplicity_Reco);
445  me_Jet_Reco.push_back(mNeutralFraction_Reco);
446 
447  MonitorElement* mPt_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "Pt");
448  MonitorElement* mEta_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "Eta");
449  MonitorElement* mPhi_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "Phi");
450  MonitorElement* mNjets_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "NJets");
451  MonitorElement* mPt_uncor_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "Pt_uncor");
452  MonitorElement* mEta_uncor_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "Eta_uncor");
453  MonitorElement* mPhi_uncor_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "Phi_uncor");
454  MonitorElement* mJetEnergyCorr_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "JetEnergyCorr");
455  MonitorElement* mJetEnergyCorrVSeta_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "JetEnergyCorrVSEta");
456  MonitorElement* mDPhi_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "DPhi");
457  MonitorElement* mLooseJIDPassFractionVSeta_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "JetIDPassFractionVSeta");
458  MonitorElement* mPt_Barrel_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "Pt_Barrel");
459  MonitorElement* mPt_EndCap_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "Pt_EndCap");
460  MonitorElement* mPt_Forward_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "Pt_Forward");
461  MonitorElement* mMVAPUJIDDiscriminant_lowPt_Barrel_MiniAOD =
462  iget_.get(rundirJet_miniaod + "/" + "MVAPUJIDDiscriminant_lowPt_Barrel");
463  MonitorElement* mMVAPUJIDDiscriminant_lowPt_EndCap_MiniAOD =
464  iget_.get(rundirJet_miniaod + "/" + "MVAPUJIDDiscriminant_lowPt_EndCap");
465  MonitorElement* mMVAPUJIDDiscriminant_lowPt_Forward_MiniAOD =
466  iget_.get(rundirJet_miniaod + "/" + "MVAPUJIDDiscriminant_lowPt_Forward");
467  MonitorElement* mMVAPUJIDDiscriminant_mediumPt_EndCap_MiniAOD =
468  iget_.get(rundirJet_miniaod + "/" + "MVAPUJIDDiscriminant_mediumPt_EndCap");
469  MonitorElement* mMVAPUJIDDiscriminant_highPt_Barrel_MiniAOD =
470  iget_.get(rundirJet_miniaod + "/" + "MVAPUJIDDiscriminant_highPt_Barrel");
471  MonitorElement* mCHFracVSpT_Barrel_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "CHFracVSpT_Barrel");
472  MonitorElement* mNHFracVSpT_EndCap_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "NHFracVSpT_EndCap");
473  MonitorElement* mPhFracVSpT_Barrel_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "PhFracVSpT_Barrel");
474  MonitorElement* mHFHFracVSpT_Forward_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "HFHFracVSpT_Forward");
475  MonitorElement* mHFEFracVSpT_Forward_MiniAOD = iget_.get(rundirJet_miniaod + "/" + "HFEFracVSpT_Forward");
476  MonitorElement* mCHFrac_MiniAOD = iget_.get(rundirJet_miniaod + "/DiJet/" + "CHFrac");
477  MonitorElement* mNHFrac_MiniAOD = iget_.get(rundirJet_miniaod + "/DiJet/" + "NHFrac");
478  MonitorElement* mPhFrac_MiniAOD = iget_.get(rundirJet_miniaod + "/DiJet/" + "PhFrac");
479  MonitorElement* mChargedMultiplicity_MiniAOD = iget_.get(rundirJet_miniaod + "/DiJet/" + "ChargedMultiplicity");
480  MonitorElement* mNeutralMultiplicity_MiniAOD = iget_.get(rundirJet_miniaod + "/DiJet/" + "NeutralMultiplicity");
481  MonitorElement* mMuonMultiplicity_MiniAOD = iget_.get(rundirJet_miniaod + "/DiJet/" + "MuonMultiplicity");
482  MonitorElement* mNeutralFraction_MiniAOD = iget_.get(rundirJet_miniaod + "/DiJet/" + "NeutralConstituentsFraction");
483 
484  std::vector<MonitorElement*> me_Jet_MiniAOD;
485  me_Jet_MiniAOD.push_back(mPt_MiniAOD);
486  me_Jet_MiniAOD.push_back(mEta_MiniAOD);
487  me_Jet_MiniAOD.push_back(mPhi_MiniAOD);
488  me_Jet_MiniAOD.push_back(mNjets_MiniAOD);
489  me_Jet_MiniAOD.push_back(mPt_uncor_MiniAOD);
490  me_Jet_MiniAOD.push_back(mEta_uncor_MiniAOD);
491  me_Jet_MiniAOD.push_back(mPhi_uncor_MiniAOD);
492  me_Jet_MiniAOD.push_back(mJetEnergyCorr_MiniAOD);
493  me_Jet_MiniAOD.push_back(mJetEnergyCorrVSeta_MiniAOD);
494  me_Jet_MiniAOD.push_back(mDPhi_MiniAOD);
495  me_Jet_MiniAOD.push_back(mLooseJIDPassFractionVSeta_MiniAOD);
496  me_Jet_MiniAOD.push_back(mPt_Barrel_MiniAOD);
497  me_Jet_MiniAOD.push_back(mPt_EndCap_MiniAOD);
498  me_Jet_MiniAOD.push_back(mPt_Forward_MiniAOD);
499  me_Jet_MiniAOD.push_back(mMVAPUJIDDiscriminant_lowPt_Barrel_MiniAOD);
500  me_Jet_MiniAOD.push_back(mMVAPUJIDDiscriminant_lowPt_EndCap_MiniAOD);
501  me_Jet_MiniAOD.push_back(mMVAPUJIDDiscriminant_lowPt_Forward_MiniAOD);
502  me_Jet_MiniAOD.push_back(mMVAPUJIDDiscriminant_mediumPt_EndCap_MiniAOD);
503  me_Jet_MiniAOD.push_back(mMVAPUJIDDiscriminant_highPt_Barrel_MiniAOD);
504  me_Jet_MiniAOD.push_back(mCHFracVSpT_Barrel_MiniAOD);
505  me_Jet_MiniAOD.push_back(mNHFracVSpT_EndCap_MiniAOD);
506  me_Jet_MiniAOD.push_back(mPhFracVSpT_Barrel_MiniAOD);
507  me_Jet_MiniAOD.push_back(mHFHFracVSpT_Forward_MiniAOD);
508  me_Jet_MiniAOD.push_back(mHFEFracVSpT_Forward_MiniAOD);
509  me_Jet_MiniAOD.push_back(mCHFrac_MiniAOD);
510  me_Jet_MiniAOD.push_back(mNHFrac_MiniAOD);
511  me_Jet_MiniAOD.push_back(mPhFrac_MiniAOD);
512  me_Jet_MiniAOD.push_back(mChargedMultiplicity_MiniAOD);
513  me_Jet_MiniAOD.push_back(mNeutralMultiplicity_MiniAOD);
514  me_Jet_MiniAOD.push_back(mMuonMultiplicity_MiniAOD);
515  me_Jet_MiniAOD.push_back(mNeutralFraction_MiniAOD);
516 
517  ibook_.setCurrentFolder(RunDirJet + "MiniAOD_over_RECO");
518  mPt_MiniAOD_over_Reco = ibook_.book1D("Pt_MiniAOD_over_RECO", (TH1F*)mPt_Reco->getRootObject());
519  mEta_MiniAOD_over_Reco = ibook_.book1D("Eta_MiniAOD_over_RECO", (TH1F*)mEta_Reco->getRootObject());
520  mPhi_MiniAOD_over_Reco = ibook_.book1D("Phi_MiniAOD_over_RECO", (TH1F*)mPhi_Reco->getRootObject());
521  mNjets_MiniAOD_over_Reco = ibook_.book1D("NJets_MiniAOD_over_RECO", (TH1F*)mNjets_Reco->getRootObject());
522  mPt_uncor_MiniAOD_over_Reco = ibook_.book1D("Pt_uncor_MiniAOD_over_RECO", (TH1F*)mPt_uncor_Reco->getRootObject());
524  ibook_.book1D("Eta_uncor_MiniAOD_over_RECO", (TH1F*)mEta_uncor_Reco->getRootObject());
526  ibook_.book1D("Phi_uncor_MiniAOD_over_RECO", (TH1F*)mPhi_uncor_Reco->getRootObject());
528  ibook_.book1D("JetEnergyCorr_MiniAOD_over_RECO", (TH1F*)mJetEnergyCorr_Reco->getRootObject());
530  "JetEnergyCorrVSEta_MiniAOD_over_RECO", "jet energy correction factor VS eta", etaBin_, etaMin_, etaMax_);
531  mDPhi_MiniAOD_over_Reco = ibook_.book1D("DPhi_MiniAOD_over_RECO", (TH1F*)mDPhi_Reco->getRootObject());
533  ibook_.book1D("JetIDPassFractionVSeta_MiniAOD_over_RECO", "JetIDPassFractionVSeta", etaBin_, etaMin_, etaMax_);
535  ibook_.book1D("Pt_Barrel_MiniAOD_over_RECO", (TH1F*)mPt_Barrel_Reco->getRootObject());
537  ibook_.book1D("Pt_EndCap_MiniAOD_over_RECO", (TH1F*)mPt_EndCap_Reco->getRootObject());
539  ibook_.book1D("Pt_Forward_MiniAOD_over_RECO", (TH1F*)mPt_Forward_Reco->getRootObject());
541  ibook_.book1D("MVAPUJIDDiscriminant_lowPt_Barrel_MiniAOD_over_RECO",
542  (TH1F*)mMVAPUJIDDiscriminant_lowPt_Barrel_Reco->getRootObject());
544  ibook_.book1D("MVAPUJIDDiscriminant_lowPt_EndCap_MiniAOD_over_RECO",
545  (TH1F*)mMVAPUJIDDiscriminant_lowPt_EndCap_Reco->getRootObject());
547  ibook_.book1D("MVAPUJIDDiscriminant_lowPt_Forward_MiniAOD_over_RECO",
548  (TH1F*)mMVAPUJIDDiscriminant_lowPt_Forward_Reco->getRootObject());
550  ibook_.book1D("MVAPUJIDDiscriminant_mediumPt_EndCap_MiniAOD_over_RECO",
551  (TH1F*)mMVAPUJIDDiscriminant_mediumPt_EndCap_Reco->getRootObject());
553  ibook_.book1D("MVAPUJIDDiscriminant_highPt_Barrel_MiniAOD_over_RECO",
554  (TH1F*)mMVAPUJIDDiscriminant_highPt_Barrel_Reco->getRootObject());
556  ibook_.book1D("CHFracVSpT_Barrel_MiniAOD_over_RECO", "CHFracVSpT_Barrel", ptBin_, ptMin_, ptMax_);
558  ibook_.book1D("NHFracVSpT_EndCap_MiniAOD_over_RECO", "NHFracVSpT_EndCap", ptBin_, ptMin_, ptMax_);
560  ibook_.book1D("PhFracVSpT_Barrel_MiniAOD_over_RECO", "PhFracVSpT_Barrel", ptBin_, ptMin_, ptMax_);
562  ibook_.book1D("HFHFracVSpT_Forward_MiniAOD_over_RECO", "HFHFracVSpT_Forward", ptBin_, ptMin_, ptMax_);
564  ibook_.book1D("HFEFracVSpT_Forward_MiniAOD_over_RECO", "HFEFracVSpT_Forward", ptBin_, ptMin_, ptMax_);
565  ibook_.setCurrentFolder(RunDirJet + "MiniAOD_over_RECO" + "/" + "DiJet");
566  mCHFrac_MiniAOD_over_Reco = ibook_.book1D("CHFrac_MiniAOD_over_RECO", (TH1F*)mCHFrac_Reco->getRootObject());
567  mNHFrac_MiniAOD_over_Reco = ibook_.book1D("NHFrac_MiniAOD_over_RECO", (TH1F*)mNHFrac_Reco->getRootObject());
568  mPhFrac_MiniAOD_over_Reco = ibook_.book1D("PhFrac_MiniAOD_over_RECO", (TH1F*)mPhFrac_Reco->getRootObject());
570  ibook_.book1D("ChargedMultiplicity_MiniAOD_over_RECO", (TH1F*)mChargedMultiplicity_Reco->getRootObject());
572  ibook_.book1D("NeutralMultiplicity_MiniAOD_over_RECO", (TH1F*)mNeutralMultiplicity_Reco->getRootObject());
574  ibook_.book1D("MuonMultiplicity_MiniAOD_over_RECO", (TH1F*)mMuonMultiplicity_Reco->getRootObject());
576  ibook_.book1D("NeutralConstituentsFraction_MiniAOD_over_RECO", (TH1F*)mNeutralFraction_Reco->getRootObject());
577 
578  std::vector<MonitorElement*> me_Jet_MiniAOD_over_Reco;
579  me_Jet_MiniAOD_over_Reco.push_back(mPt_MiniAOD_over_Reco);
580  me_Jet_MiniAOD_over_Reco.push_back(mEta_MiniAOD_over_Reco);
581  me_Jet_MiniAOD_over_Reco.push_back(mPhi_MiniAOD_over_Reco);
582  me_Jet_MiniAOD_over_Reco.push_back(mNjets_MiniAOD_over_Reco);
583  me_Jet_MiniAOD_over_Reco.push_back(mPt_uncor_MiniAOD_over_Reco);
584  me_Jet_MiniAOD_over_Reco.push_back(mEta_uncor_MiniAOD_over_Reco);
585  me_Jet_MiniAOD_over_Reco.push_back(mPhi_uncor_MiniAOD_over_Reco);
586  me_Jet_MiniAOD_over_Reco.push_back(mJetEnergyCorr_MiniAOD_over_Reco);
587  me_Jet_MiniAOD_over_Reco.push_back(mJetEnergyCorrVSeta_MiniAOD_over_Reco);
588  me_Jet_MiniAOD_over_Reco.push_back(mDPhi_MiniAOD_over_Reco);
589  me_Jet_MiniAOD_over_Reco.push_back(mLooseJIDPassFractionVSeta_MiniAOD_over_Reco);
590  me_Jet_MiniAOD_over_Reco.push_back(mPt_Barrel_MiniAOD_over_Reco);
591  me_Jet_MiniAOD_over_Reco.push_back(mPt_EndCap_MiniAOD_over_Reco);
592  me_Jet_MiniAOD_over_Reco.push_back(mPt_Forward_MiniAOD_over_Reco);
593  me_Jet_MiniAOD_over_Reco.push_back(mMVAPUJIDDiscriminant_lowPt_Barrel_MiniAOD_over_Reco);
594  me_Jet_MiniAOD_over_Reco.push_back(mMVAPUJIDDiscriminant_lowPt_EndCap_MiniAOD_over_Reco);
595  me_Jet_MiniAOD_over_Reco.push_back(mMVAPUJIDDiscriminant_lowPt_Forward_MiniAOD_over_Reco);
596  me_Jet_MiniAOD_over_Reco.push_back(mMVAPUJIDDiscriminant_mediumPt_EndCap_MiniAOD_over_Reco);
597  me_Jet_MiniAOD_over_Reco.push_back(mMVAPUJIDDiscriminant_highPt_Barrel_MiniAOD_over_Reco);
598  me_Jet_MiniAOD_over_Reco.push_back(mCHFracVSpT_Barrel_MiniAOD_over_Reco);
599  me_Jet_MiniAOD_over_Reco.push_back(mNHFracVSpT_EndCap_MiniAOD_over_Reco);
600  me_Jet_MiniAOD_over_Reco.push_back(mPhFracVSpT_Barrel_MiniAOD_over_Reco);
601  me_Jet_MiniAOD_over_Reco.push_back(mHFHFracVSpT_Forward_MiniAOD_over_Reco);
602  me_Jet_MiniAOD_over_Reco.push_back(mHFEFracVSpT_Forward_MiniAOD_over_Reco);
603  me_Jet_MiniAOD_over_Reco.push_back(mCHFrac_MiniAOD_over_Reco);
604  me_Jet_MiniAOD_over_Reco.push_back(mNHFrac_MiniAOD_over_Reco);
605  me_Jet_MiniAOD_over_Reco.push_back(mPhFrac_MiniAOD_over_Reco);
606  me_Jet_MiniAOD_over_Reco.push_back(mChargedMultiplicity_MiniAOD_over_Reco);
607  me_Jet_MiniAOD_over_Reco.push_back(mNeutralMultiplicity_MiniAOD_over_Reco);
608  me_Jet_MiniAOD_over_Reco.push_back(mMuonMultiplicity_MiniAOD_over_Reco);
609  me_Jet_MiniAOD_over_Reco.push_back(mNeutralFraction_MiniAOD_over_Reco);
610 
611  for (unsigned int j = 0; j < me_Jet_MiniAOD_over_Reco.size(); j++) {
612  MonitorElement* monJetReco = me_Jet_Reco[j];
613  if (monJetReco && monJetReco->getRootObject()) {
614  MonitorElement* monJetMiniAOD = me_Jet_MiniAOD[j];
615  if (monJetMiniAOD && monJetMiniAOD->getRootObject()) {
616  MonitorElement* monJetMiniAOD_over_RECO = me_Jet_MiniAOD_over_Reco[j];
617  if (monJetMiniAOD_over_RECO && monJetMiniAOD_over_RECO->getRootObject()) {
618  for (int i = 0; i <= (monJetMiniAOD_over_RECO->getNbinsX() + 1); i++) {
619  if (monJetReco->getBinContent(i) != 0) {
620  monJetMiniAOD_over_RECO->setBinContent(i,
621  monJetMiniAOD->getBinContent(i) / monJetReco->getBinContent(i));
622  } else if (monJetMiniAOD->getBinContent(i) != 0) {
623  monJetMiniAOD_over_RECO->setBinContent(i, -0.5);
624  }
625  }
626  }
627  }
628  }
629  }
630  } //check for RECO and MiniAOD directories
631 
632  if (verbose_)
633  std::cout << ">>> EndRun (DataCertificationJetMET) <<<" << std::endl;
634 
635  std::vector<std::string> subDirVec;
636  std::string RunDir;
637 
638  if (verbose_)
639  std::cout << "InMemory_ = " << InMemory_ << std::endl;
640 
642  reportSummary = ibook_.bookFloat("reportSummary");
643  CertificationSummary = ibook_.bookFloat("CertificationSummary");
644 
645  reportSummaryMap = ibook_.book2D("reportSummaryMap", "reportSummaryMap", 3, 0, 3, 5, 0, 5);
646  CertificationSummaryMap = ibook_.book2D("CertificationSummaryMap", "CertificationSummaryMap", 3, 0, 3, 5, 0, 5);
647 
648  reportSummary = iget_.get(folderName + "/" + "reportSummary");
649  CertificationSummary = iget_.get(folderName + "/" + "CertificationSummary");
650  reportSummaryMap = iget_.get(folderName + "/" + "reportSummaryMap");
651  CertificationSummaryMap = iget_.get(folderName + "/" + "CertificationSummaryMap");
652 
654  reportSummaryMap->getTH2F()->SetStats(kFALSE);
655  reportSummaryMap->setOption("colz");
656  reportSummaryMap->setBinLabel(1, "CaloTower");
657  reportSummaryMap->setBinLabel(2, "MET");
658  reportSummaryMap->setBinLabel(3, "Jet");
659  }
661  CertificationSummaryMap->getTH2F()->SetStats(kFALSE);
663  CertificationSummaryMap->setBinLabel(1, "CaloTower");
666  }
667 
668  reportSummary->Fill(1.);
670 
671  if (RunDir == "Reference")
672  RunDir = "";
673  if (verbose_)
674  std::cout << RunDir << std::endl;
675  ibook_.setCurrentFolder("JetMET/EventInfo/CertificationSummaryContents/");
676 
677  std::string refHistoName;
678  std::string newHistoName;
679 
680  //-----------------------------
681  // Jet DQM Data Certification
682  //-----------------------------
683  //we have 4 types anymore: PF (barrel,endcap,forward) and calojets
684  MonitorElement* meJetPt[4];
685  MonitorElement* meJetEta[4];
686  MonitorElement* meJetPhi[4];
687  MonitorElement* meJetEMFrac[4];
688  MonitorElement* meJetConstituents[4];
689  RunDir = "";
690  if (RunDir.empty())
691  newHistoName = "JetMET/Jet/";
692  else
693  newHistoName = RunDir + "/JetMET/Runsummary/Jet/";
694  std::string cleaningdir = "";
695  cleaningdir = "Cleaned";
696 
697  // Read different histograms for PbPb and pp collisions
698 
699  if (isHI) { // Histograms for heavy ions
700 
701  newHistoName = "JetMET/HIJetValidation/";
702  cleaningdir = "";
703 
704  //Jet Phi histos
705  meJetPhi[0] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Cs4PFJets/Phi");
706  meJetPhi[1] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Pu3PFJets/Phi");
707  meJetPhi[2] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Pu4PFJets/Phi");
708  meJetPhi[3] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Pu4CaloJets/Phi");
709 
710  //Jet Eta histos
711  meJetEta[0] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Cs4PFJets/Eta");
712  meJetEta[1] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Pu3PFJets/Eta");
713  meJetEta[2] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Pu4PFJets/Eta");
714  meJetEta[3] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Pu4CaloJets/Eta");
715 
716  //Jet Pt histos
717  meJetPt[0] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Cs4PFJets/Pt");
718  meJetPt[1] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Pu3PFJets/Pt");
719  meJetPt[2] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Pu4PFJets/Pt");
720  meJetPt[3] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Pu4CaloJets/Pt");
721 
722  //Jet Constituents histos
723  meJetConstituents[0] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Cs4PFJets/Constituents");
724  meJetConstituents[1] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Pu3PFJets/Constituents");
725  meJetConstituents[2] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Pu4PFJets/Constituents");
726  meJetConstituents[3] = iget_.get(newHistoName + cleaningdir + jetAlgo + "Pu4CaloJets/Constituents");
727 
728  //There are no jet EMFrac histograms for HI. Dummy paths will pass the tests by default
729  meJetEMFrac[0] = iget_.get(newHistoName + cleaningdir + jetAlgo + "dummy/dummy");
730  meJetEMFrac[1] = iget_.get(newHistoName + cleaningdir + jetAlgo + "dummy/dummy");
731  meJetEMFrac[2] = iget_.get(newHistoName + cleaningdir + jetAlgo + "dummy/dummy");
732  meJetEMFrac[3] = iget_.get(newHistoName + cleaningdir + jetAlgo + "dummy/dummy");
733 
734  } else { // Histograms for protons
735 
736  //Jet Phi histos
737  meJetPhi[0] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/Phi_Barrel");
738  meJetPhi[1] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/Phi_EndCap");
739  meJetPhi[2] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/Phi_Forward");
740  meJetPhi[3] = iget_.get(newHistoName + cleaningdir + jetAlgo + "CaloJets/Phi");
741  //meJetPhi[4] = iget_.get(newHistoName+cleaningdir+"JetPlusTrackZSPCorJetAntiKt5/Phi");
742 
743  //Jet Eta histos
744  meJetEta[0] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/Eta");
745  meJetEta[1] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/Eta");
746  meJetEta[2] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/EtaFirst");
747  meJetEta[3] = iget_.get(newHistoName + cleaningdir + jetAlgo + "CaloJets/Eta");
748  //meJetEta[4] = iget_.get(newHistoName+cleaningdir+"JetPlusTrackZSPCorJetAntiKt5/Eta");
749 
750  //Jet Pt histos
751  meJetPt[0] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/Pt_Barrel");
752  meJetPt[1] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/Pt_EndCap");
753  meJetPt[2] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/Pt_Forward");
754  meJetPt[3] = iget_.get(newHistoName + cleaningdir + jetAlgo + "CaloJets/Pt_2");
755 
756  //Jet Constituents histos
757  meJetConstituents[0] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/Constituents_Barrel");
758  meJetConstituents[1] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/Constituents_EndCap");
759  meJetConstituents[2] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/Constituents_Forward");
760  meJetConstituents[3] = iget_.get(newHistoName + cleaningdir + jetAlgo + "CaloJets/Constituents");
761 
762  //Jet EMFrac histos
763  meJetEMFrac[0] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/EFrac_Barrel");
764  meJetEMFrac[1] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/EFrac_EndCap");
765  meJetEMFrac[2] = iget_.get(newHistoName + cleaningdir + jetAlgo + "PFJets/EFrac_Forward");
766  meJetEMFrac[3] = iget_.get(newHistoName + cleaningdir + jetAlgo + "CaloJets/EFrac");
767  }
768 
769  //------------------------------------------------------------------------------
770  //--- Extract quality test results and fill data certification results for Jets
771  //--- Tests for Calo Barrel, EndCap and Forward, as well as PF and JPT jets
772  //--- For Calo and PF jets:
773  //--- Look at mean of Constituents, EM Frac and Pt
774  //--- Look at Kolmogorov result for Eta, Phi, and Pt
775  //--- For JPT jets:
776  //--- Look at mean of Pt, AllPionsTrackNHits?, nTracks,
777  //--- Look at Kolmogorov result for Eta, Phi, and Pt
778  //------------------------------------------------------------------------------
779 
780  // Four types of jets {AK5 Barrel, AK5 EndCap, AK5 Forward, PF}, removed JPT which is 5th type of jets
781  //----------------------------------------------------------------------------
782  // Kolmogorov (KS) tests
783  const QReport* QReport_JetEta[4] = {nullptr};
784  const QReport* QReport_JetPhi[4] = {nullptr};
785  // Mean and KS tests for Calo and PF jets
786  const QReport* QReport_JetConstituents[4][2] = {{nullptr}};
787  const QReport* QReport_JetEFrac[4][2] = {{nullptr}};
788  const QReport* QReport_JetPt[4][2] = {{nullptr}};
789 
790  // Mean and KS tests for JPT jets
791  //const QReport* QReport_JetNTracks[2] = {0, 0};
792  float qr_Jet_Eta[4] = {-1};
793  float qr_Jet_Phi[4] = {-1};
794  float dc_Jet[4] = {-1};
795 
796  float qr_Jet_Constituents[4][2] = {{-1}};
797  float qr_Jet_EFrac[4][2] = {{-1}};
798  float qr_Jet_Pt[4][2] = {{-1}};
799 
800  // Loop
801  //----------------------------------------------------------------------------
802  for (int jtyp = 0; jtyp < 4; ++jtyp) {
803  // Mean test results
804 
805  if (meJetConstituents[jtyp] && meJetConstituents[jtyp]->getRootObject()) {
806  QReport_JetConstituents[jtyp][0] = meJetConstituents[jtyp]->getQReport("meanJetConstituentsTest");
807  QReport_JetConstituents[jtyp][1] = meJetConstituents[jtyp]->getQReport("KolmogorovTest");
808  }
809  if (meJetEMFrac[jtyp] && meJetEMFrac[jtyp]->getRootObject()) {
810  QReport_JetEFrac[jtyp][0] = meJetEMFrac[jtyp]->getQReport("meanEMFractionTest");
811  QReport_JetEFrac[jtyp][1] = meJetEMFrac[jtyp]->getQReport("KolmogorovTest");
812  }
813  if (meJetPt[jtyp] && meJetPt[jtyp]->getRootObject()) {
814  QReport_JetPt[jtyp][0] = meJetPt[jtyp]->getQReport("meanJetPtTest");
815  QReport_JetPt[jtyp][1] = meJetPt[jtyp]->getQReport("KolmogorovTest");
816  }
817  if (meJetPhi[jtyp] && meJetPhi[jtyp]->getRootObject()) {
818  QReport_JetPhi[jtyp] = meJetPhi[jtyp]->getQReport("KolmogorovTest");
819  }
820  if (meJetEta[jtyp] && meJetEta[jtyp]->getRootObject()) {
821  QReport_JetEta[jtyp] = meJetEta[jtyp]->getQReport("KolmogorovTest");
822  }
823 
824  //Jet Pt test
825  if (QReport_JetPt[jtyp][0]) {
826  //std::cout<<"jet type test pt "<<jtyp<<"/"<<QReport_JetPt[jtyp][0]->getStatus()<<std::endl;
827  if (QReport_JetPt[jtyp][0]->getStatus() == 100 || QReport_JetPt[jtyp][0]->getStatus() == 200)
828  qr_Jet_Pt[jtyp][0] = 1;
829  else if (QReport_JetPt[jtyp][0]->getStatus() == 300)
830  qr_Jet_Pt[jtyp][0] = 0;
831  else
832  qr_Jet_Pt[jtyp][0] = -1;
833  } else {
834  qr_Jet_Pt[jtyp][0] = -2;
835  //std::cout<<"qreport is REALLY NULL type test pt "<<jtyp<<" 0 "<<std::endl;
836  }
837  if (QReport_JetPt[jtyp][1]) {
838  if (QReport_JetPt[jtyp][1]->getStatus() == 100 || QReport_JetPt[jtyp][1]->getStatus() == 200)
839  qr_Jet_Pt[jtyp][1] = 1;
840  else if (QReport_JetPt[jtyp][1]->getStatus() == 300)
841  qr_Jet_Pt[jtyp][1] = 0;
842  else
843  qr_Jet_Pt[jtyp][1] = -1;
844  } else {
845  qr_Jet_Pt[jtyp][1] = -2;
846  }
847 
848  //Jet Phi test
849  if (QReport_JetPhi[jtyp]) {
850  if (QReport_JetPhi[jtyp]->getStatus() == 100 || QReport_JetPhi[jtyp]->getStatus() == 200)
851  qr_Jet_Phi[jtyp] = 1;
852  else if (QReport_JetPhi[jtyp]->getStatus() == 300)
853  qr_Jet_Phi[jtyp] = 0;
854  else
855  qr_Jet_Phi[jtyp] = -1;
856  } else {
857  qr_Jet_Phi[jtyp] = -2;
858  }
859  //Jet Eta test
860  if (QReport_JetEta[jtyp]) {
861  if (QReport_JetEta[jtyp]->getStatus() == 100 || QReport_JetEta[jtyp]->getStatus() == 200)
862  qr_Jet_Eta[jtyp] = 1;
863  else if (QReport_JetEta[jtyp]->getStatus() == 300)
864  qr_Jet_Eta[jtyp] = 0;
865  else
866  qr_Jet_Eta[jtyp] = -1;
867  } else {
868  qr_Jet_Eta[jtyp] = -2;
869  }
870  //Jet Constituents test
871  if (QReport_JetConstituents[jtyp][0]) {
872  if (QReport_JetConstituents[jtyp][0]->getStatus() == 100 || QReport_JetConstituents[jtyp][0]->getStatus() == 200)
873  qr_Jet_Constituents[jtyp][0] = 1;
874  else if (QReport_JetConstituents[jtyp][0]->getStatus() == 300)
875  qr_Jet_Constituents[jtyp][0] = 0;
876  else
877  qr_Jet_Constituents[jtyp][0] = -1;
878  } else {
879  qr_Jet_Constituents[jtyp][0] = -2;
880  }
881 
882  if (QReport_JetConstituents[jtyp][1]) {
883  if (QReport_JetConstituents[jtyp][1]->getStatus() == 100 || QReport_JetConstituents[jtyp][1]->getStatus() == 200)
884  qr_Jet_Constituents[jtyp][1] = 1;
885  else if (QReport_JetConstituents[jtyp][1]->getStatus() == 300)
886  qr_Jet_Constituents[jtyp][1] = 0;
887  else
888  qr_Jet_Constituents[jtyp][1] = -1;
889  } else {
890  qr_Jet_Constituents[jtyp][1] = -2;
891  }
892  //Jet EMFrac test
893  if (QReport_JetEFrac[jtyp][0]) {
894  if (QReport_JetEFrac[jtyp][0]->getStatus() == 100 || QReport_JetEFrac[jtyp][0]->getStatus() == 200)
895  qr_Jet_EFrac[jtyp][0] = 1;
896  else if (QReport_JetEFrac[jtyp][0]->getStatus() == 300)
897  qr_Jet_EFrac[jtyp][0] = 0;
898  else
899  qr_Jet_EFrac[jtyp][0] = -1;
900  } else {
901  qr_Jet_EFrac[jtyp][0] = -2;
902  }
903 
904  if (QReport_JetEFrac[jtyp][1]) {
905  if (QReport_JetEFrac[jtyp][1]->getStatus() == 100 || QReport_JetEFrac[jtyp][1]->getStatus() == 200)
906  qr_Jet_EFrac[jtyp][1] = 1;
907  else if (QReport_JetEFrac[jtyp][1]->getStatus() == 300)
908  qr_Jet_EFrac[jtyp][1] = 0;
909  else
910  qr_Jet_EFrac[jtyp][1] = -1;
911  } else {
912  qr_Jet_EFrac[jtyp][1] = -2;
913  }
914 
915  if (verbose_) {
916  printf("====================Jet Type %d QTest Report Summary========================\n", jtyp);
917  printf("Eta: Phi: Pt 1: 2: Const/Ntracks 1: 2: EFrac/tracknhits 1: 2:\n");
918 
919  printf("%2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f\n",
920  qr_Jet_Eta[jtyp],
921  qr_Jet_Phi[jtyp],
922  qr_Jet_Pt[jtyp][0],
923  qr_Jet_Pt[jtyp][1],
924  qr_Jet_Constituents[jtyp][0],
925  qr_Jet_Constituents[jtyp][1],
926  qr_Jet_EFrac[jtyp][0],
927  qr_Jet_EFrac[jtyp][1]);
928  }
929  //certification result for Jet
930 
931  //Only apply certain tests, as defined in the config
932  for (int ttyp = 0; ttyp < 2; ++ttyp) {
933  if (!jetTests[jtyp][ttyp]) {
934  qr_Jet_Pt[jtyp][ttyp] = 1;
935  if (ttyp == 1) {
936  qr_Jet_Eta[jtyp] = 1;
937  qr_Jet_Phi[jtyp] = 1;
938  }
939  qr_Jet_EFrac[jtyp][ttyp] = 1;
940  qr_Jet_Constituents[jtyp][ttyp] = 1;
941  }
942  }
943 
944  if ((qr_Jet_EFrac[jtyp][0] == 0) || (qr_Jet_EFrac[jtyp][1] == 0) || (qr_Jet_Constituents[jtyp][1] == 0) ||
945  (qr_Jet_Constituents[jtyp][0] == 0) || (qr_Jet_Eta[jtyp] == 0) || (qr_Jet_Phi[jtyp] == 0) ||
946  (qr_Jet_Pt[jtyp][0] == 0) || (qr_Jet_Pt[jtyp][1] == 0))
947  dc_Jet[jtyp] = 0;
948  else if ((qr_Jet_EFrac[jtyp][0] == -1) && (qr_Jet_EFrac[jtyp][1] == -1) && (qr_Jet_Constituents[jtyp][1] == -1) &&
949  (qr_Jet_Constituents[jtyp][0] == -1) && (qr_Jet_Eta[jtyp] == -1) && (qr_Jet_Phi[jtyp] == -1) &&
950  (qr_Jet_Pt[jtyp][0] == -1) && (qr_Jet_Pt[jtyp][1] == -1))
951  dc_Jet[jtyp] = -1;
952  else if ((qr_Jet_EFrac[jtyp][0] == -2) && (qr_Jet_EFrac[jtyp][1] == -2) && (qr_Jet_Constituents[jtyp][1] == -2) &&
953  (qr_Jet_Constituents[jtyp][0] == -2) && (qr_Jet_Eta[jtyp] == -2) && (qr_Jet_Phi[jtyp] == -2) &&
954  (qr_Jet_Pt[jtyp][0] == -2) && (qr_Jet_Pt[jtyp][1] == -2))
955  dc_Jet[jtyp] = -2;
956  else
957  dc_Jet[jtyp] = 1;
958 
959  if (verbose_)
960  std::cout << "Certifying Jet algo: " << jtyp << " with value: " << dc_Jet[jtyp] << std::endl;
961 
962  CertificationSummaryMap->Fill(2, 4 - jtyp, dc_Jet[jtyp]);
963  reportSummaryMap->Fill(2, 4 - jtyp, dc_Jet[jtyp]);
964  }
965 
966  // There is nothing on the first row for HI, so mark the unfilled
967  if (isHI) {
968  CertificationSummaryMap->Fill(2, 0, -2);
969  reportSummaryMap->Fill(2, 0, -2);
970  }
971 
972  //-----------------------------
973  // MET DQM Data Certification
974  //-----------------------------
975  //
976  // Prepare test histograms
977  //
978  MonitorElement* meMExy[2][2];
979  MonitorElement* meMEt[2];
980  MonitorElement* meSumEt[2];
981  MonitorElement* meMETPhi[2];
982 
983  RunDir = "";
984  if (RunDir.empty())
985  newHistoName = "JetMET/MET/";
986  else
987  newHistoName = RunDir + "/JetMET/Runsummary/MET/";
988 
989  metFolder = "Cleaned";
990 
991  //MEx/MEy monitor elements
992  meMExy[0][0] = iget_.get(newHistoName + "met/" + metFolder + "/MEx");
993  meMExy[0][1] = iget_.get(newHistoName + "met/" + metFolder + "/MEy");
994  meMExy[1][0] = iget_.get(newHistoName + "pfMet/" + metFolder + "/MEx");
995  meMExy[1][1] = iget_.get(newHistoName + "pfMet/" + metFolder + "/MEy");
996 
997  //MET Phi monitor elements
998  meMETPhi[0] = iget_.get(newHistoName + "met/" + metFolder + "/METPhi");
999  meMETPhi[1] = iget_.get(newHistoName + "pfMet/" + metFolder + "/METPhi");
1000  //MET monitor elements
1001  meMEt[0] = iget_.get(newHistoName + "met/" + metFolder + "/MET");
1002  meMEt[1] = iget_.get(newHistoName + "pfMet/" + metFolder + "/MET");
1003  //SumET monitor elements
1004  meSumEt[0] = iget_.get(newHistoName + "met/" + metFolder + "/SumET");
1005  meSumEt[1] = iget_.get(newHistoName + "pfMet/" + metFolder + "/SumET");
1006 
1007  //----------------------------------------------------------------------------
1008  //--- Extract quality test results and fill data certification results for MET
1009  //----------------------------------------------------------------------------
1010 
1011  // 2 types of MET {CaloMET, PfMET} // It is 5 if CaloMETNoHF is included, 4 for MuonCorMET
1012  // removed 3rd type of TcMET
1013  // 2 types of tests Mean test/Kolmogorov test
1014  const QReport* QReport_MExy[2][2][2] = {{{nullptr}}};
1015  const QReport* QReport_MEt[2][2] = {{nullptr}};
1016  const QReport* QReport_SumEt[2][2] = {{nullptr}};
1017  //2 types of tests phiQTest and Kolmogorov test
1018  const QReport* QReport_METPhi[2][2] = {{nullptr}};
1019 
1020  float qr_MET_MExy[2][2][2] = {{{-999.}}};
1021  float qr_MET_MEt[2][2] = {{-999.}};
1022  float qr_MET_SumEt[2][2] = {{-999.}};
1023  float qr_MET_METPhi[2][2] = {{-999.}};
1024  float dc_MET[2] = {-999.};
1025 
1026  // J.Piedra, 27/02/212
1027  // removed MuCorrMET & TcMET --> loop up to 2 instead of 4, remove already from definition
1028  for (int mtyp = 0; mtyp < 2; ++mtyp) {
1029  //Mean test results
1030  if (meMExy[mtyp][0] && meMExy[mtyp][0]->getRootObject()) {
1031  QReport_MExy[mtyp][0][0] = meMExy[mtyp][0]->getQReport("meanMExyTest");
1032  QReport_MExy[mtyp][1][0] = meMExy[mtyp][0]->getQReport("KolmogorovTest");
1033  }
1034  if (meMExy[mtyp][1] && meMExy[mtyp][1]->getRootObject()) {
1035  QReport_MExy[mtyp][0][1] = meMExy[mtyp][1]->getQReport("meanMExyTest");
1036  QReport_MExy[mtyp][1][1] = meMExy[mtyp][1]->getQReport("KolmogorovTest");
1037  }
1038  if (meMEt[mtyp] && meMEt[mtyp]->getRootObject()) {
1039  QReport_MEt[mtyp][0] = meMEt[mtyp]->getQReport("meanMETTest");
1040  QReport_MEt[mtyp][1] = meMEt[mtyp]->getQReport("KolmogorovTest");
1041  }
1042 
1043  if (meSumEt[mtyp] && meSumEt[mtyp]->getRootObject()) {
1044  QReport_SumEt[mtyp][0] = meSumEt[mtyp]->getQReport("meanSumETTest");
1045  QReport_SumEt[mtyp][1] = meSumEt[mtyp]->getQReport("KolmogorovTest");
1046  }
1047 
1048  if (meMETPhi[mtyp] && meMETPhi[mtyp]->getRootObject()) {
1049  QReport_METPhi[mtyp][0] = meMETPhi[mtyp]->getQReport("phiQTest");
1050  QReport_METPhi[mtyp][1] = meMETPhi[mtyp]->getQReport("KolmogorovTest");
1051  }
1052  for (int testtyp = 0; testtyp < 2; ++testtyp) {
1053  //MEx test
1054  if (QReport_MExy[mtyp][testtyp][0]) {
1055  if (QReport_MExy[mtyp][testtyp][0]->getStatus() == 100 || QReport_MExy[mtyp][testtyp][0]->getStatus() == 200)
1056  qr_MET_MExy[mtyp][testtyp][0] = 1;
1057  else if (QReport_MExy[mtyp][testtyp][0]->getStatus() == 300)
1058  qr_MET_MExy[mtyp][testtyp][0] = 0;
1059  else
1060  qr_MET_MExy[mtyp][testtyp][0] = -1;
1061  } else
1062  qr_MET_MExy[mtyp][testtyp][0] = -2;
1063  //MEy test
1064  if (QReport_MExy[mtyp][testtyp][1]) {
1065  if (QReport_MExy[mtyp][testtyp][1]->getStatus() == 100 || QReport_MExy[mtyp][testtyp][1]->getStatus() == 200)
1066  qr_MET_MExy[mtyp][testtyp][1] = 1;
1067  else if (QReport_MExy[mtyp][testtyp][1]->getStatus() == 300)
1068  qr_MET_MExy[mtyp][testtyp][1] = 0;
1069  else
1070  qr_MET_MExy[mtyp][testtyp][1] = -1;
1071  } else
1072  qr_MET_MExy[mtyp][testtyp][1] = -2;
1073 
1074  //MEt test
1075  if (QReport_MEt[mtyp][testtyp]) {
1076  if (QReport_MEt[mtyp][testtyp]->getStatus() == 100 || QReport_MEt[mtyp][testtyp]->getStatus() == 200)
1077  qr_MET_MEt[mtyp][testtyp] = 1;
1078  else if (QReport_MEt[mtyp][testtyp]->getStatus() == 300)
1079  qr_MET_MEt[mtyp][testtyp] = 0;
1080  else
1081  qr_MET_MEt[mtyp][testtyp] = -1;
1082  } else {
1083  qr_MET_MEt[mtyp][testtyp] = -2;
1084  }
1085  //SumEt test
1086  if (QReport_SumEt[mtyp][testtyp]) {
1087  if (QReport_SumEt[mtyp][testtyp]->getStatus() == 100 || QReport_SumEt[mtyp][testtyp]->getStatus() == 200)
1088  qr_MET_SumEt[mtyp][testtyp] = 1;
1089  else if (QReport_SumEt[mtyp][testtyp]->getStatus() == 300)
1090  qr_MET_SumEt[mtyp][testtyp] = 0;
1091  else
1092  qr_MET_SumEt[mtyp][testtyp] = -1;
1093  } else {
1094  qr_MET_SumEt[mtyp][testtyp] = -2;
1095  }
1096  //METPhi test
1097  if (QReport_METPhi[mtyp][testtyp]) {
1098  if (QReport_METPhi[mtyp][testtyp]->getStatus() == 100 || QReport_METPhi[mtyp][testtyp]->getStatus() == 200)
1099  qr_MET_METPhi[mtyp][testtyp] = 1;
1100  else if (QReport_METPhi[mtyp][testtyp]->getStatus() == 300)
1101  qr_MET_METPhi[mtyp][testtyp] = 0;
1102  else
1103  qr_MET_METPhi[mtyp][testtyp] = -1;
1104  } else {
1105  qr_MET_METPhi[mtyp][testtyp] = -2;
1106  }
1107  }
1108 
1109  if (verbose_) {
1110  //certification result for MET
1111  printf("====================MET Type %d QTest Report Summary========================\n", mtyp);
1112  printf("MEx test MEy test MEt test: SumEt test: METPhi test:\n");
1113  for (int tt = 0; tt < 2; ++tt) {
1114  printf("%2.2f %2.2f %2.2f %2.2f %2.2f\n",
1115  qr_MET_MExy[mtyp][tt][0],
1116  qr_MET_MExy[mtyp][tt][1],
1117  qr_MET_MEt[mtyp][tt],
1118  qr_MET_SumEt[mtyp][tt],
1119  qr_MET_METPhi[mtyp][tt]);
1120  }
1121  printf("===========================================================================\n");
1122  }
1123 
1124  //Only apply certain tests, as defined in the config
1125  for (int ttyp = 0; ttyp < 2; ++ttyp) {
1126  if (!metTests[mtyp][ttyp]) {
1127  qr_MET_MExy[mtyp][ttyp][0] = 1;
1128  qr_MET_MExy[mtyp][ttyp][1] = 1;
1129  qr_MET_MEt[mtyp][ttyp] = 1;
1130  qr_MET_SumEt[mtyp][ttyp] = 1;
1131  qr_MET_METPhi[mtyp][ttyp] = 1;
1132  }
1133  }
1134 
1135  if ((qr_MET_MExy[mtyp][0][0] == 0) || (qr_MET_MExy[mtyp][0][1] == 0) || (qr_MET_MEt[mtyp][0] == 0) ||
1136  (qr_MET_SumEt[mtyp][0] == 0) || (qr_MET_METPhi[mtyp][0] == 0) || (qr_MET_MExy[mtyp][1][0] == 0) ||
1137  (qr_MET_MExy[mtyp][1][1] == 0) || (qr_MET_MEt[mtyp][1] == 0) || (qr_MET_SumEt[mtyp][1] == 0) ||
1138  (qr_MET_METPhi[mtyp][1] == 0))
1139  dc_MET[mtyp] = 0;
1140  else if ((qr_MET_MExy[mtyp][0][0] == -1) && (qr_MET_MExy[mtyp][0][1] == -1) && (qr_MET_MEt[mtyp][0] == -1) &&
1141  (qr_MET_SumEt[mtyp][0] == -1) && (qr_MET_METPhi[mtyp][0] == -1) && (qr_MET_MExy[mtyp][1][0] == -1) &&
1142  (qr_MET_MExy[mtyp][1][1] == -1) && (qr_MET_MEt[mtyp][1] == -1) && (qr_MET_SumEt[mtyp][1] == -1) &&
1143  (qr_MET_METPhi[mtyp][1] == -1))
1144  dc_MET[mtyp] = -1;
1145  else if ((qr_MET_MExy[mtyp][0][0] == -2) && (qr_MET_MExy[mtyp][0][1] == -2) && (qr_MET_MEt[mtyp][0] == -2) &&
1146  (qr_MET_SumEt[mtyp][0] == -2) && (qr_MET_METPhi[mtyp][0] == -2) && (qr_MET_MExy[mtyp][1][0] == -2) &&
1147  (qr_MET_MExy[mtyp][1][1] == -2) && (qr_MET_MEt[mtyp][1] == -2) && (qr_MET_SumEt[mtyp][1] == -2) &&
1148  (qr_MET_METPhi[mtyp][1] == -2))
1149  dc_MET[mtyp] = -2;
1150  else
1151  dc_MET[mtyp] = 1;
1152 
1153  if (verbose_)
1154  std::cout << "Certifying MET algo: " << mtyp << " with value: " << dc_MET[mtyp] << std::endl;
1155  CertificationSummaryMap->Fill(1, 4 - mtyp, dc_MET[mtyp]);
1156  reportSummaryMap->Fill(1, 4 - mtyp, dc_MET[mtyp]);
1157  }
1158 
1159  // There is nothing on the first three rows for HI, so mark them unfilled
1160  if (isHI) {
1161  for (int i = 0; i < 3; i++) {
1162  CertificationSummaryMap->Fill(1, i, -2);
1163  reportSummaryMap->Fill(1, i, -2);
1164  }
1165  }
1166 
1167  //----------------------------------------------------------------------------
1168  //--- Extract quality test results and fill data certification results for MET
1169  //----------------------------------------------------------------------------
1170  // Commenting out unused but initialized variables. [Suchandra Dutta]
1171  float dc_CT[3] = {-2.};
1172  dc_CT[0] = -2.;
1173  dc_CT[1] = -2.;
1174  dc_CT[2] = -2.;
1175 
1176  for (int cttyp = 0; cttyp < 3; ++cttyp) {
1177  if (verbose_)
1178  std::cout << "Certifying CaloTowers with value: " << dc_CT[cttyp] << std::endl;
1179  CertificationSummaryMap->Fill(0, 4 - cttyp, dc_CT[cttyp]);
1180  reportSummaryMap->Fill(0, 4 - cttyp, dc_CT[cttyp]);
1181  }
1182  ibook_.setCurrentFolder("");
1183 }
1184 
1185 //define this as a plug-in
1186 //DEFINE_FWK_MODULE(DataCertificationJetMET);
MonitorElement * mMVAPUJIDDiscriminant_lowPt_Forward_MiniAOD_over_Reco
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
T getParameter(std::string const &) const
MonitorElement * mMET_EffCSCTightHalo2015Filter
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * mMET_nVtx_profile_MiniAOD_over_Reco
MonitorElement * mMVAPUJIDDiscriminant_lowPt_EndCap_MiniAOD_over_Reco
virtual TH2F * getTH2F() const
MonitorElement * mMET_EffCSCTightHaloFilter
MonitorElement * mPt_MiniAOD_over_Reco
MonitorElement * mMuonMultiplicity_MiniAOD_over_Reco
MonitorElement * bookFloat(TString const &name)
Definition: DQMStore.cc:233
MonitorElement * CertificationSummaryMap
virtual void setOption(const char *option)
MonitorElement * mMVAPUJIDDiscriminant_mediumPt_EndCap_MiniAOD_over_Reco
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
MonitorElement * mNeutralHadronEtFraction_MiniAOD_over_Reco
MonitorElement * mHFEFracVSpT_Forward_MiniAOD_over_Reco
MonitorElement * mMET_EffHcalStripHaloFilter
MonitorElement * mPt_Barrel_MiniAOD_over_Reco
MonitorElement * mMET_MiniAOD_over_Reco
MonitorElement * mChargedHadronEtFraction_MiniAOD_over_Reco
MonitorElement * mSumET_logx_MiniAOD_over_Reco
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to <qtname> (null pointer if QReport does not exist)
MonitorElement * mDPhi_MiniAOD_over_Reco
MonitorElement * mHFHadronEtFraction_MiniAOD_over_Reco
MonitorElement * mLooseJIDPassFractionVSeta_MiniAOD_over_Reco
void Fill(long long x)
MonitorElement * mMET_EffEcalDeadCellTriggerFilter
MonitorElement * mMVAPUJIDDiscriminant_highPt_Barrel_MiniAOD_over_Reco
MonitorElement * mCHFrac_MiniAOD_over_Reco
MonitorElement * mPt_uncor_MiniAOD_over_Reco
MonitorElement * mNjets_MiniAOD_over_Reco
MonitorElement * mPt_EndCap_MiniAOD_over_Reco
MonitorElement * mPhotonEtFraction_MiniAOD_over_Reco
MonitorElement * mMETPhi_MiniAOD_over_Reco
virtual int getNbinsX() const
get # of bins in X-axis
MonitorElement * mNHFrac_MiniAOD_over_Reco
MonitorElement * mEta_MiniAOD_over_Reco
MonitorElement * mPhi_MiniAOD_over_Reco
MonitorElement * mNeutralFraction_MiniAOD_over_Reco
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
virtual double getBinContent(int binx) const
get content of bin (1-D)
MonitorElement * mMET_EffEcalDeadCellBoundaryFilter
MonitorElement * mMET_EffHBHENoiseFilter
MonitorElement * mHFEMEtFraction_MiniAOD_over_Reco
MonitorElement * CertificationSummary
MonitorElement * mPhFracVSpT_Barrel_MiniAOD_over_Reco
MonitorElement * mSumET_MiniAOD_over_Reco
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * mPt_Forward_MiniAOD_over_Reco
MonitorElement * mCHFracVSpT_Barrel_MiniAOD_over_Reco
MonitorElement * mJetEnergyCorrVSeta_MiniAOD_over_Reco
MonitorElement * mJetEnergyCorr_MiniAOD_over_Reco
MonitorElement * mPhi_uncor_MiniAOD_over_Reco
MonitorElement * mNeutralMultiplicity_MiniAOD_over_Reco
MonitorElement * mMET_EffeeBadScFilter
MonitorElement * mPhFrac_MiniAOD_over_Reco
std::string const & label() const
Definition: InputTag.h:36
MonitorElement * mMVAPUJIDDiscriminant_lowPt_Barrel_MiniAOD_over_Reco
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
MonitorElement * mMEy_MiniAOD_over_Reco
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: DQMStore.cc:266
MonitorElement * mChargedMultiplicity_MiniAOD_over_Reco
MonitorElement * mMET_EffHBHEIsoNoiseFilter
TObject * getRootObject() const override
MonitorElement * mSumET_nVtx_profile_MiniAOD_over_Reco
MonitorElement * mPhotonEtFraction_nVtx_profile_MiniAOD_over_Reco
MonitorElement * mNHFracVSpT_EndCap_MiniAOD_over_Reco
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:437
MonitorElement * mNeutralHadronEtFraction_nVtx_profile_MiniAOD_over_Reco
MonitorElement * mChargedHadronEtFraction_nVtx_profile_MiniAOD_over_Reco
MonitorElement * mEta_uncor_MiniAOD_over_Reco
MonitorElement * mHFHFracVSpT_Forward_MiniAOD_over_Reco
MonitorElement * mMET_logx_MiniAOD_over_Reco
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:424
std::vector< std::string > getSubdirs()
Definition: DQMStore.cc:453
DataCertificationJetMET(const edm::ParameterSet &)