All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
lar_content::TrackHitsBaseTool Class Referenceabstract

TrackHitsBaseTool class. More...

#include <TrackHitsBaseTool.h>

Inheritance diagram for lar_content::TrackHitsBaseTool:
lar_content::HitCreationBaseTool lar_content::LongitudinalTrackHitsBaseTool lar_content::TransverseTrackHitsBaseTool lar_content::ClearLongitudinalTrackHitsTool lar_content::MultiValuedLongitudinalTrackHitsTool lar_content::ClearTransverseTrackHitsTool lar_content::MultiValuedTransverseTrackHitsTool

Public Member Functions

 TrackHitsBaseTool ()
 Default constructor. More...
 
virtual void Run (ThreeDHitCreationAlgorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pPfo, const pandora::CaloHitVector &inputTwoDHits, ProtoHitVector &protoHitVector)
 Run the algorithm tool. More...
 
- Public Member Functions inherited from lar_content::HitCreationBaseTool
 HitCreationBaseTool ()
 Default constructor. More...
 
virtual ~HitCreationBaseTool ()
 Destructor. More...
 

Protected Types

typedef std::map
< pandora::HitType,
TwoDSlidingFitResult
MatchedSlidingFitMap
 

Protected Member Functions

virtual void GetTrackHits3D (const pandora::CaloHitVector &inputTwoDHits, const MatchedSlidingFitMap &matchedSlidingFitMap, ProtoHitVector &protoHitVector) const =0
 Calculate 3D hits from an input list of 2D hits. More...
 
virtual void BuildSlidingFitMap (const pandora::ParticleFlowObject *const pPfo, MatchedSlidingFitMap &matchedSlidingFitMap) const
 Calculate sliding fit results for clusters from each view. More...
 
virtual pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
- Protected Member Functions inherited from lar_content::HitCreationBaseTool
virtual void GetBestPosition3D (const pandora::HitType hitType1, const pandora::HitType hitType2, const pandora::CartesianPointVector &fitPositionList1, const pandora::CartesianPointVector &fitPositionList2, ProtoHit &protoHit) const
 Get the three dimensional position using a provided two dimensional calo hit and candidate fit positions from the other two views. More...
 
virtual void GetBestPosition3D (const pandora::HitType hitType1, const pandora::HitType hitType2, const pandora::CartesianVector &fitPosition1, const pandora::CartesianVector &fitPosition2, ProtoHit &protoHit) const
 Get the three dimensional position using a provided two dimensional calo hit and candidate fit positions from the other two views. More...
 
virtual void GetBestPosition3D (const pandora::HitType hitType, const pandora::CartesianVector &fitPosition, ProtoHit &protoHit) const
 Get the three dimensional position using a provided two dimensional calo hit and a candidate fit position from another view. More...
 

Protected Attributes

unsigned int m_minViews
 The minimum number of views required for building hits. More...
 
unsigned int m_slidingFitWindow
 The layer window for the sliding linear fits. More...
 
- Protected Attributes inherited from lar_content::HitCreationBaseTool
double m_sigmaX2
 The sigmaX squared value, for calculation of chi2 deltaX term. More...
 
double m_chiSquaredCut
 The chi squared cut (accept only values below the cut value) More...
 

Additional Inherited Members

- Public Types inherited from lar_content::HitCreationBaseTool
typedef
ThreeDHitCreationAlgorithm::ProtoHit 
ProtoHit
 
typedef
ThreeDHitCreationAlgorithm::ProtoHitVector 
ProtoHitVector
 
typedef
ThreeDHitCreationAlgorithm::TrajectorySample 
TrajectorySample
 

Detailed Description

TrackHitsBaseTool class.

Definition at line 23 of file TrackHitsBaseTool.h.

Member Typedef Documentation

typedef std::map<pandora::HitType, TwoDSlidingFitResult> lar_content::TrackHitsBaseTool::MatchedSlidingFitMap
protected

Definition at line 35 of file TrackHitsBaseTool.h.

Constructor & Destructor Documentation

lar_content::TrackHitsBaseTool::TrackHitsBaseTool ( )

Default constructor.

Definition at line 23 of file TrackHitsBaseTool.cc.

24 {
25 }
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
unsigned int m_minViews
The minimum number of views required for building hits.

Member Function Documentation

void lar_content::TrackHitsBaseTool::BuildSlidingFitMap ( const pandora::ParticleFlowObject *const  pPfo,
MatchedSlidingFitMap matchedSlidingFitMap 
) const
protectedvirtual

Calculate sliding fit results for clusters from each view.

Parameters
pPfothe input particle flow object
matchedSlidingFitMapthe group of sliding fit results

Definition at line 55 of file TrackHitsBaseTool.cc.

