Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/runAndEvent/RE06/src/RE06DetectorConstruction.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/runAndEvent/RE06/src/RE06DetectorConstruction.cc (Version 11.3.0) and /examples/extended/runAndEvent/RE06/src/RE06DetectorConstruction.cc (Version 11.0.p2)


  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 RE06/src/RE06DetectorConstruction.cc     26 /// \file RE06/src/RE06DetectorConstruction.cc
 27 /// \brief Implementation of the RE06DetectorC     27 /// \brief Implementation of the RE06DetectorConstruction class
 28 //                                                 28 //
 29 //                                             <<  29 // 
 30                                                    30 
 31 #include "RE06DetectorConstruction.hh"             31 #include "RE06DetectorConstruction.hh"
 32                                                    32 
 33 #include "RE06DetectorMessenger.hh"            <<  33 #include "G4RunManager.hh"
 34 #include "RE06ParallelWorld.hh"                << 
 35 #include "RE06PrimaryGeneratorAction.hh"       << 
 36                                                    34 
                                                   >>  35 #include "G4Material.hh"
 37 #include "G4Box.hh"                                36 #include "G4Box.hh"
 38 #include "G4Colour.hh"                         << 
 39 #include "G4LogicalVolume.hh"                      37 #include "G4LogicalVolume.hh"
 40 #include "G4Material.hh"                       << 
 41 #include "G4MultiFunctionalDetector.hh"        << 
 42 #include "G4PSEnergyDeposit.hh"                << 
 43 #include "G4PSMinKinEAtGeneration.hh"          << 
 44 #include "G4PSNofSecondary.hh"                 << 
 45 #include "G4PSNofStep.hh"                      << 
 46 #include "G4PSTrackLength.hh"                  << 
 47 #include "G4PVPlacement.hh"                        38 #include "G4PVPlacement.hh"
 48 #include "G4PVReplica.hh"                          39 #include "G4PVReplica.hh"
 49 #include "G4PhysicalConstants.hh"              <<  40 
 50 #include "G4RunManager.hh"                     <<  41 #include "G4VisAttributes.hh"
                                                   >>  42 #include "G4Colour.hh"
                                                   >>  43 
 51 #include "G4SDManager.hh"                          44 #include "G4SDManager.hh"
 52 #include "G4SDParticleFilter.hh"               <<  45 #include "G4MultiFunctionalDetector.hh"
 53 #include "G4SystemOfUnits.hh"                  << 
 54 #include "G4VPrimitiveScorer.hh"                   46 #include "G4VPrimitiveScorer.hh"
                                                   >>  47 #include "G4PSEnergyDeposit.hh"
                                                   >>  48 #include "G4PSNofSecondary.hh"
                                                   >>  49 #include "G4PSTrackLength.hh"
                                                   >>  50 #include "G4PSNofStep.hh"
                                                   >>  51 #include "G4PSMinKinEAtGeneration.hh"
 55 #include "G4VSDFilter.hh"                          52 #include "G4VSDFilter.hh"
 56 #include "G4VisAttributes.hh"                  <<  53 #include "G4SDParticleFilter.hh"
 57 #include "G4ios.hh"                                54 #include "G4ios.hh"
 58                                                    55 
                                                   >>  56 #include "RE06DetectorMessenger.hh"
                                                   >>  57 #include "RE06PrimaryGeneratorAction.hh"
                                                   >>  58 #include "RE06ParallelWorld.hh"
                                                   >>  59 
                                                   >>  60 #include "G4PhysicalConstants.hh"
                                                   >>  61 #include "G4SystemOfUnits.hh"
                                                   >>  62 
 59 //....oooOO0OOooo........oooOO0OOooo........oo     63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 60                                                    64 
 61 G4ThreadLocal G4bool RE06DetectorConstruction:     65 G4ThreadLocal G4bool RE06DetectorConstruction::fConstructedSDandField = false;
 62                                                    66 
 63 RE06DetectorConstruction::RE06DetectorConstruc     67 RE06DetectorConstruction::RE06DetectorConstruction()
 64   : G4VUserDetectorConstruction(),             <<  68 : G4VUserDetectorConstruction(),
 65     fNumberOfLayers(40),                       <<  69   fNumberOfLayers(40),
 66     fTotalThickness(2.0 * m),                  <<  70   fTotalThickness (2.0*m),
 67     fLayerThickness(0.),                       <<  71   fLayerThickness(0.),
 68     fConstructed(false),                       <<  72   fConstructed(false),
 69     fWorldMaterial(0),                         <<  73   fWorldMaterial(0),
 70     fAbsorberMaterial(0),                      <<  74   fAbsorberMaterial(0),
 71     fGapMaterial(0),                           <<  75   fGapMaterial(0),
 72     fLayerSolid(0),                            <<  76   fLayerSolid(0),
 73     fGapSolid(0),                              <<  77   fGapSolid(0),
 74     fWorldLogical(0),                          <<  78   fWorldLogical(0),
 75     fWorldPhysical(0),                         <<  79   fWorldPhysical(0),
 76     fSerial(false),                            <<  80   fSerial(false),
 77     fDetectorMessenger(0),                     <<  81   fDetectorMessenger(0),
 78     fVerboseLevel(1)                           <<  82   fVerboseLevel(1)
 79 {                                                  83 {
 80   fLayerThickness = fTotalThickness / fNumberO     84   fLayerThickness = fTotalThickness / fNumberOfLayers;
 81                                                    85 
 82   for (size_t i = 0; i < 3; i++) {             <<  86   for(size_t i=0;i<3;i++)
                                                   >>  87   {
 83     fCalorLogical[i] = 0;                          88     fCalorLogical[i] = 0;
 84     fLayerLogical[i] = 0;                          89     fLayerLogical[i] = 0;
 85     fGapLogical[i] = 0;                            90     fGapLogical[i] = 0;
 86     fCalorPhysical[i] = 0;                         91     fCalorPhysical[i] = 0;
 87     fLayerPhysical[i] = 0;                         92     fLayerPhysical[i] = 0;
 88     fGapPhysical[i] = 0;                           93     fGapPhysical[i] = 0;
 89   }                                                94   }
 90                                                    95 
 91   fCalName[0] = "Calor-A";                         96   fCalName[0] = "Calor-A";
 92   fCalName[1] = "Calor-B";                         97   fCalName[1] = "Calor-B";
 93   fCalName[2] = "Calor-C";                         98   fCalName[2] = "Calor-C";
 94                                                    99 
 95   fDetectorMessenger = new RE06DetectorMesseng    100   fDetectorMessenger = new RE06DetectorMessenger(this);
 96 }                                                 101 }
 97                                                   102 
 98 //....oooOO0OOooo........oooOO0OOooo........oo    103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 99                                                   104 
