All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
cluster::HoughLineFinder Class Reference
Inheritance diagram for cluster::HoughLineFinder:

Public Member Functions

 HoughLineFinder (fhicl::ParameterSet const &pset)
 

Private Member Functions

void produce (art::Event &evt) override
 

Private Attributes

std::string fDBScanModuleLabel
 
unsigned int fHoughSeed
 
HoughBaseAlg fHLAlg
 object that does the Hough Transform More...
 
CLHEP::HepRandomEngine & fEngine
 

Detailed Description

Definition at line 45 of file HoughLineFinder_module.cc.

Constructor & Destructor Documentation

cluster::HoughLineFinder::HoughLineFinder ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 59 of file HoughLineFinder_module.cc.

60  : EDProducer{pset}
61  , fDBScanModuleLabel{pset.get<std::string>("DBScanModuleLabel")}
62  , fHoughSeed{pset.get<unsigned int>("HoughSeed", 0)}
63  , fHLAlg(pset.get<fhicl::ParameterSet>("HoughBaseAlg"))
64  // Create random number engine needed for PPHT;
65  // obtain the random seed from NuRandomService,
66  // unless overridden in configuration with key "Seed"
67  // remember that HoughSeed will override this on each event if specified
68  , fEngine(art::ServiceHandle<rndm::NuRandomService> {}->createEngine(*this, pset, "Seed"))
HoughBaseAlg fHLAlg
object that does the Hough Transform
CLHEP::HepRandomEngine & fEngine

Member Function Documentation

void cluster::HoughLineFinder::produce ( art::Event &  evt)
overrideprivate

Definition at line 76 of file HoughLineFinder_module.cc.

77  {
78  //////////////////////////////////////////////////////
79  // here is how to get a collection of objects out of the file
80  // and connect it to a art::Handle
81  //////////////////////////////////////////////////////
82  auto const clusterListHandle =
83  evt.getValidHandle<std::vector<recob::Cluster>>(fDBScanModuleLabel);
84 
85  std::vector<art::Ptr<recob::Cluster>> clusIn;
86  clusIn.reserve(clusterListHandle->size());
87  for (unsigned int ii = 0; ii < clusterListHandle->size(); ++ii) {
88  clusIn.emplace_back(clusterListHandle, ii);
89  }
90 
91  //Point to a collection of clusters to output.
92  auto ccol = std::make_unique<std::vector<recob::Cluster>>();
93  auto assn = std::make_unique<art::Assns<recob::Cluster, recob::Hit>>();
94 
95  // make a std::vector< art::PtrVector<recob::Hit> >
96  // to hold the associated hits of the Hough Transform
97  std::vector<art::PtrVector<recob::Hit>> clusHitsOut;
98 
99  // If a nonzero random number seed has been provided,
100  // overwrite the seed already initialized
101  if (fHoughSeed != 0) { fEngine.setSeed(fHoughSeed, 0); }
102 
103  size_t const numclus =
104  fHLAlg.FastTransform(clusIn, *ccol, clusHitsOut, fEngine, evt, fDBScanModuleLabel);
105 
106  MF_LOG_DEBUG("HoughLineClusters") << "found " << numclus << "clusters with HoughBaseAlg";
107 
108  mf::LogVerbatim("Summary") << std::setfill('-') << std::setw(175) << "-" << std::setfill(' ');
109  mf::LogVerbatim("Summary") << "HoughLineFinder Summary:";
110  for (size_t i = 0; i < ccol->size(); ++i) {
111  mf::LogVerbatim("Summary") << ccol->at(i);
112 
113  // associate the hits to this cluster
114  util::CreateAssn(*this, evt, *ccol, clusHitsOut[i], *assn, i);
115  }
116 
117  evt.put(move(ccol));
118  evt.put(move(assn));
119  }
size_t FastTransform(const std::vector< art::Ptr< recob::Cluster >> &clusIn, std::vector< recob::Cluster > &ccol, std::vector< art::PtrVector< recob::Hit >> &clusHitsOut, CLHEP::HepRandomEngine &engine, art::Event const &evt, std::string const &label)
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.
HoughBaseAlg fHLAlg
object that does the Hough Transform
TCEvent evt
Definition: DataStructs.cxx:8
CLHEP::HepRandomEngine & fEngine

Member Data Documentation

std::string cluster::HoughLineFinder::fDBScanModuleLabel
private

Definition at line 52 of file HoughLineFinder_module.cc.

CLHEP::HepRandomEngine& cluster::HoughLineFinder::fEngine
private

Definition at line 55 of file HoughLineFinder_module.cc.

HoughBaseAlg cluster::HoughLineFinder::fHLAlg
private

object that does the Hough Transform

Definition at line 54 of file HoughLineFinder_module.cc.

unsigned int cluster::HoughLineFinder::fHoughSeed
private

Definition at line 53 of file HoughLineFinder_module.cc.


The documentation for this class was generated from the following file: