LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
CornerFinder_module.cc
Go to the documentation of this file.
1 #ifndef CORNERFINDER_H
2 #define CORNERFINDER_H
3 
16 //Basic includes
17 #include <vector>
18 #include <string>
19 
20 //Framework includes
25 
26 //LArSoft includes
31 
32 //header info for CornerFinder class
33 
34 namespace vertex {
35 
36  class CornerFinder : public art::EDProducer {
37 
38  public:
39 
40  explicit CornerFinder(fhicl::ParameterSet const& pset);
41  virtual ~CornerFinder();
42  void reconfigure(fhicl::ParameterSet const& p);
43 
44 
45  void produce(art::Event& evt);
46 
47  private:
50 
51  std::string fCalDataModuleLabel;
52 
53  void printEndpoints(std::vector<recob::EndPoint2D> const& corner_vector);
54 
55  }; //class CornerFinder
56 
57 
58 
59  //-----------------------------------------------------------------------------
61  fCornerAlg(pset.get<fhicl::ParameterSet>("CornerAlgParamSet"))
62  {
63  this->reconfigure(pset);
64  produces< std::vector<recob::EndPoint2D> >();
65  }
66 
67  //-----------------------------------------------------------------------------
69 
70  //---------------------------------------------------------------------------
72  fCalDataModuleLabel = pset.get<std::string>("CalDataModuleLabel");
73  fCornerAlg.reconfigure(pset.get<fhicl::ParameterSet>("CornerAlgParamSet"));
74  return;
75  }
76 
77  //-----------------------------------------------------------------------------
79 
80  //We need do very little here, as it's all handled by the corner finder.
81  const bool DEBUG_TEST = false; //turn on/off some messages
82 
83  //We need to grab out the wires.
85  evt.getByLabel(fCalDataModuleLabel,wireHandle);
86  std::vector<recob::Wire> const& wireVec(*wireHandle);
87 
88  //First, have it process the wires.
90 
91  //now, make a vector of recob::EndPoint2Ds, and hand that to CornerAlg to fill out
92  std::unique_ptr< std::vector<recob::EndPoint2D> > corner_vector(new std::vector<recob::EndPoint2D>);
94 
95  mf::LogInfo("CornerFinderModule") << "CornerFinderAlg finished, and returned "
96  << corner_vector->size() << " endpoints.";
97 
98  if(DEBUG_TEST) printEndpoints(*corner_vector);
99 
100  //and now, put this on the event.
101  evt.put(std::move(corner_vector));
102 
103  //Done!
104 
105  } // end of produce
106 
107 
108  //-----------------------------------------------------------------------------
109  void CornerFinder::printEndpoints(std::vector<recob::EndPoint2D> const& corner_vector){
110 
111  for(auto iter=corner_vector.begin(); iter!=corner_vector.end(); iter++){
112  geo::WireID wid = iter->WireID();
113  mf::LogVerbatim("CornerFinderModule") << "Endpoint found: (plane,wire,time,strength)=("
114  << wid.Plane << ","
115  << wid.Wire << ","
116  << iter->DriftTime() << ","
117  << iter->Strength() << ")";
118  }
119 
120  }
121 
122 
124 
125 }
126 #endif // CORNERFINDER_H
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
void reconfigure(fhicl::ParameterSet const &pset)
void reconfigure(fhicl::ParameterSet const &p)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:313
void get_feature_points_fast(std::vector< recob::EndPoint2D > &, geo::Geometry const &)
corner::CornerFinderAlg fCornerAlg
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void GrabWires(std::vector< recob::Wire > const &wireVec, geo::Geometry const &)
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
art::ServiceHandle< geo::Geometry > fGeometryHandle
algorithm to find feature 2D points
parameter set interface
T get(std::string const &key) const
Definition: ParameterSet.h:231
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:258
void printEndpoints(std::vector< recob::EndPoint2D > const &corner_vector)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void produce(art::Event &evt)
CornerFinder(fhicl::ParameterSet const &pset)
Declaration of basic channel signal object.
WireID()=default
Default constructor: an invalid TPC ID.
art framework interface to geometry description
vertex reconstruction