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  //meJetPhi[4] = iget_.get(newHistoName+cleaningdir+"JetPlusTrackZSPCorJetAntiKt5/Phi");
659 
660  //Jet Eta histos
661  meJetEta[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Eta");
662  meJetEta[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Eta");
663  meJetEta[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/EtaFirst");
664  meJetEta[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/Eta");
665  //meJetEta[4] = iget_.get(newHistoName+cleaningdir+"JetPlusTrackZSPCorJetAntiKt5/Eta");
666 
667  //Jet Pt histos
668  meJetPt[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Pt_Barrel");
669  meJetPt[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Pt_EndCap");
670  meJetPt[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Pt_Forward");
671  meJetPt[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/Pt_2");
672 
673  //Jet Constituents histos
674  meJetConstituents[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Constituents_Barrel");
675  meJetConstituents[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Constituents_EndCap");
676  meJetConstituents[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Constituents_Forward");
677  meJetConstituents[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/Constituents");
678 
679  //Jet EMFrac histos
680  meJetEMFrac[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/EFrac_Barrel");
681  meJetEMFrac[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/EFrac_EndCap");
682  meJetEMFrac[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/EFrac_Forward");
683  meJetEMFrac[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/EFrac");
684 
685  }
686 
687  //------------------------------------------------------------------------------
688  //--- Extract quality test results and fill data certification results for Jets
689  //--- Tests for Calo Barrel, EndCap and Forward, as well as PF and JPT jets
690  //--- For Calo and PF jets:
691  //--- Look at mean of Constituents, EM Frac and Pt
692  //--- Look at Kolmogorov result for Eta, Phi, and Pt
693  //--- For JPT jets:
694  //--- Look at mean of Pt, AllPionsTrackNHits?, nTracks,
695  //--- Look at Kolmogorov result for Eta, Phi, and Pt
696  //------------------------------------------------------------------------------
697 
698 
699  // Four types of jets {AK5 Barrel, AK5 EndCap, AK5 Forward, PF}, removed JPT which is 5th type of jets
700  //----------------------------------------------------------------------------
701  // Kolmogorov (KS) tests
702  const QReport* QReport_JetEta[4] = {nullptr};
703  const QReport* QReport_JetPhi[4] = {nullptr};
704  // Mean and KS tests for Calo and PF jets
705  const QReport* QReport_JetConstituents[4][2] = {{nullptr}};
706  const QReport* QReport_JetEFrac[4][2] = {{nullptr}};
707  const QReport* QReport_JetPt[4][2] = {{nullptr}};
708 
709  // Mean and KS tests for JPT jets
710  //const QReport* QReport_JetNTracks[2] = {0, 0};
711  float qr_Jet_Eta[4] = {-1};
712  float qr_Jet_Phi[4] = {-1};
713  float dc_Jet[4] = {-1};
714 
715  float qr_Jet_Constituents[4][2] = {{-1}};
716  float qr_Jet_EFrac[4][2] = {{-1}};
717  float qr_Jet_Pt[4][2] = {{-1}};
718 
719 
720  // Loop
721  //----------------------------------------------------------------------------
722  for (int jtyp=0; jtyp<4; ++jtyp) {
723  // Mean test results
724 
725  if (meJetConstituents[jtyp] && meJetConstituents[jtyp]->getRootObject() ) {
726  QReport_JetConstituents[jtyp][0] = meJetConstituents[jtyp]->getQReport("meanJetConstituentsTest");
727  QReport_JetConstituents[jtyp][1] = meJetConstituents[jtyp]->getQReport("KolmogorovTest");
728  }
729  if (meJetEMFrac[jtyp]&& meJetEMFrac[jtyp]->getRootObject() ) {
730  QReport_JetEFrac[jtyp][0] = meJetEMFrac[jtyp]->getQReport("meanEMFractionTest");
731  QReport_JetEFrac[jtyp][1] = meJetEMFrac[jtyp]->getQReport("KolmogorovTest");
732  }
733  if (meJetPt[jtyp] && meJetPt[jtyp]->getRootObject() ) {
734  QReport_JetPt[jtyp][0] = meJetPt[jtyp]->getQReport("meanJetPtTest");
735  QReport_JetPt[jtyp][1] = meJetPt[jtyp]->getQReport("KolmogorovTest");
736  }
737  if (meJetPhi[jtyp] && meJetPhi[jtyp]->getRootObject()){
738  QReport_JetPhi[jtyp] = meJetPhi[jtyp]->getQReport("KolmogorovTest");
739  }
740  if (meJetEta[jtyp] && meJetEta[jtyp]->getRootObject()){
741  QReport_JetEta[jtyp] = meJetEta[jtyp]->getQReport("KolmogorovTest");
742  }
743 
744  //Jet Pt test
745  if (QReport_JetPt[jtyp][0]){
746  //std::cout<<"jet type test pt "<<jtyp<<"/"<<QReport_JetPt[jtyp][0]->getStatus()<<std::endl;
747  if (QReport_JetPt[jtyp][0]->getStatus()==100 ||
748  QReport_JetPt[jtyp][0]->getStatus()==200)
749  qr_Jet_Pt[jtyp][0] = 1;
750  else if (QReport_JetPt[jtyp][0]->getStatus()==300)
751  qr_Jet_Pt[jtyp][0] = 0;
752  else
753  qr_Jet_Pt[jtyp][0] = -1;
754  }
755  else{ qr_Jet_Pt[jtyp][0] = -2;
756  //std::cout<<"qreport is REALLY NULL type test pt "<<jtyp<<" 0 "<<std::endl;
757  }
758  if (QReport_JetPt[jtyp][1]){
759  if (QReport_JetPt[jtyp][1]->getStatus()==100 ||
760  QReport_JetPt[jtyp][1]->getStatus()==200)
761  qr_Jet_Pt[jtyp][1] = 1;
762  else if (QReport_JetPt[jtyp][1]->getStatus()==300)
763  qr_Jet_Pt[jtyp][1] = 0;
764  else
765  qr_Jet_Pt[jtyp][1] = -1;
766  }
767  else{ qr_Jet_Pt[jtyp][1] = -2;
768  }
769 
770  //Jet Phi test
771  if (QReport_JetPhi[jtyp]){
772  if (QReport_JetPhi[jtyp]->getStatus()==100 ||
773  QReport_JetPhi[jtyp]->getStatus()==200)
774  qr_Jet_Phi[jtyp] = 1;
775  else if (QReport_JetPhi[jtyp]->getStatus()==300)
776  qr_Jet_Phi[jtyp] = 0;
777  else
778  qr_Jet_Phi[jtyp] = -1;
779  }
780  else{ qr_Jet_Phi[jtyp] = -2;
781  }
782  //Jet Eta test
783  if (QReport_JetEta[jtyp]){
784  if (QReport_JetEta[jtyp]->getStatus()==100 ||
785  QReport_JetEta[jtyp]->getStatus()==200)
786  qr_Jet_Eta[jtyp] = 1;
787  else if (QReport_JetEta[jtyp]->getStatus()==300)
788  qr_Jet_Eta[jtyp] = 0;
789  else
790  qr_Jet_Eta[jtyp] = -1;
791  }
792  else{
793  qr_Jet_Eta[jtyp] = -2;
794  }
795  //Jet Constituents test
796  if (QReport_JetConstituents[jtyp][0]){
797  if (QReport_JetConstituents[jtyp][0]->getStatus()==100 ||
798  QReport_JetConstituents[jtyp][0]->getStatus()==200)
799  qr_Jet_Constituents[jtyp][0] = 1;
800  else if (QReport_JetConstituents[jtyp][0]->getStatus()==300)
801  qr_Jet_Constituents[jtyp][0] = 0;
802  else
803  qr_Jet_Constituents[jtyp][0] = -1;
804  }
805  else{ qr_Jet_Constituents[jtyp][0] = -2;
806  }
807 
808  if (QReport_JetConstituents[jtyp][1]){
809  if (QReport_JetConstituents[jtyp][1]->getStatus()==100 ||
810  QReport_JetConstituents[jtyp][1]->getStatus()==200)
811  qr_Jet_Constituents[jtyp][1] = 1;
812  else if (QReport_JetConstituents[jtyp][1]->getStatus()==300)
813  qr_Jet_Constituents[jtyp][1] = 0;
814  else
815  qr_Jet_Constituents[jtyp][1] = -1;
816  }
817  else{ qr_Jet_Constituents[jtyp][1] = -2;
818  }
819  //Jet EMFrac test
820  if (QReport_JetEFrac[jtyp][0]){
821  if (QReport_JetEFrac[jtyp][0]->getStatus()==100 ||
822  QReport_JetEFrac[jtyp][0]->getStatus()==200)
823  qr_Jet_EFrac[jtyp][0] = 1;
824  else if (QReport_JetEFrac[jtyp][0]->getStatus()==300)
825  qr_Jet_EFrac[jtyp][0] = 0;
826  else
827  qr_Jet_EFrac[jtyp][0] = -1;
828  }
829  else{ qr_Jet_EFrac[jtyp][0] = -2;
830  }
831 
832  if (QReport_JetEFrac[jtyp][1]){
833  if (QReport_JetEFrac[jtyp][1]->getStatus()==100 ||
834  QReport_JetEFrac[jtyp][1]->getStatus()==200)
835  qr_Jet_EFrac[jtyp][1] = 1;
836  else if (QReport_JetEFrac[jtyp][1]->getStatus()==300)
837  qr_Jet_EFrac[jtyp][1] = 0;
838  else
839  qr_Jet_EFrac[jtyp][1] = -1;
840  }
841  else{ qr_Jet_EFrac[jtyp][1] = -2;
842  }
843 
844  if (verbose_) {
845  printf("====================Jet Type %d QTest Report Summary========================\n",jtyp);
846  printf("Eta: Phi: Pt 1: 2: Const/Ntracks 1: 2: EFrac/tracknhits 1: 2:\n");
847 
848  printf("%2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f\n", \
849  qr_Jet_Eta[jtyp], \
850  qr_Jet_Phi[jtyp], \
851  qr_Jet_Pt[jtyp][0], \
852  qr_Jet_Pt[jtyp][1], \
853  qr_Jet_Constituents[jtyp][0], \
854  qr_Jet_Constituents[jtyp][1], \
855  qr_Jet_EFrac[jtyp][0], \
856  qr_Jet_EFrac[jtyp][1]);
857 
858  }
859  //certification result for Jet
860 
861  //Only apply certain tests, as defined in the config
862  for (int ttyp = 0; ttyp < 2; ++ttyp) {
863  if (!jetTests[jtyp][ttyp]) {
864  qr_Jet_Pt[jtyp][ttyp] = 1;
865  if (ttyp ==1) {
866  qr_Jet_Eta[jtyp] = 1;
867  qr_Jet_Phi[jtyp] = 1;
868  }
869  qr_Jet_EFrac[jtyp][ttyp] = 1;
870  qr_Jet_Constituents[jtyp][ttyp] = 1;
871  }
872  }
873 
874 
875 
876  if ( (qr_Jet_EFrac[jtyp][0] == 0) ||
877  (qr_Jet_EFrac[jtyp][1] == 0) ||
878  (qr_Jet_Constituents[jtyp][1] == 0) ||
879  (qr_Jet_Constituents[jtyp][0] == 0) ||
880  (qr_Jet_Eta[jtyp] == 0) ||
881  (qr_Jet_Phi[jtyp] == 0) ||
882  (qr_Jet_Pt[jtyp][0] == 0) ||
883  (qr_Jet_Pt[jtyp][1] == 0)
884  )
885  dc_Jet[jtyp] = 0;
886  else if ( (qr_Jet_EFrac[jtyp][0] == -1) &&
887  (qr_Jet_EFrac[jtyp][1] == -1) &&
888  (qr_Jet_Constituents[jtyp][1] == -1) &&
889  (qr_Jet_Constituents[jtyp][0] == -1) &&
890  (qr_Jet_Eta[jtyp] == -1) &&
891  (qr_Jet_Phi[jtyp] == -1) &&
892  (qr_Jet_Pt[jtyp][0] == -1) &&
893  (qr_Jet_Pt[jtyp][1] == -1 )
894  )
895  dc_Jet[jtyp] = -1;
896  else if ( (qr_Jet_EFrac[jtyp][0] == -2) &&
897  (qr_Jet_EFrac[jtyp][1] == -2) &&
898  (qr_Jet_Constituents[jtyp][1] == -2) &&
899  (qr_Jet_Constituents[jtyp][0] == -2) &&
900  (qr_Jet_Eta[jtyp] == -2) &&
901  (qr_Jet_Phi[jtyp] == -2) &&
902  (qr_Jet_Pt[jtyp][0] == -2) &&
903  (qr_Jet_Pt[jtyp][1] == -2)
904  )
905  dc_Jet[jtyp] = -2;
906  else
907  dc_Jet[jtyp] = 1;
908 
909  if (verbose_) std::cout<<"Certifying Jet algo: "<<jtyp<<" with value: "<<dc_Jet[jtyp]<<std::endl;
910 
911 
912  CertificationSummaryMap->Fill(2, 4-jtyp, dc_Jet[jtyp]);
913  reportSummaryMap->Fill(2, 4-jtyp, dc_Jet[jtyp]);
914  }
915 
916  // There is nothing on the first row for HI, so mark the unfilled
917  if(isHI){
918  CertificationSummaryMap->Fill(2, 0, -2);
919  reportSummaryMap->Fill(2, 0, -2);
920  }
921 
922  //-----------------------------
923  // MET DQM Data Certification
924  //-----------------------------
925  //
926  // Prepare test histograms
927  //
928  MonitorElement *meMExy[2][2];
929  MonitorElement *meMEt[2];
930  MonitorElement *meSumEt[2];
931  MonitorElement *meMETPhi[2];
932 
933  RunDir = "";
934  if (RunDir.empty()) newHistoName = "JetMET/MET/";
935  else newHistoName = RunDir+"/JetMET/Runsummary/MET/";
936 
937  metFolder = "Cleaned";
938 
939  //MEx/MEy monitor elements
940  meMExy[0][0] = iget_.get(newHistoName+"met/"+metFolder+"/MEx");
941  meMExy[0][1] = iget_.get(newHistoName+"met/"+metFolder+"/MEy");
942  meMExy[1][0] = iget_.get(newHistoName+"pfMet/"+metFolder+"/MEx");
943  meMExy[1][1] = iget_.get(newHistoName+"pfMet/"+metFolder+"/MEy");
944 
945  //MET Phi monitor elements
946  meMETPhi[0] = iget_.get(newHistoName+"met/"+metFolder+"/METPhi");
947  meMETPhi[1] = iget_.get(newHistoName+"pfMet/"+metFolder+"/METPhi");
948  //MET monitor elements
949  meMEt[0] = iget_.get(newHistoName+"met/"+metFolder+"/MET");
950  meMEt[1] = iget_.get(newHistoName+"pfMet/"+metFolder+"/MET");
951  //SumET monitor elements
952  meSumEt[0] = iget_.get(newHistoName+"met/"+metFolder+"/SumET");
953  meSumEt[1] = iget_.get(newHistoName+"pfMet/"+metFolder+"/SumET");
954 
955  //----------------------------------------------------------------------------
956  //--- Extract quality test results and fill data certification results for MET
957  //----------------------------------------------------------------------------
958 
959  // 2 types of MET {CaloMET, PfMET} // It is 5 if CaloMETNoHF is included, 4 for MuonCorMET
960  // removed 3rd type of TcMET
961  // 2 types of tests Mean test/Kolmogorov test
962  const QReport * QReport_MExy[2][2][2]={{{nullptr}}};
963  const QReport * QReport_MEt[2][2]={{nullptr}};
964  const QReport * QReport_SumEt[2][2]={{nullptr}};
965  //2 types of tests phiQTest and Kolmogorov test
966  const QReport * QReport_METPhi[2][2]={{nullptr}};
967 
968 
969  float qr_MET_MExy[2][2][2] = {{{-999.}}};
970  float qr_MET_MEt[2][2] = {{-999.}};
971  float qr_MET_SumEt[2][2] = {{-999.}};
972  float qr_MET_METPhi[2][2] = {{-999.}};
973  float dc_MET[2] = {-999.};
974 
975 
976  // J.Piedra, 27/02/212
977  // removed MuCorrMET & TcMET --> loop up to 2 instead of 4, remove already from definition
978  for (int mtyp = 0; mtyp < 2; ++mtyp){
979  //Mean test results
980  if (meMExy[mtyp][0] && meMExy[mtyp][0]->getRootObject()) {
981  QReport_MExy[mtyp][0][0] = meMExy[mtyp][0]->getQReport("meanMExyTest");
982  QReport_MExy[mtyp][1][0] = meMExy[mtyp][0]->getQReport("KolmogorovTest");
983  }
984  if (meMExy[mtyp][1]&& meMExy[mtyp][1]->getRootObject()) {
985  QReport_MExy[mtyp][0][1] = meMExy[mtyp][1]->getQReport("meanMExyTest");
986  QReport_MExy[mtyp][1][1] = meMExy[mtyp][1]->getQReport("KolmogorovTest");
987  }
988  if (meMEt[mtyp] && meMEt[mtyp]->getRootObject()) {
989  QReport_MEt[mtyp][0] = meMEt[mtyp]->getQReport("meanMETTest");
990  QReport_MEt[mtyp][1] = meMEt[mtyp]->getQReport("KolmogorovTest");
991  }
992 
993  if (meSumEt[mtyp] && meSumEt[mtyp]->getRootObject()) {
994  QReport_SumEt[mtyp][0] = meSumEt[mtyp]->getQReport("meanSumETTest");
995  QReport_SumEt[mtyp][1] = meSumEt[mtyp]->getQReport("KolmogorovTest");
996  }
997 
998  if (meMETPhi[mtyp] && meMETPhi[mtyp]->getRootObject()) {
999  QReport_METPhi[mtyp][0] = meMETPhi[mtyp]->getQReport("phiQTest");
1000  QReport_METPhi[mtyp][1] = meMETPhi[mtyp]->getQReport("KolmogorovTest");
1001  }
1002  for (int testtyp = 0; testtyp < 2; ++testtyp) {
1003  //MEx test
1004  if (QReport_MExy[mtyp][testtyp][0]){
1005  if (QReport_MExy[mtyp][testtyp][0]->getStatus()==100 ||
1006  QReport_MExy[mtyp][testtyp][0]->getStatus()==200)
1007  qr_MET_MExy[mtyp][testtyp][0] = 1;
1008  else if (QReport_MExy[mtyp][testtyp][0]->getStatus()==300)
1009  qr_MET_MExy[mtyp][testtyp][0] = 0;
1010  else
1011  qr_MET_MExy[mtyp][testtyp][0] = -1;
1012  }
1013  else qr_MET_MExy[mtyp][testtyp][0] = -2;
1014  //MEy test
1015  if (QReport_MExy[mtyp][testtyp][1]){
1016  if (QReport_MExy[mtyp][testtyp][1]->getStatus()==100 ||
1017  QReport_MExy[mtyp][testtyp][1]->getStatus()==200)
1018  qr_MET_MExy[mtyp][testtyp][1] = 1;
1019  else if (QReport_MExy[mtyp][testtyp][1]->getStatus()==300)
1020  qr_MET_MExy[mtyp][testtyp][1] = 0;
1021  else
1022  qr_MET_MExy[mtyp][testtyp][1] = -1;
1023  }
1024  else qr_MET_MExy[mtyp][testtyp][1] = -2;
1025 
1026  //MEt test
1027  if (QReport_MEt[mtyp][testtyp]){
1028  if (QReport_MEt[mtyp][testtyp]->getStatus()==100 ||
1029  QReport_MEt[mtyp][testtyp]->getStatus()==200)
1030  qr_MET_MEt[mtyp][testtyp] = 1;
1031  else if (QReport_MEt[mtyp][testtyp]->getStatus()==300)
1032  qr_MET_MEt[mtyp][testtyp] = 0;
1033  else
1034  qr_MET_MEt[mtyp][testtyp] = -1;
1035  }
1036  else{
1037  qr_MET_MEt[mtyp][testtyp] = -2;
1038  }
1039  //SumEt test
1040  if (QReport_SumEt[mtyp][testtyp]){
1041  if (QReport_SumEt[mtyp][testtyp]->getStatus()==100 ||
1042  QReport_SumEt[mtyp][testtyp]->getStatus()==200)
1043  qr_MET_SumEt[mtyp][testtyp] = 1;
1044  else if (QReport_SumEt[mtyp][testtyp]->getStatus()==300)
1045  qr_MET_SumEt[mtyp][testtyp] = 0;
1046  else
1047  qr_MET_SumEt[mtyp][testtyp] = -1;
1048  }
1049  else{
1050  qr_MET_SumEt[mtyp][testtyp] = -2;
1051  }
1052  //METPhi test
1053  if (QReport_METPhi[mtyp][testtyp]){
1054  if (QReport_METPhi[mtyp][testtyp]->getStatus()==100 ||
1055  QReport_METPhi[mtyp][testtyp]->getStatus()==200)
1056  qr_MET_METPhi[mtyp][testtyp] = 1;
1057  else if (QReport_METPhi[mtyp][testtyp]->getStatus()==300)
1058  qr_MET_METPhi[mtyp][testtyp] = 0;
1059  else
1060  qr_MET_METPhi[mtyp][testtyp] = -1;
1061  }
1062  else{
1063  qr_MET_METPhi[mtyp][testtyp] = -2;
1064  }
1065  }
1066 
1067 
1068  if (verbose_) {
1069  //certification result for MET
1070  printf("====================MET Type %d QTest Report Summary========================\n",mtyp);
1071  printf("MEx test MEy test MEt test: SumEt test: METPhi test:\n");
1072  for (int tt = 0; tt < 2; ++tt) {
1073  printf("%2.2f %2.2f %2.2f %2.2f %2.2f\n",qr_MET_MExy[mtyp][tt][0], \
1074  qr_MET_MExy[mtyp][tt][1], \
1075  qr_MET_MEt[mtyp][tt], \
1076  qr_MET_SumEt[mtyp][tt], \
1077  qr_MET_METPhi[mtyp][tt]);
1078  }
1079  printf("===========================================================================\n");
1080  }
1081 
1082 
1083  //Only apply certain tests, as defined in the config
1084  for (int ttyp = 0; ttyp < 2; ++ttyp) {
1085  if (!metTests[mtyp][ttyp]) {
1086  qr_MET_MExy[mtyp][ttyp][0] = 1;
1087  qr_MET_MExy[mtyp][ttyp][1] = 1;
1088  qr_MET_MEt[mtyp][ttyp] = 1;
1089  qr_MET_SumEt[mtyp][ttyp] = 1;
1090  qr_MET_METPhi[mtyp][ttyp] = 1;
1091  }
1092  }
1093 
1094 
1095  if (
1096  (qr_MET_MExy[mtyp][0][0] == 0) ||
1097  (qr_MET_MExy[mtyp][0][1] == 0) ||
1098  (qr_MET_MEt[mtyp][0] == 0) ||
1099  (qr_MET_SumEt[mtyp][0] == 0) ||
1100  (qr_MET_METPhi[mtyp][0] == 0) ||
1101  (qr_MET_MExy[mtyp][1][0] == 0) ||
1102  (qr_MET_MExy[mtyp][1][1] == 0) ||
1103  (qr_MET_MEt[mtyp][1] == 0) ||
1104  (qr_MET_SumEt[mtyp][1] == 0) ||
1105  (qr_MET_METPhi[mtyp][1] == 0)
1106  )
1107  dc_MET[mtyp] = 0;
1108  else if (
1109  (qr_MET_MExy[mtyp][0][0] == -1) &&
1110  (qr_MET_MExy[mtyp][0][1] == -1) &&
1111  (qr_MET_MEt[mtyp][0] == -1) &&
1112  (qr_MET_SumEt[mtyp][0] == -1) &&
1113  (qr_MET_METPhi[mtyp][0] == -1) &&
1114  (qr_MET_MExy[mtyp][1][0] == -1) &&
1115  (qr_MET_MExy[mtyp][1][1] == -1) &&
1116  (qr_MET_MEt[mtyp][1] == -1) &&
1117  (qr_MET_SumEt[mtyp][1] == -1) &&
1118  (qr_MET_METPhi[mtyp][1] == -1)
1119  )
1120  dc_MET[mtyp] = -1;
1121  else if (
1122  (qr_MET_MExy[mtyp][0][0] == -2) &&
1123  (qr_MET_MExy[mtyp][0][1] == -2) &&
1124  (qr_MET_MEt[mtyp][0] == -2) &&
1125  (qr_MET_SumEt[mtyp][0] == -2) &&
1126  (qr_MET_METPhi[mtyp][0] == -2) &&
1127  (qr_MET_MExy[mtyp][1][0] == -2) &&
1128  (qr_MET_MExy[mtyp][1][1] == -2) &&
1129  (qr_MET_MEt[mtyp][1] == -2) &&
1130  (qr_MET_SumEt[mtyp][1] == -2) &&
1131  (qr_MET_METPhi[mtyp][1] == -2)
1132  )
1133  dc_MET[mtyp] = -2;
1134  else
1135  dc_MET[mtyp] = 1;
1136 
1137  if (verbose_) std::cout<<"Certifying MET algo: "<<mtyp<<" with value: "<<dc_MET[mtyp]<<std::endl;
1138  CertificationSummaryMap->Fill(1, 4-mtyp, dc_MET[mtyp]);
1139  reportSummaryMap->Fill(1, 4-mtyp, dc_MET[mtyp]);
1140  }
1141 
1142  // There is nothing on the first three rows for HI, so mark them unfilled
1143  if(isHI){
1144  for(int i = 0; i < 3; i++){
1145  CertificationSummaryMap->Fill(1, i, -2);
1146  reportSummaryMap->Fill(1, i, -2);
1147  }
1148  }
1149 
1150  //----------------------------------------------------------------------------
1151  //--- Extract quality test results and fill data certification results for MET
1152  //----------------------------------------------------------------------------
1153  // Commenting out unused but initialized variables. [Suchandra Dutta]
1154  float dc_CT[3] = {-2.};
1155  dc_CT[0] = -2.;
1156  dc_CT[1] = -2.;
1157  dc_CT[2] = -2.;
1158 
1159  for (int cttyp = 0; cttyp < 3; ++cttyp) {
1160 
1161  if (verbose_) std::cout<<"Certifying CaloTowers with value: "<<dc_CT[cttyp]<<std::endl;
1162  CertificationSummaryMap->Fill(0, 4-cttyp, dc_CT[cttyp]);
1163  reportSummaryMap->Fill(0, 4-cttyp, dc_CT[cttyp]);
1164  }
1165  ibook_.setCurrentFolder("");
1166 }
1167 
1168 //define this as a plug-in
1169 //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 &)