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< T > 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< T >
 EDFilter ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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)
 

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

Constructor & Destructor Documentation

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

Definition at line 37 of file L1GTPrescaler.cc.

References m_algoCounters, and m_techCounters.

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

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

Definition at line 98 of file L1GTPrescaler.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

99  {
101  desc.add<edm::InputTag>("l1Results", edm::InputTag("gtDigis"));
102  desc.add<std::vector<double>>("l1AlgoPrescales", std::vector<double>(128, 1));
103  desc.add<std::vector<double>>("l1TechPrescales", std::vector<double>(64, 1));
104  descriptions.add("l1GTPrescaler", desc);
105 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool L1GTPrescaler::filter ( edm::Event event,
edm::EventSetup const &  setup 
)
overridevirtual

Implements edm::one::EDFilterBase.

Definition at line 49 of file L1GTPrescaler.cc.

References L1GlobalTriggerReadoutRecord::decisionWord(), cmsBatch::handle, mps_fire::i, m_algoCounters, m_algoPrescales, m_l1ResultsToken, m_techCounters, m_techPrescales, eostools::move(), mps_fire::result, and L1GlobalTriggerReadoutRecord::technicalTriggerWord().

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

Member Data Documentation

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

Definition at line 33 of file L1GTPrescaler.cc.

Referenced by filter(), and L1GTPrescaler().

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

Definition at line 31 of file L1GTPrescaler.cc.

Referenced by filter().

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

Definition at line 30 of file L1GTPrescaler.cc.

Referenced by filter().

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

Definition at line 34 of file L1GTPrescaler.cc.

Referenced by filter(), and L1GTPrescaler().

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

Definition at line 32 of file L1GTPrescaler.cc.

Referenced by filter().