Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/electromagnetic/TestEm8/src/DetectorConstruction.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/extended/electromagnetic/TestEm8/src/DetectorConstruction.cc (Version 11.3.0) and /examples/extended/electromagnetic/TestEm8/src/DetectorConstruction.cc (Version 10.7.p4)


  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 /// \file electromagnetic/TestEm8/src/Detector     26 /// \file electromagnetic/TestEm8/src/DetectorConstruction.cc
 27 /// \brief Implementation of the DetectorConst     27 /// \brief Implementation of the DetectorConstruction class
 28 //                                                 28 //
 29 //                                                 29 //
 30 //////////////////////////////////////////////     30 /////////////////////////////////////////////////////////////////////////
 31 //                                                 31 //
 32 // TestEm8: Gaseous detector                       32 // TestEm8: Gaseous detector
 33 //                                                 33 //
 34 // Created: 31.08.2010 V.Ivanchenko ob base of     34 // Created: 31.08.2010 V.Ivanchenko ob base of V.Grichine code
 35 //                                                 35 //
 36 // Modified:                                       36 // Modified:
 37 //                                                 37 //
 38 //////////////////////////////////////////////     38 ////////////////////////////////////////////////////////////////////////
 39 //                                             <<  39 // 
 40 //....oooOO0OOooo........oooOO0OOooo........oo     40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 41                                                    41 
 42 #include "DetectorConstruction.hh"                 42 #include "DetectorConstruction.hh"
 43                                                << 
 44 #include "DetectorMessenger.hh"                    43 #include "DetectorMessenger.hh"
 45 #include "TargetSD.hh"                             44 #include "TargetSD.hh"
 46 #include "TestParameters.hh"                   << 
 47                                                    45 
 48 #include "G4Colour.hh"                         << 
 49 #include "G4GeometryManager.hh"                << 
 50 #include "G4LogicalVolume.hh"                  << 
 51 #include "G4LogicalVolumeStore.hh"             << 
 52 #include "G4Material.hh"                           46 #include "G4Material.hh"
 53 #include "G4NistManager.hh"                    <<  47 #include "G4Tubs.hh"
                                                   >>  48 #include "G4LogicalVolume.hh"
 54 #include "G4PVPlacement.hh"                        49 #include "G4PVPlacement.hh"
 55 #include "G4PhysicalConstants.hh"              <<  50 
 56 #include "G4PhysicalVolumeStore.hh"            <<  51 #include "G4SDManager.hh"
 57 #include "G4PionPlus.hh"                       <<  52 #include "G4GeometryManager.hh"
 58 #include "G4ProductionCuts.hh"                 <<  53 #include "G4RunManager.hh"
                                                   >>  54 #include "G4NistManager.hh"
                                                   >>  55 
 59 #include "G4Region.hh"                             56 #include "G4Region.hh"
 60 #include "G4RegionStore.hh"                        57 #include "G4RegionStore.hh"
 61 #include "G4RunManager.hh"                     <<  58 #include "G4PhysicalVolumeStore.hh"
 62 #include "G4SDManager.hh"                      <<  59 #include "G4LogicalVolumeStore.hh"
 63 #include "G4SolidStore.hh"                         60 #include "G4SolidStore.hh"
 64 #include "G4SystemOfUnits.hh"                  <<  61 #include "G4ProductionCuts.hh"
 65 #include "G4Tubs.hh"                           <<  62 
 66 #include "G4UnitsTable.hh"                     << 
 67 #include "G4VisAttributes.hh"                      63 #include "G4VisAttributes.hh"
                                                   >>  64 #include "G4Colour.hh"
                                                   >>  65 
                                                   >>  66 #include "G4UnitsTable.hh"
                                                   >>  67 #include "G4PhysicalConstants.hh"
                                                   >>  68 #include "G4SystemOfUnits.hh"
 68 #include "G4ios.hh"                                69 #include "G4ios.hh"
                                                   >>  70 #include "TestParameters.hh"
                                                   >>  71 #include "G4PionPlus.hh"
 69                                                    72 
 70 #include <vector>                                  73 #include <vector>
 71                                                    74 
 72 //....oooOO0OOooo........oooOO0OOooo........oo     75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 73                                                    76 
 74 DetectorConstruction::DetectorConstruction()       77 DetectorConstruction::DetectorConstruction()
 75 {                                              <<  78   : G4VUserDetectorConstruction(),
 76   fGasThickness = 23.0 * mm;                   <<  79     fGasMat(nullptr), fWindowMat(nullptr), fWorldMaterial(nullptr),
 77   fGasRadius = 10. * cm;                       <<  80     fSolidWorld(nullptr), fSolidContainer(nullptr), fSolidDetector(nullptr),
 78   fMaxStep = DBL_MAX;                          <<  81     fPhysWorld(nullptr), fLogicWorld(nullptr), fLogicContainer(nullptr), 
                                                   >>  82     fLogicDetector(nullptr),fRegGasDet(nullptr)
                                                   >>  83 {
                                                   >>  84   fGasThickness = 23.0*mm;
                                                   >>  85   fGasRadius    = 10.*cm;
                                                   >>  86   fMaxStep      = DBL_MAX;
 79                                                    87 
 80   fWindowThick = 51.0 * micrometer;            <<  88   fWindowThick  = 51.0*micrometer;
 81                                                    89 
 82   DefineMaterials();                               90   DefineMaterials();
 83                                                    91 
 84   fDetectorMessenger = new DetectorMessenger(t     92   fDetectorMessenger = new DetectorMessenger(this);
 85                                                    93 
 86   G4double cut = 0.7 * mm;                     <<  94   G4double cut = 0.7*mm;
 87   fGasDetectorCuts = new G4ProductionCuts();   <<  95   fGasDetectorCuts   = new G4ProductionCuts();
 88   fGasDetectorCuts->SetProductionCut(cut, "gam <<  96   fGasDetectorCuts->SetProductionCut(cut,"gamma");
 89   fGasDetectorCuts->SetProductionCut(cut, "e-" <<  97   fGasDetectorCuts->SetProductionCut(cut,"e-");
 90   fGasDetectorCuts->SetProductionCut(cut, "e+" <<  98   fGasDetectorCuts->SetProductionCut(cut,"e+");
 91   fGasDetectorCuts->SetProductionCut(cut, "pro <<  99   fGasDetectorCuts->SetProductionCut(cut,"proton");
 92 }                                                 100 }
 93                                                   101 
 94 //....oooOO0OOooo........oooOO0OOooo........oo    102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 95                                                   103 
 96 DetectorConstruction::~DetectorConstruction()     104 DetectorConstruction::~DetectorConstruction()
 97 {                                              << 105 { 
 98   delete fDetectorMessenger;                      106   delete fDetectorMessenger;
 99 }                                                 107 }
100                                                   108 
101 //....oooOO0OOooo........oooOO0OOooo........oo    109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102                                                   110 
103 void DetectorConstruction::DefineMaterials()      111 void DetectorConstruction::DefineMaterials()
104 {                                              << 112 { 
105   // This function illustrates the possible wa << 113   //This function illustrates the possible ways to define materials 
106   G4String name, symbol;                       << 114   G4String name, symbol ;          
107   G4double density;                            << 115   G4double density;  
108   G4int nel;                                   << 116   G4int nel; 
109   G4int ncomponents;                           << 117   G4int ncomponents; 
110   G4double fractionmass;                          118   G4double fractionmass;
111                                                   119 
112   G4NistManager* manager = G4NistManager::Inst    120   G4NistManager* manager = G4NistManager::Instance();
113   //                                              121   //
114   // define Elements                              122   // define Elements
115   //                                              123   //
116   G4Element* elH = manager->FindOrBuildElement << 124   G4Element* elH  = manager->FindOrBuildElement(1);
117   G4Element* elC = manager->FindOrBuildElement << 125   G4Element* elC  = manager->FindOrBuildElement(6);
118   G4Element* elO = manager->FindOrBuildElement << 126   G4Element* elO  = manager->FindOrBuildElement(8);
119   G4Element* elF = manager->FindOrBuildElement << 127   G4Element* elF  = manager->FindOrBuildElement(9);
120   G4Element* elNe = manager->FindOrBuildElemen    128   G4Element* elNe = manager->FindOrBuildElement(10);
121   G4Element* elXe = manager->FindOrBuildElemen    129   G4Element* elXe = manager->FindOrBuildElement(54);
122   //                                              130   //
123   // simple gases at STP conditions            << 131   // simple gases at STP conditions 
124   //                                              132   //
125   G4Material* Argon = manager->FindOrBuildMate    133   G4Material* Argon = manager->FindOrBuildMaterial("G4_Ar");
126   G4Material* Kr = manager->FindOrBuildMateria    134   G4Material* Kr = manager->FindOrBuildMaterial("G4_Kr");
127   G4Material* Xe = manager->FindOrBuildMateria << 135   G4Material* Xe     = manager->FindOrBuildMaterial("G4_Xe");
128   //                                           << 136   // 
129   // gases at STP conditions                      137   // gases at STP conditions
130   //                                              138   //
131   G4Material* CarbonDioxide = manager->FindOrB << 139   G4Material* CarbonDioxide = 
132   G4Material* Mylar = manager->FindOrBuildMate << 140     manager->FindOrBuildMaterial("G4_CARBON_DIOXIDE");
133   G4Material* Methane = manager->FindOrBuildMa << 141   G4Material* Mylar  = manager->FindOrBuildMaterial("G4_MYLAR");
134   G4Material* Propane = manager->FindOrBuildMa << 142   G4Material* Methane= manager->FindOrBuildMaterial("G4_METHANE");
                                                   >> 143   G4Material* Propane= manager->FindOrBuildMaterial("G4_PROPANE");
135                                                   144 
136   // propane at 10 atmospheres                    145   // propane at 10 atmospheres
137   manager->ConstructNewGasMaterial("Propane10" << 146   manager->ConstructNewGasMaterial("Propane10","G4_PROPANE",
                                                   >> 147                                    NTP_Temperature,10.*atmosphere);
138                                                   148 
139   G4Material* empty = manager->FindOrBuildMate << 149   G4Material* empty  = manager->FindOrBuildMaterial("G4_Galactic");
140                                                   150 
141   // 93% Kr + 7% CH4, STP                         151   // 93% Kr + 7% CH4, STP
142   density = 3.491 * mg / cm3;                  << 152   density = 3.491*mg/cm3 ;
143   G4Material* Kr7CH4 = new G4Material(name = " << 153   G4Material* Kr7CH4 = 
144   Kr7CH4->AddMaterial(Kr, fractionmass = 0.986 << 154     new G4Material(name="Kr7CH4"  , density, 
145   Kr7CH4->AddMaterial(Methane, fractionmass =  << 155                    ncomponents=2);
146                                                << 156   Kr7CH4->AddMaterial( Kr,       fractionmass = 0.986 ) ;
147   G4double TRT_Xe_density = 5.485 * mg / cm3;  << 157   Kr7CH4->AddMaterial( Methane,  fractionmass = 0.014 ) ;
148   G4Material* TRT_Xe = new G4Material(name = " << 158 
149                                       293.15 * << 159   G4double TRT_Xe_density = 5.485*mg/cm3;
150   TRT_Xe->AddElement(elXe, 1);                 << 160   G4Material* TRT_Xe = 
151                                                << 161     new G4Material(name="TRT_Xe", TRT_Xe_density, nel=1,
152   G4double TRT_CO2_density = 1.842 * mg / cm3; << 162                    kStateGas,293.15*kelvin,1.*atmosphere);
153   G4Material* TRT_CO2 = new G4Material(name =  << 163   TRT_Xe->AddElement(elXe,1);
154                                        293.15  << 164 
155   TRT_CO2->AddElement(elC, 1);                 << 165   G4double TRT_CO2_density = 1.842*mg/cm3;
156   TRT_CO2->AddElement(elO, 2);                 << 166   G4Material* TRT_CO2 = 
                                                   >> 167     new G4Material(name="TRT_CO2", TRT_CO2_density, nel=2,
                                                   >> 168                    kStateGas,293.15*kelvin,1.*atmosphere);
                                                   >> 169   TRT_CO2->AddElement(elC,1);
                                                   >> 170   TRT_CO2->AddElement(elO,2);
157                                                   171 
158   // check alternative constructor                172   // check alternative constructor
159   std::vector<G4String> trtatom = {"C", "O"};  << 173   std::vector<G4String> trtatom = {"C","O"};
160   std::vector<G4int> trtnum = {1, 2};          << 174   std::vector<G4int> trtnum  = {1, 2};
161   manager->ConstructNewMaterial("TRT_CO2p", tr << 175   manager->ConstructNewMaterial("TRT_CO2p",trtatom,trtnum,TRT_CO2_density,
162                                 NTP_Temperatur << 176                                 true,kStateGas,NTP_Temperature,atmosphere);
163                                                << 177 
164   G4double TRT_CF4_density = 3.9 * mg / cm3;   << 178   G4double TRT_CF4_density = 3.9*mg/cm3;
165   G4Material* TRT_CF4 = new G4Material(name =  << 179   G4Material* TRT_CF4 = 
166                                        293.15  << 180     new G4Material(name="TRT_CF4", TRT_CF4_density, nel=2,
167   TRT_CF4->AddElement(elC, 1);                 << 181                    kStateGas,293.15*kelvin,1.*atmosphere);
168   TRT_CF4->AddElement(elF, 4);                 << 182   TRT_CF4->AddElement(elC,1);
                                                   >> 183   TRT_CF4->AddElement(elF,4);
169                                                   184 
170   // ATLAS TRT straw tube gas mixture (20 C, 1    185   // ATLAS TRT straw tube gas mixture (20 C, 1 atm)
171   G4double XeCO2CF4_density = 4.76 * mg / cm3; << 186   G4double XeCO2CF4_density = 4.76*mg/cm3;
172   G4Material* XeCO2CF4 = new G4Material(name = << 187   G4Material* XeCO2CF4 = 
173                                         kState << 188     new G4Material(name="XeCO2CF4", XeCO2CF4_density,
174   XeCO2CF4->AddMaterial(TRT_Xe, 0.807);        << 189                    ncomponents=3,
175   XeCO2CF4->AddMaterial(TRT_CO2, 0.039);       << 190                    kStateGas,293.15*kelvin,1.*atmosphere);
176   XeCO2CF4->AddMaterial(TRT_CF4, 0.154);       << 191   XeCO2CF4->AddMaterial(TRT_Xe,0.807);
                                                   >> 192   XeCO2CF4->AddMaterial(TRT_CO2,0.039);
                                                   >> 193   XeCO2CF4->AddMaterial(TRT_CF4,0.154);
177                                                   194 
178   // C3H8,20 C, 2 atm                             195   // C3H8,20 C, 2 atm
179   density = 3.758 * mg / cm3;                  << 196   density = 3.758*mg/cm3;
180   G4Material* C3H8 =                           << 197   G4Material* C3H8 = new G4Material(name="C3H8",density,nel=2,
181     new G4Material(name = "C3H8", density, nel << 198                                     kStateGas,293.15*kelvin,2.*atmosphere);
182   C3H8->AddElement(elC, 3);                    << 199   C3H8->AddElement(elC,3);
183   C3H8->AddElement(elH, 8);                    << 200   C3H8->AddElement(elH,8);
184                                                   201 
185   // The same material via different construct    202   // The same material via different constructor
186   std::vector<G4String> elmname = {"C", "H"};  << 203   std::vector<G4String> elmname = {"C","H"};
187   std::vector<G4int> atomnum = {3, 8};         << 204   std::vector<G4int>  atomnum = {3, 8};
188   manager->ConstructNewIdealGasMaterial("C3H8p << 205   manager->ConstructNewIdealGasMaterial("C3H8p",elmname,atomnum,true,
189                                         2. * a << 206                                         293.15*kelvin,2.*atmosphere);
190                                                << 207 
191   // 87.5% Xe + 7.5% CH4 + 5% C3H8, 20 C, 1. a << 208   // 87.5% Xe + 7.5% CH4 + 5% C3H8, 20 C, 1. atm 
192   density = 4.9196 * mg / cm3;                 << 209   density = 4.9196*mg/cm3 ;
193   G4Material* XeCH4C3H8 = new G4Material(name  << 210   G4Material* XeCH4C3H8 = 
194                                          NTP_T << 211     new G4Material(name="XeCH4C3H8"  , 
195   XeCH4C3H8->AddMaterial(Xe, fractionmass = 0. << 212                    density,  ncomponents=3,
196   XeCH4C3H8->AddMaterial(Methane, fractionmass << 213                    kStateGas,NTP_Temperature,1.*atmosphere);
197   XeCH4C3H8->AddMaterial(Propane, fractionmass << 214   XeCH4C3H8->AddMaterial( Xe,      fractionmass = 0.971);
                                                   >> 215   XeCH4C3H8->AddMaterial( Methane, fractionmass = 0.010);
                                                   >> 216   XeCH4C3H8->AddMaterial( Propane, fractionmass = 0.019);
198                                                   217 
199   // 93% Ar + 7% CH4, STP                         218   // 93% Ar + 7% CH4, STP
200   density = 1.709 * mg / cm3;                  << 219   density = 1.709*mg/cm3 ;
201   G4Material* Ar7CH4 = new G4Material(name = " << 220   G4Material* Ar7CH4 = 
202                                       STP_Temp << 221     new G4Material(name="Ar7CH4", density, ncomponents=2,
203   Ar7CH4->AddMaterial(Argon, fractionmass = 0. << 222                    kStateGas,STP_Temperature,STP_Pressure);
204   Ar7CH4->AddMaterial(Methane, fractionmass =  << 223   Ar7CH4->AddMaterial( Argon,    fractionmass = 0.971 ) ;
                                                   >> 224   Ar7CH4->AddMaterial( Methane,  fractionmass = 0.029 ) ;
205                                                   225 
206   // 80% Ar + 20% CO2, STP                        226   // 80% Ar + 20% CO2, STP
207   density = 1.8223 * mg / cm3;                 << 227   density = 1.8223*mg/cm3 ;
208   G4Material* Ar_80CO2_20 = new G4Material(nam << 228   G4Material* Ar_80CO2_20 = 
209                                            STP << 229     new G4Material(name="ArCO2"  , density, ncomponents=2,
210   Ar_80CO2_20->AddMaterial(Argon, fractionmass << 230                    kStateGas,STP_Temperature,STP_Pressure);
211   Ar_80CO2_20->AddMaterial(CarbonDioxide, frac << 231   Ar_80CO2_20->AddMaterial( Argon,           fractionmass = 0.783 ) ;
                                                   >> 232   Ar_80CO2_20->AddMaterial( CarbonDioxide,   fractionmass = 0.217 ) ;
212                                                   233 
213   // 80% Xe + 20% CO2, STP                        234   // 80% Xe + 20% CO2, STP
214   density = 5.0818 * mg / cm3;                 << 235   density = 5.0818*mg/cm3 ;      
215   G4Material* Xe20CO2 = new G4Material(name =  << 236   G4Material* Xe20CO2 = 
216                                        STP_Tem << 237     new G4Material(name="Xe20CO2", density, ncomponents=2,
217   Xe20CO2->AddMaterial(Xe, fractionmass = 0.92 << 238                    kStateGas,STP_Temperature,STP_Pressure);
218   Xe20CO2->AddMaterial(CarbonDioxide, fraction << 239   Xe20CO2->AddMaterial( Xe,            fractionmass = 0.922 ) ;
                                                   >> 240   Xe20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.078 ) ;
219                                                   241 
220   // 80% Kr + 20% CO2, STP                        242   // 80% Kr + 20% CO2, STP
221   density = 3.601 * mg / cm3;                  << 243   density = 3.601*mg/cm3 ;      
222   G4Material* Kr20CO2 = new G4Material(name =  << 244   G4Material* Kr20CO2 = 
223                                        STP_Tem << 245     new G4Material(name="Kr20CO2", density, ncomponents=2,
224   Kr20CO2->AddMaterial(Kr, fractionmass = 0.89 << 246                    kStateGas,STP_Temperature,STP_Pressure);
225   Kr20CO2->AddMaterial(CarbonDioxide, fraction << 247   Kr20CO2->AddMaterial( Kr,            fractionmass = 0.89 ) ;
                                                   >> 248   Kr20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.11 ) ;
226                                                   249 
227   // ALICE mixture TPC_Ne-CO2-2                   250   // ALICE mixture TPC_Ne-CO2-2
228   density = 0.939 * mg / cm3;                  << 251   density = 0.939*mg/cm3 ;      
229   G4Material* NeCO2 = new G4Material(name = "T << 252   G4Material* NeCO2 = 
230                                      NTP_Tempe << 253     new G4Material(name="TPC_Ne-CO2-2", density, ncomponents=3,
231   NeCO2->AddElement(elNe, fractionmass = 0.803 << 254                    kStateGas,NTP_Temperature,1.*atmosphere);
232   NeCO2->AddElement(elO, fractionmass = 0.1426 << 255   NeCO2->AddElement( elNe, fractionmass = 0.8039 ) ;
233   NeCO2->AddElement(elC, fractionmass = 0.0535 << 256   NeCO2->AddElement( elO,  fractionmass = 0.1426 ) ;
                                                   >> 257   NeCO2->AddElement( elC,  fractionmass = 0.0535 ) ;
234                                                   258 
235   // check alternative constructor                259   // check alternative constructor
236   std::vector<G4String> neatom = {"Ne", "O", " << 260   std::vector<G4String> neatom = {"Ne","O","C"};
237   std::vector<G4double> nefr = {0.8039, 0.1426 << 261   std::vector<G4double> nefr   = {0.8039, 0.1426, 0.0536};
238   manager->ConstructNewMaterial("TPC_Ne-CO2-2p << 262   manager->ConstructNewMaterial("TPC_Ne-CO2-2p",neatom,nefr,density,true,
239                                 NTP_Temperatur << 263                                 kStateGas,NTP_Temperature,atmosphere);
240                                                   264 
241   // ALICE TRD mixure 85% Xe + 15% CO2 NTP        265   // ALICE TRD mixure 85% Xe + 15% CO2 NTP
242   density = 4.9389 * mg / cm3;                 << 266   density = 4.9389*mg/cm3 ;      
243   G4Material* Xe15CO2 = new G4Material(name =  << 267   G4Material* Xe15CO2 = 
244                                        NTP_Tem << 268     new G4Material(name="Xe15CO2", density, ncomponents=2,
245   Xe15CO2->AddMaterial(Xe, fractionmass = 0.94 << 269                    kStateGas,NTP_Temperature,atmosphere);
246   Xe15CO2->AddMaterial(CarbonDioxide, fraction << 270   Xe15CO2->AddMaterial( Xe,            fractionmass = 0.944 );
247                                                << 271   Xe15CO2->AddMaterial( CarbonDioxide, fractionmass = 0.056 );
                                                   >> 272    
248   fGasMat = XeCH4C3H8;                            273   fGasMat = XeCH4C3H8;
249   fWindowMat = Mylar;                             274   fWindowMat = Mylar;
250   fWorldMaterial = empty;                      << 275   fWorldMaterial = empty; 
251                                                   276 
252   G4cout << *(G4Material::GetMaterialTable())     277   G4cout << *(G4Material::GetMaterialTable()) << G4endl;
                                                   >> 278 
253 }                                                 279 }
254                                                   280 
255 //....oooOO0OOooo........oooOO0OOooo........oo    281 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
256                                                << 282   
257 G4VPhysicalVolume* DetectorConstruction::Const    283 G4VPhysicalVolume* DetectorConstruction::Construct()
258 {                                                 284 {
259   if (nullptr != fPhysWorld) {                 << 285   G4double contThick = fWindowThick*2 + fGasThickness;
260     return fPhysWorld;                         << 286   G4double contR     = fWindowThick*2 + fGasRadius;
261   }                                            << 
262                                                   287 
263   G4double contThick = fWindowThick * 2 + fGas << 288   G4double worldSizeZ = contThick*1.2;
264   G4double contR = fWindowThick * 2 + fGasRadi << 289   G4double worldSizeR = contR*1.2;
265                                                   290 
266   G4double worldSizeZ = contThick * 1.2;       << 291   TestParameters::GetPointer()->SetPositionZ(-0.55*contThick);
267   G4double worldSizeR = contR * 1.2;           << 
268                                                << 
269   TestParameters::GetPointer()->SetPositionZ(- << 
270                                                   292 
271   // Printout parameters                          293   // Printout parameters
272   G4cout << "\n The  WORLD   is made of " << w << 294   G4cout << "\n The  WORLD   is made of " 
273          << fWorldMaterial->GetName();         << 295          << worldSizeZ/mm << "mm of " << fWorldMaterial->GetName() ;
274   G4cout << ", the transverse size (R) of the  << 296   G4cout << ", the transverse size (R) of the world is " << worldSizeR/mm 
275   G4cout << " The CONTAINER is made of " << fW << 297          << " mm. " << G4endl;
                                                   >> 298   G4cout << " The CONTAINER is made of " 
                                                   >> 299          << fWindowThick/mm << "mm of " << fWindowMat->GetName() << G4endl;
                                                   >> 300   G4cout << " The TARGET is made of " 
                                                   >> 301          << fGasThickness/mm << "mm of " << fGasMat->GetName() ;
                                                   >> 302   G4cout << ", the transverse size (R) is " << fGasRadius/mm << " mm. " 
276          << G4endl;                               303          << G4endl;
277   G4cout << " The TARGET is made of " << fGasT << 
278   G4cout << ", the transverse size (R) is " << << 
279   G4cout << G4endl;                               304   G4cout << G4endl;
280                                                << 305       
281   // World                                        306   // World
282   fSolidWorld = new G4Tubs("World", 0., worldS << 307   fSolidWorld = 
283                                                << 308     new G4Tubs("World",0.,worldSizeR,worldSizeZ/2.,0.,CLHEP::twopi);
                                                   >> 309                    
284   fLogicWorld = new G4LogicalVolume(fSolidWorl    310   fLogicWorld = new G4LogicalVolume(fSolidWorld, fWorldMaterial, "World");
285                                                << 311                                    
286   fPhysWorld = new G4PVPlacement(0, G4ThreeVec << 312   fPhysWorld = new G4PVPlacement(0,      
                                                   >> 313                                    G4ThreeVector(0.,0.,0.),     
                                                   >> 314                                  "World", 
                                                   >> 315                                  fLogicWorld,
                                                   >> 316                                  0,      
                                                   >> 317                                  false,  
                                                   >> 318                                  0);     
287                                                   319 
288   // Window                                       320   // Window
289   fSolidContainer = new G4Tubs("Absorber", 0., << 321   fSolidContainer = new G4Tubs("Absorber",                
290                                                << 322                                0.,contR,contThick/2.,0.,CLHEP::twopi); 
291   fLogicContainer = new G4LogicalVolume(fSolid << 
292                                                   323 
293   G4PVPlacement* PhysWind = new G4PVPlacement( << 324   fLogicContainer = new G4LogicalVolume(fSolidContainer, fWindowMat, "Window"); 
294                                                << 
295                                                   325 
                                                   >> 326   G4PVPlacement* PhysWind = new G4PVPlacement(0, G4ThreeVector(0.,0.,0.),
                                                   >> 327                                               "Window",  fLogicContainer,
                                                   >> 328                                               fPhysWorld, false, 0);
                                                   >> 329                                         
296   // Detector volume                              330   // Detector volume
297   fSolidDetector = new G4Tubs("Gas", 0., fGasR << 331   fSolidDetector = new G4Tubs("Gas", 0., fGasRadius, fGasThickness/2.,
                                                   >> 332                               0., CLHEP::twopi); 
298                                                   333 
299   fLogicDetector = new G4LogicalVolume(fSolidD << 334   fLogicDetector = new G4LogicalVolume(fSolidDetector, fGasMat, "Gas"); 
300                                                   335 
301   new G4PVPlacement(0, G4ThreeVector(0., 0., 0 << 336   new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), "Gas", fLogicDetector, 
                                                   >> 337                     PhysWind, false, 0);
302                                                   338 
303   // defined gas detector region                  339   // defined gas detector region
304   fRegGasDet = new G4Region("GasDetector");       340   fRegGasDet = new G4Region("GasDetector");
305   fRegGasDet->SetProductionCuts(fGasDetectorCu    341   fRegGasDet->SetProductionCuts(fGasDetectorCuts);
306   fRegGasDet->AddRootLogicalVolume(fLogicDetec    342   fRegGasDet->AddRootLogicalVolume(fLogicDetector);
307                                                   343 
308   // visualisation                                344   // visualisation
309   fLogicWorld->SetVisAttributes(G4VisAttribute    345   fLogicWorld->SetVisAttributes(G4VisAttributes::GetInvisible());
310   G4VisAttributes* color1 = new G4VisAttribute    346   G4VisAttributes* color1 = new G4VisAttributes(G4Colour(0.3, 0.3, 0.3));
311   fLogicContainer->SetVisAttributes(color1);      347   fLogicContainer->SetVisAttributes(color1);
312   G4VisAttributes* color2 = new G4VisAttribute    348   G4VisAttributes* color2 = new G4VisAttributes(G4Colour(0.0, 0.3, 0.7));
313   fLogicDetector->SetVisAttributes(color2);       349   fLogicDetector->SetVisAttributes(color2);
314                                                   350 
315   if (0.0 == fGasMat->GetIonisation()->GetMean << 351   if(0.0 == fGasMat->GetIonisation()->GetMeanEnergyPerIonPair()) {
316     SetPairEnergy(20 * eV);                    << 352     SetPairEnergy(20*eV);
317   }                                               353   }
318   return fPhysWorld;                              354   return fPhysWorld;
319 }                                                 355 }
320                                                   356 
321 //....oooOO0OOooo........oooOO0OOooo........oo    357 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
322                                                   358 
323 void DetectorConstruction::ConstructSDandField    359 void DetectorConstruction::ConstructSDandField()
324 {                                              << 360 { 
325   auto sd = new TargetSD("GasSD");                361   auto sd = new TargetSD("GasSD");
326   G4SDManager::GetSDMpointer()->AddNewDetector    362   G4SDManager::GetSDMpointer()->AddNewDetector(sd);
327   SetSensitiveDetector(fLogicDetector, sd);    << 363   SetSensitiveDetector(fLogicDetector, sd); 
328 }                                                 364 }
329                                                   365 
330 //....oooOO0OOooo........oooOO0OOooo........oo    366 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
331                                                   367 
332 void DetectorConstruction::SetGasMaterial(cons    368 void DetectorConstruction::SetGasMaterial(const G4String& name)
333 {                                                 369 {
334   // get the pointer to the existing material     370   // get the pointer to the existing material
335   G4Material* mat = G4Material::GetMaterial(na    371   G4Material* mat = G4Material::GetMaterial(name, false);
336                                                   372 
337   // create the material by its name              373   // create the material by its name
338   if (!mat) {                                  << 374   if(!mat) { mat = G4NistManager::Instance()->FindOrBuildMaterial(name); }
339     mat = G4NistManager::Instance()->FindOrBui << 
340   }                                            << 
341                                                   375 
342   if (mat && mat != fGasMat) {                    376   if (mat && mat != fGasMat) {
343     G4cout << "### New target material: " << m    377     G4cout << "### New target material: " << mat->GetName() << G4endl;
344     fGasMat = mat;                                378     fGasMat = mat;
345     if (fLogicDetector) {                      << 379     if(fLogicDetector) { 
346       fLogicDetector->SetMaterial(mat);        << 380       fLogicDetector->SetMaterial(mat); 
347       G4RunManager::GetRunManager()->PhysicsHa    381       G4RunManager::GetRunManager()->PhysicsHasBeenModified();
348     }                                             382     }
349   }                                               383   }
350 }                                                 384 }
351                                                   385 
352 //....oooOO0OOooo........oooOO0OOooo........oo    386 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
353                                                   387 
354 void DetectorConstruction::SetContainerMateria    388 void DetectorConstruction::SetContainerMaterial(const G4String& name)
355 {                                                 389 {
356   // get the pointer to the existing material     390   // get the pointer to the existing material
357   G4Material* mat = G4Material::GetMaterial(na    391   G4Material* mat = G4Material::GetMaterial(name, false);
358                                                   392 
359   // create the material by its name              393   // create the material by its name
360   if (!mat) {                                  << 394   if(!mat) { mat = G4NistManager::Instance()->FindOrBuildMaterial(name); }
361     mat = G4NistManager::Instance()->FindOrBui << 
362   }                                            << 
363                                                   395 
364   if (mat && mat != fWindowMat) {                 396   if (mat && mat != fWindowMat) {
365     G4cout << "### New material for container:    397     G4cout << "### New material for container: " << mat->GetName() << G4endl;
366     fWindowMat = mat;                             398     fWindowMat = mat;
367     if (fLogicContainer) {                     << 399     if(fLogicContainer) { 
368       fLogicContainer->SetMaterial(mat);       << 400       fLogicContainer->SetMaterial(mat); 
369       G4RunManager::GetRunManager()->PhysicsHa    401       G4RunManager::GetRunManager()->PhysicsHasBeenModified();
370     }                                             402     }
371   }                                               403   }
372 }                                                 404 }
373                                                   405 
374 //....oooOO0OOooo........oooOO0OOooo........oo    406 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
375                                                   407 
376 void DetectorConstruction::SetWorldMaterial(co    408 void DetectorConstruction::SetWorldMaterial(const G4String& name)
377 {                                                 409 {
378   // get the pointer to the existing material     410   // get the pointer to the existing material
379   G4Material* mat = G4Material::GetMaterial(na    411   G4Material* mat = G4Material::GetMaterial(name, false);
380                                                   412 
381   // create the material by its name              413   // create the material by its name
382   if (!mat) {                                  << 414   if(!mat) { mat = G4NistManager::Instance()->FindOrBuildMaterial(name); }
383     mat = G4NistManager::Instance()->FindOrBui << 
384   }                                            << 
385                                                   415 
386   if (mat && mat != fWorldMaterial) {             416   if (mat && mat != fWorldMaterial) {
387     G4cout << "### New World material: " << ma    417     G4cout << "### New World material: " << mat->GetName() << G4endl;
388     fWorldMaterial = mat;                         418     fWorldMaterial = mat;
389     if (fLogicWorld) {                         << 419     if(fLogicWorld) { 
390       fLogicWorld->SetMaterial(mat);           << 420       fLogicWorld->SetMaterial(mat); 
391       G4RunManager::GetRunManager()->PhysicsHa    421       G4RunManager::GetRunManager()->PhysicsHasBeenModified();
392     }                                             422     }
393   }                                               423   }
394 }                                                 424 }
395                                                   425 
396 //....oooOO0OOooo........oooOO0OOooo........oo    426 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
397                                                   427 
398 void DetectorConstruction::SetGasThickness(G4d    428 void DetectorConstruction::SetGasThickness(G4double val)
399 {                                                 429 {
400   if (val <= 0.0) {                            << 
401     return;                                    << 
402   }                                            << 
403   fGasThickness = val;                            430   fGasThickness = val;
404   if (nullptr != fPhysWorld) {                 << 431   if(fPhysWorld) { ChangeGeometry(); }
405     ChangeGeometry();                          << 432 }  
406   }                                            << 
407 }                                              << 
408                                                   433 
409 //....oooOO0OOooo........oooOO0OOooo........oo    434 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
410                                                   435 
411 void DetectorConstruction::SetGasRadius(G4doub    436 void DetectorConstruction::SetGasRadius(G4double val)
412 {                                                 437 {
413   if (val <= 0.0) {                            << 
414     return;                                    << 
415   }                                            << 
416   fGasRadius = val;                               438   fGasRadius = val;
417   if (nullptr != fPhysWorld) {                 << 439   if(fPhysWorld) { ChangeGeometry(); }
418     ChangeGeometry();                          << 440 }  
419   }                                            << 
420 }                                              << 
421                                                   441 
422 //....oooOO0OOooo........oooOO0OOooo........oo    442 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
423                                                   443 
424 void DetectorConstruction::SetContainerThickne    444 void DetectorConstruction::SetContainerThickness(G4double val)
425 {                                                 445 {
426   if (val <= 0.0) {                            << 
427     return;                                    << 
428   }                                            << 
429   fWindowThick = val;                             446   fWindowThick = val;
430   if (nullptr != fPhysWorld) {                 << 447   if(fPhysWorld) { ChangeGeometry(); }
431     ChangeGeometry();                          << 448 }  
432   }                                            << 
433 }                                              << 
434                                                   449 
435 //....oooOO0OOooo........oooOO0OOooo........oo    450 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
436                                                   451 
437 void DetectorConstruction::SetPairEnergy(G4dou    452 void DetectorConstruction::SetPairEnergy(G4double val)
438 {                                                 453 {
439   if (val > 0.0) {                             << 454   if(val > 0.0) {
440     fGasMat->GetIonisation()->SetMeanEnergyPer    455     fGasMat->GetIonisation()->SetMeanEnergyPerIonPair(val);
441   }                                               456   }
442 }                                                 457 }
443                                                   458 
444 //....oooOO0OOooo........oooOO0OOooo........oo    459 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
445                                                   460 
446 void DetectorConstruction::ChangeGeometry()       461 void DetectorConstruction::ChangeGeometry()
447 {                                                 462 {
448   G4double contThick = fWindowThick * 2 + fGas << 463   G4double contThick = fWindowThick*2 + fGasThickness;
449   G4double contR = fWindowThick * 2 + fGasRadi << 464   G4double contR     = fWindowThick*2 + fGasRadius;
450                                                   465 
451   G4double worldSizeZ = contThick * 1.2;       << 466   G4double worldSizeZ = contThick*1.2;
452   G4double worldSizeR = contR * 1.2;           << 467   G4double worldSizeR = contR*1.2;
453                                                   468 
454   TestParameters::GetPointer()->SetPositionZ(- << 469   TestParameters::GetPointer()->SetPositionZ(-0.55*contThick);
455                                                   470 
456   fSolidWorld->SetOuterRadius(worldSizeR);        471   fSolidWorld->SetOuterRadius(worldSizeR);
457   fSolidWorld->SetZHalfLength(worldSizeZ * 0.5 << 472   fSolidWorld->SetZHalfLength(worldSizeZ*0.5);
458                                                   473 
459   fSolidContainer->SetOuterRadius(contR);         474   fSolidContainer->SetOuterRadius(contR);
460   fSolidContainer->SetZHalfLength(contThick *  << 475   fSolidContainer->SetZHalfLength(contThick*0.5);
461                                                   476 
462   fSolidDetector->SetOuterRadius(fGasRadius);     477   fSolidDetector->SetOuterRadius(fGasRadius);
463   fSolidDetector->SetZHalfLength(fGasThickness << 478   fSolidDetector->SetZHalfLength(fGasThickness*0.5);
464 }                                                 479 }
465                                                   480 
466 //....oooOO0OOooo........oooOO0OOooo........oo    481 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
467                                                   482