LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::DeltaRayShowerHitsTool Class Reference

DeltaRayShowerHitsTool class. More...

#include "DeltaRayShowerHitsTool.h"

Inheritance diagram for lar_content::DeltaRayShowerHitsTool:
lar_content::HitCreationBaseTool

Public Types

typedef ThreeDHitCreationAlgorithm::ProtoHit ProtoHit
 
typedef ThreeDHitCreationAlgorithm::ProtoHitVector ProtoHitVector
 
typedef ThreeDHitCreationAlgorithm::TrajectorySample TrajectorySample
 

Public Member Functions

virtual void Run (ThreeDHitCreationAlgorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pPfo, const pandora::CaloHitVector &inputTwoDHits, ProtoHitVector &protoHitVector)
 Run the algorithm tool. More...
 

Protected Member Functions

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...
 
virtual pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Protected Attributes

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...
 

Private Member Functions

void CreateDeltaRayShowerHits3D (const pandora::CaloHitVector &inputTwoDHits, const pandora::CaloHitVector &parentHits3D, ProtoHitVector &protoHitVector) const
 Create three dimensional hits, using a list of input two dimensional hits and the 3D hits from the parent particle. More...
 

Detailed Description

DeltaRayShowerHitsTool class.

Definition at line 19 of file DeltaRayShowerHitsTool.h.

Member Typedef Documentation

Member Function Documentation

void lar_content::DeltaRayShowerHitsTool::CreateDeltaRayShowerHits3D ( const pandora::CaloHitVector &  inputTwoDHits,
const pandora::CaloHitVector &  parentHits3D,
ProtoHitVector protoHitVector 
) const
private

Create three dimensional hits, using a list of input two dimensional hits and the 3D hits from the parent particle.

Parameters
inputTwoDHitsthe vector of input two dimensional hits
parentHits3Dthe vector of 3D hits from the parent particle
protoHitVectorto receive the new three dimensional proto hits

Definition at line 54 of file DeltaRayShowerHitsTool.cc.

References f, lar_content::ThreeDHitCreationAlgorithm::ProtoHit::IsPositionSet(), and max.

56 {
57  for (const CaloHit *const pCaloHit2D : inputTwoDHits)
58  {
59  try
60  {
61  const HitType hitType(pCaloHit2D->GetHitType());
62  const HitType hitType1((TPC_VIEW_U == hitType) ? TPC_VIEW_V : (TPC_VIEW_V == hitType) ? TPC_VIEW_W : TPC_VIEW_U);
63  const HitType hitType2((TPC_VIEW_U == hitType) ? TPC_VIEW_W : (TPC_VIEW_V == hitType) ? TPC_VIEW_U : TPC_VIEW_V);
64 
65  bool foundClosestPosition(false);
66  float closestDistanceSquared(std::numeric_limits<float>::max());
67  CartesianVector closestPosition3D(0.f, 0.f, 0.f);
68 
69  for (const CaloHit *const pCaloHit3D : parentHits3D)
70  {
71  const CartesianVector thisPosition3D(pCaloHit3D->GetPositionVector());
72  const CartesianVector thisPosition2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), thisPosition3D, hitType));
73  const float thisDistanceSquared((pCaloHit2D->GetPositionVector() - thisPosition2D).GetMagnitudeSquared());
74 
75  if (thisDistanceSquared < closestDistanceSquared)
76  {
77  foundClosestPosition = true;
78  closestDistanceSquared = thisDistanceSquared;
79  closestPosition3D = thisPosition3D;
80  }
81  }
82 
83  if (!foundClosestPosition)
84  continue;
85 
86  const CartesianVector position1(LArGeometryHelper::ProjectPosition(this->GetPandora(), closestPosition3D, hitType1));
87  const CartesianVector position2(LArGeometryHelper::ProjectPosition(this->GetPandora(), closestPosition3D, hitType2));
88 
89  ProtoHit protoHit(pCaloHit2D);
90  this->GetBestPosition3D(hitType1, hitType2, position1, position2, protoHit);
91 
92  if (protoHit.IsPositionSet())
93  protoHitVector.push_back(protoHit);
94  }
95  catch (StatusCodeException &)
96  {
97  }
98  }
99 }
ThreeDHitCreationAlgorithm::ProtoHit ProtoHit
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
TFile f
Definition: plotHisto.C:6
Int_t max
Definition: plot.C:27
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 positi...
virtual void lar_content::HitCreationBaseTool::GetBestPosition3D ( const pandora::HitType  hitType1,
const pandora::HitType  hitType2,
const pandora::CartesianPointVector &  fitPositionList1,
const pandora::CartesianPointVector &  fitPositionList2,
ProtoHit protoHit 
) const
protectedvirtualinherited

Get the three dimensional position using a provided two dimensional calo hit and candidate fit positions from the other two views.

Parameters
hitType1the hit type identifying the first view
hitType2the hit type identifying the second view
fitPositionList1the candidate sliding fit position in the first view
fitPositionList2the candidate sliding fit position in the second view
protoHitto receive the populated proto hit

