CompressedIntProducer_module.cc
Go to the documentation of this file.
1 //--------------------------------------------------------------------
2 //
3 // Produces a CompressedIntProduct instance.
4 //
5 //--------------------------------------------------------------------
6 
15 #include "fhiclcpp/ParameterSet.h"
16 
18 
19 #include <iostream>
20 #include <memory>
21 
22 namespace arttest {
24 }
25 
27 
29 public:
31  : EDProducer{p}
32  , value_(p.get<int>("ivalue"))
33  ,
34  // enums don't usually have a conversion from string
36  art::BranchType(p.get<unsigned long>("branchType", art::InEvent)))
37  {
38  art::test::run_time_produces<CompressedIntProduct>(this, branchType_);
39  }
40 
41 private:
42  void produce(art::Event& e) override;
43  void endSubRun(art::SubRun& sr) override;
44  void endRun(art::Run& r) override;
45 
46  int const value_;
48 
49 }; // CompressedIntProducer
50 
51 void
53 {
55  e.put(std::make_unique<CompressedIntProduct>(value_));
56 }
57 
58 void
60 {
62  sr.put(std::make_unique<CompressedIntProduct>(value_),
64 }
65 
66 void
68 {
69  if (branchType_ == art::InRun)
70  r.put(std::make_unique<CompressedIntProduct>(value_), art::runFragment());
71 }
72 
void endSubRun(art::SubRun &sr) override
EDProducer()=default
Definition: Run.h:21
constexpr auto runFragment()
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:68
CompressedIntProducer(fhicl::ParameterSet const &p)
p
Definition: test.py:228
constexpr auto subRunFragment()
BranchType
Definition: BranchType.h:18
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
static const double sr
Definition: Units.h:167