LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
LArPointingCluster.cc
Go to the documentation of this file.
1 
11 
12 using namespace pandora;
13 
14 namespace lar_content
15 {
16 
17 LArPointingCluster::LArPointingCluster(const Cluster *const pCluster, const unsigned int fitHalfLayerWindow, const float fitLayerPitch)
18 {
19  // TODO remove default layer fit window and z pitch values
20  if (TPC_3D == LArClusterHelper::GetClusterHitType(pCluster))
21  {
22  const ThreeDSlidingFitResult slidingFitResult(pCluster, fitHalfLayerWindow, fitLayerPitch);
23  this->BuildPointingCluster(slidingFitResult);
24  }
25  else
26  {
27  const TwoDSlidingFitResult slidingFitResult(pCluster, fitHalfLayerWindow, fitLayerPitch);
28  this->BuildPointingCluster(slidingFitResult);
29  }
30 }
31 
32 //------------------------------------------------------------------------------------------------------------------------------------------
33 
34 LArPointingCluster::LArPointingCluster(const TwoDSlidingFitResult &slidingFitResult)
35 {
36  this->BuildPointingCluster(slidingFitResult);
37 }
38 
39 //------------------------------------------------------------------------------------------------------------------------------------------
40 
41 LArPointingCluster::LArPointingCluster(const ThreeDSlidingFitResult &slidingFitResult)
42 {
43  this->BuildPointingCluster(slidingFitResult);
44 }
45 
46 //------------------------------------------------------------------------------------------------------------------------------------------
47 
48 void LArPointingCluster::BuildPointingCluster(const TwoDSlidingFitResult &slidingFitResult)
49 {
50  const HitType hitType(LArClusterHelper::GetClusterHitType(slidingFitResult.GetCluster()));
51 
52  if (!((TPC_VIEW_U == hitType) || (TPC_VIEW_V == hitType) || (TPC_VIEW_W == hitType)))
53  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
54 
55  if (slidingFitResult.GetMinLayer() >= slidingFitResult.GetMaxLayer())
56  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
57 
58  const bool isInner((slidingFitResult.GetGlobalMinLayerPosition().GetZ() < slidingFitResult.GetGlobalMaxLayerPosition().GetZ()));
59 
60  m_pCluster = slidingFitResult.GetCluster();
61 
62  const Vertex minVertex(m_pCluster, slidingFitResult.GetGlobalMinLayerPosition(), slidingFitResult.GetGlobalMinLayerDirection(),
63  slidingFitResult.GetMinLayerRms(), isInner);
64  const Vertex maxVertex(m_pCluster, slidingFitResult.GetGlobalMaxLayerPosition(), slidingFitResult.GetGlobalMaxLayerDirection() * -1.f,
65  slidingFitResult.GetMaxLayerRms(), !isInner);
66 
67  m_innerVertex = ( isInner ? minVertex : maxVertex);
68  m_outerVertex = ( isInner ? maxVertex : minVertex);
69 }
70 
71 //------------------------------------------------------------------------------------------------------------------------------------------
72 
73 void LArPointingCluster::BuildPointingCluster(const ThreeDSlidingFitResult &slidingFitResult)
74 {
75  if (TPC_3D != LArClusterHelper::GetClusterHitType(slidingFitResult.GetCluster()))
76  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
77 
78  if (slidingFitResult.GetMinLayer() >= slidingFitResult.GetMaxLayer())
79  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
80 
81  const bool isInner((slidingFitResult.GetGlobalMinLayerPosition().GetZ() < slidingFitResult.GetGlobalMaxLayerPosition().GetZ()) &&
82  (slidingFitResult.GetMinLayer() < slidingFitResult.GetMaxLayer()));
83 
84  m_pCluster = slidingFitResult.GetCluster();
85 
86  const Vertex minVertex(m_pCluster, slidingFitResult.GetGlobalMinLayerPosition(), slidingFitResult.GetGlobalMinLayerDirection(),
87  slidingFitResult.GetMinLayerRms(), isInner);
88  const Vertex maxVertex(m_pCluster, slidingFitResult.GetGlobalMaxLayerPosition(), slidingFitResult.GetGlobalMaxLayerDirection() * -1.f,
89  slidingFitResult.GetMaxLayerRms(), !isInner);
90 
91  m_innerVertex = ( isInner ? minVertex : maxVertex);
92  m_outerVertex = ( isInner ? maxVertex : minVertex);
93 }
94 
95 //------------------------------------------------------------------------------------------------------------------------------------------
96 
97 LArPointingCluster::Vertex::Vertex() :
98  m_pCluster(NULL),
99  m_position(0.f, 0.f, 0.f),
100  m_direction(0.f, 0.f, 0.f),
101  m_rms(std::numeric_limits<float>::max()),
102  m_isInner(false),
103  m_isInitialized(false)
104 {
105 }
106 
107 //------------------------------------------------------------------------------------------------------------------------------------------
108 
109 LArPointingCluster::Vertex::Vertex(const Cluster *const pCluster, const CartesianVector &position, const CartesianVector &direction,
110  const float rms, const bool isInner) :
111  m_pCluster(pCluster),
112  m_position(position),
113  m_direction(direction),
114  m_rms(rms),
115  m_isInner(isInner),
116  m_isInitialized(true)
117 {
118 }
119 
120 //------------------------------------------------------------------------------------------------------------------------------------------
121 
123  m_pCluster(rhs.m_pCluster),
124  m_position(rhs.m_position),
126  m_rms(rhs.m_rms),
127  m_isInner(rhs.m_isInner),
129 {
130 }
131 
132 //------------------------------------------------------------------------------------------------------------------------------------------
133 
135 {
136 }
137 
138 //------------------------------------------------------------------------------------------------------------------------------------------
139 
141 {
142  m_pCluster = rhs.m_pCluster;
143  m_position = rhs.m_position;
144  m_direction = rhs.m_direction;
145  m_rms = rhs.m_rms;
146  m_isInner = rhs.m_isInner;
148 
149  return *this;
150 }
151 
152 } // namespace lar_content
Header file for the lar pointing cluster class.
const pandora::CartesianVector & GetGlobalMinLayerDirection() const
Get global direction corresponding to the fit result in minimum fit layer.
float GetMaxLayerRms() const
Get rms at maximum layer.
int GetMaxLayer() const
Get the maximum occupied layer in the sliding fit.
float GetMaxLayerRms() const
Get rms at maximum layer.
STL namespace.
float GetMinLayerRms() const
Get rms at minimum layer.
Vertex & operator=(const Vertex &rhs)
Vertex assigment operator.
pandora::CartesianVector GetGlobalMinLayerDirection() const
Get global direction corresponding to the fit result in minimum fit layer.
TFile f
Definition: plotHisto.C:6
const pandora::Cluster * m_pCluster
The address of the cluster.
Int_t max
Definition: plot.C:27
int GetMaxLayer() const
Get the maximum occupied layer in the sliding fit.
int GetMinLayer() const
Get the minimum occupied layer in the sliding fit.
Header file for the cluster helper class.
const pandora::CartesianVector & GetGlobalMaxLayerDirection() const
Get global direction corresponding to the fit result in maximum fit layer.
bool m_isInner
Whether this is the inner vertex.
pandora::CartesianVector GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.
int GetMinLayer() const
Get the minimum occupied layer in the sliding fit.
const pandora::CartesianVector & GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
float GetMinLayerRms() const
Get rms at minimum layer.
const pandora::Cluster * GetCluster() const
Get the address of the cluster, if originally provided.
pandora::CartesianVector GetGlobalMaxLayerDirection() const
Get global direction corresponding to the fit result in maximum fit layer.
const pandora::Cluster * GetCluster() const
Get the address of the cluster.
bool m_isInitialized
Whether the vertex has been initialized.
pandora::CartesianVector m_direction
The vertex direction.
pandora::CartesianVector GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
pandora::CartesianVector m_position
The vertex position.
const pandora::CartesianVector & GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.