CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TcMETAnalyzer.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author A.Apresyan - Caltech
5  */
6 
10 
12 
14 
19 
21 
22 #include <string>
23 using namespace edm;
24 using namespace reco;
25 using namespace math;
26 
27 // ***********************************************************
29 
30  parameters = pSet;
31 
32 }
33 
34 // ***********************************************************
36 
38 
39  evtCounter = 0;
40  metname = "tcMETAnalyzer";
41 
42  // trigger information
43  HLTPathsJetMBByName_ = parameters.getParameter<std::vector<std::string > >("HLTPathsJetMB");
44 
45  _hlt_HighPtJet = parameters.getParameter<std::string>("HLT_HighPtJet");
46  _hlt_LowPtJet = parameters.getParameter<std::string>("HLT_LowPtJet");
47  _hlt_HighMET = parameters.getParameter<std::string>("HLT_HighMET");
48  // _hlt_LowMET = parameters.getParameter<std::string>("HLT_LowMET");
49  _hlt_Ele = parameters.getParameter<std::string>("HLT_Ele");
50  _hlt_Muon = parameters.getParameter<std::string>("HLT_Muon");
51 
52  // TcMET information
53  theTcMETCollectionLabel = parameters.getParameter<edm::InputTag>("TcMETCollectionLabel");
54  _source = parameters.getParameter<std::string>("Source");
55 
56  // Other data collections
57  HcalNoiseRBXCollectionTag = parameters.getParameter<edm::InputTag>("HcalNoiseRBXCollection");
58  theJetCollectionLabel = parameters.getParameter<edm::InputTag>("JetCollectionLabel");
59  HBHENoiseFilterResultTag = parameters.getParameter<edm::InputTag>("HBHENoiseFilterResultLabel");
60 
61  // misc
62  _verbose = parameters.getParameter<int>("verbose");
63  _etThreshold = parameters.getParameter<double>("etThreshold"); // MET threshold
64  _allhist = parameters.getParameter<bool>("allHist"); // Full set of monitoring histograms
65  _allSelection= parameters.getParameter<bool>("allSelection"); // Plot with all sets of event selection
66 
67  _highPtTcJetThreshold = parameters.getParameter<double>("HighPtTcJetThreshold"); // High Pt Jet threshold
68  _lowPtTcJetThreshold = parameters.getParameter<double>("LowPtTcJetThreshold"); // Low Pt Jet threshold
69  _highTcMETThreshold = parameters.getParameter<double>("HighTcMETThreshold"); // High MET threshold
70  _lowTcMETThreshold = parameters.getParameter<double>("LowTcMETThreshold"); // Low MET threshold
71 
72  //
73  jetID = new reco::helper::JetIDHelper(parameters.getParameter<ParameterSet>("JetIDParams"));
74 
75  // DQStore stuff
76  LogTrace(metname)<<"[TcMETAnalyzer] Parameters initialization";
77  std::string DirName = "JetMET/MET/"+_source;
78  dbe->setCurrentFolder(DirName);
79 
80  metME = dbe->book1D("metReco", "metReco", 4, 1, 5);
81  metME->setBinLabel(2,"TcMET",1);
82 
83  _dbe = dbe;
84 
85  _FolderNames.push_back("All");
86  _FolderNames.push_back("Cleanup");
87  _FolderNames.push_back("HcalNoiseFilter");
88  _FolderNames.push_back("JetID");
89  _FolderNames.push_back("JetIDTight");
90 
91  for (std::vector<std::string>::const_iterator ic = _FolderNames.begin();
92  ic != _FolderNames.end(); ic++){
93  if (*ic=="All") bookMESet(DirName+"/"+*ic);
94  if (*ic=="Cleanup") bookMESet(DirName+"/"+*ic);
95  if (_allSelection){
96  if (*ic=="HcalNoiseFilter") bookMESet(DirName+"/"+*ic);
97  if (*ic=="JetID") bookMESet(DirName+"/"+*ic);
98  if (*ic=="JetIDTight") bookMESet(DirName+"/"+*ic);
99  }
100  }
101 }
102 
103 // ***********************************************************
105 
106  delete jetID;
107 
108 }
109 
110 // ***********************************************************
112 {
113 
114  bool bLumiSecPlot=false;
115  if (DirName.find("All")!=std::string::npos) bLumiSecPlot=true;
116 
117  bookMonitorElement(DirName,bLumiSecPlot);
118 
119  if (_hlt_HighPtJet.size()){
120  bookMonitorElement(DirName+"/"+"HighPtJet",false);
121  meTriggerName_HighPtJet = _dbe->bookString("triggerName_HighPtJet", _hlt_HighPtJet);
122  }
123 
124  if (_hlt_LowPtJet.size()){
125  bookMonitorElement(DirName+"/"+"LowPtJet",false);
126  meTriggerName_LowPtJet = _dbe->bookString("triggerName_LowPtJet", _hlt_LowPtJet);
127  }
128 
129  if (_hlt_HighMET.size()){
130  bookMonitorElement(DirName+"/"+"HighMET",false);
131  meTriggerName_HighMET = _dbe->bookString("triggerName_HighMET", _hlt_HighMET);
132  }
133 
134  // if (_hlt_LowMET.size()){
135  // bookMonitorElement(DirName+"/"+"LowMET",false);
136  // meTriggerName_LowMET = _dbe->bookString("triggerName_LowMET", _hlt_LowMET);
137  // }
138 
139  if (_hlt_Ele.size()){
140  bookMonitorElement(DirName+"/"+"Ele",false);
141  meTriggerName_Ele = _dbe->bookString("triggerName_Ele", _hlt_Ele);
142  }
143 
144  if (_hlt_Muon.size()){
145  bookMonitorElement(DirName+"/"+"Muon",false);
146  meTriggerName_Muon = _dbe->bookString("triggerName_Muon", _hlt_Muon);
147  }
148 
149 }
150 
151 // ***********************************************************
153 {
154 
155  if (_verbose) std::cout << "booMonitorElement " << DirName << std::endl;
156  _dbe->setCurrentFolder(DirName);
157 
158  meTcMEx = _dbe->book1D("METTask_TcMEx", "METTask_TcMEx", 200, -500, 500);
159  meTcMEy = _dbe->book1D("METTask_TcMEy", "METTask_TcMEy", 200, -500, 500);
160  meTcEz = _dbe->book1D("METTask_TcEz", "METTask_TcEz", 200, -500, 500);
161  meTcMETSig = _dbe->book1D("METTask_TcMETSig", "METTask_TcMETSig", 51, 0, 51);
162  meTcMET = _dbe->book1D("METTask_TcMET", "METTask_TcMET", 200, 0, 1000);
163  meTcMETPhi = _dbe->book1D("METTask_TcMETPhi", "METTask_TcMETPhi", 60, -3.2, 3.2);
164  meTcSumET = _dbe->book1D("METTask_TcSumET", "METTask_TcSumET", 400, 0, 4000);
165 
166  meTcNeutralEMFraction = _dbe->book1D("METTask_TcNeutralEMFraction", "METTask_TcNeutralEMFraction" ,50,0.,1.);
167  meTcNeutralHadFraction = _dbe->book1D("METTask_TcNeutralHadFraction","METTask_TcNeutralHadFraction",50,0.,1.);
168  meTcChargedEMFraction = _dbe->book1D("METTask_TcChargedEMFraction", "METTask_TcChargedEMFraction" ,50,0.,1.);
169  meTcChargedHadFraction = _dbe->book1D("METTask_TcChargedHadFraction","METTask_TcChargedHadFraction",50,0.,1.);
170  meTcMuonFraction = _dbe->book1D("METTask_TcMuonFraction", "METTask_TcMuonFraction" ,50,0.,1.);
171 
172  meTcMETIonFeedbck = _dbe->book1D("METTask_TcMETIonFeedbck", "METTask_TcMETIonFeedbck" ,500,0,1000);
173  meTcMETHPDNoise = _dbe->book1D("METTask_TcMETHPDNoise", "METTask_TcMETHPDNoise" ,500,0,1000);
174  meTcMETRBXNoise = _dbe->book1D("METTask_TcMETRBXNoise", "METTask_TcMETRBXNoise" ,500,0,1000);
175 
176  if (_allhist){
177  if (bLumiSecPlot){
178  meTcMExLS = _dbe->book2D("METTask_TcMEx_LS","METTask_TcMEx_LS",200,-200,200,50,0.,500.);
179  meTcMEyLS = _dbe->book2D("METTask_TcMEy_LS","METTask_TcMEy_LS",200,-200,200,50,0.,500.);
180  }
181  }
182 }
183 
184 // ***********************************************************
185 void TcMETAnalyzer::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup)
186 {
187 
188 }
189 
190 // ***********************************************************
191 void TcMETAnalyzer::endRun(const edm::Run& iRun, const edm::EventSetup& iSetup, DQMStore * dbe)
192 {
193 
194  //
195  //--- Check the time length of the Run from the lumi section plots
196 
197  std::string dirName = "JetMET/MET/"+_source+"/";
198  _dbe->setCurrentFolder(dirName);
199 
200  TH1F* tlumisec;
201 
202  MonitorElement *meLumiSec = _dbe->get("aaa");
203  meLumiSec = _dbe->get("JetMET/lumisec");
204 
205  int totlsec=0;
206  double totltime=0.;
207  if ( meLumiSec->getRootObject() ) {
208  tlumisec = meLumiSec->getTH1F();
209  for (int i=0; i<500; i++){
210  if (tlumisec->GetBinContent(i+1)) totlsec++;
211  }
212  totltime = double(totlsec*90); // one lumi sec ~ 90 (sec)
213  }
214 
215  if (totltime==0.) totltime=1.;
216 
217  //
218  //--- Make the integrated plots with rate (Hz)
219 
220  for (std::vector<std::string>::const_iterator ic = _FolderNames.begin(); ic != _FolderNames.end(); ic++)
221  {
222 
224  DirName = dirName+*ic;
225 
226  makeRatePlot(DirName,totltime);
227  if (_hlt_HighPtJet.size()) makeRatePlot(DirName+"/"+_hlt_HighPtJet,totltime);
228  if (_hlt_LowPtJet.size()) makeRatePlot(DirName+"/"+_hlt_LowPtJet,totltime);
229  if (_hlt_HighMET.size()) makeRatePlot(DirName+"/"+_hlt_HighMET,totltime);
230  // if (_hlt_LowMET.size()) makeRatePlot(DirName+"/"+_hlt_LowMET,totltime);
231  if (_hlt_Ele.size()) makeRatePlot(DirName+"/"+_hlt_Ele,totltime);
232  if (_hlt_Muon.size()) makeRatePlot(DirName+"/"+_hlt_Muon,totltime);
233 
234  }
235 }
236 
237 
238 // ***********************************************************
240 {
241 
242  _dbe->setCurrentFolder(DirName);
243  MonitorElement *meTcMET = _dbe->get(DirName+"/"+"METTask_TcMET");
244 
245  TH1F* tTcMET;
246  TH1F* tTcMETRate;
247 
248  if ( meTcMET )
249  if ( meTcMET->getRootObject() ) {
250  tTcMET = meTcMET->getTH1F();
251 
252  // Integral plot & convert number of events to rate (hz)
253  tTcMETRate = (TH1F*) tTcMET->Clone("METTask_TcMETRate");
254  for (int i = tTcMETRate->GetNbinsX()-1; i>=0; i--){
255  tTcMETRate->SetBinContent(i+1,tTcMETRate->GetBinContent(i+2)+tTcMET->GetBinContent(i+1));
256  }
257  for (int i = 0; i<tTcMETRate->GetNbinsX(); i++){
258  tTcMETRate->SetBinContent(i+1,tTcMETRate->GetBinContent(i+1)/double(totltime));
259  }
260 
261  meTcMETRate = _dbe->book1D("METTask_TcMETRate",tTcMETRate);
262 
263  }
264 
265 }
266 
267 // ***********************************************************
270 
271  if (_verbose) std::cout << "TcMETAnalyzer analyze" << std::endl;
272 
273  LogTrace(metname)<<"[TcMETAnalyzer] Analyze TcMET";
274 
275  metME->Fill(2);
276 
277  // ==========================================================
278  // Trigger information
279  //
280  _trig_JetMB=0;
281  _trig_HighPtJet=0;
282  _trig_LowPtJet=0;
283  _trig_HighMET=0;
284  // _trig_LowMET=0;
285 
286  if (&triggerResults) {
287 
289 
290  //
291  //
292  // Check how many HLT triggers are in triggerResults
293  int ntrigs = triggerResults.size();
294  if (_verbose) std::cout << "ntrigs=" << ntrigs << std::endl;
295 
296  //
297  //
298  // If index=ntrigs, this HLT trigger doesn't exist in the HLT table for this data.
299  const edm::TriggerNames & triggerNames = iEvent.triggerNames(triggerResults);
300 
301  //
302  //
303  // count number of requested Jet or MB HLT paths which have fired
304  for (unsigned int i=0; i!=HLTPathsJetMBByName_.size(); i++) {
305  unsigned int triggerIndex = triggerNames.triggerIndex(HLTPathsJetMBByName_[i]);
306  if (triggerIndex<triggerResults.size()) {
307  if (triggerResults.accept(triggerIndex)) {
308  _trig_JetMB++;
309  }
310  }
311  }
312  // for empty input vectors (n==0), take all HLT triggers!
313  if (HLTPathsJetMBByName_.size()==0) _trig_JetMB=triggerResults.size()-1;
314 
315  //
316  if (_verbose) std::cout << "triggerNames size" << " " << triggerNames.size() << std::endl;
317  if (_verbose) std::cout << _hlt_HighPtJet << " " << triggerNames.triggerIndex(_hlt_HighPtJet) << std::endl;
318  if (_verbose) std::cout << _hlt_LowPtJet << " " << triggerNames.triggerIndex(_hlt_LowPtJet) << std::endl;
319  if (_verbose) std::cout << _hlt_HighMET << " " << triggerNames.triggerIndex(_hlt_HighMET) << std::endl;
320  // if (_verbose) std::cout << _hlt_LowMET << " " << triggerNames.triggerIndex(_hlt_LowMET) << std::endl;
321  if (_verbose) std::cout << _hlt_Ele << " " << triggerNames.triggerIndex(_hlt_Ele) << std::endl;
322  if (_verbose) std::cout << _hlt_Muon << " " << triggerNames.triggerIndex(_hlt_Muon) << std::endl;
323 
324  if (triggerNames.triggerIndex(_hlt_HighPtJet) != triggerNames.size() &&
325  triggerResults.accept(triggerNames.triggerIndex(_hlt_HighPtJet))) _trig_HighPtJet=1;
326 
327  if (triggerNames.triggerIndex(_hlt_LowPtJet) != triggerNames.size() &&
328  triggerResults.accept(triggerNames.triggerIndex(_hlt_LowPtJet))) _trig_LowPtJet=1;
329 
330  if (triggerNames.triggerIndex(_hlt_HighMET) != triggerNames.size() &&
331  triggerResults.accept(triggerNames.triggerIndex(_hlt_HighMET))) _trig_HighMET=1;
332 
333  // if (triggerNames.triggerIndex(_hlt_LowMET) != triggerNames.size() &&
334  // triggerResults.accept(triggerNames.triggerIndex(_hlt_LowMET))) _trig_LowMET=1;
335 
336  if (triggerNames.triggerIndex(_hlt_Ele) != triggerNames.size() &&
337  triggerResults.accept(triggerNames.triggerIndex(_hlt_Ele))) _trig_Ele=1;
338 
339  if (triggerNames.triggerIndex(_hlt_Muon) != triggerNames.size() &&
340  triggerResults.accept(triggerNames.triggerIndex(_hlt_Muon))) _trig_Muon=1;
341 
342  } else {
343 
344  edm::LogInfo("TcMetAnalyzer") << "TriggerResults::HLT not found, "
345  "automatically select events";
346 
347  // TriggerResults object not found. Look at all events.
348  _trig_JetMB=1;
349  }
350 
351  // ==========================================================
352  // TcMET information
353 
354  // **** Get the MET container
356  iEvent.getByLabel(theTcMETCollectionLabel, tcmetcoll);
357 
358  if(!tcmetcoll.isValid()) return;
359 
360  const METCollection *tcmetcol = tcmetcoll.product();
361  const MET *tcmet;
362  tcmet = &(tcmetcol->front());
363 
364  LogTrace(metname)<<"[TcMETAnalyzer] Call to the TcMET analyzer";
365 
366  // ==========================================================
367  //
369  iEvent.getByLabel(HcalNoiseRBXCollectionTag,HRBXCollection);
370  if (!HRBXCollection.isValid()) {
371  LogDebug("") << "TcMETAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
372  if (_verbose) std::cout << "TcMETAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
373  }
374 
375 
376  edm::Handle<bool> HBHENoiseFilterResultHandle;
377  iEvent.getByLabel(HBHENoiseFilterResultTag, HBHENoiseFilterResultHandle);
378  bool HBHENoiseFilterResult = *HBHENoiseFilterResultHandle;
379  if (!HBHENoiseFilterResultHandle.isValid()) {
380  LogDebug("") << "TcMETAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
381  if (_verbose) std::cout << "TcMETAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
382  }
383 
384 
386  iEvent.getByLabel(theJetCollectionLabel, caloJets);
387  if (!caloJets.isValid()) {
388  LogDebug("") << "TcMETAnalyzer: Could not find jet product" << std::endl;
389  if (_verbose) std::cout << "TcMETAnalyzer: Could not find jet product" << std::endl;
390  }
391 
392  // ==========================================================
393  // TcMET sanity check
394 
395  // if (_source=="TcMET") validateMET(*tcmet, tcCandidates);
396 
397  // ==========================================================
398  // JetID
399 
400  if (_verbose) std::cout << "JetID starts" << std::endl;
401 
402  //
403  // --- Loose cuts, not Tc specific for now!
404  //
405  bool bJetID=true;
406  for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
407  cal!=caloJets->end(); ++cal){
408  jetID->calculate(iEvent, *cal);
409  if (_verbose) std::cout << jetID->n90Hits() << " "
410  << jetID->restrictedEMF() << " "
411  << cal->pt() << std::endl;
412  if (cal->pt()>10.){
413  //
414  // for all regions
415  if (jetID->n90Hits()<2) bJetID=false;
416  if (jetID->fHPD()>=0.98) bJetID=false;
417  //if (jetID->restrictedEMF()<0.01) bJetID=false;
418  //
419  // for non-forward
420  if (fabs(cal->eta())<2.55){
421  if (cal->emEnergyFraction()<=0.01) bJetID=false;
422  }
423  // for forward
424  else {
425  if (cal->emEnergyFraction()<=-0.9) bJetID=false;
426  if (cal->pt()>80.){
427  if (cal->emEnergyFraction()>= 1.0) bJetID=false;
428  }
429  } // forward vs non-forward
430  } // pt>10 GeV/c
431  } // calor-jets loop
432 
433  //
434  // --- Tight cuts
435  //
436  bool bJetIDTight=true;
437  bJetIDTight=bJetID;
438  for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
439  cal!=caloJets->end(); ++cal){
440  jetID->calculate(iEvent, *cal);
441  if (cal->pt()>25.){
442  //
443  // for all regions
444  if (jetID->fHPD()>=0.95) bJetIDTight=false;
445  //
446  // for 1.0<|eta|<1.75
447  if (fabs(cal->eta())>=1.00 && fabs(cal->eta())<1.75){
448  if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=false;
449  }
450  //
451  // for 1.75<|eta|<2.55
452  else if (fabs(cal->eta())>=1.75 && fabs(cal->eta())<2.55){
453  if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=false;
454  }
455  //
456  // for 2.55<|eta|<3.25
457  else if (fabs(cal->eta())>=2.55 && fabs(cal->eta())<3.25){
458  if (cal->pt()< 50. && cal->emEnergyFraction()<=-0.3) bJetIDTight=false;
459  if (cal->pt()>=50. && cal->pt()< 80. && cal->emEnergyFraction()<=-0.2) bJetIDTight=false;
460  if (cal->pt()>=80. && cal->pt()<340. && cal->emEnergyFraction()<=-0.1) bJetIDTight=false;
461  if (cal->pt()>=340. && cal->emEnergyFraction()<=-0.1
462  && cal->emEnergyFraction()>=0.95) bJetIDTight=false;
463  }
464  //
465  // for 3.25<|eta|
466  else if (fabs(cal->eta())>=3.25){
467  if (cal->pt()< 50. && cal->emEnergyFraction()<=-0.3
468  && cal->emEnergyFraction()>=0.90) bJetIDTight=false;
469  if (cal->pt()>=50. && cal->pt()<130. && cal->emEnergyFraction()<=-0.2
470  && cal->emEnergyFraction()>=0.80) bJetIDTight=false;
471  if (cal->pt()>=130. && cal->emEnergyFraction()<=-0.1
472  && cal->emEnergyFraction()>=0.70) bJetIDTight=false;
473  }
474  } // pt>10 GeV/c
475  } // calor-jets loop
476 
477  if (_verbose) std::cout << "JetID ends" << std::endl;
478 
479 
480  // ==========================================================
481  // HCAL Noise filter
482 
483  bool bHcalNoiseFilter = HBHENoiseFilterResult;
484 
485  // ==========================================================
486  // Reconstructed MET Information - fill MonitorElements
487 
488  std::string DirName = "JetMET/MET/"+_source;
489 
490  for (std::vector<std::string>::const_iterator ic = _FolderNames.begin();
491  ic != _FolderNames.end(); ic++){
492  if (*ic=="All") fillMESet(iEvent, DirName+"/"+*ic, *tcmet);
493  if (*ic=="Cleanup" && bHcalNoiseFilter && bJetID) fillMESet(iEvent, DirName+"/"+*ic, *tcmet);
494  if (_allSelection) {
495  if (*ic=="HcalNoiseFilter" && bHcalNoiseFilter ) fillMESet(iEvent, DirName+"/"+*ic, *tcmet);
496  if (*ic=="JetID" && bJetID) fillMESet(iEvent, DirName+"/"+*ic, *tcmet);
497  if (*ic=="JetIDTight" && bJetIDTight) fillMESet(iEvent, DirName+"/"+*ic, *tcmet);
498  }
499  }
500 }
501 
502 // ***********************************************************
504  const reco::MET& tcmet)
505 {
506 
507  _dbe->setCurrentFolder(DirName);
508 
509  bool bLumiSecPlot=false;
510  if (DirName.find("All")) bLumiSecPlot=true;
511 
512  if (_trig_JetMB) fillMonitorElement(iEvent,DirName,"",tcmet, bLumiSecPlot);
513  if (_hlt_HighPtJet.size() && _trig_HighPtJet) fillMonitorElement(iEvent,DirName,"HighPtJet",tcmet,false);
514  if (_hlt_LowPtJet.size() && _trig_LowPtJet) fillMonitorElement(iEvent,DirName,"LowPtJet",tcmet,false);
515  if (_hlt_HighMET.size() && _trig_HighMET) fillMonitorElement(iEvent,DirName,"HighMET",tcmet,false);
516  // if (_hlt_LowMET.size() && _trig_LowMET) fillMonitorElement(iEvent,DirName,"LowMET",tcmet,false);
517  if (_hlt_Ele.size() && _trig_Ele) fillMonitorElement(iEvent,DirName,"Ele",tcmet,false);
518  if (_hlt_Muon.size() && _trig_Muon) fillMonitorElement(iEvent,DirName,"Muon",tcmet,false);
519 }
520 
521 // ***********************************************************
523  std::string TriggerTypeName,
524  const reco::MET& tcmet, bool bLumiSecPlot)
525 {
526 
527  if (TriggerTypeName=="HighPtJet") {
528  if (!selectHighPtJetEvent(iEvent)) return;
529  }
530  else if (TriggerTypeName=="LowPtJet") {
531  if (!selectLowPtJetEvent(iEvent)) return;
532  }
533  else if (TriggerTypeName=="HighMET") {
534  if (tcmet.pt()<_highTcMETThreshold) return;
535  }
536  // else if (TriggerTypeName=="LowMET") {
537  // if (tcmet.pt()<_lowTcMETThreshold) return;
538  // }
539  else if (TriggerTypeName=="Ele") {
540  if (!selectWElectronEvent(iEvent)) return;
541  }
542  else if (TriggerTypeName=="Muon") {
543  if (!selectWMuonEvent(iEvent)) return;
544  }
545 
546 // Reconstructed MET Information
547  double tcSumET = tcmet.sumEt();
548  double tcMETSig = tcmet.mEtSig();
549  double tcEz = tcmet.e_longitudinal();
550  double tcMET = tcmet.pt();
551  double tcMEx = tcmet.px();
552  double tcMEy = tcmet.py();
553  double tcMETPhi = tcmet.phi();
554 
555  //
556  int myLuminosityBlock;
557  // myLuminosityBlock = (evtCounter++)/1000;
558  myLuminosityBlock = iEvent.luminosityBlock();
559  //
560 
561  if (TriggerTypeName!="") DirName = DirName +"/"+TriggerTypeName;
562 
563  if (_verbose) std::cout << "_etThreshold = " << _etThreshold << std::endl;
564  if (tcMET>_etThreshold){
565 
566  meTcMEx = _dbe->get(DirName+"/"+"METTask_TcMEx"); if (meTcMEx && meTcMEx->getRootObject()) meTcMEx->Fill(tcMEx);
567  meTcMEy = _dbe->get(DirName+"/"+"METTask_TcMEy"); if (meTcMEy && meTcMEy->getRootObject()) meTcMEy->Fill(tcMEy);
568  meTcMET = _dbe->get(DirName+"/"+"METTask_TcMET"); if (meTcMET && meTcMET->getRootObject()) meTcMET->Fill(tcMET);
569  meTcMETPhi = _dbe->get(DirName+"/"+"METTask_TcMETPhi"); if (meTcMETPhi && meTcMETPhi->getRootObject()) meTcMETPhi->Fill(tcMETPhi);
570  meTcSumET = _dbe->get(DirName+"/"+"METTask_TcSumET"); if (meTcSumET && meTcSumET->getRootObject()) meTcSumET->Fill(tcSumET);
571  meTcMETSig = _dbe->get(DirName+"/"+"METTask_TcMETSig"); if (meTcMETSig && meTcMETSig->getRootObject()) meTcMETSig->Fill(tcMETSig);
572  meTcEz = _dbe->get(DirName+"/"+"METTask_TcEz"); if (meTcEz && meTcEz->getRootObject()) meTcEz->Fill(tcEz);
573 
574  meTcMETIonFeedbck = _dbe->get(DirName+"/"+"METTask_TcMETIonFeedbck"); if (meTcMETIonFeedbck && meTcMETIonFeedbck->getRootObject()) meTcMETIonFeedbck->Fill(tcMET);
575  meTcMETHPDNoise = _dbe->get(DirName+"/"+"METTask_TcMETHPDNoise"); if (meTcMETHPDNoise && meTcMETHPDNoise->getRootObject()) meTcMETHPDNoise->Fill(tcMET);
576  meTcMETRBXNoise = _dbe->get(DirName+"/"+"METTask_TcMETRBXNoise"); if (meTcMETRBXNoise && meTcMETRBXNoise->getRootObject()) meTcMETRBXNoise->Fill(tcMET);
577 
578  if (_allhist){
579  if (bLumiSecPlot){
580  meTcMExLS = _dbe->get(DirName+"/"+"METTask_TcMExLS"); if (meTcMExLS && meTcMExLS->getRootObject()) meTcMExLS->Fill(tcMEx,myLuminosityBlock);
581  meTcMEyLS = _dbe->get(DirName+"/"+"METTask_TcMEyLS"); if (meTcMEyLS && meTcMEyLS->getRootObject()) meTcMEyLS->Fill(tcMEy,myLuminosityBlock);
582  }
583  } // _allhist
584  } // et threshold cut
585 }
586 
587 
588 // ***********************************************************
590 
591  bool return_value=false;
592 
594  iEvent.getByLabel(theJetCollectionLabel, caloJets);
595  if (!caloJets.isValid()) {
596  LogDebug("") << "TcMETAnalyzer: Could not find jet product" << std::endl;
597  if (_verbose) std::cout << "TcMETAnalyzer: Could not find jet product" << std::endl;
598  }
599 
600  for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
601  cal!=caloJets->end(); ++cal){
602  if (cal->pt()>_highPtTcJetThreshold){
603  return_value=true;
604  }
605  }
606 
607  return return_value;
608 }
609 
610 // // ***********************************************************
612 
613  bool return_value=false;
614 
616  iEvent.getByLabel(theJetCollectionLabel, caloJets);
617  if (!caloJets.isValid()) {
618  LogDebug("") << "TcMETAnalyzer: Could not find jet product" << std::endl;
619  if (_verbose) std::cout << "TcMETAnalyzer: Could not find jet product" << std::endl;
620  }
621 
622  for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
623  cal!=caloJets->end(); ++cal){
624  if (cal->pt()>_lowPtTcJetThreshold){
625  return_value=true;
626  }
627  }
628 
629  return return_value;
630 
631 }
632 
633 // ***********************************************************
635 
636  bool return_value=false;
637 
638  /*
639  W-electron event selection comes here
640  */
641 
642  return return_value;
643 
644 }
645 
646 // ***********************************************************
648 
649  bool return_value=false;
650 
651  /*
652  W-muon event selection comes here
653  */
654 
655  return return_value;
656 
657 }
#define LogDebug(id)
double e_longitudinal() const
Definition: MET.h:55
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:204
void beginJob(DQMStore *dbe)
Inizialize parameters for histo binning.
bool selectWElectronEvent(const edm::Event &)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
const std::string metname
bool accept() const
Has at least one path accepted the event?
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:59
Strings::size_type size() const
Definition: TriggerNames.cc:39
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
void bookMESet(std::string)
void bookMonitorElement(std::string, bool)
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
double mEtSig() const
Definition: MET.h:50
int iEvent
Definition: GenABIO.cc:243
double sumEt() const
Definition: MET.h:48
void fillMonitorElement(const edm::Event &, std::string, std::string, const reco::MET &, bool)
void analyze(const edm::Event &, const edm::EventSetup &, const edm::TriggerResults &)
Get the analysis.
void fillMESet(const edm::Event &, std::string, const reco::MET &)
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
void beginRun(const edm::Run &, const edm::EventSetup &)
Initialize run-based parameters.
Definition: MET.h:32
unsigned int size() const
Get number of paths stored.
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
Collection of MET.
bool isValid() const
Definition: HandleBase.h:76
bool selectLowPtJetEvent(const edm::Event &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
#define LogTrace(id)
virtual ~TcMETAnalyzer()
Destructor.
TObject * getRootObject(void) const
TcMETAnalyzer(const edm::ParameterSet &)
Constructor.
static std::string const triggerResults("TriggerResults")
TH1F * getTH1F(void) const
T const * product() const
Definition: Handle.h:81
bool selectHighPtJetEvent(const edm::Event &)
void endJob()
Finish up a job.
tuple cout
Definition: gather_cfg.py:121
bool selectWMuonEvent(const edm::Event &)
void makeRatePlot(std::string, double)
virtual float pt() const GCC11_FINAL
transverse momentum
void endRun(const edm::Run &iRun, const edm::EventSetup &iSetup, DQMStore *dbe)
Finish up a run.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
Definition: Run.h:41