Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
gar::gar_pandora::PseudoLayerPlugin Class Reference

#include <PseudoLayerPlugin.h>

Inheritance diagram for gar::gar_pandora::PseudoLayerPlugin:

Public Member Functions

 PseudoLayerPlugin ()
 Default constructor. More...
 

Private Types

typedef std::vector< float > LayerPositionList
 
typedef std::vector< std::pair< float, float > > AngleVector
 

Private Member Functions

pandora::StatusCode Initialize ()
 
unsigned int GetPseudoLayer (const pandora::CartesianVector &positionVector) const
 
unsigned int GetPseudoLayerAtIp () const
 
pandora::StatusCode GetPseudoLayer (const float rCoordinate, const float zCoordinate, const float rCorrection, const float zCorrection, const float barrelInnerR, const float endCapInnerZ, unsigned int &pseudoLayer) const
 Get the appropriate pseudolayer for a specified parameters. More...
 
pandora::StatusCode FindMatchingLayer (const float position, const LayerPositionList &layerPositionList, unsigned int &layer) const
 Find the layer number corresponding to a specified position, via reference to a specified layer position list. More...
 
void StoreLayerPositions ()
 Store all revelevant barrel and endcap layer positions upon initialization. More...
 
void StoreLayerPositions (const pandora::SubDetector &subDetector, LayerPositionList &LayerPositionList)
 Store subdetector layer positions upon initialization. More...
 
void StoreDetectorOuterEdge ()
 Store positions of barrel and endcap outer edges upon initialization. More...
 
void StorePolygonAngles ()
 Store sine and cosine of angles used to project hit positions onto polygonal calorimeter surfaces upon initialization. More...
 
void StoreOverlapCorrectionDetails ()
 Store all details revelevant to barrel/endcap overlap corrections upon initialization. More...
 
float GetMaximumRadius (const AngleVector &angleVector, const float x, const float y) const
 Get the maximum polygon radius, with reference to cached sine/cosine values for relevant polygon angles. More...
 
void FillAngleVector (const unsigned int symmetryOrder, const float phi0, AngleVector &angleVector) const
 Fill a vector with sine/cosine values for relevant polygon angles. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

LayerPositionList m_barrelLayerPositions
 List of barrel layer positions. More...
 
LayerPositionList m_endCapLayerPositions
 List of endcap layer positions. More...
 
AngleVector m_eCalBarrelAngleVector
 The ecal barrel angle vector. More...
 
float m_barrelInnerR
 Barrel inner radius. More...
 
float m_endCapInnerZ
 Endcap inner z position. More...
 
float m_rCorrection
 Barrel/endcap overlap r correction. More...
 
float m_zCorrection
 Barrel/endcap overlap z correction. More...
 
float m_barrelEdgeR
 Extremal barrel r coordinate. More...
 
float m_endCapEdgeZ
 Extremal endcap z coordinate. More...
 

Detailed Description

Definition at line 22 of file PseudoLayerPlugin.h.

Member Typedef Documentation

typedef std::vector< std::pair<float, float> > gar::gar_pandora::PseudoLayerPlugin::AngleVector
private

Definition at line 90 of file PseudoLayerPlugin.h.

Definition at line 51 of file PseudoLayerPlugin.h.

Constructor & Destructor Documentation

gar::gar_pandora::PseudoLayerPlugin::PseudoLayerPlugin ( )

Default constructor.

Definition at line 14 of file PseudoLayerPlugin.cxx.

15  : m_barrelInnerR(0.f),
16  m_endCapInnerZ(0.f),
17  m_rCorrection(0.f),
18  m_zCorrection(0.f),
19  m_barrelEdgeR(0.f),
20  m_endCapEdgeZ(0.f)
21  {}
float m_barrelEdgeR
Extremal barrel r coordinate.
float m_endCapEdgeZ
Extremal endcap z coordinate.
float m_endCapInnerZ
Endcap inner z position.
float m_zCorrection
Barrel/endcap overlap z correction.
float m_barrelInnerR
Barrel inner radius.
float m_rCorrection
Barrel/endcap overlap r correction.

Member Function Documentation

void gar::gar_pandora::PseudoLayerPlugin::FillAngleVector ( const unsigned int  symmetryOrder,
const float  phi0,
AngleVector angleVector 
) const
private

Fill a vector with sine/cosine values for relevant polygon angles.

Parameters
symmetryOrderthe polygon symmetry order
phi0the polygon cylindrical polar phi coordinate
angleVectorthe vector to fill with sine/cosine values for relevant polygon angles

