CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FourVectorHLTOffline.h
Go to the documentation of this file.
1 #ifndef FOURVECTORHLTOFFLINE_H
2 #define FOURVECTORHLTOFFLINE_H
3 // -*- C++ -*-
4 //
5 // Package: FourVectorHLTOffline
6 // Class: FourVectorHLTOffline
7 //
16 //
17 // Original Author: Jeffrey Berryhill
18 // Created: June 2008
19 // Rewritten by: Vladimir Rekovic
20 // Date: May 2009
21 //
22 //
23 //
24 // system include files
25 #include <memory>
26 #include <unistd.h>
27 
28 
29 // user include files
32 
39 
45 
46 // added VR
52 
54 
60 
79 
82 
86 
87 /* MC
88 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
89 #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
90 #include "DataFormats/JetReco/interface/GenJetCollection.h"
91 #include "DataFormats/METReco/interface/GenMETCollection.h"
92 #include "DataFormats/METReco/interface/GenMET.h"
93 */
96 
98 
99 
100 
101 #include <iostream>
102 #include <fstream>
103 #include <vector>
104 
105 namespace edm {
106  class TriggerNames;
107 }
108 
109 typedef std::multimap<float,int> fimmap ;
110 typedef std::set<fimmap , std::less<fimmap> > mmset;
111 
113 
114  public:
115  explicit FourVectorHLTOffline(const edm::ParameterSet&);
117 
118  void cleanDRMatchSet(mmset& tempSet);
119 
123 
124  private:
125  virtual void beginJob() ;
126  virtual void analyze(const edm::Event&, const edm::EventSetup&);
127  virtual void endJob() ;
128 
129  // BeginRun
130  void beginRun(const edm::Run& run, const edm::EventSetup& c);
131 
132  // EndRun
133  void endRun(const edm::Run& run, const edm::EventSetup& c);
134  void fillHltMatrix(const edm::TriggerNames & triggerNames);
135  void setupHltMatrix(const std::string& label, std::vector<std::string> & paths);
136 
137  void setupHltLsPlots();
138  void setupHltBxPlots();
139  void countHLTPathHitsEndLumiBlock(const int & lumi);
140  void countHLTGroupHitsEndLumiBlock(const int & lumi);
141  void countHLTGroupL1HitsEndLumiBlock(const int & lumi);
142  void countHLTGroupBXHitsEndLumiBlock(const int & lumi);
145  bool hasL1Passed(const std::string & pathname, const edm::TriggerNames & triggerNames);
146  bool hasHLTPassed(const std::string & pathname, const edm::TriggerNames& triggerNames);
148 
149  void selectMuons(const edm::Handle<reco::MuonCollection> & muonHandle);
150  bool isVBTFMuon(const reco::Muon& muon);
151  void selectElectrons(const edm::Event& iEvent, const edm::EventSetup& iSetup, const edm::Handle<reco::GsfElectronCollection> & eleHandle);
152  void selectPhotons(const edm::Handle<reco::PhotonCollection> & phoHandle);
153  void selectJets(const edm::Event& iEvent,const edm::Handle<reco::CaloJetCollection> & jetHandle);
154  void selectMet(const edm::Handle<reco::CaloMETCollection> & metHandle);
155  void selectTaus(const edm::Event& iEvent);
156  void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c);
157  void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c);
159 
160 
161  // ----------member data ---------------------------
162  int nev_;
164  bool fLumiFlag;
165  bool fIsSetup;
166 
167  bool useUM;
168 
169  // JetID helper
171 
172  // Tau discriminators
176 
180  std::vector<MonitorElement*> v_ME_HLTAll_LS;
181  std::vector<MonitorElement*> v_ME_Total_BX;
182  std::vector<MonitorElement*> v_ME_Total_BX_Norm;
183 
192 
193  std::vector<std::string> fGroupName;
194 
197 
200 
203 
206 
209 
210  //reco::CaloTauCollection * fSelectedTaus;
211  //edm::Handle<reco::CaloTauCollection> fSelTausHandle;
214 
215  unsigned int nLS_;
216  double LSsize_ ;
218  unsigned int referenceBX_;
219  unsigned int Nbx_;
220 
221  bool plotAll_;
224 
225  unsigned int nBins_;
226  unsigned int nBinsDR_;
227  unsigned int nBins2D_;
228  unsigned int nBinsOneOverEt_;
229  double ptMin_ ;
230  double ptMax_ ;
231  double dRMax_ ;
232 
237  double muonEtaMax_;
238  double muonEtMin_;
239  double muonDRMatch_;
241  double tauEtaMax_;
242  double tauEtMin_;
243  double tauDRMatch_;
245  double jetEtaMax_;
246  double jetEtMin_;
247  double jetDRMatch_;
249  double bjetEtaMax_;
250  double bjetEtMin_;
251  double bjetDRMatch_;
254  double photonEtMin_;
257  double trackEtaMax_;
258  double trackEtMin_;
261  double metEtaMax_;
262  double metMin_;
263  double metDRMatch_;
265  double htEtaMax_;
266  double htMin_;
267  double htDRMatch_;
268  double htL1DRMatch_;
269  double sumEtMin_;
270 
271  // Muon quality cuts
273  double dxyCut_;
280 
281  // Electron quality cuts
284  // Ecal Barrel
292  //spikes
294  // Ecal Endcap
302  //spikes
304 
305  // Jet quality cuts
308  float fHPDJet_;
309  int n90Jet_;
310 
311  std::vector<std::pair<std::string, std::string> > custompathnamepairs_;
312 
313  std::vector <std::vector <std::string> > triggerFilters_;
314  std::vector <std::vector <uint> > triggerFilterIndices_;
315  std::vector <std::pair<std::string, float> > fPathTempCountPair;
316  std::vector <std::pair<std::string, std::vector<int> > > fPathBxTempCountPair;
317  std::vector <std::pair<std::string, float> > fGroupTempCountPair;
318  std::vector <std::pair<std::string, float> > fGroupL1TempCountPair;
319  std::vector <std::pair<std::string, std::vector<std::string> > > fGroupNamePathsPair;
320 
321  std::vector<std::string> specialPaths_;
322 
332  // data across paths
334  // helper class to store the data path
335 
336  class PathInfo {
337 
339  pathIndex_(-1), denomPathName_("unset"), pathName_("unset"), l1pathName_("unset"), filterName_("unset"), processName_("unset"), objectType_(-1) {};
340 
341  public:
342 
344  {
345  filters_ = filters;
346  }
347 
348  void setHistos(
349 
350  MonitorElement* const NOn,
351  MonitorElement* const onEtOn,
352  MonitorElement* const onOneOverEtOn,
353  MonitorElement* const onEtavsonPhiOn,
354  MonitorElement* const NOff,
355  MonitorElement* const offEtOff,
356  MonitorElement* const offEtavsoffPhiOff,
357  MonitorElement* const NL1,
358  MonitorElement* const l1EtL1,
359  MonitorElement* const l1Etavsl1PhiL1,
360  MonitorElement* const NL1On,
361  MonitorElement* const l1EtL1On,
362  MonitorElement* const l1Etavsl1PhiL1On,
363  MonitorElement* const NL1Off,
364  MonitorElement* const offEtL1Off,
365  MonitorElement* const offEtavsoffPhiL1Off,
366  MonitorElement* const NOnOff,
367  MonitorElement* const offEtOnOff,
368  MonitorElement* const offEtavsoffPhiOnOff,
369  MonitorElement* const NL1OnUM,
370  MonitorElement* const l1EtL1OnUM,
371  MonitorElement* const l1Etavsl1PhiL1OnUM,
372  MonitorElement* const NL1OffUM,
373  MonitorElement* const offEtL1OffUM,
374  MonitorElement* const offEtavsoffPhiL1OffUM,
375  MonitorElement* const NOnOffUM,
376  MonitorElement* const offEtOnOffUM,
377  MonitorElement* const offEtavsoffPhiOnOffUM,
378  MonitorElement* const offDRL1Off,
379  MonitorElement* const offDROnOff,
380  MonitorElement* const l1DRL1On)
381  {
382 
383  NOn_ = NOn;
384  onEtOn_ = onEtOn;
385  onOneOverEtOn_ = onOneOverEtOn;
386  onEtavsonPhiOn_ = onEtavsonPhiOn;
387  NOff_ = NOff;
388  offEtOff_ = offEtOff;
389  offEtavsoffPhiOff_ = offEtavsoffPhiOff;
390  NL1_ = NL1;
391  l1EtL1_ = l1EtL1;
392  l1Etavsl1PhiL1_ = l1Etavsl1PhiL1;
393  NL1On_ = NL1On;
394  l1EtL1On_ = l1EtL1On;
395  l1Etavsl1PhiL1On_ = l1Etavsl1PhiL1On;
396  NL1Off_ = NL1Off;
397  offEtL1Off_ = offEtL1Off;
398  offEtavsoffPhiL1Off_ = offEtavsoffPhiL1Off;
399  NOnOff_ = NOnOff;
400  offEtOnOff_ = offEtOnOff;
401  offEtavsoffPhiOnOff_ = offEtavsoffPhiOnOff;
402  NL1OnUM_ = NL1OnUM;
403  l1EtL1OnUM_ = l1EtL1OnUM;
404  l1Etavsl1PhiL1OnUM_ = l1Etavsl1PhiL1OnUM;
405  NL1OffUM_ = NL1OffUM;
406  offEtL1OffUM_ = offEtL1OffUM;
407  offEtavsoffPhiL1OffUM_ = offEtavsoffPhiL1OffUM;
408  NOnOffUM_ = NOnOffUM;
409  offEtOnOffUM_ = offEtOnOffUM;
410  offEtavsoffPhiOnOffUM_ = offEtavsoffPhiOnOffUM;
411  offDRL1Off_ = offDRL1Off;
412  offDROnOff_ = offDROnOff;
413  l1DRL1On_ = l1DRL1On;
414 
415  }
416 
418  return NOn_;
419  }
421  return onEtOn_;
422  }
424  return onOneOverEtOn_;
425  }
427  return onEtavsonPhiOn_;
428  }
430  return NOff_;
431  }
433  return offEtOff_;
434  }
436  return offEtavsoffPhiOff_;
437  }
439  return NL1_;
440  }
442  return l1EtL1_;
443  }
445  return l1Etavsl1PhiL1_;
446  }
448  return NL1On_;
449  }
451  return l1EtL1On_;
452  }
454  return l1Etavsl1PhiL1On_;
455  }
457  return NL1Off_;
458  }
460  return offEtL1Off_;
461  }
463  return offEtavsoffPhiL1Off_;
464  }
466  return NOnOff_;
467  }
469  return offEtOnOff_;
470  }
472  return offEtavsoffPhiOnOff_;
473  }
475  return NL1OnUM_;
476  }
478  return l1EtL1OnUM_;
479  }
481  return l1Etavsl1PhiL1OnUM_;
482  }
484  return NL1OffUM_;
485  }
487  return offEtL1OffUM_;
488  }
490  return offEtavsoffPhiL1OffUM_;
491  }
493  return NOnOffUM_;
494  }
496  return offEtOnOffUM_;
497  }
499  return offEtavsoffPhiOnOffUM_;
500  }
502  return offDRL1Off_;
503  }
505  return offDROnOff_;
506  }
508  return l1DRL1On_;
509  }
511  return filters_;
512  }
513  const std::string getLabel(void ) const {
514  return filterName_;
515  }
516  void setLabel(std::string labelName){
517  filterName_ = labelName;
518  return;
519  }
520  const std::string & getPath(void ) const {
521  return pathName_;
522  }
523  const std::string & getl1Path(void ) const {
524  return l1pathName_;
525  }
526  const int getL1ModuleIndex(void ) const {
527  return l1ModuleIndex_;
528  }
529  const std::string & getDenomPath(void ) const {
530  return denomPathName_;
531  }
532  const std::string & getProcess(void ) const {
533  return processName_;
534  }
535  const int getObjectType(void ) const {
536  return objectType_;
537  }
538 
539  const edm::InputTag getTag(void) const{
541  return tagName;
542  }
543 
544  ~PathInfo() {};
545 
546  PathInfo(std::string denomPathName, std::string pathName, std::string l1pathName, int l1ModuleIndex, std::string filterName, std::string processName, size_t type, float ptmin, float ptmax, float hltThreshold, float l1Threshold):
547 
548  denomPathName_(denomPathName),
549  pathName_(pathName),
550  l1pathName_(l1pathName),
551  l1ModuleIndex_(l1ModuleIndex),
552  filterName_(filterName),
553  processName_(processName),
554  objectType_(type),
555  NOn_(0), onEtOn_(0), onOneOverEtOn_(0), onEtavsonPhiOn_(0),
557  NL1_(0), l1EtL1_(0), l1Etavsl1PhiL1_(0),
564  offDRL1Off_(0), offDROnOff_(0), l1DRL1On_(0), filters_(0),
565  ptmin_(ptmin), ptmax_(ptmax),
566  hltThreshold_(hltThreshold), l1Threshold_(l1Threshold)
567 
568  {
569  };
570 
571  PathInfo(std::string denomPathName, std::string pathName, std::string l1pathName, std::string filterName, std::string processName, size_t type,
572  MonitorElement *NOn,
573  MonitorElement *onEtOn,
574  MonitorElement *onOneOverEtOn,
575  MonitorElement *onEtavsonPhiOn,
576  MonitorElement *NOff,
577  MonitorElement *offEtOff,
578  MonitorElement *offEtavsoffPhiOff,
579  MonitorElement *NL1,
580  MonitorElement *l1EtL1,
581  MonitorElement *l1Etavsl1PhiL1,
582  MonitorElement *NL1On,
583  MonitorElement *l1EtL1On,
584  MonitorElement *l1Etavsl1PhiL1On,
585  MonitorElement *NL1Off,
586  MonitorElement *offEtL1Off,
587  MonitorElement *offEtavsoffPhiL1Off,
588  MonitorElement *NOnOff,
589  MonitorElement *offEtOnOff,
590  MonitorElement *offEtavsoffPhiOnOff,
591  MonitorElement *NL1OnUM,
592  MonitorElement *l1EtL1OnUM,
593  MonitorElement *l1Etavsl1PhiL1OnUM,
594  MonitorElement *NL1OffUM,
595  MonitorElement *offEtL1OffUM,
596  MonitorElement *offEtavsoffPhiL1OffUM,
597  MonitorElement *NOnOffUM,
598  MonitorElement *offEtOnOffUM,
599  MonitorElement *offEtavsoffPhiOnOffUM,
600  MonitorElement *offDRL1Off,
601  MonitorElement *offDROnOff,
602  MonitorElement *l1DRL1On,
604  float ptmin, float ptmax
605  ):
606 
607  denomPathName_(denomPathName),
608  pathName_(pathName), l1pathName_(l1pathName),
609  filterName_(filterName), processName_(processName), objectType_(type),
610  NOn_(NOn), onEtOn_(onEtOn), onOneOverEtOn_(onOneOverEtOn), onEtavsonPhiOn_(onEtavsonPhiOn),
611  NOff_(NOff), offEtOff_(offEtOff), offEtavsoffPhiOff_(offEtavsoffPhiOff),
612  NL1_(NL1), l1EtL1_(l1EtL1), l1Etavsl1PhiL1_(l1Etavsl1PhiL1),
613  NL1On_(NL1On), l1EtL1On_(l1EtL1On), l1Etavsl1PhiL1On_(l1Etavsl1PhiL1On),
614  NL1Off_(NL1Off), offEtL1Off_(offEtL1Off), offEtavsoffPhiL1Off_(offEtavsoffPhiL1Off),
615  NOnOff_(NOnOff), offEtOnOff_(offEtOnOff), offEtavsoffPhiOnOff_(offEtavsoffPhiOnOff),
616  NL1OnUM_(NL1OnUM), l1EtL1OnUM_(l1EtL1OnUM), l1Etavsl1PhiL1OnUM_(l1Etavsl1PhiL1OnUM),
617  NL1OffUM_(NL1OffUM), offEtL1OffUM_(offEtL1OffUM), offEtavsoffPhiL1OffUM_(offEtavsoffPhiL1OffUM),
618  NOnOffUM_(NOnOffUM), offEtOnOffUM_(offEtOnOffUM), offEtavsoffPhiOnOffUM_(offEtavsoffPhiOnOffUM),
619  offDRL1Off_(offDRL1Off),
620  offDROnOff_(offDROnOff),
621  l1DRL1On_(l1DRL1On),
622  filters_(filters),
623  ptmin_(ptmin), ptmax_(ptmax)
624  {
625  };
626 
627  bool operator==(const std::string& v)
628  {
629  return v==filterName_;
630  }
631 
632  bool operator!=(const std::string& v)
633  {
634  return v!=filterName_;
635  }
636 
637  float getPtMin() const { return ptmin_; }
638  float getPtMax() const { return ptmax_; }
639  float getHltThreshold() const { return hltThreshold_; }
640  float getL1Threshold() const { return l1Threshold_; }
641 
642  std::vector< std::pair<std::string,unsigned int> > filtersAndIndices;
643 
644 
645  private:
646 
655 
656  // we don't own this data
668 
669  float ptmin_, ptmax_;
671 
672  const int index() {
673  return pathIndex_;
674  }
675  const int type() {
676  return objectType_;
677  }
678 
679 
680  };
681 
682 
683  public:
684 
685  // simple collection - just
686  class PathInfoCollection: public std::vector<PathInfo> {
687  public:
688 
689  PathInfoCollection(): std::vector<PathInfo>()
690  {};
691  std::vector<PathInfo>::iterator find(std::string pathName) {
692  return std::find(begin(), end(), pathName);
693  }
694  };
695 
697 
699 
700 };
701 
702 
703 class BaseMonitor
704 {
705  public:
706  virtual void clearSets( void ) = 0;
707  virtual void setPath(FourVectorHLTOffline::PathInfoCollection::iterator v) = 0;
708  virtual void monitorOffline( void ) = 0;
709  virtual void monitorL1( const int l1Index, FourVectorHLTOffline* fv) = 0;
710  virtual void monitorOnline(const int hltIndex, const int l1Index, FourVectorHLTOffline* fv) = 0;
711 
712  virtual void matchL1Offline(const trigger::TriggerObject& l1FV, FourVectorHLTOffline* fv, const int& NL1, unsigned int& NL1OffUM) = 0;
713  virtual void matchOnlineL1(const trigger::TriggerObject& onlineFV, const int& l1Index, FourVectorHLTOffline* fv, const int& NOn) = 0;
714  virtual void matchOnlineOffline(const trigger::TriggerObject& onlineFV, FourVectorHLTOffline* fv, const int& NOn) = 0;
715 
716  virtual void fillL1Match(FourVectorHLTOffline* fv) = 0;
717  virtual void fillOnlineMatch(const int l1Index, FourVectorHLTOffline* fv) = 0;
718 
719  virtual bool isTriggerType(int t) = 0;
720  virtual ~BaseMonitor(){}
721 
722 };
723 
724 template <class T>
725 class objMonData:public BaseMonitor {
726 public:
727  objMonData() { EtaMax_= 2.5; EtMin_=3.0; GenJetsFlag_ = false; BJetsFlag_ = false; fL2MuFlag = false; }
728  void setLimits(float etaMax, float etMin, float drMatch, float l1drMatch, float dRRange, float thresholdFactor)
729  {
730  EtaMax_= etaMax;
731  EtMin_= etMin;
732  DRMatch_= drMatch;
733  L1DRMatch_= l1drMatch;
734  DRRange_ = dRRange;
735  thresholdFactor_ = thresholdFactor;
736  }
737  void setTriggerType(const std::vector<int>& trigType) { triggerType_ = trigType; }
738  void pushTriggerType(int trigType) { triggerType_.push_back(trigType); }
739  void setL1TriggerType(const std::vector<int>& trigType) { l1triggerType_ = trigType; }
740  void pushL1TriggerType(int trigType) { l1triggerType_.push_back(trigType); }
741  void setPath(FourVectorHLTOffline::PathInfoCollection::iterator v) { v_ = v; }
742  void setReco(edm::Handle<T> offColl) { offColl_ = offColl; }
744  void setRecoMu(edm::Handle<reco::MuonCollection> offCollMu) { offCollMu_ = offCollMu; }
746 
747 
748 
749  // Monitor methods
750 
751  void monitorOffline();
752  void monitorL1(const int l1Index, FourVectorHLTOffline* fv);
753  void monitorOnline(const int hltIndex, const int l1Index, FourVectorHLTOffline* fv);
754  void matchL1Offline(const trigger::TriggerObject& l1FV, FourVectorHLTOffline* fv, const int& NL1, unsigned int& NL1OffUM);
755  void matchOnlineL1(const trigger::TriggerObject& onlineFV, const int& l1Index, FourVectorHLTOffline* fv, const int& NOn);
756  void matchOnlineOffline(const trigger::TriggerObject& onlineFV, FourVectorHLTOffline* fv, const int& NOn);
757  void fillOnlineMatch(const int l1Index, FourVectorHLTOffline* fv);
759  void fillOnL1Match(const int l1Index, FourVectorHLTOffline* fv);
762 
763  void clearSets();
764 
765  bool isTriggerType(int t);
766  bool isL1TriggerType(int t);
767 
774 
775 
776  void setBJetsFlag(bool flag)
777  {
778  BJetsFlag_ = flag;
779  }
780  void setL2MuFlag(bool flag)
781  {
782  fL2MuFlag = flag;
783  }
784 
785 
786 private:
787 
788  int pdgId_;
789  int pdgStatus_;
790 
791  float EtaMax_;
792  float EtMin_;
793 
794  float DRMatch_;
795  float L1DRMatch_;
796  float DRRange_;
798 
799  bool GenJetsFlag_;
800  bool BJetsFlag_;
801  bool fL2MuFlag;
802 
803  std::vector<int> triggerType_;
804  std::vector<int> l1triggerType_;
805 
810 
811  FourVectorHLTOffline::PathInfoCollection::iterator v_;
812 
813 };
814 
815 
816 template <class T>
818 {
819  bool rc = false;
820 
821  for(std::vector<int>::const_iterator it = triggerType_.begin(); it != triggerType_.end(); ++it)
822  {
823 
824  if(t == *it) { rc = true; break; }
825 
826  } // end for
827 
828  if (t==0) rc = true;
829 
830  return rc;
831 
832 }
833 
834 
835 template <class T>
837 {
838  bool rc = false;
839 
840  for(std::vector<int>::const_iterator it = l1triggerType_.begin(); it != l1triggerType_.end(); ++it)
841  {
842 
843  if(fabs(t) == fabs(*it)) { rc = true; break; }
844 
845  } // end for
846 
847  return rc;
848 
849 }
850 
851 
852 
853 
854 template <class T>
856 {
857 
858  if(! isTriggerType(v_->getObjectType()) ) return;
859 
860  unsigned int NOff = 0;
861 
862  if( offCollB_.isValid()) {
863  typedef typename reco::JetTagCollection::const_iterator const_iterator;
864  for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
865  {
866 
867  float recoEta = (*iter).first->eta();
868  float recoPhi = (*iter).first->phi();
869  float recoPt = (*iter).first->pt();
870 
871 
872  if (fabs(recoEta) <= EtaMax_ && recoPt >= EtMin_ )
873  {
874 
875  NOff++;
876  v_->getOffEtOffHisto()->Fill(recoPt);
877  if(recoPt >= thresholdFactor_*v_->getHltThreshold())
878  v_->getOffEtaVsOffPhiOffHisto()->Fill(recoEta, recoPhi);
879 
880  }
881  /*
882  else {
883 
884  continue;
885 
886  }
887  */
888 
889  }
890 
891  }
892  else if(offCollEle_.isValid()) {
893 
894  typedef typename reco::GsfElectronCollection::const_iterator const_iterator;
895  for( const_iterator iter = offCollEle_->begin(), iend = offCollEle_->end(); iter != iend; ++iter )
896  {
897 
898  if (fabs(iter->eta()) <= EtaMax_ && iter->superCluster()->energy()*sin(iter->superCluster()->position().Theta()) >= EtMin_ )
899  {
900 
901  NOff++;
902  v_->getOffEtOffHisto()->Fill(iter->superCluster()->energy()*sin(iter->superCluster()->position().Theta()));
903 
904  if(iter->pt() >= thresholdFactor_*v_->getHltThreshold())
905  v_->getOffEtaVsOffPhiOffHisto()->Fill(iter->eta(), iter->phi());
906 
907  }
908  /*
909  else {
910 
911  continue;
912 
913  }
914  */
915 
916  }
917 
918  } // end else if
919  else if(offColl_.isValid()) {
920 
921  typedef typename T::const_iterator const_iterator;
922  for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
923  {
924 
925  if (fabs(iter->eta()) <= EtaMax_ && iter->pt() >= EtMin_ )
926  {
927 
928  NOff++;
929  v_->getOffEtOffHisto()->Fill(iter->pt());
930 
931  if(iter->pt() >= thresholdFactor_*v_->getHltThreshold())
932  v_->getOffEtaVsOffPhiOffHisto()->Fill(iter->eta(), iter->phi());
933 
934  }
935  /*
936  else {
937 
938  continue;
939 
940  }
941  */
942 
943  }
944 
945  } // end else if
946 
947  if(NOff>0)v_->getNOffHisto()->Fill(NOff);
948 
949 }
950 
951 
952 template <class T>
953 void objMonData<T>::monitorL1(const int l1Index, FourVectorHLTOffline* fv)
954 {
955 
956  if ( l1Index >= fv->fTriggerObj->sizeFilters() ) return;
957 
958  unsigned int NL1=0;
959  unsigned int NL1OffUM=0;
960 
961  const trigger::TriggerObjectCollection & toc(fv->fTriggerObj->getObjects());
962  const trigger::Vids & idtype = fv->fTriggerObj->filterIds(l1Index);
963  const trigger::Keys & l1k = fv->fTriggerObj->filterKeys(l1Index);
964  bool l1accept = l1k.size() > 0;
965 
966  if(!l1accept) return;
967 
968  trigger::Vids::const_iterator idtypeiter = idtype.begin();
969 
970  for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
971 
972  trigger::TriggerObject l1FV = toc[*l1ki];
973 
974  if(isL1TriggerType(*idtypeiter))
975  {
976 
977  NL1++;
978 
979  v_->getL1EtL1Histo()->Fill(l1FV.pt());
980  v_->getL1EtaVsL1PhiL1Histo()->Fill(l1FV.eta(), l1FV.phi());
981 
982  matchL1Offline(l1FV, fv, NL1, NL1OffUM);
983 
984  } // end if isL1TriggerType
985 
986  ++idtypeiter;
987 
988  } // end for l1ki
989 
990  if(NL1 > 0) v_->getNL1Histo()->Fill(NL1);
991  if(NL1OffUM > 0) v_->getNL1OffUMHisto()->Fill(NL1OffUM);
992 
993 }
994 
995 
996 template <class T>
997 void objMonData<T>::matchL1Offline(const trigger::TriggerObject& l1FV, FourVectorHLTOffline* fv, const int& NL1, unsigned int& NL1OffUM)
998 {
999 
1000  fimmap L1OffDRMatchMap;
1001 
1002  if (offCollB_.isValid()) {
1003 
1004  int j=0;
1005  typedef typename reco::JetTagCollection::const_iterator const_iterator;
1006  for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
1007  {
1008 
1009  float recoEta = (*iter).first->eta();
1010  float recoPhi = (*iter).first->phi();
1011  float recoPt = (*iter).first->pt();
1012 
1013  if (fabs(recoEta) <= EtaMax_ && recoPt >= EtMin_ )
1014  {
1015 
1016  // fill UM histos (no matching required)
1017  if (v_->getOffEtL1OffUMHisto() != 0) {
1018  if(NL1 == 1) {
1019 
1020  NL1OffUM++;
1021  v_->getOffEtL1OffUMHisto()->Fill(recoPt);
1022 
1023  if(recoPt >= thresholdFactor_*v_->getHltThreshold())
1024  v_->getOffEtaVsOffPhiL1OffUMHisto()->Fill(recoEta,recoPhi);
1025 
1026  }
1027  }
1028 
1029  // make maps of matched objects
1030  float dR = reco::deltaR(recoEta,recoPhi,l1FV.eta(),l1FV.phi());
1031  if ( dR < DRRange_)
1032  {
1033 
1034  L1OffDRMatchMap.insert(std::pair<float,int>(dR,j));
1035 
1036  }
1037 
1038  }
1039 
1040  j++;
1041 
1042  }
1043 
1044  }
1045  else if (offCollMu_.isValid()) {
1046 
1047  int j=0;
1048  typedef typename reco::MuonCollection::const_iterator const_iterator;
1049  for( const_iterator iter = offCollMu_->begin(), iend = offCollMu_->end(); iter != iend; ++iter )
1050  {
1051 
1052  // get Eta, Phi of the MuonDetectorTrack,
1053  // looking at the detector most inner Position
1054  // This should be close to what L1 sees
1055  float recoEta = iter->outerTrack()->innerPosition().eta();
1056  float recoPhi = iter->outerTrack()->innerPosition().phi();
1057  float recoPt = iter->pt();
1058 
1059  if (fabs(recoEta) <= EtaMax_ && recoPt >= EtMin_ )
1060  {
1061 
1062  // fill UM histos (no matching required)
1063  if (v_->getOffEtL1OffUMHisto() != 0) {
1064  if(NL1 == 1) {
1065 
1066  NL1OffUM++;
1067  v_->getOffEtL1OffUMHisto()->Fill(recoPt);
1068 
1069  if(recoPt >= thresholdFactor_*v_->getHltThreshold())
1070  v_->getOffEtaVsOffPhiL1OffUMHisto()->Fill(recoEta,recoPhi);
1071 
1072  }
1073  }
1074 
1075  // make maps of matched objects
1076  float dR = reco::deltaR(recoEta,recoPhi,l1FV.eta(),l1FV.phi());
1077  if ( dR < DRRange_)
1078  {
1079 
1080  L1OffDRMatchMap.insert(std::pair<float,int>(dR,j));
1081 
1082  }
1083 
1084  }
1085 
1086  j++;
1087 
1088  }
1089 
1090  }
1091  else if (offCollEle_.isValid()) {
1092 
1093  int j=0;
1094  typedef typename reco::GsfElectronCollection::const_iterator const_iterator;
1095  for( const_iterator iter = offCollEle_->begin(), iend = offCollEle_->end(); iter != iend; ++iter )
1096  {
1097 
1098  if (fabs(iter->eta()) <= EtaMax_ && iter->superCluster()->energy()*sin(iter->superCluster()->position().Theta()) >= EtMin_ )
1099  {
1100 
1101  if ( v_->getOffEtL1OffUMHisto() != 0) {
1102  // fill UM histos (no matching required)
1103  if(NL1 == 1) {
1104 
1105  NL1OffUM++;
1106  v_->getOffEtL1OffUMHisto()->Fill(iter->superCluster()->energy()*sin(iter->superCluster()->position().Theta()));
1107 
1108  if(iter->superCluster()->energy()*sin(iter->superCluster()->position().Theta()) >= thresholdFactor_*v_->getHltThreshold())
1109  v_->getOffEtaVsOffPhiL1OffUMHisto()->Fill(iter->eta(),iter->phi());
1110 
1111  }
1112  }
1113 
1114  // make maps of matched objects
1115  float dR = reco::deltaR(iter->eta(),iter->phi(),l1FV.eta(),l1FV.phi());
1116  if ( dR < DRRange_)
1117  {
1118 
1119  L1OffDRMatchMap.insert(std::pair<float,int>(dR,j));
1120 
1121  }
1122 
1123  }
1124 
1125  j++;
1126 
1127  }
1128 
1129  }
1130  else if (offColl_.isValid()) {
1131 
1132  int j=0;
1133  typedef typename T::const_iterator const_iterator;
1134  for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
1135  {
1136 
1137  if (fabs(iter->eta()) <= EtaMax_ && iter->pt() >= EtMin_ )
1138  {
1139 
1140  // fill UM histos (no matching required)
1141  if (v_->getOffEtL1OffUMHisto()!= 0 ) {
1142  if(NL1 == 1) {
1143 
1144  NL1OffUM++;
1145  v_->getOffEtL1OffUMHisto()->Fill(iter->pt());
1146 
1147  if(iter->pt() >= thresholdFactor_*v_->getHltThreshold())
1148  v_->getOffEtaVsOffPhiL1OffUMHisto()->Fill(iter->eta(),iter->phi());
1149 
1150  }
1151  }
1152 
1153  // make maps of matched objects
1154  float dR = reco::deltaR(iter->eta(),iter->phi(),l1FV.eta(),l1FV.phi());
1155  if ( dR < DRRange_)
1156  {
1157 
1158  L1OffDRMatchMap.insert(std::pair<float,int>(dR,j));
1159 
1160  }
1161 
1162  }
1163 
1164  j++;
1165 
1166  }
1167 
1168  }
1169  if(! L1OffDRMatchMap.empty()) L1OffDRMatchSet.insert(L1OffDRMatchMap);
1170 
1171 }
1172 
1173 
1174 template <class T>
1175 void objMonData<T>::monitorOnline(const int hltIndex, const int l1Index, FourVectorHLTOffline* fv)
1176 {
1177 
1178  if(! isTriggerType(v_->getObjectType()) ) return;
1179 
1180  // Get keys of objects passed by the last filter
1181  const trigger::Keys & k = fv->fTriggerObj->filterKeys(hltIndex);
1182 
1183  const trigger::TriggerObjectCollection & toc(fv->fTriggerObj->getObjects());
1184 
1185  unsigned int NOn=0;
1186 
1187  // Loop over HLT objects
1188  for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
1189 
1190  trigger::TriggerObject onlineFV = toc[*ki];
1191 
1192  NOn++;
1193 
1194  v_->getOnEtOnHisto()->Fill(onlineFV.pt());
1195  v_->getOnOneOverEtOnHisto()->Fill(1./onlineFV.pt());
1196  v_->getOnEtaVsOnPhiOnHisto()->Fill(onlineFV.eta(), onlineFV.phi());
1197 
1198  matchOnlineL1(onlineFV,l1Index, fv, NOn);
1199  matchOnlineOffline(onlineFV,fv, NOn);
1200 
1201  } // end loop over HLT objects
1202 
1203  if(NOn>0) v_->getNOnHisto()->Fill(NOn);
1204 
1205 }
1206 
1207 template <class T>
1208 void objMonData<T>::matchOnlineL1(const trigger::TriggerObject& onlineFV, const int& l1Index, FourVectorHLTOffline* fv, const int& NOn)
1209 {
1210 
1211  if ( l1Index >= fv->fTriggerObj->sizeFilters() ) return;
1212 
1213  unsigned int NOnL1UM=0;
1214 
1215  const trigger::TriggerObjectCollection & toc(fv->fTriggerObj->getObjects());
1216  const trigger::Vids & idtype = fv->fTriggerObj->filterIds(l1Index);
1217  const trigger::Keys & l1k = fv->fTriggerObj->filterKeys(l1Index);
1218 
1219  fimmap OnL1DRMatchMap;
1220  int j=0;
1221  trigger::Vids::const_iterator idtypeiter = idtype.begin();
1222  for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki )
1223  {
1224 
1225  if(isL1TriggerType(*idtypeiter))
1226  {
1227 
1228  trigger::TriggerObject l1FV = toc[*l1ki];
1229 
1230  // fill UM histos (no matching required)
1231  if (v_->getL1EtL1OnUMHisto() != 0) {
1232  if(NOn == 1) {
1233 
1234  NOnL1UM++;
1235  v_->getL1EtL1OnUMHisto()->Fill(l1FV.pt());
1236  v_->getL1EtaVsL1PhiL1OnUMHisto()->Fill(l1FV.eta(),l1FV.phi());
1237 
1238  }
1239  }
1240 
1241  float dR = reco::deltaR(l1FV.eta(),l1FV.phi(),onlineFV.eta(),onlineFV.phi());
1242 
1243  if ( dR < DRRange_)
1244  {
1245 
1246  OnL1DRMatchMap.insert(std::pair<float,int>(dR,j));
1247 
1248  }
1249 
1250  } // end if isL1TriggerType
1251 
1252  ++idtypeiter;
1253  j++;
1254 
1255  } // end for
1256 
1257  if(! OnL1DRMatchMap.empty()) OnL1DRMatchSet.insert(OnL1DRMatchMap);
1258 
1259 }
1260 
1261 
1262 template <class T>
1264 {
1265 
1266  unsigned int NOnOffUM=0;
1267 
1268  fimmap OnOffDRMatchMap;
1269 
1270  if (offCollB_.isValid()) {
1271 
1272  int j=0;
1273  typedef typename reco::JetTagCollection::const_iterator const_iterator;
1274  for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
1275  {
1276 
1277  float recoEta = (*iter).first->eta();
1278  float recoPhi = (*iter).first->phi();
1279  float recoPt = (*iter).first->pt();
1280 
1281  if (fabs(recoEta) <= EtaMax_ && recoPt >= EtMin_ )
1282  {
1283 
1284 
1285  // fill UM histos (no matching required)
1286  if (v_->getOffEtOnOffUMHisto() != 0) {
1287  if(NOn == 1) {
1288 
1289  NOnOffUM++;
1290  v_->getOffEtOnOffUMHisto()->Fill(recoPt);
1291 
1292  if(recoPt >= thresholdFactor_*v_->getHltThreshold())
1293  v_->getOffEtaVsOffPhiOnOffUMHisto()->Fill(recoEta,recoPhi);
1294 
1295  }
1296  }
1297 
1298  // make maps of matched objects
1299  float dR = reco::deltaR(recoEta,recoPhi,onlineFV.eta(),onlineFV.phi());
1300  if ( dR < DRRange_)
1301  {
1302 
1303  OnOffDRMatchMap.insert(std::pair<float,int>(dR,j));
1304 
1305  }
1306 
1307  }
1308 
1309  j++;
1310 
1311  }
1312 
1313  }
1314  else if (offCollMu_.isValid() && fL2MuFlag) {
1315 
1316  int j=0;
1317  typedef typename reco::MuonCollection::const_iterator const_iterator;
1318  for( const_iterator iter = offCollMu_->begin(), iend = offCollMu_->end(); iter != iend; ++iter )
1319  {
1320 
1321  // get Eta, Phi of the MuonDetectorTrack,
1322  // looking at the detector most inner Position
1323  // This should be close to what L1 sees
1324  float recoEta = iter->outerTrack()->innerPosition().eta();
1325  float recoPhi = iter->outerTrack()->innerPosition().phi();
1326  float recoPt = iter->pt();
1327 
1328  if (fabs(recoEta) <= EtaMax_ && recoPt >= EtMin_ )
1329  {
1330  // fill UM histos (no matching required)
1331  if (v_->getOffEtOnOffUMHisto() != 0) {
1332  if(NOn == 1) {
1333 
1334  NOnOffUM++;
1335  v_->getOffEtOnOffUMHisto()->Fill(iter->pt());
1336 
1337  if(recoPt >= thresholdFactor_*v_->getHltThreshold())
1338  v_->getOffEtaVsOffPhiOnOffUMHisto()->Fill(iter->eta(),iter->phi());
1339 
1340  }
1341  }
1342 
1343  // make maps of matched objects
1344  float dR = reco::deltaR(recoEta,recoPhi,onlineFV.eta(),onlineFV.phi());
1345  if ( dR < DRRange_)
1346  {
1347 
1348  OnOffDRMatchMap.insert(std::pair<float,int>(dR,j));
1349 
1350  }
1351 
1352  }
1353 
1354  j++;
1355 
1356 
1357  }
1358 
1359  }
1360  else if (offCollEle_.isValid()) {
1361 
1362  int j=0;
1363 
1364  typedef typename reco::GsfElectronCollection::const_iterator const_iterator;
1365  for( const_iterator iter = offCollEle_->begin(), iend = offCollEle_->end(); iter != iend; ++iter )
1366  {
1367 
1368  if (fabs(iter->eta()) <= EtaMax_ && iter->superCluster()->energy()*sin(iter->superCluster()->position().Theta()) >= EtMin_ )
1369  {
1370 
1371  // fill UM histos (no matching required)
1372  if (v_->getOffEtOnOffUMHisto() != 0) {
1373  if(NOn == 1) {
1374 
1375  NOnOffUM++;
1376  v_->getOffEtOnOffUMHisto()->Fill(iter->superCluster()->energy()*sin(iter->superCluster()->position().Theta()));
1377 
1378  if(iter->superCluster()->energy()*sin(iter->superCluster()->position().Theta()) >= thresholdFactor_*v_->getHltThreshold())
1379  v_->getOffEtaVsOffPhiOnOffUMHisto()->Fill(iter->eta(),iter->phi());
1380 
1381  }
1382  }
1383 
1384  // make maps of matched objects
1385  float dR = reco::deltaR(iter->eta(),iter->phi(),onlineFV.eta(),onlineFV.phi());
1386  if ( dR < DRRange_)
1387  {
1388 
1389  OnOffDRMatchMap.insert(std::pair<float,int>(dR,j));
1390 
1391  }
1392 
1393  }
1394 
1395  j++;
1396 
1397 
1398  }
1399 
1400  }
1401  else if (offColl_.isValid()) {
1402 
1403  int j=0;
1404 
1405  typedef typename T::const_iterator const_iterator;
1406  for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
1407  {
1408 
1409  if (fabs(iter->eta()) <= EtaMax_ && iter->pt() >= EtMin_ )
1410  {
1411 
1412  // fill UM histos (no matching required)
1413  if (v_->getOffEtOnOffUMHisto() != 0) {
1414  if(NOn == 1) {
1415 
1416  NOnOffUM++;
1417  v_->getOffEtOnOffUMHisto()->Fill(iter->pt());
1418 
1419  if(iter->pt() >= thresholdFactor_*v_->getHltThreshold())
1420  v_->getOffEtaVsOffPhiOnOffUMHisto()->Fill(iter->eta(),iter->phi());
1421 
1422  }
1423  }
1424 
1425  // make maps of matched objects
1426  float dR = reco::deltaR(iter->eta(),iter->phi(),onlineFV.eta(),onlineFV.phi());
1427  if ( dR < DRRange_)
1428  {
1429 
1430  OnOffDRMatchMap.insert(std::pair<float,int>(dR,j));
1431 
1432  }
1433 
1434  }
1435 
1436  j++;
1437 
1438 
1439  }
1440 
1441  }
1442 
1443  if(! OnOffDRMatchMap.empty()) OnOffDRMatchSet.insert(OnOffDRMatchMap);
1444 
1445 }
1446 
1447 template <class T>
1449 {
1450 
1451  float NL1Off=0;
1452 
1453  if(L1OffDRMatchSet.size() > 1) {
1454 
1455  LogDebug("FourVectorHLTOffline") << " Cleaning L1Off mmset" << std::endl;
1456  fv->cleanDRMatchSet(L1OffDRMatchSet);
1457 
1458  }
1459  // clean the set L1-Off
1460  // now fill histos
1461  for ( mmset::iterator setIter = L1OffDRMatchSet.begin( ); setIter != L1OffDRMatchSet.end( ); setIter++ )
1462  {
1463 
1464  fimmap tempMap = *setIter;
1465 
1466  fimmap::iterator it = tempMap.begin();
1467  int i = (*it).second ;
1468  float dR = (*it).first;
1469  v_->getOffDRL1OffHisto()->Fill(dR);
1470 
1471  if (dR > L1DRMatch_) continue;
1472  if( offCollB_.isValid()) {
1473 
1474  typedef typename reco::JetTagCollection::const_iterator const_iterator;
1475  const_iterator iter = offCollB_->begin();
1476  for (int count = 0; count < i; count++) iter++;
1477 
1478 
1479  NL1Off++;
1480  v_->getOffEtL1OffHisto()->Fill((*iter).first->pt());
1481  if((*iter).first->pt() >= thresholdFactor_*v_->getHltThreshold())
1482  v_->getOffEtaVsOffPhiL1OffHisto()->Fill((*iter).first->eta(),(*iter).first->phi());
1483 
1484 
1485  }
1486  else if( offCollMu_.isValid()) {
1487 
1488  typedef typename reco::MuonCollection::const_iterator const_iterator;
1489  const_iterator iter = offCollMu_->begin();
1490  for (int count = 0; count < i; count++) iter++;
1491 
1492 
1493  NL1Off++;
1494  v_->getOffEtL1OffHisto()->Fill(iter->pt());
1495  if(iter->pt() >= thresholdFactor_*v_->getHltThreshold())
1496  v_->getOffEtaVsOffPhiL1OffHisto()->Fill(iter->outerTrack()->innerPosition().eta(),iter->outerTrack()->innerPosition().phi());
1497 
1498  }
1499  else if( offCollEle_.isValid()) {
1500 
1501  typedef typename reco::GsfElectronCollection::const_iterator const_iterator;
1502  const_iterator iter = offCollEle_->begin();
1503  for (int count = 0; count < i; count++) iter++;
1504 
1505 
1506  NL1Off++;
1507  v_->getOffEtL1OffHisto()->Fill(iter->superCluster()->energy()*sin(iter->superCluster()->position().Theta()));
1508  if(iter->pt() >= thresholdFactor_*v_->getHltThreshold())
1509  v_->getOffEtaVsOffPhiL1OffHisto()->Fill(iter->eta(),iter->phi());
1510 
1511  }
1512  else if( offColl_.isValid()) {
1513 
1514  typedef typename T::const_iterator const_iterator;
1515  const_iterator iter = offColl_->begin();
1516  for (int count = 0; count < i; count++) iter++;
1517 
1518 
1519  NL1Off++;
1520  v_->getOffEtL1OffHisto()->Fill(iter->pt());
1521  if(iter->pt() >= thresholdFactor_*v_->getHltThreshold())
1522  v_->getOffEtaVsOffPhiL1OffHisto()->Fill(iter->eta(),iter->phi());
1523 
1524  }
1525 
1526  }
1527 
1528  if(NL1Off > 0) v_->getNL1OffHisto()->Fill(NL1Off);
1529 
1530 }
1531 
1532 
1533 template <class T>
1535 {
1536 
1537  unsigned int NOnOff=0;
1538 
1539  // clean the set L1-Off
1540  if(OnOffDRMatchSet.size() > 1){
1541 
1542  LogDebug("FourVectorHLTOffline") << " Cleaning OnOff mmset" << std::endl;
1543  fv->cleanDRMatchSet(OnOffDRMatchSet);
1544 
1545  }
1546  // now fill histos
1547  for ( mmset::iterator setIter = OnOffDRMatchSet.begin( ); setIter != OnOffDRMatchSet.end( ); setIter++ )
1548  {
1549 
1550 
1551  fimmap tempMap = *setIter;
1552 
1553  fimmap::iterator it = tempMap.begin();
1554  int i = (*it).second ;
1555  float dR = (*it).first;
1556  v_->getOffDROnOffHisto()->Fill(dR);
1557 
1558 
1559  if (dR > DRMatch_) continue;
1560 
1561  if( offCollB_.isValid()) {
1562 
1563 
1564  typedef typename reco::JetTagCollection::const_iterator const_iterator;
1565  const_iterator iter = offCollB_->begin();
1566  for (int count = 0; count < i; count++) iter++;
1567 
1568 
1569  NOnOff++;
1570  v_->getOffEtOnOffHisto()->Fill((*iter).first->pt());
1571  if((*iter).first->pt() >= thresholdFactor_*v_->getHltThreshold())
1572  v_->getOffEtaVsOffPhiOnOffHisto()->Fill((*iter).first->eta(),(*iter).first->phi());
1573 
1574  }
1575  else if( offCollMu_.isValid() && fL2MuFlag) {
1576 
1577  typedef typename reco::MuonCollection::const_iterator const_iterator;
1578  const_iterator iter = offCollMu_->begin();
1579  for (int count = 0; count < i; count++) iter++;
1580 
1581 
1582  NOnOff++;
1583  v_->getOffEtOnOffHisto()->Fill(iter->pt());
1584  if(iter->pt() >= thresholdFactor_*v_->getHltThreshold())
1585  v_->getOffEtaVsOffPhiOnOffHisto()->Fill(iter->outerTrack()->innerPosition().eta(),iter->outerTrack()->innerPosition().phi());
1586 
1587  }
1588  else if( offCollEle_.isValid()) {
1589 
1590  typedef typename reco::GsfElectronCollection::const_iterator const_iterator;
1591  const_iterator iter = offCollEle_->begin();
1592  for (int count = 0; count < i; count++) iter++;
1593 
1594  NOnOff++;
1595  v_->getOffEtOnOffHisto()->Fill(iter->superCluster()->energy()*sin(iter->superCluster()->position().Theta()));
1596  if(iter->superCluster()->energy()*fabs(sin(iter->superCluster()->position().Theta())) >= thresholdFactor_*v_->getHltThreshold())
1597  v_->getOffEtaVsOffPhiOnOffHisto()->Fill(iter->eta(),iter->phi());
1598 
1599  }
1600  else if( offColl_.isValid()) {
1601 
1602  typedef typename T::const_iterator const_iterator;
1603  const_iterator iter = offColl_->begin();
1604  for (int count = 0; count < i; count++) iter++;
1605 
1606  NOnOff++;
1607  v_->getOffEtOnOffHisto()->Fill(iter->pt());
1608  if(iter->pt() >= thresholdFactor_*v_->getHltThreshold())
1609  v_->getOffEtaVsOffPhiOnOffHisto()->Fill(iter->eta(),iter->phi());
1610 
1611  }
1612 
1613  }
1614 
1615  v_->getNOnOffHisto()->Fill(NOnOff);
1616 
1617 }
1618 
1619 
1620 template <class T>
1622 {
1623 
1624  const trigger::TriggerObjectCollection & toc(fv->fTriggerObj->getObjects());
1625  const trigger::Keys & l1k = fv->fTriggerObj->filterKeys(l1Index);
1626 
1627  unsigned int NOnL1=0;
1628 
1629  // clean the set On-L1
1630  if(OnL1DRMatchSet.size() > 1) {
1631 
1632  LogDebug("FourVectorHLTOffline") << " Cleaning L1On mmset" << std::endl;
1633  fv->cleanDRMatchSet(OnL1DRMatchSet);
1634 
1635  }
1636  // now fill histos
1637  for ( mmset::iterator setIter = OnL1DRMatchSet.begin( ); setIter != OnL1DRMatchSet.end( ); setIter++ )
1638  {
1639 
1640  fimmap tempMap = *setIter;
1641 
1642  fimmap::iterator it = tempMap.begin();
1643  int i = (*it).second ;
1644  float dR = (*it).first;
1645  v_->getL1DROnL1Histo()->Fill(dR);
1646 
1647  if (dR > L1DRMatch_) continue;
1648 
1649  trigger::Keys::const_iterator l1ki = l1k.begin();
1650  for (int count = 0; count < i; count++) l1ki++;
1651 
1652  NOnL1++;
1653  v_->getL1EtL1OnHisto()->Fill(toc[*l1ki].pt());
1654  v_->getL1EtaVsL1PhiL1OnHisto()->Fill(toc[*l1ki].eta(),toc[*l1ki].phi());
1655 
1656  }
1657 
1658  v_->getNL1OnHisto()->Fill(NOnL1);
1659 
1660 }
1661 
1662 template <class T>
1664 {
1665 
1666  if(! isTriggerType(v_->getObjectType()) ) return;
1667  fillOnOffMatch(fv);
1668 
1669  if ( l1Index >= fv->fTriggerObj->sizeFilters() ) return;
1670  fillOnL1Match(l1Index, fv);
1671 
1672 }
1673 
1674 template <class T>
1676 {
1677 
1678  fillL1OffMatch(fv);
1679 
1680 }
1681 
1682 template <class T>
1684 {
1685 
1686  L1OffDRMatchSet.clear();
1687  L1MCDRMatchSet.clear();
1688  OnOffDRMatchSet.clear();
1689  OnMCDRMatchSet.clear();
1690  OnL1DRMatchSet.clear();
1691  OffMCDRMatchSet.clear();
1692 
1693 }
1694 
1695 
1696 
1697 #endif
#define LogDebug(id)
MonitorElement * getL1EtaVsL1PhiL1OnUMHisto()
void setupHltMatrix(const std::string &label, std::vector< std::string > &paths)
reco::helper::JetIDHelper * jetID
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
edm::Handle< T > offColl_
bool hasL1Passed(const std::string &pathname, const edm::TriggerNames &triggerNames)
virtual void fillL1Match(FourVectorHLTOffline *fv)=0
void selectPhotons(const edm::Handle< reco::PhotonCollection > &phoHandle)
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
virtual ~BaseMonitor()
void countHLTPathHitsEndLumiBlock(const int &lumi)
virtual void monitorOnline(const int hltIndex, const int l1Index, FourVectorHLTOnline *fv)=0
void countHLTGroupBXHitsEndLumiBlock(const int &lumi)
edm::Handle< reco::GsfElectronCollection > fSelElectronsHandle
edm::Handle< reco::CaloMETCollection > fSelMetHandle
FourVectorHLTOffline::PathInfoCollection::iterator v_
virtual void fillOnlineMatch(const int l1Index, FourVectorHLTOnline *fv)=0
transient_vector_type::const_iterator const_iterator
std::vector< std::vector< uint > > triggerFilterIndices_
bool isL1TriggerType(int t)
MonitorElement * getL1EtaVsL1PhiL1OnHisto()
reco::CaloMETCollection * fSelectedMet
PathInfoCollection hltPaths_
MonitorElement * getOffEtaVsOffPhiL1OffUMHisto()
bool isTriggerType(int t)
float phi() const
Definition: TriggerObject.h:58
reco::PFTauCollection * fSelectedTaus
std::vector< PathInfo >::iterator find(std::string pathName)
void endRun(const edm::Run &run, const edm::EventSetup &c)
EndRun.
std::string pathsSummaryFilterEfficiencyFolder_
void setRecoMu(edm::Handle< reco::MuonCollection > offCollMu)
tuple lumi
Definition: fjr2json.py:35
std::string pathsSummaryHLTPathsPerLSFolder_
int getTriggerTypeParsePathName(const std::string &pathname)
void fillHltMatrix(const edm::TriggerNames &triggerNames)
std::vector< std::pair< std::string, std::vector< int > > > fPathBxTempCountPair
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< std::string > specialPaths_
void matchOnlineL1(const trigger::TriggerObject &onlineFV, const int &l1Index, FourVectorHLTOnline *fv, const int &NOn)
FourVectorHLTOffline(const edm::ParameterSet &)
std::vector< int > l1triggerType_
void cleanDRMatchSet(mmset &tempSet)
Clean DR Match Set.
std::multimap< float, int > fimmap
PathInfo(std::string denomPathName, std::string pathName, std::string l1pathName, std::string filterName, std::string processName, size_t type, MonitorElement *NOn, MonitorElement *onEtOn, MonitorElement *onOneOverEtOn, 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 *NL1OnUM, MonitorElement *l1EtL1OnUM, MonitorElement *l1Etavsl1PhiL1OnUM, MonitorElement *NL1OffUM, MonitorElement *offEtL1OffUM, MonitorElement *offEtavsoffPhiL1OffUM, MonitorElement *NOnOffUM, MonitorElement *offEtOnOffUM, MonitorElement *offEtavsoffPhiOnOffUM, MonitorElement *offDRL1Off, MonitorElement *offDROnOff, MonitorElement *l1DRL1On, MonitorElement *filters, float ptmin, float ptmax)
std::vector< int > triggerType_
edm::Handle< reco::MuonCollection > fSelMuonsHandle
edm::Handle< reco::GsfElectronCollection > offCollEle_
float eta() const
Definition: TriggerObject.h:57
edm::Handle< reco::BeamSpot > fBeamSpotHandle
T eta() const
bool operator!=(const std::string &v)
virtual void monitorOffline(void)=0
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
edm::Handle< reco::PFTauCollection > fSelTausHandle
void fillOnlineMatch(const int l1Index, FourVectorHLTOnline *fv)
edm::Handle< reco::JetTagCollection > offCollB_
virtual void matchOnlineOffline(const trigger::TriggerObject &onlineFV, FourVectorHLTOffline *fv, const int &NOn)=0
const std::string & getPath(void) const
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
const edm::InputTag getTag(void) const
std::vector< TPRegexp > filters
Definition: eve_filter.cc:25
edm::InputTag triggerSummaryLabel_
void countHLTGroupL1HitsEndLumiBlock(const int &lumi)
void setRecoB(edm::Handle< reco::JetTagCollection > offCollB)
virtual bool isTriggerType(int t)=0
void setL1TriggerType(const std::vector< int > &trigType)
PathInfoCollection hltPathsDiagonal_
std::vector< std::pair< std::string, std::string > > custompathnamepairs_
void setPath(FourVectorHLTOffline::PathInfoCollection::iterator v)
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
std::set< fimmap, std::less< fimmap > > mmset
edm::Handle< reco::PhotonCollection > fSelPhotonsHandle
reco::GsfElectronCollection * fSelectedElectrons
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
const int getL1ModuleIndex(void) const
MonitorElement * getOffEtaVsOffPhiOffHisto()
FourVectorHLTOnline::PathInfoCollection::iterator v_
void matchOnlineOffline(const trigger::TriggerObject &onlineFV, FourVectorHLTOffline *fv, const int &NOn)
const std::string getL1ConditionModuleName(const std::string &pathname)
int iEvent
Definition: GenABIO.cc:243
void pushTriggerType(int trigType)
void monitorOnline(const int hltIndex, const int l1Index, FourVectorHLTOnline *fv)
edm::Handle< edm::TriggerResults > fTriggerResults
void selectJets(const edm::Event &iEvent, const edm::Handle< reco::CaloJetCollection > &jetHandle)
std::vector< MonitorElement * > v_ME_Total_BX
void matchL1Offline(const trigger::TriggerObject &l1FV, FourVectorHLTOffline *fv, const int &NL1, unsigned int &NL1OffUM)
std::string pathsSummaryHLTPathsPerBXFolder_
virtual void matchL1Offline(const trigger::TriggerObject &l1FV, FourVectorHLTOffline *fv, const int &NL1, unsigned int &NL1OffUM)=0
std::vector< std::pair< std::string, float > > fPathTempCountPair
int j
Definition: DBlmapReader.cc:9
const std::string & getProcess(void) const
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
HLTConfigProvider hltConfig_
virtual void matchOnlineL1(const trigger::TriggerObject &onlineFV, const int &l1Index, FourVectorHLTOnline *fv, const int &NOn)=0
void setLabel(std::string labelName)
#define end
Definition: vmac.h:37
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void setHistos(MonitorElement *const NOn, MonitorElement *const onEtOn, MonitorElement *const onOneOverEtOn, 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 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 offDRL1Off, MonitorElement *const offDROnOff, MonitorElement *const l1DRL1On)
reco::PhotonCollection * fSelectedPhotons
std::vector< MonitorElement * > v_ME_Total_BX_Norm
void fillL1OffMatch(FourVectorHLTOffline *fv)
void selectTaus(const edm::Event &iEvent)
std::vector< std::pair< std::string, unsigned int > > filtersAndIndices
bool operator==(const std::string &v)
const int getObjectType(void) const
bool isVBTFMuon(const reco::Muon &muon)
MonitorElement * ME_HLT_BX
void selectElectrons(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::Handle< reco::GsfElectronCollection > &eleHandle)
int k[5][pyjets_maxn]
reco::MuonCollection * fSelectedMuons
edm::InputTag triggerResultsLabel_
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
virtual void clearSets(void)=0
void monitorL1(const int l1Index, FourVectorHLTOnline *fv)
void setLimits(float etaMax, float etMin, float drMatch, float l1drMatch, float dRRange, float thresholdFactor)
void beginRun(const edm::Run &run, const edm::EventSetup &c)
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
MonitorElement * ME_HLT_CUSTOM_BX
std::vector< std::vector< std::string > > triggerFilters_
void fillOnOffMatch(FourVectorHLTOffline *fv)
std::vector< size_type > Keys
MonitorElement * getOffEtaVsOffPhiOnOffUMHisto()
edm::Handle< reco::CaloJetCollection > fSelJetsHandle
const std::string getLabel(void) const
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
std::vector< std::pair< std::string, float > > fGroupTempCountPair
std::vector< std::pair< std::string, std::vector< std::string > > > fGroupNamePathsPair
void setRecoEle(edm::Handle< reco::GsfElectronCollection > offCollEle)
std::string removeVersions(std::string histVersion)
void fillL1Match(FourVectorHLTOffline *fv)
void setL2MuFlag(bool flag)
virtual void setPath(FourVectorHLTOnline::PathInfoCollection::iterator v)=0
double ptmin
Definition: HydjetWrapper.h:85
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
std::string pathsSummaryHLTCorrelationsFolder_
std::string pathsSummaryFilterCountsFolder_
const std::string & getl1Path(void) const
std::string pathsIndividualHLTPathsPerLSFolder_
#define begin
Definition: vmac.h:30
MonitorElement * getOffEtaVsOffPhiOnOffHisto()
void selectMet(const edm::Handle< reco::CaloMETCollection > &metHandle)
MonitorElement * getOffEtaVsOffPhiL1OffHisto()
MonitorElement * ME_HLTAll_LS
void setTriggerType(const std::vector< int > &trigType)
std::vector< std::string > fGroupName
void fillOnL1Match(const int l1Index, FourVectorHLTOnline *fv)
void countHLTGroupHitsEndLumiBlock(const int &lumi)
virtual void monitorL1(const int l1Index, FourVectorHLTOnline *fv)=0
std::vector< std::pair< std::string, float > > fGroupL1TempCountPair
reco::CaloJetCollection * fSelectedJets
void pushL1TriggerType(int trigType)
PathInfo(std::string denomPathName, std::string pathName, std::string l1pathName, int l1ModuleIndex, std::string filterName, std::string processName, size_t type, float ptmin, float ptmax, float hltThreshold, float l1Threshold)
int getHltThresholdFromName(const std::string &pathname)
edm::Handle< trigger::TriggerEvent > fTriggerObj
void setReco(edm::Handle< T > offColl)
MonitorElement * scalersSelect
std::vector< MonitorElement * > v_ME_HLTAll_LS
void setFilterHistos(MonitorElement *const filters)
std::vector< int > Vids
Definition: Run.h:41
edm::Handle< reco::MuonCollection > offCollMu_
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
void selectMuons(const edm::Handle< reco::MuonCollection > &muonHandle)
bool hasHLTPassed(const std::string &pathname, const edm::TriggerNames &triggerNames)
const std::string & getDenomPath(void) const
Definition: DDAxes.h:10
void setBJetsFlag(bool flag)