LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::ThreeViewShowerHitsTool Class Reference

ThreeViewShowerHitsTool class. More...

#include "ThreeViewShowerHitsTool.h"

Inheritance diagram for lar_content::ThreeViewShowerHitsTool:
lar_content::ShowerHitsBaseTool lar_content::HitCreationBaseTool

Public Types

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

Public Member Functions

 ThreeViewShowerHitsTool ()
 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...
 

Protected Member Functions

virtual void GetShowerHits3D (const pandora::CaloHitVector &inputTwoDHits, const pandora::CaloHitVector &caloHitVector1, const pandora::CaloHitVector &caloHitVector2, ProtoHitVector &protoHitVector) const
 Create three dimensional hits, using a list of input two dimensional hits and the hits (contained in the same particle) from the other two views. More...
 
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

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 GetShowerHit3D (const pandora::CaloHitVector &caloHitVector1, const pandora::CaloHitVector &caloHitVector2, ProtoHit &protoHit) const
 Get the three dimensional position for to a two dimensional calo hit, using the hit and a list of candidate matched hits in the other two views. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

float m_zTolerance
 The z tolerance to use when looking for associated calo hits between views. More...
 

Detailed Description

ThreeViewShowerHitsTool class.

Definition at line 19 of file ThreeViewShowerHitsTool.h.

Member Typedef Documentation

Constructor & Destructor Documentation

lar_content::ThreeViewShowerHitsTool::ThreeViewShowerHitsTool ( )

Default constructor.

Definition at line 20 of file ThreeViewShowerHitsTool.cc.

20  :
21  m_zTolerance(1.f)
22 {
23 }
TFile f
Definition: plotHisto.C:6
float m_zTolerance
The z tolerance to use when looking for associated calo hits between views.

Member Function Documentation

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 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
void lar_content::ThreeViewShowerHitsTool::GetShowerHit3D ( const pandora::CaloHitVector &  caloHitVector1,
const pandora::CaloHitVector &  caloHitVector2,
ProtoHit protoHit 
) const
privatevirtual

Get the three dimensional position for to a two dimensional calo hit, using the hit and a list of candidate matched hits in the other two views.

Parameters
caloHitVector1the vector of candidate hits in view 1
caloHitVector2the vector of candidate hits in view 2
protoHitto receive the populated proto hit

Implements lar_content::ShowerHitsBaseTool.

Definition at line 27 of file ThreeViewShowerHitsTool.cc.

References lar_content::HitCreationBaseTool::GetBestPosition3D(), lar_content::ThreeDHitCreationAlgorithm::ProtoHit::GetChi2(), lar_content::ThreeDHitCreationAlgorithm::ProtoHit::GetParentCaloHit2D(), lar_content::ThreeDHitCreationAlgorithm::ProtoHit::IsPositionSet(), m_zTolerance, and lar_content::LArGeometryHelper::MergeTwoPositions().

28 {
29  if (caloHitVector1.empty() || caloHitVector2.empty())
30  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
31 
32  const HitType hitType1(caloHitVector1.at(0)->GetHitType());
33  const HitType hitType2(caloHitVector2.at(0)->GetHitType());
34 
35  const CaloHit *const pCaloHit2D(protoHit.GetParentCaloHit2D());
36  const HitType hitType2D(pCaloHit2D->GetHitType());
37  const float position2D(pCaloHit2D->GetPositionVector().GetZ());
38 
39  for (const CaloHit *const pCaloHit1 : caloHitVector1)
40  {
41  const CartesianVector &position1(pCaloHit1->GetPositionVector());
42  const float prediction(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), hitType2D, hitType1, position2D, position1.GetZ()));
43 
44  for (const CaloHit *const pCaloHit2 : caloHitVector2)
45  {
46  const CartesianVector &position2(pCaloHit2->GetPositionVector());
47 
48  if (std::fabs(position2.GetZ() - prediction) > m_zTolerance)
49  continue;
50 
51  ProtoHit thisProtoHit(pCaloHit2D);
52  this->GetBestPosition3D(hitType1, hitType2, position1, position2, thisProtoHit);
53 
54  if (!protoHit.IsPositionSet() || (thisProtoHit.GetChi2() < protoHit.GetChi2()))
55  protoHit = thisProtoHit;
56  }
57  }
58 }
ThreeDHitCreationAlgorithm::ProtoHit ProtoHit
static float MergeTwoPositions(const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const float position1, const float position2)
Merge two views (U,V) to give a third view (Z).
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...
HitType
Definition: HitType.h:12
float m_zTolerance
The z tolerance to use when looking for associated calo hits between views.
void lar_content::ShowerHitsBaseTool::GetShowerHits3D ( const pandora::CaloHitVector &  inputTwoDHits,
const pandora::CaloHitVector &  caloHitVector1,
const pandora::CaloHitVector &  caloHitVector2,
ProtoHitVector protoHitVector 
) const
protectedvirtualinherited

Create three dimensional hits, using a list of input two dimensional hits and the hits (contained in the same particle) from the other two views.

