CMS 3D CMS Logo

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

Public Member Functions

bool filter (edm::Event &event, edm::EventSetup const &setup) override
 
 L1GTPrescaler (edm::ParameterSet const &config)
 
- Public Member Functions inherited from edm::one::EDFilter<>
 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

std::array< unsigned int, 128 > m_algoCounters
 
const std::array< double, 128 > m_algoPrescales
 
const edm::EDGetTokenT< L1GlobalTriggerReadoutRecordm_l1ResultsToken
 
std::array< unsigned int, 64 > m_techCounters
 
const std::array< double, 64 > m_techPrescales
 

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
 
- 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 21 of file L1GTPrescaler.cc.

Constructor & Destructor Documentation

◆ L1GTPrescaler()

L1GTPrescaler::L1GTPrescaler ( edm::ParameterSet const &  config)

Definition at line 37 of file L1GTPrescaler.cc.

38  : m_l1ResultsToken(consumes<L1GlobalTriggerReadoutRecord>(config.getParameter<edm::InputTag>("l1Results"))),
39  m_algoPrescales(make_array<double, 128>(config.getParameter<std::vector<double>>("l1AlgoPrescales"))),
40  m_techPrescales(make_array<double, 64>(config.getParameter<std::vector<double>>("l1TechPrescales"))) {
41  m_algoCounters.fill(0);
42  m_techCounters.fill(0);
43  produces<L1GlobalTriggerReadoutRecord>();
44 }

References m_algoCounters, and m_techCounters.

Member Function Documentation

◆ fillDescriptions()

void L1GTPrescaler::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 93 of file L1GTPrescaler.cc.

93  {
95  desc.add<edm::InputTag>("l1Results", edm::InputTag("gtDigis"));
96  desc.add<std::vector<double>>("l1AlgoPrescales", std::vector<double>(128, 1));
97  desc.add<std::vector<double>>("l1TechPrescales", std::vector<double>(64, 1));
98  descriptions.add("l1GTPrescaler", desc);
99 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

◆ filter()

bool L1GTPrescaler::filter ( edm::Event event,
edm::EventSetup const &  setup 
)
overridevirtual

Implements edm::one::EDFilterBase.

Definition at line 46 of file L1GTPrescaler.cc.

46  {
48  event.getByToken(m_l1ResultsToken, handle);
49  auto algoWord = handle->decisionWord(); // make a copy of the L1 algo results
50  auto techWord = handle->technicalTriggerWord(); // make a copy of the L1 tech results
51  bool finalOr = false;
52 
53  for (unsigned int i = 0; i < 128; ++i) {
54  if (m_algoPrescales[i] == 0) {
55  // mask this trigger: reset the bit
56  algoWord[i] = false;
57  } else if (algoWord[i]) {
58  // prescale this trigger
59  ++m_algoCounters[i];
60  if (std::fmod(m_algoCounters[i], m_algoPrescales[i]) < 1)
61  // the prescale is successful, keep the bit set
62  finalOr = true;
63  else
64  // the prescale failed, reset the bit
65  algoWord[i] = false;
66  }
67  }
68  for (unsigned int i = 0; i < 64; ++i) {
69  if (m_techPrescales[i] == 0) {
70  // mask this trigger: reset the bit
71  techWord[i] = false;
72  } else if (techWord[i]) {
73  ++m_techCounters[i];
74  if (std::fmod(m_techCounters[i], m_techPrescales[i]) < 1)
75  // the prescale is successful, keep the bit set
76  finalOr = true;
77  else
78  // the prescale failed, reset the bit
79  techWord[i] = false;
80  }
81  }
82 
83  // make a copy of the L1GlobalTriggerReadoutRecord, and set the new decisions
84  std::unique_ptr<L1GlobalTriggerReadoutRecord> result(new L1GlobalTriggerReadoutRecord(*handle));
85  result->setDecisionWord(algoWord);
86  result->setTechnicalTriggerWord(techWord);
87  result->setDecision(finalOr);
88  event.put(std::move(result));
89 
90  return finalOr;
91 }

References patZpeak::handle, mps_fire::i, m_algoCounters, m_algoPrescales, m_l1ResultsToken, m_techCounters, m_techPrescales, eostools::move(), and mps_fire::result.

Member Data Documentation

◆ m_algoCounters

std::array<unsigned int, 128> L1GTPrescaler::m_algoCounters
private

Definition at line 33 of file L1GTPrescaler.cc.

Referenced by filter(), and L1GTPrescaler().

◆ m_algoPrescales

const std::array<double, 128> L1GTPrescaler::m_algoPrescales
private

Definition at line 31 of file L1GTPrescaler.cc.

Referenced by filter().

◆ m_l1ResultsToken

const edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> L1GTPrescaler::m_l1ResultsToken
private

Definition at line 30 of file L1GTPrescaler.cc.

Referenced by filter().

◆ m_techCounters

std::array<unsigned int, 64> L1GTPrescaler::m_techCounters
private

Definition at line 34 of file L1GTPrescaler.cc.

Referenced by filter(), and L1GTPrescaler().

◆ m_techPrescales

const std::array<double, 64> L1GTPrescaler::m_techPrescales
private

Definition at line 32 of file L1GTPrescaler.cc.

Referenced by filter().

mps_fire.i
i
Definition: mps_fire.py:428
patZpeak.handle
handle
Definition: patZpeak.py:23
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
L1GTPrescaler::m_algoCounters
std::array< unsigned int, 128 > m_algoCounters
Definition: L1GTPrescaler.cc:33
L1GTPrescaler::m_techPrescales
const std::array< double, 64 > m_techPrescales
Definition: L1GTPrescaler.cc:32
edm::Handle
Definition: AssociativeIterator.h:50
L1GlobalTriggerReadoutRecord
Definition: L1GlobalTriggerReadoutRecord.h:46
config
Definition: config.py:1
L1GTPrescaler::m_algoPrescales
const std::array< double, 128 > m_algoPrescales
Definition: L1GTPrescaler.cc:31
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
L1GTPrescaler::m_techCounters
std::array< unsigned int, 64 > m_techCounters
Definition: L1GTPrescaler.cc:34
mps_fire.result
result
Definition: mps_fire.py:311
edm::InputTag
Definition: InputTag.h:15
L1GTPrescaler::m_l1ResultsToken
const edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1ResultsToken
Definition: L1GTPrescaler.cc:30