Definition at line 249 of file PseudoLayerPlugin.cxx.

250  {
251  const float twoPi = static_cast<float>(2. * std::acos(-1.));
252  angleVector.clear();
253 
254  for (unsigned int iSymmetry = 0; iSymmetry < symmetryOrder; ++iSymmetry)
255  {
256  const float phi = phi0 + ((twoPi * static_cast<float>(iSymmetry)) / static_cast<float>(symmetryOrder));
257  angleVector.push_back(std::make_pair(std::cos(phi), std::sin(phi)));
258  }
259  }
StatusCode gar::gar_pandora::PseudoLayerPlugin::FindMatchingLayer ( const float  position,
const LayerPositionList layerPositionList,
unsigned int &  layer 
) const
private

Find the layer number corresponding to a specified position, via reference to a specified layer position list.

Parameters
positionthe specified position
layerPositionListthe specified layer position list
layerto receive the layer number

Definition at line 106 of file PseudoLayerPlugin.cxx.

108  {
109  LayerPositionList::const_iterator upperIter = std::upper_bound(layerPositionList.begin(), layerPositionList.end(), position);
110 
111  if (layerPositionList.end() == upperIter)
112  {
113  return STATUS_CODE_NOT_FOUND;
114  }
115 
116  if (layerPositionList.begin() == upperIter)
117  {
118  layer = 0;
119  return STATUS_CODE_SUCCESS;
120  }
121 
122  LayerPositionList::const_iterator lowerIter = upperIter - 1;
123 
124  if (std::fabs(position - *lowerIter) < std::fabs(position - *upperIter))
125  {
126  layer = std::distance(layerPositionList.begin(), lowerIter);
127  }
128  else
129  {
130  layer = std::distance(layerPositionList.begin(), upperIter);
131  }
132 
133  return STATUS_CODE_SUCCESS;
134  }
intermediate_table::const_iterator const_iterator
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
float gar::gar_pandora::PseudoLayerPlugin::GetMaximumRadius ( const AngleVector angleVector,
const float  x,
const float  y 
) const
private

Get the maximum polygon radius, with reference to cached sine/cosine values for relevant polygon angles.

Parameters
angleVectorvector containing cached sine/cosine values
xthe cartesian x coordinate
ythe cartesian y coordinate
Returns
the maximum radius

Definition at line 230 of file PseudoLayerPlugin.cxx.

231  {
232  if (angleVector.size() <= 2)
233  return std::sqrt((x * x) + (y * y));
234 
235  float maxRadius(0.);
236  for (AngleVector::const_iterator iter = angleVector.begin(), iterEnd = angleVector.end(); iter != iterEnd; ++iter)
237  {
238  const float radius((x * iter->first) + (y * iter->second));
239 
240  if (radius > maxRadius)
241  maxRadius = radius;
242  }
243 
244  return maxRadius;
245  }
intermediate_table::const_iterator const_iterator
list x
Definition: train.py:276
unsigned int gar::gar_pandora::PseudoLayerPlugin::GetPseudoLayer ( const pandora::CartesianVector &  positionVector) const
private

Definition at line 45 of file PseudoLayerPlugin.cxx.

