Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
lar_content::ThreeViewTransverseTracksAlgorithm Class Reference

ThreeViewTransverseTracksAlgorithm class. More...

#include <ThreeViewTransverseTracksAlgorithm.h>

Inheritance diagram for lar_content::ThreeViewTransverseTracksAlgorithm:
lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > > lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > > lar_content::MatchingBaseAlgorithm

Public Types

typedef NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > > BaseAlgorithm
 
- Public Types inherited from lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >
typedef ThreeViewMatchingControl< TransverseOverlapResultMatchingType
 

Public Member Functions

 ThreeViewTransverseTracksAlgorithm ()
 Default constructor. More...
 
- Public Member Functions inherited from lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >
 NViewTrackMatchingAlgorithm ()
 Default constructor. More...
 
virtual ~NViewTrackMatchingAlgorithm ()
 Destructor. 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 PrepareInputClusters (pandora::ClusterList &preparedClusterList)
 Perform any preparatory steps required on the input clusters, e.g. caching expensive fit results. More...
 
virtual void SetPfoParticleId (PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
 Set pfo particle id. More...
 
- Public Member Functions inherited from lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >
 NViewMatchingAlgorithm ()
 Default constructor. More...
 
virtual ~NViewMatchingAlgorithm ()
 Destructor. More...
 
const std::stringGetClusterListName (const pandora::HitType hitType) const
 Get the cluster list name corresponding to a specified hit type. More...
 
const pandora::ClusterList & GetInputClusterList (const pandora::HitType hitType) const
 Get the input cluster list corresponding to a specified hit type. More...
 
const pandora::ClusterList & GetSelectedClusterList (const pandora::HitType hitType) const
 Get the selected cluster list corresponding to a specified hit type. More...
 
- Public Member Functions inherited from lar_content::MatchingBaseAlgorithm
 MatchingBaseAlgorithm ()
 Default constructor. More...
 
virtual ~MatchingBaseAlgorithm ()
 Destructor. More...
 
virtual bool MakeClusterMerges (const ClusterMergeMap &clusterMergeMap)
 Merge clusters together. More...
 
virtual bool CreateThreeDParticles (const ProtoParticleVector &protoParticleVector)
 Create particles using findings from recent algorithm processing. More...
 
virtual void SetPfoParameters (const ProtoParticle &protoParticle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
 Set Pfo properties. 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 container. 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 ExamineOverlapContainer ()
 Examine contents of overlap container, 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >
static bool SortSplitPositions (const pandora::CartesianVector &lhs, const pandora::CartesianVector &rhs)
 Sort split position cartesian vectors by increasing x coordinate. More...
 
- Protected Member Functions inherited from lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >
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 TidyUp ()
 Tidy member variables in derived class. More...
 
- Protected Member Functions inherited from lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >
MatchingTypeGetMatchingControl ()
 Get the matching control. More...
 
virtual void SelectAllInputClusters ()
 Select a subset of input clusters for processing in this algorithm. More...
 
virtual void PrepareAllInputClusters ()
 Perform any preparatory steps required, e.g. caching expensive fit results for clusters. More...
 
virtual void PerformMainLoop ()
 Main loop over cluster combinations in order to populate the overlap container. Responsible for calling CalculateOverlapResult. More...
 
- Protected Attributes inherited from lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >
MatchingType m_matchingControl
 The matching control. More...
 

Detailed Description

ThreeViewTransverseTracksAlgorithm class.

Definition at line 29 of file ThreeViewTransverseTracksAlgorithm.h.

Member Typedef Documentation

Definition at line 32 of file ThreeViewTransverseTracksAlgorithm.h.

Definition at line 41 of file ThreeViewTransverseTracksAlgorithm.h.

Definition at line 42 of file ThreeViewTransverseTracksAlgorithm.h.

Definition at line 40 of file ThreeViewTransverseTracksAlgorithm.h.

Definition at line 109 of file ThreeViewTransverseTracksAlgorithm.h.

Constructor & Destructor Documentation

lar_content::ThreeViewTransverseTracksAlgorithm::ThreeViewTransverseTracksAlgorithm ( )

Default constructor.

Definition at line 21 of file ThreeViewTransverseTracksAlgorithm.cc.

21  :
24  m_pseudoChi2Cut(3.f),
30 {
31 }
float m_minSegmentMatchedFraction
The minimum segment matched sampling fraction to allow segment grouping.
float m_minOverallMatchedFraction
The minimum matched sampling fraction to allow particle creation.
float m_pseudoChi2Cut
The pseudo chi2 cut to identify matched sampling points.
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.
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. ...
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.

Member Function Documentation

void lar_content::ThreeViewTransverseTracksAlgorithm::CalculateOverlapResult ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2,
const pandora::Cluster *const  pCluster3 
)
privatevirtual

Calculate cluster overlap result and store in container.

Parameters
pCluster1address of cluster1
pCluster2address of cluster2
pCluster3address of cluster3

Implements lar_content::MatchingBaseAlgorithm.

pandora::StatusCode lar_content::ThreeViewTransverseTracksAlgorithm::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
void lar_content::ThreeViewTransverseTracksAlgorithm::ExamineOverlapContainer ( )
privatevirtual

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

Implements lar_content::MatchingBaseAlgorithm.

Definition at line 297 of file ThreeViewTransverseTracksAlgorithm.cc.

298 {
299  unsigned int repeatCounter(0);
300 
301  for (TensorToolVector::const_iterator iter = m_algorithmToolVector.begin(), iterEnd = m_algorithmToolVector.end(); iter != iterEnd;)
302  {
303  if ((*iter)->Run(this, this->GetMatchingControl().GetOverlapTensor()))
304  {
305  iter = m_algorithmToolVector.begin();
306 
307  if (++repeatCounter > m_nMaxTensorToolRepeats)
308  break;
309  }
310  else
311  {
312  ++iter;
313  }
314  }
315 }
intermediate_table::const_iterator const_iterator
TensorToolVector m_algorithmToolVector
The algorithm tool vector.
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
void lar_content::ThreeViewTransverseTracksAlgorithm::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 193 of file ThreeViewTransverseTracksAlgorithm.cc.

195 {
196  if (fitSegmentTensor.empty())
197  {
198  bestTransverseOverlapResult = TransverseOverlapResult();
199  return;
200  }
201 
202  unsigned int maxIndexU(0), maxIndexV(0), maxIndexW(0);
203  for (FitSegmentTensor::const_iterator tIter = fitSegmentTensor.begin(), tIterEnd = fitSegmentTensor.end(); tIter != tIterEnd; ++tIter)
204  {
205  maxIndexU = std::max(tIter->first, maxIndexU);
206 
207  for (FitSegmentMatrix::const_iterator mIter = tIter->second.begin(), mIterEnd = tIter->second.end(); mIter != mIterEnd; ++mIter)
208  {
209  maxIndexV = std::max(mIter->first, maxIndexV);
210 
211  for (FitSegmentToOverlapResultMap::const_iterator rIter = mIter->second.begin(), rIterEnd = mIter->second.end(); rIter != rIterEnd; ++rIter)
212  maxIndexW = std::max(rIter->first, maxIndexW);
213  }
214  }
215 
216  // ATTN Protect against longitudinal tracks winding back and forth; can cause large number of memory allocations
217  maxIndexU = std::min(m_maxFitSegmentIndex, maxIndexU);
218  maxIndexV = std::min(m_maxFitSegmentIndex, maxIndexV);
219  maxIndexW = std::min(m_maxFitSegmentIndex, maxIndexW);
220 
221  FitSegmentTensor fitSegmentSumTensor;
222  for (unsigned int indexU = 0; indexU <= maxIndexU; ++indexU)
223  {
224  for (unsigned int indexV = 0; indexV <= maxIndexV; ++indexV)
225  {
226  for (unsigned int indexW = 0; indexW <= maxIndexW; ++indexW)
227  {
228  TransverseOverlapResultVector transverseOverlapResultVector;
229  this->GetPreviousOverlapResults(indexU, indexV, indexW, fitSegmentSumTensor, transverseOverlapResultVector);
230 
232  std::max_element(transverseOverlapResultVector.begin(), transverseOverlapResultVector.end());
233  TransverseOverlapResult maxTransverseOverlapResult(
234  (transverseOverlapResultVector.end() != maxElement) ? *maxElement : TransverseOverlapResult());
235 
236  TransverseOverlapResult thisOverlapResult;
237  if (fitSegmentTensor.count(indexU) && (fitSegmentTensor.find(indexU))->second.count(indexV) &&
238  ((fitSegmentTensor.find(indexU))->second.find(indexV))->second.count(indexW))
239  thisOverlapResult = (((fitSegmentTensor.find(indexU))->second.find(indexV))->second.find(indexW))->second;
240 
241  if (!thisOverlapResult.IsInitialized() && !maxTransverseOverlapResult.IsInitialized())
242  continue;
243 
244  fitSegmentSumTensor[indexU][indexV][indexW] = thisOverlapResult + maxTransverseOverlapResult;
245  }
246  }
247  }
248 
249  for (unsigned int indexU = 0; indexU <= maxIndexU; ++indexU)
250  {
251  for (unsigned int indexV = 0; indexV <= maxIndexV; ++indexV)
252  {
253  for (unsigned int indexW = 0; indexW <= maxIndexW; ++indexW)
254  {
255  const TransverseOverlapResult &transverseOverlapResult(fitSegmentSumTensor[indexU][indexV][indexW]);
256 
257  if (!transverseOverlapResult.IsInitialized())
258  continue;
259 
260  if (transverseOverlapResult > bestTransverseOverlapResult)
261  bestTransverseOverlapResult = transverseOverlapResult;
262  }
263  }
264  }
265 }
std::map< unsigned int, FitSegmentMatrix > FitSegmentTensor
intermediate_table::const_iterator const_iterator
std::vector< TransverseOverlapResult > TransverseOverlapResultVector
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.
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
unsigned int m_maxFitSegmentIndex
The maximum number of fit segments used when identifying best overlap result.
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:85
void lar_content::ThreeViewTransverseTracksAlgorithm::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 87 of file ThreeViewTransverseTracksAlgorithm.cc.

89 {
90  FitSegmentList fitSegmentListU(slidingFitResultU.GetFitSegmentList());
91  FitSegmentList fitSegmentListV(slidingFitResultV.GetFitSegmentList());
92  FitSegmentList fitSegmentListW(slidingFitResultW.GetFitSegmentList());
93 
94  for (unsigned int indexU = 0, indexUEnd = fitSegmentListU.size(); indexU < indexUEnd; ++indexU)
95  {
96  const FitSegment &fitSegmentU(fitSegmentListU.at(indexU));
97 
98  for (unsigned int indexV = 0, indexVEnd = fitSegmentListV.size(); indexV < indexVEnd; ++indexV)
99  {
100  const FitSegment &fitSegmentV(fitSegmentListV.at(indexV));
101 
102  for (unsigned int indexW = 0, indexWEnd = fitSegmentListW.size(); indexW < indexWEnd; ++indexW)
103  {
104  const FitSegment &fitSegmentW(fitSegmentListW.at(indexW));
105 
106  TransverseOverlapResult segmentOverlap;
107  if (STATUS_CODE_SUCCESS != this->GetSegmentOverlap(fitSegmentU, fitSegmentV, fitSegmentW, slidingFitResultU,
108  slidingFitResultV, slidingFitResultW, segmentOverlap))
109  continue;
110 
111  if ((segmentOverlap.GetMatchedFraction() < m_minSegmentMatchedFraction) ||
112  (segmentOverlap.GetNMatchedSamplingPoints() < m_minSegmentMatchedPoints))
113  continue;
114 
115  fitSegmentTensor[indexU][indexV][indexW] = segmentOverlap;
116  }
117  }
118  }
119 }
float m_minSegmentMatchedFraction
The minimum segment matched sampling fraction to allow segment grouping.
std::vector< FitSegment > FitSegmentList
unsigned int m_minSegmentMatchedPoints
The minimum number of matched segment sampling points to allow segment grouping.
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.
void lar_content::ThreeViewTransverseTracksAlgorithm::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 269 of file ThreeViewTransverseTracksAlgorithm.cc.

271 {
272  for (unsigned int iPermutation = 1; iPermutation < 8; ++iPermutation)
273  {
274  const bool decrementU((iPermutation >> 0) & 0x1);
275  const bool decrementV((iPermutation >> 1) & 0x1);
276  const bool decrementW((iPermutation >> 2) & 0x1);
277 
278  if ((decrementU && (0 == indexU)) || (decrementV && (0 == indexV)) || (decrementW && (0 == indexW)))
279  continue;
280 
281  const unsigned int newIndexU(decrementU ? indexU - 1 : indexU);
282  const unsigned int newIndexV(decrementV ? indexV - 1 : indexV);
283  const unsigned int newIndexW(decrementW ? indexW - 1 : indexW);
284 
285  const TransverseOverlapResult &transverseOverlapResult(fitSegmentSumTensor[newIndexU][newIndexV][newIndexW]);
286 
287  if (transverseOverlapResult.IsInitialized())
288  transverseOverlapResultVector.push_back(transverseOverlapResult);
289  }
290 
291  if (transverseOverlapResultVector.empty())
292  transverseOverlapResultVector.push_back(TransverseOverlapResult());
293 }
StatusCode lar_content::ThreeViewTransverseTracksAlgorithm::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 123 of file ThreeViewTransverseTracksAlgorithm.cc.

126 {
127  // Assess x-overlap
128  const float xSpanU(fitSegmentU.GetMaxX() - fitSegmentU.GetMinX());
129  const float xSpanV(fitSegmentV.GetMaxX() - fitSegmentV.GetMinX());
130  const float xSpanW(fitSegmentW.GetMaxX() - fitSegmentW.GetMinX());
131 
132  const float minX(std::max(fitSegmentU.GetMinX(), std::max(fitSegmentV.GetMinX(), fitSegmentW.GetMinX())));
133  const float maxX(std::min(fitSegmentU.GetMaxX(), std::min(fitSegmentV.GetMaxX(), fitSegmentW.GetMaxX())));
134  const float xOverlap(maxX - minX);
135 
136  if (xOverlap < std::numeric_limits<float>::epsilon())
137  return STATUS_CODE_NOT_FOUND;
138 
139  // Sampling in x
140  const float nPointsU(std::fabs((xOverlap / xSpanU) * static_cast<float>(fitSegmentU.GetEndLayer() - fitSegmentU.GetStartLayer())));
141  const float nPointsV(std::fabs((xOverlap / xSpanV) * static_cast<float>(fitSegmentV.GetEndLayer() - fitSegmentV.GetStartLayer())));
142  const float nPointsW(std::fabs((xOverlap / xSpanW) * static_cast<float>(fitSegmentW.GetEndLayer() - fitSegmentW.GetStartLayer())));
143 
144  const unsigned int nPoints(1 + static_cast<unsigned int>((nPointsU + nPointsV + nPointsW) / 3.f));
145 
146  // Chi2 calculations
147  float pseudoChi2Sum(0.f);
148  unsigned int nSamplingPoints(0), nMatchedSamplingPoints(0);
149 
150  for (unsigned int n = 0; n <= nPoints; ++n)
151  {
152  const float x(minX + (maxX - minX) * static_cast<float>(n) / static_cast<float>(nPoints));
153 
154  CartesianVector fitUVector(0.f, 0.f, 0.f), fitVVector(0.f, 0.f, 0.f), fitWVector(0.f, 0.f, 0.f);
155  CartesianVector fitUDirection(0.f, 0.f, 0.f), fitVDirection(0.f, 0.f, 0.f), fitWDirection(0.f, 0.f, 0.f);
156 
157  if ((STATUS_CODE_SUCCESS != slidingFitResultU.GetTransverseProjection(x, fitSegmentU, fitUVector, fitUDirection)) ||
158  (STATUS_CODE_SUCCESS != slidingFitResultV.GetTransverseProjection(x, fitSegmentV, fitVVector, fitVDirection)) ||
159  (STATUS_CODE_SUCCESS != slidingFitResultW.GetTransverseProjection(x, fitSegmentW, fitWVector, fitWDirection)))
160  {
161  continue;
162  }
163 
164  const float u(fitUVector.GetZ()), v(fitVVector.GetZ()), w(fitWVector.GetZ());
165  const float uv2w(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_V, u, v));
166  const float uw2v(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_W, u, w));
167  const float vw2u(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_V, TPC_VIEW_W, v, w));
168 
169  ++nSamplingPoints;
170  const float deltaU((vw2u - u) * fitUDirection.GetX());
171  const float deltaV((uw2v - v) * fitVDirection.GetX());
172  const float deltaW((uv2w - w) * fitWDirection.GetX());
173 
174  const float pseudoChi2(deltaW * deltaW + deltaV * deltaV + deltaU * deltaU);
175  pseudoChi2Sum += pseudoChi2;
176 
177  if (pseudoChi2 < m_pseudoChi2Cut)
178  ++nMatchedSamplingPoints;
179  }
180 
181  if (0 == nSamplingPoints)
182  return STATUS_CODE_NOT_FOUND;
183 
184  const XOverlap xOverlapObject(fitSegmentU.GetMinX(), fitSegmentU.GetMaxX(), fitSegmentV.GetMinX(), fitSegmentV.GetMaxX(),
185  fitSegmentW.GetMinX(), fitSegmentW.GetMaxX(), xOverlap);
186 
187  transverseOverlapResult = TransverseOverlapResult(nMatchedSamplingPoints, nSamplingPoints, pseudoChi2Sum, xOverlapObject);
188  return STATUS_CODE_SUCCESS;
189 }
float m_pseudoChi2Cut
The pseudo chi2 cut to identify matched sampling points.
std::void_t< T > n
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).
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
list x
Definition: train.py:276
StatusCode lar_content::ThreeViewTransverseTracksAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >.

