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