19 fIsCosmicRaysDetectors =
true;
28 G4NistManager *nist = G4NistManager::Instance();
31 fLYSO =
new G4Material(
"LYSO", 7.25*g/cm3, 5, kStateSolid);
32 fLYSO->AddElement(nist->FindOrBuildElement(
"Lu"), 73.8579*perCent);
33 fLYSO->AddElement(nist->FindOrBuildElement(
"Y"), 1.9747*perCent);
34 fLYSO->AddElement(nist->FindOrBuildElement(
"Si"), 6.2418*perCent);
35 fLYSO->AddElement(nist->FindOrBuildElement(
"O"), 17.77*perCent);
36 fLYSO->AddElement(nist->FindOrBuildElement(
"Ce"), 0.1556*perCent);
38 G4MaterialPropertiesTable *mptLYSO =
new G4MaterialPropertiesTable();
40 std::vector<G4double> Energies = {2.14*eV, 2.95*eV, 3.69*eV};
41 const G4int nEntries = Energies.size();
42 std::vector<G4double> emissionEnergies =
44 2.14*eV, 2.16*eV, 2.19*eV, 2.22*eV, 2.26*eV,
45 2.29*eV, 2.33*eV, 2.37*eV, 2.41*eV, 2.45*eV,
46 2.49*eV, 2.53*eV, 2.57*eV, 2.6*eV, 2.64*eV,
47 2.67*eV, 2.7*eV, 2.72*eV, 2.74*eV, 2.76*eV,
48 2.78*eV, 2.81*eV, 2.84*eV, 2.86*eV, 2.9*eV,
49 2.95*eV, 3.0*eV, 3.05*eV, 3.07*eV, 3.09*eV,
50 3.12*eV, 3.14*eV, 3.15*eV, 3.18*eV, 3.2*eV,
51 3.21*eV, 3.22*eV, 3.24*eV, 3.25*eV, 3.28*eV,
52 3.3*eV, 3.32*eV, 3.37*eV, 3.43*eV, 3.52*eV,
56 std::vector<G4double> LYSO_RINDEX(nEntries, 1.82);
57 std::vector<G4double> LYSO_ABSLENGTH(nEntries, 50.*cm);
58 std::vector<G4double> LYSO_SCINTILLATIONCOMPONENT1 =
60 0.0, 0.0231, 0.153, 0.867,
61 1.44, 2.13, 2.99, 4.07,
62 5.17, 7.27, 10.3, 14.3,
63 19.0, 23.2, 28.0, 32.6,
64 36.9, 41.6, 46.4, 51.0,
65 55.5, 60.1, 65.0, 69.5,
66 73.8, 77.7, 78.1, 73.2,
67 68.1, 63.4, 58.9, 54.3,
68 49.6, 45.2, 40.5, 35.8,
69 31.3, 26.5, 21.5, 17.0,
70 12.2, 7.48, 3.39, 0.726,
74 mptLYSO->AddProperty(
"SCINTILLATIONCOMPONENT1", emissionEnergies, LYSO_SCINTILLATIONCOMPONENT1);
75 mptLYSO->AddProperty(
"RINDEX", Energies, LYSO_RINDEX);
76 mptLYSO->AddProperty(
"ABSLENGTH", Energies, LYSO_ABSLENGTH);
77 mptLYSO->AddConstProperty(
"SCINTILLATIONYIELD", 29000./MeV);
78 mptLYSO->AddConstProperty(
"RESOLUTIONSCALE", 1.0);
79 mptLYSO->AddConstProperty(
"SCINTILLATIONTIMECONSTANT1", 42.*ns);
80 mptLYSO->AddConstProperty(
"SCINTILLATIONYIELD1", 1.);
82 fLYSO->SetMaterialPropertiesTable(mptLYSO);
85 fAir = nist->FindOrBuildMaterial(
"G4_AIR");
87 G4MaterialPropertiesTable *mptAir =
new G4MaterialPropertiesTable();
89 std::vector<G4double> AIR_RINDEX(nEntries, 1.000293);
90 mptAir->AddProperty(
"RINDEX", Energies, AIR_RINDEX);
92 fAir->SetMaterialPropertiesTable(mptAir);
95 fVacuum = nist->FindOrBuildMaterial(
"G4_Galactic");
97 G4MaterialPropertiesTable *mptVacuum =
new G4MaterialPropertiesTable();
99 std::vector<G4double> VACUUM_RINDEX(nEntries, 1.);
100 mptVacuum->AddProperty(
"RINDEX", Energies, VACUUM_RINDEX);
102 fVacuum->SetMaterialPropertiesTable(mptVacuum);
105 fSilicon = nist->FindOrBuildMaterial(
"G4_Si");
106 G4MaterialPropertiesTable *mptDetector =
new G4MaterialPropertiesTable();
107 std::vector<G4double> DETECTOR_RINDEX(nEntries, 1.55);
108 mptDetector->AddProperty(
"RINDEX", Energies, DETECTOR_RINDEX);
110 fSilicon->SetMaterialPropertiesTable(mptDetector);
113 fEpoxy =
new G4Material(
"Epoxy", 1.2*g/cm3, 2);
114 fEpoxy->AddElement(nist->FindOrBuildElement(
"C"), 2);
115 fEpoxy->AddElement(nist->FindOrBuildElement(
"H"), 2);
116 G4MaterialPropertiesTable *mptEpoxy =
new G4MaterialPropertiesTable();
117 std::vector<G4double> EPOXY_RINDEX(nEntries, 1.55);
118 mptEpoxy->AddProperty(
"RINDEX", Energies, EPOXY_RINDEX);
120 fEpoxy->SetMaterialPropertiesTable(mptEpoxy);
123 fFR4 =
new G4Material(
"FR4", 1.85*g/cm3, 2);
124 fFR4->AddMaterial(nist->FindOrBuildMaterial(
"G4_SILICON_DIOXIDE"), 52.8*perCent);
128 fCarbonFiber =
new G4Material(
"Carbon Fiber", 1.5*g/cm3, 1);
129 fCarbonFiber->AddElement(nist->FindOrBuildElement(
"C"), 1);
132 fPlexiglass = nist->FindOrBuildMaterial(
"G4_PLEXIGLASS");
134 G4MaterialPropertiesTable *mptPlexiglass =
new G4MaterialPropertiesTable();
136 std::vector<G4double> PLEXIGLASS_RINDEX(nEntries, 1.49);
137 mptPlexiglass->AddProperty(
"RINDEX", Energies, PLEXIGLASS_RINDEX);
139 fPlexiglass->SetMaterialPropertiesTable(mptPlexiglass);
142 fSapphire =
new G4Material(
"Sapphire", 3.98*g/cm3, 2, kStateSolid);
143 fSapphire->AddElement(nist->FindOrBuildElement(
"Al"), 2);
144 fSapphire->AddElement(nist->FindOrBuildElement(
"O"), 3);
146 G4MaterialPropertiesTable *mptSapphire =
new G4MaterialPropertiesTable();
148 std::vector<G4double> SAPPHIRE_RINDEX(nEntries, 1.77);
149 mptSapphire->AddProperty(
"RINDEX", Energies, SAPPHIRE_RINDEX);
151 fSapphire->SetMaterialPropertiesTable(mptSapphire);
154 fGrease =
new G4Material(
"OpticalGrease", 1.06*g/cm3, 2);
155 fGrease->AddElement(nist->FindOrBuildElement(
"C"), 2);
156 fGrease->AddElement(nist->FindOrBuildElement(
"H"), 6);
158 G4MaterialPropertiesTable *mptGrease =
new G4MaterialPropertiesTable();
160 std::vector<G4double> GREASE_RINDEX(nEntries, 1.46);
161 mptGrease->AddProperty(
"RINDEX", Energies, GREASE_RINDEX);
163 fGrease->SetMaterialPropertiesTable(mptGrease);
183 G4VPhysicalVolume *physWorld =
new G4PVPlacement(0, G4ThreeVector(0., 0., 0.),
logicWorld,
"physWorld", 0,
false, 0,
true);
229 G4int indexDetector = 0;
230 for(G4int i = 0; i < GS::nRowsSiPMs; i++)
232 for(G4int j = 0; j < GS::nColsSiPMs; j++)
234 if(GS::panelSiPMs[i][j])
236 PositionSiPMs(physFrontPackageSiPM[indexDetector], physBackPackageSiPM[indexDetector], i, j, indexDetector);
246 if(fIsCosmicRaysDetectors)
247 ConstructCosmicRaysDetectors();
266 G4SDManager::GetSDMpointer()->AddNewDetector(sensDet);
297 G4Material *fLightGuideMaterial = 0;
308 G4Rotate3D rotXholeUP(90*deg, G4ThreeVector(1, 0, 0));
310 G4Transform3D transformHoleUP = (transYholeUP)*(rotXholeUP);
312 G4Rotate3D rotXholeDOWN(90*deg, G4ThreeVector(1, 0, 0));
314 G4Transform3D transformHoleDOWN = (transYholeDOWN)*(rotXholeDOWN);
316 G4Rotate3D rotYholeRIGHT(90*deg, G4ThreeVector(0, 1, 0));
318 G4Transform3D transformHoleRIGHT = (transYholeRIGHT)*(rotYholeRIGHT);
320 G4Rotate3D rotYholeLEFT(90*deg, G4ThreeVector(0, 1, 0));
322 G4Transform3D transformHoleLEFT = (transYholeLEFT)*(rotYholeLEFT);
324 G4MultiUnion *solidHoles =
new G4MultiUnion(
"solidHoles");
325 solidHoles->AddNode(*solidHoleUP, transformHoleUP);
326 solidHoles->AddNode(*solidHoleDOWN, transformHoleDOWN);
327 solidHoles->AddNode(*solidHoleRIGHT, transformHoleRIGHT);
328 solidHoles->AddNode(*solidHoleLEFT, transformHoleLEFT);
329 solidHoles->Voxelize();
331 G4VSolid *solidDrilledLightGuide =
new G4SubtractionSolid(
"solidDrilledLightGuide", solidLightGuide, solidHoles);
343 G4cerr <<
"Option for lightguide's material not valid. \"Plexiglass\" has been setted" << G4endl;
348 logicLightGuide =
new G4LogicalVolume(solidDrilledLightGuide, fLightGuideMaterial,
"logicLightGuide");
359 logicPCB =
new G4LogicalVolume(solidPCB,
fFR4,
"logicPCB");
385 G4Rotate3D rotXBackDet(180*deg, G4ThreeVector(1, 0, 0));
387 G4Transform3D transformBackDet = (transBackDet)*(rotXBackDet);
397 G4VisAttributes *visWorld =
new G4VisAttributes();
398 visWorld->SetVisibility(
false);
404 G4VisAttributes *visEndcap =
new G4VisAttributes();
405 visEndcap->SetColour(0.5, 0.5, 0.5, 0.5);
412 G4VisAttributes *visPCB =
new G4VisAttributes();
413 visPCB->SetColour(0, 1, 0, 0.65);
420 G4VisAttributes *visLightGuide =
new G4VisAttributes();
421 visLightGuide->SetColour(1, 1, 1, 0.5);
427 G4VisAttributes *visGrease =
new G4VisAttributes();
428 visGrease->SetColour(1, 0.5, 0, 0.5);
433 G4VisAttributes *visPackage =
new G4VisAttributes();
434 visPackage->SetColour(1, 1, 0, 0.7);
438 G4VisAttributes *visWindow =
new G4VisAttributes();
439 visWindow->SetColour(1, 1, 1, 0.7);
443 G4VisAttributes *visDetector =
new G4VisAttributes();
444 visDetector->SetColour(0.45, 0.25, 0, 0.7);
448 G4VisAttributes *visScintillator =
new G4VisAttributes();
449 visScintillator->SetColour(0, 0, 1, 0.98);
453 G4VisAttributes *visCoating =
new G4VisAttributes();
454 visCoating->SetVisibility(
false);
458 if(fIsCosmicRaysDetectors)
460 G4VisAttributes *visCosmicDet =
new G4VisAttributes();
461 visCosmicDet->SetColour(0, 0.5, 0.6, 0.7);
462 logicCosmicRaysDetector->SetVisAttributes(visCosmicDet);
471 fMessenger =
new G4GenericMessenger(
this,
"/MC_LYSO/myConstruction/",
"Construction settings");
472 fMessenger->DeclareProperty(
"isOpticalGrease",
fIsGrease,
"Set if optical grease is present");
474 fMessenger->DeclareProperty(
"isPCB",
fIsPCB,
"Set if the two PCBs are present");
476 fMessenger->DeclareProperty(
"MaterialOfLightGuide",
nLightGuideMat,
"Set the material of light guide: 1 = Plexiglass, 2 = Sapphire");
478 fMessenger->DeclareProperty(
"isCosmicRaysDetectors", fIsCosmicRaysDetectors,
"Set if the two cosmic rays detector are present");
504 G4VisAttributes *visWorld =
new G4VisAttributes();
505 visWorld->SetVisibility(
false);
509 G4VisAttributes *visPackage =
new G4VisAttributes();
510 visPackage->SetColour(1, 1, 0, 0.7);
514 G4VisAttributes *visWindow =
new G4VisAttributes();
515 visWindow->SetColour(1, 1, 1, 0.7);
519 G4VisAttributes *visDetector =
new G4VisAttributes();
520 visDetector->SetColour(0.45, 0.25, 0, 0.7);
526 void MyDetectorConstruction::ConstructCosmicRaysDetectors()
528 G4Box *solidCosmicRaysDetector =
new G4Box(
"solidCosmicRaysDetector", GS::halfZXsideCosmicRayDetector, GS::halfYsideCosmicRayDetector, GS::halfZXsideCosmicRayDetector);
529 logicCosmicRaysDetector =
new G4LogicalVolume(solidCosmicRaysDetector,
fAir,
"logicCosmicRaysDetector");
530 G4VPhysicalVolume *physUpCosmicRaysDetector =
new G4PVPlacement(0, G4ThreeVector(GS::xCosmicRayDetector, GS::yCosmicRayDetector, GS::zCosmicRayDetector), logicCosmicRaysDetector,
"physUpCosmicRaysDetector",
logicWorld,
false, 0,
true);
531 G4VPhysicalVolume *physBottomCosmicRaysDetector =
new G4PVPlacement(0, G4ThreeVector(GS::xCosmicRayDetector, -GS::yCosmicRayDetector, GS::zCosmicRayDetector), logicCosmicRaysDetector,
"physBottomCosmicRaysDetector",
logicWorld,
false, 1,
true);
533 fCosmicTriggerVolume = logicCosmicRaysDetector;
MyDetectorConstruction()
Constructor of the class.
void ConstructASiPM()
Auxiliary function called by Construct() for building only one SiPM.
void DefineVisAttributes()
Defines the visualization attributes for every component of the apparatus.
G4LogicalVolume * fScoringVolume
Pointer used to define the logical volume of the scoring volume. In the application it is assigned to...
void ConstructGrease()
Auxiliary function called by Construct() for building the optical grease.
G4LogicalVolume * logicGrease
Pointer to optical grease logical volume.
G4LogicalVolume * logicPCB
Pointer to PCB logical volume.
G4Material * fLYSO
Pointer to the LYSO material.
G4int nLightGuideMat
Indicates which material has to be used for light guides; 1 for plexiglass, 2 for sapphire.
G4Material * fAir
Pointer to the air material.
G4LogicalVolume * logicWorld
Pointer to world logical volume.
G4LogicalVolume * logicScintillator
Pointer to crystal logical volume.
G4LogicalVolume * logicDetector
Pointer to silicon layer of SiPM logical volume.
G4Material * fEpoxy
Pointer to the epoxy material.
G4LogicalVolume * logicCoating
Pointer to coating logical volume.
G4Material * fSapphire
Pointer to the sapphire material.
G4Material * fPlexiglass
Pointer to the plexiglass material.
G4bool fIsLightGuide
Flag indicating whether the light guides must be constructed.
G4LogicalVolume * logicPackageSiPM
Pointer to SiPM package logical volume.
G4Material * fFR4
Pointer to the FR4 material.
G4bool fIsEndcap
Flag indicating whether the endcaps must be constructed.
G4Material * fVacuum
Pointer to the vacuum material.
G4LogicalVolume * logicWindowSiPM
Pointer to SiPM window logical volume.
G4Material * fGrease
Pointer to the optical grease material.
G4LogicalVolume * logicEndcap
Pointer to endcap logical volume.
G4GenericMessenger * fMessenger
Generic messenger of the class.
void DefineCommands()
Defines new user commands for detector construction.
void ConstructEndcap()
Auxiliary function called by Construct() for building the endcaps.
void ConstructLightGuide()
Auxiliary function called by Construct() for building the lightguides.
void ConstructPCB()
Auxiliary function called by Construct() for building the PCBs.
G4LogicalVolume * logicLightGuide
Pointer to light guide logical volume.
void PositionSiPMs(G4VPhysicalVolume *physFrontSiPM, G4VPhysicalVolume *physBackSiPM, G4int row, G4int col, G4int index)
Auxiliary function called by Construct() for putting in the right position every SiPM.
G4bool fIsOpticalGreaseSurface
Flag indicating whether the optical grease surface must be constructed.
G4Material * fSilicon
Pointer to the silicon material.
G4Material * fCarbonFiber
Pointer to the carbon fiber material.
void ConstructSDandField() override
It sets all the SiPMs' silicon layers as sensitive detectors.
G4VPhysicalVolume * Construct() override
Construct the detector geometry.
G4bool fIsPCB
Flag indicating whether the PCBs must be constructed.
G4OpticalSurface * fOpGreaseSurface
Pointer to the optical grease surface.
G4bool fIsGrease
Flag indicating whether the optical grease must be constructed.
G4bool fIsASiPM
Flag indicating whether only one SiPM must be constructed.
void DefineMaterials()
Defines all materials.
Concrete class of G4VSensitiveDetector, representing the detector (i.e. the SiPM).
Declaration of the class MyDetectorConstruction.
constexpr G4double zScintillator
z-position of the scintillator crystal.
constexpr G4double halfYsideDetector
Half the y-side length of the SiPM silicon layer.
constexpr G4double depthHole
Depth of the holes drilled in the light guide.
constexpr G4double halfXsideWindowSiPM
Half the x-side length of the SiPM window.
constexpr G4double zWindowSiPM
z-position of the SiPM window referring to package center.
constexpr G4double halfXsidePackageSiPM
Half the x-side length of the SiPM package.
constexpr G4double halfheightPCB
Half the height of the PCB.
constexpr G4double halfXsideDetector
Half the x-side length of the SiPM silicon layer.
constexpr G4double halfZsideWindowSiPM
Half the z-side length of the SiPM window.
constexpr G4double zDetector
z-position of the SiPM silicon layer referring to window center.
constexpr G4double radiusScintillator
Radius of the scintillator crystal.
constexpr G4double zBackFaceScintillator
z-position of the back face of the scintillator crystal.
constexpr G4double halfheightGrease
Half the height of the optical grease layer.
constexpr G4double zFrontFaceScintillator
z-position of the front face of the scintillator crystal.
constexpr G4double halfZsidePackageSiPM
Half the z-side length of the SiPM package.
constexpr G4double halfheightLightGuide
Half the height of the light guide.
constexpr G4double xScintillator
x-position of the scintillator crystal.
constexpr G4double yWindowSiPM
y-position of the SiPM window referring to package center.
constexpr G4double radiusLightGuide
Radius of the light guide.
constexpr G4double halfheightScintillator
Half the height of the scintillator crystal.
constexpr G4double halfYsidePackageSiPM
Half the y-side length of the SiPM package.
constexpr G4double halfYsideWorld
Half the y-side length of the world volume.
constexpr G4double halfYsideWindowSiPM
Half the y-side length of the SiPM window.
constexpr G4double coating_space
Space between the crystal and the coating around it.
constexpr G4double halfheightEndcap
Half the height of the endcap.
constexpr G4double xWindowSiPM
x-position of the SiPM window referring to package center.
constexpr G4double xDetector
x-position of the SiPM silicon layer referring to window center.
constexpr G4double coating_thickness
Thickness of the cylindrical coating.
constexpr G4int nOfSiPMs
The number of SiPMs on a detector face.
constexpr G4double halfZsideWorld
Half the z-side length of the world volume.
constexpr G4double yDetector
y-position of the SiPM silicon layer referring to window center.
constexpr G4double halfZsideDetector
Half the z-side length of the SiPM silicon layer.
constexpr G4double radiusPCB
Radius of the Printed Circuit Board (PCB).
constexpr G4double halfXsideWorld
Half the x-side length of the world volume.
constexpr G4double yScintillator
y-position of the scintillator crystal.
constexpr G4double radiusHole
Radius of the holes drilled in the light guide.
constexpr G4double radiusEndcap
Radius of the endcap.