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 10.1.p3)


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