46  {
47  const float zCoordinate(std::fabs(positionVector.GetZ()));
48 
49  if (zCoordinate > m_endCapEdgeZ) {
50  MF_LOG_WARNING("PseudoLayerPlugin::GetPseudoLayer")
51  << "zCoordinate " << zCoordinate << " > m_endCapEdgeZ " << m_endCapEdgeZ << std::endl;
52  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
53  }
54 
55  const float rCoordinate(this->GetMaximumRadius(m_eCalBarrelAngleVector, positionVector.GetX(), positionVector.GetY()));
56 
57  if (rCoordinate > m_barrelEdgeR) {
58  MF_LOG_WARNING("PseudoLayerPlugin::GetPseudoLayer")
59  << "rCoordinate " << rCoordinate << " > m_barrelEdgeR " << m_barrelEdgeR << std::endl;
60  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
61  }
62 
63  unsigned int pseudoLayer;
64 
65  const StatusCode statusCode(this->GetPseudoLayer(rCoordinate, zCoordinate, m_rCorrection, m_zCorrection, m_barrelInnerR,
66  m_endCapInnerZ, pseudoLayer));
67 
68  if (STATUS_CODE_SUCCESS != statusCode)
69  throw StatusCodeException(statusCode);
70 
71  // Reserve a pseudo layer for track projections, etc.
72  return (1 + pseudoLayer);
73  }
float m_barrelEdgeR
Extremal barrel r coordinate.
float m_endCapEdgeZ
Extremal endcap z coordinate.
float m_endCapInnerZ
Endcap inner z position.
unsigned int GetPseudoLayer(const pandora::CartesianVector &positionVector) const
float m_zCorrection
Barrel/endcap overlap z correction.
float GetMaximumRadius(const AngleVector &angleVector, const float x, const float y) const
Get the maximum polygon radius, with reference to cached sine/cosine values for relevant polygon angl...
float m_barrelInnerR
Barrel inner radius.
AngleVector m_eCalBarrelAngleVector
The ecal barrel angle vector.
#define MF_LOG_WARNING(category)
float m_rCorrection
Barrel/endcap overlap r correction.
QTextStream & endl(QTextStream &s)
StatusCode gar::gar_pandora::PseudoLayerPlugin::GetPseudoLayer ( const float  rCoordinate,
const float  zCoordinate,
const float  rCorrection,
const float  zCorrection,
const float  barrelInnerR,
const float  endCapInnerZ,
unsigned int &  pseudoLayer 
) const
private

Get the appropriate pseudolayer for a specified parameters.

Parameters
rCoordinatethe radial coordinate
zCoordinatethe z coordinate
rCorrectionthe barrel/endcap overlap r correction
zCorrectionthe barrel/endcap overlap z correction
barrelInnerRthe barrel inner r coordinate
endCapInnerZthe endcap inner z coordinate
pseudoLayerto receive the appropriate pseudolayer

Definition at line 77 of file PseudoLayerPlugin.cxx.

79  {
80  if (zCoordinate < endCapInnerZ)
81  {
82  return this->FindMatchingLayer(rCoordinate, m_barrelLayerPositions, pseudoLayer);
83  }
84  else if (rCoordinate < barrelInnerR)
85  {
86  return this->FindMatchingLayer(zCoordinate, m_endCapLayerPositions, pseudoLayer);
87  }
88  else
89  {
90  unsigned int bestBarrelLayer(0);
91  const StatusCode barrelStatusCode(this->FindMatchingLayer(rCoordinate - rCorrection, m_barrelLayerPositions, bestBarrelLayer));
92 
93  unsigned int bestEndCapLayer(0);
94  const StatusCode endCapStatusCode(this->FindMatchingLayer(zCoordinate - zCorrection, m_endCapLayerPositions, bestEndCapLayer));
95 
96  if ((STATUS_CODE_SUCCESS != barrelStatusCode) && (STATUS_CODE_SUCCESS != endCapStatusCode))
97  return STATUS_CODE_NOT_FOUND;
98 
99  pseudoLayer = std::max(bestBarrelLayer, bestEndCapLayer);
100  return STATUS_CODE_SUCCESS;
101  }
102  }
LayerPositionList m_barrelLayerPositions
List of barrel layer positions.
LayerPositionList m_endCapLayerPositions
List of endcap layer positions.
static int max(int a, int b)
pandora::StatusCode FindMatchingLayer(const float position, const LayerPositionList &layerPositionList, unsigned int &layer) const
Find the layer number corresponding to a specified position, via reference to a specified layer posit...
unsigned int gar::gar_pandora::PseudoLayerPlugin::GetPseudoLayerAtIp ( ) const
inlineprivate

Definition at line 130 of file PseudoLayerPlugin.h.

131  {
132  const unsigned int pseudoLayerAtIp(this->GetPseudoLayer(pandora::CartesianVector(0.f, 0.f, 0.f)));
133  return pseudoLayerAtIp;
134  }
unsigned int GetPseudoLayer(const pandora::CartesianVector &positionVector) const
StatusCode gar::gar_pandora::PseudoLayerPlugin::Initialize ( )
private

Definition at line 25 of file PseudoLayerPlugin.cxx.

