CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Point5MaterialMap.h
Go to the documentation of this file.
1 #ifndef Point5MaterialMap_cc
2 #define Point5MaterialMap_cc
3 
4 #include <iostream>
5 #include <cmath>
6 
8 
9 inline int inPlug(double vx, double vy, double vz, double PlugVx = PlugOnShaftVx, double PlugVz = PlugOnShaftVz) {
10  if (vy > SurfaceOfEarth && vy < SurfaceOfEarth + PlugWidth) {
11  if (vx > PlugVx - PlugXlength / 2. && vx < PlugVx + PlugXlength / 2. && vz > PlugVz - PlugZlength / 2. &&
12  vz < PlugVz + PlugZlength / 2.)
13  return Plug;
14  if (vz >= PlugVz - PlugZlength / 2. - PlugNoseZlength && vz < PlugVz - PlugZlength / 2. &&
15  vx > PlugVx - PlugNoseXlength / 2. && vx < PlugVx + PlugNoseXlength / 2.)
16  return Plug;
17  }
18  return Unknown;
19 }
20 
21 inline int inAirAfterPlug(double vx, double vy, double vz) {
22  // particles above surface of earth
23  if (vy >= SurfaceOfEarth)
24  return Air;
25 
26  // CMS cavern (UXC 55)
27  if (std::fabs(vz) < 26548. && sqrt((vx * 1.1576) * (vx * 1.1576) + vy * vy) < 15460. && vy > -8762)
28  return Air;
29 
30  // access shaft (PX 56)
31  if (vy > 0. && vy < (SurfaceOfEarth - 2250.) && sqrt(vx * vx + (vz - Z_PX56) * (vz - Z_PX56)) < 10250.)
32  return Air;
33 
34  //surface hall ground floor
35  if (vy >= SurfaceOfEarth - 2250. && vy < SurfaceOfEarth) {
36  if (sqrt(vx * vx + (vz - Z_PX56) * (vz - Z_PX56)) < 10250. && vz - Z_PX56 > -7000. && vz - Z_PX56 < 7000.)
37  return Air;
38  if (vx > -2400. && vx < 2400. && vz - Z_PX56 >= -9800. && vz - Z_PX56 < -7000.)
39  return Air;
40  }
41 
42  // Shaft (PM 54)
43  if (vy > 3233. && vy < (SurfaceOfEarth) &&
44  sqrt((vx - 26600.) * (vx - 26600.) + (vz - 30100. - Z_PX56) * (vz - 30100. - Z_PX56)) < 6050.)
45  //sqrt((vx-5000.)*(vx-5000.) + (vz-30100.-Z_PX56)*(vz-30100.-Z_PX56)) < 10050.)//@@@@@
46  return Air;
47 
48  // Shaft (PM 56)
49  if (vy > -3700. && vy < (SurfaceOfEarth) &&
50  sqrt((vx - 18220.) * (vx - 18220.) + (vz + 24227. - Z_PX56) * (vz + 24227. - Z_PX56)) < 3550.)
51  return Air;
52 
53  //Service cavern USC 55
54  if (vz > -22050. && vz < 62050. && sqrt((vx - 29550.) * (vx - 29550.) + (vy - 3233.) * (vy - 3233.)) < 9050. &&
55  vy > -3650.)
56  return Air;
57 
58  //UXC55 cavern endcap beam openings
59  if (((vz >= -29278. && vz < -26548.) || (vz >= 26548 && vz <= 29278.)) && sqrt(vy * vy + vx * vx) < 800.)
60  return Air;
61 
62  //Pillar access between CMS collision cavern and service cavern
63  if (vx > 10000. && vx < 20500. + 3050. && //TX54 galerie
64  vz > 14460. && vz < 16260. && //estimated wall thickness 1m
65  vy > -8680. && vy < -1507.)
66  return Air;
67 
68  if (vx > 10000. && vx < 16500. && //TX54 galerie 30.9 degree opening to UXC55
69  vy > -8680. && vy < -1507. && //@vx=13300 delta(vz)=1865., 2vx=1650. delta(vz)=0
70  vz > 14460. - 1865. * (16500. - vx) / (3200.) && vz <= 14460.)
71  return Air;
72 
73  if (vx > 13300. && vx < 20500. + 3050. && //TX54 galerie
74  vz > 14460. && vz < 16260. && //estimated wall thickness 1m
75  vy > -8680. && vy < -1507.)
76  return Air;
77 
78  if (vx > 26600 - 6050. && vx < 20500. + 3050. && //TX54 going up in sewrvice cavern
79  vz > 14460. && vz < 16260. && //estimated wall thickness 1m
80  vy >= -1507. && vy < 1000.)
81  return Air;
82 
83  //R56, LHC beam tunnel East
84  if (vz > -85000. && vz <= -29278. && //UJ57 junction to UXC55 cavern
85  sqrt(vy * vy + (vx - 350.) * (vx - 350.)) < 1900. && vy > -1000.)
86  return Air;
87 
88  //R54, LHC beam tunnel West
89  if (vz >= 29278. && vz < 63000. && //UJ57 junction to UXC55 cavern
90  sqrt(vy * vy + (vx - 350.) * (vx - 350.)) < 1900. && vy > -1000.)
91  return Air;
92 
93  //UJ56 cavern
94  if (vz > -58875. && vz < -33927. && sqrt(vy * vy + (vx - 4450.) * (vx - 4450.)) < 6750. &&
95  vy > -1000. && //and beam shielding
96  !(vx > 2250. && vx < 4250. && (vz > -(33927. + 18000.) || vz < -(33927. + 19500.))) &&
97  !(vx >= 4250. && vx < 6650. && vz > -(33927. + 18000.) && vz < -(33927. + 16000.)))
98  return Air;
99 
100  //connection between PM56 shaft and UJ56 cavern
101  if (vx > 9000. && vx < 18220. &&
102  sqrt((vy - 50.) * (vy - 50.) + (vz + 24227. - Z_PX56) * (vz + 24227. - Z_PX56)) < 3550. && vy > -1000.)
103  return Air;
104 
105  return Unknown;
106 }
107 
108 inline int inWallAfterAir(double vx, double vy, double vz) {
109  // phase II surface building
110  if (vy < SurfaceOfEarth && vy >= (SurfaceOfEarth - 2250.)) {
111  if (std::fabs(vz - Z_PX56) < 30000. && std::fabs(vx) < 10950)
112  return Wall;
113  // foundation of crane
114  if (std::fabs(vz - Z_PX56) < 9000. && std::fabs(vx) >= 10950 && std::fabs(vx) < 16950)
115  return Wall;
116  }
117 
118  // CMS cavern (UXC 55)
119  if (std::fabs(vz) < 29278. && sqrt((vx * 1.1576) * (vx * 1.1576) + vy * vy) < 16830. && vy > -11762.)
120  return Wall;
121 
122  // access shaft (PX 56)
123  if (vy > 0. && vy < (SurfaceOfEarth - 2250.) && //t(shaft wall)=2150.
124  sqrt(vx * vx + (vz - Z_PX56) * (vz - Z_PX56)) < 12400.)
125  return Wall;
126 
127  // Shaft (PM 54)
128  if (vy > 3233. && vy < (SurfaceOfEarth - 1000.) && //t~=t(PX56)/R(PX56)*R(PM54)
129  sqrt((vx - 26600.) * (vx - 26600.) + (vz - 30100. - Z_PX56) * (vz - 30100. - Z_PX56)) <
130  6050. + 2150. / 10250. * 6050.)
131  return Wall;
132  //sqrt((vx-5000.)*(vx-5000.) + (vz-30100.-Z_PX56)*(vz-30100.-Z_PX56))//@@@@@
133  //< 10050.+2150./10250.*6050.) return Wall;//@@@@@
134  else if (vy >= SurfaceOfEarth - 1000. && vy < SurfaceOfEarth && //t~=t(PX56)/R(PX56)*R(PM54)
135  sqrt((vx - 26600.) * (vx - 26600.) + (vz - 30100. - Z_PX56) * (vz - 30100. - Z_PX56)) <
136  6050. + 2150. / 10250. * 6050. + 1800.)
137  return Wall;
138  //sqrt((vx-5000.)*(vx-5000.) + (vz-30100.-Z_PX56)*(vz-30100.-Z_PX56))//@@@@@
139  //< 10050.+2150./10250.*10050. +1800.) return Wall; //@@@@@@
140 
141  // Shaft (PM 56)
142  if (vy > -5450. && vy < (SurfaceOfEarth - 1000.) && //t~=t(PX56)/R(PX56)*R(PM56)
143  sqrt((vx - 18220.) * (vx - 18220.) + (vz + 24227. - Z_PX56) * (vz + 24227. - Z_PX56)) <
144  3550. + 2150. / 10250. * 3550.)
145  return Wall;
146  else if (vy > SurfaceOfEarth - 1000. && vy < SurfaceOfEarth && //t~=t(PX56)/R(PX56)*R(PM56)
147  sqrt((vx - 18220.) * (vx - 18220.) + (vz + 24227. - Z_PX56) * (vz + 24227. - Z_PX56)) <
148  3550. + 2150. / 10250. * 3550. + 1800.)
149  return Wall;
150 
151  //Service cavern USC 55
152  if (vz > -(22050. + 1150.) && vz < (62050. + 1150.) &&
153  sqrt((vx - 29550.) * (vx - 29550.) + (vy - 3233.) * (vy - 3233.)) < 9050. + 950. && vy > -3650. - 2000.)
154  return Wall; //8762=estimate, to be checked
155 
156  //Pillar between CMS collision cavern and service cavern
157  if (vz > -29278. + 1000. && vz < 29278. + 1000.) {
158  if (vy > -17985. && vy < 10410. && vx > 13300. && vx < 20500.)
159  return Wall;
160 
161  if (vy > 0. && vy < 10410. && vx > 10000. && vx <= 13300.)
162  return Wall;
163 
164  if (vy > -3650. - 2000. && vy < -3233. && // bottom edge between pillar and service cavern
165  vx > 20000. && vx < 24000.)
166  return Wall;
167  if (vy > -11762. && vy < -5000. && // bottom edge between pillar and UXC55 cavern
168  vx > 10500. && vx < 14000.)
169  return Wall;
170  }
171 
172  if (vy > -14000. && vy < -1450. && //TX54 galerie surrounding
173  vz > 13460. && vz < 17260. && vx >= 20500. && vx < 24550.)
174  return Wall;
175 
176  //R56, LHC beam tunnel East
177  if (vz > -85000. && vz < -28510.) { //UJ57 junction to UXC55 cavern
178  if (sqrt(vy * vy + (vx - 350.) * (vx - 350.)) < 2250.)
179  return Wall;
180  }
181 
182  //R54, LHC beam tunnel West
183  if (vz > 26550. && vz < 63000. && //UJ57 junction to UXC55 cavern
184  sqrt(vy * vy + (vx - 350.) * (vx - 350.)) < 2250.)
185  return Wall;
186 
187  //UJ56 cavern
188  if (vz > -(58875. + 500.) && vz < -(33927. - 500.) && sqrt(vy * vy + (vx - 4450.) * (vx - 4450.)) < (6750. + 500.) &&
189  vy > -3650.)
190  return Wall;
191 
192  //connection between PM56 shaft and UJ56 cavern
193  if (vx > 9000. && vx < 18220. &&
194  sqrt((vy - 50.) * (vy - 50.) + (vz + 24227. - Z_PX56) * (vz + 24227. - Z_PX56)) < 3550. + 500. && vy > -3650.)
195  return Wall;
196 
197  return Unknown;
198 }
199 
200 inline int inClayOrRockAfterWall(double vx, double vy, double vz, double ClayWidth) {
201  //So, it is not plug, air and wall, Check for clay
202  if (vy >= SurfaceOfEarth - ClayWidth && vy < SurfaceOfEarth)
203  return Clay;
204 
205  //So, it is not plug, air, wall and clay, Check for rock
206  if (vy < SurfaceOfEarth - ClayWidth)
207  return Rock;
208 
209  return Unknown;
210 }
211 
212 inline int inClayAfterWall(double vx, double vy, double vz, double ClayWidth) {
213  //So, it is not plug, air and wall, Check for clay
214  if (vy >= SurfaceOfEarth - ClayWidth && vy < SurfaceOfEarth)
215  return Clay;
216 
217  return Unknown;
218 }
219 
220 inline int inRockAfterClay(double vx, double vy, double vz, double ClayWidth) {
221  //So, it is not plug, air, wall and clay, Check for rock
222  if (vy < SurfaceOfEarth - ClayWidth)
223  return Rock;
224 
225  return Unknown;
226 }
227 
228 inline int inMat(double vx,
229  double vy,
230  double vz,
231  double PlugVx = PlugOnShaftVx,
232  double PlugVz = PlugOnShaftVz,
233  double ClayWidth = DefaultClayWidth) {
234  //check for Plug
235  if (inPlug(vx, vy, vz, PlugVx, PlugVz))
236  return Plug;
237 
238  //So, it is not plug, Check for air
239  if (inAirAfterPlug(vx, vy, vz))
240  return Air;
241 
242  //So, it is not plug and air, Check for wall
243  if (inWallAfterAir(vx, vy, vz))
244  return Wall;
245 
246  //So, it is not plug, air and wall, Check for clay
247  if (vy >= SurfaceOfEarth - ClayWidth && vy < SurfaceOfEarth)
248  return Clay;
249 
250  //So, it is not plug, air, wall and clay, Check for rock
251  if (vy < SurfaceOfEarth - ClayWidth)
252  return Rock;
253 
254  std::cout << "Point5MaterialMap.h: Warning! No Material recognised for point: vx=" << vx << " vy=" << vy
255  << " vz=" << vz << std::endl;
256  //Something went wrong
257  return Unknown;
258 }
259 
260 #endif
int inAirAfterPlug(double vx, double vy, double vz)
const double PlugOnShaftVz
int inClayAfterWall(double vx, double vy, double vz, double ClayWidth)
const double PlugNoseZlength
const double PlugNoseXlength
const double PlugXlength
const double PlugWidth
int inPlug(double vx, double vy, double vz, double PlugVx=PlugOnShaftVx, double PlugVz=PlugOnShaftVz)
const double SurfaceOfEarth
const double PlugOnShaftVx
const double PlugZlength
T sqrt(T t)
Definition: SSEVec.h:19
int inMat(double vx, double vy, double vz, double PlugVx=PlugOnShaftVx, double PlugVz=PlugOnShaftVz, double ClayWidth=DefaultClayWidth)
int inClayOrRockAfterWall(double vx, double vy, double vz, double ClayWidth)
const double Z_PX56
tuple cout
Definition: gather_cfg.py:144
int inRockAfterClay(double vx, double vy, double vz, double ClayWidth)
const double DefaultClayWidth
int inWallAfterAir(double vx, double vy, double vz)