CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes | Static Private Attributes
HLTPrescaler Class Reference

#include <HLTPrescaler.h>

Inheritance diagram for HLTPrescaler:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginLuminosityBlock (edm::LuminosityBlock const &lb, edm::EventSetup const &iSetup) override
 
virtual void endJob () override
 
virtual bool filter (edm::Event &iEvent, edm::EventSetup const &iSetup) override
 
 HLTPrescaler (edm::ParameterSet const &iConfig)
 
virtual ~HLTPrescaler ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

unsigned int acceptCount_
 accept counter More...
 
unsigned int eventCount_
 event counter More...
 
edm::InputTag gtDigi_
 GT payload, to extract the prescale column index. More...
 
bool newLumi_
 check for (re)initialization of the prescale More...
 
unsigned int offsetCount_
 initial offset More...
 
unsigned int offsetPhase_
 
unsigned int prescaleFactor_
 accept one in prescaleFactor_; 0 means never to accept an event More...
 
edm::service::PrescaleServiceprescaleService_
 prescale service More...
 
unsigned int prescaleSet_
 l1 prescale set index More...
 

Static Private Attributes

static const unsigned int prescaleSeed_ = 65537
 "seed" used to initialize the prescale counter More...
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

This class is an EDFilter implementing an HLT Prescaler module with associated book keeping.

Date:
2013/05/25 14:46:43
Revision:
1.24
Author
Martin Grunewald
Philipp Schieferdecker

Definition at line 24 of file HLTPrescaler.h.

Constructor & Destructor Documentation

HLTPrescaler::HLTPrescaler ( edm::ParameterSet const &  iConfig)
explicit

Definition at line 29 of file HLTPrescaler.cc.

References LogDebug, cppFunctionSkipper::operator, and prescaleService_.

29  :
30  prescaleSet_(0)
31  , prescaleFactor_(1)
32  , eventCount_(0)
33  , acceptCount_(0)
34  , offsetCount_(0)
35  , offsetPhase_(iConfig.existsAs<unsigned int>("offset") ? iConfig.getParameter<unsigned int>("offset") : 0)
36  , prescaleService_(0)
37  , newLumi_(true)
38  , gtDigi_ (iConfig.getParameter<edm::InputTag>("L1GtReadoutRecordTag"))
39 {
42  else
43  LogDebug("NoPrescaleService")<<"PrescaleService unavailable, prescaleFactor=1!";
44 }
#define LogDebug(id)
edm::InputTag gtDigi_
GT payload, to extract the prescale column index.
Definition: HLTPrescaler.h:71
edm::service::PrescaleService * prescaleService_
prescale service
Definition: HLTPrescaler.h:65
unsigned int acceptCount_
accept counter
Definition: HLTPrescaler.h:58
unsigned int eventCount_
event counter
Definition: HLTPrescaler.h:55
bool newLumi_
check for (re)initialization of the prescale
Definition: HLTPrescaler.h:68
unsigned int prescaleSet_
l1 prescale set index
Definition: HLTPrescaler.h:49
unsigned int offsetPhase_
Definition: HLTPrescaler.h:62
unsigned int offsetCount_
initial offset
Definition: HLTPrescaler.h:61
unsigned int prescaleFactor_
accept one in prescaleFactor_; 0 means never to accept an event
Definition: HLTPrescaler.h:52
HLTPrescaler::~HLTPrescaler ( )
virtual

Definition at line 47 of file HLTPrescaler.cc.

48 {
49 
50 }

Member Function Documentation

void HLTPrescaler::beginLuminosityBlock ( edm::LuminosityBlock const &  lb,
edm::EventSetup const &  iSetup 
)
overridevirtual

Reimplemented from edm::EDFilter.

Definition at line 58 of file HLTPrescaler.cc.

References newLumi_.

60 {
61  newLumi_ = true;
62 }
bool newLumi_
check for (re)initialization of the prescale
Definition: HLTPrescaler.h:68
void HLTPrescaler::endJob ( void  )
overridevirtual

Reimplemented from edm::EDFilter.

Definition at line 119 of file HLTPrescaler.cc.

References acceptCount_, eventCount_, and max().

120 {
121  edm::LogInfo("PrescaleSummary")
122  << acceptCount_<< "/" <<eventCount_
123  << " ("
124  << 100.*acceptCount_/static_cast<double>(std::max(1u,eventCount_))
125  << "% of events accepted).";
126  return;
127 }
unsigned int acceptCount_
accept counter
Definition: HLTPrescaler.h:58
const T & max(const T &a, const T &b)
unsigned int eventCount_
event counter
Definition: HLTPrescaler.h:55
bool HLTPrescaler::filter ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements edm::EDFilter.

Definition at line 66 of file HLTPrescaler.cc.

References acceptCount_, edm::EDFilter::currentContext(), edm::EventID::event(), eventCount_, edm::Event::getByLabel(), edm::Event::getLuminosityBlock(), edm::service::PrescaleService::getPrescale(), gtDigi_, patZpeak::handle, edm::LuminosityBlockBase::id(), edm::EventBase::id(), edm::HandleBase::isValid(), edm::LuminosityBlockID::luminosityBlock(), newLumi_, offsetCount_, offsetPhase_, edm::CurrentProcessingContext::pathName(), EgammaValidation_cff::pathName, prescaleFactor_, prescaleSeed_, prescaleService_, prescaleSet_, query::result, and AlCaHLTBitMon_QueryRunRegistry::string.

