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 // $Id: GammaRayTelDetectorConstruction.cc,v 1.15 2006/06/29 15:56:22 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-09-01-patch-01 $ 27 // ------------------------------------------- 29 // ------------------------------------------------------------ 28 // GEANT 4 class implementation file 30 // GEANT 4 class implementation file 29 // CERN Geneva Switzerland 31 // CERN Geneva Switzerland 30 // 32 // 31 // 33 // 32 // ------------ GammaRayTelDetectorConstr 34 // ------------ GammaRayTelDetectorConstruction ------ 33 // by F.Longo, R.Giannitrapani & G.S 35 // by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000) 34 // 36 // 35 // ******************************************* 37 // ************************************************************ >> 38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 36 40 37 #include "GammaRayTelAnticoincidenceSD.hh" << 38 #include "GammaRayTelCalorimeterSD.hh" << 39 #include "GammaRayTelDetectorConstruction.hh" 41 #include "GammaRayTelDetectorConstruction.hh" 40 #include "GammaRayTelDetectorMessenger.hh" 42 #include "GammaRayTelDetectorMessenger.hh" >> 43 41 #include "GammaRayTelTrackerSD.hh" 44 #include "GammaRayTelTrackerSD.hh" >> 45 #include "GammaRayTelTrackerROGeometry.hh" >> 46 >> 47 #include "GammaRayTelAnticoincidenceSD.hh" >> 48 #include "GammaRayTelCalorimeterSD.hh" 42 49 43 #include "G4AutoDelete.hh" << 50 #include "G4Material.hh" 44 #include "G4Box.hh" 51 #include "G4Box.hh" 45 #include "G4Colour.hh" << 46 #include "G4FieldManager.hh" << 47 #include "G4GlobalMagFieldMessenger.hh" << 48 #include "G4LogicalVolume.hh" 52 #include "G4LogicalVolume.hh" 49 #include "G4Material.hh" << 50 #include "G4PhysicalConstants.hh" << 51 #include "G4PVPlacement.hh" 53 #include "G4PVPlacement.hh" 52 #include "G4PVReplica.hh" 54 #include "G4PVReplica.hh" 53 #include "G4RegionStore.hh" << 54 #include "G4RunManager.hh" << 55 #include "G4SDManager.hh" << 56 #include "G4SystemOfUnits.hh" << 57 #include "G4TransportationManager.hh" << 58 #include "G4UImanager.hh" << 59 #include "G4UniformMagField.hh" 55 #include "G4UniformMagField.hh" >> 56 #include "G4FieldManager.hh" >> 57 #include "G4TransportationManager.hh" >> 58 #include "G4SDManager.hh" >> 59 #include "G4RunManager.hh" >> 60 60 #include "G4VisAttributes.hh" 61 #include "G4VisAttributes.hh" >> 62 #include "G4Colour.hh" 61 63 62 //....oooOO0OOooo........oooOO0OOooo........oo << 64 #include "G4ios.hh" >> 65 #include "G4RegionStore.hh" 63 66 64 G4ThreadLocal G4GlobalMagFieldMessenger *Gamma << 67 >> 68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 65 69 66 GammaRayTelDetectorConstruction::GammaRayTelDe 70 GammaRayTelDetectorConstruction::GammaRayTelDetectorConstruction() >> 71 :solidWorld(0),logicWorld(0),physiWorld(0), >> 72 solidPayload(0),logicPayload(0),physiPayload(0), >> 73 solidTKR(0),logicTKR(0),physiTKR(0), >> 74 solidCAL(0),logicCAL(0),physiCAL(0), >> 75 solidACT(0),logicACT(0),physiACT(0), >> 76 solidACL1(0),logicACL1(0),physiACL1(0), >> 77 solidACL2(0),logicACL2(0),physiACL2(0), >> 78 solidTKRDetectorX(0),logicTKRDetectorX(0),physiTKRDetectorX(0), >> 79 solidTKRDetectorY(0),logicTKRDetectorY(0),physiTKRDetectorY(0), >> 80 solidCALLayerX(0),logicCALLayerX(0),physiCALLayerX(0), >> 81 solidCALLayerY(0),logicCALLayerY(0),physiCALLayerY(0), >> 82 solidCALDetectorX(0),logicCALDetectorX(0),physiCALDetectorX(0), >> 83 solidCALDetectorY(0),logicCALDetectorY(0),physiCALDetectorY(0), >> 84 solidPlane(0),logicPlane(0),physiPlane(0), >> 85 solidConverter(0),logicConverter(0),physiConverter(0), >> 86 trackerSD(0),calorimeterSD(0),anticoincidenceSD(0), >> 87 aTKRRegion(0), aCALRegion(0) 67 { 88 { 68 // Initialize thread-local sensitive detecto << 89 // default parameter values of the payload 69 trackerSD.Put(nullptr); << 90 70 calorimeterSD.Put(nullptr); << 91 ConverterThickness = 300.*micrometer; 71 anticoincidenceSD.Put(nullptr); << 92 TKRSiliconThickness = 400.*micrometer; 72 << 93 TKRSiliconTileXY = 9.*cm; 73 ComputePayloadParameters(); << 94 TKRSiliconPitch = 200.*micrometer; 74 << 95 TKRLayerDistance = 3.*cm; 75 // create commands for interactive definitio << 96 SiliconGuardRing = 1.5*mm; 76 detectorMessenger = new GammaRayTelDetectorM << 97 TKRViewsDistance = 1.*mm; 77 } << 98 NbOfTKRLayers = 15; 78 << 99 NbOfTKRTiles = 4; 79 //....oooOO0OOooo........oooOO0OOooo........oo << 100 CALBarThickness = 1.5*cm; 80 << 101 NbOfCALBars = 12; 81 GammaRayTelDetectorConstruction::~GammaRayTelD << 102 NbOfCALLayers = 5; 82 delete detectorMessenger; << 103 ACDThickness = 1.*cm; 83 } << 104 NbOfACDTopTiles = 1; 84 << 105 NbOfACDLateralTiles = 2; 85 //....oooOO0OOooo........oooOO0OOooo........oo << 86 << 87 auto GammaRayTelDetectorConstruction::Construc << 88 DefineMaterials(); << 89 return ConstructPayload(); << 90 } << 91 << 92 //....oooOO0OOooo........oooOO0OOooo........oo << 93 << 94 void GammaRayTelDetectorConstruction::DefineMa << 95 G4String name; << 96 G4String symbol; << 97 << 98 G4int numberOfAtoms; << 99 G4int numberOfComponents; << 100 << 101 // << 102 // define Elements << 103 // << 104 << 105 constexpr auto HYDROGEN_ATOMIC_NUMBER{1.}; << 106 constexpr auto HYDROGEN_MOLAR_MASS{1.01 * g << 107 auto *hydrogen = new G4Element(name = "Hydro << 108 << 109 constexpr auto CARBON_ATOMIC_NUMBER{6.}; << 110 constexpr auto CARBON_MOLAR_MASS{12.01 * g << 111 auto *carbon = new G4Element(name = "Carbon" << 112 << 113 constexpr auto NITROGEN_ATOMIC_NUMBER{7.}; << 114 constexpr auto NITROGEN_MOLAR_MASS{14.006 << 115 auto *nitrogen = new G4Element(name = "Nitro << 116 << 117 constexpr auto OXYGEN_ATOMIC_NUMBER{8.}; << 118 constexpr auto OXYGEN_MOLAR_MASS{15.99 * g / << 119 auto *oxygen = new G4Element(name = "Oxygen" << 120 << 121 constexpr auto ALUMINIUM_ATOMIC_NUMBER{13.}; << 122 constexpr auto ALUMINIUM_MOLAR_MASS{26.98 << 123 auto *aluminium = new G4Element(name = "Alum << 124 << 125 constexpr auto SILICON_ATOMIC_NUMBER{14.}; << 126 constexpr auto SILICON_MOLAR_MASS{28.09 * << 127 auto *silicon = new G4Element(name = "Silico << 128 << 129 constexpr auto IRON_ATOMIC_NUMBER{26.}; << 130 constexpr auto IRON_MOLAR_MASS{55.845 * g << 131 auto *iron = new G4Element(name = "Iron", sy << 132 << 133 constexpr auto IODINE_ATOMIC_NUMBER{53.}; << 134 constexpr auto IODINE_MOLAR_MASS{126.904 * << 135 auto *iodine = new G4Element(name = "Iodine" << 136 << 137 constexpr auto CESIUM_ATOMIC_NUMBER{55}; << 138 constexpr auto CESIUM_MOLAR_MASS{132.905 * << 139 auto *cesium = new G4Element(name = "Cesium" << 140 << 141 constexpr auto LEAD_ATOMIC_NUMBER{82}; << 142 constexpr auto LEAD_MOLAR_MASS{207.19 * g << 143 auto *lead = new G4Element(name = "Lead", sy << 144 << 145 // << 146 // define simple materials << 147 // << 148 << 149 constexpr auto TUNGSTEN_ATOMIC_NUMBER{74.} << 150 constexpr auto TUNGSTEN_DENSITY{19.3 * g / << 151 constexpr auto TUNGSTEN_MOLAR_MASS{183.84 << 152 auto *tungsten = new G4Material(name = "Tung << 153 << 154 // << 155 // Define a material from elements. << 156 // Case 1: chemical molecule << 157 // << 158 << 159 constexpr auto SCINTILLATOR_MATERIAL_DENSITY << 160 auto *scintillatorMaterial = new G4Material( << 161 scintillatorMaterial->AddElement(carbon, num << 162 scintillatorMaterial->AddElement(hydrogen, n << 163 << 164 constexpr auto CESIUM_IODIDE_DENSITY{4.53 * << 165 auto *cesiumIodide = new G4Material(name = " << 166 cesiumIodide->AddElement(cesium, numberOfAto << 167 cesiumIodide->AddElement(iodine, numberOfAto << 168 << 169 // << 170 // Define a material from elements. << 171 // Case 2: mixture by fractional mass << 172 // << 173 << 174 constexpr auto AIR_DENSITY{1.290 * mg / cm3} << 175 constexpr auto AIR_NITROGEN_MASS_FRACTION{0. << 176 constexpr auto AIR_OXYGEN_MASS_FRACTION{0.3} << 177 << 178 auto *air = new G4Material(name = "Air", AIR << 179 air->AddElement(nitrogen, AIR_NITROGEN_MASS_ << 180 air->AddElement(oxygen, AIR_OXYGEN_MASS_FRAC << 181 << 182 constexpr auto ALUMINIUM_DENSITY{2.700 * g / << 183 constexpr auto ALUMINIUM_MASS_FRACTION{1.}; << 184 auto *Al = new G4Material(name = "Aluminum", << 185 Al->AddElement(aluminium, ALUMINIUM_MASS_FRA << 186 << 187 constexpr auto SILICON_DENSITY{2.333 * g / c << 188 constexpr auto SILICON_MASS_FRACTION{1.}; << 189 auto *Si = new G4Material(name = "Silicon", << 190 Si->AddElement(silicon, SILICON_MASS_FRACTIO << 191 << 192 constexpr auto IRON_DENSITY{7.87 * g / cm3}; << 193 constexpr auto IRON_MASS_FRACTION{1.}; << 194 auto *Fe = new G4Material(name = "Iron", IRO << 195 Fe->AddElement(iron, IRON_MASS_FRACTION); << 196 << 197 constexpr auto LEAD_DENSITY{11.35 * g / cm3} << 198 constexpr auto LEAD_MASS_FRACTION{1.}; << 199 auto *Pb = new G4Material(name = "Lead", LEA << 200 Pb->AddElement(lead, LEAD_MASS_FRACTION); << 201 << 202 // << 203 // examples of vacuum << 204 // << 205 constexpr auto VACUUM_ATOMIC_NUMBER{1.}; << 206 constexpr auto VACUUM_DENSITY{universe_mean_ << 207 constexpr auto VACUUM_MOLAR_MASS{1.01 * g / << 208 constexpr auto VACUUM_PRESSURE{3.e-18 * pa << 209 constexpr auto VACUUM_TEMPERATURE{2.73 * k << 210 auto *vacuum = new G4Material(name = "Galact << 211 << 212 constexpr auto BEAM_DENSITY{1.e-5 * g / cm3} << 213 constexpr auto BEAM_MASS_FRACTION{1.}; << 214 constexpr auto BEAM_PRESSURE{2.e-2 * bar}; << 215 constexpr auto BEAM_TEMPERATURE{STP_Temperat << 216 auto *beam = new G4Material(name = "Beam", B << 217 beam->AddMaterial(air, BEAM_MASS_FRACTION); << 218 << 219 G4cout << *(G4Material::GetMaterialTable()) << 220 << 221 // default materials of the payload << 222 << 223 defaultMaterial = vacuum; << 224 << 225 converterMaterial = tungsten; << 226 acdMaterial = scintillatorMaterial; // antic << 227 calMaterial = cesiumIodide; // calorimeter ( << 228 tkrMaterial = Si; // tracker (TKR) << 229 } << 230 << 231 //....oooOO0OOooo........oooOO0OOooo........oo << 232 << 233 auto GammaRayTelDetectorConstruction::Construc << 234 // complete the payload parameters definitio << 235 ComputePayloadParameters(); << 236 << 237 // << 238 // World << 239 // << 240 << 241 solidWorld = new G4Box("World", worldSizeXY << 242 logicWorld = new G4LogicalVolume(solidWorld, << 243 physiWorld = new G4PVPlacement(nullptr, G4Th << 244 << 245 // << 246 // Payload << 247 // << 248 << 249 solidPayload = new G4Box("Payload", payloadS << 250 logicPayload = new G4LogicalVolume(solidPayl << 251 physiPayload = new G4PVPlacement(nullptr, G4 << 252 << 253 // << 254 // Calorimeter (CAL) << 255 // << 256 << 257 solidCAL = new G4Box("CAL", calSizeXY / 2, c << 258 logicCAL = new G4LogicalVolume(solidCAL, def << 259 physiCAL = new G4PVPlacement(nullptr, << 260 G4ThreeVector(0, 0, << 261 -payloadSizeZ / 2 + calSizeZ << 262 "CAL", logicCAL, physiPayload, fal << 263 << 264 // << 265 // Tracker (TKR) << 266 // << 267 << 268 solidTKR = new G4Box("TKR", tkrSizeXY / 2, t << 269 logicTKR = new G4LogicalVolume(solidTKR, def << 270 physiTKR = new G4PVPlacement(nullptr, << 271 G4ThreeVector(0, 0, << 272 -payloadSizeZ / 2 + calSizeZ << 273 + tkrSizeZ / 2), << 274 "TKR", logicTKR, physiPayload, fal << 275 << 276 // << 277 // Anticoincidence, Top Side (ACT) << 278 // << 279 << 280 solidACT = new G4Box("ACT", actSizeXY / 2, a << 281 logicACT = new G4LogicalVolume(solidACT, acd << 282 physiACT = new G4PVPlacement(nullptr, << 283 G4ThreeVector(0, 0, << 284 -payloadSizeZ / 2 + calSizeZ + calTK << 285 + acdTKRDistance + actSizeZ / 2) << 286 "ACT", logicACT, physiPayload, fal << 287 << 288 // << 289 // Anticoincidence, Lateral Side (ACL) << 290 // << 291 << 292 solidACL1 = new G4Box("ACL1", acl1SizeX / 2, << 293 logicACL1 = new G4LogicalVolume(solidACL1, a << 294 << 295 physiACL1 = new G4PVPlacement(nullptr, << 296 G4ThreeVector(-payloadSizeXY / 2 + acl1S << 297 -payloadSizeXY / 2 + acl1SizeY / 2, << 298 -payloadSizeZ / 2 + acl1SizeZ / 2), << 299 "ACL1", logicACL1, physiPayload, f << 300 << 301 physiACL1 = new G4PVPlacement(nullptr, << 302 G4ThreeVector(payloadSizeXY / 2 - acl1Si << 303 payloadSizeXY / 2 - acl1SizeY / 2, << 304 -payloadSizeZ / 2 + acl1SizeZ / 2), << 305 "ACL1", logicACL1, physiPayload, f << 306 << 307 solidACL2 = new G4Box("ACL2", acl2SizeX / 2, << 308 logicACL2 = new G4LogicalVolume(solidACL2, a << 309 << 310 physiACL2 = new G4PVPlacement(nullptr, << 311 G4ThreeVector(-payloadSizeXY / 2 + acl2S << 312 payloadSizeXY / 2 - acl2SizeY / 2, << 313 -payloadSizeZ / 2 + acl2SizeZ / 2), << 314 "ACL2", logicACL2, physiPayload, f << 315 << 316 physiACL2 = new G4PVPlacement(nullptr, << 317 G4ThreeVector(payloadSizeXY / 2 - acl2Si << 318 -payloadSizeXY / 2 + acl2SizeY / 2, << 319 -payloadSizeZ / 2 + acl2SizeZ / 2), << 320 "ACL2", logicACL2, physiPayload, f << 321 << 322 // << 323 // Tracker Structure (Plane + Converter + TK << 324 // << 325 << 326 solidPlane = new G4Box("Plane", tkrSizeXY / << 327 logicPlane = new G4LogicalVolume(solidPlane, << 328 << 329 solidTKRDetectorY = new G4Box("TKRDetectorY" << 330 logicTKRDetectorY = new G4LogicalVolume(soli << 331 << 332 solidTKRDetectorX = new G4Box("TKRDetectorX" << 333 logicTKRDetectorX = new G4LogicalVolume(soli << 334 << 335 solidConverter = new G4Box("Converter", tkrS << 336 logicConverter = new G4LogicalVolume(solidCo << 337 << 338 G4int i = 0; << 339 << 340 for (i = 0; i < numberOfTKRLayers; i++) { << 341 physiTKRDetectorY = new G4PVPlacement(null << 342 G4ThreeVector(0., 0., << 343 -tkrSizeZ / 2 + tkrSiliconThic << 344 + (i) * tkrLayerDistance), << 345 "TKRDetectorY", logicTKRDetectorY, << 346 << 347 physiTKRDetectorX = new G4PVPlacement(null << 348 G4ThreeVector(0., 0., << 349 -tkrSizeZ / 2 + tkrSiliconThic << 350 + tkrViewsDistance + tkrSi << 351 + (i) * tkrLayerDistance), << 352 "TKRDetectorX", logicTKRDetectorX, << 353 << 354 physiConverter = new G4PVPlacement(nullptr << 355 G4ThreeVector(0., 0., << 356 -tkrSizeZ / 2 + 2 * tkrSilicon << 357 + tkrViewsDistance + conve << 358 + (i) * tkrLayerDistance), << 359 "Converter", logicConverter, physi << 360 << 361 physiPlane = new G4PVPlacement(nullptr, << 362 G4ThreeVector(0., 0., << 363 -tkrSizeZ / 2 + 2 * tkrSilicon << 364 + tkrViewsDistance + conve << 365 + tkrSupportThickness / 2 << 366 + (i) * tkrLayerDistance), << 367 "Plane", logicPlane, physiTKR, fal << 368 } << 369 106 370 auto *solidTKRActiveTileX = new G4Box("Activ << 107 TilesSeparation = 100.*micrometer; 371 auto *solidTKRActiveTileY = new G4Box("Activ << 108 ACDTKRDistance = 5.*cm; >> 109 CALTKRDistance = 1.5*cm; 372 110 373 auto *logicTKRActiveTileX = new G4LogicalVol << 111 ComputePayloadParameters(); 374 auto *logicTKRActiveTileY = new G4LogicalVol << 375 112 376 G4int j = 0; << 113 // create commands for interactive definition of the payload 377 G4int k = 0; << 114 detectorMessenger = new GammaRayTelDetectorMessenger(this); 378 115 379 G4double x = 0.; << 116 } 380 G4double y = 0.; << 381 G4double z = 0.; << 382 << 383 for (i = 0; i < numberOfTKRTiles; i++) { << 384 for (j = 0; j < numberOfTKRTiles; j++) { << 385 k = i * numberOfTKRTiles + j; << 386 << 387 x = -tkrSizeXY / 2 + tilesSeparation + s << 388 + tkrActiveTileXY / 2 << 389 + (i) << 390 * ((2 * siliconGuardRi << 391 + tkrActiveTileXY) << 392 << 393 y = -tkrSizeXY / 2 + tilesSeparation + s << 394 + tkrActiveTileXY / 2 << 395 + (j) << 396 * ((2 * siliconGuardRi << 397 + tkrActiveTileXY) << 398 z = 0.; << 399 << 400 new G4PVPlacement(nullptr, G4ThreeVector << 401 << 402 x = -tkrSizeXY / 2 + tilesSeparation + s << 403 + tkrActiveTileXY / 2 << 404 + (j) << 405 * ((2 * siliconGuardRi << 406 + tkrActiveTileXY) << 407 << 408 y = -tkrSizeXY / 2 + tilesSeparation + s << 409 + tkrActiveTileXY / 2 << 410 + (i) << 411 * ((2 * siliconGuardRi << 412 + tkrActiveTileXY) << 413 z = 0.; << 414 << 415 new G4PVPlacement(nullptr, G4ThreeVector << 416 } << 417 } << 418 117 419 // Strips << 118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 420 119 421 // Silicon Strips << 120 GammaRayTelDetectorConstruction::~GammaRayTelDetectorConstruction() >> 121 { delete detectorMessenger;} 422 122 423 /* << 123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 424 G4double tkrXStripX{0.}; << 425 G4double tkrYStripY{0.}; << 426 G4double tkrYStripX{0.}; << 427 G4double tkrXStripY{0.}; << 428 */ << 429 << 430 tkrXStripX = tkrYStripY = tkrSiliconPitch; << 431 tkrYStripX = tkrXStripY = tkrActiveTileXY; << 432 tkrZStrip = tkrSiliconThickness; << 433 << 434 auto *solidTKRStripX = new G4Box("Strip X", << 435 logicTKRStripX = new G4LogicalVolume(solidTK << 436 << 437 auto *solidTKRStripY = new G4Box("Strip Y", << 438 logicTKRStripY = new G4LogicalVolume(solidTK << 439 << 440 for (i = 0; i < numberOfTKRStrips; i++) { << 441 new G4PVPlacement(nullptr, << 442 G4ThreeVector( << 443 -tkrActiveTileXY / 2 + tkrSili << 444 + (i) * tkrSiliconPitch, 0 << 445 logicTKRStripX, "Strip X", logicTK << 446 << 447 new G4PVPlacement(nullptr, << 448 G4ThreeVector(0., << 449 -tkrActiveTileXY / 2 + tkrSili << 450 + (i) * tkrSiliconPitch, 0 << 451 logicTKRStripY, "Strip Y", logicTK << 452 } << 453 124 454 // << 125 G4VPhysicalVolume* GammaRayTelDetectorConstruction::Construct() 455 // Calorimeter Structure (CALLayerX + CALLay << 126 { 456 // << 127 DefineMaterials(); 457 << 128 return ConstructPayload(); 458 solidCALLayerX = new G4Box("CALLayerX", calS << 129 } 459 logicCALLayerX = new G4LogicalVolume(solidCA << 460 << 461 solidCALLayerY = new G4Box("CALLayerY", calS << 462 logicCALLayerY = new G4LogicalVolume(solidCA << 463 << 464 for (i = 0; i < numberOfCALLayers; i++) { << 465 physiCALLayerY = new G4PVPlacement(nullptr << 466 G4ThreeVector(0, 0, << 467 -calSizeZ / 2 + calBarThicknes << 468 + (i) * 2 * calBarThicknes << 469 "CALLayerY", logicCALLayerY, physi << 470 << 471 physiCALLayerX = new G4PVPlacement(nullptr << 472 G4ThreeVector(0, 0, << 473 -calSizeZ / 2 + calBarThicknes << 474 + (i) * 2 * calBarThicknes << 475 "CALLayerX", logicCALLayerX, physi << 476 } << 477 130 478 // << 131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 479 // Calorimeter Structure (CALDetectorX + CAL << 480 // << 481 << 482 solidCALDetectorX = new G4Box("CALDetectorX" << 483 logicCALDetectorX = new G4LogicalVolume(soli << 484 << 485 solidCALDetectorY = new G4Box("CALDetectorY" << 486 logicCALDetectorY = new G4LogicalVolume(soli << 487 << 488 for (i = 0; i < numberOfCALBars; i++) { << 489 physiCALDetectorY = new G4PVPlacement(null << 490 G4ThreeVector(-calSizeXY / 2 + cal << 491 logicCALDetectorY, "CALDetectorY", << 492 << 493 physiCALDetectorX = new G4PVPlacement(null << 494 G4ThreeVector(0, -calSizeXY / 2 + << 495 logicCALDetectorX, "CALDetectorX", << 496 } << 497 132 498 /* << 133 void GammaRayTelDetectorConstruction::DefineMaterials() 499 // Cuts by Region << 134 { >> 135 >> 136 G4String name, symbol; >> 137 G4double a, z, density; >> 138 >> 139 G4int ncomponents, natoms; >> 140 G4double fractionmass; >> 141 G4double temperature, pressure; >> 142 >> 143 // >> 144 // define Elements >> 145 // >> 146 >> 147 a = 1.01*g/mole; >> 148 G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a); >> 149 >> 150 a = 12.01*g/mole; >> 151 G4Element* C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a); >> 152 >> 153 a = 14.006*g/mole; >> 154 G4Element* N = new G4Element(name="Nitrogen" ,symbol="N" , z= 7., a); >> 155 >> 156 a = 15.99*g/mole; >> 157 G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a); >> 158 >> 159 a = 26.98*g/mole; >> 160 G4Element* Alumin = new G4Element(name="Aluminum" ,symbol="Al" , z= 13., a); >> 161 >> 162 a = 28.09*g/mole; >> 163 G4Element* Silicon = new G4Element(name="Silicon", symbol="Si", z=14., a); >> 164 >> 165 a= 55.845*g/mole; >> 166 G4Element* Iron = new G4Element(name="Iron", symbol="Fe", z=26.,a); >> 167 >> 168 a = 126.904*g/mole; >> 169 G4Element* I = new G4Element(name="Iodine" ,symbol="I" , z= 53., a); >> 170 >> 171 a = 132.905*g/mole; >> 172 G4Element* Cs = new G4Element(name="Cesium" ,symbol="Cs" , z= 55., a); >> 173 >> 174 a = 207.19*g/mole; >> 175 G4Element* Lead = new G4Element(name="Lead", symbol="Pb", z=82., a); >> 176 >> 177 // >> 178 // define simple materials >> 179 // >> 180 >> 181 density = 19.3*g/cm3; >> 182 a = 183.84*g/mole; >> 183 G4Material* W = new G4Material(name="Tungsten", z=74., a, density); >> 184 >> 185 >> 186 // >> 187 // define a material from elements. case 1: chemical molecule >> 188 // >> 189 >> 190 density = 1.032*g/cm3; >> 191 G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2); >> 192 Sci->AddElement(C, natoms=9); >> 193 Sci->AddElement(H, natoms=10); >> 194 >> 195 density = 4.53*g/cm3; >> 196 G4Material* CsI = new G4Material(name="CesiumIodide", density, ncomponents=2); >> 197 CsI->AddElement(Cs, natoms=5); >> 198 CsI->AddElement(I, natoms=5); >> 199 >> 200 // >> 201 // define a material from elements. case 2: mixture by fractional mass >> 202 // >> 203 >> 204 density = 1.290*mg/cm3; >> 205 G4Material* Air = new G4Material(name="Air" , density, ncomponents=2); >> 206 Air->AddElement(N, fractionmass=0.7); >> 207 Air->AddElement(O, fractionmass=0.3); >> 208 >> 209 density = 2.700*g/cm3; >> 210 G4Material* Al = new G4Material(name="Aluminum", density, ncomponents=1); >> 211 Al->AddElement(Alumin, fractionmass=1.); >> 212 >> 213 density = 2.333*g/cm3; >> 214 G4Material* Si = new G4Material(name="Silicon", density, ncomponents=1); >> 215 Si->AddElement(Silicon, fractionmass=1.); >> 216 >> 217 density = 7.87*g/cm3; >> 218 G4Material* Fe = new G4Material(name="Iron", density, ncomponents=1); >> 219 Fe->AddElement(Iron, fractionmass=1.); >> 220 >> 221 density = 11.35*g/cm3; >> 222 G4Material* Pb = new G4Material(name="Lead", density, ncomponents=1); >> 223 Pb->AddElement(Lead, fractionmass=1.); >> 224 >> 225 // >> 226 // examples of vacuum >> 227 // >> 228 >> 229 density = universe_mean_density; //from PhysicalConstants.h >> 230 pressure = 3.e-18*pascal; >> 231 temperature = 2.73*kelvin; >> 232 G4Material* vacuum = new G4Material(name="Galactic", z=1., a=1.01*g/mole, density,kStateGas,temperature,pressure); >> 233 >> 234 density = 1.e-5*g/cm3; >> 235 pressure = 2.e-2*bar; >> 236 temperature = STP_Temperature; //from PhysicalConstants.h >> 237 G4Material* beam = new G4Material(name="Beam", density, ncomponents=1, >> 238 kStateGas,temperature,pressure); >> 239 beam->AddMaterial(Air, fractionmass=1.); >> 240 >> 241 G4cout << *(G4Material::GetMaterialTable()) << G4endl; >> 242 >> 243 //default materials of the payload >> 244 >> 245 ConverterMaterial = W; >> 246 defaultMaterial = vacuum; >> 247 ACDMaterial = Sci; >> 248 CALMaterial = CsI; >> 249 TKRMaterial = Si; 500 250 501 G4String regionName[] = {"Calorimeter", "T << 251 } 502 252 503 if (calorimeterCutRegion) { << 253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 504 delete calorimeterCutRegion; << 505 } << 506 calorimeterCutRegion = new G4Region(region << 507 logicCAL->SetRegion(calorimeterCutRegion); << 508 calorimeterCutRegion->AddRootLogicalVolume << 509 254 510 if (trackerCutRegion != nullptr) { << 255 G4VPhysicalVolume* GammaRayTelDetectorConstruction::ConstructPayload() 511 delete trackerCutRegion; << 256 { >> 257 // complete the Payload parameters definition >> 258 ComputePayloadParameters(); >> 259 >> 260 // >> 261 // World >> 262 // >> 263 >> 264 solidWorld = new G4Box("World", >> 265 WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2); >> 266 >> 267 logicWorld = new G4LogicalVolume(solidWorld, >> 268 defaultMaterial, >> 269 "World"); >> 270 >> 271 physiWorld = new G4PVPlacement(0,G4ThreeVector(),"World",logicWorld, >> 272 0,false,0); >> 273 >> 274 // >> 275 // Payload >> 276 // >> 277 >> 278 /* solidPayload=0; logicPayload=0; physiPayload=0; >> 279 solidTKR=0;logicTKR=0;physiTKR=0; >> 280 solidCAL=0;logicCAL=0;physiCAL=0; >> 281 solidACT=0;logicACT=0;physiACT=0; >> 282 solidACL1=0;logicACL1=0;physiACL1=0; >> 283 solidACL2=0;logicACL2=0;physiACL2=0; >> 284 solidConverter=0;logicConverter=0;physiConverter=0; >> 285 solidTKRDetectorX=0;logicTKRDetectorX=0; >> 286 solidTKRDetectorY=0;logicTKRDetectorY=0; >> 287 physiTKRDetectorX=0;physiTKRDetectorY=0; >> 288 solidCALDetectorX=0;logicCALDetectorX=0;physiCALDetectorX=0; >> 289 solidCALDetectorY=0;logicCALDetectorY=0;physiCALDetectorY=0; >> 290 solidPlane=0;logicPlane=0;physiPlane=0; >> 291 aCALRegion=0; aTKRRegion=0; >> 292 */ >> 293 // >> 294 // Payload >> 295 // >> 296 >> 297 solidPayload = new G4Box("Payload", >> 298 PayloadSizeXY/2, >> 299 PayloadSizeXY/2, >> 300 PayloadSizeZ/2); >> 301 >> 302 logicPayload = new G4LogicalVolume(solidPayload, >> 303 defaultMaterial, >> 304 "Payload"); >> 305 >> 306 physiPayload = new G4PVPlacement(0, >> 307 G4ThreeVector(), >> 308 "Payload", >> 309 logicPayload, >> 310 physiWorld, >> 311 false, >> 312 0); >> 313 // >> 314 // Calorimeter (CAL) >> 315 // >> 316 >> 317 solidCAL = new G4Box("CAL", >> 318 CALSizeXY/2,CALSizeXY/2,CALSizeZ/2); >> 319 >> 320 logicCAL = new G4LogicalVolume(solidCAL, >> 321 defaultMaterial, >> 322 "CAL"); >> 323 physiCAL = new G4PVPlacement(0, >> 324 G4ThreeVector(0,0, >> 325 -PayloadSizeZ/2+CALSizeZ/2), >> 326 "CAL", >> 327 logicCAL, >> 328 physiPayload, >> 329 false, >> 330 0); >> 331 // >> 332 // Tracker (TKR) >> 333 // >> 334 >> 335 solidTKR = new G4Box("TKR", >> 336 TKRSizeXY/2,TKRSizeXY/2,TKRSizeZ/2); >> 337 >> 338 logicTKR = new G4LogicalVolume(solidTKR, >> 339 defaultMaterial, >> 340 "TKR"); >> 341 physiTKR = new G4PVPlacement(0, >> 342 G4ThreeVector(0,0, >> 343 -PayloadSizeZ/2+CALSizeZ+ >> 344 CALTKRDistance+TKRSizeZ/2), >> 345 "TKR", >> 346 logicTKR, >> 347 physiPayload, >> 348 false, >> 349 0); >> 350 >> 351 >> 352 // >> 353 // Anticoincidence Top (ACT) >> 354 // >> 355 >> 356 solidACT = new G4Box("ACT", >> 357 ACTSizeXY/2,ACTSizeXY/2,ACTSizeZ/2); >> 358 >> 359 logicACT = new G4LogicalVolume(solidACT,ACDMaterial,"ACT"); >> 360 >> 361 physiACT = new G4PVPlacement(0, >> 362 G4ThreeVector(0,0, >> 363 -PayloadSizeZ/2+CALSizeZ+ >> 364 CALTKRDistance+TKRSizeZ+ >> 365 ACDTKRDistance+ACTSizeZ/2), >> 366 "ACT", >> 367 logicACT, >> 368 physiPayload, >> 369 false, >> 370 0); >> 371 >> 372 // >> 373 // Anticoincidence Lateral Side (ACL) >> 374 // >> 375 >> 376 solidACL1 = new G4Box("ACL1", >> 377 ACL1SizeX/2,ACL1SizeY/2,ACL1SizeZ/2); >> 378 >> 379 logicACL1 = new G4LogicalVolume(solidACL1,ACDMaterial,"ACL"); >> 380 >> 381 physiACL1 = new G4PVPlacement(0, >> 382 G4ThreeVector(-PayloadSizeXY/2+ACL1SizeX/2, >> 383 -PayloadSizeXY/2+ACL1SizeY/2, >> 384 -PayloadSizeZ/2+ACL1SizeZ/2), >> 385 "ACL1", >> 386 logicACL1, >> 387 physiPayload, >> 388 false, >> 389 0); >> 390 >> 391 physiACL1 = new G4PVPlacement(0, >> 392 G4ThreeVector(PayloadSizeXY/2-ACL1SizeX/2, >> 393 PayloadSizeXY/2-ACL1SizeY/2, >> 394 -PayloadSizeZ/2+ACL1SizeZ/2), >> 395 "ACL1", >> 396 logicACL1, >> 397 physiPayload, >> 398 false, >> 399 1); >> 400 >> 401 solidACL2 = new G4Box("ACL2", >> 402 ACL2SizeX/2,ACL2SizeY/2,ACL2SizeZ/2); >> 403 >> 404 logicACL2 = new G4LogicalVolume(solidACL2, >> 405 ACDMaterial, >> 406 "ACL2"); >> 407 >> 408 >> 409 physiACL2 = new G4PVPlacement(0, >> 410 G4ThreeVector(-PayloadSizeXY/2+ACL2SizeX/2, >> 411 PayloadSizeXY/2-ACL2SizeY/2, >> 412 -PayloadSizeZ/2+ACL2SizeZ/2), >> 413 "ACL2", >> 414 logicACL2, >> 415 physiPayload, >> 416 false, >> 417 0); >> 418 >> 419 physiACL2 = new G4PVPlacement(0, >> 420 G4ThreeVector(PayloadSizeXY/2-ACL2SizeX/2, >> 421 -PayloadSizeXY/2+ACL2SizeY/2, >> 422 -PayloadSizeZ/2+ACL2SizeZ/2), >> 423 "ACL2", >> 424 logicACL2, >> 425 physiPayload, >> 426 false, >> 427 1); >> 428 >> 429 >> 430 // Tracker Structure (Plane + Converter + TKRDetectorX + TKRDetectorY) >> 431 >> 432 solidPlane = new G4Box("Plane", >> 433 TKRSizeXY/2,TKRSizeXY/2,TKRSupportThickness/2); >> 434 >> 435 logicPlane = new G4LogicalVolume(solidPlane, >> 436 defaultMaterial, >> 437 "Plane"); >> 438 >> 439 solidTKRDetectorY = new G4Box >> 440 ("TKRDetectorY",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2); >> 441 >> 442 logicTKRDetectorY = new G4LogicalVolume(solidTKRDetectorY, >> 443 TKRMaterial, >> 444 "TKRDetector Y"); >> 445 >> 446 >> 447 solidTKRDetectorX = new G4Box >> 448 ("TKRDetectorX",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2); >> 449 >> 450 logicTKRDetectorX = new G4LogicalVolume(solidTKRDetectorX, >> 451 TKRMaterial, >> 452 "TKRDetector X"); >> 453 >> 454 >> 455 solidConverter = new G4Box >> 456 ("Converter",TKRSizeXY/2,TKRSizeXY/2,ConverterThickness/2); >> 457 >> 458 logicConverter = new G4LogicalVolume(solidConverter, >> 459 ConverterMaterial, >> 460 "Converter"); >> 461 >> 462 G4int i=0; >> 463 >> 464 for (i = 0; i < NbOfTKRLayers; i++) >> 465 { >> 466 >> 467 physiTKRDetectorY = >> 468 new G4PVPlacement(0,G4ThreeVector(0.,0.,-TKRSizeZ/2 >> 469 +TKRSiliconThickness/2 >> 470 +(i)*TKRLayerDistance), >> 471 "TKRDetectorY", >> 472 logicTKRDetectorY, >> 473 physiTKR, >> 474 false, >> 475 i); >> 476 >> 477 physiTKRDetectorX = >> 478 new G4PVPlacement(0,G4ThreeVector(0.,0., >> 479 -TKRSizeZ/2+ >> 480 TKRSiliconThickness/2 + >> 481 TKRViewsDistance+ >> 482 TKRSiliconThickness+ >> 483 (i)*TKRLayerDistance), >> 484 "TKRDetectorX", >> 485 logicTKRDetectorX, >> 486 physiTKR, >> 487 false, >> 488 i); >> 489 >> 490 >> 491 physiConverter = >> 492 new G4PVPlacement(0,G4ThreeVector(0.,0., >> 493 -TKRSizeZ/2+ >> 494 2*TKRSiliconThickness + >> 495 TKRViewsDistance+ >> 496 ConverterThickness/2+ >> 497 (i)*TKRLayerDistance), >> 498 "Converter", >> 499 logicConverter, >> 500 physiTKR, >> 501 false, >> 502 i); >> 503 >> 504 >> 505 >> 506 physiPlane = >> 507 new G4PVPlacement(0,G4ThreeVector(0.,0., >> 508 -TKRSizeZ/2+ >> 509 2*TKRSiliconThickness + >> 510 TKRViewsDistance+ >> 511 ConverterThickness+ >> 512 TKRSupportThickness/2+ >> 513 (i)*TKRLayerDistance), >> 514 "Plane", >> 515 logicPlane, >> 516 physiTKR, >> 517 false, >> 518 i); >> 519 512 } 520 } 513 trackerCutRegion = new G4Region(regionName << 521 514 logicTKR->SetRegion(trackerCutRegion); << 522 515 trackerCutRegion->AddRootLogicalVolume(log << 523 516 */ << 524 G4VSolid * solidTKRActiveTileX = new 517 << 525 G4Box("Active Tile X", TKRActiveTileXY/2, 518 // << 526 TKRActiveTileXY/2,TKRActiveTileZ/2); 519 // Visualization attributes << 527 520 // << 528 521 // Invisible Volume << 529 G4VSolid * solidTKRActiveTileY = new 522 logicWorld->SetVisAttributes(G4VisAttributes << 530 G4Box("Active Tile Y", TKRActiveTileXY/2, 523 logicPayload->SetVisAttributes(G4VisAttribut << 531 TKRActiveTileXY/2,TKRActiveTileZ/2); 524 logicTKR->SetVisAttributes(G4VisAttributes:: << 532 525 logicTKRActiveTileX->SetVisAttributes(G4VisA << 533 526 logicTKRActiveTileY->SetVisAttributes(G4VisA << 534 G4LogicalVolume* logicTKRActiveTileX = 527 logicPlane->SetVisAttributes(G4VisAttributes << 535 new G4LogicalVolume(solidTKRActiveTileX, TKRMaterial, 528 logicConverter->SetVisAttributes(G4VisAttrib << 536 "Active Tile X",0,0,0); 529 logicCAL->SetVisAttributes(G4VisAttributes:: << 537 530 logicCALLayerX->SetVisAttributes(G4VisAttrib << 538 531 logicCALLayerY->SetVisAttributes(G4VisAttrib << 539 G4LogicalVolume* logicTKRActiveTileY = 532 logicTKRStripX->SetVisAttributes(G4VisAttrib << 540 new G4LogicalVolume(solidTKRActiveTileY, TKRMaterial, 533 logicTKRStripY->SetVisAttributes(G4VisAttrib << 541 "Active Tile Y",0,0,0); 534 << 542 535 // Some visualization styles << 543 536 << 544 G4int j=0; 537 auto *visualizationStyle1 = new G4VisAttribu << 545 G4int k=0; 538 visualizationStyle1->SetVisibility(true); << 546 539 visualizationStyle1->SetForceSolid(TRUE); << 547 G4VPhysicalVolume* physiTKRActiveTileX = 0; 540 << 548 G4VPhysicalVolume* physiTKRActiveTileY = 0; 541 auto *visualizationStyle2 = new G4VisAttribu << 549 542 visualizationStyle2->SetVisibility(true); << 550 G4double x=0.; 543 visualizationStyle2->SetForceSolid(FALSE); << 551 G4double y=0.; 544 << 552 G4double z=0.; 545 auto *visualizationStyle3 = new G4VisAttribu << 553 546 visualizationStyle3->SetVisibility(true); << 554 for (i=0;i< NbOfTKRTiles; i++) 547 visualizationStyle3->SetForceWireframe(TRUE) << 555 { 548 << 556 for (j=0;j< NbOfTKRTiles; j++) 549 // Visible Volumes << 557 { 550 << 558 k = i*NbOfTKRTiles + j; 551 logicCALDetectorX->SetVisAttributes(visualiz << 559 552 logicCALDetectorY->SetVisAttributes(visualiz << 560 553 logicTKRDetectorX->SetVisAttributes(visualiz << 561 x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+ 554 logicTKRDetectorY->SetVisAttributes(visualiz << 562 TKRActiveTileXY/2+(i)*((2*SiliconGuardRing)+ 555 logicACT->SetVisAttributes(visualizationStyl << 563 TilesSeparation+TKRActiveTileXY); 556 logicACL1->SetVisAttributes(visualizationSty << 564 y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+ 557 logicACL2->SetVisAttributes(visualizationSty << 565 TKRActiveTileXY/2+(j)*((2*SiliconGuardRing)+TilesSeparation+ 558 << 566 TKRActiveTileXY); 559 // << 567 z = 0.; 560 // always return the physical World << 568 561 // << 569 physiTKRActiveTileY = 562 PrintPayloadParameters(); << 570 new G4PVPlacement(0, 563 << 571 G4ThreeVector(x,y,z), 564 return physiWorld; << 572 "Active Tile Y", 565 } << 573 logicTKRActiveTileY, 566 << 574 physiTKRDetectorY, 567 //....oooOO0OOooo........oooOO0OOooo........oo << 575 false, 568 << 576 k); 569 void GammaRayTelDetectorConstruction::Construc << 577 570 // << 578 571 // Sensitive detector: Tracker << 579 x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+ 572 // << 580 TKRActiveTileXY/2+(j)*((2*SiliconGuardRing)+ 573 if (trackerSD.Get() == nullptr) { << 581 TilesSeparation+TKRActiveTileXY); 574 constexpr auto TRACKER_SENSITIVE_DETECTO << 582 y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+ 575 auto *sensitiveDetector = new GammaRayTelT << 583 TKRActiveTileXY/2+(i)*((2*SiliconGuardRing)+ 576 trackerSD.Put(sensitiveDetector); << 584 TilesSeparation+TKRActiveTileXY); >> 585 z = 0.; >> 586 >> 587 physiTKRActiveTileX = >> 588 new G4PVPlacement(0, >> 589 G4ThreeVector(x,y,z), >> 590 "Active Tile X", >> 591 logicTKRActiveTileX, >> 592 physiTKRDetectorX, >> 593 false, >> 594 k); >> 595 577 } 596 } >> 597 } >> 598 578 599 579 G4SDManager::GetSDMpointer()->AddNewDetector << 600 // Calorimeter Structure (CALLayerX + CALLayerY) >> 601 >> 602 >> 603 solidCALLayerX = new G4Box("CALLayerX", >> 604 CALSizeXY/2,CALSizeXY/2,CALBarThickness/2); >> 605 >> 606 logicCALLayerX = new G4LogicalVolume(solidCALLayerX, >> 607 CALMaterial, >> 608 "CALLayerX"); >> 609 >> 610 solidCALLayerY = new G4Box("CALLayerY", >> 611 CALSizeXY/2,CALSizeXY/2,CALBarThickness/2); >> 612 >> 613 logicCALLayerY = new G4LogicalVolume(solidCALLayerY, >> 614 CALMaterial, >> 615 "CALLayerY"); >> 616 >> 617 for (i = 0; i < NbOfCALLayers; i++) >> 618 { >> 619 >> 620 physiCALLayerY = >> 621 new G4PVPlacement(0,G4ThreeVector(0,0, >> 622 -CALSizeZ/2+ >> 623 CALBarThickness/2 + >> 624 (i)*2*CALBarThickness), >> 625 "CALLayerY", >> 626 logicCALLayerY, >> 627 physiCAL, >> 628 false, >> 629 i); >> 630 >> 631 physiCALLayerX = >> 632 new G4PVPlacement(0,G4ThreeVector(0,0, >> 633 -CALSizeZ/2+ >> 634 CALBarThickness/2 + >> 635 CALBarThickness + >> 636 (i)*2*CALBarThickness), >> 637 "CALLayerX", >> 638 logicCALLayerX, >> 639 physiCAL, >> 640 false, >> 641 i); >> 642 >> 643 } >> 644 >> 645 // Calorimeter Structure (CALDetectorX + CALDetectorY) >> 646 >> 647 solidCALDetectorX = new G4Box("CALDetectorX", >> 648 CALBarX/2,CALBarY/2,CALBarThickness/2); >> 649 >> 650 logicCALDetectorX = new G4LogicalVolume(solidCALDetectorX, >> 651 CALMaterial, >> 652 "CALDetectorX"); >> 653 >> 654 solidCALDetectorY = new G4Box("CALDetectorY", >> 655 CALBarY/2,CALBarX/2,CALBarThickness/2); >> 656 >> 657 logicCALDetectorY = new G4LogicalVolume(solidCALDetectorY, >> 658 CALMaterial, >> 659 "CALDetectorY"); >> 660 >> 661 for (i = 0; i < NbOfCALBars; i++) >> 662 { >> 663 >> 664 physiCALDetectorY = >> 665 new G4PVPlacement(0, >> 666 G4ThreeVector(-CALSizeXY/2+ CALBarY/2 + >> 667 (i)*CALBarY, 0, 0), >> 668 "CALDetectorY", >> 669 logicCALDetectorY, >> 670 physiCALLayerY, >> 671 false, >> 672 i); >> 673 >> 674 physiCALDetectorX = >> 675 new G4PVPlacement(0, >> 676 G4ThreeVector(0,-CALSizeXY/2+ CALBarY/2 + >> 677 (i)*CALBarY, 0), >> 678 "CALDetectorX", >> 679 logicCALDetectorX, >> 680 physiCALLayerX, >> 681 false, >> 682 i); >> 683 >> 684 } >> 685 >> 686 >> 687 // Cuts by Regions >> 688 >> 689 >> 690 G4String regName[] = {"Calorimeter","Tracker"}; >> 691 if (aCALRegion) delete aCALRegion; >> 692 >> 693 aCALRegion = new G4Region(regName[0]); >> 694 logicCAL->SetRegion(aCALRegion); >> 695 aCALRegion->AddRootLogicalVolume(logicCAL); >> 696 >> 697 if (aTKRRegion) delete aTKRRegion; >> 698 >> 699 aTKRRegion = new G4Region(regName[1]); >> 700 logicTKR->SetRegion(aTKRRegion); >> 701 aTKRRegion->AddRootLogicalVolume(logicTKR); >> 702 >> 703 //Sensitive Detector Manager >> 704 >> 705 G4SDManager* SDman = G4SDManager::GetSDMpointer(); >> 706 >> 707 // >> 708 // Sensitive Detectors - Tracker >> 709 // >> 710 >> 711 >> 712 if(!trackerSD) >> 713 { >> 714 trackerSD = new GammaRayTelTrackerSD("TrackerSD"); >> 715 SDman->AddNewDetector( trackerSD ); >> 716 } 580 717 581 // Flags the strips as sensitive . << 582 if (logicTKRStripX != nullptr) { << 583 SetSensitiveDetector(logicTKRStripX, track << 584 } << 585 if (logicTKRStripY != nullptr) { << 586 SetSensitiveDetector(logicTKRStripY, track << 587 } << 588 718 589 // << 719 G4String ROgeometryName = "TrackerROGeom"; 590 // Sensitive detector: Calorimeter << 720 G4VReadOutGeometry* trackerRO = 591 // << 721 new GammaRayTelTrackerROGeometry(ROgeometryName); 592 if (calorimeterSD.Get() == nullptr) { << 722 593 constexpr auto CALORIMETER_SENSITIVE_DET << 723 trackerRO->BuildROGeometry(); 594 auto *sensitiveDetector = new GammaRayTelC << 724 trackerSD->SetROgeometry(trackerRO); 595 calorimeterSD.Put(sensitiveDetector); << 725 596 } << 726 if (logicTKRActiveTileX) >> 727 logicTKRActiveTileX->SetSensitiveDetector(trackerSD); // ActiveTileX >> 728 if (logicTKRActiveTileY) >> 729 logicTKRActiveTileY->SetSensitiveDetector(trackerSD); // ActiveTileY >> 730 >> 731 // >> 732 // Sensitive Detectors: Calorimeter >> 733 // 597 734 598 G4SDManager::GetSDMpointer()->AddNewDetector << 599 if (logicCALDetectorX != nullptr) { << 600 SetSensitiveDetector(logicCALDetectorX, ca << 601 } << 602 if (logicCALDetectorY != nullptr) { << 603 SetSensitiveDetector(logicCALDetectorY, ca << 604 } << 605 735 606 // << 607 // Sensitive detector: Anticoincidence << 608 // << 609 if (anticoincidenceSD.Get() == nullptr) { << 610 constexpr auto ANTICOINCIDENCE_SENSITIVE << 611 auto *sensitiveDetector = new GammaRayTelA << 612 anticoincidenceSD.Put(sensitiveDetector); << 613 } << 614 736 615 G4SDManager::GetSDMpointer()->AddNewDetector << 737 if(!calorimeterSD) 616 if (logicACT != nullptr) { << 738 { 617 SetSensitiveDetector(logicACT, anticoincid << 739 calorimeterSD = new GammaRayTelCalorimeterSD("CalorimeterSD"); 618 } << 740 SDman->AddNewDetector( calorimeterSD ); 619 if (logicACL1 != nullptr) { << 741 } 620 SetSensitiveDetector(logicACL1, anticoinci << 742 621 } << 743 if (logicCALDetectorX) 622 if (logicACL2 != nullptr) { << 744 logicCALDetectorX->SetSensitiveDetector(calorimeterSD); // BarX 623 SetSensitiveDetector(logicACL2, anticoinci << 745 if (logicCALDetectorY) 624 } << 746 logicCALDetectorY->SetSensitiveDetector(calorimeterSD); // BarY 625 << 747 626 // Create global magnetic field messenger. << 748 // 627 // Uniform magnetic field is then created au << 749 // Sensitive Detectors: Anticoincidence 628 auto fieldValue = G4ThreeVector(); << 750 // 629 fMagFieldMessenger = new G4GlobalMagFieldMes << 751 630 fMagFieldMessenger->SetVerboseLevel(1); << 752 if(!anticoincidenceSD) 631 << 753 { 632 // Register the field messenger for deleting << 754 anticoincidenceSD = new GammaRayTelAnticoincidenceSD 633 G4AutoDelete::Register (fMagFieldMessenger); << 755 ("AnticoincidenceSD"); >> 756 SDman->AddNewDetector( anticoincidenceSD ); >> 757 } >> 758 >> 759 if (logicACT) >> 760 logicACT->SetSensitiveDetector(anticoincidenceSD); // ACD top >> 761 if (logicACL1) >> 762 logicACL1->SetSensitiveDetector(anticoincidenceSD); // ACD lateral side >> 763 if (logicACL2) >> 764 logicACL2->SetSensitiveDetector(anticoincidenceSD); // ACD lateral side >> 765 >> 766 // >> 767 // Visualization attributes >> 768 // >> 769 >> 770 // Invisible Volume >> 771 logicWorld->SetVisAttributes (G4VisAttributes::Invisible); >> 772 logicPayload->SetVisAttributes (G4VisAttributes::Invisible); >> 773 logicTKR->SetVisAttributes(G4VisAttributes::Invisible); >> 774 logicTKRActiveTileX->SetVisAttributes(G4VisAttributes::Invisible); >> 775 logicTKRActiveTileY->SetVisAttributes(G4VisAttributes::Invisible); >> 776 logicPlane->SetVisAttributes(G4VisAttributes::Invisible); >> 777 logicConverter->SetVisAttributes(G4VisAttributes::Invisible); >> 778 logicCAL->SetVisAttributes(G4VisAttributes::Invisible); >> 779 logicCALLayerX->SetVisAttributes(G4VisAttributes::Invisible); >> 780 logicCALLayerY->SetVisAttributes(G4VisAttributes::Invisible); >> 781 >> 782 // Some visualization styles >> 783 >> 784 G4VisAttributes* VisAtt1= new G4VisAttributes(G4Colour(0.3,0.8,0.1)); >> 785 VisAtt1->SetVisibility(true); >> 786 VisAtt1->SetForceSolid(TRUE); >> 787 >> 788 G4VisAttributes* VisAtt2= new G4VisAttributes(G4Colour(0.2,0.3,0.8)); >> 789 VisAtt2->SetVisibility(true); >> 790 VisAtt2->SetForceSolid(FALSE); >> 791 >> 792 G4VisAttributes* VisAtt3= new G4VisAttributes(G4Colour(0.8,0.2,0.3)); >> 793 VisAtt3->SetVisibility(true); >> 794 VisAtt3->SetForceWireframe(TRUE); >> 795 >> 796 // Visible Volumes >> 797 >> 798 logicCALDetectorX->SetVisAttributes(VisAtt1); >> 799 logicCALDetectorY->SetVisAttributes(VisAtt1); >> 800 logicTKRDetectorX->SetVisAttributes(VisAtt2); >> 801 logicTKRDetectorY->SetVisAttributes(VisAtt2); >> 802 logicACT->SetVisAttributes(VisAtt3); >> 803 logicACL1->SetVisAttributes(VisAtt3); >> 804 logicACL2->SetVisAttributes(VisAtt3); >> 805 >> 806 >> 807 // >> 808 //always return the physical World >> 809 // >> 810 PrintPayloadParameters(); >> 811 return physiWorld; 634 } 812 } 635 813 636 //....oooOO0OOooo........oooOO0OOooo........oo 814 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 637 815 638 void GammaRayTelDetectorConstruction::PrintPay << 816 void GammaRayTelDetectorConstruction::PrintPayloadParameters() 639 G4cout << 817 { 640 << "\n---------------------------------- << 818 G4cout << "\n------------------------------------------------------------" 641 << "---> The tracker is composed by " << n << 819 << "\n---> The Tracker is " << NbOfTKRLayers << " layers of: " 642 << ", each made of " << converterMaterial- << 820 << ConverterThickness/mm << "mm of " << ConverterMaterial->GetName() 643 << " and " << converterThickness / mm << " << 821 << "\n------------------------------------------------------------\n"; 644 << "\n------------------------------------ << 645 } 822 } 646 823 647 //....oooOO0OOooo........oooOO0OOooo........oo 824 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 648 825 649 void GammaRayTelDetectorConstruction::SetConve << 650 // search the material by its name << 651 G4Material *material = G4Material::GetMateri << 652 if (material != nullptr) { << 653 converterMaterial = material; << 654 logicConverter->SetMaterial(material); << 655 PrintPayloadParameters(); << 656 } << 657 } << 658 826 659 //....oooOO0OOooo........oooOO0OOooo........oo 827 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 660 828 661 void GammaRayTelDetectorConstruction::SetConve << 829 void GammaRayTelDetectorConstruction::SetConverterMaterial(G4String materialChoice) 662 converterThickness = value; << 830 { >> 831 // search the material by its name >> 832 G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice); >> 833 if (pttoMaterial) >> 834 { >> 835 ConverterMaterial = pttoMaterial; >> 836 logicConverter->SetMaterial(pttoMaterial); >> 837 PrintPayloadParameters(); >> 838 } 663 } 839 } 664 840 >> 841 void GammaRayTelDetectorConstruction::SetConverterThickness(G4double val) >> 842 { >> 843 ConverterThickness = val; >> 844 } >> 845 665 //....oooOO0OOooo........oooOO0OOooo........oo 846 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 666 847 667 void GammaRayTelDetectorConstruction::SetTKRSi << 848 void GammaRayTelDetectorConstruction::SetTKRSiliconThickness(G4double val) 668 tkrSiliconThickness = value; << 849 { 669 } << 850 TKRSiliconThickness = val; >> 851 } 670 852 671 //....oooOO0OOooo........oooOO0OOooo........oo << 672 853 673 void GammaRayTelDetectorConstruction::SetTKRSi << 854 void GammaRayTelDetectorConstruction::SetTKRSiliconPitch(G4double val) 674 tkrSiliconPitch = value; << 855 { 675 } << 856 TKRSiliconPitch = val; >> 857 } 676 858 677 //....oooOO0OOooo........oooOO0OOooo........oo << 678 859 679 void GammaRayTelDetectorConstruction::SetTKRTi << 860 void GammaRayTelDetectorConstruction::SetTKRTileSizeXY(G4double val) 680 tkrSiliconTileXY = value; << 861 { 681 } << 862 TKRSiliconTileXY = val; >> 863 } 682 864 683 //....oooOO0OOooo........oooOO0OOooo........oo << 684 865 685 void GammaRayTelDetectorConstruction::SetNbOfT << 866 void GammaRayTelDetectorConstruction::SetNbOfTKRLayers(G4int val) 686 numberOfTKRLayers = value; << 867 { >> 868 NbOfTKRLayers = val; 687 } 869 } 688 870 689 //....oooOO0OOooo........oooOO0OOooo........oo << 690 871 691 void GammaRayTelDetectorConstruction::SetNbOfT << 872 void GammaRayTelDetectorConstruction::SetNbOfTKRTiles(G4int val) 692 numberOfTKRTiles = value; << 873 { >> 874 NbOfTKRTiles = val; 693 } 875 } 694 876 695 //....oooOO0OOooo........oooOO0OOooo........oo << 877 void GammaRayTelDetectorConstruction::SetTKRLayerDistance(G4double val) >> 878 { >> 879 TKRLayerDistance = val; >> 880 } 696 881 697 void GammaRayTelDetectorConstruction::SetTKRLa << 882 void GammaRayTelDetectorConstruction::SetTKRViewsDistance(G4double val) 698 tkrLayerDistance = value; << 883 { >> 884 TKRViewsDistance = val; 699 } 885 } 700 886 >> 887 701 //....oooOO0OOooo........oooOO0OOooo........oo 888 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 702 889 703 void GammaRayTelDetectorConstruction::SetTKRVi << 890 void GammaRayTelDetectorConstruction::SetNbOfCALLayers(G4int val) 704 tkrViewsDistance = value; << 891 { >> 892 NbOfCALLayers = val; 705 } 893 } 706 894 707 //....oooOO0OOooo........oooOO0OOooo........oo << 895 void GammaRayTelDetectorConstruction::SetNbOfCALBars(G4int val) >> 896 { >> 897 NbOfCALBars = val; >> 898 } 708 899 709 void GammaRayTelDetectorConstruction::SetNbOfC << 900 void GammaRayTelDetectorConstruction::SetCALBarThickness(G4double val) 710 numberOfCALLayers = value; << 901 { >> 902 CALBarThickness = val; 711 } 903 } 712 904 713 //....oooOO0OOooo........oooOO0OOooo........oo 905 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 714 906 715 void GammaRayTelDetectorConstruction::SetNbOfC << 907 void GammaRayTelDetectorConstruction::SetACDThickness(G4double val) 716 numberOfCALBars = value; << 908 { >> 909 ACDThickness = val; 717 } 910 } 718 911 719 //....oooOO0OOooo........oooOO0OOooo........oo 912 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 720 913 721 void GammaRayTelDetectorConstruction::SetCALBa << 914 void GammaRayTelDetectorConstruction::SetMagField(G4double fieldValue) 722 calBarThickness = value; << 915 { >> 916 //apply a global uniform magnetic field along Z axis >> 917 G4FieldManager* fieldMgr >> 918 = G4TransportationManager::GetTransportationManager()->GetFieldManager(); >> 919 >> 920 if(magField) delete magField; //delete the existing magn field >> 921 >> 922 if(fieldValue!=0.) // create a new one if non nul >> 923 { magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue)); >> 924 fieldMgr->SetDetectorField(magField); >> 925 fieldMgr->CreateChordFinder(magField); >> 926 } else { >> 927 magField = 0; >> 928 fieldMgr->SetDetectorField(magField); >> 929 } 723 } 930 } 724 931 725 //....oooOO0OOooo........oooOO0OOooo........oo 932 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 933 >> 934 void GammaRayTelDetectorConstruction::UpdateGeometry() >> 935 { >> 936 // delete payloadSD; >> 937 G4RunManager::GetRunManager()->DefineWorldVolume(ConstructPayload()); >> 938 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); >> 939 G4RegionStore::GetInstance()->UpdateMaterialList(physiWorld); >> 940 726 941 727 void GammaRayTelDetectorConstruction::SetACDTh << 728 acdThickness = value; << 729 } 942 } 730 943 731 //....oooOO0OOooo........oooOO0OOooo........oo 944 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 732 945 733 void GammaRayTelDetectorConstruction::SetMagFi << 734 // Just invoke manually the MT-safe comman << 735 std::stringstream stream; << 736 stream << "/globalField/setValue 0 0 " << << 737 946 738 G4String command = stream.str(); << 739 G4cout << "Going to execute: " << command << 740 947 741 auto *uiManager = G4UImanager::GetUIpointe << 742 uiManager->ApplyCommand(command); << 743 } << 744 948 745 //....oooOO0OOooo........oooOO0OOooo........oo << 746 949 747 void GammaRayTelDetectorConstruction::UpdateGe << 950 748 // delete payloadSD; << 951 749 G4RunManager::GetRunManager()->DefineWorld << 952 750 G4RunManager::GetRunManager()->PhysicsHasB << 953 751 G4RegionStore::GetInstance()->UpdateMateri << 954 752 G4RunManager::GetRunManager()->Reinitializ << 955 753 } << 956 >> 957 >> 958 >> 959 >> 960 >> 961 754 962