LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::ThreeDTransverseTracksAlgorithm Class Reference

ThreeDTransverseTracksAlgorithm class. More...

#include "ThreeDTransverseTracksAlgorithm.h"

Inheritance diagram for lar_content::ThreeDTransverseTracksAlgorithm:
lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult > lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >

Public Types

typedef OverlapTensor< TransverseOverlapResultTensorType
 

Public Member Functions

 ThreeDTransverseTracksAlgorithm ()
 Default constructor. More...
 
const TwoDSlidingFitResultGetCachedSlidingFitResult (const pandora::Cluster *const pCluster) const
 Get a sliding fit result from the algorithm cache. More...
 
unsigned int GetSlidingFitWindow () const
 Get the layer window for the sliding linear fits. More...
 
virtual bool MakeClusterSplits (const SplitPositionMap &splitPositionMap)
 Make cluster splits. More...
 
virtual bool MakeClusterSplit (const pandora::CartesianVector &splitPosition, const pandora::Cluster *&pCurrentCluster, const pandora::Cluster *&pLowXCluster, const pandora::Cluster *&pHighXCluster) const
 Make a cluster split. More...
 
virtual void UpdateForNewCluster (const pandora::Cluster *const pNewCluster)
 Update to reflect addition of a new cluster to the problem space. More...
 
virtual void UpdateUponDeletion (const pandora::Cluster *const pDeletedCluster)
 Update to reflect cluster deletion. More...
 
