Public Member Functions | Private Attributes | List of all members
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 780 of file TransverseAssociationAlgorithm.cc.

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

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.

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

Get the direction.

Returns
the direction

Definition at line 386 of file TransverseAssociationAlgorithm.h.

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.

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.

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

Constructor.

Returns
the address of the seed cluster

Definition at line 358 of file TransverseAssociationAlgorithm.h.

Member Data Documentation

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

Definition at line 88 of file TransverseAssociationAlgorithm.h.

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

Definition at line 91 of file TransverseAssociationAlgorithm.h.

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

Definition at line 89 of file TransverseAssociationAlgorithm.h.

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

Definition at line 90 of file TransverseAssociationAlgorithm.h.

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

Definition at line 87 of file TransverseAssociationAlgorithm.h.


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