Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
arttest::MixProducer Class Reference
Inheritance diagram for arttest::MixProducer:
art::SharedProducer art::detail::Producer art::detail::SharedModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Classes

struct  Config
 

Public Types

using Parameters = Table< Config >
 
- Public Types inherited from art::SharedProducer
using ModuleType = SharedProducer
 
using WorkerType = WorkerT< SharedProducer >
 
- 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 >
 

Public Member Functions

 MixProducer (Parameters const &p, art::ProcessingFrame const &)
 
- Public Member Functions inherited from art::SharedProducer
 SharedProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 SharedProducer (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)
 
- Public Member Functions inherited from art::detail::SharedModule
 SharedModule ()
 
 SharedModule (std::string const &moduleLabel)
 
 ~SharedModule () noexcept
 
hep::concurrency::SerialTaskQueueChain * serialTaskQueueChain () const
 
void createQueues ()
 
template<BranchType BT = InEvent, typename... T>
void serialize (T const &...)
 
template<BranchType BT = InEvent>
void async ()
 
template<BranchType , typename... T>
void serialize (T const &...resources)
 

Private Types

using mv_t = cet::map_vector< unsigned int >
 
using mvv_t = mv_t::value_type
 
using mvm_t = mv_t::mapped_type
 

Private Member Functions

void produce (art::Event &e, art::ProcessingFrame const &) override
 
void endSubRun (art::SubRun &sr, art::ProcessingFrame const &) override
 
void endRun (art::Run &r, art::ProcessingFrame const &) override
 

Private Attributes

std::atomic< size_t > eventCounter_ {}
 
std::atomic< size_t > subrunCounter_ {}
 
std::atomic< size_t > runCounter_ {}
 

Detailed Description

Definition at line 29 of file MixProducer_module.cc.

Member Typedef Documentation

using arttest::MixProducer::mv_t = cet::map_vector<unsigned int>
private

Definition at line 41 of file MixProducer_module.cc.

Definition at line 43 of file MixProducer_module.cc.

Definition at line 42 of file MixProducer_module.cc.

Definition at line 33 of file MixProducer_module.cc.

Constructor & Destructor Documentation

arttest::MixProducer::MixProducer ( Parameters const &  p,
art::ProcessingFrame const &   
)
explicit

Definition at line 51 of file MixProducer_module.cc.

54 {
55  async<art::InEvent>();
56 
57  produces<double>("doubleLabel");
58  produces<IntProduct>("IntProductLabel");
59  produces<IntProduct>("SpottyProductLabel");
60  produces<std::string>("stringLabel");
61  produces<std::vector<double>>("doubleCollectionLabel");
62  produces<std::vector<art::Ptr<double>>>("doubleVectorPtrLabel");
63  produces<art::PtrVector<double>>("doublePtrVectorLabel");
64  produces<ProductWithPtrs>("ProductWithPtrsLabel");
65  produces<mv_t>("mapVectorLabel");
66  produces<std::vector<art::Ptr<mvv_t>>>("intVectorPtrLabel");
67  produces<double, art::InSubRun>("DoubleSRLabel");
68  produces<double, art::InRun>("DoubleRLabel");
69 }
p
Definition: test.py:228

Member Function Documentation

void arttest::MixProducer::endRun ( art::Run r,
art::ProcessingFrame const &   
)
overrideprivatevirtual

Reimplemented from art::SharedProducer.

Definition at line 161 of file MixProducer_module.cc.

162 {
163  ++runCounter_;
164  r.put(std::make_unique<double>(runCounter_), "DoubleRLabel");
165 }
std::atomic< size_t > runCounter_
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
void arttest::MixProducer::endSubRun ( art::SubRun sr,
art::ProcessingFrame const &   
)
overrideprivatevirtual

Reimplemented from art::SharedProducer.

Definition at line 154 of file MixProducer_module.cc.

155 {
156  ++subrunCounter_;
157  sr.put(std::make_unique<double>(subrunCounter_), "DoubleSRLabel");
158 }
std::atomic< size_t > subrunCounter_
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
void arttest::MixProducer::produce ( art::Event e,
art::ProcessingFrame const &   
)
overrideprivatevirtual

Implements art::SharedProducer.

Definition at line 72 of file MixProducer_module.cc.

