CMS 3D CMS Logo

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  inputMETLabelRECO_ = iConfig.getParameter<edm::InputTag>("METTypeRECO");
20  inputMETLabelMiniAOD_ = iConfig.getParameter<edm::InputTag>("METTypeMiniAOD");
21 }
22 
24 
25 // ------------ method called right after a run ends ------------
27  std::vector<std::string> subDirVec;
28  std::string RunDir = "JetMET/METValidation/";
29  iget_.setCurrentFolder(RunDir);
30  met_dirs = iget_.getSubdirs();
31  bool found_reco_dir = false;
32  bool found_miniaod_dir = false;
33  // loop over met subdirectories
34  for (int i = 0; i < int(met_dirs.size()); i++) {
35  if (met_dirs[i] == (RunDir + inputMETLabelRECO_.label())) {
36  found_reco_dir = true;
37  }
38  if (met_dirs[i] == (RunDir + inputMETLabelMiniAOD_.label())) {
39  found_miniaod_dir = true;
40  }
41  }
42  if (found_miniaod_dir && found_reco_dir) {
43  std::string rundir_reco = RunDir + inputMETLabelRECO_.label();
44  std::string rundir_miniaod = RunDir + inputMETLabelMiniAOD_.label();
45  MonitorElement *mMET_Reco = iget_.get(rundir_reco + "/" + "MET");
46  MonitorElement *mMETPhi_Reco = iget_.get(rundir_reco + "/" + "METPhi");
47  MonitorElement *mSumET_Reco = iget_.get(rundir_reco + "/" + "SumET");
48  MonitorElement *mMETDifference_GenMETTrue_Reco = iget_.get(rundir_reco + "/" + "METDifference_GenMETTrue");
49  MonitorElement *mMETDeltaPhi_GenMETTrue_Reco = iget_.get(rundir_reco + "/" + "METDeltaPhi_GenMETTrue");
50  MonitorElement *mPFPhotonEtFraction_Reco = iget_.get(rundir_reco + "/" + "photonEtFraction");
51  MonitorElement *mPFNeutralHadronEtFraction_Reco = iget_.get(rundir_reco + "/" + "neutralHadronEtFraction");
52  MonitorElement *mPFChargedHadronEtFraction_Reco = iget_.get(rundir_reco + "/" + "chargedHadronEtFraction");
53  MonitorElement *mPFHFHadronEtFraction_Reco = iget_.get(rundir_reco + "/" + "HFHadronEtFraction");
54  MonitorElement *mPFHFEMEtFraction_Reco = iget_.get(rundir_reco + "/" + "HFEMEtFraction");
55  MonitorElement *mMETDifference_GenMETTrue_MET20to40_Reco =
56  iget_.get(rundir_reco + "/" + "METResolution_GenMETTrue_MET20to40");
57  MonitorElement *mMETDifference_GenMETTrue_MET100to150_Reco =
58  iget_.get(rundir_reco + "/" + "METResolution_GenMETTrue_MET100to150");
59  MonitorElement *mMETDifference_GenMETTrue_MET300to400_Reco =
60  iget_.get(rundir_reco + "/" + "METResolution_GenMETTrue_MET300to400");
61 
62  std::vector<MonitorElement *> ME_Reco;
63  ME_Reco.push_back(mMET_Reco);
64  ME_Reco.push_back(mMETPhi_Reco);
65  ME_Reco.push_back(mSumET_Reco);
66  ME_Reco.push_back(mMETDifference_GenMETTrue_Reco);
67  ME_Reco.push_back(mMETDeltaPhi_GenMETTrue_Reco);
68  ME_Reco.push_back(mPFPhotonEtFraction_Reco);
69  ME_Reco.push_back(mPFNeutralHadronEtFraction_Reco);
70  ME_Reco.push_back(mPFChargedHadronEtFraction_Reco);
71  ME_Reco.push_back(mPFHFHadronEtFraction_Reco);
72  ME_Reco.push_back(mPFHFEMEtFraction_Reco);
73  ME_Reco.push_back(mMETDifference_GenMETTrue_MET20to40_Reco);
74  ME_Reco.push_back(mMETDifference_GenMETTrue_MET100to150_Reco);
75  ME_Reco.push_back(mMETDifference_GenMETTrue_MET300to400_Reco);
76 
77  MonitorElement *mMET_MiniAOD = iget_.get(rundir_miniaod + "/" + "MET");
78  MonitorElement *mMETPhi_MiniAOD = iget_.get(rundir_miniaod + "/" + "METPhi");
79  MonitorElement *mSumET_MiniAOD = iget_.get(rundir_miniaod + "/" + "SumET");
80  MonitorElement *mMETDifference_GenMETTrue_MiniAOD = iget_.get(rundir_miniaod + "/" + "METDifference_GenMETTrue");
81  MonitorElement *mMETDeltaPhi_GenMETTrue_MiniAOD = iget_.get(rundir_miniaod + "/" + "METDeltaPhi_GenMETTrue");
82  MonitorElement *mPFPhotonEtFraction_MiniAOD = iget_.get(rundir_miniaod + "/" + "photonEtFraction");
83  MonitorElement *mPFNeutralHadronEtFraction_MiniAOD = iget_.get(rundir_miniaod + "/" + "neutralHadronEtFraction");
84  MonitorElement *mPFChargedHadronEtFraction_MiniAOD = iget_.get(rundir_miniaod + "/" + "chargedHadronEtFraction");
85  MonitorElement *mPFHFHadronEtFraction_MiniAOD = iget_.get(rundir_miniaod + "/" + "HFHadronEtFraction");
86  MonitorElement *mPFHFEMEtFraction_MiniAOD = iget_.get(rundir_miniaod + "/" + "HFEMEtFraction");
87  MonitorElement *mMETDifference_GenMETTrue_MET20to40_MiniAOD =
88  iget_.get(rundir_miniaod + "/" + "METResolution_GenMETTrue_MET20to40");
89  MonitorElement *mMETDifference_GenMETTrue_MET100to150_MiniAOD =
90  iget_.get(rundir_miniaod + "/" + "METResolution_GenMETTrue_MET100to150");
91  MonitorElement *mMETDifference_GenMETTrue_MET300to400_MiniAOD =
92  iget_.get(rundir_miniaod + "/" + "METResolution_GenMETTrue_MET300to400");
93 
94  std::vector<MonitorElement *> ME_MiniAOD;
95  ME_MiniAOD.push_back(mMET_MiniAOD);
96  ME_MiniAOD.push_back(mMETPhi_MiniAOD);
97  ME_MiniAOD.push_back(mSumET_MiniAOD);
98  ME_MiniAOD.push_back(mMETDifference_GenMETTrue_MiniAOD);
99  ME_MiniAOD.push_back(mMETDeltaPhi_GenMETTrue_MiniAOD);
100  ME_MiniAOD.push_back(mPFPhotonEtFraction_MiniAOD);
101  ME_MiniAOD.push_back(mPFNeutralHadronEtFraction_MiniAOD);
102  ME_MiniAOD.push_back(mPFChargedHadronEtFraction_MiniAOD);
103  ME_MiniAOD.push_back(mPFHFHadronEtFraction_MiniAOD);
104  ME_MiniAOD.push_back(mPFHFEMEtFraction_MiniAOD);
105  ME_MiniAOD.push_back(mMETDifference_GenMETTrue_MET20to40_MiniAOD);
106  ME_MiniAOD.push_back(mMETDifference_GenMETTrue_MET100to150_MiniAOD);
107  ME_MiniAOD.push_back(mMETDifference_GenMETTrue_MET300to400_MiniAOD);
108 
109  ibook_.setCurrentFolder(RunDir + "MiniAOD_over_RECO");
110  mMET_MiniAOD_over_Reco = ibook_.book1D("MET_MiniAOD_over_RECO", (TH1F *)mMET_Reco->getRootObject());
111  mMETPhi_MiniAOD_over_Reco = ibook_.book1D("METPhi_MiniAOD_over_RECO", (TH1F *)mMETPhi_Reco->getRootObject());
112  mSumET_MiniAOD_over_Reco = ibook_.book1D("SumET_MiniAOD_over_RECO", (TH1F *)mSumET_Reco->getRootObject());
114  "METDifference_GenMETTrue_MiniAOD_over_RECO", (TH1F *)mMETDifference_GenMETTrue_Reco->getRootObject());
115  mMETDeltaPhi_GenMETTrue_MiniAOD_over_Reco = ibook_.book1D("METDeltaPhi_GenMETTrue_MiniAOD_over_RECO",
116  (TH1F *)mMETDeltaPhi_GenMETTrue_Reco->getRootObject());
118  ibook_.book1D("photonEtFraction_MiniAOD_over_RECO", (TH1F *)mPFPhotonEtFraction_Reco->getRootObject());
120  "neutralHadronEtFraction_MiniAOD_over_RECO", (TH1F *)mPFNeutralHadronEtFraction_Reco->getRootObject());
122  "chargedHadronEtFraction_MiniAOD_over_RECO", (TH1F *)mPFChargedHadronEtFraction_Reco->getRootObject());
124  ibook_.book1D("HFHadronEtFraction_MiniAOD_over_RECO", (TH1F *)mPFHFHadronEtFraction_Reco->getRootObject());
126  ibook_.book1D("HFEMEtEtFraction_MiniAOD_over_RECO", (TH1F *)mPFHFEMEtFraction_Reco->getRootObject());
128  ibook_.book1D("METResolution_GenMETTrue_MET20to40_MiniAOD_over_RECO",
129  (TH1F *)mMETDifference_GenMETTrue_MET20to40_Reco->getRootObject());
131  ibook_.book1D("METResolution_GenMETTrue_MET100to150_MiniAOD_over_RECO",
132  (TH1F *)mMETDifference_GenMETTrue_MET100to150_Reco->getRootObject());
134  ibook_.book1D("METResolution_GenMETTrue_MET300to400_MiniAOD_over_RECO",
135  (TH1F *)mMETDifference_GenMETTrue_MET300to400_Reco->getRootObject());
136 
137  std::vector<MonitorElement *> ME_MiniAOD_over_Reco;
138  ME_MiniAOD_over_Reco.push_back(mMET_MiniAOD_over_Reco);
139  ME_MiniAOD_over_Reco.push_back(mMETPhi_MiniAOD_over_Reco);
140  ME_MiniAOD_over_Reco.push_back(mSumET_MiniAOD_over_Reco);
141  ME_MiniAOD_over_Reco.push_back(mMETDifference_GenMETTrue_MiniAOD_over_Reco);
142  ME_MiniAOD_over_Reco.push_back(mMETDeltaPhi_GenMETTrue_MiniAOD_over_Reco);
143  ME_MiniAOD_over_Reco.push_back(mPFPhotonEtFraction_MiniAOD_over_Reco);
144  ME_MiniAOD_over_Reco.push_back(mPFNeutralHadronEtFraction_MiniAOD_over_Reco);
145  ME_MiniAOD_over_Reco.push_back(mPFChargedHadronEtFraction_MiniAOD_over_Reco);
146  ME_MiniAOD_over_Reco.push_back(mPFHFHadronEtFraction_MiniAOD_over_Reco);
147  ME_MiniAOD_over_Reco.push_back(mPFHFEMEtFraction_MiniAOD_over_Reco);
148  ME_MiniAOD_over_Reco.push_back(mMETDifference_GenMETTrue_MET20to40_MiniAOD_over_Reco);
149  ME_MiniAOD_over_Reco.push_back(mMETDifference_GenMETTrue_MET100to150_MiniAOD_over_Reco);
150  ME_MiniAOD_over_Reco.push_back(mMETDifference_GenMETTrue_MET300to400_MiniAOD_over_Reco);
151 
152  for (unsigned int j = 0; j < ME_MiniAOD_over_Reco.size(); j++) {
153  MonitorElement *monReco = ME_Reco[j];
154  if (monReco && monReco->getRootObject()) {
155  MonitorElement *monMiniAOD = ME_MiniAOD[j];
156  if (monMiniAOD && monMiniAOD->getRootObject()) {
157  MonitorElement *monMiniAOD_over_RECO = ME_MiniAOD_over_Reco[j];
158  if (monMiniAOD_over_RECO && monMiniAOD_over_RECO->getRootObject()) {
159  for (int i = 0; i <= (monMiniAOD_over_RECO->getNbinsX() + 1); i++) {
160  if (monReco->getBinContent(i) != 0) {
161  monMiniAOD_over_RECO->setBinContent(i, monMiniAOD->getBinContent(i) / monReco->getBinContent(i));
162  } else if (monMiniAOD->getBinContent(i) != 0) {
163  monMiniAOD_over_RECO->setBinContent(i, -0.5);
164  }
165  }
166  }
167  }
168  }
169  }
170  }
171 }
mps_fire.i
i
Definition: mps_fire.py:428
METTesterPostProcessorHarvesting::mPFPhotonEtFraction_MiniAOD_over_Reco
MonitorElement * mPFPhotonEtFraction_MiniAOD_over_Reco
Definition: METTesterPostProcessorHarvesting.h:44
LuminosityBlock.h
METTesterPostProcessorHarvesting::mSumET_MiniAOD_over_Reco
MonitorElement * mSumET_MiniAOD_over_Reco
Definition: METTesterPostProcessorHarvesting.h:43
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
dqm::implementation::IGetter::getSubdirs
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:678
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
METTesterPostProcessorHarvesting::mPFHFEMEtFraction_MiniAOD_over_Reco
MonitorElement * mPFHFEMEtFraction_MiniAOD_over_Reco
Definition: METTesterPostProcessorHarvesting.h:48
METTesterPostProcessorHarvesting::mPFChargedHadronEtFraction_MiniAOD_over_Reco
MonitorElement * mPFChargedHadronEtFraction_MiniAOD_over_Reco
Definition: METTesterPostProcessorHarvesting.h:46
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
METTesterPostProcessorHarvesting::mMETDifference_GenMETTrue_MET300to400_MiniAOD_over_Reco
MonitorElement * mMETDifference_GenMETTrue_MET300to400_MiniAOD_over_Reco
Definition: METTesterPostProcessorHarvesting.h:53
dqm::legacy::MonitorElement::getRootObject
TObject * getRootObject() const override
Definition: MonitorElement.h:469
METTesterPostProcessorHarvesting::mMET_MiniAOD_over_Reco
MonitorElement * mMET_MiniAOD_over_Reco
Definition: METTesterPostProcessorHarvesting.h:41
METTesterPostProcessorHarvesting::inputMETLabelRECO_
edm::InputTag inputMETLabelRECO_
Definition: METTesterPostProcessorHarvesting.h:36
Run.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
METTesterPostProcessorHarvesting::mPFHFHadronEtFraction_MiniAOD_over_Reco
MonitorElement * mPFHFHadronEtFraction_MiniAOD_over_Reco
Definition: METTesterPostProcessorHarvesting.h:47
edm::ParameterSet
Definition: ParameterSet.h:47
METTesterPostProcessorHarvesting::mMETPhi_MiniAOD_over_Reco
MonitorElement * mMETPhi_MiniAOD_over_Reco
Definition: METTesterPostProcessorHarvesting.h:42
METTesterPostProcessorHarvesting::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: METTesterPostProcessorHarvesting.cc:26
METTesterPostProcessorHarvesting::METTesterPostProcessorHarvesting
METTesterPostProcessorHarvesting(const edm::ParameterSet &)
Definition: METTesterPostProcessorHarvesting.cc:18
createfilelist.int
int
Definition: createfilelist.py:10
METTesterPostProcessorHarvesting::~METTesterPostProcessorHarvesting
~METTesterPostProcessorHarvesting() override
Definition: METTesterPostProcessorHarvesting.cc:23
METTesterPostProcessorHarvesting::mMETDifference_GenMETTrue_MET100to150_MiniAOD_over_Reco
MonitorElement * mMETDifference_GenMETTrue_MET100to150_MiniAOD_over_Reco
Definition: METTesterPostProcessorHarvesting.h:52
METTesterPostProcessorHarvesting::inputMETLabelMiniAOD_
edm::InputTag inputMETLabelMiniAOD_
Definition: METTesterPostProcessorHarvesting.h:37
dqm::impl::MonitorElement::setBinContent
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Definition: MonitorElement.cc:691
dqm::implementation::IGetter
Definition: DQMStore.h:484
METTesterPostProcessorHarvesting::mMETDifference_GenMETTrue_MET20to40_MiniAOD_over_Reco
MonitorElement * mMETDifference_GenMETTrue_MET20to40_MiniAOD_over_Reco
Definition: METTesterPostProcessorHarvesting.h:51
dqm::impl::MonitorElement::getNbinsX
virtual int getNbinsX() const
get # of bins in X-axis
Definition: MonitorElement.cc:574
METTesterPostProcessorHarvesting::mMETDeltaPhi_GenMETTrue_MiniAOD_over_Reco
MonitorElement * mMETDeltaPhi_GenMETTrue_MiniAOD_over_Reco
Definition: METTesterPostProcessorHarvesting.h:50
METTesterPostProcessorHarvesting::mMETDifference_GenMETTrue_MiniAOD_over_Reco
MonitorElement * mMETDifference_GenMETTrue_MiniAOD_over_Reco
Definition: METTesterPostProcessorHarvesting.h:49
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm::implementation::IBooker
Definition: DQMStore.h:43
METTesterPostProcessorHarvesting.h
METTesterPostProcessorHarvesting::mPFNeutralHadronEtFraction_MiniAOD_over_Reco
MonitorElement * mPFNeutralHadronEtFraction_MiniAOD_over_Reco
Definition: METTesterPostProcessorHarvesting.h:45
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
dqm::impl::MonitorElement::getBinContent
virtual double getBinContent(int binx) const
get content of bin (1-D)
Definition: MonitorElement.cc:592
edm::InputTag
Definition: InputTag.h:15
METTesterPostProcessorHarvesting::met_dirs
std::vector< std::string > met_dirs
Definition: METTesterPostProcessorHarvesting.h:39
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98