Parameters
inputTwoDHitsthe list of input two dimensional hits
caloHitVector1hits in the first alternate view
caloHitVector2hits in the second alternate view
protoHitVectorto receive the new three dimensional proto hits

Definition at line 55 of file ShowerHitsBaseTool.cc.

References lar_content::ShowerHitsBaseTool::FilterCaloHits(), lar_content::ShowerHitsBaseTool::GetShowerHit3D(), lar_content::HitCreationBaseTool::m_chiSquaredCut, and lar_content::ShowerHitsBaseTool::m_xTolerance.

Referenced by lar_content::ShowerHitsBaseTool::Run().

57 {
58  for (const CaloHit *const pCaloHit2D : inputTwoDHits)
59  {
60  try
61  {
62  CaloHitVector filteredHits1, filteredHits2;
63  this->FilterCaloHits(pCaloHit2D->GetPositionVector().GetX(), m_xTolerance, caloHitVector1, filteredHits1);
64  this->FilterCaloHits(pCaloHit2D->GetPositionVector().GetX(), m_xTolerance, caloHitVector2, filteredHits2);
65 
66  ProtoHit protoHit(pCaloHit2D);
67  this->GetShowerHit3D(filteredHits1, filteredHits2, protoHit);
68 
69  if (protoHit.IsPositionSet() && (protoHit.GetChi2() < m_chiSquaredCut))
70  protoHitVector.push_back(protoHit);
71  }
72  catch (StatusCodeException &)
73  {
74  }
75  }
76 }
ThreeDHitCreationAlgorithm::ProtoHit ProtoHit
float m_xTolerance
The x tolerance to use when looking for associated calo hits between views.
double m_chiSquaredCut
The chi squared cut (accept only values below the cut value)
void FilterCaloHits(const float x, const float xTolerance, const pandora::CaloHitVector &inputCaloHitVector, pandora::CaloHitVector &outputCaloHitVector) const
Filter a list of calo hits to find those within a specified tolerance of a give x position...
virtual void GetShowerHit3D(const pandora::CaloHitVector &caloHitVector1, const pandora::CaloHitVector &caloHitVector2, ProtoHit &protoHit) const =0
Get the three dimensional position for to a two dimensional calo hit, using the hit and a list of can...
StatusCode lar_content::ThreeViewShowerHitsTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::ShowerHitsBaseTool.

Definition at line 62 of file ThreeViewShowerHitsTool.cc.

References m_zTolerance, and lar_content::ShowerHitsBaseTool::ReadSettings().

63 {
64  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ZTolerance", m_zTolerance));
65 
66  return ShowerHitsBaseTool::ReadSettings(xmlHandle);
67 }
float m_zTolerance
The z tolerance to use when looking for associated calo hits between views.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void lar_content::ShowerHitsBaseTool::Run ( ThreeDHitCreationAlgorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pPfo,
const pandora::CaloHitVector &  inputTwoDHits,
ProtoHitVector protoHitVector 
)
virtualinherited

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 28 of file ShowerHitsBaseTool.cc.

References lar_content::ThreeDHitCreationAlgorithm::FilterCaloHitsByType(), lar_content::ShowerHitsBaseTool::GetShowerHits3D(), and lar_content::LArPfoHelper::IsShower().

30 {
31  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
32  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
33 
34  try
35  {
36  if (!LArPfoHelper::IsShower(pPfo))
37  return;
38 
39  CaloHitVector caloHitVectorU, caloHitVectorV, caloHitVectorW;
40  pAlgorithm->FilterCaloHitsByType(inputTwoDHits, TPC_VIEW_U, caloHitVectorU);
41  pAlgorithm->FilterCaloHitsByType(inputTwoDHits, TPC_VIEW_V, caloHitVectorV);
42  pAlgorithm->FilterCaloHitsByType(inputTwoDHits, TPC_VIEW_W, caloHitVectorW);
43 
44  this->GetShowerHits3D(caloHitVectorU, caloHitVectorV, caloHitVectorW, protoHitVector);
45  this->GetShowerHits3D(caloHitVectorV, caloHitVectorU, caloHitVectorW, protoHitVector);
46  this->GetShowerHits3D(caloHitVectorW, caloHitVectorU, caloHitVectorV, protoHitVector);
47  }
48  catch (StatusCodeException &)
49  {
50  }
51 }
static bool IsShower(const pandora::ParticleFlowObject *const pPfo)
Return shower flag based on Pfo Particle ID.
virtual void GetShowerHits3D(const pandora::CaloHitVector &inputTwoDHits, const pandora::CaloHitVector &caloHitVector1, const pandora::CaloHitVector &caloHitVector2, ProtoHitVector &protoHitVector) const
Create three dimensional hits, using a list of input two dimensional hits and the hits (contained in ...

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

float lar_content::ThreeViewShowerHitsTool::m_zTolerance
private

The z tolerance to use when looking for associated calo hits between views.

Definition at line 32 of file ThreeViewShowerHitsTool.h.

Referenced by GetShowerHit3D(), and ReadSettings().


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