Definition at line 320 of file ThreeViewTransverseTracksAlgorithm.cc.

321 {
322  AlgorithmToolVector algorithmToolVector;
323  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmToolList(*this, xmlHandle, "TrackTools", algorithmToolVector));
324 
325  for (AlgorithmToolVector::const_iterator iter = algorithmToolVector.begin(), iterEnd = algorithmToolVector.end(); iter != iterEnd; ++iter)
326  {
327  TransverseTensorTool *const pTransverseTensorTool(dynamic_cast<TransverseTensorTool *>(*iter));
328 
329  if (!pTransverseTensorTool)
330  return STATUS_CODE_INVALID_PARAMETER;
331 
332  m_algorithmToolVector.push_back(pTransverseTensorTool);
333  }
334 
335  PANDORA_RETURN_RESULT_IF_AND_IF(
336  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "NMaxTensorToolRepeats", m_nMaxTensorToolRepeats));
337 
338  PANDORA_RETURN_RESULT_IF_AND_IF(
339  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxFitSegmentIndex", m_maxFitSegmentIndex));
340 
341  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PseudoChi2Cut", m_pseudoChi2Cut));
342 
343  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
344  XmlHelper::ReadValue(xmlHandle, "MinSegmentMatchedFraction", m_minSegmentMatchedFraction));
345 
346  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
347  XmlHelper::ReadValue(xmlHandle, "MinSegmentMatchedPoints", m_minSegmentMatchedPoints));
348 
349  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
350  XmlHelper::ReadValue(xmlHandle, "MinOverallMatchedFraction", m_minOverallMatchedFraction));
351 
352  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
353  XmlHelper::ReadValue(xmlHandle, "MinOverallMatchedPoints", m_minOverallMatchedPoints));
354 
355  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
356  XmlHelper::ReadValue(xmlHandle, "MinSamplingPointsPerLayer", m_minSamplingPointsPerLayer));
357 
358  return BaseAlgorithm::ReadSettings(xmlHandle);
359 }
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_minSegmentMatchedFraction
The minimum segment matched sampling fraction to allow segment grouping.
float m_minOverallMatchedFraction
The minimum matched sampling fraction to allow particle creation.
intermediate_table::const_iterator const_iterator
float m_pseudoChi2Cut
The pseudo chi2 cut to identify matched sampling points.
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.
TensorToolVector m_algorithmToolVector
The algorithm tool vector.
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. ...
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.

