Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/xray_fluorescence/src/XrayFluoPlaneDetectorConstruction.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/xray_fluorescence/src/XrayFluoPlaneDetectorConstruction.cc (Version 11.3.0) and /examples/advanced/xray_fluorescence/src/XrayFluoPlaneDetectorConstruction.cc (Version 8.0.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                    <<   3 // * DISCLAIMER                                                       *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th <<   5 // * The following disclaimer summarizes all the specific disclaimers *
  6 // * the Geant4 Collaboration.  It is provided <<   6 // * of contributors to this software. The specific disclaimers,which *
  7 // * conditions of the Geant4 Software License <<   7 // * govern, are listed with their locations in:                      *
  8 // * LICENSE and available at  http://cern.ch/ <<   8 // *   http://cern.ch/geant4/license                                  *
  9 // * include a list of copyright holders.      << 
 10 // *                                                9 // *                                                                  *
 11 // * Neither the authors of this software syst     10 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     11 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     12 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     13 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  <<  14 // * use.                                                             *
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                               15 // *                                                                  *
 18 // * This  code  implementation is the result  <<  16 // * This  code  implementation is the  intellectual property  of the *
 19 // * technical work of the GEANT4 collaboratio <<  17 // * GEANT4 collaboration.                                            *
 20 // * By using,  copying,  modifying or  distri <<  18 // * By copying,  distributing  or modifying the Program (or any work *
 21 // * any work based  on the software)  you  ag <<  19 // * based  on  the Program)  you indicate  your  acceptance of  this *
 22 // * use  in  resulting  scientific  publicati <<  20 // * statement, and all its terms.                                    *
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // *******************************************     21 // ********************************************************************
 25 //                                                 22 //
 26 //                                                 23 //
                                                   >>  24 // $Id: XrayFluoPlaneDetectorConstruction.cc
                                                   >>  25 // GEANT4 tag $Name: xray_fluo-V03-02-00
 27 //                                                 26 //
 28 // Author: Alfonso Mantero (Alfonso.Mantero@ge     27 // Author: Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
 29 //                                                 28 //
 30 // History:                                        29 // History:
 31 // -----------                                     30 // -----------
 32 // 29 aug 2003 Alfonso Mantero Created             31 // 29 aug 2003 Alfonso Mantero Created
 33 // -------------------------------------------     32 // -------------------------------------------------------------------
 34                                                    33 
 35 #include "XrayFluoPlaneDetectorConstruction.hh     34 #include "XrayFluoPlaneDetectorConstruction.hh"
 36 #include "XrayFluoPlaneDetectorMessenger.hh"       35 #include "XrayFluoPlaneDetectorMessenger.hh"
 37 #include "XrayFluoSD.hh"                           36 #include "XrayFluoSD.hh"
 38 #include "XrayFluoNistMaterials.hh"            << 
 39 #include "G4PhysicalConstants.hh"              << 
 40 #include "G4SystemOfUnits.hh"                  << 
 41 #include "G4Material.hh"                           37 #include "G4Material.hh"
 42 #include "G4ThreeVector.hh"                        38 #include "G4ThreeVector.hh"
 43 #include "G4Box.hh"                                39 #include "G4Box.hh"
 44 #include "G4Sphere.hh"                             40 #include "G4Sphere.hh"
 45 #include "G4LogicalVolume.hh"                      41 #include "G4LogicalVolume.hh"
 46 #include "G4PVPlacement.hh"                        42 #include "G4PVPlacement.hh"
 47 #include "G4TransportationManager.hh"              43 #include "G4TransportationManager.hh"
 48 #include "G4SDManager.hh"                          44 #include "G4SDManager.hh"
 49 #include "G4RunManager.hh"                         45 #include "G4RunManager.hh"
 50 #include "G4VisAttributes.hh"                      46 #include "G4VisAttributes.hh"
 51 #include "G4Colour.hh"                             47 #include "G4Colour.hh"
                                                   >>  48 #include "G4ios.hh"
 52 #include "G4PVReplica.hh"                          49 #include "G4PVReplica.hh"
 53 #include "G4UserLimits.hh"                         50 #include "G4UserLimits.hh"
 54 #include "G4GeometryManager.hh"                <<  51 #include "XrayFluoNistMaterials.hh"
 55 #include "G4PhysicalVolumeStore.hh"            <<  52 
 56 #include "G4LogicalVolumeStore.hh"             << 
 57 #include "G4SolidStore.hh"                     << 
 58 #include "G4SDManager.hh"                      << 
 59                                                    53 
 60 //....oooOO0OOooo........oooOO0OOooo........oo     54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 61                                                    55 
 62                                                    56 
 63 XrayFluoPlaneDetectorConstruction::XrayFluoPla     57 XrayFluoPlaneDetectorConstruction::XrayFluoPlaneDetectorConstruction()
 64   : detectorType(0),planeGranularity(false), D     58   : detectorType(0),planeGranularity(false), DeviceSizeX(0),
 65     DeviceSizeY(0),DeviceThickness(0),             59     DeviceSizeY(0),DeviceThickness(0),
 66     solidWorld(0),logicWorld(0),physiWorld(0),     60     solidWorld(0),logicWorld(0),physiWorld(0),
 67     solidHPGe(0),logicHPGe(0),physiHPGe(0),        61     solidHPGe(0),logicHPGe(0),physiHPGe(0),
 68     solidScreen(0),logicScreen(0),physiScreen(     62     solidScreen(0),logicScreen(0),physiScreen(0),
 69     solidPlane (0),logicPlane(0),physiPlane (0     63     solidPlane (0),logicPlane(0),physiPlane (0),
 70     solidOhmicPos(0),logicOhmicPos(0), physiOh     64     solidOhmicPos(0),logicOhmicPos(0), physiOhmicPos(0),
 71     solidOhmicNeg(0),logicOhmicNeg(0), physiOh     65     solidOhmicNeg(0),logicOhmicNeg(0), physiOhmicNeg(0),
 72     solidPixel(0),logicPixel(0), physiPixel(0)     66     solidPixel(0),logicPixel(0), physiPixel(0),
 73     screenMaterial(0),OhmicPosMaterial(0), Ohm     67     screenMaterial(0),OhmicPosMaterial(0), OhmicNegMaterial(0),
 74     pixelMaterial(0),planeMaterial(0),             68     pixelMaterial(0),planeMaterial(0),
 75     defaultMaterial(0),HPGeSD(0)                   69     defaultMaterial(0),HPGeSD(0)
 76                                                    70   
 77 {                                                  71 { 
 78   materials = XrayFluoNistMaterials::GetInstan     72   materials = XrayFluoNistMaterials::GetInstance();
 79                                                    73 
 80   DefineDefaultMaterials();                        74   DefineDefaultMaterials();
 81                                                    75 
 82   NbOfPixelRows     =  1; // should be 1           76   NbOfPixelRows     =  1; // should be 1
 83   NbOfPixelColumns  =  1; // should be 1           77   NbOfPixelColumns  =  1; // should be 1
 84   NbOfPixels        =  NbOfPixelRows*NbOfPixel     78   NbOfPixels        =  NbOfPixelRows*NbOfPixelColumns;
 85   PixelSizeXY       = 5 * cm; // should be 5       79   PixelSizeXY       = 5 * cm; // should be 5
 86   PixelThickness = 3.5 * mm; //changed should      80   PixelThickness = 3.5 * mm; //changed should be 3.5 mm
 87                                                    81 
 88   G4cout << "PixelThickness(mm): "<< PixelThic     82   G4cout << "PixelThickness(mm): "<< PixelThickness/mm << G4endl;
 89   G4cout << "PixelSizeXY(cm): "<< PixelSizeXY/     83   G4cout << "PixelSizeXY(cm): "<< PixelSizeXY/cm << G4endl;
 90                                                    84 
 91   ContactSizeXY  = 5 * cm; //should be the sam     85   ContactSizeXY  = 5 * cm; //should be the same as pixelSizeXY
 92   planeThickness = 5 * cm;                         86   planeThickness = 5 * cm;
 93   planeSizeXY    = 5. * m;                         87   planeSizeXY    = 5. * m;
 94                                                    88 
 95   OhmicNegThickness = 0.005*mm;                    89   OhmicNegThickness = 0.005*mm;
 96   OhmicPosThickness = 0.005*mm;                    90   OhmicPosThickness = 0.005*mm;
 97                                                    91 
 98   screenThickness = 5 * mm;                        92   screenThickness = 5 * mm;
 99                                                    93 
100   ThetaHPGe = 0. * deg;                            94   ThetaHPGe = 0. * deg;
101   PhiHPGe = 0. * deg;                              95   PhiHPGe = 0. * deg;
102                                                    96 
103                                                    97 
104   DistDe = 0.5 * m;                                98   DistDe = 0.5 * m;
105                                                    99 
106   distScreen = DistDe + (screenThickness+Pixel    100   distScreen = DistDe + (screenThickness+PixelThickness)/2+OhmicPosThickness ;
107                                                   101 
108   grainDia = 1 * mm;                              102   grainDia = 1 * mm;
109                                                   103 
110                                                   104 
111   PixelCopyNb=0;                                  105   PixelCopyNb=0;
112   grainCopyNb=0;                                  106   grainCopyNb=0;
113   G4String defaultDetectorType = "sili";          107   G4String defaultDetectorType = "sili";
114   ComputeApparateParameters();                    108   ComputeApparateParameters();
115   SetDetectorType(defaultDetectorType);           109   SetDetectorType(defaultDetectorType);
116                                                   110   
117   // create commands for interactive definitio    111   // create commands for interactive definition of the apparate
118                                                   112   
119   detectorMessenger = new XrayFluoPlaneDetecto    113   detectorMessenger = new XrayFluoPlaneDetectorMessenger(this);
120   G4cout << "XrayFluoPlaneDetectorConstruction    114   G4cout << "XrayFluoPlaneDetectorConstruction created" << G4endl;
121 }                                                 115 }
122 //....oooOO0OOooo........oooOO0OOooo........oo    116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
123                                                   117 
124                                                   118 
125 XrayFluoPlaneDetectorConstruction* XrayFluoPla    119 XrayFluoPlaneDetectorConstruction* XrayFluoPlaneDetectorConstruction::instance = 0;
126                                                   120 
127 XrayFluoPlaneDetectorConstruction* XrayFluoPla    121 XrayFluoPlaneDetectorConstruction* XrayFluoPlaneDetectorConstruction::GetInstance()
128 {                                                 122 {
129   if (instance == 0)                              123   if (instance == 0)
130     {                                             124     {
131       instance = new XrayFluoPlaneDetectorCons    125       instance = new XrayFluoPlaneDetectorConstruction;
132                                                   126      
133     }                                             127     }
134   return instance;                                128   return instance;
135 }                                                 129 }
136                                                   130 
137 void XrayFluoPlaneDetectorConstruction::SetDet    131 void XrayFluoPlaneDetectorConstruction::SetDetectorType(G4String type)
138 {                                                 132 {
139                                                   133 
140   if (type=="sili")                               134   if (type=="sili")
141     {                                             135     {
142       detectorType = XrayFluoSiLiDetectorType:    136       detectorType = XrayFluoSiLiDetectorType::GetInstance();
143     }                                             137     }
144    else if (type=="hpge")                         138    else if (type=="hpge")
145      {                                            139      {
146        detectorType = XrayFluoHPGeDetectorType    140        detectorType = XrayFluoHPGeDetectorType::GetInstance();
147     }                                             141     }
148   else                                            142   else 
149     {                                             143     {
150       G4ExceptionDescription execp;            << 144       G4String excep = type + "detector type unknown";
151       execp << type + "detector type unknown"; << 145       G4Exception(excep);
152       G4Exception("XrayFluoPlaneDetectorConstr << 
153     FatalException, execp);                    << 
154     }                                             146     }
155 }                                                 147 }
156                                                   148 
157 //....oooOO0OOooo........oooOO0OOooo........oo << 149 XrayFluoVDetectorType* XrayFluoPlaneDetectorConstruction::GetDetectorType()
158                                                << 
159 XrayFluoVDetectorType* XrayFluoPlaneDetectorCo << 
160 {                                                 150 {
161   return detectorType;                            151   return detectorType;
162 }                                                 152 }
163                                                   153 
164 //....oooOO0OOooo........oooOO0OOooo........oo    154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
165                                                   155 
166 XrayFluoPlaneDetectorConstruction::~XrayFluoPl    156 XrayFluoPlaneDetectorConstruction::~XrayFluoPlaneDetectorConstruction()
167                                                   157 
168 {                                                 158 { 
169   delete detectorMessenger;                       159   delete detectorMessenger;
170   delete detectorType;                            160   delete detectorType;
171   G4cout << "XrayFluoPlaneDetectorConstruction    161   G4cout << "XrayFluoPlaneDetectorConstruction deleted" << G4endl;
172 }                                                 162 }
173                                                   163 
174 //....oooOO0OOooo........oooOO0OOooo........oo    164 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
175                                                   165 
176 G4VPhysicalVolume* XrayFluoPlaneDetectorConstr    166 G4VPhysicalVolume* XrayFluoPlaneDetectorConstruction::Construct()
177 {                                                 167 {
178   return ConstructApparate();                     168   return ConstructApparate();
179 }                                                 169 }
180 //....oooOO0OOooo........oooOO0OOooo........oo    170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
181                                                   171 
182 void XrayFluoPlaneDetectorConstruction::Define    172 void XrayFluoPlaneDetectorConstruction::DefineDefaultMaterials()
183 {                                                 173 {
184                                                   174 
185                                                   175 
186   //define materials of the apparate              176   //define materials of the apparate
187                                                   177 
188   planeMaterial = materials->GetMaterial("Anor    178   planeMaterial = materials->GetMaterial("Anorthosite");
189   screenMaterial = materials->GetMaterial("G4_ << 179   screenMaterial = materials->GetMaterial("Lead");
190   pixelMaterial = materials->GetMaterial("G4_S << 180   pixelMaterial = materials->GetMaterial("Silicon");
191   OhmicPosMaterial = materials->GetMaterial("G << 181   OhmicPosMaterial = materials->GetMaterial("Copper");
192   OhmicNegMaterial = materials->GetMaterial("G << 182   OhmicNegMaterial = materials->GetMaterial("Lead");
193   defaultMaterial = materials->GetMaterial("G4 << 183   defaultMaterial = materials->GetMaterial("Galactic");
                                                   >> 184 
                                                   >> 185   
194 }                                                 186 }
195                                                   187 
196 //....oooOO0OOooo........oooOO0OOooo........oo    188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 
197                                                   189 
198 G4VPhysicalVolume* XrayFluoPlaneDetectorConstr    190 G4VPhysicalVolume* XrayFluoPlaneDetectorConstruction::ConstructApparate()
199 {                                                 191 {
200   // complete the apparate parameters definiti    192   // complete the apparate parameters definition 
201                                                   193   
202   //ComputeApparateParameters();                  194   //ComputeApparateParameters();
203                                                   195   
204   //world                                         196   //world
205                                                   197   
206   solidWorld = new G4Box("World",                 198   solidWorld = new G4Box("World",                   //its name
207        WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/    199        WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2); //its size
208                                                   200   
209   logicWorld = new G4LogicalVolume(solidWorld,    201   logicWorld = new G4LogicalVolume(solidWorld,    //its solid
210                                    defaultMate    202                                    defaultMaterial, //its material
211                                    "World");      203                                    "World");    //its name
212   physiWorld = new G4PVPlacement(0,     //no r    204   physiWorld = new G4PVPlacement(0,     //no rotation
213          G4ThreeVector(), //at (0,0,0)            205          G4ThreeVector(), //at (0,0,0)
214          "World",   //its name                    206          "World",   //its name
215          logicWorld,    //its logical volume      207          logicWorld,    //its logical volume
216          0,     //its mother  volume              208          0,     //its mother  volume
217          false,     //no boolean operation        209          false,     //no boolean operation
218          0);      //copy number                   210          0);      //copy number
219                                                   211  
220   //detector                                      212   //detector
221                                                   213   
222   solidHPGe = 0;  physiHPGe = 0;  logicHPGe=0;    214   solidHPGe = 0;  physiHPGe = 0;  logicHPGe=0;
223   solidPixel=0; logicPixel=0; physiPixel=0;       215   solidPixel=0; logicPixel=0; physiPixel=0;
224                                                   216   
225   if (DeviceThickness > 0.)                       217   if (DeviceThickness > 0.)  
226     {                                             218     {
227       solidHPGe = new G4Box("HPGeDetector",       219       solidHPGe = new G4Box("HPGeDetector",   //its name
228           DeviceSizeX/2,DeviceSizeY/2,DeviceTh    220           DeviceSizeX/2,DeviceSizeY/2,DeviceThickness/2);//size
229                                                   221       
230                                                   222       
231       logicHPGe = new G4LogicalVolume(solidHPG    223       logicHPGe = new G4LogicalVolume(solidHPGe,  //its solid
232               defaultMaterial,  //its material    224               defaultMaterial,  //its material 
233               "HPGeDetector");  //its name        225               "HPGeDetector");  //its name
234                                                   226       
235       zRotPhiHPGe.rotateX(PhiHPGe);               227       zRotPhiHPGe.rotateX(PhiHPGe);
236       G4double x,y,z;                             228       G4double x,y,z;
237                                                   229 
238       z = -1. * DistDe; //* std::cos(ThetaHPGe    230       z = -1. * DistDe; //* std::cos(ThetaHPGe);
239       y = 0.*cm; //distScreen * std::sin(Theta    231       y = 0.*cm; //distScreen * std::sin(ThetaHPGe);
240       x = 0.*cm;                                  232       x = 0.*cm;
241                                                   233 
242       physiHPGe = new G4PVPlacement(G4Transfor    234       physiHPGe = new G4PVPlacement(G4Transform3D(zRotPhiHPGe,G4ThreeVector(x,y,z)), 
243             "HPGeDetector", //its name            235             "HPGeDetector", //its name
244             logicHPGe,  //its logical volume      236             logicHPGe,  //its logical volume
245             physiWorld, //its mother  volume      237             physiWorld, //its mother  volume
246             false,    //no boolean operation      238             false,    //no boolean operation
247             0);   //copy number                   239             0);   //copy number
248     }                                             240     }
249   // Pixel                                        241   // Pixel
250                                                   242   
251                                                   243 
252                                                   244 
253                                                   245 
254   for ( G4int j=0; j < NbOfPixelColumns ; j++     246   for ( G4int j=0; j < NbOfPixelColumns ; j++ )
255     { for ( G4int i=0; i < NbOfPixelRows ; i++    247     { for ( G4int i=0; i < NbOfPixelRows ; i++ )
256       {                                           248       { 
257   solidPixel=0; logicPixel=0;   physiPixel=0;     249   solidPixel=0; logicPixel=0;   physiPixel=0;
258   if (PixelThickness > 0.)                        250   if (PixelThickness > 0.)
259     solidPixel = new G4Box("Pixel",               251     solidPixel = new G4Box("Pixel",     
260          PixelSizeXY/2,PixelSizeXY/2, PixelThi    252          PixelSizeXY/2,PixelSizeXY/2, PixelThickness/2);
261                                                   253   
262   logicPixel = new G4LogicalVolume(solidPixel,    254   logicPixel = new G4LogicalVolume(solidPixel,  
263            pixelMaterial, //its material          255            pixelMaterial, //its material
264            "Pixel");          //its name          256            "Pixel");          //its name
265                                                   257 
266   /*                                              258   /*
267   zRotPhiHPGe.rotateX(PhiHPGe);                   259   zRotPhiHPGe.rotateX(PhiHPGe);
268   G4double x,y,z;                                 260   G4double x,y,z;
269   z = DistDe * std::cos(ThetaHPGe);               261   z = DistDe * std::cos(ThetaHPGe);
270   y =DistDe * std::sin(ThetaHPGe);                262   y =DistDe * std::sin(ThetaHPGe);
271   x = 0.*cm;*/                                    263   x = 0.*cm;*/ 
272   physiPixel = new G4PVPlacement(0,               264   physiPixel = new G4PVPlacement(0,        
273                G4ThreeVector(0,                   265                G4ThreeVector(0,
274                  i*PixelSizeXY,                   266                  i*PixelSizeXY, 
275                  j*PixelSizeXY ),                 267                  j*PixelSizeXY ),
276                "Pixel",                           268                "Pixel",  
277                logicPixel,   //its logical vol    269                logicPixel,   //its logical volume
278                physiHPGe, //its mother  volume    270                physiHPGe, //its mother  volume
279                false,  //no boolean operation     271                false,  //no boolean operation
280                PixelCopyNb);//copy number         272                PixelCopyNb);//copy number
281                                                   273 
282                                                   274 
283                                                   275 
284                                                   276   
285                                                   277 
286                                                   278   
287   // OhmicNeg                                     279   // OhmicNeg
288                                                   280   
289   solidOhmicNeg=0; logicOhmicNeg=0; physiOhmic    281   solidOhmicNeg=0; logicOhmicNeg=0; physiOhmicNeg=0;  
290                                                   282   
291   if (OhmicNegThickness > 0.)                     283   if (OhmicNegThickness > 0.) 
292     { solidOhmicNeg = new G4Box("OhmicNeg",       284     { solidOhmicNeg = new G4Box("OhmicNeg",   //its name
293               PixelSizeXY/2,PixelSizeXY/2,Ohmi    285               PixelSizeXY/2,PixelSizeXY/2,OhmicNegThickness/2); 
294                                                   286     
295     logicOhmicNeg = new G4LogicalVolume(solidO    287     logicOhmicNeg = new G4LogicalVolume(solidOhmicNeg,    //its solid
296                 OhmicNegMaterial, //its materi    288                 OhmicNegMaterial, //its material
297                 "OhmicNeg");      //its name      289                 "OhmicNeg");      //its name
298                                                   290     
299     physiOhmicNeg = new G4PVPlacement(0,          291     physiOhmicNeg = new G4PVPlacement(0,
300               G4ThreeVector                       292               G4ThreeVector
301               (0.,                                293               (0.,
302                0.,                                294                0.,
303                 (PixelThickness+OhmicNegThickn    295                 (PixelThickness+OhmicNegThickness)/2),
304               "OhmicNeg",        //its name       296               "OhmicNeg",        //its name
305               logicOhmicNeg,     //its logical    297               logicOhmicNeg,     //its logical volume
306               physiHPGe,        //its mother      298               physiHPGe,        //its mother
307               false,             //no boulean     299               false,             //no boulean operat
308               PixelCopyNb);                //c    300               PixelCopyNb);                //copy number
309                                                   301     
310     }                                             302     }
311   // OhmicPos                                     303   // OhmicPos
312   solidOhmicPos=0; logicOhmicPos=0; physiOhmic    304   solidOhmicPos=0; logicOhmicPos=0; physiOhmicPos=0;  
313                                                   305   
314   if (OhmicPosThickness > 0.)                     306   if (OhmicPosThickness > 0.) 
315     { solidOhmicPos = new G4Box("OhmicPos",       307     { solidOhmicPos = new G4Box("OhmicPos",   //its name
316               PixelSizeXY/2,PixelSizeXY/2,Ohmi    308               PixelSizeXY/2,PixelSizeXY/2,OhmicPosThickness/2); 
317                                                   309     
318     logicOhmicPos = new G4LogicalVolume(solidO    310     logicOhmicPos = new G4LogicalVolume(solidOhmicPos,    //its solid
319                 OhmicPosMaterial, //its materi    311                 OhmicPosMaterial, //its material
320                 "OhmicPos");      //its name      312                 "OhmicPos");      //its name
321                                                   313     
322     physiOhmicPos = new G4PVPlacement(0,          314     physiOhmicPos = new G4PVPlacement(0,  
323               G4ThreeVector(0.,                   315               G4ThreeVector(0.,
324                 0.,                               316                 0.,
325                 (-PixelThickness-OhmicPosThick    317                 (-PixelThickness-OhmicPosThickness)/2),  
326               "OhmicPos",                         318               "OhmicPos",  
327               logicOhmicPos,                      319               logicOhmicPos,
328               physiHPGe,                          320               physiHPGe,  
329               false,                              321               false,     
330               PixelCopyNb);                       322               PixelCopyNb); 
331                                                   323     
332     }                                             324     }
333                                                   325   
334   PixelCopyNb += PixelCopyNb;                     326   PixelCopyNb += PixelCopyNb; 
335   G4cout << "PixelCopyNb: " << PixelCopyNb <<     327   G4cout << "PixelCopyNb: " << PixelCopyNb << G4endl;
336       }                                           328       }
337                                                   329 
338     }                                             330     }
339                                                   331   
340   // Screen                                       332   // Screen
341                                                   333 
342   if (DeviceThickness > 0.)                       334   if (DeviceThickness > 0.)  
343     {                                             335     {
344       solidScreen = new G4Box("DetectorScreen"    336       solidScreen = new G4Box("DetectorScreen",   //its name
345           screenSizeXY/2,screenSizeXY/2,screen    337           screenSizeXY/2,screenSizeXY/2,screenThickness/2);//size
346                                                   338       
347                                                   339       
348       logicScreen = new G4LogicalVolume(solidS    340       logicScreen = new G4LogicalVolume(solidScreen,  //its solid
349               defaultMaterial,  //its material    341               defaultMaterial,  //its material 
350               "DetectorScreen");  //its name      342               "DetectorScreen");  //its name
351                                                   343       
352       //zRotPhiHPGe.rotateX(PhiHPGe);             344       //zRotPhiHPGe.rotateX(PhiHPGe);
353       G4double x,y,z;                             345       G4double x,y,z;
354       G4cout << "distScreen: "<< distScreen/m     346       G4cout << "distScreen: "<< distScreen/m <<G4endl;
355       z = -1 * distScreen; //* std::cos(ThetaH    347       z = -1 * distScreen; //* std::cos(ThetaHPGe);
356       y = 0.*cm; //distScreen * std::sin(Theta    348       y = 0.*cm; //distScreen * std::sin(ThetaHPGe);
357       x = 0.*cm;                                  349       x = 0.*cm;
358       physiScreen = new G4PVPlacement(G4Transf    350       physiScreen = new G4PVPlacement(G4Transform3D(zRotPhiHPGe,G4ThreeVector(x,y,z)), 
359             "DetectorScreen", //its name          351             "DetectorScreen", //its name
360             logicScreen,  //its logical volume    352             logicScreen,  //its logical volume
361             physiWorld, //its mother  volume      353             physiWorld, //its mother  volume
362             false,    //no boolean operation      354             false,    //no boolean operation
363             0);   //copy number                   355             0);   //copy number
364     }                                             356     }
365                                                   357 
366     //Plane                                       358     //Plane
367                                                   359 
368   if (planeGranularity) {                         360   if (planeGranularity) {
369                                                   361 
370     solidPlane=0;  logicPlane=0;  physiPlane=0    362     solidPlane=0;  logicPlane=0;  physiPlane=0;
371     if (planeThickness > 0.)                      363     if (planeThickness > 0.)  
372       {                                           364       {
373   solidPlane = new G4Box("Plane",   //its name    365   solidPlane = new G4Box("Plane",   //its name
374         planeSizeXY/2,planeSizeXY/2,planeThick    366         planeSizeXY/2,planeSizeXY/2,planeThickness/2);//size
375                                                   367   
376   logicPlane= new G4LogicalVolume(solidPlane,     368   logicPlane= new G4LogicalVolume(solidPlane, //its solid
377            defaultMaterial, //its material        369            defaultMaterial, //its material
378            "Plane");  //its name                  370            "Plane");  //its name
379                                                   371   
380   physiPlane = new G4PVPlacement(0,     //no r    372   physiPlane = new G4PVPlacement(0,     //no rotation
381           G4ThreeVector(),  //at (0,0,0)          373           G4ThreeVector(),  //at (0,0,0)
382           "Plane",  //its name                    374           "Plane",  //its name
383           logicPlane, //its logical volume        375           logicPlane, //its logical volume
384           physiWorld, //its mother  volume        376           physiWorld, //its mother  volume
385           false,    //no boolean operation        377           false,    //no boolean operation
386           0);   //copy number                     378           0);   //copy number
387                                                   379   
388       }                                           380       }
389                                                   381 
390                                                   382 
391                                                   383 
392                                                   384 
393     G4int nbOfGrainsX = ((G4int)(planeSizeXY/g    385     G4int nbOfGrainsX = ((G4int)(planeSizeXY/grainDia)) -1 ;
394                                                   386     
395     // y dim of a max density plane is 2rn-(n-    387     // y dim of a max density plane is 2rn-(n-1)ar, wehere a = (1-(std::sqrt(3)/2)), n is 
396     // number of rows and r the radius of the     388     // number of rows and r the radius of the grain. so the Y-dim of the plane must 
397     // be greater or equal to this. It results    389     // be greater or equal to this. It results that nmust be <= (PlaneY-a)/(1-a).
398     // Max Y shift of the planes superimposing    390     // Max Y shift of the planes superimposing along Z axis is minor (2/std::sqrt(3)r)
399                                                   391 
400     G4double a = (1.-(std::sqrt(3.)/2.));         392     G4double a = (1.-(std::sqrt(3.)/2.));
401     G4int nbOfGrainsY =  (G4int) ( ((planeSize    393     G4int nbOfGrainsY =  (G4int) ( ((planeSizeXY/(grainDia/2.)) -a)/(2.-a) ) -1;
402                                                   394 
403     // same for the z axis, but a = 2 * (std::    395     // same for the z axis, but a = 2 * (std::sqrt(3) - std::sqrt(2))/std::sqrt(3)
404                                                   396 
405     G4double b = 2. * (std::sqrt(3.) - std::sq    397     G4double b = 2. * (std::sqrt(3.) - std::sqrt(2.))/std::sqrt(3.);
406     G4int nbOfGrainsZ =  (G4int) ( ((planeThic    398     G4int nbOfGrainsZ =  (G4int) ( ((planeThickness/(grainDia/2.)) -b)/(2.-b) )-1;
407                                                   399 
408     if (planeThickness > 0.){                     400     if (planeThickness > 0.){
409                                                   401       
410       solidGrain=0; logicGrain=0; physiGrain=0    402       solidGrain=0; logicGrain=0; physiGrain=0;
411       solidGrain = new G4Sphere("Grain",0.,       403       solidGrain = new G4Sphere("Grain",0.,     
412         grainDia/2,0., twopi, 0., pi);            404         grainDia/2,0., twopi, 0., pi);
413                                                   405       
414       logicGrain = new G4LogicalVolume(solidGr    406       logicGrain = new G4LogicalVolume(solidGrain,  
415                planeMaterial, //its material      407                planeMaterial, //its material
416                "Grain");          //its name      408                "Grain");          //its name
417       G4ThreeVector grainPosition;                409       G4ThreeVector grainPosition; 
418       G4double grainInitPositionX = 0;            410       G4double grainInitPositionX = 0;
419       G4double grainInitPositionY = 0;            411       G4double grainInitPositionY = 0;
420       G4double grainInitPositionZ = (-1.*plane    412       G4double grainInitPositionZ = (-1.*planeThickness/2.+grainDia/2.);
421       G4double grainStepX = grainDia = 0;         413       G4double grainStepX = grainDia = 0;
422       G4double grainStepY = grainDia*(1.-(0.5-    414       G4double grainStepY = grainDia*(1.-(0.5-(std::sqrt(3.)/4.)));
423       G4double grainStepZ = grainDia*std::sqrt    415       G4double grainStepZ = grainDia*std::sqrt(2./3.);
424                                                   416       
425       for ( G4int k=0; k < nbOfGrainsZ ; k++ )    417       for ( G4int k=0; k < nbOfGrainsZ ; k++ ) {
426   for ( G4int j=0; j < nbOfGrainsY ; j++ ) {      418   for ( G4int j=0; j < nbOfGrainsY ; j++ ) {
427     for ( G4int i=0; i < nbOfGrainsX ; i++ ) {    419     for ( G4int i=0; i < nbOfGrainsX ; i++ ) {
428                                                   420       
429       // Now we identify the layer and the row    421       // Now we identify the layer and the row where the grain is , to place it in the right position
430                                                   422       
431                                                   423       
432                                                   424       
433       if (k%3 == 0) { // first or (4-multiple)    425       if (k%3 == 0) { // first or (4-multiple)th layer: structure is ABCABC
434         grainInitPositionY = (-1.*planeSizeXY/    426         grainInitPositionY = (-1.*planeSizeXY/2.+grainDia/2.);    
435         if (j%2 ==0) { //first or (3-multiple)    427         if (j%2 ==0) { //first or (3-multiple)th row
436     grainInitPositionX = (-1.*planeSizeXY/2.+g    428     grainInitPositionX = (-1.*planeSizeXY/2.+grainDia/2.);
437         }                                         429         }
438                                                   430         
439         else if ( ((j+1) % 2)  == 0 ) {           431         else if ( ((j+1) % 2)  == 0 ) {
440     grainInitPositionX = (-1.*planeSizeXY/2.+     432     grainInitPositionX = (-1.*planeSizeXY/2.+ grainDia);    
441         }                                         433         }
442                                                   434         
443       }                                           435       }       
444       else if ( ((k+2) % 3) == 0 ) { // B-laye    436       else if ( ((k+2) % 3) == 0 ) { // B-layer
445                                                   437         
446         grainInitPositionY = ( (-1.*planeSizeX    438         grainInitPositionY = ( (-1.*planeSizeXY/2.) + (grainDia/2.)*(1. + (1./std::sqrt(3.)) ) );
447                                                   439         
448         if (j%2 ==0) { //first or (3-multiple)    440         if (j%2 ==0) { //first or (3-multiple)th row
449     grainInitPositionX = (-1.*planeSizeXY/2.+g    441     grainInitPositionX = (-1.*planeSizeXY/2.+grainDia);
450         }                                         442         }
451                                                   443         
452         else if ( (j+1)%2  == 0 ) {               444         else if ( (j+1)%2  == 0 ) {
453     grainInitPositionX = (-1.*planeSizeXY/2.+g    445     grainInitPositionX = (-1.*planeSizeXY/2.+grainDia/2);   
454         }                                         446         }
455                                                   447         
456       }                                           448       }
457                                                   449       
458       else if ( (k+1)%3 == 0 ) { // B-layer       450       else if ( (k+1)%3 == 0 ) { // B-layer
459                                                   451         
460         grainInitPositionY = (-1.*planeSizeXY/    452         grainInitPositionY = (-1.*planeSizeXY/2.+(grainDia/2.)*(1.+2./std::sqrt(3.)) );
461                                                   453         
462         if (j%2 ==0) { //first or (3-multiple)    454         if (j%2 ==0) { //first or (3-multiple)th row
463     grainInitPositionX = (-1.*planeSizeXY/2.+g    455     grainInitPositionX = (-1.*planeSizeXY/2.+grainDia/2.);
464         }                                         456         }
465                                                   457         
466         else if ( (j+1)%2  == 0 ) {               458         else if ( (j+1)%2  == 0 ) {
467     grainInitPositionX = (-1.*planeSizeXY/2.+g    459     grainInitPositionX = (-1.*planeSizeXY/2.+grainDia);   
468         }                                         460         }
469                                                   461         
470       }                                           462       }
471                                                   463       
472       physiGrain = new G4PVPlacement(0,           464       physiGrain = new G4PVPlacement(0,        
473              G4ThreeVector( grainInitPositionX    465              G4ThreeVector( grainInitPositionX + i*grainStepX, 
474                 grainInitPositionY + j*grainSt    466                 grainInitPositionY + j*grainStepY,
475                 grainInitPositionZ + k*grainSt    467                 grainInitPositionZ + k*grainStepZ),
476              "Grain",                             468              "Grain",  
477              logicGrain,   //its logical volum    469              logicGrain,   //its logical volume
478              physiPlane, //its mother  volume     470              physiPlane, //its mother  volume
479              false,  //no boolean operation       471              false,  //no boolean operation
480              grainCopyNb);//copy number           472              grainCopyNb);//copy number    
481                                                   473       
482       grainCopyNb = grainCopyNb +1;               474       grainCopyNb = grainCopyNb +1; 
483     }                                             475     }
484   }                                               476   }
485       }                                           477       }
486     }                                             478     }    
487   }                                               479   }
488   else {                                          480   else {     
489                                                   481       
490     solidPlane=0;  logicPlane=0;  physiPlane=0    482     solidPlane=0;  logicPlane=0;  physiPlane=0;
491     if (planeThickness > 0.)                      483     if (planeThickness > 0.)  
492       {                                           484       {
493   solidPlane = new G4Box("Plane",   //its name    485   solidPlane = new G4Box("Plane",   //its name
494         planeSizeXY/2,planeSizeXY/2,planeThick    486         planeSizeXY/2,planeSizeXY/2,planeThickness/2);//size
495                                                   487     
496   logicPlane= new G4LogicalVolume(solidPlane,     488   logicPlane= new G4LogicalVolume(solidPlane, //its solid
497            planeMaterial, //its material          489            planeMaterial, //its material
498            "Plane");  //its name                  490            "Plane");  //its name
499                                                   491     
500   physiPlane = new G4PVPlacement(0,     //no r    492   physiPlane = new G4PVPlacement(0,     //no rotation
501           G4ThreeVector(),  //at (0,0,0)          493           G4ThreeVector(),  //at (0,0,0)
502           "Plane",  //its name                    494           "Plane",  //its name
503           logicPlane, //its logical volume        495           logicPlane, //its logical volume
504           physiWorld, //its mother  volume        496           physiWorld, //its mother  volume
505           false,    //no boolean operation        497           false,    //no boolean operation
506           0);   //copy number                     498           0);   //copy number
507                                                   499     
508       }                                           500       }  
509   }                                               501   }
510                                                   502 
                                                   >> 503   G4SDManager* SDman = G4SDManager::GetSDMpointer();    
                                                   >> 504 
                                                   >> 505   if(!HPGeSD)
                                                   >> 506     {
                                                   >> 507       HPGeSD = new XrayFluoSD ("HPGeSD",this);
                                                   >> 508       SDman->AddNewDetector(HPGeSD);
                                                   >> 509     }
                                                   >> 510   
                                                   >> 511   
                                                   >> 512   if (logicPixel)
                                                   >> 513     {
                                                   >> 514       logicPixel->SetSensitiveDetector(HPGeSD);
                                                   >> 515     }
                                                   >> 516   
511   // Visualization attributes                     517   // Visualization attributes
512                                                   518   
513   logicWorld->SetVisAttributes (G4VisAttribute << 519   logicWorld->SetVisAttributes (G4VisAttributes::Invisible);
514    G4VisAttributes* simpleBoxVisAtt= new G4Vis    520    G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
515    G4VisAttributes * yellow= new G4VisAttribut    521    G4VisAttributes * yellow= new G4VisAttributes( G4Colour(255/255. ,255/255. ,51/255. ));
516    G4VisAttributes * red= new G4VisAttributes(    522    G4VisAttributes * red= new G4VisAttributes( G4Colour(255/255. , 0/255. , 0/255. ));
517    G4VisAttributes * blue= new G4VisAttributes    523    G4VisAttributes * blue= new G4VisAttributes( G4Colour(0/255. , 0/255. ,  255/255. ));
518    G4VisAttributes * grayc= new G4VisAttribute << 524    G4VisAttributes * gray= new G4VisAttributes( G4Colour(128/255. , 128/255. ,  128/255. ));
519    G4VisAttributes * lightGray= new G4VisAttri    525    G4VisAttributes * lightGray= new G4VisAttributes( G4Colour(178/255. , 178/255. ,  178/255. ));
520   yellow->SetVisibility(true);                    526   yellow->SetVisibility(true);
521   yellow->SetForceSolid(true);                    527   yellow->SetForceSolid(true);
522   red->SetVisibility(true);                       528   red->SetVisibility(true);
523   red->SetForceSolid(true);                       529   red->SetForceSolid(true);
524   blue->SetVisibility(true);                      530   blue->SetVisibility(true);
525   grayc->SetVisibility(true);                  << 531   gray->SetVisibility(true);
526   grayc->SetForceSolid(true);                  << 532   gray->SetForceSolid(true);
527   lightGray->SetVisibility(true);                 533   lightGray->SetVisibility(true);
528   lightGray->SetForceSolid(true);                 534   lightGray->SetForceSolid(true);
529   simpleBoxVisAtt->SetVisibility(true);           535   simpleBoxVisAtt->SetVisibility(true);
530                                                   536  
531   logicPixel->SetVisAttributes(red); //modifie    537   logicPixel->SetVisAttributes(red); //modified!!!
532   logicHPGe->SetVisAttributes(blue);              538   logicHPGe->SetVisAttributes(blue);
533                                                   539 
534   logicPlane->SetVisAttributes(lightGray);        540   logicPlane->SetVisAttributes(lightGray);
535                                                   541   
536                                                   542 
537   logicScreen->SetVisAttributes(grayc);        << 543   logicScreen->SetVisAttributes(gray);
538   logicOhmicNeg->SetVisAttributes(yellow);        544   logicOhmicNeg->SetVisAttributes(yellow);
539   logicOhmicPos->SetVisAttributes(yellow);        545   logicOhmicPos->SetVisAttributes(yellow);
540                                                   546 
541                                                   547 
542                                                   548 
543   if (planeGranularity)  logicGrain->SetVisAtt << 549   if (planeGranularity)  logicGrain->SetVisAttributes(gray);
544                                                   550 
545   //always return the physical World              551   //always return the physical World
546                                                   552     
547   PrintApparateParameters();                      553   PrintApparateParameters();
548                                                   554 
549   return physiWorld;                              555   return physiWorld;
550 }                                                 556 }
551                                                   557 
552 //....oooOO0OOooo........oooOO0OOooo........oo << 
553                                                << 
554 void XrayFluoPlaneDetectorConstruction::Constr << 
555 {                                              << 
556   //                                           << 
557   // Sensitive Detectors                       << 
558   //                                           << 
559   if (HPGeSD.Get() == 0)                       << 
560     {                                          << 
561       XrayFluoSD* SD = new XrayFluoSD ("HPGeSD << 
562       HPGeSD.Put( SD );                        << 
563     }                                          << 
564   G4SDManager::GetSDMpointer()->AddNewDetector << 
565   if (logicPixel)                              << 
566     SetSensitiveDetector(logicPixel,HPGeSD.Get << 
567 }                                              << 
568                                                << 
569 //....oooOO0OOooo........oooOO0OOooo........oo    558 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
570                                                   559 
571 void XrayFluoPlaneDetectorConstruction::PrintA    560 void XrayFluoPlaneDetectorConstruction::PrintApparateParameters()
572 {                                                 561 {
573   G4cout << "---------------------------------    562   G4cout << "-----------------------------------------------------------------------"
574    << G4endl                                      563    << G4endl
575    << "The plane is a box whose size is: "        564    << "The plane is a box whose size is: "
576    << G4endl                                      565    << G4endl      
577    << planeThickness/cm                           566    << planeThickness/cm
578    << " cm * "                                    567    << " cm * "
579    << planeSizeXY/cm                              568    << planeSizeXY/cm
580    << " cm * "                                    569    << " cm * "
581    << planeSizeXY/cm                              570    << planeSizeXY/cm
582    << " cm"                                       571    << " cm"
583    << G4endl                                      572    << G4endl
584    <<" Material: " << logicPlane->GetMaterial(    573    <<" Material: " << logicPlane->GetMaterial()->GetName() 
585    <<G4endl                                       574    <<G4endl
586     <<"The Detector is a slice  " << DeviceThi    575     <<"The Detector is a slice  " << DeviceThickness/(1.e-6*m) <<  " micron thick of " << pixelMaterial->GetName()
587    <<G4endl                                       576    <<G4endl
588                                                   577    
589                                                   578 
590 <<"-------------------------------------------    579 <<"-------------------------------------------------------------------------"
591    << G4endl;                                     580    << G4endl;
592 }                                                 581 }
593 //....oooOO0OOooo........oooOO0OOooo........oo    582 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
594                                                   583 
595 void XrayFluoPlaneDetectorConstruction::Update    584 void XrayFluoPlaneDetectorConstruction::UpdateGeometry()
596 {                                                 585 {
597   G4GeometryManager::GetInstance()->OpenGeomet << 586 
598   G4PhysicalVolumeStore::Clean();              << 587   delete solidHPGe;
599   G4LogicalVolumeStore::Clean();               << 588   delete logicHPGe;
600   G4SolidStore::Clean();                       << 589   delete physiHPGe;
601                                                << 590   delete solidPixel;
                                                   >> 591   delete logicPixel;
                                                   >> 592   delete physiPixel;
                                                   >> 593   delete solidOhmicNeg;
                                                   >> 594   delete logicOhmicNeg;
                                                   >> 595   delete physiOhmicNeg;
                                                   >> 596   delete solidOhmicPos;
                                                   >> 597   delete logicOhmicPos;
                                                   >> 598   delete physiOhmicPos;
                                                   >> 599   delete solidPlane;
                                                   >> 600   delete logicPlane;
                                                   >> 601   delete physiPlane;
                                                   >> 602   delete solidScreen;
                                                   >> 603   delete logicScreen;
                                                   >> 604   delete physiScreen;
                                                   >> 605   delete solidWorld;
                                                   >> 606   delete logicWorld;
                                                   >> 607   delete physiWorld;
                                                   >> 608 
602   zRotPhiHPGe.rotateX(-1.*PhiHPGe);               609   zRotPhiHPGe.rotateX(-1.*PhiHPGe);
603   //Triggers a new call of Construct() and of  << 610   G4RunManager::GetRunManager()->DefineWorldVolume(ConstructApparate());
604   G4RunManager::GetRunManager()->ReinitializeG << 
605 }                                                 611 }
606                                                   612 
607 //....oooOO0OOooo........oooOO0OOooo........oo << 
608                                                   613 
609 void XrayFluoPlaneDetectorConstruction::Delete    614 void XrayFluoPlaneDetectorConstruction::DeleteGrainObjects()
610 {                                                 615 {
611   if (planeGranularity) {                         616   if (planeGranularity) { 
612     delete solidGrain;                            617     delete solidGrain; 
613     delete logicGrain;                            618     delete logicGrain;
614     delete physiGrain;                            619     delete physiGrain;
615   }                                               620   }
616                                                   621 
617 }                                                 622 }
618                                                << 
619 //....oooOO0OOooo........oooOO0OOooo........oo << 
620                                                << 
621 void XrayFluoPlaneDetectorConstruction::SetPla    623 void XrayFluoPlaneDetectorConstruction::SetPlaneMaterial(G4String newMaterial)
622 {                                                 624 {
623   //G4cout << "Material!!!!" << newMaterial << << 625 
624   logicPlane->SetMaterial(materials->GetMateri << 626 
625   PrintApparateParameters();                   << 627     G4cout << "Material!!!!" << newMaterial << G4cout;
626   //GeometryHasBeenModified is called by the m << 628     logicPlane->SetMaterial(materials->GetMaterial(newMaterial));
627                                                << 629     PrintApparateParameters();
                                                   >> 630   
628 }                                                 631 }
629                                                   632 
630 //....oooOO0OOooo........oooOO0OOooo........oo    633 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
631                                                << 
632                                                   634 
633                                                   635 
634                                                   636 
635                                                   637 
636                                                   638 
637                                                   639 
638                                                   640 
639                                                   641 
640                                                   642 
641                                                   643 
642                                                   644 
643                                                   645