Public Member Functions | Private Member Functions | List of all members
lar_content::DeltaRayShowerHitsTool Class Reference

DeltaRayShowerHitsTool class. More...

#include <DeltaRayShowerHitsTool.h>

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

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...
 
- Public Member Functions inherited from lar_content::HitCreationBaseTool
 HitCreationBaseTool ()
 Default constructor. More...
 
virtual ~HitCreationBaseTool ()
 Destructor. 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...
 

Additional Inherited Members

- Public Types inherited from lar_content::HitCreationBaseTool
typedef ThreeDHitCreationAlgorithm::ProtoHit ProtoHit
 
typedef ThreeDHitCreationAlgorithm::ProtoHitVector ProtoHitVector
 
typedef ThreeDHitCreationAlgorithm::TrajectorySample TrajectorySample
 
- 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...
 
virtual pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
- 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...
 

Detailed Description

DeltaRayShowerHitsTool class.

Definition at line 19 of file DeltaRayShowerHitsTool.h.

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.

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
enum cvn::HType HitType
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
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...
static int max(int a, int b)
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.
QTextStream & endl(QTextStream &s)

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