Public Member Functions | Private Member Functions | Private Attributes | List of all members
arttest::FindManySpeedTestProducer Class Reference
Inheritance diagram for arttest::FindManySpeedTestProducer:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 FindManySpeedTestProducer (fhicl::ParameterSet const &p)
 
- Public Member Functions inherited from art::EDProducer
 EDProducer ()=default
 
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer ()
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob ()
 
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 &mc)
 
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
virtual ~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 &)
 
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 ()
 
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)
 

Private Member Functions

void produce (art::Event &e) override
 

Private Attributes

size_t const nTracks_
 
size_t const nHits_
 
size_t const pmHitsPerTrack_
 
std::mt19937_64 gen_
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 

Detailed Description

Definition at line 29 of file FindManySpeedTestProducer_module.cc.

Constructor & Destructor Documentation

arttest::FindManySpeedTestProducer::FindManySpeedTestProducer ( fhicl::ParameterSet const &  p)
explicit

Definition at line 42 of file FindManySpeedTestProducer_module.cc.

44  : EDProducer{p}
45  , nTracks_{p.get<size_t>("nTracks")}
46  , nHits_{p.get<size_t>("nHits")}
47  , pmHitsPerTrack_{p.get<size_t>("pmHitsPerTrack")}
48  , gen_{p.get<size_t>(
49  "randomSeed",
50  std::chrono::system_clock::now().time_since_epoch().count())}
51 {
52  produces<std::vector<arttest::Hit>>();
53  produces<std::vector<arttest::Track>>();
54  produces<art::Assns<arttest::Track, arttest::Hit>>();
55 }
EDProducer()=default
p
Definition: test.py:228

Member Function Documentation

void arttest::FindManySpeedTestProducer::produce ( art::Event e)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 58 of file FindManySpeedTestProducer_module.cc.

59 {
60  auto vh_pid = e.getProductID<std::vector<arttest::Hit>>();
61  auto vt_pid = e.getProductID<std::vector<arttest::Track>>();
62 
63  // Hits.
64  auto hits = std::make_unique<std::vector<arttest::Hit>>(nHits_);
65  std::iota(hits->begin(), hits->end(), 0ul);
66  e.put(std::move(hits));
67 
68  // Tracks.
69  auto tracks = std::make_unique<std::vector<arttest::Track>>(nTracks_);
70  std::iota(tracks->begin(), tracks->end(), 0ul);
71  e.put(std::move(tracks));
72 
73  // Assns.
74  auto assns = std::make_unique<art::Assns<arttest::Hit, arttest::Track>>();
75  std::poisson_distribution<size_t> pdist(pmHitsPerTrack_);
76  std::uniform_int_distribution<size_t> udist(0, nHits_);
77  auto pdice = std::bind(pdist, gen_);
78  auto udice = std::bind(udist, gen_);
79  auto hPG = e.productGetter(vh_pid);
80  auto tPG = e.productGetter(vt_pid);
81  for (size_t iTrack = 0; iTrack != nTracks_; ++iTrack) {
82  art::Ptr<arttest::Track> trackPtr(vt_pid, iTrack, tPG);
83 
84  for (size_t i = 0, nHitsTrack = pdice(); i != nHitsTrack; ++i) {
85  assns->addSingle(art::Ptr<arttest::Hit>(vh_pid, udice(), hPG), trackPtr);
86  }
87  }
88  e.put(std::move(assns));
89 }
ProductID getProductID(std::string const &instance_name="") const
Definition: DataViewImpl.h:347
EDProductGetter const * productGetter(ProductID const pid) const
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
Definition: fwd.h:26

Member Data Documentation

std::mt19937_64 arttest::FindManySpeedTestProducer::gen_
private

Definition at line 39 of file FindManySpeedTestProducer_module.cc.

size_t const arttest::FindManySpeedTestProducer::nHits_
private

Definition at line 37 of file FindManySpeedTestProducer_module.cc.

size_t const arttest::FindManySpeedTestProducer::nTracks_
private

Definition at line 36 of file FindManySpeedTestProducer_module.cc.

size_t const arttest::FindManySpeedTestProducer::pmHitsPerTrack_
private

Definition at line 38 of file FindManySpeedTestProducer_module.cc.


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