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
 
 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
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< Bconsumes (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 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 ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
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 13 of file L1GTPrescaler.cc.

Constructor & Destructor Documentation

◆ L1GTPrescaler()

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

Definition at line 29 of file L1GTPrescaler.cc.

References m_algoCounters, and m_techCounters.

30  : m_l1ResultsToken(consumes<L1GlobalTriggerReadoutRecord>(config.getParameter<edm::InputTag>("l1Results"))),
31  m_algoPrescales(config.getParameter<std::array<double, 128>>("l1AlgoPrescales")),
32  m_techPrescales(config.getParameter<std::array<double, 64>>("l1TechPrescales")) {
33  m_algoCounters.fill(0);
34  m_techCounters.fill(0);
35  produces<L1GlobalTriggerReadoutRecord>();
36 }
const std::array< double, 64 > m_techPrescales
Definition: config.py:1
std::array< unsigned int, 64 > m_techCounters
const std::array< double, 128 > m_algoPrescales
std::array< unsigned int, 128 > m_algoCounters
const edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1ResultsToken

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 85 of file L1GTPrescaler.cc.

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

85  {
87  desc.add<edm::InputTag>("l1Results", edm::InputTag("gtDigis"));
88  desc.add<std::vector<double>>("l1AlgoPrescales", std::vector<double>(128, 1));
89  desc.add<std::vector<double>>("l1TechPrescales", std::vector<double>(64, 1));
90  descriptions.add("l1GTPrescaler", desc);
91 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ filter()

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

Implements edm::one::EDFilterBase.

Definition at line 38 of file L1GTPrescaler.cc.

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

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

Member Data Documentation

◆ m_algoCounters

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

Definition at line 25 of file L1GTPrescaler.cc.

Referenced by filter(), and L1GTPrescaler().

◆ m_algoPrescales

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

Definition at line 23 of file L1GTPrescaler.cc.

Referenced by filter().

◆ m_l1ResultsToken

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

Definition at line 22 of file L1GTPrescaler.cc.

Referenced by filter().

◆ m_techCounters

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

Definition at line 26 of file L1GTPrescaler.cc.

Referenced by filter(), and L1GTPrescaler().

◆ m_techPrescales

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

Definition at line 24 of file L1GTPrescaler.cc.

Referenced by filter().