Public Member Functions | Private Member Functions | Private Attributes | List of all members
cluster::HoughLineFinder Class Reference
Inheritance diagram for cluster::HoughLineFinder:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 HoughLineFinder (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

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
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

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"))
69  {
70  produces<std::vector<recob::Cluster>>();
71  produces<art::Assns<recob::Cluster, recob::Hit>>();
72  }
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
HoughBaseAlg fHLAlg
object that does the Hough Transform
CLHEP::HepRandomEngine & fEngine

Member Function Documentation

void cluster::HoughLineFinder::produce ( art::Event evt)
overrideprivatevirtual

Implements art::EDProducer.

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  }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
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)
def move(depos, offset)
Definition: depos.py:107
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
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.
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
HoughBaseAlg fHLAlg
object that does the Hough Transform
#define MF_LOG_DEBUG(id)
Q_EXPORT QTSManip setfill(int f)
Definition: qtextstream.h:337
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: