LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
cluster::LineCluster Class Reference

Produces clusters by ClusterCrawler algorithm. More...

Inheritance diagram for cluster::LineCluster:
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

 LineCluster (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

ClusterCrawlerAlg fCCAlg
 
art::InputTag fHitFinderLabel
 label of module producing input hits More...
 
bool fDoWireAssns
 
bool fDoRawDigitAssns
 

Detailed Description

Produces clusters by ClusterCrawler algorithm.

Configuration parameters

  • HitFinderModuleLabel (InputTag, mandatory): label of the hits to be used as input (usually the label of the producing module is enough)
  • ClusterCrawlerAlg (parameter set, mandatory): full configuration for ClusterCrawlerAlg algorithm

Definition at line 37 of file LineCluster_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::LineCluster::LineCluster ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 80 of file LineCluster_module.cc.

References recob::HitAndAssociationsWriterBase::declare_products(), fCCAlg, fDoRawDigitAssns, fDoWireAssns, fHitFinderLabel, and art::ProductRegistryHelper::producesCollector().

81  : EDProducer{pset}, fCCAlg{pset.get<fhicl::ParameterSet>("ClusterCrawlerAlg")}
82  {
83  fHitFinderLabel = pset.get<art::InputTag>("HitFinderModuleLabel");
84  fDoWireAssns = pset.get<bool>("DoWireAssns", true);
85  fDoRawDigitAssns = pset.get<bool>("DoRawDigitAssns", false);
86 
87  // let HitCollectionAssociator declare that we are going to produce
88  // hits and associations with wires and raw digits
89  // (with no particular product label)
91  producesCollector(), "", fDoWireAssns, fDoRawDigitAssns);
92 
93  produces<std::vector<recob::Cluster>>();
94  produces<std::vector<recob::Vertex>>();
95  produces<std::vector<recob::EndPoint2D>>();
96  produces<art::Assns<recob::Cluster, recob::Hit>>();
97  produces<art::Assns<recob::Cluster, recob::Vertex, unsigned short>>();
98  produces<art::Assns<recob::Cluster, recob::EndPoint2D, unsigned short>>();
99  } // LineCluster::LineCluster()
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
static void declare_products(art::ProducesCollector &collector, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
Definition: HitCreator.cxx:248
art::InputTag fHitFinderLabel
label of module producing input hits
ClusterCrawlerAlg fCCAlg
ProducesCollector & producesCollector() noexcept

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::LineCluster::produce ( art::Event evt)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 102 of file LineCluster_module.cc.

References cluster::ClusterCrawlerAlg::ClusterStore::BeginAng, cluster::ClusterCrawlerAlg::ClusterStore::BeginChg, cluster::ClusterCrawlerAlg::ClusterStore::BeginTim, cluster::ClusterCrawlerAlg::ClusterStore::BeginVtx, cluster::ClusterCrawlerAlg::ClusterStore::BeginWir, cluster::ClusterCrawlerAlg::ClearResults(), util::CreateAssn(), util::CreateAssnD(), geo::CryostatID::Cryostat, cluster::ClusterCrawlerAlg::ClusterStore::CTP, cluster::ClusterCrawlerAlg::DecodeCTP(), DEFINE_ART_MODULE, util::end(), cluster::ClusterCrawlerAlg::ClusterStore::EndAng, cluster::ClusterCrawlerAlg::ClusterStore::EndChg, cluster::ClusterCrawlerAlg::ClusterStore::EndTim, cluster::ClusterCrawlerAlg::ClusterStore::EndVtx, cluster::ClusterCrawlerAlg::ClusterStore::EndWir, fCCAlg, fDoRawDigitAssns, fDoWireAssns, fHitFinderLabel, cluster::ClusterCrawlerAlg::GetClusters(), cluster::ClusterCrawlerAlg::GetEndPoints(), art::ProductRetriever::getValidHandle(), cluster::ClusterCrawlerAlg::GetVertices(), cluster::ClusterCrawlerAlg::ClusterStore::ID, recob::Hit::Integral(), geo::PlaneID::Plane, art::errors::ProductRegistrationFailure, art::Event::put(), recob::HitRefinerAssociator::put_into(), cluster::ClusterCrawlerAlg::RunCrawler(), recob::Cluster::Sentry, recob::Hit::SummedADC(), cluster::ClusterCrawlerAlg::ClusterStore::tclhits, geo::TPCID::TPC, recob::HitRefinerAssociator::use_hits(), and cluster::ClusterCrawlerAlg::YieldHits().

103  {
104  // fetch the wires needed by CCHitFinder
105 
106  // make this accessible to ClusterCrawler_module
107  auto hitVecHandle = evt.getValidHandle<std::vector<recob::Hit>>(fHitFinderLabel);
108 
109  // look for clusters in all planes
110  auto const clock_data =
112  auto const det_prop =
114  fCCAlg.RunCrawler(clock_data, det_prop, *hitVecHandle);
115 
116  auto FinalHits = std::make_unique<std::vector<recob::Hit>>(std::move(fCCAlg.YieldHits()));
117 
118  // shcol contains the hit collection
119  // and its associations to wires and raw digits;
120  // we get the association to raw digits through wire associations
122  std::vector<recob::Cluster> sccol;
123  std::vector<recob::Vertex> sv3col;
124  std::vector<recob::EndPoint2D> sv2col;
125 
126  std::unique_ptr<art::Assns<recob::Cluster, recob::Hit>> hc_assn(
128  std::unique_ptr<art::Assns<recob::Cluster, recob::Vertex, unsigned short>> cv_assn(
130  std::unique_ptr<art::Assns<recob::Cluster, recob::EndPoint2D, unsigned short>> cep_assn(
132 
133  std::vector<ClusterCrawlerAlg::ClusterStore> const& Clusters = fCCAlg.GetClusters();
134 
135  // Consistency check
136  /*
137  std::vector<short> const& inClus = fCCAlg.GetinClus();
138  for(unsigned int icl = 0; icl < Clusters.size(); ++icl) {
139  ClusterCrawlerAlg::ClusterStore const& clstr = Clusters[icl];
140  if(clstr.ID < 0) continue;
141  geo::PlaneID planeID = ClusterCrawlerAlg::DecodeCTP(clstr.CTP);
142  unsigned short plane = planeID.Plane;
143  for(unsigned short ii = 0; ii < clstr.tclhits.size(); ++ii) {
144  unsigned int iht = clstr.tclhits[ii];
145  recob::Hit const& theHit = FinalHits->at(iht);
146  if(theHit.WireID().Plane != plane) {
147  mf::LogError("LineCluster")<<"Cluster-hit plane mis-match "<<theHit.WireID().Plane<<" "<<plane
148  <<" in cluster "<<clstr.ID<<" WT "<<clstr.BeginWir<<":"<<(int)clstr.BeginTim<<" cluster CTP "<<clstr.CTP;
149  return;
150  }
151  if(inClus[iht] != clstr.ID) {
152  mf::LogError("LineCluster") << "InClus mis-match " << inClus[iht]
153  << " ID " << clstr.ID << " in cluster ID " << clstr.ID<<" cluster ProcCode "<<clstr.ProcCode;;
154  return;
155  }
156  } // ii
157  } // icl
158 */
159  // make EndPoints (aka 2D vertices)
160  std::vector<ClusterCrawlerAlg::VtxStore> const& EndPts = fCCAlg.GetEndPoints();
161  std::vector<unsigned int> indxToIndx(EndPts.size());
163  unsigned short vtxID = 0, end, wire, ivx;
164  for (ivx = 0; ivx < EndPts.size(); ++ivx) {
165  if (EndPts[ivx].NClusters == 0) continue;
166  indxToIndx[ivx] = vtxID;
167  ++vtxID;
168  // std::cout<<"EndPt "<<ivx<<" vtxID "<<vtxID<<"\n";
169  wire = (0.5 + EndPts[ivx].Wire);
170  geo::PlaneID plID = ClusterCrawlerAlg::DecodeCTP(EndPts[ivx].CTP);
171  geo::WireID wID = geo::WireID(plID.Cryostat, plID.TPC, plID.Plane, wire);
172  geo::View_t view = geom->View(wID);
173  sv2col.emplace_back((double)EndPts[ivx].Time, // Time
174  wID, // WireID
175  0, // strength - not relevant
176  vtxID, // ID
177  view, // View
178  0); // total charge - not relevant
179  } // iv
180  // convert 2D Vertex vector to unique_ptrs
181  std::unique_ptr<std::vector<recob::EndPoint2D>> v2col(
182  new std::vector<recob::EndPoint2D>(std::move(sv2col)));
183 
184  // make 3D vertices
185  std::vector<ClusterCrawlerAlg::Vtx3Store> const& Vertices = fCCAlg.GetVertices();
186  double xyz[3] = {0, 0, 0};
187  vtxID = 0;
188  for (ClusterCrawlerAlg::Vtx3Store const& vtx3 : Vertices) {
189  // ignore incomplete vertices
190  if (vtx3.Ptr2D[0] < 0) continue;
191  if (vtx3.Ptr2D[1] < 0) continue;
192  if (vtx3.Ptr2D[2] < 0) continue;
193  ++vtxID;
194  xyz[0] = vtx3.X;
195  xyz[1] = vtx3.Y;
196  xyz[2] = vtx3.Z;
197  sv3col.emplace_back(xyz, vtxID);
198  } // 3D vertices
199  // convert Vertex vector to unique_ptrs
200  std::unique_ptr<std::vector<recob::Vertex>> v3col(
201  new std::vector<recob::Vertex>(std::move(sv3col)));
202 
203  // make the clusters and associations
204  float sumChg, sumADC;
205  unsigned int clsID = 0, nclhits;
206  for (unsigned int icl = 0; icl < Clusters.size(); ++icl) {
207  ClusterCrawlerAlg::ClusterStore const& clstr = Clusters[icl];
208  if (clstr.ID < 0) continue;
209  ++clsID;
210  sumChg = 0;
211  sumADC = 0;
212  geo::PlaneID planeID = ClusterCrawlerAlg::DecodeCTP(clstr.CTP);
213  unsigned short plane = planeID.Plane;
214  nclhits = clstr.tclhits.size();
215  std::vector<unsigned int> clsHitIndices;
216  // correct the hit indices to refer to the valid hits that were just added
217  for (unsigned int itt = 0; itt < nclhits; ++itt) {
218  unsigned int iht = clstr.tclhits[itt];
219  recob::Hit const& hit = FinalHits->at(iht);
220  sumChg += hit.Integral();
221  sumADC += hit.SummedADC();
222  } // itt
223  // get the wire, plane from a hit
224  unsigned int iht = clstr.tclhits[0];
225 
226  geo::View_t view = FinalHits->at(iht).View();
227  sccol.emplace_back((float)clstr.BeginWir, // Start wire
228  0, // sigma start wire
229  clstr.BeginTim, // start tick
230  0, // sigma start tick
231  clstr.BeginChg, // start charge
232  clstr.BeginAng, // start angle
233  0, // start opening angle (0 for line-like clusters)
234  (float)clstr.EndWir, // end wire
235  0, // sigma end wire
236  clstr.EndTim, // end tick
237  0, // sigma end tick
238  clstr.EndChg, // end charge
239  clstr.EndAng, // end angle
240  0, // end opening angle (0 for line-like clusters)
241  sumChg, // integral
242  0, // sigma integral
243  sumADC, // summed ADC
244  0, // sigma summed ADC
245  nclhits, // n hits
246  0, // wires over hits
247  0, // width (0 for line-like clusters)
248  clsID, // ID
249  view, // view
250  planeID, // plane
251  recob::Cluster::Sentry // sentry
252  );
253  // make the cluster - hit association
254  if (!util::CreateAssn(
255  evt, *hc_assn, sccol.size() - 1, clstr.tclhits.begin(), clstr.tclhits.end())) {
257  << "Failed to associate hit " << iht << " with cluster " << icl;
258  } // exception
259  // make the cluster - EndPoint2D and Vertex associations
260  if (clstr.BeginVtx >= 0) {
261  end = 0;
262  // std::cout<<clstr.ID<<" clsID "<<clsID<<" Begin vtx "<<clstr.BeginVtx<<" vtxID "<<indxToIndx[clstr.BeginVtx]<<"\n";
263  if (!util::CreateAssnD(evt, *cep_assn, clsID - 1, indxToIndx[clstr.BeginVtx], end)) {
265  << "Failed to associate cluster " << clsID << " with EndPoint2D " << clstr.BeginVtx;
266  } // exception
267  // See if this endpoint is associated with a 3D vertex
268  unsigned short vtxIndex = 0;
269  for (ClusterCrawlerAlg::Vtx3Store const& vtx3 : Vertices) {
270  // ignore incomplete vertices
271  if (vtx3.Ptr2D[0] < 0) continue;
272  if (vtx3.Ptr2D[1] < 0) continue;
273  if (vtx3.Ptr2D[2] < 0) continue;
274  if (vtx3.Ptr2D[plane] == clstr.BeginVtx) {
275  if (!util::CreateAssnD(evt, *cv_assn, clsID - 1, vtxIndex, end)) {
277  << "Failed to associate cluster " << icl << " with vertex";
278  } // exception
279  break;
280  } // vertex match
281  ++vtxIndex;
282  } // 3D vertices
283  } // clstr.BeginVtx >= 0
284  if (clstr.EndVtx >= 0) {
285  end = 1;
286  // std::cout<<clstr.ID<<" clsID "<<clsID<<" End vtx "<<clstr.EndVtx<<" vtxID "<<indxToIndx[clstr.EndVtx]<<"\n";
287  if (!util::CreateAssnD(evt, *cep_assn, clsID - 1, indxToIndx[clstr.EndVtx], end)) {
289  << "Failed to associate cluster " << clsID << " with EndPoint2D " << clstr.BeginVtx;
290  } // exception
291  // See if this endpoint is associated with a 3D vertex
292  unsigned short vtxIndex = 0;
293  for (ClusterCrawlerAlg::Vtx3Store const& vtx3 : Vertices) {
294  // ignore incomplete vertices
295  if (vtx3.Ptr2D[0] < 0) continue;
296  if (vtx3.Ptr2D[1] < 0) continue;
297  if (vtx3.Ptr2D[2] < 0) continue;
298  if (vtx3.Ptr2D[plane] == clstr.EndVtx) {
299  if (!util::CreateAssnD(evt, *cv_assn, clsID - 1, vtxIndex, end)) {
301  << "Failed to associate cluster " << icl << " with endpoint";
302  } // exception
303  break;
304  } // vertex match
305  ++vtxIndex;
306  } // 3D vertices
307  } // clstr.BeginVtx >= 0
308  } // icl
309 
310  // convert cluster vector to unique_ptrs
311  std::unique_ptr<std::vector<recob::Cluster>> ccol(
312  new std::vector<recob::Cluster>(std::move(sccol)));
313 
314  shcol.use_hits(std::move(FinalHits));
315 
316  // clean up
318 
319  // move the hit collection and the associations into the event:
320  shcol.put_into(evt);
321  evt.put(std::move(ccol));
322  evt.put(std::move(hc_assn));
323  evt.put(std::move(v2col));
324  evt.put(std::move(v3col));
325  evt.put(std::move(cv_assn));
326  evt.put(std::move(cep_assn));
327 
328  } // LineCluster::produce()
bool CreateAssnD(art::Event &evt, art::Assns< T, U, D > &assn, size_t first_index, size_t second_index, typename art::Assns< T, U, D >::data_t &&data)
Creates a single one-to-one association with associated data.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
std::vector< ClusterStore > const & GetClusters() const
Returns a constant reference to the clusters found.
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:211
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
Definition: Hit.h:244
static const SentryArgument_t Sentry
An instance of the sentry object.
Definition: Cluster.h:174
static geo::PlaneID DecodeCTP(CTP_t CTP)
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
std::vector< recob::Hit > && YieldHits()
Returns (and loses) the collection of reconstructed hits.
std::vector< VtxStore > const & GetEndPoints() const
Returns a constant reference to the 2D end points found.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
art::InputTag fHitFinderLabel
label of module producing input hits
A class handling a collection of hits and its associations.
Definition: HitCreator.h:787
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:481
ClusterCrawlerAlg fCCAlg
Detector simulation of raw signals on wires.
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.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
std::vector< Vtx3Store > const & GetVertices() const
Returns a constant reference to the 3D vertices found.
void RunCrawler(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, std::vector< recob::Hit > const &srchits)
float SummedADC() const
The sum of calibrated ADC counts of the hit (0. by default)
Definition: Hit.h:240
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:399
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

ClusterCrawlerAlg cluster::LineCluster::fCCAlg
private

Definition at line 45 of file LineCluster_module.cc.

Referenced by LineCluster(), and produce().

bool cluster::LineCluster::fDoRawDigitAssns
private

Definition at line 50 of file LineCluster_module.cc.

Referenced by LineCluster(), and produce().

bool cluster::LineCluster::fDoWireAssns
private

Definition at line 49 of file LineCluster_module.cc.

Referenced by LineCluster(), and produce().

art::InputTag cluster::LineCluster::fHitFinderLabel
private

label of module producing input hits

Definition at line 47 of file LineCluster_module.cc.

Referenced by LineCluster(), and produce().


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