virtual void SelectInputClusters (const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const
 Select a subset of input clusters for processing in this algorithm. More...
 
virtual void SetPfoParameters (const ProtoParticle &protoParticle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
 Calculate Pfo properties from proto particle. More...
 
virtual bool CreateThreeDParticles (const ProtoParticleVector &protoParticleVector)
 Create particles using findings from recent algorithm processing. More...
 
virtual bool MakeClusterMerges (const ClusterMergeMap &clusterMergeMap)
 Merge clusters together. More...
 
virtual void RemoveUnavailableTensorElements ()
 Update tensor to remove all elements that have been added to pfos and so are unavailable. More...
 
const pandora::ClusterList & GetInputClusterListU () const
 Get the input u cluster list. More...
 
const pandora::ClusterList & GetInputClusterListV () const
 Get the input v cluster list. More...
 
const pandora::ClusterList & GetInputClusterListW () const
 Get the input w cluster list. More...
 
const pandora::ClusterList & GetSelectedClusterListU () const
 Get the selected u cluster list. More...
 
const pandora::ClusterList & GetSelectedClusterListV () const
 Get the selected v cluster list. More...
 
const pandora::ClusterList & GetSelectedClusterListW () const
 Get the selected w cluster list. More...
 
const std::string & GetClusterListNameU () const
 Get the name of the u cluster list. More...
 
const std::string & GetClusterListNameV () const
 Get the name of the v cluster list. More...
 
const std::string & GetClusterListNameW () const
 Get the name of the w cluster list. More...
 

Static Public Member Functions

static bool SortSplitPositions (const pandora::CartesianVector &lhs, const pandora::CartesianVector &rhs)
 Sort split position cartesian vectors by increasing x coordinate. More...
 

Protected Member Functions

virtual void PreparationStep ()
 Perform any preparatory steps required, e.g. caching expensive fit results for clusters. More...
 
virtual void PreparationStep (pandora::ClusterList &clusterList)
 Preparation step for a specific cluster list. More...
 
virtual void TidyUp ()
 Tidy member variables in derived class. More...
 
void AddToSlidingFitCache (const pandora::Cluster *const pCluster)
 Add a new sliding fit result, for the specified cluster, to the algorithm cache. More...
 
void RemoveFromSlidingFitCache (const pandora::Cluster *const pCluster)
 Remova an existing sliding fit result, for the specified cluster, from the algorithm cache. More...
 
virtual void SelectAllInputClusters ()
 Select a subset of input clusters for processing in this algorithm. More...
 
virtual void PerformMainLoop ()
 Main loop over cluster combinations in order to populate the tensor. Responsible for calling CalculateOverlapResult. More...
 

Protected Attributes

unsigned int m_slidingFitWindow
 The layer window for the sliding linear fits. More...
 
TwoDSlidingFitResultMap m_slidingFitResultMap
 The sliding fit result map. More...
 
unsigned int m_minClusterCaloHits
 The min number of hits in base cluster selection method. More...
 
float m_minClusterLengthSquared
 The min length (squared) in base cluster selection method. More...
 
const pandora::ClusterList * m_pInputClusterListU
 Address of the input cluster list U. More...
 
const pandora::ClusterList * m_pInputClusterListV
 Address of the input cluster list V. More...
 
const pandora::ClusterList * m_pInputClusterListW
 Address of the input cluster list W. More...
 
pandora::ClusterList m_clusterListU
 The selected modified cluster list U. More...
 
pandora::ClusterList m_clusterListV
 The selected modified cluster list V. More...
 
pandora::ClusterList m_clusterListW
 The selected modified cluster list W. More...
 
TensorType m_overlapTensor
 The overlap tensor. More...
 

Private Types

typedef std::map< unsigned int, TransverseOverlapResultFitSegmentToOverlapResultMap
 
typedef std::map< unsigned int, FitSegmentToOverlapResultMapFitSegmentMatrix
 
typedef std::map< unsigned int, FitSegmentMatrixFitSegmentTensor
 
typedef std::vector< TransverseTensorTool * > TensorToolVector
 

Private Member Functions

void CalculateOverlapResult (const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW)
 Calculate cluster overlap result and store in tensor. More...
 
pandora::StatusCode CalculateOverlapResult (const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW, TransverseOverlapResult &overlapResult)
 Calculate the overlap result for given group of clusters. More...
 
void GetFitSegmentTensor (const TwoDSlidingFitResult &slidingFitResultU, const TwoDSlidingFitResult &slidingFitResultV, const TwoDSlidingFitResult &slidingFitResultW, FitSegmentTensor &fitSegmentTensor) const
 Get the number of matched points for three fit segments and accompanying sliding fit results. More...
 
pandora::StatusCode GetSegmentOverlap (const FitSegment &fitSegmentU, const FitSegment &fitSegmentV, const FitSegment &fitSegmentW, const TwoDSlidingFitResult &slidingFitResultU, const TwoDSlidingFitResult &slidingFitResultV, const TwoDSlidingFitResult &slidingFitResultW, TransverseOverlapResult &transverseOverlapResult) const
 Get the overlap result for three fit segments and the accompanying sliding fit results. More...
 
void GetBestOverlapResult (const FitSegmentTensor &fitSegmentTensor, TransverseOverlapResult &bestTransverseOverlapResult) const
 Get the best overlap result, by examining the fit segment tensor. More...
 
void GetPreviousOverlapResults (const unsigned int indexU, const unsigned int indexV, const unsigned int indexW, FitSegmentTensor &fitSegmentSumTensor, TransverseOverlapResultVector &transverseOverlapResultVector) const
 Get track overlap results for possible connected segments. More...
 
void ExamineTensor ()
 Examine contents of tensor, collect together best-matching 2D particles and modify clusters as required. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

TensorToolVector m_algorithmToolVector
 The algorithm tool vector. More...
 
unsigned int m_nMaxTensorToolRepeats
 The maximum number of repeat loops over tensor tools. More...
 
unsigned int m_maxFitSegmentIndex
 The maximum number of fit segments used when identifying best overlap result. More...
 
float m_pseudoChi2Cut
 The pseudo chi2 cut to identify matched sampling points. More...
 
float m_minSegmentMatchedFraction
 The minimum segment matched sampling fraction to allow segment grouping. More...
 
unsigned int m_minSegmentMatchedPoints
 The minimum number of matched segment sampling points to allow segment grouping. More...
 
float m_minOverallMatchedFraction
 The minimum matched sampling fraction to allow particle creation. More...
 
unsigned int m_minOverallMatchedPoints
 The minimum number of matched segment sampling points to allow particle creation. More...
 
float m_minSamplingPointsPerLayer
 The minimum number of sampling points per layer to allow particle creation. More...
 

Detailed Description

Member Typedef Documentation

Constructor & Destructor Documentation

lar_content::ThreeDTransverseTracksAlgorithm::ThreeDTransverseTracksAlgorithm ( )

Default constructor.

Definition at line 21 of file ThreeDTransverseTracksAlgorithm.cc.

References CalculateOverlapResult(), f, GetBestOverlapResult(), lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::GetCachedSlidingFitResult(), GetFitSegmentTensor(), lar_content::TrackOverlapResult::GetMatchedFraction(), lar_content::TwoDSlidingFitResult::GetMaxLayer(), lar_content::TwoDSlidingFitResult::GetMinLayer(), lar_content::TrackOverlapResult::GetNMatchedSamplingPoints(), lar_content::TrackOverlapResult::GetNSamplingPoints(), lar_content::TrackOverlapResult::IsInitialized(), m_minOverallMatchedFraction, m_minOverallMatchedPoints, m_minSamplingPointsPerLayer, lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::m_overlapTensor, and lar_content::OverlapTensor< T >::SetOverlapResult().

21  :
24  m_pseudoChi2Cut(3.f),
30 {
31 }
float m_minSegmentMatchedFraction
The minimum segment matched sampling fraction to allow segment grouping.
float m_pseudoChi2Cut
The pseudo chi2 cut to identify matched sampling points.
unsigned int m_maxFitSegmentIndex
The maximum number of fit segments used when identifying best overlap result.
unsigned int m_minOverallMatchedPoints
The minimum number of matched segment sampling points to allow particle creation. ...
TFile f
Definition: plotHisto.C:6
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
float m_minOverallMatchedFraction
The minimum matched sampling fraction to allow particle creation.
float m_minSamplingPointsPerLayer
The minimum number of sampling points per layer to allow particle creation.
unsigned int m_minSegmentMatchedPoints
The minimum number of matched segment sampling points to allow segment grouping.

Member Function Documentation

void lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::AddToSlidingFitCache ( const pandora::Cluster *const  pCluster)
protectedinherited

Add a new sliding fit result, for the specified cluster, to the algorithm cache.

Parameters
pClusteraddress of the relevant cluster
void lar_content::ThreeDTransverseTracksAlgorithm::CalculateOverlapResult ( const pandora::Cluster *const  pClusterU,
const pandora::Cluster *const  pClusterV,
const pandora::Cluster *const  pClusterW 
)
privatevirtual

Calculate cluster overlap result and store in tensor.

Parameters
pClusterUaddress of U view cluster
pClusterVaddress of V view cluster
pClusterWaddress of W view cluster

Implements lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >.

Referenced by ThreeDTransverseTracksAlgorithm().

pandora::StatusCode lar_content::ThreeDTransverseTracksAlgorithm::CalculateOverlapResult ( const pandora::Cluster *const  pClusterU,
const pandora::Cluster *const  pClusterV,
const pandora::Cluster *const  pClusterW,
TransverseOverlapResult overlapResult 
)
private

Calculate the overlap result for given group of clusters.

Parameters
pClusterUthe cluster from the U view
pClusterVthe cluster from the V view
pClusterWthe cluster from the W view
overlapResultto receive the overlap result
Returns
statusCode, faster than throwing in regular use-cases
virtual bool lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::CreateThreeDParticles ( const ProtoParticleVector protoParticleVector)
virtualinherited

Create particles using findings from recent algorithm processing.

Parameters
protoParticleVectorthe proto particle vector
whetherparticles were created
void lar_content::ThreeDTransverseTracksAlgorithm::ExamineTensor ( )
privatevirtual

Examine contents of tensor, collect together best-matching 2D particles and modify clusters as required.

Implements lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >.

Definition at line 288 of file ThreeDTransverseTracksAlgorithm.cc.

References m_algorithmToolVector, m_nMaxTensorToolRepeats, and lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::m_overlapTensor.

289 {
290  unsigned int repeatCounter(0);
291 
292  for (TensorToolVector::const_iterator iter = m_algorithmToolVector.begin(), iterEnd = m_algorithmToolVector.end(); iter != iterEnd; )
293  {
294  if ((*iter)->Run(this, m_overlapTensor))
295  {
296  iter = m_algorithmToolVector.begin();
297 
298  if (++repeatCounter > m_nMaxTensorToolRepeats)
299  break;
300  }
301  else
302  {
303  ++iter;
304  }
305  }
306 }
TensorToolVector m_algorithmToolVector
The algorithm tool vector.
intermediate_table::const_iterator const_iterator
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
void lar_content::ThreeDTransverseTracksAlgorithm::GetBestOverlapResult ( const FitSegmentTensor fitSegmentTensor,
TransverseOverlapResult bestTransverseOverlapResult 
) const
private

Get the best overlap result, by examining the fit segment tensor.

Parameters
fitSegmentTensorthe fit segment tensor
bestTransverseOverlapResultto receive the best transverse overlap result

Definition at line 188 of file ThreeDTransverseTracksAlgorithm.cc.

References GetPreviousOverlapResults(), lar_content::TrackOverlapResult::IsInitialized(), m_maxFitSegmentIndex, max, and min.

Referenced by ThreeDTransverseTracksAlgorithm().

189 {
190  if (fitSegmentTensor.empty())
191  {
192  bestTransverseOverlapResult = TransverseOverlapResult();
193  return;
194  }
195 
196  unsigned int maxIndexU(0), maxIndexV(0), maxIndexW(0);
197  for (FitSegmentTensor::const_iterator tIter = fitSegmentTensor.begin(), tIterEnd = fitSegmentTensor.end(); tIter != tIterEnd; ++tIter)
198  {
199  maxIndexU = std::max(tIter->first, maxIndexU);
200 
201  for (FitSegmentMatrix::const_iterator mIter = tIter->second.begin(), mIterEnd = tIter->second.end(); mIter != mIterEnd; ++mIter)
202  {
203  maxIndexV = std::max(mIter->first, maxIndexV);
204 
205  for (FitSegmentToOverlapResultMap::const_iterator rIter = mIter->second.begin(), rIterEnd = mIter->second.end(); rIter != rIterEnd; ++rIter)
206  maxIndexW = std::max(rIter->first, maxIndexW);
207  }
208  }
209 
210  // ATTN Protect against longitudinal tracks winding back and forth; can cause large number of memory allocations
211  maxIndexU = std::min(m_maxFitSegmentIndex, maxIndexU);
212  maxIndexV = std::min(m_maxFitSegmentIndex, maxIndexV);
213  maxIndexW = std::min(m_maxFitSegmentIndex, maxIndexW);
214 
215  FitSegmentTensor fitSegmentSumTensor;
216  for (unsigned int indexU = 0; indexU <= maxIndexU; ++indexU)
217  {
218  for (unsigned int indexV = 0; indexV <= maxIndexV; ++indexV)
219  {
220  for (unsigned int indexW = 0; indexW <= maxIndexW; ++indexW)
221  {
222  TransverseOverlapResultVector transverseOverlapResultVector;
223  this->GetPreviousOverlapResults(indexU, indexV, indexW, fitSegmentSumTensor, transverseOverlapResultVector);
224 
225  TransverseOverlapResultVector::const_iterator maxElement = std::max_element(transverseOverlapResultVector.begin(), transverseOverlapResultVector.end());
226  TransverseOverlapResult maxTransverseOverlapResult((transverseOverlapResultVector.end() != maxElement) ? *maxElement : TransverseOverlapResult());
227 
228  TransverseOverlapResult thisOverlapResult;
229  if (fitSegmentTensor.count(indexU) && (fitSegmentTensor.find(indexU))->second.count(indexV) && ((fitSegmentTensor.find(indexU))->second.find(indexV))->second.count(indexW))
230  thisOverlapResult = (((fitSegmentTensor.find(indexU))->second.find(indexV))->second.find(indexW))->second;
231 
232  if (!thisOverlapResult.IsInitialized() && !maxTransverseOverlapResult.IsInitialized())
233  continue;
234 
235  fitSegmentSumTensor[indexU][indexV][indexW] = thisOverlapResult + maxTransverseOverlapResult;
236  }
237  }
238  }
239 
240  for (unsigned int indexU = 0; indexU <= maxIndexU; ++indexU)
241  {
242  for (unsigned int indexV = 0; indexV <= maxIndexV; ++indexV)
243  {
244  for (unsigned int indexW = 0; indexW <= maxIndexW; ++indexW)
245  {
246  const TransverseOverlapResult &transverseOverlapResult(fitSegmentSumTensor[indexU][indexV][indexW]);
247 
248  if (!transverseOverlapResult.IsInitialized())
249  continue;
250 
251  if (transverseOverlapResult > bestTransverseOverlapResult)
252  bestTransverseOverlapResult = transverseOverlapResult;
253  }
254  }
255  }
256 }
unsigned int m_maxFitSegmentIndex
The maximum number of fit segments used when identifying best overlap result.
std::vector< TransverseOverlapResult > TransverseOverlapResultVector
Int_t max
Definition: plot.C:27
intermediate_table::const_iterator const_iterator
Int_t min
Definition: plot.C:26
void GetPreviousOverlapResults(const unsigned int indexU, const unsigned int indexV, const unsigned int indexW, FitSegmentTensor &fitSegmentSumTensor, TransverseOverlapResultVector &transverseOverlapResultVector) const
Get track overlap results for possible connected segments.
std::map< unsigned int, FitSegmentMatrix > FitSegmentTensor
const TwoDSlidingFitResult& lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::GetCachedSlidingFitResult ( const pandora::Cluster *const  pCluster) const
inherited

Get a sliding fit result from the algorithm cache.

Parameters
pClusteraddress of the relevant cluster

Referenced by ThreeDTransverseTracksAlgorithm().

const std::string& lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::GetClusterListNameU ( ) const
inherited

Get the name of the u cluster list.

const std::string& lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::GetClusterListNameV ( ) const
inherited

Get the name of the v cluster list.

const std::string& lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::GetClusterListNameW ( ) const
inherited

Get the name of the w cluster list.

void lar_content::ThreeDTransverseTracksAlgorithm::GetFitSegmentTensor ( const TwoDSlidingFitResult slidingFitResultU,
const TwoDSlidingFitResult slidingFitResultV,
const TwoDSlidingFitResult slidingFitResultW,
FitSegmentTensor fitSegmentTensor 
) const
private

Get the number of matched points for three fit segments and accompanying sliding fit results.

Parameters
slidingFitResultUsliding fit result for u cluster
slidingFitResultVsliding fit result for v cluster
slidingFitResultWsliding fit result for w cluster
fitSegmentTensorthe fit segment tensor

Definition at line 84 of file ThreeDTransverseTracksAlgorithm.cc.

References lar_content::TwoDSlidingFitResult::GetFitSegmentList(), GetSegmentOverlap(), m_minSegmentMatchedFraction, and m_minSegmentMatchedPoints.

Referenced by ThreeDTransverseTracksAlgorithm().

86 {
87  FitSegmentList fitSegmentListU(slidingFitResultU.GetFitSegmentList());
88  FitSegmentList fitSegmentListV(slidingFitResultV.GetFitSegmentList());
89  FitSegmentList fitSegmentListW(slidingFitResultW.GetFitSegmentList());
90 
91  for (unsigned int indexU = 0, indexUEnd = fitSegmentListU.size(); indexU < indexUEnd; ++indexU)
92  {
93  const FitSegment &fitSegmentU(fitSegmentListU.at(indexU));
94 
95  for (unsigned int indexV = 0, indexVEnd = fitSegmentListV.size(); indexV < indexVEnd; ++indexV)
96  {
97  const FitSegment &fitSegmentV(fitSegmentListV.at(indexV));
98 
99  for (unsigned int indexW = 0, indexWEnd = fitSegmentListW.size(); indexW < indexWEnd; ++indexW)
100  {
101  const FitSegment &fitSegmentW(fitSegmentListW.at(indexW));
102 
103  TransverseOverlapResult segmentOverlap;
104  if (STATUS_CODE_SUCCESS != this->GetSegmentOverlap(fitSegmentU, fitSegmentV, fitSegmentW, slidingFitResultU, slidingFitResultV, slidingFitResultW, segmentOverlap))
105  continue;
106 
107  if ((segmentOverlap.GetMatchedFraction() < m_minSegmentMatchedFraction) || (segmentOverlap.GetNMatchedSamplingPoints() < m_minSegmentMatchedPoints))
108  continue;
109 
110  fitSegmentTensor[indexU][indexV][indexW] = segmentOverlap;
111  }
112  }
113  }
114 }
float m_minSegmentMatchedFraction
The minimum segment matched sampling fraction to allow segment grouping.
std::vector< FitSegment > FitSegmentList
pandora::StatusCode GetSegmentOverlap(const FitSegment &fitSegmentU, const FitSegment &fitSegmentV, const FitSegment &fitSegmentW, const TwoDSlidingFitResult &slidingFitResultU, const TwoDSlidingFitResult &slidingFitResultV, const TwoDSlidingFitResult &slidingFitResultW, TransverseOverlapResult &transverseOverlapResult) const
Get the overlap result for three fit segments and the accompanying sliding fit results.
unsigned int m_minSegmentMatchedPoints
The minimum number of matched segment sampling points to allow segment grouping.
const pandora::ClusterList& lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::GetInputClusterListU ( ) const
inherited

Get the input u cluster list.

const pandora::ClusterList& lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::GetInputClusterListV ( ) const
inherited

Get the input v cluster list.

const pandora::ClusterList& lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::GetInputClusterListW ( ) const
inherited

Get the input w cluster list.

void lar_content::ThreeDTransverseTracksAlgorithm::GetPreviousOverlapResults ( const unsigned int  indexU,
const unsigned int  indexV,
const unsigned int  indexW,
FitSegmentTensor fitSegmentSumTensor,
TransverseOverlapResultVector transverseOverlapResultVector 
) const
private

Get track overlap results for possible connected segments.

Parameters
indexUthe index u
indexVthe index v
indexWthe index w
transverseOverlapResultVectorthe transverse overlap result vector

Definition at line 260 of file ThreeDTransverseTracksAlgorithm.cc.

References lar_content::TrackOverlapResult::IsInitialized(), and x1.

Referenced by GetBestOverlapResult().

262 {
263  for (unsigned int iPermutation = 1; iPermutation < 8; ++iPermutation)
264  {
265  const bool decrementU((iPermutation >> 0) & 0x1);
266  const bool decrementV((iPermutation >> 1) & 0x1);
267  const bool decrementW((iPermutation >> 2) & 0x1);
268 
269  if ((decrementU && (0 == indexU)) || (decrementV && (0 == indexV)) || (decrementW && (0 == indexW)))
270  continue;
271 
272  const unsigned int newIndexU(decrementU ? indexU - 1 : indexU);
273  const unsigned int newIndexV(decrementV ? indexV - 1 : indexV);
274  const unsigned int newIndexW(decrementW ? indexW - 1 : indexW);
275 
276  const TransverseOverlapResult &transverseOverlapResult(fitSegmentSumTensor[newIndexU][newIndexV][newIndexW]);
277 
278  if (transverseOverlapResult.IsInitialized())
279  transverseOverlapResultVector.push_back(transverseOverlapResult);
280  }
281 
282  if (transverseOverlapResultVector.empty())
283  transverseOverlapResultVector.push_back(TransverseOverlapResult());
284 }
Float_t x1[n_points_granero]
Definition: compare.C:5
StatusCode lar_content::ThreeDTransverseTracksAlgorithm::GetSegmentOverlap ( const FitSegment fitSegmentU,
const FitSegment fitSegmentV,
const FitSegment fitSegmentW,
const TwoDSlidingFitResult slidingFitResultU,
const TwoDSlidingFitResult slidingFitResultV,
const TwoDSlidingFitResult slidingFitResultW,
TransverseOverlapResult transverseOverlapResult 
) const
private

Get the overlap result for three fit segments and the accompanying sliding fit results.

Parameters
fitSegmentUthe fit segment u
fitSegmentVthe fit segment v
fitSegmentWthe fit segment w
slidingFitResultUsliding fit result for u cluster
slidingFitResultVsliding fit result for v cluster
slidingFitResultWsliding fit result for w cluster
transverseOverlapResultto receive the transverse overlap result
Returns
statusCode, faster than throwing in regular use-cases

Definition at line 118 of file ThreeDTransverseTracksAlgorithm.cc.

References f, lar_content::FitSegment::GetEndLayer(), lar_content::FitSegment::GetMaxX(), lar_content::FitSegment::GetMinX(), lar_content::FitSegment::GetStartLayer(), lar_content::TwoDSlidingFitResult::GetTransverseProjection(), m_pseudoChi2Cut, max, lar_content::LArGeometryHelper::MergeTwoPositions(), min, n, w, and x.

Referenced by GetFitSegmentTensor().

121 {
122  // Assess x-overlap
123  const float xSpanU(fitSegmentU.GetMaxX() - fitSegmentU.GetMinX());
124  const float xSpanV(fitSegmentV.GetMaxX() - fitSegmentV.GetMinX());
125  const float xSpanW(fitSegmentW.GetMaxX() - fitSegmentW.GetMinX());
126 
127  const float minX(std::max(fitSegmentU.GetMinX(), std::max(fitSegmentV.GetMinX(), fitSegmentW.GetMinX())));
128  const float maxX(std::min(fitSegmentU.GetMaxX(), std::min(fitSegmentV.GetMaxX(), fitSegmentW.GetMaxX())));
129  const float xOverlap(maxX - minX);
130 
131  if (xOverlap < std::numeric_limits<float>::epsilon())
132  return STATUS_CODE_NOT_FOUND;
133 
134  // Sampling in x
135  const float nPointsU(std::fabs((xOverlap / xSpanU) * static_cast<float>(fitSegmentU.GetEndLayer() - fitSegmentU.GetStartLayer())));
136  const float nPointsV(std::fabs((xOverlap / xSpanV) * static_cast<float>(fitSegmentV.GetEndLayer() - fitSegmentV.GetStartLayer())));
137  const float nPointsW(std::fabs((xOverlap / xSpanW) * static_cast<float>(fitSegmentW.GetEndLayer() - fitSegmentW.GetStartLayer())));
138 
139  const unsigned int nPoints(1 + static_cast<unsigned int>((nPointsU + nPointsV + nPointsW) / 3.f));
140 
141  // Chi2 calculations
142  float pseudoChi2Sum(0.f);
143  unsigned int nSamplingPoints(0), nMatchedSamplingPoints(0);
144 
145  for (unsigned int n = 0; n <= nPoints; ++n)
146  {
147  const float x(minX + (maxX - minX) * static_cast<float>(n) / static_cast<float>(nPoints));
148 
149  CartesianVector fitUVector(0.f, 0.f, 0.f), fitVVector(0.f, 0.f, 0.f), fitWVector(0.f, 0.f, 0.f);
150  CartesianVector fitUDirection(0.f, 0.f, 0.f), fitVDirection(0.f, 0.f, 0.f), fitWDirection(0.f, 0.f, 0.f);
151 
152  if ((STATUS_CODE_SUCCESS != slidingFitResultU.GetTransverseProjection(x, fitSegmentU, fitUVector, fitUDirection)) ||
153  (STATUS_CODE_SUCCESS != slidingFitResultV.GetTransverseProjection(x, fitSegmentV, fitVVector, fitVDirection)) ||
154  (STATUS_CODE_SUCCESS != slidingFitResultW.GetTransverseProjection(x, fitSegmentW, fitWVector, fitWDirection)))
155  {
156  continue;
157  }
158 
159  const float u(fitUVector.GetZ()), v(fitVVector.GetZ()), w(fitWVector.GetZ());
160  const float uv2w(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_V, u, v));
161  const float uw2v(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_W, u, w));
162  const float vw2u(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_V, TPC_VIEW_W, v, w));
163 
164  ++nSamplingPoints;
165  const float deltaU((vw2u - u) * fitUDirection.GetX());
166  const float deltaV((uw2v - v) * fitVDirection.GetX());
167  const float deltaW((uv2w - w) * fitWDirection.GetX());
168 
169  const float pseudoChi2(deltaW * deltaW + deltaV * deltaV + deltaU * deltaU);
170  pseudoChi2Sum += pseudoChi2;
171 
172  if (pseudoChi2 < m_pseudoChi2Cut)
173  ++nMatchedSamplingPoints;
174  }
175 
176  if (0 == nSamplingPoints)
177  return STATUS_CODE_NOT_FOUND;
178 
179  const XOverlap xOverlapObject(fitSegmentU.GetMinX(), fitSegmentU.GetMaxX(), fitSegmentV.GetMinX(),
180  fitSegmentV.GetMaxX(), fitSegmentW.GetMinX(), fitSegmentW.GetMaxX(), xOverlap);
181 
182  transverseOverlapResult = TransverseOverlapResult(nMatchedSamplingPoints, nSamplingPoints, pseudoChi2Sum, xOverlapObject);
183  return STATUS_CODE_SUCCESS;
184 }
Float_t x
Definition: compare.C:6
float m_pseudoChi2Cut
The pseudo chi2 cut to identify matched sampling points.
TFile f
Definition: plotHisto.C:6
Int_t max
Definition: plot.C:27
static float MergeTwoPositions(const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const float position1, const float position2)
Merge two views (U,V) to give a third view (Z).
Int_t min
Definition: plot.C:26
Char_t n[5]
Float_t w
Definition: plot.C:23
const pandora::ClusterList& lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::GetSelectedClusterListU ( ) const
inherited

