CMS 3D CMS Logo

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

Public Member Functions

 PrescalerFHN (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDFilter< T >
 EDFilter ()=default
 
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
 
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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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

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
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 46 of file PrescalerFHN.cc.

Constructor & Destructor Documentation

◆ PrescalerFHN()

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

Definition at line 77 of file PrescalerFHN.cc.

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 
90  }
91 }

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

Member Function Documentation

◆ filter()

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

Implements edm::one::EDFilterBase.

Definition at line 112 of file PrescalerFHN.cc.

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 
124  iEvent.getByToken(tok_trigger, trh);
125 
126  if (trh.isValid()) {
127  LogDebug("") << "TriggerResults found, number of HLT paths: " << trh->size();
128  } else {
129  LogDebug("") << "TriggerResults product not found - returning result=false!";
130  return false;
131  }
132 
133  const edm::TriggerNames& triggerNames = iEvent.triggerNames(*trh);
134  if (triggerNamesID_ != triggerNames.parameterSetID()) {
135  triggerNamesID_ = triggerNames.parameterSetID();
136  init(*trh, triggerNames);
137  }
138 
139  // Trigger indices are ready at this point
140  // - Begin checking for HLT bits
141 
142  bool accept_event = false;
143  for (std::map<std::string, unsigned int>::const_iterator cit = trigger_indices.begin(); cit != trigger_indices.end();
144  cit++) {
145  if (trh->accept(cit->second)) {
146  prescale_counter[cit->first]++;
147  if (prescale_counter[cit->first] >= prescales[cit->first]) {
148  accept_event = true;
149  prescale_counter[cit->first] = 0;
150  }
151  }
152  }
153 
154  return accept_event;
155 }

References edm::HLTGlobalStatus::accept(), iEvent, init, edm::HandleBase::isValid(), LogDebug, hltrates_dqm_sourceclient-live_cfg::prescales, edm::HLTGlobalStatus::size(), and L1TEGammaOffline_cfi::triggerNames.

◆ init()

void PrescalerFHN::init ( const edm::TriggerResults result,
const edm::TriggerNames triggerNames 
)
private

Definition at line 97 of file PrescalerFHN.cc.

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 }

References LogDebug, hltrates_dqm_sourceclient-live_cfg::prescales, mps_fire::result, and L1TEGammaOffline_cfi::triggerNames.

Member Data Documentation

◆ prescale_counter

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

Definition at line 61 of file PrescalerFHN.cc.

◆ prescales

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

Definition at line 60 of file PrescalerFHN.cc.

◆ tok_trigger

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

Definition at line 58 of file PrescalerFHN.cc.

◆ trigger_indices

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

Definition at line 63 of file PrescalerFHN.cc.

◆ triggerNamesID_

edm::ParameterSetID PrescalerFHN::triggerNamesID_
private

Definition at line 56 of file PrescalerFHN.cc.

PrescalerFHN::init
void init(const edm::TriggerResults &, const edm::TriggerNames &triggerNames)
Definition: PrescalerFHN.cc:97
PrescalerFHN::prescale_counter
std::map< std::string, unsigned int > prescale_counter
Definition: PrescalerFHN.cc:61
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::Handle
Definition: AssociativeIterator.h:50
PrescalerFHN::triggerNamesID_
edm::ParameterSetID triggerNamesID_
Definition: PrescalerFHN.cc:56
edm::HLTGlobalStatus::size
unsigned int size() const
Get number of paths stored.
Definition: HLTGlobalStatus.h:35
L1TEGammaOffline_cfi.triggerNames
triggerNames
Definition: L1TEGammaOffline_cfi.py:40
DQMScaleToClient_cfi.factor
factor
Definition: DQMScaleToClient_cfi.py:8
PrescalerFHN::prescales
std::map< std::string, unsigned int > prescales
Definition: PrescalerFHN.cc:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
iEvent
int iEvent
Definition: GenABIO.cc:224
PrescalerFHN::tok_trigger
edm::EDGetTokenT< TriggerResults > tok_trigger
Definition: PrescalerFHN.cc:58
PrescalerFHN::trigger_indices
std::map< std::string, unsigned int > trigger_indices
Definition: PrescalerFHN.cc:63
edm::TriggerNames
Definition: TriggerNames.h:55
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::HLTGlobalStatus::accept
bool accept() const
Has at least one path accepted the event?
Definition: HLTGlobalStatus.h:49
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
mps_fire.result
result
Definition: mps_fire.py:311
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15