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