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:
HLTFilter edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual bool beginLuminosityBlock (edm::LuminosityBlock &lb, edm::EventSetup const &iSetup)
 
virtual void endJob ()
 
virtual bool filter (edm::Event &iEvent, edm::EventSetup const &iSetup)
 
 HLTPrescaler (edm::ParameterSet const &iConfig)
 
virtual ~HLTPrescaler ()
 
- Public Member Functions inherited from HLTFilter
 HLTFilter ()
 
virtual ~HLTFilter ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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

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)
 
- Protected Member Functions inherited from edm::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

This class is an HLTFilter (-> EDFilter) implementing an HLT Prescaler module with associated book keeping.

Date:
2010/07/30 11:27:48
Revision:
1.18
Author
Martin Grunewald
Philipp Schieferdecker

Definition at line 21 of file HLTPrescaler.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file HLTPrescaler.cc.

References LogDebug, cmsCodeRules.cppFunctionSkipper::operator, and prescaleService_.

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

Definition at line 46 of file HLTPrescaler.cc.

47 {
48 
49 }

Member Function Documentation

bool HLTPrescaler::beginLuminosityBlock ( edm::LuminosityBlock lb,
edm::EventSetup const &  iSetup 
)
virtual

Reimplemented from edm::EDFilter.

Definition at line 57 of file HLTPrescaler.cc.

References newLumi_.

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

Reimplemented from edm::EDFilter.

Definition at line 117 of file HLTPrescaler.cc.

References acceptCount_, eventCount_, and max().

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

Implements HLTFilter.

Definition at line 67 of file HLTPrescaler.cc.

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

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

Member Data Documentation

unsigned int HLTPrescaler::acceptCount_
private

accept counter

Definition at line 52 of file HLTPrescaler.h.

Referenced by endJob(), and filter().

unsigned int HLTPrescaler::eventCount_
private

event counter

Definition at line 49 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 65 of file HLTPrescaler.h.

Referenced by filter().

bool HLTPrescaler::newLumi_
private

check for (re)initialization of the prescale

Definition at line 62 of file HLTPrescaler.h.

Referenced by beginLuminosityBlock(), and filter().

unsigned int HLTPrescaler::offsetCount_
private

initial offset

Definition at line 55 of file HLTPrescaler.h.

Referenced by filter().

unsigned int HLTPrescaler::offsetPhase_
private

Definition at line 56 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 46 of file HLTPrescaler.h.

Referenced by filter().

const unsigned int HLTPrescaler::prescaleSeed_ = 65537
staticprivate

"seed" used to initialize the prescale counter

Definition at line 69 of file HLTPrescaler.h.

Referenced by filter().

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

prescale service

Definition at line 59 of file HLTPrescaler.h.

Referenced by filter(), and HLTPrescaler().