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 () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
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
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 80 of file PrescalerFHN.cc.

References DQMScaleToClient_cfi::factor, edm::ParameterSet::getParameter(), Skims_PA_cff::name, hltrates_dqm_sourceclient-live_cfg::prescales, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 96 of file PrescalerFHN.cc.

96  {
97  // do anything here that needs to be done at desctruction time
98  // (e.g. close files, deallocate resources etc.)
99 }

Member Function Documentation

void PrescalerFHN::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 166 of file PrescalerFHN.cc.

166 {}
void PrescalerFHN::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 169 of file PrescalerFHN.cc.

References DEFINE_FWK_MODULE.

Referenced by o2olib.O2ORunMgr::executeJob().

169 {}
bool PrescalerFHN::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 120 of file PrescalerFHN.cc.

References edm::HLTGlobalStatus::accept(), edm::Event::getByToken(), init, edm::HandleBase::isValid(), LogDebug, edm::TriggerNames::parameterSetID(), hltrates_dqm_sourceclient-live_cfg::prescales, edm::HLTGlobalStatus::size(), L1TEGammaOffline_cfi::triggerNames, 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().

120  {
121  using namespace edm;
122 
123  /* Goal for this skim:
124  Prescaling MET HLT paths
125  Option to turn off HSCP filter
126  - Doing that by treating it as an HLT with prescale 1
127  */
128 
129  // Trying to mirror HLTrigger/HLTfilters/src/HLTHighLevel.cc where possible
130 
132  iEvent.getByToken(tok_trigger, trh);
133 
134  if (trh.isValid()) {
135  LogDebug("") << "TriggerResults found, number of HLT paths: " << trh->size();
136  } else {
137  LogDebug("") << "TriggerResults product not found - returning result=false!";
138  return false;
139  }
140 
141  const edm::TriggerNames& triggerNames = iEvent.triggerNames(*trh);
142  if (triggerNamesID_ != triggerNames.parameterSetID()) {
143  triggerNamesID_ = triggerNames.parameterSetID();
144  init(*trh, triggerNames);
145  }
146 
147  // Trigger indices are ready at this point
148  // - Begin checking for HLT bits
149 
150  bool accept_event = false;
151  for (std::map<std::string, unsigned int>::const_iterator cit = trigger_indices.begin(); cit != trigger_indices.end();
152  cit++) {
153  if (trh->accept(cit->second)) {
154  prescale_counter[cit->first]++;
155  if (prescale_counter[cit->first] >= prescales[cit->first]) {
156  accept_event = true;
157  prescale_counter[cit->first] = 0;
158  }
159  }
160  }
161 
162  return accept_event;
163 }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
bool accept() const
Has at least one path accepted the event?
edm::ParameterSetID triggerNamesID_
Definition: PrescalerFHN.cc:59
void init(const edm::TriggerResults &, const edm::TriggerNames &triggerNames)
ParameterSetID const & parameterSetID() const
Definition: TriggerNames.cc:33
std::map< std::string, unsigned int > prescales
Definition: PrescalerFHN.cc:63
std::map< std::string, unsigned int > prescale_counter
Definition: PrescalerFHN.cc:64
unsigned int size() const
Get number of paths stored.
std::map< std::string, unsigned int > trigger_indices
Definition: PrescalerFHN.cc:66
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< TriggerResults > tok_trigger
Definition: PrescalerFHN.cc:61
HLT enums.
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:265
void PrescalerFHN::init ( const edm::TriggerResults result,
const edm::TriggerNames triggerNames 
)
private

Definition at line 105 of file PrescalerFHN.cc.

References LogDebug, hltrates_dqm_sourceclient-live_cfg::prescales, edm::HLTGlobalStatus::size(), and edm::TriggerNames::triggerIndex().

105  {
106  trigger_indices.clear();
107 
108  for (std::map<std::string, unsigned int>::const_iterator cit = prescales.begin(); cit != prescales.end(); cit++) {
109  trigger_indices[cit->first] = triggerNames.triggerIndex(cit->first);
110 
111  if (trigger_indices[cit->first] >= result.size()) {
112  // trigger path not found
113  LogDebug("") << "requested HLT path does not exist: " << cit->first;
114  trigger_indices.erase(cit->first);
115  }
116  }
117 }
#define LogDebug(id)
std::map< std::string, unsigned int > prescales
Definition: PrescalerFHN.cc:63
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:24
unsigned int size() const
Get number of paths stored.
std::map< std::string, unsigned int > trigger_indices
Definition: PrescalerFHN.cc:66

Member Data Documentation

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

Definition at line 64 of file PrescalerFHN.cc.

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

Definition at line 63 of file PrescalerFHN.cc.

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

Definition at line 61 of file PrescalerFHN.cc.

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

Definition at line 66 of file PrescalerFHN.cc.

edm::ParameterSetID PrescalerFHN::triggerNamesID_
private

Definition at line 59 of file PrescalerFHN.cc.