test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
METTesterPostProcessorHarvesting.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Validation/RecoMET
4 // Class: METTesterPostProcessorHarvesting
5 //
6 // Original Author: "Matthias Weber"
7 // Created: Sun Feb 22 14:35:25 CET 2015
8 //
9 
13 
14 // Some switches
15 //
16 // constructors and destructor
17 //
19 {
20  inputMETLabelRECO_=iConfig.getParameter<edm::InputTag>("METTypeRECO");
21  inputMETLabelMiniAOD_=iConfig.getParameter<edm::InputTag>("METTypeMiniAOD");
22 }
23 
24 
26 {
27 }
28 
29 
30 // ------------ method called right after a run ends ------------
31 void
33 {
34  std::vector<std::string> subDirVec;
35  std::string RunDir="JetMET/METValidation/";
36  iget_.setCurrentFolder(RunDir);
37  met_dirs=iget_.getSubdirs();
38  bool found_reco_dir=false;
39  bool found_miniaod_dir=false;
40  //loop over met subdirectories
41  for (int i=0; i<int(met_dirs.size()); i++) {
42  if(met_dirs[i]==(RunDir+inputMETLabelRECO_.label())){
43  found_reco_dir=true;
44  }
45  if(met_dirs[i]==(RunDir+inputMETLabelMiniAOD_.label())){
46  found_miniaod_dir=true;
47  }
48  }
49  if(found_miniaod_dir && found_reco_dir){
50  std::string rundir_reco=RunDir+inputMETLabelRECO_.label();
51  std::string rundir_miniaod=RunDir+inputMETLabelMiniAOD_.label();
52  MonitorElement* mMET_Reco=iget_.get(rundir_reco+"/"+"MET");
53  MonitorElement* mMETPhi_Reco=iget_.get(rundir_reco+"/"+"METPhi");
54  MonitorElement* mSumET_Reco=iget_.get(rundir_reco+"/"+"SumET");
55  MonitorElement* mMETDifference_GenMETTrue_Reco=iget_.get(rundir_reco+"/"+"METDifference_GenMETTrue");
56  MonitorElement* mMETDeltaPhi_GenMETTrue_Reco=iget_.get(rundir_reco+"/"+"METDeltaPhi_GenMETTrue");
57  MonitorElement* mPFPhotonEtFraction_Reco=iget_.get(rundir_reco+"/"+"photonEtFraction");
58  MonitorElement* mPFNeutralHadronEtFraction_Reco=iget_.get(rundir_reco+"/"+"neutralHadronEtFraction");
59  MonitorElement* mPFChargedHadronEtFraction_Reco=iget_.get(rundir_reco+"/"+"chargedHadronEtFraction");
60  MonitorElement* mPFHFHadronEtFraction_Reco=iget_.get(rundir_reco+"/"+"HFHadronEtFraction");
61  MonitorElement* mPFHFEMEtFraction_Reco=iget_.get(rundir_reco+"/"+"HFEMEtFraction");
62  MonitorElement* mMETDifference_GenMETTrue_MET20to40_Reco=iget_.get(rundir_reco+"/"+"METResolution_GenMETTrue_MET20to40");
63  MonitorElement* mMETDifference_GenMETTrue_MET100to150_Reco=iget_.get(rundir_reco+"/"+"METResolution_GenMETTrue_MET100to150");
64  MonitorElement* mMETDifference_GenMETTrue_MET300to400_Reco=iget_.get(rundir_reco+"/"+"METResolution_GenMETTrue_MET300to400");
65 
66  std::vector<MonitorElement*>ME_Reco;
67  ME_Reco.push_back(mMET_Reco);
68  ME_Reco.push_back(mMETPhi_Reco);
69  ME_Reco.push_back(mSumET_Reco);
70  ME_Reco.push_back(mMETDifference_GenMETTrue_Reco);
71  ME_Reco.push_back(mMETDeltaPhi_GenMETTrue_Reco);
72  ME_Reco.push_back(mPFPhotonEtFraction_Reco);
73  ME_Reco.push_back(mPFNeutralHadronEtFraction_Reco);
74  ME_Reco.push_back(mPFChargedHadronEtFraction_Reco);
75  ME_Reco.push_back(mPFHFHadronEtFraction_Reco);
76  ME_Reco.push_back(mPFHFEMEtFraction_Reco);
77  ME_Reco.push_back(mMETDifference_GenMETTrue_MET20to40_Reco);
78  ME_Reco.push_back(mMETDifference_GenMETTrue_MET100to150_Reco);
79  ME_Reco.push_back(mMETDifference_GenMETTrue_MET300to400_Reco);
80 
81 
82  MonitorElement* mMET_MiniAOD=iget_.get(rundir_miniaod+"/"+"MET");
83  MonitorElement* mMETPhi_MiniAOD=iget_.get(rundir_miniaod+"/"+"METPhi");
84  MonitorElement* mSumET_MiniAOD=iget_.get(rundir_miniaod+"/"+"SumET");
85  MonitorElement* mMETDifference_GenMETTrue_MiniAOD=iget_.get(rundir_miniaod+"/"+"METDifference_GenMETTrue");
86  MonitorElement* mMETDeltaPhi_GenMETTrue_MiniAOD=iget_.get(rundir_miniaod+"/"+"METDeltaPhi_GenMETTrue");
87  MonitorElement* mPFPhotonEtFraction_MiniAOD=iget_.get(rundir_miniaod+"/"+"photonEtFraction");
88  MonitorElement* mPFNeutralHadronEtFraction_MiniAOD=iget_.get(rundir_miniaod+"/"+"neutralHadronEtFraction");
89  MonitorElement* mPFChargedHadronEtFraction_MiniAOD=iget_.get(rundir_miniaod+"/"+"chargedHadronEtFraction");
90  MonitorElement* mPFHFHadronEtFraction_MiniAOD=iget_.get(rundir_miniaod+"/"+"HFHadronEtFraction");
91  MonitorElement* mPFHFEMEtFraction_MiniAOD=iget_.get(rundir_miniaod+"/"+"HFEMEtFraction");
92  MonitorElement* mMETDifference_GenMETTrue_MET20to40_MiniAOD=iget_.get(rundir_miniaod+"/"+"METResolution_GenMETTrue_MET20to40");
93  MonitorElement* mMETDifference_GenMETTrue_MET100to150_MiniAOD=iget_.get(rundir_miniaod+"/"+"METResolution_GenMETTrue_MET100to150");
94  MonitorElement* mMETDifference_GenMETTrue_MET300to400_MiniAOD=iget_.get(rundir_miniaod+"/"+"METResolution_GenMETTrue_MET300to400");
95 
96  std::vector<MonitorElement*>ME_MiniAOD;
97  ME_MiniAOD.push_back(mMET_MiniAOD);
98  ME_MiniAOD.push_back(mMETPhi_MiniAOD);
99  ME_MiniAOD.push_back(mSumET_MiniAOD);
100  ME_MiniAOD.push_back(mMETDifference_GenMETTrue_MiniAOD);
101  ME_MiniAOD.push_back(mMETDeltaPhi_GenMETTrue_MiniAOD);
102  ME_MiniAOD.push_back(mPFPhotonEtFraction_MiniAOD);
103  ME_MiniAOD.push_back(mPFNeutralHadronEtFraction_MiniAOD);
104  ME_MiniAOD.push_back(mPFChargedHadronEtFraction_MiniAOD);
105  ME_MiniAOD.push_back(mPFHFHadronEtFraction_MiniAOD);
106  ME_MiniAOD.push_back(mPFHFEMEtFraction_MiniAOD);
107  ME_MiniAOD.push_back(mMETDifference_GenMETTrue_MET20to40_MiniAOD);
108  ME_MiniAOD.push_back(mMETDifference_GenMETTrue_MET100to150_MiniAOD);
109  ME_MiniAOD.push_back(mMETDifference_GenMETTrue_MET300to400_MiniAOD);
110 
111  ibook_.setCurrentFolder(RunDir+"MiniAOD_over_RECO");
112  mMET_MiniAOD_over_Reco=ibook_.book1D("MET_MiniAOD_over_RECO",(TH1F*)mMET_Reco->getRootObject());
113  mMETPhi_MiniAOD_over_Reco=ibook_.book1D("METPhi_MiniAOD_over_RECO",(TH1F*)mMETPhi_Reco->getRootObject());
114  mSumET_MiniAOD_over_Reco=ibook_.book1D("SumET_MiniAOD_over_RECO",(TH1F*)mSumET_Reco->getRootObject());
115  mMETDifference_GenMETTrue_MiniAOD_over_Reco=ibook_.book1D("METDifference_GenMETTrue_MiniAOD_over_RECO",(TH1F*)mMETDifference_GenMETTrue_Reco->getRootObject());
116  mMETDeltaPhi_GenMETTrue_MiniAOD_over_Reco=ibook_.book1D("METDeltaPhi_GenMETTrue_MiniAOD_over_RECO",(TH1F*)mMETDeltaPhi_GenMETTrue_Reco->getRootObject());
117  mPFPhotonEtFraction_MiniAOD_over_Reco=ibook_.book1D("photonEtFraction_MiniAOD_over_RECO",(TH1F*)mPFPhotonEtFraction_Reco->getRootObject());
118  mPFNeutralHadronEtFraction_MiniAOD_over_Reco=ibook_.book1D("neutralHadronEtFraction_MiniAOD_over_RECO",(TH1F*)mPFNeutralHadronEtFraction_Reco->getRootObject());
119  mPFChargedHadronEtFraction_MiniAOD_over_Reco=ibook_.book1D("chargedHadronEtFraction_MiniAOD_over_RECO",(TH1F*)mPFChargedHadronEtFraction_Reco->getRootObject());
120  mPFHFHadronEtFraction_MiniAOD_over_Reco=ibook_.book1D("HFHadronEtFraction_MiniAOD_over_RECO",(TH1F*)mPFHFHadronEtFraction_Reco->getRootObject());
121  mPFHFEMEtFraction_MiniAOD_over_Reco=ibook_.book1D("HFEMEtEtFraction_MiniAOD_over_RECO",(TH1F*)mPFHFEMEtFraction_Reco->getRootObject());
122  mMETDifference_GenMETTrue_MET20to40_MiniAOD_over_Reco=ibook_.book1D("METResolution_GenMETTrue_MET20to40_MiniAOD_over_RECO",(TH1F*)mMETDifference_GenMETTrue_MET20to40_Reco->getRootObject());
123  mMETDifference_GenMETTrue_MET100to150_MiniAOD_over_Reco=ibook_.book1D("METResolution_GenMETTrue_MET100to150_MiniAOD_over_RECO",(TH1F*)mMETDifference_GenMETTrue_MET100to150_Reco->getRootObject());
124  mMETDifference_GenMETTrue_MET300to400_MiniAOD_over_Reco=ibook_.book1D("METResolution_GenMETTrue_MET300to400_MiniAOD_over_RECO",(TH1F*)mMETDifference_GenMETTrue_MET300to400_Reco->getRootObject());
125 
126  std::vector<MonitorElement*>ME_MiniAOD_over_Reco;
127  ME_MiniAOD_over_Reco.push_back(mMET_MiniAOD_over_Reco);
128  ME_MiniAOD_over_Reco.push_back(mMETPhi_MiniAOD_over_Reco);
129  ME_MiniAOD_over_Reco.push_back(mSumET_MiniAOD_over_Reco);
130  ME_MiniAOD_over_Reco.push_back(mMETDifference_GenMETTrue_MiniAOD_over_Reco);
131  ME_MiniAOD_over_Reco.push_back(mMETDeltaPhi_GenMETTrue_MiniAOD_over_Reco);
132  ME_MiniAOD_over_Reco.push_back(mPFPhotonEtFraction_MiniAOD_over_Reco);
133  ME_MiniAOD_over_Reco.push_back(mPFNeutralHadronEtFraction_MiniAOD_over_Reco);
134  ME_MiniAOD_over_Reco.push_back(mPFChargedHadronEtFraction_MiniAOD_over_Reco);
135  ME_MiniAOD_over_Reco.push_back(mPFHFHadronEtFraction_MiniAOD_over_Reco);
136  ME_MiniAOD_over_Reco.push_back(mPFHFEMEtFraction_MiniAOD_over_Reco);
137  ME_MiniAOD_over_Reco.push_back(mMETDifference_GenMETTrue_MET20to40_MiniAOD_over_Reco);
138  ME_MiniAOD_over_Reco.push_back(mMETDifference_GenMETTrue_MET100to150_MiniAOD_over_Reco);
139  ME_MiniAOD_over_Reco.push_back(mMETDifference_GenMETTrue_MET300to400_MiniAOD_over_Reco);
140 
141  for(unsigned int j=0;j<ME_MiniAOD_over_Reco.size();j++){
142  MonitorElement* monReco=ME_Reco[j];if(monReco && monReco->getRootObject()){
143  MonitorElement* monMiniAOD=ME_MiniAOD[j];if(monMiniAOD && monMiniAOD->getRootObject()){
144  MonitorElement* monMiniAOD_over_RECO=ME_MiniAOD_over_Reco[j];if(monMiniAOD_over_RECO && monMiniAOD_over_RECO->getRootObject()){
145  for(int i=0;i<=(monMiniAOD_over_RECO->getNbinsX()+1);i++){
146  if(monReco->getBinContent(i)!=0){
147  monMiniAOD_over_RECO->setBinContent(i,monMiniAOD->getBinContent(i)/monReco->getBinContent(i));
148  }else if (monMiniAOD->getBinContent(i)!=0){
149  monMiniAOD_over_RECO->setBinContent(i,-0.5);
150  }
151  }
152  }
153  }
154  }
155  }
156  }
157 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
virtual void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &)
METTesterPostProcessorHarvesting(const edm::ParameterSet &)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
int j
Definition: DBlmapReader.cc:9
MonitorElement * mMETDifference_GenMETTrue_MET300to400_MiniAOD_over_Reco
TObject * getRootObject(void) const
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
std::string const & label() const
Definition: InputTag.h:36
std::vector< std::string > getSubdirs(void)
Definition: DQMStore.cc:322
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:346
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
MonitorElement * mMETDifference_GenMETTrue_MET100to150_MiniAOD_over_Reco