Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 // ------------------------------------------- 27 // ------------------------------------------------------------ 28 // GEANT 4 class implementation file 28 // GEANT 4 class implementation file 29 // CERN Geneva Switzerland 29 // CERN Geneva Switzerland 30 // 30 // 31 // 31 // 32 // ------------ GammaRayTelDetectorConstr 32 // ------------ GammaRayTelDetectorConstruction ------ 33 // by F.Longo, R.Giannitrapani & G.S 33 // by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000) 34 // 34 // 35 // ******************************************* 35 // ************************************************************ 36 36 37 #include "GammaRayTelAnticoincidenceSD.hh" 37 #include "GammaRayTelAnticoincidenceSD.hh" 38 #include "GammaRayTelCalorimeterSD.hh" 38 #include "GammaRayTelCalorimeterSD.hh" 39 #include "GammaRayTelDetectorConstruction.hh" 39 #include "GammaRayTelDetectorConstruction.hh" 40 #include "GammaRayTelDetectorMessenger.hh" 40 #include "GammaRayTelDetectorMessenger.hh" 41 #include "GammaRayTelTrackerSD.hh" 41 #include "GammaRayTelTrackerSD.hh" 42 42 43 #include "G4AutoDelete.hh" 43 #include "G4AutoDelete.hh" 44 #include "G4Box.hh" 44 #include "G4Box.hh" 45 #include "G4Colour.hh" 45 #include "G4Colour.hh" 46 #include "G4FieldManager.hh" 46 #include "G4FieldManager.hh" 47 #include "G4GlobalMagFieldMessenger.hh" 47 #include "G4GlobalMagFieldMessenger.hh" 48 #include "G4LogicalVolume.hh" 48 #include "G4LogicalVolume.hh" 49 #include "G4Material.hh" 49 #include "G4Material.hh" 50 #include "G4PhysicalConstants.hh" 50 #include "G4PhysicalConstants.hh" 51 #include "G4PVPlacement.hh" 51 #include "G4PVPlacement.hh" 52 #include "G4PVReplica.hh" 52 #include "G4PVReplica.hh" 53 #include "G4RegionStore.hh" 53 #include "G4RegionStore.hh" 54 #include "G4RunManager.hh" 54 #include "G4RunManager.hh" 55 #include "G4SDManager.hh" 55 #include "G4SDManager.hh" 56 #include "G4SystemOfUnits.hh" 56 #include "G4SystemOfUnits.hh" 57 #include "G4TransportationManager.hh" 57 #include "G4TransportationManager.hh" 58 #include "G4UImanager.hh" 58 #include "G4UImanager.hh" 59 #include "G4UniformMagField.hh" 59 #include "G4UniformMagField.hh" 60 #include "G4VisAttributes.hh" 60 #include "G4VisAttributes.hh" 61 61 62 //....oooOO0OOooo........oooOO0OOooo........oo 62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 63 63 64 G4ThreadLocal G4GlobalMagFieldMessenger *Gamma 64 G4ThreadLocal G4GlobalMagFieldMessenger *GammaRayTelDetectorConstruction::fMagFieldMessenger = nullptr; 65 65 66 GammaRayTelDetectorConstruction::GammaRayTelDe 66 GammaRayTelDetectorConstruction::GammaRayTelDetectorConstruction() 67 { 67 { 68 // Initialize thread-local sensitive detecto 68 // Initialize thread-local sensitive detectors 69 trackerSD.Put(nullptr); 69 trackerSD.Put(nullptr); 70 calorimeterSD.Put(nullptr); 70 calorimeterSD.Put(nullptr); 71 anticoincidenceSD.Put(nullptr); 71 anticoincidenceSD.Put(nullptr); 72 72 73 ComputePayloadParameters(); 73 ComputePayloadParameters(); 74 74 75 // create commands for interactive definitio 75 // create commands for interactive definition of the payload 76 detectorMessenger = new GammaRayTelDetectorM 76 detectorMessenger = new GammaRayTelDetectorMessenger(this); 77 } 77 } 78 78 79 //....oooOO0OOooo........oooOO0OOooo........oo 79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 80 80 81 GammaRayTelDetectorConstruction::~GammaRayTelD 81 GammaRayTelDetectorConstruction::~GammaRayTelDetectorConstruction() { 82 delete detectorMessenger; 82 delete detectorMessenger; 83 } 83 } 84 84 85 //....oooOO0OOooo........oooOO0OOooo........oo 85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 86 86 87 auto GammaRayTelDetectorConstruction::Construc 87 auto GammaRayTelDetectorConstruction::Construct() -> G4VPhysicalVolume* { 88 DefineMaterials(); 88 DefineMaterials(); 89 return ConstructPayload(); 89 return ConstructPayload(); 90 } 90 } 91 91 92 //....oooOO0OOooo........oooOO0OOooo........oo 92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 93 93 94 void GammaRayTelDetectorConstruction::DefineMa 94 void GammaRayTelDetectorConstruction::DefineMaterials() { 95 G4String name; 95 G4String name; 96 G4String symbol; 96 G4String symbol; 97 97 98 G4int numberOfAtoms; 98 G4int numberOfAtoms; 99 G4int numberOfComponents; 99 G4int numberOfComponents; 100 100 101 // 101 // 102 // define Elements 102 // define Elements 103 // 103 // 104 104 105 constexpr auto HYDROGEN_ATOMIC_NUMBER{1.}; 105 constexpr auto HYDROGEN_ATOMIC_NUMBER{1.}; 106 constexpr auto HYDROGEN_MOLAR_MASS{1.01 * g 106 constexpr auto HYDROGEN_MOLAR_MASS{1.01 * g / mole}; 107 auto *hydrogen = new G4Element(name = "Hydro 107 auto *hydrogen = new G4Element(name = "Hydrogen", symbol = "H", HYDROGEN_ATOMIC_NUMBER, HYDROGEN_MOLAR_MASS); 108 108 109 constexpr auto CARBON_ATOMIC_NUMBER{6.}; 109 constexpr auto CARBON_ATOMIC_NUMBER{6.}; 110 constexpr auto CARBON_MOLAR_MASS{12.01 * g 110 constexpr auto CARBON_MOLAR_MASS{12.01 * g / mole}; 111 auto *carbon = new G4Element(name = "Carbon" 111 auto *carbon = new G4Element(name = "Carbon", symbol = "C", CARBON_ATOMIC_NUMBER, CARBON_MOLAR_MASS); 112 112 113 constexpr auto NITROGEN_ATOMIC_NUMBER{7.}; 113 constexpr auto NITROGEN_ATOMIC_NUMBER{7.}; 114 constexpr auto NITROGEN_MOLAR_MASS{14.006 114 constexpr auto NITROGEN_MOLAR_MASS{14.006 * g / mole}; 115 auto *nitrogen = new G4Element(name = "Nitro 115 auto *nitrogen = new G4Element(name = "Nitrogen", symbol = "N", NITROGEN_ATOMIC_NUMBER, NITROGEN_MOLAR_MASS); 116 116 117 constexpr auto OXYGEN_ATOMIC_NUMBER{8.}; 117 constexpr auto OXYGEN_ATOMIC_NUMBER{8.}; 118 constexpr auto OXYGEN_MOLAR_MASS{15.99 * g / 118 constexpr auto OXYGEN_MOLAR_MASS{15.99 * g / mole}; 119 auto *oxygen = new G4Element(name = "Oxygen" 119 auto *oxygen = new G4Element(name = "Oxygen", symbol = "O", OXYGEN_ATOMIC_NUMBER, OXYGEN_MOLAR_MASS); 120 120 121 constexpr auto ALUMINIUM_ATOMIC_NUMBER{13.}; 121 constexpr auto ALUMINIUM_ATOMIC_NUMBER{13.}; 122 constexpr auto ALUMINIUM_MOLAR_MASS{26.98 122 constexpr auto ALUMINIUM_MOLAR_MASS{26.98 * g / mole}; 123 auto *aluminium = new G4Element(name = "Alum 123 auto *aluminium = new G4Element(name = "Aluminum", symbol = "Al", ALUMINIUM_ATOMIC_NUMBER, ALUMINIUM_MOLAR_MASS); 124 124 125 constexpr auto SILICON_ATOMIC_NUMBER{14.}; 125 constexpr auto SILICON_ATOMIC_NUMBER{14.}; 126 constexpr auto SILICON_MOLAR_MASS{28.09 * 126 constexpr auto SILICON_MOLAR_MASS{28.09 * g / mole}; 127 auto *silicon = new G4Element(name = "Silico 127 auto *silicon = new G4Element(name = "Silicon", symbol = "Si", SILICON_ATOMIC_NUMBER, SILICON_MOLAR_MASS); 128 128 129 constexpr auto IRON_ATOMIC_NUMBER{26.}; 129 constexpr auto IRON_ATOMIC_NUMBER{26.}; 130 constexpr auto IRON_MOLAR_MASS{55.845 * g 130 constexpr auto IRON_MOLAR_MASS{55.845 * g / mole}; 131 auto *iron = new G4Element(name = "Iron", sy 131 auto *iron = new G4Element(name = "Iron", symbol = "Fe", IRON_ATOMIC_NUMBER, IRON_MOLAR_MASS); 132 132 133 constexpr auto IODINE_ATOMIC_NUMBER{53.}; 133 constexpr auto IODINE_ATOMIC_NUMBER{53.}; 134 constexpr auto IODINE_MOLAR_MASS{126.904 * 134 constexpr auto IODINE_MOLAR_MASS{126.904 * g / mole}; 135 auto *iodine = new G4Element(name = "Iodine" 135 auto *iodine = new G4Element(name = "Iodine", symbol = "I", IODINE_ATOMIC_NUMBER, IODINE_MOLAR_MASS); 136 136 137 constexpr auto CESIUM_ATOMIC_NUMBER{55}; 137 constexpr auto CESIUM_ATOMIC_NUMBER{55}; 138 constexpr auto CESIUM_MOLAR_MASS{132.905 * 138 constexpr auto CESIUM_MOLAR_MASS{132.905 * g / mole}; 139 auto *cesium = new G4Element(name = "Cesium" 139 auto *cesium = new G4Element(name = "Cesium", symbol = "Cs", CESIUM_ATOMIC_NUMBER, CESIUM_MOLAR_MASS); 140 140 141 constexpr auto LEAD_ATOMIC_NUMBER{82}; 141 constexpr auto LEAD_ATOMIC_NUMBER{82}; 142 constexpr auto LEAD_MOLAR_MASS{207.19 * g 142 constexpr auto LEAD_MOLAR_MASS{207.19 * g / mole}; 143 auto *lead = new G4Element(name = "Lead", sy 143 auto *lead = new G4Element(name = "Lead", symbol = "Pb", LEAD_ATOMIC_NUMBER, LEAD_MOLAR_MASS); 144 144 145 // 145 // 146 // define simple materials 146 // define simple materials 147 // 147 // 148 148 149 constexpr auto TUNGSTEN_ATOMIC_NUMBER{74.} 149 constexpr auto TUNGSTEN_ATOMIC_NUMBER{74.}; 150 constexpr auto TUNGSTEN_DENSITY{19.3 * g / 150 constexpr auto TUNGSTEN_DENSITY{19.3 * g / cm3}; 151 constexpr auto TUNGSTEN_MOLAR_MASS{183.84 151 constexpr auto TUNGSTEN_MOLAR_MASS{183.84 * g / mole}; 152 auto *tungsten = new G4Material(name = "Tung 152 auto *tungsten = new G4Material(name = "Tungsten", TUNGSTEN_ATOMIC_NUMBER, TUNGSTEN_MOLAR_MASS, TUNGSTEN_DENSITY); 153 153 154 // 154 // 155 // Define a material from elements. 155 // Define a material from elements. 156 // Case 1: chemical molecule 156 // Case 1: chemical molecule 157 // 157 // 158 158 159 constexpr auto SCINTILLATOR_MATERIAL_DENSITY 159 constexpr auto SCINTILLATOR_MATERIAL_DENSITY{1.032 * g / cm3}; 160 auto *scintillatorMaterial = new G4Material( 160 auto *scintillatorMaterial = new G4Material(name = "Scintillator", SCINTILLATOR_MATERIAL_DENSITY, numberOfComponents = 2); 161 scintillatorMaterial->AddElement(carbon, num 161 scintillatorMaterial->AddElement(carbon, numberOfAtoms = 9); 162 scintillatorMaterial->AddElement(hydrogen, n 162 scintillatorMaterial->AddElement(hydrogen, numberOfAtoms = 10); 163 163 164 constexpr auto CESIUM_IODIDE_DENSITY{4.53 * 164 constexpr auto CESIUM_IODIDE_DENSITY{4.53 * g / cm3}; 165 auto *cesiumIodide = new G4Material(name = " 165 auto *cesiumIodide = new G4Material(name = "CesiumIodide", CESIUM_IODIDE_DENSITY, numberOfComponents = 2); 166 cesiumIodide->AddElement(cesium, numberOfAto 166 cesiumIodide->AddElement(cesium, numberOfAtoms = 5); 167 cesiumIodide->AddElement(iodine, numberOfAto 167 cesiumIodide->AddElement(iodine, numberOfAtoms = 5); 168 168 169 // 169 // 170 // Define a material from elements. 170 // Define a material from elements. 171 // Case 2: mixture by fractional mass 171 // Case 2: mixture by fractional mass 172 // 172 // 173 173 174 constexpr auto AIR_DENSITY{1.290 * mg / cm3} 174 constexpr auto AIR_DENSITY{1.290 * mg / cm3}; 175 constexpr auto AIR_NITROGEN_MASS_FRACTION{0. 175 constexpr auto AIR_NITROGEN_MASS_FRACTION{0.7}; 176 constexpr auto AIR_OXYGEN_MASS_FRACTION{0.3} 176 constexpr auto AIR_OXYGEN_MASS_FRACTION{0.3}; 177 177 178 auto *air = new G4Material(name = "Air", AIR 178 auto *air = new G4Material(name = "Air", AIR_DENSITY, numberOfComponents = 2); 179 air->AddElement(nitrogen, AIR_NITROGEN_MASS_ 179 air->AddElement(nitrogen, AIR_NITROGEN_MASS_FRACTION); 180 air->AddElement(oxygen, AIR_OXYGEN_MASS_FRAC 180 air->AddElement(oxygen, AIR_OXYGEN_MASS_FRACTION); 181 181 182 constexpr auto ALUMINIUM_DENSITY{2.700 * g / 182 constexpr auto ALUMINIUM_DENSITY{2.700 * g / cm3}; 183 constexpr auto ALUMINIUM_MASS_FRACTION{1.}; 183 constexpr auto ALUMINIUM_MASS_FRACTION{1.}; 184 auto *Al = new G4Material(name = "Aluminum", 184 auto *Al = new G4Material(name = "Aluminum", ALUMINIUM_DENSITY, numberOfComponents = 1); 185 Al->AddElement(aluminium, ALUMINIUM_MASS_FRA 185 Al->AddElement(aluminium, ALUMINIUM_MASS_FRACTION); 186 186 187 constexpr auto SILICON_DENSITY{2.333 * g / c 187 constexpr auto SILICON_DENSITY{2.333 * g / cm3}; 188 constexpr auto SILICON_MASS_FRACTION{1.}; 188 constexpr auto SILICON_MASS_FRACTION{1.}; 189 auto *Si = new G4Material(name = "Silicon", 189 auto *Si = new G4Material(name = "Silicon", SILICON_DENSITY, numberOfComponents = 1); 190 Si->AddElement(silicon, SILICON_MASS_FRACTIO 190 Si->AddElement(silicon, SILICON_MASS_FRACTION); 191 191 192 constexpr auto IRON_DENSITY{7.87 * g / cm3}; 192 constexpr auto IRON_DENSITY{7.87 * g / cm3}; 193 constexpr auto IRON_MASS_FRACTION{1.}; 193 constexpr auto IRON_MASS_FRACTION{1.}; 194 auto *Fe = new G4Material(name = "Iron", IRO 194 auto *Fe = new G4Material(name = "Iron", IRON_DENSITY, numberOfComponents = 1); 195 Fe->AddElement(iron, IRON_MASS_FRACTION); 195 Fe->AddElement(iron, IRON_MASS_FRACTION); 196 196 197 constexpr auto LEAD_DENSITY{11.35 * g / cm3} 197 constexpr auto LEAD_DENSITY{11.35 * g / cm3}; 198 constexpr auto LEAD_MASS_FRACTION{1.}; 198 constexpr auto LEAD_MASS_FRACTION{1.}; 199 auto *Pb = new G4Material(name = "Lead", LEA 199 auto *Pb = new G4Material(name = "Lead", LEAD_DENSITY, numberOfComponents = 1); 200 Pb->AddElement(lead, LEAD_MASS_FRACTION); 200 Pb->AddElement(lead, LEAD_MASS_FRACTION); 201 201 202 // 202 // 203 // examples of vacuum 203 // examples of vacuum 204 // 204 // 205 constexpr auto VACUUM_ATOMIC_NUMBER{1.}; 205 constexpr auto VACUUM_ATOMIC_NUMBER{1.}; 206 constexpr auto VACUUM_DENSITY{universe_mean_ 206 constexpr auto VACUUM_DENSITY{universe_mean_density}; // from PhysicalConstants.h 207 constexpr auto VACUUM_MOLAR_MASS{1.01 * g / 207 constexpr auto VACUUM_MOLAR_MASS{1.01 * g / mole}; 208 constexpr auto VACUUM_PRESSURE{3.e-18 * pa 208 constexpr auto VACUUM_PRESSURE{3.e-18 * pascal}; 209 constexpr auto VACUUM_TEMPERATURE{2.73 * k 209 constexpr auto VACUUM_TEMPERATURE{2.73 * kelvin}; 210 auto *vacuum = new G4Material(name = "Galact 210 auto *vacuum = new G4Material(name = "Galactic", VACUUM_ATOMIC_NUMBER, VACUUM_MOLAR_MASS, VACUUM_DENSITY, kStateGas, VACUUM_TEMPERATURE, VACUUM_PRESSURE); 211 211 212 constexpr auto BEAM_DENSITY{1.e-5 * g / cm3} 212 constexpr auto BEAM_DENSITY{1.e-5 * g / cm3}; 213 constexpr auto BEAM_MASS_FRACTION{1.}; 213 constexpr auto BEAM_MASS_FRACTION{1.}; 214 constexpr auto BEAM_PRESSURE{2.e-2 * bar}; 214 constexpr auto BEAM_PRESSURE{2.e-2 * bar}; 215 constexpr auto BEAM_TEMPERATURE{STP_Temperat 215 constexpr auto BEAM_TEMPERATURE{STP_Temperature}; // from PhysicalConstants.h 216 auto *beam = new G4Material(name = "Beam", B 216 auto *beam = new G4Material(name = "Beam", BEAM_DENSITY, numberOfComponents = 1, kStateGas, BEAM_TEMPERATURE, BEAM_PRESSURE); 217 beam->AddMaterial(air, BEAM_MASS_FRACTION); 217 beam->AddMaterial(air, BEAM_MASS_FRACTION); 218 218 219 G4cout << *(G4Material::GetMaterialTable()) 219 G4cout << *(G4Material::GetMaterialTable()) << G4endl; 220 220 221 // default materials of the payload 221 // default materials of the payload 222 222 223 defaultMaterial = vacuum; 223 defaultMaterial = vacuum; 224 224 225 converterMaterial = tungsten; 225 converterMaterial = tungsten; 226 acdMaterial = scintillatorMaterial; // antic 226 acdMaterial = scintillatorMaterial; // anticoincidence (ACD) 227 calMaterial = cesiumIodide; // calorimeter ( 227 calMaterial = cesiumIodide; // calorimeter (CAL) 228 tkrMaterial = Si; // tracker (TKR) 228 tkrMaterial = Si; // tracker (TKR) 229 } 229 } 230 230 231 //....oooOO0OOooo........oooOO0OOooo........oo 231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 232 232 233 auto GammaRayTelDetectorConstruction::Construc 233 auto GammaRayTelDetectorConstruction::ConstructPayload() -> G4VPhysicalVolume* { 234 // complete the payload parameters definitio 234 // complete the payload parameters definition 235 ComputePayloadParameters(); 235 ComputePayloadParameters(); 236 236 237 // 237 // 238 // World 238 // World 239 // 239 // 240 240 241 solidWorld = new G4Box("World", worldSizeXY 241 solidWorld = new G4Box("World", worldSizeXY / 2, worldSizeXY / 2, worldSizeZ / 2); 242 logicWorld = new G4LogicalVolume(solidWorld, 242 logicWorld = new G4LogicalVolume(solidWorld, defaultMaterial, "World"); 243 physiWorld = new G4PVPlacement(nullptr, G4Th 243 physiWorld = new G4PVPlacement(nullptr, G4ThreeVector(), "World", logicWorld, nullptr, false, 0); 244 244 245 // 245 // 246 // Payload 246 // Payload 247 // 247 // 248 248 249 solidPayload = new G4Box("Payload", payloadS 249 solidPayload = new G4Box("Payload", payloadSizeXY / 2, payloadSizeXY / 2, payloadSizeZ / 2); 250 logicPayload = new G4LogicalVolume(solidPayl 250 logicPayload = new G4LogicalVolume(solidPayload, defaultMaterial, "Payload"); 251 physiPayload = new G4PVPlacement(nullptr, G4 251 physiPayload = new G4PVPlacement(nullptr, G4ThreeVector(), "Payload", logicPayload, physiWorld, false, 0); 252 252 253 // 253 // 254 // Calorimeter (CAL) 254 // Calorimeter (CAL) 255 // 255 // 256 256 257 solidCAL = new G4Box("CAL", calSizeXY / 2, c 257 solidCAL = new G4Box("CAL", calSizeXY / 2, calSizeXY / 2, calSizeZ / 2); 258 logicCAL = new G4LogicalVolume(solidCAL, def 258 logicCAL = new G4LogicalVolume(solidCAL, defaultMaterial, "CAL"); 259 physiCAL = new G4PVPlacement(nullptr, 259 physiCAL = new G4PVPlacement(nullptr, 260 G4ThreeVector(0, 0, 260 G4ThreeVector(0, 0, 261 -payloadSizeZ / 2 + calSizeZ 261 -payloadSizeZ / 2 + calSizeZ / 2), 262 "CAL", logicCAL, physiPayload, fal 262 "CAL", logicCAL, physiPayload, false, 0); 263 263 264 // 264 // 265 // Tracker (TKR) 265 // Tracker (TKR) 266 // 266 // 267 267 268 solidTKR = new G4Box("TKR", tkrSizeXY / 2, t 268 solidTKR = new G4Box("TKR", tkrSizeXY / 2, tkrSizeXY / 2, tkrSizeZ / 2); 269 logicTKR = new G4LogicalVolume(solidTKR, def 269 logicTKR = new G4LogicalVolume(solidTKR, defaultMaterial, "TKR"); 270 physiTKR = new G4PVPlacement(nullptr, 270 physiTKR = new G4PVPlacement(nullptr, 271 G4ThreeVector(0, 0, 271 G4ThreeVector(0, 0, 272 -payloadSizeZ / 2 + calSizeZ 272 -payloadSizeZ / 2 + calSizeZ + calTKRDistance 273 + tkrSizeZ / 2), 273 + tkrSizeZ / 2), 274 "TKR", logicTKR, physiPayload, fal 274 "TKR", logicTKR, physiPayload, false, 0); 275 275 276 // 276 // 277 // Anticoincidence, Top Side (ACT) 277 // Anticoincidence, Top Side (ACT) 278 // 278 // 279 279 280 solidACT = new G4Box("ACT", actSizeXY / 2, a 280 solidACT = new G4Box("ACT", actSizeXY / 2, actSizeXY / 2, actSizeZ / 2); 281 logicACT = new G4LogicalVolume(solidACT, acd 281 logicACT = new G4LogicalVolume(solidACT, acdMaterial, "ACT"); 282 physiACT = new G4PVPlacement(nullptr, 282 physiACT = new G4PVPlacement(nullptr, 283 G4ThreeVector(0, 0, 283 G4ThreeVector(0, 0, 284 -payloadSizeZ / 2 + calSizeZ + calTK 284 -payloadSizeZ / 2 + calSizeZ + calTKRDistance + tkrSizeZ 285 + acdTKRDistance + actSizeZ / 2) 285 + acdTKRDistance + actSizeZ / 2), 286 "ACT", logicACT, physiPayload, fal 286 "ACT", logicACT, physiPayload, false, 0); 287 287 288 // 288 // 289 // Anticoincidence, Lateral Side (ACL) 289 // Anticoincidence, Lateral Side (ACL) 290 // 290 // 291 291 292 solidACL1 = new G4Box("ACL1", acl1SizeX / 2, 292 solidACL1 = new G4Box("ACL1", acl1SizeX / 2, acl1SizeY / 2, acl1SizeZ / 2); 293 logicACL1 = new G4LogicalVolume(solidACL1, a 293 logicACL1 = new G4LogicalVolume(solidACL1, acdMaterial, "ACL"); 294 294 295 physiACL1 = new G4PVPlacement(nullptr, 295 physiACL1 = new G4PVPlacement(nullptr, 296 G4ThreeVector(-payloadSizeXY / 2 + acl1S 296 G4ThreeVector(-payloadSizeXY / 2 + acl1SizeX / 2, 297 -payloadSizeXY / 2 + acl1SizeY / 2, 297 -payloadSizeXY / 2 + acl1SizeY / 2, 298 -payloadSizeZ / 2 + acl1SizeZ / 2), 298 -payloadSizeZ / 2 + acl1SizeZ / 2), 299 "ACL1", logicACL1, physiPayload, f 299 "ACL1", logicACL1, physiPayload, false, 0); 300 300 301 physiACL1 = new G4PVPlacement(nullptr, 301 physiACL1 = new G4PVPlacement(nullptr, 302 G4ThreeVector(payloadSizeXY / 2 - acl1Si 302 G4ThreeVector(payloadSizeXY / 2 - acl1SizeX / 2, 303 payloadSizeXY / 2 - acl1SizeY / 2, 303 payloadSizeXY / 2 - acl1SizeY / 2, 304 -payloadSizeZ / 2 + acl1SizeZ / 2), 304 -payloadSizeZ / 2 + acl1SizeZ / 2), 305 "ACL1", logicACL1, physiPayload, f 305 "ACL1", logicACL1, physiPayload, false, 1); 306 306 307 solidACL2 = new G4Box("ACL2", acl2SizeX / 2, 307 solidACL2 = new G4Box("ACL2", acl2SizeX / 2, acl2SizeY / 2, acl2SizeZ / 2); 308 logicACL2 = new G4LogicalVolume(solidACL2, a 308 logicACL2 = new G4LogicalVolume(solidACL2, acdMaterial, "ACL2"); 309 309 310 physiACL2 = new G4PVPlacement(nullptr, 310 physiACL2 = new G4PVPlacement(nullptr, 311 G4ThreeVector(-payloadSizeXY / 2 + acl2S 311 G4ThreeVector(-payloadSizeXY / 2 + acl2SizeX / 2, 312 payloadSizeXY / 2 - acl2SizeY / 2, 312 payloadSizeXY / 2 - acl2SizeY / 2, 313 -payloadSizeZ / 2 + acl2SizeZ / 2), 313 -payloadSizeZ / 2 + acl2SizeZ / 2), 314 "ACL2", logicACL2, physiPayload, f 314 "ACL2", logicACL2, physiPayload, false, 0); 315 315 316 physiACL2 = new G4PVPlacement(nullptr, 316 physiACL2 = new G4PVPlacement(nullptr, 317 G4ThreeVector(payloadSizeXY / 2 - acl2Si 317 G4ThreeVector(payloadSizeXY / 2 - acl2SizeX / 2, 318 -payloadSizeXY / 2 + acl2SizeY / 2, 318 -payloadSizeXY / 2 + acl2SizeY / 2, 319 -payloadSizeZ / 2 + acl2SizeZ / 2), 319 -payloadSizeZ / 2 + acl2SizeZ / 2), 320 "ACL2", logicACL2, physiPayload, f 320 "ACL2", logicACL2, physiPayload, false, 1); 321 321 322 // 322 // 323 // Tracker Structure (Plane + Converter + TK 323 // Tracker Structure (Plane + Converter + TKRDetectorX + TKRDetectorY) 324 // 324 // 325 325 326 solidPlane = new G4Box("Plane", tkrSizeXY / 326 solidPlane = new G4Box("Plane", tkrSizeXY / 2, tkrSizeXY / 2, tkrSupportThickness / 2); 327 logicPlane = new G4LogicalVolume(solidPlane, 327 logicPlane = new G4LogicalVolume(solidPlane, defaultMaterial, "Plane"); 328 328 329 solidTKRDetectorY = new G4Box("TKRDetectorY" 329 solidTKRDetectorY = new G4Box("TKRDetectorY", tkrSizeXY / 2, tkrSizeXY / 2, tkrSiliconThickness / 2); 330 logicTKRDetectorY = new G4LogicalVolume(soli 330 logicTKRDetectorY = new G4LogicalVolume(solidTKRDetectorY, tkrMaterial, "TKRDetector Y"); 331 331 332 solidTKRDetectorX = new G4Box("TKRDetectorX" 332 solidTKRDetectorX = new G4Box("TKRDetectorX", tkrSizeXY / 2, tkrSizeXY / 2, tkrSiliconThickness / 2); 333 logicTKRDetectorX = new G4LogicalVolume(soli 333 logicTKRDetectorX = new G4LogicalVolume(solidTKRDetectorX, tkrMaterial, "TKRDetector X"); 334 334 335 solidConverter = new G4Box("Converter", tkrS 335 solidConverter = new G4Box("Converter", tkrSizeXY / 2, tkrSizeXY / 2, converterThickness / 2); 336 logicConverter = new G4LogicalVolume(solidCo 336 logicConverter = new G4LogicalVolume(solidConverter, converterMaterial, "Converter"); 337 337 338 G4int i = 0; 338 G4int i = 0; 339 339 340 for (i = 0; i < numberOfTKRLayers; i++) { 340 for (i = 0; i < numberOfTKRLayers; i++) { 341 physiTKRDetectorY = new G4PVPlacement(null 341 physiTKRDetectorY = new G4PVPlacement(nullptr, 342 G4ThreeVector(0., 0., 342 G4ThreeVector(0., 0., 343 -tkrSizeZ / 2 + tkrSiliconThic 343 -tkrSizeZ / 2 + tkrSiliconThickness / 2 344 + (i) * tkrLayerDistance), 344 + (i) * tkrLayerDistance), 345 "TKRDetectorY", logicTKRDetectorY, 345 "TKRDetectorY", logicTKRDetectorY, physiTKR, false, i); 346 346 347 physiTKRDetectorX = new G4PVPlacement(null 347 physiTKRDetectorX = new G4PVPlacement(nullptr, 348 G4ThreeVector(0., 0., 348 G4ThreeVector(0., 0., 349 -tkrSizeZ / 2 + tkrSiliconThic 349 -tkrSizeZ / 2 + tkrSiliconThickness / 2 350 + tkrViewsDistance + tkrSi 350 + tkrViewsDistance + tkrSiliconThickness 351 + (i) * tkrLayerDistance), 351 + (i) * tkrLayerDistance), 352 "TKRDetectorX", logicTKRDetectorX, 352 "TKRDetectorX", logicTKRDetectorX, physiTKR, false, i); 353 353 354 physiConverter = new G4PVPlacement(nullptr 354 physiConverter = new G4PVPlacement(nullptr, 355 G4ThreeVector(0., 0., 355 G4ThreeVector(0., 0., 356 -tkrSizeZ / 2 + 2 * tkrSilicon 356 -tkrSizeZ / 2 + 2 * tkrSiliconThickness 357 + tkrViewsDistance + conve 357 + tkrViewsDistance + converterThickness / 2 358 + (i) * tkrLayerDistance), 358 + (i) * tkrLayerDistance), 359 "Converter", logicConverter, physi 359 "Converter", logicConverter, physiTKR, false, i); 360 360 361 physiPlane = new G4PVPlacement(nullptr, 361 physiPlane = new G4PVPlacement(nullptr, 362 G4ThreeVector(0., 0., 362 G4ThreeVector(0., 0., 363 -tkrSizeZ / 2 + 2 * tkrSilicon 363 -tkrSizeZ / 2 + 2 * tkrSiliconThickness 364 + tkrViewsDistance + conve 364 + tkrViewsDistance + converterThickness 365 + tkrSupportThickness / 2 365 + tkrSupportThickness / 2 366 + (i) * tkrLayerDistance), 366 + (i) * tkrLayerDistance), 367 "Plane", logicPlane, physiTKR, fal 367 "Plane", logicPlane, physiTKR, false, i); 368 } 368 } 369 369 370 auto *solidTKRActiveTileX = new G4Box("Activ 370 auto *solidTKRActiveTileX = new G4Box("Active Tile X", tkrActiveTileXY / 2, tkrActiveTileXY / 2, tkrActiveTileZ / 2); 371 auto *solidTKRActiveTileY = new G4Box("Activ 371 auto *solidTKRActiveTileY = new G4Box("Active Tile Y", tkrActiveTileXY / 2, tkrActiveTileXY / 2, tkrActiveTileZ / 2); 372 372 373 auto *logicTKRActiveTileX = new G4LogicalVol 373 auto *logicTKRActiveTileX = new G4LogicalVolume(solidTKRActiveTileX, tkrMaterial, "Active Tile X", nullptr, nullptr, nullptr); 374 auto *logicTKRActiveTileY = new G4LogicalVol 374 auto *logicTKRActiveTileY = new G4LogicalVolume(solidTKRActiveTileY, tkrMaterial, "Active Tile Y", nullptr, nullptr, nullptr); 375 375 376 G4int j = 0; 376 G4int j = 0; 377 G4int k = 0; 377 G4int k = 0; 378 378 379 G4double x = 0.; 379 G4double x = 0.; 380 G4double y = 0.; 380 G4double y = 0.; 381 G4double z = 0.; 381 G4double z = 0.; 382 382 383 for (i = 0; i < numberOfTKRTiles; i++) { 383 for (i = 0; i < numberOfTKRTiles; i++) { 384 for (j = 0; j < numberOfTKRTiles; j++) { 384 for (j = 0; j < numberOfTKRTiles; j++) { 385 k = i * numberOfTKRTiles + j; 385 k = i * numberOfTKRTiles + j; 386 386 387 x = -tkrSizeXY / 2 + tilesSeparation + s 387 x = -tkrSizeXY / 2 + tilesSeparation + siliconGuardRing 388 + tkrActiveTileXY / 2 388 + tkrActiveTileXY / 2 389 + (i) 389 + (i) 390 * ((2 * siliconGuardRi 390 * ((2 * siliconGuardRing) + tilesSeparation 391 + tkrActiveTileXY) 391 + tkrActiveTileXY); 392 392 393 y = -tkrSizeXY / 2 + tilesSeparation + s 393 y = -tkrSizeXY / 2 + tilesSeparation + siliconGuardRing 394 + tkrActiveTileXY / 2 394 + tkrActiveTileXY / 2 395 + (j) 395 + (j) 396 * ((2 * siliconGuardRi 396 * ((2 * siliconGuardRing) + tilesSeparation 397 + tkrActiveTileXY) 397 + tkrActiveTileXY); 398 z = 0.; 398 z = 0.; 399 399 400 new G4PVPlacement(nullptr, G4ThreeVector 400 new G4PVPlacement(nullptr, G4ThreeVector(x, y, z), logicTKRActiveTileY, "Active Tile Y", logicTKRDetectorY, false, k); 401 401 402 x = -tkrSizeXY / 2 + tilesSeparation + s 402 x = -tkrSizeXY / 2 + tilesSeparation + siliconGuardRing 403 + tkrActiveTileXY / 2 403 + tkrActiveTileXY / 2 404 + (j) 404 + (j) 405 * ((2 * siliconGuardRi 405 * ((2 * siliconGuardRing) + tilesSeparation 406 + tkrActiveTileXY) 406 + tkrActiveTileXY); 407 407 408 y = -tkrSizeXY / 2 + tilesSeparation + s 408 y = -tkrSizeXY / 2 + tilesSeparation + siliconGuardRing 409 + tkrActiveTileXY / 2 409 + tkrActiveTileXY / 2 410 + (i) 410 + (i) 411 * ((2 * siliconGuardRi 411 * ((2 * siliconGuardRing) + tilesSeparation 412 + tkrActiveTileXY) 412 + tkrActiveTileXY); 413 z = 0.; 413 z = 0.; 414 414 415 new G4PVPlacement(nullptr, G4ThreeVector 415 new G4PVPlacement(nullptr, G4ThreeVector(x, y, z), logicTKRActiveTileX, "Active Tile X", logicTKRDetectorX, false, k); 416 } 416 } 417 } 417 } 418 418 419 // Strips 419 // Strips 420 420 421 // Silicon Strips 421 // Silicon Strips 422 422 423 /* 423 /* 424 G4double tkrXStripX{0.}; 424 G4double tkrXStripX{0.}; 425 G4double tkrYStripY{0.}; 425 G4double tkrYStripY{0.}; 426 G4double tkrYStripX{0.}; 426 G4double tkrYStripX{0.}; 427 G4double tkrXStripY{0.}; 427 G4double tkrXStripY{0.}; 428 */ 428 */ 429 429 430 tkrXStripX = tkrYStripY = tkrSiliconPitch; 430 tkrXStripX = tkrYStripY = tkrSiliconPitch; 431 tkrYStripX = tkrXStripY = tkrActiveTileXY; 431 tkrYStripX = tkrXStripY = tkrActiveTileXY; 432 tkrZStrip = tkrSiliconThickness; 432 tkrZStrip = tkrSiliconThickness; 433 433 434 auto *solidTKRStripX = new G4Box("Strip X", 434 auto *solidTKRStripX = new G4Box("Strip X", tkrXStripX / 2, tkrYStripX / 2, tkrZStrip / 2); 435 logicTKRStripX = new G4LogicalVolume(solidTK 435 logicTKRStripX = new G4LogicalVolume(solidTKRStripX, tkrMaterial, "Strip X", nullptr, nullptr, nullptr); 436 436 437 auto *solidTKRStripY = new G4Box("Strip Y", 437 auto *solidTKRStripY = new G4Box("Strip Y", tkrXStripY / 2, tkrYStripY / 2, tkrZStrip / 2); 438 logicTKRStripY = new G4LogicalVolume(solidTK 438 logicTKRStripY = new G4LogicalVolume(solidTKRStripY, tkrMaterial, "Strip Y", nullptr, nullptr, nullptr); 439 439 440 for (i = 0; i < numberOfTKRStrips; i++) { 440 for (i = 0; i < numberOfTKRStrips; i++) { 441 new G4PVPlacement(nullptr, 441 new G4PVPlacement(nullptr, 442 G4ThreeVector( 442 G4ThreeVector( 443 -tkrActiveTileXY / 2 + tkrSili 443 -tkrActiveTileXY / 2 + tkrSiliconPitch / 2 444 + (i) * tkrSiliconPitch, 0 444 + (i) * tkrSiliconPitch, 0., 0.), 445 logicTKRStripX, "Strip X", logicTK 445 logicTKRStripX, "Strip X", logicTKRActiveTileX, false, i); 446 446 447 new G4PVPlacement(nullptr, 447 new G4PVPlacement(nullptr, 448 G4ThreeVector(0., 448 G4ThreeVector(0., 449 -tkrActiveTileXY / 2 + tkrSili 449 -tkrActiveTileXY / 2 + tkrSiliconPitch / 2 450 + (i) * tkrSiliconPitch, 0 450 + (i) * tkrSiliconPitch, 0.), 451 logicTKRStripY, "Strip Y", logicTK 451 logicTKRStripY, "Strip Y", logicTKRActiveTileY, false, i); 452 } 452 } 453 453 454 // 454 // 455 // Calorimeter Structure (CALLayerX + CALLay 455 // Calorimeter Structure (CALLayerX + CALLayerY) 456 // 456 // 457 457 458 solidCALLayerX = new G4Box("CALLayerX", calS 458 solidCALLayerX = new G4Box("CALLayerX", calSizeXY / 2, calSizeXY / 2, calBarThickness / 2); 459 logicCALLayerX = new G4LogicalVolume(solidCA 459 logicCALLayerX = new G4LogicalVolume(solidCALLayerX, calMaterial, "CALLayerX"); 460 460 461 solidCALLayerY = new G4Box("CALLayerY", calS 461 solidCALLayerY = new G4Box("CALLayerY", calSizeXY / 2, calSizeXY / 2, calBarThickness / 2); 462 logicCALLayerY = new G4LogicalVolume(solidCA 462 logicCALLayerY = new G4LogicalVolume(solidCALLayerY, calMaterial, "CALLayerY"); 463 463 464 for (i = 0; i < numberOfCALLayers; i++) { 464 for (i = 0; i < numberOfCALLayers; i++) { 465 physiCALLayerY = new G4PVPlacement(nullptr 465 physiCALLayerY = new G4PVPlacement(nullptr, 466 G4ThreeVector(0, 0, 466 G4ThreeVector(0, 0, 467 -calSizeZ / 2 + calBarThicknes 467 -calSizeZ / 2 + calBarThickness / 2 468 + (i) * 2 * calBarThicknes 468 + (i) * 2 * calBarThickness), 469 "CALLayerY", logicCALLayerY, physi 469 "CALLayerY", logicCALLayerY, physiCAL, false, i); 470 470 471 physiCALLayerX = new G4PVPlacement(nullptr 471 physiCALLayerX = new G4PVPlacement(nullptr, 472 G4ThreeVector(0, 0, 472 G4ThreeVector(0, 0, 473 -calSizeZ / 2 + calBarThicknes 473 -calSizeZ / 2 + calBarThickness / 2 + calBarThickness 474 + (i) * 2 * calBarThicknes 474 + (i) * 2 * calBarThickness), 475 "CALLayerX", logicCALLayerX, physi 475 "CALLayerX", logicCALLayerX, physiCAL, false, i); 476 } 476 } 477 477 478 // 478 // 479 // Calorimeter Structure (CALDetectorX + CAL 479 // Calorimeter Structure (CALDetectorX + CALDetectorY) 480 // 480 // 481 481 482 solidCALDetectorX = new G4Box("CALDetectorX" 482 solidCALDetectorX = new G4Box("CALDetectorX", calBarX / 2, calBarY / 2, calBarThickness / 2); 483 logicCALDetectorX = new G4LogicalVolume(soli 483 logicCALDetectorX = new G4LogicalVolume(solidCALDetectorX, calMaterial, "CALDetectorX"); 484 484 485 solidCALDetectorY = new G4Box("CALDetectorY" 485 solidCALDetectorY = new G4Box("CALDetectorY", calBarY / 2, calBarX / 2, calBarThickness / 2); 486 logicCALDetectorY = new G4LogicalVolume(soli 486 logicCALDetectorY = new G4LogicalVolume(solidCALDetectorY, calMaterial, "CALDetectorY"); 487 487 488 for (i = 0; i < numberOfCALBars; i++) { 488 for (i = 0; i < numberOfCALBars; i++) { 489 physiCALDetectorY = new G4PVPlacement(null 489 physiCALDetectorY = new G4PVPlacement(nullptr, 490 G4ThreeVector(-calSizeXY / 2 + cal 490 G4ThreeVector(-calSizeXY / 2 + calBarY / 2 + (i) * calBarY, 0, 0), 491 logicCALDetectorY, "CALDetectorY", 491 logicCALDetectorY, "CALDetectorY", logicCALLayerY, false, i); 492 492 493 physiCALDetectorX = new G4PVPlacement(null 493 physiCALDetectorX = new G4PVPlacement(nullptr, 494 G4ThreeVector(0, -calSizeXY / 2 + 494 G4ThreeVector(0, -calSizeXY / 2 + calBarY / 2 + (i) * calBarY, 0), 495 logicCALDetectorX, "CALDetectorX", 495 logicCALDetectorX, "CALDetectorX", logicCALLayerX, false, i); 496 } 496 } 497 497 498 /* 498 /* 499 // Cuts by Region 499 // Cuts by Region 500 500 501 G4String regionName[] = {"Calorimeter", "T 501 G4String regionName[] = {"Calorimeter", "Tracker"}; 502 502 503 if (calorimeterCutRegion) { 503 if (calorimeterCutRegion) { 504 delete calorimeterCutRegion; 504 delete calorimeterCutRegion; 505 } 505 } 506 calorimeterCutRegion = new G4Region(region 506 calorimeterCutRegion = new G4Region(regionName[0]); 507 logicCAL->SetRegion(calorimeterCutRegion); 507 logicCAL->SetRegion(calorimeterCutRegion); 508 calorimeterCutRegion->AddRootLogicalVolume 508 calorimeterCutRegion->AddRootLogicalVolume(logicCAL); 509 509 510 if (trackerCutRegion != nullptr) { 510 if (trackerCutRegion != nullptr) { 511 delete trackerCutRegion; 511 delete trackerCutRegion; 512 } 512 } 513 trackerCutRegion = new G4Region(regionName 513 trackerCutRegion = new G4Region(regionName[1]); 514 logicTKR->SetRegion(trackerCutRegion); 514 logicTKR->SetRegion(trackerCutRegion); 515 trackerCutRegion->AddRootLogicalVolume(log 515 trackerCutRegion->AddRootLogicalVolume(logicTKR); 516 */ 516 */ 517 517 518 // 518 // 519 // Visualization attributes 519 // Visualization attributes 520 // 520 // 521 // Invisible Volume 521 // Invisible Volume 522 logicWorld->SetVisAttributes(G4VisAttributes 522 logicWorld->SetVisAttributes(G4VisAttributes::GetInvisible()); 523 logicPayload->SetVisAttributes(G4VisAttribut 523 logicPayload->SetVisAttributes(G4VisAttributes::GetInvisible()); 524 logicTKR->SetVisAttributes(G4VisAttributes:: 524 logicTKR->SetVisAttributes(G4VisAttributes::GetInvisible()); 525 logicTKRActiveTileX->SetVisAttributes(G4VisA 525 logicTKRActiveTileX->SetVisAttributes(G4VisAttributes::GetInvisible()); 526 logicTKRActiveTileY->SetVisAttributes(G4VisA 526 logicTKRActiveTileY->SetVisAttributes(G4VisAttributes::GetInvisible()); 527 logicPlane->SetVisAttributes(G4VisAttributes 527 logicPlane->SetVisAttributes(G4VisAttributes::GetInvisible()); 528 logicConverter->SetVisAttributes(G4VisAttrib 528 logicConverter->SetVisAttributes(G4VisAttributes::GetInvisible()); 529 logicCAL->SetVisAttributes(G4VisAttributes:: 529 logicCAL->SetVisAttributes(G4VisAttributes::GetInvisible()); 530 logicCALLayerX->SetVisAttributes(G4VisAttrib 530 logicCALLayerX->SetVisAttributes(G4VisAttributes::GetInvisible()); 531 logicCALLayerY->SetVisAttributes(G4VisAttrib 531 logicCALLayerY->SetVisAttributes(G4VisAttributes::GetInvisible()); 532 logicTKRStripX->SetVisAttributes(G4VisAttrib 532 logicTKRStripX->SetVisAttributes(G4VisAttributes::GetInvisible()); 533 logicTKRStripY->SetVisAttributes(G4VisAttrib 533 logicTKRStripY->SetVisAttributes(G4VisAttributes::GetInvisible()); 534 534 535 // Some visualization styles 535 // Some visualization styles 536 536 537 auto *visualizationStyle1 = new G4VisAttribu 537 auto *visualizationStyle1 = new G4VisAttributes(G4Colour(0.3, 0.8, 0.1)); 538 visualizationStyle1->SetVisibility(true); 538 visualizationStyle1->SetVisibility(true); 539 visualizationStyle1->SetForceSolid(TRUE); 539 visualizationStyle1->SetForceSolid(TRUE); 540 540 541 auto *visualizationStyle2 = new G4VisAttribu 541 auto *visualizationStyle2 = new G4VisAttributes(G4Colour(0.2, 0.3, 0.8)); 542 visualizationStyle2->SetVisibility(true); 542 visualizationStyle2->SetVisibility(true); 543 visualizationStyle2->SetForceSolid(FALSE); 543 visualizationStyle2->SetForceSolid(FALSE); 544 544 545 auto *visualizationStyle3 = new G4VisAttribu 545 auto *visualizationStyle3 = new G4VisAttributes(G4Colour(0.8, 0.2, 0.3)); 546 visualizationStyle3->SetVisibility(true); 546 visualizationStyle3->SetVisibility(true); 547 visualizationStyle3->SetForceWireframe(TRUE) 547 visualizationStyle3->SetForceWireframe(TRUE); 548 548 549 // Visible Volumes 549 // Visible Volumes 550 550 551 logicCALDetectorX->SetVisAttributes(visualiz 551 logicCALDetectorX->SetVisAttributes(visualizationStyle1); 552 logicCALDetectorY->SetVisAttributes(visualiz 552 logicCALDetectorY->SetVisAttributes(visualizationStyle1); 553 logicTKRDetectorX->SetVisAttributes(visualiz 553 logicTKRDetectorX->SetVisAttributes(visualizationStyle2); 554 logicTKRDetectorY->SetVisAttributes(visualiz 554 logicTKRDetectorY->SetVisAttributes(visualizationStyle2); 555 logicACT->SetVisAttributes(visualizationStyl 555 logicACT->SetVisAttributes(visualizationStyle3); 556 logicACL1->SetVisAttributes(visualizationSty 556 logicACL1->SetVisAttributes(visualizationStyle3); 557 logicACL2->SetVisAttributes(visualizationSty 557 logicACL2->SetVisAttributes(visualizationStyle3); 558 558 559 // 559 // 560 // always return the physical World 560 // always return the physical World 561 // 561 // 562 PrintPayloadParameters(); 562 PrintPayloadParameters(); 563 563 564 return physiWorld; 564 return physiWorld; 565 } 565 } 566 566 567 //....oooOO0OOooo........oooOO0OOooo........oo 567 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 568 568 569 void GammaRayTelDetectorConstruction::Construc 569 void GammaRayTelDetectorConstruction::ConstructSDandField() { 570 // 570 // 571 // Sensitive detector: Tracker 571 // Sensitive detector: Tracker 572 // 572 // 573 if (trackerSD.Get() == nullptr) { 573 if (trackerSD.Get() == nullptr) { 574 constexpr auto TRACKER_SENSITIVE_DETECTO 574 constexpr auto TRACKER_SENSITIVE_DETECTOR_NAME = "TrackerSD"; 575 auto *sensitiveDetector = new GammaRayTelT 575 auto *sensitiveDetector = new GammaRayTelTrackerSD(TRACKER_SENSITIVE_DETECTOR_NAME); 576 trackerSD.Put(sensitiveDetector); 576 trackerSD.Put(sensitiveDetector); 577 } 577 } 578 578 579 G4SDManager::GetSDMpointer()->AddNewDetector 579 G4SDManager::GetSDMpointer()->AddNewDetector(trackerSD.Get()); 580 580 581 // Flags the strips as sensitive . 581 // Flags the strips as sensitive . 582 if (logicTKRStripX != nullptr) { 582 if (logicTKRStripX != nullptr) { 583 SetSensitiveDetector(logicTKRStripX, track 583 SetSensitiveDetector(logicTKRStripX, trackerSD.Get()); // ActiveStripX 584 } 584 } 585 if (logicTKRStripY != nullptr) { 585 if (logicTKRStripY != nullptr) { 586 SetSensitiveDetector(logicTKRStripY, track 586 SetSensitiveDetector(logicTKRStripY, trackerSD.Get()); // ActiveStripY 587 } 587 } 588 588 589 // 589 // 590 // Sensitive detector: Calorimeter 590 // Sensitive detector: Calorimeter 591 // 591 // 592 if (calorimeterSD.Get() == nullptr) { 592 if (calorimeterSD.Get() == nullptr) { 593 constexpr auto CALORIMETER_SENSITIVE_DET 593 constexpr auto CALORIMETER_SENSITIVE_DETECTOR_NAME = "CalorimeterSD"; 594 auto *sensitiveDetector = new GammaRayTelC 594 auto *sensitiveDetector = new GammaRayTelCalorimeterSD(CALORIMETER_SENSITIVE_DETECTOR_NAME); 595 calorimeterSD.Put(sensitiveDetector); 595 calorimeterSD.Put(sensitiveDetector); 596 } 596 } 597 597 598 G4SDManager::GetSDMpointer()->AddNewDetector 598 G4SDManager::GetSDMpointer()->AddNewDetector(calorimeterSD.Get()); 599 if (logicCALDetectorX != nullptr) { 599 if (logicCALDetectorX != nullptr) { 600 SetSensitiveDetector(logicCALDetectorX, ca 600 SetSensitiveDetector(logicCALDetectorX, calorimeterSD.Get()); // CAL BarX 601 } 601 } 602 if (logicCALDetectorY != nullptr) { 602 if (logicCALDetectorY != nullptr) { 603 SetSensitiveDetector(logicCALDetectorY, ca 603 SetSensitiveDetector(logicCALDetectorY, calorimeterSD.Get()); // CAL BarY 604 } 604 } 605 605 606 // 606 // 607 // Sensitive detector: Anticoincidence 607 // Sensitive detector: Anticoincidence 608 // 608 // 609 if (anticoincidenceSD.Get() == nullptr) { 609 if (anticoincidenceSD.Get() == nullptr) { 610 constexpr auto ANTICOINCIDENCE_SENSITIVE 610 constexpr auto ANTICOINCIDENCE_SENSITIVE_DETECTOR_NAME = "AnticoincidenceSD"; 611 auto *sensitiveDetector = new GammaRayTelA 611 auto *sensitiveDetector = new GammaRayTelAnticoincidenceSD(ANTICOINCIDENCE_SENSITIVE_DETECTOR_NAME); 612 anticoincidenceSD.Put(sensitiveDetector); 612 anticoincidenceSD.Put(sensitiveDetector); 613 } 613 } 614 614 615 G4SDManager::GetSDMpointer()->AddNewDetector 615 G4SDManager::GetSDMpointer()->AddNewDetector(anticoincidenceSD.Get()); 616 if (logicACT != nullptr) { 616 if (logicACT != nullptr) { 617 SetSensitiveDetector(logicACT, anticoincid 617 SetSensitiveDetector(logicACT, anticoincidenceSD.Get()); // ACD top 618 } 618 } 619 if (logicACL1 != nullptr) { 619 if (logicACL1 != nullptr) { 620 SetSensitiveDetector(logicACL1, anticoinci 620 SetSensitiveDetector(logicACL1, anticoincidenceSD.Get()); // ACD lateral side 621 } 621 } 622 if (logicACL2 != nullptr) { 622 if (logicACL2 != nullptr) { 623 SetSensitiveDetector(logicACL2, anticoinci 623 SetSensitiveDetector(logicACL2, anticoincidenceSD.Get()); // ACD lateral side 624 } 624 } 625 625 626 // Create global magnetic field messenger. 626 // Create global magnetic field messenger. 627 // Uniform magnetic field is then created au 627 // Uniform magnetic field is then created automatically if the field value is not zero. 628 auto fieldValue = G4ThreeVector(); 628 auto fieldValue = G4ThreeVector(); 629 fMagFieldMessenger = new G4GlobalMagFieldMes 629 fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue); 630 fMagFieldMessenger->SetVerboseLevel(1); 630 fMagFieldMessenger->SetVerboseLevel(1); 631 631 632 // Register the field messenger for deleting 632 // Register the field messenger for deleting 633 G4AutoDelete::Register (fMagFieldMessenger); 633 G4AutoDelete::Register (fMagFieldMessenger); 634 } 634 } 635 635 636 //....oooOO0OOooo........oooOO0OOooo........oo 636 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 637 637 638 void GammaRayTelDetectorConstruction::PrintPay 638 void GammaRayTelDetectorConstruction::PrintPayloadParameters() { 639 G4cout 639 G4cout 640 << "\n---------------------------------- 640 << "\n---------------------------------------------------------------------------------\n" 641 << "---> The tracker is composed by " << n 641 << "---> The tracker is composed by " << numberOfTKRLayers << " layers" 642 << ", each made of " << converterMaterial- 642 << ", each made of " << converterMaterial->GetName() 643 << " and " << converterThickness / mm << " 643 << " and " << converterThickness / mm << " mm long." 644 << "\n------------------------------------ 644 << "\n---------------------------------------------------------------------------------\n"; 645 } 645 } 646 646 647 //....oooOO0OOooo........oooOO0OOooo........oo 647 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 648 648 649 void GammaRayTelDetectorConstruction::SetConve 649 void GammaRayTelDetectorConstruction::SetConverterMaterial(G4String materialChoice) { 650 // search the material by its name 650 // search the material by its name 651 G4Material *material = G4Material::GetMateri 651 G4Material *material = G4Material::GetMaterial(materialChoice); 652 if (material != nullptr) { 652 if (material != nullptr) { 653 converterMaterial = material; 653 converterMaterial = material; 654 logicConverter->SetMaterial(material); 654 logicConverter->SetMaterial(material); 655 PrintPayloadParameters(); 655 PrintPayloadParameters(); 656 } 656 } 657 } 657 } 658 658 659 //....oooOO0OOooo........oooOO0OOooo........oo 659 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 660 660 661 void GammaRayTelDetectorConstruction::SetConve 661 void GammaRayTelDetectorConstruction::SetConverterThickness(G4double value) { 662 converterThickness = value; 662 converterThickness = value; 663 } 663 } 664 664 665 //....oooOO0OOooo........oooOO0OOooo........oo 665 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 666 666 667 void GammaRayTelDetectorConstruction::SetTKRSi 667 void GammaRayTelDetectorConstruction::SetTKRSiliconThickness(G4double value) { 668 tkrSiliconThickness = value; 668 tkrSiliconThickness = value; 669 } 669 } 670 670 671 //....oooOO0OOooo........oooOO0OOooo........oo 671 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 672 672 673 void GammaRayTelDetectorConstruction::SetTKRSi 673 void GammaRayTelDetectorConstruction::SetTKRSiliconPitch(G4double value) { 674 tkrSiliconPitch = value; 674 tkrSiliconPitch = value; 675 } 675 } 676 676 677 //....oooOO0OOooo........oooOO0OOooo........oo 677 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 678 678 679 void GammaRayTelDetectorConstruction::SetTKRTi 679 void GammaRayTelDetectorConstruction::SetTKRTileSizeXY(G4double value) { 680 tkrSiliconTileXY = value; 680 tkrSiliconTileXY = value; 681 } 681 } 682 682 683 //....oooOO0OOooo........oooOO0OOooo........oo 683 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 684 684 685 void GammaRayTelDetectorConstruction::SetNbOfT 685 void GammaRayTelDetectorConstruction::SetNbOfTKRLayers(G4int value) { 686 numberOfTKRLayers = value; 686 numberOfTKRLayers = value; 687 } 687 } 688 688 689 //....oooOO0OOooo........oooOO0OOooo........oo 689 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 690 690 691 void GammaRayTelDetectorConstruction::SetNbOfT 691 void GammaRayTelDetectorConstruction::SetNbOfTKRTiles(G4int value) { 692 numberOfTKRTiles = value; 692 numberOfTKRTiles = value; 693 } 693 } 694 694 695 //....oooOO0OOooo........oooOO0OOooo........oo 695 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 696 696 697 void GammaRayTelDetectorConstruction::SetTKRLa 697 void GammaRayTelDetectorConstruction::SetTKRLayerDistance(G4double value) { 698 tkrLayerDistance = value; 698 tkrLayerDistance = value; 699 } 699 } 700 700 701 //....oooOO0OOooo........oooOO0OOooo........oo 701 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 702 702 703 void GammaRayTelDetectorConstruction::SetTKRVi 703 void GammaRayTelDetectorConstruction::SetTKRViewsDistance(G4double value) { 704 tkrViewsDistance = value; 704 tkrViewsDistance = value; 705 } 705 } 706 706 707 //....oooOO0OOooo........oooOO0OOooo........oo 707 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 708 708 709 void GammaRayTelDetectorConstruction::SetNbOfC 709 void GammaRayTelDetectorConstruction::SetNbOfCALLayers(G4int value) { 710 numberOfCALLayers = value; 710 numberOfCALLayers = value; 711 } 711 } 712 712 713 //....oooOO0OOooo........oooOO0OOooo........oo 713 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 714 714 715 void GammaRayTelDetectorConstruction::SetNbOfC 715 void GammaRayTelDetectorConstruction::SetNbOfCALBars(G4int value) { 716 numberOfCALBars = value; 716 numberOfCALBars = value; 717 } 717 } 718 718 719 //....oooOO0OOooo........oooOO0OOooo........oo 719 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 720 720 721 void GammaRayTelDetectorConstruction::SetCALBa 721 void GammaRayTelDetectorConstruction::SetCALBarThickness(G4double value) { 722 calBarThickness = value; 722 calBarThickness = value; 723 } 723 } 724 724 725 //....oooOO0OOooo........oooOO0OOooo........oo 725 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 726 726 727 void GammaRayTelDetectorConstruction::SetACDTh 727 void GammaRayTelDetectorConstruction::SetACDThickness(G4double value) { 728 acdThickness = value; 728 acdThickness = value; 729 } 729 } 730 730 731 //....oooOO0OOooo........oooOO0OOooo........oo 731 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 732 732 733 void GammaRayTelDetectorConstruction::SetMagFi 733 void GammaRayTelDetectorConstruction::SetMagField(G4double fieldValue) { 734 // Just invoke manually the MT-safe comman 734 // Just invoke manually the MT-safe command /globalField/setValue instantiated by the GlobalFieldMessenger 735 std::stringstream stream; 735 std::stringstream stream; 736 stream << "/globalField/setValue 0 0 " << 736 stream << "/globalField/setValue 0 0 " << fieldValue / tesla << " tesla"; 737 737 738 G4String command = stream.str(); 738 G4String command = stream.str(); 739 G4cout << "Going to execute: " << command 739 G4cout << "Going to execute: " << command << G4endl; 740 740 741 auto *uiManager = G4UImanager::GetUIpointe 741 auto *uiManager = G4UImanager::GetUIpointer(); 742 uiManager->ApplyCommand(command); 742 uiManager->ApplyCommand(command); 743 } 743 } 744 744 745 //....oooOO0OOooo........oooOO0OOooo........oo 745 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 746 746 747 void GammaRayTelDetectorConstruction::UpdateGe 747 void GammaRayTelDetectorConstruction::UpdateGeometry() { 748 // delete payloadSD; 748 // delete payloadSD; 749 G4RunManager::GetRunManager()->DefineWorld 749 G4RunManager::GetRunManager()->DefineWorldVolume(ConstructPayload()); 750 G4RunManager::GetRunManager()->PhysicsHasB 750 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 751 G4RegionStore::GetInstance()->UpdateMateri 751 G4RegionStore::GetInstance()->UpdateMaterialList(physiWorld); 752 G4RunManager::GetRunManager()->Reinitializ 752 G4RunManager::GetRunManager()->ReinitializeGeometry(); 753 } 753 } 754 754