Get the selected u cluster list.

const pandora::ClusterList& lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::GetSelectedClusterListV ( ) const
inherited

Get the selected v cluster list.

const pandora::ClusterList& lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::GetSelectedClusterListW ( ) const
inherited

Get the selected w cluster list.

unsigned int lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::GetSlidingFitWindow ( ) const
inherited

Get the layer window for the sliding linear fits.

Returns
the layer window for the sliding linear fits
virtual bool lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::MakeClusterMerges ( const ClusterMergeMap clusterMergeMap)
virtualinherited

Merge clusters together.

Parameters
clusterMergeMapthe cluster merge map
Returns
whether changes to the tensor have been made
virtual bool lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::MakeClusterSplit ( const pandora::CartesianVector &  splitPosition,
const pandora::Cluster *&  pCurrentCluster,
const pandora::Cluster *&  pLowXCluster,
const pandora::Cluster *&  pHighXCluster 
) const
virtualinherited

Make a cluster split.

Parameters
splitPositionthe split position
pCurrentClusterthe cluster to split
pLowXClusterto receive the low x cluster
pHighXClusterto receive the high x cluster
Returns
whether a cluster split occurred
virtual bool lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::MakeClusterSplits ( const SplitPositionMap splitPositionMap)
virtualinherited

Make cluster splits.