Referenced by lar_content::ThreeViewShowerHitsTool::GetShowerHit3D(), and lar_content::HitCreationBaseTool::~HitCreationBaseTool().

virtual void lar_content::HitCreationBaseTool::GetBestPosition3D ( const pandora::HitType  hitType1,
const pandora::HitType  hitType2,
const pandora::CartesianVector &  fitPosition1,
const pandora::CartesianVector &  fitPosition2,
ProtoHit protoHit 
) const
protectedvirtualinherited

Get the three dimensional position using a provided two dimensional calo hit and candidate fit positions from the other two views.

Parameters
hitType1the hit type identifying the first view
hitType2the hit type identifying the second view
fitPosition1the candidate sliding fit position in the first view
fitPosition2the candidate sliding fit position in the second view
protoHitto receive the populated proto hit
virtual void lar_content::HitCreationBaseTool::GetBestPosition3D ( const pandora::HitType  hitType,
const pandora::CartesianVector &  fitPosition,
ProtoHit protoHit 
) const
protectedvirtualinherited

Get the three dimensional position using a provided two dimensional calo hit and a candidate fit position from another view.

Parameters
hitTypethe hit type identifying the other view
fitPositionthe candidate sliding fit position in the other view
protoHitto receive the populated proto hit
StatusCode lar_content::HitCreationBaseTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protectedvirtualinherited

Reimplemented in lar_content::TrackHitsBaseTool, lar_content::ShowerHitsBaseTool, lar_content::LongitudinalTrackHitsBaseTool, and lar_content::ThreeViewShowerHitsTool.

Definition at line 135 of file HitCreationBaseTool.cc.

References lar_content::HitCreationBaseTool::m_chiSquaredCut, and lar_content::HitCreationBaseTool::m_sigmaX2.

Referenced by lar_content::ShowerHitsBaseTool::ReadSettings(), and lar_content::TrackHitsBaseTool::ReadSettings().

136 {
137  double sigmaX(std::sqrt(m_sigmaX2));
138 
139  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
140  "SigmaX", sigmaX));
141 
142  m_sigmaX2 = sigmaX * sigmaX;
143 
144  if (m_sigmaX2 < std::numeric_limits<double>::epsilon())
145  {
146  std::cout << "HitCreationBaseTool - Invalid parameter, SigmaX: " << sigmaX << std::endl;
147  return STATUS_CODE_INVALID_PARAMETER;
148  }
149 
150  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
151  "ChiSquaredCut", m_chiSquaredCut));
152 
153  return STATUS_CODE_SUCCESS;
154 }
double m_sigmaX2
The sigmaX squared value, for calculation of chi2 deltaX term.
double m_chiSquaredCut
The chi squared cut (accept only values below the cut value)
void lar_content::DeltaRayShowerHitsTool::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 23 of file DeltaRayShowerHitsTool.cc.

25 {
26  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
27  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
28 
29  try
30  {
31  if (!LArPfoHelper::IsShower(pPfo) || (1 != pPfo->GetParentPfoList().size()))
32  return;
33 
34  const ParticleFlowObject *const pParentPfo(pPfo->GetParentPfoList().front());
35 
36  CaloHitList parentHitList3D;
37  LArPfoHelper::GetCaloHits(pParentPfo, TPC_3D, parentHitList3D);
38 
39  if (parentHitList3D.empty())
40  return;
41 
42  CaloHitVector parentHitVector3D(parentHitList3D.begin(), parentHitList3D.end());
43  std::sort(parentHitVector3D.begin(), parentHitVector3D.end(), LArClusterHelper::SortHitsByPosition);
44 
45  this->CreateDeltaRayShowerHits3D(inputTwoDHits, parentHitVector3D, protoHitVector);
46  }
47  catch (StatusCodeException &)
48  {
49  }
50 }
static bool IsShower(const pandora::ParticleFlowObject *const pPfo)
Return shower flag based on Pfo Particle ID.
static bool SortHitsByPosition(const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs)
Sort calo hits by their position (use Z, followed by X, followed by Y)
void CreateDeltaRayShowerHits3D(const pandora::CaloHitVector &inputTwoDHits, const pandora::CaloHitVector &parentHits3D, ProtoHitVector &protoHitVector) const
Create three dimensional hits, using a list of input two dimensional hits and the 3D hits from the pa...
static void GetCaloHits(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::CaloHitList &caloHitList)
Get a list of calo hits of a particular hit type from a list of pfos.

Member Data Documentation

double lar_content::HitCreationBaseTool::m_chiSquaredCut
protectedinherited
double lar_content::HitCreationBaseTool::m_sigmaX2
protectedinherited

The sigmaX squared value, for calculation of chi2 deltaX term.

Definition at line 85 of file HitCreationBaseTool.h.

Referenced by lar_content::HitCreationBaseTool::ReadSettings(), and lar_content::HitCreationBaseTool::~HitCreationBaseTool().


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