51 logicTreatmentRoom(0), physicalTreatmentRoom(0),hadrontherapyDetectorConstruction(0),
52 physiBeamLineSupport(0), physiBeamLineCover(0), physiBeamLineCover2(0),
53 physiMonitorLayer1(0), physiMonitorLayer2(0),
54 ScatteringFoil(0), logicScatteringFoil(0), physiScatteringFoil(0), ridgeFilterPhys(0), preCollimator(0), physiPreCollimator(0), Collimator(0), physiCollimator(0), solidAirTube(0), solidAirPreTube(0), physiAirTube(0), physiAirPreTube(0)
62 static G4String ROGeometryName =
"DetectorROGeometry";
65 G4cout <<
"Going to register Parallel world...";
84 SetDefaultDimensions();
87 ConstructTrentoPassiveProtonBeamLine();
90 if (!hadrontherapyDetectorConstruction)
98 hadrontherapyDetectorConstruction->InitializeDetectorROGeometry(RO,hadrontherapyDetectorConstruction->GetDetectorToWorldPosition());
100 return physicalTreatmentRoom;
117 white -> SetVisibility(
true);
118 white -> SetForceSolid(
true);
121 blue -> SetVisibility(
true);
122 blue -> SetForceSolid(
true);
125 gray-> SetVisibility(
true);
126 gray-> SetForceSolid(
true);
129 red-> SetVisibility(
true);
130 red-> SetForceSolid(
true);
133 yellow-> SetVisibility(
true);
134 yellow-> SetForceSolid(
true);
137 green -> SetVisibility(
true);
138 green -> SetForceSolid(
true);
141 darkGreen -> SetVisibility(
true);
142 darkGreen -> SetForceSolid(
true);
145 darkOrange3 -> SetVisibility(
true);
146 darkOrange3 -> SetForceSolid(
false);
149 skyBlue -> SetVisibility(
true);
150 skyBlue -> SetForceSolid(
true);
156 G4double defaultScatteringFoilXSize = 0.75*
cm;
157 ScatteringFoilXSize = defaultScatteringFoilXSize;
160 ScatteringFoilYSize = defaultScatteringFoilYSize;
162 G4double defaultScatteringFoilZSize = 100 *
mm;
163 ScatteringFoilZSize = defaultScatteringFoilZSize;
165 G4double defaultScatteringFoilXPosition = -273.*
cm;
166 ScatteringFoilXPosition = defaultScatteringFoilXPosition;
168 G4double defaultScatteringFoilYPosition = 0 *
mm;
169 ScatteringFoilYPosition = defaultScatteringFoilYPosition;
171 G4double defaultScatteringFoilZPosition = 0 *
mm;
172 ScatteringFoilZPosition = defaultScatteringFoilZPosition;
175 G4double defaultPreCollimatorXHalfSide = 12.5 *
cm;
176 preCollimatorXHalfSide = defaultPreCollimatorXHalfSide;
178 G4double defaultPreCollimatorXPosition = -50.*
cm;
179 preCollimatorXPosition = defaultPreCollimatorXPosition;
183 YHalfSideAirTube = defaultYHalfSideAirTube;
186 ZHalfSideAirTube = defaultZHalfSideAirTube;
229 brass -> AddElement(zincNist, fractionmass = 30 *
perCent);
230 brass -> AddElement(copper, fractionmass = 70 *
perCent);
234 plastic -> AddElement(carbonNist, nAtoms = 21);
235 plastic -> AddElement(oxygenNist, nAtoms = 4);
236 plastic -> AddElement(hydrogenNist, nAtoms = 24);
247 beamLineSupportMaterial = aluminumNist;
250 layerMonitorChamberMaterial = MylarNist;
251 layerDefaultMaterial = airNist;
252 internalStructureMaterial = FR4;
253 FoilMaterial = copperNist;
254 airgapMaterial = airNist;
257 ScatteringFoilMaterial = copperNist;
260 singleTrapMaterial = plastic;
263 preCollimatorMaterial = PMMANist;
264 CollimatorMaterial = brass;
267 airTubeMaterial = airTube2Material = airTube3Material = airNist;
285 G4Box* treatmentRoom =
new G4Box(
"TreatmentRoom",
292 "logicTreatmentRoom",
297 "physicalTreatmentRoom",
308 HadrontherapyBeamLineSupport();
309 HadrontherapyBeamMonitoring();
310 HadrontherapyBeamScatteringFoils();
311 HadrontherapyRidgeFilter();
312 HadrontherapyBeamCollimators();
322 const G4double beamLineSupportXSize = 1.2*
m;
324 const G4double beamLineSupportZSize = 600.*
mm;
326 const G4double beamLineSupportXPosition = -1745.09 *
mm;
327 const G4double beamLineSupportYPosition = -230. *
mm;
328 const G4double beamLineSupportZPosition = 0.*
mm;
330 G4Box* beamLineSupport =
new G4Box(
"BeamLineSupport",
331 beamLineSupportXSize,
332 beamLineSupportYSize,
333 beamLineSupportZSize);
336 beamLineSupportMaterial,
340 beamLineSupportYPosition,
341 beamLineSupportZPosition),
343 logicBeamLineSupport,
344 physicalTreatmentRoom,
349 logicBeamLineSupport -> SetVisAttributes(
gray);
354 const G4double beamLineCoverXSize = 1.2*
m;
358 const G4double beamLineCoverXPosition = -1745.09 *
mm;
359 const G4double beamLineCoverYPosition = -1000.*
mm;
360 const G4double beamLineCoverZPosition = 600.*
mm;
362 G4Box* beamLineCover =
new G4Box(
"BeamLineCover",
368 beamLineSupportMaterial,
372 beamLineCoverYPosition,
373 beamLineCoverZPosition),
376 physicalTreatmentRoom,
385 beamLineCoverYPosition,
386 - beamLineCoverZPosition),
389 physicalTreatmentRoom,
393 logicBeamLineCover -> SetVisAttributes(
blue);
418 const G4double monitorlayer1XPosition = -269.*
cm +shift;
419 const G4double monitorlayer2XPosition = -270.4104*
cm +shift;
423 G4Box* solidMonitorLayer1 =
new G4Box(
"MonitorLayer1",
429 layerMonitorChamberMaterial,
436 physicalTreatmentRoom,
441 G4Box* solidMonitorLayer2 =
new G4Box(
"MonitorLayer2",
447 layerMonitorChamberMaterial,
454 physicalTreatmentRoom,
458 logicMonitorLayer1 -> SetVisAttributes(
gray);
459 logicMonitorLayer2 -> SetVisAttributes(
gray);
468 const G4int nofLayers = 5;
469 const G4double internalStructureThickness = 800.*
um;
472 const G4double FirstCoppperLayerXPosition = -404.*
um;
473 const G4double SecondCoppperLayerXPosition = 404.*
um;
474 const G4double InternalStructureXPosition = 0.;
483 layerDefaultMaterial,
489 G4VSolid* SolidFirstCoppperLayer =
new G4Box(
"SolidFirstCoppperLayer",
495 SolidFirstCoppperLayer,
497 "SolidFirstCoppperLayer");
501 G4VSolid* SolidInternalStructure =
new G4Box(
"SolidInternalStructure",
502 internalStructureThickness/2,
507 SolidInternalStructure,
508 internalStructureMaterial,
509 "SolidInternalStructure");
514 G4VSolid* SolidSecondCoppperLayer =
new G4Box(
"SolidSecondCoppperLayer",
520 SolidSecondCoppperLayer,
522 "SolidSecondCoppperLayer");
531 Ta.
setX(FirstCoppperLayerXPosition); Ta.
setY(0.); Ta.
setZ(0.);
535 Ta.
setX(InternalStructureXPosition); Ta.
setY(0.); Ta.
setZ(0.);
539 Ta.
setX(SecondCoppperLayerXPosition); Ta.
setY(0.); Ta.
setZ(0.);
545 for(
unsigned int i = 0; i<nofLayers; i++ )
547 G4ThreeVector Tm(shift+layerXposition + i*(airGapThickness), 0., 0.);
549 assemblyMonitor -> MakeImprint(logicTreatmentRoom, Tr);
566 ScatteringFoil =
new G4Box(
"ScatteringFoil",
569 ScatteringFoilZSize);
573 ScatteringFoilMaterial,
577 ScatteringFoilYPosition,
578 ScatteringFoilZPosition),
579 "SeconScatteringFoil",
581 physicalTreatmentRoom,
585 logicScatteringFoil -> SetVisAttributes(skyBlue);
618 physicalTreatmentRoom,
653 G4VSolid* Trap00 =
new G4Trd(
"singleTrap00", x0, x1, x0, x1, heigth);
654 G4VSolid* Trap0 =
new G4Trd(
"singleTrap0", x1, x2, x1, x2, heigth0);
655 G4VSolid* Trap1 =
new G4Trd(
"singleTrap1", x2, x3, x2, x3, heigth1);
656 G4VSolid* Trap2 =
new G4Trd(
"singleTrap2", x3, x4, x3, x4, heigth2);
657 G4VSolid* Trap3 =
new G4Trd(
"singleTrap3", x4, x5, x4, x5, heigth3);
658 G4VSolid* Trap4 =
new G4Trd(
"singleTrap4", x5, x6, x5, x6, heigth4);
659 G4VSolid* Trap5 =
new G4Trd(
"singleTrap5", x6, x7, x6, x7, heigth5);
660 G4VSolid* Trap6 =
new G4Trd(
"singleTrap6", x7, x8, x7, x8, heigth6);
661 G4VSolid* Trap7 =
new G4Trd(
"singleTrap7", x8, x9, x8, x9, heigth7);
662 G4VSolid* Trap8 =
new G4Trd(
"singleTrap8", x9, x10, x9, x10, heigth8);
663 G4VSolid* Trap9 =
new G4Trd(
"singleTrap9", x10, x11, x10, x11, heigth9);
664 G4VSolid* Trap10 =
new G4Trd(
"singleTrap10", x11, x12, x11, x12, heigth10);
688 G4UnionSolid* unionTrap_blocco1 =
new G4UnionSolid(
"unionTrap_blocco1", unionTrap05, unionTrap67, yRot, tr_blocco1);
691 G4UnionSolid* unionTrap_blocco2 =
new G4UnionSolid(
"unionTrap_blocco2", unionTrap_blocco1, Trap8, yRot, tr_blocco2);
694 G4UnionSolid* unionTrap_blocco3 =
new G4UnionSolid(
"unionTrap_blocco3", unionTrap_blocco2, Trap9, yRot, tr_blocco3);
706 G4int numberOfLayers = 31;
711 vector<G4ThreeVector> singleTrapPositions;
713 for (
int i = 0; i < numberOfLayers; i++)
715 for (
int j = 0; j < numberOfLayers; j++)
717 singleTrapPositions.push_back({-0.01*
cm+ridgeXPosition,
718 minY + 2*i*sum_space,
719 minZ + 2*j*sum_space,});
727 G4int peaks = numberOfLayers*numberOfLayers;
728 for (
int i = 0; i < peaks; i++)
731 ostringstream tName;tName <<
"singleTrap" << i;
733 singleTrapPositions[i]),
753 const G4double preCollimatorYHalfSide = 10.*
cm;
754 const G4double preCollimatorZHalfSide = 10.*
cm;
756 preCollimator =
new G4Box(
"PreCollimator",
757 preCollimatorXHalfSide,
758 preCollimatorYHalfSide,
759 preCollimatorZHalfSide);
763 preCollimatorMaterial,
774 physicalTreatmentRoom,
780 logicPreCollimator -> SetVisAttributes(white);
795 Collimator =
new G4Box(
"Collimator",
798 collimatorZHalfSide);
812 physicalTreatmentRoom,
818 logicCollimator -> SetVisAttributes(darkGreen);
827 solidAirTube =
new G4Box(
"AirTube",
847 logicAirTube -> SetVisAttributes(darkOrange3);
856 solidAirPreTube =
new G4Box(
"AirPreTube",
857 preCollimatorXHalfSide,
877 logicAirPreTube -> SetVisAttributes(darkOrange3);
891 ScatteringFoil -> SetXHalfLength(value);
893 G4cout <<
"The X size of the second scattering foil is (mm):"<<
894 ((ScatteringFoil -> GetXHalfLength())*2.)/
mm
901 preCollimator -> SetXHalfLength(value);
902 G4cout<<
"The size of the pre collimator is (mm)"
903 << ((preCollimator -> GetXHalfLength())*2)/
mm <<
G4endl;
910 physiPreCollimator -> SetTranslation(
G4ThreeVector(value, 0., 0.));
912 G4cout <<
" The pre collimator is translated to" << value/
mm <<
"mm along the X axis" <<
G4endl;
918 solidAirTube -> SetYHalfLength(value);
919 G4cout<<
"The y side of brass tube is (mm)"
920 << ((preCollimator -> GetYHalfLength())*2) <<
G4endl;
927 solidAirTube -> SetZHalfLength(value);
928 G4cout<<
"The z side of the brass tube is (mm)"
929 << ((Collimator -> GetZHalfLength())*2) <<
G4endl;
942 ScatteringFoilMaterial = pttoMaterial;
943 logicScatteringFoil -> SetMaterial(pttoMaterial);
944 G4cout <<
"The material of the Scatterer has been changed to " << materialChoice <<
G4endl;
949 G4cout <<
"WARNING: material \"" << materialChoice <<
"\" doesn't exist in NIST elements/materials"
950 " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" <<
G4endl;
951 G4cout <<
"Use command \"/parameter/nist\" to see full materials list!" <<
G4endl;
static G4RunManager * GetRunManager()
void AddPlacedVolume(G4LogicalVolume *pPlacedVolume, G4ThreeVector &translation, G4RotationMatrix *rotation)
CLHEP::Hep3Vector G4ThreeVector
void SetScatteringFoilXSize(G4double)
void SetAirTubeZSize(G4double)
static constexpr double mm
Float_t x1[n_points_granero]
CLHEP::HepRotation G4RotationMatrix
static constexpr double perCent
~TrentoPassiveProtonBeamLine()
TrentoPassiveProtonBeamLine()
static constexpr double gray
void SetScattererMaterial(G4String)
void SetAirTubeYSize(G4double)
static constexpr double um
static const G4VisAttributes & GetInvisible()
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)
static constexpr double g
static constexpr double m
void SetDefaultDimensions()
const XML_Char int const XML_Char * value
static constexpr double deg
void ConstructTrentoPassiveProtonBeamLine()
TrentoPassiveProtonBeamLineMessenger * TrentoPassiveMessenger
HadrontherapyDetectorROGeometry * RO
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
void HadrontherapyBeamLineSupport()
G4VPhysicalVolume * Construct()
void SetVisAttributes(const G4VisAttributes *pVA)
void SetPreCollimatorXPosition(G4double)
void HadrontherapyBeamMonitoring()
void HadrontherapyBeamCollimators()
HepRotation & rotateY(double delta)
void AddElement(G4Element *element, G4int nAtoms)
static constexpr double cm
G4GLOB_DLL std::ostream G4cout
void RegisterParallelWorld(G4VUserParallelWorld *)
static constexpr double mole
void SetPreCollimatorXSize(G4double)
void HadrontherapyBeamScatteringFoils()
void HadrontherapyRidgeFilter()
Float_t x2[n_points_geant4]
void AddMaterial(G4Material *material, G4double fraction)
static constexpr double cm3
HadrontherapyDetectorConstruction * hadrontherapyDetectorConstruction
static G4NistManager * Instance()