Parameters
splitPositionMapthe split position map
Returns
whether changes to the tensor have been made
virtual void lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::PerformMainLoop ( )
protectedvirtualinherited

Main loop over cluster combinations in order to populate the tensor. Responsible for calling CalculateOverlapResult.

virtual void lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::PreparationStep ( )
protectedvirtualinherited

Perform any preparatory steps required, e.g. caching expensive fit results for clusters.

Reimplemented from lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >.

virtual void lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::PreparationStep ( pandora::ClusterList &  clusterList)
protectedvirtualinherited

Preparation step for a specific cluster list.

Parameters
clusterListthe cluster list
StatusCode lar_content::ThreeDTransverseTracksAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >.

Definition at line 311 of file ThreeDTransverseTracksAlgorithm.cc.

References m_algorithmToolVector, m_maxFitSegmentIndex, m_minOverallMatchedFraction, m_minOverallMatchedPoints, m_minSamplingPointsPerLayer, m_minSegmentMatchedFraction, m_minSegmentMatchedPoints, m_nMaxTensorToolRepeats, m_pseudoChi2Cut, and lar_content::ThreeDTracksBaseAlgorithm< T >::ReadSettings().

312 {
313  AlgorithmToolVector algorithmToolVector;
314  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmToolList(*this, xmlHandle,
315  "TrackTools", algorithmToolVector));
316 
317  for (AlgorithmToolVector::const_iterator iter = algorithmToolVector.begin(), iterEnd = algorithmToolVector.end(); iter != iterEnd; ++iter)
318  {
319  TransverseTensorTool *const pTransverseTensorTool(dynamic_cast<TransverseTensorTool*>(*iter));
320 
321  if (NULL == pTransverseTensorTool)
322  return STATUS_CODE_INVALID_PARAMETER;
323 
324  m_algorithmToolVector.push_back(pTransverseTensorTool);
325  }
326 
327  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
328  "NMaxTensorToolRepeats", m_nMaxTensorToolRepeats));
329 
330  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
331  "MaxFitSegmentIndex", m_maxFitSegmentIndex));
332 
333  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
334  "PseudoChi2Cut", m_pseudoChi2Cut));
335 
336  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
337  "MinSegmentMatchedFraction", m_minSegmentMatchedFraction));
338 
339  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
340  "MinSegmentMatchedPoints", m_minSegmentMatchedPoints));
341 
342  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
343  "MinOverallMatchedFraction", m_minOverallMatchedFraction));
344 
345  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
346  "MinOverallMatchedPoints", m_minOverallMatchedPoints));
347 
348  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
349  "MinSamplingPointsPerLayer", m_minSamplingPointsPerLayer));
350 
352 }
float m_minSegmentMatchedFraction
The minimum segment matched sampling fraction to allow segment grouping.
float m_pseudoChi2Cut
The pseudo chi2 cut to identify matched sampling points.
unsigned int m_maxFitSegmentIndex
The maximum number of fit segments used when identifying best overlap result.
unsigned int m_minOverallMatchedPoints
The minimum number of matched segment sampling points to allow particle creation. ...
TensorToolVector m_algorithmToolVector
The algorithm tool vector.
intermediate_table::const_iterator const_iterator
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_minOverallMatchedFraction
The minimum matched sampling fraction to allow particle creation.
float m_minSamplingPointsPerLayer
The minimum number of sampling points per layer to allow particle creation.
unsigned int m_minSegmentMatchedPoints
The minimum number of matched segment sampling points to allow segment grouping.
void lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::RemoveFromSlidingFitCache ( const pandora::Cluster *const  pCluster)
protectedinherited

