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

ThreeDSlidingConeFitResult class. More...

#include <LArThreeDSlidingConeFitResult.h>

Public Member Functions

template<typename T >
 ThreeDSlidingConeFitResult (const T *const pT, const unsigned int slidingFitWindow, const float slidingFitLayerPitch)
 Constructor. More...
 
const ThreeDSlidingFitResultGetSlidingFitResult () const
 Get the sliding fit result for the full cluster. More...
 
const TrackStateMapGetTrackStateMap () const
 Get the track state map, which caches results from the sliding fit result. More...
 
void GetSimpleConeList (const unsigned int nLayersForConeFit, const unsigned int nCones, const ConeSelection coneSelection, SimpleConeList &simpleConeList) const
 Get the list of simple cones fitted to the three dimensional cluster. More...
 

Private Types

typedef std::list< pandora::TrackState > TrackStateLinkedList
 The track state linked list typedef. More...
 

Private Attributes

const ThreeDSlidingFitResult m_slidingFitResult
 The sliding fit result for the full cluster. More...
 
TrackStateMap m_trackStateMap
 The track state map. More...
 

Detailed Description

ThreeDSlidingConeFitResult class.

Definition at line 122 of file LArThreeDSlidingConeFitResult.h.

Member Typedef Documentation

typedef std::list<pandora::TrackState> lar_content::ThreeDSlidingConeFitResult::TrackStateLinkedList
private

The track state linked list typedef.

Definition at line 161 of file LArThreeDSlidingConeFitResult.h.

Constructor & Destructor Documentation

template<typename T >
template lar_content::ThreeDSlidingConeFitResult::ThreeDSlidingConeFitResult ( const T *const  pT,
const unsigned int  slidingFitWindow,
const float  slidingFitLayerPitch 
)

Constructor.

Parameters
pTdescribing the positions to be fitted
slidingFitWindowthe sliding fit window
slidingFitLayerPitchthe sliding fit pitch, units cm

Definition at line 71 of file LArThreeDSlidingConeFitResult.cc.

71  :
72  m_slidingFitResult(ThreeDSlidingFitResult(pT, slidingFitWindow, slidingFitLayerPitch))
73 {
74  const CartesianVector &minLayerPosition3D(m_slidingFitResult.GetGlobalMinLayerPosition());
75  const CartesianVector &maxLayerPosition3D(m_slidingFitResult.GetGlobalMaxLayerPosition());
76 
77  const TwoDSlidingFitResult &fitResult1(m_slidingFitResult.GetFirstFitResult());
78  const TwoDSlidingFitResult &fitResult2(m_slidingFitResult.GetSecondFitResult());
79 
80  const LayerFitContributionMap &contributionMap1(fitResult1.GetLayerFitContributionMap());
81  const LayerFitContributionMap &contributionMap2(fitResult2.GetLayerFitContributionMap());
82 
83  const int nSteps(static_cast<int>((maxLayerPosition3D - minLayerPosition3D).GetMagnitude() / slidingFitLayerPitch));
84 
85  for (int iStep = 0; iStep <= nSteps; ++iStep)
86  {
87  try
88  {
89  const float rL((static_cast<float>(iStep) + 0.5f) * slidingFitLayerPitch);
90  CartesianVector fitPosition3D(0.f, 0.f, 0.f), fitDirection3D(0.f, 0.f, 0.f);
91 
92  if ((STATUS_CODE_SUCCESS != m_slidingFitResult.GetGlobalFitPosition(rL, fitPosition3D)) ||
93  (STATUS_CODE_SUCCESS != m_slidingFitResult.GetGlobalFitDirection(rL, fitDirection3D)))
94  {
95  continue;
96  }
97 
98  // ATTN Do not include layers without contributions in track state map (contain only interpolations)
99  if (!contributionMap1.count(fitResult1.GetLayer(rL)) && !contributionMap2.count(fitResult2.GetLayer(rL)))
100  continue;
101 
102  (void)m_trackStateMap.insert(TrackStateMap::value_type(iStep, TrackState(fitPosition3D, fitDirection3D)));
103  }
104  catch (const StatusCodeException &)
105  {
106  /* Deliberately empty */
107  }
108  }
109 }
const ThreeDSlidingFitResult m_slidingFitResult
The sliding fit result for the full cluster.
const TwoDSlidingFitResult & GetSecondFitResult() const
Get the second sliding fit result for this cluster.
std::map< int, LayerFitContribution > LayerFitContributionMap
pandora::StatusCode GetGlobalFitDirection(const float rL, pandora::CartesianVector &direction) const
Get global fit direction for a given longitudinal coordinate.
const pandora::CartesianVector & GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
const TwoDSlidingFitResult & GetFirstFitResult() const
Get the first sliding fit result for this cluster.
pandora::StatusCode GetGlobalFitPosition(const float rL, pandora::CartesianVector &position) const
Get global fit position for a given longitudinal coordinate.
TrackStateMap m_trackStateMap
The track state map.
const pandora::CartesianVector & GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.

Member Function Documentation

void lar_content::ThreeDSlidingConeFitResult::GetSimpleConeList ( const unsigned int  nLayersForConeFit,
const unsigned int  nCones,
const ConeSelection  coneSelection,
SimpleConeList simpleConeList 
) const

Get the list of simple cones fitted to the three dimensional cluster.

Parameters
nLayersForConeFitthe number of layer to use to extract the cone direction
nConesthe number of cones to extract from the cluster (spaced uniformly along the cluster)
coneSelectionwhether to receive forwards or backwards (or both) cones
simpleConeListto receive the simple cone list

