CMS 3D CMS Logo

TriggerEvent.h
Go to the documentation of this file.
1 #ifndef DataFormats_PatCandidates_TriggerEvent_h
2 #define DataFormats_PatCandidates_TriggerEvent_h
3 
4 // -*- C++ -*-
5 //
6 // Package: PatCandidates
7 // Class: pat::TriggerEvent
8 //
9 //
27 
28 #include <string>
29 #include <vector>
30 
35 #include <cstdint>
36 
37 namespace pat {
38 
39  class TriggerEvent {
41 
47  bool run_;
49  bool accept_;
51  bool error_;
53  bool physDecl_;
55  uint32_t lhcFill_;
58  uint16_t beamMode_;
60  uint16_t beamMomentum_;
62  uint32_t intensityBeam1_;
64  uint32_t intensityBeam2_;
67  uint16_t bstMasterStatus_;
69  uint32_t turnCount_;
75  float bCurrentAvg_;
76 
90 
91  public:
93 
95  TriggerEvent();
98  const std::string& nameHltTable, bool run = true, bool accept = true, bool error = false, bool physDecl = true);
101  const std::string& nameHltTable,
102  bool run = true,
103  bool accept = true,
104  bool error = false,
105  bool physDecl = true);
106 
108  virtual ~TriggerEvent(){};
109 
111 
118  void setRun(bool run) { run_ = run; };
120  void setAccept(bool accept) { accept_ = accept; };
122  void setError(bool error) { error_ = error; };
124  void setPhysDecl(bool physDecl) { physDecl_ = physDecl; };
126  void setLhcFill(uint32_t lhcFill) { lhcFill_ = lhcFill; };
128  void setBeamMode(uint16_t beamMode) { beamMode_ = beamMode; };
146  const std::string& nameL1Menu() const { return nameL1Menu_; };
148  const std::string& nameHltTable() const { return nameHltTable_; };
150  bool wasRun() const { return run_; };
152  bool wasAccept() const { return accept_; };
154  bool wasError() const { return error_; };
156  bool wasPhysDecl() const { return physDecl_; };
158  uint32_t lhcFill() const { return lhcFill_; };
160  uint16_t beamMode() const { return beamMode_; };
162  uint16_t beamMomentum() const { return beamMomentum_; };
164  uint32_t intensityBeam1() const { return intensityBeam1_; };
166  uint32_t intensityBeam2() const { return intensityBeam2_; };
168  uint16_t bstMasterStatus() const { return bstMasterStatus_; };
170  uint32_t turnCount() const { return turnCount_; };
172  float bCurrentStart() const { return bCurrentStart_; };
174  float bCurrentStop() const { return bCurrentStop_; };
176  float bCurrentAvg() const { return bCurrentAvg_; };
177 
180  void setAlgorithms(const edm::Handle<TriggerAlgorithmCollection>& handleTriggerAlgorithms) {
181  algorithms_ = TriggerAlgorithmRefProd(handleTriggerAlgorithms);
182  };
185  const TriggerAlgorithmCollection* algorithms() const { return algorithms_.get(); };
197  std::string nameAlgorithm(const unsigned bitAlgorithm, const bool techAlgorithm = true) const;
200  unsigned indexAlgorithm(const std::string& nameAlgorithm) const;
217 
220  void setConditions(const edm::Handle<TriggerConditionCollection>& handleTriggerConditions) {
221  conditions_ = TriggerConditionRefProd(handleTriggerConditions);
222  };
225  const TriggerConditionCollection* conditions() const { return conditions_.get(); };
231  const TriggerCondition* condition(const std::string& nameCondition) const;
234  const TriggerConditionRef conditionRef(const std::string& nameCondition) const;
237  unsigned indexCondition(const std::string& nameCondition) const;
240 
243  void setPaths(const edm::Handle<TriggerPathCollection>& handleTriggerPaths) {
244  paths_ = TriggerPathRefProd(handleTriggerPaths);
245  };
248  const TriggerPathCollection* paths() const { return paths_.get(); };
251  const TriggerPathRefVector pathRefs() const;
254  const TriggerPath* path(const std::string& namePath) const;
257  const TriggerPathRef pathRef(const std::string& namePath) const;
260  unsigned indexPath(const std::string& namePath) const;
263 
266  void setFilters(const edm::Handle<TriggerFilterCollection>& handleTriggerFilters) {
267  filters_ = TriggerFilterRefProd(handleTriggerFilters);
268  };
271  const TriggerFilterCollection* filters() const { return filters_.get(); };
274  const TriggerFilterRefVector filterRefs() const;
277  const TriggerFilter* filter(const std::string& labelFilter) const;
280  const TriggerFilterRef filterRef(const std::string& labelFilter) const;
283  unsigned indexFilter(const std::string& labelFilter) const;
286 
289  void setObjects(const edm::Handle<TriggerObjectCollection>& handleTriggerObjects) {
290  objects_ = TriggerObjectRefProd(handleTriggerObjects);
291  };
294  const TriggerObjectCollection* objects() const { return objects_.get(); };
297  const TriggerObjectRefVector objectRefs() const;
300  TriggerObjectRefVector objects(int triggerObjectType) const {
301  return objects(trigger::TriggerObjectType(triggerObjectType));
302  }; // for backward compatibility
303 
312  std::vector<std::string> conditionCollections(const std::string& nameAlgorithm) const;
314  TriggerObjectRefVector conditionObjects(const std::string& nameCondition) const;
316  bool objectInCondition(const TriggerObjectRef& objectRef, const std::string& nameCondition) const;
322  bool objectInAlgorithm(const TriggerObjectRef& objectRef, const std::string& nameAlgorithm) const;
325 
329  TriggerFilterRefVector pathModules(const std::string& namePath, bool all = true) const;
331  TriggerFilterRefVector pathFilters(const std::string& namePath, bool firing = true) const;
333  bool filterInPath(const TriggerFilterRef& filterRef, const std::string& namePath, bool firing = true) const;
335  TriggerPathRefVector filterPaths(const TriggerFilterRef& filterRef, bool firing = true) const;
337  std::vector<std::string> filterCollections(const std::string& labelFilter) const;
339  TriggerObjectRefVector filterObjects(const std::string& labelFilter) const;
341  bool objectInFilter(const TriggerObjectRef& objectRef, const std::string& labelFilter) const;
343  TriggerFilterRefVector objectFilters(const TriggerObjectRef& objectRef, bool firing = true) const;
345  TriggerObjectRefVector pathObjects(const std::string& namePath, bool firing = true) const;
347  bool objectInPath(const TriggerObjectRef& objectRef, const std::string& namePath, bool firing = true) const;
349  TriggerPathRefVector objectPaths(const TriggerObjectRef& objectRef, bool firing = true) const;
350 
353  bool addObjectMatchResult(const TriggerObjectMatchRefProd& trigMatches, const std::string& labelMatcher);
354  bool addObjectMatchResult(const edm::Handle<TriggerObjectMatch>& trigMatches, const std::string& labelMatcher) {
355  return addObjectMatchResult(TriggerObjectMatchRefProd(trigMatches), labelMatcher);
356  };
358  const std::string& labelMatcher) {
359  return addObjectMatchResult(TriggerObjectMatchRefProd(trigMatches), labelMatcher);
360  };
362  std::vector<std::string> triggerMatchers() const;
368  const TriggerObjectMatch* triggerObjectMatchResult(const std::string& labelMatcher) const;
369 
371  };
372 
373 } // namespace pat
374 
375 #endif
const TriggerPath * path(const std::string &namePath) const
void setBCurrentAvg(float bCurrentAvg)
Set the CMS magnet current averaged over run.
Definition: TriggerEvent.h:144
Analysis-level L1 trigger algorithm class.
TriggerAlgorithmRefVector acceptedAlgorithmsGtl() const
Get a vector of references to all L1 algorithms succeeding on the GTL board.
std::string nameHltTable_
Name of the HLT trigger table.
Definition: TriggerEvent.h:45
virtual ~TriggerEvent()
Destructor.
Definition: TriggerEvent.h:108
TriggerConditionRefProd conditions_
Reference to pat::TriggerConditionCollection in event.
Definition: TriggerEvent.h:81
void setBCurrentStop(float bCurrentStop)
Set the CMS magnet current at end of run.
Definition: TriggerEvent.h:142
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
bool objectInAlgorithm(const TriggerObjectRef &objectRef, const std::string &nameAlgorithm) const
Checks, if an object was used in a certain algorithm given by name.
void setBeamMode(uint16_t beamMode)
Set the LHC beam mode.
Definition: TriggerEvent.h:128
void setBeamMomentum(uint16_t beamMomentum)
Set the LHC beam momentum.
Definition: TriggerEvent.h:130
edm::RefProd< TriggerObjectCollection > TriggerObjectRefProd
Persistent reference to a TriggerObjectCollection product.
std::map< std::string, TriggerObjectMatchRefProd > TriggerObjectMatchContainer
Container to store references to matches from different producers in the trigger event.
TriggerConditionRefVector acceptedConditions() const
Get a vector of references to all succeeding L1 condition.
const TriggerPathRefVector pathRefs() const
std::vector< std::string > filterCollections(const std::string &labelFilter) const
Get a list of all trigger object collections used in a certain filter given by name.
TriggerConditionRefVector algorithmConditions(const std::string &nameAlgorithm) const
bool physDecl_
PhysicsDeclared GT bit.
Definition: TriggerEvent.h:53
TriggerAlgorithmRefVector objectAlgorithms(const TriggerObjectRef &objectRef) const
Get a vector of references to all algorithms, which have a certain object assigned.
bool conditionInAlgorithm(const TriggerConditionRef &conditionRef, const std::string &nameAlgorithm) const
Checks, if a condition is assigned to a certain algorithm given by name.
bool accept_
Did HLT succeed?
Definition: TriggerEvent.h:49
edm::RefProd< TriggerPathCollection > TriggerPathRefProd
Persistent reference to a TriggerPathCollection product.
Definition: TriggerPath.h:164
bool error_
Was HLT in error?
Definition: TriggerEvent.h:51
std::vector< TriggerAlgorithm > TriggerAlgorithmCollection
Collection of TriggerAlgorithm.
TriggerPathRefVector objectPaths(const TriggerObjectRef &objectRef, bool firing=true) const
Get a vector of references to all paths, which have a certain object assigned.
unsigned indexCondition(const std::string &nameCondition) const
TriggerAlgorithmRefVector physAlgorithms() const
Get a vector of references to all physics L1 algorithms.
void setRun(bool run)
Set the run flag.
Definition: TriggerEvent.h:118
void setAccept(bool accept)
Set the success flag.
Definition: TriggerEvent.h:120
void setIntensityBeam2(uint32_t intensityBeam2)
Set the LHC beam 2 intensity.
Definition: TriggerEvent.h:134
const TriggerCondition * condition(const std::string &nameCondition) const
edm::RefProd< TriggerObjectMatch > TriggerObjectMatchRefProd
Persistent reference to a TriggerObjectMatch product.
TriggerConditionRefVector objectConditions(const TriggerObjectRef &objectRef) const
Get a vector of references to all conditions, which have a certain object assigned.
TriggerAlgorithmRefVector acceptedPhysAlgorithmsGtl() const
Get a vector of references to all physics L1 algorithms succeeding on the GTL board.
uint16_t bstMasterStatus() const
Get the LHC master status.
Definition: TriggerEvent.h:168
std::string nameL1Menu_
Data Members.
Definition: TriggerEvent.h:43
const TriggerObjectMatchContainer * triggerObjectMatchResults() const
Get all trigger matches.
Definition: TriggerEvent.h:364
void setConditions(const edm::Handle< TriggerConditionCollection > &handleTriggerConditions)
Definition: TriggerEvent.h:220
TriggerEvent()
Constructors and Desctructor.
Definition: TriggerEvent.cc:11
TriggerPathRefProd paths_
Reference to pat::TriggerPathCollection in event.
Definition: TriggerEvent.h:83
uint16_t beamMomentum() const
Get the LHC beam momentum.
Definition: TriggerEvent.h:162
float bCurrentStop() const
Get the CMS magnet current at end of run.
Definition: TriggerEvent.h:174
bool filterInPath(const TriggerFilterRef &filterRef, const std::string &namePath, bool firing=true) const
Checks, if a filter is assigned to and was run in a certain path given by name.
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
unsigned indexFilter(const std::string &labelFilter) const
TriggerAlgorithmRefVector acceptedAlgorithms() const
Get a vector of references to all succeeding L1 algorithms.
void setAlgorithms(const edm::Handle< TriggerAlgorithmCollection > &handleTriggerAlgorithms)
Definition: TriggerEvent.h:180
void setNameL1Menu(const std::string &name)
Methods.
Definition: TriggerEvent.h:114
uint16_t beamMode() const
Get the LHC beam mode.
Definition: TriggerEvent.h:160
const TriggerPathRef pathRef(const std::string &namePath) const
float bCurrentStart_
CMS magnet current in ??? at start of run.
Definition: TriggerEvent.h:71
TriggerAlgorithmRefVector acceptedPhysAlgorithms() const
Get a vector of references to all succeeding physics L1 algorithms.
TriggerAlgorithmRefProd algorithms_
Definition: TriggerEvent.h:79
TriggerFilterRefVector acceptedFilters() const
Get a vector of references to all succeeding HLT filters.
uint32_t lhcFill_
LHC fill number.
Definition: TriggerEvent.h:55
void setFilters(const edm::Handle< TriggerFilterCollection > &handleTriggerFilters)
Definition: TriggerEvent.h:266
std::vector< std::string > triggerMatchers() const
Get a list of all linked trigger matches.
Definition: HeavyIon.h:7
unsigned indexAlgorithm(const std::string &nameAlgorithm) const
const TriggerAlgorithmCollection * algorithms() const
Definition: TriggerEvent.h:185
TriggerAlgorithmRefVector acceptedTechAlgorithms() const
Get a vector of references to all succeeding technical L1 algorithms.
TriggerPathRefVector filterPaths(const TriggerFilterRef &filterRef, bool firing=true) const
Get a vector of references to all paths, which have a certain filter assigned.
TriggerObjectRefVector conditionObjects(const std::string &nameCondition) const
Get a vector of references to all objects, which were used in a certain condition given by name...
uint32_t lhcFill() const
Get the LHC fill number.
Definition: TriggerEvent.h:158
Analysis-level HLTrigger filter class.
Definition: TriggerFilter.h:33
const TriggerObjectMatch * triggerObjectMatchResult(const std::string &labelMatcher) const
TriggerObjectRefVector objects(int triggerObjectType) const
Definition: TriggerEvent.h:300
unsigned indexPath(const std::string &namePath) const
uint32_t intensityBeam2() const
Get the LHC beam 2 intensity.
Definition: TriggerEvent.h:166
TriggerAlgorithmRefVector acceptedTechAlgorithmsGtl() const
Get a vector of references to all technical L1 algorithms succeeding on the GTL board.
Analysis-level L1 trigger condition class.
bool addObjectMatchResult(const TriggerObjectMatchRefProd &trigMatches, const std::string &labelMatcher)
const std::string & nameL1Menu() const
Get the name of the L1 trigger menu.
Definition: TriggerEvent.h:146
std::vector< TriggerCondition > TriggerConditionCollection
Collection of TriggerCondition.
bool wasRun() const
Get the run flag.
Definition: TriggerEvent.h:150
TriggerFilterRefVector pathFilters(const std::string &namePath, bool firing=true) const
Get a vector of references to all active HLT filters assigned to a certain path given by name...
float bCurrentAvg_
CMS magnet current in ??? averaged over run.
Definition: TriggerEvent.h:75
void setPaths(const edm::Handle< TriggerPathCollection > &handleTriggerPaths)
Definition: TriggerEvent.h:243
uint32_t turnCount() const
Get the LHC beam turn counter.
Definition: TriggerEvent.h:170
TriggerObjectRefVector algorithmObjects(const std::string &nameAlgorithm) const
Get a vector of references to all objects, which were used in a certain algorithm given by name...
bool wasError() const
Get the error flag.
Definition: TriggerEvent.h:154
std::vector< std::string > conditionCollections(const std::string &nameAlgorithm) const
Get a list of all trigger object collections used in a certain condition given by name...
TriggerFilterRefVector objectFilters(const TriggerObjectRef &objectRef, bool firing=true) const
Get a vector of references to all filters, which have a certain object assigned.
uint32_t intensityBeam1() const
Get the LHC beam 1 intensity.
Definition: TriggerEvent.h:164
void setNameHltTable(const std::string &name)
Set the name of the HLT trigger table.
Definition: TriggerEvent.h:116
TriggerObjectRefVector pathObjects(const std::string &namePath, bool firing=true) const
Get a vector of references to all objects, which were used in a certain path given by name...
bool addObjectMatchResult(const edm::Handle< TriggerObjectMatch > &trigMatches, const std::string &labelMatcher)
Definition: TriggerEvent.h:354
const TriggerFilter * filter(const std::string &labelFilter) const
uint32_t intensityBeam1_
LHC beam 1 intensity in ???
Definition: TriggerEvent.h:62
TriggerFilterRefProd filters_
Reference to pat::TriggerAlgorithmCollection in event.
Definition: TriggerEvent.h:85
Analysis-level trigger event class.
Definition: TriggerEvent.h:39
void setBstMasterStatus(uint16_t bstMasterStatus)
Set the LHC master status.
Definition: TriggerEvent.h:136
std::vector< TriggerPath > TriggerPathCollection
Collection of TriggerPath.
Definition: TriggerPath.h:160
product_type const * get() const
Definition: RefProd.h:106
bool objectInFilter(const TriggerObjectRef &objectRef, const std::string &labelFilter) const
Checks, if an object was used in a certain filter given by name.
const TriggerObjectRefVector objectRefs() const
uint32_t intensityBeam2_
LHC beam 2 intensity in ???
Definition: TriggerEvent.h:64
uint16_t beamMomentum_
LHC beam momentum in GeV.
Definition: TriggerEvent.h:60
float bCurrentAvg() const
Get the CMS magnet current averaged over run.
Definition: TriggerEvent.h:176
edm::RefProd< TriggerAlgorithmCollection > TriggerAlgorithmRefProd
Persistent reference to a TriggerAlgorithmCollection product.
void setBCurrentStart(float bCurrentStart)
Set the CMS magnet current at start of run.
Definition: TriggerEvent.h:140
bool addObjectMatchResult(const edm::OrphanHandle< TriggerObjectMatch > &trigMatches, const std::string &labelMatcher)
Definition: TriggerEvent.h:357
void setLhcFill(uint32_t lhcFill)
Set the LHC fill number.
Definition: TriggerEvent.h:126
bool objectInCondition(const TriggerObjectRef &objectRef, const std::string &nameCondition) const
Checks, if an object was used in a certain condition given by name.
uint16_t bstMasterStatus_
Definition: TriggerEvent.h:67
const TriggerFilterRef filterRef(const std::string &labelFilter) const
TriggerObjectRefVector filterObjects(const std::string &labelFilter) const
Get a vector of references to all objects, which were used in a certain filter given by name...
const TriggerConditionCollection * conditions() const
Definition: TriggerEvent.h:225
TriggerAlgorithmRefVector techAlgorithms() const
Get a vector of references to all technical L1 algorithms.
uint16_t beamMode_
Definition: TriggerEvent.h:58
float bCurrentStop_
CMS magnet current in ??? at end of run.
Definition: TriggerEvent.h:73
void setTurnCount(uint32_t turnCount)
Set the LHC beam turn counter.
Definition: TriggerEvent.h:138
TriggerPathRefVector acceptedPaths() const
Get a vector of references to all succeeding HLT paths.
std::string nameAlgorithm(const unsigned bitAlgorithm, const bool techAlgorithm=true) const
bool wasAccept() const
Get the success flag.
Definition: TriggerEvent.h:152
TriggerObjectRefProd objects_
Reference to pat::TriggerObjectCollection in event.
Definition: TriggerEvent.h:87
const TriggerAlgorithmRefVector algorithmRefs() const
Definition: TriggerEvent.cc:77
const TriggerConditionRef conditionRef(const std::string &nameCondition) const
void setObjects(const edm::Handle< TriggerObjectCollection > &handleTriggerObjects)
Definition: TriggerEvent.h:289
uint32_t turnCount_
LHC beam turn counter.
Definition: TriggerEvent.h:69
TriggerObjectMatchContainer objectMatchResults_
Table of references to pat::TriggerObjectMatch associations in event.
Definition: TriggerEvent.h:89
bool run_
Was HLT run?
Definition: TriggerEvent.h:47
bool objectInPath(const TriggerObjectRef &objectRef, const std::string &namePath, bool firing=true) const
Checks, if an object was used in a certain path given by name.
TriggerFilterRefVector pathModules(const std::string &namePath, bool all=true) const
void setPhysDecl(bool physDecl)
Set the PhysicsDeclared GT bit.
Definition: TriggerEvent.h:124
float bCurrentStart() const
Get the CMS magnet current at start of run.
Definition: TriggerEvent.h:172
const std::string & nameHltTable() const
Get the name of the HLT trigger table.
Definition: TriggerEvent.h:148
std::vector< TriggerObject > TriggerObjectCollection
Collection of TriggerObject.
const TriggerAlgorithm * algorithm(const std::string &nameAlgorithm) const
Definition: TriggerEvent.cc:89
const TriggerFilterCollection * filters() const
Definition: TriggerEvent.h:271
std::vector< TriggerFilter > TriggerFilterCollection
Collection of TriggerFilter.
const TriggerObjectCollection * objects() const
Definition: TriggerEvent.h:294
const TriggerAlgorithmRef algorithmRef(const std::string &nameAlgorithm) const
Definition: TriggerEvent.cc:99
void setError(bool error)
Set the error flag.
Definition: TriggerEvent.h:122
const TriggerPathCollection * paths() const
Definition: TriggerEvent.h:248
const TriggerConditionRefVector conditionRefs() const
bool wasPhysDecl() const
Get the PhysicsDeclared GT bit.
Definition: TriggerEvent.h:156
edm::RefProd< TriggerFilterCollection > TriggerFilterRefProd
Persistent reference to a TriggerFilterCollection product.
void setIntensityBeam1(uint32_t intensityBeam1)
Set the LHC beam 1 intensity.
Definition: TriggerEvent.h:132
const TriggerFilterRefVector filterRefs() const
edm::RefProd< TriggerConditionCollection > TriggerConditionRefProd
Persistent reference to a TriggerConditionCollection product.
TriggerAlgorithmRefVector conditionAlgorithms(const TriggerConditionRef &conditionRef) const
Get a vector of references to all algorithms, which have a certain condition assigned.