LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
cluster::FuzzyClusterMerger Class Reference
Inheritance diagram for cluster::FuzzyClusterMerger:
art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 FuzzyClusterMerger (fhicl::ParameterSet const &p)
 
virtual ~FuzzyClusterMerger ()
 
void produce (art::Event &evt) override
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > consumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > consumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > mayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > mayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Attributes

::cmtool::CMergeHelper fCMerge
 ClusterMergeHelper. More...
 
std::string fClusterModuleLabel
 Input cluster data product producer name label. More...
 
::util::GeometryUtilities fGeoU
 GeometryUtilities instance. More...
 
bool fTSep1UseEP
 
double fOOCS1MaxAngle
 
int fSDMinHits
 
double fSDSqDistCut
 
bool fTSep2UseEP
 
double fOOCS2MaxAngle
 
int fAI2MinHits
 
bool fAI2Allow180Ambig
 
bool fAI2UseOpeningAngle
 
double fAI2AngleCut
 
double fAI2MinLength
 
bool fCOM2UseCOMInPoly
 
bool fCOM2UseCOMInCone
 
bool fCOM2UseCOMNearClus
 
double fCOM2SetLengthReach
 
int fPO2MinHits
 
int fPSD2MinHits
 
int fPSD2MaxHits
 
double fPSD2MinDistSqd
 

Detailed Description

Definition at line 48 of file FuzzyClusterMerger_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

using art::EDProducer::WorkerType = WorkerT<EDProducer>
inherited

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

cluster::FuzzyClusterMerger::FuzzyClusterMerger ( fhicl::ParameterSet const &  p)
explicit

Definition at line 143 of file FuzzyClusterMerger_module.cc.

References cmtool::CMergeManager::AddMergeAlgo(), cmtool::CMManagerBase::AddPriorityAlgo(), cmtool::CMergeManager::AddSeparateAlgo(), fAI2Allow180Ambig, fAI2AngleCut, fAI2MinHits, fAI2MinLength, fAI2UseOpeningAngle, fClusterModuleLabel, fCMerge, fCOM2SetLengthReach, fCOM2UseCOMInCone, fCOM2UseCOMInPoly, fCOM2UseCOMNearClus, fOOCS1MaxAngle, fOOCS2MaxAngle, fPO2MinHits, fPSD2MaxHits, fPSD2MinDistSqd, fPSD2MinHits, fSDMinHits, fSDSqDistCut, fTSep1UseEP, fTSep2UseEP, fhicl::ParameterSet::get(), cmtool::CMergeHelper::GetManager(), and cmtool::CMManagerBase::MergeTillConverge().