26  {
27  try
28  {
29  this->StoreLayerPositions();
30  this->StoreDetectorOuterEdge();
31  this->StorePolygonAngles();
33  }
34  catch (StatusCodeException &statusCodeException)
35  {
36  std::cout << "PseudoLayerPlugin: Incomplete geometry - consider using a different PseudoLayerCalculator." << std::endl;
37  return statusCodeException.GetStatusCode();
38  }
39 
40  return STATUS_CODE_SUCCESS;
41  }
void StoreLayerPositions()
Store all revelevant barrel and endcap layer positions upon initialization.
void StoreDetectorOuterEdge()
Store positions of barrel and endcap outer edges upon initialization.
void StoreOverlapCorrectionDetails()
Store all details revelevant to barrel/endcap overlap corrections upon initialization.
void StorePolygonAngles()
Store sine and cosine of angles used to project hit positions onto polygonal calorimeter surfaces upo...
QTextStream & endl(QTextStream &s)
pandora::StatusCode gar::gar_pandora::PseudoLayerPlugin::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 263 of file PseudoLayerPlugin.cxx.

264  {
265  return STATUS_CODE_SUCCESS;
266  }
void gar::gar_pandora::PseudoLayerPlugin::StoreDetectorOuterEdge ( )
private

Store positions of barrel and endcap outer edges upon initialization.

Definition at line 183 of file PseudoLayerPlugin.cxx.

184  {
185  const GeometryManager *const pGeometryManager(this->GetPandora().GetGeometry());
186 
187  m_barrelEdgeR = pGeometryManager->GetSubDetector(ECAL_BARREL).GetOuterRCoordinate();
188 
189  m_endCapEdgeZ = std::fabs(pGeometryManager->GetSubDetector(ECAL_ENDCAP).GetOuterZCoordinate());
190 
191  if ((m_barrelLayerPositions.end() != std::upper_bound(m_barrelLayerPositions.begin(), m_barrelLayerPositions.end(), m_barrelEdgeR)) || (m_endCapLayerPositions.end() != std::upper_bound(m_endCapLayerPositions.begin(), m_endCapLayerPositions.end(), m_endCapEdgeZ)))
192  {
193  std::cout << "PseudoLayerPlugin: Layers specified outside detector edge." << std::endl;
194  throw StatusCodeException(STATUS_CODE_FAILURE);
195  }
196 
199  }
float m_barrelEdgeR
Extremal barrel r coordinate.
LayerPositionList m_barrelLayerPositions
List of barrel layer positions.
LayerPositionList m_endCapLayerPositions
List of endcap layer positions.
float m_endCapEdgeZ
Extremal endcap z coordinate.
QTextStream & endl(QTextStream &s)
GeomAnalyzerI * GetGeometry(void)
Definition: gAtmoEvGen.cxx:433
void gar::gar_pandora::PseudoLayerPlugin::StoreLayerPositions ( )
private

Store all revelevant barrel and endcap layer positions upon initialization.

Definition at line 138 of file PseudoLayerPlugin.cxx.

139  {
140  const GeometryManager *const pGeometryManager(this->GetPandora().GetGeometry());
141  this->StoreLayerPositions(pGeometryManager->GetSubDetector(ECAL_BARREL), m_barrelLayerPositions);
142  this->StoreLayerPositions(pGeometryManager->GetSubDetector(ECAL_ENDCAP), m_endCapLayerPositions);
143 
144  if (m_barrelLayerPositions.empty() || m_endCapLayerPositions.empty())
145  {
146  std::cout << "PseudoLayerPlugin: No layer positions specified." << std::endl;
147  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
148  }
149 
150  std::sort(m_barrelLayerPositions.begin(), m_barrelLayerPositions.end());
151  std::sort(m_endCapLayerPositions.begin(), m_endCapLayerPositions.end());
152 
155 
156  if ((m_barrelLayerPositions.end() != barrelIter) || (m_endCapLayerPositions.end() != endcapIter))
157  {
158  std::cout << "PseudoLayerPlugin: Duplicate layer position detected." << std::endl;
159  throw StatusCodeException(STATUS_CODE_FAILURE);
160  }
161  }
void StoreLayerPositions()
Store all revelevant barrel and endcap layer positions upon initialization.
LayerPositionList m_barrelLayerPositions
List of barrel layer positions.
LayerPositionList m_endCapLayerPositions
List of endcap layer positions.
intermediate_table::const_iterator const_iterator
QTextStream & endl(QTextStream &s)
GeomAnalyzerI * GetGeometry(void)
Definition: gAtmoEvGen.cxx:433
void gar::gar_pandora::PseudoLayerPlugin::StoreLayerPositions ( const pandora::SubDetector &  subDetector,
LayerPositionList LayerPositionList 
)
private

Store subdetector layer positions upon initialization.

Parameters
subDetectorthe sub detector
layerParametersListthe layer parameters list
void gar::gar_pandora::PseudoLayerPlugin::StoreOverlapCorrectionDetails ( )
private

