ATLAS Offline Software
Loading...
Searching...
No Matches
TileCellDim.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*
6 * Updates:
7 * - 2022 Jan, Riccardo Maria BIANCHI <riccardo.maria.bianchi@cern.ch>
8 * Added MsgStream for logging
9 */
10
12
13#include <stdexcept>
14#include <iostream>
15#include <cmath>
16
17TileCellDim::TileCellDim(unsigned int nRows)
18 : AthMessaging ("TileDetDescrManager")
19 , m_nRows(nRows)
20 , m_volume(0)
21{
22 // convert tile radius to tile half-length
23 m_Radius2HalfLength = tan ( M_PI / 64);
24
25}
26
30
31double TileCellDim::getRMin(unsigned int index) const
32{
33 if (index < m_rMin.size())
34 return m_rMin[index];
35 else
36 throw std::runtime_error( "Index out of range when retrieving RMin!" );
37}
38
39double TileCellDim::getRMax(unsigned int index) const
40{
41 if (index < m_rMax.size())
42 return m_rMax[index];
43 else
44 throw std::runtime_error( "Index out of range when retrieving RMax!" );
45}
46
47double TileCellDim::getZMin(unsigned int index) const
48{
49 if (index < m_zMin.size())
50 return m_zMin[index];
51 else
52 throw std::runtime_error( "Index out of range when retrieving ZMin!" );
53}
54
55double TileCellDim::getZMax(unsigned int index) const
56{
57 if (index < m_zMax.size())
58 return m_zMax[index];
59 else
60 throw std::runtime_error( "Index out of range when retrieving ZMax!" );
61}
62
63void TileCellDim::addRMin(double rMin)
64{
65 if (m_rMin.size() < m_nRows)
66 m_rMin.push_back(rMin);
67 else
68 throw std::runtime_error( "Attempt to insert new RMin when vector size reached maximum!" );
69}
70
71void TileCellDim::addRMax(double rMax)
72{
73 if (m_rMax.size() < m_nRows)
74 m_rMax.push_back(rMax);
75 else
76 throw std::runtime_error( "Attempt to insert new RMax when vector size reached maximum!" );
77}
78
79void TileCellDim::addZMin(double zMin)
80{
81 if (m_zMin.size() < m_nRows)
82 m_zMin.push_back(zMin);
83 else
84 throw std::runtime_error( "Attempt to insert new ZMin when vector size reached maximum!" );
85}
86
87void TileCellDim::addZMax(double zMax)
88{
89 if (m_zMax.size() < m_nRows)
90 m_zMax.push_back(zMax);
91 else
92 throw std::runtime_error( "Attempt to insert new ZMax when vector size reached maximum!" );
93}
94
96{
97 m_volume = 0.0;
98
99 for (unsigned int i=0; i<m_nRows; ++i)
101}
102
104{
105
106 return fabs ( m_Radius2HalfLength * (m_rMin[iRow] + m_rMax[iRow])
107 * (m_rMax[iRow] - m_rMin[iRow])
108 * (m_zMax[iRow] - m_zMin[iRow]) );
109}
110
111
113{
114 std::cout << " >> Cell contains " << m_nRows << " rows" << std::endl;
115 for (unsigned int i=0; i<m_nRows; ++i) {
116 std::cout << m_rMin[i] << " "
117 << m_rMax[i] << " "
118 << m_zMin[i] << " "
119 << m_zMax[i] << std::endl;
120 }
121 std::cout << " >> Cell Volume is " << m_volume << std::endl;
122}
#define M_PI
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
std::vector< double > m_zMin
Definition TileCellDim.h:47
unsigned int m_nRows
Definition TileCellDim.h:44
TileCellDim(unsigned int nRows)
std::vector< double > m_rMin
Definition TileCellDim.h:45
double getZMax(unsigned int index) const
void addRMax(double rMax)
double m_Radius2HalfLength
Definition TileCellDim.h:49
void addZMin(double zMin)
std::vector< double > m_rMax
Definition TileCellDim.h:46
double m_volume
Definition TileCellDim.h:49
void print() const
void addZMax(double zMax)
double getRMax(unsigned int index) const
std::vector< double > m_zMax
Definition TileCellDim.h:48
double getZMin(unsigned int index) const
void addRMin(double rMin)
void computeVolume()
double computeRowVolume(int iRow)
double getRMin(unsigned int index) const
Definition index.py:1