Remova an existing sliding fit result, for the specified cluster, from the algorithm cache.

Parameters
pClusteraddress of the relevant cluster
virtual void lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::RemoveUnavailableTensorElements ( )
virtualinherited

Update tensor to remove all elements that have been added to pfos and so are unavailable.

virtual void lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::SelectAllInputClusters ( )
protectedvirtualinherited

Select a subset of input clusters for processing in this algorithm.

virtual void lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::SelectInputClusters ( const pandora::ClusterList *const  pInputClusterList,
pandora::ClusterList &  selectedClusterList 
) const
virtualinherited

Select a subset of input clusters for processing in this algorithm.

Parameters
pInputClusterListaddress of an input cluster list
selectedClusterListto receive the selected cluster list

Implements lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >.

virtual void lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::SetPfoParameters ( const ProtoParticle protoParticle,
PandoraContentApi::ParticleFlowObject::Parameters &  pfoParameters 
) const
virtualinherited

Calculate Pfo properties from proto particle.

Parameters
protoParticlethe input proto particle
pfoParametersthe output pfo parameters

Implements lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >.

static bool lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::SortSplitPositions ( const pandora::CartesianVector &  lhs,
const pandora::CartesianVector &  rhs 
)
staticinherited

Sort split position cartesian vectors by increasing x coordinate.