Store all details revelevant to barrel/endcap overlap corrections upon initialization.

Definition at line 213 of file PseudoLayerPlugin.cxx.

214  {
215  const GeometryManager *const pGeometryManager(this->GetPandora().GetGeometry());
216 
217  m_barrelInnerR = pGeometryManager->GetSubDetector(ECAL_BARREL).GetInnerRCoordinate();
218  m_endCapInnerZ = std::fabs(pGeometryManager->GetSubDetector(ECAL_ENDCAP).GetInnerZCoordinate());
219 
220  const float barrelOuterZ = std::fabs(pGeometryManager->GetSubDetector(ECAL_BARREL).GetOuterZCoordinate());
221  const float endCapOuterR = pGeometryManager->GetSubDetector(ECAL_ENDCAP).GetOuterRCoordinate();
222 
223  const bool IsEnclosingEndCap(endCapOuterR > m_barrelInnerR);
224  m_rCorrection = ((!IsEnclosingEndCap) ? 0.f : m_barrelInnerR * ((m_endCapInnerZ / barrelOuterZ) - 1.f));
225  m_zCorrection = ((IsEnclosingEndCap) ? 0.f : m_endCapInnerZ * ((m_barrelInnerR / endCapOuterR) - 1.f));
226  }
float m_endCapInnerZ
Endcap inner z position.
float m_zCorrection
Barrel/endcap overlap z correction.
float m_barrelInnerR
Barrel inner radius.
float m_rCorrection
Barrel/endcap overlap r correction.
GeomAnalyzerI * GetGeometry(void)
Definition: gAtmoEvGen.cxx:433
void gar::gar_pandora::PseudoLayerPlugin::StorePolygonAngles ( )
private

Store sine and cosine of angles used to project hit positions onto polygonal calorimeter surfaces upon initialization.

Definition at line 203 of file PseudoLayerPlugin.cxx.

204  {
205  const GeometryManager *const pGeometryManager(this->GetPandora().GetGeometry());
206 
207  this->FillAngleVector(pGeometryManager->GetSubDetector(ECAL_BARREL).GetInnerSymmetryOrder(),
208  pGeometryManager->GetSubDetector(ECAL_BARREL).GetInnerPhiCoordinate(), m_eCalBarrelAngleVector);
209  }
void FillAngleVector(const unsigned int symmetryOrder, const float phi0, AngleVector &angleVector) const
Fill a vector with sine/cosine values for relevant polygon angles.
AngleVector m_eCalBarrelAngleVector
The ecal barrel angle vector.
GeomAnalyzerI * GetGeometry(void)
Definition: gAtmoEvGen.cxx:433

Member Data Documentation

float gar::gar_pandora::PseudoLayerPlugin::m_barrelEdgeR
private

Extremal barrel r coordinate.

Definition at line 124 of file PseudoLayerPlugin.h.

float gar::gar_pandora::PseudoLayerPlugin::m_barrelInnerR
private

Barrel inner radius.

Definition at line 118 of file PseudoLayerPlugin.h.

LayerPositionList gar::gar_pandora::PseudoLayerPlugin::m_barrelLayerPositions
private

List of barrel layer positions.

Definition at line 114 of file PseudoLayerPlugin.h.

AngleVector gar::gar_pandora::PseudoLayerPlugin::m_eCalBarrelAngleVector
private

The ecal barrel angle vector.

Definition at line 116 of file PseudoLayerPlugin.h.

float gar::gar_pandora::PseudoLayerPlugin::m_endCapEdgeZ
private

Extremal endcap z coordinate.

Definition at line 125 of file PseudoLayerPlugin.h.

float gar::gar_pandora::PseudoLayerPlugin::m_endCapInnerZ
private

Endcap inner z position.

Definition at line 119 of file PseudoLayerPlugin.h.

LayerPositionList gar::gar_pandora::PseudoLayerPlugin::m_endCapLayerPositions
private

List of endcap layer positions.

Definition at line 115 of file PseudoLayerPlugin.h.

float gar::gar_pandora::PseudoLayerPlugin::m_rCorrection
private

Barrel/endcap overlap r correction.

Definition at line 121 of file PseudoLayerPlugin.h.

float gar::gar_pandora::PseudoLayerPlugin::m_zCorrection
private

Barrel/endcap overlap z correction.

Definition at line 122 of file PseudoLayerPlugin.h.


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