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
17 #include "fhiclcpp/types/Atom.h"
18 #include "fhiclcpp/types/Name.h"
19 #include "fhiclcpp/types/Comment.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  */
43  public:
44 
45  struct Config {
46  using Name = fhicl::Name;
48 
50  Name("nHits"),
51  Comment("number of dummy hits to be generated"),
52  100
53  };
54 
55  }; // struct Config
56 
58 
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 // -----------------------------------------------------------------------------
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 // -----------------------------------------------------------------------------
117 
118 // -----------------------------------------------------------------------------
Who knows?
Definition: geo_types.h:147
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Unknown view.
Definition: geo_types.h:136
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
ChannelGroupService::Name Name
int TDCtick_t
Type representing a TDC tick.
Definition: RawTypes.h:25
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
static Config * config
Definition: config.cpp:1054
def move(depos, offset)
Definition: depos.py:107
virtual void produce(art::Event &event) override
Definition of data types for geometry description.
Declaration of signal hit object.
unsigned int nHits
Number of hits to be generated.
#define Comment
LArSoft-specific namespace.
AssnsChainHitMaker(Parameters const &config)
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
Event finding and building.