CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PrescalerFHN Class Reference
Inheritance diagram for PrescalerFHN:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PrescalerFHN (const edm::ParameterSet &)
 
 ~PrescalerFHN ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void beginJob () override
 
virtual void endJob () override
 
virtual bool filter (edm::Event &, const edm::EventSetup &) override
 
void init (const edm::TriggerResults &, const edm::TriggerNames &triggerNames)
 

Private Attributes

std::map< std::string, unsigned int > prescale_counter
 
std::map< std::string, unsigned int > prescales
 
edm::EDGetTokenT< TriggerResultstok_trigger
 
std::map< std::string, unsigned int > trigger_indices
 
edm::ParameterSetID triggerNamesID_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 46 of file PrescalerFHN.cc.

Constructor & Destructor Documentation

PrescalerFHN::PrescalerFHN ( const edm::ParameterSet iConfig)
explicit

Definition at line 81 of file PrescalerFHN.cc.

References edm::ParameterSet::getParameter(), dataset::name, and AlCaHLTBitMon_QueryRunRegistry::string.

82 {
83  tok_trigger = consumes<TriggerResults>(iConfig.getParameter<edm::InputTag>("TriggerResultsTag"));
84  //now do what ever initialization is needed
85  std::vector<edm::ParameterSet> prescales_in(iConfig.getParameter<std::vector<edm::ParameterSet> >("Prescales"));
86 
87  for (std::vector<edm::ParameterSet>::const_iterator cit = prescales_in.begin();
88  cit != prescales_in.end(); cit++) {
89 
90  std::string name(cit->getParameter<std::string>("HLTName"));
91  unsigned int factor(cit->getParameter<unsigned int>("PrescaleFactor"));
92 
93  // does some exception get thrown if parameters aren't available? should test...
94 
95  prescales[name] = factor;
97  }
98 
99 }
T getParameter(std::string const &) const
std::map< std::string, unsigned int > prescales
Definition: PrescalerFHN.cc:64
std::map< std::string, unsigned int > prescale_counter
Definition: PrescalerFHN.cc:65
edm::EDGetTokenT< TriggerResults > tok_trigger
Definition: PrescalerFHN.cc:62
PrescalerFHN::~PrescalerFHN ( )

Definition at line 102 of file PrescalerFHN.cc.

103 {
104 
105  // do anything here that needs to be done at desctruction time
106  // (e.g. close files, deallocate resources etc.)
107 
108 }

Member Function Documentation

void PrescalerFHN::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 184 of file PrescalerFHN.cc.

185 {
186 }
void PrescalerFHN::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 190 of file PrescalerFHN.cc.

References DEFINE_FWK_MODULE.

Referenced by o2olib.O2ORunMgr::executeJob().

190  {
191 }
bool PrescalerFHN::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Definition at line 136 of file PrescalerFHN.cc.

References edm::HLTGlobalStatus::accept(), edm::Event::getByToken(), StGenEvtProducer_cfi::init, edm::HandleBase::isValid(), LogDebug, edm::TriggerNames::parameterSetID(), edm::HLTGlobalStatus::size(), and edm::Event::triggerNames().

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

137 {
138  using namespace edm;
139 
140  /* Goal for this skim:
141  Prescaling MET HLT paths
142  Option to turn off HSCP filter
143  - Doing that by treating it as an HLT with prescale 1
144  */
145 
146  // Trying to mirror HLTrigger/HLTfilters/src/HLTHighLevel.cc where possible
147 
149  iEvent.getByToken(tok_trigger, trh);
150 
151  if (trh.isValid()) {
152  LogDebug("") << "TriggerResults found, number of HLT paths: " << trh->size();
153  } else {
154  LogDebug("") << "TriggerResults product not found - returning result=false!";
155  return false;
156  }
157 
158  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*trh);
159  if (triggerNamesID_ != triggerNames.parameterSetID()) {
160  triggerNamesID_ = triggerNames.parameterSetID();
161  init(*trh, triggerNames);
162  }
163 
164  // Trigger indices are ready at this point
165  // - Begin checking for HLT bits
166 
167  bool accept_event = false;
168  for (std::map<std::string, unsigned int>::const_iterator cit = trigger_indices.begin();
169  cit != trigger_indices.end(); cit++) {
170  if (trh->accept(cit->second)) {
171  prescale_counter[cit->first]++;
172  if (prescale_counter[cit->first] >= prescales[cit->first]) {
173  accept_event = true;
174  prescale_counter[cit->first] = 0;
175  }
176  }
177  }
178 
179  return accept_event;
180 }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
bool accept() const
Has at least one path accepted the event?
edm::ParameterSetID triggerNamesID_
Definition: PrescalerFHN.cc:60
void init(const edm::TriggerResults &, const edm::TriggerNames &triggerNames)
ParameterSetID const & parameterSetID() const
Definition: TriggerNames.cc:42
std::map< std::string, unsigned int > prescales
Definition: PrescalerFHN.cc:64
std::map< std::string, unsigned int > prescale_counter
Definition: PrescalerFHN.cc:65
unsigned int size() const
Get number of paths stored.
std::map< std::string, unsigned int > trigger_indices
Definition: PrescalerFHN.cc:67
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< TriggerResults > tok_trigger
Definition: PrescalerFHN.cc:62
HLT enums.
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:239
void PrescalerFHN::init ( const edm::TriggerResults result,
const edm::TriggerNames triggerNames 
)
private

Definition at line 115 of file PrescalerFHN.cc.

References LogDebug, edm::HLTGlobalStatus::size(), and edm::TriggerNames::triggerIndex().

117 {
118  trigger_indices.clear();
119 
120  for (std::map<std::string, unsigned int>::const_iterator cit = prescales.begin();
121  cit != prescales.end(); cit++) {
122 
123  trigger_indices[cit->first] = triggerNames.triggerIndex(cit->first);
124 
125  if (trigger_indices[cit->first] >= result.size()) {
126  // trigger path not found
127  LogDebug("") << "requested HLT path does not exist: " << cit->first;
128  trigger_indices.erase(cit->first);
129  }
130 
131  }
132 }
#define LogDebug(id)
std::map< std::string, unsigned int > prescales
Definition: PrescalerFHN.cc:64
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
unsigned int size() const
Get number of paths stored.
std::map< std::string, unsigned int > trigger_indices
Definition: PrescalerFHN.cc:67

Member Data Documentation

std::map<std::string, unsigned int> PrescalerFHN::prescale_counter
private

Definition at line 65 of file PrescalerFHN.cc.

std::map<std::string, unsigned int> PrescalerFHN::prescales
private

Definition at line 64 of file PrescalerFHN.cc.

edm::EDGetTokenT<TriggerResults> PrescalerFHN::tok_trigger
private

Definition at line 62 of file PrescalerFHN.cc.

std::map<std::string, unsigned int> PrescalerFHN::trigger_indices
private

Definition at line 67 of file PrescalerFHN.cc.

edm::ParameterSetID PrescalerFHN::triggerNamesID_
private

Definition at line 60 of file PrescalerFHN.cc.