Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
art::Prescaler Class Reference
Inheritance diagram for art::Prescaler:
art::SharedFilter art::detail::Filter art::detail::SharedModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Classes

struct  Config
 

Public Types

using Parameters = Table< Config >
 
- Public Types inherited from art::SharedFilter
using ModuleType = SharedFilter
 
using WorkerType = WorkerT< SharedFilter >
 
- Public Types inherited from art::detail::Filter
template<typename UserConfig >
using Table = Modifier::Table< UserConfig >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 

Public Member Functions

 Prescaler (Parameters const &, ProcessingFrame const &)
 
- Public Member Functions inherited from art::SharedFilter
 SharedFilter (fhicl::ParameterSet const &pset)
 
template<typename Config >
 SharedFilter (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Filter
virtual ~Filter () noexcept
 
 Filter (fhicl::ParameterSet const &)
 
 Filter (Filter const &)=delete
 
 Filter (Filter &&)=delete
 
Filteroperator= (Filter const &)=delete
 
Filteroperator= (Filter &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 
- Public Member Functions inherited from art::detail::SharedModule
 SharedModule ()
 
 SharedModule (std::string const &moduleLabel)
 
hep::concurrency::SerialTaskQueueChain * serialTaskQueueChain () const
 
std::set< std::string > const & sharedResources () const
 
void createQueues (SharedResources const &resources)
 
template<BranchType , typename... T>
void serialize (T const &...resources)
 
template<BranchType , typename... T>
void serializeExternal (T const &...resources)
 

Private Member Functions

bool filter (Event &, ProcessingFrame const &) override
 

Private Attributes

size_t count_ {}
 
size_t const n_
 
size_t const offset_
 
std::mutex mutex_ {}
 

Additional Inherited Members

- Static Public Attributes inherited from art::detail::Filter
static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
- Protected Member Functions inherited from art::detail::SharedModule
template<BranchType BT = InEvent, typename... T>
void serialize (T const &...)
 
template<BranchType BT = InEvent, typename... T>
void serializeExternal (T const &...)
 
template<BranchType BT = InEvent>
void async ()
 

Detailed Description

Definition at line 22 of file Prescaler_module.cc.

Member Typedef Documentation

Definition at line 29 of file Prescaler_module.cc.

Constructor & Destructor Documentation

Prescaler::Prescaler ( Parameters const &  config,
ProcessingFrame const &   
)
explicit

Definition at line 47 of file Prescaler_module.cc.

49  , n_{config().prescaleFactor()}
51 {
52  async<InEvent>();
53 }
size_t const n_
SharedFilter(fhicl::ParameterSet const &pset)
Definition: SharedFilter.h:22
Atom< size_t > prescaleFactor
static Config * config
Definition: config.cpp:1054
size_t const offset_
Atom< size_t > prescaleOffset

Member Function Documentation

bool Prescaler::filter ( Event ,
ProcessingFrame const &   
)
overrideprivatevirtual

Implements art::SharedFilter.

Definition at line 56 of file Prescaler_module.cc.

57 {
58  // The combination of incrementing, modulo dividing, and equality
59  // comparing must be synchronized. Changing count_ to the type
60  // std::atomic<size_t> would not help since the entire combination
61  // of operations must be atomic. Using a mutex here is cheaper than
62  // calling serialize(), since that will also serialize any of the
63  // module-level service callbacks invoked before and after this
64  // function is called.
65  std::lock_guard lock{mutex_};
66  ++count_;
67  return count_ % n_ == offset_;
68 }
size_t const n_
size_t const offset_

Member Data Documentation

size_t art::Prescaler::count_ {}
private

Definition at line 35 of file Prescaler_module.cc.

std::mutex art::Prescaler::mutex_ {}
private

Definition at line 41 of file Prescaler_module.cc.

size_t const art::Prescaler::n_
private

Definition at line 37 of file Prescaler_module.cc.

size_t const art::Prescaler::offset_
private

Definition at line 40 of file Prescaler_module.cc.


The documentation for this class was generated from the following file: