LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
DumpChargedSpacePoints_module.cc
Go to the documentation of this file.
1 
8 // LArSoft includes
11 
12 // art libraries
17 
18 // support libraries
19 #include "fhiclcpp/types/Atom.h" // also pulls in fhicl::Name and fhicl::Comment
21 
22 // C//C++ standard libraries
23 #include <string>
24 
25 namespace recob {
26 
47  public:
49  struct Config {
50  using Name = fhicl::Name;
52 
54  Name("SpacePointLabel"),
55  Comment("label of the producer used to create"
56  " the recob::SpacePoint collection to be dumped")};
58  Name("OutputCategory"),
59  Comment("the category used for the output (useful for filtering)"),
60  "DumpChargedSpacePoints" /* default value */
61  };
62 
63  }; // struct Config
64 
66 
68  explicit DumpChargedSpacePoints(Parameters const& config);
69 
71  virtual void analyze(art::Event const& event) override;
72 
73  private:
75  std::string fOutputCategory;
76 
77  }; // class DumpChargedSpacePoints
78 
79 } // namespace recob
80 
81 //==============================================================================
82 //=== Implementation section
83 //==============================================================================
84 
85 //----------------------------------------------------------------------------
87  : EDAnalyzer(config)
88  , fInputTag(config().SpacePointTag())
89  , fOutputCategory(config().OutputCategory())
90 {}
91 
92 //----------------------------------------------------------------------------
94 {
95 
96  //
97  // collect all the available information
98  //
99  // fetch the data to be dumped on screen
100  auto const& points = proxy::getChargedSpacePoints(event, fInputTag);
101 
102  size_t const nPoints = points.size();
104  log << "The event " << event.id() << " contains " << nPoints << " space points from '"
105  << fInputTag.encode() << "'";
106 
107  for (auto const& point : points) {
108 
109  log << "\n [#" << point.index() << "] " << point.point() << " " << point.charge();
110 
111  } // for
112 
113  log << "\n"; // two empty lines
114 
115 } // DumpChargedSpacePoints::analyze()
116 
117 //----------------------------------------------------------------------------
119 
120 //----------------------------------------------------------------------------
auto getChargedSpacePoints(Event const &event, art::InputTag inputTag, Args &&...withArgs)
Creates and returns a proxy to space points with associated charge.
Reconstruction base classes.
Prints the content of all the space points and charge on screen.
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.cc:6
std::string encode() const
Definition: InputTag.cc:97
Offers proxy::ChargedSpacePoints and proxy::SpacePointWithCharge class for recob::SpacePoint with rec...
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
virtual void analyze(art::Event const &event) override
Does the printing.
std::string fOutputCategory
Category for LogInfo output.
DumpChargedSpacePoints(Parameters const &config)
Constructor.
art::InputTag fInputTag
Input tag of the SpacePoint product.
Event finding and building.