17 #include "lardata/RecoObjects/Cluster3D.h" 25 #include "TDecompSVD.h" 41 m_maxNumEdgeHits(1000),
44 m_pcaAlg(pset.
get<
fhicl::ParameterSet>(
"PrincipalComponentsAlg"))
73 bool foundGoodSeeds(
false);
95 std::set<const reco::ClusterHit2D*> hit2DSet;
98 double lastArcLen = inputHitPairListPtr.front()->getArclenToPoca();
100 for(
const auto& hit3D : inputHitPairListPtr)
102 double arcLen = hit3D->getArclenToPoca();
106 seedHit3DList.clear();
110 seedHit3DList.push_back(hit3D);
112 for(
const auto& hit2D : hit3D->getHits())
114 hit2DSet.insert(hit2D);
126 size_t num3DHitsToKeep =
std::min(2*seedHit3DList.size(), inputHitPairListPtr.size());
132 std::advance(edgeHitItr, numEdgeHits);
137 hit3DList.resize(2*numEdgeHits);
143 seedHit3DList.clear();
144 seedHit3DList.resize(numEdgeHits);
146 std::copy(inputHitPairListPtr.begin(), edgeHitItr, seedHit3DList.begin());
149 std::advance(edgeHitItr, inputHitPairListPtr.size() - 2 * numEdgeHits);
151 std::copy(edgeHitItr, inputHitPairListPtr.end(), nextHit3DItr);
159 if (seedPCA.getSvdOK())
162 if (seedPCA.getEigenVectors()[0][1] > 0.) seedPCA.flipAxis(0);
172 double seedDir[3] = {seedPCA.getEigenVectors()[0][0], seedPCA.getEigenVectors()[0][1], seedPCA.getEigenVectors()[0][2]};
173 double seedStart[3] = {seedHit3DList.front()->getX(), seedHit3DList.front()->getY(), seedHit3DList.front()->getZ()};
176 double halfArcLen = 0.5 * fabs(seedHit3DList.back()->getArclenToPoca() - seedHit3DList.front()->getArclenToPoca());
178 seedStart[0] += halfArcLen * seedDir[0];
179 seedStart[1] += halfArcLen * seedDir[1];
180 seedStart[2] += halfArcLen * seedDir[2];
182 for(
const auto& hit3D : seedHit3DList) hit3D->setStatusBit(0x40000000);
184 seedHitPairVec.emplace_back(std::pair<recob::Seed, reco::HitPairListPtr>(
recob::Seed(seedStart, seedDir), seedHit3DList));
188 foundGoodSeeds =
true;
193 return foundGoodSeeds;
Define a comparator which will sort hits by arc length along a PCA axis.
void PCAAnalysis_calc3DDocas(const reco::HitPairListPtr &hitPairVector, const reco::PrincipalComponents &pca) const
void PCAAnalysis_3D(const reco::HitPairListPtr &hitPairList, reco::PrincipalComponents &pca, bool skeletonOnly=false) const
double m_gapDistance
Maximum allowed distance between hits.
void flipAxis(size_t axis)
virtual void reconfigure(fhicl::ParameterSet const &pset)
a handler for the case where the algorithm control parameters are to be reset
void reconfigure(fhicl::ParameterSet const &pset)
a handler for the case where the algorithm control parameters are to be reset
size_t m_maxNumEdgeHits
Maximum number hits each end of PCA axis.
PrincipalComponentsAlg m_pcaAlg
art framework interface to geometry description
ParallelHitsSeedFinderAlg(fhicl::ParameterSet const &pset)
Constructor.
T get(std::string const &key) const
std::list< const reco::ClusterHit3D * > HitPairListPtr
Encapsulate the geometry of a wire.
geo::Geometry * m_geometry
Declaration of signal hit object.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Encapsulate the construction of a single detector plane.
size_t m_numSeed2DHits
Number 2D seed hits desired.
std::vector< SeedHitPairListPair > SeedHitPairListPairVec
auto const & get(AssnsNode< L, R, D > const &r)
virtual ~ParallelHitsSeedFinderAlg()
Destructor.
virtual bool findTrackSeeds(reco::HitPairListPtr &hitPairListPtr, reco::PrincipalComponents &inputPCA, SeedHitPairListPairVec &seedHitMap) const
Given the list of hits this will search for candidate Seed objects and return them.
const EigenVectors & getEigenVectors() const