Geant4  10.00.p01
ML2Acc1.cc
Go to the documentation of this file.
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 "G4SystemOfUnits.hh"
47 
49 {
51 }
52 
54 {
55 }
57 
59 {
60  if (instance == 0)
61  {
62  instance = new CML2Acc1();
63  }
64  return instance;
65 }
67 {
68  std::cout <<"\n\n\tnominal beam energy: "<<idEnergy << G4endl;
69  std::cout <<"\tJaw X aperture: 1) "<< jaw1XAperture/mm<<"[mm]\t2) " << jaw2XAperture/mm<< " [mm]"<< G4endl;
70  std::cout <<"\tJaw Y aperture: 1) "<< jaw1YAperture/mm<<"[mm]\t2) " << jaw2YAperture/mm<< " [mm]\n"<< G4endl;
71 }
73 {
74  G4Material * material=0;
75  G4double A, Z, d;
76  G4String name;
77 
78  // General elements
79 
80  A = 12.011*g/mole;
81  G4Element* elC = new G4Element("Carbon","C",Z = 6.,A);
82 
83  A = 30.974*g/mole;
84  G4Element* elP = new G4Element("Phosphorus","P",Z = 15.,A);
85 
86  A = 32.064*g/mole;
87  G4Element* elS = new G4Element("Sulfur","S",Z = 16.,A);
88 
89  A = 55.85*g/mole;
90  G4Element* elFe = new G4Element("Iron","Fe",Z = 26.,A);
91 
92  A = 51.9961*g/mole;
93  G4Element* elCr = new G4Element("Cromium","Cr", Z = 24.,A);
94 
95  A = 54.94*g/mole;
96  G4Element* elMn = new G4Element("Manganese","Mn", Z = 25.,A);
97 
98  A = 58.69*g/mole;
99  G4Element* elNi = new G4Element("Nickel","Ni", Z = 28.,A);
100 
101  A = 28.09*g/mole;
102  G4Element* elSi = new G4Element("Silicon","Si", Z = 14.,A);
103 
104  A = 183.84*g/mole;
105  G4Element* elW = new G4Element("Tungsten","W", Z = 74.,A);
106 
107  if (materialName=="steel1")
108  {
109  d = 7.76 *g/cm3;
110  G4Material* steel1 = new G4Material("steel1", d,4);
111  steel1 -> AddElement(elFe, 0.935);
112  steel1 -> AddElement(elS,0.01);
113  steel1 -> AddElement(elMn,0.05);
114  steel1 -> AddElement(elC,0.005);
115  material=steel1;
116  }
117  else if (materialName=="steel2")
118  {
119  d = 8.19*g/cm3;
120  G4Material* steel2 = new G4Material("steel2", d,5);
121  steel2 -> AddElement(elFe, 0.759);
122  steel2 -> AddElement(elNi, 0.11);
123  steel2 -> AddElement(elSi,0.01);
124  steel2 -> AddElement(elCr,0.12);
125  steel2 -> AddElement(elP,0.001);
126  material=steel2;
127  }
128  else if (materialName=="steel3")
129  {
130  d = 8.19*g/cm3;
131  G4Material* steel3 = new G4Material("steel3", d,5);
132  steel3 -> AddElement(elFe, 0.69);
133  steel3 -> AddElement(elNi, 0.1);
134  steel3 -> AddElement(elSi,0.01);
135  steel3 -> AddElement(elCr,0.18);
136  steel3 -> AddElement(elMn,0.02);
137  material=steel3;
138  }
139  else if (materialName=="EZcut")
140  {
141  d = 7.9*g/cm3;
142  G4Material* EZcut20 = new G4Material("EZcut", d,2);
143  EZcut20 -> AddElement(elFe, 0.98);
144  EZcut20 -> AddElement(elMn,0.02);
145  material=EZcut20;
146  }
147  else if (materialName=="W")
148  {
149  d = 15*g/cm3;
150  G4Material* W = new G4Material("W", d,1);
151  W -> AddElement(elW, 1.);
152  material=W;
153  }
154  return material;
155 }
157 {
158  PVWorld=PWorld;
159  setIsoCentre(iso);
160  target();
161  BeWindow();
164  mirror();
166  MLC();
167  Jaw1X();
168  Jaw2X();
169  Jaw1Y();
170  Jaw2Y();
171 }
173 {
174  leavesA.clear();
175  leavesB.clear();
176 }
177 
179 {
180  switch (idEnergy)
181  {
182  case 6:
183  // materials
184 
187 
188  // colors
189 
190  G4Colour cyan (0.0, 1.0, 1.0);
191  G4Colour magenta (1.0, 0.0, 1.0);
192 
193  // volumes
194  // beam line along z axis
195 //------------------------target 6MV------------------------
196  G4double targetADim_x = 0.6*cm;
197  G4double targetADim_y = 0.6*cm;
198  G4double targetADim_z = 0.04445*cm;
199  G4Box* targetA_box = new G4Box("targetA_box",targetADim_x,targetADim_y,targetADim_z);
200  G4LogicalVolume *targetA_log = new G4LogicalVolume(targetA_box,W,"targetA_log",0,0,0);
201  G4double targetAPos_x = 0.0*m;
202  G4double targetAPos_y = 0.0*m;
203  G4double targetAPos_z = 0.20055*cm;
204  targetA_phys = new G4PVPlacement(0,
205  G4ThreeVector(targetAPos_x,targetAPos_y,targetAPos_z),
206  "targetA",targetA_log,PVWorld,false,0);
207 
208  G4double targetBDim_x = 0.6*cm;
209  G4double targetBDim_y = 0.6*cm;
210  G4double targetBDim_z = 0.07874*cm;
211  G4Box* targetB_box = new G4Box("targetB_box",targetBDim_x,targetBDim_y,targetBDim_z);
212  G4LogicalVolume *targetB_log = new G4LogicalVolume(targetB_box,Cu,"targetB_log",0,0,0);
213  G4double targetBPos_x = 0.0*m;
214  G4double targetBPos_y = 0.0*m;
215  G4double targetBPos_z = 0.07736*cm;
216  targetB_phys = new G4PVPlacement(0,
217  G4ThreeVector(targetBPos_x,targetBPos_y,targetBPos_z),
218  "targetB",targetB_log,PVWorld,false,0);
219 
220 
221  // *********** REGIONS for CUTS
222 
223  G4Region *regVol;
224  regVol= new G4Region("targetR");
226  cuts->SetProductionCut(0.1*cm);
227  regVol->SetProductionCuts(cuts);
228 
229  targetA_log->SetRegion(regVol);
230  regVol->AddRootLogicalVolume(targetA_log);
231  targetB_log->SetRegion(regVol);
232  regVol->AddRootLogicalVolume(targetB_log);
233 
234  // Visualization attributes
235 
236  G4VisAttributes* simpleWSVisAtt, *simpleCuSVisAtt;
237  simpleWSVisAtt= new G4VisAttributes(magenta);
238  simpleWSVisAtt->SetVisibility(true);
239 // simpleWSVisAtt->SetForceSolid(true);
240  simpleCuSVisAtt= new G4VisAttributes(cyan);
241  simpleCuSVisAtt->SetVisibility(true);
242 // simpleCuSVisAtt->SetForceSolid(true);
243  targetA_log->SetVisAttributes(simpleWSVisAtt);
244  targetB_log->SetVisAttributes(simpleCuSVisAtt);
245 
246  return true;
247  break;
248  }
249  return false;
250 }
252 {
253 
254  // materials
255 
256  G4Material* Vacuum = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
258 
259  // colors
260 
261  G4Colour magenta (1.0, 0.0, 1.0);
262 
263  //---------rotation matrix first collimator --------
264 
265  G4RotationMatrix* rotateMatrix=new G4RotationMatrix();
266  rotateMatrix->rotateX(180.0*deg);
267 
268  //-------------------- the first collimator upper----------------
269 
270 
271  G4double innerRadiusOfTheTubeEx = 1.0*cm;
272  G4double outerRadiusOfTheTubeEx = 8.*cm;
273  G4double hightOfTheTubeEx = 3.0*cm;
274  G4double startAngleOfTheTubeEx = 0.*deg;
275  G4double spanningAngleOfTheTubeEx = 360.*deg;
276  G4Tubs* UpperCollimator = new G4Tubs("UpperCollimator",innerRadiusOfTheTubeEx,
277  outerRadiusOfTheTubeEx,hightOfTheTubeEx,
278  startAngleOfTheTubeEx,spanningAngleOfTheTubeEx);
279  G4LogicalVolume *UpperCollimator_log = new G4LogicalVolume(UpperCollimator,W,"UpperCollimator_log",0,0,0);
280 
281  G4double UpperCollimatorPosX = 0.*cm;
282  G4double UpperCollimatorPosY = 0.*cm;
283  G4double UpperCollimatorPosZ = -1.*cm;
285  G4ThreeVector(UpperCollimatorPosX,UpperCollimatorPosY,
286  UpperCollimatorPosZ),"UpperCollimator",
287  UpperCollimator_log,PVWorld,false,0);
288 
289 
290  //-------------------- the first collimator lower----------------
291 
292  G4double pRmin1 = 0.*cm;
293 
294  G4double pRmax1 = 0.5*cm;
295  G4double pRmin2 = 0.*cm;
296  G4double pRmax2 = 1.7658592*cm;
297  G4double hightOfTheCone =3.2*cm;
298  G4double startAngleOfTheCone = 0.*deg;
299  G4double spanningAngleOfTheCone = 360.*deg;
300 
301  G4Cons* collim_cone = new G4Cons("collim_cone",pRmin1,pRmax1,pRmin2,
302  pRmax2,hightOfTheCone,startAngleOfTheCone,
303  spanningAngleOfTheCone);
304  G4LogicalVolume *collim_log = new G4LogicalVolume(collim_cone,Vacuum,"collim_log",0,0,0);
305 
306 
307  G4double innerRadiusOfTheTube = 0.*cm;
308  G4double outerRadiusOfTheTube = 8.*cm;
309  G4double hightOfTheTube = 3.1*cm;
310  G4double startAngleOfTheTube = 0.*deg;
311  G4double spanningAngleOfTheTube = 360.*deg;
312  G4Tubs* tracker_tube = new G4Tubs("tracker_tube",innerRadiusOfTheTube,
313  outerRadiusOfTheTube,hightOfTheTube,
314  startAngleOfTheTube,spanningAngleOfTheTube);
315 // G4LogicalVolume *tracker_log = new G4LogicalVolume(tracker_tube,W,"tracker_log",0,0,0);
316 
317 
318  G4SubtractionSolid* CylMinusCone = new G4SubtractionSolid("Cyl-Cone",
319  tracker_tube,collim_cone);
320  G4LogicalVolume *CylMinusCone_log = new G4LogicalVolume(CylMinusCone,W,"CylminusCone_log",0,0,0);
321  G4double CminusCPos_x = 0.*cm;
322  G4double CminusCPos_y = 0.*cm;
323  G4double CminusCPos_z = +6.2*cm;
324  CylMinusCone_phys = new G4PVPlacement(rotateMatrix,
325  G4ThreeVector(CminusCPos_x,CminusCPos_y,CminusCPos_z),
326  "CylMinusCone",CylMinusCone_log,PVWorld,false,0);
327 
328 //--------- Visualization attributes -------------------------------
329  G4VisAttributes* simpleTungstenWVisAtt= new G4VisAttributes(magenta);
330  simpleTungstenWVisAtt->SetVisibility(true);
331 // simpleTungstenWVisAtt->SetForceSolid(true);
332  collim_log->SetVisAttributes(simpleTungstenWVisAtt);
333 
334 
335  CylMinusCone_log->SetVisAttributes(simpleTungstenWVisAtt);
336  UpperCollimator_log->SetVisAttributes(simpleTungstenWVisAtt);
337 
338  // *********** REGIONS for CUTS
339 
340  G4Region *regVol;
341  regVol= new G4Region("PrymCollR");
343  cuts->SetProductionCut(0.1*cm);
344  regVol->SetProductionCuts(cuts);
345 
346  collim_log->SetRegion(regVol);
347  regVol->AddRootLogicalVolume(collim_log);
348 
349  CylMinusCone_log->SetRegion(regVol);
350  regVol->AddRootLogicalVolume(CylMinusCone_log);
351 
352  UpperCollimator_log->SetRegion(regVol);
353  regVol->AddRootLogicalVolume(UpperCollimator_log);
354 
355  return true;
356 }
358 {
359  bool bCreated=false;
361  G4Region *regVol;
362  G4VisAttributes* simpleAlSVisAtt;
363  // Region for cuts
364  regVol= new G4Region("BeWindow");
366  cuts->SetProductionCut(0.1*cm);
367  regVol->SetProductionCuts(cuts);
368 
369  G4Tubs* BeWTube = new G4Tubs("BeWindowTube", 0., 36.*mm, 0.2*mm, 0.*deg, 360.*deg);
370  G4LogicalVolume *BeWTubeLV = new G4LogicalVolume(BeWTube, Be, "BeWTubeLV", 0, 0, 0);
371  BeWTubePV=new G4PVPlacement(0, G4ThreeVector(0.,0.,100.*mm), "BeWTubePV", BeWTubeLV,
372  PVWorld, false, 0);
373 
374  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Yellow());
375  simpleAlSVisAtt->SetVisibility(true);
376 // simpleAlSVisAtt->SetForceSolid(true);
377  BeWTubeLV->SetVisAttributes(simpleAlSVisAtt);
378  BeWTubeLV->SetRegion(regVol);
379  regVol->AddRootLogicalVolume(BeWTubeLV);
380 
381  bCreated=true;
382  return bCreated;
383 }
385 {
386  switch (idEnergy)
387  {
388  case 6:
389  G4double z0, h0;
390  G4ThreeVector centre, halSize;
392  // Region for cuts
393  G4Region *regVol;
394  regVol= new G4Region("flatfilterR");
396  cuts->SetProductionCut(0.5*cm);
397  regVol->SetProductionCuts(cuts);
398 
399  G4VisAttributes* simpleAlSVisAtt;
400 
401  // one
402  z0=130.0*mm;
403  h0=5.0/2.*cm;
404  centre.set(0.,0.,z0);
405  G4Cons *FFL1A_1Cone = new G4Cons("FFL1A_1", 0.*cm, 0.3*cm, 0.*cm, 5.*cm, h0, 0.*deg, 360.*deg);
406  G4LogicalVolume *FFL1A_1LV = new G4LogicalVolume(FFL1A_1Cone, Cu, "FFL1A_1LV", 0, 0, 0);
407  FFL1A_1PV=new G4PVPlacement(0, centre, "FFL1A_1PV", FFL1A_1LV, PVWorld, false, 0);
408 
409  // two
410  z0+=h0;
411  h0=0.081/2.*cm;
412  z0+=h0;
413  centre.setZ(z0);
414  z0+=h0;
415  G4Tubs *FFL2_1Tube = new G4Tubs("FFL6_1", 0.*cm, 2.5*cm, h0, 0.*deg, 360.*deg);
416  G4LogicalVolume *FFL2_1LV = new G4LogicalVolume(FFL2_1Tube, Cu, "FFL2_1LV", 0, 0, 0);
417  FFL2_1PV=new G4PVPlacement(0, centre, "FFL2_1PV", FFL2_1LV, PVWorld, false, 0);
418 
419  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Red());
420  simpleAlSVisAtt->SetVisibility(true);
421 // simpleAlSVisAtt->SetForceSolid(true);
422  FFL1A_1LV->SetVisAttributes(simpleAlSVisAtt);
423  FFL2_1LV->SetVisAttributes(simpleAlSVisAtt);
424 
425  FFL1A_1LV->SetRegion(regVol);
426  FFL2_1LV->SetRegion(regVol);
427 
428  regVol->AddRootLogicalVolume(FFL1A_1LV);
429  regVol->AddRootLogicalVolume(FFL2_1LV);
430  return true;
431  break;
432  }
433  return false;
434 }
436 {
437  bool bCreated=false;
438 
439  G4Material *material=G4NistManager::Instance()->FindOrBuildMaterial("G4_KAPTON");
440  G4VisAttributes* simpleAlSVisAtt;
441  // Region for cuts
442  G4Region *regVol;
443  regVol= new G4Region("ionizationChamber");
445  cuts->SetProductionCut(0.1*cm);
446  regVol->SetProductionCuts(cuts);
447 
448  G4Tubs* ICTubeW = new G4Tubs("ionizationChamberTube", 0., 2.*2.54*10.*mm, 0.016*25.4*mm, 0.*deg, 360.*deg);
449  G4Tubs* ICTubeP = new G4Tubs("ionizationChamberTube", 0., 2.*2.54*10.*mm, 0.010*25.4*mm, 0.*deg, 360.*deg);
450 
451  G4ThreeVector centre;
452  // W1
453  centre.set(0.,0.,157.*mm);
454  G4LogicalVolume *PCUTubeW1LV = new G4LogicalVolume(ICTubeW, material, "ionizationChamberTubeW1LV", 0, 0, 0);
455  PCUtubeW1PV=new G4PVPlacement(0, centre, "ionizationChamberTubeW1PV", PCUTubeW1LV, PVWorld, false, 0);
456  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Blue());
457  simpleAlSVisAtt->SetVisibility(true);
458 // simpleAlSVisAtt->SetForceSolid(true);
459  PCUTubeW1LV->SetVisAttributes(simpleAlSVisAtt);
460  PCUTubeW1LV->SetRegion(regVol);
461  regVol->AddRootLogicalVolume(PCUTubeW1LV);
462 
463  // P1
464  centre.set(0.,0.,158.*mm);
465  G4LogicalVolume *PCUTubeP1LV = new G4LogicalVolume(ICTubeP, material, "ionizationChamberTubeP1LV", 0, 0, 0);
466  PCUtubeP1PV=new G4PVPlacement(0, centre, "ionizationChamberTubeP1PV", PCUTubeP1LV, PVWorld, false, 0);
467  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Yellow());
468  simpleAlSVisAtt->SetVisibility(true);
469 // simpleAlSVisAtt->SetForceSolid(true);
470  PCUTubeP1LV->SetVisAttributes(simpleAlSVisAtt);
471  PCUTubeP1LV->SetRegion(regVol);
472  regVol->AddRootLogicalVolume(PCUTubeP1LV);
473 
474  // W2
475  centre.set(0.,0.,159.*mm);
476  G4LogicalVolume *PCUTubeW2LV = new G4LogicalVolume(ICTubeW, material, "ionizationChamberTubeW2LV", 0, 0, 0);
477  PCUtubeW2PV=new G4PVPlacement(0, centre, "ionizationChamberTubeW2PV", PCUTubeW2LV, PVWorld, false, 0);
478  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Blue());
479  simpleAlSVisAtt->SetVisibility(true);
480 // simpleAlSVisAtt->SetForceSolid(true);
481  PCUTubeW2LV->SetVisAttributes(simpleAlSVisAtt);
482  PCUTubeW2LV->SetRegion(regVol);
483  regVol->AddRootLogicalVolume(PCUTubeW2LV);
484 
485  // P2
486  centre.set(0.,0.,160.*mm);
487  G4LogicalVolume *PCUTubeP2LV = new G4LogicalVolume(ICTubeP, material, "ionizationChamberTubeP2LV", 0, 0, 0);
488  PCUtubeP2PV=new G4PVPlacement(0, centre, "ionizationChamberTubeP2PV", PCUTubeP2LV, PVWorld, false, 0);
489  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Yellow());
490  simpleAlSVisAtt->SetVisibility(true);
491 // simpleAlSVisAtt->SetForceSolid(true);
492  PCUTubeP2LV->SetVisAttributes(simpleAlSVisAtt);
493  PCUTubeP2LV->SetRegion(regVol);
494  regVol->AddRootLogicalVolume(PCUTubeP2LV);
495 
496  // W3
497  centre.set(0.,0.,161.*mm);
498  G4LogicalVolume *PCUTubeW3LV = new G4LogicalVolume(ICTubeW, material, "ionizationChamberTubeW3LV", 0, 0, 0);
499  PCUtubeW3PV=new G4PVPlacement(0, centre, "ionizationChamberTubeW3PV", PCUTubeW3LV, PVWorld, false, 0);
500  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Blue());
501  simpleAlSVisAtt->SetVisibility(true);
502 // simpleAlSVisAtt->SetForceSolid(true);
503  PCUTubeW3LV->SetVisAttributes(simpleAlSVisAtt);
504  PCUTubeW3LV->SetRegion(regVol);
505  regVol->AddRootLogicalVolume(PCUTubeW3LV);
506 
507  // P3
508  centre.set(0.,0.,162.*mm);
509  G4LogicalVolume *PCUTubeP3LV = new G4LogicalVolume(ICTubeP, material, "ionizationChamberTubeP3LV", 0, 0, 0);
510  PCUtubeP3PV=new G4PVPlacement(0, centre, "ionizationChamberTubeP3PV", PCUTubeP3LV, PVWorld, false, 0);
511  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Yellow());
512  simpleAlSVisAtt->SetVisibility(true);
513 // simpleAlSVisAtt->SetForceSolid(true);
514  PCUTubeP3LV->SetVisAttributes(simpleAlSVisAtt);
515  PCUTubeP3LV->SetRegion(regVol);
516  regVol->AddRootLogicalVolume(PCUTubeP3LV);
517 
518  bCreated=true;
519  return bCreated;
520 }
522 {
523  bool bCreated=false;
525  G4VisAttributes* simpleAlSVisAtt;
526  // Region for cuts
527  G4Region *regVol;
528  regVol= new G4Region("Mirror");
530  cuts->SetProductionCut(0.1*cm);
531  regVol->SetProductionCuts(cuts);
532 
533  G4Tubs* MirrorTube = new G4Tubs("MirrorTube", 0., 63.*mm, .5*mm, 0.*deg, 360.*deg);
534  G4LogicalVolume *MirrorTubeLV = new G4LogicalVolume(MirrorTube, MYLAR, "MirrorTubeLV", 0, 0, 0);
535  G4RotationMatrix *cRotation=new G4RotationMatrix();
536  cRotation->rotateY(12.0*deg);
537  MirrorTubePV=new G4PVPlacement(cRotation, G4ThreeVector(0., 0., 175.*mm), "MirrorTubePV", MirrorTubeLV,PVWorld, false, 0);
538 
539  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Green());
540  simpleAlSVisAtt->SetVisibility(true);
541 // simpleAlSVisAtt->SetForceSolid(true);
542  MirrorTubeLV->SetVisAttributes(simpleAlSVisAtt);
543  MirrorTubeLV->SetRegion(regVol);
544  regVol->AddRootLogicalVolume(MirrorTubeLV);
545  bCreated=true;
546  return bCreated;
547 }
548 
549 void CML2Acc1::SetJawAperture(G4int idJaw, G4ThreeVector &centre, G4ThreeVector halfSize, G4double aperture, G4RotationMatrix *cRotation)
550 {
551  using namespace std;
552  G4double theta, x, y, z, dx, dy, dz;
553  x=centre.getX();
554  y=centre.getY();
555  z=centre.getZ();
556  theta=fabs(atan(aperture/isoCentre));
557  dx=halfSize.getX();
558  dy=halfSize.getY();
559  dz=halfSize.getZ();
560 
561 // G4double p1x, p1y, p2x, p2y;
562 
563  switch (idJaw)
564  {
565  case 1: //idJaw1XV2100:
566  centre.set(z*sin(theta)+dx*cos(theta), y, z*cos(theta)-dx*sin(theta));
567 // beta=fabs(atan(dx/dz));
568 // R=std::sqrt(dx*dx+dz*dz);
569 // p1x=centre.getX()-R*sin(theta+beta);
570 // p1y=centre.getZ()-R*cos(theta+beta);
571 // p2x=centre.getX()+R*sin(theta-beta);
572 // p2y=centre.getZ()+R*cos(theta-beta);
573 
574  cRotation->rotateY(-theta);
575  halfSize.set(fabs(dx*cos(theta)+dz*sin(theta)), fabs(dy), fabs(dz*cos(theta)+dx*sin(theta)));
576  break;
577  case 2: //idJaw2XV2100:
578  centre.set(-(z*sin(theta)+dx*cos(theta)), y, z*cos(theta)-dx*sin(theta));
579 // beta=fabs(atan(dx/dz));
580 // R=std::sqrt(dx*dx+dz*dz);
581 // p1x=centre.getX()+R*sin(theta+beta);
582 // p1y=centre.getZ()-R*cos(theta+beta);
583 // p2x=centre.getX()-R*sin(theta-beta);
584 // p2y=centre.getZ()+R*cos(theta-beta);
585 
586  cRotation->rotateY(theta);
587  halfSize.set(fabs(dx*cos(theta)+dz*sin(theta)), fabs(dy), fabs(dz*cos(theta)+dx*sin(theta)));
588  break;
589  case 3: //idJaw1YV2100:
590  centre.set(x, z*sin(theta)+dy*cos(theta), z*cos(theta)-dy*sin(theta));
591 // beta=fabs(atan(dy/dz));
592 // R=std::sqrt(dy*dy+dz*dz);
593 // p1x=centre.getY()-R*sin(theta+beta);
594 // p1y=centre.getZ()-R*cos(theta+beta);
595 // p2x=centre.getY()+R*sin(theta-beta);
596 // p2y=centre.getZ()+R*cos(theta-beta);
597 
598  cRotation->rotateX(theta);
599  halfSize.set(fabs(dx), fabs(dy*cos(theta)+dz*sin(theta)), fabs(dz*cos(theta)+dy*sin(theta)));
600  break;
601  case 4: //idJaw2YV2100:
602  centre.set(x, -(z*sin(theta)+dy*cos(theta)), z*cos(theta)-dy*sin(theta));
603 // beta=fabs(atan(dy/dz));
604 // R=std::sqrt(dy*dy+dz*dz);
605 // p1x=centre.getY()+R*sin(theta+beta);
606 // p1y=centre.getZ()-R*cos(theta+beta);
607 // p2x=centre.getY()-R*sin(theta-beta);
608 // p2y=centre.getZ()+R*cos(theta-beta);
609 
610  cRotation->rotateX(-theta);
611  halfSize.set(fabs(dx), fabs(dy*cos(theta)+dz*sin(theta)), fabs(dz*cos(theta)+dy*sin(theta)));
612  break;
613  }
614 }
615 
616 
617 
619 {
620  bool bCreated=false;
621  G4Material *steel1=otherMaterials("steel1");
622  G4String name="Jaws1X";
623  G4Box *box;
624  G4LogicalVolume *logVol;
625  G4VisAttributes* simpleAlSVisAtt;
626 
627  G4ThreeVector centre, halfSize;
628  G4RotationMatrix *cRotation=new G4RotationMatrix();
629  centre.set(0.,0.,(320.+80./2.)*mm);
630  halfSize.set(45.*mm, 93.*mm, 78./2.*mm);
631  box = new G4Box(name+"Box", halfSize.getX(), halfSize.getY(), halfSize.getZ());
632  logVol = new G4LogicalVolume(box, steel1, name+"LV", 0, 0, 0);
633  SetJawAperture(1, centre, halfSize, jaw1XAperture, cRotation);
634  phVol1X= new G4PVPlacement(cRotation, centre, name+"PV", logVol, PVWorld, false, 0);
635 
636  // Region for cuts
637  G4Region *regVol;
638  regVol= new G4Region(name+"R");
640  cuts->SetProductionCut(2.*cm);
641  regVol->SetProductionCuts(cuts);
642  logVol->SetRegion(regVol);
643  regVol->AddRootLogicalVolume(logVol);
644 
645  // Visibility
646  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Blue());
647  simpleAlSVisAtt->SetVisibility(true);
648 // simpleAlSVisAtt->SetForceSolid(true);
649  logVol->SetVisAttributes(simpleAlSVisAtt);
650 
651  bCreated=true;
652  return bCreated;
653 }
655 {
656  bool bCreated=false;
657  G4Material *steel1=otherMaterials("steel1");
658  G4String name="Jaws2X";
659  G4Box *box;
660  G4LogicalVolume *logVol;
661  G4VisAttributes* simpleAlSVisAtt;
662 
663  G4ThreeVector centre, halfSize;
664  G4RotationMatrix *cRotation=new G4RotationMatrix();
665  centre.set(0.,0.,(320.+80./2.)*mm);
666  halfSize.set(45.*mm, 93.*mm, 78./2.*mm);
667  box = new G4Box(name+"Box", halfSize.getX(), halfSize.getY(), halfSize.getZ());
668  logVol = new G4LogicalVolume(box, steel1, name+"LV", 0, 0, 0);
669  SetJawAperture(2, centre, halfSize, jaw2XAperture, cRotation);
670  phVol2X= new G4PVPlacement(cRotation, centre, name+"PV", logVol, PVWorld, false, 0);
671 
672  // Region for cuts
673  G4Region *regVol;
674  regVol= new G4Region(name+"R");
676  cuts->SetProductionCut(2.*cm);
677  regVol->SetProductionCuts(cuts);
678  logVol->SetRegion(regVol);
679  regVol->AddRootLogicalVolume(logVol);
680 
681  // Visibility
682  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Cyan());
683  simpleAlSVisAtt->SetVisibility(true);
684 // simpleAlSVisAtt->SetForceSolid(true);
685  logVol->SetVisAttributes(simpleAlSVisAtt);
686 
687  bCreated=true;
688  return bCreated;
689 }
691 {
692  bool bCreated=false;
693  G4Material *steel1=otherMaterials("steel1");
694  G4String name="Jaws1Y";
695  G4Box *box;
696  G4LogicalVolume *logVol;
697  G4VisAttributes* simpleAlSVisAtt;
698 
699  G4ThreeVector centre, halfSize;
700  G4RotationMatrix *cRotation=new G4RotationMatrix();
701  centre.set(0.,0.,(230.+80./2.)*mm);
702  halfSize.set(93.*mm, 35.*mm, 78./2.*mm);
703  box = new G4Box(name+"Box", halfSize.getX(), halfSize.getY(), halfSize.getZ());
704  logVol = new G4LogicalVolume(box, steel1, name+"LV", 0, 0, 0);
705  SetJawAperture(3, centre, halfSize, jaw1YAperture, cRotation);
706  phVol1Y= new G4PVPlacement(cRotation, centre, name+"PV", logVol, PVWorld, false, 0);
707 
708  // Region for cuts
709  G4Region *regVol;
710  regVol= new G4Region(name+"R");
712  cuts->SetProductionCut(2.*cm);
713  regVol->SetProductionCuts(cuts);
714  logVol->SetRegion(regVol);
715  regVol->AddRootLogicalVolume(logVol);
716 
717  // Visibility
718  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Red());
719  simpleAlSVisAtt->SetVisibility(true);
720 // simpleAlSVisAtt->SetForceSolid(true);
721  logVol->SetVisAttributes(simpleAlSVisAtt);
722 
723  bCreated=true;
724  return bCreated;
725 }
727 {
728  bool bCreated=false;
729  G4Material *steel1=otherMaterials("steel1");
730  G4String name="Jaws2Y";
731  G4Box *box;
732  G4LogicalVolume *logVol;
733  G4VisAttributes* simpleAlSVisAtt;
734 
735  G4ThreeVector centre, halfSize;
736  G4RotationMatrix *cRotation=new G4RotationMatrix();
737  centre.set(0.,0.,(230.+80./2.)*mm);
738  halfSize.set(93.*mm, 35.*mm, 78./2.*mm);
739  box = new G4Box(name+"Box", halfSize.getX(), halfSize.getY(), halfSize.getZ());
740  logVol = new G4LogicalVolume(box, steel1, name+"LV", 0, 0, 0);
741  SetJawAperture(4, centre, halfSize, jaw2YAperture, cRotation);
742  phVol2Y= new G4PVPlacement(cRotation, centre, name+"PV", logVol, PVWorld, false, 0);
743 
744  // Region for cuts
745 
746  G4Region *regVol;
747  regVol= new G4Region(name+"R");
749  cuts->SetProductionCut(2.*cm);
750  regVol->SetProductionCuts(cuts);
751  logVol->SetRegion(regVol);
752  regVol->AddRootLogicalVolume(logVol);
753 
754  // Visibility
755  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Magenta());
756  simpleAlSVisAtt->SetVisibility(true);
757 // simpleAlSVisAtt->SetForceSolid(true);
758  logVol->SetVisAttributes(simpleAlSVisAtt);
759 
760  bCreated=true;
761  return bCreated;
762 }
764 {
765  bool bCreated=false;
766  // material
768  G4VisAttributes* simpleAlSVisAtt;
769  // Region for cuts
770  G4Region *regVol;
771  regVol= new G4Region("MLCR");
773  cuts->SetProductionCut(1.0*cm);
774  regVol->SetProductionCuts(cuts);
775 
776  G4ThreeVector boxSize;
777 
778  G4ThreeVector centreStart;
779  centreStart.set(0.,0.,(330.+600.)/2.*mm);
780 
781  boxSize.set(6./2.*mm, 180./2.*mm, 50./2.*mm);
782 
783  // single leaf
784  G4Box* boxLeaf =new G4Box("LeafBox", boxSize.getX(), boxSize.getY(), boxSize.getZ());
785 
786  G4LogicalVolume *leafLVA = new G4LogicalVolume(boxLeaf, Fe, "leafSolidALV", 0, 0, 0);
787  G4LogicalVolume *leafLVB = new G4LogicalVolume(boxLeaf, Fe, "leafSolidBLV", 0, 0, 0);
788 
789  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Cyan());
790  simpleAlSVisAtt->SetVisibility(true);
791 // simpleAlSVisAtt->SetForceSolid(true);
792  leafLVA->SetVisAttributes(simpleAlSVisAtt);
793  leafLVA->SetRegion(regVol);
794  regVol->AddRootLogicalVolume(leafLVA);
795 
796  simpleAlSVisAtt= new G4VisAttributes(G4Colour::Green());
797  simpleAlSVisAtt->SetVisibility(true);
798 // simpleAlSVisAtt->SetForceSolid(true);
799  leafLVB->SetVisAttributes(simpleAlSVisAtt);
800  leafLVB->SetRegion(regVol);
801  regVol->AddRootLogicalVolume(leafLVB);
802 
803  int i;
804  G4String PVname;
805  int j=0;
806 
807  G4ThreeVector centre;
808  int nhalfLeaves=(int)(leavesA.size()/2.);
809  centre= centreStart + G4ThreeVector(-nhalfLeaves*boxSize.getX(), 0.,0.);
810  for (i=1;i<(int)leavesA.size(); i++)
811  {
812  G4String str;
813  char appo[10];
814  sprintf(appo,"%d",i);
815  str=appo;
816  PVname="leafA"+str;
817  centre.setX(centre.getX()+boxSize.getX()*2.);
818  centre.setY(-boxSize.getY()-leavesA[i]);
819  leafPhys=new G4PVPlacement(0, centre, PVname, leafLVA, PVWorld, false, i);
820  j++;
821  }
822  nhalfLeaves=(int)(leavesB.size()/2.);
823  centre=centreStart+G4ThreeVector(-nhalfLeaves*boxSize.getX(), 0.,0.);
824  for (i=1;i<(int)leavesB.size(); i++)
825  {
826  G4String str;
827  char appo[10];
828  sprintf(appo,"%d",i);
829  str=appo;
830  PVname="leafB"+str;
831  centre.setX(centre.getX()+boxSize.getX()*2.);
832  centre.setY(+boxSize.getY()+leavesB[i]);
833  leafPhys=new G4PVPlacement(0, centre, PVname, leafLVB, PVWorld, false, i);
834  j++;
835  }
836  bCreated=true;
837  return bCreated;
838 }
839 
static const double cm
Definition: G4SIunits.hh:106
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4double isoCentre
Definition: ML2Acc1.hh:84
CML2Acc1Messenger * acc1Messenger
Definition: ML2Acc1.hh:87
G4VPhysicalVolume * targetB_phys
Definition: ML2Acc1.hh:106
G4VPhysicalVolume * BeWTubePV
Definition: ML2Acc1.hh:109
G4VPhysicalVolume * targetA_phys
Definition: ML2Acc1.hh:105
CLHEP::Hep3Vector G4ThreeVector
void AddRootLogicalVolume(G4LogicalVolume *lv)
Definition: G4Region.cc:254
CLHEP::HepRotation G4RotationMatrix
G4double jaw1XAperture
Definition: ML2Acc1.hh:84
static G4Colour Green()
Definition: G4Colour.hh:149
G4double z
Definition: TRTMaterials.hh:39
Definition: G4Box.hh:63
G4VPhysicalVolume * phVol1X
Definition: ML2Acc1.hh:119
G4String name
Definition: TRTMaterials.hh:40
G4VPhysicalVolume * PCUtubeP2PV
Definition: ML2Acc1.hh:115
void SetVisibility(G4bool)
Definition: G4Tubs.hh:84
G4Element * elC
Definition: TRTMaterials.hh:48
static G4Colour Magenta()
Definition: G4Colour.hh:152
G4int idEnergy
Definition: ML2Acc1.hh:86
bool Jaw1Y()
Definition: ML2Acc1.cc:690
void SetProductionCut(G4double cut, G4int index=-1)
G4VPhysicalVolume * PCUtubeP3PV
Definition: ML2Acc1.hh:117
static CML2Acc1 * instance
Definition: ML2Acc1.hh:88
G4VPhysicalVolume * MirrorTubePV
Definition: ML2Acc1.hh:118
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
G4VPhysicalVolume * UpperCollimator_phys
Definition: ML2Acc1.hh:107
G4double jaw1YAperture
Definition: ML2Acc1.hh:84
bool flatteningFilter()
Definition: ML2Acc1.cc:384
bool MLC()
Definition: ML2Acc1.cc:763
std::vector< G4double > leavesA
Definition: ML2Acc1.hh:85
void Construct(G4VPhysicalVolume *PVWorld, G4double isoCentre)
Definition: ML2Acc1.cc:156
void SetRegion(G4Region *reg)
void SetJawAperture(G4int idJaw, G4ThreeVector &centre, G4ThreeVector halfSize, G4double aperture, G4RotationMatrix *cRotation)
Definition: ML2Acc1.cc:549
G4double jaw2YAperture
Definition: ML2Acc1.hh:84
static const double deg
Definition: G4SIunits.hh:133
Definition: G4Cons.hh:82
bool BeWindow()
Definition: ML2Acc1.cc:357
G4VPhysicalVolume * phVol2Y
Definition: ML2Acc1.hh:122
static const double cm3
Definition: G4SIunits.hh:108
static G4Colour Blue()
Definition: G4Colour.hh:150
void setIsoCentre(G4double val)
Definition: ML2Acc1.hh:76
G4VPhysicalVolume * phVol2X
Definition: ML2Acc1.hh:120
bool primaryCollimator()
Definition: ML2Acc1.cc:251
static const G4double A[nN]
bool Jaw1X()
Definition: ML2Acc1.cc:618
CML2Acc1(void)
Definition: ML2Acc1.cc:48
bool target()
Definition: ML2Acc1.cc:178
G4VPhysicalVolume * phVol1Y
Definition: ML2Acc1.hh:121
static G4Colour Cyan()
Definition: G4Colour.hh:151
void writeInfo()
Definition: ML2Acc1.cc:66
G4VPhysicalVolume * PCUtubeP1PV
Definition: ML2Acc1.hh:113
G4double jaw2XAperture
Definition: ML2Acc1.hh:84
bool ionizationChamber()
Definition: ML2Acc1.cc:435
G4Material * otherMaterials(const G4String materialName)
Definition: ML2Acc1.cc:72
static const double g
Definition: G4SIunits.hh:162
void reset()
Definition: ML2Acc1.cc:172
std::vector< G4double > leavesB
Definition: ML2Acc1.hh:85
static const double mole
Definition: G4SIunits.hh:265
G4VPhysicalVolume * PCUtubeW2PV
Definition: ML2Acc1.hh:114
#define G4endl
Definition: G4ios.hh:61
void SetProductionCuts(G4ProductionCuts *cut)
static const double m
Definition: G4SIunits.hh:110
static G4Colour Red()
Definition: G4Colour.hh:148
G4VPhysicalVolume * PCUtubeW1PV
Definition: ML2Acc1.hh:112
bool Jaw2Y()
Definition: ML2Acc1.cc:726
G4VPhysicalVolume * leafPhys
Definition: ML2Acc1.hh:123
G4VPhysicalVolume * FFL1A_1PV
Definition: ML2Acc1.hh:110
double G4double
Definition: G4Types.hh:76
static CML2Acc1 * GetInstance(void)
Definition: ML2Acc1.cc:58
Air AddElement(elN,.7)
bool Jaw2X()
Definition: ML2Acc1.cc:654
static G4Colour Yellow()
Definition: G4Colour.hh:153
static const double mm
Definition: G4SIunits.hh:102
void SetVisAttributes(const G4VisAttributes *pVA)
~CML2Acc1(void)
Definition: ML2Acc1.cc:53
G4VPhysicalVolume * PCUtubeW3PV
Definition: ML2Acc1.hh:116
G4VPhysicalVolume * FFL2_1PV
Definition: ML2Acc1.hh:111
G4VPhysicalVolume * CylMinusCone_phys
Definition: ML2Acc1.hh:108
G4VPhysicalVolume * PVWorld
Definition: ML2Acc1.hh:104
bool mirror()
Definition: ML2Acc1.cc:521