Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/hadronic/ParticleFluence/Calo/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/hadronic/ParticleFluence/Calo/src/DetectorConstruction.cc (Version 11.3.0) and /examples/extended/hadronic/ParticleFluence/Calo/src/DetectorConstruction.cc (Version 11.1.2)


  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 DetectorConstruction.hh                  26 /// \file DetectorConstruction.hh
 27 /// \brief Definition of the DetectorConstruct     27 /// \brief Definition of the DetectorConstruction class
 28 //                                                 28 //
 29 //                                             <<  29 // 
 30                                                    30 
 31 //....oooOO0OOooo........oooOO0OOooo........oo     31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32 //....oooOO0OOooo........oooOO0OOooo........oo     32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 33                                                    33 
 34 #include "DetectorConstruction.hh"                 34 #include "DetectorConstruction.hh"
 35                                                <<  35 #include "G4Material.hh"
 36 #include "DetectorMessenger.hh"                << 
 37 #include "PrimaryGeneratorAction.hh"           << 
 38                                                << 
 39 #include "G4Box.hh"                                36 #include "G4Box.hh"
                                                   >>  37 #include "G4Tubs.hh"
 40 #include "G4Cons.hh"                               38 #include "G4Cons.hh"
 41 #include "G4FieldManager.hh"                   << 
 42 #include "G4GeometryManager.hh"                << 
 43 #include "G4LogicalVolume.hh"                      39 #include "G4LogicalVolume.hh"
 44 #include "G4LogicalVolumeStore.hh"             <<  40 #include "G4ThreeVector.hh"
 45 #include "G4Material.hh"                       << 
 46 #include "G4PVPlacement.hh"                        41 #include "G4PVPlacement.hh"
 47 #include "G4PVReplica.hh"                      <<  42 #include "globals.hh"
 48 #include "G4PhysicalConstants.hh"              << 
 49 #include "G4PhysicalVolumeStore.hh"            << 
 50 #include "G4RotationMatrix.hh"                     43 #include "G4RotationMatrix.hh"
 51 #include "G4RunManager.hh"                     <<  44 #include "G4PVReplica.hh"
                                                   >>  45 #include "G4UniformMagField.hh"
                                                   >>  46 #include "G4FieldManager.hh"
                                                   >>  47 #include "G4TransportationManager.hh"
                                                   >>  48 #include "DetectorMessenger.hh"
 52 #include "G4SDManager.hh"                          49 #include "G4SDManager.hh"
                                                   >>  50 #include "G4GeometryManager.hh"
                                                   >>  51 #include "G4PhysicalVolumeStore.hh"
                                                   >>  52 #include "G4LogicalVolumeStore.hh"
 53 #include "G4SolidStore.hh"                         53 #include "G4SolidStore.hh"
                                                   >>  54 #include "G4RunManager.hh"
 54 #include "G4SystemOfUnits.hh"                      55 #include "G4SystemOfUnits.hh"
 55 #include "G4ThreeVector.hh"                    <<  56 #include "G4PhysicalConstants.hh"
 56 #include "G4TransportationManager.hh"          <<  57 #include "PrimaryGeneratorAction.hh"
 57 #include "G4Tubs.hh"                           << 
 58 #include "G4UniformMagField.hh"                << 
 59 #include "globals.hh"                          << 
 60                                                    58 
 61 //....oooOO0OOooo........oooOO0OOooo........oo     59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 62                                                    60 
 63 DetectorConstruction::DetectorConstruction()   <<  61 DetectorConstruction::DetectorConstruction() :  
 64   : fVacuum(nullptr),                          <<  62   fVacuum( nullptr ), fIron( nullptr ), fCopper( nullptr ), fTungsten( nullptr ),
 65     fIron(nullptr),                            <<  63   fLead( nullptr ), fUranium( nullptr ), fPbWO4( nullptr ), fPolystyrene( nullptr ),
 66     fCopper(nullptr),                          <<  64   fLiquidArgon( nullptr ), fSilicon( nullptr ), fQuartz( nullptr ), fBrass( nullptr ),
 67     fTungsten(nullptr),                        <<  65   fAluminium( nullptr ), fGraphite( nullptr ),
 68     fLead(nullptr),                            <<  66   fAbsorberMaterial( nullptr ), fActiveMaterial( nullptr ),
 69     fUranium(nullptr),                         <<  67   fExperimentalHall_log( nullptr ), fExperimentalHall_phys( nullptr ),
 70     fPbWO4(nullptr),                           <<  68   fLogicCalo( nullptr ), fPhysiCalo( nullptr ),
 71     fPolystyrene(nullptr),                     <<  69   fLogicModule( nullptr ), fPhysiModule( nullptr ),
 72     fLiquidArgon(nullptr),                     <<  70   fLogicAbsorber( nullptr ), fPhysiAbsorber( nullptr ),
 73     fSilicon(nullptr),                         <<  71   fLogicActive( nullptr ), fPhysiActive( nullptr ),
 74     fQuartz(nullptr),                          <<  72   fFieldMgr( nullptr ), fUniformMagField( nullptr ), 
 75     fBrass(nullptr),                           <<  73   fDetectorMessenger( nullptr ), 
 76     fAluminium(nullptr),                       <<  74   // Default values.  ***LOOKHERE***
 77     fGraphite(nullptr),                        <<  75   fIsCalHomogeneous( false ),    // Sampling calorimeter.
 78     fAbsorberMaterial(nullptr),                <<  76   fIsUnitInLambda( false ),      // Unit of length for the absorber total length.
 79     fActiveMaterial(nullptr),                  <<  77   fAbsorberTotalLength( 2.0*CLHEP::m ), 
 80     fExperimentalHall_log(nullptr),            <<  78   fCalorimeterRadius( 1.0*CLHEP::m ), 
 81     fExperimentalHall_phys(nullptr),           <<  79   fActiveLayerNumber( 50 ),
 82     fLogicCalo(nullptr),                       <<  80   fActiveLayerSize( 4.0*CLHEP::mm ),
 83     fPhysiCalo(nullptr),                       <<  81   fIsRadiusUnitInLambda( false ), // Unit of length for the radius bin size.
 84     fLogicModule(nullptr),                     <<  82   // Extra
 85     fPhysiModule(nullptr),                     <<  83   fCaloLength( 2.0*CLHEP::m ),
 86     fLogicAbsorber(nullptr),                   <<  84   // Scoring part
 87     fPhysiAbsorber(nullptr),                   <<  85   fLogicScoringUpDown( nullptr ),
 88     fLogicActive(nullptr),                     <<  86   fPhysiScoringUpstream( nullptr ),
 89     fPhysiActive(nullptr),                     <<  87   fPhysiScoringDownstream( nullptr ),
 90     fFieldMgr(nullptr),                        <<  88   fLogicScoringSide( nullptr ),
 91     fUniformMagField(nullptr),                 <<  89   fPhysiScoringSide( nullptr )
 92     fDetectorMessenger(nullptr),               << 
 93     // Default values.  ***LOOKHERE***         << 
 94     fIsCalHomogeneous(false),  // Sampling cal << 
 95     fIsUnitInLambda(false),  // Unit of length << 
 96     fAbsorberTotalLength(2.0 * CLHEP::m),      << 
 97     fCalorimeterRadius(1.0 * CLHEP::m),        << 
 98     fActiveLayerNumber(50),                    << 
 99     fActiveLayerSize(4.0 * CLHEP::mm),         << 
