ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ML2Acc1.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ML2Acc1.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 "ML2Acc1.hh"
45 #include "ML2Acc1Messenger.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  acc1Messenger = new CML2Acc1Messenger(this);
57  buildMaterial_SSteel1();
58 }
59 
61 {
62 }
64 
66 {
67  if (instance == 0)
68  {
69  instance = new CML2Acc1();
70  }
71 return instance;
72 }
73 
75 {
76  G4cout <<"\n\n\tnominal beam energy: "<<idEnergy << G4endl;
77  G4cout <<"\tJaw X aperture: 1) "<< jaw1XAperture/mm<<"[mm]\t2) " << jaw2XAperture/mm<< " [mm]"<< G4endl;
78  G4cout <<"\tJaw Y aperture: 1) "<< jaw1YAperture/mm<<"[mm]\t2) " << jaw2YAperture/mm<< " [mm]\n"<< G4endl;
79 }
80 
82 {
83 
84  G4Element* elFe = new G4Element("Iron", "Fe", 26., 55.85*g/mole);
85  G4Element* elS = new G4Element("Sulfur", "S", 16., 32.064*g/mole);
86  G4Element* elMn = new G4Element("Manganese", "Mn", 25., 54.94*g/mole);
87  G4Element* elC = new G4Element("Carbon", "C", 6., 12.011*g/mole);
88 
89  steel1 = new G4Material("steel1", 7.76 *g/cm3, 4);
90  steel1 -> AddElement(elFe, 0.935);
91  steel1 -> AddElement(elS, 0.01);
92  steel1 -> AddElement(elMn, 0.05);
93  steel1 -> AddElement(elC, 0.005);
94 }
95 
97 {
98  PVWorld = PWorld;
99  setIsoCentre(iso);
100  target();
101  vacuumWindow();
102  ionizationChamber();
103  flatteningFilter();
104  mirror();
105  primaryCollimator();
106  MLC();
107  Jaw1X();
108  Jaw2X();
109  Jaw1Y();
110  Jaw2Y();
111 }
112 
114 {
115  bool bCreated = false;
116  switch (idEnergy)
117  {
118  case 6:
119  // materials
122 
123  // volumes
124  // beam line along z axis
125  //------------------------target 6MV------------------------
126  G4double targetADim_x = 0.6*cm;
127  G4double targetADim_y = 0.6*cm;
128  G4double targetADim_z = 0.04445*cm;
129  G4Box* targetA_box = new G4Box("targetA_box",targetADim_x,targetADim_y,targetADim_z);
130  G4LogicalVolume *targetA_log = new G4LogicalVolume(targetA_box,W,"targetA_log",0,0,0);
131  G4double targetAPos_x = 0.0*m;
132  G4double targetAPos_y = 0.0*m;
133  G4double targetAPos_z = 0.20055*cm;
134  new G4PVPlacement(0,
135  G4ThreeVector(targetAPos_x,targetAPos_y,targetAPos_z),
136  "targetA",targetA_log,PVWorld,false,0);
137 
138  G4double targetBDim_x = 0.6*cm;
139  G4double targetBDim_y = 0.6*cm;
140  G4double targetBDim_z = 0.07874*cm;
141  G4Box* targetB_box = new G4Box("targetB_box",targetBDim_x,targetBDim_y,targetBDim_z);
142  G4LogicalVolume *targetB_log = new G4LogicalVolume(targetB_box,Cu,"targetB_log",0,0,0);
143  G4double targetBPos_x = 0.0*m;
144  G4double targetBPos_y = 0.0*m;
145  G4double targetBPos_z = 0.07736*cm;
146  new G4PVPlacement(0,
147  G4ThreeVector(targetBPos_x,targetBPos_y,targetBPos_z),
148  "targetB",targetB_log,PVWorld,false,0);
149 
150  // *********** REGIONS for CUTS
151  G4Region *regVol;
152  regVol= new G4Region("targetR");
154  cuts->SetProductionCut(0.1*cm);
155  regVol->SetProductionCuts(cuts);
156 
157  targetA_log -> SetRegion(regVol);
158  regVol -> AddRootLogicalVolume(targetA_log);
159  targetB_log -> SetRegion(regVol);
160  regVol -> AddRootLogicalVolume(targetB_log);
161 
162  // Visualization attributes
163  G4VisAttributes* simpleWSVisAtt, *simpleCuSVisAtt;
164  simpleWSVisAtt = new G4VisAttributes(G4Colour::Magenta());
165  simpleWSVisAtt -> SetVisibility(true);
166  simpleCuSVisAtt = new G4VisAttributes(G4Colour::Cyan());
167  simpleCuSVisAtt -> SetVisibility(true);
168  targetA_log -> SetVisAttributes(simpleWSVisAtt);
169  targetB_log -> SetVisAttributes(simpleCuSVisAtt);
170 
171  bCreated = true;
172  return bCreated;
173  break;
174  }
175  return false;
176 }
178 {
179  // materials
180  G4Material* Vacuum = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
182 
183  //---------rotation matrix first collimator --------
184  G4RotationMatrix* rotateMatrix=new G4RotationMatrix();
185  rotateMatrix->rotateX(180.0*deg);
186 
187  //--------------------upper collimator----------------
188  G4double innerRadiusOfTheTubeEx = 1.0*cm;
189  G4double outerRadiusOfTheTubeEx = 8.*cm;
190  G4double hightOfTheTubeEx = 3.0*cm;
191  G4double startAngleOfTheTubeEx = 0.*deg;
192  G4double spanningAngleOfTheTubeEx = 360.*deg;
193  G4Tubs* UpperCollimator = new G4Tubs("UpperCollimator",
194  innerRadiusOfTheTubeEx,
195  outerRadiusOfTheTubeEx,
196  hightOfTheTubeEx,
197  startAngleOfTheTubeEx,
198  spanningAngleOfTheTubeEx);
199  G4LogicalVolume *UpperCollimator_log = new G4LogicalVolume(UpperCollimator, W, "UpperCollimator_log", 0, 0, 0);
200 
201  G4double UpperCollimatorPosX = 0.*cm;
202  G4double UpperCollimatorPosY = 0.*cm;
203  G4double UpperCollimatorPosZ = -1.*cm;
204  new G4PVPlacement(0,
205  G4ThreeVector(UpperCollimatorPosX, UpperCollimatorPosY, UpperCollimatorPosZ),
206  "UpperCollimator",
207  UpperCollimator_log,
208  PVWorld,
209  false,
210  0);
211 
212 
213  //--------------------lower collimator----------------
214 
215  G4double pRmin1 = 0.*cm;
216  G4double pRmax1 = 0.5*cm;
217  G4double pRmin2 = 0.*cm;
218  G4double pRmax2 = 1.7658592*cm;
219  G4double hightOfTheCone =3.2*cm;
220  G4double startAngleOfTheCone = 0.*deg;
221  G4double spanningAngleOfTheCone = 360.*deg;
222 
223  G4Cons* collim_cone = new G4Cons("collim_cone",pRmin1,pRmax1,pRmin2,
224  pRmax2,hightOfTheCone,startAngleOfTheCone,
225  spanningAngleOfTheCone);
226  G4LogicalVolume *collim_log = new G4LogicalVolume(collim_cone,Vacuum,"collim_log",0,0,0);
227 
228 
229  G4double innerRadiusOfTheTube = 0.*cm;
230  G4double outerRadiusOfTheTube = 8.*cm;
231  G4double hightOfTheTube = 3.1*cm;
232  G4double startAngleOfTheTube = 0.*deg;
233  G4double spanningAngleOfTheTube = 360.*deg;
234  G4Tubs* tracker_tube = new G4Tubs("tracker_tube",innerRadiusOfTheTube,
235  outerRadiusOfTheTube,hightOfTheTube,
236  startAngleOfTheTube,spanningAngleOfTheTube);
237 
238  G4SubtractionSolid* CylMinusCone = new G4SubtractionSolid("Cyl-Cone",
239  tracker_tube,collim_cone);
240  G4LogicalVolume *CylMinusCone_log = new G4LogicalVolume(CylMinusCone,W,"CylminusCone_log",0,0,0);
241  G4double CminusCPos_x = 0.*cm;
242  G4double CminusCPos_y = 0.*cm;
243  G4double CminusCPos_z = +6.2*cm;
244  new G4PVPlacement(rotateMatrix,
245  G4ThreeVector(CminusCPos_x, CminusCPos_y, CminusCPos_z),
246  "CylMinusCone",
247  CylMinusCone_log,
248  PVWorld,
249  false,
250  0);
251 
252  //--------- Visualization attributes -------------------------------
253  G4VisAttributes* simpleTungstenWVisAtt= new G4VisAttributes(G4Colour::Magenta());
254  simpleTungstenWVisAtt->SetVisibility(true);
255  collim_log->SetVisAttributes(simpleTungstenWVisAtt);
256 
257  CylMinusCone_log->SetVisAttributes(simpleTungstenWVisAtt);
258  UpperCollimator_log->SetVisAttributes(simpleTungstenWVisAtt);
259 
260  // *********** REGIONS for CUTS
261  G4Region *regVol;
262  regVol= new G4Region("PrymCollR");
264  cuts->SetProductionCut(0.1*cm);
265  regVol->SetProductionCuts(cuts);
266 
267  collim_log->SetRegion(regVol);
268  regVol->AddRootLogicalVolume(collim_log);
269 
270  CylMinusCone_log->SetRegion(regVol);
271  regVol->AddRootLogicalVolume(CylMinusCone_log);
272 
273  UpperCollimator_log->SetRegion(regVol);
274  regVol->AddRootLogicalVolume(UpperCollimator_log);
275 
276  return true;
277 }
279 {
280  bool bCreated = false;
282  G4Region *regVol;
283  G4VisAttributes* simpleAlSVisAtt;
284  // Region for cuts
285  regVol= new G4Region("BeWindow");
287  cuts->SetProductionCut(0.1*cm);
288  regVol->SetProductionCuts(cuts);
289 
290  G4Tubs* BeWTube = new G4Tubs("BeWindowTube", 0., 36.*mm, 0.2*mm, 0.*deg, 360.*deg);
291  G4LogicalVolume *BeWTubeLV = new G4LogicalVolume(BeWTube, Be, "BeWTubeLV", 0, 0, 0);
292  new G4PVPlacement(0, G4ThreeVector(0.,0.,100.*mm), "BeWTubePV", BeWTubeLV,
293  PVWorld, false, 0);
294 
295  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Yellow());
296  simpleAlSVisAtt -> SetVisibility(true);
297  BeWTubeLV -> SetVisAttributes(simpleAlSVisAtt);
298  BeWTubeLV -> SetRegion(regVol);
299  regVol -> AddRootLogicalVolume(BeWTubeLV);
300 
301  bCreated = true;
302  return bCreated;
303 }
305 {
306  bool bCreated = false;
307  switch (idEnergy)
308  {
309  case 6:
310  G4double z0, h0;
311  G4ThreeVector centre, halSize;
313  // Region for cuts
314  G4Region *regVol;
315  regVol= new G4Region("flatfilterR");
317  cuts->SetProductionCut(0.5*cm);
318  regVol->SetProductionCuts(cuts);
319 
320  G4VisAttributes* simpleAlSVisAtt;
321 
322  // one
323  z0=130.0*mm;
324  h0=5.0/2.*cm;
325  centre.set(0.,0.,z0);
326  G4Cons *FFL1A_1Cone = new G4Cons("FFL1A_1", 0.*cm, 0.3*cm, 0.*cm, 5.*cm, h0, 0.*deg, 360.*deg);
327  G4LogicalVolume *FFL1A_1LV = new G4LogicalVolume(FFL1A_1Cone, Cu, "FFL1A_1LV", 0, 0, 0);
328  new G4PVPlacement(0, centre, "FFL1A_1PV", FFL1A_1LV, PVWorld, false, 0);
329 
330  // two
331  z0+=h0;
332  h0=0.081/2.*cm;
333  z0+=h0;
334  centre.setZ(z0);
335  z0+=h0;
336  G4Tubs *FFL2_1Tube = new G4Tubs("FFL6_1", 0.*cm, 2.5*cm, h0, 0.*deg, 360.*deg);
337  G4LogicalVolume *FFL2_1LV = new G4LogicalVolume(FFL2_1Tube, Cu, "FFL2_1LV", 0, 0, 0);
338  new G4PVPlacement(0, centre, "FFL2_1PV", FFL2_1LV, PVWorld, false, 0);
339 
340  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Red());
341  simpleAlSVisAtt->SetVisibility(true);
342  FFL1A_1LV->SetVisAttributes(simpleAlSVisAtt);
343  FFL2_1LV->SetVisAttributes(simpleAlSVisAtt);
344 
345  FFL1A_1LV->SetRegion(regVol);
346  FFL2_1LV->SetRegion(regVol);
347 
348  regVol->AddRootLogicalVolume(FFL1A_1LV);
349  regVol->AddRootLogicalVolume(FFL2_1LV);
350  bCreated = true;
351  break;
352  }
353 
354  return bCreated;
355 }
357 {
358  bool bCreated = false;
359 
361  G4VisAttributes* simpleAlSVisAtt;
362  // Region for cuts
363  G4Region *regVol;
364  regVol= new G4Region("ionizationChamber");
366  cuts->SetProductionCut(0.1*cm);
367  regVol->SetProductionCuts(cuts);
368 
369  G4Tubs* ICTubeW = new G4Tubs("ionizationChamberTube", 0., 2.*2.54*10.*mm, 0.016*25.4*mm, 0.*deg, 360.*deg);
370  G4Tubs* ICTubeP = new G4Tubs("ionizationChamberTube", 0., 2.*2.54*10.*mm, 0.010*25.4*mm, 0.*deg, 360.*deg);
371 
372  G4ThreeVector centre;
373  // W1
374  centre.set(0.,0.,157.*mm);
375  G4LogicalVolume *PCUTubeW1LV = new G4LogicalVolume(ICTubeW, material, "ionizationChamberTubeW1LV", 0, 0, 0);
376  new G4PVPlacement(0, centre, "ionizationChamberTubeW1PV", PCUTubeW1LV, PVWorld, false, 0);
377  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Blue());
378  simpleAlSVisAtt->SetVisibility(true);
379  PCUTubeW1LV->SetVisAttributes(simpleAlSVisAtt);
380  PCUTubeW1LV->SetRegion(regVol);
381  regVol->AddRootLogicalVolume(PCUTubeW1LV);
382 
383  // P1
384  centre.set(0.,0.,158.*mm);
385  G4LogicalVolume *PCUTubeP1LV = new G4LogicalVolume(ICTubeP, material, "ionizationChamberTubeP1LV", 0, 0, 0);
386  new G4PVPlacement(0, centre, "ionizationChamberTubeP1PV", PCUTubeP1LV, PVWorld, false, 0);
387  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Yellow());
388  simpleAlSVisAtt->SetVisibility(true);
389  PCUTubeP1LV->SetVisAttributes(simpleAlSVisAtt);
390  PCUTubeP1LV->SetRegion(regVol);
391  regVol->AddRootLogicalVolume(PCUTubeP1LV);
392 
393  // W2
394  centre.set(0.,0.,159.*mm);
395  G4LogicalVolume *PCUTubeW2LV = new G4LogicalVolume(ICTubeW, material, "ionizationChamberTubeW2LV", 0, 0, 0);
396  new G4PVPlacement(0, centre, "ionizationChamberTubeW2PV", PCUTubeW2LV, PVWorld, false, 0);
397  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Blue());
398  simpleAlSVisAtt->SetVisibility(true);
399  PCUTubeW2LV->SetVisAttributes(simpleAlSVisAtt);
400  PCUTubeW2LV->SetRegion(regVol);
401  regVol->AddRootLogicalVolume(PCUTubeW2LV);
402 
403  // P2
404  centre.set(0.,0.,160.*mm);
405  G4LogicalVolume *PCUTubeP2LV = new G4LogicalVolume(ICTubeP, material, "ionizationChamberTubeP2LV", 0, 0, 0);
406  new G4PVPlacement(0, centre, "ionizationChamberTubeP2PV", PCUTubeP2LV, PVWorld, false, 0);
407  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Yellow());
408  simpleAlSVisAtt->SetVisibility(true);
409  PCUTubeP2LV->SetVisAttributes(simpleAlSVisAtt);
410  PCUTubeP2LV->SetRegion(regVol);
411  regVol->AddRootLogicalVolume(PCUTubeP2LV);
412 
413  // W3
414  centre.set(0.,0.,161.*mm);
415  G4LogicalVolume *PCUTubeW3LV = new G4LogicalVolume(ICTubeW, material, "ionizationChamberTubeW3LV", 0, 0, 0);
416  new G4PVPlacement(0, centre, "ionizationChamberTubeW3PV", PCUTubeW3LV, PVWorld, false, 0);
417  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Blue());
418  simpleAlSVisAtt->SetVisibility(true);
419  PCUTubeW3LV->SetVisAttributes(simpleAlSVisAtt);
420  PCUTubeW3LV->SetRegion(regVol);
421  regVol->AddRootLogicalVolume(PCUTubeW3LV);
422 
423  // P3
424  centre.set(0.,0.,162.*mm);
425  G4LogicalVolume *PCUTubeP3LV = new G4LogicalVolume(ICTubeP, material, "ionizationChamberTubeP3LV", 0, 0, 0);
426  new G4PVPlacement(0, centre, "ionizationChamberTubeP3PV", PCUTubeP3LV, PVWorld, false, 0);
427  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Yellow());
428  simpleAlSVisAtt->SetVisibility(true);
429  PCUTubeP3LV->SetVisAttributes(simpleAlSVisAtt);
430  PCUTubeP3LV->SetRegion(regVol);
431  regVol->AddRootLogicalVolume(PCUTubeP3LV);
432 
433  bCreated = true;
434  return bCreated;
435 }
437 {
438  bool bCreated=false;
440  G4VisAttributes* simpleAlSVisAtt;
441  // Region for cuts
442  G4Region *regVol;
443  regVol = new G4Region("Mirror");
445  cuts -> SetProductionCut(0.1*cm);
446  regVol -> SetProductionCuts(cuts);
447 
448  G4Tubs* MirrorTube = new G4Tubs("MirrorTube", 0., 63.*mm, .5*mm, 0.*deg, 360.*deg);
449  G4LogicalVolume *MirrorTubeLV = new G4LogicalVolume(MirrorTube, MYLAR, "MirrorTubeLV", 0, 0, 0);
450  G4RotationMatrix *cRotation = new G4RotationMatrix();
451  cRotation -> rotateY(12.0*deg);
452  new G4PVPlacement(cRotation, G4ThreeVector(0., 0., 175.*mm), "MirrorTubePV", MirrorTubeLV,PVWorld, false, 0);
453 
454  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Green());
455  simpleAlSVisAtt -> SetVisibility(true);
456  MirrorTubeLV -> SetVisAttributes(simpleAlSVisAtt);
457  MirrorTubeLV -> SetRegion(regVol);
458  regVol -> AddRootLogicalVolume(MirrorTubeLV);
459  bCreated = true;
460  return bCreated;
461 }
462 
464 {
465  G4double theta, x, y, z, dx, dy, dz;
466  x=centre.getX();
467  y=centre.getY();
468  z=centre.getZ();
469 
470  dx=halfSize.getX();
471  dy=halfSize.getY();
472  dz=halfSize.getZ();
473 
474  switch (idJaw)
475  {
476  case 1: //idJaw1XV2100:
477  theta = fabs(atan(jaw1XAperture/isoCentre));
478  centre.set(z*sin(theta)+dx*cos(theta), y, z*cos(theta)-dx*sin(theta));
479  cRotation->rotateY(-theta);
480  halfSize.set(fabs(dx*cos(theta)+dz*sin(theta)), fabs(dy), fabs(dz*cos(theta)+dx*sin(theta)));
481  break;
482 
483  case 2: //idJaw2XV2100:
484  theta = fabs(atan(jaw2XAperture/isoCentre));
485  centre.set(-(z*sin(theta)+dx*cos(theta)), y, z*cos(theta)-dx*sin(theta));
486  cRotation->rotateY(theta);
487  halfSize.set(fabs(dx*cos(theta)+dz*sin(theta)), fabs(dy), fabs(dz*cos(theta)+dx*sin(theta)));
488  break;
489 
490  case 3: //idJaw1YV2100:
491  theta = fabs(atan(jaw1YAperture/isoCentre));
492  centre.set(x, z*sin(theta)+dy*cos(theta), z*cos(theta)-dy*sin(theta));
493  cRotation->rotateX(theta);
494  halfSize.set(fabs(dx), fabs(dy*cos(theta)+dz*sin(theta)), fabs(dz*cos(theta)+dy*sin(theta)));
495  break;
496 
497  case 4: //idJaw2YV2100:
498  theta = fabs(atan(jaw2YAperture/isoCentre));
499  centre.set(x, -(z*sin(theta)+dy*cos(theta)), z*cos(theta)-dy*sin(theta));
500  cRotation->rotateX(-theta);
501  halfSize.set(fabs(dx), fabs(dy*cos(theta)+dz*sin(theta)), fabs(dz*cos(theta)+dy*sin(theta)));
502  break;
503  }
504 }
505 
506 
507 
509 {
510  bool bCreated = false;
511 
512  G4String name = "Jaws1X";
513  G4Box *box;
514  G4LogicalVolume *logVol;
515  G4VisAttributes* simpleAlSVisAtt;
516 
517  G4ThreeVector centre, halfSize;
518  G4RotationMatrix *cRotation = new G4RotationMatrix();
519 
520  centre.set(0.,0.,(320.+80./2.)*mm);
521  halfSize.set(45.*mm, 93.*mm, 78./2.*mm);
522  box = new G4Box(name+"Box", halfSize.getX(), halfSize.getY(), halfSize.getZ());
523  logVol = new G4LogicalVolume(box, steel1, name+"LV", 0, 0, 0);
524  SetJawAperture(1, centre, halfSize, cRotation);
525  new G4PVPlacement(
526  cRotation,
527  centre,
528  name+"PV",
529  logVol,
530  PVWorld,
531  false,
532  0);
533 
534  // Region for cuts
535  G4Region *regVol;
536  regVol= new G4Region(name+"R");
538  cuts->SetProductionCut(2.*cm);
539  regVol->SetProductionCuts(cuts);
540  logVol->SetRegion(regVol);
541  regVol->AddRootLogicalVolume(logVol);
542 
543  // Visibility
544  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Blue());
545  simpleAlSVisAtt -> SetVisibility(true);
546  logVol -> SetVisAttributes(simpleAlSVisAtt);
547 
548  bCreated = true;
549  return bCreated;
550 }
552 {
553  bool bCreated = false;
554 
555  G4String name = "Jaws2X";
556  G4Box *box;
557  G4LogicalVolume *logVol;
558  G4VisAttributes* simpleAlSVisAtt;
559 
560  G4ThreeVector centre, halfSize;
561  G4RotationMatrix *cRotation=new G4RotationMatrix();
562 
563  centre.set(0.,0.,(320.+80./2.)*mm);
564  halfSize.set(45.*mm, 93.*mm, 78./2.*mm);
565  box = new G4Box(name+"Box", halfSize.getX(), halfSize.getY(), halfSize.getZ());
566  logVol = new G4LogicalVolume(box, steel1, name+"LV", 0, 0, 0);
567  SetJawAperture(2, centre, halfSize, cRotation);
568  new G4PVPlacement(cRotation, centre, name+"PV", logVol, PVWorld, false, 0);
569 
570  // Region for cuts
571  G4Region *regVol;
572  regVol = new G4Region(name+"R");
574  cuts -> SetProductionCut(2.*cm);
575  regVol -> SetProductionCuts(cuts);
576  logVol -> SetRegion(regVol);
577  regVol -> AddRootLogicalVolume(logVol);
578 
579  // Visibility
580  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Cyan());
581  simpleAlSVisAtt -> SetVisibility(true);
582  logVol->SetVisAttributes(simpleAlSVisAtt);
583 
584  bCreated = true;
585  return bCreated;
586 }
588 {
589  bool bCreated = false;
590 
591  G4String name = "Jaws1Y";
592  G4Box *box;
593  G4LogicalVolume *logVol;
594  G4VisAttributes* simpleAlSVisAtt;
595 
596  G4ThreeVector centre, halfSize;
597  G4RotationMatrix *cRotation=new G4RotationMatrix();
598 
599  centre.set(0.,0.,(230.+80./2.)*mm);
600  halfSize.set(93.*mm, 35.*mm, 78./2.*mm);
601  box = new G4Box(name+"Box", halfSize.getX(), halfSize.getY(), halfSize.getZ());
602  logVol = new G4LogicalVolume(box, steel1, name+"LV", 0, 0, 0);
603  SetJawAperture(3, centre, halfSize, cRotation);
604  new G4PVPlacement(cRotation, centre, name+"PV", logVol, PVWorld, false, 0);
605 
606  // Region for cuts
607  G4Region *regVol;
608  regVol = new G4Region(name+"R");
610  cuts -> SetProductionCut(2.*cm);
611  regVol -> SetProductionCuts(cuts);
612  logVol -> SetRegion(regVol);
613  regVol -> AddRootLogicalVolume(logVol);
614 
615  // Visibility
616  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Red());
617  simpleAlSVisAtt -> SetVisibility(true);
618  logVol -> SetVisAttributes(simpleAlSVisAtt);
619 
620  bCreated = true;
621  return bCreated;
622 }
624 {
625  bool bCreated = false;
626 
627  G4String name = "Jaws2Y";
628  G4Box *box;
629  G4LogicalVolume *logVol;
630  G4VisAttributes* simpleAlSVisAtt;
631 
632  G4ThreeVector centre, halfSize;
633  G4RotationMatrix *cRotation=new G4RotationMatrix();
634 
635  centre.set(0.,0.,(230.+80./2.)*mm);
636  halfSize.set(93.*mm, 35.*mm, 78./2.*mm);
637  box = new G4Box(name+"Box", halfSize.getX(), halfSize.getY(), halfSize.getZ());
638  logVol = new G4LogicalVolume(box, steel1, name+"LV", 0, 0, 0);
639  SetJawAperture(4, centre, halfSize, cRotation);
640  new G4PVPlacement(cRotation, centre, name+"PV", logVol, PVWorld, false, 0);
641 
642  // Region for cuts
643  G4Region *regVol;
644  regVol = new G4Region(name+"R");
646  cuts -> SetProductionCut(2.*cm);
647  regVol -> SetProductionCuts(cuts);
648  logVol -> SetRegion(regVol);
649  regVol -> AddRootLogicalVolume(logVol);
650 
651  // Visibility
652  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Magenta());
653  simpleAlSVisAtt -> SetVisibility(true);
654  logVol -> SetVisAttributes(simpleAlSVisAtt);
655 
656  bCreated = true;
657  return bCreated;
658 }
659 bool CML2Acc1::MLC() //MultiLeaf Collimator
660 {
661  bool bCreated = false;
662  // material
664  G4VisAttributes* simpleAlSVisAtt;
665  // Region for cuts
666  G4Region *regVol;
667  regVol = new G4Region("MLCR");
669  cuts -> SetProductionCut(1.0*cm);
670  regVol -> SetProductionCuts(cuts);
671 
672  G4ThreeVector boxSize;
673  G4ThreeVector centreStart;
674  centreStart.set(0.,0.,(330.+600.)/2.*mm);
675  boxSize.set(6./2.*mm, 180./2.*mm, 50./2.*mm);
676 
677  // single leaf
678  G4Box* boxLeaf = new G4Box("LeafBox", boxSize.getX(), boxSize.getY(), boxSize.getZ());
679 
680  G4LogicalVolume *leafLVA = new G4LogicalVolume(boxLeaf, Fe, "leafSolidALV", 0, 0, 0);
681  G4LogicalVolume *leafLVB = new G4LogicalVolume(boxLeaf, Fe, "leafSolidBLV", 0, 0, 0);
682 
683  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Cyan());
684  simpleAlSVisAtt -> SetVisibility(true);
685  leafLVA -> SetVisAttributes(simpleAlSVisAtt);
686  leafLVA -> SetRegion(regVol);
687  regVol -> AddRootLogicalVolume(leafLVA);
688 
689  simpleAlSVisAtt = new G4VisAttributes(G4Colour::Green());
690  simpleAlSVisAtt -> SetVisibility(true);
691  leafLVB -> SetVisAttributes(simpleAlSVisAtt);
692  leafLVB -> SetRegion(regVol);
693  regVol -> AddRootLogicalVolume(leafLVB);
694 
695  int i;
696  int j=0;
697  G4String PVname;
698  G4ThreeVector centre;
699  int nhalfLeaves = (int)(vec_leavesA.size()/2.);
700  centre = centreStart + G4ThreeVector(-nhalfLeaves*boxSize.getX(), 0.,0.);
701  for (i = 1; i < (int)vec_leavesA.size(); i++)
702  {
703  G4String str;
704  char appo[12];
705  sprintf(appo,"%d",i);
706  str = appo;
707  PVname = "leafA"+str;
708  centre.setX(centre.getX()+boxSize.getX()*2.);
709  centre.setY(-boxSize.getY()-vec_leavesA[i]);
710  new G4PVPlacement(0, centre, PVname, leafLVA, PVWorld, false, i);
711  j++;
712  }
713  nhalfLeaves = (int)(vec_leavesB.size()/2.);
714  centre = centreStart+G4ThreeVector(-nhalfLeaves*boxSize.getX(), 0.,0.);
715  for (i = 1; i < (int)vec_leavesB.size(); i++)
716  {
717  G4String str;
718  char appo[12];
719  sprintf(appo,"%d",i);
720  str = appo;
721  PVname = "leafB"+str;
722  centre.setX(centre.getX()+boxSize.getX()*2.);
723  centre.setY(+boxSize.getY()+vec_leavesB[i]);
724  new G4PVPlacement(0, centre, PVname, leafLVB, PVWorld, false, i);
725  j++;
726  }
727  bCreated = true;
728  return bCreated;
729 }
730