LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
cluster::BlurredClustering Class Reference
Inheritance diagram for cluster::BlurredClustering:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 BlurredClustering (fhicl::ParameterSet const &pset)
 
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)
 
void fillProductDescriptions ()
 
void registerProducts (ProductDescriptions &productsToRegister)
 
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)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
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 ()
 

Private Member Functions

void produce (art::Event &evt) override
 

Private Attributes

std::string const fHitsModuleLabel
 
std::string const fTrackModuleLabel
 
std::string const fVertexModuleLabel
 
std::string const fPFParticleModuleLabel
 
bool const fCreateDebugPDF
 
bool const fMergeClusters
 
bool const fGlobalTPCRecon
 
bool const fShowerReconOnly
 
cluster::BlurredClusteringAlg fBlurredClusteringAlg
 
cluster::MergeClusterAlg fMergeClusterAlg
 
shower::TrackShowerSeparationAlg fTrackShowerSeparationAlg
 

Detailed Description

Definition at line 52 of file BlurredClustering_module.cc.

Member Typedef Documentation

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 26 of file Producer.h.

Constructor & Destructor Documentation

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

Definition at line 68 of file BlurredClustering_module.cc.

References fBlurredClusteringAlg, fCreateDebugPDF, fGlobalTPCRecon, fHitsModuleLabel, fMergeClusterAlg, fMergeClusters, fPFParticleModuleLabel, fShowerReconOnly, fTrackModuleLabel, fTrackShowerSeparationAlg, and fVertexModuleLabel.

69  : EDProducer{pset}
70  , fHitsModuleLabel{pset.get<std::string>("HitsModuleLabel")}
71  , fTrackModuleLabel{pset.get<std::string>("TrackModuleLabel")}
72  , fVertexModuleLabel{pset.get<std::string>("VertexModuleLabel")}
73  , fPFParticleModuleLabel{pset.get<std::string>("PFParticleModuleLabel")}
74  , fCreateDebugPDF{pset.get<bool>("CreateDebugPDF")}
75  , fMergeClusters{pset.get<bool>("MergeClusters")}
76  , fGlobalTPCRecon{pset.get<bool>("GlobalTPCRecon")}
77  , fShowerReconOnly{pset.get<bool>("ShowerReconOnly")}
78  , fBlurredClusteringAlg{pset.get<fhicl::ParameterSet>("BlurredClusterAlg")}
79  , fMergeClusterAlg{pset.get<fhicl::ParameterSet>("MergeClusterAlg")}
80  , fTrackShowerSeparationAlg{pset.get<fhicl::ParameterSet>("TrackShowerSeparationAlg")}
81 {
82  produces<std::vector<recob::Cluster>>();
83  produces<art::Assns<recob::Cluster, recob::Hit>>();
84 }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
cluster::MergeClusterAlg fMergeClusterAlg
shower::TrackShowerSeparationAlg fTrackShowerSeparationAlg
cluster::BlurredClusteringAlg fBlurredClusteringAlg

Member Function Documentation

template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::Producer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 22 of file Producer.cc.

References art::detail::Producer::beginJobWithFrame(), and art::detail::Producer::setupQueues().

23  {
24  setupQueues(resources);
25  ProcessingFrame const frame{ScheduleID{}};
26  beginJobWithFrame(frame);
27  }
virtual void setupQueues(SharedResources const &)=0
virtual void beginJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 65 of file Producer.cc.

References art::detail::Producer::beginRunWithFrame(), art::RangeSet::forRun(), art::RunPrincipal::makeRun(), r, art::RunPrincipal::runID(), and art::ModuleContext::scheduleID().

66  {
67  auto r = rp.makeRun(mc, RangeSet::forRun(rp.runID()));
68  ProcessingFrame const frame{mc.scheduleID()};
69  beginRunWithFrame(r, frame);
70  r.commitProducts();
71  return true;
72  }
TRandom r
Definition: spectrum.C:23
virtual void beginRunWithFrame(Run &, ProcessingFrame const &)=0
static RangeSet forRun(RunID)
Definition: RangeSet.cc:51
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 85 of file Producer.cc.

