Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/gammaray_telescope/src/GammaRayTelDetectorConstruction.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/gammaray_telescope/src/GammaRayTelDetectorConstruction.cc (Version 11.3.0) and /examples/advanced/gammaray_telescope/src/GammaRayTelDetectorConstruction.cc (Version 11.0.p1)


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