56 {
57  const ClusterList &pfoClusterList(pPfo->GetClusterList());
58  const float slidingFitPitch(LArGeometryHelper::GetWireZPitch(this->GetPandora()));
59 
60  ClusterVector pfoClusterVector;
61  pfoClusterVector.insert(pfoClusterVector.end(), pfoClusterList.begin(), pfoClusterList.end());
62  std::sort(pfoClusterVector.begin(), pfoClusterVector.end(), LArClusterHelper::SortByNHits);
63 
64  for (const Cluster *const pCluster : pfoClusterVector)
65  {
66  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
67 
68  if (TPC_3D == hitType)
69  continue;
70 
71  if (matchedSlidingFitMap.end() != matchedSlidingFitMap.find(hitType))
72  continue;
73 
74  try
75  {
76  const TwoDSlidingFitResult slidingFitResult(pCluster, m_slidingFitWindow, slidingFitPitch);
77 
78  if (!matchedSlidingFitMap.insert(MatchedSlidingFitMap::value_type(hitType, slidingFitResult)).second)
79  throw StatusCodeException(STATUS_CODE_FAILURE);
80  }
81  catch (StatusCodeException &statusCodeException)
82  {
83  if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
84  throw statusCodeException;
85  }
86  }
87 }
static bool SortByNHits(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sort clusters by number of hits, then layer span, then inner layer, then position, then pulse-height.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
virtual void lar_content::TrackHitsBaseTool::GetTrackHits3D ( const pandora::CaloHitVector &  inputTwoDHits,
const MatchedSlidingFitMap matchedSlidingFitMap,
ProtoHitVector protoHitVector 
) const
protectedpure virtual

Calculate 3D hits from an input list of 2D hits.

Parameters
pAlgorithmthe hit creation algorithm
inputTwoDHitsthe input vector of 2D hits
matchedSlidingFitMapthe group of sliding fit results
protoHitVectorto receive the new three dimensional proto hits

Implemented in lar_content::LongitudinalTrackHitsBaseTool, and lar_content::TransverseTrackHitsBaseTool.

StatusCode lar_content::TrackHitsBaseTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protectedvirtual

Reimplemented from lar_content::HitCreationBaseTool.

Reimplemented in lar_content::LongitudinalTrackHitsBaseTool.

Definition at line 91 of file TrackHitsBaseTool.cc.

92 {
93  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinViews", m_minViews));
94 
95  PANDORA_RETURN_RESULT_IF_AND_IF(
96  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingFitWindow", m_slidingFitWindow));
97 
98  return HitCreationBaseTool::ReadSettings(xmlHandle);
99 }
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
unsigned int m_minViews
The minimum number of views required for building hits.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void lar_content::TrackHitsBaseTool::Run ( ThreeDHitCreationAlgorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pPfo,
const pandora::CaloHitVector &  inputTwoDHits,
ProtoHitVector protoHitVector 
)
virtual

Run the algorithm tool.

Parameters
pAlgorithmaddress of the calling algorithm
pPfothe address of the pfo
inputTwoDHitsthe vector of input two dimensional hits
protoHitVectorto receive the new three dimensional proto hits

Implements lar_content::HitCreationBaseTool.

Definition at line 29 of file TrackHitsBaseTool.cc.

31 {
32  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
33  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
34 
35  try
36  {
37  if (!LArPfoHelper::IsTrack(pPfo))
38  return;
39 
40  MatchedSlidingFitMap matchedSlidingFitMap;
41  this->BuildSlidingFitMap(pPfo, matchedSlidingFitMap);
42 
43  if (matchedSlidingFitMap.size() < 2)
44  return;
45 
46  this->GetTrackHits3D(inputTwoDHits, matchedSlidingFitMap, protoHitVector);
47  }
48  catch (StatusCodeException &)
49  {
50  }
51 }
virtual void BuildSlidingFitMap(const pandora::ParticleFlowObject *const pPfo, MatchedSlidingFitMap &matchedSlidingFitMap) const
Calculate sliding fit results for clusters from each view.
virtual void GetTrackHits3D(const pandora::CaloHitVector &inputTwoDHits, const MatchedSlidingFitMap &matchedSlidingFitMap, ProtoHitVector &protoHitVector) const =0
Calculate 3D hits from an input list of 2D hits.
std::map< pandora::HitType, TwoDSlidingFitResult > MatchedSlidingFitMap
static bool IsTrack(const pandora::ParticleFlowObject *const pPfo)
Return track flag based on Pfo Particle ID.
BEGIN_PROLOG could also be cout

Member Data Documentation

unsigned int lar_content::TrackHitsBaseTool::m_minViews
protected

The minimum number of views required for building hits.

Definition at line 58 of file TrackHitsBaseTool.h.

unsigned int lar_content::TrackHitsBaseTool::m_slidingFitWindow
protected

The layer window for the sliding linear fits.

Definition at line 59 of file TrackHitsBaseTool.h.


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