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

LArTransverseCluster class. More...

Public Member Functions

 LArTransverseCluster (const pandora::Cluster *const pSeedCluster, const pandora::ClusterVector &associatedClusters)
 Constructor. More...
 
const pandora::Cluster * GetSeedCluster () const
 Constructor. More...
 
const pandora::ClusterVector & GetAssociatedClusters () const
 Get the associated cluster vector. More...
 
const pandora::CartesianVector & GetInnerVertex () const
 Get the inner vertex position. More...
 
const pandora::CartesianVector & GetOuterVertex () const
 Get the outer vertex position. More...
 
const pandora::CartesianVector & GetDirection () const
 Get the direction. More...
 

Private Attributes

const pandora::Cluster * m_pSeedCluster
 
pandora::ClusterVector m_associatedClusters
 
pandora::CartesianVector m_innerVertex
 
pandora::CartesianVector m_outerVertex
 
pandora::CartesianVector m_direction
 

Detailed Description

LArTransverseCluster class.

Definition at line 40 of file TransverseAssociationAlgorithm.h.

Constructor & Destructor Documentation

lar_content::TransverseAssociationAlgorithm::LArTransverseCluster::LArTransverseCluster ( const pandora::Cluster *const  pSeedCluster,
const pandora::ClusterVector &  associatedClusters 
)

Constructor.

Parameters
pSeedCluster
associatedClusters

Definition at line 789 of file TransverseAssociationAlgorithm.cc.

References f, m_direction, m_innerVertex, and m_outerVertex.

789  :
790  m_pSeedCluster(pSeedCluster),
791  m_associatedClusters(associatedClusters),
792  m_innerVertex(0.f, 0.f, 0.f),
793  m_outerVertex(0.f, 0.f, 0.f),
794  m_direction(0.f, 0.f, 0.f)
795 {
796  double Swxx(0.), Swzx(0.), Swz(0.), Swx(0.), Sw(0.);
797  double minX(std::numeric_limits<double>::max());
798  double maxX(-std::numeric_limits<double>::max());
799 
800  ClusterList clusterList(1, pSeedCluster);
801  clusterList.insert(clusterList.end(), associatedClusters.begin(), associatedClusters.end());
802 
803  for (ClusterList::const_iterator iterI = clusterList.begin(), iterEndI = clusterList.end(); iterI != iterEndI; ++iterI)
804  {
805  for (OrderedCaloHitList::const_iterator iterJ = (*iterI)->GetOrderedCaloHitList().begin(),
806  iterEndJ = (*iterI)->GetOrderedCaloHitList().end();
807  iterJ != iterEndJ; ++iterJ)
808  {
809  for (CaloHitList::const_iterator iterK = iterJ->second->begin(), iterEndK = iterJ->second->end(); iterK != iterEndK; ++iterK)
810  {
811  const CaloHit *const pCaloHit = *iterK;
812 
813  if (pCaloHit->GetPositionVector().GetX() < minX)
814  minX = pCaloHit->GetPositionVector().GetX();
815 
816  if (pCaloHit->GetPositionVector().GetX() > maxX)
817  maxX = pCaloHit->GetPositionVector().GetX();
818 
819  Swxx += pCaloHit->GetPositionVector().GetX() * pCaloHit->GetPositionVector().GetX();
820  Swzx += pCaloHit->GetPositionVector().GetZ() * pCaloHit->GetPositionVector().GetX();
821  Swz += pCaloHit->GetPositionVector().GetZ();
822  Swx += pCaloHit->GetPositionVector().GetX();
823  Sw += 1.;
824  }
825  }
826  }
827 
828  if (Sw > 0.f)
829  {
830  const double averageX(Swx / Sw);
831  const double averageZ(Swz / Sw);
832 
833  if (Sw * Swxx - Swx * Swx > 0.)
834  {
835  double m((Sw * Swzx - Swx * Swz) / (Sw * Swxx - Swx * Swx));
836  double px(1. / std::sqrt(1. + m * m));
837  double pz(m / std::sqrt(1. + m * m));
838 
839  m_innerVertex.SetValues(static_cast<float>(minX), 0.f, static_cast<float>(averageZ + m * (minX - averageX)));
840  m_outerVertex.SetValues(static_cast<float>(maxX), 0.f, static_cast<float>(averageZ + m * (maxX - averageX)));
841  m_direction.SetValues(static_cast<float>(px), 0.f, static_cast<float>(pz));
842  }
843  else
844  {
845  m_innerVertex.SetValues(static_cast<float>(averageX), 0.f, static_cast<float>(averageZ));
846  m_outerVertex.SetValues(static_cast<float>(averageX), 0.f, static_cast<float>(averageZ));
847  m_direction.SetValues(1.f, 0.f, 0.f);
848  }
849  }
850  else
851  {
852  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
853  }
854 }
intermediate_table::const_iterator const_iterator
TFile f
Definition: plotHisto.C:6