Parameters
lhsthe first cartesian vector
rhsthe second cartesian vector
virtual void lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::TidyUp ( )
protectedvirtualinherited

Tidy member variables in derived class.

Reimplemented from lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >.

virtual void lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::UpdateForNewCluster ( const pandora::Cluster *const  pNewCluster)
virtualinherited

Update to reflect addition of a new cluster to the problem space.

Parameters
pNewClusteraddress of the new cluster

Reimplemented from lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >.

virtual void lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::UpdateUponDeletion ( const pandora::Cluster *const  pDeletedCluster)
virtualinherited

Update to reflect cluster deletion.

Parameters
pDeletedClusteraddress of the deleted cluster

Reimplemented from lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >.

Member Data Documentation

TensorToolVector lar_content::ThreeDTransverseTracksAlgorithm::m_algorithmToolVector
private

The algorithm tool vector.

Definition at line 107 of file ThreeDTransverseTracksAlgorithm.h.

Referenced by ExamineTensor(), and ReadSettings().

pandora::ClusterList lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::m_clusterListU
protectedinherited

The selected modified cluster list U.

Definition at line 196 of file ThreeDBaseAlgorithm.h.

pandora::ClusterList lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::m_clusterListV
protectedinherited

The selected modified cluster list V.

Definition at line 197 of file ThreeDBaseAlgorithm.h.