References art::detail::Producer::beginSubRunWithFrame(), art::RangeSet::forSubRun(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::SubRunPrincipal::subRunID().

86  {
87  auto sr = srp.makeSubRun(mc, RangeSet::forSubRun(srp.subRunID()));
88  ProcessingFrame const frame{mc.scheduleID()};
89  beginSubRunWithFrame(sr, frame);
90  sr.commitProducts();
91  return true;
92  }
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:57
void art::detail::Producer::doEndJob ( )
inherited

Definition at line 30 of file Producer.cc.

References art::detail::Producer::endJobWithFrame().

31  {
32  ProcessingFrame const frame{ScheduleID{}};
33  endJobWithFrame(frame);
34  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 75 of file Producer.cc.

References art::detail::Producer::endRunWithFrame(), art::RunPrincipal::makeRun(), r, art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

76  {
77  auto r = rp.makeRun(mc, rp.seenRanges());
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(r, frame);
80  r.commitProducts();
81  return true;
82  }
TRandom r
Definition: spectrum.C:23
virtual void endRunWithFrame(Run &, ProcessingFrame const &)=0
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 95 of file Producer.cc.

References art::detail::Producer::endSubRunWithFrame(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

96  {
97  auto sr = srp.makeSubRun(mc, srp.seenRanges());
98  ProcessingFrame const frame{mc.scheduleID()};
99  endSubRunWithFrame(sr, frame);
100  sr.commitProducts();
101  return true;
102  }
virtual void endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
bool art::detail::Producer::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 
)
inherited

Definition at line 105 of file Producer.cc.

References art::detail::Producer::checkPutProducts_, e, art::EventPrincipal::makeEvent(), art::detail::Producer::produceWithFrame(), and art::ModuleContext::scheduleID().

110  {
111  auto e = ep.makeEvent(mc);
112  ++counts_run;
113  ProcessingFrame const frame{mc.scheduleID()};
114  produceWithFrame(e, frame);
115  e.commitProducts(checkPutProducts_, &expectedProducts<InEvent>());
116  ++counts_passed;
117  return true;
118  }
bool const checkPutProducts_
Definition: Producer.h:70
Float_t e
Definition: plot.C:35
virtual void produceWithFrame(Event &, ProcessingFrame const &)=0
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 44 of file Producer.cc.

References art::detail::Producer::respondToCloseInputFileWithFrame().

45  {
46  ProcessingFrame const frame{ScheduleID{}};
48  }
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 58 of file Producer.cc.

References art::detail::Producer::respondToCloseOutputFilesWithFrame().

59  {
60  ProcessingFrame const frame{ScheduleID{}};
62  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 37 of file Producer.cc.

References art::detail::Producer::respondToOpenInputFileWithFrame().

38  {
39  ProcessingFrame const frame{ScheduleID{}};
41  }
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 51 of file Producer.cc.

References art::detail::Producer::respondToOpenOutputFilesWithFrame().

52  {
53  ProcessingFrame const frame{ScheduleID{}};
55  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::Modifier::fillProductDescriptions ( )
inherited

Definition at line 10 of file Modifier.cc.

References art::ProductRegistryHelper::fillDescriptions(), and art::ModuleBase::moduleDescription().

11  {
13  }
void fillDescriptions(ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void cluster::BlurredClustering::produce ( art::Event evt)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 86 of file BlurredClustering_module.cc.

References cluster::BlurredClusteringAlg::ConvertBinsToClusters(), cluster::BlurredClusteringAlg::ConvertRecobHitsToVector(), util::CreateAssn(), cluster::BlurredClusteringAlg::CreateDebugPDF(), DEFINE_ART_MODULE, art::Event::event(), fBlurredClusteringAlg, fCreateDebugPDF, fGlobalTPCRecon, fHitsModuleLabel, art::fill_ptr_vector(), cluster::BlurredClusteringAlg::FindClusters(), fMergeClusterAlg, fMergeClusters, fPFParticleModuleLabel, fShowerReconOnly, fTrackModuleLabel, fTrackShowerSeparationAlg, fVertexModuleLabel, cluster::BlurredClusteringAlg::GaussianBlur(), art::ProductRetriever::getByLabel(), cluster::BlurredClusteringAlg::GetMinSize(), cluster::BlurredClusteringAlg::GlobalWire(), hits(), art::Handle< T >::isValid(), cluster::BlurredClusteringAlg::MakeHistogram(), cluster::MergeClusterAlg::MergeClusters(), art::Event::put(), art::Event::run(), cluster::BlurredClusteringAlg::SaveImage(), shower::TrackShowerSeparationAlg::SelectShowerHits(), recob::Cluster::Sentry, and art::Event::subRun().

87 {
88  // Create debug pdf to illustrate the blurring process
90 
91  // Output containers -- collection of clusters and associations
92  auto clusters = std::make_unique<std::vector<recob::Cluster>>();
93  auto associations = std::make_unique<art::Assns<recob::Cluster, recob::Hit>>();
94 
95  // Compute the cluster characteristics
96  // Just use default for now, but configuration will go here
97  ClusterParamsImportWrapper<StandardClusterParamsAlg> ClusterParamAlgo;
98 
99  // Services
101  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
102  auto const detProp =
104  util::GeometryUtilities const gser{*geom, clockData, detProp};
105  int const readoutWindowSize = detProp.ReadOutWindowSize();
106 
107  // Get the hits from the event
109  std::vector<art::Ptr<recob::Hit>> hits;
110  std::vector<art::Ptr<recob::Hit>> hitsToCluster;
111  if (evt.getByLabel(fHitsModuleLabel, hitCollection)) art::fill_ptr_vector(hits, hitCollection);
112 
113  if (fShowerReconOnly) {
114 
115  // Get the tracks from the event
116  art::Handle<std::vector<recob::Track>> trackCollection;
117  std::vector<art::Ptr<recob::Track>> tracks;
118  if (evt.getByLabel(fTrackModuleLabel, trackCollection))
119  art::fill_ptr_vector(tracks, trackCollection);
120 
121  // Get the space points from the event
122  art::Handle<std::vector<recob::SpacePoint>> spacePointCollection;
123  std::vector<art::Ptr<recob::SpacePoint>> spacePoints;
124  if (evt.getByLabel(fTrackModuleLabel, spacePointCollection))
125  art::fill_ptr_vector(spacePoints, spacePointCollection);
126 
127  // Get vertices from the event
128  art::Handle<std::vector<recob::Vertex>> vertexCollection;
129  std::vector<art::Ptr<recob::Vertex>> vertices;
130  if (evt.getByLabel(fVertexModuleLabel, vertexCollection))
131  art::fill_ptr_vector(vertices, vertexCollection);
132 
133  // Get pandora pfparticles and clusters from the event
134  art::Handle<std::vector<recob::PFParticle>> pfParticleCollection;
135  std::vector<art::Ptr<recob::PFParticle>> pfParticles;
136  if (evt.getByLabel(fPFParticleModuleLabel, pfParticleCollection))
137  art::fill_ptr_vector(pfParticles, pfParticleCollection);
138  art::Handle<std::vector<recob::Cluster>> clusterCollection;
139  evt.getByLabel(fPFParticleModuleLabel, clusterCollection);
140 
141  if (trackCollection.isValid()) {
142  art::FindManyP<recob::Hit> fmht(trackCollection, evt, fTrackModuleLabel);
143  art::FindManyP<recob::Track> fmth(hitCollection, evt, fTrackModuleLabel);
144  art::FindManyP<recob::SpacePoint> fmspt(trackCollection, evt, fTrackModuleLabel);
145  art::FindManyP<recob::Track> fmtsp(spacePointCollection, evt, fTrackModuleLabel);
147  evt.event(), hits, tracks, spacePoints, fmht, fmth, fmspt, fmtsp);
148  }
149  }
150  else
151  hitsToCluster = hits;
152 
153  // Make a map between the planes and the hits on each
154  std::map<std::pair<int, int>, std::vector<art::Ptr<recob::Hit>>> planeToHits;
155  for (auto const& hitToCluster : hitsToCluster) {
156  auto const& wireID = hitToCluster->WireID();
157  auto const planeNo = wireID.Plane;
158  auto const tpc = fGlobalTPCRecon ? wireID.TPC % 2 : wireID.TPC;
159  planeToHits[std::make_pair(planeNo, tpc)].push_back(hitToCluster);
160  }
161 
162  // Loop over views
163  for (auto const& [plane, hits] : planeToHits) {
164  std::vector<art::PtrVector<recob::Hit>> finalClusters;
165 
166  // Implement the algorithm
167  if (hits.size() >= fBlurredClusteringAlg.GetMinSize()) {
168 
169  // Convert hit map to TH2 histogram and blur it
170  auto const image = fBlurredClusteringAlg.ConvertRecobHitsToVector(hits, readoutWindowSize);
171  auto const blurred = fBlurredClusteringAlg.GaussianBlur(image);
172 
173  // Find clusters in histogram
174  std::vector<std::vector<int>>
175  allClusterBins; // Vector of clusters (clusters are vectors of hits)
176  int numClusters = fBlurredClusteringAlg.FindClusters(blurred, allClusterBins);
177  mf::LogVerbatim("Blurred Clustering") << "Found " << numClusters << " clusters" << std::endl;
178 
179  // Create output clusters from the vector of clusters made in FindClusters
180  std::vector<art::PtrVector<recob::Hit>> planeClusters;
181  fBlurredClusteringAlg.ConvertBinsToClusters(image, allClusterBins, planeClusters);
182 
183  // Use the cluster merging algorithm
184  if (fMergeClusters) {
185  int numMergedClusters = fMergeClusterAlg.MergeClusters(planeClusters, finalClusters);
186  mf::LogVerbatim("Blurred Clustering")
187  << "After merging, there are " << numMergedClusters << " clusters" << std::endl;
188  }
189  else
190  finalClusters = planeClusters;
191 
192  // Make the debug PDF
193  if (fCreateDebugPDF) {
194  std::stringstream name;
195  name << "blurred_image";
196  TH2F* imageHist = fBlurredClusteringAlg.MakeHistogram(image, TString{name.str()});
197  name << "_convolved";
198  TH2F* blurredHist = fBlurredClusteringAlg.MakeHistogram(blurred, TString{name.str()});
199  auto const [planeNo, tpc] = plane;
200  fBlurredClusteringAlg.SaveImage(imageHist, 1, tpc, planeNo);
201  fBlurredClusteringAlg.SaveImage(blurredHist, 2, tpc, planeNo);
202  fBlurredClusteringAlg.SaveImage(blurredHist, allClusterBins, 3, tpc, planeNo);
203  fBlurredClusteringAlg.SaveImage(imageHist, finalClusters, 4, tpc, planeNo);
204  imageHist->Delete();
205  blurredHist->Delete();
206  }
207 
208  } // End min hits check
209 
210  // Make the output cluster objects
211  for (auto const& clusterHits : finalClusters) {
212  if (clusterHits.empty()) continue;
213 
214  // Get the start and end wires of the cluster
215  unsigned int const startWire =
216  fBlurredClusteringAlg.GlobalWire(clusterHits.front()->WireID());
217  unsigned int const endWire = fBlurredClusteringAlg.GlobalWire(clusterHits.back()->WireID());
218 
219  // Put cluster hits in the algorithm
220  ClusterParamAlgo.ImportHits(gser, clusterHits);
221 
222  // Create the recob::Cluster and place in the vector of clusters
223  ClusterCreator cluster(gser,
224  ClusterParamAlgo, // algo
225  float(startWire), // start_wire
226  0., // sigma_start_wire
227  clusterHits.front()->PeakTime(), // start_tick
228  clusterHits.front()->SigmaPeakTime(), // sigma_start_tick
229  float(endWire), // end_wire
230  0., // sigma_end_wire,
231  clusterHits.back()->PeakTime(), // end_tick
232  clusterHits.back()->SigmaPeakTime(), // sigma_end_tick
233  clusters->size(), // ID
234  clusterHits.front()->View(), // view
235  clusterHits.front()->WireID().planeID(), // plane
236  recob::Cluster::Sentry // sentry
237  );
238  clusters->emplace_back(cluster.move());
239 
240  // Associate the hits to this cluster
241  util::CreateAssn(evt, *clusters, clusterHits, *associations);
242  } // End loop over all clusters
243  }
244 
245  evt.put(std::move(clusters));
246  evt.put(std::move(associations));
247 }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
SubRunNumber_t subRun() const
Definition: Event.cc:35
int MergeClusters(std::vector< art::PtrVector< recob::Hit >> const &planeClusters, std::vector< art::PtrVector< recob::Hit >> &clusters) const
TH2F * MakeHistogram(std::vector< std::vector< double >> const &image, TString name) const
Converts a 2D vector in a histogram for the debug pdf.
cluster::MergeClusterAlg fMergeClusterAlg
Cluster finding and building.
int FindClusters(std::vector< std::vector< double >> const &image, std::vector< std::vector< int >> &allcluster) const
Find clusters in the histogram.
static const SentryArgument_t Sentry
An instance of the sentry object.
Definition: Cluster.h:174
bool isValid() const noexcept
Definition: Handle.h:203
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
void CreateDebugPDF(int run, int subrun, int event)
Create the PDF to save debug images.
void hits()
Definition: readHits.C:15
int GlobalWire(geo::WireID const &wireID) const
Find the global wire position.
std::vector< std::vector< double > > GaussianBlur(std::vector< std::vector< double >> const &image) const
Applies Gaussian blur to image.
EventNumber_t event() const
Definition: Event.cc:41
void SaveImage(TH2F *image, std::vector< art::PtrVector< recob::Hit >> const &allClusters, int pad, int tpc, int plane)
shower::TrackShowerSeparationAlg fTrackShowerSeparationAlg
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.
void ConvertBinsToClusters(std::vector< std::vector< double >> const &image, std::vector< std::vector< int >> const &allClusterBins, std::vector< art::PtrVector< recob::Hit >> &clusters) const
Takes a vector of clusters (itself a vector of hits) and turns them into clusters using the initial h...
std::vector< std::vector< double > > ConvertRecobHitsToVector(std::vector< art::Ptr< recob::Hit >> const &hits, int readoutWindowSize)
Takes hit map and returns a 2D vector representing wire and tick, filled with the charge...
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
cluster::BlurredClusteringAlg fBlurredClusteringAlg
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:306
std::vector< art::Ptr< recob::Hit > > SelectShowerHits(int event, const std::vector< art::Ptr< recob::Hit >> &hits, const std::vector< art::Ptr< recob::Track >> &tracks, const std::vector< art::Ptr< recob::SpacePoint >> &spacePoints, const art::FindManyP< recob::Hit > &fmht, const art::FindManyP< recob::Track > &fmth, const art::FindManyP< recob::SpacePoint > &fmspt, const art::FindManyP< recob::Track > &fmtsp) const
RunNumber_t run() const
Definition: Event.cc:29
unsigned int GetMinSize() const noexcept
Minimum size of cluster to save.
void art::Modifier::registerProducts ( ProductDescriptions productsToRegister)
inherited

Definition at line 16 of file Modifier.cc.

References art::ModuleBase::moduleDescription(), and art::ProductRegistryHelper::registerProducts().

17  {
18  ProductRegistryHelper::registerProducts(productsToRegister,
20  }
void registerProducts(ProductDescriptions &productsToRegister, ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)

Member Data Documentation

cluster::BlurredClusteringAlg cluster::BlurredClustering::fBlurredClusteringAlg
private

Definition at line 63 of file BlurredClustering_module.cc.

Referenced by BlurredClustering(), and produce().

bool const cluster::BlurredClustering::fCreateDebugPDF
private

Definition at line 60 of file BlurredClustering_module.cc.

Referenced by BlurredClustering(), and produce().

bool const cluster::BlurredClustering::fGlobalTPCRecon
private

Definition at line 60 of file BlurredClustering_module.cc.

Referenced by BlurredClustering(), and produce().

std::string const cluster::BlurredClustering::fHitsModuleLabel
private

Definition at line 59 of file BlurredClustering_module.cc.

Referenced by BlurredClustering(), and produce().

cluster::MergeClusterAlg cluster::BlurredClustering::fMergeClusterAlg
private

Definition at line 64 of file BlurredClustering_module.cc.

Referenced by BlurredClustering(), and produce().

bool const cluster::BlurredClustering::fMergeClusters
private

Definition at line 60 of file BlurredClustering_module.cc.

Referenced by BlurredClustering(), and produce().

std::string const cluster::BlurredClustering::fPFParticleModuleLabel
private

Definition at line 59 of file BlurredClustering_module.cc.

Referenced by BlurredClustering(), and produce().

bool const cluster::BlurredClustering::fShowerReconOnly
private

Definition at line 60 of file BlurredClustering_module.cc.

Referenced by BlurredClustering(), and produce().

std::string const cluster::BlurredClustering::fTrackModuleLabel
private

Definition at line 59 of file BlurredClustering_module.cc.

Referenced by BlurredClustering(), and produce().

shower::TrackShowerSeparationAlg cluster::BlurredClustering::fTrackShowerSeparationAlg
private

Definition at line 65 of file BlurredClustering_module.cc.

Referenced by BlurredClustering(), and produce().

std::string const cluster::BlurredClustering::fVertexModuleLabel
private

Definition at line 59 of file BlurredClustering_module.cc.

Referenced by BlurredClustering(), and produce().


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