100 RE06DetectorConstruction::~RE06DetectorConstru    105 RE06DetectorConstruction::~RE06DetectorConstruction()
101 {                                              << 106 { delete fDetectorMessenger;}
102   delete fDetectorMessenger;                   << 
103 }                                              << 
104                                                   107 
105 G4VPhysicalVolume* RE06DetectorConstruction::C    108 G4VPhysicalVolume* RE06DetectorConstruction::Construct()
106 {                                                 109 {
107   if (!fConstructed) {                         << 110   if(!fConstructed)
                                                   >> 111   {
108     fConstructed = true;                          112     fConstructed = true;
109     DefineMaterials();                            113     DefineMaterials();
110     SetupGeometry();                              114     SetupGeometry();
111   }                                               115   }
112   if (GetVerboseLevel() > 0) {                 << 116   if (GetVerboseLevel()>0) {
113     PrintCalorParameters();                       117     PrintCalorParameters();
114   }                                               118   }
115   return fWorldPhysical;                          119   return fWorldPhysical;
116 }                                                 120 }
117                                                   121 
118 void RE06DetectorConstruction::ConstructSDandF << 122 void RE06DetectorConstruction::ConstructSDandField() 
119 {                                                 123 {
120   if (!fConstructedSDandField) {               << 124   if(!fConstructedSDandField)
                                                   >> 125   {
121     fConstructedSDandField = true;                126     fConstructedSDandField = true;
122     SetupDetectors();                             127     SetupDetectors();
123   }                                               128   }
124 }                                                 129 }
125                                                   130 
126 //....oooOO0OOooo........oooOO0OOooo........oo    131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
127                                                   132 
128 void RE06DetectorConstruction::DefineMaterials    133 void RE06DetectorConstruction::DefineMaterials()
129 {                                              << 134 { 
130   G4String name, symbol;  // a=mass of a mole; << 135   G4String name, symbol;             //a=mass of a mole;
131   G4double a, z, density;  // z=mean number of << 136   G4double a, z, density;            //z=mean number of protons;  
132   G4int iz;  // iz=number of protons  in an is << 137   G4int iz;                          //iz=number of protons  in an isotope; 
133   G4int n;  // n=number of nucleons in an isot << 138   G4int n;                           // n=number of nucleons in an isotope;
134                                                   139 
135   G4int ncomponents, natoms;                      140   G4int ncomponents, natoms;
136   G4double abundance, fractionmass;               141   G4double abundance, fractionmass;
137   G4double temperature, pressure;                 142   G4double temperature, pressure;
138                                                   143 
139   //                                              144   //
140   // define Elements                              145   // define Elements
141   //                                              146   //
142                                                   147 
143   a = 1.01 * g / mole;                         << 148   a = 1.01*g/mole;
144   G4Element* H = new G4Element(name = "Hydroge << 149   G4Element* H  = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
145                                                   150 
146   a = 12.01 * g / mole;                        << 151   a = 12.01*g/mole;
147   G4Element* C = new G4Element(name = "Carbon" << 152   G4Element* C  = new G4Element(name="Carbon"  ,symbol="C" , z= 6., a);
148                                                   153 
149   a = 14.01 * g / mole;                        << 154   a = 14.01*g/mole;
150   G4Element* N = new G4Element(name = "Nitroge << 155   G4Element* N  = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
151                                                   156 
152   a = 16.00 * g / mole;                        << 157   a = 16.00*g/mole;
153   G4Element* O = new G4Element(name = "Oxygen" << 158   G4Element* O  = new G4Element(name="Oxygen"  ,symbol="O" , z= 8., a);
154                                                   159 
155   //                                              160   //
156   // define an Element from isotopes, by relat << 161   // define an Element from isotopes, by relative abundance 
157   //                                              162   //
158                                                   163 
159   G4Isotope* U5 = new G4Isotope(name = "U235", << 164   G4Isotope* U5 = new G4Isotope(name="U235", iz=92, n=235, a=235.01*g/mole);
160   G4Isotope* U8 = new G4Isotope(name = "U238", << 165   G4Isotope* U8 = new G4Isotope(name="U238", iz=92, n=238, a=238.03*g/mole);
161                                                   166 
162   G4Element* U = new G4Element(name = "enriche << 167   G4Element* U  = new G4Element(name="enriched Uranium",symbol="U",ncomponents=2);
163   U->AddIsotope(U5, abundance = 90. * perCent) << 168   U->AddIsotope(U5, abundance= 90.*perCent);
164   U->AddIsotope(U8, abundance = 10. * perCent) << 169   U->AddIsotope(U8, abundance= 10.*perCent);
165                                                   170 
166   //                                              171   //
167   // define simple materials                      172   // define simple materials
168   //                                              173   //
169                                                   174 
170   new G4Material(name = "Aluminium", z = 13.,  << 175   new G4Material(name="Aluminium", z=13., a=26.98*g/mole, density=2.700*g/cm3);
171   new G4Material(name = "Silicon", z = 14., a  << 176   new G4Material(name="Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3);
172   new G4Material(name = "Iron", z = 26., a = 5 << 177   new G4Material(name="Iron", z=26., a=55.85*g/mole, density=7.87*g/cm3);
173   new G4Material(name = "ArgonGas", z = 18., a << 178   new G4Material(name="ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3);
174   new G4Material(name = "He", z = 2., a = 4.0  << 179   new G4Material(name="He", z=2., a=4.0*g/mole, density=0.1786e-03*g/cm3);
175                                                << 180 
176   density = 1.390 * g / cm3;                   << 181   density = 1.390*g/cm3;
177   a = 39.95 * g / mole;                        << 182   a = 39.95*g/mole;
178   G4Material* lAr = new G4Material(name = "liq << 183   G4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density);
179                                                << 184 
180   density = 11.35 * g / cm3;                   << 185   density = 11.35*g/cm3;
181   a = 207.19 * g / mole;                       << 186   a = 207.19*g/mole;
182   G4Material* Pb = new G4Material(name = "Lead << 187   G4Material* Pb = new G4Material(name="Lead"     , z=82., a, density);
183                                                   188 
184   //                                              189   //
185   // define a material from elements.   case 1    190   // define a material from elements.   case 1: chemical molecule
186   //                                              191   //
187                                                << 192  
188   density = 1.000 * g / cm3;                   << 193   density = 1.000*g/cm3;
189   G4Material* H2O = new G4Material(name = "Wat << 194   G4Material* H2O = new G4Material(name="Water", density, ncomponents=2);
190   H2O->AddElement(H, natoms = 2);              << 195   H2O->AddElement(H, natoms=2);
191   H2O->AddElement(O, natoms = 1);              << 196   H2O->AddElement(O, natoms=1);
192                                                << 197 
193   density = 1.032 * g / cm3;                   << 198   density = 1.032*g/cm3;
194   G4Material* Sci = new G4Material(name = "Sci << 199   G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2);
195   Sci->AddElement(C, natoms = 9);              << 200   Sci->AddElement(C, natoms=9);
196   Sci->AddElement(H, natoms = 10);             << 201   Sci->AddElement(H, natoms=10);
197                                                   202 
198   //                                              203   //
199   // define a material from elements.   case 2    204   // define a material from elements.   case 2: mixture by fractional mass
200   //                                              205   //
201                                                   206 
202   density = 1.290 * mg / cm3;                  << 207   density = 1.290*mg/cm3;
203   G4Material* Air = new G4Material(name = "Air << 208   G4Material* Air = new G4Material(name="Air"  , density, ncomponents=2);
204   Air->AddElement(N, fractionmass = 0.7);      << 209   Air->AddElement(N, fractionmass=0.7);
205   Air->AddElement(O, fractionmass = 0.3);      << 210   Air->AddElement(O, fractionmass=0.3);
206                                                   211 
207   //                                              212   //
208   // examples of vacuum                           213   // examples of vacuum
209   //                                              214   //
210                                                   215 
211   density = universe_mean_density;             << 216   density     = universe_mean_density;
212   pressure = 3.e-18 * pascal;                  << 217   pressure    = 3.e-18*pascal;
213   temperature = 2.73 * kelvin;                 << 218   temperature = 2.73*kelvin;
214   G4Material* Vacuum = new G4Material(name = " << 219   G4Material* Vacuum = new G4Material(name="Galactic", z=1., a=1.01*g/mole,
215                                       kStateGa << 220                                     density,kStateGas,temperature,pressure);
216                                                   221 
217   if (GetVerboseLevel() > 1) {                 << 222   if (GetVerboseLevel()>1) {
218     G4cout << *(G4Material::GetMaterialTable()    223     G4cout << *(G4Material::GetMaterialTable()) << G4endl;
219   }                                               224   }
220                                                   225 
221   // default materials of the calorimeter      << 226   //default materials of the calorimeter
222   fWorldMaterial = Vacuum;                     << 227   fWorldMaterial    = Vacuum;
223   fAbsorberMaterial = Pb;                         228   fAbsorberMaterial = Pb;
224   fGapMaterial = lAr;                          << 229   fGapMaterial      = lAr;
225 }                                                 230 }
226                                                   231 
227 //....oooOO0OOooo........oooOO0OOooo........oo    232 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
228                                                   233 
229 void RE06DetectorConstruction::SetupGeometry()    234 void RE06DetectorConstruction::SetupGeometry()
230 {                                                 235 {
231   //                                           << 236   //     
232   // World                                        237   // World
233   //                                              238   //
234   G4VSolid* worldSolid = new G4Box("World", 2. << 239   G4VSolid* worldSolid = new G4Box("World",2.*m,2.*m,fTotalThickness*2.);
235   fWorldLogical = new G4LogicalVolume(worldSol << 240   fWorldLogical = new G4LogicalVolume(worldSolid,fWorldMaterial,"World");
236   fWorldPhysical = new G4PVPlacement(0, G4Thre << 241   fWorldPhysical = new G4PVPlacement(0,G4ThreeVector(),fWorldLogical,"World",
237                                                << 242                         0,false,0);
238   //                                           << 243   
                                                   >> 244   //                               
239   // Calorimeter                                  245   // Calorimeter
240   //                                           << 246   //  
241   G4VSolid* calorSolid = new G4Box("Calor", 0. << 247   G4VSolid* calorSolid = new G4Box("Calor",0.5*m,0.5*m,fTotalThickness/2.);
242   G4int i;                                        248   G4int i;
243   for (i = 0; i < 3; i++) {                    << 249   for(i=0;i<3;i++)
244     fCalorLogical[i] = new G4LogicalVolume(cal << 250   {
245     if (fSerial) {                             << 251     fCalorLogical[i] 
246       fCalorPhysical[i] =                      << 252       = new G4LogicalVolume(calorSolid,fAbsorberMaterial,fCalName[i]);
247         new G4PVPlacement(0, G4ThreeVector(0., << 253     if(fSerial)
248                           fCalorLogical[i], fC << 254     {
                                                   >> 255       fCalorPhysical[i] = new G4PVPlacement(0,
                                                   >> 256                  G4ThreeVector(0.,0.,G4double(i-1)*fTotalThickness),
                                                   >> 257                  fCalorLogical[i],fCalName[i],fWorldLogical,false,i);
249     }                                             258     }
250     else {                                     << 259     else
251       fCalorPhysical[i] = new G4PVPlacement(0, << 260     {
252                                             fC << 261       fCalorPhysical[i] = new G4PVPlacement(0,
                                                   >> 262                  G4ThreeVector(0.,G4double(i-1)*m,0.),
                                                   >> 263                  fCalorLogical[i],fCalName[i],fWorldLogical,false,i);
253     }                                             264     }
254   }                                               265   }
255                                                << 266  
256   //                                           << 267   //                                 
257   // Layers --- as absorbers                      268   // Layers --- as absorbers
258   //                                              269   //
259   fLayerSolid = new G4Box("Layer", 0.5 * m, 0. << 270   fLayerSolid = new G4Box("Layer",0.5*m,0.5*m,fLayerThickness/2.);
260   for (i = 0; i < 3; i++) {                    << 271   for(i=0;i<3;i++)
261     fLayerLogical[i] =                         << 272   {
262       new G4LogicalVolume(fLayerSolid, fAbsorb << 273     fLayerLogical[i] 
263     fLayerPhysical[i] = new G4PVReplica(fCalNa << 274       = new G4LogicalVolume(fLayerSolid,fAbsorberMaterial,fCalName[i]+"_LayerLog");
264                                         kZAxis << 275     fLayerPhysical[i] 
                                                   >> 276       = new G4PVReplica(fCalName[i]+"_Layer",fLayerLogical[i],fCalorLogical[i],
                                                   >> 277                         kZAxis,fNumberOfLayers,fLayerThickness);
265   }                                               278   }
266                                                << 279    
267   //                                              280   //
268   // Gap                                          281   // Gap
269   //                                              282   //
270   fGapSolid = new G4Box("Gap", 0.5 * m, 0.5 *  << 283   fGapSolid = new G4Box("Gap",0.5*m,0.5*m,fLayerThickness/4.);
271   for (i = 0; i < 3; i++) {                    << 284   for(i=0;i<3;i++)
272     fGapLogical[i] = new G4LogicalVolume(fGapS << 285   {
273     fGapPhysical[i] =                          << 286     fGapLogical[i] = new G4LogicalVolume(fGapSolid,fGapMaterial,fCalName[i]+"_Gap");
274       new G4PVPlacement(0, G4ThreeVector(0., 0 << 287     fGapPhysical[i] = new G4PVPlacement(0,G4ThreeVector(0.,0.,fLayerThickness/4.),
275                         fCalName[i] + "_gap",  << 288                 fGapLogical[i],fCalName[i]+"_gap",fLayerLogical[i],false,0);
276   }                                               289   }
277                                                   290 
278   //                                              291   //
279   // Regions                                      292   // Regions
280   //                                              293   //
281   for (i = 0; i < 3; i++) {                    << 294   for(i=0;i<3;i++)
                                                   >> 295   {
282     G4Region* aRegion = new G4Region(fCalName[    296     G4Region* aRegion = new G4Region(fCalName[i]);
283     fCalorLogical[i]->SetRegion(aRegion);         297     fCalorLogical[i]->SetRegion(aRegion);
284     aRegion->AddRootLogicalVolume(fCalorLogica    298     aRegion->AddRootLogicalVolume(fCalorLogical[i]);
285   }                                               299   }
286                                                   300 
287   //                                           << 301   //                                        
288   // Visualization attributes                     302   // Visualization attributes
289   //                                              303   //
290   fWorldLogical->SetVisAttributes(G4VisAttribu    304   fWorldLogical->SetVisAttributes(G4VisAttributes::GetInvisible());
291   G4VisAttributes* simpleBoxVisAtt = new G4Vis << 305   G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
292   simpleBoxVisAtt->SetVisibility(true);           306   simpleBoxVisAtt->SetVisibility(true);
293   for (i = 0; i < 3; i++) {                    << 307   for(i=0;i<3;i++)
                                                   >> 308   { 
294     fCalorLogical[i]->SetVisAttributes(simpleB    309     fCalorLogical[i]->SetVisAttributes(simpleBoxVisAtt);
295     fLayerLogical[i]->SetVisAttributes(simpleB    310     fLayerLogical[i]->SetVisAttributes(simpleBoxVisAtt);
296     fGapLogical[i]->SetVisAttributes(simpleBox    311     fGapLogical[i]->SetVisAttributes(simpleBoxVisAtt);
297   }                                               312   }
                                                   >> 313   
298 }                                                 314 }
299                                                   315 
300 //....oooOO0OOooo........oooOO0OOooo........oo    316 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
301                                                   317 
302 void RE06DetectorConstruction::SetupDetectors(    318 void RE06DetectorConstruction::SetupDetectors()
303 {                                                 319 {
304   G4SDManager::GetSDMpointer()->SetVerboseLeve    320   G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
305   G4String filterName, particleName;              321   G4String filterName, particleName;
306                                                   322 
307   G4SDParticleFilter* gammaFilter =            << 323   G4SDParticleFilter* gammaFilter 
308     new G4SDParticleFilter(filterName = "gamma << 324     = new G4SDParticleFilter(filterName="gammaFilter",particleName="gamma");
309   G4SDParticleFilter* electronFilter =         << 325   G4SDParticleFilter* electronFilter 
310     new G4SDParticleFilter(filterName = "elect << 326     = new G4SDParticleFilter(filterName="electronFilter",particleName="e-");
311   G4SDParticleFilter* positronFilter =         << 327   G4SDParticleFilter* positronFilter 
312     new G4SDParticleFilter(filterName = "posit << 328     = new G4SDParticleFilter(filterName="positronFilter",particleName="e+");
313   G4SDParticleFilter* epFilter = new G4SDParti << 329   G4SDParticleFilter* epFilter 
314   epFilter->add(particleName = "e-");          << 330     = new G4SDParticleFilter(filterName="epFilter");
315   epFilter->add(particleName = "e+");          << 331   epFilter->add(particleName="e-");
316                                                << 332   epFilter->add(particleName="e+");
317   for (G4int i = 0; i < 3; i++) {              << 333 
318     for (G4int j = 0; j < 2; j++) {            << 334 
319       // Loop counter j = 0 : absorber         << 335   for(G4int i=0;i<3;i++)
320       //                = 1 : gap              << 336   {
321       G4String detName = fCalName[i];          << 337    for(G4int j=0;j<2;j++)
322       if (j == 0) {                            << 338    {
323         detName += "_abs";                     << 339     // Loop counter j = 0 : absorber
324       }                                        << 340     //                = 1 : gap
325       else {                                   << 341     G4String detName = fCalName[i];
326         detName += "_gap";                     << 342     if(j==0)
327       }                                        << 343     { detName += "_abs"; }
328       G4MultiFunctionalDetector* det = new G4M << 344     else
329       G4SDManager::GetSDMpointer()->AddNewDete << 345     { detName += "_gap"; }
330                                                << 346     G4MultiFunctionalDetector* det = new G4MultiFunctionalDetector(detName);
331       // The second argument in each primitive << 347     G4SDManager::GetSDMpointer()->AddNewDetector(det);
332       // hierarchy, the copy number of that le << 348 
333       // G4THitsMap.                           << 349     // The second argument in each primitive means the "level" of geometrical 
334       // For absorber (j = 0), the copy number << 350     // hierarchy, the copy number of that level is used as the key of the 
335       // For gap (j = 1), the copy number of i << 351     // G4THitsMap.
336       // since there is only one physical volu << 352     // For absorber (j = 0), the copy number of its own physical volume is used.
337       // to its mother.                        << 353     // For gap (j = 1), the copy number of its mother physical volume is used, 
338       G4VPrimitiveScorer* primitive;           << 354     // since there is only one physical volume of gap is placed with respect 
339       primitive = new G4PSEnergyDeposit("eDep" << 355     // to its mother.
340       det->RegisterPrimitive(primitive);       << 356     G4VPrimitiveScorer* primitive;
341       primitive = new G4PSNofSecondary("nGamma << 357     primitive = new G4PSEnergyDeposit("eDep",j);
342       primitive->SetFilter(gammaFilter);       << 358     det->RegisterPrimitive(primitive);
343       det->RegisterPrimitive(primitive);       << 359     primitive = new G4PSNofSecondary("nGamma",j);
344       primitive = new G4PSNofSecondary("nElect << 360     primitive->SetFilter(gammaFilter);
345       primitive->SetFilter(electronFilter);    << 361     det->RegisterPrimitive(primitive);
346       det->RegisterPrimitive(primitive);       << 362     primitive = new G4PSNofSecondary("nElectron",j);
347       primitive = new G4PSNofSecondary("nPosit << 363     primitive->SetFilter(electronFilter);
348       primitive->SetFilter(positronFilter);    << 364     det->RegisterPrimitive(primitive);
349       det->RegisterPrimitive(primitive);       << 365     primitive = new G4PSNofSecondary("nPositron",j);
350       primitive = new G4PSMinKinEAtGeneration( << 366     primitive->SetFilter(positronFilter);
351       primitive->SetFilter(gammaFilter);       << 367     det->RegisterPrimitive(primitive);
352       det->RegisterPrimitive(primitive);       << 368     primitive = new G4PSMinKinEAtGeneration("minEkinGamma",j);
353       primitive = new G4PSMinKinEAtGeneration( << 369     primitive->SetFilter(gammaFilter);
354       primitive->SetFilter(electronFilter);    << 370     det->RegisterPrimitive(primitive);
355       det->RegisterPrimitive(primitive);       << 371     primitive = new G4PSMinKinEAtGeneration("minEkinElectron",j);
356       primitive = new G4PSMinKinEAtGeneration( << 372     primitive->SetFilter(electronFilter);
357       primitive->SetFilter(positronFilter);    << 373     det->RegisterPrimitive(primitive);
358       det->RegisterPrimitive(primitive);       << 374     primitive = new G4PSMinKinEAtGeneration("minEkinPositron",j);
359       primitive = new G4PSTrackLength("trackLe << 375     primitive->SetFilter(positronFilter);
360       primitive->SetFilter(epFilter);          << 376     det->RegisterPrimitive(primitive);
361       det->RegisterPrimitive(primitive);       << 377     primitive = new G4PSTrackLength("trackLength",j);
362       primitive = new G4PSNofStep("nStep", j); << 378     primitive->SetFilter(epFilter);
363       primitive->SetFilter(epFilter);          << 379     det->RegisterPrimitive(primitive);
364       det->RegisterPrimitive(primitive);       << 380     primitive = new G4PSNofStep("nStep",j);
365                                                << 381     primitive->SetFilter(epFilter);
366       if (j == 0) {                            << 382     det->RegisterPrimitive(primitive);
367         SetSensitiveDetector(fLayerLogical[i], << 383 
368       }                                        << 384     if(j==0)
369       else {                                   << 385      { SetSensitiveDetector(fLayerLogical[i], det); }
370         SetSensitiveDetector(fGapLogical[i], d << 386     else
371       }                                        << 387     { SetSensitiveDetector(fGapLogical[i], det);}
372     }                                          << 388    }
373   }                                               389   }
374   G4SDManager::GetSDMpointer()->SetVerboseLeve    390   G4SDManager::GetSDMpointer()->SetVerboseLevel(0);
375 }                                                 391 }
376                                                   392 
377 void RE06DetectorConstruction::PrintCalorParam    393 void RE06DetectorConstruction::PrintCalorParameters() const
378 {                                                 394 {
379   G4cout << "--------------------------------- << 395   G4cout 
380   if (fSerial) {                               << 396     << "--------------------------------------------------------" << G4endl;
381     G4cout << " Calorimeters are placed in ser << 397   if(fSerial)
382   }                                            << 398   { G4cout << " Calorimeters are placed in serial." << G4endl; }
383   else {                                       << 399   else
384     G4cout << " Calorimeters are placed in par << 400   { G4cout << " Calorimeters are placed in parallel." << G4endl; }
385   }                                            << 401   G4cout 
386   G4cout << " Absorber is made of " << fAbsorb << 402     << " Absorber is made of " << fAbsorberMaterial->GetName() << G4endl
387          << fGapMaterial->GetName() << G4endl  << 403     << " Gap is made of " << fGapMaterial->GetName() << G4endl
388          << "--------------------------------- << 404     << "--------------------------------------------------------" << G4endl;
389 }                                                 405 }
390                                                   406 
391 //....oooOO0OOooo........oooOO0OOooo........oo    407 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
392                                                   408 
393 void RE06DetectorConstruction::SetAbsorberMate    409 void RE06DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
394 {                                                 410 {
395   // search the material by its name           << 411   // search the material by its name   
396   G4Material* pttoMaterial = G4Material::GetMa << 412   G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);     
397   if (pttoMaterial) {                          << 413   if(pttoMaterial)
                                                   >> 414   {
398     fAbsorberMaterial = pttoMaterial;             415     fAbsorberMaterial = pttoMaterial;
399     if (fConstructed)                          << 416     if(fConstructed) for(size_t i=0;i<3;i++)
400       for (size_t i = 0; i < 3; i++) {         << 417     {
401         fCalorLogical[i]->SetMaterial(fAbsorbe << 418       fCalorLogical[i]->SetMaterial(fAbsorberMaterial);
402         fLayerLogical[i]->SetMaterial(fAbsorbe << 419       fLayerLogical[i]->SetMaterial(fAbsorberMaterial);
403       }                                        << 420     }
404     G4RunManager::GetRunManager()->GeometryHas    421     G4RunManager::GetRunManager()->GeometryHasBeenModified();
405     if (GetVerboseLevel() > 1) {               << 422     if (GetVerboseLevel()>1) {
406       PrintCalorParameters();                     423       PrintCalorParameters();
407     }                                             424     }
408   }                                               425   }
409   else {                                       << 426   else
410     G4cerr << materialChoice << " is not defin << 427   { 
                                                   >> 428     G4cerr 
                                                   >> 429       << materialChoice << " is not defined. - Command is ignored." << G4endl; 
411   }                                               430   }
412 }                                                 431 }
413                                                   432 
414 //....oooOO0OOooo........oooOO0OOooo........oo    433 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
415                                                   434 
416 G4String RE06DetectorConstruction::GetAbsorber    435 G4String RE06DetectorConstruction::GetAbsorberMaterial() const
417 {                                              << 436 { return fAbsorberMaterial->GetName(); }
418   return fAbsorberMaterial->GetName();         << 
419 }                                              << 
420                                                   437 
421 //....oooOO0OOooo........oooOO0OOooo........oo    438 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
422                                                   439 
423 void RE06DetectorConstruction::SetGapMaterial(    440 void RE06DetectorConstruction::SetGapMaterial(G4String materialChoice)
424 {                                                 441 {
425   // search the material by its name           << 442   // search the material by its name 
426   G4Material* pttoMaterial = G4Material::GetMa << 443   G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);  
427   if (pttoMaterial) {                          << 444   if(pttoMaterial)
                                                   >> 445   {
428     fGapMaterial = pttoMaterial;                  446     fGapMaterial = pttoMaterial;
429     if (fConstructed)                          << 447     if(fConstructed) for(size_t i=0;i<3;i++)
430       for (size_t i = 0; i < 3; i++) {         << 448     { fGapLogical[i]->SetMaterial(fGapMaterial); }
431         fGapLogical[i]->SetMaterial(fGapMateri << 
432       }                                        << 
433     G4RunManager::GetRunManager()->GeometryHas    449     G4RunManager::GetRunManager()->GeometryHasBeenModified();
434     if (GetVerboseLevel() > 1) {               << 450     if (GetVerboseLevel()>1) {
435       PrintCalorParameters();                     451       PrintCalorParameters();
436     }                                             452     }
437   }                                            << 453    }
438   else {                                       << 454   else
439     G4cerr << materialChoice << " is not defin << 455   { 
                                                   >> 456     G4cerr 
                                                   >> 457       << materialChoice << " is not defined. - Command is ignored." << G4endl; 
440   }                                               458   }
441 }                                                 459 }
442                                                   460 
443 G4String RE06DetectorConstruction::GetGapMater    461 G4String RE06DetectorConstruction::GetGapMaterial() const
444 {                                              << 462 { return fGapMaterial->GetName(); }
445   return fGapMaterial->GetName();              << 
446 }                                              << 
447                                                   463 
448 //....oooOO0OOooo........oooOO0OOooo........oo    464 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
449                                                   465 
450 void RE06DetectorConstruction::SetSerialGeomet    466 void RE06DetectorConstruction::SetSerialGeometry(G4bool serial)
451 {                                                 467 {
452   if (fSerial == serial) return;               << 468   if(fSerial==serial) return;
453   fSerial = serial;                            << 469   fSerial=serial;
454   RE06PrimaryGeneratorAction* gen =            << 470   RE06PrimaryGeneratorAction* gen = (RE06PrimaryGeneratorAction*)
455     (RE06PrimaryGeneratorAction*)(G4RunManager << 471           (G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
456   if (gen) gen->SetSerial(fSerial);            << 472   if(gen) gen->SetSerial(fSerial);
457   if (!fConstructed) return;                   << 473   if(!fConstructed) return;
458   for (G4int i = 0; i < 3; i++) {              << 474   for(G4int i=0;i<3;i++)
459     if (fSerial) {                             << 475   {
460       fCalorPhysical[i]->SetTranslation(G4Thre << 476     if(fSerial)
                                                   >> 477     { 
                                                   >> 478       fCalorPhysical[i]
                                                   >> 479         ->SetTranslation(G4ThreeVector(0.,0.,G4double(i-1)*2.*m));
461     }                                             480     }
462     else {                                     << 481     else
463       fCalorPhysical[i]->SetTranslation(G4Thre << 482     { 
                                                   >> 483       fCalorPhysical[i]
                                                   >> 484         ->SetTranslation(G4ThreeVector(0.,G4double(i-1)*m,0.)); 
464     }                                             485     }
465   }                                               486   }
466   ((RE06ParallelWorld*)GetParallelWorld(0))->S    487   ((RE06ParallelWorld*)GetParallelWorld(0))->SetSerialGeometry(serial);
467   G4RunManager::GetRunManager()->GeometryHasBe    488   G4RunManager::GetRunManager()->GeometryHasBeenModified();
468 }                                                 489 }
469                                                   490 
470 //....oooOO0OOooo........oooOO0OOooo........oo    491 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
471                                                   492 
472 void RE06DetectorConstruction::SetNumberOfLaye    493 void RE06DetectorConstruction::SetNumberOfLayers(G4int nl)
473 {                                                 494 {
474   fNumberOfLayers = nl;                           495   fNumberOfLayers = nl;
475   fLayerThickness = fTotalThickness / fNumberO << 496   fLayerThickness = fTotalThickness/fNumberOfLayers;
476   if (!fConstructed) return;                   << 497   if(!fConstructed) return;
477                                                   498 
478   fLayerSolid->SetZHalfLength(fLayerThickness  << 499   fLayerSolid->SetZHalfLength(fLayerThickness/2.);
479   fGapSolid->SetZHalfLength(fLayerThickness /  << 500   fGapSolid->SetZHalfLength(fLayerThickness/4.);
480   for (size_t i = 0; i < 3; i++) {             << 501   for(size_t i=0;i<3;i++)
                                                   >> 502   { 
481     fCalorLogical[i]->RemoveDaughter(fLayerPhy    503     fCalorLogical[i]->RemoveDaughter(fLayerPhysical[i]);
482     delete fLayerPhysical[i];                     504     delete fLayerPhysical[i];
483     fLayerPhysical[i] = new G4PVReplica(fCalNa << 505     fLayerPhysical[i] 
484                                         kZAxis << 506       = new G4PVReplica(fCalName[i]+"_Layer",fLayerLogical[i],fCalorLogical[i],
485     fGapPhysical[i]->SetTranslation(G4ThreeVec << 507                         kZAxis,fNumberOfLayers,fLayerThickness);
                                                   >> 508     fGapPhysical[i]->SetTranslation(G4ThreeVector(0.,0.,fLayerThickness/4.));
486   }                                               509   }
487   G4RunManager::GetRunManager()->GeometryHasBe    510   G4RunManager::GetRunManager()->GeometryHasBeenModified();
488 }                                                 511 }
489                                                   512 
490 //....oooOO0OOooo........oooOO0OOooo........oo    513 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
491                                                   514 
492 void RE06DetectorConstruction::AddMaterial()   << 515 void   RE06DetectorConstruction::AddMaterial()
493 {                                                 516 {
494   static G4bool isAdded = false;               << 517   static G4bool isAdded = false;   
495                                                   518 
496   if (isAdded) return;                         << 519   if( isAdded ) return;
497                                                   520 
498   G4String name, symbol;  // a=mass of a mole; << 521   G4String name, symbol;             //a=mass of a mole;
499   G4double a, z, density;  // z=mean number of << 522   G4double a, z, density;            //z=mean number of protons;  
500                                                   523 
501   G4int ncomponents, natoms;                      524   G4int ncomponents, natoms;
502                                                   525 
503   //                                              526   //
504   // define simple materials                      527   // define simple materials
505   //                                              528   //
506                                                   529 
507   new G4Material(name = "Copper", z = 29., a = << 530   new G4Material(name="Copper", z=29., a=63.546*g/mole, density=8.96*g/cm3);
508   new G4Material(name = "Tungsten", z = 74., a << 531   new G4Material(name="Tungsten", z=74., a=183.84*g/mole, density=19.3*g/cm3);
509                                                   532 
510   G4Element* C = G4Element::GetElement("Carbon    533   G4Element* C = G4Element::GetElement("Carbon");
511   G4Element* O = G4Element::GetElement("Oxygen    534   G4Element* O = G4Element::GetElement("Oxygen");
                                                   >> 535   
512                                                   536 
513   G4Material* CO2 = new G4Material("CarbonicGa << 537   G4Material* CO2 = 
514                                    kStateGas,  << 538     new G4Material("CarbonicGas", density= 27.*mg/cm3, ncomponents=2,
515   CO2->AddElement(C, natoms = 1);              << 539                    kStateGas, 325.*kelvin, 50.*atmosphere);
516   CO2->AddElement(O, natoms = 2);              << 540   CO2->AddElement(C, natoms=1);
                                                   >> 541   CO2->AddElement(O, natoms=2);
517                                                   542 
518   isAdded = true;                                 543   isAdded = true;
                                                   >> 544 
519 }                                                 545 }
520                                                   546 
521 //....oooOO0OOooo........oooOO0OOooo........oo    547 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
522                                                   548