pandora::ClusterList lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::m_clusterListW
protectedinherited

The selected modified cluster list W.

Definition at line 198 of file ThreeDBaseAlgorithm.h.

unsigned int lar_content::ThreeDTransverseTracksAlgorithm::m_maxFitSegmentIndex
private

The maximum number of fit segments used when identifying best overlap result.

Definition at line 110 of file ThreeDTransverseTracksAlgorithm.h.

Referenced by GetBestOverlapResult(), and ReadSettings().

unsigned int lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::m_minClusterCaloHits
protectedinherited

The min number of hits in base cluster selection method.

Definition at line 121 of file ThreeDTracksBaseAlgorithm.h.

float lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::m_minClusterLengthSquared
protectedinherited

The min length (squared) in base cluster selection method.

Definition at line 122 of file ThreeDTracksBaseAlgorithm.h.

float lar_content::ThreeDTransverseTracksAlgorithm::m_minOverallMatchedFraction
private

The minimum matched sampling fraction to allow particle creation.

Definition at line 114 of file ThreeDTransverseTracksAlgorithm.h.

Referenced by ReadSettings(), and ThreeDTransverseTracksAlgorithm().

unsigned int lar_content::ThreeDTransverseTracksAlgorithm::m_minOverallMatchedPoints
private

The minimum number of matched segment sampling points to allow particle creation.

