FairRoot/PandaRoot
createSTTwithPassive.C
Go to the documentation of this file.
1 // *******************************************************************************
2 // if you want to include the passive elements:
3 // - reduce the length of the tubes (tubeLength) -4 mm
4 // - flag passive = true
5 // if you want to reduce the tube length:
6 // - change tubeLength
7 // - change sttCenterZ
8 // - length and number of the short skewed straws is changed automatically
9 // *******************************************************************************
10 
11 #include <iostream>
12 #include <iomanip>
13 #include <fstream>
14 #include <math.h>
15 #include <string>
16 #include <sstream>
17 #include <vector>
18 
19 using namespace std;
20 
21 static int counter1;
22 static int counter2;
23 static int counter3;
24 static int counter4;
25 static int counter5;
26 static int counter6;
27 
28 bool passive;
29 
30 //--------------------------------------------geometry definitions (cm)
31 #define outerDiam 84.4000 // 84.0000
32 #define innerDiam 30.0000 // 32.0000
33 #define tubeInnerDiam 1.0000
34 #define tubeOuterDiam 1.0060
35 // #define tubeSeperation 1.0100 // <<=== this HAS to be the tubeOuterDiam!! CHECK
37 #define wireDiam 0.0020
38 #define tubeLength 119.6000 // (120.0000 without passive elements)
39 // #define shortTube1 17.1000
40 // #define shortTube2 37.1000
41 // #define shortTube3 57.1000
42 // #define shortTube4 77.1000
43 // #define shortTube5 97.1000
44 #define endcapInnerDiam 0.9000
45 #define endcapOuterDiam 0.9950
46 #define endcapLength 0.7200
47 #define topcapInnerDiam 0.1000
48 #define topcapLength 0.0800
49 #define crimppinLength 1.2000
50 #define beltInnerDiam 0.3100
51 #define beltLength 0.0800
52 #define beltDistance 0.2000
53 #define gassupplyInnerDiam 0.0500
54 #define gassupplyOuterDiam 0.0800
55 #define gassupplyLength 3.0000
56 #define gassupplyTransY 0.4000
57 #define ringInnerDiam 0.9500
58 #define ringLength 0.0250
59 #define springInnerDiam 0.5000
60 #define springOuterDiam 0.5500
61 #define springLength 0.1000
62 #define noseOuterDiam 0.3000
63 #define noseLength 0.5000
64 
65 #define safety 0.2000
66 
67 #define sttCenterX 0.
68 #define sttCenterY 0.
69 // (tubeLength+0.4)/2 - 40
70 #define sttCenterZ 20.
71 
72 #define innerCoverThickness 1.0000 // 1.200 // 0.1000 cm
73 #define outerCoverThickness 1.2000 // 1.200 // 0.1000 cm
74 
75 #define panelthickness 0.1000
76 #define pipeDiam 4.0800
77 #define noSupport 0
78 
79 #define skewangle 3.
80 
81 #define pi 3.141592653589793238512808959406186204433
82 
83 #define cave "cave"
84 #define sttassembly "stt01assembly"
85 #define innerCylinder "stt01innerCylinder"
86 #define outerCylinder "stt01outerCylinder"
87 #define panel1 "stt01box#1"
88 #define panel2 "stt01box#2"
89 #define panel3 "stt01box#3"
90 #define panel4 "stt01box#4"
91 
92 // materials
93 #define air "air"
94 #define AlBe "carbon"
95 #define mylar "mylar"
96 #define GasMixture "argon"
97 #define W "tungsten"
98 #define ABS "carbon" // to be defined
99 #define PVC "carbon" // to be defined
100 #define Cu "copper"
101 #define CuBe "copper" // to be defined
102 #define GFK "carbon" // to be defined
103 
104 static int tubeteller;
105 static int axialtubeteller;
106 static int skewedtubeteller;
108 static double maximumradius = 0;
109 static double minimumradius = 100000;
110 
111 // fuctions to write part of the declaration
112 void writename(char const *name, bool support = false, bool leftside = false)
113 {
114  if(support && leftside) cout << name << "#1" << endl;
115  else if(support && !leftside) cout << name << "#2" << endl;
116  else cout << name << endl;
117  counter1++;
118 }
119 
120 void writemother(char const *name, bool original = true, bool support = false, bool firsttube = false)
121 {
122  cout << name << endl;
123  if ((original && !support && firsttube) || (original && support && firsttube))
124  cout << "ASSEMBLY" << endl;
125  if (original && !support && !firsttube)
126  cout << "TUBE" << endl;
127  if(original && support && !firsttube)
128  cout << "TUBS" << endl;
129  counter2++;
130 }
131 
132 void writemedium(char *name)
133 {
134  cout << name << endl;
135  counter3++;
136 }
137 
138 void writetube(double inner, double outer, double length)
139 {
140  cout << 0. << " " << 0. << " " << -1. * length * 10. << endl;
141  cout << inner * 10. << " " << outer * 10. << endl;
142  cout << 0. << " " << 0. << " " << length * 10. << endl;
143  counter4++;
144 }
145 
146 void writehalftube(double inner, double outer, double length)
147 {
148  cout << 0. << " " << 0. << " " << -1. * length * 10. << endl;
149  cout << inner * 10. << " " << outer * 10. << endl;
150  cout << 0. << " " << 0. << " " << length * 10. << endl;
151  cout << atan((pipeDiam/2.)/outer) * (180. / pi) << " " << 180. - atan((pipeDiam/2.)/outer) * (180. / pi) << endl;
152  counter4++;
153 }
154 
155 void writepanel(char const *name, bool firstone, double xthick, double ythick, double length, int side)
156 {
157  xthick *= 10.;
158  ythick *= 10.;
159  length *= 10.;
160 
161  if(firstone) {
162  cout << name << endl;
163  cout << sttassembly << endl;
164  cout << "BOX" << endl;
165  cout << AlBe << endl;
166  cout << xthick/2. << " " << ythick/2. << " " << length / 2. << endl;
167  cout << -xthick/2. << " " << ythick/2. << " " << length / 2. << endl;
168  cout << xthick/2. << " " << ythick/2. << " " << -length / 2. << endl;
169  cout << -xthick/2. << " " << ythick/2. << " " << -length / 2. << endl;
170  cout << xthick/2. << " " << -ythick/2. << " " << length / 2. << endl;
171  cout << -xthick/2. << " " << -ythick/2. << " " << length / 2. << endl;
172  cout << xthick/2. << " " << -ythick/2. << " " << -length / 2. << endl;
173  cout << -xthick/2. << " " << -ythick/2. << " " << -length / 2. << endl;
174  }
175  else {
176  cout << name << endl;
177  cout << sttassembly << endl;
178  }
179 
180 }
181 
182 
183 void writetrans(double x, double y, double z)
184 {
185  cout << x * 10. << " " << y * 10. << " " << z * 10. << endl;
186  counter5++;
187 }
188 
189 void writerot(double x00, double x01, double x02, double x10, double x11, double x12, double x20, double x21, double x22)
190 {
191  cout << x00 << " " << x01 << " " << x02 << " "
192  << x10 << " " << x11 << " " << x12 << " "
193  << x20 << " " << x21 << " " << x22 << endl;
194  cout << "//----------------------------------------------------------" << endl;
195  counter6++;
196 }
197 
198 // write the declaration of a complete straw
199 bool putStraw(double posX, double posY, double posZ)
200 {
201 
202  // CHECK PIPE
203  if(posX > -(pipeDiam/2. + panelthickness + tubeOuterDiam/2.) && posX < (pipeDiam/2. + panelthickness + tubeOuterDiam/2.)) return false;
204 
205  // check if the straws fit wihin the inner and outer diameter specified
206  if (
207  (sqrt(posX * posX + posY * posY) < ((outerDiam / 2.) - outerCoverThickness - (tubeOuterDiam / 2.))) &&
208  (sqrt(posX * posX + posY * posY) > ((innerDiam / 2.) + innerCoverThickness + (tubeOuterDiam / 2.)))
209  )
210  {
211  // convert int to string
212  stringstream
213  conv;
214 
215  string
216  tubetellerStr;
217 
218  conv << tubeteller + 1;
219  conv >> tubetellerStr;
220 
221  string
222  nameItube = "stt01tube#" + tubetellerStr,
223  nameIwall = "stt01wall#" + tubetellerStr,
224  nameIgas = "stt01gas#" + tubetellerStr,
225  nameIwire = "stt01wire#" + tubetellerStr,
226  nameIendcap = "stt01endcap",
227  nameItopcap = "stt01topcap",
228  nameIcrimppin = "stt01crimppin",
229  nameIbelt = "stt01belt",
230  nameIgassupply = "stt01gassupply",
231  nameIring = "stt01ring",
232  nameIspring = "stt01spring",
233  nameInose = "stt01nose";
234 
235  // keep track of minimum and maximum extend of the straw package
236  if (sqrt(posX * posX + posY * posY) - (tubeOuterDiam / 2.) < minimumradius)
237  {
238  minimumradius = sqrt(posX * posX + posY * posY) - (tubeOuterDiam / 2.);
239  }
240  if (sqrt(posX * posX + posY * posY) + (tubeOuterDiam / 2.) > maximumradius)
241  {
242  maximumradius = sqrt(posX * posX + posY * posY) + (tubeOuterDiam / 2.);
243  }
244 
245  // place the tube
246  if (tubeteller == 0)
247  {
248  // original tube
249  writename(nameItube.c_str());
250  writemother(sttassembly, 1, 0, 1);
251  writemedium(air);
252  writetrans(posX, posY, posZ);
253  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
254 
255  // Mylar wall
256  writename(nameIwall.c_str());
257  writemother(nameItube.c_str());
259  writetube(0, tubeOuterDiam / 2., tubeLength / 2.);
260  writetrans(0., 0., 0.);
261  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
262 
263  // Gas filling
264  writename(nameIgas.c_str());
265  writemother(nameIwall.c_str());
267  writetube(0., tubeInnerDiam / 2., tubeLength / 2.);
268  writetrans(0., 0., 0.);
269  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
270 
271  // Anode wire
272  writename(nameIwire.c_str());
273  writemother(nameIgas.c_str());
274  writemedium(W);
275  writetube(0., wireDiam / 2., tubeLength / 2.);
276  writetrans(0., 0., 0.);
277  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
278 
279  if (passive) {
280  // Endcaps
281  writename(nameIendcap.c_str(), 1, 1);
282  writemother(nameIgas.c_str());
283  writemedium(ABS);
285  writetrans(0., 0., (tubeLength / 2. - topcapLength - endcapLength / 2.));
286  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
287 
288  writename(nameIendcap.c_str(), 1, 0);
289  writemother(nameIgas.c_str(), false);
290  writetrans(0., 0., -(tubeLength / 2. - topcapLength - endcapLength / 2.));
291  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
292 
293  // Top cap
294  writename(nameItopcap.c_str(), 1, 1);
295  writemother(nameIgas.c_str());
296  writemedium(ABS);
298  writetrans(0., 0., (tubeLength / 2. - topcapLength / 2.));
299  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
300 
301  writename(nameItopcap.c_str(), 1, 0);
302  writemother(nameIgas.c_str(), false);
303  writetrans(0., 0., -(tubeLength / 2. - topcapLength / 2.));
304  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
305 
306  // Crimp pin
307  writename(nameIcrimppin.c_str(), 1, 1);
308  writemother(nameItube.c_str());
309  writemedium(Cu);
311  writetrans(0., 0., (tubeLength / 2. + crimppinLength / 2.));
312  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
313 
314  writename(nameIcrimppin.c_str(), 1, 0);
315  writemother(nameItube.c_str(), false);
316  writetrans(0., 0., -(tubeLength / 2. + crimppinLength / 2.));
317  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
318 
319  // Belt
320  writename(nameIbelt.c_str(), 1, 1);
321  writemother(nameItube.c_str());
322  writemedium(GFK);
324  writetrans(0., 0., (tubeLength / 2. + beltDistance + beltLength / 2.));
325  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
326 
327  writename(nameIbelt.c_str(), 1, 0);
328  writemother(nameItube.c_str(), false);
329  writetrans(0., 0., -(tubeLength / 2. + beltDistance + beltLength / 2.));
330  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
331 
332  // Gas supply
333  writename(nameIgassupply.c_str(), 1, 1);
334  writemother(nameItube.c_str());
335  writemedium(PVC);
338  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
339 
340  writename(nameIgassupply.c_str(), 1, 0);
341  writemother(nameItube.c_str(), false);
343  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
344 
345  // Ring
346  writename(nameIring.c_str(), 1, 1);
347  writemother(nameItube.c_str());
348  writemedium(CuBe);
350  writetrans(0., 0., (tubeLength / 2. + ringLength / 2.));
351  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
352 
353  writename(nameIring.c_str(), 1, 0);
354  writemother(nameItube.c_str(), false);
355  writetrans(0., 0., -(tubeLength / 2. + ringLength / 2.));
356  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
357 
358  // Spring
359  writename(nameIspring.c_str(), 1, 1);
360  writemother(nameItube.c_str());
361  writemedium(CuBe);
363  writetrans(0., 0., (tubeLength / 2. + springLength / 2.));
364  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
365 
366  writename(nameIspring.c_str(), 1, 0);
367  writemother(nameItube.c_str(), false);
368  writetrans(0., 0., -(tubeLength / 2. + springLength / 2.));
369  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
370 
371  // Nose
372  writename(nameInose.c_str(), 1, 1);
373  writemother(nameItube.c_str());
374  writemedium(ABS);
376  writetrans(0., 0., (tubeLength/2. + noseLength/2.));
377  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
378 
379  writename(nameInose.c_str(), 1, 0);
380  writemother(nameItube.c_str(), false);
381  writetrans(0., 0., -(tubeLength/2. + noseLength/2.));
382  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
383  }
384  }
385  else
386  {
387  // copy
388  writename(nameItube.c_str());
389  writemother(sttassembly, false);
390  writetrans(posX, posY, posZ);
391  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
392  }
393  tubeteller++;
394  axialtubeteller++;
395  }
396  else
397  {
398  return false;
399  }
400 
401  return true;
402 }
403 
404 // write the rotation matrix for a right skewed straw
405 void plotrotright(double x, double y, double z)
406 {
407  double
408  newskewangle = skewangle * -1.;
409 
410  cout << 1 + (1 - cos(newskewangle * (pi / 180.))) * (x * x - 1) << " "
411  << -z * sin(newskewangle * (pi / 180.)) + (1 - cos(newskewangle * (pi / 180.))) * x * y << " "
412  << y * sin(newskewangle * (pi / 180.)) + (1 - cos(newskewangle * (pi / 180.))) * x * z << " "
413 
414  << z * sin(newskewangle * (pi / 180.)) + (1 - cos(newskewangle * (pi / 180.))) * x * y << " "
415  << 1 + (1 - cos(newskewangle * (pi / 180.))) * (y * y - 1) << " "
416  << -x * sin(newskewangle * (pi / 180.)) + (1 - cos(newskewangle * (pi / 180.))) * y * z << " "
417 
418  << -y * sin(newskewangle * (pi / 180.)) + (1 - cos(newskewangle * (pi / 180.))) * x * z << " "
419  << x * sin(newskewangle * (pi / 180.)) + (1 - cos(newskewangle * (pi / 180.))) * y * z << " "
420  << 1 + (1 - cos(newskewangle * (pi / 180.))) * (z * z - 1) << endl;
421  cout << "//----------------------------------------------------------" << endl;
422  counter6++;
423 }
424 
425 // write the rotation matrix for a left skewed straw
426 void plotrotleft(double x, double y, double z)
427 {
428  cout << 1 + (1 - cos(skewangle * (pi / 180.))) * (x * x - 1) << " "
429  << -z * sin(skewangle * (pi / 180.)) + (1 - cos(skewangle * (pi / 180.))) * x * y << " "
430  << y * sin(skewangle * (pi / 180.)) + (1 - cos(skewangle * (pi / 180.))) * x * z << " "
431 
432  << z * sin(skewangle * (pi / 180.)) + (1 - cos(skewangle * (pi / 180.))) * x * y << " "
433  << 1 + (1 - cos(skewangle * (pi / 180.))) * (y * y - 1) << " "
434  << -x * sin(skewangle * (pi / 180.)) + (1 - cos(skewangle * (pi / 180.))) * y * z << " "
435 
436  << -y * sin(skewangle * (pi / 180.)) + (1 - cos(skewangle * (pi / 180.))) * x * z << " "
437  << x * sin(skewangle * (pi / 180.)) + (1 - cos(skewangle * (pi / 180.))) * y * z << " "
438  << 1 + (1 - cos(skewangle * (pi / 180.))) * (z * z - 1) << endl;
439  cout << "//----------------------------------------------------------" << endl;
440  counter6++;
441 }
442 
443 bool putStrawRotatedShortLeft(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
444 {
445 
446  double extr1 = posX + (length/2.) * sin(skewangle);
447  double extr2 = posX - (length/2.) * sin(skewangle);
448 
449  if (length > 0.)
450  {
451  // convert int to string
452  stringstream
453  conv;
454 
455  string
456  tubetellerStr;
457 
458  conv << tubeteller + 1;
459  conv >> tubetellerStr;
460 
461  string
462  nameItube = "stt01tube" + tubetellerStr,
463  nameIwall = "stt01wall" + tubetellerStr,
464  nameIgas = "stt01gas" + tubetellerStr,
465  nameIwire = "stt01wire" + tubetellerStr,
466  nameIendcap = "stt01endcap",
467  nameItopcap = "stt01topcap",
468  nameIcrimppin = "stt01crimppin",
469  nameIbelt = "stt01belt",
470  nameIgassupply = "stt01gassupply",
471  nameIring = "stt01ring",
472  nameIspring = "stt01spring",
473  nameInose = "stt01nose";
474 
475  // N.B. we don't use copies here since the short straws are all different in length
476  writename(nameItube.c_str());
477  writemother(sttassembly, 1, 0, 1);
478  writemedium(air);
479  writetrans(posX, posY, posZ);
480  plotrotleft(xvector, yvector, zvector);
481 
482  // Mylar wall
483  writename(nameIwall.c_str());
484  writemother(nameItube.c_str());
486  writetube(0, tubeOuterDiam / 2., length / 2.);
487  writetrans(0., 0., 0.);
488  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
489 
490  // Gas filling
491  writename(nameIgas.c_str());
492  writemother(nameItube.c_str());
494  writetube(0., tubeInnerDiam / 2., length / 2.);
495  writetrans(0., 0., 0.);
496  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
497 
498  // Anode wire
499  writename(nameIwire.c_str());
500  writemother(nameIgas.c_str());
501  writemedium(W);
502  writetube(0., wireDiam / 2., length / 2.);
503  writetrans(0., 0., 0.);
504  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
505 
506  if (passive) {
507  // Endcaps
508  writename(nameIendcap.c_str(), 1, 1);
509  writemother(nameIgas.c_str(), false);
510  writetrans(0., 0., length / 2. - topcapLength - endcapLength / 2.);
511  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
512 
513  writename(nameIendcap.c_str(), 1, 0);
514  writemother(nameIgas.c_str(), false);
515  writetrans(0., 0., -(length / 2. - topcapLength - endcapLength / 2.));
516  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
517 
518  // Top cap
519  writename(nameItopcap.c_str(), 1, 1);
520  writemother(nameIgas.c_str(), false);
521  writetrans(0., 0., (length / 2. - topcapLength / 2.));
522  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
523 
524  writename(nameItopcap.c_str(), 1, 0);
525  writemother(nameIgas.c_str(), false);
526  writetrans(0., 0., -(length / 2. - topcapLength / 2.));
527  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
528 
529  // Crimp pin
530  writename(nameIcrimppin.c_str(), 1, 1);
531  writemother(nameItube.c_str(), false);
532  writetrans(0., 0., (length / 2. + crimppinLength / 2.));
533  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
534 
535  writename(nameIcrimppin.c_str(), 1, 0);
536  writemother(nameItube.c_str(), false);
537  writetrans(0., 0., -(length / 2. + crimppinLength / 2.));
538  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
539 
540  // Belt
541  writename(nameIbelt.c_str(), 1, 1);
542  writemother(nameItube.c_str(), false);
543  writetrans(0., 0., (length / 2. + beltDistance + beltLength / 2.));
544  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
545 
546  writename(nameIbelt.c_str(), 1, 0);
547  writemother(nameItube.c_str(), false);
548  writetrans(0., 0., -(length / 2. + beltDistance + beltLength / 2.));
549  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
550 
551  // Gas supply
552  writename(nameIgassupply.c_str(), 1, 1);
553  writemother(nameItube.c_str(), false);
554  writetrans(0., gassupplyTransY, (length / 2. + beltDistance + beltLength + gassupplyLength / 2.));
555  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
556 
557  writename(nameIgassupply.c_str(), 1, 0);
558  writemother(nameItube.c_str(), false);
559  writetrans(0., gassupplyTransY, -(length / 2. + beltDistance + beltLength + gassupplyLength / 2.));
560  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
561 
562  // Ring
563  writename(nameIring.c_str(), 1, 1);
564  writemother(nameItube.c_str(), false);
565  writetrans(0., 0., (length / 2. + ringLength / 2.));
566  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
567 
568  writename(nameIring.c_str(), 1, 0);
569  writemother(nameItube.c_str(), false);
570  writetrans(0., 0., -(length / 2. + ringLength / 2.));
571  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
572 
573  // Spring
574  writename(nameIspring.c_str(), 1, 1);
575  writemother(nameItube.c_str(), false);
576  writetrans(0., 0., (length / 2. + springLength / 2.));
577  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
578 
579  writename(nameIspring.c_str(), 1, 0);
580  writemother(nameItube.c_str(), false);
581  writetrans(0., 0., -(length / 2. + springLength / 2.));
582  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
583 
584  // Nose
585  writename(nameInose.c_str(), 1, 1);
586  writemother(nameItube.c_str(), false);
587  writetrans(0., 0., (length/2. + noseLength/2.));
588  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
589 
590  writename(nameInose.c_str(), 1, 0);
591  writemother(nameItube.c_str(), false);
592  writetrans(0., 0., -(length/2. + noseLength/2.));
593  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
594  }
595 
596  tubeteller++;
598 
599 
600  return true;
601  }
602 }
603 
604 bool putStrawRotatedShortRight(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
605 {
606  double extr1 = posX + (length/2.) * sin(skewangle);
607  double extr2 = posX - (length/2.) * sin(skewangle);
608 
609  if (length > 0.)
610  {
611 
612 
613 
614  // convert int to string
615  stringstream
616  conv;
617 
618  string
619  tubetellerStr;
620 
621  conv << tubeteller + 1;
622  conv >> tubetellerStr;
623 
624  string
625  nameItube = "stt01tube" + tubetellerStr,
626  nameIwall = "stt01wall" + tubetellerStr,
627  nameIgas = "stt01gas" + tubetellerStr,
628  nameIwire = "stt01wire" + tubetellerStr,
629  nameIendcap = "stt01endcap",
630  nameItopcap = "stt01topcap",
631  nameIcrimppin = "stt01crimppin",
632  nameIbelt = "stt01belt",
633  nameIgassupply = "stt01gassupply",
634  nameIring = "stt01ring",
635  nameIspring = "stt01spring",
636  nameInose = "stt01nose";
637 
638  // N.B. don't use copies here since all short straws have different length
639  writename(nameItube.c_str());
640  writemother(sttassembly, 1, 0, 1);
641  writemedium(air);
642  writetrans(posX, posY, posZ);
643  plotrotright(xvector, yvector, zvector);
644 
645  // Mylar wall
646  writename(nameIwall.c_str());
647  writemother(nameItube.c_str());
649  writetube(0, tubeOuterDiam / 2., length / 2.);
650  writetrans(0., 0., 0.);
651  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
652 
653  // Gas filling
654  writename(nameIgas.c_str());
655  writemother(nameItube.c_str());
657  writetube(0., tubeInnerDiam / 2., length / 2.);
658  writetrans(0., 0., 0.);
659  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
660 
661  // Anode wire
662  writename(nameIwire.c_str());
663  writemother(nameIgas.c_str());
664  writemedium(W);
665  writetube(0., wireDiam / 2., length / 2.);
666  writetrans(0., 0., 0.);
667  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
668 
669  if (passive) {
670  // Endcaps
671  writename(nameIendcap.c_str(), 1, 1);
672  writemother(nameIgas.c_str(), false);
673  writetrans(0., 0., length / 2. - topcapLength - endcapLength / 2.);
674  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
675 
676  writename(nameIendcap.c_str(), 1, 0);
677  writemother(nameIgas.c_str(), false);
678  writetrans(0., 0., -(length / 2. - topcapLength - endcapLength / 2.));
679  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
680 
681  // Top cap
682  writename(nameItopcap.c_str(), 1, 1);
683  writemother(nameIgas.c_str(), false);
684  writetrans(0., 0., (length / 2. - topcapLength / 2.));
685  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
686 
687  writename(nameItopcap.c_str(), 1, 0);
688  writemother(nameIgas.c_str(), false);
689  writetrans(0., 0., -(length / 2. - topcapLength / 2.));
690  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
691 
692  // Crimp pin
693  writename(nameIcrimppin.c_str(), 1, 1);
694  writemother(nameItube.c_str(), false);
695  writetrans(0., 0., (length / 2. + crimppinLength / 2.));
696  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
697 
698  writename(nameIcrimppin.c_str(), 1, 0);
699  writemother(nameItube.c_str(), false);
700  writetrans(0., 0.,-(length / 2. + crimppinLength / 2.));
701  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
702 
703  // Belt
704  writename(nameIbelt.c_str(), 1, 1);
705  writemother(nameItube.c_str(), false);
706  writetrans(0., 0., (length / 2. + beltDistance + beltLength / 2.));
707  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
708 
709  writename(nameIbelt.c_str(), 1, 0);
710  writemother(nameItube.c_str(), false);
711  writetrans(0., 0., -(length / 2. + beltDistance + beltLength / 2.));
712  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
713 
714  // Gas supply
715  writename(nameIgassupply.c_str(), 1, 1);
716  writemother(nameItube.c_str(), false);
717  writetrans(0., gassupplyTransY, (length / 2. + beltDistance + beltLength + gassupplyLength / 2.));
718  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
719 
720  writename(nameIgassupply.c_str(), 1, 0);
721  writemother(nameItube.c_str(), false);
722  writetrans(0., gassupplyTransY, -(length / 2. + beltDistance + beltLength + gassupplyLength / 2.));
723  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
724 
725  // Ring
726  writename(nameIring.c_str(), 1, 1);
727  writemother(nameItube.c_str(), false);
728  writetrans(0., 0., (length / 2. + ringLength / 2.));
729  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
730 
731  writename(nameIring.c_str(), 1, 0);
732  writemother(nameItube.c_str(), false);
733  writetrans(0., 0., -(length / 2. + ringLength / 2.));
734  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
735 
736  // Spring
737  writename(nameIspring.c_str(), 1, 1);
738  writemother(nameItube.c_str(), false);
739  writetrans(0., 0., (length / 2. + springLength / 2.));
740  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
741 
742  writename(nameIspring.c_str(), 1, 0);
743  writemother(nameItube.c_str(), false);
744  writetrans(0., 0., -(length / 2. + springLength / 2.));
745  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
746 
747  // Nose
748  writename(nameInose.c_str(), 1, 1);
749  writemother(nameItube.c_str(), false);
750  writetrans(0., 0., (length/2. + noseLength/2.));
751  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
752 
753  writename(nameInose.c_str(), 1, 0);
754  writemother(nameItube.c_str(), false);
755  writetrans(0., 0., -(length/2. + noseLength/2.));
756  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
757  }
758 
759  tubeteller++;
761 
762  return true;
763  }
764 }
765 
766 bool putStrawRotatedLeft(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
767 {
768  double extr1 = posX + (length/2.) * sin(skewangle);
769  double extr2 = posX - (length/2.) * sin(skewangle);
770 
771 
772  // convert int to string
773  stringstream
774  conv;
775 
776  string
777  tubetellerStr;
778 
779  conv << tubeteller + 1;
780  conv >> tubetellerStr;
781 
782  string
783  nameItube = "stt01tube#" + tubetellerStr,
784  nameIwall = "stt01wall#" + tubetellerStr,
785  nameIgas = "stt01gas#" + tubetellerStr,
786  nameIwire = "stt01wire#" + tubetellerStr,
787  nameIendcap = "stt01endcap",
788  nameItopcap = "stt01topcap",
789  nameIcrimppin = "stt01crimppin",
790  nameIbelt = "stt01belt",
791  nameIgassupply = "stt01gassupply",
792  nameIring = "stt01ring",
793  nameIspring = "stt01spring",
794  nameInose = "stt01nose";
795 
796 
797  if (tubeteller == 0)
798  {
799  // original straw
800  writename(nameItube.c_str());
801  writemother(sttassembly, 1, 0, 1);
802  writemedium(air);
803  writetrans(posX, posY, posZ);
804  plotrotleft(xvector, yvector, zvector);
805 
806  // Mylar wall
807  writename(nameIwall.c_str());
808  writemother(nameItube.c_str());
810  writetube(0, tubeOuterDiam / 2., length / 2.);
811  writetrans(0., 0., 0.);
812  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
813 
814  // Gas filling
815  writename(nameIgas.c_str());
816  writemother(nameItube.c_str());
818  writetube(0., tubeInnerDiam / 2., length / 2.);
819  writetrans(0., 0., 0.);
820  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
821 
822  // Anode wire
823  writename(nameIwire.c_str());
824  writemother(nameIgas.c_str());
825  writemedium(W);
826  writetube(0., wireDiam / 2., length / 2.);
827  writetrans(0., 0., 0.);
828  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
829 
830  if (passive) {
831  // Endcaps
832  writename(nameIendcap.c_str(), 1, 1);
833  writemother(nameIgas.c_str(), false);
834  writetrans(0., 0., length / 2. - topcapLength - endcapLength / 2.);
835  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
836 
837  writename(nameIendcap.c_str(), 1, 0);
838  writemother(nameIgas.c_str(), false);
839  writetrans(0., 0., -(length / 2. - topcapLength - endcapLength / 2.));
840  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
841 
842  // Top cap
843  writename(nameItopcap.c_str(), 1, 1);
844  writemother(nameIgas.c_str(), false);
845  writetrans(0., 0., (length / 2. - topcapLength / 2.));
846  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
847 
848  writename(nameItopcap.c_str(), 1, 0);
849  writemother(nameIgas.c_str(), false);
850  writetrans(0., 0., -(length / 2. - topcapLength / 2.));
851  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
852 
853  // Crimp pin
854  writename(nameIcrimppin.c_str(), 1, 1);
855  writemother(nameItube.c_str(), false);
856  writetrans(0., 0., (length / 2. + crimppinLength / 2.));
857  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
858 
859  writename(nameIcrimppin.c_str(), 1, 0);
860  writemother(nameItube.c_str(), false);
861  writetrans(0., 0.,-(length / 2. + crimppinLength / 2.));
862  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
863 
864  // Belt
865  writename(nameIbelt.c_str(), 1, 1);
866  writemother(nameItube.c_str(), false);
867  writetrans(0., 0., (length / 2. + beltDistance + beltLength / 2.));
868  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
869 
870  writename(nameIbelt.c_str(), 1, 0);
871  writemother(nameItube.c_str(), false);
872  writetrans(0., 0., -(length / 2. + beltDistance + beltLength / 2.));
873  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
874 
875  // Gas supply
876  writename(nameIgassupply.c_str(), 1, 1);
877  writemother(nameItube.c_str(), false);
878  writetrans(0., gassupplyTransY, (length / 2. + beltDistance + beltLength + gassupplyLength / 2.));
879  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
880 
881  writename(nameIgassupply.c_str(), 1, 0);
882  writemother(nameItube.c_str(), false);
883  writetrans(0., gassupplyTransY, -(length / 2. + beltDistance + beltLength + gassupplyLength / 2.));
884  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
885 
886  // Ring
887  writename(nameIring.c_str(), 1, 1);
888  writemother(nameItube.c_str(), false);
889  writetrans(0., 0., (length / 2. + ringLength / 2.));
890  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
891 
892  writename(nameIring.c_str(), 1, 0);
893  writemother(nameItube.c_str(), false);
894  writetrans(0., 0., -(length / 2. + ringLength / 2.));
895  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
896 
897  // Spring
898  writename(nameIspring.c_str(), 1, 1);
899  writemother(nameItube.c_str(), false);
900  writetrans(0., 0., (length / 2. + springLength / 2.));
901  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
902 
903  writename(nameIspring.c_str(), 1, 0);
904  writemother(nameItube.c_str(), false);
905  writetrans(0., 0., -(length / 2. + springLength / 2.));
906  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
907 
908  // Nose
909  writename(nameInose.c_str(), 1, 1);
910  writemother(nameItube.c_str(), false);
911  writetrans(0., 0., (length/2. + noseLength/2.));
912  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
913 
914  writename(nameInose.c_str(), 1, 0);
915  writemother(nameItube.c_str(), false);
916  writetrans(0., 0., -(length/2. + noseLength/2.));
917  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
918  }
919  }
920  else
921  {
922  // copy volume
923 
924  writename(nameItube.c_str());
925  writemother(sttassembly, false);
926  writetrans(posX, posY, posZ);
927  plotrotleft(xvector, yvector, zvector);
928  }
929 
930  tubeteller++;
932 
933  return true;
934 }
935 
936 bool putStrawRotatedRight(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
937 {
938 
939 
940  double extr1 = posX + (length/2.) * sin(skewangle);
941  double extr2 = posX - (length/2.) * sin(skewangle);
942 
943 
944  // convert int to string
945  stringstream
946  conv;
947 
948  string
949  tubetellerStr;
950 
951  conv << tubeteller + 1;
952  conv >> tubetellerStr;
953 
954  string
955  nameItube = "stt01tube#" + tubetellerStr,
956  nameIwall = "stt01wall#" + tubetellerStr,
957  nameIgas = "stt01gas#" + tubetellerStr,
958  nameIwire = "stt01wire#" + tubetellerStr,
959  nameIendcap = "stt01endcap",
960  nameItopcap = "stt01topcap",
961  nameIcrimppin = "stt01crimppin",
962  nameIbelt = "stt01belt",
963  nameIgassupply = "stt01gassupply",
964  nameIring = "stt01ring",
965  nameIspring = "stt01spring",
966  nameInose = "stt01nose";
967 
968  if (tubeteller == 0)
969  {
970  // original volume
971  writename(nameItube.c_str());
972  writemother(sttassembly, 1, 0, 1);
973  writemedium(air);
974  writetrans(posX, posY, posZ);
975  plotrotright(xvector, yvector, zvector);
976 
977  // Mylar wall
978  writename(nameIwall.c_str());
979  writemother(nameItube.c_str());
981  writetube(0, tubeOuterDiam / 2., length / 2.);
982  writetrans(0., 0., 0.);
983  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
984 
985  // Gas filling
986  writename(nameIgas.c_str());
987  writemother(nameItube.c_str());
989  writetube(0., tubeInnerDiam / 2., length / 2.);
990  writetrans(0., 0., 0.);
991  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
992 
993  // Anode wire
994  writename(nameIwire.c_str());
995  writemother(nameIgas.c_str());
996  writemedium(W);
997  writetube(0., wireDiam / 2., length / 2.);
998  writetrans(0., 0., 0.);
999  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1000 
1001  if (passive) {
1002  // Endcaps
1003  writename(nameIendcap.c_str(), 1, 1);
1004  writemother(nameIgas.c_str(), false);
1005  writetrans(0., 0., length / 2. - topcapLength - endcapLength / 2.);
1006  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1007 
1008  writename(nameIendcap.c_str(), 1, 0);
1009  writemother(nameIgas.c_str(), false);
1010  writetrans(0., 0., -(length / 2. - topcapLength - endcapLength / 2.));
1011  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1012 
1013  // Top cap
1014  writename(nameItopcap.c_str(), 1, 1);
1015  writemother(nameIgas.c_str(), false);
1016  writetrans(0., 0., (length / 2. - topcapLength / 2.));
1017  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1018 
1019  writename(nameItopcap.c_str(), 1, 0);
1020  writemother(nameIgas.c_str(), false);
1021  writetrans(0., 0., -(length / 2. - topcapLength / 2.));
1022  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1023 
1024  // Crimp pin
1025  writename(nameIcrimppin.c_str(), 1, 1);
1026  writemother(nameItube.c_str(), false);
1027  writetrans(0., 0., (length / 2. + crimppinLength / 2.));
1028  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1029 
1030  writename(nameIcrimppin.c_str(), 1, 0);
1031  writemother(nameItube.c_str(), false);
1032  writetrans(0., 0.,-(length / 2. + crimppinLength / 2.));
1033  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1034 
1035  // Belt
1036  writename(nameIbelt.c_str(), 1, 1);
1037  writemother(nameItube.c_str(), false);
1038  writetrans(0., 0., (length / 2. + beltDistance + beltLength / 2.));
1039  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1040 
1041  writename(nameIbelt.c_str(), 1, 0);
1042  writemother(nameItube.c_str(), false);
1043  writetrans(0., 0., -(length / 2. + beltDistance + beltLength / 2.));
1044  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1045 
1046  // Gas supply
1047  writename(nameIgassupply.c_str(), 1, 1);
1048  writemother(nameItube.c_str(), false);
1049  writetrans(0., gassupplyTransY, (length / 2. + beltDistance + beltLength + gassupplyLength / 2.));
1050  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1051 
1052  writename(nameIgassupply.c_str(), 1, 0);
1053  writemother(nameItube.c_str(), false);
1054  writetrans(0., gassupplyTransY, -(length / 2. + beltDistance + beltLength + gassupplyLength / 2.));
1055  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1056 
1057  // Ring
1058  writename(nameIring.c_str(), 1, 1);
1059  writemother(nameItube.c_str(), false);
1060  writetrans(0., 0., (length / 2. + ringLength / 2.));
1061  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1062 
1063  writename(nameIring.c_str(), 1, 0);
1064  writemother(nameItube.c_str(), false);
1065  writetrans(0., 0., -(length / 2. + ringLength / 2.));
1066  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1067 
1068  // Spring
1069  writename(nameIspring.c_str(), 1, 1);
1070  writemother(nameItube.c_str(), false);
1071  writetrans(0., 0., (length / 2. + springLength / 2.));
1072  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1073 
1074  writename(nameIspring.c_str(), 1, 0);
1076  writetrans(0., 0., -(length / 2. + springLength / 2.));
1077  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1078 
1079  // Nose
1080  writename(nameInose.c_str(), 1, 1);
1081  writemother(nameItube.c_str(), false);
1082  writetrans(0., 0., (length/2. + noseLength/2.));
1083  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1084 
1085  writename(nameInose.c_str(), 1, 0);
1086  writemother(nameItube.c_str(), false);
1087  writetrans(0., 0., -(length/2. + noseLength/2.));
1088  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
1089  }
1090  }
1091  else
1092  {
1093  // copy volume
1094  writename(nameItube.c_str());
1095  writemother(sttassembly, false);
1096  writetrans(posX, posY, posZ);
1097  plotrotright(xvector, yvector, zvector);
1098  }
1099 
1100  tubeteller++;
1101  skewedtubeteller++;
1102 
1103  return true;
1104 }
1105 
1106 
1107 
1108 void placeSingleLayerStraightExact(double ringteller)
1109 {
1110  double
1111  radius = tubeSeperation / 2.;
1112 
1113  // place a straight double layer
1114  double
1115  xpos = 0.,
1116  ypos = ((ringteller) * 2 * radius),
1117  zpos = 0.;
1118 
1119  // 6 loops, one for each side of the hexagon
1120  // 1 / \ 4
1121  // 2 | | 5
1122  // 3 \ / 6
1123  for(int i = 0; i < ringteller; i++)
1124  {
1125  xpos -= sqrt(3.) * radius;
1126  ypos -= radius;
1127  putStraw(xpos, ypos, zpos);
1128  }
1129  for(int i = 0; i < ringteller; i++)
1130  {
1131  ypos -= 2 * radius;
1132  putStraw(xpos, ypos, zpos);
1133  }
1134  for(int i = 0; i < ringteller; i++)
1135  {
1136  xpos += sqrt(3.) * radius;
1137  ypos -= radius;
1138  putStraw(xpos, ypos, zpos);
1139  }
1140  for(int i = 0; i < ringteller; i++)
1141  {
1142  xpos += sqrt(3.) * radius;
1143  ypos += radius;
1144  putStraw(xpos, ypos, zpos);
1145  }
1146  for(int i = 0; i < ringteller; i++)
1147  {
1148  ypos += 2 * radius;
1149  putStraw(xpos, ypos, zpos);
1150  }
1151  for(int i = 0; i < ringteller; i++)
1152  {
1153  xpos -= sqrt(3.) * radius;
1154  ypos += radius;
1155  putStraw(xpos, ypos, zpos);
1156  }
1157 }
1158 
1159 void placeSingleLayerSkewedRight(double ringposition)
1160 {
1161  // see void placeSingleLayerSkewedLeft(double ringposition)
1162 
1163  double radius = tubeSeperation / 2.;
1164 
1165  double
1166  newskewangle = skewangle * -1.;
1167 
1168  double
1169  newradius = radius / cos((newskewangle / 180.) * pi);
1170 
1171  double
1172  xpos = 0.,
1173  ypos = ringposition / cos((30. / 180.) * pi),
1174  zpos = 0.,
1175  tmpxpos,
1176  tmpypos,
1177  vectorx,
1178  vectory,
1179  vectorz;
1180 
1181  double
1182  availableSpace = 2. * ringposition * tan((30. / 180.) * pi);
1183 
1184  int
1185  possibleStraws = int((availableSpace - fabs(tubeLength * sin((newskewangle / 180.) * pi))) / (newradius * 2)),
1186  extraStraws = -1 * possibleStraws + int(availableSpace / (newradius * 2));
1187 
1188  double
1189  extraspace = (availableSpace - (possibleStraws + extraStraws) * (newradius * 2)) / 2.;
1190 
1191  cerr << "extra space: " << extraspace * 2 << endl;
1192 
1193  double
1194  skewanglerad = (newskewangle / 180.) * pi,
1195  sixtyrad = (60. / 180.) * pi,
1196  translationToLeft = - 0.5 * tubeLength * tan(skewanglerad);
1197 
1198 
1199  vector<double>
1200  lengthsShort;
1201 
1202  double
1203  xpos2 = xpos - availableSpace * sin((60. / 180.) * pi),
1204  ypos2 = ypos - availableSpace * cos((60. / 180.) * pi),
1205  tmpxpos2 = xpos2,
1206  tmpypos2 = ypos2 - extraspace - newradius,
1207  limit = ypos2 - availableSpace + newradius + safety + extraspace;
1208 
1209  for(int i = 0; i < possibleStraws; i++)
1210  {
1211  tmpypos2 -= 2 * newradius;
1212  }
1213  int extracounter = 0; // how many short tubes can be really placed
1214  for (int i = 0; i < extraStraws; i++)
1215  {
1216  if((tmpypos2 - limit) < 0) break;
1217  extracounter++;
1218  double
1219  lengthShort = fabs((tmpypos2 - newradius - limit) / sin(newskewangle * (pi / 180.)));
1220 
1221  if (lengthShort > tubeLength)
1222  lengthShort = tubeLength;
1223 
1224  // cerr << "length: " << lengthShort << endl;
1225  lengthsShort.push_back(fabs(lengthShort));
1226 
1227  tmpypos2 -= 2 * newradius;
1228  }
1229  extraStraws = extracounter; // update the number
1230 
1231  double
1232  additionalShift = fabs(tubeLength * sin((newskewangle / 180.) * pi));
1233 
1234  // =================================================
1235  // planes intersecting pipe ========================
1236  // pipe
1237  double pipespace = (panelthickness + pipeDiam/2.) * 1./(sqrt(3)/2.);
1238 
1239  // the available space for a layer at the radius ringposition
1240  double
1241  availableSpacePipe = 2. * ringposition * tan((30. / 180.) * pi) - pipespace;
1242 
1243  // the number of skewed full-length straws that fit in the available space
1244  int
1245  possibleStrawsPipe = int((availableSpacePipe - fabs(tubeLength * sin((skewangle / 180.) * pi))) / (newradius * 2));
1246 
1247  // the number of short straws that fit on either side of the pack of full-length straws
1248  int
1249  extraStrawsPipe = -1 * possibleStrawsPipe + int(availableSpacePipe / (newradius * 2));
1250  // the amount of space that is left in the layer when considering the sum of all
1251  // full length and short straws together
1252  double
1253  extraspacePipe = (availableSpacePipe - (possibleStrawsPipe + extraStrawsPipe) * (newradius * 2)) / 2.;
1254 
1255  // cerr << "layer with pipe " << possibleStraws << " " << extraStraws << endl;
1256 
1257  // calculate the lenghts of the different short straws in this layer
1258  vector<double>
1259  lengthsShortPipe;
1260 
1261  double
1262  // start at the right edge of the layer
1263  xpos2Pipe = xpos - availableSpacePipe * sin((60. / 180.) * pi),
1264  ypos2Pipe = ypos - availableSpacePipe * cos((60. / 180.) * pi),
1265  // shift to the center of the rightmost straw
1266  tmpxpos2Pipe = xpos2Pipe,
1267  tmpypos2Pipe = ypos2Pipe - extraspacePipe - newradius,
1268  // the limit on the left side of the plane beyond which no center of the short straws may be
1269  limitPipe = ypos2Pipe - availableSpacePipe + newradius + safety + extraspacePipe;
1270 
1271 
1272  // shift to the center of of the leftmost full-length straw
1273  for(int i = 0; i < possibleStrawsPipe; i++)
1274  {
1275  tmpypos2Pipe -= 2 * newradius;
1276  }
1277  extracounter = 0; // how many short tubes can be really placed
1278  // calculate the maximum allowable length for this short straw and shift to the next
1279  for (int i = 0; i < extraStrawsPipe; i++)
1280  {
1281  if((tmpypos2Pipe - limitPipe) < 0) break;
1282  extracounter++;
1283  double
1284  lengthShort = fabs((tmpypos2Pipe - newradius - limitPipe) / sin(skewangle * (pi / 180.)));
1285 
1286  if (lengthShort > tubeLength)
1287  lengthShort = tubeLength;
1288  lengthsShortPipe.push_back(lengthShort);
1289  tmpypos2Pipe -= 2 * newradius;
1290  }
1291  extraStrawsPipe = extracounter; // update the number
1292  // =================================================
1293 
1294  // plane 1
1295  vectorx = -cos((60. / 180.) * pi);
1296  vectory = sin((60. / 180.) * pi);
1297  vectorz = 0;
1298  tmpxpos = xpos - (extraspacePipe + newradius + pipespace) * sin((60. / 180.) * pi);
1299  tmpypos = ypos - (extraspacePipe + newradius + pipespace) * cos((60. / 180.) * pi);
1300 
1301  for(int i = 0; i < possibleStrawsPipe; i++)
1302  {
1303 
1304  putStrawRotatedRight(tmpxpos + (translationToLeft - additionalShift) * sin(sixtyrad),
1305  tmpypos + (translationToLeft - additionalShift) * cos(sixtyrad),
1306  zpos, vectorx, vectory, vectorz, tubeLength);
1307 
1308  tmpxpos -= 2 * newradius * sin((60. / 180.) * pi);
1309  tmpypos -= 2 * newradius * cos((60. / 180.) * pi);
1310  }
1311 
1312  for (int i = 0; i < extraStrawsPipe; i++)
1313  {
1314  double
1315  lengthShort = lengthsShortPipe[i];
1316 
1317  double
1318  translationToFrontPar = ((tubeLength - lengthShort) / 2.) * cos(skewanglerad),
1319  translationToFrontPer = ((tubeLength - lengthShort) / 2.) * sin(skewanglerad),
1320  switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * i)) * cos(skewanglerad);
1321 
1322  putStrawRotatedShortRight(tmpxpos + (translationToLeft - additionalShift - translationToFrontPer) * sin(sixtyrad),
1323  tmpypos + (translationToLeft - additionalShift - translationToFrontPer) * cos(sixtyrad),
1324  zpos - translationToFrontPar,
1325  vectorx, vectory, vectorz, lengthShort);
1326 
1327  putStrawRotatedShortRight(tmpxpos + (translationToLeft - additionalShift + translationToFrontPer + switchSides) * sin(sixtyrad),
1328  tmpypos + (translationToLeft - additionalShift + translationToFrontPer + switchSides) * cos(sixtyrad),
1329  zpos + translationToFrontPar,
1330  vectorx, vectory, vectorz, lengthShort);
1331 
1332 
1333  tmpxpos -= 2 * newradius * sin((60. / 180.) * pi);
1334  tmpypos -= 2 * newradius * cos((60. / 180.) * pi);
1335  }
1336 
1337 
1338  // plane 2
1339  vectorx = -1.;
1340  vectory = 0.;
1341  vectorz = 0.;
1342  xpos -= availableSpace * sin((60. / 180.) * pi);
1343  ypos -= availableSpace * cos((60. / 180.) * pi);
1344  tmpxpos = xpos;
1345  tmpypos = ypos - extraspace - newradius;
1346 
1347  for(int i = 0; i < possibleStraws; i++)
1348  {
1349  putStrawRotatedRight(tmpxpos, tmpypos - additionalShift + translationToLeft, zpos, vectorx, vectory, vectorz, tubeLength);
1350  tmpypos -= 2 * newradius;
1351  }
1352 
1353  for (int i = 0; i < extraStraws; i++)
1354  {
1355  double
1356  lengthShort = lengthsShort[i];
1357 
1358  double
1359  translationToFrontPar = ((tubeLength - lengthShort) / 2.) * cos(skewanglerad),
1360  translationToFrontPer = ((tubeLength - lengthShort) / 2.) * sin(skewanglerad),
1361  switchSides = 2 * newradius * (possibleStraws + 1 + (2 * i)) * cos(skewanglerad);
1362 
1363  putStrawRotatedShortRight(tmpxpos,
1364  tmpypos - additionalShift + (translationToLeft - translationToFrontPer),
1365  zpos - translationToFrontPar,
1366  vectorx, vectory, vectorz, lengthShort);
1367 
1368  putStrawRotatedShortRight(tmpxpos,
1369  tmpypos - additionalShift + (translationToLeft + translationToFrontPer + switchSides),
1370  zpos + translationToFrontPar,
1371  vectorx, vectory, vectorz, lengthShort);
1372 
1373  tmpypos -= 2 * newradius;
1374  }
1375 
1376  // plane 3
1377  vectorx = -1 * cos((60. / 180.) * pi);
1378  vectory = -1 * sin((60. / 180.) * pi);
1379  vectorz = 0;
1380  ypos -= availableSpace;
1381  tmpxpos = xpos + (extraspacePipe + newradius) * sin((60. / 180.) * pi);
1382  tmpypos = ypos - (extraspacePipe + newradius) * cos((60. / 180.) * pi);
1383 
1384  for(int i = 0; i < possibleStrawsPipe; i++)
1385  {
1386 
1387  putStrawRotatedRight(tmpxpos - (translationToLeft - additionalShift) * sin(sixtyrad),
1388  tmpypos + (translationToLeft - additionalShift) * cos(sixtyrad),
1389  zpos, vectorx, vectory, vectorz, tubeLength);
1390 
1391  tmpxpos += 2 * newradius * sin((60. / 180.) * pi);
1392  tmpypos -= 2 * newradius * cos((60. / 180.) * pi);
1393  }
1394 
1395  for (int i = 0; i < extraStrawsPipe; i++)
1396  {
1397  double
1398  lengthShort = lengthsShortPipe[i];
1399 
1400  double
1401  translationToFrontPar = ((tubeLength - lengthShort) / 2.) * cos(skewanglerad),
1402  translationToFrontPer = ((tubeLength - lengthShort) / 2.) * sin(skewanglerad),
1403  switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * i)) * cos(skewanglerad);
1404 
1405  putStrawRotatedShortRight(tmpxpos - (translationToLeft - translationToFrontPer - additionalShift) * sin(sixtyrad),
1406  tmpypos + (translationToLeft - translationToFrontPer - additionalShift) * cos(sixtyrad),
1407  zpos - translationToFrontPar,
1408  vectorx, vectory, vectorz, lengthShort);
1409 
1410  putStrawRotatedShortRight(tmpxpos - (translationToLeft + translationToFrontPer - additionalShift + switchSides) * sin(sixtyrad),
1411  tmpypos + (translationToLeft + translationToFrontPer - additionalShift + switchSides) * cos(sixtyrad),
1412  zpos + translationToFrontPar,
1413  vectorx, vectory, vectorz, lengthShort);
1414 
1415  tmpxpos += 2 * newradius * sin((60. / 180.) * pi);
1416  tmpypos -= 2 * newradius * cos((60. / 180.) * pi);
1417  }
1418 
1419  // plane 4
1420  vectorx = 1 * cos((60. / 180.) * pi);
1421  vectory = -1 * sin((60. / 180.) * pi);
1422  vectorz = 0;
1423  xpos += availableSpace * sin((60. / 180.) * pi);
1424  ypos -= availableSpace * cos((60. / 180.) * pi);
1425  tmpxpos = xpos + (extraspacePipe + newradius + pipespace) * sin((60. / 180.) * pi);
1426  tmpypos = ypos + (extraspacePipe + newradius + pipespace) * cos((60. / 180.) * pi);
1427 
1428  for(int i = 0; i < possibleStrawsPipe; i++)
1429  {
1430 
1431  putStrawRotatedRight(tmpxpos - (translationToLeft - additionalShift) * sin(sixtyrad),
1432  tmpypos - (translationToLeft - additionalShift) * cos(sixtyrad),
1433  zpos, vectorx, vectory, vectorz, tubeLength);
1434 
1435  tmpxpos += 2 * newradius * sin((60. / 180.) * pi);
1436  tmpypos += 2 * newradius * cos((60. / 180.) * pi);
1437  }
1438 
1439  for (int i = 0; i < extraStrawsPipe; i++)
1440  {
1441  double
1442  lengthShort = lengthsShortPipe[i];
1443 
1444  double
1445  translationToFrontPar = ((tubeLength - lengthShort) / 2.) * cos(skewanglerad),
1446  translationToFrontPer = ((tubeLength - lengthShort) / 2.) * sin(skewanglerad),
1447  switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * i)) * cos(skewanglerad);
1448 
1449  putStrawRotatedShortRight(tmpxpos - (translationToLeft - additionalShift - translationToFrontPer) * sin(sixtyrad),
1450  tmpypos - (translationToLeft - additionalShift - translationToFrontPer) * cos(sixtyrad),
1451  zpos - translationToFrontPar,
1452  vectorx, vectory, vectorz, lengthShort);
1453 
1454  putStrawRotatedShortRight(tmpxpos - (translationToLeft - additionalShift + translationToFrontPer + switchSides) * sin(sixtyrad),
1455  tmpypos - (translationToLeft - additionalShift + translationToFrontPer + switchSides) * cos(sixtyrad),
1456  zpos + translationToFrontPar,
1457  vectorx, vectory, vectorz, lengthShort);
1458 
1459  tmpxpos += 2 * newradius * sin((60. / 180.) * pi);
1460  tmpypos += 2 * newradius * cos((60. / 180.) * pi);
1461  }
1462 
1463  // plane 5
1464  vectorx = 1.;
1465  vectory = 0.;
1466  vectorz = 0.;
1467  xpos += availableSpace * sin((60. / 180.) * pi);
1468  ypos += availableSpace * cos((60. / 180.) * pi);
1469  tmpxpos = xpos;
1470  tmpypos = ypos + extraspace + newradius;
1471 
1472  for(int i = 0; i < possibleStraws; i++)
1473  {
1474  putStrawRotatedRight(tmpxpos, tmpypos - (translationToLeft - additionalShift), zpos, vectorx, vectory, vectorz, tubeLength);
1475  tmpypos += 2 * newradius;
1476  }
1477 
1478  for (int i = 0; i < extraStraws; i++)
1479  {
1480  double
1481  lengthShort = lengthsShort[i];
1482 
1483  double
1484  translationToFrontPar = ((tubeLength - lengthShort) / 2.) * cos(skewanglerad),
1485  translationToFrontPer = ((tubeLength - lengthShort) / 2.) * sin(skewanglerad),
1486  switchSides = 2 * newradius * (possibleStraws + 1 + (2 * i)) * cos(skewanglerad);
1487 
1488  putStrawRotatedShortRight(tmpxpos, tmpypos - (translationToLeft - additionalShift - translationToFrontPer),
1489  zpos - translationToFrontPar,
1490  vectorx, vectory, vectorz, lengthShort);
1491 
1492  putStrawRotatedShortRight(tmpxpos, tmpypos - (translationToLeft - additionalShift + translationToFrontPer + switchSides),
1493  zpos + translationToFrontPar,
1494  vectorx, vectory, vectorz, lengthShort);
1495 
1496  tmpypos += 2 * newradius;
1497  }
1498 
1499  // plane 6
1500  vectorx = cos((60. / 180.) * pi);
1501  vectory = sin((60. / 180.) * pi);
1502  vectorz = 0;
1503  ypos += availableSpace;
1504  tmpxpos = xpos - (extraspacePipe + newradius) * sin((60. / 180.) * pi);
1505  tmpypos = ypos + (extraspacePipe + newradius) * cos((60. / 180.) * pi);
1506 
1507  for(int i = 0; i < possibleStrawsPipe; i++)
1508  {
1509 
1510  putStrawRotatedRight(tmpxpos + (translationToLeft - additionalShift) * sin(sixtyrad),
1511  tmpypos - (translationToLeft - additionalShift) * cos(sixtyrad),
1512  zpos, vectorx, vectory, vectorz, tubeLength);
1513 
1514  tmpxpos -= 2 * newradius * sin((60. / 180.) * pi);
1515  tmpypos += 2 * newradius * cos((60. / 180.) * pi);
1516  }
1517 
1518  for (int i = 0; i < extraStrawsPipe; i++)
1519  {
1520  double
1521  lengthShort = lengthsShortPipe[i];
1522 
1523  double
1524  translationToFrontPar = ((tubeLength - lengthShort) / 2.) * cos(skewanglerad),
1525  translationToFrontPer = ((tubeLength - lengthShort) / 2.) * sin(skewanglerad),
1526  switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * i)) * cos(skewanglerad);
1527 
1528  putStrawRotatedShortRight(tmpxpos + (translationToLeft - additionalShift - translationToFrontPer) * sin(sixtyrad),
1529  tmpypos - (translationToLeft - additionalShift - translationToFrontPer) * cos(sixtyrad),
1530  zpos - translationToFrontPar,
1531  vectorx, vectory, vectorz, lengthShort);
1532 
1533  putStrawRotatedShortRight(tmpxpos + (translationToLeft - additionalShift + translationToFrontPer + switchSides) * sin(sixtyrad),
1534  tmpypos - (translationToLeft - additionalShift + translationToFrontPer + switchSides) * cos(sixtyrad),
1535  zpos + translationToFrontPar,
1536  vectorx, vectory, vectorz, lengthShort);
1537 
1538  tmpxpos -= 2 * newradius * sin((60. / 180.) * pi);
1539  tmpypos += 2 * newradius * cos((60. / 180.) * pi);
1540  }
1541 
1542 }
1543 
1544 
1545 
1546 
1547 void placeSingleLayerSkewedLeft(double ringposition)
1548 {
1549  // calculation of some general properties of the layer layout
1550  // see layerfront.ps and layertop.ps if description is not clear
1551 
1552  // skewed straws become ellipses in the x-y projection
1553  // the short ellipse radius is still the straw radius, the
1554  // long ellipse radius (within the straw plane) is given by:
1555 
1556  double
1557  radius = tubeSeperation / 2.;
1558 
1559  double
1560  newradius = radius / cos((skewangle / 180.) * pi);
1561 
1562 
1563  double
1564  xpos = 0.,
1565  ypos = ringposition / cos((30. / 180.) * pi),
1566  zpos = 0.,
1567  tmpxpos,
1568  tmpypos,
1569  vectorx,
1570  vectory,
1571  vectorz;
1572 
1573 
1574  // the available space for a layer at the radius ringposition
1575  double
1576  availableSpace = 2. * ringposition * tan((30. / 180.) * pi);
1577 
1578  // the number of skewed full-length straws that fit in the available space
1579  int
1580  possibleStraws = int((availableSpace - tubeLength * sin((skewangle / 180.) * pi)) / (newradius * 2));
1581 
1582  // the number of short straws that fit on either side of the pack of full-length straws
1583  int
1584  extraStraws = int(availableSpace / (newradius * 2)) - possibleStraws;
1585 
1586  // the amount of space that is left in the layer when considering the sum of all
1587  // full length and short straws together
1588  double
1589  extraspace = (availableSpace - (possibleStraws + extraStraws) * (newradius * 2)) / 2.;
1590 
1591  // cerr << possibleStraws << " " << extraStraws << endl;
1592 
1593  double
1594  skewanglerad = (skewangle / 180.) * pi,
1595  sixtyrad = (60. / 180.) * pi,
1596  // translation between the front end of the straw and the center
1597  translationToLeft = - 0.5 * tubeLength * tan(skewanglerad);
1598 
1599  // calculate the lenghts of the different short straws in this layer
1600  vector<double>
1601  lengthsShort;
1602 
1603  double
1604  // start at the right edge of the layer
1605  xpos2 = xpos - availableSpace * sin((60. / 180.) * pi),
1606  ypos2 = ypos - availableSpace * cos((60. / 180.) * pi),
1607  // shift to the center of the rightmost straw
1608  tmpxpos2 = xpos2,
1609  tmpypos2 = ypos2 - extraspace - newradius,
1610  // the limit on the left side of the plane beyond which no center of the short straws may be
1611  limit = ypos2 - availableSpace + newradius + safety + extraspace;
1612 
1613  // cerr << "xpos2/ypos2 " << xpos2 << " " << ypos2 << endl;
1614  // cerr << "tmpxpos2/tmpypos2 " << tmpxpos2 << " " << tmpypos2 << endl;
1615 
1616 
1617  // shift to the center of of the leftmost full-length straw
1618  for(int i = 0; i < possibleStraws; i++)
1619  {
1620  tmpypos2 -= 2 * newradius;
1621  }
1622  int extracounter = 0; // how many short tubes can be really placed
1623  // calculate the maximum allowable length for this short straw and shift to the next
1624  for (int i = 0; i < extraStraws; i++)
1625  {
1626  if((tmpypos2 - limit) < 0) break;
1627  extracounter++;
1628  double
1629  lengthShort = fabs((tmpypos2 - newradius - limit) / sin(skewangle * (pi / 180.)));
1630 
1631  if (lengthShort > tubeLength)
1632  lengthShort = tubeLength;
1633 
1634  // cerr << "length: " << lengthShort << endl;
1635  lengthsShort.push_back(lengthShort);
1636 
1637  tmpypos2 -= 2 * newradius;
1638  }
1639  extraStraws = extracounter; // update the number
1640  // =================================================
1641  // planes intersecting pipe ========================
1642  // pipe
1643  double pipespace = (panelthickness + pipeDiam/2.) * 1./(sqrt(3)/2.);
1644 
1645  // the available space for a layer at the radius ringposition
1646  double
1647  availableSpacePipe = 2. * ringposition * tan((30. / 180.) * pi) - pipespace;
1648 
1649  // the number of skewed full-length straws that fit in the available space
1650  int
1651  possibleStrawsPipe = int((availableSpacePipe - tubeLength * sin((skewangle / 180.) * pi)) / (newradius * 2));
1652 
1653  // the number of short straws that fit on either side of the pack of full-length straws
1654  int
1655  extraStrawsPipe = int(availableSpacePipe / (newradius * 2)) - possibleStrawsPipe;
1656 
1657  // the amount of space that is left in the layer when considering the sum of all
1658  // full length and short straws together
1659  double
1660  extraspacePipe = (availableSpacePipe - (possibleStrawsPipe + extraStrawsPipe) * (newradius * 2)) / 2.;
1661 
1662  // cerr << "layer with pipe " << possibleStraws << " " << extraStraws << endl;
1663 
1664  // calculate the lenghts of the different short straws in this layer
1665  vector<double>
1666  lengthsShortPipe;
1667 
1668  double
1669  // start at the right edge of the layer
1670  xpos2Pipe = xpos - availableSpacePipe * sin((60. / 180.) * pi),
1671  ypos2Pipe = ypos - availableSpacePipe * cos((60. / 180.) * pi),
1672  // shift to the center of the rightmost straw
1673  tmpxpos2Pipe = xpos2Pipe,
1674  tmpypos2Pipe = ypos2Pipe - extraspacePipe - newradius,
1675  // the limit on the left side of the plane beyond which no center of the short straws may be
1676  limitPipe = ypos2Pipe - availableSpacePipe + newradius + safety + extraspacePipe;
1677 
1678  // shift to the center of of the leftmost full-length straw
1679  for(int i = 0; i < possibleStrawsPipe; i++)
1680  {
1681  tmpypos2Pipe -= 2 * newradius;
1682  }
1683 
1684  // calculate the maximum allowable length for this short straw and shift to the next
1685  extracounter = 0; // how many short tubes can be really placed
1686  for (int i = 0; i < extraStrawsPipe; i++)
1687  {
1688  if((tmpypos2Pipe - limitPipe) < 0) break;
1689  extracounter++;
1690  double
1691  lengthShort = fabs((tmpypos2Pipe - newradius - limitPipe) / sin(skewangle * (pi / 180.)));
1692 
1693  if (lengthShort > tubeLength)
1694  lengthShort = tubeLength;
1695 
1696  lengthsShortPipe.push_back(lengthShort);
1697 
1698  tmpypos2Pipe -= 2 * newradius;
1699  }
1700  extraStrawsPipe = extracounter; // update the number
1701  // =================================================
1702  // plane 1
1703  // place full straws:
1704  vectorx = -cos((60. / 180.) * pi);
1705  vectory = sin((60. / 180.) * pi);
1706  vectorz = 0;
1707  tmpxpos = xpos - (extraspacePipe + newradius + pipespace) * sin((60. / 180.) * pi);
1708  tmpypos = ypos - (extraspacePipe + newradius + pipespace) * cos((60. / 180.) * pi);
1709 
1710  for(int i = 0; i < possibleStrawsPipe; i++)
1711  {
1712  // place a straw
1713  putStrawRotatedLeft(tmpxpos + translationToLeft * sin(sixtyrad),
1714  tmpypos + translationToLeft * cos(sixtyrad),
1715  zpos, vectorx, vectory, vectorz, tubeLength);
1716 
1717  tmpxpos -= 2 * newradius * sin((60. / 180.) * pi);
1718  tmpypos -= 2 * newradius * cos((60. / 180.) * pi);
1719  }
1720 
1721  for (int i = 0; i < extraStrawsPipe; i++)
1722  {
1723  double
1724  lengthShort = lengthsShortPipe[i];
1725 
1726  double
1727  translationToFrontPar = ((tubeLength - lengthShort) / 2.) * cos(skewanglerad),
1728  translationToFrontPer = ((tubeLength - lengthShort) / 2.) * sin(skewanglerad),
1729  // translation to the other side of the straw layer
1730  switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * i)) * cos(skewanglerad);
1731 
1732 
1733  putStrawRotatedShortLeft(tmpxpos + (translationToLeft + translationToFrontPer) * sin(sixtyrad),
1734  tmpypos + (translationToLeft + translationToFrontPer) * cos(sixtyrad),
1735  zpos + translationToFrontPar,
1736  vectorx, vectory, vectorz, lengthShort);
1737 
1738  putStrawRotatedShortLeft(tmpxpos + (translationToLeft - translationToFrontPer + switchSides) * sin(sixtyrad),
1739  tmpypos + (translationToLeft - translationToFrontPer + switchSides) * cos(sixtyrad),
1740  zpos - translationToFrontPar,
1741  vectorx, vectory, vectorz, lengthShort);
1742 
1743 
1744  tmpxpos -= 2 * newradius * sin((60. / 180.) * pi);
1745  tmpypos -= 2 * newradius * cos((60. / 180.) * pi);
1746  }
1747 
1748  // plane 2
1749  vectorx = -1.;
1750  vectory = 0.;
1751  vectorz = 0.;
1752  xpos -= availableSpace * sin((60. / 180.) * pi);
1753  ypos -= availableSpace * cos((60. / 180.) * pi);
1754  tmpxpos = xpos;
1755  tmpypos = ypos - extraspace - newradius;
1756 
1757  for(int i = 0; i < possibleStraws; i++)
1758  {
1759  putStrawRotatedLeft(tmpxpos, tmpypos + translationToLeft, zpos, vectorx, vectory, vectorz, tubeLength);
1760  tmpypos -= 2 * newradius;
1761  }
1762 
1763  for (int i = 0; i < extraStraws; i++)
1764  {
1765  double
1766  lengthShort = lengthsShort[i];
1767 
1768  double
1769  translationToFrontPar = ((tubeLength - lengthShort) / 2.) * cos(skewanglerad),
1770  translationToFrontPer = ((tubeLength - lengthShort) / 2.) * sin(skewanglerad),
1771  switchSides = 2 * newradius * (possibleStraws + 1 + (2 * i)) * cos(skewanglerad);
1772 
1773  putStrawRotatedShortLeft(tmpxpos,
1774  tmpypos + (translationToLeft + translationToFrontPer),
1775  zpos + translationToFrontPar,
1776  vectorx, vectory, vectorz, lengthShort);
1777 
1778  putStrawRotatedShortLeft(tmpxpos,
1779  tmpypos + (translationToLeft - translationToFrontPer + switchSides),
1780  zpos - translationToFrontPar,
1781  vectorx, vectory, vectorz, lengthShort);
1782 
1783  tmpypos -= 2 * newradius;
1784  }
1785 
1786  // plane 3
1787  vectorx = -1 * cos((60. / 180.) * pi);
1788  vectory = -1 * sin((60. / 180.) * pi);
1789  vectorz = 0;
1790  ypos -= availableSpace;
1791  tmpxpos = xpos + (extraspacePipe + newradius) * sin((60. / 180.) * pi);
1792  tmpypos = ypos - (extraspacePipe + newradius) * cos((60. / 180.) * pi);
1793 
1794  for(int i = 0; i < possibleStrawsPipe; i++)
1795  {
1796 
1797  putStrawRotatedLeft(tmpxpos - translationToLeft * sin(sixtyrad),
1798  tmpypos + translationToLeft * cos(sixtyrad),
1799  zpos, vectorx, vectory, vectorz, tubeLength);
1800 
1801  tmpxpos += 2 * newradius * sin((60. / 180.) * pi);
1802  tmpypos -= 2 * newradius * cos((60. / 180.) * pi);
1803  }
1804 
1805  for (int i = 0; i < extraStrawsPipe; i++)
1806  {
1807  double
1808  lengthShort = lengthsShortPipe[i];
1809 
1810  double
1811  translationToFrontPar = ((tubeLength - lengthShort) / 2.) * cos(skewanglerad),
1812  translationToFrontPer = ((tubeLength - lengthShort) / 2.) * sin(skewanglerad),
1813  switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * i)) * cos(skewanglerad);
1814 
1815  putStrawRotatedShortLeft(tmpxpos - (translationToLeft + translationToFrontPer) * sin(sixtyrad),
1816  tmpypos + (translationToLeft + translationToFrontPer) * cos(sixtyrad),
1817  zpos + translationToFrontPar,
1818  vectorx, vectory, vectorz, lengthShort);
1819 
1820  putStrawRotatedShortLeft(tmpxpos - (translationToLeft - translationToFrontPer + switchSides) * sin(sixtyrad),
1821  tmpypos + (translationToLeft - translationToFrontPer + switchSides) * cos(sixtyrad),
1822  zpos - translationToFrontPar,
1823  vectorx, vectory, vectorz, lengthShort);
1824 
1825  tmpxpos += 2 * newradius * sin((60. / 180.) * pi);
1826  tmpypos -= 2 * newradius * cos((60. / 180.) * pi);
1827  }
1828 
1829  // plane 4
1830  vectorx = 1 * cos((60. / 180.) * pi);
1831  vectory = -1 * sin((60. / 180.) * pi);
1832  vectorz = 0;
1833  xpos += availableSpace * sin((60. / 180.) * pi);
1834  ypos -= availableSpace * cos((60. / 180.) * pi);
1835  tmpxpos = xpos + (extraspacePipe + newradius + pipespace) * sin((60. / 180.) * pi);
1836  tmpypos = ypos + (extraspacePipe + newradius + pipespace) * cos((60. / 180.) * pi);
1837 
1838  for(int i = 0; i < possibleStrawsPipe; i++)
1839  {
1840 
1841  putStrawRotatedLeft(tmpxpos - translationToLeft * sin(sixtyrad),
1842  tmpypos - translationToLeft * cos(sixtyrad),
1843  zpos, vectorx, vectory, vectorz, tubeLength);
1844 
1845  tmpxpos += 2 * newradius * sin((60. / 180.) * pi);
1846  tmpypos += 2 * newradius * cos((60. / 180.) * pi);
1847  }
1848 
1849  for (int i = 0; i < extraStrawsPipe; i++)
1850  {
1851  double
1852  lengthShort = lengthsShortPipe[i];
1853 
1854  double
1855  translationToFrontPar = ((tubeLength - lengthShort) / 2.) * cos(skewanglerad),
1856  translationToFrontPer = ((tubeLength - lengthShort) / 2.) * sin(skewanglerad),
1857  switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * i)) * cos(skewanglerad);
1858 
1859 
1860  putStrawRotatedShortLeft(tmpxpos - (translationToLeft + translationToFrontPer) * sin(sixtyrad),
1861  tmpypos - (translationToLeft + translationToFrontPer) * cos(sixtyrad),
1862  zpos + translationToFrontPar,
1863  vectorx, vectory, vectorz, lengthShort);
1864 
1865  putStrawRotatedShortLeft(tmpxpos - (translationToLeft - translationToFrontPer + switchSides) * sin(sixtyrad),
1866  tmpypos - (translationToLeft - translationToFrontPer + switchSides) * cos(sixtyrad),
1867  zpos - translationToFrontPar,
1868  vectorx, vectory, vectorz, lengthShort);
1869 
1870  tmpxpos += 2 * newradius * sin((60. / 180.) * pi);
1871  tmpypos += 2 * newradius * cos((60. / 180.) * pi);
1872  }
1873 
1874  // plane 5
1875  vectorx = 1.;
1876  vectory = 0.;
1877  vectorz = 0.;
1878  xpos += availableSpace * sin((60. / 180.) * pi);
1879  ypos += availableSpace * cos((60. / 180.) * pi);
1880  tmpxpos = xpos;
1881  tmpypos = ypos + extraspace + newradius;
1882 
1883  for(int i = 0; i < possibleStraws; i++)
1884  {
1885 
1886  putStrawRotatedLeft(tmpxpos, tmpypos - translationToLeft, zpos, vectorx, vectory, vectorz, tubeLength);
1887 
1888  tmpypos += 2 * newradius;
1889  }
1890 
1891  for (int i = 0; i < extraStraws; i++)
1892  {
1893  double
1894  lengthShort = lengthsShort[i];
1895 
1896  double
1897  translationToFrontPar = ((tubeLength - lengthShort) / 2.) * cos(skewanglerad),
1898  translationToFrontPer = ((tubeLength - lengthShort) / 2.) * sin(skewanglerad),
1899  switchSides = 2 * newradius * (possibleStraws + 1 + (2 * i)) * cos(skewanglerad);
1900 
1901  putStrawRotatedShortLeft(tmpxpos,
1902  tmpypos - (translationToLeft + translationToFrontPer),
1903  zpos + translationToFrontPar,
1904  vectorx, vectory, vectorz, lengthShort);
1905 
1906  putStrawRotatedShortLeft(tmpxpos,
1907  tmpypos - (translationToLeft - translationToFrontPer + switchSides),
1908  zpos - translationToFrontPar,
1909  vectorx, vectory, vectorz, lengthShort);
1910 
1911  tmpypos += 2 * newradius;
1912  }
1913 
1914  // plane 6
1915  vectorx = cos((60. / 180.) * pi);
1916  vectory = sin((60. / 180.) * pi);
1917  vectorz = 0;
1918  ypos += availableSpace;
1919  tmpxpos = xpos - (extraspacePipe + newradius) * sin((60. / 180.) * pi);
1920  tmpypos = ypos + (extraspacePipe + newradius) * cos((60. / 180.) * pi);
1921 
1922  for(int i = 0; i < possibleStrawsPipe; i++)
1923  {
1924 
1925  putStrawRotatedLeft(tmpxpos + translationToLeft * sin(sixtyrad),
1926  tmpypos - translationToLeft * cos(sixtyrad),
1927  zpos, vectorx, vectory, vectorz, tubeLength);
1928 
1929  tmpxpos -= 2 * newradius * sin((60. / 180.) * pi);
1930  tmpypos += 2 * newradius * cos((60. / 180.) * pi);
1931  }
1932 
1933  for (int i = 0; i < extraStrawsPipe; i++)
1934  {
1935  double
1936  lengthShort = lengthsShortPipe[i];
1937 
1938  double
1939  translationToFrontPar = ((tubeLength - lengthShort) / 2.) * cos(skewanglerad),
1940  translationToFrontPer = ((tubeLength - lengthShort) / 2.) * sin(skewanglerad),
1941  switchSides = 2 * newradius * (possibleStrawsPipe + 1 + (2 * i)) * cos(skewanglerad);
1942 
1943  putStrawRotatedShortLeft(tmpxpos + (translationToLeft + translationToFrontPer) * sin(sixtyrad),
1944  tmpypos - (translationToLeft + translationToFrontPer) * cos(sixtyrad),
1945  zpos + translationToFrontPar,
1946  vectorx, vectory, vectorz, lengthShort);
1947 
1948  putStrawRotatedShortLeft(tmpxpos + (translationToLeft - translationToFrontPer + switchSides) * sin(sixtyrad),
1949  tmpypos - (translationToLeft - translationToFrontPer + switchSides) * cos(sixtyrad),
1950  zpos - translationToFrontPar,
1951  vectorx, vectory, vectorz, lengthShort);
1952 
1953  tmpxpos -= 2 * newradius * sin((60. / 180.) * pi);
1954  tmpypos += 2 * newradius * cos((60. / 180.) * pi);
1955  }
1956 }
1957 
1958 
1959 void makeDoubleLayerStraightExact(double &startRadius)
1960 {
1961  // close packed straight layers are only possible at specific positions
1962  // these are indicated by the integer ringteller. ringteller = 0 would be
1963  // a single straw at the origin. ringteller = 1 would be the first layer of
1964  // 6 straws closepacked around that single straw. And so on ...
1965 
1966  // look for the first ring number which is completely outside the startradius
1967  // given:
1968  double
1969  radius = tubeSeperation / 2.;
1970 
1971  int
1972  ringteller = 0;
1973 
1974  while (ringteller * sqrt(3.) * radius - radius <= startRadius)
1975  {
1976  ringteller++;
1977  }
1978  cerr << "startRadius " << startRadius << endl;
1979  // move the startRadius to the next double layer
1980  startRadius = (ringteller + 1) * sqrt(3.) * radius;
1981 
1982  // place the first layer of this double layer
1983  cerr << "positioning ring at: " << ringteller * sqrt(3.) * radius << endl;
1984  placeSingleLayerStraightExact(ringteller);
1985  // place the second layer
1986  cerr << "positioning ring at: " << (ringteller + 1) * sqrt(3.) * radius << endl;
1987  placeSingleLayerStraightExact(ringteller + 1);
1988 
1989  cerr << "ringteller " << ringteller << endl;
1990 }
1991 
1992 void makeSingleLayerStraightExact(double &startRadius)
1993 {
1994  // see comments at makeDoubleLayerStraightExact()
1995 
1996  double
1997  radius = tubeSeperation / 2.;
1998 
1999  int
2000  ringteller = 0;
2001 
2002  while (ringteller * sqrt(3.) * radius - radius + innerCoverThickness <= startRadius) // CHECK
2003  {
2004  ringteller++;
2005  }
2006 
2007  startRadius = (ringteller + 1) * sqrt(3.) * radius;
2008 
2009  cerr << "positioning ring at: " << ringteller * sqrt(3.) * radius << endl;
2010  placeSingleLayerStraightExact(ringteller);
2011  cerr << "ringteller " << ringteller << " radius " << radius << endl;
2012 
2013 }
2014 
2015 void makeDoubleLayerSkewedRight(double startRadius)
2016 {
2017  // see comments at makeDoubleLayerSkewedLeft()
2018  placeSingleLayerSkewedRight(startRadius);
2019  placeSingleLayerSkewedRight(startRadius + sqrt(3.) * (tubeSeperation / 2.));
2020 }
2021 
2022 void makeDoubleLayerSkewedLeft(double startRadius)
2023 {
2024  // place first skewed left layer at the specified radius
2025  placeSingleLayerSkewedLeft(startRadius);
2026 
2027  // the straw separation is the separation between the centers of two straws next to each other within one layer.
2028  // Close packing then dictates that separation between the layers is sqrt(3) * (separation / 2)
2029  placeSingleLayerSkewedLeft(startRadius + sqrt(3.) * (tubeSeperation / 2.));
2030 }
2031 
2032 int main()
2033 {
2034  // reset counters for the numbers of straws
2035  counter1 = 0;
2036  counter2 = 0;
2037  counter3 = 0;
2038  counter4 = 0;
2039  counter5 = 0;
2040  counter6 = 0;
2041  tubeteller = 0;
2042  axialtubeteller = 0;
2043  skewedtubeteller = 0;
2044 
2045  cout << setiosflags(ios::fixed) << setprecision(6);
2046 
2047  //------------------------------------------------------ volumes
2048 
2050  // //
2051  // STT Support: //
2052  // //
2054 
2055  if(!noSupport)
2056  {
2057  // container for all tubes!
2058  // for X > 0
2059  cout << sttassembly << endl;
2060  cout << cave << endl;
2061  cout << "ASSEMBLY" << endl;
2062  cout << air << endl;
2063  counter4++;
2064  writetrans(0., 0., sttCenterZ);
2065  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
2066 
2067  // cylinder inner x > 0
2068  writename(innerCylinder, 1, 1);
2069  writemother(sttassembly, 1, 1);
2070  writemedium(AlBe);
2071  writehalftube((innerDiam / 2.), (innerDiam / 2.) + innerCoverThickness, (tubeLength + 0.4) / 2.);
2072  writetrans(0., 0., 0.);
2073  writerot(0., 1., 0., -1., 0., 0., 0., 0., 1.);
2074  // writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
2075 
2076  // cylinder outer x > 0
2077  writename(outerCylinder, 1, 1);
2078  writemother(sttassembly, 1, 1);
2079  writemedium(AlBe);
2080  writehalftube((outerDiam / 2.) - outerCoverThickness, (outerDiam / 2.), (tubeLength + 0.4) / 2.);
2081  writetrans(0., 0., 0.);
2082  writerot(0., 1., 0., -1., 0., 0., 0., 0., 1.);
2083  // writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
2084 
2085  // cylinder inner x < 0
2086  writename(innerCylinder, 1, 0);
2087  writemother(sttassembly, 1, 1);
2088  writemedium(AlBe);
2089  writehalftube((innerDiam / 2.), (innerDiam / 2.) + innerCoverThickness, (tubeLength + 0.4) / 2.);
2090  writetrans(0., 0., 0.);
2091  writerot(0., -1., 0., 1., 0., 0., 0., 0., 1.);
2092  // writerot(1., 0., 0., 0., -1., 0., 0., 0., 1.);
2093 
2094  // cylinder outer x < 0
2095  writename(outerCylinder, 1, 0);
2096  writemother(sttassembly, 1, 1);
2097  writemedium(AlBe);
2098  writehalftube((outerDiam / 2.) - outerCoverThickness, (outerDiam / 2.), (tubeLength + 0.4) / 2.);
2099  writetrans(0., 0., 0.);
2100  writerot(0., -1., 0., 1., 0., 0., 0., 0., 1.);
2101  // writerot(1., 0., 0., 0., -1., 0., 0., 0., 1.);
2102 
2103  // around the pipe CHECK why (pipeDiam/2.) "-" panelthickness/2?? -----------------
2104  // panel up x > 0
2105  writepanel(panel1, true, panelthickness, (outerDiam/2. - innerDiam/2.), (tubeLength + 0.4), 1);
2106  writetrans((pipeDiam/2.) + panelthickness/2., (outerDiam/2. + innerDiam/2.)/2., 0.);
2107  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
2108  // panel up x < 0
2109  writepanel(panel2, false, panelthickness, (outerDiam/2. - innerDiam/2.), (tubeLength + 0.4), 2);
2110  writetrans(-((pipeDiam/2.) + panelthickness/2.), (outerDiam/2. + innerDiam/2.)/2., 0.);
2111  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
2112  // panel down x > 0
2113  writepanel(panel3, false, panelthickness, (outerDiam/2. - innerDiam/2.), (tubeLength + 0.4), 1);
2114  writetrans((pipeDiam/2.) + panelthickness/2., -(outerDiam/2. + innerDiam/2.)/2., 0.);
2115  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
2116  // panel down x < 0
2117  writepanel(panel4, false, panelthickness, (outerDiam/2. - innerDiam/2.), (tubeLength + 0.4), 2);
2118  writetrans(-((pipeDiam/2.) + panelthickness/2.), -(outerDiam/2. + innerDiam/2.)/2., 0.);
2119  writerot(1., 0., 0., 0., 1., 0., 0., 0., 1.);
2120 
2121  }
2122 
2124  // //
2125  // Layers Geometry and //
2126  // Placement of the logical tubes : //
2127  // //
2129 
2130  double
2131  startRadius = innerCoverThickness + innerDiam / 2.; // CHECK added CoverThickness // CHECK
2132 
2133  bool
2134  wintzdesign = true;
2135 
2136  passive = true;//false;
2137 
2138  if (wintzdesign)
2139  {
2140 
2141  // NEW ONE!
2142  // 4 double layers of straight straws
2143  makeDoubleLayerStraightExact(startRadius);
2144  makeDoubleLayerStraightExact(startRadius);
2145  makeDoubleLayerStraightExact(startRadius);
2146  makeDoubleLayerStraightExact(startRadius);
2147 
2148  cerr << "start radius before skewed " << startRadius << endl;
2149  // startRadius = (ringteller + 1) * sqrt(3.) * radius;
2150 
2151  makeDoubleLayerSkewedLeft((26 * sqrt(3.) + 2) * (tubeSeperation / 2.));
2152  makeDoubleLayerSkewedRight((27 * sqrt(3.) + 4) * (tubeSeperation / 2.) + 0.244);
2153  makeDoubleLayerSkewedLeft((28 * sqrt(3.) + 6) * (tubeSeperation / 2.) + 2*0.244);
2154  makeDoubleLayerSkewedRight((29 * sqrt(3.) + 8) * (tubeSeperation / 2.) + 3*0.244);
2155 
2156 
2157  cerr << "start radius after " << startRadius << endl;
2158  startRadius += 10 * tubeSeperation * sqrt(3.) /2.;
2159 
2160  cerr << "start radius " << startRadius << endl;
2161 
2162  // then two double layers of straight straws
2163  makeDoubleLayerStraightExact(startRadius);
2164  makeDoubleLayerStraightExact(startRadius);
2165 
2166  }
2167  else
2168  {
2169  makeDoubleLayerStraightExact(startRadius);
2170  startRadius += tubeSeperation;
2171  makeDoubleLayerSkewedLeft(startRadius);
2172  startRadius += tubeSeperation + sqrt(3.) * (tubeSeperation / 2.);
2173  makeDoubleLayerSkewedRight(startRadius);
2174  startRadius += (tubeSeperation / 2.) + sqrt(3.) * (tubeSeperation / 2.);
2175  makeDoubleLayerStraightExact(startRadius);
2176  startRadius += tubeSeperation;
2177  makeDoubleLayerSkewedLeft(startRadius);
2178  startRadius += tubeSeperation + sqrt(3.) * (tubeSeperation / 2.);
2179  makeDoubleLayerSkewedRight(startRadius);
2180  startRadius += (tubeSeperation / 2.) + sqrt(3.) * (tubeSeperation / 2.);
2181  makeDoubleLayerStraightExact(startRadius);
2182  startRadius += tubeSeperation;
2183  makeDoubleLayerSkewedLeft(startRadius);
2184  startRadius += tubeSeperation + sqrt(3.) * (tubeSeperation / 2.);
2185  makeDoubleLayerSkewedRight(startRadius);
2186  startRadius += (tubeSeperation / 2.) + sqrt(3.) * (tubeSeperation / 2.);
2187  makeDoubleLayerStraightExact(startRadius);
2188  }
2189 
2190  // fill the rest of the volume with straight straws
2191  // straws outside the outerDiam will not be placed
2192  bool
2193  fillup = true;
2194 
2195  if (fillup)
2196  {
2197  makeDoubleLayerStraightExact(startRadius);
2198  makeDoubleLayerStraightExact(startRadius);
2199  makeDoubleLayerStraightExact(startRadius);
2200  makeDoubleLayerStraightExact(startRadius);
2201  makeDoubleLayerStraightExact(startRadius);
2202  makeDoubleLayerStraightExact(startRadius);
2203  makeDoubleLayerStraightExact(startRadius);
2204  makeDoubleLayerStraightExact(startRadius);
2205  makeDoubleLayerStraightExact(startRadius);
2206  makeDoubleLayerStraightExact(startRadius);
2207  }
2208 
2209  // output of all counters
2210  cerr << "tubes: " << tubeteller << endl;
2211  cerr << "axial tubes: " << axialtubeteller << endl;
2212  cerr << "skewed tubes full length: " << skewedtubeteller << endl;
2213  cerr << "skewed tubes short: " << shortskewedtubeteller << endl;
2214  cerr << "minimum radius: " << minimumradius << endl;
2215  cerr << "maximum radius: " << maximumradius << endl;
2216 
2217  return 0;
2218 }
2219 
2220 
2221 
#define GFK
#define pipeDiam
#define panelthickness
int main(int argc, char **argv)
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
bool putStraw(double posX, double posY, double posZ)
Definition: createSTT.C:171
static int shortskewedtubeteller
#define GasMixture
#define PVC
#define wireDiam
#define gassupplyLength
Int_t i
Definition: run_full.C:25
#define outerCylinder
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
#define innerCoverThickness
#define endcapLength
#define air
static double maximumradius
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
bool putStrawRotatedShortLeft(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
Definition: createSTT.C:295
static double minimumradius
#define outerDiam
#define ABS
#define panel1
#define crimppinLength
#define topcapInnerDiam
#define pi
Definition: createSTT.C:60
#define beltInnerDiam
#define springOuterDiam
static int counter4
#define springInnerDiam
#define noseOuterDiam
#define AlBe
#define topcapLength
#define skewangle
#define tubeLength
void writetrans(double x, double y, double z)
Definition: createSTT.C:155
void makeDoubleLayerStraightExact(double &startRadius)
Definition: createSTT.C:1397
static int counter3
#define endcapOuterDiam
void writerot(double x00, double x01, double x02, double x10, double x11, double x12, double x20, double x21, double x22)
Definition: createSTT.C:161
void writename(char const *name, bool support=false, bool leftside=false)
Definition: createSTT.C:86
void writemedium(char *name)
Definition: createSTT.C:104
bool putStrawRotatedRight(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
Definition: createSTT.C:474
bool putStrawRotatedShortRight(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
Definition: createSTT.C:352
#define beltDistance
static int axialtubeteller
#define tubeInnerDiam
static int tubeteller
#define Cu
const Double_t zpos
void plotrotright(double x, double y, double z)
Definition: createSTT.C:257
static int skewedtubeteller
#define ringLength
void makeSingleLayerStraightExact(double &startRadius)
Definition: createSTT.C:1430
#define gassupplyOuterDiam
#define springLength
#define gassupplyInnerDiam
void placeSingleLayerStraightExact(double ringteller)
Definition: createSTT.C:542
#define mylar
#define tubeOuterDiam
Double_t z
#define cave
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
void makeDoubleLayerSkewedRight(double startRadius)
Definition: createSTT.C:1453
static int counter1
void placeSingleLayerSkewedRight(double ringposition)
Definition: createSTT.C:593
#define outerCoverThickness
#define tubeSeperation
Definition: createSTT_150.C:38
bool putStrawRotatedLeft(double posX, double posY, double posZ, double xvector, double yvector, double zvector, double length)
Definition: createSTT.C:410
#define beltLength
TString name
#define sttCenterZ
void writehalftube(double inner, double outer, double length)
Definition: createSTT.C:118
void placeSingleLayerSkewedLeft(double ringposition)
Definition: createSTT.C:984
void makeDoubleLayerSkewedLeft(double startRadius)
Definition: createSTT.C:1460
#define noSupport
Double_t x
static int counter2
#define sttassembly
void writetube(double inner, double outer, double length)
Definition: createSTT.C:110
void plotrotleft(double x, double y, double z)
Definition: createSTT.C:278
#define W
#define safety
void writepanel(char const *name, bool firstone, double xthick, double ythick, double length, int side)
Definition: createSTT.C:127
#define CuBe
#define innerDiam
#define innerCylinder
Double_t y
#define panel4
#define panel3
double limit
Definition: dedx_bands.C:18
#define ringInnerDiam
#define gassupplyTransY
static int counter6
void writemother(char const *name, bool original=true, bool support=false)
Definition: createSTT.C:94
#define endcapInnerDiam
bool passive
static int counter5
#define noseLength
#define panel2