ATLAS Offline Software
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 
17 TileCellDim::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 
28 {
29 }
30 
31 double 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 
39 double 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 
47 double 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 
55 double 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 
63 void 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 
71 void 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 
79 void 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 
87 void 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 
112 void TileCellDim::print() const
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 }
TileCellDim::addRMax
void addRMax(double rMax)
Definition: TileCellDim.cxx:71
TileCellDim::m_rMin
std::vector< double > m_rMin
Definition: TileCellDim.h:45
TileCellDim::m_volume
double m_volume
Definition: TileCellDim.h:49
TileCellDim::computeRowVolume
double computeRowVolume(int iRow)
Definition: TileCellDim.cxx:103
TileCellDim::m_zMax
std::vector< double > m_zMax
Definition: TileCellDim.h:48
TileCellDim::TileCellDim
TileCellDim(unsigned int nRows)
Definition: TileCellDim.cxx:17
index
Definition: index.py:1
TileCellDim::computeVolume
void computeVolume()
Definition: TileCellDim.cxx:95
M_PI
#define M_PI
Definition: ActiveFraction.h:11
TileCellDim::m_rMax
std::vector< double > m_rMax
Definition: TileCellDim.h:46
TileCellDim::m_zMin
std::vector< double > m_zMin
Definition: TileCellDim.h:47
TileCellDim::getRMax
double getRMax(unsigned int index) const
Definition: TileCellDim.cxx:39
TileCellDim::addZMin
void addZMin(double zMin)
Definition: TileCellDim.cxx:79
lumiFormat.i
int i
Definition: lumiFormat.py:92
TileCellDim::m_Radius2HalfLength
double m_Radius2HalfLength
Definition: TileCellDim.h:49
TileCellDim::~TileCellDim
~TileCellDim()
Definition: TileCellDim.cxx:27
TileCellDim::addRMin
void addRMin(double rMin)
Definition: TileCellDim.cxx:63
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
TileCellDim::getRMin
double getRMin(unsigned int index) const
Definition: TileCellDim.cxx:31
TileCellDim::m_nRows
unsigned int m_nRows
Definition: TileCellDim.h:44
TileCellDim::getZMax
double getZMax(unsigned int index) const
Definition: TileCellDim.cxx:55
TileCellDim.h
DeMoScan.index
string index
Definition: DeMoScan.py:362
TileCellDim::print
void print() const
Definition: TileCellDim.cxx:112
TileCellDim::addZMax
void addZMax(double zMax)
Definition: TileCellDim.cxx:87
TileCellDim::getZMin
double getZMin(unsigned int index) const
Definition: TileCellDim.cxx:47