144  {
145  // Declare output data products
146  produces< std::vector<recob::Cluster> >();
147  produces< art::Assns<recob::Cluster, recob::Hit> >();
148 
149  // Fill fcl parameter
150  fClusterModuleLabel = p.get<std::string>("InputClusterLabel");
151 
152  fTSep1UseEP = p.get<bool>("TSep1UseEP");
153 
154  fOOCS1MaxAngle = p.get<double>("OOCS1MaxAngle");
155 
156  fSDMinHits = p.get<int>("SDMinHits");
157  fSDSqDistCut = p.get<double>("SDSqDistCut");
158 
159  fTSep2UseEP = p.get<bool>("TSep2UseEP");
160 
161  fOOCS2MaxAngle = p.get<double>("OOCS2MaxAngle");
162 
163  fAI2MinHits = p.get<int>("AI2MinHits");
164  fAI2Allow180Ambig = p.get<bool>("AI2Allow180Ambig");
165  fAI2UseOpeningAngle = p.get<bool>("AI2UseOpeningAngle");
166  fAI2AngleCut = p.get<double>("AI2AngleCut");
167  fAI2MinLength = p.get<double>("AI2MinLength");
168 
169 
170  fCOM2UseCOMInPoly = p.get<bool>("COM2UseCOMInPoly");
171  fCOM2UseCOMInCone = p.get<bool>("COM2UseCOMInCone");
172  fCOM2UseCOMNearClus = p.get<bool>("COM2UseCOMNearClus");
173  fCOM2SetLengthReach = p.get<double>("COM2SetLengthReach");
174 
175 
176  fPO2MinHits = p.get<int>("PO2MinHits");
177 
178  fPSD2MinHits = p.get<int>("PSD2MinHits");
179  fPSD2MaxHits = p.get<int>("PSD2MaxHits");
180  fPSD2MinDistSqd = p.get<double>("PSD2MinDistSqd");
181 
182 
183 
184  //--- Configure Merging Algorithm ---//
185 
186 
188  //fCMerge.GetManager(0).DebugMode(::cmtool::CMergeManager::kPerIteration);
189 
190  // Prohibit algorithms
191  auto prohib_algo_1_1 = new ::cmtool::CBAlgoTrackSeparate;
192  prohib_algo_1_1->SetUseEP(fTSep1UseEP);
193 
194  auto prohib_algo_1_2 = new ::cmtool::CBAlgoOutOfConeSeparate;
195  prohib_algo_1_2->SetMaxAngleSep(fOOCS1MaxAngle);
196 
197  auto prohib_algo_1 = new ::cmtool::CBAlgoArray;
198  prohib_algo_1->AddAlgo(prohib_algo_1_1,false);
199  prohib_algo_1->AddAlgo(prohib_algo_1_2,false);
200 
201  fCMerge.GetManager(0).AddSeparateAlgo( prohib_algo_1 );
202 
203  // Merge algorithms
204  auto merge_algo_1_1 = new ::cmtool::CBAlgoShortestDist;
205  merge_algo_1_1->SetMinHits(fSDMinHits);
206  merge_algo_1_1->SetSquaredDistanceCut(fSDSqDistCut);
207 
208  auto merge_algo_1_2 = new ::cmtool::CBAlgoStartTrack;
209 
210  auto merge_algo_1_3 = new ::cmtool::CBAlgoPolyContain;
211 
212  auto merge_algo_1 = new ::cmtool::CBAlgoArray;
213  merge_algo_1->AddAlgo(merge_algo_1_1,false);
214  merge_algo_1->AddAlgo(merge_algo_1_2,false);
215  merge_algo_1->AddAlgo(merge_algo_1_3,false);
216 
217  fCMerge.GetManager(0).AddMergeAlgo( merge_algo_1 );
218 
219  // Configure 2nd stage merging
220  //auto& fCMerge.GetManager(1) = GetManager(1);
222  //fCMerge.GetManager(0).DebugMode(::cmtool::CMergeManager::kPerIteration);
223 
224  // Prohibit algorithms
225  auto prohib_algo_2_1 = new ::cmtool::CBAlgoTrackSeparate;
226  // prohib_algo_2_1->SetDebug(false);
227  // prohib_algo_2_1->SetVerbose(false);
228  prohib_algo_2_1->SetUseEP(fTSep2UseEP);
229 
230  auto prohib_algo_2_2 = new ::cmtool::CBAlgoOutOfConeSeparate;
231  // prohib_algo_2_2->SetDebug(false);
232  // prohib_algo_2_2->SetVerbose(false);
233  prohib_algo_2_2->SetMaxAngleSep(fOOCS2MaxAngle);
234 
235  auto prohib_algo_2_3 = new ::cmtool::CBAlgoAngleIncompat;
236  prohib_algo_2_3->SetMinHits(fAI2MinHits);
237  prohib_algo_2_3->SetAllow180Ambig(fAI2Allow180Ambig);
238  prohib_algo_2_3->SetUseOpeningAngle(fAI2UseOpeningAngle);
239  prohib_algo_2_3->SetAngleCut(fAI2AngleCut);
240  prohib_algo_2_3->SetMinLength(fAI2MinLength);
241  // prohib_algo_2_3->SetDebug(false);
242 
243 
244 
245  auto prohib_algo_2 = new ::cmtool::CBAlgoArray;
246  prohib_algo_2->AddAlgo(prohib_algo_2_1,false);
247  prohib_algo_2->AddAlgo(prohib_algo_2_2,false);
248  prohib_algo_2->AddAlgo(prohib_algo_2_3,false);
249 
250  fCMerge.GetManager(1).AddSeparateAlgo(prohib_algo_2);
251 
252  // Merge algorithms
253  auto merge_algo_2_1 = new ::cmtool::CBAlgoCenterOfMass;
254  // merge_algo_2_1->SetDebug(false);
255  // merge_algo_2_1->SetVerbose(false);
256  merge_algo_2_1->UseCOMInPoly(fCOM2UseCOMInPoly);
257  merge_algo_2_1->UseCOMInCone(fCOM2UseCOMInCone);
258  merge_algo_2_1->UseCOMNearClus(fCOM2UseCOMNearClus);
259  merge_algo_2_1->SetLengthReach(fCOM2SetLengthReach);
260 
261 
262  auto merge_algo_2_2 = new ::cmtool::CBAlgoPolyOverlap;
263  merge_algo_2_2->SetMinNumHits(fPO2MinHits);
264 
265  auto merge_algo_2_3 = new ::cmtool::CBAlgoPolyShortestDist;
266  merge_algo_2_3->SetMinNumHits(fPSD2MinHits);
267  merge_algo_2_3->SetMaxNumHits(fPSD2MaxHits);
268  merge_algo_2_3->SetMinDistSquared(fPSD2MinDistSqd);
269  merge_algo_2_3->SetDebug(false);
270 
271  auto merge_algo_2 = new ::cmtool::CBAlgoArray;
272  merge_algo_2->AddAlgo(merge_algo_2_1,false);
273  merge_algo_2->AddAlgo(merge_algo_2_2,false);
274  merge_algo_2->AddAlgo(merge_algo_2_3,false);
275 
276  fCMerge.GetManager(1).AddMergeAlgo(merge_algo_2);
277 
278  // Prohibit algorithms
279  auto priority_algo_2 = new ::cmtool::CPAlgoIgnoreTracks;
280 
281  fCMerge.GetManager(1).AddPriorityAlgo(priority_algo_2);
282 
283  //
284  // FYI there's an algorithm to just-merge-everything if you want to do a simple test (line commented out below)
285  //
286  //fCMerge.GetManager(0).AddMergeAlgo( new CMAlgoMergeAll );
287 
288 
289  }
std::string fClusterModuleLabel
Input cluster data product producer name label.
::cmtool::CMergeHelper fCMerge
ClusterMergeHelper.
void AddMergeAlgo(CBoolAlgoBase *algo)
A simple method to add an algorithm for merging.
Definition: CMergeManager.h:44
CMergeManager & GetManager(size_t mgr_id)
Definition: CMergeHelper.cxx:8
void MergeTillConverge(bool doit=true)
Switch to continue merging till converges.
Definition: CMManagerBase.h:66
void AddPriorityAlgo(CPriorityAlgoBase *algo)
Setter to add an algorithm for priority determination.
Definition: CMManagerBase.h:63
void AddSeparateAlgo(CBoolAlgoBase *algo)
A simple method to add an algorithm for separation.
Definition: CMergeManager.h:47
cluster::FuzzyClusterMerger::~FuzzyClusterMerger ( )
virtual

