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
L1TGlobalPrescaler Class Reference
Inheritance diagram for L1TGlobalPrescaler:
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
 
 L1TGlobalPrescaler (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,
GlobalAlgBlk::maxPhysicsTriggers
m_counters
 
const edm::EDGetTokenT
< GlobalAlgBlkBxCollection
m_l1ResultsToken
 
const std::array< double,
GlobalAlgBlk::maxPhysicsTriggers
m_prescales
 

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 L1TGlobalPrescaler.cc.

Constructor & Destructor Documentation

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

Definition at line 37 of file L1TGlobalPrescaler.cc.

References m_counters.

37  :
38  m_l1ResultsToken( consumes<GlobalAlgBlkBxCollection>(config.getParameter<edm::InputTag>("l1tResults")) ),
39  m_prescales( make_array<double, GlobalAlgBlk::maxPhysicsTriggers>(config.getParameter<std::vector<double>>("l1tPrescales")) )
40 {
41  m_counters.fill(0);
42  produces<GlobalAlgBlkBxCollection>();
43 }
std::array< unsigned int, GlobalAlgBlk::maxPhysicsTriggers > m_counters
const std::array< double, GlobalAlgBlk::maxPhysicsTriggers > m_prescales
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1ResultsToken

Member Function Documentation

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

Definition at line 92 of file L1TGlobalPrescaler.cc.

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

92  {
94  desc.add<edm::InputTag>("l1tResults", edm::InputTag("gtStage2Digis"));
95  desc.add<std::vector<double>>("l1tPrescales", std::vector<double>(GlobalAlgBlk::maxPhysicsTriggers, 1.));
96  descriptions.add("l1tGlobalPrescaler", desc);
97 }
static const unsigned int maxPhysicsTriggers
Definition: GlobalAlgBlk.h:52
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool L1TGlobalPrescaler::filter ( edm::Event event,
edm::EventSetup const &  setup 
)
overridevirtual

Implements edm::one::EDFilterBase.

Definition at line 45 of file L1TGlobalPrescaler.cc.

References GlobalAlgBlk::getAlgoDecisionFinal(), GlobalAlgBlk::getFinalORVeto(), patZpeak::handle, i, m_counters, m_l1ResultsToken, m_prescales, GlobalAlgBlk::maxPhysicsTriggers, eostools::move(), mps_fire::result, GlobalAlgBlk::setAlgoDecisionFinal(), GlobalAlgBlk::setFinalOR(), and GlobalAlgBlk::setFinalORPreVeto().

45  {
47  event.getByToken(m_l1ResultsToken, handle);
48 
49  // if the input collection does not have any information for bx 0,
50  // produce an empty collection, and fail
51  if (handle->isEmpty(0)) {
52  std::unique_ptr<GlobalAlgBlkBxCollection> result(new GlobalAlgBlkBxCollection());
53  event.put(std::move(result));
54  return false;
55  }
56 
57  // make a copy of the GlobalAlgBlk for bx 0
58  GlobalAlgBlk algoBlock = handle->at(0,0);
59 
60  bool finalOr = false;
61 
62  for (unsigned int i = 0; i < GlobalAlgBlk::maxPhysicsTriggers; ++i) {
63  if (m_prescales[i] == 0) {
64  // mask this trigger: reset the bit
65  algoBlock.setAlgoDecisionFinal(i, false);
66  } else if (algoBlock.getAlgoDecisionFinal(i)) {
67  // prescale this trigger
68  ++m_counters[i];
69  if (std::fmod(m_counters[i], m_prescales[i]) < 1)
70  // the prescale is successful, keep the bit set
71  finalOr = true;
72  else
73  // the prescale failed, reset the bit
74  algoBlock.setAlgoDecisionFinal(i, false);
75  }
76  }
77 
78  // set the final OR
79  algoBlock.setFinalORPreVeto(finalOr);
80  if (algoBlock.getFinalORVeto())
81  finalOr = false;
82  algoBlock.setFinalOR(finalOr);
83 
84  // create a new GlobalAlgBlkBxCollection, and set the new prescaled decisions for bx 0
85  std::unique_ptr<GlobalAlgBlkBxCollection> result(new GlobalAlgBlkBxCollection());
86  result->push_back(0, algoBlock);
87  event.put(std::move(result));
88 
89  return finalOr;
90 }
int i
Definition: DBlmapReader.cc:9
void setFinalORPreVeto(bool fOR)
Definition: GlobalAlgBlk.h:59
std::array< unsigned int, GlobalAlgBlk::maxPhysicsTriggers > m_counters
BXVector< GlobalAlgBlk > GlobalAlgBlkBxCollection
Definition: GlobalAlgBlk.h:31
bool getAlgoDecisionFinal(unsigned int bit) const
const bool getFinalORVeto() const
Definition: GlobalAlgBlk.h:69
static const unsigned int maxPhysicsTriggers
Definition: GlobalAlgBlk.h:52
tuple result
Definition: mps_fire.py:95
const std::array< double, GlobalAlgBlk::maxPhysicsTriggers > m_prescales
def move
Definition: eostools.py:510
tuple handle
Definition: patZpeak.py:22
void setFinalOR(bool fOR)
Definition: GlobalAlgBlk.h:60
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1ResultsToken
void setAlgoDecisionFinal(unsigned int bit, bool val)

Member Data Documentation

std::array<unsigned int, GlobalAlgBlk::maxPhysicsTriggers> L1TGlobalPrescaler::m_counters
private

Definition at line 33 of file L1TGlobalPrescaler.cc.

Referenced by filter(), and L1TGlobalPrescaler().

const edm::EDGetTokenT<GlobalAlgBlkBxCollection> L1TGlobalPrescaler::m_l1ResultsToken
private

Definition at line 31 of file L1TGlobalPrescaler.cc.

Referenced by filter().

const std::array<double, GlobalAlgBlk::maxPhysicsTriggers> L1TGlobalPrescaler::m_prescales
private

Definition at line 32 of file L1TGlobalPrescaler.cc.

Referenced by filter().