CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PrescalerFHN Class Reference
Inheritance diagram for PrescalerFHN:
edm::one::EDFilter<> edm::one::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PrescalerFHN (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDFilter<>
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDFilteroperator= (const EDFilter &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDFilterBase () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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::one::EDFilterBase
typedef EDFilterBase 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::one::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 46 of file PrescalerFHN.cc.

Constructor & Destructor Documentation

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

Definition at line 77 of file PrescalerFHN.cc.

References edm::ParameterSet::getParameter(), mergeVDriftHistosByStation::name, makeHLTPrescaleTable::prescales, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Member Function Documentation

bool PrescalerFHN::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDFilterBase.

Definition at line 112 of file PrescalerFHN.cc.

References edm::Event::getHandle(), init, LogDebug, makeHLTPrescaleTable::prescales, L1TMuonDQMOffline_cfi::triggerNames, and edm::Event::triggerNames().

112  {
113  using namespace edm;
114 
115  /* Goal for this skim:
116  Prescaling MET HLT paths
117  Option to turn off HSCP filter
118  - Doing that by treating it as an HLT with prescale 1
119  */
120 
121  // Trying to mirror HLTrigger/HLTfilters/src/HLTHighLevel.cc where possible
122 
123  auto const& trh = iEvent.getHandle(tok_trigger);
124 
125  if (trh.isValid()) {
126  LogDebug("") << "TriggerResults found, number of HLT paths: " << trh->size();
127  } else {
128  LogDebug("") << "TriggerResults product not found - returning result=false!";
129  return false;
130  }
131 
132  const edm::TriggerNames& triggerNames = iEvent.triggerNames(*trh);
133  if (triggerNamesID_ != triggerNames.parameterSetID()) {
134  triggerNamesID_ = triggerNames.parameterSetID();
135  init(*trh, triggerNames);
136  }
137 
138  // Trigger indices are ready at this point
139  // - Begin checking for HLT bits
140 
141  bool accept_event = false;
142  for (std::map<std::string, unsigned int>::const_iterator cit = trigger_indices.begin(); cit != trigger_indices.end();
143  cit++) {
144  if (trh->accept(cit->second)) {
145  prescale_counter[cit->first]++;
146  if (prescale_counter[cit->first] >= prescales[cit->first]) {
147  accept_event = true;
148  prescale_counter[cit->first] = 0;
149  }
150  }
151  }
152 
153  return accept_event;
154 }
edm::ParameterSetID triggerNamesID_
Definition: PrescalerFHN.cc:56
void init(const edm::TriggerResults &, const edm::TriggerNames &triggerNames)
Definition: PrescalerFHN.cc:97
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:275
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
std::map< std::string, unsigned int > prescales
Definition: PrescalerFHN.cc:60
std::map< std::string, unsigned int > prescale_counter
Definition: PrescalerFHN.cc:61
std::map< std::string, unsigned int > trigger_indices
Definition: PrescalerFHN.cc:63
edm::EDGetTokenT< TriggerResults > tok_trigger
Definition: PrescalerFHN.cc:58
#define LogDebug(id)
void PrescalerFHN::init ( const edm::TriggerResults result,
const edm::TriggerNames triggerNames 
)
private

Definition at line 97 of file PrescalerFHN.cc.

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

97  {
98  trigger_indices.clear();
99 
100  for (std::map<std::string, unsigned int>::const_iterator cit = prescales.begin(); cit != prescales.end(); cit++) {
101  auto index = triggerNames.triggerIndex(cit->first);
102  if (index < result.size()) {
103  trigger_indices[cit->first] = index;
104  } else {
105  // trigger path not found
106  LogDebug("") << "requested HLT path does not exist: " << cit->first;
107  }
108  }
109 }
unsigned int triggerIndex(std::string_view name) const
Definition: TriggerNames.cc:52
std::map< std::string, unsigned int > prescales
Definition: PrescalerFHN.cc:60
unsigned int size() const
Get number of paths stored.
std::map< std::string, unsigned int > trigger_indices
Definition: PrescalerFHN.cc:63
#define LogDebug(id)

Member Data Documentation

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

Definition at line 61 of file PrescalerFHN.cc.

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

Definition at line 60 of file PrescalerFHN.cc.

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

Definition at line 58 of file PrescalerFHN.cc.

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

Definition at line 63 of file PrescalerFHN.cc.

edm::ParameterSetID PrescalerFHN::triggerNamesID_
private

Definition at line 56 of file PrescalerFHN.cc.