Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/runAndEvent/RE02/src/RE02DetectorConstruction.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/runAndEvent/RE02/src/RE02DetectorConstruction.cc (Version 11.3.0) and /examples/extended/runAndEvent/RE02/src/RE02DetectorConstruction.cc (Version 9.4.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 /// \file runAndEvent/RE02/src/RE02DetectorCon << 
 27 /// \brief Implementation of the RE02DetectorC << 
 28 //                                                 26 //
                                                   >>  27 // $Id: RE02DetectorConstruction.cc,v 1.5 2010-12-07 15:17:13 stesting Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-09-04-patch-01 $
 29 //                                                 29 //
 30 //                                             <<  30  
 31                                                << 
 32 #include "RE02DetectorConstruction.hh"             31 #include "RE02DetectorConstruction.hh"
 33                                                    32 
 34 #include "RE02NestedPhantomParameterisation.hh <<  33 #include "G4MultiFunctionalDetector.hh"
 35                                                    34 
                                                   >>  35 #include "RE02PSEnergyDeposit.hh"
                                                   >>  36 #include "RE02PSNofStep.hh"
                                                   >>  37 #include "RE02PSCellFlux.hh"
                                                   >>  38 #include "RE02PSPassageCellFlux.hh"
                                                   >>  39 #include "RE02PSFlatSurfaceFlux.hh"
                                                   >>  40 #include "RE02PSFlatSurfaceCurrent.hh"
                                                   >>  41 
                                                   >>  42 #include "G4SDParticleWithEnergyFilter.hh"
                                                   >>  43 #include "G4SDParticleFilter.hh"
                                                   >>  44 #include "G4SDChargedFilter.hh"
                                                   >>  45 
                                                   >>  46 #include "G4NistManager.hh"
                                                   >>  47 #include "G4Material.hh"
 36 #include "G4Box.hh"                                48 #include "G4Box.hh"
 37 #include "G4Colour.hh"                         << 
 38 #include "G4LogicalVolume.hh"                      49 #include "G4LogicalVolume.hh"
 39 #include "G4Material.hh"                       << 
 40 #include "G4NistManager.hh"                    << 
 41 #include "G4PSCellFlux3D.hh"                   << 
 42 #include "G4PSEnergyDeposit3D.hh"              << 
 43 #include "G4PSFlatSurfaceCurrent3D.hh"         << 
 44 #include "G4PSFlatSurfaceFlux3D.hh"            << 
 45 #include "G4PSNofStep3D.hh"                    << 
 46 #include "G4PSPassageCellFlux3D.hh"            << 
 47 #include "G4PVParameterised.hh"                << 
 48 #include "G4PVPlacement.hh"                        50 #include "G4PVPlacement.hh"
 49 #include "G4SDChargedFilter.hh"                << 
 50 #include "G4SDManager.hh"                          51 #include "G4SDManager.hh"
 51 #include "G4SDParticleFilter.hh"               <<  52 
 52 #include "G4SDParticleWithEnergyFilter.hh"     <<  53 #include "G4PVParameterised.hh"
 53 #include "G4SystemOfUnits.hh"                  <<  54 #include "RE02NestedPhantomParameterisation.hh"
                                                   >>  55 
 54 #include "G4VisAttributes.hh"                      56 #include "G4VisAttributes.hh"
                                                   >>  57 #include "G4Colour.hh"
                                                   >>  58 
 55 #include "G4ios.hh"                                59 #include "G4ios.hh"
 56                                                    60 
 57 //============================================     61 //=======================================================================
 58 //  RE02DetectorConstruction                       62 //  RE02DetectorConstruction
 59 //                                                 63 //
 60 //  (Description)                                  64 //  (Description)
 61 //                                                 65 //
 62 //     Detector construction for example RE02.     66 //     Detector construction for example RE02.
 63 //                                             <<  67 //    
 64 //   [Geometry]                                <<  68 //   [Geometry] 
 65 //     The world volume is defined as 200 cm x     69 //     The world volume is defined as 200 cm x 200 cm x 200 cm box with Air.
 66 //   Water phantom is defined as  200 mm x 200     70 //   Water phantom is defined as  200 mm x 200 mm x 400 mm box with Water.
 67 //   The water phantom is divided into 100 seg <<  71 //   The water phantom is divided into 100 segments in x,y plane using replication,
 68 //   replication,                              <<  72 //   and then divided into 200 segments perpendicular to z axis using nested 
 69 //   and then divided into 200 segments perpen <<  73 //   parameterised volume.  
 70 //   parameterised volume.                     << 
 71 //    These values are defined at constructor,     74 //    These values are defined at constructor,
 72 //    e.g. the size of water phantom (fPhantom <<  75 //    e.g. the size of water phantom (fphantomSize), and number of segmentation
 73 //   of water phantom (fNx, fNy, fNz).             76 //   of water phantom (fNx, fNy, fNz).
 74 //                                                 77 //
 75 //   By default, lead plates are inserted into <<  78 //   By default, lead plates are inserted into the position of even order segments.
 76 //   segments.                                 << 
 77 //   NIST database is used for materials.          79 //   NIST database is used for materials.
 78 //                                                 80 //
 79 //                                                 81 //
 80 //   [Scorer]                                      82 //   [Scorer]
 81 //    Assignment of G4MultiFunctionalDetector  <<  83 //    Assignment of G4MultiFunctionalDetector and G4PrimitiveScorer 
 82 //   is demonstrated in this example.              84 //   is demonstrated in this example.
 83 //       -------------------------------------     85 //       -------------------------------------------------
 84 //       The collection names of defined Primi     86 //       The collection names of defined Primitives are
 85 //        0       PhantomSD/totalEDep          <<  87 //        0       PhantomSD/totalEDep 
 86 //        1       PhantomSD/protonEDep             88 //        1       PhantomSD/protonEDep
 87 //        2       PhantomSD/protonNStep            89 //        2       PhantomSD/protonNStep
 88 //        3       PhantomSD/chargedPassCellFlu     90 //        3       PhantomSD/chargedPassCellFlux
 89 //        4       PhantomSD/chargedCellFlux    <<  91 //        4       PhantomSD/chargedCellFlux 
 90 //        5       PhantomSD/chargedSurfFlux    <<  92 //        5       PhantomSD/chargedSurfFlux 
 91 //        6       PhantomSD/gammaSurfCurr000       93 //        6       PhantomSD/gammaSurfCurr000
 92 //        7       PhantomSD/gammaSurfCurr001       94 //        7       PhantomSD/gammaSurfCurr001
 93 //        9       PhantomSD/gammaSurdCurr002       95 //        9       PhantomSD/gammaSurdCurr002
 94 //       10       PhantomSD/gammaSurdCurr003       96 //       10       PhantomSD/gammaSurdCurr003
 95 //      --------------------------------------     97 //      -------------------------------------------------
 96 //      Please see README for detail descripti     98 //      Please see README for detail description.
 97 //                                                 99 //
 98 //============================================    100 //=======================================================================
 99                                                   101 
100 //....oooOO0OOooo........oooOO0OOooo........oo << 102 //
101 RE02DetectorConstruction::RE02DetectorConstruc << 103 RE02DetectorConstruction::RE02DetectorConstruction()
102 {                                                 104 {
103   // Default size of water phantom,and segment    105   // Default size of water phantom,and segmentation.
104   fPhantomSize.setX(200. * mm);                << 106     fphantomSize.setX(200.*mm);
105   fPhantomSize.setY(200. * mm);                << 107     fphantomSize.setY(200.*mm);
106   fPhantomSize.setZ(400. * mm);                << 108     fphantomSize.setZ(400.*mm);
107   fNx = fNy = fNz = 100;                       << 109     fNx = fNy = fNz = 100;
108   fInsertLead = TRUE;                          << 
109 }                                                 110 }
110                                                   111 
111 //....oooOO0OOooo........oooOO0OOooo........oo << 112 //
112 RE02DetectorConstruction::~RE02DetectorConstru    113 RE02DetectorConstruction::~RE02DetectorConstruction()
113 {                                              << 114 {;}
114   ;                                            << 
115 }                                              << 
116                                                   115 
117 //....oooOO0OOooo........oooOO0OOooo........oo << 116 //
118 G4VPhysicalVolume* RE02DetectorConstruction::C << 117  G4VPhysicalVolume* RE02DetectorConstruction::Construct()
119 {                                                 118 {
120   //=====================                         119   //=====================
121   // Material Definitions                         120   // Material Definitions
122   //=====================                         121   //=====================
123   //                                           << 122   //  
124   //-------- NIST Materials ------------------    123   //-------- NIST Materials ----------------------------------------------------
125   //  Material Information imported from NIST     124   //  Material Information imported from NIST database.
126   //                                              125   //
127   G4NistManager* NISTman = G4NistManager::Inst    126   G4NistManager* NISTman = G4NistManager::Instance();
128   G4Material* air = NISTman->FindOrBuildMateri << 127   G4Material* Air  = NISTman->FindOrBuildMaterial("G4_AIR");
129   G4Material* water = NISTman->FindOrBuildMate << 128   G4Material* H2O  = NISTman->FindOrBuildMaterial("G4_WATER");
130   G4Material* lead = NISTman->FindOrBuildMater << 129   G4Material* LEAD = NISTman->FindOrBuildMaterial("G4_Pb");
131                                                   130 
132   //                                              131   //
133   // Print all the materials defined.             132   // Print all the materials defined.
134   G4cout << G4endl << "The materials defined a    133   G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
135   G4cout << *(G4Material::GetMaterialTable())     134   G4cout << *(G4Material::GetMaterialTable()) << G4endl;
136                                                   135 
                                                   >> 136 
137   //==========================================    137   //============================================================================
138   //      Definitions of Solids, Logical Volum << 138   //      Definitions of Solids, Logical Volumes, Physical Volumes 
139   //==========================================    139   //============================================================================
140                                                   140 
141   //-------------                                 141   //-------------
142   // World Volume                              << 142   // World Volume 
143   //-------------                                 143   //-------------
144                                                   144 
145   G4ThreeVector worldSize = G4ThreeVector(200  << 145   G4ThreeVector worldSize = G4ThreeVector(200*cm, 200*cm, 200*cm);
                                                   >> 146   
                                                   >> 147   G4Box * solidWorld
                                                   >> 148     = new G4Box("world", worldSize.x()/2., worldSize.y()/2., worldSize.z()/2.);
                                                   >> 149   G4LogicalVolume * logicWorld
                                                   >> 150     = new G4LogicalVolume(solidWorld, Air, "World", 0, 0, 0);
146                                                   151 
147   G4Box* solidWorld =                          << 152   // 
148     new G4Box("world", worldSize.x() / 2., wor << 
149   G4LogicalVolume* logicWorld = new G4LogicalV << 
150                                                << 
151   //                                           << 
152   //  Must place the World Physical volume unr    153   //  Must place the World Physical volume unrotated at (0,0,0).
153   G4VPhysicalVolume* physiWorld = new G4PVPlac << 154   G4VPhysicalVolume * physiWorld
154                                                << 155     = new G4PVPlacement(0,               // no rotation
155                                                << 156       G4ThreeVector(), // at (0,0,0)
156                                                << 157       logicWorld,      // its logical volume
157                                                << 158       "World",         // its name
158                                                << 159       0,               // its mother  volume
159                                                << 160       false,           // no boolean operations
160                                                << 161       0);              // copy number
                                                   >> 162          
161   //---------------                               163   //---------------
162   // Water Phantom                                164   // Water Phantom
163   //---------------                               165   //---------------
164                                                   166 
165   //................................              167   //................................
166   // Mother Volume of Water Phantom               168   // Mother Volume of Water Phantom
167   //................................              169   //................................
168                                                   170 
169   //--  Default size of water phantom is defin    171   //--  Default size of water phantom is defined at constructor.
170   G4ThreeVector phantomSize = fPhantomSize;    << 172   G4ThreeVector phantomSize = fphantomSize; 
171                                                << 173   
172   G4Box* solidPhantom =                        << 174   G4Box * solidPhantom
173     new G4Box("phantom", phantomSize.x() / 2., << 175     = new G4Box("phantom",
174   G4LogicalVolume* logicPhantom = new G4Logica << 176     phantomSize.x()/2., phantomSize.y()/2., phantomSize.z()/2.);
                                                   >> 177   G4LogicalVolume * logicPhantom
                                                   >> 178     = new G4LogicalVolume(solidPhantom, H2O, "Phantom", 0, 0, 0);  
175                                                   179 
176   G4RotationMatrix* rot = new G4RotationMatrix << 180   G4RotationMatrix* rot=new G4RotationMatrix();
177   // rot->rotateY(30.*deg);                    << 181   //rot->rotateY(30.*deg);
178   G4ThreeVector positionPhantom;                  182   G4ThreeVector positionPhantom;
179   // G4VPhysicalVolume * physiPhantom =        << 183   //G4VPhysicalVolume * physiPhantom =
180   new G4PVPlacement(rot,  // no rotation       << 184   new G4PVPlacement(rot,             // no rotation
181                     positionPhantom,  // at (x << 185         positionPhantom, // at (x,y,z)
182                     logicPhantom,  // its logi << 186         logicPhantom,    // its logical volume
183                     "Phantom",  // its name    << 187         "Phantom",       // its name
184                     logicWorld,  // its mother << 188         logicWorld,      // its mother  volume
185                     false,  // no boolean oper << 189         false,           // no boolean operations
186                     0);  // copy number        << 190         0);              // copy number 
187                                                   191 
188   //..........................................    192   //..............................................
189   // Phantom segmentation using Parameterisati    193   // Phantom segmentation using Parameterisation
190   //..........................................    194   //..............................................
191   //                                              195   //
192   G4cout << "<-- RE02DetectorConstruction::Con << 196   G4cout << "<-- RE02DetectorConstruction::Construct-------" <<G4endl;
193   G4cout << "  Water Phantom Size " << fPhanto << 197   G4cout << "  Water Phantom Size " << fphantomSize/mm       << G4endl;
194   G4cout << "  Segmentation  (" << fNx << ","  << 198   G4cout << "  Segmentation  ("<< fNx<<","<<fNy<<","<<fNz<<")"<<G4endl;
195   G4cout << "  Lead plate at even copy # (0-Fa << 199   G4cout << "  Lead plate at even copy # (0-False,1-True): " << IsLeadSegment() <<G4endl;
196   G4cout << "<-------------------------------- << 200   G4cout << "<---------------------------------------------"<<G4endl;
197   // Number of segmentation.                      201   // Number of segmentation.
198   // - Default number of segmentation is defin    202   // - Default number of segmentation is defined at constructor.
199   G4int nxCells = fNx;                            203   G4int nxCells = fNx;
200   G4int nyCells = fNy;                            204   G4int nyCells = fNy;
201   G4int nzCells = fNz;                            205   G4int nzCells = fNz;
202                                                   206 
203   G4ThreeVector sensSize;                         207   G4ThreeVector sensSize;
204   sensSize.setX(phantomSize.x() / (G4double)nx << 208   sensSize.setX(phantomSize.x()/(G4double)nxCells);
205   sensSize.setY(phantomSize.y() / (G4double)ny << 209   sensSize.setY(phantomSize.y()/(G4double)nyCells);
206   sensSize.setZ(phantomSize.z() / (G4double)nz << 210   sensSize.setZ(phantomSize.z()/(G4double)nzCells);
207   // i.e Voxel size will be 2.0 x 2.0 x 2.0 mm    211   // i.e Voxel size will be 2.0 x 2.0 x 2.0 mm3 cube by default.
208   //                                           << 212   // 
209                                                   213 
210   // Replication of Water Phantom Volume.         214   // Replication of Water Phantom Volume.
211   // Y Slice                                      215   // Y Slice
212   G4String yRepName("RepY");                      216   G4String yRepName("RepY");
213   G4VSolid* solYRep =                             217   G4VSolid* solYRep =
214     new G4Box(yRepName, phantomSize.x() / 2.,  << 218     new G4Box(yRepName,phantomSize.x()/2.,sensSize.y()/2.,phantomSize.z()/2.);
215   G4LogicalVolume* logYRep = new G4LogicalVolu << 219   G4LogicalVolume* logYRep =
216   // G4PVReplica* yReplica =                   << 220     new G4LogicalVolume(solYRep,H2O,yRepName);
217   new G4PVReplica(yRepName, logYRep, logicPhan << 221   //G4PVReplica* yReplica =
                                                   >> 222   new G4PVReplica(yRepName,logYRep,logicPhantom,kYAxis,fNy,sensSize.y());
218   // X Slice                                      223   // X Slice
219   G4String xRepName("RepX");                      224   G4String xRepName("RepX");
220   G4VSolid* solXRep =                             225   G4VSolid* solXRep =
221     new G4Box(xRepName, sensSize.x() / 2., sen << 226     new G4Box(xRepName,sensSize.x()/2.,sensSize.y()/2.,phantomSize.z()/2.);
222   G4LogicalVolume* logXRep = new G4LogicalVolu << 227   G4LogicalVolume* logXRep =
223   // G4PVReplica* xReplica =                   << 228     new G4LogicalVolume(solXRep,H2O,xRepName);
224   new G4PVReplica(xRepName, logXRep, logYRep,  << 229   //G4PVReplica* xReplica =
225                                                << 230   new G4PVReplica(xRepName,logXRep,logYRep,kXAxis,fNx,sensSize.x());
                                                   >> 231   //
                                                   >> 232   //
226   //                                              233   //
227   //..................................            234   //..................................
228   // Voxel solid and logical volumes              235   // Voxel solid and logical volumes
229   //..................................            236   //..................................
230   // Z Slice                                      237   // Z Slice
231   G4String zVoxName("phantomSens");               238   G4String zVoxName("phantomSens");
232   G4VSolid* solVoxel = new G4Box(zVoxName, sen << 239   G4VSolid* solVoxel = 
233   fLVPhantomSens = new G4LogicalVolume(solVoxe << 240     new G4Box(zVoxName,sensSize.x()/2.,sensSize.y()/2.,sensSize.z()/2.);
                                                   >> 241   G4LogicalVolume* logicPhantomSens = new G4LogicalVolume(solVoxel,H2O,zVoxName);
234   //                                              242   //
235   //                                              243   //
236   std::vector<G4Material*> phantomMat(2, water << 244   std::vector<G4Material*> phantomMat(2,H2O);
237   if (IsLeadSegment()) phantomMat[1] = lead;   << 245   if ( IsLeadSegment() ) phantomMat[1]=LEAD;
238   //                                              246   //
239   // Parameterisation for transformation of vo    247   // Parameterisation for transformation of voxels.
240   //  (voxel size is fixed in this example.    << 248   //  (voxel size is fixed in this example. 
241   //  e.g. nested parameterisation handles mat << 249   //    e.g. nested parameterisation handles material and transfomation of voxels.)
242   RE02NestedPhantomParameterisation* paramPhan << 250   RE02NestedPhantomParameterisation* paramPhantom
243     new RE02NestedPhantomParameterisation(sens << 251     = new RE02NestedPhantomParameterisation(sensSize/2.,nzCells,phantomMat);
244   // G4VPhysicalVolume * physiPhantomSens =    << 252   //G4VPhysicalVolume * physiPhantomSens =
245   new G4PVParameterised("PhantomSens",  // the << 253     new G4PVParameterised("PhantomSens",     // their name
246                         fLVPhantomSens,  // th << 254         logicPhantomSens,  // their logical volume
247                         logXRep,  // Mother lo << 255         logXRep,           // Mother logical volume
248                         kUndefined,  // Are pl << 256         kUndefined,        // Are placed along this axis 
249                         nzCells,  // Number of << 257         nzCells,            // Number of cells
250                         paramPhantom);  // Par << 258         paramPhantom);     // Parameterisation.
251   //   Optimization flag is avaiable for,         259   //   Optimization flag is avaiable for,
252   //    kUndefined, kXAxis, kYAxis, kZAxis.       260   //    kUndefined, kXAxis, kYAxis, kZAxis.
253   //                                              261   //
254                                                   262 
255   //===============================            << 
256   //   Visualization attributes                << 
257   //===============================            << 
258                                                << 
259   G4VisAttributes* boxVisAtt = new G4VisAttrib << 
260   logicWorld->SetVisAttributes(boxVisAtt);     << 
261   // logicWorld->SetVisAttributes(G4VisAttribu << 
262                                                << 
263   // Mother volume of WaterPhantom             << 
264   G4VisAttributes* phantomVisAtt = new G4VisAt << 
265   logicPhantom->SetVisAttributes(phantomVisAtt << 
266                                                << 
267   // Replica                                   << 
268   G4VisAttributes* yRepVisAtt = new G4VisAttri << 
269   logYRep->SetVisAttributes(yRepVisAtt);       << 
270   G4VisAttributes* xRepVisAtt = new G4VisAttri << 
271   logXRep->SetVisAttributes(xRepVisAtt);       << 
272                                                << 
273   // Skip the visualization for those voxels.  << 
274   fLVPhantomSens->SetVisAttributes(G4VisAttrib << 
275                                                << 
276   return physiWorld;                           << 
277 }                                              << 
278                                                << 
279 void RE02DetectorConstruction::ConstructSDandF << 
280 {                                              << 
281   //==========================================    263   //================================================
282   // Sensitive detectors : MultiFunctionalDete    264   // Sensitive detectors : MultiFunctionalDetector
283   //==========================================    265   //================================================
284   //                                              266   //
285   //  Sensitive Detector Manager.                 267   //  Sensitive Detector Manager.
286   G4SDManager* pSDman = G4SDManager::GetSDMpoi << 268   G4SDManager* SDman = G4SDManager::GetSDMpointer();
287   //                                              269   //
288   // Sensitive Detector Name                      270   // Sensitive Detector Name
289   G4String phantomSDname = "PhantomSD";           271   G4String phantomSDname = "PhantomSD";
290                                                   272 
291   //------------------------                      273   //------------------------
292   // MultiFunctionalDetector                      274   // MultiFunctionalDetector
293   //------------------------                      275   //------------------------
294   //                                              276   //
295   // Define MultiFunctionalDetector with name.    277   // Define MultiFunctionalDetector with name.
296   G4MultiFunctionalDetector* mFDet = new G4Mul << 278   G4MultiFunctionalDetector* MFDet = new G4MultiFunctionalDetector(phantomSDname);
297   pSDman->AddNewDetector(mFDet);  // Register  << 279   SDman->AddNewDetector( MFDet );                 // Register SD to SDManager.
298   fLVPhantomSens->SetSensitiveDetector(mFDet); << 280   logicPhantomSens->SetSensitiveDetector(MFDet);  // Assign SD to the logical volume.
299                                                   281 
300   //---------------------------------------       282   //---------------------------------------
301   // SDFilter : Sensitive Detector Filters        283   // SDFilter : Sensitive Detector Filters
302   //---------------------------------------       284   //---------------------------------------
303   //                                              285   //
304   // Particle Filter for Primitive Scorer with << 286   // Particle Filter for Primitive Scorer with filter name(fltName) 
305   // and particle name(particleName),             287   // and particle name(particleName),
306   // or particle names are given by add("parti    288   // or particle names are given by add("particle name"); method.
307   //                                              289   //
308   G4String fltName, particleName;              << 290   G4String fltName,particleName;
309   //                                              291   //
310   //-- proton filter                              292   //-- proton filter
311   G4SDParticleFilter* protonFilter =           << 293   G4SDParticleFilter* protonFilter = 
312     new G4SDParticleFilter(fltName = "protonFi << 294       new G4SDParticleFilter(fltName="protonFilter", particleName="proton");
313   //                                              295   //
314   //-- electron filter                            296   //-- electron filter
315   G4SDParticleFilter* electronFilter = new G4S << 297   G4SDParticleFilter* electronFilter = 
316   electronFilter->add(particleName = "e+");  / << 298       new G4SDParticleFilter(fltName="electronFilter");
317   electronFilter->add(particleName = "e-");  / << 299   electronFilter->add(particleName="e+");   // accept electrons.
                                                   >> 300   electronFilter->add(particleName="e-");   // accept positorons.
318   //                                              301   //
319   //-- charged particle filter                    302   //-- charged particle filter
320   G4SDChargedFilter* chargedFilter = new G4SDC << 303   G4SDChargedFilter* chargedFilter = 
                                                   >> 304       new G4SDChargedFilter(fltName="chargedFilter");
321                                                   305 
322   //------------------------                      306   //------------------------
323   // PS : Primitive Scorers                       307   // PS : Primitive Scorers
324   //------------------------                      308   //------------------------
325   // Primitive Scorers are used with SDFilters    309   // Primitive Scorers are used with SDFilters according to your purpose.
326   //                                           << 310   // 
327   //                                              311   //
328   //-- Primitive Scorer for Energy Deposit.       312   //-- Primitive Scorer for Energy Deposit.
329   //      Total, by protons, by electrons.        313   //      Total, by protons, by electrons.
330   G4String psName;                                314   G4String psName;
331   G4PSEnergyDeposit3D* scorer0 = new G4PSEnerg << 315   G4PSEnergyDeposit*  scorer0 = new RE02PSEnergyDeposit(psName="totalEDep",fNx,fNy,fNz);
332   G4PSEnergyDeposit3D* scorer1 = new G4PSEnerg << 316   G4PSEnergyDeposit*  scorer1 = new RE02PSEnergyDeposit(psName="protonEDep",fNx,fNy,fNz);
333   scorer1->SetFilter(protonFilter);               317   scorer1->SetFilter(protonFilter);
334                                                   318 
335   //                                              319   //
336   //-- Number of Steps for protons                320   //-- Number of Steps for protons
337   G4PSNofStep3D* scorer2 = new G4PSNofStep3D(p << 321   G4PSNofStep*   scorer2 = new RE02PSNofStep(psName="protonNStep",fNx,fNy,fNz);
338   scorer2->SetFilter(protonFilter);               322   scorer2->SetFilter(protonFilter);
339                                                   323 
340   //                                              324   //
341   //-- CellFlux for charged particles             325   //-- CellFlux for charged particles
342   G4PSPassageCellFlux3D* scorer3 =             << 326   G4PSPassageCellFlux* scorer3 = new RE02PSPassageCellFlux(psName="chargedPassCellFlux",
343     new G4PSPassageCellFlux3D(psName = "charge << 327                  fNx,fNy,fNz);
344   G4PSCellFlux3D* scorer4 = new G4PSCellFlux3D << 328   G4PSCellFlux*        scorer4 = new RE02PSCellFlux(psName="chargedCellFlux",
345   G4PSFlatSurfaceFlux3D* scorer5 =             << 329                 fNx,fNy,fNz);
346     new G4PSFlatSurfaceFlux3D(psName = "charge << 330   G4PSFlatSurfaceFlux* scorer5 = new RE02PSFlatSurfaceFlux(psName="chargedSurfFlux",
                                                   >> 331                  fFlux_InOut,fNx,fNy,fNz);
347   scorer3->SetFilter(chargedFilter);              332   scorer3->SetFilter(chargedFilter);
348   scorer4->SetFilter(chargedFilter);              333   scorer4->SetFilter(chargedFilter);
349   scorer5->SetFilter(chargedFilter);              334   scorer5->SetFilter(chargedFilter);
350                                                   335 
351   //                                              336   //
352   //------------------------------------------    337   //------------------------------------------------------------
353   //  Register primitive scorers to MultiFunct    338   //  Register primitive scorers to MultiFunctionalDetector
354   //------------------------------------------    339   //------------------------------------------------------------
355   mFDet->RegisterPrimitive(scorer0);           << 340   MFDet->RegisterPrimitive(scorer0);
356   mFDet->RegisterPrimitive(scorer1);           << 341   MFDet->RegisterPrimitive(scorer1);
357   mFDet->RegisterPrimitive(scorer2);           << 342   MFDet->RegisterPrimitive(scorer2);
358   mFDet->RegisterPrimitive(scorer3);           << 343   MFDet->RegisterPrimitive(scorer3);
359   mFDet->RegisterPrimitive(scorer4);           << 344   MFDet->RegisterPrimitive(scorer4);
360   mFDet->RegisterPrimitive(scorer5);           << 345   MFDet->RegisterPrimitive(scorer5);
                                                   >> 346 
361                                                   347 
362   //========================                      348   //========================
363   // More additional Primitive Scoreres           349   // More additional Primitive Scoreres
364   //========================                      350   //========================
365   //                                              351   //
366   //--- Surface Current for gamma with energy     352   //--- Surface Current for gamma with energy bin.
367   // This example creates four primitive score    353   // This example creates four primitive scorers.
368   //  4 bins with energy   ---   Primitive Sco    354   //  4 bins with energy   ---   Primitive Scorer Name
369   //    1.     to  10 KeV,        gammaSurfCur    355   //    1.     to  10 KeV,        gammaSurfCurr000
370   //   10 keV  to 100 KeV,        gammaSurfCur    356   //   10 keV  to 100 KeV,        gammaSurfCurr001
371   //  100 keV  to   1 MeV,        gammaSurfCur    357   //  100 keV  to   1 MeV,        gammaSurfCurr002
372   //    1 MeV  to  10 MeV.        gammaSurfCur    358   //    1 MeV  to  10 MeV.        gammaSurfCurr003
373   //                                              359   //
374   for (G4int i = 0; i < 4; i++) {              << 360   char name[17];
375     std::ostringstream name;                   << 361   for ( G4int i = 0; i < 4; i++){
376     name << "gammaSurfCurr" << std::setfill('0 << 362       std::sprintf(name,"gammaSurfCurr%03d",i);
377     G4String psgName = name.str();             << 363       G4String psgName(name);
378     G4double kmin = std::pow(10., (G4double)i) << 364       G4double kmin = std::pow(10.,(G4double)i)*keV;
379     G4double kmax = std::pow(10., (G4double)(i << 365       G4double kmax = std::pow(10.,(G4double)(i+1))*keV;
380     //-- Particle with kinetic energy filter.  << 366       //-- Particle with kinetic energy filter.
381     G4SDParticleWithEnergyFilter* pkinEFilter  << 367       G4SDParticleWithEnergyFilter* pkinEFilter =
382       new G4SDParticleWithEnergyFilter(fltName << 368   new G4SDParticleWithEnergyFilter(fltName="gammaE filter",kmin,kmax);
383     pkinEFilter->add("gamma");  // Accept only << 369       pkinEFilter->add("gamma");  // Accept only gamma.
384     pkinEFilter->show();  // Show accepting co << 370       pkinEFilter->show();        // Show accepting condition to stdout.
385     //-- Surface Current Scorer which scores   << 371       //-- Surface Current Scorer which scores  number of tracks in unit area.
386     G4PSFlatSurfaceCurrent3D* scorer =         << 372       G4PSFlatSurfaceCurrent* scorer =
387       new G4PSFlatSurfaceCurrent3D(psgName, fC << 373     new RE02PSFlatSurfaceCurrent(psgName,fCurrent_InOut,fNx,fNy,fNz);
388     scorer->SetFilter(pkinEFilter);  // Assign << 374       scorer->SetFilter(pkinEFilter);    // Assign filter.
389     mFDet->RegisterPrimitive(scorer);  // Regi << 375       MFDet->RegisterPrimitive(scorer);  // Register it to MultiFunctionalDetector.
390   }                                               376   }
                                                   >> 377   //
                                                   >> 378 
                                                   >> 379   //=============================== 
                                                   >> 380  //   Visualization attributes 
                                                   >> 381   //===============================
                                                   >> 382 
                                                   >> 383   G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
                                                   >> 384   logicWorld  ->SetVisAttributes(BoxVisAtt);  
                                                   >> 385   //logicWorld->SetVisAttributes(G4VisAttributes::Invisible);  
                                                   >> 386 
                                                   >> 387   // Mother volume of WaterPhantom
                                                   >> 388   G4VisAttributes* PhantomVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
                                                   >> 389   logicPhantom->SetVisAttributes(PhantomVisAtt);
                                                   >> 390   
                                                   >> 391   // Replica
                                                   >> 392   G4VisAttributes* YRepVisAtt = new G4VisAttributes(G4Colour(0.0,1.0,0.0));
                                                   >> 393   logYRep->SetVisAttributes(YRepVisAtt);
                                                   >> 394   G4VisAttributes* XRepVisAtt = new G4VisAttributes(G4Colour(0.0,1.0,0.0));
                                                   >> 395   logXRep->SetVisAttributes(XRepVisAtt);
                                                   >> 396   
                                                   >> 397   // Skip the visualization for those voxels.
                                                   >> 398   logicPhantomSens->SetVisAttributes(G4VisAttributes::Invisible);
                                                   >> 399 
                                                   >> 400   
                                                   >> 401   return physiWorld;
391 }                                                 402 }
                                                   >> 403 
392                                                   404