Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
art::BlockingPrescaler Class Reference
Inheritance diagram for art::BlockingPrescaler:
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

 BlockingPrescaler (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 m_
 
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 27 of file BlockingPrescaler_module.cc.

Member Typedef Documentation

Definition at line 38 of file BlockingPrescaler_module.cc.

Constructor & Destructor Documentation

art::BlockingPrescaler::BlockingPrescaler ( Parameters const &  config,
ProcessingFrame const &   
)
explicit

Definition at line 53 of file BlockingPrescaler_module.cc.

56  , m_{config().blockSize()}
57  , n_{config().stepSize()}
58  , offset_{config().offset()}
59 {
60  if (n_ < m_) {
62  "There was an error configuring Blocking Prescaler.\n"}
63  << "The specified step size (" << n_ << ") is less than the block size ("
64  << m_ << ")\n";
65  }
66  async<InEvent>();
67 }
SharedFilter(fhicl::ParameterSet const &pset)
Definition: SharedFilter.h:22
static Config * config
Definition: config.cpp:1054
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66

Member Function Documentation

bool art::BlockingPrescaler::filter ( Event ,
ProcessingFrame const &   
)
overrideprivatevirtual

Implements art::SharedFilter.

Definition at line 70 of file BlockingPrescaler_module.cc.

71 {
72  // This sequence of operations/comparisons must be serialized.
73  // Changing 'count_' to be of type std::atomic<size_t> will not
74  // help. Using a mutex here is cheaper than calling serialize(),
75  // since that will also serialize any of the module-level service
76  // callbacks invoked before and after this function is called.
77  std::lock_guard lock{mutex_};
78  bool const result{(count_ >= offset_) && ((count_ - offset_) % n_) < m_};
79  ++count_;
80  return result;
81 }
static QCString result

Member Data Documentation

size_t art::BlockingPrescaler::count_ {}
private

Definition at line 44 of file BlockingPrescaler_module.cc.

size_t const art::BlockingPrescaler::m_
private

Definition at line 45 of file BlockingPrescaler_module.cc.

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

Definition at line 48 of file BlockingPrescaler_module.cc.

size_t const art::BlockingPrescaler::n_
private

Definition at line 46 of file BlockingPrescaler_module.cc.

size_t const art::BlockingPrescaler::offset_
private

Definition at line 47 of file BlockingPrescaler_module.cc.


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