CMS 3D CMS Logo

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