Definition at line 115 of file ThreeDTransverseTracksAlgorithm.h.

Referenced by ReadSettings(), and ThreeDTransverseTracksAlgorithm().

float lar_content::ThreeDTransverseTracksAlgorithm::m_minSamplingPointsPerLayer
private

The minimum number of sampling points per layer to allow particle creation.

Definition at line 116 of file ThreeDTransverseTracksAlgorithm.h.

Referenced by ReadSettings(), and ThreeDTransverseTracksAlgorithm().

float lar_content::ThreeDTransverseTracksAlgorithm::m_minSegmentMatchedFraction
private

The minimum segment matched sampling fraction to allow segment grouping.

Definition at line 112 of file ThreeDTransverseTracksAlgorithm.h.

Referenced by GetFitSegmentTensor(), and ReadSettings().

unsigned int lar_content::ThreeDTransverseTracksAlgorithm::m_minSegmentMatchedPoints
private

The minimum number of matched segment sampling points to allow segment grouping.

Definition at line 113 of file ThreeDTransverseTracksAlgorithm.h.

Referenced by GetFitSegmentTensor(), and ReadSettings().

unsigned int lar_content::ThreeDTransverseTracksAlgorithm::m_nMaxTensorToolRepeats
private

The maximum number of repeat loops over tensor tools.

Definition at line 109 of file ThreeDTransverseTracksAlgorithm.h.

Referenced by ExamineTensor(), and ReadSettings().

The overlap tensor.

Definition at line 200 of file ThreeDBaseAlgorithm.h.

Referenced by ExamineTensor(), and ThreeDTransverseTracksAlgorithm().

const pandora::ClusterList* lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::m_pInputClusterListU
protectedinherited

Address of the input cluster list U.

Definition at line 192 of file ThreeDBaseAlgorithm.h.

const pandora::ClusterList* lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::m_pInputClusterListV
protectedinherited

Address of the input cluster list V.

Definition at line 193 of file ThreeDBaseAlgorithm.h.

const pandora::ClusterList* lar_content::ThreeDBaseAlgorithm< TransverseOverlapResult >::m_pInputClusterListW
protectedinherited

Address of the input cluster list W.

Definition at line 194 of file ThreeDBaseAlgorithm.h.

float lar_content::ThreeDTransverseTracksAlgorithm::m_pseudoChi2Cut
private

The pseudo chi2 cut to identify matched sampling points.

Definition at line 111 of file ThreeDTransverseTracksAlgorithm.h.

Referenced by GetSegmentOverlap(), and ReadSettings().

The sliding fit result map.

Definition at line 119 of file ThreeDTracksBaseAlgorithm.h.

unsigned int lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >::m_slidingFitWindow
protectedinherited

The layer window for the sliding linear fits.

Definition at line 118 of file ThreeDTracksBaseAlgorithm.h.


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