CMS 3D CMS Logo

HLTTauDQMPath.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 #ifndef DQMOffline_Trigger_HLTTauDQMPath_h
3 #define DQMOffline_Trigger_HLTTauDQMPath_h
4 
6 
7 #include <tuple>
8 #include <vector>
9 #include <string>
10 
11 class HLTConfigProvider;
12 namespace edm {
13  class ParameterSet;
14  class TriggerResults;
15 }
16 namespace trigger {
17  class TriggerEvent;
18  class TriggerObject;
19 }
21 
23 public:
25  typedef std::vector<LV> LVColl;
26  typedef std::tuple<std::string, std::string, size_t> FilterIndex;
27 
28  constexpr static size_t kName = 0;
29  constexpr static size_t kType = 1;
30  constexpr static size_t kModuleIndex = 2;
32 
33  struct Object {
35  const int id; // from TriggerTypeDefs.h
36  };
37 
38  HLTTauDQMPath(const std::string& pathName, const std::string& hltProcess, bool doRefAnalysis, const HLTConfigProvider& HLTCP);
39  ~HLTTauDQMPath();
40 
41  bool isValid() const { return isValid_; }
42 
43  bool fired(const edm::TriggerResults& triggerResults) const;
44 
45  // index (to getFilterName, getFilterIndex) of the last passed filter
46  // -1, if the first filter rejects the event
47  int lastPassedFilter(const edm::TriggerResults& triggerResults) const;
48 
49  const std::string& getPathName() const { return pathName_; }
50  const unsigned int getPathIndex() const { return pathIndex_; }
51 
52  size_t filtersSize() const { return filterIndices_.size(); }
53  const std::string& getFilterName(size_t i) const { return std::get<kName>(filterIndices_[i]); }
54  const std::string& getFilterType(size_t i) const { return std::get<kType>(filterIndices_[i]); }
55  int getFilterNTaus(size_t i) const { if(i < filterTauN_.size()) return filterTauN_[i]; else return 0;}
56  int getFilterNElectrons(size_t i) const {if(i < filterElectronN_.size()) return filterElectronN_[i]; else return 0;}
57  int getFilterNMuons(size_t i) const {if(i < filterMuonN_.size()) return filterMuonN_[i]; else return 0;}
58  int getFilterMET(size_t i) const {if(i < filterMET_.size()) return filterMET_[i]; else return 0;}
59  int getFilterLevel(size_t i) const {if(i < filterLevel_.size()) return filterLevel_[i]; else return 0;}
60 
61  bool isFirstFilterL1Seed() const { return isFirstL1Seed_; }
62  const std::string& getLastFilterName() const { return std::get<kName>(filterIndices_.back()); }
63 
64  bool hasL2Taus() const { return lastL2TauFilterIndex_ != kInvalidIndex; }
65  bool hasL3Taus() const { return lastL3TauFilterIndex_ != kInvalidIndex; }
66  bool hasL2Electrons() const { return lastL2ElectronFilterIndex_ != kInvalidIndex; }
67  bool hasL3Electrons() const { return lastL3ElectronFilterIndex_ != kInvalidIndex; }
68  bool hasL2Muons() const { return lastL2MuonFilterIndex_ != kInvalidIndex; }
69  bool hasL3Muons() const { return lastL3MuonFilterIndex_ != kInvalidIndex; }
70  bool hasL2CaloMET() const { return lastL2METFilterIndex_ != kInvalidIndex; }
71  size_t getLastFilterBeforeL2TauIndex() const { return lastFilterBeforeL2TauIndex_; }
72  size_t getLastL2TauFilterIndex() const { return lastL2TauFilterIndex_; }
73  size_t getLastFilterBeforeL3TauIndex() const { return lastFilterBeforeL3TauIndex_; }
74  size_t getLastL3TauFilterIndex() const { return lastL3TauFilterIndex_; }
75 
76  size_t getLastFilterBeforeL2ElectronIndex() const { return lastFilterBeforeL2ElectronIndex_; }
77  size_t getLastL2ElectronFilterIndex() const { return lastL2ElectronFilterIndex_; }
78  size_t getLastFilterBeforeL3ElectronIndex() const { return lastFilterBeforeL3ElectronIndex_; }
79  size_t getLastL3ElectronFilterIndex() const { return lastL3ElectronFilterIndex_; }
80 
81  size_t getLastFilterBeforeL2MuonIndex() const { return lastFilterBeforeL2MuonIndex_; }
82  size_t getLastL2MuonFilterIndex() const { return lastL2MuonFilterIndex_; }
83  size_t getLastFilterBeforeL3MuonIndex() const { return lastFilterBeforeL3MuonIndex_; }
84  size_t getLastL3MuonFilterIndex() const { return lastL3MuonFilterIndex_; }
85 
86  size_t getLastFilterBeforeL2CaloMETIndex() const { return lastFilterBeforeL2METIndex_; }
87  size_t getLastL2CaloMETFilterIndex() const { return lastL2METFilterIndex_; }
88  size_t getFirstFilterBeforeL2CaloMETIndex() const { return firstFilterBeforeL2METIndex_; }
89  size_t getFirstL2CaloMETFilterIndex() const { return firstL2METFilterIndex_; }
90 
91  // index (to edm::TriggerResults) of a filter
92  size_t getFilterIndex(size_t i) const { return std::get<kModuleIndex>(filterIndices_[i]); }
93 
94  // Get objects associated to a filter, i is the "internal" index
95  void getFilterObjects(const trigger::TriggerEvent& triggerEvent, size_t i, std::vector<Object>& retval) const;
96 
97  // i = filter index
98  bool offlineMatching(size_t i, const std::vector<Object>& triggerObjects, const HLTTauDQMOfflineObjects& offlineObjects, double dR, std::vector<Object>& matchedTriggerObjects, HLTTauDQMOfflineObjects& matchedOfflineObjects) const;
99 
100  bool goodOfflineEvent(size_t i, const HLTTauDQMOfflineObjects& offlineObjects) const;
101 
102 private:
104  const bool doRefAnalysis_;
105 
106  std::vector<FilterIndex> filterIndices_;
107  std::vector<int> filterTauN_;
108  std::vector<int> filterElectronN_;
109  std::vector<int> filterMuonN_;
110  std::vector<int> filterMET_;
111  std::vector<int> filterLevel_;
113  const unsigned int pathIndex_;
131  bool isValid_;
132 };
133 
134 
135 #endif
size_t getLastL2TauFilterIndex() const
Definition: HLTTauDQMPath.h:72
const std::string pathName_
int getFilterLevel(size_t i) const
Definition: HLTTauDQMPath.h:59
bool hasL3Electrons() const
Definition: HLTTauDQMPath.h:67
constexpr auto kInvalidIndex
size_t lastL3ElectronFilterIndex_
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
std::vector< int > filterMET_
size_t getLastL3ElectronFilterIndex() const
Definition: HLTTauDQMPath.h:79
size_t lastFilterBeforeL2METIndex_
size_t getLastL3MuonFilterIndex() const
Definition: HLTTauDQMPath.h:84
bool isValid() const
Definition: HLTTauDQMPath.h:41
std::tuple< std::string, std::string, size_t > FilterIndex
Definition: HLTTauDQMPath.h:26
bool hasL2Muons() const
Definition: HLTTauDQMPath.h:68
const unsigned int getPathIndex() const
Definition: HLTTauDQMPath.h:50
size_t lastFilterBeforeL3ElectronIndex_
static const std::string kType("type")
int getFilterNElectrons(size_t i) const
Definition: HLTTauDQMPath.h:56
size_t getLastFilterBeforeL2CaloMETIndex() const
Definition: HLTTauDQMPath.h:86
bool isValid_(value_type const &hash)
Definition: Hash.cc:72
int getFilterNTaus(size_t i) const
Definition: HLTTauDQMPath.h:55
bool isFirstFilterL1Seed() const
Definition: HLTTauDQMPath.h:61
size_t lastFilterBeforeL3MuonIndex_
#define constexpr
std::vector< LV > LVColl
Definition: HLTTauDQMPath.h:25
std::vector< int > filterLevel_
const std::string hltProcess_
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
size_t getLastFilterBeforeL3TauIndex() const
Definition: HLTTauDQMPath.h:73
const std::string & getFilterType(size_t i) const
Definition: HLTTauDQMPath.h:54
bool hasL2CaloMET() const
Definition: HLTTauDQMPath.h:70
int getFilterNMuons(size_t i) const
Definition: HLTTauDQMPath.h:57
const unsigned int pathIndex_
size_t lastFilterBeforeL2TauIndex_
size_t getLastFilterBeforeL3ElectronIndex() const
Definition: HLTTauDQMPath.h:78
size_t filtersSize() const
Definition: HLTTauDQMPath.h:52
size_t getLastFilterBeforeL2MuonIndex() const
Definition: HLTTauDQMPath.h:81
const std::string & getLastFilterName() const
Definition: HLTTauDQMPath.h:62
size_t getLastL2CaloMETFilterIndex() const
Definition: HLTTauDQMPath.h:87
size_t getLastL2MuonFilterIndex() const
Definition: HLTTauDQMPath.h:82
size_t lastFilterBeforeL3TauIndex_
bool hasL3Taus() const
Definition: HLTTauDQMPath.h:65
size_t getLastFilterBeforeL3MuonIndex() const
Definition: HLTTauDQMPath.h:83
size_t getLastL3TauFilterIndex() const
Definition: HLTTauDQMPath.h:74
size_t lastFilterBeforeL2ElectronIndex_
size_t getFirstL2CaloMETFilterIndex() const
Definition: HLTTauDQMPath.h:89
std::vector< int > filterTauN_
math::XYZTLorentzVectorD LV
Definition: HLTTauDQMPath.h:24
size_t lastL2MuonFilterIndex_
std::vector< FilterIndex > filterIndices_
size_t getFilterIndex(size_t i) const
Definition: HLTTauDQMPath.h:92
const bool doRefAnalysis_
bool hasL3Muons() const
Definition: HLTTauDQMPath.h:69
static std::string const triggerResults("TriggerResults")
const std::string & getFilterName(size_t i) const
Definition: HLTTauDQMPath.h:53
size_t lastL3TauFilterIndex_
size_t getLastL2ElectronFilterIndex() const
Definition: HLTTauDQMPath.h:77
size_t lastL2TauFilterIndex_
size_t getLastFilterBeforeL2TauIndex() const
Definition: HLTTauDQMPath.h:71
int getFilterMET(size_t i) const
Definition: HLTTauDQMPath.h:58
size_t getLastFilterBeforeL2ElectronIndex() const
Definition: HLTTauDQMPath.h:76
HLT enums.
const std::string & getPathName() const
Definition: HLTTauDQMPath.h:49
std::vector< int > filterElectronN_
size_t lastL3MuonFilterIndex_
bool hasL2Taus() const
Definition: HLTTauDQMPath.h:64
size_t lastL2ElectronFilterIndex_
size_t getFirstFilterBeforeL2CaloMETIndex() const
Definition: HLTTauDQMPath.h:88
size_t firstFilterBeforeL2METIndex_
bool hasL2Electrons() const
Definition: HLTTauDQMPath.h:66
std::vector< int > filterMuonN_
const trigger::TriggerObject & object
Definition: HLTTauDQMPath.h:34
size_t lastL2METFilterIndex_
size_t lastFilterBeforeL2MuonIndex_
size_t firstL2METFilterIndex_