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