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