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 
51  LSBegin_ = pSet.getParameter<int>("LSBegin");
52  LSEnd_ = pSet.getParameter<int>("LSEnd");
53  // Smallest track pt
54  ptMinCand_ = pSet.getParameter<double>("ptMinCand");
55 
56  MetType_ = parameters.getUntrackedParameter<std::string>("METType");
57 
58  triggerResultsLabel_ = parameters.getParameter<edm::InputTag>("TriggerResultsLabel");
59  triggerResultsToken_= consumes<edm::TriggerResults>(edm::InputTag(triggerResultsLabel_));
60 
61  isCaloMet_ = (std::string("calo")==MetType_);
62  //isTCMet_ = (std::string("tc") ==MetType_);
63  isPFMet_ = (std::string("pf") ==MetType_);
64  isMiniAODMet_ = (std::string("miniaod") ==MetType_);
65  if(!isMiniAODMet_){
66  jetCorrectorToken_ = consumes<reco::JetCorrector>(pSet.getParameter<edm::InputTag>("JetCorrections"));
67  }
68 
69  // MET information
70  metCollectionLabel_ = parameters.getParameter<edm::InputTag>("METCollectionLabel");
71 
72  if(/*isTCMet_ || */isCaloMet_){
73  inputJetIDValueMap = pSet.getParameter<edm::InputTag>("InputJetIDValueMap");
74  jetID_ValueMapToken_= consumes< edm::ValueMap<reco::JetID> >(inputJetIDValueMap);
76  }
77 
78  if(isPFMet_){
79  pflowToken_ = consumes<std::vector<reco::PFCandidate> >(pSet.getParameter<edm::InputTag>("srcPFlow"));
81  }
82  if(isMiniAODMet_){
83  pflowPackedToken_ = consumes<std::vector<pat::PackedCandidate> >(pSet.getParameter<edm::InputTag>("srcPFlow"));
85  }
86  MuonsToken_ = consumes<reco::MuonCollection>(pSet.getParameter<edm::InputTag> ("muonsrc"));
87 
88  ptThreshold_ = parameters.getParameter<double>("ptThreshold");
89 
90 
91  if(isPFMet_){
92  pfMetToken_= consumes<reco::PFMETCollection>(edm::InputTag(metCollectionLabel_));
93  }
94  if(isCaloMet_){
95  caloMetToken_= consumes<reco::CaloMETCollection>(edm::InputTag(metCollectionLabel_));
96  }
97  if(isMiniAODMet_){
98  patMetToken_= consumes<pat::METCollection>(edm::InputTag(metCollectionLabel_));
99  }
100  //if(isTCMet_){
101  // tcMetToken_= consumes<reco::METCollection>(edm::InputTag(metCollectionLabel_));
102  //}
103 
104  fill_met_high_level_histo = parameters.getParameter<bool>("fillMetHighLevel");
105  fillCandidateMap_histos = parameters.getParameter<bool>("fillCandidateMaps");
106 
107  hTriggerLabelsIsSet_ = false;
108  //jet cleanup parameters
109  cleaningParameters_ = pSet.getParameter<ParameterSet>("CleaningParameters");
110 
111  diagnosticsParameters_ = pSet.getParameter<std::vector<edm::ParameterSet> >("METDiagonisticsParameters");
112 
113  edm::ConsumesCollector iC = consumesCollector();
114  //DCS
115  DCSFilter_ = new JetMETDQMDCSFilter(parameters.getParameter<ParameterSet>("DCSFilter"), iC );
116 
117  //Vertex requirements
118  bypassAllPVChecks_ = cleaningParameters_.getParameter<bool>("bypassAllPVChecks");
119  bypassAllDCSChecks_ = cleaningParameters_.getParameter<bool>("bypassAllDCSChecks");
120  runcosmics_ = parameters.getUntrackedParameter<bool>("runcosmics");
121  onlyCleaned_ = parameters.getUntrackedParameter<bool>("onlyCleaned");
122  vertexTag_ = cleaningParameters_.getParameter<edm::InputTag>("vertexCollection");
123  vertexToken_ = consumes<std::vector<reco::Vertex> >(edm::InputTag(vertexTag_));
124 
125  //Trigger parameters
126  gtTag_ = cleaningParameters_.getParameter<edm::InputTag>("gtLabel");
127  gtToken_= consumes<L1GlobalTriggerReadoutRecord>(edm::InputTag(gtTag_));
128 
129  // Other data collections
130  jetCollectionLabel_ = parameters.getParameter<edm::InputTag>("JetCollectionLabel");
131  if (isCaloMet_) caloJetsToken_ = consumes<reco::CaloJetCollection>(jetCollectionLabel_);
132  //if (isTCMet_) jptJetsToken_ = consumes<reco::JPTJetCollection>(jetCollectionLabel_);
133  if (isPFMet_) pfJetsToken_ = consumes<reco::PFJetCollection>(jetCollectionLabel_);
134  if (isMiniAODMet_) 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(); it!= triggerSelectedSubFolders_.end(); it++) {
171  triggerFolderEventFlag_.push_back(new GenericTriggerEventFlag( *it, consumesCollector(), *this ));
172  triggerFolderExpr_.push_back(it->getParameter<std::vector<std::string> >("hltPaths"));
173  triggerFolderLabels_.push_back(it->getParameter<std::string>("label"));
174  }
175 
176  cleaningParameters_ = parameters.getParameter<ParameterSet>("CleaningParameters");
177 
178  verbose_ = parameters.getParameter<int>("verbose");
179 
180  FolderName_ = parameters.getUntrackedParameter<std::string>("FolderName");
181 
182 }
183 
184 // ***********************************************************
186  for (std::vector<GenericTriggerEventFlag *>::const_iterator it = triggerFolderEventFlag_.begin(); it!= triggerFolderEventFlag_.end(); it++) {
187  delete *it;
188  }
189  delete DCSFilter_;
190 }
191 
192 
194  edm::Run const & iRun,
195  edm::EventSetup const &) {
196  std::string DirName = FolderName_+metCollectionLabel_.label();
197  ibooker.setCurrentFolder(DirName);
198 
199  if(!folderNames_.empty()){
200  folderNames_.clear();
201  }
202  if(runcosmics_){
203  folderNames_.push_back("Uncleaned");
204  }else{
205  if(!onlyCleaned_){
206  folderNames_.push_back("Uncleaned");
207  }
208  folderNames_.push_back("Cleaned");
209  folderNames_.push_back("DiJet");
210  if(!isMiniAODMet_){
211  folderNames_.push_back("ZJets");
212  }
213  }
214  for (std::vector<std::string>::const_iterator ic = folderNames_.begin();
215  ic != folderNames_.end(); ic++){
216  bookMESet(DirName+"/"+*ic, ibooker,map_dijet_MEs);
217  }
218 }
219 
220 
221 // ***********************************************************
222 void METAnalyzer::bookMESet(std::string DirName, DQMStore::IBooker & ibooker, std::map<std::string,MonitorElement*>& map_of_MEs)
223 {
224  bool bLumiSecPlot=fill_met_high_level_histo;
225  //bool inTriggerPathPlots=false;
226  bool fillPFCandidatePlots=false;
227  bool fillZPlots=false;
228 
229  if (DirName.find("Cleaned")!=std::string::npos) {
230  fillPFCandidatePlots=true;
231  bookMonitorElement(DirName,ibooker,map_of_MEs,bLumiSecPlot,fillPFCandidatePlots,fillZPlots);
232  //for (unsigned int i = 0; i<triggerFolderEventFlag_.size(); i++) {
233  //fillPFCandidatePlots=false;
234  //if (triggerFolderEventFlag_[i]->on()) {
235  //bookMonitorElement(DirName+"/"+triggerFolderLabels_[i],ibooker,map_of_MEs,bLumiSecPlot,fillPFCandidatePlots,fillZPlots);
236  //}
237  //}
238  }else if (DirName.find("ZJets")!=std::string::npos) {
239  fillPFCandidatePlots=false;
240  fillZPlots=true;
241  bookMonitorElement(DirName,ibooker,map_of_MEs,bLumiSecPlot,fillPFCandidatePlots,fillZPlots);
242  }else{
243  bookMonitorElement(DirName,ibooker,map_of_MEs,bLumiSecPlot,fillPFCandidatePlots,fillZPlots);
244  }
245 }
246 
247 // ***********************************************************
248 void METAnalyzer::bookMonitorElement(std::string DirName,DQMStore::IBooker & ibooker, std::map<std::string,MonitorElement*>& map_of_MEs, bool bLumiSecPlot=false, bool fillPFCandPlots=false, bool fillZPlots=false)
249 {
250  if (verbose_) std::cout << "bookMonitorElement " << DirName << std::endl;
251 
252  ibooker.setCurrentFolder(DirName);
253  if(fillZPlots){
254  if(isCaloMet_){
255  meZJets_u_par = ibooker.book1D("u_parallel_Z_inc", "u_parallel_Z_inc", 50, -1000., 75);
256  }else{
257  meZJets_u_par = ibooker.book1D("u_parallel_Z_inc", "u_parallel_Z_inc", 50, -800., 75);
258  }
259  meZJets_u_par_ZPt_0_15 = ibooker.book1D("u_parallel_ZPt_0_15", "u_parallel_ZPt_0_15", 50, -100, 75);
260  meZJets_u_par_ZPt_15_30 = ibooker.book1D("u_parallel_ZPt_15_30", "u_parallel_ZPt_15_30", 50, -100, 50);
261  meZJets_u_par_ZPt_30_55 = ibooker.book1D("u_parallel_ZPt_30_55", "u_parallel_ZPt_30_55", 50, -175, 50);
262  meZJets_u_par_ZPt_55_75 = ibooker.book1D("u_parallel_ZPt_55_75", "u_parallel_ZPt_55_75", 50, -175, 0);
263  meZJets_u_par_ZPt_75_150 = ibooker.book1D("u_parallel_ZPt_75_150", "u_parallel_ZPt_75_150", 50, -300, 0);
264  if(isCaloMet_){
265  meZJets_u_par_ZPt_150_290 = ibooker.book1D("u_parallel_ZPt_150_290", "u_parallel_ZPt_150_290", 50, -750, -100);
266  }else{
267  meZJets_u_par_ZPt_150_290 = ibooker.book1D("u_parallel_ZPt_150_290", "u_parallel_ZPt_150_290", 50, -450, -50);
268  }
269  if(isCaloMet_){
270  meZJets_u_par_ZPt_290 = ibooker.book1D("u_parallel_ZPt_290", "u_parallel_ZPt_290", 50, -1000., -350.);
271  }else{
272  meZJets_u_par_ZPt_290 = ibooker.book1D("u_parallel_ZPt_290", "u_parallel_ZPt_290", 50, -750., -150.);
273  }
274  meZJets_u_perp = ibooker.book1D("u_perp_Z_inc", "u_perp_Z_inc", 50, -85., 85.);
275  meZJets_u_perp_ZPt_0_15 = ibooker.book1D("u_perp_ZPt_0_15", "u_perp_ZPt_0_15", 50, -85., 85.);
276  meZJets_u_perp_ZPt_15_30 = ibooker.book1D("u_perp_ZPt_15_30", "u_perp_ZPt_15_30", 50, -85., 85.);
277  meZJets_u_perp_ZPt_30_55 = ibooker.book1D("u_perp_ZPt_30_55", "u_perp_ZPt_30_55", 50, -85., 85.);
278  meZJets_u_perp_ZPt_55_75 = ibooker.book1D("u_perp_ZPt_55_75", "u_perp_ZPt_55_75", 50, -85., 85.);
279  meZJets_u_perp_ZPt_75_150 = ibooker.book1D("u_perp_ZPt_75_150", "u_perp_ZPt_75_150", 50, -85., 85.);
280  meZJets_u_perp_ZPt_150_290 = ibooker.book1D("u_perp_ZPt_150_290", "u_perp_ZPt_150_290", 50, -85., 85.);
281  meZJets_u_perp_ZPt_290 = ibooker.book1D("u_perp_ZPt_290", "u_perp_ZPt_290", 50, -85., 85.);
282 
283  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_parallel_Z_inc",meZJets_u_par));
284  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_parallel_ZPt_0_15",meZJets_u_par_ZPt_0_15));
285  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_parallel_ZPt_15_30",meZJets_u_par_ZPt_15_30));
286  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_parallel_ZPt_30_55",meZJets_u_par_ZPt_30_55));
287  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_parallel_ZPt_55_75",meZJets_u_par_ZPt_55_75));
288  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_parallel_ZPt_75_150",meZJets_u_par_ZPt_75_150));
289  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_parallel_ZPt_150_290",meZJets_u_par_ZPt_150_290));
290  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_parallel_ZPt_290",meZJets_u_par_ZPt_290));
291 
292  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_perp_Z_inc",meZJets_u_perp));
293  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_perp_ZPt_0_15",meZJets_u_perp_ZPt_0_15));
294  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_perp_ZPt_15_30",meZJets_u_perp_ZPt_15_30));
295  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_perp_ZPt_30_55",meZJets_u_perp_ZPt_30_55));
296  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_perp_ZPt_55_75",meZJets_u_perp_ZPt_55_75));
297  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_perp_ZPt_75_150",meZJets_u_perp_ZPt_75_150));
298  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_perp_ZPt_150_290",meZJets_u_perp_ZPt_150_290));
299  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"u_perp_ZPt_290",meZJets_u_perp_ZPt_290));
300  }
301 
302  if(!fillZPlots){
303  hTrigger = ibooker.book1D("triggerResults", "triggerResults", 500, 0, 500);
304  for (unsigned int i = 0; i<allTriggerNames_.size();i++){
305  if(i<(unsigned int)hTrigger->getNbinsX()){
306  if (!hTriggerLabelsIsSet_) {
307  hTrigger->setBinLabel(i+1, allTriggerNames_[i]);
308  }
309  }
310  }
311  if (!hTriggerLabelsIsSet_) for (int i = allTriggerNames_.size(); i<hTrigger->getNbinsX();i++){
312  hTrigger->setBinLabel(i+1, "");
313  }
314  hTriggerLabelsIsSet_ = true;
315 
316  hMEx = ibooker.book1D("MEx", "MEx", 200, -500, 500);
317  hMEy = ibooker.book1D("MEy", "MEy", 200, -500, 500);
318  hMET = ibooker.book1D("MET", "MET", 200, 0, 1000);
319  hMET_2 = ibooker.book1D("MET_2", "MET Range 2",200, 0, 2000);
320  hSumET = ibooker.book1D("SumET", "SumET", 400, 0, 4000);
321  hMETSig = ibooker.book1D("METSig", "METSig", 51, 0, 51);
322  hMETSig->setLumiFlag();
323  hMETPhi = ibooker.book1D("METPhi", "METPhi", 60, -M_PI, M_PI);
324  hMET_logx = ibooker.book1D("MET_logx", "MET_logx", 40, -1, 9);
325  hSumET_logx = ibooker.book1D("SumET_logx", "SumET_logx", 40, -1, 9);
326 
327  hMEx ->setAxisTitle("MEx [GeV]", 1);
328  hMEy ->setAxisTitle("MEy [GeV]", 1);
329  hMET ->setAxisTitle("MET [GeV]", 1);
330  hMET_2 ->setAxisTitle("MET [GeV]", 1);
331  hSumET ->setAxisTitle("SumET [GeV]", 1);
332  hMETSig ->setAxisTitle("METSig", 1);
333  hMETPhi ->setAxisTitle("METPhi [rad]", 1);
334  hMET_logx ->setAxisTitle("log(MET) [GeV]", 1);
335  hSumET_logx->setAxisTitle("log(SumET) [GeV]", 1);
336 
337  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"triggerResults",hTrigger));
338  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MEx",hMEx));
339  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MEy",hMEy));
340  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET",hMET));
341  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET_2",hMET_2));
342  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"SumET",hSumET));
343  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METSig",hMETSig));
344  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhi",hMETPhi));
345  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET_logx",hMET_logx));
346  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"SumET_logx",hSumET_logx));
347 
348  hMET_HBHENoiseFilter = ibooker.book1D("MET_HBHENoiseFilter", "MET_HBHENoiseFiltered", 200, 0, 1000);
349  hMET_CSCTightHaloFilter = ibooker.book1D("MET_CSCTightHaloFilter", "MET_CSCTightHaloFiltered", 200, 0, 1000);
350  hMET_eeBadScFilter = ibooker.book1D("MET_eeBadScFilter", "MET_eeBadScFiltered", 200, 0, 1000);
351  hMET_HBHEIsoNoiseFilter = ibooker.book1D("MET_HBHEIsoNoiseFilter", "MET_HBHEIsoNoiseFiltered", 200, 0, 1000);
352  hMET_CSCTightHalo2015Filter = ibooker.book1D("MET_CSCTightHalo2015Filter", "MET_CSCTightHalo2015Filtered", 200, 0, 1000);
353  hMET_EcalDeadCellTriggerFilter = ibooker.book1D("MET_EcalDeadCellTriggerFilter", "MET_EcalDeadCellTriggerFiltered", 200, 0, 1000);
354  hMET_EcalDeadCellBoundaryFilter = ibooker.book1D("MET_EcalDeadCellBoundaryFilter", "MET_EcalDeadCellBoundaryFiltered", 200, 0, 1000);
355  hMET_HcalStripHaloFilter = ibooker.book1D("MET_HcalStripHaloFilter", "MET_HcalStripHaloFiltered", 200, 0, 1000);
356 
357  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET_HBHENoiseFilter",hMET_HBHENoiseFilter));
358  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET_CSCTightHaloFilter",hMET_CSCTightHaloFilter));
359  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET_eeBadScFilter",hMET_eeBadScFilter));
360  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET_HBHEIsoNoiseFilter",hMET_HBHEIsoNoiseFilter));
361  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET_CSCTightHalo2015Filter",hMET_CSCTightHalo2015Filter));
362  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET_EcalDeadCellTriggerFilter",hMET_EcalDeadCellTriggerFilter));
363  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET_EcalDeadCellBoundaryFilter",hMET_EcalDeadCellBoundaryFilter));
364  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET_HcalStripHaloFilter",hMET_HcalStripHaloFilter));
365 
366 
367  // Book NPV profiles --> would some of these profiles be interesting for other MET types too
368  //----------------------------------------------------------------------------
369  meMEx_profile = ibooker.bookProfile("MEx_profile", "met.px()", nbinsPV_, nPVMin_, nPVMax_, 200, -500, 500);
370  meMEy_profile = ibooker.bookProfile("MEy_profile", "met.py()", nbinsPV_, nPVMin_, nPVMax_, 200, -500, 500);
371  meMET_profile = ibooker.bookProfile("MET_profile", "met.pt()", nbinsPV_, nPVMin_, nPVMax_, 200, 0, 1000);
372  meSumET_profile = ibooker.bookProfile("SumET_profile", "met.sumEt()", nbinsPV_, nPVMin_, nPVMax_, 400, 0, 4000);
373  // Set NPV profiles x-axis title
374  //----------------------------------------------------------------------------
375  meMEx_profile ->setAxisTitle("nvtx", 1);
376  meMEy_profile ->setAxisTitle("nvtx", 1);
377  meMET_profile ->setAxisTitle("nvtx", 1);
378  meSumET_profile->setAxisTitle("nvtx", 1);
379 
380  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MEx_profile",meMEx_profile));
381  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MEy_profile",meMEy_profile));
382  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET_profile",meMET_profile));
383  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"SumET_profile",meSumET_profile));
384 
385 
386  if(isCaloMet_){
387  hCaloHadEtInHB = ibooker.book1D("CaloHadEtInHB","CaloHadEtInHB",50,0,2000);
388  hCaloHadEtInHB->setAxisTitle("Had Et [GeV]",1);
389  hCaloHadEtInHO = ibooker.book1D("CaloHadEtInHO","CaloHadEtInHO",25,0,500);
390  hCaloHadEtInHO->setAxisTitle("Had Et [GeV]",1);
391  hCaloHadEtInHE = ibooker.book1D("CaloHadEtInHE","CaloHadEtInHE",50,0,2000);
392  hCaloHadEtInHE->setAxisTitle("Had Et [GeV]",1);
393  hCaloHadEtInHF = ibooker.book1D("CaloHadEtInHF","CaloHadEtInHF",50,0,1000);
394  hCaloHadEtInHF->setAxisTitle("Had Et [GeV]",1);
395  hCaloEmEtInHF = ibooker.book1D("CaloEmEtInHF" ,"CaloEmEtInHF" ,25,0,500);
396  hCaloEmEtInHF->setAxisTitle("EM Et [GeV]",1);
397  hCaloEmEtInEE = ibooker.book1D("CaloEmEtInEE" ,"CaloEmEtInEE" ,50,0,1000);
398  hCaloEmEtInEE->setAxisTitle("EM Et [GeV]",1);
399  hCaloEmEtInEB = ibooker.book1D("CaloEmEtInEB" ,"CaloEmEtInEB" ,50,0,2000);
400  hCaloEmEtInEB->setAxisTitle("EM Et [GeV]",1);
401 
402  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"CaloHadEtInHO",hCaloHadEtInHO));
403  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"CaloHadEtInHF",hCaloHadEtInHF));
404  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"CaloHadEtInHE",hCaloHadEtInHE));
405  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"CaloHadEtInHB",hCaloHadEtInHB));
406  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"CaloEmEtInHF",hCaloEmEtInHF));
407  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"CaloEmEtInEE",hCaloEmEtInEE));
408  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"CaloEmEtInEB",hCaloEmEtInEB));
409 
410  hCaloMETPhi020 = ibooker.book1D("CaloMETPhi020", "CaloMETPhi020", 60, -M_PI, M_PI);
411  hCaloMETPhi020 ->setAxisTitle("METPhi [rad] (MET>20 GeV)", 1);
412 
413  hCaloEtFractionHadronic = ibooker.book1D("CaloEtFractionHadronic","CaloEtFractionHadronic",50,0,1);
414  hCaloEtFractionHadronic->setAxisTitle("Hadronic Et Fraction",1);
415  hCaloEmEtFraction = ibooker.book1D("CaloEmEtFraction", "CaloEmEtFraction" ,50,0,1);
416  hCaloEmEtFraction->setAxisTitle("EM Et Fraction",1);
417 
418  hCaloEmEtFraction020 = ibooker.book1D("CaloEmEtFraction020", "CaloEmEtFraction020" ,50,0,1);
419  hCaloEmEtFraction020->setAxisTitle("EM Et Fraction (MET>20 GeV)",1);
420 
421 
422  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"CaloMETPhi020",hCaloMETPhi020));
423  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"CaloEtFractionHadronic",hCaloEtFractionHadronic));
424  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"CaloEmEtFraction", hCaloEmEtFraction));
425  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"CaloEmEtFraction020",hCaloEmEtFraction020));
426 
427  }
428 
429  if(isPFMet_){
430  if(fillPFCandPlots && 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
431 
432  meCHF_Barrel = ibooker.book1D("PfChargedHadronEtFractionBarrel", "chargedHadronEtFractionBarrel", 50, 0, 1);
433  meCHF_EndcapPlus = ibooker.book1D("PfChargedHadronEtFractionEndcapPlus", "chargedHadronEtFractionEndcapPlus", 50, 0, 1);
434  meCHF_EndcapMinus = ibooker.book1D("PfChargedHadronEtFractionEndcapMinus", "chargedHadronEtFractionEndcapMinus", 50, 0, 1);
435  meCHF_Barrel_BXm1Empty = ibooker.book1D("PfChargedHadronEtFractionBarrel_BXm1Empty", "chargedHadronEtFractionBarrel prev empty bunch", 50, 0, 1);
436  meCHF_EndcapPlus_BXm1Empty = ibooker.book1D("PfChargedHadronEtFractionEndcapPlus_BXm1Empty", "chargedHadronEtFractionEndcapPlus prev empty bunch", 50, 0, 1);
437  meCHF_EndcapMinus_BXm1Empty = ibooker.book1D("PfChargedHadronEtFractionEndcapMinus_BXm1Empty", "chargedHadronEtFractionEndcapMinus prev empty bunch", 50, 0, 1);
438  meCHF_Barrel_BXm1Filled = ibooker.book1D("PfChargedHadronEtFractionBarrel_BXm1Filled", "chargedHadronEtFractionBarrel prev filled 2 bunches", 50, 0, 1);
439  meCHF_EndcapPlus_BXm1Filled = ibooker.book1D("PfChargedHadronEtFractionEndcapPlus_BXm1Filled", "chargedHadronEtFractionEndcapPlus prev filled bunch", 50, 0, 1);
440  meCHF_EndcapMinus_BXm1Filled = ibooker.book1D("PfChargedHadronEtFractionEndcapMinus_BXm1Filled", "chargedHadronEtFractionEndcapMinus prev filled bunch", 50, 0, 1);
441 
442  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionBarrel", meCHF_Barrel));
443  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapPlus", meCHF_EndcapPlus));
444  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapMinus", meCHF_EndcapMinus));
445  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm1Empty", meCHF_Barrel_BXm1Empty));
446  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm1Empty", meCHF_EndcapPlus_BXm1Empty));
447  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm1Empty", meCHF_EndcapMinus_BXm1Empty));
448  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm2BXm1Empty", meCHF_Barrel_BXm2BXm1Empty));
449  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm2BXm1Empty", meCHF_EndcapPlus_BXm2BXm1Empty));
450  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm2BXm1Empty", meCHF_EndcapMinus_BXm2BXm1Empty));
451  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm1Filled", meCHF_Barrel_BXm1Filled));
452  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm1Filled", meCHF_EndcapPlus_BXm1Filled));
453  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm1Filled", meCHF_EndcapMinus_BXm1Filled));
454  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm2BXm1Filled", meCHF_Barrel_BXm2BXm1Filled));
455  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm2BXm1Filled", meCHF_EndcapPlus_BXm2BXm1Filled));
456  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm2BXm1Filled", meCHF_EndcapMinus_BXm2BXm1Filled));
457 
458  meNHF_Barrel = ibooker.book1D("PfNeutralHadronEtFractionBarrel", "neutralHadronEtFractionBarrel", 50, 0, 1);
459  meNHF_EndcapPlus = ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus", "neutralHadronEtFractionEndcapPlus", 50, 0, 1);
460  meNHF_EndcapMinus = ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus", "neutralHadronEtFractionEndcapMinus", 50, 0, 1);
461  meNHF_Barrel_BXm1Empty = ibooker.book1D("PfNeutralHadronEtFractionBarrel_BXm1Empty", "neutralHadronEtFractionBarrel prev empty bunch", 50, 0, 1);
462  meNHF_EndcapPlus_BXm1Empty = ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus_BXm1Empty", "neutralHadronEtFractionEndcapPlus prev empty bunch", 50, 0, 1);
463  meNHF_EndcapMinus_BXm1Empty = ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus_BXm1Empty", "neutralHadronEtFractionEndcapMinus prev empty bunch", 50, 0, 1);
464  //meNHF_Barrel_BXm2BXm1Empty = ibooker.book1D("PfNeutralHadronEtFractionBarrel_BXm2BXm1Empty", "neutralHadronEtFractionBarrel prev empty 2 bunches", 50, 0, 1);
465  //meNHF_EndcapPlus_BXm2BXm1Empty = ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Empty", "neutralHadronEtFractionEndcapPlus prev empty 2 bunches", 50, 0, 1);
466  //meNHF_EndcapMinus_BXm2BXm1Empty = ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Empty", "neutralHadronEtFractionEndcapMinus prev empty 2 bunches", 50, 0, 1);
467  meNHF_Barrel_BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionBarrel_BXm1Filled", "neutralHadronEtFractionBarrel prev filled 2 bunches", 50, 0, 1);
468  meNHF_EndcapPlus_BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus_BXm1Filled", "neutralHadronEtFractionEndcapPlus prev filled bunch", 50, 0, 1);
469  meNHF_EndcapMinus_BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus_BXm1Filled", "neutralHadronEtFractionEndcapMinus prev filled bunch", 50, 0, 1);
470  //meNHF_Barrel_BXm2BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionBarrel_BXm2BXm1Filled", "neutralHadronEtFractionBarrel prev filled 2 bunches", 50, 0, 1);
471  //meNHF_EndcapPlus_BXm2BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Filled", "neutralHadronEtFractionEndcapPlus prev filled 2 bunches", 50, 0, 1);
472  //meNHF_EndcapMinus_BXm2BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Filled", "neutralHadronEtFractionEndcapMinus prev filled 2 bunches", 50, 0, 1);
473 
474  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionBarrel", meNHF_Barrel));
475  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus", meNHF_EndcapPlus));
476  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus", meNHF_EndcapMinus));
477  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm1Empty", meNHF_Barrel_BXm1Empty));
478  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm1Empty", meNHF_EndcapPlus_BXm1Empty));
479  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm1Empty", meNHF_EndcapMinus_BXm1Empty));
480  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm2BXm1Empty", meNHF_Barrel_BXm2BXm1Empty));
481  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Empty", meNHF_EndcapPlus_BXm2BXm1Empty));
482  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Empty", meNHF_EndcapMinus_BXm2BXm1Empty));
483  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm1Filled", meNHF_Barrel_BXm1Filled));
484  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm1Filled", meNHF_EndcapPlus_BXm1Filled));
485  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm1Filled", meNHF_EndcapMinus_BXm1Filled));
486  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm2BXm1Filled", meNHF_Barrel_BXm2BXm1Filled));
487  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Filled", meNHF_EndcapPlus_BXm2BXm1Filled));
488  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Filled", meNHF_EndcapMinus_BXm2BXm1Filled));
489 
490  mePhF_Barrel = ibooker.book1D("PfPhotonEtFractionBarrel", "photonEtFractionBarrel", 50, 0, 1);
491  mePhF_EndcapPlus = ibooker.book1D("PfPhotonEtFractionEndcapPlus", "photonEtFractionEndcapPlus", 50, 0, 1);
492  mePhF_EndcapMinus = ibooker.book1D("PfPhotonEtFractionEndcapMinus", "photonEtFractionEndcapMinus", 50, 0, 1);
493  mePhF_Barrel_BXm1Empty = ibooker.book1D("PfPhotonEtFractionBarrel_BXm1Empty", "photonEtFractionBarrel prev empty bunch", 50, 0, 1);
494  mePhF_EndcapPlus_BXm1Empty = ibooker.book1D("PfPhotonEtFractionEndcapPlus_BXm1Empty", "photonEtFractionEndcapPlus prev empty bunch", 50, 0, 1);
495  mePhF_EndcapMinus_BXm1Empty = ibooker.book1D("PfPhotonEtFractionEndcapMinus_BXm1Empty", "photonEtFractionEndcapMinus prev empty bunch", 50, 0, 1);
496  //mePhF_Barrel_BXm2BXm1Empty = ibooker.book1D("PfPhotonEtFractionBarrel_BXm2BXm1Empty", "photonEtFractionBarrel prev empty 2 bunches", 50, 0, 1);
497  //mePhF_EndcapPlus_BXm2BXm1Empty = ibooker.book1D("PfPhotonEtFractionEndcapPlus_BXm2BXm1Empty", "photonEtFractionEndcapPlus prev empty 2 bunches", 50, 0, 1);
498  //mePhF_EndcapMinus_BXm2BXm1Empty = ibooker.book1D("PfPhotonEtFractionEndcapMinus_BXm2BXm1Empty", "photonEtFractionEndcapMinus prev empty 2 bunches", 50, 0, 1);
499  mePhF_Barrel_BXm1Filled = ibooker.book1D("PfPhotonEtFractionBarrel_BXm1Filled", "photonEtFractionBarrel prev filled 2 bunches", 50, 0, 1);
500  mePhF_EndcapPlus_BXm1Filled = ibooker.book1D("PfPhotonEtFractionEndcapPlus_BXm1Filled", "photonEtFractionEndcapPlus prev filled bunch", 50, 0, 1);
501  mePhF_EndcapMinus_BXm1Filled = ibooker.book1D("PfPhotonEtFractionEndcapMinus_BXm1Filled", "photonEtFractionEndcapMinus prev filled bunch", 50, 0, 1);
502  //mePhF_Barrel_BXm2BXm1Filled = ibooker.book1D("PfPhotonEtFractionBarrel_BXm2BXm1Filled", "photonEtFractionBarrel prev filled 2 bunches", 50, 0, 1);
503  //mePhF_EndcapPlus_BXm2BXm1Filled = ibooker.book1D("PfPhotonEtFractionEndcapPlus_BXm2BXm1Filled", "photonEtFractionEndcapPlus prev filled 2 bunches", 50, 0, 1);
504  //mePhF_EndcapMinus_BXm2BXm1Filled = ibooker.book1D("PfPhotonEtFractionEndcapMinus_BXm2BXm1Filled", "photonEtFractionEndcapMinus prev filled 2 bunches", 50, 0, 1);
505 
506  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionBarrel", mePhF_Barrel));
507  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapPlus", mePhF_EndcapPlus));
508  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapMinus", mePhF_EndcapMinus));
509  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionBarrel_BXm1Empty", mePhF_Barrel_BXm1Empty));
510  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm1Empty", mePhF_EndcapPlus_BXm1Empty));
511  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm1Empty", mePhF_EndcapMinus_BXm1Empty));
512  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionBarrel_BXm2BXm1Empty", mePhF_Barrel_BXm2BXm1Empty));
513  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm2BXm1Empty", mePhF_EndcapPlus_BXm2BXm1Empty));
514  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm2BXm1Empty", mePhF_EndcapMinus_BXm2BXm1Empty));
515  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionBarrel_BXm1Filled", mePhF_Barrel_BXm1Filled));
516  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm1Filled", mePhF_EndcapPlus_BXm1Filled));
517  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm1Filled", mePhF_EndcapMinus_BXm1Filled));
518  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionBarrel_BXm2BXm1Filled", mePhF_Barrel_BXm2BXm1Filled));
519  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm2BXm1Filled", mePhF_EndcapPlus_BXm2BXm1Filled));
520  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm2BXm1Filled", mePhF_EndcapMinus_BXm2BXm1Filled));
521 
522  meHFHadF_Plus = ibooker.book1D("PfHFHadronEtFractionPlus", "HFHadronEtFractionPlus", 50, 0, 1);
523  meHFHadF_Minus = ibooker.book1D("PfHFHadronEtFractionMinus", "HFHadronEtFractionMinus", 50, 0, 1);
524  meHFHadF_Plus_BXm1Empty = ibooker.book1D("PfHFHadronEtFractionPlus_BXm1Empty", "HFHadronEtFractionPlus prev empty bunch", 50, 0, 1);
525  meHFHadF_Minus_BXm1Empty = ibooker.book1D("PfHFHadronEtFractionMinus_BXm1Empty", "HFHadronEtFractionMinus prev empty bunch", 50, 0, 1);
526  //meHFHadF_Plus_BXm2BXm1Empty = ibooker.book1D("PfHFHadronEtFractionPlus_BXm2BXm1Empty", "HFHadronEtFractionPlus prev empty 2 bunches", 50, 0, 1);
527  //meHFHadF_Minus_BXm2BXm1Empty = ibooker.book1D("PfHFHadronEtFractionMinus_BXm2BXm1Empty", "HFHadronEtFractionMinus prev empty 2 bunches", 50, 0, 1);
528  meHFHadF_Plus_BXm1Filled = ibooker.book1D("PfHFHadronEtFractionPlus_BXm1Filled", "HFHadronEtFractionPlus prev filled bunch", 50, 0, 1);
529  meHFHadF_Minus_BXm1Filled = ibooker.book1D("PfHFHadronEtFractionMinus_BXm1Filled", "HFHadronEtFractionMinus prev filled bunch", 50, 0, 1);
530  //meHFHadF_Plus_BXm2BXm1Filled = ibooker.book1D("PfHFHadronEtFractionPlus_BXm2BXm1Filled", "HFHadronEtFractionPlus prev filled 2 bunches", 50, 0, 1);
531  //meHFHadF_Minus_BXm2BXm1Filled = ibooker.book1D("PfHFHadronEtFractionMinus_BXm2BXm1Filled", "HFHadronEtFractionMinus prev filled 2 bunches", 50, 0, 1);
532 
533  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionPlus", meHFHadF_Plus));
534  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionMinus", meHFHadF_Minus));
535  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionPlus_BXm1Empty", meHFHadF_Plus_BXm1Empty));
536  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionMinus_BXm1Empty", meHFHadF_Minus_BXm1Empty));
537  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionPlus_BXm2BXm1Empty", meHFHadF_Plus_BXm2BXm1Empty));
538  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionMinus_BXm2BXm1Empty", meHFHadF_Minus_BXm2BXm1Empty));
539  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionPlus_BXm1Filled", meHFHadF_Plus_BXm1Filled));
540  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionMinus_BXm1Filled", meHFHadF_Minus_BXm1Filled));
541  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionPlus_BXm2BXm1Filled", meHFHadF_Plus_BXm2BXm1Filled));
542  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionMinus_BXm2BXm1Filled", meHFHadF_Minus_BXm2BXm1Filled));
543 
544  meHFEMF_Plus = ibooker.book1D("PfHFEMEtFractionPlus", "HFEMEtFractionPlus", 50, 0, 1);
545  meHFEMF_Minus = ibooker.book1D("PfHFEMEtFractionMinus", "HFEMEtFractionMinus", 50, 0, 1);
546  meHFEMF_Plus_BXm1Empty = ibooker.book1D("PfHFEMEtFractionPlus_BXm1Empty", "HFEMEtFractionPlus prev empty bunch", 50, 0, 1);
547  meHFEMF_Minus_BXm1Empty = ibooker.book1D("PfHFEMEtFractionMinus_BXm1Empty", "HFEMEtFractionMinus prev empty bunch", 50, 0, 1);
548  //meHFEMF_Plus_BXm2BXm1Empty = ibooker.book1D("PfHFEMEtFractionPlus_BXm2BXm1Empty", "HFEMEtFractionPlus prev empty 2 bunches", 50, 0, 1);
549  //meHFEMF_Minus_BXm2BXm1Empty = ibooker.book1D("PfHFEMEtFractionMinus_BXm2BXm1Empty", "HFEMEtFractionMinus prev empty 2 bunches", 50, 0, 1);
550  meHFEMF_Plus_BXm1Filled = ibooker.book1D("PfHFEMEtFractionPlus_BXm1Filled", "HFEMEtFractionPlus prev filled bunch", 50, 0, 1);
551  meHFEMF_Minus_BXm1Filled = ibooker.book1D("PfHFEMEtFractionMinus_BXm1Filled", "HFEMEtFractionMinus prev filled bunch", 50, 0, 1);
552  //meHFEMF_Plus_BXm2BXm1Filled = ibooker.book1D("PfHFEMEtFractionPlus_BXm2BXm1Filled", "HFEMEtFractionPlus prev filled 2 bunches", 50, 0, 1);
553  //meHFEMF_Minus_BXm2BXm1Filled = ibooker.book1D("PfHFEMEtFractionMinus_BXm2BXm1Filled", "HFEMEtFractionMinus prev filled 2 bunches", 50, 0, 1);
554 
555  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionPlus", meHFEMF_Plus));
556  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionMinus", meHFEMF_Minus));
557  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionPlus_BXm1Empty", meHFEMF_Plus_BXm1Empty));
558  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionMinus_BXm1Empty", meHFEMF_Minus_BXm1Empty));
559  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionPlus_BXm2BXm1Empty", meHFEMF_Plus_BXm2BXm1Empty));
560  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionMinus_BXm2BXm1Empty", meHFEMF_Minus_BXm2BXm1Empty));
561  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionPlus_BXm1Filled", meHFEMF_Plus_BXm1Filled));
562  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionMinus_BXm1Filled", meHFEMF_Minus_BXm1Filled));
563  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionPlus_BXm2BXm1Filled", meHFEMF_Plus_BXm2BXm1Filled));
564  //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionMinus_BXm2BXm1Filled", meHFEMF_Minus_BXm2BXm1Filled));
565  /*
566  meMETPhiChargedHadronsBarrel_BXm2BXm1Filled = ibooker.book1D("METPhiChargedHadronsBarrel_BXm2BXm1Filled", "METPhi_PFChargedHadronsBarrel prev two bunches filled", 50, -M_PI,M_PI);
567  meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled = ibooker.book1D("METPhiChargedHadronsEndcapPlus_BXm2BXm1Filled", "METPhi_PFChargedHadronsEndcapPlus prev two bunches filled", 50, -M_PI,M_PI);
568  meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled = ibooker.book1D("METPhiChargedHadronsEndcapMinus_BXm2BXm1Filled","METPhi_PFChargedHadronsEndcapMinus prev two bunches filled", 50, -M_PI,M_PI);
569  meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled = ibooker.book1D("METPhiNeutralHadronsBarrel_BXm2BXm1Filled", "METPhi_PFNeutralHadronsBarrel prev two bunches filled", 50, -M_PI,M_PI);
570  meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled = ibooker.book1D("METPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled", "METPhi_PFNeutralHadronsEndcapPlus prev two bunches filled", 50, -M_PI,M_PI);
571  meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled = ibooker.book1D("METPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled","METPhi_PFNeutralHadronsEndcapMinus prev two bunches filled", 50, -M_PI,M_PI);
572  meMETPhiPhotonsBarrel_BXm2BXm1Filled = ibooker.book1D("METPhiPhotonsBarrel_BXm2BXm1Filled", "METPhi_PFPhotonsBarrel prev two bunches filled", 50, -M_PI,M_PI);
573  meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled = ibooker.book1D("METPhiPhotonsEndcapPlus_BXm2BXm1Filled", "METPhi_PFPhotonsEndcapPlus prev two bunches filled", 50, -M_PI,M_PI);
574  meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled = ibooker.book1D("METPhiPhotonsEndcapMinus_BXm2BXm1Filled", "METPhi_PFPhotonsEndcapMinus prev two bunches filled", 50, -M_PI,M_PI);
575  meMETPhiHFHadronsPlus_BXm2BXm1Filled = ibooker.book1D("METPhiHFHadronsPlus_BXm2BXm1Filled", "METPhi_PFHFHadronsPlus prev two bunches filled", 50, -M_PI,M_PI);
576  meMETPhiHFHadronsMinus_BXm2BXm1Filled = ibooker.book1D("METPhiHFHadronsMinus_BXm2BXm1Filled", "METPhi_PFHFHadronsMinus prev two bunches filled", 50, -M_PI,M_PI);
577  meMETPhiHFEGammasPlus_BXm2BXm1Filled = ibooker.book1D("METPhiHFEGammasPlus_BXm2BXm1Filled", "METPhi_PFHFEGammasPlus prev two bunches filled", 50, -M_PI,M_PI);
578  meMETPhiHFEGammasMinus_BXm2BXm1Filled = ibooker.book1D("METPhiHFEGammasMinus_BXm2BXm1Filled", "METPhi_PFHFEGammasMinus prev two bunches filled", 50, -M_PI,M_PI);
579 
580  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsBarrel_BXm2BXm1Filled" ,meMETPhiChargedHadronsBarrel_BXm2BXm1Filled));
581  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm2BXm1Filled" ,meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled));
582  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm2BXm1Filled" ,meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled));
583  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsBarrel_BXm2BXm1Filled" ,meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled));
584  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled" ,meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled));
585  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled" ,meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled));
586  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsBarrel_BXm2BXm1Filled" ,meMETPhiPhotonsBarrel_BXm2BXm1Filled));
587  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapPlus_BXm2BXm1Filled" ,meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled));
588  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapMinus_BXm2BXm1Filled" ,meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled));
589  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsPlus_BXm2BXm1Filled" ,meMETPhiHFHadronsPlus_BXm2BXm1Filled));
590  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsMinus_BXm2BXm1Filled" ,meMETPhiHFHadronsMinus_BXm2BXm1Filled));
591  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasPlus_BXm2BXm1Filled" ,meMETPhiHFEGammasPlus_BXm2BXm1Filled));
592  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasMinus_BXm2BXm1Filled" ,meMETPhiHFEGammasMinus_BXm2BXm1Filled));
593 
594  meMETPhiChargedHadronsBarrel_BXm2BXm1Empty = ibooker.book1D("METPhiChargedHadronsBarrel_BXm2BXm1Empty", "METPhi_PFChargedHadronsBarrel prev two bunches empty", 50, -M_PI,M_PI);
595  meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty = ibooker.book1D("METPhiChargedHadronsEndcapPlus_BXm2BXm1Empty", "METPhi_PFChargedHadronsEndcapPlus prev two bunches empty", 50, -M_PI,M_PI);
596  meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty = ibooker.book1D("METPhiChargedHadronsEndcapMinus_BXm2BXm1Empty","METPhi_PFChargedHadronsEndcapMinus prev two bunches empty", 50, -M_PI,M_PI);
597  meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty = ibooker.book1D("METPhiNeutralHadronsBarrel_BXm2BXm1Empty", "METPhi_PFNeutralHadronsBarrel prev two bunches empty", 50, -M_PI,M_PI);
598  meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty = ibooker.book1D("METPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty", "METPhi_PFNeutralHadronsEndcapPlus prev two bunches empty", 50, -M_PI,M_PI);
599  meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty = ibooker.book1D("METPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty","METPhi_PFNeutralHadronsEndcapMinus prev two bunches empty", 50, -M_PI,M_PI);
600  meMETPhiPhotonsBarrel_BXm2BXm1Empty = ibooker.book1D("METPhiPhotonsBarrel_BXm2BXm1Empty", "METPhi_PFPhotonsBarrel prev two bunches empty", 50, -M_PI,M_PI);
601  meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty = ibooker.book1D("METPhiPhotonsEndcapPlus_BXm2BXm1Empty", "METPhi_PFPhotonsEndcapPlus prev two bunches empty", 50, -M_PI,M_PI);
602  meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty = ibooker.book1D("METPhiPhotonsEndcapMinus_BXm2BXm1Empty", "METPhi_PFPhotonsEndcapMinus prev two bunches empty", 50, -M_PI,M_PI);
603  meMETPhiHFHadronsPlus_BXm2BXm1Empty = ibooker.book1D("METPhiHFHadronsPlus_BXm2BXm1Empty", "METPhi_PFHFHadronsPlus prev two bunches empty", 50, -M_PI,M_PI);
604  meMETPhiHFHadronsMinus_BXm2BXm1Empty = ibooker.book1D("METPhiHFHadronsMinus_BXm2BXm1Empty", "METPhi_PFHFHadronsMinus prev two bunches empty", 50, -M_PI,M_PI);
605  meMETPhiHFEGammasPlus_BXm2BXm1Empty = ibooker.book1D("METPhiHFEGammasPlus_BXm2BXm1Empty", "METPhi_PFHFEGammasPlus prev two bunches empty", 50, -M_PI,M_PI);
606  meMETPhiHFEGammasMinus_BXm2BXm1Empty = ibooker.book1D("METPhiHFEGammasMinus_BXm2BXm1Empty", "METPhi_PFHFEGammasMinus prev two bunches empty", 50, -M_PI,M_PI);
607 
608  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsBarrel_BXm2BXm1Empty" ,meMETPhiChargedHadronsBarrel_BXm2BXm1Empty));
609  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm2BXm1Empty" ,meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty));
610  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm2BXm1Empty" ,meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty));
611  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsBarrel_BXm2BXm1Empty" ,meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty));
612  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty" ,meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty));
613  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty" ,meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty));
614  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsBarrel_BXm2BXm1Empty" ,meMETPhiPhotonsBarrel_BXm2BXm1Empty));
615  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapPlus_BXm2BXm1Empty" ,meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty));
616  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapMinus_BXm2BXm1Empty" ,meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty));
617  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsPlus_BXm2BXm1Empty" ,meMETPhiHFHadronsPlus_BXm2BXm1Empty));
618  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsMinus_BXm2BXm1Empty" ,meMETPhiHFHadronsMinus_BXm2BXm1Empty));
619  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasPlus_BXm2BXm1Empty" ,meMETPhiHFEGammasPlus_BXm2BXm1Empty));
620  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasMinus_BXm2BXm1Empty" ,meMETPhiHFEGammasMinus_BXm2BXm1Empty));
621  */
622  //histos where one previous bunch was empty/filled
623  mePhotonEtFraction_BXm1Empty = ibooker.book1D("PfPhotonEtFraction_BXm1Empty", "photonEtFraction() prev empty bunch", 50, 0, 1);
624  mePhotonEtFraction_BXm1Filled = ibooker.book1D("PfPhotonEtFraction_BXm1Filled", "photonEtFraction() prev filled bunch", 50, 0, 1);
625  meNeutralHadronEtFraction_BXm1Empty = ibooker.book1D("PfNeutralHadronEtFraction_BXm1Empty", "neutralHadronEtFraction() prev empty bunch", 50, 0, 1);
626  meNeutralHadronEtFraction_BXm1Filled = ibooker.book1D("PfNeutralHadronEtFraction_BXm1Filled", "neutralHadronEtFraction() prev filled bunch", 50, 0, 1);
627  meChargedHadronEtFraction_BXm1Empty = ibooker.book1D("PfChargedHadronEtFraction_BXm1Empty", "chargedHadronEtFraction() prev empty bunch", 50, 0, 1);
628  meChargedHadronEtFraction_BXm1Filled = ibooker.book1D("PfChargedHadronEtFraction_BXm1Filled", "chargedHadronEtFraction() prev filled bunch", 50, 0, 1);
629  meMET_BXm1Empty = ibooker.book1D("MET_BXm1Empty", "MET prev empty bunch", 200, 0, 1000);
630  meMET_BXm1Filled = ibooker.book1D("MET_BXm1Filled", "MET prev filled bunch", 200, 0, 1000);
631  meSumET_BXm1Empty = ibooker.book1D("SumET_BXm1Empty", "SumET prev empty bunch", 400, 0, 4000);
632  meSumET_BXm1Filled = ibooker.book1D("SumET_BXm1Filled", "SumET prev filled bunch", 400, 0, 4000);
633 
634  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFraction_BXm1Empty" ,mePhotonEtFraction_BXm1Empty));
635  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFraction_BXm1Filled" ,mePhotonEtFraction_BXm1Filled));
636  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFraction_BXm1Empty" ,meNeutralHadronEtFraction_BXm1Empty));
637  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralEtFraction_BXm1Filled" ,meNeutralHadronEtFraction_BXm1Filled));
638  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFraction_BXm1Empty" ,meChargedHadronEtFraction_BXm1Empty));
639  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedEtFraction_BXm1Filled" ,meChargedHadronEtFraction_BXm1Filled));
640  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET_BXm1Empty" ,meMET_BXm1Empty));
641  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MET_BXm1Filled" ,meMET_BXm1Filled));
642  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"SumET_BXm1Empty" ,meSumET_BXm1Empty));
643  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"SumET_BXm1Filled",meSumET_BXm1Filled));
644 
645  meMETPhiChargedHadronsBarrel_BXm1Filled = ibooker.book1D("METPhiChargedHadronsBarrel_BXm1Filled", "METPhi_PFChargedHadronsBarrel prev bunch filled", 50, -M_PI,M_PI);
646  meMETPhiChargedHadronsEndcapPlus_BXm1Filled = ibooker.book1D("METPhiChargedHadronsEndcapPlus_BXm1Filled", "METPhi_PFChargedHadronsEndcapPlus prev bunch filled", 50, -M_PI,M_PI);
647  meMETPhiChargedHadronsEndcapMinus_BXm1Filled = ibooker.book1D("METPhiChargedHadronsEndcapMinus_BXm1Filled","METPhi_PFChargedHadronsEndcapMinus prev bunch filled", 50, -M_PI,M_PI);
648  meMETPhiNeutralHadronsBarrel_BXm1Filled = ibooker.book1D("METPhiNeutralHadronsBarrel_BXm1Filled", "METPhi_PFNeutralHadronsBarrel prev bunch filled", 50, -M_PI,M_PI);
649  meMETPhiNeutralHadronsEndcapPlus_BXm1Filled = ibooker.book1D("METPhiNeutralHadronsEndcapPlus_BXm1Filled", "METPhi_PFNeutralHadronsEndcapPlus prev bunch filled", 50, -M_PI,M_PI);
650  meMETPhiNeutralHadronsEndcapMinus_BXm1Filled = ibooker.book1D("METPhiNeutralHadronsEndcapMinus_BXm1Filled","METPhi_PFNeutralHadronsEndcapMinus prev bunch filled", 50, -M_PI,M_PI);
651  meMETPhiPhotonsBarrel_BXm1Filled = ibooker.book1D("METPhiPhotonsBarrel_BXm1Filled", "METPhi_PFPhotonsBarrel prev bunch filled", 50, -M_PI,M_PI);
652  meMETPhiPhotonsEndcapPlus_BXm1Filled = ibooker.book1D("METPhiPhotonsEndcapPlus_BXm1Filled", "METPhi_PFPhotonsEndcapPlus prev bunch filled", 50, -M_PI,M_PI);
653  meMETPhiPhotonsEndcapMinus_BXm1Filled = ibooker.book1D("METPhiPhotonsEndcapMinus_BXm1Filled", "METPhi_PFPhotonsEndcapMinus prev bunch filled", 50, -M_PI,M_PI);
654  meMETPhiHFHadronsPlus_BXm1Filled = ibooker.book1D("METPhiHFHadronsPlus_BXm1Filled", "METPhi_PFHFHadronsPlus prev bunch filled", 50, -M_PI,M_PI);
655  meMETPhiHFHadronsMinus_BXm1Filled = ibooker.book1D("METPhiHFHadronsMinus_BXm1Filled", "METPhi_PFHFHadronsMinus prev bunch filled", 50, -M_PI,M_PI);
656  meMETPhiHFEGammasPlus_BXm1Filled = ibooker.book1D("METPhiHFEGammasPlus_BXm1Filled", "METPhi_PFHFEGammasPlus prev bunch filled", 50, -M_PI,M_PI);
657  meMETPhiHFEGammasMinus_BXm1Filled = ibooker.book1D("METPhiHFEGammasMinus_BXm1Filled", "METPhi_PFHFEGammasMinus prev bunch filled", 50, -M_PI,M_PI);
658 
659  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsBarrel_BXm1Filled" ,meMETPhiChargedHadronsBarrel_BXm1Filled));
660  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm1Filled" ,meMETPhiChargedHadronsEndcapPlus_BXm1Filled));
661  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm1Filled" ,meMETPhiChargedHadronsEndcapMinus_BXm1Filled));
662  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsBarrel_BXm1Filled" ,meMETPhiNeutralHadronsBarrel_BXm1Filled));
663  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm1Filled" ,meMETPhiNeutralHadronsEndcapPlus_BXm1Filled));
664  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm1Filled" ,meMETPhiNeutralHadronsEndcapMinus_BXm1Filled));
665  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsBarrel_BXm1Filled" ,meMETPhiPhotonsBarrel_BXm1Filled));
666  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapPlus_BXm1Filled" ,meMETPhiPhotonsEndcapPlus_BXm1Filled));
667  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapMinus_BXm1Filled" ,meMETPhiPhotonsEndcapMinus_BXm1Filled));
668  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsPlus_BXm1Filled" ,meMETPhiHFHadronsPlus_BXm1Filled));
669  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsMinus_BXm1Filled" ,meMETPhiHFHadronsMinus_BXm1Filled));
670  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasPlus_BXm1Filled" ,meMETPhiHFEGammasPlus_BXm1Filled));
671  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasMinus_BXm1Filled" ,meMETPhiHFEGammasMinus_BXm1Filled));
672 
673  meMETPhiChargedHadronsBarrel_BXm1Empty = ibooker.book1D("METPhiChargedHadronsBarrel_BXm1Empty", "METPhi_PFChargedHadronsBarrel prev bunch empty", 50, -M_PI,M_PI);
674  meMETPhiChargedHadronsEndcapPlus_BXm1Empty = ibooker.book1D("METPhiChargedHadronsEndcapPlus_BXm1Empty", "METPhi_PFChargedHadronsEndcapPlus prev bunch empty", 50, -M_PI,M_PI);
675  meMETPhiChargedHadronsEndcapMinus_BXm1Empty = ibooker.book1D("METPhiChargedHadronsEndcapMinus_BXm1Empty","METPhi_PFChargedHadronsEndcapMinus prev bunch empty", 50, -M_PI,M_PI);
676  meMETPhiNeutralHadronsBarrel_BXm1Empty = ibooker.book1D("METPhiNeutralHadronsBarrel_BXm1Empty", "METPhi_PFNeutralHadronsBarrel prev bunch empty", 50, -M_PI,M_PI);
677  meMETPhiNeutralHadronsEndcapPlus_BXm1Empty = ibooker.book1D("METPhiNeutralHadronsEndcapPlus_BXm1Empty", "METPhi_PFNeutralHadronsEndcapPlus prev bunch empty", 50, -M_PI,M_PI);
678  meMETPhiNeutralHadronsEndcapMinus_BXm1Empty = ibooker.book1D("METPhiNeutralHadronsEndcapMinus_BXm1Empty","METPhi_PFNeutralHadronsEndcapMinus prev bunch empty", 50, -M_PI,M_PI);
679  meMETPhiPhotonsBarrel_BXm1Empty = ibooker.book1D("METPhiPhotonsBarrel_BXm1Empty", "METPhi_PFPhotonsBarrel prev bunch empty", 50, -M_PI,M_PI);
680  meMETPhiPhotonsEndcapPlus_BXm1Empty = ibooker.book1D("METPhiPhotonsEndcapPlus_BXm1Empty", "METPhi_PFPhotonsEndcapPlus prev bunch empty", 50, -M_PI,M_PI);
681  meMETPhiPhotonsEndcapMinus_BXm1Empty = ibooker.book1D("METPhiPhotonsEndcapMinus_BXm1Empty", "METPhi_PFPhotonsEndcapMinus prev bunch empty", 50, -M_PI,M_PI);
682  meMETPhiHFHadronsPlus_BXm1Empty = ibooker.book1D("METPhiHFHadronsPlus_BXm1Empty", "METPhi_PFHFHadronsPlus prev bunch empty", 50, -M_PI,M_PI);
683  meMETPhiHFHadronsMinus_BXm1Empty = ibooker.book1D("METPhiHFHadronsMinus_BXm1Empty", "METPhi_PFHFHadronsMinus prev bunch empty", 50, -M_PI,M_PI);
684  meMETPhiHFEGammasPlus_BXm1Empty = ibooker.book1D("METPhiHFEGammasPlus_BXm1Empty", "METPhi_PFHFEGammasPlus prev bunch empty", 50, -M_PI,M_PI);
685  meMETPhiHFEGammasMinus_BXm1Empty = ibooker.book1D("METPhiHFEGammasMinus_BXm1Empty", "METPhi_PFHFEGammasMinus prev bunch empty", 50, -M_PI,M_PI);
686 
687  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsBarrel_BXm1Empty" ,meMETPhiChargedHadronsBarrel_BXm1Empty));
688  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm1Empty" ,meMETPhiChargedHadronsEndcapPlus_BXm1Empty));
689  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm1Empty" ,meMETPhiChargedHadronsEndcapMinus_BXm1Empty));
690  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsBarrel_BXm1Empty" ,meMETPhiNeutralHadronsBarrel_BXm1Empty));
691  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm1Empty" ,meMETPhiNeutralHadronsEndcapPlus_BXm1Empty));
692  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm1Empty" ,meMETPhiNeutralHadronsEndcapMinus_BXm1Empty));
693  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsBarrel_BXm1Empty" ,meMETPhiPhotonsBarrel_BXm1Empty));
694  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapPlus_BXm1Empty" ,meMETPhiPhotonsEndcapPlus_BXm1Empty));
695  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapMinus_BXm1Empty" ,meMETPhiPhotonsEndcapMinus_BXm1Empty));
696  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsPlus_BXm1Empty" ,meMETPhiHFHadronsPlus_BXm1Empty));
697  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsMinus_BXm1Empty" ,meMETPhiHFHadronsMinus_BXm1Empty));
698  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasPlus_BXm1Empty" ,meMETPhiHFEGammasPlus_BXm1Empty));
699  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasMinus_BXm1Empty" ,meMETPhiHFEGammasMinus_BXm1Empty));
700 
701  meMETPhiChargedHadronsBarrel = ibooker.book1D("METPhiChargedHadronsBarrel", "METPhi_PFChargedHadronsBarrel", 50, -M_PI,M_PI);
702  meMETPhiChargedHadronsEndcapPlus = ibooker.book1D("METPhiChargedHadronsEndcapPlus", "METPhi_PFChargedHadronsEndcapPlus", 50, -M_PI,M_PI);
703  meMETPhiChargedHadronsEndcapMinus = ibooker.book1D("METPhiChargedHadronsEndcapMinus","METPhi_PFChargedHadronsEndcapMinus", 50, -M_PI,M_PI);
704  meMETPhiNeutralHadronsBarrel = ibooker.book1D("METPhiNeutralHadronsBarrel", "METPhi_PFNeutralHadronsBarrel", 50, -M_PI,M_PI);
705  meMETPhiNeutralHadronsEndcapPlus = ibooker.book1D("METPhiNeutralHadronsEndcapPlus", "METPhi_PFNeutralHadronsEndcapPlus", 50, -M_PI,M_PI);
706  meMETPhiNeutralHadronsEndcapMinus = ibooker.book1D("METPhiNeutralHadronsEndcapMinus","METPhi_PFNeutralHadronsEndcapMinus", 50, -M_PI,M_PI);
707  meMETPhiPhotonsBarrel = ibooker.book1D("METPhiPhotonsBarrel", "METPhi_PFPhotonsBarrel", 50, -M_PI,M_PI);
708  meMETPhiPhotonsEndcapPlus = ibooker.book1D("METPhiPhotonsEndcapPlus", "METPhi_PFPhotonsEndcapPlus", 50, -M_PI,M_PI);
709  meMETPhiPhotonsEndcapMinus = ibooker.book1D("METPhiPhotonsEndcapMinus", "METPhi_PFPhotonsEndcapMinus", 50, -M_PI,M_PI);
710  meMETPhiHFHadronsPlus = ibooker.book1D("METPhiHFHadronsPlus", "METPhi_PFHFHadronsPlus", 50, -M_PI,M_PI);
711  meMETPhiHFHadronsMinus = ibooker.book1D("METPhiHFHadronsMinus", "METPhi_PFHFHadronsMinus", 50, -M_PI,M_PI);
712  meMETPhiHFEGammasPlus = ibooker.book1D("METPhiHFEGammasPlus", "METPhi_PFHFEGammasPlus", 50, -M_PI,M_PI);
713  meMETPhiHFEGammasMinus = ibooker.book1D("METPhiHFEGammasMinus", "METPhi_PFHFEGammasMinus", 50, -M_PI,M_PI);
714 
715  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsBarrel" ,meMETPhiChargedHadronsBarrel));
716  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapPlus" ,meMETPhiChargedHadronsEndcapPlus));
717  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapMinus" ,meMETPhiChargedHadronsEndcapMinus));
718  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsBarrel" ,meMETPhiNeutralHadronsBarrel));
719  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapPlus" ,meMETPhiNeutralHadronsEndcapPlus));
720  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapMinus" ,meMETPhiNeutralHadronsEndcapMinus));
721  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsBarrel" ,meMETPhiPhotonsBarrel));
722  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapPlus" ,meMETPhiPhotonsEndcapPlus));
723  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapMinus" ,meMETPhiPhotonsEndcapMinus));
724  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsPlus" ,meMETPhiHFHadronsPlus));
725  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsMinus" ,meMETPhiHFHadronsMinus));
726  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasPlus" ,meMETPhiHFEGammasPlus));
727  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasMinus" ,meMETPhiHFEGammasMinus));
728  }
729 
730  if(fillPFCandPlots && fillCandidateMap_histos){
731  if(!profilePFCand_x_.empty()){
732  etaMinPFCand_.clear();
733  etaMaxPFCand_.clear();
734  typePFCand_.clear();
735  countsPFCand_.clear();
736  MExPFCand_.clear();
737  MEyPFCand_.clear();
738  profilePFCand_x_.clear();
739  profilePFCand_y_.clear();
740  profilePFCand_x_name_.clear();
741  profilePFCand_y_name_.clear();
742  }
743  for (std::vector<edm::ParameterSet>::const_iterator v = diagnosticsParameters_.begin(); v!=diagnosticsParameters_.end(); v++) {
744  double etaMinPFCand = v->getParameter<double>("etaMin");
745  double etaMaxPFCand = v->getParameter<double>("etaMax");
746  int nMinPFCand = v->getParameter<int>("nMin");
747  int nMaxPFCand = v->getParameter<int>("nMax");
748  int nbinsPFCand = v->getParameter<double>("nbins");
749 
750  // etaNBins_.push_back(etaNBins);
751  etaMinPFCand_.push_back(etaMinPFCand);
752  etaMaxPFCand_.push_back(etaMaxPFCand);
753  typePFCand_.push_back(v->getParameter<int>("type"));
754  countsPFCand_.push_back(0);
755  MExPFCand_.push_back(0.);
756  MEyPFCand_.push_back(0.);
757 
758  profilePFCand_x_.push_back(ibooker.bookProfile(std::string(v->getParameter<std::string>("name")).append("_Px_").c_str(), std::string(v->getParameter<std::string>("name"))+"Px", nbinsPFCand, nMinPFCand, nMaxPFCand, -300,300));
759  profilePFCand_x_name_.push_back(std::string(v->getParameter<std::string>("name")).append("_Px_"));
760  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+profilePFCand_x_name_[profilePFCand_x_name_.size()-1], profilePFCand_x_[profilePFCand_x_.size()-1]));
761  profilePFCand_y_.push_back(ibooker.bookProfile(std::string(v->getParameter<std::string>("name")).append("_Py_").c_str(), std::string(v->getParameter<std::string>("name"))+"Py", nbinsPFCand, nMinPFCand, nMaxPFCand, -300,300));
762  profilePFCand_y_name_.push_back(std::string(v->getParameter<std::string>("name")).append("_Py_"));
763  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+profilePFCand_y_name_[profilePFCand_y_name_.size()-1], profilePFCand_y_[profilePFCand_y_.size()-1]));
764  }
765  }
766  }
767  if(isMiniAODMet_){
768  if(fillPFCandPlots && 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
769  if(!profilePFCand_x_.empty()){
770  etaMinPFCand_.clear();
771  etaMaxPFCand_.clear();
772  typePFCand_.clear();
773  countsPFCand_.clear();
774  profilePFCand_x_.clear();
775  profilePFCand_y_.clear();
776  }
777  for (std::vector<edm::ParameterSet>::const_iterator v = diagnosticsParameters_.begin(); v!=diagnosticsParameters_.end(); v++) {
778  double etaMinPFCand = v->getParameter<double>("etaMin");
779  double etaMaxPFCand = v->getParameter<double>("etaMax");
780 
781  etaMinPFCand_.push_back(etaMinPFCand);
782  etaMaxPFCand_.push_back(etaMaxPFCand);
783  typePFCand_.push_back(v->getParameter<int>("type"));
784  countsPFCand_.push_back(0);
785  MExPFCand_.push_back(0.);
786  MEyPFCand_.push_back(0.);
787  }
788  }
789  }
790 
791  if(isPFMet_ || isMiniAODMet_){
792  mePhotonEtFraction = ibooker.book1D("PfPhotonEtFraction", "photonEtFraction()", 50, 0, 1);
793  meNeutralHadronEtFraction = ibooker.book1D("PfNeutralHadronEtFraction", "neutralHadronEtFraction()", 50, 0, 1);
794  meChargedHadronEtFraction = ibooker.book1D("PfChargedHadronEtFraction", "chargedHadronEtFraction()", 50, 0, 1);
795  meHFHadronEtFraction = ibooker.book1D("PfHFHadronEtFraction", "HFHadronEtFraction()", 50, 0, 1);
796  meHFEMEtFraction = ibooker.book1D("PfHFEMEtFraction", "HFEMEtFraction()", 50, 0, 1);
797 
798  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFraction" ,mePhotonEtFraction));
799  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFraction",meNeutralHadronEtFraction));
800  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFraction",meChargedHadronEtFraction));
801  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFraction" ,meHFHadronEtFraction));
802  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFraction" ,meHFEMEtFraction));
803 
804  mePhotonEtFraction_profile = ibooker.bookProfile("PfPhotonEtFraction_profile", "photonEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
805  meNeutralHadronEtFraction_profile = ibooker.bookProfile("PfNeutralHadronEtFraction_profile", "neutralHadronEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
806  meChargedHadronEtFraction_profile = ibooker.bookProfile("PfChargedHadronEtFraction_profile", "chargedHadronEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
807  meHFHadronEtFraction_profile = ibooker.bookProfile("PfHFHadronEtFraction_profile", "HFHadronEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
808  meHFEMEtFraction_profile = ibooker.bookProfile("PfHFEMEtFraction_profile", "HFEMEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
809  mePhotonEtFraction_profile ->setAxisTitle("nvtx", 1);
810  meNeutralHadronEtFraction_profile->setAxisTitle("nvtx", 1);
811  meChargedHadronEtFraction_profile->setAxisTitle("nvtx", 1);
812  meHFHadronEtFraction_profile ->setAxisTitle("nvtx", 1);
813  meHFEMEtFraction_profile ->setAxisTitle("nvtx", 1);
814 
815  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFraction_profile" ,mePhotonEtFraction_profile));
816  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFraction_profile" ,meNeutralHadronEtFraction_profile));
817  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFraction_profile" ,meChargedHadronEtFraction_profile));
818  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFraction_profile" ,meHFHadronEtFraction_profile));
819  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFraction_profile" ,meHFEMEtFraction_profile));
820 
821  mePhotonEt = ibooker.book1D("PfPhotonEt", "photonEt()", 50, 0, 1000);
822  meNeutralHadronEt = ibooker.book1D("PfNeutralHadronEt", "neutralHadronEt()", 50, 0, 1000);
823  meElectronEt = ibooker.book1D("PfElectronEt", "electronEt()", 50, 0, 100);
824  meChargedHadronEt = ibooker.book1D("PfChargedHadronEt", "chargedHadronEt()", 50, 0, 2000);
825  meMuonEt = ibooker.book1D("PfMuonEt", "muonEt()", 50, 0, 100);
826  meHFHadronEt = ibooker.book1D("PfHFHadronEt", "HFHadronEt()", 50, 0, 2000);
827  meHFEMEt = ibooker.book1D("PfHFEMEt", "HFEMEt()", 50, 0, 1000);
828 
829  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEt" ,mePhotonEt));
830  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEt" ,meNeutralHadronEt));
831  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfElectronEt" ,meElectronEt));
832  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEt" ,meChargedHadronEt));
833  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfMuonEt" ,meMuonEt));
834  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEt" ,meHFHadronEt));
835  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEt" ,meHFEMEt));
836 
837  mePhotonEt_profile = ibooker.bookProfile("PfPhotonEt_profile", "photonEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
838  meNeutralHadronEt_profile = ibooker.bookProfile("PfNeutralHadronEt_profile", "neutralHadronEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
839  meChargedHadronEt_profile = ibooker.bookProfile("PfChargedHadronEt_profile", "chargedHadronEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
840  meHFHadronEt_profile = ibooker.bookProfile("PfHFHadronEt_profile", "HFHadronEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
841  meHFEMEt_profile = ibooker.bookProfile("PfHFEMEt_profile", "HFEMEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
842 
843  mePhotonEt_profile ->setAxisTitle("nvtx", 1);
844  meNeutralHadronEt_profile ->setAxisTitle("nvtx", 1);
845  meChargedHadronEt_profile ->setAxisTitle("nvtx", 1);
846  meHFHadronEt_profile ->setAxisTitle("nvtx", 1);
847  meHFEMEt_profile ->setAxisTitle("nvtx", 1);
848 
849  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEt_profile" ,mePhotonEt_profile));
850  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEt_profile" ,meNeutralHadronEt_profile));
851  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEt_profile" ,meChargedHadronEt_profile));
852  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEt_profile" ,meHFHadronEt_profile));
853  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEt_profile" ,meHFEMEt_profile));
854  }
855 
856  if (isCaloMet_){
857  if (fill_met_high_level_histo){//now configurable in python file
858  hMExLS = ibooker.book2D("MExLS","MEx_LS",200,-200,200,250,0.,2500.);
859  hMExLS->setAxisTitle("MEx [GeV]",1);
860  hMExLS->setAxisTitle("Lumi Section",2);
861  hMExLS->getTH2F()->SetOption("colz");
862  hMEyLS = ibooker.book2D("MEyLS","MEy_LS",200,-200,200,250,0.,2500.);
863  hMEyLS->setAxisTitle("MEy [GeV]",1);
864  hMEyLS->setAxisTitle("Lumi Section",2);
865  hMEyLS->getTH2F()->SetOption("colz");
866  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MExLS",hMExLS));
867  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"MEyLS",hMEyLS));
868  }
869  }
870 
871  hMETRate = ibooker.book1D("METRate", "METRate", 200, 0, 1000);
872  map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METRate",hMETRate));
873 
874 
875  ibooker.setCurrentFolder("JetMET");
876  lumisecME = ibooker.book1D("lumisec", "lumisec", 2501, -1., 2500.);
877  map_of_MEs.insert(std::pair<std::string,MonitorElement*>("JetMET/lumisec",lumisecME));
878  }//all non Z plots (restrict Z Plots only for resolution study)
879 }
880 
881 // ***********************************************************
882 void METAnalyzer::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup)
883 {
885  iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd) ;
886  const L1GtTriggerMenu* menu = menuRcd.product();
887  for (CItAlgo techTrig = menu->gtTechnicalTriggerMap().begin(); techTrig != menu->gtTechnicalTriggerMap().end(); ++techTrig) {
888  if ((techTrig->second).algoName() == m_l1algoname_) {
889  m_bitAlgTechTrig_=(techTrig->second).algoBitNumber();
890  break;
891  }
892  }
893 
894 // std::cout << "Run " << iRun.run() << " hltconfig.init "
895 // << hltConfig_.init(iRun,iSetup,triggerResultsLabel_.process(),changed_) << " length: "<<hltConfig_.triggerNames().size()<<" changed "<<changed_<<std::endl;
896  bool changed(true);
897  if (hltConfig_.init(iRun,iSetup,triggerResultsLabel_.process(),changed)) {
898  if (changed) {
899  //hltConfig_.dump("ProcessName");
900  //hltConfig_.dump("GlobalTag");
901  //hltConfig_.dump("TableName");
902 // hltConfig_.dump("Streams");
903 // hltConfig_.dump("Datasets");
904 // hltConfig_.dump("PrescaleTable");
905 // hltConfig_.dump("ProcessPSet");
906  }
907  } else {
908  if (verbose_) std::cout << "HLTEventAnalyzerAOD::analyze:"
909  << " config extraction failure with process name "
910  << triggerResultsLabel_.process() << std::endl;
911  }
912 
913  allTriggerNames_.clear();
914  for (unsigned int i = 0; i<hltConfig_.size();i++) {
915  allTriggerNames_.push_back(hltConfig_.triggerName(i));
916  }
917 // std::cout<<"Length: "<<allTriggerNames_.size()<<std::endl;
918 
919  triggerSelectedSubFolders_ = parameters.getParameter<edm::VParameterSet>("triggerSelectedSubFolders");
920  for ( std::vector<GenericTriggerEventFlag *>::const_iterator it = triggerFolderEventFlag_.begin(); it!= triggerFolderEventFlag_.end(); it++) {
921  int pos = it - triggerFolderEventFlag_.begin();
922  if ((*it)->on()) {
923  (*it)->initRun( iRun, iSetup );
924  if (triggerSelectedSubFolders_[pos].exists(std::string("hltDBKey"))) {
925  if ((*it)->expressionsFromDB((*it)->hltDBKey(), iSetup)[0] != "CONFIG_ERROR")
926  triggerFolderExpr_[pos] = (*it)->expressionsFromDB((*it)->hltDBKey(), iSetup);
927  }
928  }
929  }
930  if(isMiniAODMet_){
931  bool changed_filter=true;
932  std::vector<int>initializeFilter(8,-1);//we have 8 filters at the moment
933  miniaodFilterIndex_=initializeFilter;
934  if (FilterhltConfig_.init(iRun,iSetup,METFilterMiniAODLabel_.process(),changed_filter)){
935  miniaodfilterdec=0;
936  for(unsigned int i=0;i<FilterhltConfig_.size();i++){
937  std::string search=FilterhltConfig_.triggerName(i).substr(5);//actual label of filter, the first 5 items are Flag_, so stripped off
938  std::string search2=HBHENoiseStringMiniAOD;//all filters end with DQM, which is not in the flag --> ONLY not for HBHEFilters
939  std::size_t found=search2.find(search);
940  if(found!=std::string::npos){
941  miniaodFilterIndex_[0]=i;
942  }
943  search2=CSCHaloResultTag_.label().substr(0,CSCHaloResultTag_.label().size()-3);
944  found=search2.find(search);
945  if(found!=std::string::npos){
946  miniaodFilterIndex_[1]=i;
947  }
948  search2=eeBadScFilterTag_.label().substr(0,eeBadScFilterTag_.label().size()-3);
949  found=search2.find(search);
950  if(found!=std::string::npos){
951  miniaodFilterIndex_[2]=i;
952  }
953  search2=HBHEIsoNoiseStringMiniAOD;
954  found=search2.find(search);
955  if(found!=std::string::npos){
956  miniaodFilterIndex_[3]=i;
957  }
958  search2=CSCHalo2015ResultTag_.label().substr(0,CSCHalo2015ResultTag_.label().size()-3);
959  found=search2.find(search);
960  if(found!=std::string::npos){
961  miniaodFilterIndex_[4]=i;
962  }
963  search2=EcalDeadCellTriggerTag_.label().substr(0,EcalDeadCellTriggerTag_.label().size()-3);
964  found=search2.find(search);
965  if(found!=std::string::npos){
966  miniaodFilterIndex_[5]=i;
967  }
968  search2=EcalDeadCellBoundaryTag_.label().substr(0,EcalDeadCellBoundaryTag_.label().size()-3);
969  found=search2.find(search);
970  if(found!=std::string::npos){
971  miniaodFilterIndex_[6]=i;
972  }
973  search2=HcalStripHaloTag_.label().substr(0,HcalStripHaloTag_.label().size()-3);
974  found=search2.find(search);
975  if(found!=std::string::npos){
976  miniaodFilterIndex_[7]=i;
977  }
978  }
979  }else if(FilterhltConfig_.init(iRun,iSetup,METFilterMiniAODLabel2_.process(),changed_filter)){
980  miniaodfilterdec=1;
981  for(unsigned int i=0;i<FilterhltConfig_.size();i++){
982  std::string search=FilterhltConfig_.triggerName(i).substr(5);//actual label of filter, the first 5 items are Flag_, so stripped off
983  std::string search2=HBHENoiseStringMiniAOD;//all filters end with DQM, which is not in the flag --> ONLY not for HBHEFilters
984  std::size_t found=search2.find(search);
985  if(found!=std::string::npos){
986  miniaodFilterIndex_[0]=i;
987  }
988  search2=CSCHaloResultTag_.label().substr(0,CSCHaloResultTag_.label().size()-3);
989  found=search2.find(search);
990  if(found!=std::string::npos){
991  miniaodFilterIndex_[1]=i;
992  }
993  search2=eeBadScFilterTag_.label().substr(0,eeBadScFilterTag_.label().size()-3);
994  found=search2.find(search);
995  if(found!=std::string::npos){
996  miniaodFilterIndex_[2]=i;
997  }
998  search2=HBHEIsoNoiseStringMiniAOD;
999  found=search2.find(search);
1000  if(found!=std::string::npos){
1001  miniaodFilterIndex_[3]=i;
1002  }
1003  search2=CSCHalo2015ResultTag_.label().substr(0,CSCHalo2015ResultTag_.label().size()-3);
1004  found=search2.find(search);
1005  if(found!=std::string::npos){
1006  miniaodFilterIndex_[4]=i;
1007  }
1008  search2=EcalDeadCellTriggerTag_.label().substr(0,EcalDeadCellTriggerTag_.label().size()-3);
1009  found=search2.find(search);
1010  if(found!=std::string::npos){
1011  miniaodFilterIndex_[5]=i;
1012  }
1013  search2=EcalDeadCellBoundaryTag_.label().substr(0,EcalDeadCellBoundaryTag_.label().size()-3);
1014  found=search2.find(search);
1015  if(found!=std::string::npos){
1016  miniaodFilterIndex_[6]=i;
1017  }
1018  search2=HcalStripHaloTag_.label().substr(0,HcalStripHaloTag_.label().size()-3);
1019  found=search2.find(search);
1020  if(found!=std::string::npos){
1021  miniaodFilterIndex_[7]=i;
1022  }
1023  }
1024  }else{
1025  edm::LogWarning("MiniAOD METAN Filter HLT OBject version")<<"nothing found with both RECO and reRECO label"<<std::endl;
1026  }
1027  }
1028 }
1029 
1030 // ***********************************************************
1031 void METAnalyzer::endRun(const edm::Run& iRun, const edm::EventSetup& iSetup)
1032 {
1033 
1034  //
1035  //--- Check the time length of the Run from the lumi section plots
1036 
1037 
1038  TH1F* tlumisec;
1039 
1040  MonitorElement *meLumiSec = map_dijet_MEs["aaa"];
1041  meLumiSec = map_dijet_MEs["JetMET/lumisec"];
1042 
1043  int totlsec=0;
1044  int totlssecsum=0;
1045  double totltime=0.;
1046  if (meLumiSec && meLumiSec->getRootObject() ) {
1047  tlumisec = meLumiSec->getTH1F();
1048  //check overflow bin (if we have more than 2500 LS in a run)
1049  //lumisec is filled every time the analyze section is processed
1050  //we know an LS is present only once in a run: normalize how many events we had on average
1051  //if lumi fluctuates strongly might be unreliable for overflow bin though
1052  for (int i=0; i< (tlumisec->GetNbinsX()); i++){
1053  if (tlumisec->GetBinContent(i)!=0){
1054  totlsec+=1;
1055  totlssecsum+=tlumisec->GetBinContent(i);
1056  }
1057  }
1058  int num_per_ls=(double)totlssecsum/(double)totlsec;
1059  totlsec=totlsec+tlumisec->GetBinContent(tlumisec->GetNbinsX()+1)/(double)num_per_ls;
1060  totltime = double(totlsec*90); // one lumi sec ~ 90 (sec)
1061  }
1062 
1063  if (totltime==0.) totltime=1.;
1064 
1065  std::string dirName = FolderName_+metCollectionLabel_.label()+"/";
1066  //dbe_->setCurrentFolder(dirName);
1067 
1068 
1069 
1070  //below is the original METAnalyzer formulation
1071 
1072  for (std::vector<std::string>::const_iterator ic = folderNames_.begin(); ic != folderNames_.end(); ic++) {
1074  DirName = dirName+*ic;
1075  makeRatePlot(DirName,totltime);
1076  for ( std::vector<GenericTriggerEventFlag *>::const_iterator it = triggerFolderEventFlag_.begin(); it!= triggerFolderEventFlag_.end(); it++) {
1077  int pos = it - triggerFolderEventFlag_.begin();
1078  if ((*it)->on()) {
1079  makeRatePlot(DirName+"/"+triggerFolderLabels_[pos],totltime);
1080  }
1081  }
1082  }
1083 
1084 }
1085 
1086 
1087 // ***********************************************************
1089 {
1090 
1091  //dbe_->setCurrentFolder(DirName);
1092  MonitorElement *meMET = map_dijet_MEs[DirName+"/"+"MET"];
1093  MonitorElement *mMETRate = map_dijet_MEs[DirName+"/"+"METRate"];
1094 
1095  TH1F* tMET;
1096  TH1F* tMETRate;
1097 
1098  if ( meMET && mMETRate){
1099  if ( meMET->getRootObject() && mMETRate->getRootObject()) {
1100  tMET = meMET->getTH1F();
1101 
1102  // Integral plot & convert number of events to rate (hz)
1103  tMETRate = (TH1F*) tMET->Clone("METRateHist");
1104  for (int i = tMETRate->GetNbinsX()-1; i>=0; i--){
1105  mMETRate->setBinContent(i+1,tMETRate->GetBinContent(i+2)+tMET->GetBinContent(i+1));
1106  }
1107  for (int i = 0; i<tMETRate->GetNbinsX(); i++){
1108  mMETRate->setBinContent(i+1,tMETRate->GetBinContent(i+1)/double(totltime));
1109  }
1110  }
1111  }
1112 
1113 }
1114 
1115 // ***********************************************************
1117 
1118 
1119  // *** Fill lumisection ME
1120  int myLuminosityBlock;
1121  myLuminosityBlock = iEvent.luminosityBlock();
1122  if(fill_met_high_level_histo){
1123  lumisecME=map_dijet_MEs["JetMET/lumisec"]; if(lumisecME && lumisecME->getRootObject()) lumisecME->Fill(myLuminosityBlock);
1124  }
1125 
1126  if (myLuminosityBlock<LSBegin_) return;
1127  if (myLuminosityBlock>LSEnd_ && LSEnd_>0) return;
1128 
1129  if (verbose_) std::cout << "METAnalyzer analyze" << std::endl;
1130 
1131  std::string DirName = FolderName_+metCollectionLabel_.label();
1132 
1133 
1134 
1135 
1136  // ==========================================================
1137  // Trigger information
1138  //
1139 // trigJetMB_=0;
1140 // trigHighPtJet_=0;
1141 // trigLowPtJet_=0;
1142 // trigMinBias_=0;
1143 // trigHighMET_=0;
1144 // // _trig_LowMET=0;
1145 // trigEle_=0;
1146 // trigMuon_=0;
1147 // trigPhysDec_=0;
1148  std::vector<int> triggerFolderDecisions;
1149  triggerFolderDecisions_ = std::vector<int> (triggerFolderEventFlag_.size(), 0);
1150  // **** Get the TriggerResults container
1152  iEvent.getByToken(triggerResultsToken_, triggerResults);
1153 
1154  if( triggerResults.isValid()) {
1156  // Check how many HLT triggers are in triggerResults
1157  int ntrigs = (*triggerResults).size();
1158  if (verbose_) std::cout << "ntrigs=" << ntrigs << std::endl;
1159  // If index=ntrigs, this HLT trigger doesn't exist in the HLT table for this data.
1160  for (std::vector<GenericTriggerEventFlag *>::const_iterator it = triggerFolderEventFlag_.begin(); it!=triggerFolderEventFlag_.end();it++) {
1161  unsigned int pos = it - triggerFolderEventFlag_.begin();
1162  bool fd = (*it)->accept(iEvent, iSetup);
1163  triggerFolderDecisions_[pos] = fd;
1164  }
1165  allTriggerDecisions_.clear();
1166  for (unsigned int i=0;i<allTriggerNames_.size();++i) {
1167  allTriggerDecisions_.push_back((*triggerResults).accept(i));
1168  //std::cout<<"TR "<<(*triggerResults).size()<<" "<<(*triggerResults).accept(i)<<" "<<allTriggerNames_[i]<<std::endl;
1169  }
1170  }
1171 
1172  // ==========================================================
1173  // MET information
1174 
1175  // **** Get the MET container
1180 
1181  //if(isTCMet_){
1182  //iEvent.getByToken(tcMetToken_, tcmetcoll);
1183  //if(!tcmetcoll.isValid()) return;
1184  //}
1185  if(isCaloMet_){
1186  iEvent.getByToken(caloMetToken_, calometcoll);
1187  if(!calometcoll.isValid()) return;
1188  }
1189  if(isPFMet_){
1190  iEvent.getByToken(pfMetToken_, pfmetcoll);
1191  if(!pfmetcoll.isValid()) return;
1192  }
1193  if(isMiniAODMet_){
1194  iEvent.getByToken(patMetToken_, patmetcoll);
1195  if(!patmetcoll.isValid()) return;
1196  }
1197 
1198  const MET *met=nullptr;
1199  const pat::MET *patmet=nullptr;
1200  const PFMET *pfmet=nullptr;
1201  const CaloMET *calomet=nullptr;
1202  //if(isTCMet_){
1203  //met=&(tcmetcoll->front());
1204  //}
1205  if(isPFMet_){
1206  met=&(pfmetcoll->front());
1207  pfmet=&(pfmetcoll->front());
1208  }
1209  if(isCaloMet_){
1210  met=&(calometcoll->front());
1211  calomet=&(calometcoll->front());
1212  }
1213  if(isMiniAODMet_){
1214  met=&(patmetcoll->front());
1215  patmet=&(patmetcoll->front());
1216  }
1217 
1218  LogTrace("METAnalyzer")<<"[METAnalyzer] Call to the MET analyzer";
1219 
1220  // ==========================================================
1221  // TCMET
1222 
1223  //if (/*isTCMet_ || */(isCaloMet_ && metCollectionLabel_.label() == "corMetGlobalMuons")) {
1224 
1225  //iEvent.getByToken(MuonToken_, muonHandle_);
1226  //iEvent.getByToken(TrackToken_, trackHandle_);
1227  //iEvent.getByToken(ElectronToken_, electronHandle_);
1228  //iEvent.getByToken(BeamspotToken_, beamSpotHandle_);
1229  //iEvent.getByToken(tcMETValueMapToken_,tcMetValueMapHandle_);
1230 
1231  //if(!muonHandle_.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve muon data require by MET Task";
1232  //if(!trackHandle_.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve track data require by MET Task";
1233  //if(!electronHandle_.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve electron data require by MET Task";
1234  //if(!beamSpotHandle_.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve beam spot data require by MET Task";
1235 
1236  //beamSpot_ = ( beamSpotHandle_.isValid() ) ? beamSpotHandle_->position() : math::XYZPoint(0, 0, 0);
1237  //}
1238 
1239  // ==========================================================
1240  bool bJetID = false;
1241  bool bDiJetID = false;
1242  // Jet ID -------------------------------------------------------
1243  //
1244 
1249 
1250  int collsize=-1;
1251 
1252  if (isCaloMet_){
1253  iEvent.getByToken(caloJetsToken_, caloJets);
1254  if (!caloJets.isValid()) {
1255  LogDebug("") << "METAnalyzer: Could not find calojet product" << std::endl;
1256  if (verbose_) std::cout << "METAnalyzer: Could not find calojet product" << std::endl;
1257  }
1258  collsize=caloJets->size();
1259  }
1261  //if (isTCMet_){
1262  //iEvent.getByToken(jptJetsToken_, jptJets);
1263  //if (!jptJets.isValid()) {
1264  // LogDebug("") << "METAnalyzer: Could not find jptjet product" << std::endl;
1265  // if (verbose_) std::cout << "METAnalyzer: Could not find jptjet product" << std::endl;
1266  //}
1267  //collsize=jptJets->size();
1268  //}*/
1269 
1270  edm::Handle< edm::ValueMap<reco::JetID> >jetID_ValueMap_Handle;
1271  if(/*isTCMet_ || */isCaloMet_){
1272  if(!runcosmics_){
1273  iEvent.getByToken(jetID_ValueMapToken_,jetID_ValueMap_Handle);
1274  }
1275  }
1276 
1277  if (isMiniAODMet_){ iEvent.getByToken(patJetsToken_, patJets);
1278  if (!patJets.isValid()) {
1279  LogDebug("") << "METAnalyzer: Could not find patjet product" << std::endl;
1280  if (verbose_) std::cout << "METAnalyzer: Could not find patjet product" << std::endl;
1281  }
1282  collsize=patJets->size();
1283  }
1284 
1285  if (isPFMet_){ iEvent.getByToken(pfJetsToken_, pfJets);
1286  if (!pfJets.isValid()) {
1287  LogDebug("") << "METAnalyzer: Could not find pfjet product" << std::endl;
1288  if (verbose_) std::cout << "METAnalyzer: Could not find pfjet product" << std::endl;
1289  }
1290  collsize=pfJets->size();
1291  }
1292 
1293  unsigned int ind1=-1;
1294  double pt1=-1;
1295  bool pass_jetID1=false;
1296  unsigned int ind2=-1;
1297  double pt2=-1;
1298  bool pass_jetID2=false;
1299 
1301  bool pass_correction_flag=false;
1302  if(!isMiniAODMet_){
1303  iEvent.getByToken(jetCorrectorToken_, jetCorr);
1304  if (jetCorr.isValid()){
1305  pass_correction_flag=true;
1306  }
1307  }else{
1308  pass_correction_flag=true;
1309  }
1310  //do loose jet ID-> check threshold on corrected jets
1311  for (int ijet=0; ijet<collsize; ijet++) {
1312  double pt_jet=-10;
1313  double scale=1.;
1314  bool iscleaned=false;
1315  if (pass_correction_flag) {
1316  if(isCaloMet_){
1317  scale = jetCorr->correction((*caloJets)[ijet]);
1318  }
1319  //if(isTCMet_){
1320  //scale = jetCorr->correction((*jptJets)[ijet]);
1321  //}
1322  if(isPFMet_){
1323  scale = jetCorr->correction((*pfJets)[ijet]);
1324  }
1325  }
1326  if(isCaloMet_){
1327  pt_jet=scale*(*caloJets)[ijet].pt();
1328  if(pt_jet> ptThreshold_){
1329  reco::CaloJetRef calojetref(caloJets, ijet);
1330  if(!runcosmics_){
1331  reco::JetID jetID = (*jetID_ValueMap_Handle)[calojetref];
1332  iscleaned = jetIDFunctorLoose((*caloJets)[ijet], jetID);
1333  }else{
1334  iscleaned=true;
1335  }
1336  }
1337  }
1339  //if(isTCMet_){
1340  //pt_jet=scale*(*jptJets)[ijet].pt();
1341  //if(pt_jet> ptThreshold_){
1342  // const edm::RefToBase<reco::Jet>& rawJet = (*jptJets)[ijet].getCaloJetRef();
1343  // const reco::CaloJet *rawCaloJet = dynamic_cast<const reco::CaloJet*>(&*rawJet);
1344  // reco::CaloJetRef const theCaloJetRef = (rawJet).castTo<reco::CaloJetRef>();
1345  // if(!runcosmics_){
1346  // reco::JetID jetID = (*jetID_ValueMap_Handle)[theCaloJetRef];
1347  // iscleaned = jetIDFunctorLoose(*rawCaloJet, jetID);
1348  // }else{
1349  // iscleaned=true;
1350  // }
1351  //}
1352  //}*/
1353  if(isPFMet_){
1354  pt_jet=scale*(*pfJets)[ijet].pt();
1355  if(pt_jet> ptThreshold_){
1356  iscleaned = pfjetIDFunctorLoose((*pfJets)[ijet]);
1357  }
1358  }
1359  if(isMiniAODMet_){
1360  pt_jet=(*patJets)[ijet].pt();
1361  if(pt_jet> ptThreshold_){
1362  pat::strbitset stringbitset=pfjetIDFunctorLoose.getBitTemplate();
1363  iscleaned = pfjetIDFunctorLoose((*patJets)[ijet],stringbitset);
1364  }
1365  }
1366  if(iscleaned){
1367  bJetID=true;
1368  }
1369  if(pt_jet>pt1){
1370  pt2=pt1;
1371  ind2=ind1;
1372  pass_jetID2=pass_jetID1;
1373  pt1=pt_jet;
1374  ind1=ijet;
1375  pass_jetID1=iscleaned;
1376  }else if (pt_jet>pt2){
1377  pt2=pt_jet;
1378  ind2=ijet;
1379  pass_jetID2=iscleaned;
1380  }
1381  }
1382  if(pass_jetID1 && pass_jetID2){
1383  double dphi=-1.0;
1384  if(isCaloMet_){
1385  dphi=fabs((*caloJets)[ind1].phi()-(*caloJets)[ind2].phi());
1386  }
1388  //dphi=fabs((*jptJets)[ind1].phi()-(*jptJets)[ind2].phi());
1389  //}*/
1390  if(isPFMet_){
1391  dphi=fabs((*pfJets)[ind1].phi()-(*pfJets)[ind2].phi());
1392  }
1393  if(isMiniAODMet_){
1394  dphi=fabs((*patJets)[0].phi()-(*patJets)[1].phi());
1395  }
1396  if(dphi>acos(-1.)){
1397  dphi=2*acos(-1.)-dphi;
1398  }
1399  if(dphi>2.7){
1400  bDiJetID=true;
1401  }
1402  }
1403  // ==========================================================
1404  // ==========================================================
1405  //Vertex information
1406  Handle<VertexCollection> vertexHandle;
1407  iEvent.getByToken(vertexToken_, vertexHandle);
1408 
1409  if (!vertexHandle.isValid()) {
1410  LogDebug("") << "CaloMETAnalyzer: Could not find vertex collection" << std::endl;
1411  if (verbose_) std::cout << "CaloMETAnalyzer: Could not find vertex collection" << std::endl;
1412  }
1413  numPV_ = 0;
1414  if ( vertexHandle.isValid() ){
1415  VertexCollection vertexCollection = *(vertexHandle.product());
1416  numPV_ = vertexCollection.size();
1417  }
1418  bool bPrimaryVertex = (bypassAllPVChecks_ || (numPV_>0));
1419 
1420  bool bZJets = false;
1421 
1423  iEvent.getByToken(MuonsToken_, Muons);
1424 
1426 
1427  double pt_muon0=-1;
1428  double pt_muon1=-1;
1429  int mu_index0=-1;
1430  int mu_index1=-1;
1431  //fill it only for cleaned jets
1432  if(Muons.isValid() && Muons->size()>1){
1433  for (unsigned int i=0;i<Muons->size();i++){
1434  bool pass_muon_id=false;
1435  bool pass_muon_iso=false;
1436  double dxy=fabs((*Muons)[i].muonBestTrack()->dxy());
1437  double dz=fabs((*Muons)[i].muonBestTrack()->dz());
1438  if (numPV_>0){
1439  dxy=fabs((*Muons)[i].muonBestTrack()->dxy((*vertexHandle)[0].position()));
1440  dz=fabs((*Muons)[i].muonBestTrack()->dz((*vertexHandle)[0].position()));
1441  }
1442  if((*Muons)[i].pt()>20 && fabs((*Muons)[i].eta())<2.3){
1443  if((*Muons)[i].isGlobalMuon() && (*Muons)[i].isPFMuon() && (*Muons)[i].globalTrack()->hitPattern().numberOfValidMuonHits() > 0 && (*Muons)[i].numberOfMatchedStations() > 1 && dxy < 0.2 && (*Muons)[i].numberOfMatchedStations() > 1 && dz<0.5 && (*Muons)[i].innerTrack()->hitPattern().numberOfValidPixelHits() > 0 && (*Muons)[i].innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5){
1444  pass_muon_id=true;
1445  }
1446  // Muon pf isolation DB corrected
1447  float muonIsoPFdb = ((*Muons)[i].pfIsolationR04().sumChargedHadronPt
1448  + std::max(0., (*Muons)[i].pfIsolationR04().sumNeutralHadronEt + (*Muons)[i].pfIsolationR04().sumPhotonEt - 0.5*(*Muons)[i].pfIsolationR04().sumPUPt))/(*Muons)[i].pt();
1449  if(muonIsoPFdb<0.12){
1450  pass_muon_iso=true;
1451  }
1452 
1453  if(pass_muon_id && pass_muon_iso){
1454  if((*Muons)[i].pt()>pt_muon0){
1455  mu_index1=mu_index0;
1456  pt_muon1=pt_muon0;
1457  mu_index0=i;
1458  pt_muon0=(*Muons)[i].pt();
1459  }else if ((*Muons)[i].pt()>pt_muon1){
1460  mu_index1=i;
1461  pt_muon1=(*Muons)[i].pt();
1462  }
1463  }
1464  }
1465  }
1466  if(mu_index0>=0 && mu_index1>=0){
1467  if((*Muons)[mu_index0].charge()*(*Muons)[mu_index1].charge()<0){
1468  zCand=(*Muons)[mu_index0].polarP4()+(*Muons)[mu_index1].polarP4();
1469  if(fabs(zCand.M()-91.)<20){
1470  bZJets=true;
1471  }
1472  }
1473  }
1474  }
1475 
1476  // ==========================================================
1477 
1479  iEvent.getByToken( gtToken_, gtReadoutRecord);
1480 
1481  bool techTriggerResultBxM2 = false;
1482  bool techTriggerResultBxM1 = false;
1483  bool techTriggerResultBx0 = false;
1484 
1485  if (!gtReadoutRecord.isValid()) {
1486  LogDebug("") << "METAnalyzer: Could not find GT readout record" << std::endl;
1487  if (verbose_) std::cout << "METAnalyzer: Could not find GT readout record product" << std::endl;
1488  }else{
1489  // trigger results before mask for BxInEvent -2 (E), -1 (F), 0 (L1A), 1, 2
1490  const TechnicalTriggerWord& technicalTriggerWordBeforeMaskBxM2 = gtReadoutRecord->technicalTriggerWord(-2);
1491  const TechnicalTriggerWord& technicalTriggerWordBeforeMaskBxM1 = gtReadoutRecord->technicalTriggerWord(-1);
1492  const TechnicalTriggerWord& technicalTriggerWordBeforeMaskBx0 = gtReadoutRecord->technicalTriggerWord();
1493  //const TechnicalTriggerWord& technicalTriggerWordBeforeMaskBxG = gtReadoutRecord->technicalTriggerWord(1);
1494  //const TechnicalTriggerWord& technicalTriggerWordBeforeMaskBxH = gtReadoutRecord->technicalTriggerWord(2);
1495  if (m_bitAlgTechTrig_ > -1 && !technicalTriggerWordBeforeMaskBx0.empty()) {
1496  techTriggerResultBx0 = technicalTriggerWordBeforeMaskBx0.at(m_bitAlgTechTrig_);
1497  if(techTriggerResultBx0!=0){
1498  techTriggerResultBxM2 = technicalTriggerWordBeforeMaskBxM2.at(m_bitAlgTechTrig_);
1499  techTriggerResultBxM1 = technicalTriggerWordBeforeMaskBxM1.at(m_bitAlgTechTrig_);
1500  }
1501  }
1502  }
1503 
1504  std::vector<bool>trigger_flag(4,false);
1505  if(techTriggerResultBx0 && techTriggerResultBxM2 && techTriggerResultBxM1){//current and previous two bunches filled
1506  trigger_flag[0]=true;
1507  }
1508  if(techTriggerResultBx0 && techTriggerResultBxM1){//current and previous bunch filled
1509  trigger_flag[1]=true; }
1510  if(techTriggerResultBx0 && !techTriggerResultBxM1){//current bunch filled, but previous bunch emtpy
1511  trigger_flag[2]=true;
1512  }
1513  if(techTriggerResultBx0 && !techTriggerResultBxM2 && !techTriggerResultBxM1){//current bunch filled, but previous two bunches emtpy
1514  trigger_flag[3]=true;
1515  }
1516  std::vector<bool>filter_decisions(8,false);//include all recommended filters, old filters in MiniAOD, and 2 new filters in testing phase
1517  if(!isMiniAODMet_ && !runcosmics_){//not checked for MiniAOD -> for miniaod decision filled as "triggerResults" bool
1518  edm::Handle<bool> HBHENoiseFilterResultHandle;
1519  iEvent.getByToken(hbheNoiseFilterResultToken_, HBHENoiseFilterResultHandle);
1520  if (!HBHENoiseFilterResultHandle.isValid()) {
1521  LogDebug("") << "METAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
1522  if (verbose_) std::cout << "METAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
1523  }
1524  filter_decisions[0]= *HBHENoiseFilterResultHandle;
1525  edm::Handle<bool> CSCTightHaloFilterResultHandle;
1526  iEvent.getByToken(CSCHaloResultToken_, CSCTightHaloFilterResultHandle);
1527  if (!CSCTightHaloFilterResultHandle.isValid()) {
1528  LogDebug("") << "METAnalyzer: Could not find CSCTightHaloFilterResultHandle" << std::endl;
1529  if (verbose_) std::cout << "METAnalyzer: CSCTightHaloFilterResultHandle" << std::endl;
1530  }
1531  filter_decisions[1]= *CSCTightHaloFilterResultHandle;
1532  edm::Handle<bool> eeBadScFilterResultHandle;
1533  iEvent.getByToken(eeBadScFilterToken_, eeBadScFilterResultHandle);
1534  if (!eeBadScFilterResultHandle.isValid()) {
1535  LogDebug("") << "METAnalyzer: Could not find eeBadScFilterResultHandle" << std::endl;
1536  if (verbose_) std::cout << "METAnalyzer: eeBadScFilterResultHandle" << std::endl;
1537  }
1538  filter_decisions[2]= *eeBadScFilterResultHandle;
1539  edm::Handle<bool> HBHENoiseIsoFilterResultHandle;
1540  iEvent.getByToken(hbheIsoNoiseFilterResultToken_, HBHENoiseIsoFilterResultHandle);
1541  if (!HBHENoiseIsoFilterResultHandle.isValid()) {
1542  LogDebug("") << "METAnalyzer: Could not find HBHENoiseIsoFilterResult" << std::endl;
1543  if (verbose_) std::cout << "METAnalyzer: Could not find HBHENoiseIsoFilterResult" << std::endl;
1544  }
1545  filter_decisions[3]= *HBHENoiseIsoFilterResultHandle;
1546  edm::Handle<bool> CSCTightHalo2015FilterResultHandle;
1547  iEvent.getByToken(CSCHalo2015ResultToken_, CSCTightHalo2015FilterResultHandle);
1548  if (!CSCTightHalo2015FilterResultHandle.isValid()) {
1549  LogDebug("") << "METAnalyzer: Could not find CSCTightHalo2015FilterResultHandle" << std::endl;
1550  if (verbose_) std::cout << "METAnalyzer: CSCTightHalo2015FilterResultHandle" << std::endl;
1551  }
1552  filter_decisions[4]= *CSCTightHalo2015FilterResultHandle;
1553  edm::Handle<bool> EcalDeadCellTriggerFilterResultHandle;
1554  iEvent.getByToken(EcalDeadCellTriggerToken_, EcalDeadCellTriggerFilterResultHandle);
1555  if (!EcalDeadCellTriggerFilterResultHandle.isValid()) {
1556  LogDebug("") << "METAnalyzer: Could not find EcalDeadCellTriggerFilterResultHandle" << std::endl;
1557  if (verbose_) std::cout << "METAnalyzer: EcalDeadCellTriggerFilterResultHandle" << std::endl;
1558  }
1559  filter_decisions[5]= *EcalDeadCellTriggerFilterResultHandle;
1560  edm::Handle<bool> EcalDeadCellBoundaryHandle;
1561  iEvent.getByToken(EcalDeadCellBoundaryToken_, EcalDeadCellBoundaryHandle);
1562  if (!EcalDeadCellBoundaryHandle.isValid()) {
1563  LogDebug("") << "METAnalyzer: Could not find EcalDeadCellBoundaryHandle" << std::endl;
1564  if (verbose_) std::cout << "METAnalyzer: EcalDeadCellBoundaryHandle" << std::endl;
1565  }
1566  filter_decisions[6]= *EcalDeadCellBoundaryHandle;
1567  edm::Handle<bool> HcalStripHaloFilterHandle;
1568  iEvent.getByToken(HcalStripHaloToken_, HcalStripHaloFilterHandle);
1569  if (!HcalStripHaloFilterHandle.isValid()) {
1570  LogDebug("") << "METAnalyzer: Could not find CSCTightHalo2015FilterResultHandle" << std::endl;
1571  if (verbose_) std::cout << "METAnalyzer: CSCTightHalo2015FilterResultHandle" << std::endl;
1572  }
1573  filter_decisions[7]= *HcalStripHaloFilterHandle;
1574  }else if (isMiniAODMet_) {
1575  //miniaodFilterIndex_ is only filled in dqmBeginRun if isMiniAODMet_ true
1576  edm::Handle<edm::TriggerResults> metFilterResults;
1577  iEvent.getByToken(METFilterMiniAODToken_, metFilterResults);
1578  if(metFilterResults.isValid()){
1579  if(miniaodFilterIndex_[0]!=-1){
1580  filter_decisions[0] = metFilterResults->accept(miniaodFilterIndex_[0]);
1581  }
1582  if(miniaodFilterIndex_[1]!=-1){
1583  filter_decisions[1] = metFilterResults->accept(miniaodFilterIndex_[1]);
1584  }
1585  if(miniaodFilterIndex_[2]!=-1){
1586  filter_decisions[2] = metFilterResults->accept(miniaodFilterIndex_[2]);
1587  }
1588  if(miniaodFilterIndex_[3]!=-1){
1589  filter_decisions[3] = metFilterResults->accept(miniaodFilterIndex_[3]);
1590  }
1591  if(miniaodFilterIndex_[4]!=-1){
1592  filter_decisions[4] = metFilterResults->accept(miniaodFilterIndex_[4]);
1593  }
1594  if(miniaodFilterIndex_[5]!=-1){
1595  filter_decisions[5] = metFilterResults->accept(miniaodFilterIndex_[5]);
1596  }
1597  if(miniaodFilterIndex_[6]!=-1){
1598  filter_decisions[6] = metFilterResults->accept(miniaodFilterIndex_[6]);
1599  }
1600  if(miniaodFilterIndex_[7]!=-1){
1601  filter_decisions[7] = metFilterResults->accept(miniaodFilterIndex_[7]);
1602  }
1603  }else{
1604  iEvent.getByToken(METFilterMiniAODToken2_, metFilterResults);
1605  if(metFilterResults.isValid()){
1606  if(miniaodFilterIndex_[0]!=-1){
1607  filter_decisions[0] = metFilterResults->accept(miniaodFilterIndex_[0]);
1608  }
1609  if(miniaodFilterIndex_[1]!=-1){
1610  filter_decisions[1] = metFilterResults->accept(miniaodFilterIndex_[1]);
1611  }
1612  if(miniaodFilterIndex_[2]!=-1){
1613  filter_decisions[2] = metFilterResults->accept(miniaodFilterIndex_[2]);
1614  }
1615  if(miniaodFilterIndex_[3]!=-1){
1616  filter_decisions[3] = metFilterResults->accept(miniaodFilterIndex_[3]);
1617  }
1618  if(miniaodFilterIndex_[4]!=-1){
1619  filter_decisions[4] = metFilterResults->accept(miniaodFilterIndex_[4]);
1620  }
1621  if(miniaodFilterIndex_[5]!=-1){
1622  filter_decisions[5] = metFilterResults->accept(miniaodFilterIndex_[5]);
1623  }
1624  if(miniaodFilterIndex_[6]!=-1){
1625  filter_decisions[6] = metFilterResults->accept(miniaodFilterIndex_[6]);
1626  }
1627  if(miniaodFilterIndex_[7]!=-1){
1628  filter_decisions[7] = metFilterResults->accept(miniaodFilterIndex_[7]);
1629  }
1630  }
1631  }
1632  }
1633  bool HBHENoiseFilterResultFlag=filter_decisions[0];//setup for RECO and MINIAOD
1634  // ==========================================================
1635  // HCAL Noise filter
1636  bool bHBHENoiseFilter = HBHENoiseFilterResultFlag;
1637 
1638  // DCS Filter
1639  bool bDCSFilter = (bypassAllDCSChecks_ || DCSFilter_->filter(iEvent, iSetup));
1640  // ==========================================================
1641  // Reconstructed MET Information - fill MonitorElements
1642  std::string DirName_old=DirName;
1643  for (std::vector<std::string>::const_iterator ic = folderNames_.begin();
1644  ic != folderNames_.end(); ic++){
1645  bool pass_selection = false;
1646  if ((*ic=="Uncleaned") &&(isCaloMet_ || bPrimaryVertex)){
1647  fillMESet(iEvent, DirName_old+"/"+*ic, *met,*patmet, *pfmet,*calomet,zCand, map_dijet_MEs,trigger_flag,filter_decisions);
1648  pass_selection =true;
1649  }
1650  //take two lines out for first check
1651  if ((*ic=="Cleaned") && bDCSFilter && bHBHENoiseFilter && bPrimaryVertex && bJetID){
1652  fillMESet(iEvent, DirName_old+"/"+*ic, *met,*patmet,*pfmet,*calomet,zCand,map_dijet_MEs,trigger_flag,filter_decisions);
1653  pass_selection=true;
1654  }
1655  if ((*ic=="DiJet" ) &&bDCSFilter&&bHBHENoiseFilter&& bPrimaryVertex&& bDiJetID){
1656  fillMESet(iEvent, DirName_old+"/"+*ic, *met,*patmet,*pfmet,*calomet,zCand,map_dijet_MEs,trigger_flag,filter_decisions);
1657  pass_selection=true;
1658  }
1659  if ((*ic=="ZJets" ) &&bDCSFilter&&bHBHENoiseFilter&& bPrimaryVertex&& bZJets){
1660  fillMESet(iEvent, DirName_old+"/"+*ic, *met,*patmet,*pfmet,*calomet,zCand,map_dijet_MEs,trigger_flag,filter_decisions);
1661  pass_selection=true;
1662  }
1663  if(pass_selection && isPFMet_){
1664  DirName=DirName_old+"/"+*ic;
1665  }
1666 
1667  }
1668 }
1669 
1670 
1671 // ***********************************************************
1673  const reco::MET& met, const pat::MET& patmet, const reco::PFMET& pfmet, const reco::CaloMET& calomet,const reco::Candidate::PolarLorentzVector& zCand,std::map<std::string,MonitorElement*>& map_of_MEs, std::vector<bool>techTriggerCase, std::vector<bool>METFilterDecision)
1674 {
1675  bool bLumiSecPlot=fill_met_high_level_histo;
1676  bool fillPFCandidatePlots=false;
1677  if (DirName.find("Cleaned")!=std::string::npos) {
1678  fillPFCandidatePlots=true;
1679  fillMonitorElement(iEvent, DirName, std::string(""), met, patmet, pfmet, calomet, zCand, map_of_MEs,bLumiSecPlot,fillPFCandidatePlots,techTriggerCase,METFilterDecision);
1680  for (unsigned int i = 0; i<triggerFolderLabels_.size(); i++) {
1681  fillPFCandidatePlots=false;
1682  if (triggerFolderDecisions_[i]){
1683  fillMonitorElement(iEvent, DirName, triggerFolderLabels_[i], met, patmet, pfmet, calomet, zCand, map_of_MEs,bLumiSecPlot,fillPFCandidatePlots,techTriggerCase,METFilterDecision);
1684  }
1685  }
1686  }else if (DirName.find("DiJet")!=std::string::npos) {
1687  fillMonitorElement(iEvent, DirName, std::string(""), met, patmet, pfmet, calomet, zCand, map_of_MEs,bLumiSecPlot,fillPFCandidatePlots,techTriggerCase,METFilterDecision);
1688  for (unsigned int i = 0; i<triggerFolderLabels_.size(); i++) {
1689  if (triggerFolderDecisions_[i]) fillMonitorElement(iEvent, DirName, triggerFolderLabels_[i], met, patmet, pfmet, calomet, zCand, map_of_MEs,bLumiSecPlot,fillPFCandidatePlots,techTriggerCase,METFilterDecision);
1690  }
1691  }else if (DirName.find("ZJets")!=std::string::npos) {
1692  fillMonitorElement(iEvent, DirName, std::string(""), met, patmet, pfmet, calomet, zCand, map_of_MEs,bLumiSecPlot,fillPFCandidatePlots,techTriggerCase,METFilterDecision);
1693  }else{
1694  fillMonitorElement(iEvent, DirName, std::string(""), met, patmet, pfmet, calomet, zCand, map_of_MEs,bLumiSecPlot,fillPFCandidatePlots,techTriggerCase,METFilterDecision);
1695  }
1696 
1697 
1698 }
1699 
1700 // ***********************************************************
1702  std::string subFolderName,
1703  const reco::MET& met,const pat::MET & patmet, const reco::PFMET & pfmet, const reco::CaloMET &calomet, const reco::Candidate::PolarLorentzVector& zCand,std::map<std::string,MonitorElement*>& map_of_MEs,bool bLumiSecPlot, bool fillPFCandidatePlots,std::vector<bool> techTriggerCase,std::vector<bool> METFilterDecision)
1704 {
1705  bool do_only_Z_histograms=false;
1706  if(DirName.find("ZJets")!=std::string::npos) {//do Z plots only
1707  do_only_Z_histograms=true;
1708  //\vec{p}_{T}^{Z}+vec{u}_{T}+\vec{MET}=0
1709 
1710  double u_x=-met.px()-zCand.Px();
1711  double u_y=-met.py()-zCand.Py();
1712 
1713  //protection for VERY special case where Z-Pt==0
1714  double u_par=0;
1715  double u_perp=sqrt(u_x*u_x + u_y*u_y);
1716  double e_Z_x=0;
1717  double e_Z_y=0;
1718  if(zCand.Pt()!=0){
1719  e_Z_x = zCand.Px()/zCand.Pt();
1720  e_Z_y = zCand.Py()/zCand.Pt();
1721  }
1722  u_par=u_x*e_Z_x+u_y*e_Z_y;
1723  u_perp= -e_Z_y * u_x + e_Z_x*u_y;
1724 
1725  meZJets_u_par = map_of_MEs[DirName+"/"+"u_parallel_Z_inc"]; if ( meZJets_u_par && meZJets_u_par->getRootObject()) meZJets_u_par ->Fill(u_par);
1726  if(zCand.Pt()<15){
1727  meZJets_u_par_ZPt_0_15 = map_of_MEs[DirName+"/"+"u_parallel_ZPt_0_15"]; if ( meZJets_u_par_ZPt_0_15 && meZJets_u_par_ZPt_0_15->getRootObject()) meZJets_u_par_ZPt_0_15 ->Fill(u_par);
1728  }else if(zCand.Pt()<30){
1729  meZJets_u_par_ZPt_15_30 = map_of_MEs[DirName+"/"+"u_parallel_ZPt_15_30"]; if ( meZJets_u_par_ZPt_15_30 && meZJets_u_par_ZPt_15_30->getRootObject()) meZJets_u_par_ZPt_15_30 ->Fill(u_par);
1730  }else if(zCand.Pt()<55){
1731  meZJets_u_par_ZPt_30_55 = map_of_MEs[DirName+"/"+"u_parallel_ZPt_30_55"]; if ( meZJets_u_par_ZPt_30_55 && meZJets_u_par_ZPt_30_55->getRootObject()) meZJets_u_par_ZPt_30_55 ->Fill(u_par);
1732  }else if(zCand.Pt()<75){
1733  meZJets_u_par_ZPt_55_75 = map_of_MEs[DirName+"/"+"u_parallel_ZPt_55_75"]; if ( meZJets_u_par_ZPt_55_75 && meZJets_u_par_ZPt_55_75->getRootObject()) meZJets_u_par_ZPt_55_75 ->Fill(u_par);
1734  }else if(zCand.Pt()<150){
1735  meZJets_u_par_ZPt_75_150 = map_of_MEs[DirName+"/"+"u_parallel_ZPt_75_150"]; if ( meZJets_u_par_ZPt_75_150 && meZJets_u_par_ZPt_75_150->getRootObject()) meZJets_u_par_ZPt_75_150 ->Fill(u_par);
1736  }else if(zCand.Pt()<290){
1737  meZJets_u_par_ZPt_150_290 = map_of_MEs[DirName+"/"+"u_parallel_ZPt_150_290"]; if ( meZJets_u_par_ZPt_150_290 && meZJets_u_par_ZPt_150_290->getRootObject()) meZJets_u_par_ZPt_150_290 ->Fill(u_par);
1738  }else{
1739  meZJets_u_par_ZPt_290 = map_of_MEs[DirName+"/"+"u_parallel_ZPt_290"]; if ( meZJets_u_par_ZPt_290 && meZJets_u_par_ZPt_290->getRootObject()) meZJets_u_par_ZPt_290 ->Fill(u_par);
1740  }
1741 
1742  meZJets_u_perp = map_of_MEs[DirName+"/"+"u_perp_Z_inc"]; if ( meZJets_u_perp && meZJets_u_perp->getRootObject()) meZJets_u_perp ->Fill(u_perp);
1743  if(zCand.Pt()<15){
1744  meZJets_u_perp_ZPt_0_15 = map_of_MEs[DirName+"/"+"u_perp_ZPt_0_15"]; if ( meZJets_u_perp_ZPt_0_15 && meZJets_u_perp_ZPt_0_15->getRootObject()) meZJets_u_perp_ZPt_0_15 ->Fill(u_perp);
1745  }else if(zCand.Pt()<30){
1746  meZJets_u_perp_ZPt_15_30 = map_of_MEs[DirName+"/"+"u_perp_ZPt_15_30"]; if ( meZJets_u_perp_ZPt_15_30 && meZJets_u_perp_ZPt_15_30->getRootObject()) meZJets_u_perp_ZPt_15_30 ->Fill(u_perp);
1747  }else if(zCand.Pt()<55){
1748  meZJets_u_perp_ZPt_30_55 = map_of_MEs[DirName+"/"+"u_perp_ZPt_30_55"]; if ( meZJets_u_perp_ZPt_30_55 && meZJets_u_perp_ZPt_30_55->getRootObject()) meZJets_u_perp_ZPt_30_55 ->Fill(u_perp);
1749  }else if(zCand.Pt()<75){
1750  meZJets_u_perp_ZPt_55_75 = map_of_MEs[DirName+"/"+"u_perp_ZPt_55_75"]; if ( meZJets_u_perp_ZPt_55_75 && meZJets_u_perp_ZPt_55_75->getRootObject()) meZJets_u_perp_ZPt_55_75 ->Fill(u_perp);
1751  }else if(zCand.Pt()<150){
1752  meZJets_u_perp_ZPt_75_150 = map_of_MEs[DirName+"/"+"u_perp_ZPt_75_150"]; if ( meZJets_u_perp_ZPt_75_150 && meZJets_u_perp_ZPt_75_150->getRootObject()) meZJets_u_perp_ZPt_75_150 ->Fill(u_perp);
1753  }else if(zCand.Pt()<290){
1754  meZJets_u_perp_ZPt_150_290 = map_of_MEs[DirName+"/"+"u_perp_ZPt_150_290"]; if ( meZJets_u_perp_ZPt_150_290 && meZJets_u_perp_ZPt_150_290->getRootObject()) meZJets_u_perp_ZPt_150_290 ->Fill(u_perp);
1755  }else{
1756  meZJets_u_perp_ZPt_290 = map_of_MEs[DirName+"/"+"u_perp_ZPt_290"]; if ( meZJets_u_perp_ZPt_290 && meZJets_u_perp_ZPt_290->getRootObject()) meZJets_u_perp_ZPt_290 ->Fill(u_perp);
1757  }
1758 
1759 
1760  }
1761  if(!do_only_Z_histograms){
1762  // Reconstructed MET Information
1763  double SumET = met.sumEt();
1764  double METSig = met.mEtSig();
1765  //double Ez = met.e_longitudinal();
1766  double MET = met.pt();
1767  double MEx = met.px();
1768  double MEy = met.py();
1769  double METPhi = met.phi();
1770  //
1771  int myLuminosityBlock;
1772  myLuminosityBlock = iEvent.luminosityBlock();
1773  //
1774 
1775  if (!subFolderName.empty()){
1776  DirName = DirName +"/"+subFolderName;
1777  }
1778 
1779  hTrigger = map_of_MEs[DirName+"/triggerResults"];
1780  if (hTrigger && hTrigger->getRootObject()) {
1781  for (unsigned int i = 0; i<allTriggerDecisions_.size();i++){
1782  if(i<(unsigned int)hTrigger->getNbinsX()){
1783  hTrigger->Fill(i + .5, allTriggerDecisions_[i]);
1784  }
1785  }
1786  }
1787 
1788 
1789  hMEx = map_of_MEs[DirName+"/"+"MEx"]; if (hMEx && hMEx->getRootObject()) hMEx ->Fill(MEx);
1790  hMEy = map_of_MEs[DirName+"/"+"MEy"]; if (hMEy && hMEy->getRootObject()) hMEy ->Fill(MEy);
1791  hMET = map_of_MEs[DirName+"/"+"MET"]; if (hMET && hMET->getRootObject()) hMET ->Fill(MET);
1792  hMET_2 = map_of_MEs[DirName+"/"+"MET_2"]; if (hMET_2 && hMET_2->getRootObject()) hMET_2 ->Fill(MET);
1793 
1794  //hMET_HBHENoiseFilter = ibooker.book1D("MET_HBHENoiseFilter", "MET_HBHENoiseFiltered", 200, 0, 1000);
1795  //hMET_CSCTightHaloFilter = ibooker.book1D("MET_CSCTightHaloFilter", "MET_CSCTightHaloFiltered", 200, 0, 1000);
1796  //hMET_eeBadScFilter = ibooker.book1D("MET_eeBadScFilter", "MET_eeBadScFiltered", 200, 0, 1000);
1797  //hMET_HBHEIsoNoiseFilter = ibooker.book1D("MET_HBHEIsoNoiseFilter", "MET_HBHEIsoNoiseFiltered", 200, 0, 1000);
1798  //hMET_CSCTightHalo2015Filter = ibooker.book1D("MET_CSCTightHalo2015Filter", "MET_CSCTightHalo2015Filtered", 200, 0, 1000);
1799  //hMET_EcalDeadCellTriggerFilter = ibooker.book1D("MET_EcalDeadCellTriggerFilter", "MET_EcalDeadCellTriggerFiltered", 200, 0, 1000);
1800  //hMET_EcalDeadCellBoundaryFilter = ibooker.book1D("MET_EcalDeadCellBoundaryFilter", "MET_EcalDeadCellBoundaryFiltered", 200, 0, 1000);
1801  //hMET_HcalStripHaloFilter = ibooker.book1D("MET_HcalStripHaloFilter", "MET_HcalStripHaloFiltered", 200, 0, 1000);
1802 
1803 
1804  bool HBHENoiseFilterResult=false;
1805  bool CSCTightHaloFilterResult=false;
1806  bool eeBadScFilterResult=false;
1807  bool HBHEIsoNoiseFilterResult=false;
1808  bool CSCTightHalo2015FilterResult=false;
1809  bool EcalDeadCellTriggerFilterResult=false;
1810  bool EcalDeadCellBoundaryFilterResult=false;
1811  bool HcalStripHaloFilterResult=false;
1812  HBHENoiseFilterResult = METFilterDecision[0];
1813  if(HBHENoiseFilterResult){
1814  hMET_HBHENoiseFilter = map_of_MEs[DirName+"/"+"MET_HBHENoiseFilter"]; if (hMET_HBHENoiseFilter && hMET_HBHENoiseFilter->getRootObject()) hMET_HBHENoiseFilter ->Fill(MET);
1815  }
1816  CSCTightHaloFilterResult = METFilterDecision[1];
1817  if(CSCTightHaloFilterResult){
1818  hMET_CSCTightHaloFilter = map_of_MEs[DirName+"/"+"MET_CSCTightHaloFilter"]; if (hMET_CSCTightHaloFilter && hMET_CSCTightHaloFilter->getRootObject()) hMET_CSCTightHaloFilter ->Fill(MET);
1819  }
1820  eeBadScFilterResult = METFilterDecision[2];
1821  if(eeBadScFilterResult){
1822  hMET_eeBadScFilter = map_of_MEs[DirName+"/"+"MET_eeBadScFilter"]; if (hMET_eeBadScFilter && hMET_eeBadScFilter->getRootObject()) hMET_eeBadScFilter ->Fill(MET);
1823  }
1824  HBHEIsoNoiseFilterResult = METFilterDecision[3];
1825  if(HBHEIsoNoiseFilterResult){
1826  hMET_HBHEIsoNoiseFilter = map_of_MEs[DirName+"/"+"MET_HBHEIsoNoiseFilter"]; if (hMET_HBHEIsoNoiseFilter && hMET_HBHEIsoNoiseFilter->getRootObject()) hMET_HBHEIsoNoiseFilter ->Fill(MET);
1827  }
1828  CSCTightHalo2015FilterResult = METFilterDecision[4];
1829  if(CSCTightHalo2015FilterResult){
1830  hMET_CSCTightHalo2015Filter = map_of_MEs[DirName+"/"+"MET_CSCTightHalo2015Filter"]; if (hMET_CSCTightHalo2015Filter && hMET_CSCTightHalo2015Filter->getRootObject()) hMET_CSCTightHalo2015Filter ->Fill(MET);
1831  }
1832  EcalDeadCellTriggerFilterResult = METFilterDecision[5];
1833  if(EcalDeadCellTriggerFilterResult){
1834  hMET_EcalDeadCellTriggerFilter = map_of_MEs[DirName+"/"+"MET_EcalDeadCellTriggerFilter"]; if (hMET_EcalDeadCellTriggerFilter && hMET_EcalDeadCellTriggerFilter->getRootObject()) hMET_EcalDeadCellTriggerFilter ->Fill(MET);
1835  }
1836  EcalDeadCellBoundaryFilterResult = METFilterDecision[6];
1837  if(EcalDeadCellBoundaryFilterResult){
1838  hMET_EcalDeadCellBoundaryFilter = map_of_MEs[DirName+"/"+"MET_EcalDeadCellBoundaryFilter"]; if (hMET_EcalDeadCellBoundaryFilter && hMET_EcalDeadCellBoundaryFilter->getRootObject()) hMET_EcalDeadCellBoundaryFilter ->Fill(MET);
1839  }
1840  HcalStripHaloFilterResult = METFilterDecision[7];
1841  if(HcalStripHaloFilterResult){
1842  hMET_HcalStripHaloFilter = map_of_MEs[DirName+"/"+"MET_HcalStripHaloFilter"]; if (hMET_HcalStripHaloFilter && hMET_HcalStripHaloFilter->getRootObject()) hMET_HcalStripHaloFilter ->Fill(MET);
1843  }
1844  hMETPhi = map_of_MEs[DirName+"/"+"METPhi"]; if (hMETPhi && hMETPhi->getRootObject()) hMETPhi ->Fill(METPhi);
1845  hSumET = map_of_MEs[DirName+"/"+"SumET"]; if (hSumET && hSumET->getRootObject()) hSumET ->Fill(SumET);
1846  hMETSig = map_of_MEs[DirName+"/"+"METSig"]; if (hMETSig && hMETSig->getRootObject()) hMETSig ->Fill(METSig);
1847  hMET_logx = map_of_MEs[DirName+"/"+"MET_logx"]; if (hMET_logx && hMET_logx->getRootObject()) hMET_logx->Fill(log10(MET));
1848  hSumET_logx = map_of_MEs[DirName+"/"+"SumET_logx"]; if (hSumET_logx && hSumET_logx->getRootObject()) hSumET_logx->Fill(log10(SumET));
1849 
1850  // Fill NPV profiles
1851  //--------------------------------------------------------------------------
1852  meMEx_profile = map_of_MEs[DirName + "/MEx_profile"];
1853  meMEy_profile = map_of_MEs[DirName + "/MEy_profile"];
1854  meMET_profile = map_of_MEs[DirName + "/MET_profile"];
1855  meSumET_profile = map_of_MEs[DirName + "/SumET_profile"];
1856 
1857  if (meMEx_profile && meMEx_profile ->getRootObject()) meMEx_profile ->Fill(numPV_, MEx);
1858  if (meMEy_profile && meMEy_profile ->getRootObject()) meMEy_profile ->Fill(numPV_, MEy);
1859  if (meMET_profile && meMET_profile ->getRootObject()) meMET_profile ->Fill(numPV_, MET);
1860  if (meSumET_profile && meSumET_profile->getRootObject()) meSumET_profile->Fill(numPV_, SumET);
1861 
1862  if(isCaloMet_){
1863  //const reco::CaloMETCollection *calometcol = calometcoll.product();
1864  //const reco::CaloMET *calomet;
1865  //calomet = &(calometcol->front());
1866 
1867  double caloEtFractionHadronic = calomet.etFractionHadronic();
1868  double caloEmEtFraction = calomet.emEtFraction();
1869 
1870  double caloHadEtInHB = calomet.hadEtInHB();
1871  double caloHadEtInHO = calomet.hadEtInHO();
1872  double caloHadEtInHE = calomet.hadEtInHE();
1873  double caloHadEtInHF = calomet.hadEtInHF();
1874  double caloEmEtInEB = calomet.emEtInEB();
1875  double caloEmEtInEE = calomet.emEtInEE();
1876  double caloEmEtInHF = calomet.emEtInHF();
1877 
1878  hCaloHadEtInHB = map_of_MEs[DirName+"/"+"CaloHadEtInHB"]; if (hCaloHadEtInHB && hCaloHadEtInHB->getRootObject()) hCaloHadEtInHB->Fill(caloHadEtInHB);
1879  hCaloHadEtInHO = map_of_MEs[DirName+"/"+"CaloHadEtInHO"]; if (hCaloHadEtInHO && hCaloHadEtInHO->getRootObject()) hCaloHadEtInHO->Fill(caloHadEtInHO);
1880  hCaloHadEtInHE = map_of_MEs[DirName+"/"+"CaloHadEtInHE"]; if (hCaloHadEtInHE && hCaloHadEtInHE->getRootObject()) hCaloHadEtInHE->Fill(caloHadEtInHE);
1881  hCaloHadEtInHF = map_of_MEs[DirName+"/"+"CaloHadEtInHF"]; if (hCaloHadEtInHF && hCaloHadEtInHF->getRootObject()) hCaloHadEtInHF->Fill(caloHadEtInHF);
1882  hCaloEmEtInEB = map_of_MEs[DirName+"/"+"CaloEmEtInEB"]; if (hCaloEmEtInEB && hCaloEmEtInEB->getRootObject()) hCaloEmEtInEB->Fill(caloEmEtInEB);
1883  hCaloEmEtInEE = map_of_MEs[DirName+"/"+"CaloEmEtInEE"]; if (hCaloEmEtInEE && hCaloEmEtInEE->getRootObject()) hCaloEmEtInEE->Fill(caloEmEtInEE);
1884  hCaloEmEtInHF = map_of_MEs[DirName+"/"+"CaloEmEtInHF"]; if (hCaloEmEtInHF && hCaloEmEtInHF->getRootObject()) hCaloEmEtInHF->Fill(caloEmEtInHF);
1885 
1886  hCaloMETPhi020 = map_of_MEs[DirName+"/"+"CaloMETPhi020"]; if (MET> 20. && hCaloMETPhi020 && hCaloMETPhi020->getRootObject()) { hCaloMETPhi020->Fill(METPhi);}
1887 
1888 
1889  hCaloEtFractionHadronic = map_of_MEs[DirName+"/"+"CaloEtFractionHadronic"]; if (hCaloEtFractionHadronic && hCaloEtFractionHadronic->getRootObject()) hCaloEtFractionHadronic->Fill(caloEtFractionHadronic);
1890  hCaloEmEtFraction = map_of_MEs[DirName+"/"+"CaloEmEtFraction"]; if (hCaloEmEtFraction && hCaloEmEtFraction->getRootObject()) hCaloEmEtFraction->Fill(caloEmEtFraction);
1891  hCaloEmEtFraction020 = map_of_MEs[DirName+"/"+"CaloEmEtFraction020"]; if (MET> 20. && hCaloEmEtFraction020 && hCaloEmEtFraction020->getRootObject()) hCaloEmEtFraction020->Fill(caloEmEtFraction);
1892  }
1893  if(isPFMet_){
1894 
1895  if(fillPFCandidatePlots && fillCandidateMap_histos){
1896  for (unsigned int i=0;i<countsPFCand_.size();i++) {
1897  countsPFCand_[i]=0;
1898  MExPFCand_[i]=0.;
1899  MEyPFCand_[i]=0.;
1900  }
1901 
1902  // typedef std::vector<reco::PFCandidate> pfCand;
1904  iEvent.getByToken(pflowToken_, particleFlow);
1905 
1906  float pt_sum_CHF_Barrel=0;
1907  float pt_sum_CHF_Endcap_plus=0;
1908  float pt_sum_CHF_Endcap_minus=0;
1909  float pt_sum_NHF_Barrel=0;
1910  float pt_sum_NHF_Endcap_plus=0;
1911  float pt_sum_NHF_Endcap_minus=0;
1912  float pt_sum_PhF_Barrel=0;
1913  float pt_sum_PhF_Endcap_plus=0;
1914  float pt_sum_PhF_Endcap_minus=0;
1915  float pt_sum_HFH_plus=0;
1916  float pt_sum_HFH_minus=0;
1917  float pt_sum_HFE_plus=0;
1918  float pt_sum_HFE_minus=0;
1919 
1920  float px_chargedHadronsBarrel=0;
1921  float py_chargedHadronsBarrel=0;
1922  float px_chargedHadronsEndcapPlus=0;
1923  float py_chargedHadronsEndcapPlus=0;
1924  float px_chargedHadronsEndcapMinus=0;
1925  float py_chargedHadronsEndcapMinus=0;
1926  float px_neutralHadronsBarrel=0;
1927  float py_neutralHadronsBarrel=0;
1928  float px_neutralHadronsEndcapPlus=0;
1929  float py_neutralHadronsEndcapPlus=0;
1930  float px_neutralHadronsEndcapMinus=0;
1931  float py_neutralHadronsEndcapMinus=0;
1932  float px_PhotonsBarrel=0;
1933  float py_PhotonsBarrel=0;
1934  float px_PhotonsEndcapPlus=0;
1935  float py_PhotonsEndcapPlus=0;
1936  float px_PhotonsEndcapMinus=0;
1937  float py_PhotonsEndcapMinus=0;
1938  float px_HFHadronsPlus=0;
1939  float py_HFHadronsPlus=0;
1940  float px_HFHadronsMinus=0;
1941  float py_HFHadronsMinus=0;
1942  float px_HFEGammasPlus=0;
1943  float py_HFEGammasPlus=0;
1944  float px_HFEGammasMinus=0;
1945  float py_HFEGammasMinus=0;
1946  for (unsigned int i = 0; i < particleFlow->size(); i++) {
1947  const reco::PFCandidate& c = particleFlow->at(i);
1948  if(c.particleId()==1){//charged hadrons
1949  //endcap minus
1950  if(c.eta()>(-3.0)&& c.eta()<(-1.392)){
1951  px_chargedHadronsEndcapMinus-=c.px();
1952  py_chargedHadronsEndcapMinus-=c.py();
1953  pt_sum_CHF_Endcap_minus+=c.et();
1954  }else if(c.eta()>=(-1.392)&& c.eta()<=1.392){//barrel
1955  px_chargedHadronsBarrel-=c.px();
1956  py_chargedHadronsBarrel-=c.py();
1957  pt_sum_CHF_Barrel+=c.et();
1958  }else if(c.eta()>1.392 && c.eta()<3.0){//endcap plus
1959  px_chargedHadronsEndcapPlus-=c.px();
1960  py_chargedHadronsEndcapPlus-=c.py();
1961  pt_sum_CHF_Endcap_plus+=c.et();
1962  }
1963  }
1964  if(c.particleId()==5){//neutral hadrons
1965  //endcap minus
1966  if(c.eta()>(-3.0)&& c.eta()<(-1.392)){
1967  px_neutralHadronsEndcapMinus-=c.px();
1968  py_neutralHadronsEndcapMinus-=c.py();
1969  pt_sum_NHF_Endcap_minus+=c.et();
1970  }else if(c.eta()>=(-1.392)&& c.eta()<=1.392){
1971  px_neutralHadronsBarrel-=c.px();
1972  py_neutralHadronsBarrel-=c.py();
1973  pt_sum_NHF_Barrel+=c.et();
1974  }else if(c.eta()>1.392 && c.eta()<3.0){
1975  px_neutralHadronsEndcapPlus-=c.px();
1976  py_neutralHadronsEndcapPlus-=c.py();
1977  pt_sum_NHF_Endcap_plus+=c.et();
1978  }
1979  }
1980  if(c.particleId()==4){//photons
1981  //endcap minus
1982  if(c.eta()>(-3.0)&& c.eta()<(-1.479)){
1983  px_PhotonsEndcapMinus-=c.px();
1984  py_PhotonsEndcapMinus-=c.py();
1985  pt_sum_PhF_Endcap_minus+=c.et();
1986  }else if(c.eta()>=(-1.479)&& c.eta()<=1.479){
1987  px_PhotonsBarrel-=c.px();
1988  py_PhotonsBarrel-=c.py();
1989  pt_sum_PhF_Barrel+=c.et();
1990  }else if(c.eta()>1.479 && c.eta()<3.0){
1991  px_PhotonsEndcapPlus-=c.px();
1992  py_PhotonsEndcapPlus-=c.py();
1993  pt_sum_PhF_Endcap_plus+=c.et();
1994  }
1995  }
1996  if(c.particleId()==6){//HFHadrons
1997  //forward minus
1998  if(c.eta()>(-5.20)&& c.eta()<-2.901376){
1999  pt_sum_HFH_minus+=c.et();
2000  px_HFHadronsMinus-=c.px();
2001  py_HFHadronsMinus-=c.py();
2002  }else if(c.eta()>2.901376 && c.eta()<5.20){//forward plus
2003  px_HFHadronsPlus-=c.px();
2004  py_HFHadronsPlus-=c.py();
2005  pt_sum_HFH_plus+=c.et();
2006  }
2007  }
2008  if(c.particleId()==7){//HFEGammas
2009  //forward minus
2010  if(c.eta()>(-5.20)&& c.eta()<-2.901376){
2011  pt_sum_HFE_minus+=c.et();
2012  px_HFEGammasMinus-=c.px();
2013  py_HFEGammasMinus-=c.py();
2014  }else if(c.eta()>2.901376 && c.eta()<5.20){//forward plus
2015  px_HFEGammasPlus-=c.px();
2016  py_HFEGammasPlus-=c.py();
2017  pt_sum_HFE_plus+=c.et();
2018  }
2019  }
2020  for (unsigned int j=0; j<typePFCand_.size(); j++) {
2021  if (c.particleId()==typePFCand_[j]) {
2022  //second check for endcap, if inside barrel Max and Min symmetric around 0
2023  if ( ((c.eta()>etaMinPFCand_[j]) && (c.eta()<etaMaxPFCand_[j])) || ((c.eta()> (-etaMaxPFCand_[j])) && (c.eta()< (-etaMinPFCand_[j]))) ){
2024  countsPFCand_[j]+=1;
2025  MExPFCand_[j]-=c.px();
2026  MEyPFCand_[j]-=c.py();
2027  }
2028  }
2029  }
2030  }
2031 
2032  for (unsigned int j=0; j<countsPFCand_.size(); j++) {
2033  profilePFCand_x_[j] = map_of_MEs[DirName + "/"+profilePFCand_x_name_[j]];
2034  if(profilePFCand_x_[j] && profilePFCand_x_[j]->getRootObject()) profilePFCand_x_[j]->Fill(countsPFCand_[j], MExPFCand_[j]);
2035  profilePFCand_y_[j] = map_of_MEs[DirName + "/"+profilePFCand_y_name_[j]];
2036  if(profilePFCand_y_[j] && profilePFCand_y_[j]->getRootObject()) profilePFCand_y_[j]->Fill(countsPFCand_[j], MEyPFCand_[j]);
2037  }
2038  meCHF_Barrel=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionBarrel"]; if(meCHF_Barrel && meCHF_Barrel->getRootObject()) meCHF_Barrel->Fill(pt_sum_CHF_Barrel/pfmet.sumEt());
2039  meCHF_EndcapPlus=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapPlus"]; if(meCHF_EndcapPlus && meCHF_EndcapPlus->getRootObject()) meCHF_EndcapPlus->Fill(pt_sum_CHF_Endcap_plus/pfmet.sumEt());
2040  meCHF_EndcapMinus=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapMinus"]; if(meCHF_EndcapMinus && meCHF_EndcapMinus->getRootObject()) meCHF_EndcapMinus->Fill(pt_sum_CHF_Endcap_minus/pfmet.sumEt());
2041  meNHF_Barrel=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionBarrel"]; if(meNHF_Barrel && meNHF_Barrel->getRootObject()) meNHF_Barrel->Fill(pt_sum_NHF_Barrel/pfmet.sumEt());
2042  meNHF_EndcapPlus=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus"]; if(meNHF_EndcapPlus && meNHF_EndcapPlus->getRootObject()) meNHF_EndcapPlus->Fill(pt_sum_NHF_Endcap_plus/pfmet.sumEt());
2043  meNHF_EndcapMinus=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus"]; if(meNHF_EndcapMinus && meNHF_EndcapMinus->getRootObject()) meNHF_EndcapMinus->Fill(pt_sum_NHF_Endcap_minus/pfmet.sumEt());
2044  mePhF_Barrel=map_of_MEs[DirName+"/"+"PfPhotonEtFractionBarrel"]; if(mePhF_Barrel && mePhF_Barrel->getRootObject()) mePhF_Barrel->Fill(pt_sum_PhF_Barrel/pfmet.sumEt());
2045  mePhF_EndcapPlus=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapPlus"]; if(mePhF_EndcapPlus && mePhF_EndcapPlus->getRootObject()) mePhF_EndcapPlus->Fill(pt_sum_PhF_Endcap_plus/pfmet.sumEt());
2046  mePhF_EndcapMinus=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapMinus"]; if(mePhF_EndcapMinus && mePhF_EndcapMinus->getRootObject()) mePhF_EndcapMinus->Fill(pt_sum_PhF_Endcap_minus/pfmet.sumEt());
2047  meHFHadF_Plus=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionPlus"]; if(meHFHadF_Plus && meHFHadF_Plus->getRootObject()) meHFHadF_Plus->Fill(pt_sum_HFH_plus/pfmet.sumEt());
2048  meHFHadF_Minus=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionMinus"]; if(meHFHadF_Minus && meHFHadF_Minus->getRootObject()) meHFHadF_Minus->Fill(pt_sum_HFH_minus/pfmet.sumEt());
2049  meHFEMF_Plus=map_of_MEs[DirName+"/"+"PfHFEMEtFractionPlus"]; if(meHFEMF_Plus && meHFEMF_Plus->getRootObject()) meHFEMF_Plus->Fill(pt_sum_HFE_plus/pfmet.sumEt());
2050  meHFEMF_Minus=map_of_MEs[DirName+"/"+"PfHFEMEtFractionMinus"]; if(meHFEMF_Minus && meHFEMF_Minus->getRootObject()) meHFEMF_Minus->Fill(pt_sum_HFE_minus/pfmet.sumEt());
2051  //sanity check if we have any type of the respective species in the events
2052  //else don't fill phi, as else we have a results of a biased peak at 0
2053  //if pt_sum of species part is 0, obviously that would be the case
2054  if(pt_sum_CHF_Barrel){
2055  meMETPhiChargedHadronsBarrel = map_of_MEs[DirName+"/"+"METPhiChargedHadronsBarrel"];if(meMETPhiChargedHadronsBarrel && meMETPhiChargedHadronsBarrel ->getRootObject())meMETPhiChargedHadronsBarrel->Fill(atan2(py_chargedHadronsBarrel,px_chargedHadronsBarrel));
2056  }
2057  if(pt_sum_CHF_Endcap_plus){
2058  meMETPhiChargedHadronsEndcapPlus = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapPlus"];if(meMETPhiChargedHadronsEndcapPlus && meMETPhiChargedHadronsEndcapPlus ->getRootObject())meMETPhiChargedHadronsEndcapPlus->Fill(atan2(py_chargedHadronsEndcapPlus,px_chargedHadronsEndcapPlus));
2059  }
2060  if(pt_sum_CHF_Endcap_minus){
2061  meMETPhiChargedHadronsEndcapMinus = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapMinus"];if(meMETPhiChargedHadronsEndcapMinus && meMETPhiChargedHadronsEndcapMinus ->getRootObject())meMETPhiChargedHadronsEndcapMinus->Fill(atan2(py_chargedHadronsEndcapMinus,px_chargedHadronsEndcapMinus));
2062  }
2063  if(pt_sum_NHF_Barrel){
2064  meMETPhiNeutralHadronsBarrel = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsBarrel"];if(meMETPhiNeutralHadronsBarrel && meMETPhiNeutralHadronsBarrel ->getRootObject())meMETPhiNeutralHadronsBarrel->Fill(atan2(py_neutralHadronsBarrel,px_neutralHadronsBarrel));
2065  }
2066  if(pt_sum_NHF_Endcap_plus){
2067  meMETPhiNeutralHadronsEndcapPlus = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapPlus"];if(meMETPhiNeutralHadronsEndcapPlus && meMETPhiNeutralHadronsEndcapPlus ->getRootObject())meMETPhiNeutralHadronsEndcapPlus->Fill(atan2(py_neutralHadronsEndcapPlus,px_neutralHadronsEndcapPlus));
2068  }
2069  if(pt_sum_NHF_Endcap_minus){
2070  meMETPhiNeutralHadronsEndcapMinus = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapMinus"];if(meMETPhiNeutralHadronsEndcapMinus && meMETPhiNeutralHadronsEndcapMinus ->getRootObject())meMETPhiNeutralHadronsEndcapMinus->Fill(atan2(py_neutralHadronsEndcapMinus,px_neutralHadronsEndcapMinus));
2071  }
2072  if(pt_sum_PhF_Barrel){
2073  meMETPhiPhotonsBarrel = map_of_MEs[DirName+"/"+"METPhiPhotonsBarrel"];if(meMETPhiPhotonsBarrel && meMETPhiPhotonsBarrel ->getRootObject())meMETPhiPhotonsBarrel->Fill(atan2(py_PhotonsBarrel,px_PhotonsBarrel));
2074  }
2075  if(pt_sum_PhF_Endcap_plus){
2076  meMETPhiPhotonsEndcapPlus = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapPlus"];if(meMETPhiPhotonsEndcapPlus && meMETPhiPhotonsEndcapPlus ->getRootObject())meMETPhiPhotonsEndcapPlus->Fill(atan2(py_PhotonsEndcapPlus,px_PhotonsEndcapPlus));
2077  }
2078  if(pt_sum_PhF_Endcap_minus){
2079  meMETPhiPhotonsEndcapMinus = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapMinus"];if(meMETPhiPhotonsEndcapMinus && meMETPhiPhotonsEndcapMinus ->getRootObject())meMETPhiPhotonsEndcapMinus->Fill(atan2(py_PhotonsEndcapMinus,px_PhotonsEndcapMinus));
2080  }
2081  if(pt_sum_HFH_plus){
2082  meMETPhiHFHadronsPlus = map_of_MEs[DirName+"/"+"METPhiHFHadronsPlus"];if(meMETPhiHFHadronsPlus && meMETPhiHFHadronsPlus ->getRootObject())meMETPhiHFHadronsPlus->Fill(atan2(py_HFHadronsPlus,px_HFHadronsPlus));
2083  }
2084  if(pt_sum_HFH_minus){
2085  meMETPhiHFHadronsMinus = map_of_MEs[DirName+"/"+"METPhiHFHadronsMinus"];if(meMETPhiHFHadronsMinus && meMETPhiHFHadronsMinus ->getRootObject())meMETPhiHFHadronsMinus->Fill(atan2(py_HFHadronsMinus,px_HFHadronsMinus));
2086  }
2087  if(pt_sum_HFE_plus){
2088  meMETPhiHFEGammasPlus = map_of_MEs[DirName+"/"+"METPhiHFEGammasPlus"];if(meMETPhiHFEGammasPlus && meMETPhiHFEGammasPlus ->getRootObject())meMETPhiHFEGammasPlus->Fill(atan2(py_HFEGammasPlus,px_HFEGammasPlus));
2089  }
2090  if(pt_sum_HFE_minus){
2091  meMETPhiHFEGammasMinus = map_of_MEs[DirName+"/"+"METPhiHFEGammasMinus"];if(meMETPhiHFEGammasMinus && meMETPhiHFEGammasMinus ->getRootObject())meMETPhiHFEGammasMinus->Fill(atan2(py_HFEGammasMinus,px_HFEGammasMinus));
2092  }
2093  //fill other diagnostic plots based on trigger decision
2094  /*if(techTriggerCase[0]){//techTriggerResultBx0 && techTriggerResultBxM2 && techTriggerResultBxM1 -> both previous bunches filled
2095  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());
2096  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());
2097  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());
2098  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());
2099  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());
2100  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());
2101  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());
2102  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());
2103  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());
2104  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());
2105  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());
2106  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());
2107  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());
2108  mePhotonEtFraction_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"PfPhotonEtFraction_BXm2BXm1Filled"]; if ( mePhotonEtFraction_BXm2BXm1Filled && mePhotonEtFraction_BXm2BXm1Filled ->getRootObject()) mePhotonEtFraction_BXm2BXm1Filled ->Fill(pfmet.photonEtFraction());
2109  meNeutralHadronEtFraction_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"PfNeutralHadronEtFraction_BXm2BXm1Filled"]; if ( meNeutralHadronEtFraction_BXm2BXm1Filled && meNeutralHadronEtFraction_BXm2BXm1Filled ->getRootObject()) meNeutralHadronEtFraction_BXm2BXm1Filled ->Fill(pfmet.neutralHadronEtFraction());
2110  meChargedHadronEtFraction_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"PfChargedHadronEtFraction_BXm2BXm1Filled"]; if ( meChargedHadronEtFraction_BXm2BXm1Filled && meChargedHadronEtFraction_BXm2BXm1Filled ->getRootObject()) meChargedHadronEtFraction_BXm2BXm1Filled ->Fill(pfmet.chargedHadronEtFraction());
2111  meMET_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"MET_BXm2BXm1Filled"]; if ( meMET_BXm2BXm1Filled && meMET_BXm2BXm1Filled ->getRootObject()) meMET_BXm2BXm1Filled ->Fill(pfmet.pt());
2112  meSumET_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"SumET_BXm2BXm1Filled"]; if ( meSumET_BXm2BXm1Filled && meSumET_BXm2BXm1Filled ->getRootObject()) meSumET_BXm2BXm1Filled ->Fill(pfmet.sumEt());
2113  if(pt_sum_CHF_Barrel){
2114  meMETPhiChargedHadronsBarrel_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiChargedHadronsBarrel_BXm2BXm1Filled"];if(meMETPhiChargedHadronsBarrel_BXm2BXm1Filled && meMETPhiChargedHadronsBarrel_BXm2BXm1Filled ->getRootObject())meMETPhiChargedHadronsBarrel_BXm2BXm1Filled->Fill(atan2(py_chargedHadronsBarrel,px_chargedHadronsBarrel));
2115  }
2116  if(pt_sum_CHF_Endcap_plus){
2117  meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm2BXm1Filled"];if(meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled && meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled ->getRootObject())meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled->Fill(atan2(py_chargedHadronsEndcapPlus,px_chargedHadronsEndcapPlus));
2118  }
2119  if(pt_sum_CHF_Endcap_minus){
2120  meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm2BXm1Filled"];if(meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled && meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled ->getRootObject())meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled->Fill(atan2(py_chargedHadronsEndcapMinus,px_chargedHadronsEndcapMinus));
2121  }
2122  if(pt_sum_NHF_Barrel){
2123  meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsBarrel_BXm2BXm1Filled"];if(meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled && meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled ->getRootObject())meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled->Fill(atan2(py_neutralHadronsBarrel,px_neutralHadronsBarrel));
2124  }
2125  if(pt_sum_NHF_Endcap_plus){
2126  meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled"];if(meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled && meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled ->getRootObject())meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled->Fill(atan2(py_neutralHadronsEndcapPlus,px_neutralHadronsEndcapPlus));
2127  }
2128  if(pt_sum_NHF_Endcap_minus){
2129  meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled"];if(meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled && meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled ->getRootObject())meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled->Fill(atan2(py_neutralHadronsEndcapMinus,px_neutralHadronsEndcapMinus));
2130  }
2131  if(pt_sum_PhF_Barrel){
2132  meMETPhiPhotonsBarrel_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiPhotonsBarrel_BXm2BXm1Filled"];if(meMETPhiPhotonsBarrel_BXm2BXm1Filled && meMETPhiPhotonsBarrel_BXm2BXm1Filled ->getRootObject())meMETPhiPhotonsBarrel_BXm2BXm1Filled->Fill(atan2(py_PhotonsBarrel,px_PhotonsBarrel));
2133  }
2134  if(pt_sum_PhF_Endcap_plus){
2135  meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapPlus_BXm2BXm1Filled"];if(meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled && meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled ->getRootObject())meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled->Fill(atan2(py_PhotonsEndcapPlus,px_PhotonsEndcapPlus));
2136  }
2137  if(pt_sum_PhF_Endcap_minus){
2138  meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapMinus_BXm2BXm1Filled"];if(meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled && meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled ->getRootObject())meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled->Fill(atan2(py_PhotonsEndcapMinus,px_PhotonsEndcapMinus));
2139  }
2140  if(pt_sum_HFH_plus){
2141  meMETPhiHFHadronsPlus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiHFHadronsPlus_BXm2BXm1Filled"];if(meMETPhiHFHadronsPlus_BXm2BXm1Filled && meMETPhiHFHadronsPlus_BXm2BXm1Filled ->getRootObject())meMETPhiHFHadronsPlus_BXm2BXm1Filled->Fill(atan2(py_HFHadronsPlus,px_HFHadronsPlus));
2142  }
2143  if(pt_sum_HFH_minus){
2144  meMETPhiHFHadronsMinus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiHFHadronsMinus_BXm2BXm1Filled"];if(meMETPhiHFHadronsMinus_BXm2BXm1Filled && meMETPhiHFHadronsMinus_BXm2BXm1Filled ->getRootObject())meMETPhiHFHadronsMinus_BXm2BXm1Filled->Fill(atan2(py_HFHadronsMinus,px_HFHadronsMinus));
2145  }
2146  if(pt_sum_HFE_plus){
2147  meMETPhiHFEGammasPlus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiHFEGammasPlus_BXm2BXm1Filled"];if(meMETPhiHFEGammasPlus_BXm2BXm1Filled && meMETPhiHFEGammasPlus_BXm2BXm1Filled ->getRootObject())meMETPhiHFEGammasPlus_BXm2BXm1Filled->Fill(atan2(py_HFEGammasPlus,px_HFEGammasPlus));
2148  }
2149  if(pt_sum_HFE_minus){
2150  meMETPhiHFEGammasMinus_BXm2BXm1Filled = map_of_MEs[DirName+"/"+"METPhiHFEGammasMinus_BXm2BXm1Filled"];if(meMETPhiHFEGammasMinus_BXm2BXm1Filled && meMETPhiHFEGammasMinus_BXm2BXm1Filled ->getRootObject())meMETPhiHFEGammasMinus_BXm2BXm1Filled->Fill(atan2(py_HFEGammasMinus,px_HFEGammasMinus));
2151  }
2152  }*/
2153  if(techTriggerCase[1]){//techTriggerResultBx0 && techTriggerResultBxM1 -> previous bunch filled
2154  meCHF_Barrel_BXm1Filled=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm1Filled"]; if(meCHF_Barrel_BXm1Filled && meCHF_Barrel_BXm1Filled->getRootObject()) meCHF_Barrel_BXm1Filled->Fill(pt_sum_CHF_Barrel/pfmet.sumEt());
2155  meCHF_EndcapPlus_BXm1Filled=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm1Filled"]; if(meCHF_EndcapPlus_BXm1Filled && meCHF_EndcapPlus_BXm1Filled->getRootObject()) meCHF_EndcapPlus_BXm1Filled->Fill(pt_sum_CHF_Endcap_plus/pfmet.sumEt());
2156  meCHF_EndcapMinus_BXm1Filled=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm1Filled"]; if(meCHF_EndcapMinus_BXm1Filled && meCHF_EndcapMinus_BXm1Filled->getRootObject()) meCHF_EndcapMinus_BXm1Filled->Fill(pt_sum_CHF_Endcap_minus/pfmet.sumEt());
2157  meNHF_Barrel_BXm1Filled=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm1Filled"]; if(meNHF_Barrel_BXm1Filled && meNHF_Barrel_BXm1Filled->getRootObject()) meNHF_Barrel_BXm1Filled->Fill(pt_sum_NHF_Barrel/pfmet.sumEt());
2158  meNHF_EndcapPlus_BXm1Filled=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm1Filled"]; if(meNHF_EndcapPlus_BXm1Filled && meNHF_EndcapPlus_BXm1Filled->getRootObject()) meNHF_EndcapPlus_BXm1Filled->Fill(pt_sum_NHF_Endcap_plus/pfmet.sumEt());
2159  meNHF_EndcapMinus_BXm1Filled=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm1Filled"]; if(meNHF_EndcapMinus_BXm1Filled && meNHF_EndcapMinus_BXm1Filled->getRootObject()) meNHF_EndcapMinus_BXm1Filled->Fill(pt_sum_NHF_Endcap_minus/pfmet.sumEt());
2160  mePhF_Barrel_BXm1Filled=map_of_MEs[DirName+"/"+"PfPhotonEtFractionBarrel_BXm1Filled"]; if(mePhF_Barrel_BXm1Filled && mePhF_Barrel_BXm1Filled->getRootObject()) mePhF_Barrel_BXm1Filled->Fill(pt_sum_PhF_Barrel/pfmet.sumEt());
2161  mePhF_EndcapPlus_BXm1Filled=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm1Filled"]; if(mePhF_EndcapPlus_BXm1Filled && mePhF_EndcapPlus_BXm1Filled->getRootObject()) mePhF_EndcapPlus_BXm1Filled->Fill(pt_sum_PhF_Endcap_plus/pfmet.sumEt());
2162  mePhF_EndcapMinus_BXm1Filled=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm1Filled"]; if(mePhF_EndcapMinus_BXm1Filled && mePhF_EndcapMinus_BXm1Filled->getRootObject()) mePhF_EndcapMinus_BXm1Filled->Fill(pt_sum_PhF_Endcap_minus/pfmet.sumEt());
2163  meHFHadF_Plus_BXm1Filled=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionPlus_BXm1Filled"]; if(meHFHadF_Plus_BXm1Filled && meHFHadF_Plus_BXm1Filled->getRootObject()) meHFHadF_Plus_BXm1Filled->Fill(pt_sum_HFH_plus/pfmet.sumEt());
2164  meHFHadF_Minus_BXm1Filled=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionMinus_BXm1Filled"]; if(meHFHadF_Minus_BXm1Filled && meHFHadF_Minus_BXm1Filled->getRootObject()) meHFHadF_Minus_BXm1Filled->Fill(pt_sum_HFH_minus/pfmet.sumEt());
2165  meHFEMF_Plus_BXm1Filled=map_of_MEs[DirName+"/"+"PfHFEMEtFractionPlus_BXm1Filled"]; if(meHFEMF_Plus_BXm1Filled && meHFEMF_Plus_BXm1Filled->getRootObject()) meHFEMF_Plus_BXm1Filled->Fill(pt_sum_HFE_plus/pfmet.sumEt());
2166  meHFEMF_Minus_BXm1Filled=map_of_MEs[DirName+"/"+"PfHFEMEtFractionMinus_BXm1Filled"]; if(meHFEMF_Minus_BXm1Filled && meHFEMF_Minus_BXm1Filled->getRootObject()) meHFEMF_Minus_BXm1Filled->Fill(pt_sum_HFE_minus/pfmet.sumEt());
2167  mePhotonEtFraction_BXm1Filled = map_of_MEs[DirName+"/"+"PfPhotonEtFraction_BXm1Filled"]; if ( mePhotonEtFraction_BXm1Filled && mePhotonEtFraction_BXm1Filled ->getRootObject()) mePhotonEtFraction_BXm1Filled ->Fill(pfmet.photonEtFraction());
2168  meNeutralHadronEtFraction_BXm1Filled = map_of_MEs[DirName+"/"+"PfNeutralHadronEtFraction_BXm1Filled"]; if ( meNeutralHadronEtFraction_BXm1Filled && meNeutralHadronEtFraction_BXm1Filled ->getRootObject()) meNeutralHadronEtFraction_BXm1Filled ->Fill(pfmet.neutralHadronEtFraction());
2169  meChargedHadronEtFraction_BXm1Filled = map_of_MEs[DirName+"/"+"PfChargedHadronEtFraction_BXm1Filled"]; if ( meChargedHadronEtFraction_BXm1Filled && meChargedHadronEtFraction_BXm1Filled ->getRootObject()) meChargedHadronEtFraction_BXm1Filled ->Fill(pfmet.chargedHadronEtFraction());
2170  meMET_BXm1Filled = map_of_MEs[DirName+"/"+"MET_BXm1Filled"]; if ( meMET_BXm1Filled && meMET_BXm1Filled ->getRootObject()) meMET_BXm1Filled ->Fill(pfmet.pt());
2171  meSumET_BXm1Filled = map_of_MEs[DirName+"/"+"SumET_BXm1Filled"]; if ( meSumET_BXm1Filled && meSumET_BXm1Filled ->getRootObject()) meSumET_BXm1Filled ->Fill(pfmet.sumEt());
2172  if(pt_sum_CHF_Barrel){
2173  meMETPhiChargedHadronsBarrel_BXm1Filled = map_of_MEs[DirName+"/"+"METPhiChargedHadronsBarrel_BXm1Filled"];if(meMETPhiChargedHadronsBarrel_BXm1Filled && meMETPhiChargedHadronsBarrel_BXm1Filled ->getRootObject())meMETPhiChargedHadronsBarrel_BXm1Filled->Fill(atan2(py_chargedHadronsBarrel,px_chargedHadronsBarrel));
2174  }
2175  if(pt_sum_CHF_Endcap_plus){
2176  meMETPhiChargedHadronsEndcapPlus_BXm1Filled = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm1Filled"];if(meMETPhiChargedHadronsEndcapPlus_BXm1Filled && meMETPhiChargedHadronsEndcapPlus_BXm1Filled ->getRootObject())meMETPhiChargedHadronsEndcapPlus_BXm1Filled->Fill(atan2(py_chargedHadronsEndcapPlus,px_chargedHadronsEndcapPlus));
2177  }
2178  if(pt_sum_CHF_Endcap_minus){
2179  meMETPhiChargedHadronsEndcapMinus_BXm1Filled = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm1Filled"];if(meMETPhiChargedHadronsEndcapMinus_BXm1Filled && meMETPhiChargedHadronsEndcapMinus_BXm1Filled ->getRootObject())meMETPhiChargedHadronsEndcapMinus_BXm1Filled->Fill(atan2(py_chargedHadronsEndcapMinus,px_chargedHadronsEndcapMinus));
2180  }
2181  if(pt_sum_NHF_Barrel){
2182  meMETPhiNeutralHadronsBarrel_BXm1Filled = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsBarrel_BXm1Filled"];if(meMETPhiNeutralHadronsBarrel_BXm1Filled && meMETPhiNeutralHadronsBarrel_BXm1Filled ->getRootObject())meMETPhiNeutralHadronsBarrel_BXm1Filled->Fill(atan2(py_neutralHadronsBarrel,px_neutralHadronsBarrel));
2183  }
2184  if(pt_sum_NHF_Endcap_plus){
2185  meMETPhiNeutralHadronsEndcapPlus_BXm1Filled = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm1Filled"];if(meMETPhiNeutralHadronsEndcapPlus_BXm1Filled && meMETPhiNeutralHadronsEndcapPlus_BXm1Filled ->getRootObject())meMETPhiNeutralHadronsEndcapPlus_BXm1Filled->Fill(atan2(py_neutralHadronsEndcapPlus,px_neutralHadronsEndcapPlus));
2186  }
2187  if(pt_sum_NHF_Endcap_minus){
2188  meMETPhiNeutralHadronsEndcapMinus_BXm1Filled = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm1Filled"];if(meMETPhiNeutralHadronsEndcapMinus_BXm1Filled && meMETPhiNeutralHadronsEndcapMinus_BXm1Filled ->getRootObject())meMETPhiNeutralHadronsEndcapMinus_BXm1Filled->Fill(atan2(py_neutralHadronsEndcapMinus,px_neutralHadronsEndcapMinus));
2189  }
2190  if(pt_sum_PhF_Barrel){
2191  meMETPhiPhotonsBarrel_BXm1Filled = map_of_MEs[DirName+"/"+"METPhiPhotonsBarrel_BXm1Filled"];if(meMETPhiPhotonsBarrel_BXm1Filled && meMETPhiPhotonsBarrel_BXm1Filled ->getRootObject())meMETPhiPhotonsBarrel_BXm1Filled->Fill(atan2(py_PhotonsBarrel,px_PhotonsBarrel));
2192  }
2193  if(pt_sum_PhF_Endcap_plus){
2194  meMETPhiPhotonsEndcapPlus_BXm1Filled = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapPlus_BXm1Filled"];if(meMETPhiPhotonsEndcapPlus_BXm1Filled && meMETPhiPhotonsEndcapPlus_BXm1Filled ->getRootObject())meMETPhiPhotonsEndcapPlus_BXm1Filled->Fill(atan2(py_PhotonsEndcapPlus,px_PhotonsEndcapPlus));
2195  }
2196  if(pt_sum_PhF_Endcap_minus){
2197  meMETPhiPhotonsEndcapMinus_BXm1Filled = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapMinus_BXm1Filled"];if(meMETPhiPhotonsEndcapMinus_BXm1Filled && meMETPhiPhotonsEndcapMinus_BXm1Filled ->getRootObject())meMETPhiPhotonsEndcapMinus_BXm1Filled->Fill(atan2(py_PhotonsEndcapMinus,px_PhotonsEndcapMinus));
2198  }
2199  if(pt_sum_HFH_plus){
2200  meMETPhiHFHadronsPlus_BXm1Filled = map_of_MEs[DirName+"/"+"METPhiHFHadronsPlus_BXm1Filled"];if(meMETPhiHFHadronsPlus_BXm1Filled && meMETPhiHFHadronsPlus_BXm1Filled ->getRootObject())meMETPhiHFHadronsPlus_BXm1Filled->Fill(atan2(py_HFHadronsPlus,px_HFHadronsPlus));
2201  }
2202  if(pt_sum_HFH_minus){
2203  meMETPhiHFHadronsMinus_BXm1Filled = map_of_MEs[DirName+"/"+"METPhiHFHadronsMinus_BXm1Filled"];if(meMETPhiHFHadronsMinus_BXm1Filled && meMETPhiHFHadronsMinus_BXm1Filled ->getRootObject())meMETPhiHFHadronsMinus_BXm1Filled->Fill(atan2(py_HFHadronsMinus,px_HFHadronsMinus));
2204  }
2205  if(pt_sum_HFE_plus){
2206  meMETPhiHFEGammasPlus_BXm1Filled = map_of_MEs[DirName+"/"+"METPhiHFEGammasPlus_BXm1Filled"];if(meMETPhiHFEGammasPlus_BXm1Filled && meMETPhiHFEGammasPlus_BXm1Filled ->getRootObject())meMETPhiHFEGammasPlus_BXm1Filled->Fill(atan2(py_HFEGammasPlus,px_HFEGammasPlus));
2207  }
2208  if(pt_sum_HFE_minus){
2209  meMETPhiHFEGammasMinus_BXm1Filled = map_of_MEs[DirName+"/"+"METPhiHFEGammasMinus_BXm1Filled"];if(meMETPhiHFEGammasMinus_BXm1Filled && meMETPhiHFEGammasMinus_BXm1Filled ->getRootObject())meMETPhiHFEGammasMinus_BXm1Filled->Fill(atan2(py_HFEGammasMinus,px_HFEGammasMinus));
2210  }
2211  }
2212  /*if(techTriggerCase[3]){//techTriggerResultBx0 && !techTriggerResultBxM2 && !techTriggerResultBxM1 ->previous two bunches empty
2213  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());
2214  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());
2215  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());
2216  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());
2217  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());
2218  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());
2219  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());
2220  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());
2221  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());
2222  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());
2223  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());
2224  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());
2225  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());
2226  mePhotonEtFraction_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"PfPhotonEtFraction_BXm2BXm1Empty"]; if ( mePhotonEtFraction_BXm2BXm1Empty && mePhotonEtFraction_BXm2BXm1Empty ->getRootObject()) mePhotonEtFraction_BXm2BXm1Empty ->Fill(pfmet.photonEtFraction());
2227  meNeutralHadronEtFraction_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"PfNeutralHadronEtFraction_BXm2BXm1Empty"]; if ( meNeutralHadronEtFraction_BXm2BXm1Empty && meNeutralHadronEtFraction_BXm2BXm1Empty ->getRootObject()) meNeutralHadronEtFraction_BXm2BXm1Empty ->Fill(pfmet.neutralHadronEtFraction());
2228  meChargedHadronEtFraction_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"PfChargedHadronEtFraction_BXm2BXm1Empty"]; if ( meChargedHadronEtFraction_BXm2BXm1Empty && meChargedHadronEtFraction_BXm2BXm1Empty ->getRootObject()) meChargedHadronEtFraction_BXm2BXm1Empty ->Fill(pfmet.chargedHadronEtFraction());
2229  meMET_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"MET_BXm2BXm1Empty"]; if ( meMET_BXm2BXm1Empty && meMET_BXm2BXm1Empty ->getRootObject()) meMET_BXm2BXm1Empty ->Fill(pfmet.pt());
2230  meSumET_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"SumET_BXm2BXm1Empty"]; if ( meSumET_BXm2BXm1Empty && meSumET_BXm2BXm1Empty ->getRootObject()) meSumET_BXm2BXm1Empty ->Fill(pfmet.sumEt());
2231  if(pt_sum_CHF_Barrel){
2232  meMETPhiChargedHadronsBarrel_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiChargedHadronsBarrel_BXm2BXm1Empty"];if(meMETPhiChargedHadronsBarrel_BXm2BXm1Empty && meMETPhiChargedHadronsBarrel_BXm2BXm1Empty ->getRootObject())meMETPhiChargedHadronsBarrel_BXm2BXm1Empty->Fill(atan2(py_chargedHadronsBarrel,px_chargedHadronsBarrel));
2233  }
2234  if(pt_sum_CHF_Endcap_plus){
2235  meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm2BXm1Empty"];if(meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty && meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty ->getRootObject())meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty->Fill(atan2(py_chargedHadronsEndcapPlus,px_chargedHadronsEndcapPlus));
2236  }
2237  if(pt_sum_CHF_Endcap_minus){
2238  meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm2BXm1Empty"];if(meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty && meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty ->getRootObject())meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty->Fill(atan2(py_chargedHadronsEndcapMinus,px_chargedHadronsEndcapMinus));
2239  }
2240  if(pt_sum_NHF_Barrel){
2241  meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsBarrel_BXm2BXm1Empty"];if(meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty && meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty ->getRootObject())meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty->Fill(atan2(py_neutralHadronsBarrel,px_neutralHadronsBarrel));
2242  }
2243  if(pt_sum_NHF_Endcap_plus){
2244  meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty"];if(meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty && meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty ->getRootObject())meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty->Fill(atan2(py_neutralHadronsEndcapPlus,px_neutralHadronsEndcapPlus));
2245  }
2246  if(pt_sum_NHF_Endcap_minus){
2247  meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty"];if(meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty && meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty ->getRootObject())meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty->Fill(atan2(py_neutralHadronsEndcapMinus,px_neutralHadronsEndcapMinus));
2248  }
2249  if(pt_sum_PhF_Barrel){
2250  meMETPhiPhotonsBarrel_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiPhotonsBarrel_BXm2BXm1Empty"];if(meMETPhiPhotonsBarrel_BXm2BXm1Empty && meMETPhiPhotonsBarrel_BXm2BXm1Empty ->getRootObject())meMETPhiPhotonsBarrel_BXm2BXm1Empty->Fill(atan2(py_PhotonsBarrel,px_PhotonsBarrel));
2251  }
2252  if(pt_sum_PhF_Endcap_plus){
2253  meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapPlus_BXm2BXm1Empty"];if(meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty && meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty ->getRootObject())meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty->Fill(atan2(py_PhotonsEndcapPlus,px_PhotonsEndcapPlus));
2254  }
2255  if(pt_sum_PhF_Endcap_minus){
2256  meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapMinus_BXm2BXm1Empty"];if(meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty && meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty ->getRootObject())meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty->Fill(atan2(py_PhotonsEndcapMinus,px_PhotonsEndcapMinus));
2257  }
2258  if(pt_sum_HFH_plus){
2259  meMETPhiHFHadronsPlus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiHFHadronsPlus_BXm2BXm1Empty"];if(meMETPhiHFHadronsPlus_BXm2BXm1Empty && meMETPhiHFHadronsPlus_BXm2BXm1Empty ->getRootObject())meMETPhiHFHadronsPlus_BXm2BXm1Empty->Fill(atan2(py_HFHadronsPlus,px_HFHadronsPlus));
2260  }
2261  if(pt_sum_HFH_minus){
2262  meMETPhiHFHadronsMinus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiHFHadronsMinus_BXm2BXm1Empty"];if(meMETPhiHFHadronsMinus_BXm2BXm1Empty && meMETPhiHFHadronsMinus_BXm2BXm1Empty ->getRootObject())meMETPhiHFHadronsMinus_BXm2BXm1Empty->Fill(atan2(py_HFHadronsMinus,px_HFHadronsMinus));
2263  }
2264  if(pt_sum_HFE_plus){
2265  meMETPhiHFEGammasPlus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiHFEGammasPlus_BXm2BXm1Empty"];if(meMETPhiHFEGammasPlus_BXm2BXm1Empty && meMETPhiHFEGammasPlus_BXm2BXm1Empty ->getRootObject())meMETPhiHFEGammasPlus_BXm2BXm1Empty->Fill(atan2(py_HFEGammasPlus,px_HFEGammasPlus));
2266  }
2267  if(pt_sum_HFE_minus){
2268  meMETPhiHFEGammasMinus_BXm2BXm1Empty = map_of_MEs[DirName+"/"+"METPhiHFEGammasMinus_BXm2BXm1Empty"];if(meMETPhiHFEGammasMinus_BXm2BXm1Empty && meMETPhiHFEGammasMinus_BXm2BXm1Empty ->getRootObject())meMETPhiHFEGammasMinus_BXm2BXm1Empty->Fill(atan2(py_HFEGammasMinus,px_HFEGammasMinus));
2269  }
2270  }*/
2271  if(techTriggerCase[2]){//techTriggerResultBx0 && !techTriggerResultBxM1 --> previous bunch empty
2272  meCHF_Barrel_BXm1Empty=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm1Empty"]; if(meCHF_Barrel_BXm1Empty && meCHF_Barrel_BXm1Empty->getRootObject()) meCHF_Barrel_BXm1Empty->Fill(pt_sum_CHF_Barrel/pfmet.sumEt());
2273  meCHF_EndcapPlus_BXm1Empty=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm1Empty"]; if(meCHF_EndcapPlus_BXm1Empty && meCHF_EndcapPlus_BXm1Empty->getRootObject()) meCHF_EndcapPlus_BXm1Empty->Fill(pt_sum_CHF_Endcap_plus/pfmet.sumEt());
2274  meCHF_EndcapMinus_BXm1Empty=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm1Empty"]; if(meCHF_EndcapMinus_BXm1Empty && meCHF_EndcapMinus_BXm1Empty->getRootObject()) meCHF_EndcapMinus_BXm1Empty->Fill(pt_sum_CHF_Endcap_minus/pfmet.sumEt());
2275  meNHF_Barrel_BXm1Empty=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm1Empty"]; if(meNHF_Barrel_BXm1Empty && meNHF_Barrel_BXm1Empty->getRootObject()) meNHF_Barrel_BXm1Empty->Fill(pt_sum_NHF_Barrel/pfmet.sumEt());
2276  meNHF_EndcapPlus_BXm1Empty=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm1Empty"]; if(meNHF_EndcapPlus_BXm1Empty && meNHF_EndcapPlus_BXm1Empty->getRootObject()) meNHF_EndcapPlus_BXm1Empty->Fill(pt_sum_NHF_Endcap_plus/pfmet.sumEt());
2277  meNHF_EndcapMinus_BXm1Empty=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm1Empty"]; if(meNHF_EndcapMinus_BXm1Empty && meNHF_EndcapMinus_BXm1Empty->getRootObject()) meNHF_EndcapMinus_BXm1Empty->Fill(pt_sum_NHF_Endcap_minus/pfmet.sumEt());
2278  mePhF_Barrel_BXm1Empty=map_of_MEs[DirName+"/"+"PfPhotonEtFractionBarrel_BXm1Empty"]; if(mePhF_Barrel_BXm1Empty && mePhF_Barrel_BXm1Empty->getRootObject()) mePhF_Barrel_BXm1Empty->Fill(pt_sum_PhF_Barrel/pfmet.sumEt());
2279  mePhF_EndcapPlus_BXm1Empty=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm1Empty"]; if(mePhF_EndcapPlus_BXm1Empty && mePhF_EndcapPlus_BXm1Empty->getRootObject()) mePhF_EndcapPlus_BXm1Empty->Fill(pt_sum_PhF_Endcap_plus/pfmet.sumEt());
2280  mePhF_EndcapMinus_BXm1Empty=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm1Empty"]; if(mePhF_EndcapMinus_BXm1Empty && mePhF_EndcapMinus_BXm1Empty->getRootObject()) mePhF_EndcapMinus_BXm1Empty->Fill(pt_sum_PhF_Endcap_minus/pfmet.sumEt());
2281  meHFHadF_Plus_BXm1Empty=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionPlus_BXm1Empty"]; if(meHFHadF_Plus_BXm1Empty && meHFHadF_Plus_BXm1Empty->getRootObject()) meHFHadF_Plus_BXm1Empty->Fill(pt_sum_HFH_plus/pfmet.sumEt());
2282  meHFHadF_Minus_BXm1Empty=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionMinus_BXm1Empty"]; if(meHFHadF_Minus_BXm1Empty && meHFHadF_Minus_BXm1Empty->getRootObject()) meHFHadF_Minus_BXm1Empty->Fill(pt_sum_HFH_minus/pfmet.sumEt());
2283  meHFEMF_Plus_BXm1Empty=map_of_MEs[DirName+"/"+"PfHFEMEtFractionPlus_BXm1Empty"]; if(meHFEMF_Plus_BXm1Empty && meHFEMF_Plus_BXm1Empty->getRootObject()) meHFEMF_Plus_BXm1Empty->Fill(pt_sum_HFE_plus/pfmet.sumEt());
2284  meHFEMF_Minus_BXm1Empty=map_of_MEs[DirName+"/"+"PfHFEMEtFractionMinus_BXm1Empty"]; if(meHFEMF_Minus_BXm1Empty && meHFEMF_Minus_BXm1Empty->getRootObject()) meHFEMF_Minus_BXm1Empty->Fill(pt_sum_HFE_minus/pfmet.sumEt());
2285  mePhotonEtFraction_BXm1Empty = map_of_MEs[DirName+"/"+"PfPhotonEtFraction_BXm1Empty"]; if ( mePhotonEtFraction_BXm1Empty && mePhotonEtFraction_BXm1Empty ->getRootObject()) mePhotonEtFraction_BXm1Empty ->Fill(pfmet.photonEtFraction());
2286  meNeutralHadronEtFraction_BXm1Empty = map_of_MEs[DirName+"/"+"PfNeutralHadronEtFraction_BXm1Empty"]; if ( meNeutralHadronEtFraction_BXm1Empty && meNeutralHadronEtFraction_BXm1Empty ->getRootObject()) meNeutralHadronEtFraction_BXm1Empty ->Fill(pfmet.neutralHadronEtFraction());
2287  meChargedHadronEtFraction_BXm1Empty = map_of_MEs[DirName+"/"+"PfChargedHadronEtFraction_BXm1Empty"]; if ( meChargedHadronEtFraction_BXm1Empty && meChargedHadronEtFraction_BXm1Empty ->getRootObject()) meChargedHadronEtFraction_BXm1Empty ->Fill(pfmet.chargedHadronEtFraction());
2288  meMET_BXm1Empty = map_of_MEs[DirName+"/"+"MET_BXm1Empty"]; if ( meMET_BXm1Empty && meMET_BXm1Empty ->getRootObject()) meMET_BXm1Empty ->Fill(pfmet.pt());
2289  meSumET_BXm1Empty = map_of_MEs[DirName+"/"+"SumET_BXm1Empty"]; if ( meSumET_BXm1Empty && meSumET_BXm1Empty ->getRootObject()) meSumET_BXm1Empty ->Fill(pfmet.sumEt());
2290  if(pt_sum_CHF_Barrel){
2291  meMETPhiChargedHadronsBarrel_BXm1Empty = map_of_MEs[DirName+"/"+"METPhiChargedHadronsBarrel_BXm1Empty"];if(meMETPhiChargedHadronsBarrel_BXm1Empty && meMETPhiChargedHadronsBarrel_BXm1Empty ->getRootObject())meMETPhiChargedHadronsBarrel_BXm1Empty->Fill(atan2(py_chargedHadronsBarrel,px_chargedHadronsBarrel));
2292  }
2293  if(pt_sum_CHF_Endcap_plus){
2294  meMETPhiChargedHadronsEndcapPlus_BXm1Empty = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm1Empty"];if(meMETPhiChargedHadronsEndcapPlus_BXm1Empty && meMETPhiChargedHadronsEndcapPlus_BXm1Empty ->getRootObject())meMETPhiChargedHadronsEndcapPlus_BXm1Empty->Fill(atan2(py_chargedHadronsEndcapPlus,px_chargedHadronsEndcapPlus));
2295  }
2296  if(pt_sum_CHF_Endcap_minus){
2297  meMETPhiChargedHadronsEndcapMinus_BXm1Empty = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm1Empty"];if(meMETPhiChargedHadronsEndcapMinus_BXm1Empty && meMETPhiChargedHadronsEndcapMinus_BXm1Empty ->getRootObject())meMETPhiChargedHadronsEndcapMinus_BXm1Empty->Fill(atan2(py_chargedHadronsEndcapMinus,px_chargedHadronsEndcapMinus));
2298  }
2299  if(pt_sum_NHF_Barrel){
2300  meMETPhiNeutralHadronsBarrel_BXm1Empty = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsBarrel_BXm1Empty"];if(meMETPhiNeutralHadronsBarrel_BXm1Empty && meMETPhiNeutralHadronsBarrel_BXm1Empty ->getRootObject())meMETPhiNeutralHadronsBarrel_BXm1Empty->Fill(atan2(py_neutralHadronsBarrel,px_neutralHadronsBarrel));
2301  }
2302  if(pt_sum_NHF_Endcap_plus){
2303  meMETPhiNeutralHadronsEndcapPlus_BXm1Empty = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm1Empty"];if(meMETPhiNeutralHadronsEndcapPlus_BXm1Empty && meMETPhiNeutralHadronsEndcapPlus_BXm1Empty ->getRootObject())meMETPhiNeutralHadronsEndcapPlus_BXm1Empty->Fill(atan2(py_neutralHadronsEndcapPlus,px_neutralHadronsEndcapPlus));
2304  }
2305  if(pt_sum_NHF_Endcap_minus){
2306  meMETPhiNeutralHadronsEndcapMinus_BXm1Empty = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm1Empty"];if(meMETPhiNeutralHadronsEndcapMinus_BXm1Empty && meMETPhiNeutralHadronsEndcapMinus_BXm1Empty ->getRootObject())meMETPhiNeutralHadronsEndcapMinus_BXm1Empty->Fill(atan2(py_neutralHadronsEndcapMinus,px_neutralHadronsEndcapMinus));
2307  }
2308  if(pt_sum_PhF_Barrel){
2309  meMETPhiPhotonsBarrel_BXm1Empty = map_of_MEs[DirName+"/"+"METPhiPhotonsBarrel_BXm1Empty"];if(meMETPhiPhotonsBarrel_BXm1Empty && meMETPhiPhotonsBarrel_BXm1Empty ->getRootObject())meMETPhiPhotonsBarrel_BXm1Empty->Fill(atan2(py_PhotonsBarrel,px_PhotonsBarrel));
2310  }
2311  if(pt_sum_PhF_Endcap_plus){
2312  meMETPhiPhotonsEndcapPlus_BXm1Empty = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapPlus_BXm1Empty"];if(meMETPhiPhotonsEndcapPlus_BXm1Empty && meMETPhiPhotonsEndcapPlus_BXm1Empty ->getRootObject())meMETPhiPhotonsEndcapPlus_BXm1Empty->Fill(atan2(py_PhotonsEndcapPlus,px_PhotonsEndcapPlus));
2313  }
2314  if(pt_sum_PhF_Endcap_minus){
2315  meMETPhiPhotonsEndcapMinus_BXm1Empty = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapMinus_BXm1Empty"];if(meMETPhiPhotonsEndcapMinus_BXm1Empty && meMETPhiPhotonsEndcapMinus_BXm1Empty ->getRootObject())meMETPhiPhotonsEndcapMinus_BXm1Empty->Fill(atan2(py_PhotonsEndcapMinus,px_PhotonsEndcapMinus));
2316  }
2317  if(pt_sum_HFH_plus){
2318  meMETPhiHFHadronsPlus_BXm1Empty = map_of_MEs[DirName+"/"+"METPhiHFHadronsPlus_BXm1Empty"];if(meMETPhiHFHadronsPlus_BXm1Empty && meMETPhiHFHadronsPlus_BXm1Empty ->getRootObject())meMETPhiHFHadronsPlus_BXm1Empty->Fill(atan2(py_HFHadronsPlus,px_HFHadronsPlus));
2319  }
2320  if(pt_sum_HFH_minus){
2321  meMETPhiHFHadronsMinus_BXm1Empty = map_of_MEs[DirName+"/"+"METPhiHFHadronsMinus_BXm1Empty"];if(meMETPhiHFHadronsMinus_BXm1Empty && meMETPhiHFHadronsMinus_BXm1Empty ->getRootObject())meMETPhiHFHadronsMinus_BXm1Empty->Fill(atan2(py_HFHadronsMinus,px_HFHadronsMinus));
2322  }
2323  if(pt_sum_HFE_plus){
2324  meMETPhiHFEGammasPlus_BXm1Empty = map_of_MEs[DirName+"/"+"METPhiHFEGammasPlus_BXm1Empty"];if(meMETPhiHFEGammasPlus_BXm1Empty && meMETPhiHFEGammasPlus_BXm1Empty ->getRootObject())meMETPhiHFEGammasPlus_BXm1Empty->Fill(atan2(py_HFEGammasPlus,px_HFEGammasPlus)); \
2325  }
2326  if(pt_sum_HFE_minus){
2327  meMETPhiHFEGammasMinus_BXm1Empty = map_of_MEs[DirName+"/"+"METPhiHFEGammasMinus_BXm1Empty"];if(meMETPhiHFEGammasMinus_BXm1Empty && meMETPhiHFEGammasMinus_BXm1Empty ->getRootObject())meMETPhiHFEGammasMinus_BXm1Empty->Fill(atan2(py_HFEGammasMinus,px_HFEGammasMinus));
2328  }
2329  }
2330 
2331  }//fill candidate plots only then
2332 
2333  // PFMET getters
2334  //----------------------------------------------------------------------------
2335  double pfPhotonEtFraction = pfmet.photonEtFraction();
2336  double pfPhotonEt = pfmet.photonEt();
2337  double pfNeutralHadronEtFraction = pfmet.neutralHadronEtFraction();
2338  double pfNeutralHadronEt = pfmet.neutralHadronEt();
2339  double pfElectronEt = pfmet.electronEt();
2340  double pfChargedHadronEtFraction = pfmet.chargedHadronEtFraction();
2341  double pfChargedHadronEt = pfmet.chargedHadronEt();
2342  double pfMuonEt = pfmet.muonEt();
2343  double pfHFHadronEtFraction = pfmet.HFHadronEtFraction();
2344  double pfHFHadronEt = pfmet.HFHadronEt();
2345  double pfHFEMEtFraction = pfmet.HFEMEtFraction();
2346  double pfHFEMEt = pfmet.HFEMEt();
2347  mePhotonEtFraction = map_of_MEs[DirName + "/PfPhotonEtFraction"];
2348  mePhotonEt = map_of_MEs[DirName + "/PfPhotonEt"];
2349  meNeutralHadronEtFraction = map_of_MEs[DirName + "/PfNeutralHadronEtFraction"];
2350  meNeutralHadronEt = map_of_MEs[DirName + "/PfNeutralHadronEt"];
2351  meElectronEt = map_of_MEs[DirName + "/PfElectronEt"];
2352  meChargedHadronEtFraction = map_of_MEs[DirName + "/PfChargedHadronEtFraction"];
2353  meChargedHadronEt = map_of_MEs[DirName + "/PfChargedHadronEt"];
2354  meMuonEt = map_of_MEs[DirName + "/PfMuonEt"];
2355  meHFHadronEtFraction = map_of_MEs[DirName + "/PfHFHadronEtFraction"];
2356  meHFHadronEt = map_of_MEs[DirName + "/PfHFHadronEt"];
2357  meHFEMEtFraction = map_of_MEs[DirName + "/PfHFEMEtFraction"];
2358  meHFEMEt = map_of_MEs[DirName + "/PfHFEMEt"];
2359 
2360  if (mePhotonEtFraction && mePhotonEtFraction ->getRootObject()) mePhotonEtFraction ->Fill(pfPhotonEtFraction);
2361  if (mePhotonEt && mePhotonEt ->getRootObject()) mePhotonEt ->Fill(pfPhotonEt);
2362  if (meNeutralHadronEtFraction && meNeutralHadronEtFraction->getRootObject()) meNeutralHadronEtFraction->Fill(pfNeutralHadronEtFraction);
2363  if (meNeutralHadronEt && meNeutralHadronEt ->getRootObject()) meNeutralHadronEt ->Fill(pfNeutralHadronEt);
2364  if (meElectronEt && meElectronEt ->getRootObject()) meElectronEt ->Fill(pfElectronEt);
2365  if (meChargedHadronEtFraction && meChargedHadronEtFraction->getRootObject()) meChargedHadronEtFraction->Fill(pfChargedHadronEtFraction);
2366  if (meChargedHadronEt && meChargedHadronEt ->getRootObject()) meChargedHadronEt ->Fill(pfChargedHadronEt);
2367  if (meMuonEt && meMuonEt ->getRootObject()) meMuonEt ->Fill(pfMuonEt);
2368  if (meHFHadronEtFraction && meHFHadronEtFraction ->getRootObject()) meHFHadronEtFraction ->Fill(pfHFHadronEtFraction);
2369  if (meHFHadronEt && meHFHadronEt ->getRootObject()) meHFHadronEt ->Fill(pfHFHadronEt);
2370  if (meHFEMEtFraction && meHFEMEtFraction ->getRootObject()) meHFEMEtFraction ->Fill(pfHFEMEtFraction);
2371  if (meHFEMEt && meHFEMEt ->getRootObject()) meHFEMEt ->Fill(pfHFEMEt);
2372 
2373  //NPV profiles
2374 
2375  mePhotonEtFraction_profile = map_of_MEs[DirName + "/PfPhotonEtFraction_profile"];
2376  mePhotonEt_profile = map_of_MEs[DirName + "/PfPhotonEt_profile"];
2377  meNeutralHadronEtFraction_profile = map_of_MEs[DirName + "/PfNeutralHadronEtFraction_profile"];
2378  meNeutralHadronEt_profile = map_of_MEs[DirName + "/PfNeutralHadronEt_profile"];
2379  meChargedHadronEtFraction_profile = map_of_MEs[DirName + "/PfChargedHadronEtFraction_profile"];
2380  meChargedHadronEt_profile = map_of_MEs[DirName + "/PfChargedHadronEt_profile"];
2381  meHFHadronEtFraction_profile = map_of_MEs[DirName + "/PfHFHadronEtFraction_profile"];
2382  meHFHadronEt_profile = map_of_MEs[DirName + "/PfHFHadronEt_profile"];
2383  meHFEMEtFraction_profile = map_of_MEs[DirName + "/PfHFEMEtFraction_profile"];
2384  meHFEMEt_profile = map_of_MEs[DirName + "/PfHFEMEt_profile"];
2385 
2386  if (mePhotonEtFraction_profile && mePhotonEtFraction_profile ->getRootObject()) mePhotonEtFraction_profile ->Fill(numPV_, pfPhotonEtFraction);
2387  if (mePhotonEt_profile && mePhotonEt_profile ->getRootObject()) mePhotonEt_profile ->Fill(numPV_, pfPhotonEt);
2388  if (meNeutralHadronEtFraction_profile && meNeutralHadronEtFraction_profile->getRootObject()) meNeutralHadronEtFraction_profile->Fill(numPV_, pfNeutralHadronEtFraction);
2389  if (meNeutralHadronEt_profile && meNeutralHadronEt_profile ->getRootObject()) meNeutralHadronEt_profile ->Fill(numPV_, pfNeutralHadronEt);
2390  if (meChargedHadronEtFraction_profile && meChargedHadronEtFraction_profile->getRootObject()) meChargedHadronEtFraction_profile->Fill(numPV_, pfChargedHadronEtFraction);
2391  if (meChargedHadronEt_profile && meChargedHadronEt_profile ->getRootObject()) meChargedHadronEt_profile ->Fill(numPV_, pfChargedHadronEt);
2392  if (meHFHadronEtFraction_profile && meHFHadronEtFraction_profile ->getRootObject()) meHFHadronEtFraction_profile ->Fill(numPV_, pfHFHadronEtFraction);
2393  if (meHFHadronEt_profile && meHFHadronEt_profile ->getRootObject()) meHFHadronEt_profile ->Fill(numPV_, pfHFHadronEt);
2394  if (meHFEMEtFraction_profile && meHFEMEtFraction_profile ->getRootObject()) meHFEMEtFraction_profile ->Fill(numPV_, pfHFEMEtFraction);
2395  if (meHFEMEt_profile && meHFEMEt_profile ->getRootObject()) meHFEMEt_profile ->Fill(numPV_, pfHFEMEt);
2396  }
2397 
2398  if(isMiniAODMet_){
2399  mePhotonEtFraction = map_of_MEs[DirName + "/PfPhotonEtFraction"];
2400  meNeutralHadronEtFraction = map_of_MEs[DirName + "/PfNeutralHadronEtFraction"];
2401  meChargedHadronEtFraction = map_of_MEs[DirName + "/PfChargedHadronEtFraction"];
2402  meHFHadronEtFraction = map_of_MEs[DirName + "/PfHFHadronEtFraction"];
2403  meHFEMEtFraction = map_of_MEs[DirName + "/PfHFEMEtFraction"];
2404 
2405  if (mePhotonEtFraction && mePhotonEtFraction ->getRootObject()) mePhotonEtFraction ->Fill(patmet.NeutralEMFraction());
2406  if (meNeutralHadronEtFraction && meNeutralHadronEtFraction->getRootObject()) meNeutralHadronEtFraction->Fill(patmet.NeutralHadEtFraction());
2407  if (meChargedHadronEtFraction && meChargedHadronEtFraction->getRootObject()) meChargedHadronEtFraction->Fill(patmet.ChargedHadEtFraction());
2408  if (meHFHadronEtFraction && meHFHadronEtFraction ->getRootObject()) meHFHadronEtFraction ->Fill(patmet.Type6EtFraction());//HFHadrons
2409  if (meHFEMEtFraction && meHFEMEtFraction ->getRootObject()) meHFEMEtFraction ->Fill(patmet.Type7EtFraction());
2410 
2411  //NPV profiles
2412  mePhotonEtFraction_profile = map_of_MEs[DirName + "/PfPhotonEtFraction_profile"];
2413  meNeutralHadronEtFraction_profile = map_of_MEs[DirName + "/PfNeutralHadronEtFraction_profile"];
2414  meChargedHadronEtFraction_profile = map_of_MEs[DirName + "/PfChargedHadronEtFraction_profile"];
2415  meHFHadronEtFraction_profile = map_of_MEs[DirName + "/PfHFHadronEtFraction_profile"];
2416  meHFEMEtFraction_profile = map_of_MEs[DirName + "/PfHFEMEtFraction_profile"];
2417 
2418  if (mePhotonEtFraction_profile && mePhotonEtFraction_profile ->getRootObject()) mePhotonEtFraction_profile ->Fill(numPV_, patmet.NeutralEMFraction());
2419  if (meNeutralHadronEtFraction_profile && meNeutralHadronEtFraction_profile->getRootObject()) meNeutralHadronEtFraction_profile->Fill(numPV_, patmet.NeutralHadEtFraction());
2420  if (meChargedHadronEtFraction_profile && meChargedHadronEtFraction_profile->getRootObject()) meChargedHadronEtFraction_profile->Fill(numPV_, patmet.ChargedHadEtFraction());
2421  if (meHFHadronEtFraction_profile && meHFHadronEtFraction_profile ->getRootObject()) meHFHadronEtFraction_profile ->Fill(numPV_, patmet.Type6EtFraction());
2422  if (meHFEMEtFraction_profile && meHFEMEtFraction_profile ->getRootObject()) meHFEMEtFraction_profile ->Fill(numPV_, patmet.Type7EtFraction());
2423 
2424  mePhotonEt = map_of_MEs[DirName + "/PfPhotonEt"];
2425  meNeutralHadronEt = map_of_MEs[DirName + "/PfNeutralHadronEt"];
2426  meChargedHadronEt = map_of_MEs[DirName + "/PfChargedHadronEt"];
2427  meHFHadronEt = map_of_MEs[DirName + "/PfHFHadronEt"];
2428  meHFEMEt = map_of_MEs[DirName + "/PfHFEMEt"];
2429  meMuonEt = map_of_MEs[DirName + "/PfMuonEt"];
2430  meElectronEt = map_of_MEs[DirName + "/PfElectronEt"];
2431 
2432  if (mePhotonEt && mePhotonEt ->getRootObject()) mePhotonEt ->Fill(patmet.NeutralEMFraction()*patmet.sumEt());
2433  if (meNeutralHadronEt && meNeutralHadronEt->getRootObject()) meNeutralHadronEt->Fill(patmet.NeutralHadEtFraction()*patmet.sumEt());
2434  if (meChargedHadronEt && meChargedHadronEt->getRootObject()) meChargedHadronEt->Fill(patmet.ChargedHadEtFraction()*patmet.sumEt());
2435  if (meHFHadronEt && meHFHadronEt ->getRootObject()) meHFHadronEt ->Fill(patmet.Type6EtFraction()*patmet.sumEt());//HFHadrons
2436  if (meHFEMEt && meHFEMEt ->getRootObject()) meHFEMEt ->Fill(patmet.Type7EtFraction()*patmet.sumEt());
2437  if (meMuonEt && meMuonEt ->getRootObject()) meMuonEt ->Fill(patmet.MuonEtFraction()*patmet.sumEt());
2438  if (meElectronEt && meElectronEt ->getRootObject()) meElectronEt ->Fill(patmet.ChargedEMEtFraction()*patmet.sumEt());
2439 
2440  //NPV profiles
2441  mePhotonEt_profile = map_of_MEs[DirName + "/PfPhotonEt_profile"];
2442  meNeutralHadronEt_profile = map_of_MEs[DirName + "/PfNeutralHadronEt_profile"];
2443  meChargedHadronEt_profile = map_of_MEs[DirName + "/PfChargedHadronEt_profile"];
2444  meHFHadronEt_profile = map_of_MEs[DirName + "/PfHFHadronEt_profile"];
2445  meHFEMEt_profile = map_of_MEs[DirName + "/PfHFEMEt_profile"];
2446 
2447  if (mePhotonEt_profile && mePhotonEt_profile ->getRootObject()) mePhotonEt_profile ->Fill(numPV_, patmet.NeutralEMFraction()*patmet.sumEt());
2448  if (meNeutralHadronEt_profile && meNeutralHadronEt_profile->getRootObject()) meNeutralHadronEt_profile->Fill(numPV_, patmet.NeutralHadEtFraction()*patmet.sumEt());
2449  if (meChargedHadronEt_profile && meChargedHadronEt_profile->getRootObject()) meChargedHadronEt_profile->Fill(numPV_, patmet.ChargedHadEtFraction()*patmet.sumEt());
2450  if (meHFHadronEt_profile && meHFHadronEt_profile ->getRootObject()) meHFHadronEt_profile ->Fill(numPV_, patmet.Type6EtFraction()*patmet.sumEt());
2451  if (meHFEMEt_profile && meHFEMEt_profile ->getRootObject()) meHFEMEt_profile ->Fill(numPV_, patmet.Type7EtFraction()*patmet.sumEt());
2452  }
2453 
2454  if (isCaloMet_){
2455  //if (bLumiSecPlot){//get from config level
2456  if (fill_met_high_level_histo){
2457  hMExLS = map_of_MEs[DirName+"/"+"MExLS"]; if (hMExLS && hMExLS->getRootObject()) hMExLS->Fill(MEx,myLuminosityBlock);
2458  hMEyLS = map_of_MEs[DirName+"/"+"MEyLS"]; if (hMEyLS && hMEyLS->getRootObject()) hMEyLS->Fill(MEy,myLuminosityBlock);
2459  }
2460  }
2461  }//check if we only wanna do Z plots
2462 }
#define LogDebug(id)
Analysis-level MET class.
Definition: MET.h:40
T getParameter(std::string const &) const
double hadEtInHE() const
Definition: CaloMET.h:51
void setBinContent(int binx, double content)
set content of bin (1-D)
double eta() const final
momentum pseudorapidity
double HFEMEtFraction() const
Definition: PFMET.h:47
double hadEtInHF() const
Definition: CaloMET.h:53
const TechnicalTriggerWord & technicalTriggerWord(int bxInEventValue) const
double ChargedHadEtFraction() const
Definition: MET.h:140
double MuonEtFraction() const
Definition: MET.h:141
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
TH1F * getTH1F() const
TObject * getRootObject() const
std::vector< T >::const_iterator search(const cond::Time_t &val, const std::vector< T > &container)
Definition: IOVProxy.cc:314
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
double neutralHadronEtFraction() const
Definition: PFMET.h:32
double px() const final
x coordinate of momentum vector
bool accept() const
Has at least one path accepted the event?
double muonEt() const
Definition: PFMET.h:42
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
double pt() const final
transverse momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
double NeutralEMFraction() const
Definition: MET.h:137
double correction(const LorentzVector &fJet) const
get correction using Jet information only
Definition: JetCorrector.h:49
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
double ChargedEMEtFraction() const
Definition: MET.h:139
double Type6EtFraction() const
Definition: MET.h:142
double Type7EtFraction() const
Definition: MET.h:143
Jet ID object.
Definition: JetID.h:16
double NeutralHadEtFraction() const
Definition: MET.h:138
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
void makeRatePlot(std::string, double)
double mEtSig() const
Definition: MET.h:58
double HFHadronEtFraction() const
Definition: PFMET.h:44
int iEvent
Definition: GenABIO.cc:224
double sumEt() const
Definition: MET.h:56
void setLumiFlag()
this ME is meant to be stored for each luminosity section
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
void analyze(const edm::Event &, const edm::EventSetup &) override
Get the analysis.
double HFHadronEt() const
Definition: PFMET.h:45
double et() const final
transverse energy
void bookMESet(std::string, DQMStore::IBooker &, std::map< std::string, MonitorElement * > &)
Definition: METAnalyzer.cc:222
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: MET.h:42
T sqrt(T t)
Definition: SSEVec.h:18
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 photonEtFraction() const
Definition: PFMET.h:29
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
double emEtInEB() const
Definition: CaloMET.h:55
bool isValid() const
Definition: HandleBase.h:74
#define LogTrace(id)
double HFEMEt() const
Definition: PFMET.h:48
PF Jet selector for pat::Jets.
Definition: Error.h:16
double hadEtInHO() const
Definition: CaloMET.h:49
#define M_PI
double electronEt() const
Definition: PFMET.h:36
Jet selector for pat::Jets and for CaloJets.
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Initialize run-based parameters.
Definition: METAnalyzer.cc:882
double etFractionHadronic() const
Definition: CaloMET.h:42
T const * product() const
Definition: Handle.h:74
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
double photonEt() const
Definition: PFMET.h:30
met
===> hadronic RAZOR
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 >)
static std::string const triggerResults("TriggerResults")
void endRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
Finish up a run.
double py() const final
y coordinate of momentum vector
METAnalyzer(const edm::ParameterSet &)
Constructor.
Definition: METAnalyzer.cc:42
double emEtInEE() const
Definition: CaloMET.h:57
void bookMonitorElement(std::string, DQMStore::IBooker &, std::map< std::string, MonitorElement * > &, bool, bool, bool)
Definition: METAnalyzer.cc:248
double chargedHadronEtFraction() const
Definition: PFMET.h:38
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
fixed size matrix
HLT enums.
static int position[264][3]
Definition: ReadPGInfo.cc:509
T get() const
Definition: EventSetup.h:71
pfIsolationR04
Definition: muons_cfi.py:31
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Inizialize parameters for histo binning.
Definition: METAnalyzer.cc:193
~METAnalyzer() override
Destructor.
Definition: METAnalyzer.cc:185
double emEtInHF() const
Definition: CaloMET.h:59
double neutralHadronEt() const
Definition: PFMET.h:33
const AlgorithmMap & gtTechnicalTriggerMap() const
get / set the technical trigger map
virtual ParticleType particleId() const
Definition: PFCandidate.h:374
double phi() const final
momentum azimuthal angle
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
T const * product() const
Definition: ESHandle.h:86
double hadEtInHB() const
Definition: CaloMET.h:47
double emEtFraction() const
Definition: CaloMET.h:45
double chargedHadronEt() const
Definition: PFMET.h:39
Definition: Run.h:45
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:39