LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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 38 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 769 of file TransverseAssociationAlgorithm.cc.

References f, m_direction, m_innerVertex, m_outerVertex, and max.

769  :
770  m_pSeedCluster(pSeedCluster),
771  m_associatedClusters(associatedClusters),
772  m_innerVertex(0.f, 0.f, 0.f),
773  m_outerVertex(0.f, 0.f, 0.f),
774  m_direction(0.f, 0.f, 0.f)
775 {
776  double Swzz(0.), Swxx(0.), Swzx(0.), Swz(0.), Swx(0.), Sw(0.);
777  double minX(std::numeric_limits<double>::max());
778  double maxX(-std::numeric_limits<double>::max());
779 
780  ClusterList clusterList(1, pSeedCluster);
781  clusterList.insert(clusterList.end(), associatedClusters.begin(), associatedClusters.end());
782 
783  for (ClusterList::const_iterator iterI = clusterList.begin(), iterEndI = clusterList.end(); iterI != iterEndI; ++iterI)
784  {
785  for (OrderedCaloHitList::const_iterator iterJ = (*iterI)->GetOrderedCaloHitList().begin(), iterEndJ = (*iterI)->GetOrderedCaloHitList().end(); iterJ != iterEndJ; ++iterJ)
786  {
787  for (CaloHitList::const_iterator iterK = iterJ->second->begin(), iterEndK = iterJ->second->end(); iterK != iterEndK; ++iterK)
788  {
789  const CaloHit *const pCaloHit = *iterK;
790 
791  if (pCaloHit->GetPositionVector().GetX() < minX)
792  minX = pCaloHit->GetPositionVector().GetX();
793 
794  if (pCaloHit->GetPositionVector().GetX() > maxX)
795  maxX = pCaloHit->GetPositionVector().GetX();
796 
797  Swzz += pCaloHit->GetPositionVector().GetZ() * pCaloHit->GetPositionVector().GetZ();
798  Swxx += pCaloHit->GetPositionVector().GetX() * pCaloHit->GetPositionVector().GetX();
799  Swzx += pCaloHit->GetPositionVector().GetZ() * pCaloHit->GetPositionVector().GetX();
800  Swz += pCaloHit->GetPositionVector().GetZ();
801  Swx += pCaloHit->GetPositionVector().GetX();
802  Sw += 1.;
803  }
804  }
805  }
806 
807  if (Sw > 0.f)
808  {
809  const double averageX(Swx / Sw);
810  const double averageZ(Swz / Sw);
811 
812  if (Sw * Swxx - Swx * Swx > 0.)
813  {
814  double m((Sw * Swzx - Swx * Swz) / (Sw * Swxx - Swx * Swx));
815  double px(1. / std::sqrt(1. + m * m));
816  double pz(m / std::sqrt(1. + m * m));
817 
818  m_innerVertex.SetValues(static_cast<float>(minX), 0.f, static_cast<float>(averageZ + m * (minX - averageX)));
819  m_outerVertex.SetValues(static_cast<float>(maxX), 0.f, static_cast<float>(averageZ + m * (maxX - averageX)));
820  m_direction.SetValues(static_cast<float>(px), 0.f, static_cast<float>(pz));
821  }
822  else
823  {
824  m_innerVertex.SetValues(static_cast<float>(averageX), 0.f, static_cast<float>(averageZ));
825  m_outerVertex.SetValues(static_cast<float>(averageX), 0.f, static_cast<float>(averageZ));
826  m_direction.SetValues(1.f, 0.f, 0.f);
827  }
828  }
829  else
830  {
831  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
832  }
833 }
TFile f
Definition: plotHisto.C:6
Int_t max
Definition: plot.C:27
intermediate_table::const_iterator const_iterator

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 86 of file TransverseAssociationAlgorithm.h.

Referenced by GetAssociatedClusters().

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

Definition at line 89 of file TransverseAssociationAlgorithm.h.

Referenced by GetDirection(), and LArTransverseCluster().

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

Definition at line 87 of file TransverseAssociationAlgorithm.h.

Referenced by GetInnerVertex(), and LArTransverseCluster().

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

Definition at line 88 of file TransverseAssociationAlgorithm.h.

Referenced by GetOuterVertex(), and LArTransverseCluster().

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

Definition at line 85 of file TransverseAssociationAlgorithm.h.

Referenced by GetSeedCluster().


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