Definition at line 291 of file FuzzyClusterMerger_module.cc.

292  {
293  // Clean up dynamic memory and other resources here.
294  }

Member Function Documentation

template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 147 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

148 {
149  if (!moduleContext_)
150  return ProductToken<T>::invalid();
151 
152  consumables_[BT].emplace_back(ConsumableType::Product,
153  TypeID{typeid(T)},
154  it.label(),
155  it.instance(),
156  it.process());
157  return ProductToken<T>{it};
158 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 162 of file Consumer.h.

163 {
164  if (!moduleContext_)
165  return;
166 
167  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
168 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 172 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

173 {
174  if (!moduleContext_)
175  return ViewToken<T>::invalid();
176 
177  consumables_[BT].emplace_back(ConsumableType::ViewElement,
178  TypeID{typeid(T)},
179  it.label(),
180  it.instance(),
181  it.process());
182  return ViewToken<T>{it};
183 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited

Definition at line 32 of file EngineCreator.cc.

References art::EngineCreator::rng().

34 {
35  return rng()->createEngine(
36  placeholder_schedule_id(), seed, kind_of_engine_to_make);
37 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited

Definition at line 40 of file EngineCreator.cc.

References art::EngineCreator::rng().

43 {
44  return rng()->createEngine(
45  placeholder_schedule_id(), seed, kind_of_engine_to_make, engine_label);
46 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
CurrentProcessingContext const * art::EDProducer::currentContext ( ) const
protectedinherited

Definition at line 120 of file EDProducer.cc.

References art::EDProducer::current_context_.

121  {
122  return current_context_.get();
123  }
CPC_exempt_ptr current_context_
Definition: EDProducer.h:116
EngineCreator::seed_t EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited

Definition at line 49 of file EngineCreator.cc.

References fhicl::ParameterSet::get().

Referenced by art::MixFilter< T >::initEngine_().

52 {
53  auto const& explicit_seeds = pset.get<std::vector<int>>(key, {});
54  return explicit_seeds.empty() ? implicit_seed : explicit_seeds.front();
55 }
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References B, and art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
Int_t B
Definition: plot.C:25
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 190 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

191 {
192  if (!moduleContext_)
193  return ProductToken<T>::invalid();
194 
195  consumables_[BT].emplace_back(ConsumableType::Product,
196  TypeID{typeid(T)},
197  it.label(),
198  it.instance(),
199  it.process());
200  return ProductToken<T>{it};
201 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 205 of file Consumer.h.

206 {
207  if (!moduleContext_)
208  return;
209 
210  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
211 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 215 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

216 {
217  if (!moduleContext_)
218  return ViewToken<T>::invalid();
219 
220  consumables_[BT].emplace_back(ConsumableType::ViewElement,
221  TypeID{typeid(T)},
222  it.label(),
223  it.instance(),
224  it.process());
225  return ViewToken<T>{it};
226 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID().

41  {
42  return true;
43  }
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited

Definition at line 89 of file Consumer.cc.

References fhicl::ParameterSet::get_if_present().

Referenced by art::EDProducer::doBeginJob(), art::EDFilter::doBeginJob(), and art::EDAnalyzer::doBeginJob().

90 {
91  if (!moduleContext_)
92  return;
93 
94  pset.get_if_present("errorOnMissingConsumes", requireConsumes_);
95  for (auto& consumablesPerBranch : consumables_) {
96  cet::sort_all(consumablesPerBranch);
97  }
98 }
bool requireConsumes_
Definition: Consumer.h:137
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
void cluster::FuzzyClusterMerger::produce ( art::Event evt)
overridevirtual

Implements art::EDProducer.

Definition at line 296 of file FuzzyClusterMerger_module.cc.

References util::CreateAssn(), DEFINE_ART_MODULE, cluster::cluster_params::end_point, cluster::LazyClusterParamsAlg::EndAngle(), cluster::LazyClusterParamsAlg::EndCharge(), cluster::LazyClusterParamsAlg::EndOpeningAngle(), fClusterModuleLabel, fCMerge, fGeoU, util::PxHitConverter::GeneratePxHit(), art::DataViewImpl::getByLabel(), cmtool::CMergeHelper::GetClusters(), cmtool::CMergeHelper::GetResult(), cmtool::CMergeBookKeeper::GetResult(), hits(), cluster::LazyClusterParamsAlg::Integral(), cluster::LazyClusterParamsAlg::IntegralStdDev(), art::Handle< T >::isValid(), cluster::LazyClusterParamsAlg::MultipleHitDensity(), cluster::LazyClusterParamsAlg::NHits(), geo::GeometryCore::Plane(), cmtool::CMergeHelper::Process(), art::Event::put(), recob::Cluster::Sentry, cluster::cluster_params::start_point, cluster::LazyClusterParamsAlg::StartAngle(), cluster::LazyClusterParamsAlg::StartCharge(), cluster::LazyClusterParamsAlg::StartOpeningAngle(), cluster::LazyClusterParamsAlg::SummedADC(), cluster::LazyClusterParamsAlg::SummedADCStdDev(), util::PxPoint::t, util::GeometryUtilities::TimeToCm(), cluster::details::Measure_t< T >::value(), geo::PlaneGeo::View(), util::PxPoint::w, cluster::LazyClusterParamsAlg::Width(), and util::GeometryUtilities::WireToCm().

297  {
298  std::unique_ptr<std::vector<recob::Cluster> > out_clusters(new std::vector<recob::Cluster>);
299  std::unique_ptr<art::Assns<recob::Cluster, recob::Hit> > out_assn(new art::Assns<recob::Cluster, recob::Hit>);
300 
302 
303  //
304  // Preparation
305  //
306 
307  // Retrieve input clusters
309  evt.getByLabel(fClusterModuleLabel,cHandle);
310 
311  if(!cHandle.isValid())
312  throw cet::exception(__FUNCTION__) << "Invalid input cluster label!" << std::endl;
313 
314  // Cluster type conversion: recob::Hit => util::PxHit
315  std::vector<std::vector< ::util::PxHit> > local_clusters;
316  art::FindManyP<recob::Hit> hit_m(cHandle, evt, fClusterModuleLabel);
318  for(size_t i=0; i<cHandle->size(); ++i) {
319 
320  local_clusters.push_back(std::vector< ::util::PxHit>());
321 
322  const std::vector<art::Ptr<recob::Hit> >& all_hits = hit_m.at(i);
323  std::vector<art::Ptr<recob::Hit>> good_hits;
324  std::copy_if(
325  all_hits.begin(), all_hits.end(), std::back_inserter(good_hits),
326  [](auto const& pHit){ return pHit->Integral() > 0.; }
327  );
328  if (all_hits.size() > good_hits.size()) {
329  mf::LogWarning("FuzzyClusterMerger")
330  << "Dropped " << (all_hits.size() - good_hits.size()) << "/"
331  << all_hits.size()
332  << " hits which had non-positive integral in cluster #" << i;
333  }
334  if (good_hits.empty()) {
335  mf::LogError("FuzzyClusterMerger")
336  << "Cluster #" << i << " is skipped because of no good hits!";
337  continue;
338  }
339 
340  conv.GeneratePxHit(good_hits, local_clusters.back());
341  }
342 
343  //--- Process merging ---//
344  fCMerge.Process(local_clusters);
345 
346  // Store output
347  auto merged_clusters = fCMerge.GetResult().GetResult();
348 
349  auto const& cpan_v = fCMerge.GetClusters();
350  if(merged_clusters.size()!=cpan_v.size())
351 
352  throw cet::exception(__FUNCTION__) << "LOGIC ERROR: merged cluster id length != output cluster counts..." << std::endl;
353 
354 
355 
356  for(size_t out_index=0; out_index < merged_clusters.size(); ++out_index) {
357 
358  // To save typing let's just retrieve const cluster_params instance
359  const cluster_params &res = cpan_v[out_index].GetParams();
360 
361  // this "algo" is actually parroting its cluster_params
362  LazyClusterParamsAlg algo(res);
363 
364  std::vector<art::Ptr<recob::Hit> > merged_hits;
365  for(auto const& c_index : merged_clusters[out_index]) {
366  const std::vector<art::Ptr<recob::Hit> >& hits = hit_m.at(c_index);
367  merged_hits.reserve(merged_hits.size() + hits.size());
368  for(auto const& hit : hits) {
369  if (hit->Integral() > 0.) merged_hits.push_back(hit);
370  }
371  }
372 
373  // the full plane needed but not a part of cluster_params...
374  // get the one from the first hit
375  geo::PlaneID plane; // invalid by default
376  if (!merged_hits.empty()) plane = merged_hits.front()->WireID().planeID();
377 
378  // View_t needed but not a part of cluster_params, so retrieve it here
379  geo::View_t view_id = geo->Plane(plane).View();
380 
381  // Push back a new cluster data product with parameters copied from cluster_params
382  out_clusters->emplace_back(
383  res.start_point.w / fGeoU.WireToCm(), // start_wire
384  0., // sigma_start_wire
385  res.start_point.t / fGeoU.TimeToCm(), // start_tick
386  0., // sigma_start_tick
387  algo.StartCharge().value(), // start_charge
388  algo.StartAngle().value(), // start_angle
389  algo.StartOpeningAngle().value(), // start_opening
390  res.end_point.w / fGeoU.WireToCm(), // end_wire
391  0., // sigma_end_wire
392  res.end_point.t / fGeoU.TimeToCm(), // end_tick
393  0., // sigma_end_tick
394  algo.EndCharge().value(), // end_charge
395  algo.EndAngle().value(), // end_angle
396  algo.EndOpeningAngle().value(), // end_opening
397  algo.Integral().value(), // integral
398  algo.IntegralStdDev().value(), // integral_stddev
399  algo.SummedADC().value(), // summedADC
400  algo.SummedADCStdDev().value(), // summedADC_stddev
401  algo.NHits(), // n_hits
402  algo.MultipleHitDensity(), // multiple_hit_density
403  algo.Width(), // width
404  out_clusters->size(), // ID
405  view_id, // view
406  plane, // plane
407  recob::Cluster::Sentry // sentry
408  );
409 
410  util::CreateAssn(*this,
411  evt,
412  *(out_clusters.get()),
413  merged_hits,
414  *(out_assn.get())
415  );
416 
417  }
418 
419 
420 
421 
422 
423 
424 
425  /*
426  for(size_t out_index=0; out_index < merged_clusters.size(); ++out_index) {
427 
428  // To save typing let's just retrieve const cluster_params instance
429  const cluster_params &res = cpan_v[out_index].GetParams();
430 
431  // View_t needed but not a part of cluster_params, so retrieve it here
432  geo::View_t view_id = geo->Plane(cpan_v[out_index].Plane()).View();
433 
434  // Push back a new cluster data product with parameters copied from cluster_params
435  out_clusters->push_back( recob::Cluster( res.start_point.w / fGeoU.WireToCm(), 0, // start wire & error
436  res.start_point.t / fGeoU.TimeToCm(), 0, // start time & error
437  res.end_point.w / fGeoU.WireToCm(), 0, // end wire & error
438  res.end_point.t / fGeoU.TimeToCm(), 0, // end time & error
439  res.cluster_angle_2d, 0, // dT/dW (slope)
440  0, 0, // dQ/dW (what is that?)
441  res.sum_charge, // charge sum
442  view_id, // geo::View_t
443  out_clusters->size() // Cluster ID
444  )
445  );
446 
447 
448 
449  std::vector<art::Ptr<recob::Hit> > merged_hits;
450 
451  for(auto const& c_index : merged_clusters[out_index]) {
452 
453  const std::vector<art::Ptr<recob::Hit> >& hits = hit_m.at(c_index);
454 
455  merged_hits.reserve(merged_hits.size() + hits.size());
456 
457  for(auto const& ptr : hits) merged_hits.push_back(ptr);
458 
459  }
460 
461  util::CreateAssn(*this,
462  evt,
463  *(out_clusters.get()),
464  merged_hits,
465  *(out_assn.get())
466  );
467 
468  }*/
469 
470  evt.put(std::move(out_clusters));
471  evt.put(std::move(out_assn));
472  }
PlaneGeo const & Plane(unsigned int const p, unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified wire.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
std::vector< std::vector< unsigned short > > GetResult() const
Double_t TimeToCm() const
Double_t WireToCm() const
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
static const SentryArgument_t Sentry
An instance of the sentry object.
Definition: Cluster.h:182
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
bool isValid() const
Definition: Handle.h:190
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:171
void hits()
Definition: readHits.C:15
void GeneratePxHit(const std::vector< unsigned int > &hit_index, const std::vector< art::Ptr< recob::Hit >> hits, std::vector< util::PxHit > &pxhits) const
Generate: from 1 set of hits => 1 set of PxHits using indexes (association)
const std::vector< ::cluster::ClusterParamsAlg > & GetClusters() const
std::string fClusterModuleLabel
Input cluster data product producer name label.
::cmtool::CMergeHelper fCMerge
ClusterMergeHelper.
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.
const CMergeBookKeeper & GetResult() const
Definition: CMergeHelper.h:44
Detector simulation of raw signals on wires.
::util::GeometryUtilities fGeoU
GeometryUtilities instance.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void Process(const std::vector< std::vector< ::util::PxHit > > &clusters)
Namespace collecting geometry-related classes utilities.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Definition at line 125 of file Consumer.cc.

Referenced by art::EDProducer::doEndJob(), art::EDFilter::doEndJob(), art::EDAnalyzer::doEndJob(), and art::RootOutput::endJob().

126 {
127  if (!moduleContext_)
128  return;
129 
130  // If none of the branches have missing consumes statements, exit early.
131  if (std::all_of(cbegin(missingConsumes_),
132  cend(missingConsumes_),
133  [](auto const& perBranch) { return perBranch.empty(); }))
134  return;
135 
136  constexpr cet::HorizontalRule rule{60};
137  mf::LogPrint log{"MTdiagnostics"};
138  log << '\n'
139  << rule('=') << '\n'
140  << "The following consumes (or mayConsume) statements are missing from\n"
141  << module_context(moduleDescription_) << '\n'
142  << rule('-') << '\n';
143 
144  cet::for_all_with_index(
145  missingConsumes_, [&log](std::size_t const i, auto const& perBranch) {
146  for (auto const& pi : perBranch) {
147  log << " "
148  << assemble_consumes_statement(static_cast<BranchType>(i), pi)
149  << '\n';
150  }
151  });
152  log << rule('=');
153 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Definition at line 101 of file Consumer.cc.

References art::errors::ProductRegistrationFailure.

103 {
104  // Early exits if consumes tracking has been disabled or if the
105  // consumed product is an allowed consumable.
106  if (!moduleContext_)
107  return;
108 
109  if (cet::binary_search_all(consumables_[bt], pi))
110  return;
111 
112  if (requireConsumes_) {
114  "Consumer: an error occurred during validation of a "
115  "retrieved product\n\n")
116  << "The following consumes (or mayConsume) statement is missing from\n"
117  << module_context(moduleDescription_) << ":\n\n"
118  << " " << assemble_consumes_statement(bt, pi) << "\n\n";
119  }
120 
121  missingConsumes_[bt].insert(pi);
122 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
bool requireConsumes_
Definition: Consumer.h:137
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139

Member Data Documentation

bool cluster::FuzzyClusterMerger::fAI2Allow180Ambig
private

Definition at line 83 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

double cluster::FuzzyClusterMerger::fAI2AngleCut
private

Definition at line 85 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

int cluster::FuzzyClusterMerger::fAI2MinHits
private

Definition at line 82 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

double cluster::FuzzyClusterMerger::fAI2MinLength
private

Definition at line 86 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

bool cluster::FuzzyClusterMerger::fAI2UseOpeningAngle
private

Definition at line 84 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

std::string cluster::FuzzyClusterMerger::fClusterModuleLabel
private

Input cluster data product producer name label.

Definition at line 64 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger(), and produce().

::cmtool::CMergeHelper cluster::FuzzyClusterMerger::fCMerge
private

ClusterMergeHelper.

Definition at line 61 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger(), and produce().

double cluster::FuzzyClusterMerger::fCOM2SetLengthReach
private

Definition at line 91 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

bool cluster::FuzzyClusterMerger::fCOM2UseCOMInCone
private

Definition at line 89 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

bool cluster::FuzzyClusterMerger::fCOM2UseCOMInPoly
private

Definition at line 88 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

bool cluster::FuzzyClusterMerger::fCOM2UseCOMNearClus
private

Definition at line 90 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

::util::GeometryUtilities cluster::FuzzyClusterMerger::fGeoU
private

GeometryUtilities instance.

Definition at line 69 of file FuzzyClusterMerger_module.cc.

Referenced by produce().

double cluster::FuzzyClusterMerger::fOOCS1MaxAngle
private

Definition at line 73 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

double cluster::FuzzyClusterMerger::fOOCS2MaxAngle
private

Definition at line 80 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

int cluster::FuzzyClusterMerger::fPO2MinHits
private

Definition at line 93 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

int cluster::FuzzyClusterMerger::fPSD2MaxHits
private

Definition at line 96 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

double cluster::FuzzyClusterMerger::fPSD2MinDistSqd
private

Definition at line 97 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

int cluster::FuzzyClusterMerger::fPSD2MinHits
private

Definition at line 95 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

int cluster::FuzzyClusterMerger::fSDMinHits
private

Definition at line 75 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

double cluster::FuzzyClusterMerger::fSDSqDistCut
private

Definition at line 76 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

bool cluster::FuzzyClusterMerger::fTSep1UseEP
private

Definition at line 71 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().

bool cluster::FuzzyClusterMerger::fTSep2UseEP
private

Definition at line 78 of file FuzzyClusterMerger_module.cc.

Referenced by FuzzyClusterMerger().


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