Member Function Documentation

const pandora::ClusterVector & lar_content::TransverseAssociationAlgorithm::LArTransverseCluster::GetAssociatedClusters ( ) const
inline

Get the associated cluster vector.

Returns
the associated cluster vector

Definition at line 365 of file TransverseAssociationAlgorithm.h.

References m_associatedClusters.

const pandora::CartesianVector & lar_content::TransverseAssociationAlgorithm::LArTransverseCluster::GetDirection ( ) const
inline

Get the direction.

Returns
the direction

Definition at line 386 of file TransverseAssociationAlgorithm.h.

References m_direction.

Referenced by lar_content::TransverseAssociationAlgorithm::IsTransverseAssociated().

const pandora::CartesianVector & lar_content::TransverseAssociationAlgorithm::LArTransverseCluster::GetInnerVertex ( ) const
inline

Get the inner vertex position.

Returns
the inner vertex position

Definition at line 372 of file TransverseAssociationAlgorithm.h.

References m_innerVertex.

Referenced by lar_content::TransverseAssociationAlgorithm::IsTransverseAssociated().

const pandora::CartesianVector & lar_content::TransverseAssociationAlgorithm::LArTransverseCluster::GetOuterVertex ( ) const
inline

Get the outer vertex position.

Returns
the outer vertex position

Definition at line 379 of file TransverseAssociationAlgorithm.h.

References m_outerVertex.

Referenced by lar_content::TransverseAssociationAlgorithm::IsTransverseAssociated().

const pandora::Cluster * lar_content::TransverseAssociationAlgorithm::LArTransverseCluster::GetSeedCluster ( ) const
inline

Member Data Documentation

pandora::ClusterVector lar_content::TransverseAssociationAlgorithm::LArTransverseCluster::m_associatedClusters
private

Definition at line 88 of file TransverseAssociationAlgorithm.h.

Referenced by GetAssociatedClusters().

pandora::CartesianVector lar_content::TransverseAssociationAlgorithm::LArTransverseCluster::m_direction
private

Definition at line 91 of file TransverseAssociationAlgorithm.h.

Referenced by GetDirection(), and LArTransverseCluster().

pandora::CartesianVector lar_content::TransverseAssociationAlgorithm::LArTransverseCluster::m_innerVertex
private

Definition at line 89 of file TransverseAssociationAlgorithm.h.

Referenced by GetInnerVertex(), and LArTransverseCluster().

pandora::CartesianVector lar_content::TransverseAssociationAlgorithm::LArTransverseCluster::m_outerVertex
private

Definition at line 90 of file TransverseAssociationAlgorithm.h.

Referenced by GetOuterVertex(), and LArTransverseCluster().

const pandora::Cluster* lar_content::TransverseAssociationAlgorithm::LArTransverseCluster::m_pSeedCluster
private

Definition at line 87 of file TransverseAssociationAlgorithm.h.

Referenced by GetSeedCluster().


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