Belle II Software development
ARICHGeoAerogelPlane.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <arich/dbobjects/ARICHGeoAerogelPlane.h>
10#include <math.h>
11#include <iostream>
12#include <iomanip>
13
14using namespace std;
15using namespace Belle2;
16
18{
19
20 if (m_layers.size() == 0 || m_r.size() == 0 || m_dPhi.size() == 0) return false;
21 if (m_tileGap < 0 || m_innerR < 0) return false;
22 if (m_innerR > m_outerR) return false;
23 if (m_thickness < 0 || m_wallThickness < 0 || m_wallHeight < 0) return false;
24
25 if (abs(getWallHeight() - getLayerThickness(1) - getLayerThickness(2)) > 1.0e-10) {
26 cout << "getWallHeight() = " << getWallHeight() << endl
27 << "getLayerThickness(1) = " << getLayerThickness(1) << endl
28 << "getLayerThickness(2) = " << getLayerThickness(2) << endl;
29 cout << "getWallHeight() - getLayerThickness(1) - getLayerThickness(2) = "
31 B2ERROR("Data of the ARICHGeoAerogelPlane is inconsisten : --> abs (getWallHeight() - getLayerThickness(1) - getLayerThickness(2)) > 1.0e-10");
32 }
33
35 const int nn = 10;// Please note it can be any number bigger than number of aero ringth (now it is 4)
36 int nAeroSlotsPerRing[nn];
37 // Define the array with zeros
38 for (int i = 0; i < nn; i++)
39 nAeroSlotsPerRing[i] = 0;
40 for (unsigned i = 0; i < m_tiles.size(); i++)
41 if (m_tiles.at(i).layer == 0)
42 nAeroSlotsPerRing[m_tiles.at(i).ring - 1] += 1;
43 //Check is number of aerogel slots is consistent with number of entries for tiles properties.
44 for (unsigned i = 0; i < getNAeroSlotsIndividualRing().size(); i++) {
45 //cout<<"getNAeroSlotsIndividualRing().at(i) = "<<getNAeroSlotsIndividualRing().at(i)<<endl
46 // <<"nAeroSlotsPerRing[i] = "<<nAeroSlotsPerRing[i]<<endl;
47 B2ASSERT("Data of the ARICHGeoAerogelPlane is inconsisten : --> getNAeroSlotsIndividualRing().at(i) != nAeroSlotsPerRing[i]",
48 getNAeroSlotsIndividualRing().at(i) == nAeroSlotsPerRing[i]);
49 }
50 }
51
52 return true;
53}
54
55void ARICHGeoAerogelPlane::print(const std::string& title) const
56{
58
59 cout << "Full aerogel material description key : " << getFullAerogelMaterialDescriptionKey() << endl;
60
61 cout << "Nume of aerogel rings and number of aerogel slots in individual ring " << endl;
62
63 cout << setw(5) << "Ring"
64 << setw(15) << "Aerogel slots" << endl;
65 for (unsigned i = 0; i < getNAeroSlotsIndividualRing().size(); i++) {
66 cout << setw(5) << i + 1
67 << setw(15) << getNAeroSlotsIndividualRing().at(i) << endl;
68 }
69
70 cout << "Imaginary tube thikness just after aerogel layers : " << getImgTubeThickness() << endl;
71 cout << "Minimum thickness of the compensation volume with ARICH air : " << getCompensationARICHairVolumeThick_min() << endl;
72
73 cout << "Aerogel layers " << endl;
74
75 int nLayer = getNLayers();
76 for (int iLayer = 1; iLayer < nLayer + 1; iLayer++) {
77 cout << " layer " << iLayer << endl;
78 cout << " thickness: " << getLayerThickness(iLayer) << " " << s_unitName << ", ref. index: " << getLayerRefIndex(
79 iLayer) << ", transm. length: " << getLayerTrLength(iLayer) << " " << s_unitName << ", material: " << getLayerMaterial(
80 iLayer) << endl;
81 }
83 cout << " Please note full aerogel material description key is set to 1 " << endl;
84 cout << " The name of each particular tile have this form : Aero1_serA090_rin4_col26 " << endl;
85 cout << " serialID = A090; ring = 4; column = 26; layer = up; " << endl;
86 cout << " The name of each particular tile have this form : Aero2_serB162_rin4_col14 " << endl;
87 cout << " serialID = B162; ring = 4 column = 15; layer = down; " << endl;
88 }
89
90 int nRing = getNRings();
91 cout << " Aluminum walls between tiles parameters" << endl;
92 cout << " thickness: " << getWallThickness() << " " << s_unitName << endl;
93 cout << " height: " << getWallHeight() << " " << s_unitName << endl;
94 for (int iRing = 1; iRing < nRing + 1; iRing++) {
95
96 if (iRing < nRing) cout << " ring: " << iRing << " has inner radius of " << getRingRadius(iRing) << " " << s_unitName << " and "
97 << static_cast<int>(2 * M_PI / getRingDPhi(iRing) + 0.5) << " aerogel tile slots." << endl;
98 else cout << " ring: " << iRing << " has inner radius of " << getRingRadius(iRing) << " " << s_unitName <<
99 " (this is the outer ring)" << endl;
100 }
101
102 cout << " gap between tile and aluminum wall: " << getTileGap() << " " << s_unitName << endl;
103 cout << " inner radius of support plate: " << getSupportInnerR() << " " << s_unitName << endl;
104 cout << " outer radius of support plate: " << getSupportOuterR() << " " << s_unitName << endl;
105 cout << " thickness of support plate: " << getSupportThickness() << " " << s_unitName << endl;
106 cout << " material of support plate: " << getSupportMaterial() << endl;
107
108 cout << "Positioning parameters (in local ARICH frame)" << endl;
110
111 if (isSimple()) {
112 cout << endl << "Simple aerogel configuration is set!" << endl;
113 cout << " Parameters:" << endl;
114 cout << " xSize: " << m_simpleParams.at(0) << ", ySize: " << m_simpleParams.at(1) << ", xPos: " << m_simpleParams.at(
115 2) << ", xPos: " << m_simpleParams.at(3) << ", zRot: " << m_simpleParams.at(4) << endl;
116 }
117
118}
119
120unsigned ARICHGeoAerogelPlane::getAerogelTileID(double x, double y) const
121{
122
123 double r = sqrt(x * x + y * y);
124
125 int nTile = 0;
126 for (unsigned iRing = 0; iRing < getNRings(); iRing++) {
127 if (r > m_r[iRing] + m_wallThickness + m_tileGap) {
128 if (iRing == 0) continue;
129 nTile += static_cast<int>(2 * M_PI / m_dPhi[iRing - 1] + 0.5);
130 } else {
131 if (iRing == 0) return 0;
132 if (r > m_r[iRing] - m_tileGap) return 0;
133 double phi = atan2(y, x);
134 if (phi < 0) phi += 2 * M_PI;
135 int nphi = static_cast<int>(phi / m_dPhi[iRing - 1]);
136 double gapPhi = (m_tileGap + m_wallThickness / 2.) / m_r[iRing];
137 if (phi < nphi * m_dPhi[iRing - 1] + gapPhi || phi > (nphi + 1)* m_dPhi[iRing - 1] - gapPhi) return 0;
138 nTile += nphi;
139 return nTile + 1;
140 }
141
142 }
143 return 0;
144}
145
146unsigned ARICHGeoAerogelPlane::getTileParameters(int ring, int column, int layerN, double& n, double& transmL, double& thick,
147 std::string& material) const
148{
149 n = 0.0;
150 transmL = 0.0;
151 thick = 0.0;
152 material = (char*)"NULL";
153 for (unsigned i = 0; i < m_tiles.size(); i++) {
154 if (m_tiles.at(i).ring == ring) {
155 if (m_tiles.at(i).column == column) {
156 if (m_tiles.at(i).layer == layerN) {
157 n = m_tiles.at(i).n;
158 transmL = m_tiles.at(i).transmL;
159 thick = m_tiles.at(i).thick;
160 material = m_tiles.at(i).material;
161 return i;
162 }
163 }
164 }
165 }
166 B2WARNING("ARICHGeoAerogelPlane::getTileParameters --> tile position does not exist " << endl
167 << "ring = " << ring << endl
168 << "column = " << column << endl
169 << "layerN = " << layerN << endl);
170 B2ASSERT("ARICHGeoAerogelPlane::getTileParameters --> tile position does not exist", false);
171 return 0;
172}
173
174double ARICHGeoAerogelPlane::getTileThickness(int ring, int column, int layerN) const
175{
176 for (unsigned i = 0; i < m_tiles.size(); i++)
177 if (m_tiles.at(i).ring == ring)
178 if (m_tiles.at(i).column == column)
179 if (m_tiles.at(i).layer == layerN)
180 return m_tiles.at(i).thick;
181 B2WARNING("ARICHGeoAerogelPlane::getTileThickness --> tile position does not exist " << endl
182 << "ring = " << ring << endl
183 << "column = " << column << endl
184 << "layerN = " << layerN << endl);
185 B2ASSERT("ARICHGeoAerogelPlane::getTileParameters --> tile position does not exist", false);
186 return 0;
187}
188
189std::string ARICHGeoAerogelPlane::getTileMaterialName(int ring, int column, int layerN) const
190{
191 for (unsigned i = 0; i < m_tiles.size(); i++)
192 if (m_tiles.at(i).ring == ring)
193 if (m_tiles.at(i).column == column)
194 if (m_tiles.at(i).layer == layerN)
195 return m_tiles.at(i).material;
196 B2WARNING("ARICHGeoAerogelPlane::getTileThickness --> tile position does not exist " << endl
197 << "ring = " << ring << endl
198 << "column = " << column << endl
199 << "layerN = " << layerN << endl);
200 B2ASSERT("ARICHGeoAerogelPlane::getTileParameters --> tile position does not exist", false);
201 return NULL;
202}
203
204double ARICHGeoAerogelPlane::getTotalTileThickness(int ring, int column) const
205{
206 double n;
207 double transmL;
208 double thickUp;
209 double thickDown;
210 std::string materialName;
211 getTileParameters(ring, column, 0, n, transmL, thickUp, materialName);
212 getTileParameters(ring, column, 1, n, transmL, thickDown, materialName);
213 //cout << setw(5) << "QWER"
214 // << setw(10) << ring
215 // << setw(10) << column
216 // << setw(10) << thickUp
217 // << setw(10) << thickDown <<endl;
218 return thickUp + thickDown;
219}
220
222{
223 double maxThick = 0.0;
224 // ring ID (range : [ 1, 2, 3, 4])
225 // column ID (range : [1;22] [1;28] [1;34] [1;40])
226 for (unsigned iR = 0; iR < getNAeroSlotsIndividualRing().size(); iR++) {
227 int iRi = iR;
228 for (int iS = 0; iS < getNAeroSlotsIndividualRing().at(iR); iS++) {
229 double athick = getTotalTileThickness(iRi + 1, iS + 1);
230 if (maxThick < athick)
231 maxThick = athick;
232 }
233 }
234 return maxThick;
235}
236
237void ARICHGeoAerogelPlane::printTileParameters(const std::string& title) const
238{
239 ARICHGeoBase::print(title);
240 cout << setw(5) << "i"
241 << setw(10) << "ring"
242 << setw(10) << "column"
243 << setw(10) << "layer"
244 << setw(12) << "n"
245 << setw(12) << "transmL"
246 << setw(12) << "thick"
247 << setw(30) << "material" << endl;
248 for (unsigned i = 0; i < m_tiles.size(); i++) {
249 cout << setw(5) << i
250 << setw(10) << m_tiles.at(i).ring
251 << setw(10) << m_tiles.at(i).column
252 << setw(10) << m_tiles.at(i).layer
253 << setw(12) << m_tiles.at(i).n
254 << setw(12) << m_tiles.at(i).transmL
255 << setw(12) << m_tiles.at(i).thick
256 << setw(30) << m_tiles.at(i).material << endl;
257 }
258}
259
261{
262 cout << "ARICHGeoAerogelPlane::printSingleTileParameters" << endl;
263 B2ASSERT("Aerogel tile property entry does not exist i >= m_tiles.size() ", i < m_tiles.size());
264 cout << setw(5) << "i"
265 << setw(10) << "ring"
266 << setw(10) << "column"
267 << setw(10) << "layer"
268 << setw(12) << "n"
269 << setw(12) << "transmL"
270 << setw(12) << "thick"
271 << setw(30) << "material" << endl;
272 cout << setw(5) << i
273 << setw(10) << m_tiles.at(i).ring
274 << setw(10) << m_tiles.at(i).column
275 << setw(10) << m_tiles.at(i).layer
276 << setw(12) << m_tiles.at(i).n
277 << setw(12) << m_tiles.at(i).transmL
278 << setw(12) << m_tiles.at(i).thick
279 << setw(30) << m_tiles.at(i).material << endl;
280}
281
283{
284 int ring = 1;
285 int column = 1;
286 int layerN = 0;
287 double n;
288 double transmL;
289 double thick;
290 std::string materialName;
291 printSingleTileParameters(getTileParameters(ring, column, layerN, n, transmL, thick, materialName));
292 ring = 1;
293 column = 1;
294 layerN = 1;
295 printSingleTileParameters(getTileParameters(ring, column, layerN, n, transmL, thick, materialName));
296 ring = 3;
297 column = 20;
298 layerN = 0;
299 printSingleTileParameters(getTileParameters(ring, column, layerN, n, transmL, thick, materialName));
300 ring = 3;
301 column = 20;
302 layerN = 1;
303 printSingleTileParameters(getTileParameters(ring, column, layerN, n, transmL, thick, materialName));
304 ring = -3;
305 column = 20;
306 layerN = 1;
307 printSingleTileParameters(getTileParameters(ring, column, layerN, n, transmL, thick, materialName));
308}
std::vector< double > m_r
"r" aluminum wall radiuses
double m_tileGap
gap between aerogel tiles and aluminum walls
bool isConsistent() const override
Consistency check of geometry parameters.
bool isSimple() const
Use simple aerogel configuration.
double getLayerThickness(unsigned iLayer) const
Get thickness of tiles in i-th aerogel layer.
double m_innerR
inner radius of support plate
double getSupportThickness() const
Get support-plate thickness.
unsigned getNRings() const
Get number of aluminum wall rings (should be number of tile rings + 1).
double getSupportOuterR() const
Get support-plate outer radius.
std::vector< tilestr > m_tiles
parameters of the individual aerogel tiles
double getCompensationARICHairVolumeThick_min() const
Get minimum thickness of the compensation volume with ARICH air.
void printSingleTileParameters(unsigned i) const
Print the content of the single tilestr structure.
std::vector< double > m_dPhi
"phi" aluminum wall distances in tile ring
double getImgTubeThickness() const
Get imaginary tube thikness just after aerogel layers used as volume to which tracks are extrapolated...
double getWallHeight() const
Get height of aluminum walls between aerogel tiles.
std::vector< double > m_simpleParams
vector of simple parameters
double m_ry
rotation around y-axis
void print(const std::string &title="Aerogel plane parameters:") const override
Print the content of the class.
double getLayerTrLength(unsigned iLayer) const
Get transmission length of tiles in i-th aerogel layer.
double getTotalTileThickness(int ring, int column) const
Get total thickness of the aerogel tiles tile_up + tile_down for a given slot.
double getRingDPhi(unsigned iRing) const
Get phi (angle) distance between "phi" aluminum wall between aerogel tiles in i-th tile ring.
void printTileParameters(const std::string &title="Aerogel tiles parameters:") const
Print the content of the m_tiles vector of tilestr structure.
double m_thickness
thickness of support plate
double getTileThickness(int ring, int column, int layerN) const
Get thickness of individual tile.
double m_wallHeight
height (z) of aluminum walls between aerogel tiles
const std::string & getLayerMaterial(unsigned iLayer) const
Get material name of tiles in i-th aerogel layer.
const std::string & getSupportMaterial() const
Get material of support plate.
std::vector< layer > m_layers
parameters averaged properties of the aerogel tiles/layers (up and down)
double getLayerRefIndex(unsigned iLayer) const
Get refractive index of tiles in i-th aerogel layer.
void testGetTileParametersFunction() const
This function tests the getTileParameters function.
double getWallThickness() const
Get thickness of aluminum walls between aerogel tiles.
double getRingRadius(unsigned iRing) const
Get radius of i-th aluminum ring between aerogel tiles (inner radius of ring).
double m_outerR
outer radius of support plate
double m_wallThickness
thickness of aluminum walls between aerogel tiles
unsigned getNLayers() const
Get number of aerogel layers.
double getSupportInnerR() const
Get support-plate inner radius.
double m_rz
rotation around z-axis
int getFullAerogelMaterialDescriptionKey() const
Get full aerogel material description key.
unsigned getAerogelTileID(double x, double y) const
Get ID of aerogel tile containing point (x,y) (actually this is tile slot ID, as it is the same for a...
const std::vector< int > & getNAeroSlotsIndividualRing() const
Get vector of numbers of aerogel slots in individual ring.
std::string getTileMaterialName(int ring, int column, int layerN) const
Get material name of individual tile.
double getMaximumTotalTileThickness() const
Get maximum total thickness of the aerogel tiles tile_up + tile_down for all the slots.
double m_rx
rotation around x-axis
double getTileGap() const
Get gap between aerogel tile and aluminum wall.
unsigned getTileParameters(int ring, int column, int layerN, double &n, double &transmL, double &thick, std::string &material) const
Get parameters of individual tile.
virtual void printPlacement(double x, double y, double z, double rx, double ry, double rz) const
Print volume positioning parameters.
Definition: ARICHGeoBase.cc:25
virtual void print(const std::string &title) const
Print the content of the class.
Definition: ARICHGeoBase.cc:20
static std::string s_unitName
conversion unit name
Definition: ARICHGeoBase.h:84
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Abstract base class for different kinds of events.
STL namespace.