HitFinder_module.cc
Go to the documentation of this file.
1 /**
2  * @file HitFinder_module.cc
3  * @brief Hit finder (originating for cluster crawler algorithm)
4  * @author Bruce Baller (bballer@fnal.gov)
5  *
6  * Generated at Fri Jun 7 09:44:09 2013 by Bruce Baller using artmod
7  * from cetpkgsupport v1_02_00.
8  */
9 
10 
11 // C/C++ standard libraries
12 #include <utility> // std::unique_ptr<>
13 
14 // Framework libraries
15 #include "fhiclcpp/ParameterSet.h"
21 
22 //LArSoft includes
24 
25 // ... more includes in the implementation section
26 
27 
28 namespace hit {
29 
30  class HitFinder: public art::EDProducer {
31 
32  public:
33  explicit HitFinder(fhicl::ParameterSet const & pset);
34 
35  private:
36  void produce(art::Event & evt) override;
37 
38  void endJob() override;
39 
40  art::InputTag fCalDataModuleLabel; ///< label of module producing input wires
41  CCHitFinderAlg fCCHFAlg; // define CCHitFinderAlg object
42 
43  }; // hit::HitFinder()
44 
45 } // namespace hit
46 
47 //******************************************************************************
48 //*** implementation
49 //***
50 
51 // C/C++ standard libraries
52 #include <memory> // std::move()
53 
54 // Framework libraries
56 
57 //LArSoft includes
60 #include "lardata/ArtDataHelper/HitCreator.h" // recob::HitCollectionAssociator
61 
62 
63 namespace hit {
64 
65 
66  //----------------------------------------------------------------------------
68  : EDProducer{pset}
69  , fCCHFAlg{pset.get<fhicl::ParameterSet>("CCHitFinderAlg")}
70  {
71  fCalDataModuleLabel = pset.get<art::InputTag>("CalDataModuleLabel");
72 
73  // let HitCollectionAssociator declare that we are going to produce
74  // hits and associations with wires and raw digits
75  // (with no particular product label);
76  // TODO this should be marked as transient when art will implement issue #8018
78 
79  } // HitFinder::HitFinder()
80 
81 
82  //----------------------------------------------------------------------------
84  {
85  // fetch the wires needed by HitFinder
86 
87  // make this accessible to ClusterCrawler_module
89  = evt.getValidHandle<std::vector<recob::Wire>>(fCalDataModuleLabel);
90 
91  // find hits in all planes
92  fCCHFAlg.RunCCHitFinder(*wireVecHandle);
93 
94  // extract the result of the algorithm (it's moved)
95  std::unique_ptr<std::vector<recob::Hit>> Hits
96  (new std::vector<recob::Hit>(std::move(fCCHFAlg.YieldHits())));
97 
98  mf::LogInfo("HitFinder") << Hits->size() << " hits produced.";
99 
100  // shcol contains the hit collection
101  // and its associations to wires and raw digits;
102  // we get the association to raw digits through wire associations
104 
105  shcol.use_hits(std::move(Hits));
106 
107  // move the hit collection and the associations into the event:
108  shcol.put_into(evt);
109 
110  } // produce()
111 
112 
113  //----------------------------------------------------------------------------
115  // print the statistics about fits
116  mf::LogInfo log("HitFinder"); // messages are printed on "log" destruction
117  fCCHFAlg.PrintStats(log);
118  } // HitFinder::endJob()
119 
120 
122 
123 } // namespace hit
void RunCCHitFinder(std::vector< recob::Wire > const &Wires)
art::InputTag fCalDataModuleLabel
label of module producing input wires
void PrintStats(Stream &out) const
Print the fit statistics.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
void produce(art::Event &evt) override
void use_hits(std::unique_ptr< std::vector< recob::Hit >> &&srchits)
Uses the specified collection as data product.
Definition: HitCreator.cxx:390
static void declare_products(art::ProducesCollector &collector, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
Definition: HitCreator.cxx:248
Hit finder algorithm designed to work with Cluster Crawler.
Helper functions to create a hit.
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
HitFinder(fhicl::ParameterSet const &pset)
def move(depos, offset)
Definition: depos.py:107
A class handling a collection of hits and its associations.
Definition: HitCreator.h:692
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
size_type size() const
Definition: PtrVector.h:302
Detector simulation of raw signals on wires.
ProducesCollector & producesCollector() noexcept
art::PtrVector< recob::Hit > Hits
Declaration of signal hit object.
void endJob() override
CCHitFinderAlg fCCHFAlg
void put_into(art::Event &)
Moves the data into the event.
Definition: HitCreator.h:801
Declaration of basic channel signal object.
std::vector< recob::Hit > && YieldHits()
Returns (and loses) the collection of reconstructed hits.
TCEvent evt
Definition: DataStructs.cxx:7