CMS 3D CMS Logo

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