CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TriggerEvent.h
Go to the documentation of this file.
1 #ifndef DataFormats_PatCandidates_TriggerEvent_h
2 #define DataFormats_PatCandidates_TriggerEvent_h
3 
4 
5 // -*- C++ -*-
6 //
7 // Package: PatCandidates
8 // Class: pat::TriggerEvent
9 //
10 // $Id: TriggerEvent.h,v 1.17 2013/06/11 13:24:49 vadler Exp $
11 //
31 
32 #include <string>
33 #include <vector>
34 #include <boost/cstdint.hpp>
35 
40 
41 
42 namespace pat {
43 
44  class TriggerEvent {
45 
47 
49  std::string nameL1Menu_;
51  std::string nameHltTable_;
53  bool run_;
55  bool accept_;
57  bool error_;
59  bool physDecl_;
61  boost::uint32_t lhcFill_;
64  boost::uint16_t beamMode_;
66  boost::uint16_t beamMomentum_;
68  boost::uint32_t intensityBeam1_;
70  boost::uint32_t intensityBeam2_;
73  boost::uint16_t bstMasterStatus_;
75  boost::uint32_t turnCount_;
81  float bCurrentAvg_;
82 
96 
97  public:
98 
100 
102  TriggerEvent();
104  TriggerEvent( const std::string & nameHltTable, bool run = true, bool accept = true, bool error = false, bool physDecl = true );
106  TriggerEvent( const std::string & nameL1Menu, const std::string & nameHltTable, bool run = true, bool accept = true, bool error = false, bool physDecl = true );
107 
109  virtual ~TriggerEvent() {};
110 
112 
115  void setNameL1Menu( const std::string & name ) { nameL1Menu_ = name; };
117  void setNameHltTable( const std::string & name ) { nameHltTable_ = name; };
119  void setRun( bool run ) { run_ = run; };
121  void setAccept( bool accept ) { accept_ = accept; };
123  void setError( bool error ) { error = error; };
125  void setPhysDecl( bool physDecl ) { physDecl_ = physDecl; };
127  void setLhcFill( boost::uint32_t lhcFill ) { lhcFill_ = lhcFill; };
129  void setBeamMode( boost::uint16_t beamMode ) { beamMode_ = beamMode; };
131  void setBeamMomentum( boost::uint16_t beamMomentum ) { beamMomentum_ = beamMomentum; };
139  void setTurnCount( boost::uint32_t turnCount ) { turnCount_ = turnCount; };
147  const std::string & nameL1Menu() const { return nameL1Menu_; };
149  const std::string & nameHltTable() const { return nameHltTable_; };
151  bool wasRun() const { return run_; };
153  bool wasAccept() const { return accept_; };
155  bool wasError() const { return error_; };
157  bool wasPhysDecl() const { return physDecl_; };
159  boost::uint32_t lhcFill() const { return lhcFill_; };
161  boost::uint16_t beamMode() const { return beamMode_; };
163  boost::uint16_t beamMomentum() const { return beamMomentum_; };
165  boost::uint32_t intensityBeam1() const { return intensityBeam1_; };
167  boost::uint32_t intensityBeam2() const { return intensityBeam2_; };
169  boost::uint16_t bstMasterStatus() const { return bstMasterStatus_; };
171  boost::uint32_t turnCount() const { return turnCount_; };
173  float bCurrentStart() const { return bCurrentStart_; };
175  float bCurrentStop() const { return bCurrentStop_; };
177  float bCurrentAvg() const { return bCurrentAvg_; };
178 
181  void setAlgorithms( const edm::Handle< TriggerAlgorithmCollection > & handleTriggerAlgorithms ) { algorithms_ = TriggerAlgorithmRefProd( handleTriggerAlgorithms ); };
184  const TriggerAlgorithmCollection * algorithms() const { return algorithms_.get(); };
190  const TriggerAlgorithm * algorithm( const std::string & nameAlgorithm ) const;
193  const TriggerAlgorithmRef algorithmRef( const std::string & nameAlgorithm ) const;
196  std::string nameAlgorithm( const unsigned bitAlgorithm, const bool techAlgorithm = true ) const;
199  unsigned indexAlgorithm( const std::string & nameAlgorithm ) const;
216 
219  void setConditions( const edm::Handle< TriggerConditionCollection > & handleTriggerConditions ) { conditions_ = TriggerConditionRefProd( handleTriggerConditions ); };
222  const TriggerConditionCollection * conditions() const { return conditions_.get(); };
228  const TriggerCondition * condition( const std::string & nameCondition ) const;
231  const TriggerConditionRef conditionRef( const std::string & nameCondition ) const;
234  unsigned indexCondition( const std::string & nameCondition ) const;
237 
240  void setPaths( const edm::Handle< TriggerPathCollection > & handleTriggerPaths ) { paths_ = TriggerPathRefProd( handleTriggerPaths ); };
243  const TriggerPathCollection * paths() const { return paths_.get(); };
246  const TriggerPathRefVector pathRefs() const;
249  const TriggerPath * path( const std::string & namePath ) const;
252  const TriggerPathRef pathRef( const std::string & namePath ) const;
255  unsigned indexPath( const std::string & namePath ) const;
258 
261  void setFilters( const edm::Handle< TriggerFilterCollection > & handleTriggerFilters ) { filters_ = TriggerFilterRefProd( handleTriggerFilters ); };
264  const TriggerFilterCollection * filters() const { return filters_.get(); };
267  const TriggerFilterRefVector filterRefs() const;
270  const TriggerFilter * filter( const std::string & labelFilter ) const;
273  const TriggerFilterRef filterRef( const std::string & labelFilter ) const;
276  unsigned indexFilter( const std::string & labelFilter ) const;
279 
282  void setObjects( const edm::Handle< TriggerObjectCollection > & handleTriggerObjects ) { objects_ = TriggerObjectRefProd( handleTriggerObjects ); };
285  const TriggerObjectCollection * objects() const { return objects_.get(); };
288  const TriggerObjectRefVector objectRefs() const;
290  TriggerObjectRefVector objects( trigger::TriggerObjectType triggerObjectType ) const;
291  TriggerObjectRefVector objects( int triggerObjectType ) const { return objects( trigger::TriggerObjectType( triggerObjectType ) ); }; // for backward compatibility
292 
295  TriggerConditionRefVector algorithmConditions( const std::string & nameAlgorithm ) const;
297  bool conditionInAlgorithm( const TriggerConditionRef & conditionRef, const std::string & nameAlgorithm ) const;
301  std::vector< std::string > conditionCollections( const std::string & nameAlgorithm ) const;
303  TriggerObjectRefVector conditionObjects( const std::string & nameCondition ) const;
305  bool objectInCondition( const TriggerObjectRef & objectRef, const std::string & nameCondition ) const;
309  TriggerObjectRefVector algorithmObjects( const std::string & nameAlgorithm ) const;
311  bool objectInAlgorithm( const TriggerObjectRef & objectRef, const std::string & nameAlgorithm ) const;
314 
318  TriggerFilterRefVector pathModules( const std::string & namePath, bool all = true ) const;
320  TriggerFilterRefVector pathFilters( const std::string & namePath, bool firing = true ) const;
322  bool filterInPath( const TriggerFilterRef & filterRef, const std::string & namePath, bool firing = true ) const;
324  TriggerPathRefVector filterPaths( const TriggerFilterRef & filterRef, bool firing = true ) const;
326  std::vector< std::string > filterCollections( const std::string & labelFilter ) const;
328  TriggerObjectRefVector filterObjects( const std::string & labelFilter ) const;
330  bool objectInFilter( const TriggerObjectRef & objectRef, const std::string & labelFilter ) const;
332  TriggerFilterRefVector objectFilters( const TriggerObjectRef & objectRef, bool firing = true ) const;
334  TriggerObjectRefVector pathObjects( const std::string & namePath, bool firing = true ) const;
336  bool objectInPath( const TriggerObjectRef & objectRef, const std::string & namePath, bool firing = true ) const;
338  TriggerPathRefVector objectPaths( const TriggerObjectRef & objectRef, bool firing = true ) const;
339 
342  bool addObjectMatchResult( const TriggerObjectMatchRefProd & trigMatches, const std::string & labelMatcher );
343  bool addObjectMatchResult( const edm::Handle< TriggerObjectMatch > & trigMatches, const std::string & labelMatcher ) { return addObjectMatchResult( TriggerObjectMatchRefProd( trigMatches ), labelMatcher ); };
344  bool addObjectMatchResult( const edm::OrphanHandle< TriggerObjectMatch > & trigMatches, const std::string & labelMatcher ) { return addObjectMatchResult( TriggerObjectMatchRefProd( trigMatches ), labelMatcher ); };
346  std::vector< std::string > triggerMatchers() const;
352  const TriggerObjectMatch * triggerObjectMatchResult( const std::string & labelMatcher ) const;
353 
355 
356  };
357 
358 }
359 
360 
361 #endif
const TriggerObjectMatchContainer * triggerObjectMatchResults() const
Get all trigger matches.
Definition: TriggerEvent.h:348
void setBeamMode(boost::uint16_t beamMode)
Set the LHC beam mode.
Definition: TriggerEvent.h:129
bool wasAccept() const
Get the success flag.
Definition: TriggerEvent.h:153
TriggerConditionRefVector algorithmConditions(const std::string &nameAlgorithm) const
edm::RefProd< TriggerObjectMatch > TriggerObjectMatchRefProd
Persistent reference to a TriggerObjectMatch product.
void setBCurrentAvg(float bCurrentAvg)
Set the CMS magnet current averaged over run.
Definition: TriggerEvent.h:145
Analysis-level L1 trigger algorithm class.
TriggerAlgorithmRefVector physAlgorithms() const
Get a vector of references to all physics L1 algorithms.
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:51
TriggerConditionRefVector objectConditions(const TriggerObjectRef &objectRef) const
Get a vector of references to all conditions, which have a certain object assigned.
virtual ~TriggerEvent()
Destructor.
Definition: TriggerEvent.h:109
TriggerConditionRefProd conditions_
Reference to pat::TriggerConditionCollection in event.
Definition: TriggerEvent.h:87
const TriggerObjectRefVector objectRefs() const
void setBCurrentStop(float bCurrentStop)
Set the CMS magnet current at end of run.
Definition: TriggerEvent.h:143
boost::uint16_t beamMomentum() const
Get the LHC beam momentum.
Definition: TriggerEvent.h:163
boost::uint16_t beamMode_
Definition: TriggerEvent.h:64
const std::string & nameHltTable() const
Get the name of the HLT trigger table.
Definition: TriggerEvent.h:149
boost::uint16_t beamMomentum_
LHC beam momentum in GeV.
Definition: TriggerEvent.h:66
std::vector< std::string > triggerMatchers() const
Get a list of all linked trigger matches.
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.
bool physDecl_
PhysicsDeclared GT bit.
Definition: TriggerEvent.h:59
bool accept_
Did HLT succeed?
Definition: TriggerEvent.h:55
bool error_
Was HLT in error?
Definition: TriggerEvent.h:57
const TriggerPathRef pathRef(const std::string &namePath) const
const TriggerCondition * condition(const std::string &nameCondition) const
const TriggerConditionCollection * conditions() const
Definition: TriggerEvent.h:222
void setRun(bool run)
Set the run flag.
Definition: TriggerEvent.h:119
void setAccept(bool accept)
Set the success flag.
Definition: TriggerEvent.h:121
TriggerFilterRefVector acceptedFilters() const
Get a vector of references to all succeeding HLT filters.
edm::RefProd< TriggerObjectCollection > TriggerObjectRefProd
Persistent reference to a TriggerObjectCollection product.
const TriggerFilterRefVector filterRefs() const
TriggerAlgorithmRefVector acceptedTechAlgorithms() const
Get a vector of references to all succeeding technical L1 algorithms.
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...
std::string nameL1Menu_
Data Members.
Definition: TriggerEvent.h:49
void setConditions(const edm::Handle< TriggerConditionCollection > &handleTriggerConditions)
Definition: TriggerEvent.h:219
TriggerEvent()
Constructors and Desctructor.
Definition: TriggerEvent.cc:16
TriggerPathRefProd paths_
Reference to pat::TriggerPathCollection in event.
Definition: TriggerEvent.h:89
TriggerAlgorithmRefVector objectAlgorithms(const TriggerObjectRef &objectRef) const
Get a vector of references to all algorithms, which have a certain object assigned.
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:22
const TriggerPathCollection * paths() const
Definition: TriggerEvent.h:243
unsigned indexFilter(const std::string &labelFilter) const
const std::string & nameL1Menu() const
Get the name of the L1 trigger menu.
Definition: TriggerEvent.h:147
void setIntensityBeam2(boost::uint32_t intensityBeam2)
Set the LHC beam 2 intensity.
Definition: TriggerEvent.h:135
TriggerFilterRefVector pathModules(const std::string &namePath, bool all=true) const
void setAlgorithms(const edm::Handle< TriggerAlgorithmCollection > &handleTriggerAlgorithms)
Definition: TriggerEvent.h:181
void setNameL1Menu(const std::string &name)
Methods.
Definition: TriggerEvent.h:115
bool objectInAlgorithm(const TriggerObjectRef &objectRef, const std::string &nameAlgorithm) const
Checks, if an object was used in a certain algorithm given by name.
float bCurrentStart_
CMS magnet current in ??? at start of run.
Definition: TriggerEvent.h:77
TriggerConditionRefVector acceptedConditions() const
Get a vector of references to all succeeding L1 condition.
TriggerAlgorithmRefProd algorithms_
Definition: TriggerEvent.h:85
void setFilters(const edm::Handle< TriggerFilterCollection > &handleTriggerFilters)
Definition: TriggerEvent.h:261
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...
void setLhcFill(boost::uint32_t lhcFill)
Set the LHC fill number.
Definition: TriggerEvent.h:127
std::vector< TriggerAlgorithm > TriggerAlgorithmCollection
Collection of TriggerAlgorithm.
const TriggerObjectCollection * objects() const
Definition: TriggerEvent.h:285
unsigned indexAlgorithm(const std::string &nameAlgorithm) const
Analysis-level HLTrigger filter class.
Definition: TriggerFilter.h:37
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 wasPhysDecl() const
Get the PhysicsDeclared GT bit.
Definition: TriggerEvent.h:157
boost::uint16_t bstMasterStatus_
Definition: TriggerEvent.h:73
unsigned indexCondition(const std::string &nameCondition) const
Analysis-level L1 trigger condition class.
Analysis-level HLTrigger path class.
Definition: TriggerPath.h:41
bool addObjectMatchResult(const TriggerObjectMatchRefProd &trigMatches, const std::string &labelMatcher)
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...
boost::uint32_t intensityBeam1() const
Get the LHC beam 1 intensity.
Definition: TriggerEvent.h:165
const TriggerPath * path(const std::string &namePath) const
const TriggerFilterRef filterRef(const std::string &labelFilter) const
boost::uint32_t intensityBeam2() const
Get the LHC beam 2 intensity.
Definition: TriggerEvent.h:167
TriggerAlgorithmRefVector techAlgorithms() const
Get a vector of references to all technical L1 algorithms.
float bCurrentAvg_
CMS magnet current in ??? averaged over run.
Definition: TriggerEvent.h:81
void setPaths(const edm::Handle< TriggerPathCollection > &handleTriggerPaths)
Definition: TriggerEvent.h:240
boost::uint32_t lhcFill_
LHC fill number.
Definition: TriggerEvent.h:61
bool objectInCondition(const TriggerObjectRef &objectRef, const std::string &nameCondition) const
Checks, if an object was used in a certain condition given by name.
edm::RefProd< TriggerConditionCollection > TriggerConditionRefProd
Persistent reference to a TriggerConditionCollection product.
boost::uint16_t bstMasterStatus() const
Get the LHC master status.
Definition: TriggerEvent.h:169
TriggerAlgorithmRefVector acceptedPhysAlgorithms() const
Get a vector of references to all succeeding physics L1 algorithms.
const TriggerAlgorithmCollection * algorithms() const
Definition: TriggerEvent.h:184
void setNameHltTable(const std::string &name)
Set the name of the HLT trigger table.
Definition: TriggerEvent.h:117
float bCurrentAvg() const
Get the CMS magnet current averaged over run.
Definition: TriggerEvent.h:177
TriggerAlgorithmRefVector acceptedAlgorithms() const
Get a vector of references to all succeeding L1 algorithms.
bool addObjectMatchResult(const edm::Handle< TriggerObjectMatch > &trigMatches, const std::string &labelMatcher)
Definition: TriggerEvent.h:343
const TriggerObjectMatch * triggerObjectMatchResult(const std::string &labelMatcher) const
TriggerFilterRefVector objectFilters(const TriggerObjectRef &objectRef, bool firing=true) const
Get a vector of references to all filters, which have a certain object assigned.
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...
TriggerAlgorithmRefVector conditionAlgorithms(const TriggerConditionRef &conditionRef) const
Get a vector of references to all algorithms, which have a certain condition assigned.
TriggerFilterRefProd filters_
Reference to pat::TriggerAlgorithmCollection in event.
Definition: TriggerEvent.h:91
std::string nameAlgorithm(const unsigned bitAlgorithm, const bool techAlgorithm=true) const
Analysis-level trigger event class.
Definition: TriggerEvent.h:44
boost::uint32_t turnCount() const
Get the LHC beam turn counter.
Definition: TriggerEvent.h:171
const TriggerAlgorithmRef algorithmRef(const std::string &nameAlgorithm) const
std::vector< TriggerFilter > TriggerFilterCollection
Collection of TriggerFilter.
void setTurnCount(boost::uint32_t turnCount)
Set the LHC beam turn counter.
Definition: TriggerEvent.h:139
TriggerPathRefVector objectPaths(const TriggerObjectRef &objectRef, bool firing=true) const
Get a vector of references to all paths, which have a certain object assigned.
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.
const TriggerFilterCollection * filters() const
Definition: TriggerEvent.h:264
bool objectInFilter(const TriggerObjectRef &objectRef, const std::string &labelFilter) const
Checks, if an object was used in a certain filter given by name.
edm::RefProd< TriggerAlgorithmCollection > TriggerAlgorithmRefProd
Persistent reference to a TriggerAlgorithmCollection product.
void setBeamMomentum(boost::uint16_t beamMomentum)
Set the LHC beam momentum.
Definition: TriggerEvent.h:131
bool wasError() const
Get the error flag.
Definition: TriggerEvent.h:155
const TriggerAlgorithmRefVector algorithmRefs() const
Definition: TriggerEvent.cc:88
float bCurrentStart() const
Get the CMS magnet current at start of run.
Definition: TriggerEvent.h:173
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...
void setBCurrentStart(float bCurrentStart)
Set the CMS magnet current at start of run.
Definition: TriggerEvent.h:141
bool addObjectMatchResult(const edm::OrphanHandle< TriggerObjectMatch > &trigMatches, const std::string &labelMatcher)
Definition: TriggerEvent.h:344
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...
product_type const * get() const
Definition: RefProd.h:116
boost::uint32_t intensityBeam1_
LHC beam 1 intensity in ???
Definition: TriggerEvent.h:68
boost::uint32_t turnCount_
LHC beam turn counter.
Definition: TriggerEvent.h:75
TriggerAlgorithmRefVector acceptedPhysAlgorithmsGtl() const
Get a vector of references to all physics L1 algorithms succeeding on the GTL board.
TriggerAlgorithmRefVector acceptedTechAlgorithmsGtl() const
Get a vector of references to all technical L1 algorithms succeeding on the GTL board.
const TriggerConditionRefVector conditionRefs() const
float bCurrentStop_
CMS magnet current in ??? at end of run.
Definition: TriggerEvent.h:79
void setIntensityBeam1(boost::uint32_t intensityBeam1)
Set the LHC beam 1 intensity.
Definition: TriggerEvent.h:133
TriggerObjectRefVector objects(int triggerObjectType) const
Definition: TriggerEvent.h:291
std::vector< TriggerObject > TriggerObjectCollection
Collection of TriggerObject.
const TriggerAlgorithm * algorithm(const std::string &nameAlgorithm) const
TriggerPathRefVector filterPaths(const TriggerFilterRef &filterRef, bool firing=true) const
Get a vector of references to all paths, which have a certain filter assigned.
std::vector< TriggerCondition > TriggerConditionCollection
Collection of TriggerCondition.
TriggerObjectRefProd objects_
Reference to pat::TriggerObjectCollection in event.
Definition: TriggerEvent.h:93
const TriggerFilter * filter(const std::string &labelFilter) const
bool conditionInAlgorithm(const TriggerConditionRef &conditionRef, const std::string &nameAlgorithm) const
Checks, if a condition is assigned to a certain algorithm given by name.
void setObjects(const edm::Handle< TriggerObjectCollection > &handleTriggerObjects)
Definition: TriggerEvent.h:282
edm::RefProd< TriggerFilterCollection > TriggerFilterRefProd
Persistent reference to a TriggerFilterCollection product.
TriggerObjectMatchContainer objectMatchResults_
Table of references to pat::TriggerObjectMatch associations in event.
Definition: TriggerEvent.h:95
edm::RefProd< TriggerPathCollection > TriggerPathRefProd
Persistent reference to a TriggerPathCollection product.
Definition: TriggerPath.h:159
bool run_
Was HLT run?
Definition: TriggerEvent.h:53
boost::uint32_t lhcFill() const
Get the LHC fill number.
Definition: TriggerEvent.h:159
std::map< std::string, TriggerObjectMatchRefProd > TriggerObjectMatchContainer
Container to store references to matches from different producers in the trigger event.
void setPhysDecl(bool physDecl)
Set the PhysicsDeclared GT bit.
Definition: TriggerEvent.h:125
std::vector< TriggerPath > TriggerPathCollection
Collection of TriggerPath.
Definition: TriggerPath.h:155
const TriggerConditionRef conditionRef(const std::string &nameCondition) const
TriggerPathRefVector acceptedPaths() const
Get a vector of references to all succeeding HLT paths.
boost::uint16_t beamMode() const
Get the LHC beam mode.
Definition: TriggerEvent.h:161
void setError(bool error)
Set the error flag.
Definition: TriggerEvent.h:123
unsigned indexPath(const std::string &namePath) const
void setBstMasterStatus(boost::uint16_t bstMasterStatus)
Set the LHC master status.
Definition: TriggerEvent.h:137
boost::uint32_t intensityBeam2_
LHC beam 2 intensity in ???
Definition: TriggerEvent.h:70
bool wasRun() const
Get the run flag.
Definition: TriggerEvent.h:151
const TriggerPathRefVector pathRefs() const
float bCurrentStop() const
Get the CMS magnet current at end of run.
Definition: TriggerEvent.h:175