TrackProxyHitMaker_module.cc
Go to the documentation of this file.
1 /**
2  * @file TrackProxyHitMaker_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  * This started as a copy of `lar::test::AssnsChainHitMaker` test module.
8  */
9 
10 // LArSoft libraries
12 #include "larcoreobj/SimpleTypesAndConstants/geo_types.h" // geo namespace
13 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw namespace
14 
15 // framework libraries
20 #include "fhiclcpp/types/Atom.h"
21 #include "fhiclcpp/types/Name.h"
22 #include "fhiclcpp/types/Comment.h"
23 
24 // C/C++ standard libraries
25 #include <utility> // std::move()
26 #include <memory> // std::make_unique()
27 
28 
29 namespace lar {
30  namespace test {
31 
32  // -------------------------------------------------------------------------
33  /**
34  * @brief Creates some dummy hits.
35  *
36  * The produced hits are not associated to wires or raw digits.
37  *
38  * Configuration parameters
39  * =========================
40  *
41  * * *nHits* (unsigned integer, default: 100): number of hits to produce
42  *
43  */
45  public:
46 
47  struct Config {
48  using Name = fhicl::Name;
50 
52  Name("nHits"),
53  Comment("number of dummy hits to be generated"),
54  100
55  };
56 
57  }; // struct Config
58 
60 
62  : EDProducer{config}, nHits(config().nHits())
63  {
64  produces<std::vector<recob::Hit>>();
65  }
66 
67  virtual void produce(art::Event& event) override;
68 
69  private:
70  unsigned int nHits; ///< Number of hits to be generated.
71 
72  }; // TrackProxyHitMaker
73 
74  // -------------------------------------------------------------------------
75 
76 
77  } // namespace test
78 } // namespace lar
79 
80 
81 // -----------------------------------------------------------------------------
83 
84  auto hits = std::make_unique<std::vector<recob::Hit>>();
85 
86  for (unsigned int i = 0; i < nHits; ++i) {
87 
88  hits->emplace_back(
89  raw::ChannelID_t(i + 1), // channel
90  raw::TDCtick_t(10*i), // start_tick
91  raw::TDCtick_t(10*i + 40), // end_tick
92  10.0 * i, // peak_time
93  1.0, // sigma_peak_time
94  0.5, // RMS
95  200.0 + i, // peak_amplitude
96  10.0, // sigma_peak_amplitude
97  400.0, // summedADC
98  400.0, // hit_integral
99  10.0, // hit_sigma_integral
100  1, // multiplicity
101  0, // local_index
102  1.0, // goodness_of_fit
103  37, // DOF
104  geo::kUnknown, // view
105  geo::kCollection, // signal_type
106  geo::WireID{ 0, 1, 2, i } // wire ID
107  );
108 
109  } // for
110 
111  mf::LogInfo("TrackProxyHitMaker") << "Produced " << hits->size() << " hits.";
112 
113  event.put(std::move(hits));
114 
115 } // lar::test::TrackProxyHitMaker::produce()
116 
117 // -----------------------------------------------------------------------------
119 
120 // -----------------------------------------------------------------------------
virtual void produce(art::Event &event) override
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
unsigned int nHits
Number of hits to be generated.
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
static Config * config
Definition: config.cpp:1054
def move(depos, offset)
Definition: depos.py:107
Definition of data types for geometry description.
Declaration of signal hit object.
#define Comment
LArSoft-specific namespace.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
Event finding and building.
TrackProxyHitMaker(Parameters const &config)
Signal from collection planes.
Definition: geo_types.h:146