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