CMS 3D CMS Logo

METAnalyzer.cc
Go to the documentation of this file.
1 
20 
25 
27 
31 #include <cmath>
32 #include "TH2F.h"
33 #include "TH2.h"
34 
35 #include <string>
36 
37 using namespace edm;
38 using namespace reco;
39 using namespace math;
40 
41 // ***********************************************************
43  parameters = pSet;
44 
45  m_l1algoname_ = pSet.getParameter<std::string>("l1algoname");
46  m_bitAlgTechTrig_ = -1;
47 
48  miniaodfilterdec = -1;
49 
50  LSBegin_ = pSet.getParameter<int>("LSBegin");
51  LSEnd_ = pSet.getParameter<int>("LSEnd");
52  // Smallest track pt
53  ptMinCand_ = pSet.getParameter<double>("ptMinCand");
54 
55  MetType_ = parameters.getUntrackedParameter<std::string>("METType");
56 
57  triggerResultsLabel_ = parameters.getParameter<edm::InputTag>("TriggerResultsLabel");
58  triggerResultsToken_ = consumes<edm::TriggerResults>(edm::InputTag(triggerResultsLabel_));
59 
60  isCaloMet_ = (std::string("calo") == MetType_);
61  //isTCMet_ = (std::string("tc") ==MetType_);
62  isPFMet_ = (std::string("pf") == MetType_);
63  isMiniAODMet_ = (std::string("miniaod") == MetType_);
64  if (!isMiniAODMet_) {
65  jetCorrectorToken_ = consumes<reco::JetCorrector>(pSet.getParameter<edm::InputTag>("JetCorrections"));
66  }
67 
68  // MET information
69  metCollectionLabel_ = parameters.getParameter<edm::InputTag>("METCollectionLabel");
70 
71  if (/*isTCMet_ || */ isCaloMet_) {
72  inputJetIDValueMap = pSet.getParameter<edm::InputTag>("InputJetIDValueMap");
73  jetID_ValueMapToken_ = consumes<edm::ValueMap<reco::JetID> >(inputJetIDValueMap);
75  }
76 
77  if (isPFMet_) {
78  pflowToken_ = consumes<std::vector<reco::PFCandidate> >(pSet.getParameter<edm::InputTag>("srcPFlow"));
80  }
81  if (isMiniAODMet_) {
82  pflowPackedToken_ = consumes<std::vector<pat::PackedCandidate> >(pSet.getParameter<edm::InputTag>("srcPFlow"));
84  }
85  MuonsToken_ = consumes<reco::MuonCollection>(pSet.getParameter<edm::InputTag>("muonsrc"));
86 
87  ptThreshold_ = parameters.getParameter<double>("ptThreshold");
88 
89  if (isPFMet_) {
90  pfMetToken_ = consumes<reco::PFMETCollection>(edm::InputTag(metCollectionLabel_));
91  }
92  if (isCaloMet_) {
93  caloMetToken_ = consumes<reco::CaloMETCollection>(edm::InputTag(metCollectionLabel_));
94  }
95  if (isMiniAODMet_) {
96  patMetToken_ = consumes<pat::METCollection>(edm::InputTag(metCollectionLabel_));
97  }
98  //if(isTCMet_){
99  // tcMetToken_= consumes<reco::METCollection>(edm::InputTag(metCollectionLabel_));
100  //}
101 
102  fill_met_high_level_histo = parameters.getParameter<bool>("fillMetHighLevel");
103  fillCandidateMap_histos = parameters.getParameter<bool>("fillCandidateMaps");
104 
105  //jet cleanup parameters
106  cleaningParameters_ = pSet.getParameter<ParameterSet>("CleaningParameters");
107 
108  diagnosticsParameters_ = pSet.getParameter<std::vector<edm::ParameterSet> >("METDiagonisticsParameters");
109 
110  edm::ConsumesCollector iC = consumesCollector();
111  //DCS
112  DCSFilter_ = new JetMETDQMDCSFilter(parameters.getParameter<ParameterSet>("DCSFilter"), iC);
113 
114  //Vertex requirements
115  bypassAllPVChecks_ = cleaningParameters_.getParameter<bool>("bypassAllPVChecks");
116  bypassAllDCSChecks_ = cleaningParameters_.getParameter<bool>("bypassAllDCSChecks");
117  runcosmics_ = parameters.getUntrackedParameter<bool>("runcosmics");
118  onlyCleaned_ = parameters.getUntrackedParameter<bool>("onlyCleaned");
119  vertexTag_ = cleaningParameters_.getParameter<edm::InputTag>("vertexCollection");
120  vertexToken_ = consumes<std::vector<reco::Vertex> >(edm::InputTag(vertexTag_));
121 
122  //Trigger parameters
123  gtTag_ = cleaningParameters_.getParameter<edm::InputTag>("gtLabel");
124  gtToken_ = consumes<L1GlobalTriggerReadoutRecord>(edm::InputTag(gtTag_));
125 
126  // Other data collections
127  jetCollectionLabel_ = parameters.getParameter<edm::InputTag>("JetCollectionLabel");
128  if (isCaloMet_)
129  caloJetsToken_ = consumes<reco::CaloJetCollection>(jetCollectionLabel_);
130  //if (isTCMet_) jptJetsToken_ = consumes<reco::JPTJetCollection>(jetCollectionLabel_);
131  if (isPFMet_)
132  pfJetsToken_ = consumes<reco::PFJetCollection>(jetCollectionLabel_);
133  if (isMiniAODMet_)
134  patJetsToken_ = consumes<pat::JetCollection>(jetCollectionLabel_);
135 
136  HBHENoiseStringMiniAOD = parameters.getParameter<std::string>("HBHENoiseLabelMiniAOD");
137  HBHEIsoNoiseStringMiniAOD = parameters.getParameter<std::string>("HBHEIsoNoiseLabelMiniAOD");
138 
139  hbheNoiseFilterResultTag_ = parameters.getParameter<edm::InputTag>("HBHENoiseFilterResultLabel");
140  hbheNoiseFilterResultToken_ = consumes<bool>(hbheNoiseFilterResultTag_);
141  hbheNoiseIsoFilterResultTag_ = parameters.getParameter<edm::InputTag>("HBHENoiseIsoFilterResultLabel");
142  hbheIsoNoiseFilterResultToken_ = consumes<bool>(hbheNoiseIsoFilterResultTag_);
143  CSCHaloResultTag_ = parameters.getParameter<edm::InputTag>("CSCHaloResultLabel");
144  CSCHaloResultToken_ = consumes<bool>(CSCHaloResultTag_);
145  CSCHalo2015ResultTag_ = parameters.getParameter<edm::InputTag>("CSCHalo2015ResultLabel");
146  CSCHalo2015ResultToken_ = consumes<bool>(CSCHalo2015ResultTag_);
147  EcalDeadCellTriggerTag_ = parameters.getParameter<edm::InputTag>("EcalDeadCellTriggerPrimitiveFilterLabel");
148  EcalDeadCellTriggerToken_ = consumes<bool>(EcalDeadCellTriggerTag_);
149  EcalDeadCellBoundaryTag_ = parameters.getParameter<edm::InputTag>("EcalDeadCellBoundaryEnergyFilterLabel");
150  EcalDeadCellBoundaryToken_ = consumes<bool>(EcalDeadCellBoundaryTag_);
151  eeBadScFilterTag_ = parameters.getParameter<edm::InputTag>("eeBadScFilterLabel");
152  eeBadScFilterToken_ = consumes<bool>(eeBadScFilterTag_);
153  HcalStripHaloTag_ = parameters.getParameter<edm::InputTag>("HcalStripHaloFilterLabel");
154  HcalStripHaloToken_ = consumes<bool>(HcalStripHaloTag_);
155 
156  if (isMiniAODMet_) {
157  METFilterMiniAODLabel_ = parameters.getParameter<edm::InputTag>("FilterResultsLabelMiniAOD");
158  METFilterMiniAODToken_ = consumes<edm::TriggerResults>(METFilterMiniAODLabel_);
159 
160  METFilterMiniAODLabel2_ = parameters.getParameter<edm::InputTag>("FilterResultsLabelMiniAOD2");
161  METFilterMiniAODToken2_ = consumes<edm::TriggerResults>(METFilterMiniAODLabel2_);
162  }
163 
164  //
165  nbinsPV_ = parameters.getParameter<int>("pVBin");
166  nPVMin_ = parameters.getParameter<double>("pVMin");
167  nPVMax_ = parameters.getParameter<double>("pVMax");
168 
169  triggerSelectedSubFolders_ = parameters.getParameter<edm::VParameterSet>("triggerSelectedSubFolders");
170  for (edm::VParameterSet::const_iterator it = triggerSelectedSubFolders_.begin();
171  it != triggerSelectedSubFolders_.end();
172  it++) {
173  triggerFolderEventFlag_.push_back(new GenericTriggerEventFlag(*it, consumesCollector(), *this));
174  triggerFolderExpr_.push_back(it->getParameter<std::vector<std::string> >("hltPaths"));
175  triggerFolderLabels_.push_back(it->getParameter<std::string>("label"));
176  }
177 
178  cleaningParameters_ = parameters.getParameter<ParameterSet>("CleaningParameters");
179 
180  verbose_ = parameters.getParameter<int>("verbose");
181 
182  FolderName_ = parameters.getUntrackedParameter<std::string>("FolderName");
183 
184  l1gtTrigMenuToken_ = esConsumes<edm::Transition::BeginRun>();
185 }
186 
187 // ***********************************************************
189  for (std::vector<GenericTriggerEventFlag*>::const_iterator it = triggerFolderEventFlag_.begin();
190  it != triggerFolderEventFlag_.end();
191  it++) {
192  delete *it;
193  }
194  delete DCSFilter_;
195 }
196 
198  std::string DirName = FolderName_ + metCollectionLabel_.label();
199  ibooker.setCurrentFolder(DirName);
200  // since this module does things in dqmEndRun, we need to make sure to have
201  // per-run histograms.
202  ibooker.setScope(MonitorElementData::Scope::RUN);
203 
204  if (!folderNames_.empty()) {
205  folderNames_.clear();
206  }
207  if (runcosmics_) {
208  folderNames_.push_back("Uncleaned");
209  } else {
210  if (!onlyCleaned_) {
211  folderNames_.push_back("Uncleaned");
212  }
213  folderNames_.push_back("Cleaned");
214  folderNames_.push_back("DiJet");
215  if (!isMiniAODMet_) {
216  folderNames_.push_back("ZJets");
217  }
218  }
219  for (std::vector<std::string>::const_iterator ic = folderNames_.begin(); ic != folderNames_.end(); ic++) {
220  bookMESet(DirName + "/" + *ic, ibooker, map_dijet_MEs);
221  }
222 }
223 
224 // ***********************************************************
226  DQMStore::IBooker& ibooker,
227  std::map<std::string, MonitorElement*>& map_of_MEs) {
228  bool bLumiSecPlot = fill_met_high_level_histo;
229  //bool inTriggerPathPlots=false;
230  bool fillPFCandidatePlots = false;
231  bool fillZPlots = false;
232 
233  if (DirName.find("Cleaned") != std::string::npos) {
234  fillPFCandidatePlots = true;
235  bookMonitorElement(DirName, ibooker, map_of_MEs, bLumiSecPlot, fillPFCandidatePlots, fillZPlots);
236  //for (unsigned int i = 0; i<triggerFolderEventFlag_.size(); i++) {
237  //fillPFCandidatePlots=false;
238  //if (triggerFolderEventFlag_[i]->on()) {
239  //bookMonitorElement(DirName+"/"+triggerFolderLabels_[i],ibooker,map_of_MEs,bLumiSecPlot,fillPFCandidatePlots,fillZPlots);
240  //}
241  //}
242  } else if (DirName.find("ZJets") != std::string::npos) {
243  fillPFCandidatePlots = false;
244  fillZPlots = true;
245  bookMonitorElement(DirName, ibooker, map_of_MEs, bLumiSecPlot, fillPFCandidatePlots, fillZPlots);
246  } else {
247  bookMonitorElement(DirName, ibooker, map_of_MEs, bLumiSecPlot, fillPFCandidatePlots, fillZPlots);
248  }
249 }
250 
251 // ***********************************************************
253  DQMStore::IBooker& ibooker,
254  std::map<std::string, MonitorElement*>& map_of_MEs,
255  bool bLumiSecPlot = false,
256  bool fillPFCandPlots = false,
257  bool fillZPlots = false) {
258  if (verbose_)
259  std::cout << "bookMonitorElement " << DirName << std::endl;
260 
261  ibooker.setCurrentFolder(DirName);
262  if (fillZPlots) {
263  if (isCaloMet_) {
264  meZJets_u_par = ibooker.book1D("u_parallel_Z_inc", "u_parallel_Z_inc", 50, -1000., 75);
265  } else {
266  meZJets_u_par = ibooker.book1D("u_parallel_Z_inc", "u_parallel_Z_inc", 50, -800., 75);
267  }
268  meZJets_u_par_ZPt_0_15 = ibooker.book1D("u_parallel_ZPt_0_15", "u_parallel_ZPt_0_15", 50, -100, 75);
269  meZJets_u_par_ZPt_15_30 = ibooker.book1D("u_parallel_ZPt_15_30", "u_parallel_ZPt_15_30", 50, -100, 50);
270  meZJets_u_par_ZPt_30_55 = ibooker.book1D("u_parallel_ZPt_30_55", "u_parallel_ZPt_30_55", 50, -175, 50);
271  meZJets_u_par_ZPt_55_75 = ibooker.book1D("u_parallel_ZPt_55_75", "u_parallel_ZPt_55_75", 50, -175, 0);
272  meZJets_u_par_ZPt_75_150 = ibooker.book1D("u_parallel_ZPt_75_150", "u_parallel_ZPt_75_150", 50, -300, 0);
273  if (isCaloMet_) {
274  meZJets_u_par_ZPt_150_290 = ibooker.book1D("u_parallel_ZPt_150_290", "u_parallel_ZPt_150_290", 50, -750, -100);
275  } else {
276  meZJets_u_par_ZPt_150_290 = ibooker.book1D("u_parallel_ZPt_150_290", "u_parallel_ZPt_150_290", 50, -450, -50);
277  }
278  if (isCaloMet_) {
279  meZJets_u_par_ZPt_290 = ibooker.book1D("u_parallel_ZPt_290", "u_parallel_ZPt_290", 50, -1000., -350.);
280  } else {
281  meZJets_u_par_ZPt_290 = ibooker.book1D("u_parallel_ZPt_290", "u_parallel_ZPt_290", 50, -750., -150.);
282  }
283  meZJets_u_perp = ibooker.book1D("u_perp_Z_inc", "u_perp_Z_inc", 50, -85., 85.);
284  meZJets_u_perp_ZPt_0_15 = ibooker.book1D("u_perp_ZPt_0_15", "u_perp_ZPt_0_15", 50, -85., 85.);
285  meZJets_u_perp_ZPt_15_30 = ibooker.book1D("u_perp_ZPt_15_30", "u_perp_ZPt_15_30", 50, -85., 85.);
286  meZJets_u_perp_ZPt_30_55 = ibooker.book1D("u_perp_ZPt_30_55", "u_perp_ZPt_30_55", 50, -85., 85.);
287  meZJets_u_perp_ZPt_55_75 = ibooker.book1D("u_perp_ZPt_55_75", "u_perp_ZPt_55_75", 50, -85., 85.);
288  meZJets_u_perp_ZPt_75_150 = ibooker.book1D("u_perp_ZPt_75_150", "u_perp_ZPt_75_150", 50, -85., 85.);
289  meZJets_u_perp_ZPt_150_290 = ibooker.book1D("u_perp_ZPt_150_290", "u_perp_ZPt_150_290", 50, -85., 85.);
290  meZJets_u_perp_ZPt_290 = ibooker.book1D("u_perp_ZPt_290", "u_perp_ZPt_290", 50, -85., 85.);
291 
292  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_Z_inc", meZJets_u_par));
293  map_of_MEs.insert(
294  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_0_15", meZJets_u_par_ZPt_0_15));
295  map_of_MEs.insert(
296  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_15_30", meZJets_u_par_ZPt_15_30));
297  map_of_MEs.insert(
298  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_30_55", meZJets_u_par_ZPt_30_55));
299  map_of_MEs.insert(
300  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_55_75", meZJets_u_par_ZPt_55_75));
301  map_of_MEs.insert(
302  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_75_150", meZJets_u_par_ZPt_75_150));
303  map_of_MEs.insert(
304  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_150_290", meZJets_u_par_ZPt_150_290));
305  map_of_MEs.insert(
306  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_290", meZJets_u_par_ZPt_290));
307 
308  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_Z_inc", meZJets_u_perp));
309  map_of_MEs.insert(
310  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_0_15", meZJets_u_perp_ZPt_0_15));
311  map_of_MEs.insert(
312  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_15_30", meZJets_u_perp_ZPt_15_30));
313  map_of_MEs.insert(
314  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_30_55", meZJets_u_perp_ZPt_30_55));
315  map_of_MEs.insert(
316  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_55_75", meZJets_u_perp_ZPt_55_75));
317  map_of_MEs.insert(
318  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_75_150", meZJets_u_perp_ZPt_75_150));
319  map_of_MEs.insert(
320  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_150_290", meZJets_u_perp_ZPt_150_290));
321  map_of_MEs.insert(
322  std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_290", meZJets_u_perp_ZPt_290));
323  }
324 
325  if (!fillZPlots) {
326  hMEx = ibooker.book1D("MEx", "MEx", 200, -500, 500);
327  hMEy = ibooker.book1D("MEy", "MEy", 200, -500, 500);
328  hMET = ibooker.book1D("MET", "MET", 200, 0, 1000);
329 
330  {
331  auto scope = DQMStore::IBooker::UseLumiScope(ibooker);
332  hMET_2 = ibooker.book1D("MET_2", "MET Range 2", 200, 0, 2000);
333  hSumET = ibooker.book1D("SumET", "SumET", 400, 0, 4000);
334  hMETSig = ibooker.book1D("METSig", "METSig", 51, 0, 51);
335  hMETPhi = ibooker.book1D("METPhi", "METPhi", 60, -M_PI, M_PI);
336  }
337 
338  hMET_logx = ibooker.book1D("MET_logx", "MET_logx", 40, -1, 9);
339  hSumET_logx = ibooker.book1D("SumET_logx", "SumET_logx", 40, -1, 9);
340 
341  hMEx->setAxisTitle("MEx [GeV]", 1);
342  hMEy->setAxisTitle("MEy [GeV]", 1);
343  hMET->setAxisTitle("MET [GeV]", 1);
344  hMET_2->setAxisTitle("MET [GeV]", 1);
345  hSumET->setAxisTitle("SumET [GeV]", 1);
346  hMETSig->setAxisTitle("METSig", 1);
347  hMETPhi->setAxisTitle("METPhi [rad]", 1);
348  hMET_logx->setAxisTitle("log(MET) [GeV]", 1);
349  hSumET_logx->setAxisTitle("log(SumET) [GeV]", 1);
350 
351  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MEx", hMEx));
352  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MEy", hMEy));
353  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET", hMET));
354  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_2", hMET_2));
355  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "SumET", hSumET));
356  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METSig", hMETSig));
357  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhi", hMETPhi));
358  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_logx", hMET_logx));
359  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "SumET_logx", hSumET_logx));
360 
361  hMET_HBHENoiseFilter = ibooker.book1D("MET_HBHENoiseFilter", "MET_HBHENoiseFiltered", 200, 0, 1000);
362  hMET_CSCTightHaloFilter = ibooker.book1D("MET_CSCTightHaloFilter", "MET_CSCTightHaloFiltered", 200, 0, 1000);
363  hMET_eeBadScFilter = ibooker.book1D("MET_eeBadScFilter", "MET_eeBadScFiltered", 200, 0, 1000);
364  hMET_HBHEIsoNoiseFilter = ibooker.book1D("MET_HBHEIsoNoiseFilter", "MET_HBHEIsoNoiseFiltered", 200, 0, 1000);
365  hMET_CSCTightHalo2015Filter =
366  ibooker.book1D("MET_CSCTightHalo2015Filter", "MET_CSCTightHalo2015Filtered", 200, 0, 1000);
367  hMET_EcalDeadCellTriggerFilter =
368  ibooker.book1D("MET_EcalDeadCellTriggerFilter", "MET_EcalDeadCellTriggerFiltered", 200, 0, 1000);
369  hMET_EcalDeadCellBoundaryFilter =
370  ibooker.book1D("MET_EcalDeadCellBoundaryFilter", "MET_EcalDeadCellBoundaryFiltered", 200, 0, 1000);
371  hMET_HcalStripHaloFilter = ibooker.book1D("MET_HcalStripHaloFilter", "MET_HcalStripHaloFiltered", 200, 0, 1000);
372 
373  map_of_MEs.insert(
374  std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_HBHENoiseFilter", hMET_HBHENoiseFilter));
375  map_of_MEs.insert(
376  std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_CSCTightHaloFilter", hMET_CSCTightHaloFilter));
377  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_eeBadScFilter", hMET_eeBadScFilter));
378  map_of_MEs.insert(
379  std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_HBHEIsoNoiseFilter", hMET_HBHEIsoNoiseFilter));
380  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_CSCTightHalo2015Filter",
381  hMET_CSCTightHalo2015Filter));
382  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_EcalDeadCellTriggerFilter",
383  hMET_EcalDeadCellTriggerFilter));
384  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_EcalDeadCellBoundaryFilter",
385  hMET_EcalDeadCellBoundaryFilter));
386  map_of_MEs.insert(
387  std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_HcalStripHaloFilter", hMET_HcalStripHaloFilter));
388 
389  // Book NPV profiles --> would some of these profiles be interesting for other MET types too
390  //----------------------------------------------------------------------------
391  meMEx_profile = ibooker.bookProfile("MEx_profile", "met.px()", nbinsPV_, nPVMin_, nPVMax_, 200, -500, 500);
392  meMEy_profile = ibooker.bookProfile("MEy_profile", "met.py()", nbinsPV_, nPVMin_, nPVMax_, 200, -500, 500);
393  meMET_profile = ibooker.bookProfile("MET_profile", "met.pt()", nbinsPV_, nPVMin_, nPVMax_, 200, 0, 1000);
394  meSumET_profile = ibooker.bookProfile("SumET_profile", "met.sumEt()", nbinsPV_, nPVMin_, nPVMax_, 400, 0, 4000);
395  // Set NPV profiles x-axis title
396  //----------------------------------------------------------------------------
397  meMEx_profile->setAxisTitle("nvtx", 1);
398  meMEy_profile->setAxisTitle("nvtx", 1);
399  meMET_profile->setAxisTitle("nvtx", 1);
400  meSumET_profile->setAxisTitle("nvtx", 1);
401 
402  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MEx_profile", meMEx_profile));
403  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MEy_profile", meMEy_profile));
404  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_profile", meMET_profile));
405  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "SumET_profile", meSumET_profile));
406 
407  if (isCaloMet_) {
408  hCaloHadEtInHB = ibooker.book1D("CaloHadEtInHB", "CaloHadEtInHB", 50, 0, 2000);
409  hCaloHadEtInHB->setAxisTitle("Had Et [GeV]", 1);
410  hCaloHadEtInHO = ibooker.book1D("CaloHadEtInHO", "CaloHadEtInHO", 25, 0, 500);
411  hCaloHadEtInHO->setAxisTitle("Had Et [GeV]", 1);
412  hCaloHadEtInHE = ibooker.book1D("CaloHadEtInHE", "CaloHadEtInHE", 50, 0, 2000);
413  hCaloHadEtInHE->setAxisTitle("Had Et [GeV]", 1);
414  hCaloHadEtInHF = ibooker.book1D("CaloHadEtInHF", "CaloHadEtInHF", 50, 0, 1000);
415  hCaloHadEtInHF->setAxisTitle("Had Et [GeV]", 1);
416  hCaloEmEtInHF = ibooker.book1D("CaloEmEtInHF", "CaloEmEtInHF", 25, 0, 500);
417  hCaloEmEtInHF->setAxisTitle("EM Et [GeV]", 1);
418  hCaloEmEtInEE = ibooker.book1D("CaloEmEtInEE", "CaloEmEtInEE", 50, 0, 1000);
419  hCaloEmEtInEE->setAxisTitle("EM Et [GeV]", 1);
420  hCaloEmEtInEB = ibooker.book1D("CaloEmEtInEB", "CaloEmEtInEB", 50, 0, 2000);
421  hCaloEmEtInEB->setAxisTitle("EM Et [GeV]", 1);
422 
423  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloHadEtInHO", hCaloHadEtInHO));
424  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloHadEtInHF", hCaloHadEtInHF));
425  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloHadEtInHE", hCaloHadEtInHE));
426  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloHadEtInHB", hCaloHadEtInHB));
427  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloEmEtInHF", hCaloEmEtInHF));
428  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloEmEtInEE", hCaloEmEtInEE));
429  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloEmEtInEB", hCaloEmEtInEB));
430 
431  hCaloMETPhi020 = ibooker.book1D("CaloMETPhi020", "CaloMETPhi020", 60, -M_PI, M_PI);
432  hCaloMETPhi020->setAxisTitle("METPhi [rad] (MET>20 GeV)", 1);
433 
434  hCaloEtFractionHadronic = ibooker.book1D("CaloEtFractionHadronic", "CaloEtFractionHadronic", 50, 0, 1);
435  hCaloEtFractionHadronic->setAxisTitle("Hadronic Et Fraction", 1);
436  hCaloEmEtFraction = ibooker.book1D("CaloEmEtFraction", "CaloEmEtFraction", 50, 0, 1);
437  hCaloEmEtFraction->setAxisTitle("EM Et Fraction", 1);
438 
439  hCaloEmEtFraction020 = ibooker.book1D("CaloEmEtFraction020", "CaloEmEtFraction020", 50, 0, 1);
440  hCaloEmEtFraction020->setAxisTitle("EM Et Fraction (MET>20 GeV)", 1);
441 
442  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloMETPhi020", hCaloMETPhi020));
443  map_of_MEs.insert(
444  std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloEtFractionHadronic", hCaloEtFractionHadronic));
445  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloEmEtFraction", hCaloEmEtFraction));
446  map_of_MEs.insert(
447  std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloEmEtFraction020", hCaloEmEtFraction020));
448  }
449 
450  if (isPFMet_) {
451  if (fillPFCandPlots &&
452  fillCandidateMap_histos) { //first bool internal checks for subdirectory filling, second bool given in cfg file, checks that we fill maps only in one module in total
453 
454  meCHF_Barrel = ibooker.book1D("PfChargedHadronEtFractionBarrel", "chargedHadronEtFractionBarrel", 50, 0, 1);
455  meCHF_EndcapPlus =
456  ibooker.book1D("PfChargedHadronEtFractionEndcapPlus", "chargedHadronEtFractionEndcapPlus", 50, 0, 1);
457  meCHF_EndcapMinus =
458  ibooker.book1D("PfChargedHadronEtFractionEndcapMinus", "chargedHadronEtFractionEndcapMinus", 50, 0, 1);
459  meCHF_Barrel_BXm1Empty = ibooker.book1D(
460  "PfChargedHadronEtFractionBarrel_BXm1Empty", "chargedHadronEtFractionBarrel prev empty bunch", 50, 0, 1);
461  meCHF_EndcapPlus_BXm1Empty = ibooker.book1D("PfChargedHadronEtFractionEndcapPlus_BXm1Empty",
462  "chargedHadronEtFractionEndcapPlus prev empty bunch",
463  50,
464  0,
465  1);
466  meCHF_EndcapMinus_BXm1Empty = ibooker.book1D("PfChargedHadronEtFractionEndcapMinus_BXm1Empty",
467  "chargedHadronEtFractionEndcapMinus prev empty bunch",
468  50,
469  0,
470  1);
471  meCHF_Barrel_BXm1Filled = ibooker.book1D("PfChargedHadronEtFractionBarrel_BXm1Filled",
472  "chargedHadronEtFractionBarrel prev filled 2 bunches",
473  50,
474  0,
475  1);
476  meCHF_EndcapPlus_BXm1Filled = ibooker.book1D("PfChargedHadronEtFractionEndcapPlus_BXm1Filled",
477  "chargedHadronEtFractionEndcapPlus prev filled bunch",
478  50,
479  0,
480  1);
481  meCHF_EndcapMinus_BXm1Filled = ibooker.book1D("PfChargedHadronEtFractionEndcapMinus_BXm1Filled",
482  "chargedHadronEtFractionEndcapMinus prev filled bunch",
483  50,
484  0,
485  1);
486 
487  map_of_MEs.insert(
488  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEtFractionBarrel", meCHF_Barrel));
489  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEtFractionEndcapPlus",
490  meCHF_EndcapPlus));
491  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
492  DirName + "/" + "PfChargedHadronEtFractionEndcapMinus", meCHF_EndcapMinus));
493  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
494  DirName + "/" + "PfChargedHadronEtFractionBarrel_BXm1Empty", meCHF_Barrel_BXm1Empty));
495  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
496  DirName + "/" + "PfChargedHadronEtFractionEndcapPlus_BXm1Empty", meCHF_EndcapPlus_BXm1Empty));
497  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
498  DirName + "/" + "PfChargedHadronEtFractionEndcapMinus_BXm1Empty", meCHF_EndcapMinus_BXm1Empty));
499  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm2BXm1Empty", meCHF_Barrel_BXm2BXm1Empty));
500  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm2BXm1Empty", meCHF_EndcapPlus_BXm2BXm1Empty));
501  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm2BXm1Empty", meCHF_EndcapMinus_BXm2BXm1Empty));
502  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
503  DirName + "/" + "PfChargedHadronEtFractionBarrel_BXm1Filled", meCHF_Barrel_BXm1Filled));
504  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
505  DirName + "/" + "PfChargedHadronEtFractionEndcapPlus_BXm1Filled", meCHF_EndcapPlus_BXm1Filled));
506  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
507  DirName + "/" + "PfChargedHadronEtFractionEndcapMinus_BXm1Filled", meCHF_EndcapMinus_BXm1Filled));
508  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm2BXm1Filled", meCHF_Barrel_BXm2BXm1Filled));
509  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm2BXm1Filled", meCHF_EndcapPlus_BXm2BXm1Filled));
510  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm2BXm1Filled", meCHF_EndcapMinus_BXm2BXm1Filled));
511 
512  meNHF_Barrel = ibooker.book1D("PfNeutralHadronEtFractionBarrel", "neutralHadronEtFractionBarrel", 50, 0, 1);
513  meNHF_EndcapPlus =
514  ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus", "neutralHadronEtFractionEndcapPlus", 50, 0, 1);
515  meNHF_EndcapMinus =
516  ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus", "neutralHadronEtFractionEndcapMinus", 50, 0, 1);
517  meNHF_Barrel_BXm1Empty = ibooker.book1D(
518  "PfNeutralHadronEtFractionBarrel_BXm1Empty", "neutralHadronEtFractionBarrel prev empty bunch", 50, 0, 1);
519  meNHF_EndcapPlus_BXm1Empty = ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus_BXm1Empty",
520  "neutralHadronEtFractionEndcapPlus prev empty bunch",
521  50,
522  0,
523  1);
524  meNHF_EndcapMinus_BXm1Empty = ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus_BXm1Empty",
525  "neutralHadronEtFractionEndcapMinus prev empty bunch",
526  50,
527  0,
528  1);
529  //meNHF_Barrel_BXm2BXm1Empty = ibooker.book1D("PfNeutralHadronEtFractionBarrel_BXm2BXm1Empty", "neutralHadronEtFractionBarrel prev empty 2 bunches", 50, 0, 1);
530  //meNHF_EndcapPlus_BXm2BXm1Empty = ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Empty", "neutralHadronEtFractionEndcapPlus prev empty 2 bunches", 50, 0, 1);
531  //meNHF_EndcapMinus_BXm2BXm1Empty = ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Empty", "neutralHadronEtFractionEndcapMinus prev empty 2 bunches", 50, 0, 1);
532  meNHF_Barrel_BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionBarrel_BXm1Filled",
533  "neutralHadronEtFractionBarrel prev filled 2 bunches",
534  50,
535  0,
536  1);
537  meNHF_EndcapPlus_BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus_BXm1Filled",
538  "neutralHadronEtFractionEndcapPlus prev filled bunch",
539  50,
540  0,
541  1);
542  meNHF_EndcapMinus_BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus_BXm1Filled",
543  "neutralHadronEtFractionEndcapMinus prev filled bunch",
544  50,
545  0,
546  1);
547  //meNHF_Barrel_BXm2BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionBarrel_BXm2BXm1Filled", "neutralHadronEtFractionBarrel prev filled 2 bunches", 50, 0, 1);
548  //meNHF_EndcapPlus_BXm2BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Filled", "neutralHadronEtFractionEndcapPlus prev filled 2 bunches", 50, 0, 1);
549  //meNHF_EndcapMinus_BXm2BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Filled", "neutralHadronEtFractionEndcapMinus prev filled 2 bunches", 50, 0, 1);
550 
551  map_of_MEs.insert(
552  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEtFractionBarrel", meNHF_Barrel));
553  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEtFractionEndcapPlus",
554  meNHF_EndcapPlus));
555  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
556  DirName + "/" + "PfNeutralHadronEtFractionEndcapMinus", meNHF_EndcapMinus));
557  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
558  DirName + "/" + "PfNeutralHadronEtFractionBarrel_BXm1Empty", meNHF_Barrel_BXm1Empty));
559  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
560  DirName + "/" + "PfNeutralHadronEtFractionEndcapPlus_BXm1Empty", meNHF_EndcapPlus_BXm1Empty));
561  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
562  DirName + "/" + "PfNeutralHadronEtFractionEndcapMinus_BXm1Empty", meNHF_EndcapMinus_BXm1Empty));
563  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm2BXm1Empty", meNHF_Barrel_BXm2BXm1Empty));
564  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Empty", meNHF_EndcapPlus_BXm2BXm1Empty));
565  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Empty", meNHF_EndcapMinus_BXm2BXm1Empty));
566  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
567  DirName + "/" + "PfNeutralHadronEtFractionBarrel_BXm1Filled", meNHF_Barrel_BXm1Filled));
568  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
569  DirName + "/" + "PfNeutralHadronEtFractionEndcapPlus_BXm1Filled", meNHF_EndcapPlus_BXm1Filled));
570  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
571  DirName + "/" + "PfNeutralHadronEtFractionEndcapMinus_BXm1Filled", meNHF_EndcapMinus_BXm1Filled));
572  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm2BXm1Filled", meNHF_Barrel_BXm2BXm1Filled));
573  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Filled", meNHF_EndcapPlus_BXm2BXm1Filled));
574  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Filled", meNHF_EndcapMinus_BXm2BXm1Filled));
575 
576  mePhF_Barrel = ibooker.book1D("PfPhotonEtFractionBarrel", "photonEtFractionBarrel", 50, 0, 1);
577  mePhF_EndcapPlus = ibooker.book1D("PfPhotonEtFractionEndcapPlus", "photonEtFractionEndcapPlus", 50, 0, 1);
578  mePhF_EndcapMinus = ibooker.book1D("PfPhotonEtFractionEndcapMinus", "photonEtFractionEndcapMinus", 50, 0, 1);
579  mePhF_Barrel_BXm1Empty =
580  ibooker.book1D("PfPhotonEtFractionBarrel_BXm1Empty", "photonEtFractionBarrel prev empty bunch", 50, 0, 1);
581  mePhF_EndcapPlus_BXm1Empty = ibooker.book1D(
582  "PfPhotonEtFractionEndcapPlus_BXm1Empty", "photonEtFractionEndcapPlus prev empty bunch", 50, 0, 1);
583  mePhF_EndcapMinus_BXm1Empty = ibooker.book1D(
584  "PfPhotonEtFractionEndcapMinus_BXm1Empty", "photonEtFractionEndcapMinus prev empty bunch", 50, 0, 1);
585  //mePhF_Barrel_BXm2BXm1Empty = ibooker.book1D("PfPhotonEtFractionBarrel_BXm2BXm1Empty", "photonEtFractionBarrel prev empty 2 bunches", 50, 0, 1);
586  //mePhF_EndcapPlus_BXm2BXm1Empty = ibooker.book1D("PfPhotonEtFractionEndcapPlus_BXm2BXm1Empty", "photonEtFractionEndcapPlus prev empty 2 bunches", 50, 0, 1);
587  //mePhF_EndcapMinus_BXm2BXm1Empty = ibooker.book1D("PfPhotonEtFractionEndcapMinus_BXm2BXm1Empty", "photonEtFractionEndcapMinus prev empty 2 bunches", 50, 0, 1);
588  mePhF_Barrel_BXm1Filled = ibooker.book1D(
589  "PfPhotonEtFractionBarrel_BXm1Filled", "photonEtFractionBarrel prev filled 2 bunches", 50, 0, 1);
590  mePhF_EndcapPlus_BXm1Filled = ibooker.book1D(
591  "PfPhotonEtFractionEndcapPlus_BXm1Filled", "photonEtFractionEndcapPlus prev filled bunch", 50, 0, 1);
592  mePhF_EndcapMinus_BXm1Filled = ibooker.book1D(
593  "PfPhotonEtFractionEndcapMinus_BXm1Filled", "photonEtFractionEndcapMinus prev filled bunch", 50, 0, 1);
594  //mePhF_Barrel_BXm2BXm1Filled = ibooker.book1D("PfPhotonEtFractionBarrel_BXm2BXm1Filled", "photonEtFractionBarrel prev filled 2 bunches", 50, 0, 1);
595  //mePhF_EndcapPlus_BXm2BXm1Filled = ibooker.book1D("PfPhotonEtFractionEndcapPlus_BXm2BXm1Filled", "photonEtFractionEndcapPlus prev filled 2 bunches", 50, 0, 1);
596  //mePhF_EndcapMinus_BXm2BXm1Filled = ibooker.book1D("PfPhotonEtFractionEndcapMinus_BXm2BXm1Filled", "photonEtFractionEndcapMinus prev filled 2 bunches", 50, 0, 1);
597 
598  map_of_MEs.insert(
599  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFractionBarrel", mePhF_Barrel));
600  map_of_MEs.insert(
601  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFractionEndcapPlus", mePhF_EndcapPlus));
602  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFractionEndcapMinus",
603  mePhF_EndcapMinus));
604  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFractionBarrel_BXm1Empty",
605  mePhF_Barrel_BXm1Empty));
606  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
607  DirName + "/" + "PfPhotonEtFractionEndcapPlus_BXm1Empty", mePhF_EndcapPlus_BXm1Empty));
608  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
609  DirName + "/" + "PfPhotonEtFractionEndcapMinus_BXm1Empty", mePhF_EndcapMinus_BXm1Empty));
610  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionBarrel_BXm2BXm1Empty", mePhF_Barrel_BXm2BXm1Empty));
611  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm2BXm1Empty", mePhF_EndcapPlus_BXm2BXm1Empty));
612  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm2BXm1Empty", mePhF_EndcapMinus_BXm2BXm1Empty));
613  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFractionBarrel_BXm1Filled",
614  mePhF_Barrel_BXm1Filled));
615  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
616  DirName + "/" + "PfPhotonEtFractionEndcapPlus_BXm1Filled", mePhF_EndcapPlus_BXm1Filled));
617  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
618  DirName + "/" + "PfPhotonEtFractionEndcapMinus_BXm1Filled", mePhF_EndcapMinus_BXm1Filled));
619  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionBarrel_BXm2BXm1Filled", mePhF_Barrel_BXm2BXm1Filled));
620  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm2BXm1Filled", mePhF_EndcapPlus_BXm2BXm1Filled));
621  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm2BXm1Filled", mePhF_EndcapMinus_BXm2BXm1Filled));
622 
623  meHFHadF_Plus = ibooker.book1D("PfHFHadronEtFractionPlus", "HFHadronEtFractionPlus", 50, 0, 1);
624  meHFHadF_Minus = ibooker.book1D("PfHFHadronEtFractionMinus", "HFHadronEtFractionMinus", 50, 0, 1);
625  meHFHadF_Plus_BXm1Empty =
626  ibooker.book1D("PfHFHadronEtFractionPlus_BXm1Empty", "HFHadronEtFractionPlus prev empty bunch", 50, 0, 1);
627  meHFHadF_Minus_BXm1Empty =
628  ibooker.book1D("PfHFHadronEtFractionMinus_BXm1Empty", "HFHadronEtFractionMinus prev empty bunch", 50, 0, 1);
629  //meHFHadF_Plus_BXm2BXm1Empty = ibooker.book1D("PfHFHadronEtFractionPlus_BXm2BXm1Empty", "HFHadronEtFractionPlus prev empty 2 bunches", 50, 0, 1);
630  //meHFHadF_Minus_BXm2BXm1Empty = ibooker.book1D("PfHFHadronEtFractionMinus_BXm2BXm1Empty", "HFHadronEtFractionMinus prev empty 2 bunches", 50, 0, 1);
631  meHFHadF_Plus_BXm1Filled =
632  ibooker.book1D("PfHFHadronEtFractionPlus_BXm1Filled", "HFHadronEtFractionPlus prev filled bunch", 50, 0, 1);
633  meHFHadF_Minus_BXm1Filled = ibooker.book1D(
634  "PfHFHadronEtFractionMinus_BXm1Filled", "HFHadronEtFractionMinus prev filled bunch", 50, 0, 1);
635  //meHFHadF_Plus_BXm2BXm1Filled = ibooker.book1D("PfHFHadronEtFractionPlus_BXm2BXm1Filled", "HFHadronEtFractionPlus prev filled 2 bunches", 50, 0, 1);
636  //meHFHadF_Minus_BXm2BXm1Filled = ibooker.book1D("PfHFHadronEtFractionMinus_BXm2BXm1Filled", "HFHadronEtFractionMinus prev filled 2 bunches", 50, 0, 1);
637 
638  map_of_MEs.insert(
639  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFractionPlus", meHFHadF_Plus));
640  map_of_MEs.insert(
641  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFractionMinus", meHFHadF_Minus));
642  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFractionPlus_BXm1Empty",
643  meHFHadF_Plus_BXm1Empty));
644  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFractionMinus_BXm1Empty",
645  meHFHadF_Minus_BXm1Empty));
646  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionPlus_BXm2BXm1Empty", meHFHadF_Plus_BXm2BXm1Empty));
647  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionMinus_BXm2BXm1Empty", meHFHadF_Minus_BXm2BXm1Empty));
648  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFractionPlus_BXm1Filled",
649  meHFHadF_Plus_BXm1Filled));
650  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
651  DirName + "/" + "PfHFHadronEtFractionMinus_BXm1Filled", meHFHadF_Minus_BXm1Filled));
652  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionPlus_BXm2BXm1Filled", meHFHadF_Plus_BXm2BXm1Filled));
653  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionMinus_BXm2BXm1Filled", meHFHadF_Minus_BXm2BXm1Filled));
654 
655  meHFEMF_Plus = ibooker.book1D("PfHFEMEtFractionPlus", "HFEMEtFractionPlus", 50, 0, 1);
656  meHFEMF_Minus = ibooker.book1D("PfHFEMEtFractionMinus", "HFEMEtFractionMinus", 50, 0, 1);
657  meHFEMF_Plus_BXm1Empty =
658  ibooker.book1D("PfHFEMEtFractionPlus_BXm1Empty", "HFEMEtFractionPlus prev empty bunch", 50, 0, 1);
659  meHFEMF_Minus_BXm1Empty =
660  ibooker.book1D("PfHFEMEtFractionMinus_BXm1Empty", "HFEMEtFractionMinus prev empty bunch", 50, 0, 1);
661  //meHFEMF_Plus_BXm2BXm1Empty = ibooker.book1D("PfHFEMEtFractionPlus_BXm2BXm1Empty", "HFEMEtFractionPlus prev empty 2 bunches", 50, 0, 1);
662  //meHFEMF_Minus_BXm2BXm1Empty = ibooker.book1D("PfHFEMEtFractionMinus_BXm2BXm1Empty", "HFEMEtFractionMinus prev empty 2 bunches", 50, 0, 1);
663  meHFEMF_Plus_BXm1Filled =
664  ibooker.book1D("PfHFEMEtFractionPlus_BXm1Filled", "HFEMEtFractionPlus prev filled bunch", 50, 0, 1);
665  meHFEMF_Minus_BXm1Filled =
666  ibooker.book1D("PfHFEMEtFractionMinus_BXm1Filled", "HFEMEtFractionMinus prev filled bunch", 50, 0, 1);
667  //meHFEMF_Plus_BXm2BXm1Filled = ibooker.book1D("PfHFEMEtFractionPlus_BXm2BXm1Filled", "HFEMEtFractionPlus prev filled 2 bunches", 50, 0, 1);
668  //meHFEMF_Minus_BXm2BXm1Filled = ibooker.book1D("PfHFEMEtFractionMinus_BXm2BXm1Filled", "HFEMEtFractionMinus prev filled 2 bunches", 50, 0, 1);
669 
670  map_of_MEs.insert(
671  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFractionPlus", meHFEMF_Plus));
672  map_of_MEs.insert(
673  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFractionMinus", meHFEMF_Minus));
674  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFractionPlus_BXm1Empty",
675  meHFEMF_Plus_BXm1Empty));
676  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFractionMinus_BXm1Empty",
677  meHFEMF_Minus_BXm1Empty));
678  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionPlus_BXm2BXm1Empty", meHFEMF_Plus_BXm2BXm1Empty));
679  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionMinus_BXm2BXm1Empty", meHFEMF_Minus_BXm2BXm1Empty));
680  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFractionPlus_BXm1Filled",
681  meHFEMF_Plus_BXm1Filled));
682  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFractionMinus_BXm1Filled",
683  meHFEMF_Minus_BXm1Filled));
684  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionPlus_BXm2BXm1Filled", meHFEMF_Plus_BXm2BXm1Filled));
685  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionMinus_BXm2BXm1Filled", meHFEMF_Minus_BXm2BXm1Filled));
686  /*
687  meMETPhiChargedHadronsBarrel_BXm2BXm1Filled = ibooker.book1D("METPhiChargedHadronsBarrel_BXm2BXm1Filled", "METPhi_PFChargedHadronsBarrel prev two bunches filled", 50, -M_PI,M_PI);
688  meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled = ibooker.book1D("METPhiChargedHadronsEndcapPlus_BXm2BXm1Filled", "METPhi_PFChargedHadronsEndcapPlus prev two bunches filled", 50, -M_PI,M_PI);
689  meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled = ibooker.book1D("METPhiChargedHadronsEndcapMinus_BXm2BXm1Filled","METPhi_PFChargedHadronsEndcapMinus prev two bunches filled", 50, -M_PI,M_PI);
690  meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled = ibooker.book1D("METPhiNeutralHadronsBarrel_BXm2BXm1Filled", "METPhi_PFNeutralHadronsBarrel prev two bunches filled", 50, -M_PI,M_PI);
691  meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled = ibooker.book1D("METPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled", "METPhi_PFNeutralHadronsEndcapPlus prev two bunches filled", 50, -M_PI,M_PI);
692  meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled = ibooker.book1D("METPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled","METPhi_PFNeutralHadronsEndcapMinus prev two bunches filled", 50, -M_PI,M_PI);
693  meMETPhiPhotonsBarrel_BXm2BXm1Filled = ibooker.book1D("METPhiPhotonsBarrel_BXm2BXm1Filled", "METPhi_PFPhotonsBarrel prev two bunches filled", 50, -M_PI,M_PI);
694  meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled = ibooker.book1D("METPhiPhotonsEndcapPlus_BXm2BXm1Filled", "METPhi_PFPhotonsEndcapPlus prev two bunches filled", 50, -M_PI,M_PI);
695  meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled = ibooker.book1D("METPhiPhotonsEndcapMinus_BXm2BXm1Filled", "METPhi_PFPhotonsEndcapMinus prev two bunches filled", 50, -M_PI,M_PI);
696  meMETPhiHFHadronsPlus_BXm2BXm1Filled = ibooker.book1D("METPhiHFHadronsPlus_BXm2BXm1Filled", "METPhi_PFHFHadronsPlus prev two bunches filled", 50, -M_PI,M_PI);
697  meMETPhiHFHadronsMinus_BXm2BXm1Filled = ibooker.book1D("METPhiHFHadronsMinus_BXm2BXm1Filled", "METPhi_PFHFHadronsMinus prev two bunches filled", 50, -M_PI,M_PI);
698  meMETPhiHFEGammasPlus_BXm2BXm1Filled = ibooker.book1D("METPhiHFEGammasPlus_BXm2BXm1Filled", "METPhi_PFHFEGammasPlus prev two bunches filled", 50, -M_PI,M_PI);
699  meMETPhiHFEGammasMinus_BXm2BXm1Filled = ibooker.book1D("METPhiHFEGammasMinus_BXm2BXm1Filled", "METPhi_PFHFEGammasMinus prev two bunches filled", 50, -M_PI,M_PI);
700 
701  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsBarrel_BXm2BXm1Filled" ,meMETPhiChargedHadronsBarrel_BXm2BXm1Filled));
702  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm2BXm1Filled" ,meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled));
703  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm2BXm1Filled" ,meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled));
704  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsBarrel_BXm2BXm1Filled" ,meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled));
705  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled" ,meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled));
706  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled" ,meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled));
707  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsBarrel_BXm2BXm1Filled" ,meMETPhiPhotonsBarrel_BXm2BXm1Filled));
708  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapPlus_BXm2BXm1Filled" ,meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled));
709  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapMinus_BXm2BXm1Filled" ,meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled));
710  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsPlus_BXm2BXm1Filled" ,meMETPhiHFHadronsPlus_BXm2BXm1Filled));
711  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsMinus_BXm2BXm1Filled" ,meMETPhiHFHadronsMinus_BXm2BXm1Filled));
712  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasPlus_BXm2BXm1Filled" ,meMETPhiHFEGammasPlus_BXm2BXm1Filled));
713  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasMinus_BXm2BXm1Filled" ,meMETPhiHFEGammasMinus_BXm2BXm1Filled));
714 
715  meMETPhiChargedHadronsBarrel_BXm2BXm1Empty = ibooker.book1D("METPhiChargedHadronsBarrel_BXm2BXm1Empty", "METPhi_PFChargedHadronsBarrel prev two bunches empty", 50, -M_PI,M_PI);
716  meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty = ibooker.book1D("METPhiChargedHadronsEndcapPlus_BXm2BXm1Empty", "METPhi_PFChargedHadronsEndcapPlus prev two bunches empty", 50, -M_PI,M_PI);
717  meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty = ibooker.book1D("METPhiChargedHadronsEndcapMinus_BXm2BXm1Empty","METPhi_PFChargedHadronsEndcapMinus prev two bunches empty", 50, -M_PI,M_PI);
718  meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty = ibooker.book1D("METPhiNeutralHadronsBarrel_BXm2BXm1Empty", "METPhi_PFNeutralHadronsBarrel prev two bunches empty", 50, -M_PI,M_PI);
719  meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty = ibooker.book1D("METPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty", "METPhi_PFNeutralHadronsEndcapPlus prev two bunches empty", 50, -M_PI,M_PI);
720  meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty = ibooker.book1D("METPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty","METPhi_PFNeutralHadronsEndcapMinus prev two bunches empty", 50, -M_PI,M_PI);
721  meMETPhiPhotonsBarrel_BXm2BXm1Empty = ibooker.book1D("METPhiPhotonsBarrel_BXm2BXm1Empty", "METPhi_PFPhotonsBarrel prev two bunches empty", 50, -M_PI,M_PI);
722  meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty = ibooker.book1D("METPhiPhotonsEndcapPlus_BXm2BXm1Empty", "METPhi_PFPhotonsEndcapPlus prev two bunches empty", 50, -M_PI,M_PI);
723  meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty = ibooker.book1D("METPhiPhotonsEndcapMinus_BXm2BXm1Empty", "METPhi_PFPhotonsEndcapMinus prev two bunches empty", 50, -M_PI,M_PI);
724  meMETPhiHFHadronsPlus_BXm2BXm1Empty = ibooker.book1D("METPhiHFHadronsPlus_BXm2BXm1Empty", "METPhi_PFHFHadronsPlus prev two bunches empty", 50, -M_PI,M_PI);
725  meMETPhiHFHadronsMinus_BXm2BXm1Empty = ibooker.book1D("METPhiHFHadronsMinus_BXm2BXm1Empty", "METPhi_PFHFHadronsMinus prev two bunches empty", 50, -M_PI,M_PI);
726  meMETPhiHFEGammasPlus_BXm2BXm1Empty = ibooker.book1D("METPhiHFEGammasPlus_BXm2BXm1Empty", "METPhi_PFHFEGammasPlus prev two bunches empty", 50, -M_PI,M_PI);
727  meMETPhiHFEGammasMinus_BXm2BXm1Empty = ibooker.book1D("METPhiHFEGammasMinus_BXm2BXm1Empty", "METPhi_PFHFEGammasMinus prev two bunches empty", 50, -M_PI,M_PI);
728 
729  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsBarrel_BXm2BXm1Empty" ,meMETPhiChargedHadronsBarrel_BXm2BXm1Empty));
730  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm2BXm1Empty" ,meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty));
731  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm2BXm1Empty" ,meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty));
732  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsBarrel_BXm2BXm1Empty" ,meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty));
733  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty" ,meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty));
734  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty" ,meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty));
735  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsBarrel_BXm2BXm1Empty" ,meMETPhiPhotonsBarrel_BXm2BXm1Empty));
736  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapPlus_BXm2BXm1Empty" ,meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty));
737  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapMinus_BXm2BXm1Empty" ,meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty));
738  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsPlus_BXm2BXm1Empty" ,meMETPhiHFHadronsPlus_BXm2BXm1Empty));
739  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsMinus_BXm2BXm1Empty" ,meMETPhiHFHadronsMinus_BXm2BXm1Empty));
740  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasPlus_BXm2BXm1Empty" ,meMETPhiHFEGammasPlus_BXm2BXm1Empty));
741  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasMinus_BXm2BXm1Empty" ,meMETPhiHFEGammasMinus_BXm2BXm1Empty));
742  */
743  //histos where one previous bunch was empty/filled
744  mePhotonEtFraction_BXm1Empty =
745  ibooker.book1D("PfPhotonEtFraction_BXm1Empty", "photonEtFraction() prev empty bunch", 50, 0, 1);
746  mePhotonEtFraction_BXm1Filled =
747  ibooker.book1D("PfPhotonEtFraction_BXm1Filled", "photonEtFraction() prev filled bunch", 50, 0, 1);
748  meNeutralHadronEtFraction_BXm1Empty = ibooker.book1D(
749  "PfNeutralHadronEtFraction_BXm1Empty", "neutralHadronEtFraction() prev empty bunch", 50, 0, 1);
750  meNeutralHadronEtFraction_BXm1Filled = ibooker.book1D(
751  "PfNeutralHadronEtFraction_BXm1Filled", "neutralHadronEtFraction() prev filled bunch", 50, 0, 1);
752  meChargedHadronEtFraction_BXm1Empty = ibooker.book1D(
753  "PfChargedHadronEtFraction_BXm1Empty", "chargedHadronEtFraction() prev empty bunch", 50, 0, 1);
754  meChargedHadronEtFraction_BXm1Filled = ibooker.book1D(
755  "PfChargedHadronEtFraction_BXm1Filled", "chargedHadronEtFraction() prev filled bunch", 50, 0, 1);
756  meMET_BXm1Empty = ibooker.book1D("MET_BXm1Empty", "MET prev empty bunch", 200, 0, 1000);
757  meMET_BXm1Filled = ibooker.book1D("MET_BXm1Filled", "MET prev filled bunch", 200, 0, 1000);
758  meSumET_BXm1Empty = ibooker.book1D("SumET_BXm1Empty", "SumET prev empty bunch", 400, 0, 4000);
759  meSumET_BXm1Filled = ibooker.book1D("SumET_BXm1Filled", "SumET prev filled bunch", 400, 0, 4000);
760 
761  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFraction_BXm1Empty",
762  mePhotonEtFraction_BXm1Empty));
763  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFraction_BXm1Filled",
764  mePhotonEtFraction_BXm1Filled));
765  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEtFraction_BXm1Empty",
766  meNeutralHadronEtFraction_BXm1Empty));
767  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralEtFraction_BXm1Filled",
768  meNeutralHadronEtFraction_BXm1Filled));
769  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEtFraction_BXm1Empty",
770  meChargedHadronEtFraction_BXm1Empty));
771  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedEtFraction_BXm1Filled",
772  meChargedHadronEtFraction_BXm1Filled));
773  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_BXm1Empty", meMET_BXm1Empty));
774  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_BXm1Filled", meMET_BXm1Filled));
775  map_of_MEs.insert(
776  std::pair<std::string, MonitorElement*>(DirName + "/" + "SumET_BXm1Empty", meSumET_BXm1Empty));
777  map_of_MEs.insert(
778  std::pair<std::string, MonitorElement*>(DirName + "/" + "SumET_BXm1Filled", meSumET_BXm1Filled));
779 
780  meMETPhiChargedHadronsBarrel_BXm1Filled = ibooker.book1D(
781  "METPhiChargedHadronsBarrel_BXm1Filled", "METPhi_PFChargedHadronsBarrel prev bunch filled", 50, -M_PI, M_PI);
782  meMETPhiChargedHadronsEndcapPlus_BXm1Filled =
783  ibooker.book1D("METPhiChargedHadronsEndcapPlus_BXm1Filled",
784  "METPhi_PFChargedHadronsEndcapPlus prev bunch filled",
785  50,
786  -M_PI,
787  M_PI);
788  meMETPhiChargedHadronsEndcapMinus_BXm1Filled =
789  ibooker.book1D("METPhiChargedHadronsEndcapMinus_BXm1Filled",
790  "METPhi_PFChargedHadronsEndcapMinus prev bunch filled",
791  50,
792  -M_PI,
793  M_PI);
794  meMETPhiNeutralHadronsBarrel_BXm1Filled = ibooker.book1D(
795  "METPhiNeutralHadronsBarrel_BXm1Filled", "METPhi_PFNeutralHadronsBarrel prev bunch filled", 50, -M_PI, M_PI);
796  meMETPhiNeutralHadronsEndcapPlus_BXm1Filled =
797  ibooker.book1D("METPhiNeutralHadronsEndcapPlus_BXm1Filled",
798  "METPhi_PFNeutralHadronsEndcapPlus prev bunch filled",
799  50,
800  -M_PI,
801  M_PI);
802  meMETPhiNeutralHadronsEndcapMinus_BXm1Filled =
803  ibooker.book1D("METPhiNeutralHadronsEndcapMinus_BXm1Filled",
804  "METPhi_PFNeutralHadronsEndcapMinus prev bunch filled",
805  50,
806  -M_PI,
807  M_PI);
808  meMETPhiPhotonsBarrel_BXm1Filled = ibooker.book1D(
809  "METPhiPhotonsBarrel_BXm1Filled", "METPhi_PFPhotonsBarrel prev bunch filled", 50, -M_PI, M_PI);
810  meMETPhiPhotonsEndcapPlus_BXm1Filled = ibooker.book1D(
811  "METPhiPhotonsEndcapPlus_BXm1Filled", "METPhi_PFPhotonsEndcapPlus prev bunch filled", 50, -M_PI, M_PI);
812  meMETPhiPhotonsEndcapMinus_BXm1Filled = ibooker.book1D(
813  "METPhiPhotonsEndcapMinus_BXm1Filled", "METPhi_PFPhotonsEndcapMinus prev bunch filled", 50, -M_PI, M_PI);
814  meMETPhiHFHadronsPlus_BXm1Filled = ibooker.book1D(
815  "METPhiHFHadronsPlus_BXm1Filled", "METPhi_PFHFHadronsPlus prev bunch filled", 50, -M_PI, M_PI);
816  meMETPhiHFHadronsMinus_BXm1Filled = ibooker.book1D(
817  "METPhiHFHadronsMinus_BXm1Filled", "METPhi_PFHFHadronsMinus prev bunch filled", 50, -M_PI, M_PI);
818  meMETPhiHFEGammasPlus_BXm1Filled = ibooker.book1D(
819  "METPhiHFEGammasPlus_BXm1Filled", "METPhi_PFHFEGammasPlus prev bunch filled", 50, -M_PI, M_PI);
820  meMETPhiHFEGammasMinus_BXm1Filled = ibooker.book1D(
821  "METPhiHFEGammasMinus_BXm1Filled", "METPhi_PFHFEGammasMinus prev bunch filled", 50, -M_PI, M_PI);
822 
823  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
824  DirName + "/" + "METPhiChargedHadronsBarrel_BXm1Filled", meMETPhiChargedHadronsBarrel_BXm1Filled));
825  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
826  DirName + "/" + "METPhiChargedHadronsEndcapPlus_BXm1Filled", meMETPhiChargedHadronsEndcapPlus_BXm1Filled));
827  map_of_MEs.insert(
828  std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiChargedHadronsEndcapMinus_BXm1Filled",
829  meMETPhiChargedHadronsEndcapMinus_BXm1Filled));
830  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
831  DirName + "/" + "METPhiNeutralHadronsBarrel_BXm1Filled", meMETPhiNeutralHadronsBarrel_BXm1Filled));
832  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
833  DirName + "/" + "METPhiNeutralHadronsEndcapPlus_BXm1Filled", meMETPhiNeutralHadronsEndcapPlus_BXm1Filled));
834  map_of_MEs.insert(
835  std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiNeutralHadronsEndcapMinus_BXm1Filled",
836  meMETPhiNeutralHadronsEndcapMinus_BXm1Filled));
837  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsBarrel_BXm1Filled",
838  meMETPhiPhotonsBarrel_BXm1Filled));
839  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsEndcapPlus_BXm1Filled",
840  meMETPhiPhotonsEndcapPlus_BXm1Filled));
841  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsEndcapMinus_BXm1Filled",
842  meMETPhiPhotonsEndcapMinus_BXm1Filled));
843  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFHadronsPlus_BXm1Filled",
844  meMETPhiHFHadronsPlus_BXm1Filled));
845  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFHadronsMinus_BXm1Filled",
846  meMETPhiHFHadronsMinus_BXm1Filled));
847  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFEGammasPlus_BXm1Filled",
848  meMETPhiHFEGammasPlus_BXm1Filled));
849  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFEGammasMinus_BXm1Filled",
850  meMETPhiHFEGammasMinus_BXm1Filled));
851 
852  meMETPhiChargedHadronsBarrel_BXm1Empty = ibooker.book1D(
853  "METPhiChargedHadronsBarrel_BXm1Empty", "METPhi_PFChargedHadronsBarrel prev bunch empty", 50, -M_PI, M_PI);
854  meMETPhiChargedHadronsEndcapPlus_BXm1Empty =
855  ibooker.book1D("METPhiChargedHadronsEndcapPlus_BXm1Empty",
856  "METPhi_PFChargedHadronsEndcapPlus prev bunch empty",
857  50,
858  -M_PI,
859  M_PI);
860  meMETPhiChargedHadronsEndcapMinus_BXm1Empty =
861  ibooker.book1D("METPhiChargedHadronsEndcapMinus_BXm1Empty",
862  "METPhi_PFChargedHadronsEndcapMinus prev bunch empty",
863  50,
864  -M_PI,
865  M_PI);
866  meMETPhiNeutralHadronsBarrel_BXm1Empty = ibooker.book1D(
867  "METPhiNeutralHadronsBarrel_BXm1Empty", "METPhi_PFNeutralHadronsBarrel prev bunch empty", 50, -M_PI, M_PI);
868  meMETPhiNeutralHadronsEndcapPlus_BXm1Empty =
869  ibooker.book1D("METPhiNeutralHadronsEndcapPlus_BXm1Empty",
870  "METPhi_PFNeutralHadronsEndcapPlus prev bunch empty",
871  50,
872  -M_PI,
873  M_PI);
874  meMETPhiNeutralHadronsEndcapMinus_BXm1Empty =
875  ibooker.book1D("METPhiNeutralHadronsEndcapMinus_BXm1Empty",
876  "METPhi_PFNeutralHadronsEndcapMinus prev bunch empty",
877  50,
878  -M_PI,
879  M_PI);
880  meMETPhiPhotonsBarrel_BXm1Empty =
881  ibooker.book1D("METPhiPhotonsBarrel_BXm1Empty", "METPhi_PFPhotonsBarrel prev bunch empty", 50, -M_PI, M_PI);
882  meMETPhiPhotonsEndcapPlus_BXm1Empty = ibooker.book1D(
883  "METPhiPhotonsEndcapPlus_BXm1Empty", "METPhi_PFPhotonsEndcapPlus prev bunch empty", 50, -M_PI, M_PI);
884  meMETPhiPhotonsEndcapMinus_BXm1Empty = ibooker.book1D(
885  "METPhiPhotonsEndcapMinus_BXm1Empty", "METPhi_PFPhotonsEndcapMinus prev bunch empty", 50, -M_PI, M_PI);
886  meMETPhiHFHadronsPlus_BXm1Empty =
887  ibooker.book1D("METPhiHFHadronsPlus_BXm1Empty", "METPhi_PFHFHadronsPlus prev bunch empty", 50, -M_PI, M_PI);
888  meMETPhiHFHadronsMinus_BXm1Empty = ibooker.book1D(
889  "METPhiHFHadronsMinus_BXm1Empty", "METPhi_PFHFHadronsMinus prev bunch empty", 50, -M_PI, M_PI);
890  meMETPhiHFEGammasPlus_BXm1Empty =
891  ibooker.book1D("METPhiHFEGammasPlus_BXm1Empty", "METPhi_PFHFEGammasPlus prev bunch empty", 50, -M_PI, M_PI);
892  meMETPhiHFEGammasMinus_BXm1Empty = ibooker.book1D(
893  "METPhiHFEGammasMinus_BXm1Empty", "METPhi_PFHFEGammasMinus prev bunch empty", 50, -M_PI, M_PI);
894 
895  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
896  DirName + "/" + "METPhiChargedHadronsBarrel_BXm1Empty", meMETPhiChargedHadronsBarrel_BXm1Empty));
897  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
898  DirName + "/" + "METPhiChargedHadronsEndcapPlus_BXm1Empty", meMETPhiChargedHadronsEndcapPlus_BXm1Empty));
899  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
900  DirName + "/" + "METPhiChargedHadronsEndcapMinus_BXm1Empty", meMETPhiChargedHadronsEndcapMinus_BXm1Empty));
901  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
902  DirName + "/" + "METPhiNeutralHadronsBarrel_BXm1Empty", meMETPhiNeutralHadronsBarrel_BXm1Empty));
903  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
904  DirName + "/" + "METPhiNeutralHadronsEndcapPlus_BXm1Empty", meMETPhiNeutralHadronsEndcapPlus_BXm1Empty));
905  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
906  DirName + "/" + "METPhiNeutralHadronsEndcapMinus_BXm1Empty", meMETPhiNeutralHadronsEndcapMinus_BXm1Empty));
907  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsBarrel_BXm1Empty",
908  meMETPhiPhotonsBarrel_BXm1Empty));
909  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsEndcapPlus_BXm1Empty",
910  meMETPhiPhotonsEndcapPlus_BXm1Empty));
911  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsEndcapMinus_BXm1Empty",
912  meMETPhiPhotonsEndcapMinus_BXm1Empty));
913  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFHadronsPlus_BXm1Empty",
914  meMETPhiHFHadronsPlus_BXm1Empty));
915  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFHadronsMinus_BXm1Empty",
916  meMETPhiHFHadronsMinus_BXm1Empty));
917  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFEGammasPlus_BXm1Empty",
918  meMETPhiHFEGammasPlus_BXm1Empty));
919  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFEGammasMinus_BXm1Empty",
920  meMETPhiHFEGammasMinus_BXm1Empty));
921 
922  meMETPhiChargedHadronsBarrel =
923  ibooker.book1D("METPhiChargedHadronsBarrel", "METPhi_PFChargedHadronsBarrel", 50, -M_PI, M_PI);
924  meMETPhiChargedHadronsEndcapPlus =
925  ibooker.book1D("METPhiChargedHadronsEndcapPlus", "METPhi_PFChargedHadronsEndcapPlus", 50, -M_PI, M_PI);
926  meMETPhiChargedHadronsEndcapMinus =
927  ibooker.book1D("METPhiChargedHadronsEndcapMinus", "METPhi_PFChargedHadronsEndcapMinus", 50, -M_PI, M_PI);
928  meMETPhiNeutralHadronsBarrel =
929  ibooker.book1D("METPhiNeutralHadronsBarrel", "METPhi_PFNeutralHadronsBarrel", 50, -M_PI, M_PI);
930  meMETPhiNeutralHadronsEndcapPlus =
931  ibooker.book1D("METPhiNeutralHadronsEndcapPlus", "METPhi_PFNeutralHadronsEndcapPlus", 50, -M_PI, M_PI);
932  meMETPhiNeutralHadronsEndcapMinus =
933  ibooker.book1D("METPhiNeutralHadronsEndcapMinus", "METPhi_PFNeutralHadronsEndcapMinus", 50, -M_PI, M_PI);
934  meMETPhiPhotonsBarrel = ibooker.book1D("METPhiPhotonsBarrel", "METPhi_PFPhotonsBarrel", 50, -M_PI, M_PI);
935  meMETPhiPhotonsEndcapPlus =
936  ibooker.book1D("METPhiPhotonsEndcapPlus", "METPhi_PFPhotonsEndcapPlus", 50, -M_PI, M_PI);
937  meMETPhiPhotonsEndcapMinus =
938  ibooker.book1D("METPhiPhotonsEndcapMinus", "METPhi_PFPhotonsEndcapMinus", 50, -M_PI, M_PI);
939  meMETPhiHFHadronsPlus = ibooker.book1D("METPhiHFHadronsPlus", "METPhi_PFHFHadronsPlus", 50, -M_PI, M_PI);
940  meMETPhiHFHadronsMinus = ibooker.book1D("METPhiHFHadronsMinus", "METPhi_PFHFHadronsMinus", 50, -M_PI, M_PI);
941  meMETPhiHFEGammasPlus = ibooker.book1D("METPhiHFEGammasPlus", "METPhi_PFHFEGammasPlus", 50, -M_PI, M_PI);
942  meMETPhiHFEGammasMinus = ibooker.book1D("METPhiHFEGammasMinus", "METPhi_PFHFEGammasMinus", 50, -M_PI, M_PI);
943 
944  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiChargedHadronsBarrel",
945  meMETPhiChargedHadronsBarrel));
946  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiChargedHadronsEndcapPlus",
947  meMETPhiChargedHadronsEndcapPlus));
948  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiChargedHadronsEndcapMinus",
949  meMETPhiChargedHadronsEndcapMinus));
950  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiNeutralHadronsBarrel",
951  meMETPhiNeutralHadronsBarrel));
952  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiNeutralHadronsEndcapPlus",
953  meMETPhiNeutralHadronsEndcapPlus));
954  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiNeutralHadronsEndcapMinus",
955  meMETPhiNeutralHadronsEndcapMinus));
956  map_of_MEs.insert(
957  std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsBarrel", meMETPhiPhotonsBarrel));
958  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsEndcapPlus",
959  meMETPhiPhotonsEndcapPlus));
960  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsEndcapMinus",
961  meMETPhiPhotonsEndcapMinus));
962  map_of_MEs.insert(
963  std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFHadronsPlus", meMETPhiHFHadronsPlus));
964  map_of_MEs.insert(
965  std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFHadronsMinus", meMETPhiHFHadronsMinus));
966  map_of_MEs.insert(
967  std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFEGammasPlus", meMETPhiHFEGammasPlus));
968  map_of_MEs.insert(
969  std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFEGammasMinus", meMETPhiHFEGammasMinus));
970  }
971 
972  if (fillPFCandPlots && fillCandidateMap_histos) {
973  if (!profilePFCand_x_.empty()) {
974  etaMinPFCand_.clear();
975  etaMaxPFCand_.clear();
976  typePFCand_.clear();
977  countsPFCand_.clear();
978  MExPFCand_.clear();
979  MEyPFCand_.clear();
980  profilePFCand_x_.clear();
981  profilePFCand_y_.clear();
982  profilePFCand_x_name_.clear();
983  profilePFCand_y_name_.clear();
984  }
985  for (std::vector<edm::ParameterSet>::const_iterator v = diagnosticsParameters_.begin();
986  v != diagnosticsParameters_.end();
987  v++) {
988  double etaMinPFCand = v->getParameter<double>("etaMin");
989  double etaMaxPFCand = v->getParameter<double>("etaMax");
990  int nMinPFCand = v->getParameter<int>("nMin");
991  int nMaxPFCand = v->getParameter<int>("nMax");
992  int nbinsPFCand = v->getParameter<double>("nbins");
993 
994  // etaNBins_.push_back(etaNBins);
995  etaMinPFCand_.push_back(etaMinPFCand);
996  etaMaxPFCand_.push_back(etaMaxPFCand);
997  typePFCand_.push_back(v->getParameter<int>("type"));
998  countsPFCand_.push_back(0);
999  MExPFCand_.push_back(0.);
1000  MEyPFCand_.push_back(0.);
1001 
1002  profilePFCand_x_.push_back(
1003  ibooker.bookProfile(std::string(v->getParameter<std::string>("name")).append("_Px_").c_str(),
1004  std::string(v->getParameter<std::string>("name")) + "Px",
1005  nbinsPFCand,
1006  nMinPFCand,
1007  nMaxPFCand,
1008  -300,
1009  300));
1010  profilePFCand_x_name_.push_back(std::string(v->getParameter<std::string>("name")).append("_Px_"));
1011  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
1012  DirName + "/" + profilePFCand_x_name_[profilePFCand_x_name_.size() - 1],
1013  profilePFCand_x_[profilePFCand_x_.size() - 1]));
1014  profilePFCand_y_.push_back(
1015  ibooker.bookProfile(std::string(v->getParameter<std::string>("name")).append("_Py_").c_str(),
1016  std::string(v->getParameter<std::string>("name")) + "Py",
1017  nbinsPFCand,
1018  nMinPFCand,
1019  nMaxPFCand,
1020  -300,
1021  300));
1022  profilePFCand_y_name_.push_back(std::string(v->getParameter<std::string>("name")).append("_Py_"));
1023  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
1024  DirName + "/" + profilePFCand_y_name_[profilePFCand_y_name_.size() - 1],
1025  profilePFCand_y_[profilePFCand_y_.size() - 1]));
1026  }
1027  }
1028  }
1029  if (isMiniAODMet_) {
1030  if (fillPFCandPlots &&
1031  fillCandidateMap_histos) { //first bool internal checks for subdirectory filling, second bool given in cfg file, checks that we fill maps only in one module in total
1032  if (!profilePFCand_x_.empty()) {
1033  etaMinPFCand_.clear();
1034  etaMaxPFCand_.clear();
1035  typePFCand_.clear();
1036  countsPFCand_.clear();
1037  profilePFCand_x_.clear();
1038  profilePFCand_y_.clear();
1039  }
1040  for (std::vector<edm::ParameterSet>::const_iterator v = diagnosticsParameters_.begin();
1041  v != diagnosticsParameters_.end();
1042  v++) {
1043  double etaMinPFCand = v->getParameter<double>("etaMin");
1044  double etaMaxPFCand = v->getParameter<double>("etaMax");
1045 
1046  etaMinPFCand_.push_back(etaMinPFCand);
1047  etaMaxPFCand_.push_back(etaMaxPFCand);
1048  typePFCand_.push_back(v->getParameter<int>("type"));
1049  countsPFCand_.push_back(0);
1050  MExPFCand_.push_back(0.);
1051  MEyPFCand_.push_back(0.);
1052  }
1053  }
1054  }
1055 
1056  if (isPFMet_ || isMiniAODMet_) {
1057  mePhotonEtFraction = ibooker.book1D("PfPhotonEtFraction", "photonEtFraction()", 50, 0, 1);
1058  meNeutralHadronEtFraction = ibooker.book1D("PfNeutralHadronEtFraction", "neutralHadronEtFraction()", 50, 0, 1);
1059  meChargedHadronEtFraction = ibooker.book1D("PfChargedHadronEtFraction", "chargedHadronEtFraction()", 50, 0, 1);
1060  meHFHadronEtFraction = ibooker.book1D("PfHFHadronEtFraction", "HFHadronEtFraction()", 50, 0, 1);
1061  meHFEMEtFraction = ibooker.book1D("PfHFEMEtFraction", "HFEMEtFraction()", 50, 0, 1);
1062 
1063  map_of_MEs.insert(
1064  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFraction", mePhotonEtFraction));
1065  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEtFraction",
1066  meNeutralHadronEtFraction));
1067  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEtFraction",
1068  meChargedHadronEtFraction));
1069  map_of_MEs.insert(
1070  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFraction", meHFHadronEtFraction));
1071  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFraction", meHFEMEtFraction));
1072 
1073  mePhotonEtFraction_profile =
1074  ibooker.bookProfile("PfPhotonEtFraction_profile", "photonEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
1075  meNeutralHadronEtFraction_profile = ibooker.bookProfile(
1076  "PfNeutralHadronEtFraction_profile", "neutralHadronEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
1077  meChargedHadronEtFraction_profile = ibooker.bookProfile(
1078  "PfChargedHadronEtFraction_profile", "chargedHadronEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
1079  meHFHadronEtFraction_profile = ibooker.bookProfile(
1080  "PfHFHadronEtFraction_profile", "HFHadronEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
1081  meHFEMEtFraction_profile =
1082  ibooker.bookProfile("PfHFEMEtFraction_profile", "HFEMEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
1083  mePhotonEtFraction_profile->setAxisTitle("nvtx", 1);
1084  meNeutralHadronEtFraction_profile->setAxisTitle("nvtx", 1);
1085  meChargedHadronEtFraction_profile->setAxisTitle("nvtx", 1);
1086  meHFHadronEtFraction_profile->setAxisTitle("nvtx", 1);
1087  meHFEMEtFraction_profile->setAxisTitle("nvtx", 1);
1088 
1089  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFraction_profile",
1090  mePhotonEtFraction_profile));
1091  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEtFraction_profile",
1092  meNeutralHadronEtFraction_profile));
1093  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEtFraction_profile",
1094  meChargedHadronEtFraction_profile));
1095  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFraction_profile",
1096  meHFHadronEtFraction_profile));
1097  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFraction_profile",
1098  meHFEMEtFraction_profile));
1099 
1100  mePhotonEt = ibooker.book1D("PfPhotonEt", "photonEt()", 50, 0, 1000);
1101  meNeutralHadronEt = ibooker.book1D("PfNeutralHadronEt", "neutralHadronEt()", 50, 0, 1000);
1102  meElectronEt = ibooker.book1D("PfElectronEt", "electronEt()", 50, 0, 100);
1103  meChargedHadronEt = ibooker.book1D("PfChargedHadronEt", "chargedHadronEt()", 50, 0, 2000);
1104  meMuonEt = ibooker.book1D("PfMuonEt", "muonEt()", 50, 0, 100);
1105  meHFHadronEt = ibooker.book1D("PfHFHadronEt", "HFHadronEt()", 50, 0, 2000);
1106  meHFEMEt = ibooker.book1D("PfHFEMEt", "HFEMEt()", 50, 0, 1000);
1107 
1108  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEt", mePhotonEt));
1109  map_of_MEs.insert(
1110  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEt", meNeutralHadronEt));
1111  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfElectronEt", meElectronEt));
1112  map_of_MEs.insert(
1113  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEt", meChargedHadronEt));
1114  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfMuonEt", meMuonEt));
1115  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEt", meHFHadronEt));
1116  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEt", meHFEMEt));
1117 
1118  mePhotonEt_profile =
1119  ibooker.bookProfile("PfPhotonEt_profile", "photonEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
1120  meNeutralHadronEt_profile = ibooker.bookProfile(
1121  "PfNeutralHadronEt_profile", "neutralHadronEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
1122  meChargedHadronEt_profile = ibooker.bookProfile(
1123  "PfChargedHadronEt_profile", "chargedHadronEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
1124  meHFHadronEt_profile =
1125  ibooker.bookProfile("PfHFHadronEt_profile", "HFHadronEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
1126  meHFEMEt_profile = ibooker.bookProfile("PfHFEMEt_profile", "HFEMEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
1127 
1128  mePhotonEt_profile->setAxisTitle("nvtx", 1);
1129  meNeutralHadronEt_profile->setAxisTitle("nvtx", 1);
1130  meChargedHadronEt_profile->setAxisTitle("nvtx", 1);
1131  meHFHadronEt_profile->setAxisTitle("nvtx", 1);
1132  meHFEMEt_profile->setAxisTitle("nvtx", 1);
1133 
1134  map_of_MEs.insert(
1135  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEt_profile", mePhotonEt_profile));
1136  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEt_profile",
1137  meNeutralHadronEt_profile));
1138  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEt_profile",
1139  meChargedHadronEt_profile));
1140  map_of_MEs.insert(
1141  std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEt_profile", meHFHadronEt_profile));
1142  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEt_profile", meHFEMEt_profile));
1143  }
1144 
1145  if (isCaloMet_) {
1146  if (fill_met_high_level_histo) { //now configurable in python file
1147  hMExLS = ibooker.book2D("MExLS", "MEx_LS", 200, -200, 200, 250, 0., 2500.);
1148  hMExLS->setAxisTitle("MEx [GeV]", 1);
1149  hMExLS->setAxisTitle("Lumi Section", 2);
1150  hMExLS->setOption("colz");
1151  hMEyLS = ibooker.book2D("MEyLS", "MEy_LS", 200, -200, 200, 250, 0., 2500.);
1152  hMEyLS->setAxisTitle("MEy [GeV]", 1);
1153  hMEyLS->setAxisTitle("Lumi Section", 2);
1154  hMEyLS->setOption("colz");
1155  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MExLS", hMExLS));
1156  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MEyLS", hMEyLS));
1157  }
1158  }
1159 
1160  hMETRate = ibooker.book1D("METRate", "METRate", 200, 0, 1000);
1161  map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METRate", hMETRate));
1162 
1163  ibooker.setCurrentFolder("JetMET");
1164  lumisecME = ibooker.book1D("lumisec", "lumisec", 2501, -1., 2500.);
1165  map_of_MEs.insert(std::pair<std::string, MonitorElement*>("JetMET/lumisec", lumisecME));
1166  } //all non Z plots (restrict Z Plots only for resolution study)
1167 }
1168 
1169 // ***********************************************************
1170 void METAnalyzer::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {
1171  const L1GtTriggerMenu* menu = &iSetup.getData(l1gtTrigMenuToken_);
1172  for (CItAlgo techTrig = menu->gtTechnicalTriggerMap().begin(); techTrig != menu->gtTechnicalTriggerMap().end();
1173  ++techTrig) {
1174  if ((techTrig->second).algoName() == m_l1algoname_) {
1175  m_bitAlgTechTrig_ = (techTrig->second).algoBitNumber();
1176  break;
1177  }
1178  }
1179 
1180  // std::cout << "Run " << iRun.run() << " hltconfig.init "
1181  // << hltConfig_.init(iRun,iSetup,triggerResultsLabel_.process(),changed_) << " length: "<<hltConfig_.triggerNames().size()<<" changed "<<changed_<<std::endl;
1182  bool changed(true);
1183  if (hltConfig_.init(iRun, iSetup, triggerResultsLabel_.process(), changed)) {
1184  if (changed) {
1185  //hltConfig_.dump("ProcessName");
1186  //hltConfig_.dump("GlobalTag");
1187  //hltConfig_.dump("TableName");
1188  // hltConfig_.dump("Streams");
1189  // hltConfig_.dump("Datasets");
1190  // hltConfig_.dump("PrescaleTable");
1191  // hltConfig_.dump("ProcessPSet");
1192  }
1193  } else {
1194  if (verbose_)
1195  std::cout << "HLTEventAnalyzerAOD::analyze:"
1196  << " config extraction failure with process name " << triggerResultsLabel_.process() << std::endl;
1197  }
1198 
1199  triggerSelectedSubFolders_ = parameters.getParameter<edm::VParameterSet>("triggerSelectedSubFolders");
1200  for (std::vector<GenericTriggerEventFlag*>::const_iterator it = triggerFolderEventFlag_.begin();
1201  it != triggerFolderEventFlag_.end();
1202  it++) {
1203  int pos = it - triggerFolderEventFlag_.begin();
1204  if ((*it)->on()) {
1205  (*it)->initRun(iRun, iSetup);
1206  if (triggerSelectedSubFolders_[pos].exists(std::string("hltDBKey"))) {
1207  if ((*it)->expressionsFromDB((*it)->hltDBKey(), iSetup)[0] != "CONFIG_ERROR")
1208  triggerFolderExpr_[pos] = (*it)->expressionsFromDB((*it)->hltDBKey(), iSetup);
1209  }
1210  }
1211  }
1212  if (isMiniAODMet_) {
1213  bool changed_filter = true;
1214  std::vector<int> initializeFilter(8, -1); //we have 8 filters at the moment
1215  miniaodFilterIndex_ = initializeFilter;
1216  if (FilterhltConfig_.init(iRun, iSetup, METFilterMiniAODLabel_.process(), changed_filter)) {
1217  miniaodfilterdec = 0;
1218  for (unsigned int i = 0; i < FilterhltConfig_.size(); i++) {
1219  std::string search = FilterhltConfig_.triggerName(i).substr(
1220  5); //actual label of filter, the first 5 items are Flag_, so stripped off
1222  HBHENoiseStringMiniAOD; //all filters end with DQM, which is not in the flag --> ONLY not for HBHEFilters
1223  std::size_t found = search2.find(search);
1224  if (found != std::string::npos) {
1225  miniaodFilterIndex_[0] = i;
1226  }
1227  search2 = CSCHaloResultTag_.label().substr(0, CSCHaloResultTag_.label().size() - 3);
1228  found = search2.find(search);
1229  if (found != std::string::npos) {
1230  miniaodFilterIndex_[1] = i;
1231  }
1232  search2 = eeBadScFilterTag_.label().substr(0, eeBadScFilterTag_.label().size() - 3);
1233  found = search2.find(search);
1234  if (found != std::string::npos) {
1235  miniaodFilterIndex_[2] = i;
1236  }
1237  search2 = HBHEIsoNoiseStringMiniAOD;
1238  found = search2.find(search);
1239  if (found != std::string::npos) {
1240  miniaodFilterIndex_[3] = i;
1241  }
1242  search2 = CSCHalo2015ResultTag_.label().substr(0, CSCHalo2015ResultTag_.label().size() - 3);
1243  found = search2.find(search);
1244  if (found != std::string::npos) {
1245  miniaodFilterIndex_[4] = i;
1246  }
1247  search2 = EcalDeadCellTriggerTag_.label().substr(0, EcalDeadCellTriggerTag_.label().size() - 3);
1248  found = search2.find(search);
1249  if (found != std::string::npos) {
1250  miniaodFilterIndex_[5] = i;
1251  }
1252  search2 = EcalDeadCellBoundaryTag_.label().substr(0, EcalDeadCellBoundaryTag_.label().size() - 3);
1253  found = search2.find(search);
1254  if (found != std::string::npos) {
1255  miniaodFilterIndex_[6] = i;
1256  }
1257  search2 = HcalStripHaloTag_.label().substr(0, HcalStripHaloTag_.label().size() - 3);
1258  found = search2.find(search);
1259  if (found != std::string::npos) {
1260  miniaodFilterIndex_[7] = i;
1261  }
1262  }
1263  } else if (FilterhltConfig_.init(iRun, iSetup, METFilterMiniAODLabel2_.process(), changed_filter)) {
1264  miniaodfilterdec = 1;
1265  for (unsigned int i = 0; i < FilterhltConfig_.size(); i++) {
1266  std::string search = FilterhltConfig_.triggerName(i).substr(
1267  5); //actual label of filter, the first 5 items are Flag_, so stripped off
1269  HBHENoiseStringMiniAOD; //all filters end with DQM, which is not in the flag --> ONLY not for HBHEFilters
1270  std::size_t found = search2.find(search);
1271  if (found != std::string::npos) {
1272  miniaodFilterIndex_[0] = i;
1273  }
1274  search2 = CSCHaloResultTag_.label().substr(0, CSCHaloResultTag_.label().size() - 3);
1275  found = search2.find(search);
1276  if (found != std::string::npos) {
1277  miniaodFilterIndex_[1] = i;
1278  }
1279  search2 = eeBadScFilterTag_.label().substr(0, eeBadScFilterTag_.label().size() - 3);
1280  found = search2.find(search);
1281  if (found != std::string::npos) {
1282  miniaodFilterIndex_[2] = i;
1283  }
1284  search2 = HBHEIsoNoiseStringMiniAOD;
1285  found = search2.find(search);
1286  if (found != std::string::npos) {
1287  miniaodFilterIndex_[3] = i;
1288  }
1289  search2 = CSCHalo2015ResultTag_.label().substr(0, CSCHalo2015ResultTag_.label().size() - 3);
1290  found = search2.find(search);
1291  if (found != std::string::npos) {
1292  miniaodFilterIndex_[4] = i;
1293  }
1294  search2 = EcalDeadCellTriggerTag_.label().substr(0, EcalDeadCellTriggerTag_.label().size() - 3);
1295  found = search2.find(search);
1296  if (found != std::string::npos) {
1297  miniaodFilterIndex_[5] = i;
1298  }
1299  search2 = EcalDeadCellBoundaryTag_.label().substr(0, EcalDeadCellBoundaryTag_.label().size() - 3);
1300  found = search2.find(search);
1301  if (found != std::string::npos) {
1302  miniaodFilterIndex_[6] = i;
1303  }
1304  search2 = HcalStripHaloTag_.label().substr(0, HcalStripHaloTag_.label().size() - 3);
1305  found = search2.find(search);
1306  if (found != std::string::npos) {
1307  miniaodFilterIndex_[7] = i;
1308  }
1309  }
1310  } else {
1311  edm::LogWarning("MiniAOD METAN Filter HLT OBject version")
1312  << "nothing found with both RECO and reRECO label" << std::endl;
1313  }
1314  }
1315 }
1316 
1317 // ***********************************************************
1318 void METAnalyzer::dqmEndRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {
1319  //
1320  //--- Check the time length of the Run from the lumi section plots
1321 
1322  TH1F* tlumisec;
1323 
1324  MonitorElement* meLumiSec = map_dijet_MEs["aaa"];
1325  meLumiSec = map_dijet_MEs["JetMET/lumisec"];
1326 
1327  int totlsec = 0;
1328  int totlssecsum = 0;
1329  double totltime = 0.;
1330  if (meLumiSec && meLumiSec->getRootObject()) {
1331  tlumisec = meLumiSec->getTH1F();
1332  //check overflow bin (if we have more than 2500 LS in a run)
1333  //lumisec is filled every time the analyze section is processed
1334  //we know an LS is present only once in a run: normalize how many events we had on average
1335  //if lumi fluctuates strongly might be unreliable for overflow bin though
1336  for (int i = 0; i < (tlumisec->GetNbinsX()); i++) {
1337  if (tlumisec->GetBinContent(i) != 0) {
1338  totlsec += 1;
1339  totlssecsum += tlumisec->GetBinContent(i);
1340  }
1341  }
1342  int num_per_ls = (double)totlssecsum / (double)totlsec;
1343  totlsec = totlsec + tlumisec->GetBinContent(tlumisec->GetNbinsX() + 1) / (double)num_per_ls;
1344  totltime = double(totlsec * 90); // one lumi sec ~ 90 (sec)
1345  }
1346 
1347  if (totltime == 0.)
1348  totltime = 1.;
1349 
1350  std::string dirName = FolderName_ + metCollectionLabel_.label() + "/";
1351  //dbe_->setCurrentFolder(dirName);
1352 
1353  //below is the original METAnalyzer formulation
1354 
1355  for (std::vector<std::string>::const_iterator ic = folderNames_.begin(); ic != folderNames_.end(); ic++) {
1357  DirName = dirName + *ic;
1358  makeRatePlot(DirName, totltime);
1359  for (std::vector<GenericTriggerEventFlag*>::const_iterator it = triggerFolderEventFlag_.begin();
1360  it != triggerFolderEventFlag_.end();
1361  it++) {
1362  int pos = it - triggerFolderEventFlag_.begin();
1363  if ((*it)->on()) {
1364  makeRatePlot(DirName + "/" + triggerFolderLabels_[pos], totltime);
1365  }
1366  }
1367  }
1368 }
1369 
1370 // ***********************************************************
1372  //dbe_->setCurrentFolder(DirName);
1373  MonitorElement* meMET = map_dijet_MEs[DirName + "/" + "MET"];
1374  MonitorElement* mMETRate = map_dijet_MEs[DirName + "/" + "METRate"];
1375 
1376  TH1F* tMET;
1377  TH1F* tMETRate;
1378 
1379  if (meMET && mMETRate) {
1380  if (meMET->getRootObject() && mMETRate->getRootObject()) {
1381  tMET = meMET->getTH1F();
1382 
1383  // Integral plot & convert number of events to rate (hz)
1384  tMETRate = (TH1F*)tMET->Clone("METRateHist");
1385  for (int i = tMETRate->GetNbinsX() - 1; i >= 0; i--) {
1386  tMETRate->SetBinContent(i + 1, tMETRate->GetBinContent(i + 2) + tMET->GetBinContent(i + 1));
1387  }
1388  for (int i = 0; i < tMETRate->GetNbinsX(); i++) {
1389  tMETRate->SetBinContent(i + 1, tMETRate->GetBinContent(i + 1) / double(totltime));
1390  mMETRate->setBinContent(i + 1, tMETRate->GetBinContent(i + 1));
1391  }
1392  }
1393  }
1394 }
1395 
1396 // ***********************************************************
1398  // *** Fill lumisection ME
1399  int myLuminosityBlock;
1400  myLuminosityBlock = iEvent.luminosityBlock();
1401  if (fill_met_high_level_histo) {
1402  lumisecME = map_dijet_MEs["JetMET/lumisec"];
1403  if (lumisecME && lumisecME->getRootObject())
1404  lumisecME->Fill(myLuminosityBlock);
1405  }
1406 
1407  if (myLuminosityBlock < LSBegin_)
1408  return;
1409  if (myLuminosityBlock > LSEnd_ && LSEnd_ > 0)
1410  return;
1411 
1412  if (verbose_)
1413  std::cout << "METAnalyzer analyze" << std::endl;
1414 
1415  std::string DirName = FolderName_ + metCollectionLabel_.label();
1416 
1417  // ==========================================================
1418  // Trigger information
1419  //
1420  // trigJetMB_=0;
1421  // trigHighPtJet_=0;
1422  // trigLowPtJet_=0;
1423  // trigMinBias_=0;
1424  // trigHighMET_=0;
1425  // // _trig_LowMET=0;
1426  // trigEle_=0;
1427  // trigMuon_=0;
1428  // trigPhysDec_=0;
1429  std::vector<int> triggerFolderDecisions;
1430  triggerFolderDecisions_ = std::vector<int>(triggerFolderEventFlag_.size(), 0);
1431  // **** Get the TriggerResults container
1433  iEvent.getByToken(triggerResultsToken_, triggerResults);
1434 
1435  if (triggerResults.isValid()) {
1437  // Check how many HLT triggers are in triggerResults
1438  int ntrigs = (*triggerResults).size();
1439  if (verbose_)
1440  std::cout << "ntrigs=" << ntrigs << std::endl;
1441  // If index=ntrigs, this HLT trigger doesn't exist in the HLT table for this data.
1442  for (std::vector<GenericTriggerEventFlag*>::const_iterator it = triggerFolderEventFlag_.begin();
1443  it != triggerFolderEventFlag_.end();
1444  it++) {
1445  unsigned int pos = it - triggerFolderEventFlag_.begin();
1446  bool fd = (*it)->accept(iEvent, iSetup);
1447  triggerFolderDecisions_[pos] = fd;
1448  }
1449  }
1450 
1451  // ==========================================================
1452  // MET information
1453 
1454  // **** Get the MET container
1459 
1460  //if(isTCMet_){
1461  //iEvent.getByToken(tcMetToken_, tcmetcoll);
1462  //if(!tcmetcoll.isValid()) return;
1463  //}
1464  if (isCaloMet_) {
1465  iEvent.getByToken(caloMetToken_, calometcoll);
1466  if (!calometcoll.isValid())
1467  return;
1468  }
1469  if (isPFMet_) {
1470  iEvent.getByToken(pfMetToken_, pfmetcoll);
1471  if (!pfmetcoll.isValid())
1472  return;
1473  }
1474  if (isMiniAODMet_) {
1475  iEvent.getByToken(patMetToken_, patmetcoll);
1476  if (!patmetcoll.isValid())
1477  return;
1478  }
1479 
1480  const MET* met = nullptr;
1481  const pat::MET* patmet = nullptr;
1482  const PFMET* pfmet = nullptr;
1483  const CaloMET* calomet = nullptr;
1484  //if(isTCMet_){
1485  //met=&(tcmetcoll->front());
1486  //}
1487  if (isPFMet_) {
1488  assert(!pfmetcoll->empty());
1489  met = &(pfmetcoll->front());
1490  pfmet = &(pfmetcoll->front());
1491  }
1492  if (isCaloMet_) {
1493  assert(!calometcoll->empty());
1494  met = &(calometcoll->front());
1495  calomet = &(calometcoll->front());
1496  }
1497  if (isMiniAODMet_) {
1498  assert(!patmetcoll->empty());
1499  met = &(patmetcoll->front());
1500  patmet = &(patmetcoll->front());
1501  }
1502 
1503  LogTrace("METAnalyzer") << "[METAnalyzer] Call to the MET analyzer";
1504 
1505  // ==========================================================
1506  // TCMET
1507 
1508  //if (/*isTCMet_ || */(isCaloMet_ && metCollectionLabel_.label() == "corMetGlobalMuons")) {
1509 
1510  //iEvent.getByToken(MuonToken_, muonHandle_);
1511  //iEvent.getByToken(TrackToken_, trackHandle_);
1512  //iEvent.getByToken(ElectronToken_, electronHandle_);
1513  //iEvent.getByToken(BeamspotToken_, beamSpotHandle_);
1514  //iEvent.getByToken(tcMETValueMapToken_,tcMetValueMapHandle_);
1515 
1516  //if(!muonHandle_.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve muon data require by MET Task";
1517  //if(!trackHandle_.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve track data require by MET Task";
1518  //if(!electronHandle_.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve electron data require by MET Task";
1519  //if(!beamSpotHandle_.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve beam spot data require by MET Task";
1520 
1521  //beamSpot_ = ( beamSpotHandle_.isValid() ) ? beamSpotHandle_->position() : math::XYZPoint(0, 0, 0);
1522  //}
1523 
1524  // ==========================================================
1525  bool bJetID = false;
1526  bool bDiJetID = false;
1527  // Jet ID -------------------------------------------------------
1528  //
1529 
1534 
1535  int collsize = -1;
1536 
1537  if (isCaloMet_) {
1538  iEvent.getByToken(caloJetsToken_, caloJets);
1539  if (!caloJets.isValid()) {
1540  LogDebug("") << "METAnalyzer: Could not find calojet product" << std::endl;
1541  if (verbose_)
1542  std::cout << "METAnalyzer: Could not find calojet product" << std::endl;
1543  }
1544  collsize = caloJets->size();
1545  }
1547  //if (isTCMet_){
1548  //iEvent.getByToken(jptJetsToken_, jptJets);
1549  //if (!jptJets.isValid()) {
1550  // LogDebug("") << "METAnalyzer: Could not find jptjet product" << std::endl;
1551  // if (verbose_) std::cout << "METAnalyzer: Could not find jptjet product" << std::endl;
1552  //}
1553  //collsize=jptJets->size();
1554  //}*/
1555 
1556  edm::Handle<edm::ValueMap<reco::JetID> > jetID_ValueMap_Handle;
1557  if (/*isTCMet_ || */ isCaloMet_) {
1558  if (!runcosmics_) {
1559  iEvent.getByToken(jetID_ValueMapToken_, jetID_ValueMap_Handle);
1560  }
1561  }
1562 
1563  if (isMiniAODMet_) {
1564  iEvent.getByToken(patJetsToken_, patJets);
1565  if (!patJets.isValid()) {
1566  LogDebug("") << "METAnalyzer: Could not find patjet product" << std::endl;
1567  if (verbose_)
1568  std::cout << "METAnalyzer: Could not find patjet product" << std::endl;
1569  }
1570  collsize = patJets->size();
1571  }
1572 
1573  if (isPFMet_) {
1574  iEvent.getByToken(pfJetsToken_, pfJets);
1575  if (!pfJets.isValid()) {
1576  LogDebug("") << "METAnalyzer: Could not find pfjet product" << std::endl;
1577  if (verbose_)
1578  std::cout << "METAnalyzer: Could not find pfjet product" << std::endl;
1579  }
1580  collsize = pfJets->size();
1581  }
1582 
1583  unsigned int ind1 = -1;
1584  double pt1 = -1;
1585  bool pass_jetID1 = false;
1586  unsigned int ind2 = -1;
1587  double pt2 = -1;
1588  bool pass_jetID2 = false;
1589 
1591  bool pass_correction_flag = false;
1592  if (!isMiniAODMet_) {
1593  iEvent.getByToken(jetCorrectorToken_, jetCorr);
1594  if (jetCorr.isValid()) {
1595  pass_correction_flag = true;
1596  }
1597  } else {
1598  pass_correction_flag = true;
1599  }
1600  //do loose jet ID-> check threshold on corrected jets
1601  for (int ijet = 0; ijet < collsize; ijet++) {
1602  double pt_jet = -10;
1603  double scale = 1.;
1604  bool iscleaned = false;
1605  if (pass_correction_flag) {
1606  if (isCaloMet_) {
1607  scale = jetCorr->correction((*caloJets)[ijet]);
1608  }
1609  //if(isTCMet_){
1610  //scale = jetCorr->correction((*jptJets)[ijet]);
1611  //}
1612  if (isPFMet_) {
1613  scale = jetCorr->correction((*pfJets)[ijet]);
1614  }
1615  }
1616  if (isCaloMet_) {
1617  pt_jet = scale * (*caloJets)[ijet].pt();
1618  if (pt_jet > ptThreshold_) {
1619  reco::CaloJetRef calojetref(caloJets, ijet);
1620  if (!runcosmics_) {
1621  reco::JetID jetID = (*jetID_ValueMap_Handle)[calojetref];
1622  iscleaned = jetIDFunctorLoose((*caloJets)[ijet], jetID);
1623  } else {
1624  iscleaned = true;
1625  }
1626  }
1627  }
1629  //if(isTCMet_){
1630  //pt_jet=scale*(*jptJets)[ijet].pt();
1631  //if(pt_jet> ptThreshold_){
1632  // const edm::RefToBase<reco::Jet>& rawJet = (*jptJets)[ijet].getCaloJetRef();
1633  // const reco::CaloJet *rawCaloJet = dynamic_cast<const reco::CaloJet*>(&*rawJet);
1634  // reco::CaloJetRef const theCaloJetRef = (rawJet).castTo<reco::CaloJetRef>();
1635  // if(!runcosmics_){
1636  // reco::JetID jetID = (*jetID_ValueMap_Handle)[theCaloJetRef];
1637  // iscleaned = jetIDFunctorLoose(*rawCaloJet, jetID);
1638  // }else{
1639  // iscleaned=true;
1640  // }
1641  //}
1642  //}*/
1643  if (isPFMet_) {
1644  pt_jet = scale * (*pfJets)[ijet].pt();
1645  if (pt_jet > ptThreshold_) {
1646  iscleaned = pfjetIDFunctorLoose((*pfJets)[ijet]);
1647  }
1648  }
1649  if (isMiniAODMet_) {
1650  pt_jet = (*patJets)[ijet].pt();
1651  if (pt_jet > ptThreshold_) {
1652  pat::strbitset stringbitset = pfjetIDFunctorLoose.getBitTemplate();
1653  iscleaned = pfjetIDFunctorLoose((*patJets)[ijet], stringbitset);
1654  }
1655  }
1656  if (iscleaned) {
1657  bJetID = true;
1658  }
1659  if (pt_jet > pt1) {
1660  pt2 = pt1;
1661  ind2 = ind1;
1662  pass_jetID2 = pass_jetID1;
1663  pt1 = pt_jet;
1664  ind1 = ijet;
1665  pass_jetID1 = iscleaned;
1666  } else if (pt_jet > pt2) {
1667  pt2 = pt_jet;
1668  ind2 = ijet;
1669  pass_jetID2 = iscleaned;
1670  }
1671  }
1672  if (pass_jetID1 && pass_jetID2) {
1673  double dphi = -1.0;
1674  if (isCaloMet_) {
1675  dphi = fabs((*caloJets)[ind1].phi() - (*caloJets)[ind2].phi());
1676  }
1678  //dphi=fabs((*jptJets)[ind1].phi()-(*jptJets)[ind2].phi());
1679  //}*/
1680  if (isPFMet_) {
1681  dphi = fabs((*pfJets)[ind1].phi() - (*pfJets)[ind2].phi());
1682  }
1683  if (isMiniAODMet_) {
1684  dphi = fabs((*patJets)[0].phi() - (*patJets)[1].phi());
1685  }
1686  if (dphi > acos(-1.)) {
1687  dphi = 2 * acos(-1.) - dphi;
1688  }
1689  if (dphi > 2.7) {
1690  bDiJetID = true;
1691  }
1692  }
1693  // ==========================================================
1694  // ==========================================================
1695  //Vertex information
1696  Handle<VertexCollection> vertexHandle;
1697  iEvent.getByToken(vertexToken_, vertexHandle);
1698 
1699  if (!vertexHandle.isValid()) {
1700  LogDebug("") << "CaloMETAnalyzer: Could not find vertex collection" << std::endl;
1701  if (verbose_)
1702  std::cout << "CaloMETAnalyzer: Could not find vertex collection" << std::endl;
1703  }
1704  numPV_ = 0;
1705  if (vertexHandle.isValid()) {
1706  VertexCollection vertexCollection = *(vertexHandle.product());
1707  numPV_ = vertexCollection.size();
1708  }
1709  bool bPrimaryVertex = (bypassAllPVChecks_ || (numPV_ > 0));
1710 
1711  bool bZJets = false;
1712 
1714  iEvent.getByToken(MuonsToken_, Muons);
1715 
1717 
1718  double pt_muon0 = -1;
1719  double pt_muon1 = -1;
1720  int mu_index0 = -1;
1721  int mu_index1 = -1;
1722  //fill it only for cleaned jets
1723  if (Muons.isValid() && Muons->size() > 1) {
1724  for (unsigned int i = 0; i < Muons->size(); i++) {
1725  bool pass_muon_id = false;
1726  bool pass_muon_iso = false;
1727  double dxy = fabs((*Muons)[i].muonBestTrack()->dxy());
1728  double dz = fabs((*Muons)[i].muonBestTrack()->dz());
1729  if (numPV_ > 0) {
1730  dxy = fabs((*Muons)[i].muonBestTrack()->dxy((*vertexHandle)[0].position()));
1731  dz = fabs((*Muons)[i].muonBestTrack()->dz((*vertexHandle)[0].position()));
1732  }
1733  if ((*Muons)[i].pt() > 20 && fabs((*Muons)[i].eta()) < 2.3) {
1734  if ((*Muons)[i].isGlobalMuon() && (*Muons)[i].isPFMuon() &&
1735  (*Muons)[i].globalTrack()->hitPattern().numberOfValidMuonHits() > 0 &&
1736  (*Muons)[i].numberOfMatchedStations() > 1 && dxy < 0.2 && (*Muons)[i].numberOfMatchedStations() > 1 &&
1737  dz < 0.5 && (*Muons)[i].innerTrack()->hitPattern().numberOfValidPixelHits() > 0 &&
1738  (*Muons)[i].innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5) {
1739  pass_muon_id = true;
1740  }
1741  // Muon pf isolation DB corrected
1742  float muonIsoPFdb =
1743  ((*Muons)[i].pfIsolationR04().sumChargedHadronPt +
1744  std::max(0.,
1745  (*Muons)[i].pfIsolationR04().sumNeutralHadronEt + (*Muons)[i].pfIsolationR04().sumPhotonEt -
1746  0.5 * (*Muons)[i].pfIsolationR04().sumPUPt)) /
1747  (*Muons)[i].pt();
1748  if (muonIsoPFdb < 0.12) {
1749  pass_muon_iso = true;
1750  }
1751 
1752  if (pass_muon_id && pass_muon_iso) {
1753  if ((*Muons)[i].pt() > pt_muon0) {
1754  mu_index1 = mu_index0;
1755  pt_muon1 = pt_muon0;
1756  mu_index0 = i;
1757  pt_muon0 = (*Muons)[i].pt();
1758  } else if ((*Muons)[i].pt() > pt_muon1) {
1759  mu_index1 = i;
1760  pt_muon1 = (*Muons)[i].pt();
1761  }
1762  }
1763  }
1764  }
1765  if (mu_index0 >= 0 && mu_index1 >= 0) {
1766  if ((*Muons)[mu_index0].charge() * (*Muons)[mu_index1].charge() < 0) {
1767  zCand = (*Muons)[mu_index0].polarP4() + (*Muons)[mu_index1].polarP4();
1768  if (fabs(zCand.M() - 91.) < 20) {
1769  bZJets = true;
1770  }
1771  }
1772  }
1773  }
1774 
1775  // ==========================================================
1776 
1778  iEvent.getByToken(gtToken_, gtReadoutRecord);
1779 
1780  bool techTriggerResultBxM2 = false;
1781  bool techTriggerResultBxM1 = false;
1782  bool techTriggerResultBx0 = false;
1783 
1784  if (!gtReadoutRecord.isValid()) {
1785  LogDebug("") << "METAnalyzer: Could not find GT readout record" << std::endl;
1786  if (verbose_)
1787  std::cout << "METAnalyzer: Could not find GT readout record product" << std::endl;
1788  } else {
1789  // trigger results before mask for BxInEvent -2 (E), -1 (F), 0 (L1A), 1, 2
1790  const TechnicalTriggerWord& technicalTriggerWordBeforeMaskBxM2 = gtReadoutRecord->technicalTriggerWord(-2);
1791  const TechnicalTriggerWord& technicalTriggerWordBeforeMaskBxM1 = gtReadoutRecord->technicalTriggerWord(-1);
1792  const TechnicalTriggerWord& technicalTriggerWordBeforeMaskBx0 = gtReadoutRecord->technicalTriggerWord();
1793  //const TechnicalTriggerWord& technicalTriggerWordBeforeMaskBxG = gtReadoutRecord->technicalTriggerWord(1);
1794  //const TechnicalTriggerWord& technicalTriggerWordBeforeMaskBxH = gtReadoutRecord->technicalTriggerWord(2);
1795  if (m_bitAlgTechTrig_ > -1 && !technicalTriggerWordBeforeMaskBx0.empty()) {
1796  techTriggerResultBx0 = technicalTriggerWordBeforeMaskBx0.at(m_bitAlgTechTrig_);
1797  if (techTriggerResultBx0 != 0) {
1798  techTriggerResultBxM2 = technicalTriggerWordBeforeMaskBxM2.at(m_bitAlgTechTrig_);
1799  techTriggerResultBxM1 = technicalTriggerWordBeforeMaskBxM1.at(m_bitAlgTechTrig_);
1800  }
1801  }
1802  }
1803 
1804  std::vector<bool> trigger_flag(4, false);
1805  if (techTriggerResultBx0 && techTriggerResultBxM2 &&
1806  techTriggerResultBxM1) { //current and previous two bunches filled
1807  trigger_flag[0] = true;
1808  }
1809  if (techTriggerResultBx0 && techTriggerResultBxM1) { //current and previous bunch filled
1810  trigger_flag[1] = true;
1811  }
1812  if (techTriggerResultBx0 && !techTriggerResultBxM1) { //current bunch filled, but previous bunch emtpy
1813  trigger_flag[2] = true;
1814  }
1815  if (techTriggerResultBx0 && !techTriggerResultBxM2 &&
1816  !techTriggerResultBxM1) { //current bunch filled, but previous two bunches emtpy
1817  trigger_flag[3] = true;
1818  }
1819  std::vector<bool> filter_decisions(
1820  8, false); //include all recommended filters, old filters in MiniAOD, and 2 new filters in testing phase
1821  if (!isMiniAODMet_ &&
1822  !runcosmics_) { //not checked for MiniAOD -> for miniaod decision filled as "triggerResults" bool
1823  edm::Handle<bool> HBHENoiseFilterResultHandle;
1824  iEvent.getByToken(hbheNoiseFilterResultToken_, HBHENoiseFilterResultHandle);
1825  if (!HBHENoiseFilterResultHandle.isValid()) {
1826  LogDebug("") << "METAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
1827  if (verbose_)
1828  std::cout << "METAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
1829  }
1830  filter_decisions[0] = *HBHENoiseFilterResultHandle;
1831  edm::Handle<bool> CSCTightHaloFilterResultHandle;
1832  iEvent.getByToken(CSCHaloResultToken_, CSCTightHaloFilterResultHandle);
1833  if (!CSCTightHaloFilterResultHandle.isValid()) {
1834  LogDebug("") << "METAnalyzer: Could not find CSCTightHaloFilterResultHandle" << std::endl;
1835  if (verbose_)
1836  std::cout << "METAnalyzer: CSCTightHaloFilterResultHandle" << std::endl;
1837  }
1838  filter_decisions[1] = *CSCTightHaloFilterResultHandle;
1839  edm::Handle<bool> eeBadScFilterResultHandle;
1840  iEvent.getByToken(eeBadScFilterToken_, eeBadScFilterResultHandle);
1841  if (!eeBadScFilterResultHandle.isValid()) {
1842  LogDebug("") << "METAnalyzer: Could not find eeBadScFilterResultHandle" << std::endl;
1843  if (verbose_)
1844  std::cout << "METAnalyzer: eeBadScFilterResultHandle" << std::endl;
1845  }
1846  filter_decisions[2] = *eeBadScFilterResultHandle;
1847  edm::Handle<bool> HBHENoiseIsoFilterResultHandle;
1848  iEvent.getByToken(hbheIsoNoiseFilterResultToken_, HBHENoiseIsoFilterResultHandle);
1849  if (!HBHENoiseIsoFilterResultHandle.isValid()) {
1850  LogDebug("") << "METAnalyzer: Could not find HBHENoiseIsoFilterResult" << std::endl;
1851  if (verbose_)
1852  std::cout << "METAnalyzer: Could not find HBHENoiseIsoFilterResult" << std::endl;
1853  }
1854  filter_decisions[3] = *HBHENoiseIsoFilterResultHandle;
1855  edm::Handle<bool> CSCTightHalo2015FilterResultHandle;
1856  iEvent.getByToken(CSCHalo2015ResultToken_, CSCTightHalo2015FilterResultHandle);
1857  if (!CSCTightHalo2015FilterResultHandle.isValid()) {
1858  LogDebug("") << "METAnalyzer: Could not find CSCTightHalo2015FilterResultHandle" << std::endl;
1859  if (verbose_)
1860  std::cout << "METAnalyzer: CSCTightHalo2015FilterResultHandle" << std::endl;
1861  }
1862  filter_decisions[4] = *CSCTightHalo2015FilterResultHandle;
1863  edm::Handle<bool> EcalDeadCellTriggerFilterResultHandle;
1864  iEvent.getByToken(EcalDeadCellTriggerToken_, EcalDeadCellTriggerFilterResultHandle);
1865  if (!EcalDeadCellTriggerFilterResultHandle.isValid()) {
1866  LogDebug("") << "METAnalyzer: Could not find EcalDeadCellTriggerFilterResultHandle" << std::endl;
1867  if (verbose_)
1868  std::cout << "METAnalyzer: EcalDeadCellTriggerFilterResultHandle" << std::endl;
1869  }
1870  filter_decisions[5] = *EcalDeadCellTriggerFilterResultHandle;
1871  edm::Handle<bool> EcalDeadCellBoundaryHandle;
1872  iEvent.getByToken(EcalDeadCellBoundaryToken_, EcalDeadCellBoundaryHandle);
1873  if (!EcalDeadCellBoundaryHandle.isValid()) {
1874  LogDebug("") << "METAnalyzer: Could not find EcalDeadCellBoundaryHandle" << std::endl;
1875  if (verbose_)
1876  std::cout << "METAnalyzer: EcalDeadCellBoundaryHandle" << std::endl;
1877  }
1878  filter_decisions[6] = *EcalDeadCellBoundaryHandle;
1879  edm::Handle<bool> HcalStripHaloFilterHandle;
1880  iEvent.getByToken(HcalStripHaloToken_, HcalStripHaloFilterHandle);
1881  if (!HcalStripHaloFilterHandle.isValid()) {
1882  LogDebug("") << "METAnalyzer: Could not find CSCTightHalo2015FilterResultHandle" << std::endl;
1883  if (verbose_)
1884  std::cout << "METAnalyzer: CSCTightHalo2015FilterResultHandle" << std::endl;
1885  }
1886  filter_decisions[7] = *HcalStripHaloFilterHandle;
1887  } else if (isMiniAODMet_) {
1888  //miniaodFilterIndex_ is only filled in dqmBeginRun if isMiniAODMet_ true
1889  edm::Handle<edm::TriggerResults> metFilterResults;
1890  iEvent.getByToken(METFilterMiniAODToken_, metFilterResults);
1891  if (metFilterResults.isValid()) {
1892  if (miniaodFilterIndex_[0] != -1) {
1893  filter_decisions[0] = metFilterResults->accept(miniaodFilterIndex_[0]);
1894  }
1895  if (miniaodFilterIndex_[1] != -1) {
1896  filter_decisions[1] = metFilterResults->accept(miniaodFilterIndex_[1]);
1897  }
1898  if (miniaodFilterIndex_[2] != -1) {
1899  filter_decisions[2] = metFilterResults->accept(miniaodFilterIndex_[2]);
1900  }
1901  if (miniaodFilterIndex_[3] != -1) {
1902  filter_decisions[3] = metFilterResults->accept(miniaodFilterIndex_[3]);
1903  }
1904  if (miniaodFilterIndex_[4] != -1) {
1905  filter_decisions[4] = metFilterResults->accept(miniaodFilterIndex_[4]);
1906  }
1907  if (miniaodFilterIndex_[5] != -1) {
1908  filter_decisions[5] = metFilterResults->accept(miniaodFilterIndex_[5]);
1909  }
1910  if (miniaodFilterIndex_[6] != -1) {
1911  filter_decisions[6] = metFilterResults->accept(miniaodFilterIndex_[6]);
1912  }
1913  if (miniaodFilterIndex_[7] != -1) {
1914  filter_decisions[7] = metFilterResults->accept(miniaodFilterIndex_[7]);
1915  }
1916  } else {
1917  iEvent.getByToken(METFilterMiniAODToken2_, metFilterResults);
1918  if (metFilterResults.isValid()) {
1919  if (miniaodFilterIndex_[0] != -1) {
1920  filter_decisions[0] = metFilterResults->accept(miniaodFilterIndex_[0]);
1921  }
1922  if (miniaodFilterIndex_[1] != -1) {
1923  filter_decisions[1] = metFilterResults->accept(miniaodFilterIndex_[1]);
1924  }
1925  if (miniaodFilterIndex_[2] != -1) {
1926  filter_decisions[2] = metFilterResults->accept(miniaodFilterIndex_[2]);
1927  }
1928  if (miniaodFilterIndex_[3] != -1) {
1929  filter_decisions[3] = metFilterResults->accept(miniaodFilterIndex_[3]);
1930  }
1931  if (miniaodFilterIndex_[4] != -1) {
1932  filter_decisions[4] = metFilterResults->accept(miniaodFilterIndex_[4]);
1933  }
1934  if (miniaodFilterIndex_[5] != -1) {
1935  filter_decisions[5] = metFilterResults->accept(miniaodFilterIndex_[5]);
1936  }
1937  if (miniaodFilterIndex_[6] != -1) {
1938  filter_decisions[6] = metFilterResults->accept(miniaodFilterIndex_[6]);
1939  }
1940  if (miniaodFilterIndex_[7] != -1) {
1941  filter_decisions[7] = metFilterResults->accept(miniaodFilterIndex_[7]);
1942  }
1943  }
1944  }
1945  }
1946  bool HBHENoiseFilterResultFlag = filter_decisions[0]; //setup for RECO and MINIAOD
1947  // ==========================================================
1948  // HCAL Noise filter
1949  bool bHBHENoiseFilter = HBHENoiseFilterResultFlag;
1950 
1951  // DCS Filter
1952  bool bDCSFilter = (bypassAllDCSChecks_ || DCSFilter_->filter(iEvent, iSetup));
1953  // ==========================================================
1954  // Reconstructed MET Information - fill MonitorElements
1955  std::string DirName_old = DirName;
1956  for (std::vector<std::string>::const_iterator ic = folderNames_.begin(); ic != folderNames_.end(); ic++) {
1957  bool pass_selection = false;
1958  if ((*ic == "Uncleaned") && (isCaloMet_ || bPrimaryVertex)) {
1959  fillMESet(iEvent,
1960  DirName_old + "/" + *ic,
1961  *met,
1962  patmet,
1963  pfmet,
1964  calomet,
1965  zCand,
1966  map_dijet_MEs,
1967  trigger_flag,
1968  filter_decisions);
1969  pass_selection = true;
1970  }
1971  //take two lines out for first check
1972  if ((*ic == "Cleaned") && bDCSFilter && bHBHENoiseFilter && bPrimaryVertex && bJetID) {
1973  fillMESet(iEvent,
1974  DirName_old + "/" + *ic,
1975  *met,
1976  patmet,
1977  pfmet,
1978  calomet,
1979  zCand,
1980  map_dijet_MEs,
1981  trigger_flag,
1982  filter_decisions);
1983  pass_selection = true;
1984  }
1985  if ((*ic == "DiJet") && bDCSFilter && bHBHENoiseFilter && bPrimaryVertex && bDiJetID) {
1986  fillMESet(iEvent,
1987  DirName_old + "/" + *ic,
1988  *met,
1989  patmet,
1990  pfmet,
1991  calomet,
1992  zCand,
1993  map_dijet_MEs,
1994  trigger_flag,
1995  filter_decisions);
1996  pass_selection = true;
1997  }
1998  if ((*ic == "ZJets") && bDCSFilter && bHBHENoiseFilter && bPrimaryVertex && bZJets) {
1999  fillMESet(iEvent,
2000  DirName_old + "/" + *ic,
2001  *met,
2002  patmet,
2003  pfmet,
2004  calomet,
2005  zCand,
2006  map_dijet_MEs,
2007  trigger_flag,
2008  filter_decisions);
2009  pass_selection = true;
2010  }
2011  if (pass_selection && isPFMet_) {
2012  DirName = DirName_old + "/" + *ic;
2013  }
2014  }
2015 }
2016 
2017 // ***********************************************************
2020  const reco::MET& met,
2021  const pat::MET* patmet,
2022  const reco::PFMET* pfmet,
2023  const reco::CaloMET* calomet,
2025  std::map<std::string, MonitorElement*>& map_of_MEs,
2026  std::vector<bool> techTriggerCase,
2027  std::vector<bool> METFilterDecision) {
2028  bool bLumiSecPlot = fill_met_high_level_histo;
2029  bool fillPFCandidatePlots = false;
2030  if (DirName.find("Cleaned") != std::string::npos) {
2031  fillPFCandidatePlots = true;
2032  fillMonitorElement(iEvent,
2033  DirName,
2034  std::string(""),
2035  met,
2036  patmet,
2037  pfmet,
2038  calomet,
2039  zCand,
2040  map_of_MEs,
2041  bLumiSecPlot,
2042  fillPFCandidatePlots,
2043  techTriggerCase,
2044  METFilterDecision);
2045  for (unsigned int i = 0; i < triggerFolderLabels_.size(); i++) {
2046  fillPFCandidatePlots = false;
2047  if (triggerFolderDecisions_[i]) {
2048  fillMonitorElement(iEvent,
2049  DirName,
2050  triggerFolderLabels_[i],
2051  met,
2052  patmet,
2053  pfmet,
2054  calomet,
2055  zCand,
2056  map_of_MEs,
2057  bLumiSecPlot,
2058  fillPFCandidatePlots,
2059  techTriggerCase,
2060  METFilterDecision);
2061  }
2062  }
2063  } else if (DirName.find("DiJet") != std::string::npos) {
2064  fillMonitorElement(iEvent,
2065  DirName,
2066  std::string(""),
2067  met,
2068  patmet,
2069  pfmet,
2070  calomet,
2071  zCand,
2072  map_of_MEs,
2073  bLumiSecPlot,
2074  fillPFCandidatePlots,
2075  techTriggerCase,
2076  METFilterDecision);
2077  for (unsigned int i = 0; i < triggerFolderLabels_.size(); i++) {
2078  if (triggerFolderDecisions_[i])
2079  fillMonitorElement(iEvent,
2080  DirName,
2081  triggerFolderLabels_[i],
2082  met,
2083  patmet,
2084  pfmet,
2085  calomet,
2086  zCand,
2087  map_of_MEs,
2088  bLumiSecPlot,
2089  fillPFCandidatePlots,
2090  techTriggerCase,
2091  METFilterDecision);
2092  }
2093  } else if (DirName.find("ZJets") != std::string::npos) {
2094  fillMonitorElement(iEvent,
2095  DirName,
2096  std::string(""),
2097  met,
2098  patmet,
2099  pfmet,
2100  calomet,
2101  zCand,
2102  map_of_MEs,
2103  bLumiSecPlot,
2104  fillPFCandidatePlots,
2105  techTriggerCase,
2106  METFilterDecision);
2107  } else {
2108  fillMonitorElement(iEvent,
2109  DirName,
2110  std::string(""),
2111  met,
2112  patmet,
2113  pfmet,
2114  calomet,
2115  zCand,
2116  map_of_MEs,
2117  bLumiSecPlot,
2118  fillPFCandidatePlots,
2119  techTriggerCase,
2120  METFilterDecision);
2121  }
2122 }
2123 
2124 // ***********************************************************
2127  std::string subFolderName,
2128  const reco::MET& met,
2129  const pat::MET* patmet,
2130  const reco::PFMET* pfmet,
2131  const reco::CaloMET* calomet,
2133  std::map<std::string, MonitorElement*>& map_of_MEs,
2134  bool bLumiSecPlot,
2135  bool fillPFCandidatePlots,
2136  std::vector<bool> techTriggerCase,
2137  std::vector<bool> METFilterDecision) {
2138  bool do_only_Z_histograms = false;
2139  if (DirName.find("ZJets") != std::string::npos) { //do Z plots only
2140  do_only_Z_histograms = true;
2141  //\vec{p}_{T}^{Z}+vec{u}_{T}+\vec{MET}=0
2142 
2143  double u_x = -met.px() - zCand.Px();
2144  double u_y = -met.py() - zCand.Py();
2145 
2146  //protection for VERY special case where Z-Pt==0
2147  double u_par = 0;
2148  double u_perp = sqrt(u_x * u_x + u_y * u_y);
2149  double e_Z_x = 0;
2150  double e_Z_y = 0;
2151  if (zCand.Pt() != 0) {
2152  e_Z_x = zCand.Px() / zCand.Pt();
2153  e_Z_y = zCand.Py() / zCand.Pt();
2154  }
2155  u_par = u_x * e_Z_x + u_y * e_Z_y;
2156  u_perp = -e_Z_y * u_x + e_Z_x * u_y;
2157 
2158  meZJets_u_par = map_of_MEs[DirName + "/" + "u_parallel_Z_inc"];
2159  if (meZJets_u_par && meZJets_u_par->getRootObject())
2160  meZJets_u_par->Fill(u_par);
2161  if (zCand.Pt() < 15) {
2162  meZJets_u_par_ZPt_0_15 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_0_15"];
2163  if (meZJets_u_par_ZPt_0_15 && meZJets_u_par_ZPt_0_15->getRootObject())
2164  meZJets_u_par_ZPt_0_15->Fill(u_par);
2165  } else if (zCand.Pt() < 30) {
2166  meZJets_u_par_ZPt_15_30 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_15_30"];
2167  if (meZJets_u_par_ZPt_15_30 && meZJets_u_par_ZPt_15_30->getRootObject())
2168  meZJets_u_par_ZPt_15_30->Fill(u_par);
2169  } else if (zCand.Pt() < 55) {
2170  meZJets_u_par_ZPt_30_55 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_30_55"];
2171  if (meZJets_u_par_ZPt_30_55 && meZJets_u_par_ZPt_30_55->getRootObject())
2172  meZJets_u_par_ZPt_30_55->Fill(u_par);
2173  } else if (zCand.Pt() < 75) {
2174  meZJets_u_par_ZPt_55_75 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_55_75"];
2175  if (meZJets_u_par_ZPt_55_75 && meZJets_u_par_ZPt_55_75->getRootObject())
2176  meZJets_u_par_ZPt_55_75->Fill(u_par);
2177  } else if (zCand.Pt() < 150) {
2178  meZJets_u_par_ZPt_75_150 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_75_150"];
2179  if (meZJets_u_par_ZPt_75_150 && meZJets_u_par_ZPt_75_150->getRootObject())
2180  meZJets_u_par_ZPt_75_150->Fill(u_par);
2181  } else if (zCand.Pt() < 290) {
2182  meZJets_u_par_ZPt_150_290 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_150_290"];
2183  if (meZJets_u_par_ZPt_150_290 && meZJets_u_par_ZPt_150_290->getRootObject())
2184  meZJets_u_par_ZPt_150_290->Fill(u_par);
2185  } else {
2186  meZJets_u_par_ZPt_290 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_290"];
2187  if (meZJets_u_par_ZPt_290 && meZJets_u_par_ZPt_290->getRootObject())
2188  meZJets_u_par_ZPt_290->Fill(u_par);
2189  }
2190 
2191  meZJets_u_perp = map_of_MEs[DirName + "/" + "u_perp_Z_inc"];
2192  if (meZJets_u_perp && meZJets_u_perp->getRootObject())
2193  meZJets_u_perp->Fill(u_perp);
2194  if (zCand.Pt() < 15) {
2195  meZJets_u_perp_ZPt_0_15 = map_of_MEs[DirName + "/" + "u_perp_ZPt_0_15"];
2196  if (meZJets_u_perp_ZPt_0_15 && meZJets_u_perp_ZPt_0_15->getRootObject())
2197  meZJets_u_perp_ZPt_0_15->Fill(u_perp);
2198  } else if (zCand.Pt() < 30) {
2199  meZJets_u_perp_ZPt_15_30 = map_of_MEs[DirName + "/" + "u_perp_ZPt_15_30"];
2200  if (meZJets_u_perp_ZPt_15_30 && meZJets_u_perp_ZPt_15_30->getRootObject())
2201  meZJets_u_perp_ZPt_15_30->Fill(u_perp);
2202  } else if (zCand.Pt() < 55) {
2203  meZJets_u_perp_ZPt_30_55 = map_of_MEs[DirName + "/" + "u_perp_ZPt_30_55"];
2204  if (meZJets_u_perp_ZPt_30_55 && meZJets_u_perp_ZPt_30_55->getRootObject())
2205  meZJets_u_perp_ZPt_30_55->Fill(u_perp);
2206  } else if (zCand.Pt() < 75) {
2207  meZJets_u_perp_ZPt_55_75 = map_of_MEs[DirName + "/" + "u_perp_ZPt_55_75"];
2208  if (meZJets_u_perp_ZPt_55_75 && meZJets_u_perp_ZPt_55_75->getRootObject())
2209  meZJets_u_perp_ZPt_55_75->Fill(u_perp);
2210  } else if (zCand.Pt() < 150) {
2211  meZJets_u_perp_ZPt_75_150 = map_of_MEs[DirName + "/" + "u_perp_ZPt_75_150"];
2212  if (meZJets_u_perp_ZPt_75_150 && meZJets_u_perp_ZPt_75_150->getRootObject())
2213  meZJets_u_perp_ZPt_75_150->Fill(u_perp);
2214  } else if (zCand.Pt() < 290) {
2215  meZJets_u_perp_ZPt_150_290 = map_of_MEs[DirName + "/" + "u_perp_ZPt_150_290"];
2216  if (meZJets_u_perp_ZPt_150_290 && meZJets_u_perp_ZPt_150_290->getRootObject())
2217  meZJets_u_perp_ZPt_150_290->Fill(u_perp);
2218  } else {
2219  meZJets_u_perp_ZPt_290 = map_of_MEs[DirName + "/" + "u_perp_ZPt_290"];
2220  if (meZJets_u_perp_ZPt_290 && meZJets_u_perp_ZPt_290->getRootObject())
2221  meZJets_u_perp_ZPt_290->Fill(u_perp);
2222  }
2223  }
2224  if (!do_only_Z_histograms) {
2225  // Reconstructed MET Information
2226  double SumET = met.sumEt();
2227  double METSig = met.mEtSig();
2228  //double Ez = met.e_longitudinal();
2229  double MET = met.pt();
2230  double MEx = met.px();
2231  double MEy = met.py();
2232  double METPhi = met.phi();
2233  //
2234  int myLuminosityBlock;
2235  myLuminosityBlock = iEvent.luminosityBlock();
2236  //
2237 
2238  if (!subFolderName.empty()) {
2239  DirName = DirName + "/" + subFolderName;
2240  }
2241 
2242  hMEx = map_of_MEs[DirName + "/" + "MEx"];
2243  if (hMEx && hMEx->getRootObject())
2244  hMEx->Fill(MEx);
2245  hMEy = map_of_MEs[DirName + "/" + "MEy"];
2246  if (hMEy && hMEy->getRootObject())
2247  hMEy->Fill(MEy);
2248  hMET = map_of_MEs[DirName + "/" + "MET"];
2249  if (hMET && hMET->getRootObject())
2250  hMET->Fill(MET);
2251  hMET_2 = map_of_MEs[DirName + "/" + "MET_2"];
2252  if (hMET_2 && hMET_2->getRootObject())
2253  hMET_2->Fill(MET);
2254 
2255  //hMET_HBHENoiseFilter = ibooker.book1D("MET_HBHENoiseFilter", "MET_HBHENoiseFiltered", 200, 0, 1000);
2256  //hMET_CSCTightHaloFilter = ibooker.book1D("MET_CSCTightHaloFilter", "MET_CSCTightHaloFiltered", 200, 0, 1000);
2257  //hMET_eeBadScFilter = ibooker.book1D("MET_eeBadScFilter", "MET_eeBadScFiltered", 200, 0, 1000);
2258  //hMET_HBHEIsoNoiseFilter = ibooker.book1D("MET_HBHEIsoNoiseFilter", "MET_HBHEIsoNoiseFiltered", 200, 0, 1000);
2259  //hMET_CSCTightHalo2015Filter = ibooker.book1D("MET_CSCTightHalo2015Filter", "MET_CSCTightHalo2015Filtered", 200, 0, 1000);
2260  //hMET_EcalDeadCellTriggerFilter = ibooker.book1D("MET_EcalDeadCellTriggerFilter", "MET_EcalDeadCellTriggerFiltered", 200, 0, 1000);
2261  //hMET_EcalDeadCellBoundaryFilter = ibooker.book1D("MET_EcalDeadCellBoundaryFilter", "MET_EcalDeadCellBoundaryFiltered", 200, 0, 1000);
2262  //hMET_HcalStripHaloFilter = ibooker.book1D("MET_HcalStripHaloFilter", "MET_HcalStripHaloFiltered", 200, 0, 1000);
2263 
2264  bool HBHENoiseFilterResult = false;
2265  bool CSCTightHaloFilterResult = false;
2266  bool eeBadScFilterResult = false;
2267  bool HBHEIsoNoiseFilterResult = false;
2268  bool CSCTightHalo2015FilterResult = false;
2269  bool EcalDeadCellTriggerFilterResult = false;
2270  bool EcalDeadCellBoundaryFilterResult = false;
2271  bool HcalStripHaloFilterResult = false;
2272  HBHENoiseFilterResult = METFilterDecision[0];
2273  if (HBHENoiseFilterResult) {
2274  hMET_HBHENoiseFilter = map_of_MEs[DirName + "/" + "MET_HBHENoiseFilter"];
2275  if (hMET_HBHENoiseFilter && hMET_HBHENoiseFilter->getRootObject())
2276  hMET_HBHENoiseFilter->Fill(MET);
2277  }
2278  CSCTightHaloFilterResult = METFilterDecision[1];
2279  if (CSCTightHaloFilterResult) {
2280  hMET_CSCTightHaloFilter = map_of_MEs[DirName + "/" + "MET_CSCTightHaloFilter"];
2281  if (hMET_CSCTightHaloFilter && hMET_CSCTightHaloFilter->getRootObject())
2282  hMET_CSCTightHaloFilter->Fill(MET);
2283  }
2284  eeBadScFilterResult = METFilterDecision[2];
2285  if (eeBadScFilterResult) {
2286  hMET_eeBadScFilter = map_of_MEs[DirName + "/" + "MET_eeBadScFilter"];
2287  if (hMET_eeBadScFilter && hMET_eeBadScFilter->getRootObject())
2288  hMET_eeBadScFilter->Fill(MET);
2289  }
2290  HBHEIsoNoiseFilterResult = METFilterDecision[3];
2291  if (HBHEIsoNoiseFilterResult) {
2292  hMET_HBHEIsoNoiseFilter = map_of_MEs[DirName + "/" + "MET_HBHEIsoNoiseFilter"];
2293  if (hMET_HBHEIsoNoiseFilter && hMET_HBHEIsoNoiseFilter->getRootObject())
2294  hMET_HBHEIsoNoiseFilter->Fill(MET);
2295  }
2296  CSCTightHalo2015FilterResult = METFilterDecision[4];
2297  if (CSCTightHalo2015FilterResult) {
2298  hMET_CSCTightHalo2015Filter = map_of_MEs[DirName + "/" + "MET_CSCTightHalo2015Filter"];
2299  if (hMET_CSCTightHalo2015Filter && hMET_CSCTightHalo2015Filter->getRootObject())
2300  hMET_CSCTightHalo2015Filter->Fill(MET);
2301  }
2302  EcalDeadCellTriggerFilterResult = METFilterDecision[5];
2303  if (EcalDeadCellTriggerFilterResult) {
2304  hMET_EcalDeadCellTriggerFilter = map_of_MEs[DirName + "/" + "MET_EcalDeadCellTriggerFilter"];
2305  if (hMET_EcalDeadCellTriggerFilter && hMET_EcalDeadCellTriggerFilter->getRootObject())
2306  hMET_EcalDeadCellTriggerFilter->Fill(MET);
2307  }
2308  EcalDeadCellBoundaryFilterResult = METFilterDecision[6];
2309  if (EcalDeadCellBoundaryFilterResult) {
2310  hMET_EcalDeadCellBoundaryFilter = map_of_MEs[DirName + "/" + "MET_EcalDeadCellBoundaryFilter"];
2311  if (hMET_EcalDeadCellBoundaryFilter && hMET_EcalDeadCellBoundaryFilter->getRootObject())
2312  hMET_EcalDeadCellBoundaryFilter->Fill(MET);
2313  }
2314  HcalStripHaloFilterResult = METFilterDecision[7];
2315  if (HcalStripHaloFilterResult) {
2316  hMET_HcalStripHaloFilter = map_of_MEs[DirName + "/" + "MET_HcalStripHaloFilter"];
2317  if (hMET_HcalStripHaloFilter && hMET_HcalStripHaloFilter->getRootObject())
2318  hMET_HcalStripHaloFilter->Fill(MET);
2319  }
2320  hMETPhi = map_of_MEs[DirName + "/" + "METPhi"];
2321  if (hMETPhi && hMETPhi->getRootObject())
2322  hMETPhi->Fill(METPhi);
2323  hSumET = map_of_MEs[DirName + "/" + "SumET"];
2324  if (hSumET && hSumET->getRootObject())
2325  hSumET->Fill(SumET);
2326  hMETSig = map_of_MEs[DirName + "/" + "METSig"];
2327  if (hMETSig && hMETSig->getRootObject())
2328  hMETSig->Fill(METSig);
2329  hMET_logx = map_of_MEs[DirName + "/" + "MET_logx"];
2330  if (hMET_logx && hMET_logx->getRootObject())
2331  hMET_logx->Fill(log10(MET));
2332  hSumET_logx = map_of_MEs[DirName + "/" + "SumET_logx"];
2333  if (hSumET_logx && hSumET_logx->getRootObject())
2334  hSumET_logx->Fill(log10(SumET));
2335 
2336  // Fill NPV profiles
2337  //--------------------------------------------------------------------------
2338  meMEx_profile = map_of_MEs[DirName + "/MEx_profile"];
2339  meMEy_profile = map_of_MEs[DirName + "/MEy_profile"];
2340  meMET_profile = map_of_MEs[DirName + "/MET_profile"];
2341  meSumET_profile = map_of_MEs[DirName + "/SumET_profile"];
2342 
2343  if (meMEx_profile && meMEx_profile->getRootObject())
2344  meMEx_profile->Fill(numPV_, MEx);
2345  if (meMEy_profile && meMEy_profile->getRootObject())
2346  meMEy_profile->Fill(numPV_, MEy);
2347  if (meMET_profile && meMET_profile->getRootObject())
2348  meMET_profile->Fill(numPV_, MET);
2349  if (meSumET_profile && meSumET_profile->getRootObject())
2350  meSumET_profile->Fill(numPV_, SumET);
2351 
2352  if (isCaloMet_) {
2353  //const reco::CaloMETCollection *calometcol = calometcoll.product();
2354  //const reco::CaloMET *calomet;
2355  //calomet = &(calometcol->front());
2356 
2357  double caloEtFractionHadronic = calomet->etFractionHadronic();
2358  double caloEmEtFraction = calomet->emEtFraction();
2359 
2360  double caloHadEtInHB = calomet->hadEtInHB();
2361  double caloHadEtInHO = calomet->hadEtInHO();
2362  double caloHadEtInHE = calomet->hadEtInHE();
2363  double caloHadEtInHF = calomet->hadEtInHF();
2364  double caloEmEtInEB = calomet->emEtInEB();
2365  double caloEmEtInEE = calomet->emEtInEE();
2366  double caloEmEtInHF = calomet->emEtInHF();
2367 
2368  hCaloHadEtInHB = map_of_MEs[DirName + "/" + "CaloHadEtInHB"];
2369  if (hCaloHadEtInHB && hCaloHadEtInHB->getRootObject())
2370  hCaloHadEtInHB->Fill(caloHadEtInHB);
2371  hCaloHadEtInHO = map_of_MEs[DirName + "/" + "CaloHadEtInHO"];
2372  if (hCaloHadEtInHO && hCaloHadEtInHO->getRootObject())
2373  hCaloHadEtInHO->Fill(caloHadEtInHO);
2374  hCaloHadEtInHE = map_of_MEs[DirName + "/" + "CaloHadEtInHE"];
2375  if (hCaloHadEtInHE && hCaloHadEtInHE->getRootObject())
2376  hCaloHadEtInHE->Fill(caloHadEtInHE);
2377  hCaloHadEtInHF = map_of_MEs[DirName + "/" + "CaloHadEtInHF"];
2378  if (hCaloHadEtInHF && hCaloHadEtInHF->getRootObject())
2379  hCaloHadEtInHF->Fill(caloHadEtInHF);
2380  hCaloEmEtInEB = map_of_MEs[DirName + "/" + "CaloEmEtInEB"];
2381  if (hCaloEmEtInEB && hCaloEmEtInEB->getRootObject())
2382  hCaloEmEtInEB->Fill(caloEmEtInEB);
2383  hCaloEmEtInEE = map_of_MEs[DirName + "/" + "CaloEmEtInEE"];
2384  if (hCaloEmEtInEE && hCaloEmEtInEE->getRootObject())
2385  hCaloEmEtInEE->Fill(caloEmEtInEE);
2386  hCaloEmEtInHF = map_of_MEs[DirName + "/" + "CaloEmEtInHF"];
2387  if (hCaloEmEtInHF && hCaloEmEtInHF->getRootObject())
2388  hCaloEmEtInHF->Fill(caloEmEtInHF);
2389 
2390  hCaloMETPhi020 = map_of_MEs[DirName + "/" + "CaloMETPhi020"];
2391  if (MET > 20. && hCaloMETPhi020 && hCaloMETPhi020->getRootObject()) {
2392  hCaloMETPhi020->Fill(METPhi);
2393  }
2394 
2395  hCaloEtFractionHadronic = map_of_MEs[DirName + "/" + "CaloEtFractionHadronic"];
2396  if (hCaloEtFractionHadronic && hCaloEtFractionHadronic->getRootObject())
2397  hCaloEtFractionHadronic->Fill(caloEtFractionHadronic);
2398  hCaloEmEtFraction = map_of_MEs[DirName + "/" + "CaloEmEtFraction"];
2399  if (hCaloEmEtFraction && hCaloEmEtFraction->getRootObject())
2400  hCaloEmEtFraction->Fill(caloEmEtFraction);
2401  hCaloEmEtFraction020 = map_of_MEs[DirName + "/" + "CaloEmEtFraction020"];
2402  if (MET > 20. && hCaloEmEtFraction020 && hCaloEmEtFraction020->getRootObject())
2403  hCaloEmEtFraction020->Fill(caloEmEtFraction);
2404  }
2405  if (isPFMet_) {
2406  if (fillPFCandidatePlots && fillCandidateMap_histos) {
2407  for (unsigned int i = 0; i < countsPFCand_.size(); i++) {
2408  countsPFCand_[i] = 0;
2409  MExPFCand_[i] = 0.;
2410  MEyPFCand_[i] = 0.;
2411  }
2412 
2413  // typedef std::vector<reco::PFCandidate> pfCand;
2415  iEvent.getByToken(pflowToken_, particleFlow);
2416 
2417  float pt_sum_CHF_Barrel = 0;
2418  float pt_sum_CHF_Endcap_plus = 0;
2419  float pt_sum_CHF_Endcap_minus = 0;
2420  float pt_sum_NHF_Barrel = 0;
2421  float pt_sum_NHF_Endcap_plus = 0;
2422  float pt_sum_NHF_Endcap_minus = 0;
2423  float pt_sum_PhF_Barrel = 0;
2424  float pt_sum_PhF_Endcap_plus = 0;
2425  float pt_sum_PhF_Endcap_minus = 0;
2426  float pt_sum_HFH_plus = 0;
2427  float pt_sum_HFH_minus = 0;
2428  float pt_sum_HFE_plus = 0;
2429  float pt_sum_HFE_minus = 0;
2430 
2431  float px_chargedHadronsBarrel = 0;
2432  float py_chargedHadronsBarrel = 0;
2433  float px_chargedHadronsEndcapPlus = 0;
2434  float py_chargedHadronsEndcapPlus = 0;
2435  float px_chargedHadronsEndcapMinus = 0;
2436  float py_chargedHadronsEndcapMinus = 0;
2437  float px_neutralHadronsBarrel = 0;
2438  float py_neutralHadronsBarrel = 0;
2439  float px_neutralHadronsEndcapPlus = 0;
2440  float py_neutralHadronsEndcapPlus = 0;
2441  float px_neutralHadronsEndcapMinus = 0;
2442  float py_neutralHadronsEndcapMinus = 0;
2443  float px_PhotonsBarrel = 0;
2444  float py_PhotonsBarrel = 0;
2445  float px_PhotonsEndcapPlus = 0;
2446  float py_PhotonsEndcapPlus = 0;
2447  float px_PhotonsEndcapMinus = 0;
2448  float py_PhotonsEndcapMinus = 0;
2449  float px_HFHadronsPlus = 0;
2450  float py_HFHadronsPlus = 0;
2451  float px_HFHadronsMinus = 0;
2452  float py_HFHadronsMinus = 0;
2453  float px_HFEGammasPlus = 0;
2454  float py_HFEGammasPlus = 0;
2455  float px_HFEGammasMinus = 0;
2456  float py_HFEGammasMinus = 0;
2457  for (unsigned int i = 0; i < particleFlow->size(); i++) {
2458  const reco::PFCandidate& c = particleFlow->at(i);
2459  if (c.particleId() == 1) { //charged hadrons
2460  //endcap minus
2461  if (c.eta() > (-3.0) && c.eta() < (-1.392)) {
2462  px_chargedHadronsEndcapMinus -= c.px();
2463  py_chargedHadronsEndcapMinus -= c.py();
2464  pt_sum_CHF_Endcap_minus += c.et();
2465  } else if (c.eta() >= (-1.392) && c.eta() <= 1.392) { //barrel
2466  px_chargedHadronsBarrel -= c.px();
2467  py_chargedHadronsBarrel -= c.py();
2468  pt_sum_CHF_Barrel += c.et();
2469  } else if (c.eta() > 1.392 && c.eta() < 3.0) { //endcap plus
2470  px_chargedHadronsEndcapPlus -= c.px();
2471  py_chargedHadronsEndcapPlus -= c.py();
2472  pt_sum_CHF_Endcap_plus += c.et();
2473  }
2474  }
2475  if (c.particleId() == 5) { //neutral hadrons
2476  //endcap minus
2477  if (c.eta() > (-3.0) && c.eta() < (-1.392)) {
2478  px_neutralHadronsEndcapMinus -= c.px();
2479  py_neutralHadronsEndcapMinus -= c.py();
2480  pt_sum_NHF_Endcap_minus += c.et();
2481  } else if (c.eta() >= (-1.392) && c.eta() <= 1.392) {
2482  px_neutralHadronsBarrel -= c.px();
2483  py_neutralHadronsBarrel -= c.py();
2484  pt_sum_NHF_Barrel += c.et();
2485  } else if (c.eta() > 1.392 && c.eta() < 3.0) {
2486  px_neutralHadronsEndcapPlus -= c.px();
2487  py_neutralHadronsEndcapPlus -= c.py();
2488  pt_sum_NHF_Endcap_plus += c.et();
2489  }
2490  }
2491  if (c.particleId() == 4) { //photons
2492  //endcap minus
2493  if (c.eta() > (-3.0) && c.eta() < (-1.479)) {
2494  px_PhotonsEndcapMinus -= c.px();
2495  py_PhotonsEndcapMinus -= c.py();
2496  pt_sum_PhF_Endcap_minus += c.et();
2497  } else if (c.eta() >= (-1.479) && c.eta() <= 1.479) {
2498  px_PhotonsBarrel -= c.px();
2499  py_PhotonsBarrel -= c.py();
2500  pt_sum_PhF_Barrel += c.et();
2501  } else if (c.eta() > 1.479 && c.eta() < 3.0) {
2502  px_PhotonsEndcapPlus -= c.px();
2503  py_PhotonsEndcapPlus -= c.py();
2504  pt_sum_PhF_Endcap_plus += c.et();
2505  }
2506  }
2507  if (c.particleId() == 6) { //HFHadrons
2508  //forward minus
2509  if (c.eta() > (-5.20) && c.eta() < -2.901376) {
2510  pt_sum_HFH_minus += c.et();
2511  px_HFHadronsMinus -= c.px();
2512  py_HFHadronsMinus -= c.py();
2513  } else if (c.eta() > 2.901376 && c.eta() < 5.20) { //forward plus
2514  px_HFHadronsPlus -= c.px();
2515  py_HFHadronsPlus -= c.py();
2516  pt_sum_HFH_plus += c.et();
2517  }
2518  }
2519  if (c.particleId() == 7) { //HFEGammas
2520  //forward minus
2521  if (c.eta() > (-5.20) && c.eta() < -2.901376) {
2522  pt_sum_HFE_minus += c.et();
2523  px_HFEGammasMinus -= c.px();
2524  py_HFEGammasMinus -= c.py();
2525  } else if (c.eta() > 2.901376 && c.eta() < 5.20) { //forward plus
2526  px_HFEGammasPlus -= c.px();
2527  py_HFEGammasPlus -= c.py();
2528  pt_sum_HFE_plus += c.et();
2529  }
2530  }
2531  for (unsigned int j = 0; j < typePFCand_.size(); j++) {
2532  if (c.particleId() == typePFCand_[j]) {
2533  //second check for endcap, if inside barrel Max and Min symmetric around 0
2534  if (((c.eta() > etaMinPFCand_[j]) && (c.eta() < etaMaxPFCand_[j])) ||
2535  ((c.eta() > (-etaMaxPFCand_[j])) && (c.eta() < (-etaMinPFCand_[j])))) {
2536  countsPFCand_[j] += 1;
2537  MExPFCand_[j] -= c.px();
2538  MEyPFCand_[j] -= c.py();
2539  }
2540  }
2541  }
2542  }
2543 
2544  for (unsigned int j = 0; j < countsPFCand_.size(); j++) {
2545  profilePFCand_x_[j] = map_of_MEs[DirName + "/" + profilePFCand_x_name_[j]];
2546  if (profilePFCand_x_[j] && profilePFCand_x_[j]->getRootObject())
2547  profilePFCand_x_[j]->Fill(countsPFCand_[j], MExPFCand_[j]);
2548  profilePFCand_y_[j] = map_of_MEs[DirName + "/" + profilePFCand_y_name_[j]];
2549  if (profilePFCand_y_[j] && profilePFCand_y_[j]->getRootObject())
2550  profilePFCand_y_[j]->Fill(countsPFCand_[j], MEyPFCand_[j]);
2551  }
2552  meCHF_Barrel = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionBarrel"];
2553  if (meCHF_Barrel && meCHF_Barrel->getRootObject())
2554  meCHF_Barrel->Fill(pt_sum_CHF_Barrel / pfmet->sumEt());
2555  meCHF_EndcapPlus = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionEndcapPlus"];
2556  if (meCHF_EndcapPlus && meCHF_EndcapPlus->getRootObject())
2557  meCHF_EndcapPlus->Fill(pt_sum_CHF_Endcap_plus / pfmet->sumEt());
2558  meCHF_EndcapMinus = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionEndcapMinus"];
2559  if (meCHF_EndcapMinus && meCHF_EndcapMinus->getRootObject())
2560  meCHF_EndcapMinus->Fill(pt_sum_CHF_Endcap_minus / pfmet->sumEt());
2561  meNHF_Barrel = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionBarrel"];
2562  if (meNHF_Barrel && meNHF_Barrel->getRootObject())
2563  meNHF_Barrel->Fill(pt_sum_NHF_Barrel / pfmet->sumEt());
2564  meNHF_EndcapPlus = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionEndcapPlus"];
2565  if (meNHF_EndcapPlus && meNHF_EndcapPlus->getRootObject())
2566  meNHF_EndcapPlus->Fill(pt_sum_NHF_Endcap_plus / pfmet->sumEt());
2567  meNHF_EndcapMinus = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionEndcapMinus"];
2568  if (meNHF_EndcapMinus && meNHF_EndcapMinus->getRootObject())
2569  meNHF_EndcapMinus->Fill(pt_sum_NHF_Endcap_minus / pfmet->sumEt());
2570  mePhF_Barrel = map_of_MEs[DirName + "/" + "PfPhotonEtFractionBarrel"];
2571  if (mePhF_Barrel && mePhF_Barrel->getRootObject())
2572  mePhF_Barrel->Fill(pt_sum_PhF_Barrel / pfmet->sumEt());
2573  mePhF_EndcapPlus = map_of_MEs[DirName + "/" + "PfPhotonEtFractionEndcapPlus"];
2574  if (mePhF_EndcapPlus && mePhF_EndcapPlus->getRootObject())
2575  mePhF_EndcapPlus->Fill(pt_sum_PhF_Endcap_plus / pfmet->sumEt());
2576  mePhF_EndcapMinus = map_of_MEs[DirName + "/" + "PfPhotonEtFractionEndcapMinus"];
2577  if (mePhF_EndcapMinus && mePhF_EndcapMinus->getRootObject())
2578  mePhF_EndcapMinus->Fill(pt_sum_PhF_Endcap_minus / pfmet->sumEt());
2579  meHFHadF_Plus = map_of_MEs[DirName + "/" + "PfHFHadronEtFractionPlus"];
2580  if (meHFHadF_Plus && meHFHadF_Plus->getRootObject())
2581  meHFHadF_Plus->Fill(pt_sum_HFH_plus / pfmet->sumEt());
2582  meHFHadF_Minus = map_of_MEs[DirName + "/" + "PfHFHadronEtFractionMinus"];
2583  if (meHFHadF_Minus && meHFHadF_Minus->getRootObject())
2584  meHFHadF_Minus->Fill(pt_sum_HFH_minus / pfmet->sumEt());
2585  meHFEMF_Plus = map_of_MEs[DirName + "/" + "PfHFEMEtFractionPlus"];
2586  if (meHFEMF_Plus && meHFEMF_Plus->getRootObject())
2587  meHFEMF_Plus->Fill(pt_sum_HFE_plus / pfmet->sumEt());
2588  meHFEMF_Minus = map_of_MEs[DirName + "/" + "PfHFEMEtFractionMinus"];
2589  if (meHFEMF_Minus && meHFEMF_Minus->getRootObject())
2590  meHFEMF_Minus->Fill(pt_sum_HFE_minus / pfmet->sumEt());
2591  //sanity check if we have any type of the respective species in the events
2592  //else don't fill phi, as else we have a results of a biased peak at 0
2593  //if pt_sum of species part is 0, obviously that would be the case
2594  if (pt_sum_CHF_Barrel) {
2595  meMETPhiChargedHadronsBarrel = map_of_MEs[DirName + "/" + "METPhiChargedHadronsBarrel"];
2596  if (meMETPhiChargedHadronsBarrel && meMETPhiChargedHadronsBarrel->getRootObject())
2597  meMETPhiChargedHadronsBarrel->Fill(atan2(py_chargedHadronsBarrel, px_chargedHadronsBarrel));
2598  }
2599  if (pt_sum_CHF_Endcap_plus) {
2600  meMETPhiChargedHadronsEndcapPlus = map_of_MEs[DirName + "/" + "METPhiChargedHadronsEndcapPlus"];
2601  if (meMETPhiChargedHadronsEndcapPlus && meMETPhiChargedHadronsEndcapPlus->getRootObject())
2602  meMETPhiChargedHadronsEndcapPlus->Fill(atan2(py_chargedHadronsEndcapPlus, px_chargedHadronsEndcapPlus));
2603  }
2604  if (pt_sum_CHF_Endcap_minus) {
2605  meMETPhiChargedHadronsEndcapMinus = map_of_MEs[DirName + "/" + "METPhiChargedHadronsEndcapMinus"];
2606  if (meMETPhiChargedHadronsEndcapMinus && meMETPhiChargedHadronsEndcapMinus->getRootObject())
2607  meMETPhiChargedHadronsEndcapMinus->Fill(atan2(py_chargedHadronsEndcapMinus, px_chargedHadronsEndcapMinus));
2608  }
2609  if (pt_sum_NHF_Barrel) {
2610  meMETPhiNeutralHadronsBarrel = map_of_MEs[DirName + "/" + "METPhiNeutralHadronsBarrel"];
2611  if (meMETPhiNeutralHadronsBarrel && meMETPhiNeutralHadronsBarrel->getRootObject())
2612  meMETPhiNeutralHadronsBarrel->Fill(atan2(py_neutralHadronsBarrel, px_neutralHadronsBarrel));
2613  }
2614  if (pt_sum_NHF_Endcap_plus) {
2615  meMETPhiNeutralHadronsEndcapPlus = map_of_MEs[DirName + "/" + "METPhiNeutralHadronsEndcapPlus"];
2616  if (meMETPhiNeutralHadronsEndcapPlus && meMETPhiNeutralHadronsEndcapPlus->getRootObject())
2617  meMETPhiNeutralHadronsEndcapPlus->Fill(atan2(py_neutralHadronsEndcapPlus, px_neutralHadronsEndcapPlus));
2618  }
2619  if (pt_sum_NHF_Endcap_minus) {
2620  meMETPhiNeutralHadronsEndcapMinus = map_of_MEs[DirName + "/" + "METPhiNeutralHadronsEndcapMinus"];
2621  if (meMETPhiNeutralHadronsEndcapMinus && meMETPhiNeutralHadronsEndcapMinus->getRootObject())
2622  meMETPhiNeutralHadronsEndcapMinus->Fill(atan2(py_neutralHadronsEndcapMinus, px_neutralHadronsEndcapMinus));
2623  }
2624  if (pt_sum_PhF_Barrel) {
2625  meMETPhiPhotonsBarrel = map_of_MEs[DirName + "/" + "METPhiPhotonsBarrel"];
2626  if (meMETPhiPhotonsBarrel && meMETPhiPhotonsBarrel->getRootObject())
2627  meMETPhiPhotonsBarrel->Fill(atan2(py_PhotonsBarrel, px_PhotonsBarrel));
2628  }
2629  if (pt_sum_PhF_Endcap_plus) {
2630  meMETPhiPhotonsEndcapPlus = map_of_MEs[DirName + "/" + "METPhiPhotonsEndcapPlus"];
2631  if (meMETPhiPhotonsEndcapPlus && meMETPhiPhotonsEndcapPlus->getRootObject())
2632  meMETPhiPhotonsEndcapPlus->Fill(atan2(py_PhotonsEndcapPlus, px_PhotonsEndcapPlus));
2633  }
2634  if (pt_sum_PhF_Endcap_minus) {
2635  meMETPhiPhotonsEndcapMinus = map_of_MEs[DirName + "/" + "METPhiPhotonsEndcapMinus"];
2636  if (meMETPhiPhotonsEndcapMinus && meMETPhiPhotonsEndcapMinus->getRootObject())
2637  meMETPhiPhotonsEndcapMinus->Fill(atan2(py_PhotonsEndcapMinus, px_PhotonsEndcapMinus));
2638  }
2639  if (pt_sum_HFH_plus) {
2640  meMETPhiHFHadronsPlus = map_of_MEs[DirName + "/" + "METPhiHFHadronsPlus"];
2641  if (meMETPhiHFHadronsPlus && meMETPhiHFHadronsPlus->getRootObject())
2642  meMETPhiHFHadronsPlus->Fill(atan2(py_HFHadronsPlus, px_HFHadronsPlus));
2643  }
2644  if (pt_sum_HFH_minus) {
2645  meMETPhiHFHadronsMinus = map_of_MEs[DirName + "/" + "METPhiHFHadronsMinus"];
2646  if (meMETPhiHFHadronsMinus && meMETPhiHFHadronsMinus->getRootObject())
2647  meMETPhiHFHadronsMinus->Fill(atan2(py_HFHadronsMinus, px_HFHadronsMinus));
2648  }
2649  if (pt_sum_HFE_plus) {
2650  meMETPhiHFEGammasPlus = map_of_MEs[DirName + "/" + "METPhiHFEGammasPlus"];
2651  if (meMETPhiHFEGammasPlus && meMETPhiHFEGammasPlus->getRootObject())
2652  meMETPhiHFEGammasPlus->Fill(atan2(py_HFEGammasPlus, px_HFEGammasPlus));
2653  }
2654  if (pt_sum_HFE_minus) {
2655  meMETPhiHFEGammasMinus = map_of_MEs[DirName + "/" + "METPhiHFEGammasMinus"];
2656  if (meMETPhiHFEGammasMinus && meMETPhiHFEGammasMinus->getRootObject())
2657  meMETPhiHFEGammasMinus->Fill(atan2(py_HFEGammasMinus, px_HFEGammasMinus));
2658  }
2659  //fill other diagnostic plots based on trigger decision
2660  /*if(techTriggerCase[0]){//techTriggerResultBx0 && techTriggerResultBxM2 && techTriggerResultBxM1 -> both previous bunches filled
2661  meCHF_Barrel_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm2BXm1Filled"]; if(meCHF_Barrel_BXm2BXm1Filled && meCHF_Barrel_BXm2BXm1Filled->getRootObject()) meCHF_Barrel_BXm2BXm1Filled->Fill(pt_sum_CHF_Barrel/pfmet->sumEt());
2662  meCHF_EndcapPlus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm2BXm1Filled"]; if(meCHF_EndcapPlus_BXm2BXm1Filled && meCHF_EndcapPlus_BXm2BXm1Filled->getRootObject()) meCHF_EndcapPlus_BXm2BXm1Filled->Fill(pt_sum_CHF_Endcap_plus/pfmet->sumEt());
2663  meCHF_EndcapMinus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm2BXm1Filled"]; if(meCHF_EndcapMinus_BXm2BXm1Filled && meCHF_EndcapMinus_BXm2BXm1Filled->getRootObject()) meCHF_EndcapMinus_BXm2BXm1Filled->Fill(pt_sum_CHF_Endcap_minus/pfmet->sumEt());
2664  meNHF_Barrel_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm2BXm1Filled"]; if(meNHF_Barrel_BXm2BXm1Filled && meNHF_Barrel_BXm2BXm1Filled->getRootObject()) meNHF_Barrel_BXm2BXm1Filled->Fill(pt_sum_NHF_Barrel/pfmet->sumEt());
2665  meNHF_EndcapPlus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Filled"]; if(meNHF_EndcapPlus_BXm2BXm1Filled && meNHF_EndcapPlus_BXm2BXm1Filled->getRootObject()) meNHF_EndcapPlus_BXm2BXm1Filled->Fill(pt_sum_NHF_Endcap_plus/pfmet->sumEt());
2666  meNHF_EndcapMinus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Filled"]; if(meNHF_EndcapMinus_BXm2BXm1Filled && meNHF_EndcapMinus_BXm2BXm1Filled->getRootObject()) meNHF_EndcapMinus_BXm2BXm1Filled->Fill(pt_sum_NHF_Endcap_minus/pfmet->sumEt());
2667  mePhF_Barrel_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfPhotonEtFractionBarrel_BXm2BXm1Filled"]; if(mePhF_Barrel_BXm2BXm1Filled && mePhF_Barrel_BXm2BXm1Filled->getRootObject()) mePhF_Barrel_BXm2BXm1Filled->Fill(pt_sum_PhF_Barrel/pfmet->sumEt());
2668  mePhF_EndcapPlus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm2BXm1Filled"]; if(mePhF_EndcapPlus_BXm2BXm1Filled && mePhF_EndcapPlus_BXm2BXm1Filled->getRootObject()) mePhF_EndcapPlus_BXm2BXm1Filled->Fill(pt_sum_PhF_Endcap_plus/pfmet->sumEt());
2669  mePhF_EndcapMinus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm2BXm1Filled"]; if(mePhF_EndcapMinus_BXm2BXm1Filled && mePhF_EndcapMinus_BXm2BXm1Filled->getRootObject()) mePhF_EndcapMinus_BXm2BXm1Filled->Fill(pt_sum_PhF_Endcap_minus/pfmet->sumEt());
2670  meHFHadF_Plus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionPlus_BXm2BXm1Filled"]; if(meHFHadF_Plus_BXm2BXm1Filled && meHFHadF_Plus_BXm2BXm1Filled->getRootObject()) meHFHadF_Plus_BXm2BXm1Filled->Fill(pt_sum_HFH_plus/pfmet->sumEt());
2671  meHFHadF_Minus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionMinus_BXm2BXm1Filled"]; if(meHFHadF_Minus_BXm2BXm1Filled && meHFHadF_Minus_BXm2BXm1Filled->getRootObject()) meHFHadF_Minus_BXm2BXm1Filled->Fill(pt_sum_HFH_minus/pfmet->sumEt());
2672  meHFEMF_Plus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfHFEMEtFractionPlus_BXm2BXm1Filled"]; if(meHFEMF_Plus_BXm2BXm1Filled && meHFEMF_Plus_BXm2BXm1Filled->getRootObject()) meHFEMF_Plus_BXm2BXm1Filled->Fill(pt_sum_HFE_plus/pfmet->sumEt());
2673  meHFEMF_Minus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfHFEMEtFractionMinus_BXm2BXm1Filled"]; if(meHFEMF_Minus_BXm2BXm1Filled && meHFEMF_Minus_BXm2BXm1Filled->getRootObject()) meHFEMF_Minus_BXm2BXm1Filled->Fill(pt_sum_HFE_minus/pfmet->sumEt());
2674  mePhotonEtFraction_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"PfPhotonEtFraction_BXm2BXm1Filled"]; if ( mePhotonEtFraction_BXm2BXm1Filled && mePhotonEtFraction_BXm2BXm1Filled ->getRootObject()) mePhotonEtFraction_BXm2BXm1Filled ->Fill(pfmet->photonEtFraction());
2675  meNeutralHadronEtFraction_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"PfNeutralHadronEtFraction_BXm2BXm1Filled"]; if ( meNeutralHadronEtFraction_BXm2BXm1Filled && meNeutralHadronEtFraction_BXm2BXm1Filled ->getRootObject()) meNeutralHadronEtFraction_BXm2BXm1Filled ->Fill(pfmet->neutralHadronEtFraction());
2676  meChargedHadronEtFraction_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"PfChargedHadronEtFraction_BXm2BXm1Filled"]; if ( meChargedHadronEtFraction_BXm2BXm1Filled && meChargedHadronEtFraction_BXm2BXm1Filled ->getRootObject()) meChargedHadronEtFraction_BXm2BXm1Filled ->Fill(pfmet->chargedHadronEtFraction());
2677  meMET_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"MET_BXm2BXm1Filled"]; if ( meMET_BXm2BXm1Filled && meMET_BXm2BXm1Filled ->getRootObject()) meMET_BXm2BXm1Filled ->Fill(pfmet->pt());
2678  meSumET_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"SumET_BXm2BXm1Filled"]; if ( meSumET_BXm2BXm1Filled && meSumET_BXm2BXm1Filled ->getRootObject()) meSumET_BXm2BXm1Filled ->Fill(pfmet->sumEt());
2679  if(pt_sum_CHF_Barrel){
2680  meMETPhiChargedHadronsBarrel_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiChargedHadronsBarrel_BXm2BXm1Filled"];if(meMETPhiChargedHadronsBarrel_BXm2BXm1Filled && meMETPhiChargedHadronsBarrel_BXm2BXm1Filled ->getRootObject())meMETPhiChargedHadronsBarrel_BXm2BXm1Filled->Fill(atan2(py_chargedHadronsBarrel,px_chargedHadronsBarrel));
2681  }
2682  if(pt_sum_CHF_Endcap_plus){
2683  meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm2BXm1Filled"];if(meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled && meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled ->getRootObject())meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled->Fill(atan2(py_chargedHadronsEndcapPlus,px_chargedHadronsEndcapPlus));
2684  }
2685  if(pt_sum_CHF_Endcap_minus){
2686  meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm2BXm1Filled"];if(meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled && meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled ->getRootObject())meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled->Fill(atan2(py_chargedHadronsEndcapMinus,px_chargedHadronsEndcapMinus));
2687  }
2688  if(pt_sum_NHF_Barrel){
2689  meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsBarrel_BXm2BXm1Filled"];if(meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled && meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled ->getRootObject())meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled->Fill(atan2(py_neutralHadronsBarrel,px_neutralHadronsBarrel));
2690  }
2691  if(pt_sum_NHF_Endcap_plus){
2692  meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled"];if(meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled && meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled ->getRootObject())meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled->Fill(atan2(py_neutralHadronsEndcapPlus,px_neutralHadronsEndcapPlus));
2693  }
2694  if(pt_sum_NHF_Endcap_minus){
2695  meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled"];if(meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled && meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled ->getRootObject())meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled->Fill(atan2(py_neutralHadronsEndcapMinus,px_neutralHadronsEndcapMinus));
2696  }
2697  if(pt_sum_PhF_Barrel){
2698  meMETPhiPhotonsBarrel_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiPhotonsBarrel_BXm2BXm1Filled"];if(meMETPhiPhotonsBarrel_BXm2BXm1Filled && meMETPhiPhotonsBarrel_BXm2BXm1Filled ->getRootObject())meMETPhiPhotonsBarrel_BXm2BXm1Filled->Fill(atan2(py_PhotonsBarrel,px_PhotonsBarrel));
2699  }
2700  if(pt_sum_PhF_Endcap_plus){
2701  meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapPlus_BXm2BXm1Filled"];if(meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled && meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled ->getRootObject())meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled->Fill(atan2(py_PhotonsEndcapPlus,px_PhotonsEndcapPlus));
2702  }
2703  if(pt_sum_PhF_Endcap_minus){
2704  meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapMinus_BXm2BXm1Filled"];if(meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled && meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled ->getRootObject())meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled->Fill(atan2(py_PhotonsEndcapMinus,px_PhotonsEndcapMinus));
2705  }
2706  if(pt_sum_HFH_plus){
2707  meMETPhiHFHadronsPlus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiHFHadronsPlus_BXm2BXm1Filled"];if(meMETPhiHFHadronsPlus_BXm2BXm1Filled && meMETPhiHFHadronsPlus_BXm2BXm1Filled ->getRootObject())meMETPhiHFHadronsPlus_BXm2BXm1Filled->Fill(atan2(py_HFHadronsPlus,px_HFHadronsPlus));
2708  }
2709  if(pt_sum_HFH_minus){
2710  meMETPhiHFHadronsMinus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiHFHadronsMinus_BXm2BXm1Filled"];if(meMETPhiHFHadronsMinus_BXm2BXm1Filled && meMETPhiHFHadronsMinus_BXm2BXm1Filled ->getRootObject())meMETPhiHFHadronsMinus_BXm2BXm1Filled->Fill(atan2(py_HFHadronsMinus,px_HFHadronsMinus));
2711  }
2712  if(pt_sum_HFE_plus){
2713  meMETPhiHFEGammasPlus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiHFEGammasPlus_BXm2BXm1Filled"];if(meMETPhiHFEGammasPlus_BXm2BXm1Filled && meMETPhiHFEGammasPlus_BXm2BXm1Filled ->getRootObject())meMETPhiHFEGammasPlus_BXm2BXm1Filled->Fill(atan2(py_HFEGammasPlus,px_HFEGammasPlus));
2714  }
2715  if(pt_sum_HFE_minus){
2716  meMETPhiHFEGammasMinus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiHFEGammasMinus_BXm2BXm1Filled"];if(meMETPhiHFEGammasMinus_BXm2BXm1Filled && meMETPhiHFEGammasMinus_BXm2BXm1Filled ->getRootObject())meMETPhiHFEGammasMinus_BXm2BXm1Filled->Fill(atan2(py_HFEGammasMinus,px_HFEGammasMinus));
2717  }
2718  }*/
2719  if (techTriggerCase[1]) { //techTriggerResultBx0 && techTriggerResultBxM1 -> previous bunch filled
2720  meCHF_Barrel_BXm1Filled = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionBarrel_BXm1Filled"];
2721  if (meCHF_Barrel_BXm1Filled && meCHF_Barrel_BXm1Filled->getRootObject())
2722  meCHF_Barrel_BXm1Filled->Fill(pt_sum_CHF_Barrel / pfmet->sumEt());
2723  meCHF_EndcapPlus_BXm1Filled = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionEndcapPlus_BXm1Filled"];
2724  if (meCHF_EndcapPlus_BXm1Filled && meCHF_EndcapPlus_BXm1Filled->getRootObject())
2725  meCHF_EndcapPlus_BXm1Filled->Fill(pt_sum_CHF_Endcap_plus / pfmet->sumEt());
2726  meCHF_EndcapMinus_BXm1Filled = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionEndcapMinus_BXm1Filled"];
2727  if (meCHF_EndcapMinus_BXm1Filled && meCHF_EndcapMinus_BXm1Filled->getRootObject())
2728  meCHF_EndcapMinus_BXm1Filled->Fill(pt_sum_CHF_Endcap_minus / pfmet->sumEt());
2729  meNHF_Barrel_BXm1Filled = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionBarrel_BXm1Filled"];
2730  if (meNHF_Barrel_BXm1Filled && meNHF_Barrel_BXm1Filled->getRootObject())
2731  meNHF_Barrel_BXm1Filled->Fill(pt_sum_NHF_Barrel / pfmet->sumEt());
2732  meNHF_EndcapPlus_BXm1Filled = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionEndcapPlus_BXm1Filled"];
2733  if (meNHF_EndcapPlus_BXm1Filled && meNHF_EndcapPlus_BXm1Filled->getRootObject())
2734  meNHF_EndcapPlus_BXm1Filled->Fill(pt_sum_NHF_Endcap_plus / pfmet->sumEt());
2735  meNHF_EndcapMinus_BXm1Filled = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionEndcapMinus_BXm1Filled"];
2736  if (meNHF_EndcapMinus_BXm1Filled && meNHF_EndcapMinus_BXm1Filled->getRootObject())
2737  meNHF_EndcapMinus_BXm1Filled->Fill(pt_sum_NHF_Endcap_minus / pfmet->sumEt());
2738  mePhF_Barrel_BXm1Filled = map_of_MEs[DirName + "/" + "PfPhotonEtFractionBarrel_BXm1Filled"];
2739  if (mePhF_Barrel_BXm1Filled && mePhF_Barrel_BXm1Filled->getRootObject())
2740  mePhF_Barrel_BXm1Filled->Fill(pt_sum_PhF_Barrel / pfmet->sumEt());
2741  mePhF_EndcapPlus_BXm1Filled = map_of_MEs[DirName + "/" + "PfPhotonEtFractionEndcapPlus_BXm1Filled"];
2742  if (mePhF_EndcapPlus_BXm1Filled && mePhF_EndcapPlus_BXm1Filled->getRootObject())
2743  mePhF_EndcapPlus_BXm1Filled->Fill(pt_sum_PhF_Endcap_plus / pfmet->sumEt());
2744  mePhF_EndcapMinus_BXm1Filled = map_of_MEs[DirName + "/" + "PfPhotonEtFractionEndcapMinus_BXm1Filled"];
2745  if (mePhF_EndcapMinus_BXm1Filled && mePhF_EndcapMinus_BXm1Filled->getRootObject())
2746  mePhF_EndcapMinus_BXm1Filled->Fill(pt_sum_PhF_Endcap_minus / pfmet->sumEt());
2747  meHFHadF_Plus_BXm1Filled = map_of_MEs[DirName + "/" + "PfHFHadronEtFractionPlus_BXm1Filled"];
2748  if (meHFHadF_Plus_BXm1Filled && meHFHadF_Plus_BXm1Filled->getRootObject())
2749  meHFHadF_Plus_BXm1Filled->Fill(pt_sum_HFH_plus / pfmet->sumEt());
2750  meHFHadF_Minus_BXm1Filled = map_of_MEs[DirName + "/" + "PfHFHadronEtFractionMinus_BXm1Filled"];
2751  if (meHFHadF_Minus_BXm1Filled && meHFHadF_Minus_BXm1Filled->getRootObject())
2752  meHFHadF_Minus_BXm1Filled->Fill(pt_sum_HFH_minus / pfmet->sumEt());
2753  meHFEMF_Plus_BXm1Filled = map_of_MEs[DirName + "/" + "PfHFEMEtFractionPlus_BXm1Filled"];
2754  if (meHFEMF_Plus_BXm1Filled && meHFEMF_Plus_BXm1Filled->getRootObject())
2755  meHFEMF_Plus_BXm1Filled->Fill(pt_sum_HFE_plus / pfmet->sumEt());
2756  meHFEMF_Minus_BXm1Filled = map_of_MEs[DirName + "/" + "PfHFEMEtFractionMinus_BXm1Filled"];
2757  if (meHFEMF_Minus_BXm1Filled && meHFEMF_Minus_BXm1Filled->getRootObject())
2758  meHFEMF_Minus_BXm1Filled->Fill(pt_sum_HFE_minus / pfmet->sumEt());
2759  mePhotonEtFraction_BXm1Filled = map_of_MEs[DirName + "/" + "PfPhotonEtFraction_BXm1Filled"];
2760  if (mePhotonEtFraction_BXm1Filled && mePhotonEtFraction_BXm1Filled->getRootObject())
2761  mePhotonEtFraction_BXm1Filled->Fill(pfmet->photonEtFraction());
2762  meNeutralHadronEtFraction_BXm1Filled = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFraction_BXm1Filled"];
2763  if (meNeutralHadronEtFraction_BXm1Filled && meNeutralHadronEtFraction_BXm1Filled->getRootObject())
2764  meNeutralHadronEtFraction_BXm1Filled->Fill(pfmet->neutralHadronEtFraction());
2765  meChargedHadronEtFraction_BXm1Filled = map_of_MEs[DirName + "/" + "PfChargedHadronEtFraction_BXm1Filled"];
2766  if (meChargedHadronEtFraction_BXm1Filled && meChargedHadronEtFraction_BXm1Filled->getRootObject())
2767  meChargedHadronEtFraction_BXm1Filled->Fill(pfmet->chargedHadronEtFraction());
2768  meMET_BXm1Filled = map_of_MEs[DirName + "/" + "MET_BXm1Filled"];
2769  if (meMET_BXm1Filled && meMET_BXm1Filled->getRootObject())
2770  meMET_BXm1Filled->Fill(pfmet->pt());
2771  meSumET_BXm1Filled = map_of_MEs[DirName + "/" + "SumET_BXm1Filled"];
2772  if (meSumET_BXm1Filled && meSumET_BXm1Filled->getRootObject())
2773  meSumET_BXm1Filled->Fill(pfmet->sumEt());
2774  if (pt_sum_CHF_Barrel) {
2775  meMETPhiChargedHadronsBarrel_BXm1Filled =
2776  map_of_MEs[DirName + "/" + "METPhiChargedHadronsBarrel_BXm1Filled"];
2777  if (meMETPhiChargedHadronsBarrel_BXm1Filled && meMETPhiChargedHadronsBarrel_BXm1Filled->getRootObject())
2778  meMETPhiChargedHadronsBarrel_BXm1Filled->Fill(atan2(py_chargedHadronsBarrel, px_chargedHadronsBarrel));
2779  }
2780  if (pt_sum_CHF_Endcap_plus) {
2781  meMETPhiChargedHadronsEndcapPlus_BXm1Filled =
2782  map_of_MEs[DirName + "/" + "METPhiChargedHadronsEndcapPlus_BXm1Filled"];
2783  if (meMETPhiChargedHadronsEndcapPlus_BXm1Filled &&
2784  meMETPhiChargedHadronsEndcapPlus_BXm1Filled->getRootObject())
2785  meMETPhiChargedHadronsEndcapPlus_BXm1Filled->Fill(
2786  atan2(py_chargedHadronsEndcapPlus, px_chargedHadronsEndcapPlus));
2787  }
2788  if (pt_sum_CHF_Endcap_minus) {
2789  meMETPhiChargedHadronsEndcapMinus_BXm1Filled =
2790  map_of_MEs[DirName + "/" + "METPhiChargedHadronsEndcapMinus_BXm1Filled"];
2791  if (meMETPhiChargedHadronsEndcapMinus_BXm1Filled &&
2792  meMETPhiChargedHadronsEndcapMinus_BXm1Filled->getRootObject())
2793  meMETPhiChargedHadronsEndcapMinus_BXm1Filled->Fill(
2794  atan2(py_chargedHadronsEndcapMinus, px_chargedHadronsEndcapMinus));
2795  }
2796  if (pt_sum_NHF_Barrel) {
2797  meMETPhiNeutralHadronsBarrel_BXm1Filled =
2798  map_of_MEs[DirName + "/" + "METPhiNeutralHadronsBarrel_BXm1Filled"];
2799  if (meMETPhiNeutralHadronsBarrel_BXm1Filled && meMETPhiNeutralHadronsBarrel_BXm1Filled->getRootObject())
2800  meMETPhiNeutralHadronsBarrel_BXm1Filled->Fill(atan2(py_neutralHadronsBarrel, px_neutralHadronsBarrel));
2801  }
2802  if (pt_sum_NHF_Endcap_plus) {
2803  meMETPhiNeutralHadronsEndcapPlus_BXm1Filled =
2804  map_of_MEs[DirName + "/" + "METPhiNeutralHadronsEndcapPlus_BXm1Filled"];
2805  if (meMETPhiNeutralHadronsEndcapPlus_BXm1Filled &&
2806  meMETPhiNeutralHadronsEndcapPlus_BXm1Filled->getRootObject())
2807  meMETPhiNeutralHadronsEndcapPlus_BXm1Filled->Fill(
2808  atan2(py_neutralHadronsEndcapPlus, px_neutralHadronsEndcapPlus));
2809  }
2810  if (pt_sum_NHF_Endcap_minus) {
2811  meMETPhiNeutralHadronsEndcapMinus_BXm1Filled =
2812  map_of_MEs[DirName + "/" + "METPhiNeutralHadronsEndcapMinus_BXm1Filled"];
2813  if (meMETPhiNeutralHadronsEndcapMinus_BXm1Filled &&
2814  meMETPhiNeutralHadronsEndcapMinus_BXm1Filled->getRootObject())
2815  meMETPhiNeutralHadronsEndcapMinus_BXm1Filled->Fill(
2816  atan2(py_neutralHadronsEndcapMinus, px_neutralHadronsEndcapMinus));
2817  }
2818  if (pt_sum_PhF_Barrel) {
2819  meMETPhiPhotonsBarrel_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiPhotonsBarrel_BXm1Filled"];
2820  if (meMETPhiPhotonsBarrel_BXm1Filled && meMETPhiPhotonsBarrel_BXm1Filled->getRootObject())
2821  meMETPhiPhotonsBarrel_BXm1Filled->Fill(atan2(py_PhotonsBarrel, px_PhotonsBarrel));
2822  }
2823  if (pt_sum_PhF_Endcap_plus) {
2824  meMETPhiPhotonsEndcapPlus_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiPhotonsEndcapPlus_BXm1Filled"];
2825  if (meMETPhiPhotonsEndcapPlus_BXm1Filled && meMETPhiPhotonsEndcapPlus_BXm1Filled->getRootObject())
2826  meMETPhiPhotonsEndcapPlus_BXm1Filled->Fill(atan2(py_PhotonsEndcapPlus, px_PhotonsEndcapPlus));
2827  }
2828  if (pt_sum_PhF_Endcap_minus) {
2829  meMETPhiPhotonsEndcapMinus_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiPhotonsEndcapMinus_BXm1Filled"];
2830  if (meMETPhiPhotonsEndcapMinus_BXm1Filled && meMETPhiPhotonsEndcapMinus_BXm1Filled->getRootObject())
2831  meMETPhiPhotonsEndcapMinus_BXm1Filled->Fill(atan2(py_PhotonsEndcapMinus, px_PhotonsEndcapMinus));
2832  }
2833  if (pt_sum_HFH_plus) {
2834  meMETPhiHFHadronsPlus_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiHFHadronsPlus_BXm1Filled"];
2835  if (meMETPhiHFHadronsPlus_BXm1Filled && meMETPhiHFHadronsPlus_BXm1Filled->getRootObject())
2836  meMETPhiHFHadronsPlus_BXm1Filled->Fill(atan2(py_HFHadronsPlus, px_HFHadronsPlus));
2837  }
2838  if (pt_sum_HFH_minus) {
2839  meMETPhiHFHadronsMinus_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiHFHadronsMinus_BXm1Filled"];
2840  if (meMETPhiHFHadronsMinus_BXm1Filled && meMETPhiHFHadronsMinus_BXm1Filled->getRootObject())
2841  meMETPhiHFHadronsMinus_BXm1Filled->Fill(atan2(py_HFHadronsMinus, px_HFHadronsMinus));
2842  }
2843  if (pt_sum_HFE_plus) {
2844  meMETPhiHFEGammasPlus_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiHFEGammasPlus_BXm1Filled"];
2845  if (meMETPhiHFEGammasPlus_BXm1Filled && meMETPhiHFEGammasPlus_BXm1Filled->getRootObject())
2846  meMETPhiHFEGammasPlus_BXm1Filled->Fill(atan2(py_HFEGammasPlus, px_HFEGammasPlus));
2847  }
2848  if (pt_sum_HFE_minus) {
2849  meMETPhiHFEGammasMinus_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiHFEGammasMinus_BXm1Filled"];
2850  if (meMETPhiHFEGammasMinus_BXm1Filled && meMETPhiHFEGammasMinus_BXm1Filled->getRootObject())
2851  meMETPhiHFEGammasMinus_BXm1Filled->Fill(atan2(py_HFEGammasMinus, px_HFEGammasMinus));
2852  }
2853  }
2854  /*if(techTriggerCase[3]){//techTriggerResultBx0 && !techTriggerResultBxM2 && !techTriggerResultBxM1 ->previous two bunches empty
2855  meCHF_Barrel_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm2BXm1Empty"]; if(meCHF_Barrel_BXm2BXm1Empty && meCHF_Barrel_BXm2BXm1Empty->getRootObject()) meCHF_Barrel_BXm2BXm1Empty->Fill(pt_sum_CHF_Barrel/pfmet->sumEt());
2856  meCHF_EndcapPlus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm2BXm1Empty"]; if(meCHF_EndcapPlus_BXm2BXm1Empty && meCHF_EndcapPlus_BXm2BXm1Empty->getRootObject()) meCHF_EndcapPlus_BXm2BXm1Empty->Fill(pt_sum_CHF_Endcap_plus/pfmet->sumEt());
2857  meCHF_EndcapMinus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm2BXm1Empty"]; if(meCHF_EndcapMinus_BXm2BXm1Empty && meCHF_EndcapMinus_BXm2BXm1Empty->getRootObject()) meCHF_EndcapMinus_BXm2BXm1Empty->Fill(pt_sum_CHF_Endcap_minus/pfmet->sumEt());
2858  meNHF_Barrel_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm2BXm1Empty"]; if(meNHF_Barrel_BXm2BXm1Empty && meNHF_Barrel_BXm2BXm1Empty->getRootObject()) meNHF_Barrel_BXm2BXm1Empty->Fill(pt_sum_NHF_Barrel/pfmet->sumEt());
2859  meNHF_EndcapPlus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Empty"]; if(meNHF_EndcapPlus_BXm2BXm1Empty && meNHF_EndcapPlus_BXm2BXm1Empty->getRootObject()) meNHF_EndcapPlus_BXm2BXm1Empty->Fill(pt_sum_NHF_Endcap_plus/pfmet->sumEt());
2860  meNHF_EndcapMinus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Empty"]; if(meNHF_EndcapMinus_BXm2BXm1Empty && meNHF_EndcapMinus_BXm2BXm1Empty->getRootObject()) meNHF_EndcapMinus_BXm2BXm1Empty->Fill(pt_sum_NHF_Endcap_minus/pfmet->sumEt());
2861  mePhF_Barrel_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfPhotonEtFractionBarrel_BXm2BXm1Empty"]; if(mePhF_Barrel_BXm2BXm1Empty && mePhF_Barrel_BXm2BXm1Empty->getRootObject()) mePhF_Barrel_BXm2BXm1Empty->Fill(pt_sum_PhF_Barrel/pfmet->sumEt());
2862  mePhF_EndcapPlus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm2BXm1Empty"]; if(mePhF_EndcapPlus_BXm2BXm1Empty && mePhF_EndcapPlus_BXm2BXm1Empty->getRootObject()) mePhF_EndcapPlus_BXm2BXm1Empty->Fill(pt_sum_PhF_Endcap_plus/pfmet->sumEt());
2863  mePhF_EndcapMinus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm2BXm1Empty"]; if(mePhF_EndcapMinus_BXm2BXm1Empty && mePhF_EndcapMinus_BXm2BXm1Empty->getRootObject()) mePhF_EndcapMinus_BXm2BXm1Empty->Fill(pt_sum_PhF_Endcap_minus/pfmet->sumEt());
2864  meHFHadF_Plus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionPlus_BXm2BXm1Empty"]; if(meHFHadF_Plus_BXm2BXm1Empty && meHFHadF_Plus_BXm2BXm1Empty->getRootObject()) meHFHadF_Plus_BXm2BXm1Empty->Fill(pt_sum_HFH_plus/pfmet->sumEt());
2865  meHFHadF_Minus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionMinus_BXm2BXm1Empty"]; if(meHFHadF_Minus_BXm2BXm1Empty && meHFHadF_Minus_BXm2BXm1Empty->getRootObject()) meHFHadF_Minus_BXm2BXm1Empty->Fill(pt_sum_HFH_minus/pfmet->sumEt());
2866  meHFEMF_Plus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfHFEMEtFractionPlus_BXm2BXm1Empty"]; if(meHFEMF_Plus_BXm2BXm1Empty && meHFEMF_Plus_BXm2BXm1Empty->getRootObject()) meHFEMF_Plus_BXm2BXm1Empty->Fill(pt_sum_HFE_plus/pfmet->sumEt());
2867  meHFEMF_Minus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfHFEMEtFractionMinus_BXm2BXm1Empty"]; if(meHFEMF_Minus_BXm2BXm1Empty && meHFEMF_Minus_BXm2BXm1Empty->getRootObject()) meHFEMF_Minus_BXm2BXm1Empty->Fill(pt_sum_HFE_minus/pfmet->sumEt());
2868  mePhotonEtFraction_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"PfPhotonEtFraction_BXm2BXm1Empty"]; if ( mePhotonEtFraction_BXm2BXm1Empty && mePhotonEtFraction_BXm2BXm1Empty ->getRootObject()) mePhotonEtFraction_BXm2BXm1Empty ->Fill(pfmet->photonEtFraction());
2869  meNeutralHadronEtFraction_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"PfNeutralHadronEtFraction_BXm2BXm1Empty"]; if ( meNeutralHadronEtFraction_BXm2BXm1Empty && meNeutralHadronEtFraction_BXm2BXm1Empty ->getRootObject()) meNeutralHadronEtFraction_BXm2BXm1Empty ->Fill(pfmet->neutralHadronEtFraction());
2870  meChargedHadronEtFraction_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"PfChargedHadronEtFraction_BXm2BXm1Empty"]; if ( meChargedHadronEtFraction_BXm2BXm1Empty && meChargedHadronEtFraction_BXm2BXm1Empty ->getRootObject()) meChargedHadronEtFraction_BXm2BXm1Empty ->Fill(pfmet->chargedHadronEtFraction());
2871  meMET_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"MET_BXm2BXm1Empty"]; if ( meMET_BXm2BXm1Empty && meMET_BXm2BXm1Empty ->getRootObject()) meMET_BXm2BXm1Empty ->Fill(pfmet->pt());
2872  meSumET_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"SumET_BXm2BXm1Empty"]; if ( meSumET_BXm2BXm1Empty && meSumET_BXm2BXm1Empty ->getRootObject()) meSumET_BXm2BXm1Empty ->Fill(pfmet->sumEt());
2873  if(pt_sum_CHF_Barrel){
2874  meMETPhiChargedHadronsBarrel_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiChargedHadronsBarrel_BXm2BXm1Empty"];if(meMETPhiChargedHadronsBarrel_BXm2BXm1Empty && meMETPhiChargedHadronsBarrel_BXm2BXm1Empty ->getRootObject())meMETPhiChargedHadronsBarrel_BXm2BXm1Empty->Fill(atan2(py_chargedHadronsBarrel,px_chargedHadronsBarrel));
2875  }
2876  if(pt_sum_CHF_Endcap_plus){
2877  meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm2BXm1Empty"];if(meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty && meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty ->getRootObject())meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty->Fill(atan2(py_chargedHadronsEndcapPlus,px_chargedHadronsEndcapPlus));
2878  }
2879  if(pt_sum_CHF_Endcap_minus){
2880  meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm2BXm1Empty"];if(meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty && meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty ->getRootObject())meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty->Fill(atan2(py_chargedHadronsEndcapMinus,px_chargedHadronsEndcapMinus));
2881  }
2882  if(pt_sum_NHF_Barrel){
2883  meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsBarrel_BXm2BXm1Empty"];if(meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty && meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty ->getRootObject())meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty->Fill(atan2(py_neutralHadronsBarrel,px_neutralHadronsBarrel));
2884  }
2885  if(pt_sum_NHF_Endcap_plus){
2886  meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty"];if(meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty && meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty ->getRootObject())meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty->Fill(atan2(py_neutralHadronsEndcapPlus,px_neutralHadronsEndcapPlus));
2887  }
2888  if(pt_sum_NHF_Endcap_minus){
2889  meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty"];if(meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty && meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty ->getRootObject())meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty->Fill(atan2(py_neutralHadronsEndcapMinus,px_neutralHadronsEndcapMinus));
2890  }
2891  if(pt_sum_PhF_Barrel){
2892  meMETPhiPhotonsBarrel_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiPhotonsBarrel_BXm2BXm1Empty"];if(meMETPhiPhotonsBarrel_BXm2BXm1Empty && meMETPhiPhotonsBarrel_BXm2BXm1Empty ->getRootObject())meMETPhiPhotonsBarrel_BXm2BXm1Empty->Fill(atan2(py_PhotonsBarrel,px_PhotonsBarrel));
2893  }
2894  if(pt_sum_PhF_Endcap_plus){
2895  meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapPlus_BXm2BXm1Empty"];if(meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty && meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty ->getRootObject())meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty->Fill(atan2(py_PhotonsEndcapPlus,px_PhotonsEndcapPlus));
2896  }
2897  if(pt_sum_PhF_Endcap_minus){
2898  meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapMinus_BXm2BXm1Empty"];if(meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty && meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty ->getRootObject())meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty->Fill(atan2(py_PhotonsEndcapMinus,px_PhotonsEndcapMinus));
2899  }
2900  if(pt_sum_HFH_plus){
2901  meMETPhiHFHadronsPlus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiHFHadronsPlus_BXm2BXm1Empty"];if(meMETPhiHFHadronsPlus_BXm2BXm1Empty && meMETPhiHFHadronsPlus_BXm2BXm1Empty ->getRootObject())meMETPhiHFHadronsPlus_BXm2BXm1Empty->Fill(atan2(py_HFHadronsPlus,px_HFHadronsPlus));
2902  }
2903  if(pt_sum_HFH_minus){
2904  meMETPhiHFHadronsMinus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiHFHadronsMinus_BXm2BXm1Empty"];if(meMETPhiHFHadronsMinus_BXm2BXm1Empty && meMETPhiHFHadronsMinus_BXm2BXm1Empty ->getRootObject())meMETPhiHFHadronsMinus_BXm2BXm1Empty->Fill(atan2(py_HFHadronsMinus,px_HFHadronsMinus));
2905  }
2906  if(pt_sum_HFE_plus){
2907  meMETPhiHFEGammasPlus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiHFEGammasPlus_BXm2BXm1Empty"];if(meMETPhiHFEGammasPlus_BXm2BXm1Empty && meMETPhiHFEGammasPlus_BXm2BXm1Empty ->getRootObject())meMETPhiHFEGammasPlus_BXm2BXm1Empty->Fill(atan2(py_HFEGammasPlus,px_HFEGammasPlus));
2908  }
2909  if(pt_sum_HFE_minus){
2910  meMETPhiHFEGammasMinus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiHFEGammasMinus_BXm2BXm1Empty"];if(meMETPhiHFEGammasMinus_BXm2BXm1Empty && meMETPhiHFEGammasMinus_BXm2BXm1Empty ->getRootObject())meMETPhiHFEGammasMinus_BXm2BXm1Empty->Fill(atan2(py_HFEGammasMinus,px_HFEGammasMinus));
2911  }
2912  }*/
2913  if (techTriggerCase[2]) { //techTriggerResultBx0 && !techTriggerResultBxM1 --> previous bunch empty
2914  meCHF_Barrel_BXm1Empty = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionBarrel_BXm1Empty"];
2915  if (meCHF_Barrel_BXm1Empty && meCHF_Barrel_BXm1Empty->getRootObject())
2916  meCHF_Barrel_BXm1Empty->Fill(pt_sum_CHF_Barrel / pfmet->sumEt());
2917  meCHF_EndcapPlus_BXm1Empty = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionEndcapPlus_BXm1Empty"];
2918  if (meCHF_EndcapPlus_BXm1Empty && meCHF_EndcapPlus_BXm1Empty->getRootObject())
2919  meCHF_EndcapPlus_BXm1Empty->Fill(pt_sum_CHF_Endcap_plus / pfmet->sumEt());
2920  meCHF_EndcapMinus_BXm1Empty = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionEndcapMinus_BXm1Empty"];
2921  if (meCHF_EndcapMinus_BXm1Empty && meCHF_EndcapMinus_BXm1Empty->getRootObject())
2922  meCHF_EndcapMinus_BXm1Empty->Fill(pt_sum_CHF_Endcap_minus / pfmet->sumEt());
2923  meNHF_Barrel_BXm1Empty = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionBarrel_BXm1Empty"];
2924  if (meNHF_Barrel_BXm1Empty && meNHF_Barrel_BXm1Empty->getRootObject())
2925  meNHF_Barrel_BXm1Empty->Fill(pt_sum_NHF_Barrel / pfmet->sumEt());
2926  meNHF_EndcapPlus_BXm1Empty = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionEndcapPlus_BXm1Empty"];
2927  if (meNHF_EndcapPlus_BXm1Empty && meNHF_EndcapPlus_BXm1Empty->getRootObject())
2928  meNHF_EndcapPlus_BXm1Empty->Fill(pt_sum_NHF_Endcap_plus / pfmet->sumEt());
2929  meNHF_EndcapMinus_BXm1Empty = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionEndcapMinus_BXm1Empty"];
2930  if (meNHF_EndcapMinus_BXm1Empty && meNHF_EndcapMinus_BXm1Empty->getRootObject())
2931  meNHF_EndcapMinus_BXm1Empty->Fill(pt_sum_NHF_Endcap_minus / pfmet->sumEt());
2932  mePhF_Barrel_BXm1Empty = map_of_MEs[DirName + "/" + "PfPhotonEtFractionBarrel_BXm1Empty"];
2933  if (mePhF_Barrel_BXm1Empty && mePhF_Barrel_BXm1Empty->getRootObject())
2934  mePhF_Barrel_BXm1Empty->Fill(pt_sum_PhF_Barrel / pfmet->sumEt());
2935  mePhF_EndcapPlus_BXm1Empty = map_of_MEs[DirName + "/" + "PfPhotonEtFractionEndcapPlus_BXm1Empty"];
2936  if (mePhF_EndcapPlus_BXm1Empty && mePhF_EndcapPlus_BXm1Empty->getRootObject())
2937  mePhF_EndcapPlus_BXm1Empty->Fill(pt_sum_PhF_Endcap_plus / pfmet->sumEt());
2938  mePhF_EndcapMinus_BXm1Empty = map_of_MEs[DirName + "/" + "PfPhotonEtFractionEndcapMinus_BXm1Empty"];
2939  if (mePhF_EndcapMinus_BXm1Empty && mePhF_EndcapMinus_BXm1Empty->getRootObject())
2940  mePhF_EndcapMinus_BXm1Empty->Fill(pt_sum_PhF_Endcap_minus / pfmet->sumEt());
2941  meHFHadF_Plus_BXm1Empty = map_of_MEs[DirName + "/" + "PfHFHadronEtFractionPlus_BXm1Empty"];
2942  if (meHFHadF_Plus_BXm1Empty && meHFHadF_Plus_BXm1Empty->getRootObject())
2943  meHFHadF_Plus_BXm1Empty->Fill(pt_sum_HFH_plus / pfmet->sumEt());
2944  meHFHadF_Minus_BXm1Empty = map_of_MEs[DirName + "/" + "PfHFHadronEtFractionMinus_BXm1Empty"];
2945  if (meHFHadF_Minus_BXm1Empty && meHFHadF_Minus_BXm1Empty->getRootObject())
2946  meHFHadF_Minus_BXm1Empty->Fill(pt_sum_HFH_minus / pfmet->sumEt());
2947  meHFEMF_Plus_BXm1Empty = map_of_MEs[DirName + "/" + "PfHFEMEtFractionPlus_BXm1Empty"];
2948  if (meHFEMF_Plus_BXm1Empty && meHFEMF_Plus_BXm1Empty->getRootObject())
2949  meHFEMF_Plus_BXm1Empty->Fill(pt_sum_HFE_plus / pfmet->sumEt());
2950  meHFEMF_Minus_BXm1Empty = map_of_MEs[DirName + "/" + "PfHFEMEtFractionMinus_BXm1Empty"];
2951  if (meHFEMF_Minus_BXm1Empty && meHFEMF_Minus_BXm1Empty->getRootObject())
2952  meHFEMF_Minus_BXm1Empty->Fill(pt_sum_HFE_minus / pfmet->sumEt());
2953  mePhotonEtFraction_BXm1Empty = map_of_MEs[DirName + "/" + "PfPhotonEtFraction_BXm1Empty"];
2954  if (mePhotonEtFraction_BXm1Empty && mePhotonEtFraction_BXm1Empty->getRootObject())
2955  mePhotonEtFraction_BXm1Empty->Fill(pfmet->photonEtFraction());
2956  meNeutralHadronEtFraction_BXm1Empty = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFraction_BXm1Empty"];
2957  if (meNeutralHadronEtFraction_BXm1Empty && meNeutralHadronEtFraction_BXm1Empty->getRootObject())
2958  meNeutralHadronEtFraction_BXm1Empty->Fill(pfmet->neutralHadronEtFraction());
2959  meChargedHadronEtFraction_BXm1Empty = map_of_MEs[DirName + "/" + "PfChargedHadronEtFraction_BXm1Empty"];
2960  if (meChargedHadronEtFraction_BXm1Empty && meChargedHadronEtFraction_BXm1Empty->getRootObject())
2961  meChargedHadronEtFraction_BXm1Empty->Fill(pfmet->chargedHadronEtFraction());
2962  meMET_BXm1Empty = map_of_MEs[DirName + "/" + "MET_BXm1Empty"];
2963  if (meMET_BXm1Empty && meMET_BXm1Empty->getRootObject())
2964  meMET_BXm1Empty->Fill(pfmet->pt());
2965  meSumET_BXm1Empty = map_of_MEs[DirName + "/" + "SumET_BXm1Empty"];
2966  if (meSumET_BXm1Empty && meSumET_BXm1Empty->getRootObject())
2967  meSumET_BXm1Empty->Fill(pfmet->sumEt());
2968  if (pt_sum_CHF_Barrel) {
2969  meMETPhiChargedHadronsBarrel_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiChargedHadronsBarrel_BXm1Empty"];
2970  if (meMETPhiChargedHadronsBarrel_BXm1Empty && meMETPhiChargedHadronsBarrel_BXm1Empty->getRootObject())
2971  meMETPhiChargedHadronsBarrel_BXm1Empty->Fill(atan2(py_chargedHadronsBarrel, px_chargedHadronsBarrel));
2972  }
2973  if (pt_sum_CHF_Endcap_plus) {
2974  meMETPhiChargedHadronsEndcapPlus_BXm1Empty =
2975  map_of_MEs[DirName + "/" + "METPhiChargedHadronsEndcapPlus_BXm1Empty"];
2976  if (meMETPhiChargedHadronsEndcapPlus_BXm1Empty &&
2977  meMETPhiChargedHadronsEndcapPlus_BXm1Empty->getRootObject())
2978  meMETPhiChargedHadronsEndcapPlus_BXm1Empty->Fill(
2979  atan2(py_chargedHadronsEndcapPlus, px_chargedHadronsEndcapPlus));
2980  }
2981  if (pt_sum_CHF_Endcap_minus) {
2982  meMETPhiChargedHadronsEndcapMinus_BXm1Empty =
2983  map_of_MEs[DirName + "/" + "METPhiChargedHadronsEndcapMinus_BXm1Empty"];
2984  if (meMETPhiChargedHadronsEndcapMinus_BXm1Empty &&
2985  meMETPhiChargedHadronsEndcapMinus_BXm1Empty->getRootObject())
2986  meMETPhiChargedHadronsEndcapMinus_BXm1Empty->Fill(
2987  atan2(py_chargedHadronsEndcapMinus, px_chargedHadronsEndcapMinus));
2988  }
2989  if (pt_sum_NHF_Barrel) {
2990  meMETPhiNeutralHadronsBarrel_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiNeutralHadronsBarrel_BXm1Empty"];
2991  if (meMETPhiNeutralHadronsBarrel_BXm1Empty && meMETPhiNeutralHadronsBarrel_BXm1Empty->getRootObject())
2992  meMETPhiNeutralHadronsBarrel_BXm1Empty->Fill(atan2(py_neutralHadronsBarrel, px_neutralHadronsBarrel));
2993  }
2994  if (pt_sum_NHF_Endcap_plus) {
2995  meMETPhiNeutralHadronsEndcapPlus_BXm1Empty =
2996  map_of_MEs[DirName + "/" + "METPhiNeutralHadronsEndcapPlus_BXm1Empty"];
2997  if (meMETPhiNeutralHadronsEndcapPlus_BXm1Empty &&
2998  meMETPhiNeutralHadronsEndcapPlus_BXm1Empty->getRootObject())
2999  meMETPhiNeutralHadronsEndcapPlus_BXm1Empty->Fill(
3000  atan2(py_neutralHadronsEndcapPlus, px_neutralHadronsEndcapPlus));
3001  }
3002  if (pt_sum_NHF_Endcap_minus) {
3003  meMETPhiNeutralHadronsEndcapMinus_BXm1Empty =
3004  map_of_MEs[DirName + "/" + "METPhiNeutralHadronsEndcapMinus_BXm1Empty"];
3005  if (meMETPhiNeutralHadronsEndcapMinus_BXm1Empty &&
3006  meMETPhiNeutralHadronsEndcapMinus_BXm1Empty->getRootObject())
3007  meMETPhiNeutralHadronsEndcapMinus_BXm1Empty->Fill(
3008  atan2(py_neutralHadronsEndcapMinus, px_neutralHadronsEndcapMinus));
3009  }
3010  if (pt_sum_PhF_Barrel) {
3011  meMETPhiPhotonsBarrel_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiPhotonsBarrel_BXm1Empty"];
3012  if (meMETPhiPhotonsBarrel_BXm1Empty && meMETPhiPhotonsBarrel_BXm1Empty->getRootObject())
3013  meMETPhiPhotonsBarrel_BXm1Empty->Fill(atan2(py_PhotonsBarrel, px_PhotonsBarrel));
3014  }
3015  if (pt_sum_PhF_Endcap_plus) {
3016  meMETPhiPhotonsEndcapPlus_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiPhotonsEndcapPlus_BXm1Empty"];
3017  if (meMETPhiPhotonsEndcapPlus_BXm1Empty && meMETPhiPhotonsEndcapPlus_BXm1Empty->getRootObject())
3018  meMETPhiPhotonsEndcapPlus_BXm1Empty->Fill(atan2(py_PhotonsEndcapPlus, px_PhotonsEndcapPlus));
3019  }
3020  if (pt_sum_PhF_Endcap_minus) {
3021  meMETPhiPhotonsEndcapMinus_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiPhotonsEndcapMinus_BXm1Empty"];
3022  if (meMETPhiPhotonsEndcapMinus_BXm1Empty && meMETPhiPhotonsEndcapMinus_BXm1Empty->getRootObject())
3023  meMETPhiPhotonsEndcapMinus_BXm1Empty->Fill(atan2(py_PhotonsEndcapMinus, px_PhotonsEndcapMinus));
3024  }
3025  if (pt_sum_HFH_plus) {
3026  meMETPhiHFHadronsPlus_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiHFHadronsPlus_BXm1Empty"];
3027  if (meMETPhiHFHadronsPlus_BXm1Empty && meMETPhiHFHadronsPlus_BXm1Empty->getRootObject())
3028  meMETPhiHFHadronsPlus_BXm1Empty->Fill(atan2(py_HFHadronsPlus, px_HFHadronsPlus));
3029  }
3030  if (pt_sum_HFH_minus) {
3031  meMETPhiHFHadronsMinus_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiHFHadronsMinus_BXm1Empty"];
3032  if (meMETPhiHFHadronsMinus_BXm1Empty && meMETPhiHFHadronsMinus_BXm1Empty->getRootObject())
3033  meMETPhiHFHadronsMinus_BXm1Empty->Fill(atan2(py_HFHadronsMinus, px_HFHadronsMinus));
3034  }
3035  if (pt_sum_HFE_plus) {
3036  meMETPhiHFEGammasPlus_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiHFEGammasPlus_BXm1Empty"];
3037  if (meMETPhiHFEGammasPlus_BXm1Empty && meMETPhiHFEGammasPlus_BXm1Empty->getRootObject())
3038  meMETPhiHFEGammasPlus_BXm1Empty->Fill(atan2(py_HFEGammasPlus, px_HFEGammasPlus));
3039  }
3040  if (pt_sum_HFE_minus) {
3041  meMETPhiHFEGammasMinus_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiHFEGammasMinus_BXm1Empty"];
3042  if (meMETPhiHFEGammasMinus_BXm1Empty && meMETPhiHFEGammasMinus_BXm1Empty->getRootObject())
3043  meMETPhiHFEGammasMinus_BXm1Empty->Fill(atan2(py_HFEGammasMinus, px_HFEGammasMinus));
3044  }
3045  }
3046 
3047  } //fill candidate plots only then
3048 
3049  // PFMET getters
3050  //----------------------------------------------------------------------------
3051  double pfPhotonEtFraction = pfmet->photonEtFraction();
3052  double pfPhotonEt = pfmet->photonEt();
3053  double pfNeutralHadronEtFraction = pfmet->neutralHadronEtFraction();
3054  double pfNeutralHadronEt = pfmet->neutralHadronEt();
3055  double pfElectronEt = pfmet->electronEt();
3056  double pfChargedHadronEtFraction = pfmet->chargedHadronEtFraction();
3057  double pfChargedHadronEt = pfmet->chargedHadronEt();
3058  double pfMuonEt = pfmet->muonEt();
3059  double pfHFHadronEtFraction = pfmet->HFHadronEtFraction();
3060  double pfHFHadronEt = pfmet->HFHadronEt();
3061  double pfHFEMEtFraction = pfmet->HFEMEtFraction();
3062  double pfHFEMEt = pfmet->HFEMEt();
3063  mePhotonEtFraction = map_of_MEs[DirName + "/PfPhotonEtFraction"];
3064  mePhotonEt = map_of_MEs[DirName + "/PfPhotonEt"];
3065  meNeutralHadronEtFraction = map_of_MEs[DirName + "/PfNeutralHadronEtFraction"];
3066  meNeutralHadronEt = map_of_MEs[DirName + "/PfNeutralHadronEt"];
3067  meElectronEt = map_of_MEs[DirName + "/PfElectronEt"];
3068  meChargedHadronEtFraction = map_of_MEs[DirName + "/PfChargedHadronEtFraction"];
3069  meChargedHadronEt = map_of_MEs[DirName + "/PfChargedHadronEt"];
3070  meMuonEt = map_of_MEs[DirName + "/PfMuonEt"];
3071  meHFHadronEtFraction = map_of_MEs[DirName + "/PfHFHadronEtFraction"];
3072  meHFHadronEt = map_of_MEs[DirName + "/PfHFHadronEt"];
3073  meHFEMEtFraction = map_of_MEs[DirName + "/PfHFEMEtFraction"];
3074  meHFEMEt = map_of_MEs[DirName + "/PfHFEMEt"];
3075 
3076  if (mePhotonEtFraction && mePhotonEtFraction->getRootObject())
3077  mePhotonEtFraction->Fill(pfPhotonEtFraction);
3078  if (mePhotonEt && mePhotonEt->getRootObject())
3079  mePhotonEt->Fill(pfPhotonEt);
3080  if (meNeutralHadronEtFraction && meNeutralHadronEtFraction->getRootObject())
3081  meNeutralHadronEtFraction->Fill(pfNeutralHadronEtFraction);
3082  if (meNeutralHadronEt && meNeutralHadronEt->getRootObject())
3083  meNeutralHadronEt->Fill(pfNeutralHadronEt);
3084  if (meElectronEt && meElectronEt->getRootObject())
3085  meElectronEt->Fill(pfElectronEt);
3086  if (meChargedHadronEtFraction && meChargedHadronEtFraction->getRootObject())
3087  meChargedHadronEtFraction->Fill(pfChargedHadronEtFraction);
3088  if (meChargedHadronEt && meChargedHadronEt->getRootObject())
3089  meChargedHadronEt->Fill(pfChargedHadronEt);
3090  if (meMuonEt && meMuonEt->getRootObject())
3091  meMuonEt->Fill(pfMuonEt);
3092  if (meHFHadronEtFraction && meHFHadronEtFraction->getRootObject())
3093  meHFHadronEtFraction->Fill(pfHFHadronEtFraction);
3094  if (meHFHadronEt && meHFHadronEt->getRootObject())
3095  meHFHadronEt->Fill(pfHFHadronEt);
3096  if (meHFEMEtFraction && meHFEMEtFraction->getRootObject())
3097  meHFEMEtFraction->Fill(pfHFEMEtFraction);
3098  if (meHFEMEt && meHFEMEt->getRootObject())
3099  meHFEMEt->Fill(pfHFEMEt);
3100 
3101  //NPV profiles
3102 
3103  mePhotonEtFraction_profile = map_of_MEs[DirName + "/PfPhotonEtFraction_profile"];
3104  mePhotonEt_profile = map_of_MEs[DirName + "/PfPhotonEt_profile"];
3105  meNeutralHadronEtFraction_profile = map_of_MEs[DirName + "/PfNeutralHadronEtFraction_profile"];
3106  meNeutralHadronEt_profile = map_of_MEs[DirName + "/PfNeutralHadronEt_profile"];
3107  meChargedHadronEtFraction_profile = map_of_MEs[DirName + "/PfChargedHadronEtFraction_profile"];
3108  meChargedHadronEt_profile = map_of_MEs[DirName + "/PfChargedHadronEt_profile"];
3109  meHFHadronEtFraction_profile = map_of_MEs[DirName + "/PfHFHadronEtFraction_profile"];
3110  meHFHadronEt_profile = map_of_MEs[DirName + "/PfHFHadronEt_profile"];
3111  meHFEMEtFraction_profile = map_of_MEs[DirName + "/PfHFEMEtFraction_profile"];
3112  meHFEMEt_profile = map_of_MEs[DirName + "/PfHFEMEt_profile"];
3113 
3114  if (mePhotonEtFraction_profile && mePhotonEtFraction_profile->getRootObject())
3115  mePhotonEtFraction_profile->Fill(numPV_, pfPhotonEtFraction);
3116  if (mePhotonEt_profile && mePhotonEt_profile->getRootObject())
3117  mePhotonEt_profile->Fill(numPV_, pfPhotonEt);
3118  if (meNeutralHadronEtFraction_profile && meNeutralHadronEtFraction_profile->getRootObject())
3119  meNeutralHadronEtFraction_profile->Fill(numPV_, pfNeutralHadronEtFraction);
3120  if (meNeutralHadronEt_profile && meNeutralHadronEt_profile->getRootObject())
3121  meNeutralHadronEt_profile->Fill(numPV_, pfNeutralHadronEt);
3122  if (meChargedHadronEtFraction_profile && meChargedHadronEtFraction_profile->getRootObject())
3123  meChargedHadronEtFraction_profile->Fill(numPV_, pfChargedHadronEtFraction);
3124  if (meChargedHadronEt_profile && meChargedHadronEt_profile->getRootObject())
3125  meChargedHadronEt_profile->Fill(numPV_, pfChargedHadronEt);
3126  if (meHFHadronEtFraction_profile && meHFHadronEtFraction_profile->getRootObject())
3127  meHFHadronEtFraction_profile->Fill(numPV_, pfHFHadronEtFraction);
3128  if (meHFHadronEt_profile && meHFHadronEt_profile->getRootObject())
3129  meHFHadronEt_profile->Fill(numPV_, pfHFHadronEt);
3130  if (meHFEMEtFraction_profile && meHFEMEtFraction_profile->getRootObject())
3131  meHFEMEtFraction_profile->Fill(numPV_, pfHFEMEtFraction);
3132  if (meHFEMEt_profile && meHFEMEt_profile->getRootObject())
3133  meHFEMEt_profile->Fill(numPV_, pfHFEMEt);
3134  }
3135 
3136  if (isMiniAODMet_) {
3137  mePhotonEtFraction = map_of_MEs[DirName + "/PfPhotonEtFraction"];
3138  meNeutralHadronEtFraction = map_of_MEs[DirName + "/PfNeutralHadronEtFraction"];
3139  meChargedHadronEtFraction = map_of_MEs[DirName + "/PfChargedHadronEtFraction"];
3140  meHFHadronEtFraction = map_of_MEs[DirName + "/PfHFHadronEtFraction"];
3141  meHFEMEtFraction = map_of_MEs[DirName + "/PfHFEMEtFraction"];
3142 
3143  if (mePhotonEtFraction && mePhotonEtFraction->getRootObject())
3144  mePhotonEtFraction->Fill(patmet->NeutralEMFraction());
3145  if (meNeutralHadronEtFraction && meNeutralHadronEtFraction->getRootObject())
3146  meNeutralHadronEtFraction->Fill(patmet->NeutralHadEtFraction());
3147  if (meChargedHadronEtFraction && meChargedHadronEtFraction->getRootObject())
3148  meChargedHadronEtFraction->Fill(patmet->ChargedHadEtFraction());
3149  if (meHFHadronEtFraction && meHFHadronEtFraction->getRootObject())
3150  meHFHadronEtFraction->Fill(patmet->Type6EtFraction()); //HFHadrons
3151  if (meHFEMEtFraction && meHFEMEtFraction->getRootObject())
3152  meHFEMEtFraction->Fill(patmet->Type7EtFraction());
3153 
3154  //NPV profiles
3155  mePhotonEtFraction_profile = map_of_MEs[DirName + "/PfPhotonEtFraction_profile"];
3156  meNeutralHadronEtFraction_profile = map_of_MEs[DirName + "/PfNeutralHadronEtFraction_profile"];
3157  meChargedHadronEtFraction_profile = map_of_MEs[DirName + "/PfChargedHadronEtFraction_profile"];
3158  meHFHadronEtFraction_profile = map_of_MEs[DirName + "/PfHFHadronEtFraction_profile"];
3159  meHFEMEtFraction_profile = map_of_MEs[DirName + "/PfHFEMEtFraction_profile"];
3160 
3161  if (mePhotonEtFraction_profile && mePhotonEtFraction_profile->getRootObject())
3162  mePhotonEtFraction_profile->Fill(numPV_, patmet->NeutralEMFraction());
3163  if (meNeutralHadronEtFraction_profile && meNeutralHadronEtFraction_profile->getRootObject())
3164  meNeutralHadronEtFraction_profile->Fill(numPV_, patmet->NeutralHadEtFraction());
3165  if (meChargedHadronEtFraction_profile && meChargedHadronEtFraction_profile->getRootObject())
3166  meChargedHadronEtFraction_profile->Fill(numPV_, patmet->ChargedHadEtFraction());
3167  if (meHFHadronEtFraction_profile && meHFHadronEtFraction_profile->getRootObject())
3168  meHFHadronEtFraction_profile->Fill(numPV_, patmet->Type6EtFraction());
3169  if (meHFEMEtFraction_profile && meHFEMEtFraction_profile->getRootObject())
3170  meHFEMEtFraction_profile->Fill(numPV_, patmet->Type7EtFraction());
3171 
3172  mePhotonEt = map_of_MEs[DirName + "/PfPhotonEt"];
3173  meNeutralHadronEt = map_of_MEs[DirName + "/PfNeutralHadronEt"];
3174  meChargedHadronEt = map_of_MEs[DirName + "/PfChargedHadronEt"];
3175  meHFHadronEt = map_of_MEs[DirName + "/PfHFHadronEt"];
3176  meHFEMEt = map_of_MEs[DirName + "/PfHFEMEt"];
3177  meMuonEt = map_of_MEs[DirName + "/PfMuonEt"];
3178  meElectronEt = map_of_MEs[DirName + "/PfElectronEt"];
3179 
3180  if (mePhotonEt && mePhotonEt->getRootObject())
3181  mePhotonEt->Fill(patmet->NeutralEMFraction() * patmet->sumEt());
3182  if (meNeutralHadronEt && meNeutralHadronEt->getRootObject())
3183  meNeutralHadronEt->Fill(patmet->NeutralHadEtFraction() * patmet->sumEt());
3184  if (meChargedHadronEt && meChargedHadronEt->getRootObject())
3185  meChargedHadronEt->Fill(patmet->ChargedHadEtFraction() * patmet->sumEt());
3186  if (meHFHadronEt && meHFHadronEt->getRootObject())
3187  meHFHadronEt->Fill(patmet->Type6EtFraction() * patmet->sumEt()); //HFHadrons
3188  if (meHFEMEt && meHFEMEt->getRootObject())
3189  meHFEMEt->Fill(patmet->Type7EtFraction() * patmet->sumEt());
3190  if (meMuonEt && meMuonEt->getRootObject())
3191  meMuonEt->Fill(patmet->MuonEtFraction() * patmet->sumEt());
3192  if (meElectronEt && meElectronEt->getRootObject())
3193  meElectronEt->Fill(patmet->ChargedEMEtFraction() * patmet->sumEt());
3194 
3195  //NPV profiles
3196  mePhotonEt_profile = map_of_MEs[DirName + "/PfPhotonEt_profile"];
3197  meNeutralHadronEt_profile = map_of_MEs[DirName + "/PfNeutralHadronEt_profile"];
3198  meChargedHadronEt_profile = map_of_MEs[DirName + "/PfChargedHadronEt_profile"];
3199  meHFHadronEt_profile = map_of_MEs[DirName + "/PfHFHadronEt_profile"];
3200  meHFEMEt_profile = map_of_MEs[DirName + "/PfHFEMEt_profile"];
3201 
3202  if (mePhotonEt_profile && mePhotonEt_profile->getRootObject())
3203  mePhotonEt_profile->Fill(numPV_, patmet->NeutralEMFraction() * patmet->sumEt());
3204  if (meNeutralHadronEt_profile && meNeutralHadronEt_profile->getRootObject())
3205  meNeutralHadronEt_profile->Fill(numPV_, patmet->NeutralHadEtFraction() * patmet->sumEt());
3206  if (meChargedHadronEt_profile && meChargedHadronEt_profile->getRootObject())
3207  meChargedHadronEt_profile->Fill(numPV_, patmet->ChargedHadEtFraction() * patmet->sumEt());
3208  if (meHFHadronEt_profile && meHFHadronEt_profile->getRootObject())
3209  meHFHadronEt_profile->Fill(numPV_, patmet->Type6EtFraction() * patmet->sumEt());
3210  if (meHFEMEt_profile && meHFEMEt_profile->getRootObject())
3211  meHFEMEt_profile->Fill(numPV_, patmet->Type7EtFraction() * patmet->sumEt());
3212  }
3213 
3214  if (isCaloMet_) {
3215  //if (bLumiSecPlot){//get from config level
3216  if (fill_met_high_level_histo) {
3217  hMExLS = map_of_MEs[DirName + "/" + "MExLS"];
3218  if (hMExLS && hMExLS->getRootObject())
3219  hMExLS->Fill(MEx, myLuminosityBlock);
3220  hMEyLS = map_of_MEs[DirName + "/" + "MEyLS"];
3221  if (hMEyLS && hMEyLS->getRootObject())
3222  hMEyLS->Fill(MEy, myLuminosityBlock);
3223  }
3224  }
3225  } //check if we only wanna do Z plots
3226 }
bool accept() const
Has at least one path accepted the event?
Analysis-level MET class.
Definition: MET.h:40
double Type6EtFraction() const
Definition: MET.h:142
double HFEMEt() const
Definition: PFMET.h:50
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
double neutralHadronEt() const
Definition: PFMET.h:35
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
double pt() const final
transverse momentum
double hadEtInHF() const
Definition: CaloMET.h:51
double chargedHadronEt() const
Definition: PFMET.h:41
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
double chargedHadronEtFraction() const
Definition: PFMET.h:40
double hadEtInHO() const
Definition: CaloMET.h:47
double ChargedEMEtFraction() const
Definition: MET.h:139
std::vector< T >::const_iterator search(const cond::Time_t &val, const std::vector< T > &container)
Definition: IOVProxy.cc:22
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:35
void bookMonitorElement(std::string, DQMStore::IBooker &, std::map< std::string, MonitorElement *> &, bool, bool, bool)
Definition: METAnalyzer.cc:252
T const * product() const
Definition: Handle.h:70
double neutralHadronEtFraction() const
Definition: PFMET.h:34
virtual MonitorElementData::Scope setScope(MonitorElementData::Scope newscope)
Definition: DQMStore.cc:50
double etFractionHadronic() const
Definition: CaloMET.h:41
double HFHadronEtFraction() const
Definition: PFMET.h:46
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
double sumEt() const
Definition: MET.h:56
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
double HFHadronEt() const
Definition: PFMET.h:47
double electronEt() const
Definition: PFMET.h:38
double emEtInEE() const
Definition: CaloMET.h:55
double Type7EtFraction() const
Definition: MET.h:143
Jet ID object.
Definition: JetID.h:16
double correction(const LorentzVector &fJet) const
get correction using Jet information only
Definition: JetCorrector.h:46
assert(be >=bs)
#define LogTrace(id)
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
double muonEt() const
Definition: PFMET.h:44
double HFEMEtFraction() const
Definition: PFMET.h:49
double emEtFraction() const
Definition: CaloMET.h:43
void makeRatePlot(std::string, double)
int iEvent
Definition: GenABIO.cc:224
void analyze(const edm::Event &, const edm::EventSetup &) override
Get the analysis.
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:408
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: MET.h:41
void dqmEndRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
Finish up a run.
T sqrt(T t)
Definition: SSEVec.h:23
void fillMonitorElement(const edm::Event &, std::string, std::string, const reco::MET &, const pat::MET *, const reco::PFMET *, const reco::CaloMET *, const reco::Candidate::PolarLorentzVector &, std::map< std::string, MonitorElement *> &, bool, bool, std::vector< bool >, std::vector< bool >)
double emEtInHF() const
Definition: CaloMET.h:57
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
const TechnicalTriggerWord & technicalTriggerWord(int bxInEventValue) const
double emEtInEB() const
Definition: CaloMET.h:53
UseScope< MonitorElementData::Scope::LUMI > UseLumiScope
Definition: DQMStore.h:549
double hadEtInHE() const
Definition: CaloMET.h:49
PF Jet selector for pat::Jets.
#define M_PI
double photonEt() const
Definition: PFMET.h:32
Jet selector for pat::Jets and for CaloJets.
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Initialize run-based parameters.
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
static std::string const triggerResults("TriggerResults")
virtual TH1F * getTH1F() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:221
double NeutralHadEtFraction() const
Definition: MET.h:138
double hadEtInHB() const
Definition: CaloMET.h:45
bool isValid() const
Definition: HandleBase.h:70
METAnalyzer(const edm::ParameterSet &)
Constructor.
Definition: METAnalyzer.cc:42
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
fixed size matrix
double ChargedHadEtFraction() const
Definition: MET.h:140
HLT enums.
double photonEtFraction() const
Definition: PFMET.h:31
static int position[264][3]
Definition: ReadPGInfo.cc:289
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Inizialize parameters for histo binning.
Definition: METAnalyzer.cc:197
~METAnalyzer() override
Destructor.
Definition: METAnalyzer.cc:188
TObject * getRootObject() const override
double NeutralEMFraction() const
Definition: MET.h:137
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
void bookMESet(std::string, DQMStore::IBooker &, std::map< std::string, MonitorElement *> &)
Definition: METAnalyzer.cc:225
fd
Definition: ztee.py:136
Definition: Run.h:45
void fillMESet(const edm::Event &, std::string, const reco::MET &, const pat::MET *, const reco::PFMET *, const reco::CaloMET *, const reco::Candidate::PolarLorentzVector &, std::map< std::string, MonitorElement *> &, std::vector< bool >, std::vector< bool >)
double MuonEtFraction() const
Definition: MET.h:141
#define LogDebug(id)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38