9 #include "art/Framework/Services/Registry/ServiceHandle.h"
10 #include "art/Utilities/make_tool.h"
11 #include "art/Utilities/ToolMacros.h"
12 #include "cetlib/cpu_timer.h"
13 #include "fhiclcpp/ParameterSet.h"
14 #include "messagefacility/MessageLogger/MessageLogger.h"
29 namespace lar_cluster3d {
42 explicit DBScanAlg(fhicl::ParameterSet
const &pset);
49 void configure(
const fhicl::ParameterSet&)
override;
113 m_clusterBuilder = art::make_tool<lar_cluster3d::IClusterParametersBuilder>(pset.get<fhicl::ParameterSet>(
"ClusterParamsBuilder"));
116 fhicl::ParameterSet kdTreeParams(pset.get<fhicl::ParameterSet>(
"kdTree"));
119 art::ServiceHandle<geo::Geometry const>
geometry;
122 std::vector<float> wirePitchVec(3,0.);
124 wirePitchVec[0] = geometry->WirePitch(0);
125 wirePitchVec[1] = geometry->WirePitch(1);
126 wirePitchVec[2] = geometry->WirePitch(2);
128 float maxBestDist = 1.99 * *std::max_element(wirePitchVec.begin(),wirePitchVec.end());
130 kdTreeParams.put_or_replace<
float>(
"RefLeafBestDist", maxBestDist);
142 cet::cpu_timer theClockDBScan;
158 for(
const auto&
hit : hitPairList)
168 float bestDistance(std::numeric_limits<float>::max());
193 theClockDBScan.stop();
199 cet::cpu_timer theClockBuildClusters;
208 theClockBuildClusters.stop();
213 mf::LogDebug(
"Cluster3D") <<
">>>>> DBScan done, found " << clusterParametersList.size() <<
" clusters" << std::endl;
225 cet::cpu_timer theClockDBScan;
241 for(
const auto&
hit : hitPairList)
251 float bestDistance(std::numeric_limits<float>::max());
276 theClockDBScan.stop();
282 cet::cpu_timer theClockBuildClusters;
291 theClockBuildClusters.stop();
296 mf::LogDebug(
"Cluster3D") <<
">>>>> DBScan done, found " << clusterParametersList.size() <<
" clusters" << std::endl;
309 while(!candPairList.empty())
322 float bestDistance(std::numeric_limits<float>::max());
327 if (neighborCandPairList.size() >= minPts)
329 std::copy(neighborCandPairList.begin(),neighborCandPairList.end(),std::back_inserter(candPairList));
340 candPairList.pop_front();
void expandCluster(const kdTree::KdTreeNode &, kdTree::CandPairList &, reco::ClusterParameters &, size_t) const
the main routine for DBScan
std::list< reco::ClusterHit3D > HitPairList
void configure(const fhicl::ParameterSet &) override
Interface for configuring the particular algorithm tool.
const geo::GeometryCore * geometry
bool m_enableMonitoring
Data members to follow.
float getTimeToExecute(IClusterAlg::TimeValues index) const override
If monitoring, recover the time to execute a particular function.
std::list< KdTreeNode > KdTreeNodeList
Implements a kdTree for use in clustering.
size_t FindNearestNeighbors(const reco::ClusterHit3D *, const KdTreeNode &, CandPairList &, float &) const
Labelled "noise" by a clustering algorithm.
IClusterAlg interface class definiton.
unsigned int getStatusBits() const
void Cluster3DHits(reco::HitPairList &hitPairList, reco::ClusterParametersList &clusterParametersList) const override
Given a set of recob hits, run DBscan to form 3D clusters.
TimeValues
enumerate the possible values for time checking if monitoring timing
std::list< const reco::ClusterHit3D * > HitPairListPtr
This provides an art tool interface definition for 3D Cluster algorithms.
std::unique_ptr< lar_cluster3d::IClusterParametersBuilder > m_clusterBuilder
Common cluster builder tool.
std::list< CandPair > CandPairList
DBScanAlg(fhicl::ParameterSet const &pset)
Constructor.
DBScanAlg class definiton.
float getTimeToExecute() const
"visited" by a clustering algorithm
std::vector< float > m_timeVector
KdTreeNode & BuildKdTree(Hit3DVec::iterator, Hit3DVec::iterator, KdTreeNodeList &, int depth=0) const
Given an input set of ClusterHit3D objects, build a kd tree structure.
BEGIN_PROLOG don t mess with this pandoraTrackGausCryoW true
art framework interface to geometry description
std::list< ClusterParameters > ClusterParametersList
void addHit3D(const reco::ClusterHit3D *hit3D)
void setStatusBit(unsigned bits) const