![]() |
![]() |
#include <HLTPrescaler.h>
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 () |
Private Attributes | |
unsigned int | acceptCount_ |
accept counter | |
unsigned int | eventCount_ |
event counter | |
edm::InputTag | gtDigi_ |
GT payload, to extract the prescale column index. | |
bool | newLumi_ |
check for (re)initialization of the prescale | |
unsigned int | offsetCount_ |
initial offset | |
unsigned int | offsetPhase_ |
unsigned int | prescaleFactor_ |
accept one in prescaleFactor_; 0 means never to accept an event | |
edm::service::PrescaleService * | prescaleService_ |
prescale service | |
Static Private Attributes | |
static const unsigned int | prescaleSeed_ = 65537 |
"seed" used to initialize the prescale counter |
This class is an HLTFilter (-> EDFilter) implementing an HLT Prescaler module with associated book keeping.
Definition at line 21 of file HLTPrescaler.h.
HLTPrescaler::HLTPrescaler | ( | edm::ParameterSet const & | iConfig | ) | [explicit] |
Definition at line 29 of file HLTPrescaler.cc.
References LogDebug, cmsCodeRules::cppFunctionSkipper::operator, and prescaleService_.
: prescaleFactor_(1) , eventCount_(0) , acceptCount_(0) , offsetCount_(0) , offsetPhase_(iConfig.existsAs<unsigned int>("offset") ? iConfig.getParameter<unsigned int>("offset") : 0) , prescaleService_(0) , newLumi_(true) , gtDigi_ (iConfig.getParameter<edm::InputTag>("L1GtReadoutRecordTag")) { if(edm::Service<edm::service::PrescaleService>().isAvailable()) prescaleService_ = edm::Service<edm::service::PrescaleService>().operator->(); else LogDebug("NoPrescaleService")<<"PrescaleService unavailable, prescaleFactor=1!"; }
HLTPrescaler::~HLTPrescaler | ( | ) | [virtual] |
Definition at line 46 of file HLTPrescaler.cc.
{ }
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_.
{ newLumi_ = true; return true; }
void HLTPrescaler::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDFilter.
Definition at line 117 of file HLTPrescaler.cc.
References acceptCount_, eventCount_, and max().
{ edm::LogInfo("PrescaleSummary") << acceptCount_<< "/" <<eventCount_ << " (" << 100.*acceptCount_/static_cast<double>(std::max(1u,eventCount_)) << "% of events accepted)."; return; }
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::EventBase::id(), getHLTprescales::index, edm::HandleBase::isValid(), newLumi_, offsetCount_, offsetPhase_, pathName(), prescaleFactor_, prescaleSeed_, prescaleService_, and query::result.
{ // during the first event of a LumiSection, read from the GT the prescale index for this // LumiSection and get the corresponding prescale factor from the PrescaleService if (newLumi_) { newLumi_ = false; bool needsInit (eventCount_==0); if (prescaleService_) { const unsigned int oldPrescale(prescaleFactor_); edm::Handle<L1GlobalTriggerReadoutRecord> handle; iEvent.getByLabel(gtDigi_ , handle); if (handle.isValid()) { unsigned int index = handle->gtFdlWord().gtPrescaleFactorIndexAlgo(); // gtPrescaleFactorIndexTech() is also available // by construction, they should always return the same index prescaleFactor_ = prescaleService_->getPrescale(index, *pathName()); } else { edm::LogWarning("HLT") << "Cannot read prescale column index from GT data: using default as defined by configuration or DAQ"; prescaleFactor_ = prescaleService_->getPrescale(*pathName()); } if (prescaleFactor_ != oldPrescale) { edm::LogInfo("ChangedPrescale") << "lumiBlockNb="<< iEvent.getLuminosityBlock().id().luminosityBlock() << ", " << "path="<<*pathName()<<": " << prescaleFactor_ << " [" <<oldPrescale<<"]"; // reset the prescale counter needsInit = true; } } if (needsInit && (prescaleFactor_ != 0)) { // initialize the prescale counter to the first event number multiplied by a big "seed" offsetCount_ = ((uint64_t) (iEvent.id().event() + offsetPhase_) * prescaleSeed_) % prescaleFactor_; } } const bool result ( (prescaleFactor_ == 0) ? false : ((eventCount_ + offsetCount_) % prescaleFactor_ == 0) ); ++eventCount_; if (result) ++acceptCount_; return result; }
unsigned int HLTPrescaler::acceptCount_ [private] |
unsigned int HLTPrescaler::eventCount_ [private] |
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] |
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 [static, private] |
"seed" used to initialize the prescale counter
Definition at line 69 of file HLTPrescaler.h.
Referenced by filter().
prescale service
Definition at line 59 of file HLTPrescaler.h.
Referenced by filter(), and HLTPrescaler().