CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual 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
 
- Public Member Functions inherited from edm::one::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilterBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
< L1GlobalTriggerReadoutRecord
m_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
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 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 22 of file L1GTPrescaler.cc.

Constructor & Destructor Documentation

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

Definition at line 39 of file L1GTPrescaler.cc.

References m_algoCounters, and m_techCounters.

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

Member Function Documentation

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

Definition at line 96 of file L1GTPrescaler.cc.

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

96  {
98  desc.add<edm::InputTag>("l1Results", edm::InputTag("gtDigis"));
99  desc.add<std::vector<double>>("l1AlgoPrescales", std::vector<double>(128, 1));
100  desc.add<std::vector<double>>("l1TechPrescales", std::vector<double>( 64, 1));
101  descriptions.add("l1GTPrescaler", desc);
102 }
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 patZpeak::handle, i, m_algoCounters, m_algoPrescales, m_l1ResultsToken, m_techCounters, m_techPrescales, eostools::move(), and mps_fire::result.

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

Member Data Documentation

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

Definition at line 34 of file L1GTPrescaler.cc.

Referenced by filter(), and L1GTPrescaler().

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

Definition at line 32 of file L1GTPrescaler.cc.

Referenced by filter().

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

Definition at line 31 of file L1GTPrescaler.cc.

Referenced by filter().

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

Definition at line 35 of file L1GTPrescaler.cc.

Referenced by filter(), and L1GTPrescaler().

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

Definition at line 33 of file L1GTPrescaler.cc.

Referenced by filter().