All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AssnsChainHitMaker_module.cc
Go to the documentation of this file.
1 /**
2  * @file AssnsChainHitMaker_module.cc
3  * @brief Test producer creating a few dummy hits.
4  * @author Gianluca Petrillo (petrillo@fnal.gov)
5  * @date June 23, 2017
6  */
7 
8 // LArSoft libraries
10 #include "larcoreobj/SimpleTypesAndConstants/geo_types.h" // geo namespace
11 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw namespace
12 
13 // framework libraries
14 #include "art/Framework/Core/EDProducer.h"
15 #include "art/Framework/Core/ModuleMacros.h"
16 #include "art/Framework/Principal/Event.h"
17 #include "fhiclcpp/types/Atom.h"
18 #include "fhiclcpp/types/Name.h"
19 #include "fhiclcpp/types/Comment.h"
20 #include "messagefacility/MessageLogger/MessageLogger.h"
21 
22 // C/C++ standard libraries
23 #include <utility> // std::move()
24 #include <memory> // std::make_unique()
25 
26 
27 namespace lar {
28  namespace test {
29 
30  // -------------------------------------------------------------------------
31  /**
32  * @brief Creates some dummy hits.
33  *
34  * The produced hits are not associated to wires or raw digits.
35  *
36  * Configuration parameters
37  * =========================
38  *
39  * * *nHits* (unsigned integer, default: 100): number of hits to produce
40  *
41  */
42  class AssnsChainHitMaker: public art::EDProducer {
43  public:
44 
45  struct Config {
46  using Name = fhicl::Name;
47  using Comment = fhicl::Comment;
48 
49  fhicl::Atom<unsigned int> nHits{
50  Name("nHits"),
51  Comment("number of dummy hits to be generated"),
52  100
53  };
54 
55  }; // struct Config
56 
57  using Parameters = art::EDProducer::Table<Config>;
58 
59  explicit AssnsChainHitMaker(Parameters const& config)
60  : EDProducer{config}, nHits(config().nHits())
61  {
62  produces<std::vector<recob::Hit>>();
63  }
64 
65  virtual void produce(art::Event& event) override;
66 
67  private:
68  unsigned int nHits; ///< Number of hits to be generated.
69 
70  }; // AssnsChainHitMaker
71 
72  // -------------------------------------------------------------------------
73 
74 
75  } // namespace test
76 } // namespace lar
77 
78 
79 // -----------------------------------------------------------------------------
80 void lar::test::AssnsChainHitMaker::produce(art::Event& event) {
81 
82  auto hits = std::make_unique<std::vector<recob::Hit>>();
83 
84  for (unsigned int i = 0; i < nHits; ++i) {
85 
86  hits->emplace_back(
87  raw::ChannelID_t(i + 1), // channel
88  raw::TDCtick_t(10*i), // start_tick
89  raw::TDCtick_t(10*i + 40), // end_tick
90  10.0 * i, // peak_time
91  1.0, // sigma_peak_time
92  0.5, // RMS
93  200.0 + i, // peak_amplitude
94  10.0, // sigma_peak_amplitude
95  400.0, // summedADC
96  400.0, // hit_integral
97  10.0, // hit_sigma_integral
98  1, // multiplicity
99  0, // local_index
100  1.0, // goodness_of_fit
101  37, // DOF
102  geo::kUnknown, // view
103  geo::kMysteryType, // signal_type
104  geo::WireID{ 0, 1, 2, i } // wire ID
105  );
106 
107  } // for
108 
109  mf::LogInfo("AssnsChainHitMaker") << "Produced " << hits->size() << " hits.";
110 
111  event.put(std::move(hits));
112 
113 } // lar::test::AssnsChainHitMaker::produce()
114 
115 // -----------------------------------------------------------------------------
116 DEFINE_ART_MODULE(lar::test::AssnsChainHitMaker)
117 
118 // -----------------------------------------------------------------------------
Who knows?
Definition: geo_types.h:147
Unknown view.
Definition: geo_types.h:136
Declaration of signal hit object.
int TDCtick_t
Type representing a TDC tick.
Definition: RawTypes.h:25
virtual void produce(art::Event &event) override
BEGIN_PROLOG vertical distance to the surface Name
Definition of data types for geometry description.
unsigned int nHits
Number of hits to be generated.
AssnsChainHitMaker(Parameters const &config)
art::EDProducer::Table< Config > Parameters
BEGIN_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree showermakertwo END_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree sequence::inline_paths sequence::inline_paths sequence::inline_paths showermakers test
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28