100     fIsRadiusUnitInLambda(false),  // Unit of  << 
101     // Extra                                   << 
102     fCaloLength(2.0 * CLHEP::m),               << 
103     // Scoring part                            << 
104     fLogicScoringUpDown(nullptr),              << 
105     fPhysiScoringUpstream(nullptr),            << 
106     fPhysiScoringDownstream(nullptr),          << 
107     fLogicScoringSide(nullptr),                << 
108     fPhysiScoringSide(nullptr)                 << 
109 {                                                  90 {
110   fFieldMgr = G4TransportationManager::GetTran     91   fFieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
111   DefineMaterials();                               92   DefineMaterials();
112   fAbsorberMaterial = fIron;                       93   fAbsorberMaterial = fIron;
113   fActiveMaterial = fPolystyrene;                  94   fActiveMaterial = fPolystyrene;
114   fDetectorMessenger = new DetectorMessenger(t <<  95   fDetectorMessenger = new DetectorMessenger( this );
115 }                                                  96 }
116                                                    97 
117 //....oooOO0OOooo........oooOO0OOooo........oo     98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
118                                                    99 
119 DetectorConstruction::~DetectorConstruction()  << 100 DetectorConstruction::~DetectorConstruction() {
120 {                                              << 
121   delete fDetectorMessenger;                      101   delete fDetectorMessenger;
122   delete fUniformMagField;                        102   delete fUniformMagField;
123 }                                                 103 }
124                                                   104 
125 //....oooOO0OOooo........oooOO0OOooo........oo    105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
126                                                   106 
127 G4VPhysicalVolume* DetectorConstruction::Const << 107 G4VPhysicalVolume* DetectorConstruction::Construct() {
128 {                                              << 
129   return ConstructCalorimeter();                  108   return ConstructCalorimeter();
130 }                                                 109 }
131                                                   110 
132 //....oooOO0OOooo........oooOO0OOooo........oo    111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
133                                                   112 
134 void DetectorConstruction::ConstructSDandField    113 void DetectorConstruction::ConstructSDandField() {}
135                                                   114 
136 //....oooOO0OOooo........oooOO0OOooo........oo    115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
137                                                   116 
138 void DetectorConstruction::DefineMaterials()   << 117 void DetectorConstruction::DefineMaterials() { 
139 {                                              << 
140   G4double a;  // atomic mass                     118   G4double a;  // atomic mass
141   G4double z;  // atomic number                   119   G4double z;  // atomic number
142   G4double density, pressure, temperature, fra    120   G4double density, pressure, temperature, fractionmass;
143   G4String name, symbol;                          121   G4String name, symbol;
144   G4int nel, natoms;                              122   G4int nel, natoms;
145                                                   123 
146   //--- elements                                  124   //--- elements
147                                                   125 
148   a = 1.01 * g / mole;                         << 126   a = 1.01*g/mole;
149   G4Element* elH = new G4Element(name = "Hydro << 127   G4Element* elH = new G4Element( name="Hydrogen", symbol="H2", z=1., a );
150                                                   128 
151   a = 2.01 * g / mole;                         << 129   a = 2.01*g/mole;
152   // G4Element* elD = new G4Element( name="Deu << 130   //G4Element* elD = new G4Element( name="Deuterium", symbol="D", z=1., a );
153                                                   131 
154   a = 4. * g / mole;                           << 132   a = 4.*g/mole;
155   // G4Element* elHe = new G4Element( name="He << 133   //G4Element* elHe = new G4Element( name="Helium", symbol="He", z=2., a );
156                                                   134 
157   a = 6.94 * g / mole;                         << 135   a = 6.94*g/mole;
158   // G4Element* elLi = new G4Element( name="Li << 136   //G4Element* elLi = new G4Element( name="Lithium", symbol="Li", z=3., a );
159                                                   137 
160   a = 9.01 * g / mole;                         << 138   a = 9.01*g/mole;
161   // G4Element* elBe = new G4Element( name="Be << 139   //G4Element* elBe = new G4Element( name="Berillium", symbol="Be", z=4., a );
162                                                   140 
163   a = 12.01 * g / mole;                        << 141   a = 12.01*g/mole;
164   G4Element* elC = new G4Element(name = "Carbo << 142   G4Element* elC = new G4Element( name="Carbon", symbol="C", z=6., a );
165                                                   143 
166   a = 14.01 * g / mole;                        << 144   a = 14.01*g/mole;
167   G4Element* elN = new G4Element(name = "Nitro << 145   G4Element* elN = new G4Element( name="Nitrogen", symbol="N2", z=7., a );
168                                                   146 
169   a = 16. * g / mole;                          << 147   a = 16.*g/mole;
170   G4Element* elO = new G4Element(name = "Oxyge << 148   G4Element* elO = new G4Element( name="Oxygen", symbol="O2", z=8., a );
171                                                   149 
172   a = 20.18 * g / mole;                        << 150   a = 20.18*g/mole;
173   // G4Element* elNe = new G4Element( name="Ne << 151   //G4Element* elNe = new G4Element( name="Neon", symbol="Ne", z=10., a );
174                                                   152 
175   a = 22.99 * g / mole;                        << 153   a = 22.99*g/mole;
176   // G4Element* elNa = new G4Element( name="So << 154   //G4Element* elNa = new G4Element( name="Sodium", symbol="Na", z=11., a );
177                                                   155 
178   a = 26.98 * g / mole;                        << 156   a = 26.98*g/mole;
179   // G4Element* elAl = new G4Element( name="Al << 157   //G4Element* elAl = new G4Element( name="Aluminium", symbol="Al", z=13., a );
180                                                   158 
181   a = 28.085 * g / mole;                       << 159   a = 28.085*g/mole;
182   G4Element* elSi = new G4Element(name = "Sili << 160   G4Element* elSi = new G4Element( name="Silicon", symbol="Si", z=14., a );
183                                                   161 
184   a = 40.08 * g / mole;                        << 162   a = 40.08*g/mole;
185   // G4Element* elCa = new G4Element( name="Ca << 163   //G4Element* elCa = new G4Element( name="Calcium", symbol="Ca", z=20., a );
186                                                   164 
187   a = 55.850 * g / mole;                       << 165   a = 55.850*g/mole;
188   // G4Element* elFe = new G4Element( name="Ir << 166   //G4Element* elFe = new G4Element( name="Iron", symbol="Fe", z=26., a );
189                                                   167 
190   a = 63.54 * g / mole;                        << 168   a = 63.54*g/mole;
191   G4Element* elCu = new G4Element(name = "Copp << 169   G4Element* elCu = new G4Element( name="Copper", symbol="Cu", z=29., a );
192                                                   170 
193   a = 65.41 * g / mole;                        << 171   a = 65.41*g/mole; 
194   G4Element* elZn = new G4Element(name = "Zinc << 172   G4Element* elZn = new G4Element( name="Zinc", symbol="Zn", z=30., a );
195                                                   173 
196   a = 183.85 * g / mole;                       << 174   a = 183.85*g/mole;
197   G4Element* elW = new G4Element(name = "Tungs << 175   G4Element* elW = new G4Element( name="Tungstenm", symbol="W", z=74., a );
198                                                   176 
199   a = 207.19 * g / mole;                       << 177   a = 207.19*g/mole;
200   G4Element* elPb = new G4Element(name = "Lead << 178   G4Element* elPb = new G4Element( name="Lead", symbol="Pb", z=82., a );
201                                                   179 
202   a = 238.03 * g / mole;                       << 180   a = 238.03*g/mole;
203   // G4Element* elU = new G4Element(name="Uran << 181   //G4Element* elU = new G4Element(name="Uranium", symbol="U", z=92., a);
204                                                   182 
205   //--- simple materials                          183   //--- simple materials
206                                                   184 
207   // Iron has a  X0 = 1.7585 cm  and  lambda_I << 185   // Iron has a  X0 = 1.7585 cm  and  lambda_I = 16.760 cm.   
208   density = 7.87 * g / cm3;                    << 186   density = 7.87*g/cm3;
209   a = 55.85 * g / mole;                        << 187   a = 55.85*g/mole;
210   fIron = new G4Material(name = "Iron", z = 26 << 188   fIron = new G4Material( name="Iron", z=26., a, density );
211                                                << 189 
212   // Copper has a  X0 = 1.4353 cm  and  lambda << 190   // Copper has a  X0 = 1.4353 cm  and  lambda_I = 15.056 cm.   
213   density = 8.96 * g / cm3;                    << 191   density = 8.96*g/cm3;
214   a = 63.54 * g / mole;                        << 192   a = 63.54*g/mole;
215   fCopper = new G4Material(name = "Copper", z  << 193   fCopper = new G4Material( name="Copper", z=29., a, density );
216                                                << 194 
217   // Tungsten has a  X0 = 0.35 cm  and  lambda << 195   // Tungsten has a  X0 = 0.35 cm  and  lambda_I = 9.5855 cm. 
218   density = 19.3 * g / cm3;                    << 196   density = 19.3*g/cm3;
219   a = 183.85 * g / mole;                       << 197   a = 183.85*g/mole;
220   fTungsten = new G4Material(name = "Tungsten" << 198   fTungsten = new G4Material( name="Tungsten", z=74., a, density );
221                                                << 199 
222   // Lead has a  X0 = 0.56120 cm  and  lambda_ << 200   // Lead has a  X0 = 0.56120 cm  and  lambda_I = 17.092 cm.  
223   density = 11.35 * g / cm3;                   << 201   density = 11.35*g/cm3;
224   a = 207.19 * g / mole;                       << 202   a = 207.19*g/mole;
225   fLead = new G4Material(name = "Lead", z = 82 << 203   fLead = new G4Material( name="Lead", z=82., a, density );
226                                                << 204 
227   // Uranium has a  X0 = 0.31662 cm  and  lamb << 205   // Uranium has a  X0 = 0.31662 cm  and  lambda_I = 10.501 cm.  
228   density = 18.95 * g / cm3;                   << 206   density =  18.95*g/cm3;
229   a = 238.03 * g / mole;                       << 207   a = 238.03*g/mole;
230   fUranium = new G4Material(name = "Uranium",  << 208   fUranium = new G4Material( name="Uranium", z=92., a, density );
231                                                << 209 
232   // Liquid Argon has a  X0 = 10.971 cm  and   << 210   // Liquid Argon has a  X0 = 10.971 cm  and  lambda_I = 65.769 cm.  
233   density = 1.4 * g / cm3;                     << 211   density = 1.4*g/cm3;
234   a = 39.95 * g / mole;                        << 212   a = 39.95*g/mole;
235   fLiquidArgon = new G4Material(name = "Liquid << 213   fLiquidArgon = new G4Material( name="LiquidArgon", z=18., a, density );
236                                                << 214 
237   density = 0.002 * g / cm3;                   << 215   density = 0.002*g/cm3;
238   a = 39.95 * g / mole;                        << 216   a = 39.95*g/mole;
239   // G4Material* ArgonGas = new G4Material( na << 217   //G4Material* ArgonGas = new G4Material( name="ArgonGas", z=18., a, density );
240                                                << 218 
241   // Silicon has a  X0 = 9.3688 cm  and  lambd << 219   // Silicon has a  X0 = 9.3688 cm  and  lambda_I = 46.5436 cm 
242   density = 2.33 * g / cm3;                    << 220   density = 2.33*g/cm3;
243   a = 28.085 * g / mole;                       << 221   a = 28.085*g/mole;
244   fSilicon = new G4Material(name = "Silicon",  << 222   fSilicon = new G4Material( name="Silicon", z=14., a, density );
245                                                << 223   
246   // Aluminium has a  X0 = 8.8959 cm  and  lam    224   // Aluminium has a  X0 = 8.8959 cm  and  lambda_I = 39.7184 cm
247   density = 2.7 * g / cm3;                     << 225   density = 2.7*g/cm3;
248   a = 26.98 * g / mole;                        << 226   a = 26.98*g/mole;
249   fAluminium = new G4Material(name = "Aluminiu << 227   fAluminium = new G4Material( name="Aluminium", z=13., a, density );
250                                                << 228   
251   // Graphite has a  X0 = 19.3213 cm  and  lam    229   // Graphite has a  X0 = 19.3213 cm  and  lambda_I = 38.8235 cm
252   density = 2.210 * g / cm3;                   << 230   density = 2.210*g/cm3;
253   a = 12.0107 * g / mole;                      << 231   a = 12.0107*g/mole;
254   fGraphite = new G4Material(name = "Graphite" << 232   fGraphite = new G4Material( name="Graphite", z=6., a, density );
255                                                << 233 
256   density = 8.96 * g / cm3;                    << 234   density = 8.96*g/cm3;
257   a = 58.69 * g / mole;                        << 235   a = 58.69*g/mole;
258   // G4Material* Nickel = new G4Material( name << 236   //G4Material* Nickel = new G4Material( name="Nickel", z=28., a, density );
259                                                   237 
260   //--- mixtures                                  238   //--- mixtures
261                                                   239 
262   density = 1.290 * mg / cm3;                  << 240   density = 1.290*mg/cm3;
263   G4Material* Air = new G4Material(name = "Air << 241   G4Material* Air = new G4Material( name="Air", density, nel=2 );
264   Air->AddElement(elN, 0.7);                      242   Air->AddElement(elN, 0.7);
265   Air->AddElement(elO, 0.3);                      243   Air->AddElement(elO, 0.3);
266                                                   244 
267   density = 1.e-5 * g / cm3;                   << 245   density     = 1.e-5*g/cm3;
268   pressure = 2.e-2 * bar;                      << 246   pressure    = 2.e-2*bar;
269   temperature = STP_Temperature;  // From Phys    247   temperature = STP_Temperature;  // From PhysicalConstants.h .
270   fVacuum = new G4Material(name = "Vacuum", de << 248   fVacuum = new G4Material( name="Vacuum", density, nel=1,
271   fVacuum->AddMaterial(Air, fractionmass = 1.) << 249                             kStateGas, temperature, pressure );
                                                   >> 250   fVacuum->AddMaterial( Air, fractionmass=1. );
272                                                   251 
273   // Plastic scintillator tiles (used both in     252   // Plastic scintillator tiles (used both in CMS hadron calorimeter
274   // and ATLAS hadron barrel calorimeter):     << 253   // and ATLAS hadron barrel calorimeter): 
275   //     X0 = 42.4 cm  and  lambda_I = 79.360  << 254   //     X0 = 42.4 cm  and  lambda_I = 79.360 cm.  
276   density = 1.032 * g / cm3;                   << 255   density = 1.032*g/cm3;
277   fPolystyrene = new G4Material(name = "Polyst << 256   fPolystyrene = new G4Material( name="Polystyrene", density, nel=2 );
278   fPolystyrene->AddElement(elC, natoms = 19);  << 257   fPolystyrene->AddElement( elC, natoms=19 );
279   fPolystyrene->AddElement(elH, natoms = 21);  << 258   fPolystyrene->AddElement( elH, natoms=21 );
280                                                << 259 
281   // PbWO4 CMS crystals. It has a  X0 = 0.89 c << 260   // PbWO4 CMS crystals. It has a  X0 = 0.89 cm  and  lambda_I = 22.4 cm. 
282   density = 8.28 * g / cm3;                    << 261   density = 8.28*g/cm3;
283   fPbWO4 = new G4Material(name = "PbWO4", dens << 262   fPbWO4 = new G4Material( name="PbWO4", density, nel=3 );
284   fPbWO4->AddElement(elPb, natoms = 1);        << 263   fPbWO4->AddElement( elPb, natoms=1 );
285   fPbWO4->AddElement(elW, natoms = 1);         << 264   fPbWO4->AddElement( elW,  natoms=1 );
286   fPbWO4->AddElement(elO, natoms = 4);         << 265   fPbWO4->AddElement( elO,  natoms=4 );
287                                                << 266 
288   fQuartz = new G4Material(name = "Quartz", de << 267   fQuartz = new G4Material( name="Quartz", density=2.200*g/cm3, nel=2 );
289   fQuartz->AddElement(elSi, 1);                << 268   fQuartz->AddElement( elSi, 1 );
290   fQuartz->AddElement(elO, 2);                 << 269   fQuartz->AddElement( elO , 2 );
291                                                << 270 
292   fBrass = new G4Material(name = "Brass", dens << 271   fBrass = new G4Material( name="Brass", density=8.6*g/cm3, nel=2 );
293   fBrass->AddElement(elCu, 0.7);               << 272   fBrass->AddElement( elCu, 0.7 );
294   fBrass->AddElement(elZn, 0.3);               << 273   fBrass->AddElement( elZn, 0.3 );  
295 }                                                 274 }
296                                                   275 
297 //....oooOO0OOooo........oooOO0OOooo........oo    276 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
298                                                   277 
299 G4VPhysicalVolume* DetectorConstruction::Const << 278 G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter() {
300 {                                              << 279   if ( ! AreParametersOK() ) {
301   if (!AreParametersOK()) {                    << 280     G4cout << " DetectorConstruction::ConstructCalorimeter() : ***ERROR*** "
302     G4cout << " DetectorConstruction::Construc << 281            << G4endl << "\t PARAMETERS NOT WELL-DEFINED! GEOMETRY UNCHANGED."
303            << "\t PARAMETERS NOT WELL-DEFINED! << 282            << G4endl;
304     return fExperimentalHall_phys;                283     return fExperimentalHall_phys;
305   }                                               284   }
306                                                   285 
307   // Clean old geometry, if any.                  286   // Clean old geometry, if any.
308   G4GeometryManager::GetInstance()->OpenGeomet    287   G4GeometryManager::GetInstance()->OpenGeometry();
309   G4PhysicalVolumeStore::GetInstance()->Clean(    288   G4PhysicalVolumeStore::GetInstance()->Clean();
310   G4LogicalVolumeStore::GetInstance()->Clean()    289   G4LogicalVolumeStore::GetInstance()->Clean();
311   G4SolidStore::GetInstance()->Clean();           290   G4SolidStore::GetInstance()->Clean();
312                                                   291 
313   G4double lambda = 0.0;  // G4double X0 = 0.0 << 292   G4double lambda = 0.0; // G4double X0 = 0.0;
314   if (fIsUnitInLambda) {                       << 293   if ( fIsUnitInLambda ) {
315     if (fAbsorberMaterial == fIron) {          << 294     if ( fAbsorberMaterial == fIron ) {
316       lambda = 16.760 * cm;  // X0     = 1.758 << 295       lambda = 16.760*cm; // X0     = 1.7585*cm; 
317     }                                          << 296     } else if ( fAbsorberMaterial == fCopper ) {
318     else if (fAbsorberMaterial == fCopper) {   << 297       lambda = 15.056*cm; // X0     = 1.4353*cm; 
319       lambda = 15.056 * cm;  // X0     = 1.435 << 298     } else if ( fAbsorberMaterial == fBrass ) {  
320     }                                          << 299       lambda = 15.056*cm; // Lack of PDG data: I am assuming the same as Copper.  // X0=1.4353*cm
321     else if (fAbsorberMaterial == fBrass) {    << 300     } else if ( fAbsorberMaterial == fTungsten ) {
322       lambda = 15.056 * cm;  // Lack of PDG da << 301       lambda = 9.5855*cm; // X0     = 0.35*cm; 
323     }                                          << 302     } else if ( fAbsorberMaterial == fLead ) {
324     else if (fAbsorberMaterial == fTungsten) { << 303       lambda = 17.092*cm; // X0     = 0.56120*cm; 
325       lambda = 9.5855 * cm;  // X0     = 0.35* << 304     } else if ( fAbsorberMaterial == fPbWO4 ) {
326     }                                          << 305       lambda = 22.4*cm;   // X0     = 0.89*cm; 
327     else if (fAbsorberMaterial == fLead) {     << 306     } else if ( fAbsorberMaterial == fUranium ) {
328       lambda = 17.092 * cm;  // X0     = 0.561 << 307       lambda = 10.501*cm; // X0     = 0.31662*cm; 
329     }                                          << 308     } else if ( fAbsorberMaterial == fGraphite ) {
330     else if (fAbsorberMaterial == fPbWO4) {    << 309       lambda = 38.82*cm;  // X0     = 19.32*cm; 
331       lambda = 22.4 * cm;  // X0     = 0.89*cm << 310     } else {
332     }                                          << 
333     else if (fAbsorberMaterial == fUranium) {  << 
334       lambda = 10.501 * cm;  // X0     = 0.316 << 
335     }                                          << 
336     else if (fAbsorberMaterial == fGraphite) { << 
337       lambda = 38.82 * cm;  // X0     = 19.32* << 
338     }                                          << 
339     else {                                     << 
340       std::cout << "ERROR: absorber material n    311       std::cout << "ERROR: absorber material not recognized" << std::endl;
341     }                                             312     }
342   }                                               313   }
343                                                   314 
344   //------------------- volumes --------------    315   //------------------- volumes --------------------------
345                                                   316 
346   G4double absorberTotalLength = fAbsorberTota    317   G4double absorberTotalLength = fAbsorberTotalLength;
347   G4double calorimeterRadius = fCalorimeterRad    318   G4double calorimeterRadius = fCalorimeterRadius;
348   if (fIsUnitInLambda) {                       << 319   if ( fIsUnitInLambda ) {
349     absorberTotalLength *= lambda;             << 320     absorberTotalLength *= lambda; 
350     calorimeterRadius *= lambda;               << 321     calorimeterRadius *= lambda; 
351   }                                               322   }
352                                                   323 
353   // --- experimental hall (world volume)    *    324   // --- experimental hall (world volume)    ***LOOKHERE***
354   //     beam line along the Z-axis               325   //     beam line along the Z-axis
355   G4double expHall_x = 10.0 * m;  // half dime << 326   G4double expHall_x = 10.0*m;  // half dimension along x 
356   G4double expHall_y = 10.0 * m;  // half dime << 327   G4double expHall_y = 10.0*m;  // half dimension along y
357   G4double expHall_z = 10.0 * m;  // half dime << 328   G4double expHall_z = 10.0*m;  // half dimension along z
358                                                << 329 
359   G4Box* experimentalHall_box = new G4Box("exp << 330   G4Box* experimentalHall_box = new G4Box( "expHall_box", expHall_x, expHall_y, expHall_z );
360   fExperimentalHall_log = new G4LogicalVolume( << 331   fExperimentalHall_log = new G4LogicalVolume( experimentalHall_box,  // solid 
361                                                << 332                                                fVacuum,               // material
362                                                << 333                                                "expHall_log",         // name
363                                                << 334                                                0,                     // field manager
364                                                << 335                                                0,                     // sensitive detector
365                                                << 336                                                0 );                   // user limits
366   fExperimentalHall_phys = new G4PVPlacement(0 << 337   fExperimentalHall_phys = new G4PVPlacement( 0,                      // rotation
367                                              G << 338                                               G4ThreeVector(),        // translation
368                                              " << 339                                               "expHall",              // name
369                                              f << 340                                               fExperimentalHall_log,  // logical volume
370                                              0 << 341                                               0,                      // mother physical volume
371                                              f << 342                                               false,                  // boolean operation
372                                              0 << 343                                               0 );                    // copy number
373                                                << 344   
374   // --- Detector                                 345   // --- Detector
375   // The idea is to use Replica placement.     << 346   // The idea is to use Replica placement. 
376   // To do that, we have to define two extra v << 347   // To do that, we have to define two extra volumes: the "calorimeter" volume 
377   // and the "module". The former, which has t << 348   // and the "module". The former, which has the world as its mother volume, 
378   // is the mother of the module volume. The c << 349   // is the mother of the module volume. The calorimeter volume is completely 
379   // filled by a number (theActiveLayerNumber) << 350   // filled by a number (theActiveLayerNumber) of replicas of the module volume. 
380   // A module volume, in its turn, is the moth << 351   // A module volume, in its turn, is the mother volume of the absorber layer + 
381   // active layer.                             << 352   // active layer. 
382                                                   353 
383   //            --- absorber layer : logical      354   //            --- absorber layer : logical
384   G4double zAbsorber = absorberTotalLength / s << 355   G4double zAbsorber = absorberTotalLength / static_cast< double >( fActiveLayerNumber );
385   // In the case of homogenous calorimeter the    356   // In the case of homogenous calorimeter the "active" part must be
386   // subtracted because it is made of the same    357   // subtracted because it is made of the same material
387   // (the material of the "active" part is set    358   // (the material of the "active" part is set to be the same as
388   //  the aborber).                               359   //  the aborber).
389   if (fIsCalHomogeneous) {                     << 360   if ( fIsCalHomogeneous ) { 
390     fActiveMaterial = fAbsorberMaterial;          361     fActiveMaterial = fAbsorberMaterial;
391     zAbsorber -= fActiveLayerSize;             << 362     zAbsorber -= fActiveLayerSize; 
392   }                                               363   }
393   zAbsorber /= 2.0;  // half dimension along z    364   zAbsorber /= 2.0;  // half dimension along z
394   G4Tubs* solidAbsorber = new G4Tubs("solidAbs << 365   G4Tubs* solidAbsorber = new G4Tubs( "solidAbsorber",      // name
395                                      0.0,  //  << 366                                       0.0,                  // inner radius
396                                      calorimet << 367                                       calorimeterRadius,    // outer radius
397                                      zAbsorber << 368                                       zAbsorber,            // half cylinder length in z
398                                      0.0,  //  << 369                                       0.0,                  // starting phi angle in rad
399                                      2.0 * pi) << 370                                       2.0*pi );             // final phi angle in rad
400   fLogicAbsorber = new G4LogicalVolume(solidAb << 371   fLogicAbsorber = new G4LogicalVolume( solidAbsorber,      // solid 
401                                        fAbsorb << 372                                         fAbsorberMaterial,  // material
402                                        "logicA << 373                                         "logicAbsorber",    // name
403                                        0,  //  << 374                                         0,                  // field manager
404                                        0,  //  << 375                                         0,                  // sensitive detector
405                                        0);  // << 376                                         0 );                // user limits
406                                                   377 
407   //            --- active layer : logical        378   //            --- active layer : logical
408   G4double zActive = fActiveLayerSize / 2.0;   << 379   G4double zActive = fActiveLayerSize / 2.0;  // half dimension along z 
409   G4Tubs* solidActive = new G4Tubs("solidActiv << 380   G4Tubs* solidActive = new G4Tubs( "solidActive",      // name
410                                    0.0,  // in << 381                                     0.0,                // inner radius
411                                    calorimeter << 382                                     calorimeterRadius,  // outer radius
412                                    zActive,  / << 383                                     zActive,            // half cylinder length in z
413                                    0.0,  // st << 384                                     0.0,                // starting phi angle in rad
414                                    2.0 * pi);  << 385                                     2.0*pi );           // final phi angle in rad
415   fLogicActive = new G4LogicalVolume(solidActi << 386   fLogicActive = new G4LogicalVolume( solidActive,      // solid 
416                                      fActiveMa << 387                                       fActiveMaterial,  // material
417                                      "logicAct << 388                                       "logicActive",    // name
418                                      0,  // fi << 389                                       0,                // field manager
419                                      0,  // se << 390                                       0,                // sensitive detector
420                                      0);  // u << 391                                       0 );              // user limits
421                                                   392 
422   //        --- module : logical                  393   //        --- module : logical
423   G4double zModule = zAbsorber + zActive;  //  << 394   G4double zModule = zAbsorber + zActive;  // half dimension along z 
424   G4Tubs* solidModule = new G4Tubs("solidModul << 395   G4Tubs* solidModule = new G4Tubs( "solidModule",      // name
425                                    0.0,  // in << 396                                     0.0,                // inner radius
426                                    calorimeter << 397                                     calorimeterRadius,  // outer radius
427                                    zModule,  / << 398                                     zModule,            // half cylinder length in z
428                                    0.0,  // st << 399                                     0.0,                // starting phi angle in rad
429                                    2.0 * pi);  << 400                                     2.0*pi );           // final phi angle in rad
430   fLogicModule = new G4LogicalVolume(solidModu << 401   fLogicModule = new G4LogicalVolume( solidModule,      // solid 
431                                      fLead,  / << 402                                       fLead,            // material, it does NOT matter
432                                      "logicMod << 403                                       "logicModule",    // name
433                                      0,  // fi << 404                                       0,                // field manager
434                                      0,  // se << 405                                       0,                // sensitive detector
435                                      0);  // u << 406                                       0 );              // user limits
436                                                   407 
437   //    --- calorimeter : logical                 408   //    --- calorimeter : logical
438   G4int numberOfModules = fActiveLayerNumber;     409   G4int numberOfModules = fActiveLayerNumber;
439   G4double zCalo = numberOfModules * zModule;  << 410   G4double zCalo = numberOfModules*zModule;  // half dimension along z
440   fCaloLength = 2.0 * zCalo;                   << 411   fCaloLength = 2.0*zCalo;
441   G4Tubs* solidCalo = new G4Tubs("solidCalo",  << 412   G4Tubs* solidCalo = new G4Tubs( "solidCalo",        // name
442                                  0.0,  // inne << 413                                   0.0,                // inner radius
443                                  calorimeterRa << 414                                   calorimeterRadius,  // outer radius
444                                  zCalo,  // ha << 415                                   zCalo,              // half cylinder length in z
445                                  0.0,  // star << 416                                   0.0,                // starting phi angle in rad
446                                  2.0 * pi);  / << 417                                   2.0*pi );           // final phi angle in rad
447   fLogicCalo = new G4LogicalVolume(solidCalo,  << 418   fLogicCalo = new G4LogicalVolume( solidCalo,        // solid 
448                                    fLead,  //  << 419                                     fLead,            // material, it does NOT matter
449                                    "logicCalo" << 420                                     "logicCalo",      // name
450                                    0,  // fiel << 421                                     0,                // field manager
451                                    0,  // sens << 422                                     0,                // sensitive detector
452                                    0);  // use << 423                                     0 );              // user limits
453                                                   424 
454   //            --- absorber layer : physical     425   //            --- absorber layer : physical
455   G4double zpos = -zActive;                    << 426   G4double zpos = - zActive;
456   fPhysiAbsorber = new G4PVPlacement(0,  // ro << 427   fPhysiAbsorber = new G4PVPlacement( 0,                        // rotation
457                                      G4ThreeVe << 428                                       G4ThreeVector(0,0,zpos),  // translation
458                                      fLogicAbs << 429                                       fLogicAbsorber,           // logical volume
459                                      "physiAbs << 430                                       "physiAbsorber",          // name
460                                      fLogicMod << 431                                       fLogicModule,             // mother logical volume
461                                      false,  / << 432                                       false,                    // boolean operation
462                                      1000);  / << 433                                       1000 );                   // copy number
463                                                   434 
464   //            --- active layer : physical       435   //            --- active layer : physical
465   zpos += zAbsorber + zActive;                    436   zpos += zAbsorber + zActive;
466   fPhysiActive = new G4PVPlacement(0,  // rota << 437   fPhysiActive = new G4PVPlacement( 0,                          // rotation
467                                    G4ThreeVect << 438                                     G4ThreeVector(0,0,zpos),    // translation
468                                    fLogicActiv << 439                                     fLogicActive,               // logical volume
469                                    "physiActiv << 440                                     "physiActive",              // name
470                                    fLogicModul << 441                                     fLogicModule,               // mother logical volume
471                                    false,  //  << 442                                     false,                      // boolean operation
472                                    2000);  //  << 443                                     2000 );                     // copy number
473                                                   444 
474   //        --- module : physical (using repli    445   //        --- module : physical (using replica)
475   fPhysiModule = new G4PVReplica("Calo",  // n << 446   fPhysiModule = new G4PVReplica( "Calo",                   // name
476                                  fLogicModule, << 447                                   fLogicModule,             // logical volume
477                                  fLogicCalo,   << 448                                   fLogicCalo,               // mother logical volume
478                                  kZAxis,  // a << 449                                   kZAxis,                   // axis of replication
479                                  numberOfModul << 450                                   numberOfModules,          // number of replica
480                                  2 * (zAbsorbe << 451                                   2*(zAbsorber+zActive) );  // (full) width of replica
481                                                   452 
482   //    --- calorimeter : physical                453   //    --- calorimeter : physical
483   fPhysiCalo = new G4PVPlacement(0,  // rotati << 454   fPhysiCalo = new G4PVPlacement( 0,                        // rotation
484                                  G4ThreeVector << 455                                   G4ThreeVector(),          // translation
485                                  "physiCalo",  << 456                                   "physiCalo",              // its name
486                                  fLogicCalo,   << 457                                   fLogicCalo,               // logical volume
487                                  fExperimental << 458                                   fExperimentalHall_phys,   // mother physical volume
488                                  false,  // bo << 459                                   false,                    // boolean operation
489                                  100);  // cop << 460                                   100 );                    // copy number
490                                                   461 
491   // Three scoring volumes: one thin layer dow    462   // Three scoring volumes: one thin layer downstream of the calorimeter ("down")
492   //                        one thin layer sur    463   //                        one thin layer surrounding (lateral) of the calorimeter ("side")
493   //                        one thin layer ups    464   //                        one thin layer upstream of the calorimeter ("up")
494   G4Tubs* solidScoringUpDown = new G4Tubs("sol << 465   G4Tubs* solidScoringUpDown = new G4Tubs( "solidScoringUpDown",    // name
495                                           0.0, << 466                                            0.0,                     // inner radius
496                                           calo << 467                                            calorimeterRadius,       // outer radius
497                                           0.5  << 468                                            0.5*fScoringThickness,   // half cylinder length in z
498                                           0.0, << 469                                            0.0,                     // starting phi angle in rad
499                                           2.0  << 470                                            2.0*pi );                // final phi angle in rad
500   fLogicScoringUpDown = new G4LogicalVolume(so << 471   fLogicScoringUpDown = new G4LogicalVolume( solidScoringUpDown,    // solid
501                                             fV << 472                                              fVacuum,               // material
502                                             "l << 473                                              "logicScoringUpDown",  // name
503                                             0, << 474                                              0,                     // field manager
504                                             0, << 475                                              0,                     // sensitive detector
505                                             0) << 476                                              0 );                   // user limits
506   G4double zScoringUpDown = 0.5 * (fCaloLength << 477   G4double zScoringUpDown = 0.5*(fCaloLength + fScoringThickness);
507   fPhysiScoringUpstream = new G4PVPlacement(0, << 478   fPhysiScoringUpstream = new G4PVPlacement( 0,                          // rotation
508                                             G4 << 479                                              G4ThreeVector( 0.0, 0.0, -zScoringUpDown ),
509                                             // << 480                                                                          // translation
510                                             "p << 481                                              "physiScoringUpstream",     // name
511                                             fL << 482                                              fLogicScoringUpDown,        // logical volume
512                                             fE << 483                                              fExperimentalHall_phys,     // mother physical volume
513                                             fa << 484                                              false,                      // boolean operation
514                                             0) << 485                                              0 );                        // copy number
515   fPhysiScoringDownstream = new G4PVPlacement( << 486   fPhysiScoringDownstream = new G4PVPlacement( 0,                        // rotation
516                                                << 487                                                G4ThreeVector( 0.0, 0.0, zScoringUpDown ),
517                                                << 488                                                                          // translation
518                                                << 489                                                "physiScoringDownstream", // name
519                                                << 490                                                fLogicScoringUpDown,      // logical volume
520                                                << 491                                                fExperimentalHall_phys,   // mother physical volume
521                                                << 492                                                false,                    // boolean operation
522                                                << 493                                                0 );                      // copy number
523                                                << 494   
524   G4Tubs* solidScoringSide = new G4Tubs("solid << 495   G4Tubs* solidScoringSide = new G4Tubs( "solidScoringSide",    // name
525                                         calori << 496                                          calorimeterRadius,     // inner radius
526                                         calori << 497                                          calorimeterRadius + fScoringThickness,  // outer radius
527                                         0.5 *  << 498                                          0.5*fCaloLength,       // half cylinder length in z
528                                         0.0,   << 499                                          0.0,                   // starting phi angle in rad
529                                         2.0 *  << 500                                          2.0*pi );              // final phi angle in rad
530   fLogicScoringSide = new G4LogicalVolume(soli << 501   fLogicScoringSide = new G4LogicalVolume( solidScoringSide,    // solid
531                                           fVac << 502                                            fVacuum,             // material
532                                           "log << 503                                            "logicScoringSide",  // name
533                                           0,   << 504                                            0,                   // field manager
534                                           0,   << 505                                            0,                   // sensitive detector
535                                           0);  << 506                                            0 );                 // user limits
536   fPhysiScoringSide = new G4PVPlacement(0,  // << 507   fPhysiScoringSide = new G4PVPlacement( 0,                       // rotation
537                                         G4Thre << 508                                          G4ThreeVector( 0.0, 0.0, 0.0 ),  // translation
538                                         "physi << 509                                          "physiScoringSide",      // name
539                                         fLogic << 510                                          fLogicScoringSide,       // logical volume
540                                         fExper << 511                                          fExperimentalHall_phys,  // mother physical volume
541                                         false, << 512                                          false,                   // boolean operation
542                                         0);  / << 513                                          0 );                     // copy number
543                                                << 514   
544   return fExperimentalHall_phys;                  515   return fExperimentalHall_phys;
545 }                                                 516 }
546                                                   517 
547 //....oooOO0OOooo........oooOO0OOooo........oo    518 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
548                                                   519 
549 G4bool DetectorConstruction::AreParametersOK() << 520 G4bool DetectorConstruction::AreParametersOK() {
550 {                                              << 
551   bool isOk = true;                               521   bool isOk = true;
552   if (!fAbsorberMaterial) {                    << 522   if ( ! fAbsorberMaterial ) {
553     isOk = false;                                 523     isOk = false;
554     G4cout << " DetectorConstruction::AreParam    524     G4cout << " DetectorConstruction::AreParametersOK() : UNDEFINED absorber material" << G4endl;
555   }                                               525   }
556   if (!fActiveMaterial) {                      << 526   if ( ! fActiveMaterial ) {
557     isOk = false;                                 527     isOk = false;
558     G4cout << " DetectorConstruction::AreParam    528     G4cout << " DetectorConstruction::AreParametersOK() : UNDEFINED active material" << G4endl;
559   }                                               529   }
560   if (fAbsorberTotalLength <= 0.0) {           << 530   if ( fAbsorberTotalLength <= 0.0 ) {
561     isOk = false;                                 531     isOk = false;
562     G4cout << " DetectorConstruction::AreParam    532     G4cout << " DetectorConstruction::AreParametersOK() : fAbsorberTotalLength = "
563            << fAbsorberTotalLength << G4endl;     533            << fAbsorberTotalLength << G4endl;
564   }                                               534   }
565   if (fCalorimeterRadius <= 0.0) {             << 535   if ( fCalorimeterRadius <= 0.0 ) {
566     isOk = false;                                 536     isOk = false;
567     G4cout << " DetectorConstruction::AreParam    537     G4cout << " DetectorConstruction::AreParametersOK() : fCalorimeterRadius = "
568            << fCalorimeterRadius << G4endl;       538            << fCalorimeterRadius << G4endl;
569   }                                               539   }
570   if (fActiveLayerNumber <= 0) {               << 540   if ( fActiveLayerNumber <= 0 ) {
571     isOk = false;                                 541     isOk = false;
572     G4cout << " DetectorConstruction::AreParam    542     G4cout << " DetectorConstruction::AreParametersOK() : fActiveLayerNumber = "
573            << fActiveLayerNumber << G4endl;       543            << fActiveLayerNumber << G4endl;
574   }                                               544   }
575   if (fActiveLayerSize <= 0.0) {               << 545   if ( fActiveLayerSize <= 0.0 ) {
576     isOk = false;                                 546     isOk = false;
577     G4cout << " DetectorConstruction::AreParam << 547     G4cout << " DetectorConstruction::AreParametersOK() : fActiveLayerSize = "
578            << G4endl;                          << 548            << fActiveLayerSize << G4endl;
579   }                                               549   }
580   return isOk;                                    550   return isOk;
581 }                                                 551 }
582                                                   552 
583 //....oooOO0OOooo........oooOO0OOooo........oo    553 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
584                                                   554 
585 void DetectorConstruction::SetMagField(const G << 555 void DetectorConstruction::SetMagField( const G4double fieldValue ) {
586 {                                              << 556   if ( fUniformMagField ) {
587   if (fUniformMagField) {                      << 
588     delete fUniformMagField;                      557     delete fUniformMagField;
589   }                                               558   }
590   if (std::abs(fieldValue) > 0.0) {            << 559   if ( std::abs( fieldValue ) > 0.0 ) {
591     // Apply a global uniform magnetic field a    560     // Apply a global uniform magnetic field along the Y axis.
592     // Notice that only if the magnetic field     561     // Notice that only if the magnetic field is not zero, the Geant4
593     // transportion in field gets activated.      562     // transportion in field gets activated.
594     fUniformMagField = new G4UniformMagField(G << 563     fUniformMagField = new G4UniformMagField( G4ThreeVector( 0.0, fieldValue, 0.0 ) );
595     fFieldMgr->SetDetectorField(fUniformMagFie << 564     fFieldMgr->SetDetectorField( fUniformMagField );
596     fFieldMgr->CreateChordFinder(fUniformMagFi << 565     fFieldMgr->CreateChordFinder( fUniformMagField );
597   }                                            << 566   } 
598 }                                                 567 }
599                                                   568 
600 //....oooOO0OOooo........oooOO0OOooo........oo    569 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
601                                                   570 
602 void DetectorConstruction::SetAbsorberMaterial << 571 void DetectorConstruction::SetAbsorberMaterial( const G4String name ) {
603 {                                              << 572   if        ( name == "Fe" || name == "Iron" || name == "iron" ) { 
604   if (name == "Fe" || name == "Iron" || name = << 
605     fAbsorberMaterial = fIron;                    573     fAbsorberMaterial = fIron;
606   }                                            << 574   } else if ( name == "Cu" || name == "Copper" || name == "copper" ) { 
607   else if (name == "Cu" || name == "Copper" || << 
608     fAbsorberMaterial = fCopper;                  575     fAbsorberMaterial = fCopper;
609   }                                            << 576   } else if ( name == "Brass" || name == "brass" ) { 
610   else if (name == "Brass" || name == "brass") << 
611     fAbsorberMaterial = fBrass;                   577     fAbsorberMaterial = fBrass;
612   }                                            << 578   } else if ( name == "Pb" || name == "Lead" || name == "lead" ) { 
613   else if (name == "Pb" || name == "Lead" || n << 
614     fAbsorberMaterial = fLead;                    579     fAbsorberMaterial = fLead;
615   }                                            << 580   } else if ( name == "PbWO4" ) {
616   else if (name == "PbWO4") {                  << 
617     fAbsorberMaterial = fPbWO4;                   581     fAbsorberMaterial = fPbWO4;
618   }                                            << 582   } else if ( name == "W" || name == "Tungsten" || name == "tungsten" ) { 
619   else if (name == "W" || name == "Tungsten" | << 
620     fAbsorberMaterial = fTungsten;                583     fAbsorberMaterial = fTungsten;
621   }                                            << 584   } else if ( name == "U" || name == "Uranium" || name == "uranium" ) { 
622   else if (name == "U" || name == "Uranium" || << 
623     fAbsorberMaterial = fUranium;                 585     fAbsorberMaterial = fUranium;
624   }                                            << 586   } else if ( name == "C" || name == "Graphite" || name == "graphite" ) { 
625   else if (name == "C" || name == "Graphite" | << 
626     fAbsorberMaterial = fGraphite;                587     fAbsorberMaterial = fGraphite;
627   }                                            << 588   } else {
628   else {                                       << 589     G4cout << G4endl << G4endl
629     G4cout << G4endl << G4endl << "WARNING: th << 590         << "WARNING: the name of the material has not been recognized!" << G4endl
630            << G4endl << "     ===> the default << 591         << "     ===> the default  * Iron *  will be used." << G4endl << G4endl;  
631     fAbsorberMaterial = fIron;                    592     fAbsorberMaterial = fIron;
632   }                                            << 593   }  
633   fLogicAbsorber->SetMaterial(fAbsorberMateria << 594   fLogicAbsorber->SetMaterial( fAbsorberMaterial );
634 }                                                 595 }
635                                                   596 
636 //....oooOO0OOooo........oooOO0OOooo........oo    597 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
637                                                   598 
638 void DetectorConstruction::SetActiveMaterial(c << 599 void DetectorConstruction::SetActiveMaterial( const G4String name ) {
639 {                                              << 600   if        ( name == "Scintillator" || name == "scintillator" ) { 
640   if (name == "Scintillator" || name == "scint << 
641     fActiveMaterial = fPolystyrene;               601     fActiveMaterial = fPolystyrene;
642   }                                            << 602   } else if ( name == "LAr" || name == "LiquidArgon" || name == "liquidArgon" ) { 
643   else if (name == "LAr" || name == "LiquidArg << 
644     fActiveMaterial = fLiquidArgon;               603     fActiveMaterial = fLiquidArgon;
645   }                                            << 604   } else if ( name == "PbWO4" ) {
646   else if (name == "PbWO4") {                  << 
647     fActiveMaterial = fPbWO4;                     605     fActiveMaterial = fPbWO4;
648   }                                            << 606   } else if ( name == "Si" || name == "Silicon" || name == "silicon" ) { 
649   else if (name == "Si" || name == "Silicon" | << 
650     fActiveMaterial = fSilicon;                   607     fActiveMaterial = fSilicon;
651   }                                            << 608   } else if ( name == "Quartz" || name == "quartz" ) { 
652   else if (name == "Quartz" || name == "quartz << 
653     fActiveMaterial = fQuartz;                    609     fActiveMaterial = fQuartz;
654   }                                            << 610   } else if ( name == "C" || name == "Graphite" || name == "graphite" ) { 
655   else if (name == "C" || name == "Graphite" | << 
656     fActiveMaterial = fGraphite;                  611     fActiveMaterial = fGraphite;
657   }                                            << 612   } else {
658   else {                                       << 613     G4cout << G4endl << G4endl
659     G4cout << G4endl << G4endl << "WARNING: th << 614         << "WARNING: the name of the material has not been recognized!" << G4endl
660            << G4endl << "     ===> the default << 615         << "     ===> the default  * Scintillator *  will be used." << G4endl << G4endl;
661            << G4endl;                          << 
662     fActiveMaterial = fPolystyrene;               616     fActiveMaterial = fPolystyrene;
663   }                                            << 617   }  
664   fLogicActive->SetMaterial(fActiveMaterial);  << 618   fLogicActive->SetMaterial( fActiveMaterial );
665 }                                                 619 }
666                                                   620 
667 //....oooOO0OOooo........oooOO0OOooo........oo    621 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
668                                                   622 
669 void DetectorConstruction::UpdateGeometry()    << 623 void DetectorConstruction::UpdateGeometry() {
670 {                                              << 624   //G4RunManager::GetRunManager()->DefineWorldVolume( ConstructCalorimeter() );
671   // G4RunManager::GetRunManager()->DefineWorl << 
672   G4RunManager::GetRunManager()->ReinitializeG    625   G4RunManager::GetRunManager()->ReinitializeGeometry();
673   PrintParameters();                              626   PrintParameters();
674   // Update also the position of the gun          627   // Update also the position of the gun
675   const PrimaryGeneratorAction* pPrimaryAction << 628   const PrimaryGeneratorAction* pPrimaryAction = 
676     G4RunManager::GetRunManager()->GetUserPrim << 629     dynamic_cast< const PrimaryGeneratorAction* >(
677   if (pPrimaryAction) pPrimaryAction->SetGunPo << 630       G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction() );
                                                   >> 631   if ( pPrimaryAction ) pPrimaryAction->SetGunPosition();  
678 }                                                 632 }
679                                                   633 
680 //....oooOO0OOooo........oooOO0OOooo........oo    634 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
681                                                   635 
682 void DetectorConstruction::PrintParameters()   << 636 void DetectorConstruction::PrintParameters() {
683 {                                              << 637   G4cout << G4endl << G4endl << " ------  DetectorConstruction::PrintParameters() ------ "
684   G4cout << G4endl << G4endl << " ------  Dete << 638          << G4endl
685          << " Absorber Material = ";              639          << " Absorber Material = ";
686   if (fAbsorberMaterial) {                     << 640   if ( fAbsorberMaterial ) {
687     G4cout << fAbsorberMaterial->GetName();       641     G4cout << fAbsorberMaterial->GetName();
688   }                                            << 642   } else {
689   else {                                       << 
690     G4cout << " UNDEFINED ";                      643     G4cout << " UNDEFINED ";
691   }                                               644   }
692   G4cout << G4endl << " Active Material   = ";    645   G4cout << G4endl << " Active Material   = ";
693   if (fActiveMaterial) {                       << 646   if ( fActiveMaterial ) {
694     G4cout << fActiveMaterial->GetName();         647     G4cout << fActiveMaterial->GetName();
695   }                                            << 648   } else {
696   else {                                       << 
697     G4cout << " UNDEFINED ";                      649     G4cout << " UNDEFINED ";
698   }                                               650   }
699   G4cout << G4endl << " Is the Calorimeter Hom    651   G4cout << G4endl << " Is the Calorimeter Homogeneous ? " << fIsCalHomogeneous;
700   G4cout << G4endl << " Is the Unit in Lambda     652   G4cout << G4endl << " Is the Unit in Lambda ? " << fIsUnitInLambda;
701   G4cout << G4endl << " Absorber Total Length     653   G4cout << G4endl << " Absorber Total Length = ";
702   if (fIsUnitInLambda) {                       << 654   if ( fIsUnitInLambda ) {
703     G4cout << fAbsorberTotalLength << "  lambd    655     G4cout << fAbsorberTotalLength << "  lambdas";
704   }                                            << 656   } else {
705   else {                                       << 
706     G4cout << fAbsorberTotalLength / m << " m"    657     G4cout << fAbsorberTotalLength / m << " m";
707   }                                               658   }
708   G4cout << G4endl << " Calorimeter Radius = "    659   G4cout << G4endl << " Calorimeter Radius = ";
709   if (fIsUnitInLambda) {                       << 660   if ( fIsUnitInLambda ) {
710     G4cout << fCalorimeterRadius << "  lambdas    661     G4cout << fCalorimeterRadius << "  lambdas";
711   }                                            << 662   } else {
712   else {                                       << 
713     G4cout << fCalorimeterRadius / m << " m";     663     G4cout << fCalorimeterRadius / m << " m";
714   }                                               664   }
715   G4cout << G4endl << " Active Layer Number       665   G4cout << G4endl << " Active Layer Number   = " << fActiveLayerNumber;
716   G4cout << G4endl << " Active Layer Size      << 666   G4cout << G4endl << " Active Layer Size     = " << fActiveLayerSize/mm << " mm";
717   G4cout << G4endl << " Is the Radius Unit in     667   G4cout << G4endl << " Is the Radius Unit in Lambda ? " << fIsRadiusUnitInLambda;
718   G4cout << G4endl << " Radius Bin Size           668   G4cout << G4endl << " Radius Bin Size       = ";
719   G4cout << G4endl << " Magnetic field [T]        669   G4cout << G4endl << " Magnetic field [T]    = ";
720   if (fUniformMagField) {                      << 670   if ( fUniformMagField ) {
721     G4cout << fUniformMagField->GetConstantFie    671     G4cout << fUniformMagField->GetConstantFieldValue() / tesla;
722   }                                            << 672   } else {
723   else {                                       << 
724     G4cout << "(0,0,0)";                          673     G4cout << "(0,0,0)";
725   }                                               674   }
726                                                   675 
727   G4cout << G4endl << " ----------------------    676   G4cout << G4endl << " -------------------------------------------------------- " << G4endl
728          << G4endl;                               677          << G4endl;
729 }                                                 678 }
730                                                   679 
731 //....oooOO0OOooo........oooOO0OOooo........oo    680 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
732                                                   681