67 {
68  // during the first event of a LumiSection, read from the GT the prescale index for this
69  // LumiSection and get the corresponding prescale factor from the PrescaleService
70  if (newLumi_) {
71  newLumi_ = false;
72 
73  bool needsInit (eventCount_==0);
74 
75  if (prescaleService_) {
77  const unsigned int oldSet(prescaleSet_);
78  const unsigned int oldPrescale(prescaleFactor_);
79 
81  iEvent.getByLabel(gtDigi_ , handle);
82  if (handle.isValid()) {
83  prescaleSet_ = handle->gtFdlWord().gtPrescaleFactorIndexAlgo();
84  // gtPrescaleFactorIndexTech() is also available
85  // by construction, they should always return the same index
87  } else {
88  edm::LogWarning("HLT") << "Cannot read prescale column index from GT data: using default as defined by configuration or DAQ";
90  }
91 
92  if (prescaleSet_ != oldSet) {
93  edm::LogInfo("ChangedPrescale")
94  << "lumiBlockNb = " << iEvent.getLuminosityBlock().id().luminosityBlock()
95  << ", set = " << prescaleSet_ << " [" << oldSet <<"]"
96  << ", path = "<< pathName
97  << ": " << prescaleFactor_ << " [" <<oldPrescale<<"]";
98  // reset the prescale counter
99  needsInit = true;
100  }
101  }
102 
103  if (needsInit && (prescaleFactor_ != 0)) {
104  // initialize the prescale counter to the first event number multiplied by a big "seed"
106  }
107  }
108 
109  const bool result ( (prescaleFactor_ == 0) ?
110  false : ((eventCount_ + offsetCount_) % prescaleFactor_ == 0) );
111 
112  ++eventCount_;
113  if (result) ++acceptCount_;
114  return result;
115 }
LuminosityBlockID id() const
EventNumber_t event() const
Definition: EventID.h:44
edm::InputTag gtDigi_
GT payload, to extract the prescale column index.
Definition: HLTPrescaler.h:71
edm::service::PrescaleService * prescaleService_
prescale service
Definition: HLTPrescaler.h:65
static const unsigned int prescaleSeed_
&quot;seed&quot; used to initialize the prescale counter
Definition: HLTPrescaler.h:75
unsigned int acceptCount_
accept counter
Definition: HLTPrescaler.h:58
tuple result
Definition: query.py:137
unsigned int eventCount_
event counter
Definition: HLTPrescaler.h:55
bool newLumi_
check for (re)initialization of the prescale
Definition: HLTPrescaler.h:68
tuple handle
Definition: patZpeak.py:22
unsigned int prescaleSet_
l1 prescale set index
Definition: HLTPrescaler.h:49
LuminosityBlock const & getLuminosityBlock() const
Definition: Event.h:68
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
unsigned long long uint64_t
Definition: Time.h:15
LuminosityBlockNumber_t luminosityBlock() const
unsigned int offsetPhase_
Definition: HLTPrescaler.h:62
edm::EventID id() const
Definition: EventBase.h:56
unsigned int offsetCount_
initial offset
Definition: HLTPrescaler.h:61
std::string const * pathName() const
CurrentProcessingContext const * currentContext() const
Definition: EDFilter.cc:119
unsigned int prescaleFactor_
accept one in prescaleFactor_; 0 means never to accept an event
Definition: HLTPrescaler.h:52
unsigned int getPrescale(unsigned int lvl1Index, std::string const &prescaledPath)

Member Data Documentation

unsigned int HLTPrescaler::acceptCount_
private

accept counter

Definition at line 58 of file HLTPrescaler.h.

Referenced by endJob(), and filter().

unsigned int HLTPrescaler::eventCount_
private

event counter

Definition at line 55 of file HLTPrescaler.h.

Referenced by endJob(), and filter().

edm::InputTag HLTPrescaler::gtDigi_
private

GT payload, to extract the prescale column index.

Definition at line 71 of file HLTPrescaler.h.

Referenced by filter().

bool HLTPrescaler::newLumi_
private

check for (re)initialization of the prescale

Definition at line 68 of file HLTPrescaler.h.

Referenced by beginLuminosityBlock(), and filter().

unsigned int HLTPrescaler::offsetCount_
private

initial offset

Definition at line 61 of file HLTPrescaler.h.

Referenced by filter().

unsigned int HLTPrescaler::offsetPhase_
private

Definition at line 62 of file HLTPrescaler.h.

Referenced by filter().

unsigned int HLTPrescaler::prescaleFactor_
private

accept one in prescaleFactor_; 0 means never to accept an event

Definition at line 52 of file HLTPrescaler.h.

Referenced by filter().

const unsigned int HLTPrescaler::prescaleSeed_ = 65537
staticprivate

"seed" used to initialize the prescale counter

Definition at line 75 of file HLTPrescaler.h.

Referenced by filter().

edm::service::PrescaleService* HLTPrescaler::prescaleService_
private

prescale service

Definition at line 65 of file HLTPrescaler.h.

Referenced by filter(), and HLTPrescaler().

unsigned int HLTPrescaler::prescaleSet_
private

l1 prescale set index

Definition at line 49 of file HLTPrescaler.h.

Referenced by filter().