ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ML2Acc2.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ML2Acc2.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // The code was written by :
27 // ^Claudio Andenna claudio.andenna@ispesl.it, claudio.andenna@iss.infn.it
28 // *Barbara Caccia barbara.caccia@iss.it
29 // with the support of Pablo Cirrone (LNS, INFN Catania Italy)
30 // with the contribute of Alessandro Occhigrossi*
31 //
32 // ^INAIL DIPIA - ex ISPESL and INFN Roma, gruppo collegato Sanità, Italy
33 // *Istituto Superiore di Sanità and INFN Roma, gruppo collegato Sanità, Italy
34 // Viale Regina Elena 299, 00161 Roma (Italy)
35 // tel (39) 06 49902246
36 // fax (39) 06 49387075
37 //
38 // more information:
39 // http://g4advancedexamples.lngs.infn.it/Examples/medical-linac
40 //
41 //*******************************************************//
42 
43 
44 #include "ML2Acc2.hh"
45 #include "ML2Acc2Messenger.hh"
46 #include "ML2Accelerator.hh"
47 
48 #include "G4SystemOfUnits.hh"
49 #include "G4ios.hh"
50 
51 using namespace std;
52 
54 {
55  PVWorld = 0;
56  acc2Messenger = new CML2Acc2Messenger(this);
57 }
58 
60 {
61 }
62 
64 
66 {
67  if (instance == 0)
68  {
69  instance = new CML2Acc2();
70  }
71  return instance;
72 }
74 {
75  G4cout << "----------------------------------------------------------------" << G4endl;;
76  G4cout << "Accelerator VARIAN LINAC 2100 " << G4endl;
77  G4cout <<"\n\n\tnominal beam energy: "<<idEnergy << G4endl;
78  G4cout << "\tdistance isocentre [mm]:"<< isoCentre/mm << G4endl;
79  G4cout <<"\tJaw X aperture: 1) "<< jaw1XAperture/mm<<"[mm]\t2) " << jaw2XAperture/mm<< " [mm]"<< G4endl;
80  G4cout <<"\tJaw Y aperture: 1) "<< jaw1YAperture/mm<<"[mm]\t2) " << jaw2YAperture/mm<< " [mm]\n"<< G4endl;
81  if (vec_leavesA.size()>0)
82  {
83  G4cout << "\tvec_leaves A aperture [mm]" << G4endl;;
84  for (int i=0; i< (int)vec_leavesA.size(); i++)
85  {
86  G4cout<<"\t" <<i <<") "<< vec_leavesA[i]/mm << G4endl;
87  }
88  }
89  else
90  {
91  G4cout << "\tNo vec_leaves A" << G4endl;
92  }
93  if (vec_leavesB.size()>0)
94  {
95  G4cout << "\tvec_leaves B aperture [mm]" << G4endl;
96  for (int i=0; i< (int)vec_leavesB.size(); i++)
97  {
98  G4cout<<"\t" <<i <<") "<< vec_leavesB[i]/mm << G4endl;
99  }
100  }
101  else
102  {
103  G4cout << "\tNo vec_leaves B" << G4endl;
104  }
105  G4cout << "______________________________________________________________" << G4endl;
106 }
107 
109 {
110  setIsoCentre(iso);
111  PVWorld = PWorld;
112  target();
113  vacuumWindow();
114  ionizationChamber();
115  flatteningFilter();
116  mirror();
117  primaryCollimator();
118  MLC();
119  Jaw1X();
120  Jaw2X();
121  Jaw1Y();
122  Jaw2Y();
123 }
125 {
126  using namespace std;
127  G4double theta, x, y, z, dx, dy; //, dz, top;
128 // G4double beta, R;
129  x=centre.getX();
130  y=centre.getY();
131  z=centre.getZ();
132 // top=z-78./2.;
133  dx=halfSize.getX();
134  dy=halfSize.getY();
135 // dz=halfSize.getZ();
136 
137 // G4double p1x, p1y, p2x, p2y, dist;
138 
139  switch (idJaw)
140  {
141  case 1: //idJaw1XV2100:
142  theta=fabs(atan(jaw1XAperture/isoCentre));
143  centre.set(z*sin(theta)+dx*cos(theta), y, z*cos(theta)-dx*sin(theta));
144  cRotation->rotateY(-theta);
145  break;
146 
147  case 2: //idJaw2XV2100:
148  theta=fabs(atan(jaw2XAperture/isoCentre));
149  centre.set(-(z*sin(theta)+dx*cos(theta)), y, z*cos(theta)-dx*sin(theta));
150  cRotation->rotateY(theta);
151  break;
152 
153  case 3: //idJaw1YV2100:
154  theta=fabs(atan(jaw1YAperture/isoCentre));
155  centre.set(x, z*sin(theta)+dy*cos(theta), z*cos(theta)-dy*sin(theta));
156  cRotation->rotateX(theta);
157  break;
158 
159  case 4: //idJaw2YV2100:
160  theta=fabs(atan(jaw2YAperture/isoCentre));
161  centre.set(x, -(z*sin(theta)+dy*cos(theta)), z*cos(theta)-dy*sin(theta));
162  cRotation->rotateX(-theta);
163  break;
164  }
165 }
166 
167 
169 {
170  bool bCreated = false;
171  switch (idEnergy)
172  {
173  case 6:
174  {
175  // Physical and logical volumes
177  G4Box *targetABox = new G4Box("targetABox", 5.*mm, 5.*mm, (.035*25.4/2.)*mm);
178  G4LogicalVolume *targetALV = new G4LogicalVolume(targetABox, W, "targetALV", 0, 0, 0);
179 
181  G4Box *targetBBox = new G4Box("targetABox", 5.*mm, 5.*mm, (0.062*25.4/2.)*mm);
182  G4LogicalVolume *targetBLV = new G4LogicalVolume(targetBBox, Cu, "targetBLV", 0, 0, 0);
183 
184  // specific translations for the various parts of the component
185  new G4PVPlacement(
186  0,
187  G4ThreeVector(0.,0.,targetABox->GetZHalfLength()),
188  "targetAPV",
189  targetALV,
190  PVWorld,
191  false,
192  0);
193 
194  new G4PVPlacement(
195  0,
196  G4ThreeVector(0.,0.,targetABox->GetZHalfLength()*2.+targetBBox->GetZHalfLength()),
197  "targetBPV",
198  targetBLV,
199  PVWorld,
200  false,
201  0);
202 
203  // Region for cuts
204  G4Region *regVol= new G4Region("targetR");
206  cuts->SetProductionCut(0.2*cm);
207  regVol->SetProductionCuts(cuts);
208 
209  targetALV->SetRegion(regVol);
210  regVol->AddRootLogicalVolume(targetALV);
211 
212  targetBLV->SetRegion(regVol);
213  regVol->AddRootLogicalVolume(targetBLV);
214 
215  // Visibility
216  G4VisAttributes* simpleAlSVisAtt= new G4VisAttributes(G4Colour::Red());
217  simpleAlSVisAtt->SetVisibility(true);
218  targetALV->SetVisAttributes(simpleAlSVisAtt);
219 
220  G4VisAttributes* simpleBlSVisAtt= new G4VisAttributes(G4Colour::Yellow());
221  simpleBlSVisAtt->SetVisibility(true);
222  targetBLV->SetVisAttributes(simpleBlSVisAtt);
223 
224  bCreated = true;
225  break;
226  }
227  case 15:
228  {
229  // Physical and logical volumes
231  G4Box *targetABox = new G4Box("targetABox", 5.*mm, 5.*mm, (.025*25.4/2.)*mm);
232  G4LogicalVolume *targetALV = new G4LogicalVolume(targetABox, W, "targetALV", 0, 0, 0);
233 
235  G4Box *targetBBox = new G4Box("targetABox", 5.*mm, 5.*mm, (0.312*25.4/2.)*mm);
236  G4LogicalVolume *targetBLV = new G4LogicalVolume(targetBBox, Cu, "targetBLV", 0, 0, 0);
237 
238  // specific translations for the various parts of the component
239  new G4PVPlacement(
240  0,
241  G4ThreeVector(0.,0.,targetABox->GetZHalfLength()),
242  "targetAPV",
243  targetALV,
244  PVWorld,
245  false,
246  0);
247 
248  new G4PVPlacement(
249  0,
250  G4ThreeVector(0.,0.,targetABox->GetZHalfLength()*2.+targetBBox->GetZHalfLength()),
251  "targetBPV",
252  targetBLV,
253  PVWorld,
254  false,
255  0);
256 
257  // Region for cuts
258  G4Region *regVol= new G4Region("targetR");
260  cuts->SetProductionCut(0.2*cm);
261  regVol->SetProductionCuts(cuts);
262 
263  targetALV->SetRegion(regVol);
264  regVol->AddRootLogicalVolume(targetALV);
265 
266  targetBLV->SetRegion(regVol);
267  regVol->AddRootLogicalVolume(targetBLV);
268 
269  // Visibility
270  G4VisAttributes* simpleAlSVisAtt= new G4VisAttributes(G4Colour::Red());
271  simpleAlSVisAtt->SetVisibility(true);
272  targetALV->SetVisAttributes(simpleAlSVisAtt);
273 
274  G4VisAttributes* simpleBlSVisAtt= new G4VisAttributes(G4Colour::Yellow());
275  simpleBlSVisAtt->SetVisibility(true);
276  targetBLV->SetVisAttributes(simpleBlSVisAtt);
277 
278  bCreated=true;
279  break;
280  }
281  }
282  return bCreated;
283 }
285 {
286  bool bCreated = false;
287  // the component as a whole
288  G4double totalHeight = 80.0*mm;
289 
291  G4Material *Vacuum = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
292 
293  // Region for cuts
294  G4Region *regVol = new G4Region("primaryCollimator");
296  cuts->SetProductionCut(1.*cm);
297  regVol->SetProductionCuts(cuts);
298 
299  // //-------------------- upper part----------------
300  G4ThreeVector centre=G4ThreeVector(0.,0.,16.)-G4ThreeVector(0.,0.,(16. + totalHeight-76.)/2.);
301  G4Tubs *PCUTube = new G4Tubs("PrimaryCollimatorUTube", 10.*mm, 40.0*mm, 10.*mm, 0.*deg, 360.*deg);
302  G4LogicalVolume *PCUTubeLV = new G4LogicalVolume(PCUTube, Pb, "PrimaryCollimatorUTubeLV", 0, 0, 0);
303 
304  new G4PVPlacement(0, centre, "PrimaryCollimatorUTubePV", PCUTubeLV, PVWorld, false, 0);
305  G4VisAttributes* simpleAlSVisAtt= new G4VisAttributes(G4Colour::White());
306  simpleAlSVisAtt->SetVisibility(true);
307  PCUTubeLV->SetVisAttributes(simpleAlSVisAtt);
308  PCUTubeLV->SetRegion(regVol);
309  regVol->AddRootLogicalVolume(PCUTubeLV);
310 
311  // //-------------------- lower part----------------
312  // Tube
313  G4Tubs* PCLTube = new G4Tubs("PrimaryCollimatorLTube", 0., 40.*mm, 60./2.*mm, 0.*deg, 360.*deg);
314  // Cone
315  G4double coneAperture = 14.*deg;
316  G4Cons* collimCone = new G4Cons("PrimaryCollimatorLCone", 0., (16.*std::tan(coneAperture))*mm, 0., (76.*std::tan(coneAperture))*mm, 30.*mm, 0.*deg, 360.*deg);
317 
318  G4LogicalVolume* PCLTubeLV = new G4LogicalVolume(PCLTube, Pb, "PCLTubeLV",0,0,0);
319  G4LogicalVolume* collimConeLV = new G4LogicalVolume(collimCone, Vacuum, "collimConeLV",0,0,0);
320  centre = G4ThreeVector(0.,0.,16.+60./2.);
321  G4VPhysicalVolume *PCLTubePV = new G4PVPlacement(0, centre, "PCLTubePV", PCLTubeLV, PVWorld, false, 0);
322 
323  centre = G4ThreeVector(0.,0.,0.);
324  new G4PVPlacement(0, centre, "TubeMinusConeLPV", collimConeLV, PCLTubePV, false, 0);
325 
326  // Visualization
327  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Green());
328  simpleAlSVisAtt->SetVisibility(true);
329  simpleAlSVisAtt->SetForceSolid(true);
330  PCLTubeLV->SetVisAttributes(simpleAlSVisAtt);
331 
332  // Region for cuts
333  PCLTubeLV->SetRegion(regVol);
334  regVol->AddRootLogicalVolume(PCLTubeLV);
335 
336  bCreated = true;
337  return bCreated;
338 }
340 {
341  bool bCreated = false;
342 
344 
345  // Region for cuts
346  G4Region *regVol = new G4Region("BeWindow");
348  cuts->SetProductionCut(0.1*cm);
349  regVol->SetProductionCuts(cuts);
350 
351 
352  G4Tubs* BeWTube = new G4Tubs("BeWindowTube", 0., 50.*mm, 0.12*mm, 0.*deg, 360.*deg);
353  G4LogicalVolume *BeWTubeLV = new G4LogicalVolume(BeWTube, Be, "BeWTubeLV", 0, 0, 0);
354  new G4PVPlacement(0, G4ThreeVector(0.,0.,90.*mm), "BeWTubePV", BeWTubeLV, PVWorld, false, 0);
355 
356  G4VisAttributes* simpleAlSVisAtt= new G4VisAttributes(G4Colour::Yellow());
357  simpleAlSVisAtt->SetVisibility(true);
358  BeWTubeLV->SetVisAttributes(simpleAlSVisAtt);
359  BeWTubeLV->SetRegion(regVol);
360  regVol->AddRootLogicalVolume(BeWTubeLV);
361 
362  bCreated = true;
363  return bCreated;
364 }
366 {
367  G4String iName;
368  char a[10];
369  bool bCreated = false;
370  switch (idEnergy)
371  {
372  case 6:
373  {
374  G4double distanceLast = 116.3386 - 0.932*25.4/2.*mm;
375 
377  const int PointsNumber=22;
378  // Coordinates of flattening filter in inches
379  G4double xRadius[PointsNumber]={0.0000000001, .025, .050, .075, .1, .15, .2, .25, .3, .35, .4, .5, .6, .7, .8, .9, 1., 1.1, 1.205, 1.3, 1.325, 1.5};
380  G4double yHeight[PointsNumber]={.932, .92, .907, .892, .874, .83, .782, .736, .69, .645, .601, .516, .437, .361, .294, .22, .173, .118, .08, .08, .125, .125};
381 
382  int i;
383  // From inches to millimeters
384  for (i = 0; i<PointsNumber; i++)
385  {
386  xRadius[i]*=25.4*mm;
387  yHeight[i]*=25.4*mm;
388  }
389  G4double angleStart=0.;
390  G4double angleStop=360.0;
391 
392  G4double halfHeigth, rMaxInf, rMaxSup, rMinInf, rMinSup;
393  G4String name;
394  G4ThreeVector centre;
395  G4LogicalVolume *logVol;
396  G4Cons *cone;
397 // G4VPhysicalVolume *phVol;
398  G4VisAttributes* simpleAlSVisAtt;
399  G4Region *regVol= new G4Region("flatfilterR");
401  cuts->SetProductionCut(0.2*cm);
402  regVol->SetProductionCuts(cuts);
403 
404  for (i = 0 ; i < 19; i++)
405  {
406  sprintf(a,"%d", i);
407  iName = (G4String)a;
408  halfHeigth = (yHeight[i]-yHeight[i+1])/2. ;
409  if (i == 18)
410  {
411  halfHeigth = yHeight[i]/2.;
412  }
413 
414  rMaxInf = xRadius[i];
415  rMaxSup = xRadius[i+1];
416  rMinInf = 0.;
417  rMinSup = 0.;
418  centre.set(0.,0.,distanceLast+halfHeigth); distanceLast+=halfHeigth*2.;
419  name = "ffConeG"+iName;
420  cone = new G4Cons(name, rMinInf, rMaxInf, rMinSup, rMaxSup, halfHeigth, angleStart, angleStop);
421  name = "ffConeLV"+iName;
422  logVol = new G4LogicalVolume(cone, Cu, name, 0, 0, 0);
423  name = "ffConePV"+iName;
424  new G4PVPlacement(0, centre, name, logVol, PVWorld, false, 0);
425 
426  // Region for cuts
427  logVol->SetRegion(regVol);
428  regVol->AddRootLogicalVolume(logVol);
429  // Visualization
430  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Cyan());
431  simpleAlSVisAtt->SetVisibility(true);
432  logVol->SetVisAttributes(simpleAlSVisAtt);
433  }
434 
435  halfHeigth = yHeight[19]/2. ;
436  rMaxInf = xRadius[21];
437  rMaxSup = xRadius[21];
438  rMinInf = 0.;
439  rMinSup = 0.;
440  centre.set(0.,0., distanceLast+halfHeigth);
441  sprintf(a,"%d", i);
442  iName = (G4String)a;
443  name = "ffConeG"+iName;
444  cone = new G4Cons(name, rMinInf, rMaxInf, rMinSup, rMaxSup, halfHeigth, angleStart, angleStop);
445  name = "ffConeLV"+iName;
446  logVol = new G4LogicalVolume(cone, Cu, name, 0, 0, 0);
447  name = "ffConePV"+iName;
448  new G4PVPlacement(0, centre, name, logVol, PVWorld, false, 0);
449 
450  // Region for cuts
451  logVol->SetRegion(regVol);
452  regVol->AddRootLogicalVolume(logVol);
453  // Visualization
454  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Cyan());
455  simpleAlSVisAtt -> SetVisibility(true);
456  logVol -> SetVisAttributes(simpleAlSVisAtt);
457 
458  halfHeigth = (yHeight[20]-yHeight[19])/2. ;
459  rMaxInf = xRadius[21];
460  rMaxSup = xRadius[21];
461  rMinInf = xRadius[20];
462  rMinSup = xRadius[19];
463  centre.set(0.,0., distanceLast-halfHeigth);
464  sprintf(a,"%d", ++i);
465  iName = (G4String)a;
466  name = "ffConeG"+iName;
467  cone = new G4Cons(name, rMinInf, rMaxInf, rMinSup, rMaxSup, halfHeigth, angleStart, angleStop);
468  name = "ffConeLV"+iName;
469  logVol = new G4LogicalVolume(cone, Cu, name, 0, 0, 0);
470  name = "ffConePV"+iName;
471  new G4PVPlacement(0, centre, name, logVol,PVWorld, false, 0);
472 
473  // Region for cuts
474  logVol->SetRegion(regVol);
475  regVol->AddRootLogicalVolume(logVol);
476  // Visualization
477  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Cyan());
478  simpleAlSVisAtt->SetVisibility(true);
479  logVol->SetVisAttributes(simpleAlSVisAtt);
480 
481  bCreated = true;
482  break;
483  }
484  case 15:
485  {
486  G4double distanceLast = 125.+.125*25.4 - 0.744*25.4/2.- 0.744*25.4/2.*mm;
487 
489  const int PointsNumber = 21;
490  // Coordinate in pollici del flattening filter come da disegno
491  G4double xRadius[PointsNumber] = {0.0000000001, 0.040, 0.078,
492  0.105, 0.131, 0.160, 0.205, 0.248, 0.343, 0.436, 0.531,
493  0.628, 0.727, 0.829, 0.880, 0.932, 0.983, 1.037, 1.250,
494  1.350, 1.5};
495  G4double yHeight[PointsNumber] = {0.744, 0.718, 0.682, 0.653,
496  0.622, 0.593, 0.547, 0.506, 0.427, 0.354, 0.287, 0.225,
497  0.168, 0.119, 0.090, 0.067, 0.047, 0.030, 0.030, 0.125,
498  0.125};
499 
500  // From inches to millimeters
501  int i;
502  for (i = 0; i < PointsNumber; i++)
503  {
504  xRadius[i]*=25.4*mm;
505  yHeight[i]*=25.4*mm;
506  }
507  G4double angleStart = 0.;
508  G4double angleStop = 360.0;
509 
510  G4double halfHeigth, rMaxInf, rMaxSup, rMinInf, rMinSup;
511  G4String name;
512  G4ThreeVector centre;
513  G4Cons *cone;
514  G4LogicalVolume *logVol;
515 // G4VPhysicalVolume *phVol;
516  G4VisAttributes* simpleAlSVisAtt;
517  G4Region *regVol= new G4Region("flatfilterR");
519  cuts->SetProductionCut(0.2*cm);
520  regVol->SetProductionCuts(cuts);
521 
522  for (i=0;i<18;i++)
523  {
524  sprintf(a,"%d", i);
525  iName = (G4String)a;
526  halfHeigth = (yHeight[i]-yHeight[i+1])/2. ;
527  if (i == 17)
528  {
529  halfHeigth = yHeight[i]/2.;
530  }
531  rMaxInf = xRadius[i];
532  rMaxSup = xRadius[i+1];
533  rMinInf = 0.;
534  rMinSup = 0.;
535  centre.set(0.,0.,distanceLast+halfHeigth); distanceLast+=halfHeigth*2.;
536  name = "ffConeG"+iName;
537  cone = new G4Cons(name, rMinInf, rMaxInf, rMinSup, rMaxSup, halfHeigth, angleStart, angleStop);
538  name = "ffConeLV"+iName;
539  logVol = new G4LogicalVolume(cone, Cu, name, 0, 0, 0);
540  name = "ffConePV"+iName;
541  new G4PVPlacement(0, centre, name, logVol, PVWorld, false, 0);
542 
543  // Region for cuts
544  logVol -> SetRegion(regVol);
545  regVol -> AddRootLogicalVolume(logVol);
546  // Visualization
547  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Cyan());
548  simpleAlSVisAtt -> SetVisibility(true);
549  logVol -> SetVisAttributes(simpleAlSVisAtt);
550  }
551 
552  halfHeigth = yHeight[18]/2. ;
553  rMaxInf = xRadius[20];
554  rMaxSup = xRadius[20];
555  rMinInf = 0.;
556  rMinSup = 0.;
557  centre.set(0.,0., distanceLast+halfHeigth);
558  sprintf(a,"%d", i);
559  iName = (G4String)a;
560  name = "ffConeG"+iName;
561  cone = new G4Cons(name, rMinInf, rMaxInf, rMinSup, rMaxSup, halfHeigth, angleStart, angleStop);
562  name = "ffConeLV"+iName;
563  logVol = new G4LogicalVolume(cone, Cu, name, 0, 0, 0);
564  name = "ffConePV"+iName;
565  new G4PVPlacement(0, centre, name, logVol, PVWorld, false, 0);
566 
567  // Region for cuts
568  logVol -> SetRegion(regVol);
569  regVol -> AddRootLogicalVolume(logVol);
570  // Visualization
571  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Cyan());
572  simpleAlSVisAtt -> SetVisibility(true);
573  logVol -> SetVisAttributes(simpleAlSVisAtt);
574 
575  halfHeigth = (yHeight[19]-yHeight[18])/2. ;
576  rMaxInf = xRadius[20];
577  rMaxSup = xRadius[20];
578  rMinInf = xRadius[19];
579  rMinSup = xRadius[18];
580  centre.set(0.,0., distanceLast-halfHeigth);
581  sprintf(a,"%d", ++i);
582  iName = (G4String)a;
583  name = "ffConeG"+iName;
584  cone = new G4Cons(name, rMinInf, rMaxInf, rMinSup, rMaxSup, halfHeigth, angleStart, angleStop);
585  name = "ffConeLV"+iName;
586  logVol = new G4LogicalVolume(cone, Cu, name, 0, 0, 0);
587  name = "ffConePV"+iName;
588  new G4PVPlacement(0, centre, name, logVol,PVWorld, false, 0);
589 
590  // Region for cuts
591  logVol -> SetRegion(regVol);
592  regVol -> AddRootLogicalVolume(logVol);
593  // Visualization
594  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Cyan());
595  simpleAlSVisAtt -> SetVisibility(true);
596  logVol -> SetVisAttributes(simpleAlSVisAtt);
597 
598  bCreated = true;
599  break;
600  }
601  }
602  return bCreated;
603 }
605 {
606  bool bCreated = false;
607 
608 
609  G4Material *KAPTON = G4NistManager::Instance()->FindOrBuildMaterial("G4_KAPTON");
610  G4Region *regVol = new G4Region("ionizationChamber");
612  cuts -> SetProductionCut(0.1*cm);
613  regVol -> SetProductionCuts(cuts);
614 
615  G4VisAttributes* simpleAlSVisAtt;
616  // Region for cuts
617 
618  G4Tubs* ICTubeW = new G4Tubs("ionizationChamberTube", 0., 3.75*2.54*10.*mm, 0.005*25.4*mm, 0.*deg, 360.*deg);
619  G4Tubs* ICTubeP = new G4Tubs("ionizationChamberTube", 0., 3.75*2.54*10.*mm, 0.002*25.4*mm, 0.*deg, 360.*deg);
620 
621  G4ThreeVector centre;
622  // W1
623  centre.set(0.,0.,148.35*mm);
624  G4LogicalVolume *PCUTubeW1LV = new G4LogicalVolume(ICTubeW, KAPTON, "ionizationChamberTubeW1LV", 0, 0, 0);
625  new G4PVPlacement(0, centre, "ionizationChamberTubeW1PV", PCUTubeW1LV, PVWorld, false, 0);
626  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Blue());
627  simpleAlSVisAtt -> SetVisibility(true);
628  PCUTubeW1LV -> SetVisAttributes(simpleAlSVisAtt);
629  PCUTubeW1LV -> SetRegion(regVol);
630  regVol -> AddRootLogicalVolume(PCUTubeW1LV);
631 
632  // P1
633  centre.set(0.,0.,150.73*mm);
634  G4LogicalVolume *PCUTubeP1LV = new G4LogicalVolume(ICTubeP, KAPTON, "ionizationChamberTubeP1LV", 0, 0, 0);
635  new G4PVPlacement(0, centre, "ionizationChamberTubeP1PV", PCUTubeP1LV, PVWorld, false, 0);
636  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Yellow());
637  simpleAlSVisAtt -> SetVisibility(true);
638  PCUTubeP1LV -> SetVisAttributes(simpleAlSVisAtt);
639  PCUTubeP1LV -> SetRegion(regVol);
640  regVol -> AddRootLogicalVolume(PCUTubeP1LV);
641 
642  // W2
643  centre.set(0.,0.,155.5*mm);
644  G4LogicalVolume *PCUTubeW2LV = new G4LogicalVolume(ICTubeW, KAPTON, "ionizationChamberTubeW2LV", 0, 0, 0);
645  new G4PVPlacement(0, centre, "ionizationChamberTubeW2PV", PCUTubeW2LV, PVWorld, false, 0);
646  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Blue());
647  simpleAlSVisAtt -> SetVisibility(true);
648  PCUTubeW2LV -> SetVisAttributes(simpleAlSVisAtt);
649  PCUTubeW2LV -> SetRegion(regVol);
650  regVol -> AddRootLogicalVolume(PCUTubeW2LV);
651 
652  // P2
653  centre.set(0.,0.,153.12*mm);
654  G4LogicalVolume *PCUTubeP2LV = new G4LogicalVolume(ICTubeP, KAPTON, "ionizationChamberTubeP2LV", 0, 0, 0);
655  new G4PVPlacement(0, centre, "ionizationChamberTubeP2PV", PCUTubeP2LV, PVWorld, false, 0);
656  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Yellow());
657  simpleAlSVisAtt->SetVisibility(true);
658  PCUTubeP2LV->SetVisAttributes(simpleAlSVisAtt);
659  PCUTubeP2LV->SetRegion(regVol);
660  regVol->AddRootLogicalVolume(PCUTubeP2LV);
661 
662  // W3
663  centre.set(0.,0.,162.65*mm);
664  G4LogicalVolume *PCUTubeW3LV = new G4LogicalVolume(ICTubeW, KAPTON, "ionizationChamberTubeW3LV", 0, 0, 0);
665  new G4PVPlacement(0, centre, "ionizationChamberTubeW3PV", PCUTubeW3LV, PVWorld, false, 0);
666  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Blue());
667  simpleAlSVisAtt -> SetVisibility(true);
668  PCUTubeW3LV -> SetVisAttributes(simpleAlSVisAtt);
669  PCUTubeW3LV -> SetRegion(regVol);
670  regVol -> AddRootLogicalVolume(PCUTubeW3LV);
671 
672  // P3
673  centre.set(0.,0.,157.88*mm);
674  G4LogicalVolume *PCUTubeP3LV = new G4LogicalVolume(ICTubeP, KAPTON, "ionizationChamberTubeP3LV", 0, 0, 0);
675  new G4PVPlacement(0, centre, "ionizationChamberTubeP3PV", PCUTubeP3LV, PVWorld, false, 0);
676  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Yellow());
677  simpleAlSVisAtt -> SetVisibility(true);
678  PCUTubeP3LV -> SetVisAttributes(simpleAlSVisAtt);
679  PCUTubeP3LV -> SetRegion(regVol);
680  regVol -> AddRootLogicalVolume(PCUTubeP3LV);
681 
682  // P4
683  centre.set(0.,0.,160.27*mm);
684  G4LogicalVolume *PCUTubeP4LV = new G4LogicalVolume(ICTubeP, KAPTON, "ionizationChamberTubeP4LV", 0, 0, 0);
685  new G4PVPlacement(0, centre, "ionizationChamberTubeP4PV", PCUTubeP4LV, PVWorld, false, 0);
686  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Yellow());
687  simpleAlSVisAtt->SetVisibility(true);
688  PCUTubeP4LV->SetVisAttributes(simpleAlSVisAtt);
689  PCUTubeP4LV->SetRegion(regVol);
690  regVol->AddRootLogicalVolume(PCUTubeP4LV);
691 
692  bCreated = true;
693  return bCreated;
694 }
696 {
697  bool bCreated = false;
698 
700 
701  // Region for cuts
702  G4Region *regVol = new G4Region("Mirror");
704  cuts -> SetProductionCut(0.1*cm);
705  regVol -> SetProductionCuts(cuts);
706 
707  G4Tubs* MirrorTube = new G4Tubs("MirrorTube", 0., 86.*mm, 1.*mm, 0.*deg, 360.*deg);
708  G4LogicalVolume *MirrorTubeLV = new G4LogicalVolume(MirrorTube, MYLAR, "MirrorTubeLV", 0, 0, 0);
709  G4RotationMatrix *cRotation = new G4RotationMatrix();
710  cRotation -> rotateY(35.0*deg);
711  new G4PVPlacement(cRotation, G4ThreeVector(0., 0., 220.*mm), "MirrorTubePV", MirrorTubeLV,PVWorld, false, 0);
712 
713  G4VisAttributes* simpleAlSVisAtt = new G4VisAttributes(G4Colour::Green());
714  simpleAlSVisAtt -> SetVisibility(true);
715  MirrorTubeLV -> SetVisAttributes(simpleAlSVisAtt);
716  MirrorTubeLV -> SetRegion(regVol);
717  regVol -> AddRootLogicalVolume(MirrorTubeLV);
718 
719  bCreated = true;
720  return bCreated;
721 }
723 {
724  bool bCreated = false;
725 
727  G4String name = "Jaws1X";
728 
729  G4Region *regVol= new G4Region(name+"R");
731  cuts->SetProductionCut(1.*cm);
732  regVol->SetProductionCuts(cuts);
733 
734  G4VisAttributes* simpleAlSVisAtt;
735  G4ThreeVector centre, halfSize;
736  G4RotationMatrix *cRotation = new G4RotationMatrix();
737  centre.set(0.,0.,(367.+78./2.)*mm);
738  halfSize.set(50.*mm, 90.*mm, 78./2.*mm);
739  G4Box *box = new G4Box(name+"Box", halfSize.getX(), halfSize.getY(), halfSize.getZ());
740  G4LogicalVolume *logVol = new G4LogicalVolume(box, W, name+"LV", 0, 0, 0);
741  SetJawAperture(1, centre, halfSize,cRotation);
742  new G4PVPlacement(cRotation, centre, name+"PV", logVol, PVWorld, false, 0);
743 
744  // Region for cuts
745  logVol->SetRegion(regVol);
746  regVol->AddRootLogicalVolume(logVol);
747 
748  // Visibility
749  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Blue());
750  simpleAlSVisAtt->SetVisibility(true);
751  logVol->SetVisAttributes(simpleAlSVisAtt);
752 
753  bCreated = true;
754  return bCreated;
755 }
757 {
758  bool bCreated=false;
760  G4String name="Jaws2X";
761  G4Region *regVol= new G4Region(name+"R");
763  cuts->SetProductionCut(1.*cm);
764  regVol->SetProductionCuts(cuts);
765 
766  G4VisAttributes* simpleAlSVisAtt;
767  G4ThreeVector centre, halfSize;
768  G4RotationMatrix *cRotation = new G4RotationMatrix();
769  centre.set(0.,0.,(367.+78./2.)*mm);
770  halfSize.set(50.*mm, 90.*mm, 78./2.*mm);
771  G4Box *box = new G4Box(name+"Box", halfSize.getX(), halfSize.getY(), halfSize.getZ());
772  G4LogicalVolume *logVol = new G4LogicalVolume(box, W, name+"LV", 0, 0, 0);
773  SetJawAperture(2, centre, halfSize, cRotation);
774  new G4PVPlacement(cRotation, centre, name+"PV", logVol, PVWorld, false, 0);
775 
776  // Region for cuts
777  logVol->SetRegion(regVol);
778  regVol->AddRootLogicalVolume(logVol);
779 
780  // Visibility
781  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Blue());
782  simpleAlSVisAtt->SetVisibility(true);
783  logVol->SetVisAttributes(simpleAlSVisAtt);
784 
785  bCreated = true;
786  return bCreated;
787 }
789 {
790  bool bCreated = false;
792  G4String name="Jaws1Y";
793 
794  G4Region *regVol= new G4Region(name+"R");
796  cuts->SetProductionCut(1.*cm);
797  regVol->SetProductionCuts(cuts);
798 
799  G4VisAttributes* simpleAlSVisAtt;
800  G4ThreeVector centre, halfSize;
801  G4RotationMatrix *cRotation=new G4RotationMatrix();
802  centre.set(0.,0.,(280.+78./2.)*mm);
803  halfSize.set(90.*mm, 50.*mm, 78./2.*mm);
804  G4Box *box = new G4Box(name+"Box", halfSize.getX(), halfSize.getY(), halfSize.getZ());
805  G4LogicalVolume *logVol = new G4LogicalVolume(box, W, name+"LV", 0, 0, 0);
806  SetJawAperture(3, centre, halfSize, cRotation);
807  new G4PVPlacement(cRotation, centre, name+"PV", logVol, PVWorld, false, 0);
808 
809  // Region for cuts
810  logVol->SetRegion(regVol);
811  regVol->AddRootLogicalVolume(logVol);
812 
813  // Visibility
814  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Red());
815  simpleAlSVisAtt->SetVisibility(true);
816  logVol->SetVisAttributes(simpleAlSVisAtt);
817 
818  bCreated = true;
819  return bCreated;
820 }
822 {
823  bool bCreated = false;
824 
826  G4String name = "Jaws2Y";
827  G4Region *regVol = new G4Region(name+"R");
829  cuts->SetProductionCut(1.*cm);
830  regVol->SetProductionCuts(cuts);
831 
832  G4ThreeVector centre, halfSize;
833  G4RotationMatrix *cRotation=new G4RotationMatrix();
834  centre.set(0.,0.,(280.+78./2.)*mm);
835  halfSize.set(90.*mm, 50.*mm, 78./2.*mm);
836  G4Box *box = new G4Box(name+"Box", halfSize.getX(), halfSize.getY(), halfSize.getZ());
837  G4LogicalVolume *logVol = new G4LogicalVolume(box, W, name+"LV", 0, 0, 0);
838  SetJawAperture(4, centre, halfSize, cRotation);
839  new G4PVPlacement(cRotation, centre, name+"PV", logVol, PVWorld, false, 0);
840 
841  // Region for cuts
842  logVol->SetRegion(regVol);
843  regVol->AddRootLogicalVolume(logVol);
844 
845  // Visibility
846 
847  G4VisAttributes* simpleAlSVisAtt = new G4VisAttributes(G4Colour::Red());
848  simpleAlSVisAtt -> SetVisibility(true);
849  logVol -> SetVisAttributes(simpleAlSVisAtt);
850 
851  bCreated = true;
852  return bCreated;
853 }
855 {
856  G4String iName;
857  char a[12];
858  bool bCreated = false;
859  // material
861  G4VisAttributes* simpleAlSVisAtt;
862  // Region for cuts
863  G4Region *regVol = new G4Region("MLCR");
865  cuts->SetProductionCut(0.5*cm);
866  regVol->SetProductionCuts(cuts);
867 
868  G4ThreeVector box1Size, box2Size;
869 
870  G4ThreeVector centreStart;
871  centreStart.set(0.,0.,(482.5+535.5)/2.*mm);
872 
873  box1Size.set(5.2883/2.*mm, 167.488/2.*mm, 61.2953/2.*mm);
874  G4double circleRadiuos=80.0*mm;
875 
876  G4double alfa=std::asin(box1Size.getZ()/circleRadiuos);
877  G4double externalYPartSize=circleRadiuos*(1-std::cos(alfa));
878 
879  box2Size.set(box1Size.getX(), externalYPartSize/2., box1Size.getZ());
880 
881  // single leaf
882  G4Box *box1Leaf = new G4Box("LeafBox1", box1Size.getX(), box1Size.getY(), box1Size.getZ());
883  G4Box *box2leaf = new G4Box("LeafBox2", box2Size.getX(), box2Size.getY(), box2Size.getZ());
884  G4Tubs *cyLeaf = new G4Tubs("LeafCylinder", 0, circleRadiuos, box1Size.getX(),0,CLHEP::twopi);
885 
887  rm->rotateY(90.*deg);
888  G4DisplacedSolid *cyLeaf90Y=new G4DisplacedSolid("LeafCylinder90Y",cyLeaf,rm,G4ThreeVector(0,0,0));
889  G4DisplacedSolid *cyLeafTr=new G4DisplacedSolid("LeafCylinderTr",cyLeaf90Y,0,G4ThreeVector(0., -(circleRadiuos-box2Size.getY()), 0.));
890  G4IntersectionSolid* bx2CyleafTr =new G4IntersectionSolid("bx2CyleafTr", box2leaf, cyLeafTr);
891  G4DisplacedSolid *bx2CyleafTrTr=new G4DisplacedSolid("bx2CyleafTrTr",bx2CyleafTr,0,G4ThreeVector(0., +(box1Size.getY()+box2Size.getY()-.1), 0.)); // -.1 to guarantee the volumes touch each other
892 
893  G4UnionSolid *leafSolidA = new G4UnionSolid("SingleLeafA", bx2CyleafTrTr, box1Leaf);
894  rm = new G4RotationMatrix();
895  rm -> rotateZ(180.*deg);
896  G4DisplacedSolid *leafSolidB = new G4DisplacedSolid("SingleLeafB", leafSolidA, rm, G4ThreeVector(0,0,0));
897 
898 
899  G4ThreeVector halfSize;
900  halfSize.set(0., box2Size.getY()*2.-.1,0.);
901  halfSize+=box1Size;
902 
903  G4LogicalVolume *leafLVA = new G4LogicalVolume(leafSolidA, W, "leafSolidALV", 0, 0, 0);
904  G4LogicalVolume *leafLVB = new G4LogicalVolume(leafSolidB, W, "leafSolidBLV", 0, 0, 0);
905 
906  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Green());
907  simpleAlSVisAtt->SetVisibility(true);
908  leafLVA->SetVisAttributes(simpleAlSVisAtt);
909  leafLVA->SetRegion(regVol);
910  regVol->AddRootLogicalVolume(leafLVA);
911 
912  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Green());
913  simpleAlSVisAtt->SetVisibility(true);
914  leafLVB->SetVisAttributes(simpleAlSVisAtt);
915  leafLVB->SetRegion(regVol);
916  regVol->AddRootLogicalVolume(leafLVB);
917 
918 
919  G4String PVname;
920 // G4VPhysicalVolume *leafPhys;
921  int i;
922  int j = 0;
923 
924  G4ThreeVector centre;
925  centre= centreStart + G4ThreeVector(-38.*halfSize.getX(), 0.,0.);
926 
927  for (i = 1; i < (int)vec_leavesA.size(); i++)
928  {
929  sprintf(a,"%d", i);
930  iName = (G4String)a;
931  PVname = "leafA"+iName;
932  centre.setX(centre.getX()+halfSize.getX()*2.);
933  centre.setY(-halfSize.getY()-vec_leavesA[i]);
934  new G4PVPlacement(0, centre, PVname, leafLVA, PVWorld, false, i);
935  j++;
936  }
937  centre=centreStart+G4ThreeVector(-38.*halfSize.getX(), 0.,0.);
938  for (i = 1; i < (int)vec_leavesB.size(); i++)
939  {
940  sprintf(a,"%d", i);
941  iName = (G4String)a;
942  PVname = "leafB"+iName;
943  centre.setX(centre.getX()+halfSize.getX()*2.);
944  centre.setY(+halfSize.getY()+vec_leavesB[i]);
945  new G4PVPlacement(0, centre, PVname, leafLVB, PVWorld, false, i);
946  j++;
947  }
948  bCreated = true;
949  return bCreated;
950 }
951