Build a list of candidate splits.
126 for (ClusterVector::const_iterator iterI = clusterVector.begin(), iterEndI = clusterVector.end(); iterI != iterEndI; ++iterI)
128 const Cluster *
const pClusterI = *iterI;
130 for (ClusterVector::const_iterator iterJ = iterI, iterEndJ = clusterVector.end(); iterJ != iterEndJ; ++iterJ)
132 const Cluster *
const pClusterJ = *iterJ;
134 if (pClusterI == pClusterJ)
138 TwoDSlidingFitResultMap::const_iterator iterBranchI = branchSlidingFitResultMap.find(*iterI);
139 TwoDSlidingFitResultMap::const_iterator iterBranchJ = branchSlidingFitResultMap.find(*iterJ);
141 TwoDSlidingFitResultMap::const_iterator iterReplacementI = replacementSlidingFitResultMap.find(*iterI);
142 TwoDSlidingFitResultMap::const_iterator iterReplacementJ = replacementSlidingFitResultMap.find(*iterJ);
144 if (branchSlidingFitResultMap.end() == iterBranchI || branchSlidingFitResultMap.end() == iterBranchJ ||
145 replacementSlidingFitResultMap.end() == iterReplacementI || replacementSlidingFitResultMap.end() == iterReplacementJ)
151 const TwoDSlidingFitResult &branchSlidingFitI(iterBranchI->second);
152 const TwoDSlidingFitResult &branchSlidingFitJ(iterBranchJ->second);
154 const TwoDSlidingFitResult &replacementSlidingFitI(iterReplacementI->second);
155 const TwoDSlidingFitResult &replacementSlidingFitJ(iterReplacementJ->second);
158 float branchChisqI(0.f);
159 CartesianVector branchSplitPositionI(0.f, 0.f, 0.f);
160 CartesianVector branchSplitDirectionI(0.f, 0.f, 0.f);
161 CartesianVector replacementStartPositionJ(0.f, 0.f, 0.f);
165 this->
FindBestSplitPosition(branchSlidingFitI, replacementSlidingFitJ, replacementStartPositionJ, branchSplitPositionI, branchSplitDirectionI);
166 branchChisqI = this->
CalculateBranchChi2(pClusterI, branchSplitPositionI, branchSplitDirectionI);
168 catch (StatusCodeException &)
173 float branchChisqJ(0.f);
174 CartesianVector branchSplitPositionJ(0.f, 0.f, 0.f);
175 CartesianVector branchSplitDirectionJ(0.f, 0.f, 0.f);
176 CartesianVector replacementStartPositionI(0.f, 0.f, 0.f);
180 this->
FindBestSplitPosition(branchSlidingFitJ, replacementSlidingFitI, replacementStartPositionI, branchSplitPositionJ, branchSplitDirectionJ);
181 branchChisqJ = this->
CalculateBranchChi2(pClusterJ, branchSplitPositionJ, branchSplitDirectionJ);
183 catch (StatusCodeException &)
188 if (branchChisqI > 0.f && branchChisqJ > 0.f)
190 const CartesianVector relativeDirection((branchSplitPositionJ - branchSplitPositionI).GetUnitVector());
192 if (branchSplitDirectionI.GetDotProduct(relativeDirection) > 0.f && branchSplitDirectionJ.GetDotProduct(relativeDirection) < 0.f)
196 const float newBranchChisqI(this->
CalculateBranchChi2(pClusterI, branchSplitPositionI, relativeDirection));
197 const float newBranchChisqJ(this->
CalculateBranchChi2(pClusterJ, branchSplitPositionJ, relativeDirection * -1.f));
198 branchChisqI = newBranchChisqI;
199 branchChisqJ = newBranchChisqJ;
201 catch (StatusCodeException &)
208 if (branchChisqI > branchChisqJ)
210 clusterExtensionList.push_back(
211 ClusterExtension(pClusterI, pClusterJ, replacementStartPositionJ, branchSplitPositionI, branchSplitDirectionI));
214 else if (branchChisqJ > branchChisqI)
216 clusterExtensionList.push_back(
217 ClusterExtension(pClusterJ, pClusterI, replacementStartPositionI, branchSplitPositionJ, branchSplitDirectionJ));
virtual void FindBestSplitPosition(const TwoDSlidingFitResult &branchSlidingFit, const TwoDSlidingFitResult &replacementSlidingFit, pandora::CartesianVector &replacementStartPosition, pandora::CartesianVector &branchSplitPosition, pandora::CartesianVector &branchSplitDirection) const =0
Output the best split positions in branch and replacement clusters.
float CalculateBranchChi2(const pandora::Cluster *const pCluster, const pandora::CartesianVector &splitPosition, const pandora::CartesianVector &splitDirection) const
Calculate RMS deviation of branch hits relative to the split direction.