Member Data Documentation

TensorToolVector lar_content::ThreeViewTransverseTracksAlgorithm::m_algorithmToolVector
private

The algorithm tool vector.

Definition at line 110 of file ThreeViewTransverseTracksAlgorithm.h.

unsigned int lar_content::ThreeViewTransverseTracksAlgorithm::m_maxFitSegmentIndex
private

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

Definition at line 113 of file ThreeViewTransverseTracksAlgorithm.h.

float lar_content::ThreeViewTransverseTracksAlgorithm::m_minOverallMatchedFraction
private

The minimum matched sampling fraction to allow particle creation.

Definition at line 117 of file ThreeViewTransverseTracksAlgorithm.h.

unsigned int lar_content::ThreeViewTransverseTracksAlgorithm::m_minOverallMatchedPoints
private

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

Definition at line 118 of file ThreeViewTransverseTracksAlgorithm.h.

float lar_content::ThreeViewTransverseTracksAlgorithm::m_minSamplingPointsPerLayer
private

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

Definition at line 119 of file ThreeViewTransverseTracksAlgorithm.h.

float lar_content::ThreeViewTransverseTracksAlgorithm::m_minSegmentMatchedFraction
private

The minimum segment matched sampling fraction to allow segment grouping.

Definition at line 115 of file ThreeViewTransverseTracksAlgorithm.h.

unsigned int lar_content::ThreeViewTransverseTracksAlgorithm::m_minSegmentMatchedPoints
private

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

Definition at line 116 of file ThreeViewTransverseTracksAlgorithm.h.

unsigned int lar_content::ThreeViewTransverseTracksAlgorithm::m_nMaxTensorToolRepeats
private

The maximum number of repeat loops over tensor tools.

Definition at line 112 of file ThreeViewTransverseTracksAlgorithm.h.

float lar_content::ThreeViewTransverseTracksAlgorithm::m_pseudoChi2Cut
private

The pseudo chi2 cut to identify matched sampling points.

Definition at line 114 of file ThreeViewTransverseTracksAlgorithm.h.


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