LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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

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.

References f, lar_content::ThreeDSlidingFitResult::GetFirstFitResult(), lar_content::ThreeDSlidingFitResult::GetGlobalFitDirection(), lar_content::ThreeDSlidingFitResult::GetGlobalFitPosition(), lar_content::ThreeDSlidingFitResult::GetGlobalMaxLayerPosition(), lar_content::ThreeDSlidingFitResult::GetGlobalMinLayerPosition(), lar_content::ThreeDSlidingFitResult::GetSecondFitResult(), m_slidingFitResult, and m_trackStateMap.

Referenced by GetSimpleConeList().

72  :
73  m_slidingFitResult(ThreeDSlidingFitResult(pT, slidingFitWindow, slidingFitLayerPitch))
74 {
75  const CartesianVector &minLayerPosition3D(m_slidingFitResult.GetGlobalMinLayerPosition());
76  const CartesianVector &maxLayerPosition3D(m_slidingFitResult.GetGlobalMaxLayerPosition());
77 
78  const TwoDSlidingFitResult &fitResult1(m_slidingFitResult.GetFirstFitResult());
79  const TwoDSlidingFitResult &fitResult2(m_slidingFitResult.GetSecondFitResult());
80 
81  const LayerFitContributionMap &contributionMap1(fitResult1.GetLayerFitContributionMap());
82  const LayerFitContributionMap &contributionMap2(fitResult2.GetLayerFitContributionMap());
83 
84  const int nSteps(static_cast<int>((maxLayerPosition3D - minLayerPosition3D).GetMagnitude() / slidingFitLayerPitch));
85 
86  for (int iStep = 0; iStep <= nSteps; ++iStep)
87  {
88  try
89  {
90  const float rL((static_cast<float>(iStep) + 0.5f) * slidingFitLayerPitch);
91  CartesianVector fitPosition3D(0.f, 0.f, 0.f), fitDirection3D(0.f, 0.f, 0.f);
92 
93  if ((STATUS_CODE_SUCCESS != m_slidingFitResult.GetGlobalFitPosition(rL, fitPosition3D)) ||
94  (STATUS_CODE_SUCCESS != m_slidingFitResult.GetGlobalFitDirection(rL, fitDirection3D)))
95  {
96  continue;
97  }
98 
99  // ATTN Do not include layers without contributions in track state map (contain only interpolations)
100  if (!contributionMap1.count(fitResult1.GetLayer(rL)) && !contributionMap2.count(fitResult2.GetLayer(rL)))
101  continue;
102 
103  (void) m_trackStateMap.insert(TrackStateMap::value_type(iStep, TrackState(fitPosition3D, fitDirection3D)));
104  }
105  catch (const StatusCodeException &)
106  {
107  /* Deliberately empty */
108  }
109  }
110 }
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
TFile f
Definition: plotHisto.C:6
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 114 of file LArThreeDSlidingConeFitResult.cc.

References lar_content::CONE_BACKWARD_ONLY, lar_content::CONE_BOTH_DIRECTIONS, lar_content::CONE_FORWARD_ONLY, f, lar_content::ThreeDSlidingFitResult::GetGlobalMaxLayerPosition(), lar_content::ThreeDSlidingFitResult::GetGlobalMinLayerPosition(), GetSlidingFitResult(), GetTrackStateMap(), and ThreeDSlidingConeFitResult().

Referenced by lar_content::SlidingConePfoMopUpAlgorithm::GetClusterMergeMap(), lar_content::SlidingConeClusterMopUpAlgorithm::GetClusterMergeMap(), and lar_content::EventSlicingTool::PassShowerCone().

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

Referenced by lar_content::SlidingConePfoMopUpAlgorithm::GetClusterMergeMap(), lar_content::SlidingConeClusterMopUpAlgorithm::GetClusterMergeMap(), GetSimpleConeList(), and lar_content::EventSlicingTool::PassShowerCone().

220 {
221  return m_slidingFitResult;
222 }
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 226 of file LArThreeDSlidingConeFitResult.h.

Referenced by GetSimpleConeList().

227 {
228  return m_trackStateMap;
229 }
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.

Referenced by ThreeDSlidingConeFitResult().

TrackStateMap lar_content::ThreeDSlidingConeFitResult::m_trackStateMap
private

The track state map.

Definition at line 164 of file LArThreeDSlidingConeFitResult.h.

Referenced by ThreeDSlidingConeFitResult().


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