73 {
74  ++eventCounter_;
75 
76  // double
77  e.put(std::make_unique<double>(eventCounter_), "doubleLabel");
78 
79  // IntProduct
80  e.put(std::make_unique<IntProduct>(eventCounter_ + 1000000),
81  "IntProductLabel");
82 
83  // SpottyProduct
84  if (e.event() % 100) {
85  e.put(std::make_unique<IntProduct>(eventCounter_), "SpottyProductLabel");
86  }
87 
88  // std::string
89  std::ostringstream s;
90  s << "string value: " << std::setfill('0') << std::setw(7) << eventCounter_
91  << "\n";
92  e.put(std::make_unique<std::string>(s.str()), "stringLabel");
93 
94  // 1. std::vector<double>
95  //
96  // 2. std::vector<art::Ptr<double>>
97  //
98  // 3. art::PtrVector<double>
99  //
100  // 4. ProductWithPtrs
101  auto coll = std::make_unique<std::vector<double>>();
102  coll->reserve(10);
103  for (size_t i = 1; i < 11; ++i) {
104  coll->push_back(i + 10 * (eventCounter_ - 1));
105  }
106  e.put(move(coll), "doubleCollectionLabel"); // 1.
107  auto vpd = std::make_unique<std::vector<art::Ptr<double>>>();
108  vpd->reserve(3);
109  auto pvd = std::make_unique<art::PtrVector<double>>();
110  pvd->reserve(3);
111  art::ProductID const collID{
112  e.getProductID<std::vector<double>>("doubleCollectionLabel")};
113  vpd->emplace_back(collID, 0, e.productGetter(collID));
114  vpd->emplace_back(collID, 4, e.productGetter(collID));
115  vpd->emplace_back(collID, 8, e.productGetter(collID));
116  pvd->push_back(art::Ptr<double>(collID, 1, e.productGetter(collID)));
117  pvd->push_back(art::Ptr<double>(collID, 5, e.productGetter(collID)));
118  pvd->push_back(art::Ptr<double>(collID, 9, e.productGetter(collID)));
119  auto pwp = std::make_unique<ProductWithPtrs>(
120 #ifndef ART_NO_MIX_PTRVECTOR
121  *pvd.get(),
122 #endif
123  *vpd.get());
124  e.put(move(vpd), "doubleVectorPtrLabel"); // 2.
125  e.put(std::move(pvd), "doublePtrVectorLabel"); // 3.
126  e.put(move(pwp), "ProductWithPtrsLabel"); // 4.
127 
128  // map_vector, .
129  auto mv = std::make_unique<mv_t>();
130  static size_t constexpr mv_size{5};
131  mv->reserve(mv_size);
132  for (size_t i = 0; i < mv_size; ++i) {
133  (*mv)[cet::map_vector_key(
134  static_cast<mvm_t>(1 + i * 2 + 10 * (eventCounter_ - 1)))] =
135  (eventCounter_ - 1) * mv_size + i + 1;
136  }
137 
138  // Ptr into map_vector.
139  auto mvvp = std::make_unique<std::vector<art::Ptr<mvv_t>>>();
140  mvvp->reserve(mv_size);
141  art::ProductID const mvID{e.getProductID<mv_t>("mapVectorLabel")};
142  mvvp->emplace_back(mvID, 10 * (eventCounter_ - 1) + 7, e.productGetter(mvID));
143  mvvp->emplace_back(mvID, 10 * (eventCounter_ - 1) + 1, e.productGetter(mvID));
144  mvvp->emplace_back(mvID, 10 * (eventCounter_ - 1) + 3, e.productGetter(mvID));
145  mvvp->emplace_back(mvID, 10 * (eventCounter_ - 1) + 9, e.productGetter(mvID));
146  mvvp->emplace_back(mvID, 10 * (eventCounter_ - 1) + 5, e.productGetter(mvID));
147 
148  e.put(move(mvvp), "intVectorPtrLabel");
149  e.put(move(mv), "mapVectorLabel"); // Note we're putting these into the event
150  // in the "wrong" order.
151 }
std::atomic< size_t > eventCounter_
EventNumber_t event() const
Definition: DataViewImpl.cc:96
ProductID getProductID(std::string const &instance_name="") const
Definition: DataViewImpl.h:347
cet::map_vector< unsigned int > mv_t
EDProductGetter const * productGetter(ProductID const pid) const
static const double s
Definition: Units.h:99
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692

Member Data Documentation

std::atomic<size_t> arttest::MixProducer::eventCounter_ {}
private

Definition at line 46 of file MixProducer_module.cc.

std::atomic<size_t> arttest::MixProducer::runCounter_ {}
private

Definition at line 48 of file MixProducer_module.cc.

std::atomic<size_t> arttest::MixProducer::subrunCounter_ {}
private

Definition at line 47 of file MixProducer_module.cc.


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