Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/amsEcal/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/advanced/amsEcal/src/DetectorConstruction.cc (Version 11.3.0) and /examples/advanced/amsEcal/src/DetectorConstruction.cc (Version 9.5.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 // $Id: DetectorConstruction.cc,v 1.12 2010-05-22 21:36:46 maire Exp $
                                                   >>  27 // GEANT4 tag $Name: not supported by cvs2svn $
 26 //                                                 28 //
 27 //....oooOO0OOooo........oooOO0OOooo........oo     29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 28 //....oooOO0OOooo........oooOO0OOooo........oo     30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 29                                                    31 
 30 #include "DetectorConstruction.hh"                 32 #include "DetectorConstruction.hh"
                                                   >>  33 #include "DetectorMessenger.hh"
 31                                                    34 
 32 #include "G4SystemOfUnits.hh"                  << 
 33 #include "G4PhysicalConstants.hh"              << 
 34 #include "G4Material.hh"                           35 #include "G4Material.hh"
 35 #include "G4Tubs.hh"                               36 #include "G4Tubs.hh"
 36 #include "G4Box.hh"                                37 #include "G4Box.hh"
 37 #include "G4LogicalVolume.hh"                      38 #include "G4LogicalVolume.hh"
 38 #include "G4PVPlacement.hh"                        39 #include "G4PVPlacement.hh"
 39 #include "G4PVReplica.hh"                          40 #include "G4PVReplica.hh"
 40 #include "G4Transform3D.hh"                    << 
 41 #include "G4RotationMatrix.hh"                     41 #include "G4RotationMatrix.hh"
 42                                                    42 
                                                   >>  43 #include "G4UniformMagField.hh"
                                                   >>  44 
 43 #include "G4GeometryManager.hh"                    45 #include "G4GeometryManager.hh"
 44 #include "G4PhysicalVolumeStore.hh"                46 #include "G4PhysicalVolumeStore.hh"
 45 #include "G4LogicalVolumeStore.hh"                 47 #include "G4LogicalVolumeStore.hh"
 46 #include "G4SolidStore.hh"                         48 #include "G4SolidStore.hh"
 47                                                    49 
                                                   >>  50 #include "G4UnitsTable.hh"
                                                   >>  51 
 48 #include "G4VisAttributes.hh"                      52 #include "G4VisAttributes.hh"
 49                                                    53 
 50                                                    54 
 51 //....oooOO0OOooo........oooOO0OOooo........oo     55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 52                                                    56 
 53 DetectorConstruction::DetectorConstruction()       57 DetectorConstruction::DetectorConstruction()
 54 :fiberMat(0),lvol_fiber(0), absorberMat(0),lvo     58 :fiberMat(0),lvol_fiber(0), absorberMat(0),lvol_layer(0),
 55  moduleMat(0),lvol_module(0), calorimeterMat(0     59  moduleMat(0),lvol_module(0), calorimeterMat(0),lvol_calorimeter(0),
 56  worldMat(0),pvol_world(0), defaultMat(0)      <<  60  worldMat(0),pvol_world(0), defaultMat(0), magField(0)
 57 {                                                  61 {
 58   // materials                                     62   // materials
 59   DefineMaterials();                               63   DefineMaterials();
 60                                                    64   
 61   // default parameter values of calorimeter       65   // default parameter values of calorimeter
 62   //                                               66   //
 63   fiberDiameter       = 1.13*mm;  //1.08*mm        67   fiberDiameter       = 1.13*mm;  //1.08*mm
 64   nbOfFibers          = 490;    //490              68   nbOfFibers          = 490;    //490
 65   distanceInterFibers = 1.35*mm;  //1.35*mm        69   distanceInterFibers = 1.35*mm;  //1.35*mm
 66   layerThickness      = 1.73*mm;  //1.68*mm    <<  70   layerThickness      = 1.73*mm;  //1.68*mm
 67   milledLayer         = 1.00*mm;    //1.40*mm  <<  71   milledLayer         = 1.00*mm;        //1.40*mm ?
 68   nbOfLayers          = 10;       //10         <<  72   nbOfLayers          = 10;   //10
 69   nbOfModules         = 9;        //9          <<  73   nbOfModules         = 9;    //9
 70                                                    74      
 71   fiberLength         = (nbOfFibers+0.5)*dista <<  75   fiberLength         = (nbOfFibers+1)*distanceInterFibers; //658*mm
                                                   >>  76       
                                                   >>  77   //pixels readout
                                                   >>  78   //
                                                   >>  79   G4int nSubModul     = 2;      //2   
                                                   >>  80   n1pxl               = nbOfModules*nSubModul;  //18
                                                   >>  81   n2pxl               = 72;     //72
                                                   >>  82   
                                                   >>  83   n1shift = 1;
                                                   >>  84   if (n1pxl > 1)   n1shift = 10;
                                                   >>  85   if (n1pxl > 10)  n1shift = 100;
                                                   >>  86   if (n1pxl > 100) n1shift = 1000;        
                                                   >>  87   
                                                   >>  88   sizeVectorPxl    = n1pxl*n1shift;   //1800
                                                   >>  89   
                                                   >>  90   // create commands for interactive definition of the calorimeter
                                                   >>  91   detectorMessenger = new DetectorMessenger(this);   
 72 }                                                  92 }
 73                                                    93 
 74 //....oooOO0OOooo........oooOO0OOooo........oo     94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 75                                                    95 
 76 DetectorConstruction::~DetectorConstruction()      96 DetectorConstruction::~DetectorConstruction()
 77 { }                                            <<  97 { 
                                                   >>  98   delete detectorMessenger;
                                                   >>  99 }
 78                                                   100 
 79 //....oooOO0OOooo........oooOO0OOooo........oo    101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 80                                                   102 
 81 G4VPhysicalVolume* DetectorConstruction::Const    103 G4VPhysicalVolume* DetectorConstruction::Construct()
 82 {                                                 104 {
 83   return ConstructCalorimeter();                  105   return ConstructCalorimeter();
 84 }                                                 106 }
 85                                                   107 
 86 //....oooOO0OOooo........oooOO0OOooo........oo    108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 87                                                   109 
 88 void DetectorConstruction::DefineMaterials()      110 void DetectorConstruction::DefineMaterials()
 89 {                                                 111 {
 90   // define Elements                              112   // define Elements
 91   //                                              113   //
 92   G4Element* H  = new G4Element("Hydrogen","H"    114   G4Element* H  = new G4Element("Hydrogen","H", 1,  1.01*g/mole);
 93   G4Element* C  = new G4Element("Carbon",  "C"    115   G4Element* C  = new G4Element("Carbon",  "C", 6, 12.01*g/mole);
 94   G4Element* N  = new G4Element("Nitrogen","N"    116   G4Element* N  = new G4Element("Nitrogen","N", 7, 14.01*g/mole);
 95   G4Element* O  = new G4Element("Oxygen",  "O"    117   G4Element* O  = new G4Element("Oxygen",  "O", 8, 16.00*g/mole);
 96                                                   118 
 97   G4int natoms, ncomponents;                      119   G4int natoms, ncomponents;
 98   G4double density, massfraction;                 120   G4double density, massfraction;            
 99                                                   121 
100   // Lead                                         122   // Lead
101   //                                              123   //
102   G4Material* Pb =                                124   G4Material* Pb =   
103   new G4Material("Lead", 82., 207.20*g/mole, d    125   new G4Material("Lead", 82., 207.20*g/mole, density= 0.98*11.20*g/cm3);
104                                                   126 
105   // Scintillator                                 127   // Scintillator
106   //                                              128   //
107   G4Material* Sci =                               129   G4Material* Sci = 
108   new G4Material("Scintillator", density= 1.03    130   new G4Material("Scintillator", density= 1.032*g/cm3, ncomponents=2);
109   Sci->AddElement(C, natoms=8);                   131   Sci->AddElement(C, natoms=8);
110   Sci->AddElement(H, natoms=8);                   132   Sci->AddElement(H, natoms=8);
111                                                   133   
112   Sci->GetIonisation()->SetBirksConstant(0.126    134   Sci->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
113                                                   135 
114   // Air                                          136   // Air
115   //                                              137   //
116   G4Material* Air =                               138   G4Material* Air = 
117   new G4Material("Air", density= 1.290*mg/cm3,    139   new G4Material("Air", density= 1.290*mg/cm3, ncomponents=2);
118   Air->AddElement(N, massfraction=70*perCent);    140   Air->AddElement(N, massfraction=70*perCent);
119   Air->AddElement(O, massfraction=30.*perCent)    141   Air->AddElement(O, massfraction=30.*perCent);
120                                                   142 
121   // example of vacuum                            143   // example of vacuum
122   //                                              144   //
123   density     = universe_mean_density;    //fr    145   density     = universe_mean_density;    //from PhysicalConstants.h
124   G4double pressure    = 3.e-18*pascal;           146   G4double pressure    = 3.e-18*pascal;
125   G4double temperature = 2.73*kelvin;             147   G4double temperature = 2.73*kelvin;
126   G4Material* Vacuum =                            148   G4Material* Vacuum =   
127   new G4Material("Galactic", 1., 1.008*g/mole,    149   new G4Material("Galactic", 1., 1.008*g/mole, density,
128                              kStateGas,tempera    150                              kStateGas,temperature,pressure);
129                                                   151 
130   //attribute materials                           152   //attribute materials
131   //                                              153   //
132   defaultMat     = Vacuum;                        154   defaultMat     = Vacuum;  
133   fiberMat       = Sci;                           155   fiberMat       = Sci;
134   absorberMat    = Pb;                            156   absorberMat    = Pb;
135   moduleMat      = defaultMat;                    157   moduleMat      = defaultMat;
136   calorimeterMat = defaultMat;                    158   calorimeterMat = defaultMat;
137   worldMat       = defaultMat;                    159   worldMat       = defaultMat;
138                                                   160 
139   // print table                                  161   // print table
140   //                                              162   //      
141   G4cout << *(G4Material::GetMaterialTable())     163   G4cout << *(G4Material::GetMaterialTable()) << G4endl;
142 }                                                 164 }
143                                                   165 
144 //....oooOO0OOooo........oooOO0OOooo........oo    166 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
145                                                   167 
146 G4VPhysicalVolume* DetectorConstruction::Const    168 G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
147 {                                                 169 {
148   // Cleanup old geometry                         170   // Cleanup old geometry
149   //                                              171   //
150   G4GeometryManager::GetInstance()->OpenGeomet    172   G4GeometryManager::GetInstance()->OpenGeometry();
151   G4PhysicalVolumeStore::GetInstance()->Clean(    173   G4PhysicalVolumeStore::GetInstance()->Clean();
152   G4LogicalVolumeStore::GetInstance()->Clean()    174   G4LogicalVolumeStore::GetInstance()->Clean();
153   G4SolidStore::GetInstance()->Clean();           175   G4SolidStore::GetInstance()->Clean();
154                                                   176   
155   // fibers                                       177   // fibers
156   //                                              178   //
157   G4Tubs*                                         179   G4Tubs*
158   svol_fiber = new G4Tubs("fiber",      //name    180   svol_fiber = new G4Tubs("fiber",      //name
159                          0*mm, 0.5*fiberDiamet    181                          0*mm, 0.5*fiberDiameter, //r1, r2
160        0.5*fiberLength,   //half-length           182        0.5*fiberLength,   //half-length 
161        0., twopi);      //theta1, theta2          183        0., twopi);      //theta1, theta2
162                                                   184        
163   lvol_fiber = new G4LogicalVolume(svol_fiber,    185   lvol_fiber = new G4LogicalVolume(svol_fiber,    //solid
164                                    fiberMat,      186                                    fiberMat,    //material
165                                    "fiber");      187                                    "fiber");    //name
166                                                   188            
167   // layer                                        189   // layer
168   //                                              190   //
169   G4double sizeX = layerThickness;                191   G4double sizeX = layerThickness;
170   G4double sizeY = distanceInterFibers*nbOfFib    192   G4double sizeY = distanceInterFibers*nbOfFibers;
171   G4double sizeZ = fiberLength;                   193   G4double sizeZ = fiberLength;
172                                                   194   
173   G4Box*                                          195   G4Box*      
174   svol_layer = new G4Box("layer",     //name      196   svol_layer = new G4Box("layer",     //name
175                   0.5*sizeX, 0.5*sizeY, 0.5*si    197                   0.5*sizeX, 0.5*sizeY, 0.5*sizeZ); //size
176                                                   198 
177                                                   199 
178   lvol_layer = new G4LogicalVolume(svol_layer,    200   lvol_layer = new G4LogicalVolume(svol_layer,    //solid
179                                    absorberMat    201                                    absorberMat,   //material
180                                    "layer");      202                                    "layer");    //name
181                                                   203 
182   // put fibers within layer                      204   // put fibers within layer
183   //                                              205   //
184   G4double Xcenter = 0.;                          206   G4double Xcenter = 0.;
185   G4double Ycenter = -0.5*(sizeY + distanceInt    207   G4double Ycenter = -0.5*(sizeY + distanceInterFibers);
186                                                   208   
187   for (G4int k=0; k<nbOfFibers; k++) {            209   for (G4int k=0; k<nbOfFibers; k++) {
188     Ycenter += distanceInterFibers;               210     Ycenter += distanceInterFibers;
189     new G4PVPlacement(0,          //no rotatio    211     new G4PVPlacement(0,          //no rotation
190             G4ThreeVector(Xcenter,Ycenter,0.),    212             G4ThreeVector(Xcenter,Ycenter,0.),    //position
191                       lvol_fiber,                 213                       lvol_fiber,             //logical volume  
192                       "fiber",          //name    214                       "fiber",          //name
193                       lvol_layer,           //    215                       lvol_layer,           //mother
194                       false,                //    216                       false,                //no boulean operat
195                       k+1);                    << 217                       k);                   //copy number
196                                                   218 
197   }                                               219   }
198                                                   220            
199   // modules                                      221   // modules
200   //                                              222   //
201   moduleThickness = layerThickness*nbOfLayers     223   moduleThickness = layerThickness*nbOfLayers + milledLayer;       
202   sizeX = moduleThickness;                        224   sizeX = moduleThickness;
203   sizeY = fiberLength;                            225   sizeY = fiberLength;
204   sizeZ = fiberLength;                            226   sizeZ = fiberLength;
205                                                   227   
206   G4Box*                                          228   G4Box*      
207   svol_module = new G4Box("module",     //name    229   svol_module = new G4Box("module",     //name
208                   0.5*sizeX, 0.5*sizeY, 0.5*si    230                   0.5*sizeX, 0.5*sizeY, 0.5*sizeZ); //size
209                                                   231 
210   lvol_module = new G4LogicalVolume(svol_modul    232   lvol_module = new G4LogicalVolume(svol_module,  //solid
211                                    absorberMat    233                                    absorberMat,   //material
212                                    "module");     234                                    "module");   //name
213                                                   235 
214   // put layers within module                     236   // put layers within module
215   //                                              237   //
216   Xcenter = -0.5*(nbOfLayers+1)*layerThickness    238   Xcenter = -0.5*(nbOfLayers+1)*layerThickness;
217   Ycenter =  0.25*distanceInterFibers;            239   Ycenter =  0.25*distanceInterFibers;
218                                                   240   
219   for (G4int k=0; k<nbOfLayers; k++) {            241   for (G4int k=0; k<nbOfLayers; k++) {
220     Xcenter += layerThickness;                    242     Xcenter += layerThickness;
221     Ycenter  = - Ycenter;                         243     Ycenter  = - Ycenter;
222     new G4PVPlacement(0,          //no rotatio    244     new G4PVPlacement(0,          //no rotation
223             G4ThreeVector(Xcenter,Ycenter,0.),    245             G4ThreeVector(Xcenter,Ycenter,0.),    //position
224                       lvol_layer,                 246                       lvol_layer,             //logical volume  
225                       "layer",          //name    247                       "layer",          //name
226                       lvol_module,                248                       lvol_module,            //mother
227                       false,                //    249                       false,                //no boulean operat
228                       k+1);                    << 250                       k);                   //copy number
229                                                   251 
230   }                                               252   }                    
231                                                   253 
232   // calorimeter                                  254   // calorimeter
233   //                                              255   //
234   calorThickness = moduleThickness*nbOfModules    256   calorThickness = moduleThickness*nbOfModules;
235   sizeX = calorThickness;                         257   sizeX = calorThickness;
236   sizeY = fiberLength;                            258   sizeY = fiberLength;
237   sizeZ = fiberLength;                            259   sizeZ = fiberLength;
238                                                   260   
239   G4Box*                                          261   G4Box*      
240   svol_calorimeter = new G4Box("calorimeter",     262   svol_calorimeter = new G4Box("calorimeter",   //name
241                   0.5*sizeX, 0.5*sizeY, 0.5*si    263                   0.5*sizeX, 0.5*sizeY, 0.5*sizeZ); //size
242                                                   264 
243                                                   265 
244   lvol_calorimeter = new G4LogicalVolume(svol_    266   lvol_calorimeter = new G4LogicalVolume(svol_calorimeter,  //solid
245                                    calorimeter    267                                    calorimeterMat,    //material
246                                    "calorimete    268                                    "calorimeter");    //name  
247                                                   269 
248   // put modules inside calorimeter               270   // put modules inside calorimeter
249   //                                              271   //  
250   Xcenter = -0.5*(calorThickness + moduleThick    272   Xcenter = -0.5*(calorThickness + moduleThickness);
251                                                   273   
252                                                << 274   //rotation matrix to place modules
                                                   >> 275   G4RotationMatrix* rotm = 0;  
                                                   >> 276   G4RotationMatrix* rotmX = new G4RotationMatrix();
                                                   >> 277   rotmX->rotateX(90*deg);
                                                   >> 278     
253   for (G4int k=0; k<nbOfModules; k++) {           279   for (G4int k=0; k<nbOfModules; k++) {
254     Xcenter += moduleThickness;                << 280     rotm = 0;
255     G4RotationMatrix rotm;                     << 281     if ((k+1)%2 == 0) rotm = rotmX;
256     if ((k+1)%2 == 0) rotm.rotateX(90*deg);    << 282     Xcenter += moduleThickness;    
257   G4Transform3D transform(rotm, G4ThreeVector( << 283     new G4PVPlacement(rotm,         //rotation
258     new G4PVPlacement(transform,          //ro << 284             G4ThreeVector(Xcenter,0.,0.),   //position
259                       lvol_module,          //    285                       lvol_module,          //logical volume  
260                       "module",             // << 286                       "module",         //name
261                       lvol_calorimeter,        << 287                       lvol_calorimeter,           //mother
262                       false,                //    288                       false,                //no boulean operat
263                       k+1);                    << 289                       k);                   //copy number
264   }                                               290   }
265                                                   291 
266   // world                                        292   // world
267   //                                              293   //
268   sizeX = 1.2*calorThickness;                     294   sizeX = 1.2*calorThickness;
269   sizeY = 1.2*fiberLength;                        295   sizeY = 1.2*fiberLength;
270   sizeZ = 1.2*fiberLength;                        296   sizeZ = 1.2*fiberLength;
271                                                   297   
272   worldSizeX = sizeX;                             298   worldSizeX = sizeX;
273                                                   299   
274   G4Box*                                          300   G4Box*      
275   svol_world = new G4Box("world",     //name      301   svol_world = new G4Box("world",     //name
276                   0.5*sizeX, 0.5*sizeY, 0.5*si    302                   0.5*sizeX, 0.5*sizeY, 0.5*sizeZ); //size
277                                                   303 
278   lvol_world = new G4LogicalVolume(svol_world,    304   lvol_world = new G4LogicalVolume(svol_world,    //solid
279                                    worldMat,      305                                    worldMat,    //material
280                                    "world");      306                                    "world");    //name 
281                                                   307             
282   pvol_world = new G4PVPlacement(0,     //no r    308   pvol_world = new G4PVPlacement(0,     //no rotation
283            G4ThreeVector(), //at (0,0,0)          309            G4ThreeVector(), //at (0,0,0)
284                                  lvol_world,      310                                  lvol_world,    //logical volume
285                                  "world",   //    311                                  "world",   //name
286                                  0,     //moth    312                                  0,     //mother  volume
287                                  false,     //    313                                  false,     //no boolean operation
288                                  0);      //co    314                                  0);      //copy number
289                                                   315 
290   //put calorimeter in world                      316   //put calorimeter in world
291   //                                              317   //  
292   new G4PVPlacement(0,        //no rotation       318   new G4PVPlacement(0,        //no rotation
293                     G4ThreeVector(),    //at (    319                     G4ThreeVector(),    //at (0,0,0)
294                     lvol_calorimeter,   //logi    320                     lvol_calorimeter,   //logical volume
295                     "calorimeter",    //name      321                     "calorimeter",    //name
296                     lvol_world,     //mother      322                     lvol_world,     //mother  volume
297                     false,      //no boolean o    323                     false,      //no boolean operation
298                     0);       //copy number       324                     0);       //copy number
299                                                   325                  
300   PrintCalorParameters();                         326   PrintCalorParameters();
301                                                   327   
302   // Visualization attributes                     328   // Visualization attributes
303   //                                              329   //
304   lvol_fiber->SetVisAttributes (G4VisAttribute << 330   lvol_fiber->SetVisAttributes (G4VisAttributes::Invisible);  
305   lvol_layer->SetVisAttributes (G4VisAttribute << 331   lvol_layer->SetVisAttributes (G4VisAttributes::Invisible);
306   lvol_world->SetVisAttributes (G4VisAttribute << 332   lvol_world->SetVisAttributes (G4VisAttributes::Invisible);
307                                                << 333   
                                                   >> 334   // Pixels readout
                                                   >> 335   //
                                                   >> 336   d1pxl = calorThickness/n1pxl;
                                                   >> 337   d2pxl = fiberLength/n2pxl;
                                                   >> 338   
308   //always return the physical World              339   //always return the physical World
309   //                                              340   //
310   return pvol_world;                              341   return pvol_world;
311 }                                                 342 }
312                                                   343 
313 //....oooOO0OOooo........oooOO0OOooo........oo    344 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
314                                                   345 
315 #include "G4UnitsTable.hh"                     << 
316                                                << 
317 void DetectorConstruction::PrintCalorParameter    346 void DetectorConstruction::PrintCalorParameters()
318 {                                                 347 {
319   G4cout << "\n-------------------------------    348   G4cout << "\n-------------------------------------------------------------"
320      << "\n ---> The calorimeter is " << nbOfM    349      << "\n ---> The calorimeter is " << nbOfModules << " Modules"
321      << "\n ---> A Module is " << nbOfLayers <    350      << "\n ---> A Module is " << nbOfLayers << " Layers + 1 milled Layer";
322                                                   351      
323   G4cout                                          352   G4cout  
324      << "\n ---> A Layer is " << G4BestUnit(la    353      << "\n ---> A Layer is " << G4BestUnit(layerThickness,"Length")  
325      << " thickness of " << absorberMat->GetNa    354      << " thickness of " << absorberMat->GetName();    
326                                                   355      
327   G4cout                                          356   G4cout 
328      << "\n ---> A Layer includes " << nbOfFib    357      << "\n ---> A Layer includes " << nbOfFibers << " fibers of " 
329      << fiberMat->GetName();                      358      << fiberMat->GetName();
330                                                   359      
331   G4cout                                          360   G4cout 
332      << "\n      ---> diameter : " << G4BestUn    361      << "\n      ---> diameter : " << G4BestUnit(fiberDiameter,"Length")
333      << "\n      ---> length   : " << G4BestUn    362      << "\n      ---> length   : " << G4BestUnit(fiberLength,"Length")
334      << "\n      ---> distance : " << G4BestUn    363      << "\n      ---> distance : " << G4BestUnit(distanceInterFibers,"Length");
335                                                   364      
336   G4cout                                          365   G4cout  
337      << "\n ---> The milled Layer is " << G4Be    366      << "\n ---> The milled Layer is " << G4BestUnit(milledLayer,"Length")  
338      << " thickness of " << absorberMat->GetNa    367      << " thickness of " << absorberMat->GetName();
339                                                   368      
340   G4cout                                          369   G4cout 
341    << "\n\n ---> Module thickness " << G4BestU    370    << "\n\n ---> Module thickness " << G4BestUnit(moduleThickness,"Length");
342                                                   371   
343   G4cout                                          372   G4cout 
344    << "\n\n ---> Total calor thickness " << G4    373    << "\n\n ---> Total calor thickness " << G4BestUnit(calorThickness,"Length")
345    <<   "\n      Tranverse size        " << G4    374    <<   "\n      Tranverse size        " << G4BestUnit(fiberLength,"Length");
346                                                   375 
347   G4cout << "\n-------------------------------    376   G4cout << "\n-------------------------------------------------------------\n";
348   G4cout << G4endl;                               377   G4cout << G4endl;
349 }                                                 378 }
350                                                   379 
351 //....oooOO0OOooo........oooOO0OOooo........oo    380 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
352                                                   381 
353 #include "G4GlobalMagFieldMessenger.hh"        << 382 #include "G4FieldManager.hh"
354 #include "G4AutoDelete.hh"                     << 383 #include "G4TransportationManager.hh"
                                                   >> 384 
                                                   >> 385 void DetectorConstruction::SetMagField(G4double fieldValue)
                                                   >> 386 {
                                                   >> 387   //apply a global uniform magnetic field along Z axis
                                                   >> 388   //
                                                   >> 389   G4FieldManager* fieldMgr
                                                   >> 390    = G4TransportationManager::GetTransportationManager()->GetFieldManager();
                                                   >> 391 
                                                   >> 392   if(magField) delete magField;   //delete the existing magn field
                                                   >> 393 
                                                   >> 394   if(fieldValue!=0.)      // create a new one if non nul
                                                   >> 395   { magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));
                                                   >> 396     fieldMgr->SetDetectorField(magField);
                                                   >> 397     fieldMgr->CreateChordFinder(magField);
                                                   >> 398   } else {
                                                   >> 399     magField = 0;
                                                   >> 400     fieldMgr->SetDetectorField(magField);
                                                   >> 401   }
                                                   >> 402 }
                                                   >> 403 
                                                   >> 404 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 405 
                                                   >> 406 #include "G4RunManager.hh"
355                                                   407 
356 void DetectorConstruction::ConstructSDandField << 408 void DetectorConstruction::UpdateGeometry()
357 {                                                 409 {
358     if ( fFieldMessenger.Get() == 0 ) {        << 410   G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
359         // Create global magnetic field messen << 
360         // Uniform magnetic field is then crea << 
361         // the field value is not zero.        << 
362         G4ThreeVector fieldValue = G4ThreeVect << 
363         G4GlobalMagFieldMessenger* msg =       << 
364         new G4GlobalMagFieldMessenger(fieldVal << 
365         //msg->SetVerboseLevel(1);             << 
366         G4AutoDelete::Register(msg);           << 
367         fFieldMessenger.Put( msg );            << 
368                                                << 
369     }                                          << 
370 }                                                 411 }
371                                                   412 
372 //....oooOO0OOooo........oooOO0OOooo........oo    413 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
373                                                   414