GEMC  1.8
Geant4 Monte-Carlo Framework
dc12geom.cc
Go to the documentation of this file.
1 //#include <stdlib.h>
2 #include <iostream>
3 #include <sstream>
4 #include <fstream>
5 #include <cmath>
6 #include <string>
7 #include <cstdlib>
8 #include <cstdio>
9 #include <cstring>
10 using namespace std;
11 
12 #include "dc12geom.h"
13 
14 int main()
15 {
16  // read the essential parameters from geometry.parm file
17  read_param("geometry.parm");
18 
19  // use this section to create files with trapezoid parameters
20  for(int ireg = 0; ireg < nreg; ireg++) get_thickness(ireg);
21  for(int isup = 0; isup < nslayers; isup++)
22  {//LOOP OVER SUPERLAYERS
23  calc_cosines_etc(isup);
24  for(int ilayer = 0; ilayer < nlayers; ilayer++)
25  {//LOOP OVER LAYERS
26  for(int iwir = 0; iwir < nwires; iwir++)
27  {//LOOP OVER WIRES
28  calc_wire_info(iwir,ilayer,isup);
29  }
30  calc_g4layer_parameters(ilayer,isup);
31  }
32  }
33 
35 
36  for(int isup = 0; isup < nslayers; isup++)
37  {
40  }
41  write_output_g4layers("layers-geom.dat");
42  write_output_g4mother("mother-geom.dat");
43 
44  return 0;
45 }
46 
47 
48 /*----------------------------------------------------------------------------*/
49 //calculates the angle (in degrees) between the 3d vectors (x1-x2) and (x1-x3)
50 //Returns :: angle (deg)
51 //Parameters :: 3d vectors: x1,x2,x3
52 double anglepoint(double x1[],double x2[],double x3[])
53 {
54  double angle, cosine, x1x2norm = 0.,x1x3norm = 0.,dot =0.;
55  /* first calculate norms of vectors*/
56  for (int i = 0; i < ndim; i++)
57  {
58  x1x2norm += (x1[i]-x2[i])*(x1[i]-x2[i]);
59  x1x3norm += (x1[i]-x3[i])*(x1[i]-x3[i]);
60  }
61  x1x2norm = sqrt(x1x2norm);
62  x1x3norm = sqrt(x1x3norm);
63  /* now do dot product*/
64  for (int i = 0; i < ndim; i++) dot += (x1[i]-x2[i])*(x1[i]-x3[i]);
65 
66  cosine = dot/x1x2norm/x1x3norm;
67  /* now calculate angle in degrees*/
68  angle = acos(cosine)*r2d;
69  angle = angle*(x2[1]-x3[1])/abs(x2[1]-x3[1]);
70 
71  return angle;
72 }
73 
74 
75 /*----------------------------------------------------------------------------*/
76 int wiretowire(double x1[], double x2[], double cwire[], double *par)
77 {
78  //calculates distance between parallel wires
79  //Returns :: the distance between wires (wir2wir (cm)) and the intersection on wire2 (x3)
80  //Parameters :: a point from each wire (x1,x2), their dir. cosine (cwire), ref.parameter (*par)
81  double x3[ndim]; //point on wire 2 closest to x1 (pt. on wire 1)
82  double wir2wir=0.,delta = 0.;
83  for (int i = 0; i<ndim; i++) delta += cwire[i]*(x1[i]-x2[i]);
84  for (int i = 0; i<ndim; i++) x3[i] = x2[i]+cwire[i]*delta;
85  for (int i = 0; i<ndim; i++) wir2wir += (x3[i]-x1[i])*(x3[i]-x1[i]);
86 
87  *par = sqrt(wir2wir);
88  *(par+1) = x3[0];
89  *(par+2) = x3[1];
90  *(par+3) = x3[2];
91 
92  return 1;
93 }
94 
95 
96 /*----------------------------------------------------------------------------*/
97 
98 //Returns :: length from wire point to intersection (wirelen), and intersection point (xintersection)
99 //Parameters :: point on the wire (xwire), wire direction (cwire), point on the plate (xplates),
100 //Parameters (cont) ::plate normal (cplate), ref. parameter (*par)
101 int lineplaneint(double xwire[],double cwire[],double xplates[],double cplate[],double *par)
102 {
103  double wirelen,xintersection[ndim];
104  double num[ndim],denom[ndim]; // temp variables
105  //solve 4 eqns (3 line eqs., 1 plane eq.) for 4 quantities:
106  //the 3 intersection points and the line length
107  for (int i = 0; i<ndim; i++)
108  {
109  num[i] = cplate[i]*(xwire[i]-xplates[i]);
110  denom[i] = cwire[i]*cplate[i];
111  }
112  wirelen = -(num[0]+num[1]+num[2])/(denom[0]+denom[1]+denom[2]); //wire length from mid-point to plane
113  for (int i = 0; i<ndim; i++) xintersection[i]= xwire[i]+wirelen*cwire[i];
114 
115  *par = wirelen;
116  *(par+1) = xintersection[0];
117  *(par+2) = xintersection[1];
118  *(par+3) = xintersection[2];
119  return 1;
120 }
121 
122 /*----------------------------------------------------------------------------------------*/
123 void read_param(string filename)
124 {
125  string line;
126  ifstream infile;
127  int i,j;
128  string s;
129  double a1,a2,a3,a4,a5,a6,a7,b1,b2,b3;
130 
131  infile.open(filename.c_str());
132  if (infile!=NULL)
133  {
134  cout << "File " << filename << " is open succesfully " << endl;
135  while (!infile.eof())
136  {
137  getline(infile,line);
138  //cout<<line<<endl;
139  if(line.compare(0,1,"#")==0)
140  {
141  istringstream iss;
142  iss.str(line);
143  iss >>s>>i>>a1>>a2>>a3>>a4>>a5>>a6>>a7;
144  rlyr[i-1] = a1;
145  thopen[i-1] = a2;
146  thtilt[i-1] = a3;
147  thster[i-1] = a4;
148  thmin[i-1] = a5;
149  d[i-1] = a6;
150  xe[i-1] = a7;
151  //cout << i << " "<<xe[i-1]<<endl;
152  }
153  //cout<<line<<endl;
154  if(line.compare(0,1,"!")==0)
155  {
156  //cout<<line<<endl;
157  istringstream iss;
158  iss.str(line);
159  iss >>s>>i>>b1>>b2>>b3;
160  frontgap[i-1] = b1;
161  midgap[i-1] = b2;
162  backgap[i-1] = b3;
163  //cout << i << " "<<midgap[i-1]<<endl;
164  }
165  }
166  infile.close();
167  cout << " end reading " << endl;
168  }
169  else
170  cout << "Error: File " << filename << " is not opened " << endl;
171 
172 }
173 /*----------------------------------------------------------------------------------------*/
174 void get_thickness(int ireg){
175  int isup1 = 2*ireg;
176  int isup2 = isup1+1;
177  rlyr[isup2] = rlyr[isup1]+totnlyr*d[isup1]+midgap[ireg];
178  layerthickness[isup1] = avethick*d[isup1];
179  layerthickness[isup2] = avethick*d[isup2];
180  regthickness[ireg] = frontgap[ireg]+midgap[ireg]+ backgap[ireg]+totnlyr*d[isup1]+totnlyr*d[isup2];
181  //cout<< isup1<<" "<<isup2<<" "<<rlyr[isup1]<<endl;
182 }
183 
184 /*----------------------------------------------------------------------------------------*/
185 void calc_cosines_etc(int isup){
186 //calculate some commonly used expressions
187  ctilt = cos(thtilt[isup]*d2r);
188  stilt = sin(thtilt[isup]*d2r);
189  cster = cos(thster[isup]*d2r);
190  sster = sin(thster[isup]*d2r);
191  dw = d[isup]*4.*cos(30.*d2r); //characteristic distance between sense wires
192  dw2 = dw/cster; // distance between the wire 'mid-points' which are the intersections of the wires with the chamber mid-plane
193 //calculate wire direction cosines
194  //cwire[0] = -sster*ctilt;
195  //cwire[1] = cster;
196  //cwire[2] = sster*stilt;
197  cwire[0] = cwirex(isup);
198  cwire[1] = cwirey(isup);
199  cwire[2] = cwirez(isup);
200 //calculate direction cosines of wire planes
201  cplane[0] = stilt;
202  cplane[1] = 0.;
203  cplane[2] = ctilt;
204 //calculate direction cosines of right-hand endplate
205  crhplate[0] = sin(thopen[isup]/2.*d2r);
206  crhplate[1] = cos(thopen[isup]/2.*d2r);
207  crhplate[2] = 0.;
208 //calculate direction cosines of rleft-hand endplate
209  clhplate[0] = sin(thopen[isup]/2.*d2r);
210  clhplate[1] =-cos(thopen[isup]/2.*d2r);
211  clhplate[2] = 0.;
212 
213 //input a common point on the right-hand and left-hand endplate
214 //- we have chosen a point at y,z =0; i.e. the x-distance from the
215 //beamline to the intersection line of the two endplates
216  xplates[0] = xe[isup];
217  xplates[1] = 0.;
218  xplates[2] = 0.;
219 
220 /* now, calculate the midpoint posn. of the first guard wire in
221  the first guard layer, using the angle, thmin, as defined for
222  the "ifirstwir" guard wire in that superlayer
223  where "mid-point" is the intersection of the first wire w/ the mid-plane
224 
225  What is the FIRST WIRE?
226  X0mid is the position of the first "marked" or "fiducial" wire;
227  the one whose "mid-point" is at a polar angle of THMIN;
228  in the first layer which is a GUARD WIRE LAYER.
229  ifirstwir(sup) is the integer marker of which wire this is
230 */
231  r = rlyr[isup];
232  dist1mid = r/cos((thtilt[isup]-thmin[isup])*d2r);
233  x0mid = dist1mid*sin(thmin[isup]*d2r)-(ifirstwir[isup]-1)*dw2*ctilt;
234  y0mid = 0.;
235  z0mid = dist1mid*cos(thmin[isup]*d2r)+(ifirstwir[isup]-1)*dw2*ctilt;
236 // calculate the thickness of a geant4 "layer"; where a geant4 layer is 3 layer thicknesses
237  lyrthick = layerthickness[isup];
238 }
239 
240 /*----------------------------------------------------------------------------------------*/
241 
242 void calc_midpoints(int ilayer, int isup){
243  int l1,l2,l3,l4;
244 //first, calculate the distance to the layer in question from the first layer
245  r = (ilayer)*avethick*d[isup];
246 //now, calculate the midpoint posn. of the 1st wire in the layer where "mid-point" is the intersection of the first wire w/ the mid-plane
247  x1mid = x0mid+stilt*r;
248  y1mid = 0.;
249  z1mid = z0mid+ctilt*r;
250 //now, put in the "brick-wall" stagger: layer-to-layer
251  if (staggerflag==1){
252  l1=1; l2=3; l3=5; l4=7;
253  }
254  else if(staggerflag==0){
255  l1=0; l2=2; l3=4; l4=6;
256  }
257  else
258  cout<< "stagger error"<<endl;
259  if(ilayer==l1||ilayer==l2||ilayer==l3||ilayer==l4){
260  x1mid=x1mid-0.5*dw2*ctilt;
261  y1mid=0.;
262  z1mid=z1mid+0.5*dw2*stilt;
263  }
264 
265 }
266 /*----------------------------------------------------------------------------------------*/
267 void calc_wire_info(int iwir, int ilayer, int isup){
268  double param[4];
269  double wirelenr,wirelenl;
270  double c,s,x,y,z,xrtpl,yrtpl,zrtpl,xlfpl,ylfpl,zlfpl;
271 
272 //xmid is the wire "mid-point"
273  //xmid[0][iwir] = x1mid+(iwir)*dw2*ctilt;
274  //xmid[1][iwir] = 0.;
275  //xmid[2][iwir] = z1mid-(iwir)*dw2*stilt;
276 
277  xmid[0][iwir] = wiremidx(iwir,ilayer,isup);
278  xmid[1][iwir] = wiremidy(iwir,ilayer,isup);
279  xmid[2][iwir] = wiremidz(iwir,ilayer,isup);
280  angmid[iwir] = atan(xmid[0][iwir]/xmid[2][iwir])*r2d;//polar angle to the wire mid-point (deg)
281 
282 //find the intersection of line with a plane and the distance to the plane; first load 3-vectors:
283  for (int i = 0; i<ndim; i++) xmidwire[i]=xmid[i][iwir];
284 
285 //call intersection finder (for right and left plates)
287  wirelenr = param[0];
288  xrightwire[0] = param[1];
289  xrightwire[1] = param[2];
290  xrightwire[2] = param[3];
291 
293  wirelenl = param[0];
294  xleftwire[0] = param[1];
295  xleftwire[1] = param[2];
296  xleftwire[2] = param[3];
297 
298  for (int i = 0; i<ndim; i++){
299  xright[i][isup][ilayer][iwir] = xrightwire[i];
300  xleft[i][isup][ilayer][iwir] = xleftwire[i];
301  //x,y,z of the wire center (not it's "mid-point")
302  xcenter[i][iwir] = (xleft[i][isup][ilayer][iwir]+xright[i][isup][ilayer][iwir])/2.;
303  }
304 //total wirelength of each wire
305  wirelength[iwir] = abs(wirelenl)+abs(wirelenr);
306 
307 
308 }
309 
310 /*----------------------------------------------------------------------------------------*/
311 void calc_g4layer_parameters(int ilayer,int isup){
312 /*
313 c calculate the parameters for each layer's trapezoid ----
314 c One layer of sense wires lies in a trapezoidal volume
315 c The trapezoidal volume has two trapezoidal faces and
316 c four rectangular faces. The front and back trapezoidal
317 c faces are in planes which are parallel to the sense wire
318 c plane and equidistant from it. The distance between
319 c the trapezoidal planes is the thickness in z.
320 c "x" is in the wire direction and "y" is perpendicular
321 c to the wire direction, but in the wire plane.
322 c To summarize "z_trap" is parallel to a 25 deg. ray from
323 c the target, "x_trap" is parallel to the wires.
324 c The y_trap extent of the trapezoid goes from guard wire
325 c to guard wire; 113 wire-gaps in total (2 guard wires, 112
326 c sense wires). The smaller "x_trap" side is the length of
327 c the short guard wire, and the larger is the length of the
328 c long guard wire.
329 */
330  double param[4];
331  double xpoint1[ndim],xpoint2[ndim],xpoint3[ndim],wir2wir;
332 //calculate the short and long "x" lengths
333  delx1lyr[isup][ilayer] = wirelength[0]/2.;
334  delx2lyr[isup][ilayer] = wirelength[nwires-1]/2.;
335 //calculate the "y" length of the layer trapezoid
336  for (int i = 0; i<ndim; i++){
337  xpoint1[i] = xcenter[i][0];
338  xpoint2[i] = xcenter[i][nwires-1];
339  }
340 //plane is a test result; it should equal 0 if x,y,z in a plane
341  double plane=0.;
342  for (int i = 0; i<ndim; i++) plane=plane+cplane[i]*(xcenter[i][0]-xcenter[i][nwires-1]);
343 
344 //calculate the separation between parallel wires ---------
345 //inputs: a point from each wire, their dir. cosine
346 //output: the distance between wires and the intersection on wire2
347  wiretowire(xpoint1,xpoint2, cwire, &param[0]);
348  wir2wir = param[0];
349  xpoint3[0] = param[1];
350  xpoint3[1] = param[2];
351  xpoint3[2] = param[3];
352 
353  wirespan[isup][ilayer] = wir2wir;
354  delylyr[isup][ilayer] = wir2wir/2.;
355 
356 // calculate the angle between the perp. line (x1-x3) and the line joining the centers, (x1-x2)
357  lyrangle[isup][ilayer] = anglepoint(xpoint1,xpoint2,xpoint3);
358 
359 // now calculate the "middle" of the layer trapezoid
360  for (int i = 0; i<ndim; i++) xlyr[i][isup][ilayer] =(xcenter[i][0]+xcenter[i][nwires-1])/2.;
361 
362 }
363 /*----------------------------------------------------------------------------------------*/
364 void calc_g4mother_positions(int isup){
365  for (int ireg = 0; ireg < nreg; ireg++) {
366  dely[ireg] = (xx2[ireg]-xx1[ireg])/cos(thtilt[isup]*d2r)/2.;
367  center_m[0][ireg] =(xx1[ireg]+xx2[ireg])/2.;
368  center_m[1][ireg] = 0;
369  center_m[2][ireg] =(xz1[ireg]+xz2[ireg])/2.;
370 
371 //expand the mother volume (optional)
372  delx1[ireg] = expand*delx1[ireg];
373  delx2[ireg] = expand*delx2[ireg];
374  dely[ireg] = expand*dely[ireg];
375  regthickness[ireg]= expand*regthickness[ireg];
376 
377  }
378 
379 
380 }
381 /*----------------------------------------------------------------------------------------*/
383  delx1[0] = xleft[1][0][0][0];
384  delx1[1] = xleft[1][2][0][0];
385  delx1[2] = xleft[1][4][0][0];
386  delx2[0] = xleft[1][1][7][nwires-1];
387  delx2[1] = xleft[1][3][7][nwires-1];
388  delx2[2] = xleft[1][5][7][nwires-1];
389 
390  xx1[0] = xleft[0][0][0][0];
391  xx1[1] = xleft[0][2][0][0];
392  xx1[2] = xleft[0][4][0][0];
393  xx2[0] = xleft[0][1][7][nwires-1];
394  xx2[1] = xleft[0][3][7][nwires-1];
395  xx2[2] = xleft[0][5][7][nwires-1];
396 
397  xz1[0] = xleft[2][0][0][0];
398  xz1[1] = xleft[2][2][0][0];
399  xz1[2] = xleft[2][4][0][0];
400  xz2[0] = xleft[2][1][7][nwires-1];
401  xz2[1] = xleft[2][3][7][nwires-1];
402  xz2[2] = xleft[2][5][7][nwires-1];
403 
404 
405 }
406 
407 /*----------------------------------------------------------------------------------------*/
408 void calc_g4layer_positions(int isup){
409  int ireg = -1;
410  double ctilt,sltilt;
411  double dx,dy,dz;
412 
413  ctilt = cos(thtilt[isup]*d2r);
414  stilt = sin(thtilt[isup]*d2r);
415 
416  if(isup==0 || isup ==1) ireg = 0;
417  if(isup==2 || isup ==3) ireg = 1;
418  if(isup==4 || isup ==5) ireg = 2;
419 
420  for (int ilayer = 0; ilayer < nlayers; ilayer++) {
421 // calculate distance in sector coord. system
422 
423  dx = xlyr[0][isup][ilayer]-center_m[0][ireg];
424  dy = xlyr[1][isup][ilayer]-center_m[1][ireg];
425  dz = xlyr[2][isup][ilayer]-center_m[2][ireg];
426 
427 
428 // now rotate to the mother coordinate system and interchange "x" and "y"
429  delxlyr[0][isup][ilayer] = dy;
430  delxlyr[1][isup][ilayer] = ctilt*dx-stilt*dz;
431  delxlyr[2][isup][ilayer] = ctilt*dz+stilt*dx;
432  }
433 }
434 
435 
436 /*----------------------------------------------------------------------------*/
437 void write_output_g4layers(string filename)
438 {
439  ofstream outfile;
440  outfile.open(filename.c_str());
441  if (outfile.is_open())
442  {
443  for (int isup = 0; isup < nslayers; isup++)
444  {
445  for (int ilayer = 0; ilayer < nlayers; ilayer++)
446  {
447  outfile<<isup+1<<" "<<ilayer+1<<" "<<
448  delxlyr[0][isup][ilayer]<<" "<<delxlyr[1][isup][ilayer]<<" "<<delxlyr[2][isup][ilayer]<<" "<<
449  delx1lyr[isup][ilayer] <<" "<<delx2lyr[isup][ilayer] <<" "<<delylyr[isup][ilayer]<<" "<<
450  lyrangle[isup][ilayer] <<" "<<layerthickness[isup]/2 <<" "<<thster[isup]<<endl;
451  }
452  }
453  outfile.close();
454  }
455  else cout << "Unable to open file";
456 }
457 
458 
459 /*----------------------------------------------------------------------------*/
460 void write_output_g4mother(string filename)
461 {
462  ofstream outfile;
463  outfile.open(filename.c_str());
464  if (outfile.is_open())
465  {
466  for (int ireg = 0; ireg < nreg; ireg++)
467  {
468  outfile<<ireg+1<<" "<<delx1[ireg]<<" "<<delx2[ireg] <<" "<<dely[ireg]<<" "<<
469  regthickness[ireg]/2 <<" "<<center_m[1][ireg]<<" "<<center_m[0][ireg]<<" "<<center_m[2][ireg]<<endl;
470  }
471  outfile.close();
472  }
473  else cout << "Unable to open file";
474 }
475 
476 
477 /*----------------------------------------------------------------------------*/
478 double cwirex(int isup)
479 {//calculate wire direction cosine-x
480  double cwire;
481  cwire = -sin(thster[isup]*d2r)*cos(thtilt[isup]*d2r);
482  return cwire;
483 }
484 
485 
486 /*----------------------------------------------------------------------------*/
487 double cwirey(int isup){//calculate wire direction cosine-y
488  double cwire;
489  cwire = cos(thster[isup]*d2r);
490  return cwire;
491 }
492 
493 
494 /*----------------------------------------------------------------------------*/
495 double cwirez(int isup)
496 {//calculate wire direction cosine-z
497  double cwire;
498  cwire = sin(thster[isup]*d2r)*sin(thtilt[isup]*d2r);
499  return cwire;
500 }
501 
502 
503 /*----------------------------------------------------------------------------*/
504 double wiremidx(int iwir, int ilayer, int isup)
505 {//wire "mid-point" in x
506  int l1, l2, l3, l4;
507  double xmid;
508  calc_cosines_etc(isup);
509  r = (ilayer)*avethick*d[isup];
510  x1mid = x0mid+stilt*r;
511 
512  //now, put in the "brick-wall" stagger: layer-to-layer
513  if(staggerflag==1)
514  {
515  l1=1; l2=3; l3=5; l4=7;
516  }
517  else if(staggerflag==0)
518  {
519  l1=0; l2=2; l3=4; l4=6;
520  }
521  else
522  cout<< "stagger error"<<endl;
523 
524  if(ilayer==l1||ilayer==l2||ilayer==l3||ilayer==l4)
525  {
526  x1mid=x1mid-0.5*dw2*ctilt;
527  }
528 
529  xmid = x1mid+(iwir)*dw2*ctilt;
530  return xmid;
531  //cout<<x0mid<<" "<<stilt<<" "<<r" "<<dw2<<" "<<ctilt<<endl;
532 }
533 
534 
535 /*----------------------------------------------------------------------------*/
536 double wiremidy(int iwir, int ilayer, int isup)
537 {// wire "mid-point" in y
538  return 0.;
539 }
540 
541 
542 /*----------------------------------------------------------------------------*/
543 double wiremidz(int iwir, int ilayer, int isup)
544 {//wire "mid-point" in z
545  int l1, l2, l3, l4;
546  double zmid;
547  calc_cosines_etc(isup);
548  r = (ilayer)*avethick*d[isup];
549  z1mid = z0mid+ctilt*r;
550 
551  //now, put in the "brick-wall" stagger: layer-to-layer
552  if(staggerflag==1)
553  {
554  l1=1; l2=3; l3=5; l4=7;
555  }
556  else if(staggerflag==0)
557  {
558  l1=0; l2=2; l3=4; l4=6;
559  }
560  else
561  cout<< "stagger error"<<endl;
562  if(ilayer==l1||ilayer==l2||ilayer==l3||ilayer==l4)
563  {
564  z1mid=z1mid+0.5*dw2*stilt;
565  }
566 
567  zmid = z1mid-(iwir)*dw2*stilt;
568  return zmid;
569 }
570 
571 
572 /*----------------------------------------------------------------------------*/
573 void getWirePositions(int isup,int ilayer,double xc[],double yc[],double zc[],double xcos[],double ycos[],double zcos[])
574 {
575  for (int iwir = 0; iwir < nwires; iwir++)
576  {//LOOP OVER WIRES
577  xc[iwir] = wiremidx(iwir,ilayer,isup);
578  yc[iwir] = wiremidy(iwir,ilayer,isup);
579  zc[iwir] = wiremidz(iwir,ilayer,isup);
580  xcos[iwir] = cwirex(isup);
581  ycos[iwir] = cwirey(isup);
582  zcos[iwir] = cwirez(isup);
583  }
584 }
const int ndim
Definition: dc12geom.h:32
double dw
Definition: dc12geom.h:59
double dely[nreg]
Definition: dc12geom.h:68
double xz1[nreg]
Definition: dc12geom.h:67
double cwirez(int isup)
Definition: dc12geom.cc:495
double wirespan[nslayers][nlayers]
Definition: dc12geom.h:65
double cplane[ndim]
Definition: dc12geom.h:56
double wirelength[nwires]
Definition: dc12geom.h:61
void write_output_g4layers(string filename)
Definition: dc12geom.cc:437
double crhplate[ndim]
Definition: dc12geom.h:57
const int staggerflag
Definition: dc12geom.h:37
double xlyr[ndim][nslayers][nlayers]
Definition: dc12geom.h:66
double regthickness[nreg]
Definition: dc12geom.h:54
void calc_midpoints(int ilayer, int isup)
Definition: dc12geom.cc:242
double xrightwire[ndim]
Definition: dc12geom.h:62
double layerthickness[nslayers]
Definition: dc12geom.h:55
const int nlayers
Definition: dc12geom.h:30
double x1mid
Definition: dc12geom.h:60
const int nwires
Definition: dc12geom.h:34
const int totnlyr
Definition: dc12geom.h:35
double thmin[nslayers]
Definition: dc12geom.h:44
double xcenter[ndim][nwires]
Definition: dc12geom.h:63
double rlyr[nslayers]
Definition: dc12geom.h:40
double delx1[nreg]
Definition: dc12geom.h:68
double xmidwire[ndim]
Definition: dc12geom.h:62
double dw2
Definition: dc12geom.h:59
const int nslayers
Definition: dc12geom.h:31
void getWirePositions(int isup, int ilayer, double xc[], double yc[], double zc[], double xcos[], double ycos[], double zcos[])
Definition: dc12geom.cc:573
double delxlyr[ndim][nslayers][nlayers]
Definition: dc12geom.h:69
STL namespace.
double dist1mid
Definition: dc12geom.h:60
void calc_wire_info(int iwir, int ilayer, int isup)
Definition: dc12geom.cc:267
double y0mid
Definition: dc12geom.h:60
double x0mid
Definition: dc12geom.h:60
void get_thickness(int ireg)
Definition: dc12geom.cc:174
double xe[nslayers]
Definition: dc12geom.h:46
double midgap[nreg]
Definition: dc12geom.h:48
double xplates[ndim]
Definition: dc12geom.h:58
double wiremidz(int iwir, int ilayer, int isup)
Definition: dc12geom.cc:543
double delx2[nreg]
Definition: dc12geom.h:68
int ifirstwir[nslayers]
Definition: dc12geom.h:52
double expand
Definition: dc12geom.h:27
void calc_g4layer_parameters(int ilayer, int isup)
Definition: dc12geom.cc:311
double xmid[ndim][nwires]
Definition: dc12geom.h:61
int wiretowire(double x1[], double x2[], double cwire[], double *par)
Definition: dc12geom.cc:76
double xleftwire[ndim]
Definition: dc12geom.h:62
double thster[nslayers]
Definition: dc12geom.h:43
void calc_g4mother_positions(int isup)
Definition: dc12geom.cc:364
const int nreg
Definition: dc12geom.h:33
double sster
Definition: dc12geom.h:59
void read_param(string filename)
Definition: dc12geom.cc:123
double d2r
Definition: dc12geom.h:25
double xleft[ndim][nslayers][nlayers][nwires]
Definition: dc12geom.h:63
double lyrangle[nslayers][nlayers]
Definition: dc12geom.h:65
void write_output_g4mother(string filename)
Definition: dc12geom.cc:460
int lineplaneint(double xwire[], double cwire[], double xplates[], double cplate[], double *par)
Definition: dc12geom.cc:101
double y1mid
Definition: dc12geom.h:60
void calc_cosines_etc(int isup)
Definition: dc12geom.cc:185
double wiremidx(int iwir, int ilayer, int isup)
Definition: dc12geom.cc:504
double thtilt[nslayers]
Definition: dc12geom.h:42
double xx2[nreg]
Definition: dc12geom.h:67
double cwirex(int isup)
Definition: dc12geom.cc:478
double r2d
Definition: dc12geom.h:26
void def_some_numbers()
Definition: dc12geom.cc:382
double d[nslayers]
Definition: dc12geom.h:45
double stilt
Definition: dc12geom.h:59
double lyrthick
Definition: dc12geom.h:60
double delx1lyr[nslayers][nlayers]
Definition: dc12geom.h:64
double thopen[nslayers]
Definition: dc12geom.h:41
double z1mid
Definition: dc12geom.h:60
double delylyr[nslayers][nlayers]
Definition: dc12geom.h:64
double xright[ndim][nslayers][nlayers][nwires]
Definition: dc12geom.h:63
double frontgap[nreg]
Definition: dc12geom.h:47
double clhplate[ndim]
Definition: dc12geom.h:57
double backgap[nreg]
Definition: dc12geom.h:49
void calc_g4layer_positions(int isup)
Definition: dc12geom.cc:408
double cster
Definition: dc12geom.h:59
const int avethick
Definition: dc12geom.h:36
double angmid[nwires]
Definition: dc12geom.h:61
double z0mid
Definition: dc12geom.h:60
double anglepoint(double x1[], double x2[], double x3[])
Definition: dc12geom.cc:52
double cwirey(int isup)
Definition: dc12geom.cc:487
double xx1[nreg]
Definition: dc12geom.h:67
double r
Definition: dc12geom.h:54
double delx2lyr[nslayers][nlayers]
Definition: dc12geom.h:64
double wiremidy(int iwir, int ilayer, int isup)
Definition: dc12geom.cc:536
double center_m[ndim][nreg]
Definition: dc12geom.h:68
double xz2[nreg]
Definition: dc12geom.h:67
double ctilt
Definition: dc12geom.h:59
double cwire[ndim]
Definition: dc12geom.h:56
int main()
Definition: dc12geom.cc:14