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 | Static Private Attributes
HLTPrescaler Class Reference

#include <HLTPrescaler.h>

Inheritance diagram for HLTPrescaler:
edm::stream::EDFilter< edm::GlobalCache< trigger::Efficiency > > edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginLuminosityBlock (edm::LuminosityBlock const &lb, edm::EventSetup const &iSetup) override
 
virtual void endStream () override
 
virtual bool filter (edm::Event &iEvent, edm::EventSetup const &iSetup) override
 
 HLTPrescaler (edm::ParameterSet const &iConfig, const trigger::Efficiency *efficiency)
 
virtual ~HLTPrescaler ()
 
- Public Member Functions inherited from edm::stream::EDFilter< edm::GlobalCache< trigger::Efficiency > >
 EDFilter ()=default
 
- Public Member Functions inherited from edm::stream::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 (const std::string &iProcessName, std::vector< const char * > &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 void globalEndJob (const trigger::Efficiency *efficiency)
 
static std::unique_ptr
< trigger::Efficiency
initializeGlobalCache (edm::ParameterSet const &)
 
- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

unsigned int acceptCount_
 accept counter More...
 
unsigned int eventCount_
 event counter More...
 
edm::InputTag gtDigiTag_
 GT payload, to extract the prescale column index. More...
 
edm::EDGetTokenT
< L1GlobalTriggerReadoutRecord
gtDigiToken_
 
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::stream::EDFilter< edm::GlobalCache< trigger::Efficiency > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase 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

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

Author
Martin Grunewald
Philipp Schieferdecker

Definition at line 34 of file HLTPrescaler.h.

Constructor & Destructor Documentation

HLTPrescaler::HLTPrescaler ( edm::ParameterSet const &  iConfig,
const trigger::Efficiency efficiency 
)
explicit

Definition at line 32 of file HLTPrescaler.cc.

References LogDebug, cppFunctionSkipper::operator, and prescaleService_.

32  :
33  prescaleSet_(0)
34  , prescaleFactor_(1)
35  , eventCount_(0)
36  , acceptCount_(0)
37  , offsetCount_(0)
38  , offsetPhase_(iConfig.getParameter<unsigned int>("offset"))
39  , prescaleService_(0)
40  , newLumi_(true)
41  , gtDigiTag_ (iConfig.getParameter<edm::InputTag>("L1GtReadoutRecordTag"))
42  , gtDigiToken_ (consumes<L1GlobalTriggerReadoutRecord>(gtDigiTag_))
43 {
46  else
47  LogDebug("NoPrescaleService")<<"PrescaleService unavailable, prescaleFactor=1!";
48 }
#define LogDebug(id)
edm::service::PrescaleService * prescaleService_
prescale service
Definition: HLTPrescaler.h:82
unsigned int acceptCount_
accept counter
Definition: HLTPrescaler.h:75
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > gtDigiToken_
Definition: HLTPrescaler.h:89
unsigned int eventCount_
event counter
Definition: HLTPrescaler.h:72
bool newLumi_
check for (re)initialization of the prescale
Definition: HLTPrescaler.h:85
unsigned int prescaleSet_
l1 prescale set index
Definition: HLTPrescaler.h:66
edm::InputTag gtDigiTag_
GT payload, to extract the prescale column index.
Definition: HLTPrescaler.h:88
unsigned int offsetPhase_
Definition: HLTPrescaler.h:79
unsigned int offsetCount_
initial offset
Definition: HLTPrescaler.h:78
unsigned int prescaleFactor_
accept one in prescaleFactor_; 0 means never to accept an event
Definition: HLTPrescaler.h:69
HLTPrescaler::~HLTPrescaler ( )
virtual

Definition at line 51 of file HLTPrescaler.cc.

52 {
53 
54 }

Member Function Documentation

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 68 of file HLTPrescaler.cc.

References newLumi_.

70 {
71  newLumi_ = true;
72 }
bool newLumi_
check for (re)initialization of the prescale
Definition: HLTPrescaler.h:85
void HLTPrescaler::endStream ( )
overridevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 129 of file HLTPrescaler.cc.

References acceptCount_, and eventCount_.

130 {
131  //since these are std::atomic, it is safe to increment them
132  // even if multiple endStreams are being called.
133  globalCache()->eventCount_ += eventCount_;
134  globalCache()->acceptCount_ += acceptCount_;
135  return;
136 }
unsigned int acceptCount_
accept counter
Definition: HLTPrescaler.h:75
unsigned int eventCount_
event counter
Definition: HLTPrescaler.h:72
void HLTPrescaler::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 60 of file HLTPrescaler.cc.

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

60  {
62  desc.add<unsigned int>("offset",0);
63  desc.add<edm::InputTag>("L1GtReadoutRecordTag",edm::InputTag("hltGtDigis"));
64  descriptions.add("hltPrescaler", desc);
65 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool HLTPrescaler::filter ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements edm::stream::EDFilterBase.

Definition at line 76 of file HLTPrescaler.cc.

References acceptCount_, edm::EventID::event(), eventCount_, edm::Event::getByToken(), edm::Event::getLuminosityBlock(), edm::service::PrescaleService::getPrescale(), gtDigiToken_, patZpeak::handle, edm::LuminosityBlockBase::id(), edm::EventBase::id(), edm::HandleBase::isValid(), edm::LuminosityBlockID::luminosityBlock(), edm::Event::moduleCallingContext(), newLumi_, offsetCount_, offsetPhase_, edm::PlaceInPathContext::pathContext(), edm::PathContext::pathName(), EgammaValidation_cff::pathName, edm::ModuleCallingContext::placeInPathContext(), prescaleFactor_, prescaleSeed_, prescaleService_, prescaleSet_, query::result, and AlCaHLTBitMon_QueryRunRegistry::string.

77 {
78  // during the first event of a LumiSection, read from the GT the prescale index for this
79  // LumiSection and get the corresponding prescale factor from the PrescaleService
80  if (newLumi_) {
81  newLumi_ = false;
82 
83  bool needsInit (eventCount_==0);
84 
85  if (prescaleService_) {
87  const unsigned int oldSet(prescaleSet_);
88  const unsigned int oldPrescale(prescaleFactor_);
89 
91  iEvent.getByToken(gtDigiToken_,handle);
92  if (handle.isValid()) {
93  prescaleSet_ = handle->gtFdlWord().gtPrescaleFactorIndexAlgo();
94  // gtPrescaleFactorIndexTech() is also available
95  // by construction, they should always return the same index
97  } else {
98  edm::LogWarning("HLT") << "Cannot read prescale column index from GT data: using default as defined by configuration or DAQ";
100  }
101 
102  if (prescaleSet_ != oldSet) {
103  edm::LogInfo("ChangedPrescale")
104  << "lumiBlockNb = " << iEvent.getLuminosityBlock().id().luminosityBlock()
105  << ", set = " << prescaleSet_ << " [" << oldSet <<"]"
106  << ", path = "<< pathName
107  << ": " << prescaleFactor_ << " [" <<oldPrescale<<"]";
108  // reset the prescale counter
109  needsInit = true;
110  }
111  }
112 
113  if (needsInit && (prescaleFactor_ != 0)) {
114  // initialize the prescale counter to the first event number multiplied by a big "seed"
116  }
117  }
118 
119  const bool result ( (prescaleFactor_ == 0) ?
120  false : ((eventCount_ + offsetCount_) % prescaleFactor_ == 0) );
121 
122  ++eventCount_;
123  if (result) ++acceptCount_;
124  return result;
125 }
LuminosityBlockID id() const
std::string const & pathName() const
Definition: PathContext.h:37
EventNumber_t event() const
Definition: EventID.h:41
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
edm::service::PrescaleService * prescaleService_
prescale service
Definition: HLTPrescaler.h:82
static const unsigned int prescaleSeed_
&quot;seed&quot; used to initialize the prescale counter
Definition: HLTPrescaler.h:93
unsigned int acceptCount_
accept counter
Definition: HLTPrescaler.h:75
ModuleCallingContext const * moduleCallingContext() const
Definition: Event.h:224
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > gtDigiToken_
Definition: HLTPrescaler.h:89
PathContext const * pathContext() const
tuple result
Definition: query.py:137
unsigned int eventCount_
event counter
Definition: HLTPrescaler.h:72
bool newLumi_
check for (re)initialization of the prescale
Definition: HLTPrescaler.h:85
tuple handle
Definition: patZpeak.py:22
unsigned int prescaleSet_
l1 prescale set index
Definition: HLTPrescaler.h:66
LuminosityBlock const & getLuminosityBlock() const
Definition: Event.h:84
bool isValid() const
Definition: HandleBase.h:75
unsigned long long uint64_t
Definition: Time.h:15
unsigned int getPrescale(std::string const &prescaledPath) const
LuminosityBlockNumber_t luminosityBlock() const
unsigned int offsetPhase_
Definition: HLTPrescaler.h:79
edm::EventID id() const
Definition: EventBase.h:60
PlaceInPathContext const * placeInPathContext() const
unsigned int offsetCount_
initial offset
Definition: HLTPrescaler.h:78
unsigned int prescaleFactor_
accept one in prescaleFactor_; 0 means never to accept an event
Definition: HLTPrescaler.h:69
void HLTPrescaler::globalEndJob ( const trigger::Efficiency efficiency)
static

Definition at line 139 of file HLTPrescaler.cc.

References accept(), trigger::Efficiency::acceptCount_, event(), trigger::Efficiency::eventCount_, and bookConverter::max.

140 {
141  unsigned int accept(efficiency->acceptCount_);
142  unsigned int event (efficiency->eventCount_);
143  edm::LogInfo("PrescaleSummary")
144  << accept << "/" << event
145  << " ("
146  << 100.*accept/static_cast<double>(std::max(1u,event))
147  << "% of events accepted).";
148  return;
149 }
std::atomic< unsigned int > acceptCount_
Definition: HLTPrescaler.h:30
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:24
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::atomic< unsigned int > eventCount_
Definition: HLTPrescaler.h:29
static std::unique_ptr<trigger::Efficiency> HLTPrescaler::initializeGlobalCache ( edm::ParameterSet const &  )
inlinestatic

Definition at line 43 of file HLTPrescaler.h.

43  {
44  return std::unique_ptr<trigger::Efficiency>(new trigger::Efficiency());
45  }

Member Data Documentation

unsigned int HLTPrescaler::acceptCount_
private

accept counter

Definition at line 75 of file HLTPrescaler.h.

Referenced by endStream(), and filter().

unsigned int HLTPrescaler::eventCount_
private

event counter

Definition at line 72 of file HLTPrescaler.h.

Referenced by endStream(), and filter().

edm::InputTag HLTPrescaler::gtDigiTag_
private

GT payload, to extract the prescale column index.

Definition at line 88 of file HLTPrescaler.h.

edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> HLTPrescaler::gtDigiToken_
private

Definition at line 89 of file HLTPrescaler.h.

Referenced by filter().

bool HLTPrescaler::newLumi_
private

check for (re)initialization of the prescale

Definition at line 85 of file HLTPrescaler.h.

Referenced by beginLuminosityBlock(), and filter().

unsigned int HLTPrescaler::offsetCount_
private

initial offset

Definition at line 78 of file HLTPrescaler.h.

Referenced by filter().

unsigned int HLTPrescaler::offsetPhase_
private

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

Referenced by filter().

const unsigned int HLTPrescaler::prescaleSeed_ = 65537
staticprivate

"seed" used to initialize the prescale counter

Definition at line 93 of file HLTPrescaler.h.

Referenced by filter().

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

prescale service

Definition at line 82 of file HLTPrescaler.h.

Referenced by filter(), and HLTPrescaler().

unsigned int HLTPrescaler::prescaleSet_
private

l1 prescale set index

Definition at line 66 of file HLTPrescaler.h.

Referenced by filter().