Definition at line 113 of file LArThreeDSlidingConeFitResult.cc.

115 {
116  const TrackStateMap &trackStateMap(this->GetTrackStateMap());
117  const unsigned int nLayers(trackStateMap.size());
118 
119  if (nLayers + 1 < nLayersForConeFit + nCones)
120  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
121 
122  // Calculate intervals and offsets such that cones are evenly spaced along sliding fit and are equidistant from the extremal layers
123  const unsigned int coneInterval((nCones > 1) ? (nLayers - nLayersForConeFit) / (nCones - 1) : 1);
124  const ThreeDSlidingFitResult &slidingFitResult(this->GetSlidingFitResult());
125  const CartesianVector coneDisplacement(slidingFitResult.GetGlobalMaxLayerPosition() - slidingFitResult.GetGlobalMinLayerPosition());
126  const bool isForward(coneDisplacement.GetZ() > std::numeric_limits<float>::epsilon());
127  const unsigned int coneOffset1((nLayers - nLayersForConeFit - (nCones - 1) * coneInterval) / 2);
128  const unsigned int coneOffset2((1 == nLayers % 2) && isForward ? 1 : 0);
129  const unsigned int coneOffset(coneOffset1 + coneOffset2);
130 
131  TrackStateLinkedList trackStateList;
132  CartesianVector directionSum(0.f, 0.f, 0.f);
133  const float clusterLength((trackStateMap.begin()->second.GetPosition() - trackStateMap.rbegin()->second.GetPosition()).GetMagnitude());
134 
135  unsigned int nConeSamplingSteps(0);
136 
137  for (TrackStateMap::const_iterator iter = trackStateMap.begin(), iterEnd = trackStateMap.end(); iter != iterEnd; ++iter)
138  {
139  if (nConeSamplingSteps >= nCones)
140  return;
141 
142  trackStateList.push_back(iter->second);
143  directionSum += iter->second.GetMomentum();
144 
145  const unsigned int beginDistance(static_cast<unsigned int>(std::distance(trackStateMap.begin(), iter)));
146 
147  if (beginDistance + 1 < nLayersForConeFit)
148  continue;
149 
150  const TrackState &maxLayerTrackState(trackStateList.back());
151  const TrackState &minLayerTrackState(trackStateList.front());
152 
153  if ((beginDistance + 1 >= nLayersForConeFit + coneOffset) && (beginDistance + 1 - nLayersForConeFit - coneOffset) % coneInterval == 0)
154  {
155  const CartesianVector &minLayerApex(minLayerTrackState.GetPosition());
156  const CartesianVector &maxLayerApex(maxLayerTrackState.GetPosition());
157 
158  const CartesianVector minLayerDirection(directionSum.GetUnitVector());
159  const CartesianVector maxLayerDirection(directionSum.GetUnitVector() * -1.f);
160 
161  // TODO Estimate cone length and angle here too, maybe by projecting positions onto direction and looking at rT distribution?
162  ++nConeSamplingSteps;
163  const float placeHolderTanHalfAngle(0.5f);
164 
165  if ((CONE_FORWARD_ONLY == coneSelection) || (CONE_BOTH_DIRECTIONS == coneSelection))
166  simpleConeList.push_back(SimpleCone(minLayerApex, minLayerDirection, clusterLength, placeHolderTanHalfAngle));
167 
168  if ((CONE_BACKWARD_ONLY == coneSelection) || (CONE_BOTH_DIRECTIONS == coneSelection))
169  simpleConeList.push_back(SimpleCone(maxLayerApex, maxLayerDirection, clusterLength, placeHolderTanHalfAngle));
170  }
171 
172  directionSum -= minLayerTrackState.GetMomentum();
173  trackStateList.pop_front();
174  }
175 }
intermediate_table::const_iterator const_iterator
const ThreeDSlidingFitResult & GetSlidingFitResult() const
Get the sliding fit result for the full cluster.
std::list< pandora::TrackState > TrackStateLinkedList
The track state linked list typedef.
std::map< int, pandora::TrackState > TrackStateMap
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
const TrackStateMap & GetTrackStateMap() const
Get the track state map, which caches results from the sliding fit result.
const ThreeDSlidingFitResult & lar_content::ThreeDSlidingConeFitResult::GetSlidingFitResult ( ) const
inline

Get the sliding fit result for the full cluster.

Returns
the sliding fit result for the full cluster

Definition at line 220 of file LArThreeDSlidingConeFitResult.h.

221 {
222  return m_slidingFitResult;
223 }
const ThreeDSlidingFitResult m_slidingFitResult
The sliding fit result for the full cluster.
const TrackStateMap & lar_content::ThreeDSlidingConeFitResult::GetTrackStateMap ( ) const
inline

Get the track state map, which caches results from the sliding fit result.

Returns
the track state map

Definition at line 227 of file LArThreeDSlidingConeFitResult.h.

228 {
229  return m_trackStateMap;
230 }
TrackStateMap m_trackStateMap
The track state map.

Member Data Documentation

const ThreeDSlidingFitResult lar_content::ThreeDSlidingConeFitResult::m_slidingFitResult
private

The sliding fit result for the full cluster.

Definition at line 163 of file LArThreeDSlidingConeFitResult.h.

TrackStateMap lar_content::ThreeDSlidingConeFitResult::m_trackStateMap
private

The track state map.

Definition at line 164 of file LArThreeDSlidingConeFitResult.h.


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