CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
PrescaleEventFilter Class Reference

#include <CalibTracker/SiStripCommon/plugins/PrescaleEventFilter.cc>

Inheritance diagram for PrescaleEventFilter:
edm::stream::EDFilter< edm::GlobalCache< prescale::Efficiency > > edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PrescaleEventFilter (edm::ParameterSet const &iConfig, const prescale::Efficiency *efficiency)
 
 ~PrescaleEventFilter () override
 
- Public Member Functions inherited from edm::stream::EDFilter< edm::GlobalCache< prescale::Efficiency > >
 EDFilter ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilterBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void globalEndJob (const prescale::Efficiency *efficiency)
 
static std::unique_ptr< prescale::EfficiencyinitializeGlobalCache (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 Member Functions

void beginStream (edm::StreamID) override
 
void endStream () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

unsigned int acceptCount_
 accept counter More...
 
unsigned int eventCount_
 event counter 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...
 

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< prescale::Efficiency > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Description: Simple class to prescale events entering the Strip Tracker Calibration Tree

Implementation: Largely copied from HLTrigger/HLTcore/plugins/HLTPrescaler.cc, without the need to specify a specific trigger path

Definition at line 45 of file PrescaleEventFilter.cc.

Constructor & Destructor Documentation

PrescaleEventFilter::PrescaleEventFilter ( edm::ParameterSet const &  iConfig,
const prescale::Efficiency efficiency 
)
explicit

Definition at line 89 of file PrescaleEventFilter.cc.

89  :
90  prescaleFactor_(iConfig.getParameter<unsigned int>("prescale")),
91  eventCount_(0),
92  acceptCount_(0),
93  offsetCount_(0),
94  offsetPhase_(iConfig.getParameter<unsigned int>("offset"))
95 {
96  //now do what ever initialization is needed
97 
98 }
unsigned int acceptCount_
accept counter
unsigned int prescaleFactor_
accept one in prescaleFactor_; 0 means never to accept an event
unsigned int offsetCount_
initial offset
unsigned int eventCount_
event counter
PrescaleEventFilter::~PrescaleEventFilter ( )
override

Definition at line 101 of file PrescaleEventFilter.cc.

102 {
103 }

Member Function Documentation

void PrescaleEventFilter::beginStream ( edm::StreamID  )
overrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 133 of file PrescaleEventFilter.cc.

134 {
135 }
void PrescaleEventFilter::endStream ( )
overrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 139 of file PrescaleEventFilter.cc.

References acceptCount_, and eventCount_.

140 {
141  //since these are std::atomic, it is safe to increment them
142  // even if multiple endStreams are being called.
143  globalCache()->eventCount_ += eventCount_;
144  globalCache()->acceptCount_ += acceptCount_;
145  return;
146 }
unsigned int acceptCount_
accept counter
unsigned int eventCount_
event counter
void PrescaleEventFilter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 164 of file PrescaleEventFilter.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

164  {
165 
167  desc.add<unsigned int>("prescale",1);
168  desc.add<unsigned int>("offset",0);
169  descriptions.add("prescaleEvent", desc);
170 
171 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool PrescaleEventFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 111 of file PrescaleEventFilter.cc.

References acceptCount_, edm::EventID::event(), eventCount_, edm::EventBase::id(), offsetCount_, offsetPhase_, prescaleFactor_, prescaleSeed_, and mps_fire::result.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

112 {
113  using namespace edm;
114 
115  bool needsInit (eventCount_==0);
116 
117  if (needsInit && (prescaleFactor_ != 0)) {
118  // initialize the prescale counter to the first event number multiplied by a big "seed"
120  }
121 
122  const bool result ( (prescaleFactor_ == 0) ?
123  false : ((eventCount_ + offsetCount_) % prescaleFactor_ == 0) );
124 
125  ++eventCount_;
126  if (result) ++acceptCount_;
127  return result;
128 
129 }
EventNumber_t event() const
Definition: EventID.h:41
unsigned int acceptCount_
accept counter
unsigned int prescaleFactor_
accept one in prescaleFactor_; 0 means never to accept an event
static const unsigned int prescaleSeed_
"seed" used to initialize the prescale counter
unsigned int offsetCount_
initial offset
unsigned int eventCount_
event counter
unsigned long long uint64_t
Definition: Time.h:15
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
void PrescaleEventFilter::globalEndJob ( const prescale::Efficiency efficiency)
static

Definition at line 150 of file PrescaleEventFilter.cc.

References accept(), prescale::Efficiency::acceptCount_, event(), prescale::Efficiency::eventCount_, and SiStripPI::max.

151 {
152  unsigned int accept(efficiency->acceptCount_);
153  unsigned int event (efficiency->eventCount_);
154  edm::LogInfo("PrescaleSummary")
155  << accept << "/" << event
156  << " ("
157  << 100.*accept/static_cast<double>(std::max(1u,event))
158  << "% of events accepted).";
159  return;
160 }
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
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 > acceptCount_
Definition: event.py:1
std::atomic< unsigned int > eventCount_
static std::unique_ptr<prescale::Efficiency> PrescaleEventFilter::initializeGlobalCache ( edm::ParameterSet const &  )
inlinestatic

Definition at line 50 of file PrescaleEventFilter.cc.

References fillDescriptions(), and ALCARECOTkAlBeamHalo_cff::filter.

50  {
51  return std::unique_ptr<prescale::Efficiency>(new prescale::Efficiency());
52  };

Member Data Documentation

unsigned int PrescaleEventFilter::acceptCount_
private

accept counter

Definition at line 72 of file PrescaleEventFilter.cc.

Referenced by endStream(), and filter().

unsigned int PrescaleEventFilter::eventCount_
private

event counter

Definition at line 69 of file PrescaleEventFilter.cc.

Referenced by endStream(), and filter().

bool PrescaleEventFilter::newLumi_
private

check for (re)initialization of the prescale

Definition at line 79 of file PrescaleEventFilter.cc.

unsigned int PrescaleEventFilter::offsetCount_
private

initial offset

Definition at line 75 of file PrescaleEventFilter.cc.

Referenced by filter().

unsigned int PrescaleEventFilter::offsetPhase_
private

Definition at line 76 of file PrescaleEventFilter.cc.

Referenced by filter().

unsigned int PrescaleEventFilter::prescaleFactor_
private

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

Definition at line 66 of file PrescaleEventFilter.cc.

Referenced by filter().

const unsigned int PrescaleEventFilter::prescaleSeed_ = 65537
staticprivate

"seed" used to initialize the prescale counter

Definition at line 82 of file PrescaleEventFilter.cc.

Referenced by filter().