CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FourVectorHLTriggerOffline.h
Go to the documentation of this file.
1 #ifndef FOURVECTORHLTRIGGEROFFLINE_H
2 #define FOURVECTORHLTRIGGEROFFLINE_H
3 // -*- C++ -*-
4 //
5 // Package: FourVectorHLTriggerOffline
6 // Class: FourVectorHLTriggerOffline
7 //
16 //
17 // Original Author: Jeffrey Berryhill
18 // Created: June 2008
19 // Rewritten by: Vladimir Rekovic
20 // Date: May 2009
21 // $Id: FourVectorHLTriggerOffline.h,v 1.33 2013/04/23 16:41:39 wmtan Exp $
22 //
23 //
24 
25 
26 // system include files
27 #include <memory>
28 #include <unistd.h>
29 
30 
31 // user include files
34 
40 
46 
47 // added VR
53 
55 
61 
84 
86 
87 
90 
91 
92 #include <iostream>
93 #include <fstream>
94 #include <vector>
95 
96 
97 typedef std::multimap<float,int> fimmap ;
98 typedef std::set<fimmap , std::less<fimmap> > mmset;
99 
101  public:
104 
105  void cleanDRMatchSet(mmset& tempSet);
106 
107  private:
108  virtual void beginJob() ;
109  virtual void analyze(const edm::Event&, const edm::EventSetup&);
110  virtual void endJob() ;
111 
112  // BeginRun
113  void beginRun(const edm::Run& run, const edm::EventSetup& c);
114 
115  // EndRun
116  void endRun(const edm::Run& run, const edm::EventSetup& c);
117 
118 
119  // ----------member data ---------------------------
120  int nev_;
122 
124 
125  bool plotAll_;
126  bool resetMe_;
128 
129  unsigned int nBins_;
130  double ptMin_ ;
131  double ptMax_ ;
132 
136  double muonEtaMax_;
137  double muonEtMin_;
138  double muonDRMatch_;
139  double tauEtaMax_;
140  double tauEtMin_;
141  double tauDRMatch_;
142  double jetEtaMax_;
143  double jetEtMin_;
144  double jetDRMatch_;
145  double bjetEtaMax_;
146  double bjetEtMin_;
147  double bjetDRMatch_;
149  double photonEtMin_;
151  double trackEtaMax_;
152  double trackEtMin_;
154  double metMin_;
155  double htMin_;
156  double sumEtMin_;
157 
158  std::vector<std::pair<std::string, std::string> > custompathnamepairs_;
159 
160 
168  // data across paths
170  // helper class to store the data path
171 
172  class PathInfo {
174  pathIndex_(-1), denomPathName_("unset"), pathName_("unset"), l1pathName_("unset"), filterName_("unset"), processName_("unset"), objectType_(-1)
175  {};
176  public:
177  void setHistos(
178  MonitorElement* const NMc,
179  MonitorElement* const mcEtMc,
180  MonitorElement* const mcEtavsmcPhiMc,
181  MonitorElement* const NOn,
182  MonitorElement* const onEtOn,
183  MonitorElement* const onEtavsonPhiOn,
184  MonitorElement* const NOff,
185  MonitorElement* const offEtOff,
186  MonitorElement* const offEtavsoffPhiOff,
187  MonitorElement* const NL1,
188  MonitorElement* const l1EtL1,
189  MonitorElement* const l1Etavsl1PhiL1,
190  MonitorElement* const NL1On,
191  MonitorElement* const l1EtL1On,
192  MonitorElement* const l1Etavsl1PhiL1On,
193  MonitorElement* const NL1Off,
194  MonitorElement* const offEtL1Off,
195  MonitorElement* const offEtavsoffPhiL1Off,
196  MonitorElement* const NOnOff,
197  MonitorElement* const offEtOnOff,
198  MonitorElement* const offEtavsoffPhiOnOff,
199  MonitorElement* const NL1Mc,
200  MonitorElement* const mcEtL1Mc,
201  MonitorElement* const mcEtavsmcPhiL1Mc,
202  MonitorElement* const NOffMc,
203  MonitorElement* const mcEtOffMc,
204  MonitorElement* const mcEtavsmcPhiOffMc,
205  MonitorElement* const NOnMc,
206  MonitorElement* const mcEtOnMc,
207  MonitorElement* const mcEtavsmcPhiOnMc,
208  MonitorElement* const NL1OnUM,
209  MonitorElement* const l1EtL1OnUM,
210  MonitorElement* const l1Etavsl1PhiL1OnUM,
211  MonitorElement* const NL1OffUM,
212  MonitorElement* const offEtL1OffUM,
213  MonitorElement* const offEtavsoffPhiL1OffUM,
214  MonitorElement* const NOnOffUM,
215  MonitorElement* const offEtOnOffUM,
216  MonitorElement* const offEtavsoffPhiOnOffUM,
217  MonitorElement* const NL1McUM,
218  MonitorElement* const mcEtL1McUM,
219  MonitorElement* const mcEtavsmcPhiL1McUM,
220  MonitorElement* const NOffMcUM,
221  MonitorElement* const mcEtOffMcUM,
222  MonitorElement* const mcEtavsmcPhiOffMcUM,
223  MonitorElement* const NOnMcUM,
224  MonitorElement* const mcEtOnMcUM,
225  MonitorElement* const mcEtavsmcPhiOnMcUM,
226  MonitorElement* const mcDRL1Mc,
227  MonitorElement* const mcDROnMc,
228  MonitorElement* const mcDROffMc,
229  MonitorElement* const offDRL1Off,
230  MonitorElement* const offDROnOff,
231  MonitorElement* const l1DRL1On
232  ) {
233  NMc_ = NMc;
234  mcEtMc_ = mcEtMc;
235  mcEtavsmcPhiMc_ = mcEtavsmcPhiMc;
236  NOn_ = NOn;
237  onEtOn_ = onEtOn;
238  onEtavsonPhiOn_ = onEtavsonPhiOn;
239  NOff_ = NOff;
240  offEtOff_ = offEtOff;
241  offEtavsoffPhiOff_ = offEtavsoffPhiOff;
242  NL1_ = NL1;
243  l1EtL1_ = l1EtL1;
244  l1Etavsl1PhiL1_ = l1Etavsl1PhiL1;
245  NL1On_ = NL1On;
246  l1EtL1On_ = l1EtL1On;
247  l1Etavsl1PhiL1On_ = l1Etavsl1PhiL1On;
248  NL1Off_ = NL1Off;
249  offEtL1Off_ = offEtL1Off;
250  offEtavsoffPhiL1Off_ = offEtavsoffPhiL1Off;
251  NOnOff_ = NOnOff;
252  offEtOnOff_ = offEtOnOff;
253  offEtavsoffPhiOnOff_ = offEtavsoffPhiOnOff;
254  NL1Mc_ = NL1Mc;
255  mcEtL1Mc_ = mcEtL1Mc;
256  mcEtavsmcPhiL1Mc_ = mcEtavsmcPhiL1Mc;
257  NOffMc_ = NOffMc;
258  mcEtOffMc_ = mcEtOffMc;
259  mcEtavsmcPhiOffMc_ = mcEtavsmcPhiOffMc;
260  NOnMc_ = NOnMc;
261  mcEtOnMc_ = mcEtOnMc;
262  mcEtavsmcPhiOnMc_ = mcEtavsmcPhiOnMc;
263  NL1OnUM_ = NL1OnUM;
264  l1EtL1OnUM_ = l1EtL1OnUM;
265  l1Etavsl1PhiL1OnUM_ = l1Etavsl1PhiL1OnUM;
266  NL1OffUM_ = NL1OffUM;
267  offEtL1OffUM_ = offEtL1OffUM;
268  offEtavsoffPhiL1OffUM_ = offEtavsoffPhiL1OffUM;
269  NOnOffUM_ = NOnOffUM;
270  offEtOnOffUM_ = offEtOnOffUM;
271  offEtavsoffPhiOnOffUM_ = offEtavsoffPhiOnOffUM;
272  NL1McUM_ = NL1McUM;
273  mcEtL1McUM_ = mcEtL1McUM;
274  mcEtavsmcPhiL1McUM_ = mcEtavsmcPhiL1McUM;
275  NOffMcUM_ = NOffMcUM;
276  mcEtOffMcUM_ = mcEtOffMcUM;
277  mcEtavsmcPhiOffMcUM_ = mcEtavsmcPhiOffMcUM;
278  NOnMcUM_ = NOnMcUM;
279  mcEtOnMcUM_ = mcEtOnMcUM;
280  mcEtavsmcPhiOnMcUM_ = mcEtavsmcPhiOnMcUM;
281  mcDRL1Mc_ = mcDRL1Mc;
282  mcDROnMc_ = mcDROnMc;
283  mcDROffMc_ = mcDROffMc;
284  offDRL1Off_ = offDRL1Off;
285  offDROnOff_ = offDROnOff;
286  l1DRL1On_ = l1DRL1On;
287  }
289  return NMc_;
290  }
292  return mcEtMc_;
293  }
295  return mcEtavsmcPhiMc_;
296  }
298  return NOn_;
299  }
301  return onEtOn_;
302  }
304  return onEtavsonPhiOn_;
305  }
307  return NOff_;
308  }
310  return offEtOff_;
311  }
313  return offEtavsoffPhiOff_;
314  }
316  return NL1_;
317  }
319  return l1EtL1_;
320  }
322  return l1Etavsl1PhiL1_;
323  }
325  return NL1On_;
326  }
328  return l1EtL1On_;
329  }
331  return l1Etavsl1PhiL1On_;
332  }
334  return NL1Off_;
335  }
337  return offEtL1Off_;
338  }
340  return offEtavsoffPhiL1Off_;
341  }
343  return NOnOff_;
344  }
346  return offEtOnOff_;
347  }
349  return offEtavsoffPhiOnOff_;
350  }
352  return NL1Mc_;
353  }
355  return mcEtL1Mc_;
356  }
358  return mcEtavsmcPhiL1Mc_;
359  }
360 
362  return NOffMc_;
363  }
365  return mcEtOffMc_;
366  }
368  return mcEtavsmcPhiOffMc_;
369  }
370 
372  return NOnMc_;
373  }
375  return mcEtOnMc_;
376  }
378  return mcEtavsmcPhiOnMc_;
379  }
381  return NL1OnUM_;
382  }
384  return l1EtL1OnUM_;
385  }
387  return l1Etavsl1PhiL1OnUM_;
388  }
390  return NL1OffUM_;
391  }
393  return offEtL1OffUM_;
394  }
396  return offEtavsoffPhiL1OffUM_;
397  }
399  return NOnOffUM_;
400  }
402  return offEtOnOffUM_;
403  }
405  return offEtavsoffPhiOnOffUM_;
406  }
408  return NL1McUM_;
409  }
411  return mcEtL1McUM_;
412  }
414  return mcEtavsmcPhiL1McUM_;
415  }
416 
418  return NOffMcUM_;
419  }
421  return mcEtOffMcUM_;
422  }
424  return mcEtavsmcPhiOffMcUM_;
425  }
426 
428  return NOnMcUM_;
429  }
431  return mcEtOnMcUM_;
432  }
434  return mcEtavsmcPhiOnMcUM_;
435  }
437  return mcDRL1Mc_;
438  }
440  return offDRL1Off_;
441  }
443  return offDROnOff_;
444  }
446  return mcDROnMc_;
447  }
449  return mcDROffMc_;
450  }
452  return l1DRL1On_;
453  }
454  const std::string getLabel(void ) const {
455  return filterName_;
456  }
457  void setLabel(std::string labelName){
458  filterName_ = labelName;
459  return;
460  }
461  const std::string getPath(void ) const {
462  return pathName_;
463  }
464  const std::string getl1Path(void ) const {
465  return l1pathName_;
466  }
467  const std::string getDenomPath(void ) const {
468  return denomPathName_;
469  }
470  const std::string getProcess(void ) const {
471  return processName_;
472  }
473  const int getObjectType(void ) const {
474  return objectType_;
475  }
476 
477  const edm::InputTag getTag(void) const{
479  return tagName;
480  }
481  ~PathInfo() {};
482  PathInfo(std::string denomPathName, std::string pathName, std::string l1pathName, std::string filterName, std::string processName, size_t type, float ptmin,
483  float ptmax):
484  denomPathName_(denomPathName), pathName_(pathName), l1pathName_(l1pathName), filterName_(filterName), processName_(processName), objectType_(type),
485  NMc_(0), mcEtMc_(0), mcEtavsmcPhiMc_(0),
486  NOn_(0), onEtOn_(0), onEtavsonPhiOn_(0),
488  NL1_(0), l1EtL1_(0), l1Etavsl1PhiL1_(0),
501  mcDRL1Mc_(0), mcDROnMc_(0), mcDROffMc_(0), offDRL1Off_(0),
502  offDROnOff_(0), l1DRL1On_(0),
503  ptmin_(ptmin), ptmax_(ptmax)
504  {
505  };
506  PathInfo(std::string denomPathName, std::string pathName, std::string l1pathName, std::string filterName, std::string processName, size_t type,
507  MonitorElement *NMc,
508  MonitorElement *mcEtMc,
509  MonitorElement *mcEtavsmcPhiMc,
510  MonitorElement *NOn,
511  MonitorElement *onEtOn,
512  MonitorElement *onEtavsonPhiOn,
513  MonitorElement *NOff,
514  MonitorElement *offEtOff,
515  MonitorElement *offEtavsoffPhiOff,
516  MonitorElement *NL1,
517  MonitorElement *l1EtL1,
518  MonitorElement *l1Etavsl1PhiL1,
519  MonitorElement *NL1On,
520  MonitorElement *l1EtL1On,
521  MonitorElement *l1Etavsl1PhiL1On,
522  MonitorElement *NL1Off,
523  MonitorElement *offEtL1Off,
524  MonitorElement *offEtavsoffPhiL1Off,
525  MonitorElement *NOnOff,
526  MonitorElement *offEtOnOff,
527  MonitorElement *offEtavsoffPhiOnOff,
528  MonitorElement *NL1Mc,
529  MonitorElement *mcEtL1Mc,
530  MonitorElement *mcEtavsmcPhiL1Mc,
531  MonitorElement *NOffMc,
532  MonitorElement *mcEtOffMc,
533  MonitorElement *mcEtavsmcPhiOffMc,
534  MonitorElement *NOnMc,
535  MonitorElement *mcEtOnMc,
536  MonitorElement *mcEtavsmcPhiOnMc,
537  MonitorElement *NL1OnUM,
538  MonitorElement *l1EtL1OnUM,
539  MonitorElement *l1Etavsl1PhiL1OnUM,
540  MonitorElement *NL1OffUM,
541  MonitorElement *offEtL1OffUM,
542  MonitorElement *offEtavsoffPhiL1OffUM,
543  MonitorElement *NOnOffUM,
544  MonitorElement *offEtOnOffUM,
545  MonitorElement *offEtavsoffPhiOnOffUM,
546  MonitorElement *NL1McUM,
547  MonitorElement *mcEtL1McUM,
548  MonitorElement *mcEtavsmcPhiL1McUM,
549  MonitorElement *NOffMcUM,
550  MonitorElement *mcEtOffMcUM,
551  MonitorElement *mcEtavsmcPhiOffMcUM,
552  MonitorElement *NOnMcUM,
553  MonitorElement *mcEtOnMcUM,
554  MonitorElement *mcEtavsmcPhiOnMcUM,
555  MonitorElement *mcDRL1Mc,
556  MonitorElement *mcDROnMc,
557  MonitorElement *mcDROffMc,
558  MonitorElement *offDRL1Off,
559  MonitorElement *offDROnOff,
560  MonitorElement *l1DRL1On,
561  float ptmin, float ptmax
562  ):
563  denomPathName_(denomPathName), pathName_(pathName), l1pathName_(l1pathName), filterName_(filterName), processName_(processName), objectType_(type),
564  NMc_(NMc), mcEtMc_(mcEtMc), mcEtavsmcPhiMc_(mcEtavsmcPhiMc),
565  NOn_(NOn), onEtOn_(onEtOn), onEtavsonPhiOn_(onEtavsonPhiOn),
566  NOff_(NOff), offEtOff_(offEtOff), offEtavsoffPhiOff_(offEtavsoffPhiOff),
567  NL1_(NL1), l1EtL1_(l1EtL1), l1Etavsl1PhiL1_(l1Etavsl1PhiL1),
568  NL1On_(NL1On), l1EtL1On_(l1EtL1On), l1Etavsl1PhiL1On_(l1Etavsl1PhiL1On),
569  NL1Off_(NL1Off), offEtL1Off_(offEtL1Off), offEtavsoffPhiL1Off_(offEtavsoffPhiL1Off),
570  NOnOff_(NOnOff), offEtOnOff_(offEtOnOff), offEtavsoffPhiOnOff_(offEtavsoffPhiOnOff),
571  NL1Mc_(NL1Mc), mcEtL1Mc_(mcEtL1Mc), mcEtavsmcPhiL1Mc_(mcEtavsmcPhiL1Mc),
572  NOffMc_(NOffMc), mcEtOffMc_(mcEtOffMc), mcEtavsmcPhiOffMc_(mcEtavsmcPhiOffMc),
573  NOnMc_(NOnMc), mcEtOnMc_(mcEtOnMc), mcEtavsmcPhiOnMc_(mcEtavsmcPhiOnMc),
574  NL1OnUM_(NL1OnUM), l1EtL1OnUM_(l1EtL1OnUM), l1Etavsl1PhiL1OnUM_(l1Etavsl1PhiL1OnUM),
575  NL1OffUM_(NL1OffUM), offEtL1OffUM_(offEtL1OffUM), offEtavsoffPhiL1OffUM_(offEtavsoffPhiL1OffUM),
576  NOnOffUM_(NOnOffUM), offEtOnOffUM_(offEtOnOffUM), offEtavsoffPhiOnOffUM_(offEtavsoffPhiOnOffUM),
577  NL1McUM_(NL1McUM), mcEtL1McUM_(mcEtL1McUM), mcEtavsmcPhiL1McUM_(mcEtavsmcPhiL1McUM),
578  NOffMcUM_(NOffMcUM), mcEtOffMcUM_(mcEtOffMcUM), mcEtavsmcPhiOffMcUM_(mcEtavsmcPhiOffMcUM),
579  NOnMcUM_(NOnMcUM), mcEtOnMcUM_(mcEtOnMcUM), mcEtavsmcPhiOnMcUM_(mcEtavsmcPhiOnMcUM),
580  mcDRL1Mc_(mcDRL1Mc),
581  mcDROnMc_(mcDROnMc),
582  mcDROffMc_(mcDROffMc),
583  offDRL1Off_(offDRL1Off),
584  offDROnOff_(offDROnOff),
585  l1DRL1On_(l1DRL1On),
586  ptmin_(ptmin), ptmax_(ptmax)
587  {};
588  bool operator==(const std::string v)
589  {
590  return v==filterName_;
591  }
592  private:
600 
601  // we don't own this data
620 
621  float ptmin_, ptmax_;
622 
623  const int index() {
624  return pathIndex_;
625  }
626  const int type() {
627  return objectType_;
628  }
629  public:
630  float getPtMin() const { return ptmin_; }
631  float getPtMax() const { return ptmax_; }
632  };
633 
634 public:
635  typedef std::vector<PathInfo> PathInfoCollection;
636 private:
638 
639 
640 };
641 
642 template <class T>
643 class objMon {
644 public:
645  objMon() { EtaMax_= 2.5; EtMin_=3.0; GenJetsFlag_ = false; BJetsFlag_ = false; }
646  void setLimits(float etaMax, float etMin, float drMatch)
647  {
648  EtaMax_= etaMax;
649  EtMin_= etMin;
650  DRMatch_= drMatch;
651  }
652  void setTriggerType(const std::vector<int>& trigType) { triggerType_ = trigType; }
653  void pushTriggerType(int trigType) { triggerType_.push_back(trigType); }
654  void setL1TriggerType(const std::vector<int>& trigType) { l1triggerType_ = trigType; }
655  void pushL1TriggerType(int trigType) { l1triggerType_.push_back(trigType); }
656  void setPath(FourVectorHLTriggerOffline::PathInfoCollection::iterator v) { v_ = v; }
657  void setReco(edm::Handle<T> offColl) { offColl_ = offColl; }
660  {
661 
663  pdgId_ = pdgId;
664  pdgStatus_ = status;
665 
666  }
667 
668  void fillMC();
669  void fillOff();
670  void monitorL1(const trigger::Vids & idtype, const trigger::Keys & l1k, const trigger::TriggerObjectCollection & toc);
671  void monitorDenominator(FourVectorHLTriggerOffline::PathInfoCollection::iterator v, bool l1accept, const trigger::Vids & idtype, const trigger::Keys & l1k, const trigger::TriggerObjectCollection& toc);
672 
676  {
677  fillL1OffMatch(fv);
678  fillL1MCMatch(fv);
679  }
680 
681  void monitorOnline(const trigger::Vids & idtype, const trigger::Keys & l1k, trigger::Keys::const_iterator ki, const trigger::TriggerObjectCollection & toc, unsigned int & NOn);
687  {
688 
689  if(! isTriggerType(v_->getObjectType()) ) return;
690  fillOnOffMatch(fv);
691  fillOnMCMatch(fv);
692  fillOnL1Match(fv, l1k, toc);
693 
694  }
695 
698  {
699  if(! isTriggerType(v_->getObjectType()) ) return;
700  fillOffMCMatch(fv);
701  }
702  void clearSets();
703 
704  bool isTriggerType(int t);
705  bool isL1TriggerType(int t);
706  bool hasBPartonInCone(reco::GenJetCollection::const_iterator gjet, float coneSize);
707 
714 
715 
717  {
718  GenJetsFlag_ = flag;
719  genJets_ = genJets;
720  }
721  void setBJetsFlag(bool flag)
722  {
723  BJetsFlag_ = flag;
724  }
725 
726 
727 private:
728 
729  int pdgId_;
731 
732  float EtaMax_;
733  float EtMin_;
734 
735  float DRMatch_;
736 
739 
740  std::vector<int> triggerType_;
741  std::vector<int> l1triggerType_;
742 
745 
748  FourVectorHLTriggerOffline::PathInfoCollection::iterator v_;
749 
750 };
751 
752 template <class T>
754 {
755  bool rc = false;
756 
757  for(std::vector<int>::const_iterator it = triggerType_.begin(); it != triggerType_.end(); ++it)
758  {
759 
760  if(t == *it) { rc = true; break; }
761 
762  } // end for
763 
764  return rc;
765 
766 }
767 
768 
769 template <class T>
771 {
772  bool rc = false;
773 
774  for(std::vector<int>::const_iterator it = l1triggerType_.begin(); it != l1triggerType_.end(); ++it)
775  {
776 
777  if(t == *it) { rc = true; break; }
778 
779  } // end for
780 
781  return rc;
782 
783 }
784 
785 template <class T>
786 void objMon<T>::monitorDenominator(FourVectorHLTriggerOffline::PathInfoCollection::iterator v, bool l1accept, const trigger::Vids & idtype, const trigger::Keys & l1k, const trigger::TriggerObjectCollection& toc)
787 {
788 
789  setPath(v);
790 
791  if(! isTriggerType(v_->getObjectType()) ) return;
792 
793  fillMC();
794 
795  fillOff();
796 
797  if (l1accept) monitorL1(idtype, l1k, toc);
798 
799 
800 }
801 
802 template <class T>
804 {
805 
806  unsigned int NOff = 0;
807 
808  if( offCollB_.isValid()) {
809  typedef typename reco::JetTagCollection::const_iterator const_iterator;
810  for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
811  {
812 
813  float recoEta = (*iter).first->eta();
814  float recoPhi = (*iter).first->phi();
815  float recoPt = (*iter).first->pt();
816 
817 
818  if (fabs(recoEta) <= EtaMax_ && recoPt >= EtMin_ )
819  {
820 
821  NOff++;
822  v_->getOffEtOffHisto()->Fill(recoPt);
823  v_->getOffEtaVsOffPhiOffHisto()->Fill(recoEta, recoPhi);
824 
825  }
826 
827  }
828 
829  }
830  else if(offColl_.isValid()) {
831 
832  typedef typename T::const_iterator const_iterator;
833  for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
834  {
835 
836 
837  if (fabs(iter->eta()) <= EtaMax_ && iter->pt() >= EtMin_ )
838  {
839 
840  NOff++;
841  v_->getOffEtOffHisto()->Fill(iter->pt());
842  v_->getOffEtaVsOffPhiOffHisto()->Fill(iter->eta(), iter->phi());
843 
844  }
845 
846  }
847 
848  } // end else if
849 
850  v_->getNOffHisto()->Fill(NOff);
851 
852 }
853 
854 template <class T>
856 {
857 
858  float NMc=0;
859 
860  if(GenJetsFlag_)
861  {
862 
863  if (! genJets_.isValid()) return;
864 
865  for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
866 
867  if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
868 
869  if(BJetsFlag_)
870  {
871  // this jet must have b in the cone
872  if(! hasBPartonInCone(gjet,0.7)) continue;
873 
874 
875  }
876 
877  NMc++;
878  v_->getMcEtMcHisto()->Fill(gjet->pt());
879  v_->getMcEtaVsMcPhiMcHisto()->Fill(gjet->eta(),gjet->phi());
880 
881 
882  } // end if Eta , Et
883 
884  } // end for
885 
886 
887  } // end if GenJetsFlag_
888  else if( genParticles_.isValid()) {
889 
890  for(size_t i = 0; i < genParticles_->size(); ++ i) {
891 
892  const reco::GenParticle & p = (*genParticles_)[i];
893  if (abs(p.pdgId()) == pdgId_ && p.status() == pdgStatus_ && fabs(p.eta()) <= EtaMax_ && p.pt() >= EtMin_ ){
894 
895  NMc++;
896  v_->getMcEtMcHisto()->Fill(p.pt());
897  v_->getMcEtaVsMcPhiMcHisto()->Fill(p.eta(),p.phi());
898 
899  }
900 
901  } // end for
902 
903  } // end if
904 
905  v_->getNMcHisto()->Fill(NMc);
906 
907 }
908 
909 template <class T>
911 {
912 
913  unsigned int NL1=0;
914  unsigned int NL1McUM=0;
915  unsigned int NL1OffUM=0;
916 
917  trigger::Vids::const_iterator idtypeiter = idtype.begin();
918  for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
919 
920  trigger::TriggerObject l1FV = toc[*l1ki];
921  if(isL1TriggerType(*idtypeiter))
922  {
923 
924  NL1++;
925 
926 
927  if (fabs(l1FV.eta()) <= EtaMax_ && l1FV.pt() >= EtMin_)
928  {
929 
930  v_->getL1EtL1Histo()->Fill(l1FV.pt());
931  v_->getL1EtaVsL1PhiL1Histo()->Fill(l1FV.eta(), l1FV.phi());
932 
933  }
934 
935  fimmap L1OffDRMatchMap;
936 
937  if (offCollB_.isValid()) {
938 
939  int j=0;
940  typedef typename reco::JetTagCollection::const_iterator const_iterator;
941  for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
942  {
943 
944  float recoEta = (*iter).first->eta();
945  float recoPhi = (*iter).first->phi();
946  float recoPt = (*iter).first->pt();
947 
948  if (fabs(recoEta) <= EtaMax_ && recoPt >= EtMin_ )
949  {
950 
951  // fill UM histos (no matching required)
952  if(NL1 == 1) {
953 
954  NL1OffUM++;
955  v_->getOffEtL1OffUMHisto()->Fill(recoPt);
956  v_->getOffEtaVsOffPhiL1OffUMHisto()->Fill(recoEta,recoPhi);
957 
958  }
959 
960  // make maps of matched objects
961  float dR = reco::deltaR(recoEta,recoPhi,l1FV.eta(),l1FV.phi());
962  if ( dR < 1.0)
963  {
964 
965  L1OffDRMatchMap.insert(std::pair<float,int>(dR,j));
966 
967  }
968 
969  }
970 
971  j++;
972 
973  }
974 
975  }
976  else if (offColl_.isValid()) {
977 
978  int j=0;
979  typedef typename T::const_iterator const_iterator;
980  for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
981  {
982 
983  if (fabs(iter->eta()) <= EtaMax_ && iter->pt() >= EtMin_ )
984  {
985 
986  // fill UM histos (no matching required)
987  if(NL1 == 1) {
988 
989  NL1OffUM++;
990  v_->getOffEtL1OffUMHisto()->Fill(iter->pt());
991  v_->getOffEtaVsOffPhiL1OffUMHisto()->Fill(iter->eta(),iter->phi());
992 
993  }
994 
995  // make maps of matched objects
996  float dR = reco::deltaR(iter->eta(),iter->phi(),l1FV.eta(),l1FV.phi());
997  if ( dR < 1.0)
998  {
999 
1000  L1OffDRMatchMap.insert(std::pair<float,int>(dR,j));
1001 
1002  }
1003 
1004  }
1005 
1006  j++;
1007 
1008  }
1009 
1010  }
1011  if(! L1OffDRMatchMap.empty()) L1OffDRMatchSet.insert(L1OffDRMatchMap);
1012 
1013  // fillL1MCUM
1015 
1016  if (GenJetsFlag_ && genJets_.isValid())
1017  {
1018 
1019  fimmap L1MCDRMatchMap;
1020  int j=0;
1021 
1022  for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
1023 
1024  if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
1025 
1026  if (BJetsFlag_) {
1027 
1028  // this jet must have b in the cone
1029  if(! hasBPartonInCone(gjet,0.7)) {
1030 
1031  j++;
1032  continue;
1033 
1034  }
1035 
1036  }
1037 
1038  // fill UM histos (no matching required)
1039  if(NL1 == 1) {
1040 
1041  NL1McUM++;
1042  v_->getMcEtL1McUMHisto()->Fill(gjet->pt());
1043  v_->getMcEtaVsMcPhiL1McUMHisto()->Fill(gjet->eta(),gjet->phi());
1044 
1045  }
1046 
1047  // make maps of matched objects
1048  float dR = reco::deltaR(gjet->eta(),gjet->phi(),l1FV.eta(),l1FV.phi());
1049  if ( dR < 1.0)
1050  {
1051 
1052  L1MCDRMatchMap.insert(std::pair<float,int>(dR,j));
1053 
1054  }
1055 
1056 
1057  } // end if eta, Et
1058 
1059  j++;
1060 
1061  } // end for genJets
1062 
1063  if(! L1MCDRMatchMap.empty()) {
1064  L1MCDRMatchSet.insert(L1MCDRMatchMap);
1065  }
1066 
1067  } // end if genJets
1068  else if ( ! GenJetsFlag_ && genParticles_.isValid())
1069  {
1070 
1071  fimmap L1MCDRMatchMap;
1072  for(size_t i = 0; i < genParticles_->size(); ++ i)
1073  {
1074 
1075  const reco::GenParticle & p = (*genParticles_)[i];
1076  if (abs(p.pdgId()) == pdgId_ && p.status() == pdgStatus_ && fabs(p.eta()) <= EtaMax_ && p.pt() >= EtMin_)
1077  {
1078 
1079  // fill UM histos (no matching required)
1080  if(NL1 == 1) {
1081 
1082  NL1McUM++;
1083  v_->getMcEtL1McUMHisto()->Fill(p.pt());
1084  v_->getMcEtaVsMcPhiL1McUMHisto()->Fill(p.eta(),p.phi());
1085 
1086  }
1087 
1088  // make maps of matched objects
1089  float dR = reco::deltaR(p.eta(),p.phi(),l1FV.eta(),l1FV.phi());
1090  if ( dR < 1.0)
1091  {
1092 
1093  L1MCDRMatchMap.insert(std::pair<float,int>(dR,i));
1094 
1095  }
1096 
1097  } // end if pdg, status, eta, pt
1098  } // end for
1099 
1100  if(! L1MCDRMatchMap.empty()) {
1101  L1MCDRMatchSet.insert(L1MCDRMatchMap);
1102  }
1103 
1104  } // end if genParticle_
1105 
1106  } // end if isL1TriggerType
1107  ++idtypeiter;
1108 
1109  } // end for l1ki
1110 
1111  v_->getNL1Histo()->Fill(NL1);
1112  v_->getNL1OffUMHisto()->Fill(NL1OffUM);
1113  v_->getNL1McUMHisto()->Fill(NL1McUM);
1114 
1115 }
1116 
1117 template <class T>
1118 void objMon<T>::monitorOnline(const trigger::Vids & idtype, const trigger::Keys & l1k, trigger::Keys::const_iterator ki, const trigger::TriggerObjectCollection & toc, unsigned int & NOn)
1119 {
1120 
1121 
1122  unsigned int NOnOffUM=0;
1123  unsigned int NOnMcUM=0;
1124  unsigned int NOnL1UM=0;
1125 
1126  if(! isTriggerType(v_->getObjectType()) ) return;
1127 
1128  trigger::TriggerObject onlineFV = toc[*ki];
1129 
1130  NOn++;
1131 
1132  if (fabs(onlineFV.eta()) <= EtaMax_ && onlineFV.pt() >= EtMin_)
1133  {
1134 
1135  v_->getOnEtOnHisto()->Fill(onlineFV.pt());
1136  v_->getOnEtaVsOnPhiOnHisto()->Fill(onlineFV.eta(), onlineFV.phi());
1137 
1138  }
1139 
1140 
1141  fimmap OnOffDRMatchMap;
1142 
1143  if (offCollB_.isValid()) {
1144 
1145  int j=0;
1146  typedef typename reco::JetTagCollection::const_iterator const_iterator;
1147  for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
1148  {
1149 
1150  float recoEta = (*iter).first->eta();
1151  float recoPhi = (*iter).first->phi();
1152  float recoPt = (*iter).first->pt();
1153 
1154  if (fabs(recoEta) <= EtaMax_ && recoPt >= EtMin_ )
1155  {
1156 
1157  // fill UM histos (no matching required)
1158  if(NOn == 1) {
1159 
1160  NOnOffUM++;
1161  v_->getOffEtOnOffUMHisto()->Fill(recoPt);
1162  v_->getOffEtaVsOffPhiOnOffUMHisto()->Fill(recoEta,recoPhi);
1163 
1164  }
1165 
1166  // make maps of matched objects
1167  float dR = reco::deltaR(recoEta,recoPhi,onlineFV.eta(),onlineFV.phi());
1168  if ( dR < 1.0)
1169  {
1170 
1171  OnOffDRMatchMap.insert(std::pair<float,int>(dR,j));
1172 
1173  }
1174 
1175  }
1176 
1177  j++;
1178 
1179  }
1180 
1181  }
1182  else if (offColl_.isValid()) {
1183 
1184  int j=0;
1185 
1186  typedef typename T::const_iterator const_iterator;
1187  for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
1188  {
1189 
1190  if (fabs(iter->eta()) <= EtaMax_ && iter->pt() >= EtMin_ )
1191  {
1192 
1193  // fill UM histos (no matching required)
1194  if(NOn == 1) {
1195 
1196  NOnOffUM++;
1197  v_->getOffEtOnOffUMHisto()->Fill(iter->pt());
1198  v_->getOffEtaVsOffPhiOnOffUMHisto()->Fill(iter->eta(),iter->phi());
1199 
1200  }
1201 
1202  // make maps of matched objects
1203  float dR = reco::deltaR(iter->eta(),iter->phi(),onlineFV.eta(),onlineFV.phi());
1204  if ( dR < 1.0)
1205  {
1206 
1207  OnOffDRMatchMap.insert(std::pair<float,int>(dR,j));
1208 
1209  }
1210 
1211  }
1212 
1213  j++;
1214 
1215 
1216  }
1217 
1218  }
1219 
1220  if(! OnOffDRMatchMap.empty()) OnOffDRMatchSet.insert(OnOffDRMatchMap);
1221 
1222 
1223 
1224  fimmap OnL1DRMatchMap;
1225  int j=0;
1226  trigger::Vids::const_iterator idtypeiter = idtype.begin();
1227  for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki )
1228  {
1229 
1230 
1231 
1232  if(isL1TriggerType(*idtypeiter))
1233  {
1234 
1235  trigger::TriggerObject l1FV = toc[*l1ki];
1236 
1237  if ( fabs(l1FV.eta()) <= EtaMax_ && l1FV.pt() >= EtMin_ )
1238  {
1239 
1240  // fill UM histos (no matching required)
1241  if(NOn == 1) {
1242 
1243  NOnL1UM++;
1244  v_->getL1EtL1OnUMHisto()->Fill(l1FV.pt());
1245  v_->getL1EtaVsL1PhiL1OnUMHisto()->Fill(l1FV.eta(),l1FV.phi());
1246 
1247  }
1248 
1249 
1250  float dR = reco::deltaR(l1FV.eta(),l1FV.phi(),onlineFV.eta(),onlineFV.phi());
1251 
1252  if ( dR < 1.0)
1253  {
1254 
1255  OnL1DRMatchMap.insert(std::pair<float,int>(dR,j));
1256 
1257  }
1258 
1259  } // end if l1FV eta, pt
1260 
1261  } // end if isL1TriggerType
1262 
1263  ++idtypeiter;
1264  j++;
1265 
1266  } // end for
1267 
1268  if(! OnL1DRMatchMap.empty()) OnL1DRMatchSet.insert(OnL1DRMatchMap);
1269 
1270  // fillOnMCUM
1272 
1273  if (GenJetsFlag_ && genJets_.isValid())
1274  {
1275 
1276  fimmap OnMCDRMatchMap;
1277  int j=0;
1278 
1279  for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
1280 
1281  if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
1282 
1283  if (BJetsFlag_) {
1284 
1285  // this jet must have b in the cone
1286  if(! hasBPartonInCone(gjet,0.7)) {
1287 
1288  j++;
1289  continue;
1290 
1291  }
1292 
1293  }
1294  // fill UM histos (no matching required)
1295  if(NOn == 1) {
1296 
1297  NOnMcUM++;
1298  v_->getMcEtOnMcUMHisto()->Fill(gjet->pt());
1299  v_->getMcEtaVsMcPhiOnMcUMHisto()->Fill(gjet->eta(),gjet->phi());
1300 
1301  }
1302 
1303  // make maps of matched objects
1304  float dR = reco::deltaR(gjet->eta(),gjet->phi(),onlineFV.eta(),onlineFV.phi());
1305  if ( dR < 1.0)
1306  {
1307 
1308  OnMCDRMatchMap.insert(std::pair<float,int>(dR,j));
1309 
1310  }
1311 
1312  } // end if eta, Et
1313 
1314  j++;
1315 
1316  } // end for genJets
1317 
1318  if(! OnMCDRMatchMap.empty()) OnMCDRMatchSet.insert(OnMCDRMatchMap);
1319 
1320  } // end if genJets
1321  else if (!GenJetsFlag_ && genParticles_.isValid())
1322  {
1323 
1324  fimmap OnMCDRMatchMap;
1325  for(size_t i = 0; i < genParticles_->size(); ++ i)
1326  {
1327 
1328  const reco::GenParticle & p = (*genParticles_)[i];
1329  if (abs(p.pdgId()) == pdgId_ && p.status() == pdgStatus_ && fabs(p.eta()) <= EtaMax_ && p.pt() >= EtMin_)
1330  {
1331 
1332  // fill UM histos (no matching required)
1333  if(NOn == 1) {
1334 
1335  NOnMcUM++;
1336  v_->getMcEtOnMcUMHisto()->Fill(p.pt());
1337  v_->getMcEtaVsMcPhiOnMcUMHisto()->Fill(p.eta(),p.phi());
1338 
1339  }
1340 
1341  // make maps of matched objects
1342  float dR = reco::deltaR(p.eta(),p.phi(),onlineFV.eta(),onlineFV.phi());
1343  if ( dR < 1.0)
1344  {
1345 
1346  OnMCDRMatchMap.insert(std::pair<float,int>(dR,i));
1347 
1348  }
1349  } // end if
1350  } // end for
1351 
1352  if(! OnMCDRMatchMap.empty()) OnMCDRMatchSet.insert(OnMCDRMatchMap);
1353 
1354  }
1355 
1356  v_->getNOnHisto()->Fill(NOn);
1357  v_->getNOnOffUMHisto()->Fill(NOnOffUM);
1358  v_->getNL1OnUMHisto()->Fill(NOnL1UM);
1359  v_->getNOnMcUMHisto()->Fill(NOnMcUM);
1360 
1361 }
1362 
1363 template <class T>
1365 {
1366 
1367  unsigned int NOff=0;
1368  unsigned int NOffMcUM=0;
1369 
1370  if(! isTriggerType(v_->getObjectType()) ) return;
1371 
1372 
1373  if(offCollB_.isValid()) {
1374 
1375  typedef typename reco::JetTagCollection::const_iterator const_iterator;
1376  for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
1377  {
1378 
1379  NOff++;
1380 
1381  if (GenJetsFlag_ && genJets_.isValid())
1382  {
1383 
1384  fimmap OffMCDRMatchMap;
1385  int j=0;
1386 
1387  for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
1388 
1389 
1390  if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
1391 
1392  if (BJetsFlag_ && hasBPartonInCone(gjet,0.7)) {
1393 
1394 
1395  // fill UM histos (no matching required)
1396  if(NOff == 1) {
1397 
1398  NOffMcUM++;
1399  v_->getMcEtOffMcUMHisto()->Fill(gjet->pt());
1400  v_->getMcEtaVsMcPhiOffMcUMHisto()->Fill(gjet->eta(),gjet->phi());
1401 
1402  }
1403 
1404  // make maps of matched objects
1405  float dR = reco::deltaR(gjet->eta(),gjet->phi(),(*iter).first->eta(),(*iter).first->phi());
1406  if ( dR < 1.0)
1407  {
1408 
1409  OffMCDRMatchMap.insert(std::pair<float,int>(dR,j));
1410 
1411  }
1412 
1413  } // end if BJetsFlag_ and hasBParton
1414 
1415  } // end if eta, Et
1416 
1417  j++;
1418 
1419  } // end for genJets
1420 
1421  if(! OffMCDRMatchMap.empty()) OffMCDRMatchSet.insert(OffMCDRMatchMap);
1422 
1423  } // end if genJets
1424 
1425  } // end for offline objects
1426 
1427  } // end if
1428  else if(offColl_.isValid()) {
1429 
1430  typedef typename T::const_iterator const_iterator;
1431  for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
1432  {
1433 
1434  NOff++;
1435 
1436  if (GenJetsFlag_ && genJets_.isValid())
1437  {
1438 
1439  fimmap OffMCDRMatchMap;
1440  int j=0;
1441 
1442  for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
1443 
1444  if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
1445 
1446  if (BJetsFlag_) {
1447 
1448  // this jet must have b in the cone
1449  if(! hasBPartonInCone(gjet,0.7)) {
1450 
1451  j++;
1452  continue;
1453 
1454  }
1455 
1456  }
1457 
1458  // fill UM histos (no matching required)
1459  if(NOff == 1) {
1460 
1461  NOffMcUM++;
1462  v_->getMcEtOffMcUMHisto()->Fill(gjet->pt());
1463  v_->getMcEtaVsMcPhiOffMcUMHisto()->Fill(gjet->eta(),gjet->phi());
1464 
1465  }
1466 
1467  // make maps of matched objects
1468  float dR = reco::deltaR(gjet->eta(),gjet->phi(),iter->eta(),iter->phi());
1469  if ( dR < 1.0)
1470  {
1471 
1472  OffMCDRMatchMap.insert(std::pair<float,int>(dR,j));
1473 
1474  }
1475 
1476  } // end if eta, Et
1477 
1478  j++;
1479 
1480  } // end for genJets
1481 
1482  if(! OffMCDRMatchMap.empty()) OffMCDRMatchSet.insert(OffMCDRMatchMap);
1483 
1484  } // end if genJets
1485 
1486  else if (!GenJetsFlag_ && genParticles_.isValid())
1487  {
1488 
1489  fimmap OffMCDRMatchMap;
1490  for(size_t i = 0; i < genParticles_->size(); ++ i)
1491  {
1492 
1493  const reco::GenParticle & p = (*genParticles_)[i];
1494  if (abs(p.pdgId()) == pdgId_ && p.status() == pdgStatus_ && fabs(p.eta()) <= EtaMax_ && p.pt() >= EtMin_)
1495  {
1496 
1497  // fill UM histos (no matching required)
1498  if(NOff == 1) {
1499 
1500  NOffMcUM++;
1501  v_->getMcEtOffMcUMHisto()->Fill(p.pt());
1502  v_->getMcEtaVsMcPhiOffMcUMHisto()->Fill(p.eta(),p.phi());
1503 
1504  }
1505 
1506  // make maps of matched objects
1507  float dR = reco::deltaR(p.eta(),p.phi(),iter->eta(),iter->phi());
1508  if ( dR < 1.0)
1509  {
1510 
1511  OffMCDRMatchMap.insert(std::pair<float,int>(dR,i));
1512 
1513  }
1514 
1515  } // end if pdg, status, eta, pt
1516  } // end for
1517 
1518  if(! OffMCDRMatchMap.empty()) OffMCDRMatchSet.insert(OffMCDRMatchMap);
1519 
1520  } // end if genParticle_
1521 
1522  } // end for offline objects
1523 
1524  } // end else if
1525 
1526  v_->getNOffHisto()->Fill(NOff);
1527  v_->getNOffMcUMHisto()->Fill(NOffMcUM);
1528 
1529 }
1530 
1531 template <class T>
1533 {
1534 
1535  float NL1Off=0;
1536 
1537  if(L1OffDRMatchSet.size() > 1) fv->cleanDRMatchSet(L1OffDRMatchSet);
1538 
1539  // clean the set L1-Off
1540  // now fill histos
1541  for ( mmset::iterator setIter = L1OffDRMatchSet.begin( ); setIter != L1OffDRMatchSet.end( ); setIter++ )
1542  {
1543 
1544  fimmap tempMap = *setIter;
1545 
1546  fimmap::iterator it = tempMap.begin();
1547  int i = (*it).second ;
1548  float dR = (*it).first;
1549  v_->getOffDRL1OffHisto()->Fill(dR);
1550 
1551  if (dR > DRMatch_) continue;
1552  if( offCollB_.isValid()) {
1553 
1554  typedef typename reco::JetTagCollection::const_iterator const_iterator;
1555  const_iterator iter = offCollB_->begin();
1556  for (int count = 0; count < i; count++) iter++;
1557 
1558 
1559  NL1Off++;
1560  v_->getOffEtL1OffHisto()->Fill((*iter).first->pt());
1561  v_->getOffEtaVsOffPhiL1OffHisto()->Fill((*iter).first->eta(),(*iter).first->phi());
1562 
1563 
1564  }
1565  else if( offColl_.isValid()) {
1566 
1567  typedef typename T::const_iterator const_iterator;
1568  const_iterator iter = offColl_->begin();
1569  for (int count = 0; count < i; count++) iter++;
1570 
1571 
1572  NL1Off++;
1573  v_->getOffEtL1OffHisto()->Fill(iter->pt());
1574  v_->getOffEtaVsOffPhiL1OffHisto()->Fill(iter->eta(),iter->phi());
1575 
1576  }
1577 
1578  }
1579 
1580  v_->getNL1OffHisto()->Fill(NL1Off);
1581 
1582 }
1583 
1584 template <class T>
1586 {
1587 
1588  unsigned int NL1Mc=0;
1589 
1590  if(GenJetsFlag_)
1591  {
1592 
1593  if (! genJets_.isValid()) return;
1594 
1595  // clean the set L1-MC
1596  if(L1MCDRMatchSet.size() > 1) fv->cleanDRMatchSet(L1MCDRMatchSet);
1597 
1598  float NL1Mc=0;
1599 
1600  // now fill histos
1601  for ( mmset::iterator setIter = L1MCDRMatchSet.begin( ); setIter != L1MCDRMatchSet.end( ); setIter++ )
1602  {
1603 
1604  fimmap tempMap = *setIter;
1605 
1606  fimmap::iterator it = tempMap.begin();
1607  int i = (*it).second ;
1608  float dR = (*it).first;
1609 
1610  v_->getMcDRL1McHisto()->Fill(dR);
1611 
1612  if (dR > DRMatch_) continue;
1613 
1614  reco::GenJetCollection::const_iterator gjet=genJets_->begin();
1615  for (int count = 0; count < i; count++) gjet++;
1616 
1617  NL1Mc++;
1618  v_->getMcEtL1McHisto()->Fill(gjet->pt());
1619  v_->getMcEtaVsMcPhiL1McHisto()->Fill(gjet->eta(),gjet->phi());
1620 
1621 
1622  } // end for set
1623 
1624  } // end if GenJetsFlag_
1625  else if( genParticles_.isValid()) {
1626 
1627  // clean the set L1-MC
1628  if(L1MCDRMatchSet.size() > 1) fv->cleanDRMatchSet(L1MCDRMatchSet);
1629 
1630  // now fill histos
1631  for ( mmset::iterator setIter = L1MCDRMatchSet.begin( ); setIter != L1MCDRMatchSet.end( ); setIter++ )
1632  {
1633 
1634  fimmap tempMap = *setIter;
1635 
1636  fimmap::iterator it = tempMap.begin();
1637  int i = (*it).second ;
1638  float dR = (*it).first;
1639 
1640  v_->getMcDRL1McHisto()->Fill(dR);
1641 
1642  if (dR > DRMatch_) continue;
1643 
1644  const reco::GenParticle & p = (*genParticles_)[i];
1645 
1646  NL1Mc++;
1647  v_->getMcEtL1McHisto()->Fill(p.pt());
1648  v_->getMcEtaVsMcPhiL1McHisto()->Fill(p.eta(),p.phi());
1649 
1650  } // end for
1651 
1652  } // end else if
1653 
1654  v_->getNL1McHisto()->Fill(NL1Mc);
1655 
1656 }
1657 
1658 template <class T>
1660 {
1661 
1662  unsigned int NOnOff=0;
1663 
1664  // clean the set L1-Off
1665  if(OnOffDRMatchSet.size() > 1) fv->cleanDRMatchSet(OnOffDRMatchSet);
1666  // now fill histos
1667  for ( mmset::iterator setIter = OnOffDRMatchSet.begin( ); setIter != OnOffDRMatchSet.end( ); setIter++ )
1668  {
1669 
1670 
1671  fimmap tempMap = *setIter;
1672 
1673  fimmap::iterator it = tempMap.begin();
1674  int i = (*it).second ;
1675  float dR = (*it).first;
1676  v_->getOffDROnOffHisto()->Fill(dR);
1677 
1678 
1679  if (dR > DRMatch_) continue;
1680 
1681  if( offCollB_.isValid()) {
1682 
1683 
1684  typedef typename reco::JetTagCollection::const_iterator const_iterator;
1685  const_iterator iter = offCollB_->begin();
1686  for (int count = 0; count < i; count++) iter++;
1687 
1688 
1689  NOnOff++;
1690  v_->getOffEtOnOffHisto()->Fill((*iter).first->pt());
1691  v_->getOffEtaVsOffPhiOnOffHisto()->Fill((*iter).first->eta(),(*iter).first->phi());
1692 
1693  }
1694  else if( offColl_.isValid()) {
1695 
1696  typedef typename T::const_iterator const_iterator;
1697  const_iterator iter = offColl_->begin();
1698  for (int count = 0; count < i; count++) iter++;
1699 
1700  NOnOff++;
1701  v_->getOffEtOnOffHisto()->Fill(iter->pt());
1702  v_->getOffEtaVsOffPhiOnOffHisto()->Fill(iter->eta(),iter->phi());
1703 
1704  }
1705 
1706  }
1707 
1708  v_->getNOnOffHisto()->Fill(NOnOff);
1709 
1710 }
1711 
1712 template <class T>
1714 {
1715 
1716  unsigned int NOnMc=0;
1717 
1718  if(GenJetsFlag_)
1719  {
1720 
1721  if (! genJets_.isValid()) return;
1722 
1723  // clean the set L1-MC
1724  if(OnMCDRMatchSet.size() > 1) fv->cleanDRMatchSet(OnMCDRMatchSet);
1725 
1726  // now fill histos
1727  for ( mmset::iterator setIter = OnMCDRMatchSet.begin( ); setIter != OnMCDRMatchSet.end( ); setIter++ )
1728  {
1729 
1730  fimmap tempMap = *setIter;
1731 
1732  fimmap::iterator it = tempMap.begin();
1733  int i = (*it).second ;
1734  float dR = (*it).first;
1735  v_->getMcDROnMcHisto()->Fill(dR);
1736 
1737  if (dR > DRMatch_) continue;
1738 
1739  reco::GenJetCollection::const_iterator gjet=genJets_->begin();
1740  for (int count = 0; count < i; count++) gjet++;
1741 
1742 
1743  NOnMc++;
1744  v_->getMcEtOnMcHisto()->Fill(gjet->pt());
1745  v_->getMcEtaVsMcPhiOnMcHisto()->Fill(gjet->eta(),gjet->phi());
1746 
1747  } // end for set
1748 
1749  } // end if GenJetsFlag_
1750  else if( genParticles_.isValid()) {
1751 
1752  // clean the set L1-MC
1753  if(OnMCDRMatchSet.size() > 1) fv->cleanDRMatchSet(OnMCDRMatchSet);
1754 
1755  // now fill histos
1756  for ( mmset::iterator setIter = OnMCDRMatchSet.begin( ); setIter != OnMCDRMatchSet.end( ); setIter++ )
1757  {
1758 
1759  fimmap tempMap = *setIter;
1760 
1761  fimmap::iterator it = tempMap.begin();
1762  int i = (*it).second ;
1763  float dR = (*it).first;
1764  v_->getMcDROnMcHisto()->Fill(dR);
1765 
1766  if (dR > DRMatch_) continue;
1767 
1768  const reco::GenParticle & p = (*genParticles_)[i];
1769 
1770  NOnMc++;
1771  v_->getMcEtOnMcHisto()->Fill(p.pt());
1772  v_->getMcEtaVsMcPhiOnMcHisto()->Fill(p.eta(),p.phi());
1773 
1774  }
1775 
1776  }
1777 
1778  v_->getNOnMcHisto()->Fill(NOnMc);
1779 
1780 }
1781 
1782 template <class T>
1784 {
1785 
1786  unsigned int NOffMc=0;
1787 
1788  if(GenJetsFlag_)
1789  {
1790 
1791  if (! genJets_.isValid()) return;
1792 
1793  // clean the set L1-MC
1794  if(OffMCDRMatchSet.size() > 1) fv->cleanDRMatchSet(OffMCDRMatchSet);
1795 
1796  // now fill histos
1797  for ( mmset::iterator setIter = OffMCDRMatchSet.begin( ); setIter != OffMCDRMatchSet.end( ); setIter++ )
1798  {
1799 
1800  fimmap tempMap = *setIter;
1801 
1802  fimmap::iterator it = tempMap.begin();
1803  int i = (*it).second ;
1804  float dR = (*it).first;
1805  v_->getMcDROffMcHisto()->Fill(dR);
1806 
1807  if (dR > DRMatch_) continue;
1808 
1809  reco::GenJetCollection::const_iterator gjet=genJets_->begin();
1810  for (int count = 0; count < i; count++) gjet++;
1811 
1812  NOffMc++;
1813  v_->getMcEtOffMcHisto()->Fill(gjet->pt());
1814  v_->getMcEtaVsMcPhiOffMcHisto()->Fill(gjet->eta(),gjet->phi());
1815 
1816  } // end for set
1817 
1818  } // end if GenJetsFlag_
1819  else if( genParticles_.isValid() && offColl_.isValid()) {
1820 
1821  // clean the set L1-MC
1822  if(OffMCDRMatchSet.size() > 1) fv->cleanDRMatchSet(OffMCDRMatchSet);
1823 
1824  // now fill histos
1825  for ( mmset::iterator setIter = OffMCDRMatchSet.begin( ); setIter != OffMCDRMatchSet.end( ); setIter++ )
1826  {
1827 
1828  fimmap tempMap = *setIter;
1829 
1830  fimmap::iterator it = tempMap.begin();
1831  int i = (*it).second ;
1832  float dR = (*it).first;
1833  v_->getMcDROffMcHisto()->Fill(dR);
1834 
1835  if (dR > DRMatch_) continue;
1836 
1837  const reco::GenParticle & p = (*genParticles_)[i];
1838 
1839  NOffMc++;
1840  v_->getMcEtOffMcHisto()->Fill(p.pt());
1841  v_->getMcEtaVsMcPhiOffMcHisto()->Fill(p.eta(),p.phi());
1842 
1843  }
1844 
1845  }
1846 
1847  v_->getNOffMcHisto()->Fill(NOffMc);
1848 
1849 }
1850 
1851 template <class T>
1853 {
1854 
1855  unsigned int NOnL1=0;
1856 
1857  // clean the set On-L1
1858  if(OnL1DRMatchSet.size() > 1) fv->cleanDRMatchSet(OnL1DRMatchSet);
1859  // now fill histos
1860  for ( mmset::iterator setIter = OnL1DRMatchSet.begin( ); setIter != OnL1DRMatchSet.end( ); setIter++ )
1861  {
1862 
1863  fimmap tempMap = *setIter;
1864 
1865  fimmap::iterator it = tempMap.begin();
1866  int i = (*it).second ;
1867  float dR = (*it).first;
1868  v_->getL1DROnL1Histo()->Fill(dR);
1869 
1870  if (dR > DRMatch_) continue;
1871 
1872  trigger::Keys::const_iterator l1ki = l1k.begin();
1873  for (int count = 0; count < i; count++) l1ki++;
1874 
1875  NOnL1++;
1876  v_->getL1EtL1OnHisto()->Fill(toc[*l1ki].pt());
1877  v_->getL1EtaVsL1PhiL1OnHisto()->Fill(toc[*l1ki].eta(),toc[*l1ki].phi());
1878 
1879  }
1880 
1881  v_->getNL1OnHisto()->Fill(NOnL1);
1882 
1883 }
1884 
1885 template <class T>
1886 bool objMon<T>::hasBPartonInCone(reco::GenJetCollection::const_iterator gjet, float coneSize)
1887 {
1888 
1889  bool rc = false;
1890  if (! genParticles_.isValid()) return rc;
1891 
1892  for(size_t i = 0; i < genParticles_->size(); ++ i) {
1893 
1894  const reco::GenParticle & p = (*genParticles_)[i];
1895  if (abs(p.pdgId()) == 5){
1896 
1897  if (reco::deltaR(p.eta(),p.phi(),gjet->eta(),gjet->phi()) < coneSize){
1898 
1899  rc = true;
1900 
1901  }
1902 
1903  }
1904 
1905  }
1906 
1907 
1908  return rc;
1909 
1910 }
1911 
1912 template <class T>
1914 {
1915 
1916  L1OffDRMatchSet.clear();
1917  L1MCDRMatchSet.clear();
1918  OnOffDRMatchSet.clear();
1919  OnMCDRMatchSet.clear();
1920  OnL1DRMatchSet.clear();
1921  OffMCDRMatchSet.clear();
1922 
1923 }
1924 
1925 
1926 
1927 
1928 #endif
edm::Handle< reco::GenJetCollection > genJets_
type
Definition: HCALResponse.h:21
bool isTriggerType(int t)
int i
Definition: DBlmapReader.cc:9
void setHistos(MonitorElement *const NMc, MonitorElement *const mcEtMc, MonitorElement *const mcEtavsmcPhiMc, MonitorElement *const NOn, MonitorElement *const onEtOn, MonitorElement *const onEtavsonPhiOn, MonitorElement *const NOff, MonitorElement *const offEtOff, MonitorElement *const offEtavsoffPhiOff, MonitorElement *const NL1, MonitorElement *const l1EtL1, MonitorElement *const l1Etavsl1PhiL1, MonitorElement *const NL1On, MonitorElement *const l1EtL1On, MonitorElement *const l1Etavsl1PhiL1On, MonitorElement *const NL1Off, MonitorElement *const offEtL1Off, MonitorElement *const offEtavsoffPhiL1Off, MonitorElement *const NOnOff, MonitorElement *const offEtOnOff, MonitorElement *const offEtavsoffPhiOnOff, MonitorElement *const NL1Mc, MonitorElement *const mcEtL1Mc, MonitorElement *const mcEtavsmcPhiL1Mc, MonitorElement *const NOffMc, MonitorElement *const mcEtOffMc, MonitorElement *const mcEtavsmcPhiOffMc, MonitorElement *const NOnMc, MonitorElement *const mcEtOnMc, MonitorElement *const mcEtavsmcPhiOnMc, MonitorElement *const NL1OnUM, MonitorElement *const l1EtL1OnUM, MonitorElement *const l1Etavsl1PhiL1OnUM, MonitorElement *const NL1OffUM, MonitorElement *const offEtL1OffUM, MonitorElement *const offEtavsoffPhiL1OffUM, MonitorElement *const NOnOffUM, MonitorElement *const offEtOnOffUM, MonitorElement *const offEtavsoffPhiOnOffUM, MonitorElement *const NL1McUM, MonitorElement *const mcEtL1McUM, MonitorElement *const mcEtavsmcPhiL1McUM, MonitorElement *const NOffMcUM, MonitorElement *const mcEtOffMcUM, MonitorElement *const mcEtavsmcPhiOffMcUM, MonitorElement *const NOnMcUM, MonitorElement *const mcEtOnMcUM, MonitorElement *const mcEtavsmcPhiOnMcUM, MonitorElement *const mcDRL1Mc, MonitorElement *const mcDROnMc, MonitorElement *const mcDROffMc, MonitorElement *const offDRL1Off, MonitorElement *const offDROnOff, MonitorElement *const l1DRL1On)
long int flag
Definition: mlp_lapack.h:47
PathInfo(std::string denomPathName, std::string pathName, std::string l1pathName, std::string filterName, std::string processName, size_t type, MonitorElement *NMc, MonitorElement *mcEtMc, MonitorElement *mcEtavsmcPhiMc, MonitorElement *NOn, MonitorElement *onEtOn, MonitorElement *onEtavsonPhiOn, MonitorElement *NOff, MonitorElement *offEtOff, MonitorElement *offEtavsoffPhiOff, MonitorElement *NL1, MonitorElement *l1EtL1, MonitorElement *l1Etavsl1PhiL1, MonitorElement *NL1On, MonitorElement *l1EtL1On, MonitorElement *l1Etavsl1PhiL1On, MonitorElement *NL1Off, MonitorElement *offEtL1Off, MonitorElement *offEtavsoffPhiL1Off, MonitorElement *NOnOff, MonitorElement *offEtOnOff, MonitorElement *offEtavsoffPhiOnOff, MonitorElement *NL1Mc, MonitorElement *mcEtL1Mc, MonitorElement *mcEtavsmcPhiL1Mc, MonitorElement *NOffMc, MonitorElement *mcEtOffMc, MonitorElement *mcEtavsmcPhiOffMc, MonitorElement *NOnMc, MonitorElement *mcEtOnMc, MonitorElement *mcEtavsmcPhiOnMc, MonitorElement *NL1OnUM, MonitorElement *l1EtL1OnUM, MonitorElement *l1Etavsl1PhiL1OnUM, MonitorElement *NL1OffUM, MonitorElement *offEtL1OffUM, MonitorElement *offEtavsoffPhiL1OffUM, MonitorElement *NOnOffUM, MonitorElement *offEtOnOffUM, MonitorElement *offEtavsoffPhiOnOffUM, MonitorElement *NL1McUM, MonitorElement *mcEtL1McUM, MonitorElement *mcEtavsmcPhiL1McUM, MonitorElement *NOffMcUM, MonitorElement *mcEtOffMcUM, MonitorElement *mcEtavsmcPhiOffMcUM, MonitorElement *NOnMcUM, MonitorElement *mcEtOnMcUM, MonitorElement *mcEtavsmcPhiOnMcUM, MonitorElement *mcDRL1Mc, MonitorElement *mcDROnMc, MonitorElement *mcDROffMc, MonitorElement *offDRL1Off, MonitorElement *offDROnOff, MonitorElement *l1DRL1On, float ptmin, float ptmax)
FourVectorHLTriggerOffline::PathInfoCollection::iterator v_
void endRun(const edm::Run &run, const edm::EventSetup &c)
EndRun.
FourVectorHLTriggerOffline(const edm::ParameterSet &)
void setGenJets(bool flag, edm::Handle< reco::GenJetCollection > genJets)
transient_vector_type::const_iterator const_iterator
void fillOnlineMatch(FourVectorHLTriggerOffline *fv, const trigger::Keys &l1k, const trigger::TriggerObjectCollection &toc)
void fillOffMatch(FourVectorHLTriggerOffline *fv)
float phi() const
Definition: TriggerObject.h:60
edm::Handle< T > offColl_
void setLimits(float etaMax, float etMin, float drMatch)
virtual int pdgId() const GCC11_FINAL
PDG identifier.
void fillOnOffMatch(FourVectorHLTriggerOffline *fv)
void pushL1TriggerType(int trigType)
void setBJetsFlag(bool flag)
bool hasBPartonInCone(reco::GenJetCollection::const_iterator gjet, float coneSize)
void fillOnMCMatch(FourVectorHLTriggerOffline *fv)
std::multimap< float, int > fimmap
#define abs(x)
Definition: mlp_lapack.h:159
void monitorOffline(FourVectorHLTriggerOffline *fv)
float eta() const
Definition: TriggerObject.h:59
virtual void analyze(const edm::Event &, const edm::EventSetup &)
T eta() const
void pushTriggerType(int trigType)
void monitorDenominator(FourVectorHLTriggerOffline::PathInfoCollection::iterator v, bool l1accept, const trigger::Vids &idtype, const trigger::Keys &l1k, const trigger::TriggerObjectCollection &toc)
std::set< fimmap, std::less< fimmap > > mmset
void fillOnL1Match(FourVectorHLTriggerOffline *fv, const trigger::Keys &l1k, const trigger::TriggerObjectCollection &toc)
std::vector< int > triggerType_
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:24
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
void cleanDRMatchSet(mmset &tempSet)
Clean DR Match Set.
void setL1TriggerType(const std::vector< int > &trigType)
virtual int status() const GCC11_FINAL
status word
void setTriggerType(const std::vector< int > &trigType)
edm::Handle< reco::GenParticleCollection > genParticles_
void setReco(edm::Handle< T > offColl)
const edm::InputTag getTag(void) const
void fillL1OffMatch(FourVectorHLTriggerOffline *fv)
void monitorL1(const trigger::Vids &idtype, const trigger::Keys &l1k, const trigger::TriggerObjectCollection &toc)
void fillL1MCMatch(FourVectorHLTriggerOffline *fv)
int j
Definition: DBlmapReader.cc:9
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
void beginRun(const edm::Run &run, const edm::EventSetup &c)
std::vector< PathInfo > PathInfoCollection
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
bool etMin(const PFCandidate &cand, double cut)
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:83
void fillOffMCMatch(FourVectorHLTriggerOffline *fv)
void setMC(edm::Handle< reco::GenParticleCollection > genParticles, int pdgId, int status)
std::vector< size_type > Keys
const std::string getDenomPath(void) const
double ptmin
Definition: HydjetWrapper.h:86
void monitorOnline(const trigger::Vids &idtype, const trigger::Keys &l1k, trigger::Keys::const_iterator ki, const trigger::TriggerObjectCollection &toc, unsigned int &NOn)
std::vector< std::pair< std::string, std::string > > custompathnamepairs_
edm::Handle< reco::JetTagCollection > offCollB_
std::vector< int > l1triggerType_
tuple status
Definition: ntuplemaker.py:245
PathInfo(std::string denomPathName, std::string pathName, std::string l1pathName, std::string filterName, std::string processName, size_t type, float ptmin, float ptmax)
virtual float pt() const GCC11_FINAL
transverse momentum
void setPath(FourVectorHLTriggerOffline::PathInfoCollection::iterator v)
void setRecoB(edm::Handle< reco::JetTagCollection > offCollB)
std::vector< int > Vids
void fillL1Match(FourVectorHLTriggerOffline *fv)
void setPath(TString &v)
Definition: fwPaths.cc:15
Definition: Run.h:36
bool isL1TriggerType(int t)
Definition: DDAxes.h:10