LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
EndPointModule_module.cc
Go to the documentation of this file.
1 //
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.
17 //Thanks to B. Morgan of U. of Warwick for comments and suggestions
18 
19 #include <string>
20 #include <vector>
21 
22 // Framework includes
30 #include "fhiclcpp/ParameterSet.h"
32 
33 // LArSoft includes
39 
41 namespace cluster {
42 
45 
46  public:
47  explicit EndPointModule(fhicl::ParameterSet const& pset);
48 
49  private:
50  void produce(art::Event& evt);
51 
52  std::string fDBScanModuleLabel;
53 
55  };
56 
57 }
58 
59 namespace cluster {
60 
61  //-----------------------------------------------------------------------------
63  : EDProducer{pset}, fEPAlg(pset.get<fhicl::ParameterSet>("EndPointAlg"))
64  {
65  fDBScanModuleLabel = pset.get<std::string>("DBScanModuleLabel");
66 
67  produces<std::vector<recob::EndPoint2D>>();
68  produces<art::Assns<recob::EndPoint2D, recob::Hit>>();
69  }
70 
71  //-----------------------------------------------------------------------------
72 
74  {
75 
76  art::Handle<std::vector<recob::Cluster>> clusterListHandle;
77  evt.getByLabel(fDBScanModuleLabel, clusterListHandle);
78  //Point to a collection of vertices to output.
79 
80  //.......................................
82  for (unsigned int ii = 0; ii < clusterListHandle->size(); ++ii) {
83  art::Ptr<recob::Cluster> cluster(clusterListHandle, ii);
84  clusIn.push_back(cluster);
85  }
86 
87  // make a std::vector<recob::Cluster> for the output of the
88  // Hough Transform
89  std::vector<recob::EndPoint2D> vtxOut;
90  std::vector<art::PtrVector<recob::Hit>> vtxHitsOut;
91  size_t numvtx = fEPAlg.EndPoint(clusIn, vtxOut, vtxHitsOut, evt, fDBScanModuleLabel);
92 
93  MF_LOG_DEBUG("Vertex") << "found " << numvtx << "vertices with VertexService";
94 
95  //Point to a collection of vertices to output.
96  std::unique_ptr<std::vector<recob::EndPoint2D>> vtxcol(
97  new std::vector<recob::EndPoint2D>(vtxOut));
98  std::unique_ptr<art::Assns<recob::EndPoint2D, recob::Hit>> assn(
100 
101  for (size_t v = 0; v < vtxcol->size(); ++v)
102  util::CreateAssn(evt, *(vtxcol.get()), vtxHitsOut[v], *(assn.get()), v);
103 
104  evt.put(std::move(vtxcol));
105  evt.put(std::move(assn));
106  }
107 
108 } // end namespace
109 
110 namespace cluster {
111 
113 
114 }
algorithm to find 2D endpoints
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
void produce(art::Event &evt)
Cluster finding and building.
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
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
Declaration of cluster object.
Algorithm to find 2D end points.
Definition: EndPointAlg.h:29
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Utility object to perform functions of association.
#define MF_LOG_DEBUG(id)
EndPointAlg fEPAlg
object that contains the end point finding algorithm
TCEvent evt
Definition: DataStructs.cxx:8
module to find 2D end points
EndPointModule(fhicl::ParameterSet const &pset)