LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
DumpChargedSpacePoints_module.cc
Go to the documentation of this file.
1 
8 // LArSoft includes
13 
14 // art libraries
19 
20 // support libraries
22 #include "fhiclcpp/ParameterSet.h"
23 #include "fhiclcpp/types/Atom.h" // also pulls in fhicl::Name and fhicl::Comment
24 
25 // C//C++ standard libraries
26 #include <string>
27 
28 
29 namespace recob {
30 
51  public:
52 
54  struct Config {
55  using Name = fhicl::Name;
57 
59  Name ("SpacePointLabel"),
60  Comment(
61  "label of the producer used to create"
62  " the recob::SpacePoint collection to be dumped"
63  )
64  };
66  Name ("OutputCategory"),
67  Comment("the category used for the output (useful for filtering)"),
68  "DumpChargedSpacePoints" /* default value */
69  };
70 
71  }; // struct Config
72 
74 
75 
77  explicit DumpChargedSpacePoints(Parameters const& config);
78 
80  virtual void analyze (art::Event const& event) override;
81 
82  private:
83 
85  std::string fOutputCategory;
86 
87  }; // class DumpChargedSpacePoints
88 
89 } // namespace recob
90 
91 
92 //==============================================================================
93 //=== Implementation section
94 //==============================================================================
95 
96 //----------------------------------------------------------------------------
99  : EDAnalyzer(config)
100  , fInputTag(config().SpacePointTag())
101  , fOutputCategory(config().OutputCategory())
102  {}
103 
104 
105 //----------------------------------------------------------------------------
107 
108  //
109  // collect all the available information
110  //
111  // fetch the data to be dumped on screen
112  auto const& points = proxy::getChargedSpacePoints(event, fInputTag);
113 
114  size_t const nPoints = points.size();
116  log
117  << "The event " << event.id()
118  << " contains " << nPoints
119  << " space points from '" << fInputTag.encode() << "'";
120 
121  for (auto const& point: points) {
122 
123  log << "\n [#" << point.index() << "] "
124  << point.point() << " " << point.charge();
125 
126  } // for
127 
128  log << "\n"; // two empty lines
129 
130 } // DumpChargedSpacePoints::analyze()
131 
132 
133 //----------------------------------------------------------------------------
135 
136 
137 //----------------------------------------------------------------------------
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.
Information about charge reconstructed in the active volume.
Functions dumping space points.
Offers proxy::ChargedSpacePoints and proxy::SpacePointWithCharge class for recob::SpacePoint with rec...
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
virtual void analyze(art::Event const &event) override
Does the printing.
std::string encode() const
Definition: InputTag.cc:36
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
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.