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

Public Member Functions

 SeedFinderModule (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
 
art::PtrVector< recob::HitGetHitsFromEvent (std::string HitModuleLabel, art::Event &evt)
 
void GetSortedHitsFromClusters (std::string ClusterModuleLabel, art::Event &evt, std::vector< std::vector< art::PtrVector< recob::Hit >>> &SortedHits)
 

Private Attributes

SeedFinderAlgorithm fSeedAlg
 
std::string fInputModuleLabel
 
int fInputSource
 

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 25 of file SeedFinderModule_module.cc.

Constructor & Destructor Documentation

trkf::SeedFinderModule::SeedFinderModule ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 56 of file SeedFinderModule_module.cc.

57  : EDProducer{pset}, fSeedAlg(pset.get<fhicl::ParameterSet>("SeedAlg"))
58  {
59  fInputModuleLabel = pset.get<std::string>("InputModuleLabel");
60  fInputSource = pset.get<int>("InputSource");
61 
62  produces<std::vector<recob::Seed>>();
63  }
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20

Member Function Documentation

art::PtrVector< recob::Hit > trkf::SeedFinderModule::GetHitsFromEvent ( std::string  HitModuleLabel,
art::Event evt 
)
private

Definition at line 156 of file SeedFinderModule_module.cc.

157  {
158 
161  evt.getByLabel(HitModuleLabel, hith);
162  for (unsigned int i = 0; i < hith->size(); ++i) {
163  art::Ptr<recob::Hit> hit(hith, i);
164  TheHits.push_back(hit);
165  }
166 
167  return TheHits;
168  }
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
Detector simulation of raw signals on wires.
void trkf::SeedFinderModule::GetSortedHitsFromClusters ( std::string  ClusterModuleLabel,
art::Event evt,
std::vector< std::vector< art::PtrVector< recob::Hit >>> &  SortedHits 
)
private

Definition at line 121 of file SeedFinderModule_module.cc.

125  {
126 
127  SortedHits.clear();
128  SortedHits.resize(3);
129  std::vector<art::Ptr<recob::Cluster>> Clusters;
130 
132  evt.getByLabel(ClusterModuleLabel, clusterh);
133 
134  if (clusterh.isValid()) { art::fill_ptr_vector(Clusters, clusterh); }
135 
136  art::FindManyP<recob::Hit> fm(clusterh, evt, ClusterModuleLabel);
137 
138  for (size_t iclus = 0; iclus < Clusters.size(); ++iclus) {
139  art::Ptr<recob::Cluster> ThisCluster = Clusters.at(iclus);
140 
141  std::vector<art::Ptr<recob::Hit>> ihits = fm.at(iclus);
142 
143  art::PtrVector<recob::Hit> HitsThisCluster;
144  for (std::vector<art::Ptr<recob::Hit>>::const_iterator i = ihits.begin(); i != ihits.end();
145  ++i)
146  HitsThisCluster.push_back(*i);
147 
148  SortedHits[ThisCluster->View()].push_back(HitsThisCluster);
149  }
150  }
struct vector vector
bool isValid() const noexcept
Definition: Handle.h:191
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
geo::View_t View() const
Returns the view for this cluster.
Definition: Cluster.h:741
static constexpr double fm
Definition: Units.h:75
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
void trkf::SeedFinderModule::produce ( art::Event evt)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 67 of file SeedFinderModule_module.cc.

68  {
69  auto seeds = std::make_unique<std::vector<recob::Seed>>();
70 
71  std::vector<std::vector<recob::SpacePoint>> SpacePointsWithSeeds;
72  std::vector<recob::Seed> SeedVector;
73 
74  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
75  auto const detProp =
77 
78  // Make seeds from clusters
79  if (fInputSource == 1) {
80  std::vector<std::vector<art::PtrVector<recob::Hit>>> HitsPerSeed;
81 
82  std::vector<std::vector<art::PtrVector<recob::Hit>>> SortedHits;
84 
85  std::vector<std::vector<recob::Seed>> Seeds =
86  fSeedAlg.GetSeedsFromSortedHits(clockData, detProp, SortedHits, HitsPerSeed);
87 
88  for (size_t i = 0; i != Seeds.size(); ++i)
89  for (size_t j = 0; j != Seeds.at(i).size(); ++j)
90  SeedVector.push_back(Seeds.at(i).at(j));
91  }
92 
93  // Make seeds from unsorted hits
94  else if (fInputSource == 0) {
95 
97  std::vector<art::PtrVector<recob::Hit>> HitCatalogue;
98  SeedVector = fSeedAlg.GetSeedsFromUnSortedHits(clockData, detProp, Hits, HitCatalogue);
99  }
100  else {
101  throw cet::exception("SeedFinderModule") << "Unkown source mode " << fInputSource << "\n";
102  }
103 
104  if (SeedVector.size() > 0) {
105  for (size_t i = 0; i != SeedVector.size(); ++i) {
106  seeds->push_back(SeedVector.at(i));
107  }
108  }
109  else
110  mf::LogInfo("SeedFinder") << "Seed finder made no seeds : no space points in event"
111  << std::endl;
112 
113  evt.put(std::move(seeds));
114  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< art::Ptr< recob::Seed > > SeedVector
def move(depos, offset)
Definition: depos.py:107
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
std::vector< recob::Seed > GetSeedsFromUnSortedHits(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, art::PtrVector< recob::Hit > const &, std::vector< art::PtrVector< recob::Hit >> &, unsigned int StopAfter=0) const
std::vector< TrajPoint > seeds
Definition: DataStructs.cxx:13
art::PtrVector< recob::Hit > Hits
void GetSortedHitsFromClusters(std::string ClusterModuleLabel, art::Event &evt, std::vector< std::vector< art::PtrVector< recob::Hit >>> &SortedHits)
art::PtrVector< recob::Hit > GetHitsFromEvent(std::string HitModuleLabel, art::Event &evt)
std::vector< std::vector< recob::Seed > > GetSeedsFromSortedHits(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< std::vector< art::PtrVector< recob::Hit >>> const &SortedHits, std::vector< std::vector< art::PtrVector< recob::Hit >>> &HitsPerSeed, unsigned int StopAfter=0) const
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)

Member Data Documentation

std::string trkf::SeedFinderModule::fInputModuleLabel
private

Definition at line 40 of file SeedFinderModule_module.cc.

int trkf::SeedFinderModule::fInputSource
private

Definition at line 41 of file SeedFinderModule_module.cc.

SeedFinderAlgorithm trkf::SeedFinderModule::fSeedAlg
private

Definition at line 39 of file SeedFinderModule_module.cc.


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