EndPointModule_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // EndPointModule class
4 //
5 // joshua.spitz@yale.edu
6 //
7 // This algorithm is designed to find (weak) vertices from hits after deconvolution and hit finding.
8 // A weak vertex is a vertex that has been found using a dedicated vertex finding algorithm only. A
9 // strong vertex is a vertex that has been found using a dedicated vertex finding algorithm and matched
10 // to a crossing of two or more HoughLineFinder lines. The VertexMatch module finds strong vertices.
11 ////////////////////////////////////////////////////////////////////////
12 /// The algorithm is based on:
13 ///C. Harris and M. Stephens (1988). "A combined corner and edge detector". Proceedings of the 4th Alvey
14 ///Vision Conference. pp. 147-151.
15 ///B. Morgan (2010). "Interest Point Detection for Reconstruction in High Granularity Tracking Detectors".
16 ///arXiv:1006.3012v1 [physics.ins-det]
17 //Thanks to B. Morgan of U. of Warwick for comments and suggestions
18 
19 #include <string>
20 
21 // Framework includes
25 #include "fhiclcpp/ParameterSet.h"
30 
31 // LArSoft includes
37 
38 /// 2D end point reconstruction
39 namespace cluster {
40 
41  ///module to find 2D end points
43 
44  public:
45 
46  explicit EndPointModule(fhicl::ParameterSet const& pset);
47 
48  private:
49 
50  void produce(art::Event& evt);
51 
53 
54  EndPointAlg fEPAlg; ///< object that contains the end point finding algorithm
55 
56  };
57 
58 }
59 
60 
61 namespace cluster {
62 
63 
64  //-----------------------------------------------------------------------------
66  : EDProducer{pset}
67  , fEPAlg(pset.get< fhicl::ParameterSet >("EndPointAlg"))
68  {
69  fDBScanModuleLabel = pset.get<std::string>("DBScanModuleLabel");
70 
71  produces< std::vector<recob::EndPoint2D> >();
72  produces< art::Assns<recob::EndPoint2D, recob::Hit> >();
73  }
74 
75  //-----------------------------------------------------------------------------
76 
78  {
79 
80  art::Handle< std::vector<recob::Cluster> > clusterListHandle;
81  evt.getByLabel(fDBScanModuleLabel,clusterListHandle);
82  //Point to a collection of vertices to output.
83 
84  //.......................................
86  for(unsigned int ii = 0; ii < clusterListHandle->size(); ++ii)
87  {
88  art::Ptr<recob::Cluster> cluster(clusterListHandle, ii);
89  clusIn.push_back(cluster);
90  }
91 
92  // make a std::vector<recob::Cluster> for the output of the
93  // Hough Transform
94  std::vector<recob::EndPoint2D> vtxOut;
95  std::vector< art::PtrVector<recob::Hit> > vtxHitsOut;
96  size_t numvtx = fEPAlg.EndPoint(clusIn, vtxOut, vtxHitsOut, evt, fDBScanModuleLabel);
97 
98  MF_LOG_DEBUG("Vertex") << "found " << numvtx << "vertices with VertexService";
99 
100  //Point to a collection of vertices to output.
101  std::unique_ptr<std::vector<recob::EndPoint2D> > vtxcol(new std::vector<recob::EndPoint2D>(vtxOut));
102  std::unique_ptr< art::Assns<recob::EndPoint2D, recob::Hit> > assn(new art::Assns<recob::EndPoint2D, recob::Hit>);
103 
104  for(size_t v = 0; v < vtxcol->size(); ++v)
105  util::CreateAssn(*this, evt, *(vtxcol.get()), vtxHitsOut[v], *(assn.get()), v);
106 
107  evt.put(std::move(vtxcol));
108  evt.put(std::move(assn));
109  }
110 
111 
112 } // end namespace
113 
114 
115 
116 
117 
118 
119 
120 namespace cluster{
121 
123 
124 }
algorithm to find 2D endpoints
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
void produce(art::Event &evt)
Cluster finding and building.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
def move(depos, offset)
Definition: depos.py:107
size_t EndPoint(const art::PtrVector< recob::Cluster > &clusIn, std::vector< recob::EndPoint2D > &vtxcol, std::vector< art::PtrVector< recob::Hit > > &vtxHitsOut, art::Event const &evt, std::string const &label) const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
Algorithm to find 2D end points.
Definition: EndPointAlg.h:27
Declaration of signal hit object.
#define MF_LOG_DEBUG(id)
EndPointAlg fEPAlg
object that contains the end point finding algorithm
TCEvent evt
Definition: DataStructs.cxx:7
module to find 2D end points
EndPointModule(fhicl::ParameterSet const &pset)