Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/medical/electronScattering2/src/ElectronBenchmarkDetector.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/medical/electronScattering2/src/ElectronBenchmarkDetector.cc (Version 11.3.0) and /examples/extended/medical/electronScattering2/src/ElectronBenchmarkDetector.cc (Version 9.4)


  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 //                                             << 
 27 /// \file medical/electronScattering2/src/Elec << 
 28 /// \brief Implementation of the ElectronBench << 
 29                                                    26 
 30 #include "ElectronBenchmarkDetector.hh"            27 #include "ElectronBenchmarkDetector.hh"
 31                                                    28 
 32 #include "ElectronBenchmarkDetectorMessenger.h     29 #include "ElectronBenchmarkDetectorMessenger.hh"
 33                                                    30 
 34 #include "G4Colour.hh"                         <<  31 #include "G4RunManager.hh"
                                                   >>  32 #include "G4UImanager.hh"
                                                   >>  33 #include "G4NistManager.hh"
 35 #include "G4GeometryManager.hh"                    34 #include "G4GeometryManager.hh"
 36 #include "G4LogicalVolume.hh"                  <<  35 #include "G4PhysicalVolumeStore.hh"
 37 #include "G4LogicalVolumeStore.hh"                 36 #include "G4LogicalVolumeStore.hh"
                                                   >>  37 #include "G4SolidStore.hh"
 38 #include "G4Material.hh"                           38 #include "G4Material.hh"
 39 #include "G4MultiFunctionalDetector.hh"        <<  39 #include "G4Tubs.hh"
 40 #include "G4NistManager.hh"                    <<  40 #include "G4LogicalVolume.hh"
 41 #include "G4PSCellFlux.hh"                     << 
 42 #include "G4PSPopulation.hh"                   << 
 43 #include "G4PVPlacement.hh"                        41 #include "G4PVPlacement.hh"
 44 #include "G4PVReplica.hh"                          42 #include "G4PVReplica.hh"
 45 #include "G4PhysicalVolumeStore.hh"            <<  43 #include "G4VisAttributes.hh"
 46 #include "G4RunManager.hh"                     <<  44 #include "G4Colour.hh"
 47 #include "G4SDManager.hh"                          45 #include "G4SDManager.hh"
 48 #include "G4SDParticleFilter.hh"                   46 #include "G4SDParticleFilter.hh"
 49 #include "G4SolidStore.hh"                     <<  47 #include "G4MultiFunctionalDetector.hh"
 50 #include "G4SystemOfUnits.hh"                  << 
 51 #include "G4Tubs.hh"                           << 
 52 #include "G4UImanager.hh"                      << 
 53 #include "G4VPrimitiveScorer.hh"                   48 #include "G4VPrimitiveScorer.hh"
 54 #include "G4VisAttributes.hh"                  <<  49 #include "G4PSCellFlux.hh"
 55                                                <<  50 #include "G4PSPopulation.hh"
 56 //....oooOO0OOooo........oooOO0OOooo........oo << 
 57                                                    51 
 58 ElectronBenchmarkDetector::ElectronBenchmarkDe <<  52 ElectronBenchmarkDetector::ElectronBenchmarkDetector()
 59 {                                              <<  53 :fLogWorld(NULL),
 60   // Exit Window                               <<  54 worldVisAtt(0),
 61   fPosWindow0 = 0.000000 * cm;                 <<  55 windowVisAtt(0),
 62   fPosWindow1 = 0.004120 * cm;                 <<  56 primFoilVisAtt(0), 
 63                                                <<  57 monVisAtt(0),
 64   // Scattering Foil                           <<  58 bagVisAtt(0),
 65   fPosPrimFoil = 2.650000 * cm;                <<  59 heliumVisAtt(0),
 66   fHalfThicknessPrimFoil = 0.0 * cm;           <<  60 ringVisAtt(0),
 67                                                <<  61 scorerVisAtt(0)
 68   // Monitor Chamber                           <<  62 {
 69   fPosMon0 = 5.000000 * cm;                    <<  63   // Exit Window
 70   fPosMon1 = 5.011270 * cm;                    <<  64   fPosWindow0   =   0.000000*cm;
 71                                                <<  65   fPosWindow1   =   0.004120*cm;
 72   // Helium Bag                                <<  66   
 73   fPosBag0 = 6.497500 * cm;                    <<  67   // Scattering Foil
 74   fPosHelium0 = 6.500000 * cm;                 <<  68   fPosPrimFoil  =   2.650000*cm;
 75   fPosHelium1 = 116.500000 * cm;               <<  69   
 76   fPosBag1 = 116.502500 * cm;                  <<  70   // Monitor Chamber
 77   fThicknessRing = 1.4 * cm;                   <<  71   fPosMon0    =   5.000000*cm;
 78                                                <<  72   fPosMon1    =   5.011270*cm;
 79   // Scoring Plane                             <<  73   
 80   fPosScorer = 118.200000 * cm;                <<  74   // Helium Bag
 81   fThicknessScorer = 0.001 * cm;               <<  75   fPosBag0    =   6.497500*cm;
 82   fWidthScorerRing = 0.1 * cm;                 <<  76   fPosHelium0   =   6.500000*cm;
 83                                                <<  77   fPosHelium1   = 116.500000*cm;
 84   // Radii                                     <<  78   fPosBag1    = 116.502500*cm;
 85   fRadOverall = 23.3 * cm;                     <<  79   fThicknessRing  =   1.4*cm;
 86   fRadRingInner = 20.0 * cm;                   <<  80   
 87                                                <<  81   // Scoring Plane
 88   // Extra space remaining in world volume aro <<  82   fPosScorer    = 118.200000*cm;  
 89   fPosDelta = 1. * cm;                         <<  83   fThicknessScorer=   0.001*cm;
 90   fRadDelta = 0.1 * cm;                        <<  84   fWidthScorerRing=   0.1*cm;
                                                   >>  85   
                                                   >>  86   // Radii
                                                   >>  87   fRadOverall   =  23.3*cm;
                                                   >>  88   fRadRingInner =  20.0*cm;
                                                   >>  89   
                                                   >>  90   // Extra space remaining in world volume around apparatus
                                                   >>  91   fPosDelta   =   1.*cm;
                                                   >>  92   fRadDelta   =   0.1*cm;
 91                                                    93 
 92   fMessenger = new ElectronBenchmarkDetectorMe <<  94   fMessenger = new ElectronBenchmarkDetectorMessenger(this);    
 93   DefineMaterials();                           << 
 94 }                                                  95 }
 95                                                    96 
 96 //....oooOO0OOooo........oooOO0OOooo........oo << 
 97                                                    97 
 98 ElectronBenchmarkDetector::~ElectronBenchmarkD     98 ElectronBenchmarkDetector::~ElectronBenchmarkDetector()
 99 {                                                  99 {
100   delete fMessenger;                           << 100   delete fMessenger;
101                                                << 101   
102   delete fWorldVisAtt;                         << 102   delete worldVisAtt;
103   delete fWindowVisAtt;                        << 103   delete windowVisAtt;
104   delete fPrimFoilVisAtt;                      << 104   delete primFoilVisAtt;
105   delete fMonVisAtt;                           << 105   delete monVisAtt;
106   delete fBagVisAtt;                           << 106   delete bagVisAtt;
107   delete fHeliumVisAtt;                        << 107   delete heliumVisAtt;
108   delete fRingVisAtt;                          << 108   delete ringVisAtt;
109   delete fScorerVisAtt;                        << 109   delete scorerVisAtt;
110 }                                                 110 }
111                                                   111 
112 //....oooOO0OOooo........oooOO0OOooo........oo << 
113                                                   112 
114 G4VPhysicalVolume* ElectronBenchmarkDetector::    113 G4VPhysicalVolume* ElectronBenchmarkDetector::Construct()
115 {                                              << 114 { 
116   return CreateGeometry();                     << 115   DefineMaterials();
117 }                                              << 116   
118                                                << 117   G4VPhysicalVolume* physiworld = CreateGeometry();
119 //....oooOO0OOooo........oooOO0OOooo........oo << 118   return physiworld;
120                                                << 119 }
121 void ElectronBenchmarkDetector::DefineMaterial << 120 
122 {                                              << 121 
123   // Use NIST database for elements and materi << 122 void ElectronBenchmarkDetector::DefineMaterials(){ 
124   G4NistManager* man = G4NistManager::Instance << 123   // Use NIST database for elements and materials whereever possible.
125   man->SetVerbose(1);                          << 124   G4NistManager* man = G4NistManager::Instance();
126                                                << 125   man->SetVerbose(1);
127   // Take all elements and materials from NIST << 126   
128   man->FindOrBuildMaterial("G4_He");           << 127   // Take all elements and materials from NIST 
129   man->FindOrBuildMaterial("G4_Be");           << 128   man->FindOrBuildMaterial("G4_He");
130   man->FindOrBuildMaterial("G4_Al");           << 129   man->FindOrBuildMaterial("G4_Be");
131   man->FindOrBuildMaterial("G4_Ti");           << 130   man->FindOrBuildMaterial("G4_Al");
132   man->FindOrBuildMaterial("G4_Ta");           << 131   man->FindOrBuildMaterial("G4_Ti");
133   man->FindOrBuildMaterial("G4_AIR");          << 132   man->FindOrBuildMaterial("G4_Ta");
134   man->FindOrBuildMaterial("G4_MYLAR");        << 133   man->FindOrBuildMaterial("G4_AIR");
135                                                << 134   man->FindOrBuildMaterial("G4_MYLAR");
136   G4Element* C = man->FindOrBuildElement("C"); << 135   
137   G4Element* Cu = man->FindOrBuildElement("Cu" << 136   G4Element* C  = man->FindOrBuildElement("C");
138   G4Element* Au = man->FindOrBuildElement("Au" << 137   G4Element* Cu = man->FindOrBuildElement("Cu");
139   G4Element* Ti = man->FindOrBuildElement("Ti" << 138   G4Element* Au = man->FindOrBuildElement("Au");
140   G4Element* Al = man->FindOrBuildElement("Al" << 139   G4Element* Ti = man->FindOrBuildElement("Ti");
141   G4Element* V = man->FindOrBuildElement("V"); << 140   G4Element* Al = man->FindOrBuildElement("Al");
142                                                << 141   G4Element* V  = man->FindOrBuildElement("V");
143   // Define materials not in NIST.             << 142   
144   // While the NIST database does contain defa << 143   // Define materials not in NIST
145   // those defaults have different densities t << 144   // While the NIST database does contain default materials for C, Cu and Au, those defaults have different
146   // benchmark specification.                  << 145   // densities than the ones used in the benchmark specification.
147   G4double density;                            << 146   G4double density;
148   G4int ncomponents;                           << 147   G4int ncomponents;
149   G4double fractionmass;                       << 148   G4double fractionmass;
150                                                << 149   
151   G4Material* G4_C = new G4Material("G4_C", de << 150   G4Material* G4_C = new G4Material("G4_C", density= 2.18*g/cm3, ncomponents=1);
152   G4_C->AddElement(C, fractionmass = 1.00);    << 151   G4_C->AddElement(C, fractionmass=1.00);
153                                                << 152 
154   G4Material* G4_Cu = new G4Material("G4_Cu",  << 153   G4Material* G4_Cu = new G4Material("G4_Cu", density= 8.92*g/cm3, ncomponents=1);
155   G4_Cu->AddElement(Cu, fractionmass = 1.00);  << 154   G4_Cu->AddElement(Cu, fractionmass=1.00);
156                                                << 155 
157   G4Material* G4_Au = new G4Material("G4_Au",  << 156   G4Material* G4_Au = new G4Material("G4_Au", density= 19.30*g/cm3, ncomponents=1);
158   G4_Au->AddElement(Au, fractionmass = 1.00);  << 157   G4_Au->AddElement(Au, fractionmass=1.00);
159                                                << 158 
160   G4Material* TiAlloy = new G4Material("TiAllo << 159   G4Material* TiAlloy = new G4Material("TiAlloy", density= 4.42*g/cm3, ncomponents=3);
161   TiAlloy->AddElement(Ti, fractionmass = 0.90) << 160   TiAlloy->AddElement(Ti, fractionmass=0.90);
162   TiAlloy->AddElement(Al, fractionmass = 0.06) << 161   TiAlloy->AddElement(Al, fractionmass=0.06);
163   TiAlloy->AddElement(V, fractionmass = 0.04); << 162   TiAlloy->AddElement(V,  fractionmass=0.04);
164                                                << 163 
165   // Print materials table                     << 164   // Print materials table  
166   G4cout << *(G4Material::GetMaterialTable())  << 165   G4cout << *(G4Material::GetMaterialTable()) << G4endl;
167 }                                              << 166 }
168                                                << 167 
169 //....oooOO0OOooo........oooOO0OOooo........oo << 168 
170                                                << 169 G4VPhysicalVolume* ElectronBenchmarkDetector::CreateGeometry(){ 
171 G4VPhysicalVolume* ElectronBenchmarkDetector:: << 170   // Clean old geometry, if any
172 {                                              << 171   fLogWorld=NULL;
173   if (fPhysiWorld) return fPhysiWorld;         << 172   fScorerRingLog=NULL;
174                                                << 173   G4GeometryManager::GetInstance()->OpenGeometry();
175   // Instantiate the world                     << 174   G4PhysicalVolumeStore::GetInstance()->Clean();
176   fPhysiWorld = CreateWorld();                 << 175   G4LogicalVolumeStore::GetInstance()->Clean();
177   fLogWorld = fPhysiWorld->GetLogicalVolume(); << 176   G4SolidStore::GetInstance()->Clean();
178                                                << 177   
179   // Instantiate the geometry                  << 178   // Instantiate the world
180   CreateExitWindow(fLogWorld);                 << 179   G4VPhysicalVolume* physiworld = CreateWorld();
181   CreatePrimaryFoil(fLogWorld);                << 180   fLogWorld = physiworld->GetLogicalVolume();
182   CreateMonitor(fLogWorld);                    << 181   
183   CreateHeliumBag(fLogWorld);                  << 182   // Instantiate the geometry
184                                                << 183   CreateExitWindow(fLogWorld);
185   // Create the scorers                        << 184   CreatePrimaryFoil(fLogWorld);
186   CreateScorer(fLogWorld);                     << 185   CreateMonitor(fLogWorld);
187                                                << 186   CreateHeliumBag(fLogWorld);
188   return fPhysiWorld;                          << 187   
189 }                                              << 188   // Create and activate the scorers
190                                                << 189   CreateScorer(fLogWorld);
191 //....oooOO0OOooo........oooOO0OOooo........oo << 190   ActivateScorer();
192                                                << 191   
193 G4VPhysicalVolume* ElectronBenchmarkDetector:: << 192   return physiworld;  
194 {                                              << 193 }
195   G4double halfLengthWorld = fPosScorer / 2. + << 194 
196   G4double radWorld = fRadOverall + fRadDelta; << 195 
197   G4VSolid* worldSolid =                       << 196 void ElectronBenchmarkDetector::UpdateGeometry(){
198     new G4Tubs("WorldSolid", 0. * cm, radWorld << 197   G4RunManager::GetRunManager()->DefineWorldVolume(CreateGeometry());
199   G4LogicalVolume* worldLog =                  << 198 }
200     new G4LogicalVolume(worldSolid, G4Material << 199 
201                                                << 200 
202   fWorldVisAtt = new G4VisAttributes(G4Colour( << 201 G4VPhysicalVolume* ElectronBenchmarkDetector::CreateWorld(){
203   worldLog->SetVisAttributes(fWorldVisAtt);    << 202   G4double halfLengthWorld = fPosScorer/2. + fPosDelta;
204                                                << 203   G4double radWorld = fRadOverall + fRadDelta;
205   G4VPhysicalVolume* worldPhys =               << 204   G4VSolid* worldSolid = new G4Tubs("WorldSolid", 0.*cm, radWorld, halfLengthWorld, 0.*deg, 360.*deg);
206     new G4PVPlacement(0, G4ThreeVector(0., 0., << 205   G4LogicalVolume* worldLog = new G4LogicalVolume(worldSolid, G4Material::GetMaterial("G4_AIR"), "WorldLog");
207                                                << 206   
208   return worldPhys;                            << 207   worldVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
209 }                                              << 208   worldLog->SetVisAttributes(worldVisAtt);
210                                                << 209   
211 //....oooOO0OOooo........oooOO0OOooo........oo << 210   G4VPhysicalVolume* worldPhys = 
212                                                << 211     new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), worldLog,"World", 0, false, 0);
213 void ElectronBenchmarkDetector::CreateExitWind << 212   
214 {                                              << 213     return worldPhys;
215   G4double halfLengthWorld = fPosScorer / 2.;  << 214 }
216   G4double halfThicknessWindow = fPosWindow1 / << 215 
217   G4VSolid* windowSolid =                      << 216 
218     new G4Tubs("windowSolid", 0. * cm, fRadOve << 217 void ElectronBenchmarkDetector::CreateExitWindow(G4LogicalVolume* worldLog){
219   G4LogicalVolume* windowLog =                 << 218   G4double halfLengthWorld = fPosScorer/2.;
220     new G4LogicalVolume(windowSolid, G4Materia << 219   G4double halfThicknessWindow = fPosWindow1/2.;
221                                                << 220   G4VSolid* windowSolid = new G4Tubs("windowSolid", 0.*cm, fRadOverall, halfThicknessWindow, 0.*deg, 360.*deg);
222   fWindowVisAtt = new G4VisAttributes(G4Colour << 221   G4LogicalVolume* windowLog = new G4LogicalVolume(windowSolid, G4Material::GetMaterial("TiAlloy"), "windowLog");
223   windowLog->SetVisAttributes(fWindowVisAtt);  << 222   
224                                                << 223   windowVisAtt = new G4VisAttributes(G4Colour(0.5,1.0,0.5));
225   new G4PVPlacement(0, G4ThreeVector(0., 0., h << 224   windowLog->SetVisAttributes(windowVisAtt);
226                     "ExitWindow", worldLog, fa << 225   
227 }                                              << 226   new G4PVPlacement(0, 
228                                                << 227     G4ThreeVector(0.,0., halfThicknessWindow - halfLengthWorld),
229 //....oooOO0OOooo........oooOO0OOooo........oo << 228     windowLog,"ExitWindow",worldLog,false,0); 
230                                                << 229 }
231 void ElectronBenchmarkDetector::CreatePrimaryF << 230 
232 {                                              << 231 
233   G4double halfLengthWorld = fPosScorer / 2.;  << 232 void ElectronBenchmarkDetector::CreatePrimaryFoil(G4LogicalVolume* worldLog){
234                                                << 233   G4double halfLengthWorld = fPosScorer/2.;
235   // For some energies, we have no Primary Foi << 234 
236   if (fHalfThicknessPrimFoil == 0.) return;    << 235   // For some energies, we have no Primary Foil.
237                                                << 236   if (fHalfThicknessPrimFoil==0.) return;
238   fSolidPrimFoil =                             << 237   
239     new G4Tubs("PrimFoilSolid", 0. * cm, fRadO << 238   G4VSolid* primFoilSolid = new G4Tubs("PrimFoilSolid", 
240   fLogPrimFoil = new G4LogicalVolume(fSolidPri << 239     0.*cm, fRadOverall, fHalfThicknessPrimFoil, 0.*deg, 360.*deg);
241                                                << 240   G4LogicalVolume* primFoilLog = new G4LogicalVolume(primFoilSolid, fMaterialPrimFoil, "PrimFoilLog");
242   fPrimFoilVisAtt = new G4VisAttributes(G4Colo << 241   
243   fLogPrimFoil->SetVisAttributes(fPrimFoilVisA << 242   primFoilVisAtt = new G4VisAttributes(G4Colour(0.5,1.0,0.5));
244                                                << 243   primFoilLog->SetVisAttributes(primFoilVisAtt);
245   new G4PVPlacement(0,                         << 244   
246                     G4ThreeVector(0., 0., fPos << 245   new G4PVPlacement(0, 
247                     fLogPrimFoil, "ScatteringF << 246     G4ThreeVector(0.,0.,fPosPrimFoil + fHalfThicknessPrimFoil - halfLengthWorld),
                                                   >> 247     primFoilLog,"ScatteringFoil",worldLog,false,0);
                                                   >> 248 }
                                                   >> 249 
                                                   >> 250 
                                                   >> 251 void ElectronBenchmarkDetector::CreateMonitor(G4LogicalVolume* worldLog){
                                                   >> 252   G4double halfLengthWorld = fPosScorer/2.;
                                                   >> 253   G4double halfThicknessMon = (fPosMon1 - fPosMon0) /2.;
                                                   >> 254   G4VSolid* monSolid = new G4Tubs("monSolid", 0.*cm, fRadOverall, halfThicknessMon, 0.*deg, 360.*deg);
                                                   >> 255   G4LogicalVolume* monLog = new G4LogicalVolume(monSolid, G4Material::GetMaterial("G4_MYLAR"), "monLog");
                                                   >> 256   
                                                   >> 257   monVisAtt = new G4VisAttributes(G4Colour(0.5,1.0,0.5));
                                                   >> 258   monLog->SetVisAttributes(monVisAtt);
                                                   >> 259   
                                                   >> 260   new G4PVPlacement(0, 
                                                   >> 261     G4ThreeVector(0.,0., fPosMon0 + halfThicknessMon - halfLengthWorld),
                                                   >> 262     monLog,"MonitorChamber",worldLog,false,0);  
                                                   >> 263 }
                                                   >> 264 
                                                   >> 265 
                                                   >> 266 void ElectronBenchmarkDetector::CreateHeliumBag(G4LogicalVolume* worldLog){
                                                   >> 267   G4double halfLengthWorld = fPosScorer/2.;
                                                   >> 268 // Construct cylinder of Mylar
                                                   >> 269   G4double halfThicknessBag = (fPosBag1 - fPosBag0) /2.;
                                                   >> 270   G4VSolid* bagSolid = new G4Tubs("bagSolid", 0.*cm, fRadOverall, halfThicknessBag, 0.*deg, 360.*deg);
                                                   >> 271   G4LogicalVolume* bagLog = new G4LogicalVolume(bagSolid, G4Material::GetMaterial("G4_MYLAR"), "bagLog");
                                                   >> 272   
                                                   >> 273   bagVisAtt = new G4VisAttributes(G4Colour(0.5,1.0,0.5));
                                                   >> 274   bagLog->SetVisAttributes(bagVisAtt);
                                                   >> 275   
                                                   >> 276   new G4PVPlacement(0, 
                                                   >> 277     G4ThreeVector(0.,0., fPosBag0 + halfThicknessBag - halfLengthWorld),
                                                   >> 278     bagLog,"HeliumBag",worldLog,false,0); 
                                                   >> 279 
                                                   >> 280 // Insert cylinder of Helium into the Cylinder of Mylar
                                                   >> 281   G4double halfThicknessHelium = (fPosHelium1 - fPosHelium0) /2.;
                                                   >> 282   G4VSolid* heliumSolid = new G4Tubs("heliumSolid", 0.*cm, fRadOverall, halfThicknessHelium, 0.*deg, 360.*deg);
                                                   >> 283   G4LogicalVolume* heliumLog = new G4LogicalVolume(heliumSolid, G4Material::GetMaterial("G4_He"), "heliumLog");
                                                   >> 284   
                                                   >> 285   heliumVisAtt = new G4VisAttributes(G4Colour(0.5,1.0,0.5));
                                                   >> 286   heliumLog->SetVisAttributes(heliumVisAtt);
                                                   >> 287   
                                                   >> 288   new G4PVPlacement(0, G4ThreeVector(0.,0.,0.),heliumLog,"Helium",bagLog,false,0);  
                                                   >> 289 
                                                   >> 290 // Insert two rings of Aluminum into the Cylinder of Helium
                                                   >> 291   G4double halfThicknessRing = fThicknessRing /2.;
                                                   >> 292   G4VSolid* ringSolid = new G4Tubs("ringSolid", fRadRingInner, fRadOverall, halfThicknessRing, 0.*deg, 360.*deg);
                                                   >> 293   G4LogicalVolume* ring0Log = new G4LogicalVolume(ringSolid, G4Material::GetMaterial("G4_Al"), "ring0Log");
                                                   >> 294   G4LogicalVolume* ring1Log = new G4LogicalVolume(ringSolid, G4Material::GetMaterial("G4_Al"), "ring1Log");
                                                   >> 295   
                                                   >> 296   ringVisAtt = new G4VisAttributes(G4Colour(0.5,1.0,0.5));
                                                   >> 297   ring0Log->SetVisAttributes(ringVisAtt);
                                                   >> 298   ring1Log->SetVisAttributes(ringVisAtt);
                                                   >> 299   
                                                   >> 300   new G4PVPlacement(0, 
                                                   >> 301     G4ThreeVector(0.,0., -halfThicknessHelium + halfThicknessRing),
                                                   >> 302     ring0Log,"Ring0",heliumLog,false,0);  
                                                   >> 303   
                                                   >> 304   new G4PVPlacement(0, 
                                                   >> 305     G4ThreeVector(0.,0., halfThicknessHelium - halfThicknessRing),
                                                   >> 306     ring1Log,"Ring1",heliumLog,false,0);  
                                                   >> 307 }
                                                   >> 308 
                                                   >> 309 
                                                   >> 310 void ElectronBenchmarkDetector::CreateScorer(G4LogicalVolume* worldLog){
                                                   >> 311   G4double halfLengthWorld = fPosScorer/2.;
                                                   >> 312   G4double halfThicknessScorer = fThicknessScorer /2.;
                                                   >> 313   
                                                   >> 314   G4VSolid* scorerSolid = new G4Tubs("scorerSolid", 0.*cm, fRadOverall, halfThicknessScorer, 0.*deg, 360.*deg);
                                                   >> 315   G4LogicalVolume* scorerLog = new G4LogicalVolume(scorerSolid, G4Material::GetMaterial("G4_AIR"), "scorerLog");
                                                   >> 316 
                                                   >> 317   scorerVisAtt = new G4VisAttributes(G4Colour(0.5,1.0,0.5));
                                                   >> 318   scorerLog->SetVisAttributes(scorerVisAtt);
                                                   >> 319   new G4PVPlacement(0,
                                                   >> 320     G4ThreeVector(0.,0., halfLengthWorld - halfThicknessScorer),
                                                   >> 321     scorerLog,"Scorer",worldLog,false,0); 
                                                   >> 322   
                                                   >> 323   G4VSolid* scorerRingSolid = new G4Tubs("scorerRingSolid", 0.*cm, fRadOverall, halfThicknessScorer, 0.*deg, 360.*deg);
                                                   >> 324   fScorerRingLog = new G4LogicalVolume(scorerRingSolid, G4Material::GetMaterial("G4_AIR"), "scorerRingLog");
                                                   >> 325   new G4PVReplica("ScorerRing",fScorerRingLog,scorerLog,kRho,G4int(fRadOverall/fWidthScorerRing),fWidthScorerRing); 
                                                   >> 326 }
                                                   >> 327 
                                                   >> 328 
                                                   >> 329 void ElectronBenchmarkDetector::ActivateScorer()
                                                   >> 330 {
                                                   >> 331   G4String detName = "MyDetector";
                                                   >> 332   G4SDManager* SDman = G4SDManager::GetSDMpointer();
                                                   >> 333   G4VSensitiveDetector* sdet = SDman->FindSensitiveDetector(detName,false);
                                                   >> 334   
                                                   >> 335   if (sdet)
                                                   >> 336   {
                                                   >> 337     G4cout << "Already have the detector" << G4endl;
                                                   >> 338     fScorerRingLog->SetSensitiveDetector(sdet);
                                                   >> 339   }
                                                   >> 340   else
                                                   >> 341   {
                                                   >> 342       G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
                                                   >> 343 
                                                   >> 344     G4MultiFunctionalDetector* det = new G4MultiFunctionalDetector(detName);
                                                   >> 345   
                                                   >> 346     G4String fltName,particleName;
                                                   >> 347     G4SDParticleFilter* electronFilter = 
                                                   >> 348     new G4SDParticleFilter(fltName="electronFilter", particleName="e-");
                                                   >> 349   
                                                   >> 350     G4VPrimitiveScorer* primitive;
                                                   >> 351   
                                                   >> 352     primitive = new G4PSCellFlux("cell flux");
                                                   >> 353     det->RegisterPrimitive(primitive);
                                                   >> 354   
                                                   >> 355     primitive = new G4PSCellFlux("e cell flux");
                                                   >> 356     primitive->SetFilter(electronFilter);
                                                   >> 357     det->RegisterPrimitive(primitive);
                                                   >> 358   
                                                   >> 359     primitive = new G4PSPopulation("population");
                                                   >> 360     det->RegisterPrimitive(primitive);
                                                   >> 361   
                                                   >> 362     primitive = new G4PSPopulation("e population");
                                                   >> 363     primitive->SetFilter(electronFilter);
                                                   >> 364     det->RegisterPrimitive(primitive);
                                                   >> 365   
                                                   >> 366     G4SDManager::GetSDMpointer()->AddNewDetector(det);
                                                   >> 367     fScorerRingLog->SetSensitiveDetector(det); 
                                                   >> 368   
                                                   >> 369     G4SDManager::GetSDMpointer()->SetVerboseLevel(0);
                                                   >> 370   }
                                                   >> 371 }
                                                   >> 372 
                                                   >> 373 
                                                   >> 374 void ElectronBenchmarkDetector::SetPrimFoilMaterial(G4String matname){
                                                   >> 375   fMaterialPrimFoil = G4Material::GetMaterial(matname);
                                                   >> 376   UpdateGeometry();
                                                   >> 377 }
                                                   >> 378 
                                                   >> 379 
                                                   >> 380 void ElectronBenchmarkDetector::SetPrimFoilThickness(G4double thicknessPrimFoil){
                                                   >> 381   fHalfThicknessPrimFoil = thicknessPrimFoil / 2.;
                                                   >> 382   UpdateGeometry();
248 }                                                 383 }
249                                                << 
250 //....oooOO0OOooo........oooOO0OOooo........oo << 
251                                                << 
252 void ElectronBenchmarkDetector::CreateMonitor( << 
253 {                                              << 
254   G4double halfLengthWorld = fPosScorer / 2.;  << 
255   G4double halfThicknessMon = (fPosMon1 - fPos << 
256   G4VSolid* monSolid =                         << 
257     new G4Tubs("monSolid", 0. * cm, fRadOveral << 
258   G4LogicalVolume* monLog =                    << 
259     new G4LogicalVolume(monSolid, G4Material:: << 
260                                                << 
261   fMonVisAtt = new G4VisAttributes(G4Colour(0. << 
262   monLog->SetVisAttributes(fMonVisAtt);        << 
263                                                << 
264   new G4PVPlacement(0, G4ThreeVector(0., 0., f << 
265                     "MonitorChamber", worldLog << 
266 }                                              << 
267                                                << 
268 //....oooOO0OOooo........oooOO0OOooo........oo << 
269                                                << 
270 void ElectronBenchmarkDetector::CreateHeliumBa << 
271 {                                              << 
272   G4double halfLengthWorld = fPosScorer / 2.;  << 
273                                                << 
274   // Construct cylinder of Mylar               << 
275   G4double halfThicknessBag = (fPosBag1 - fPos << 
276   G4VSolid* bagSolid =                         << 
277     new G4Tubs("bagSolid", 0. * cm, fRadOveral << 
278   G4LogicalVolume* bagLog =                    << 
279     new G4LogicalVolume(bagSolid, G4Material:: << 
280                                                << 
281   fBagVisAtt = new G4VisAttributes(G4Colour(0. << 
282   bagLog->SetVisAttributes(fBagVisAtt);        << 
283                                                << 
284   new G4PVPlacement(0, G4ThreeVector(0., 0., f << 
285                     "HeliumBag", worldLog, fal << 
286                                                << 
287   // Insert cylinder of Helium into the Cylind << 
288   G4double halfThicknessHelium = (fPosHelium1  << 
289   G4VSolid* heliumSolid =                      << 
290     new G4Tubs("heliumSolid", 0. * cm, fRadOve << 
291   G4LogicalVolume* heliumLog =                 << 
292     new G4LogicalVolume(heliumSolid, G4Materia << 
293                                                << 
294   fHeliumVisAtt = new G4VisAttributes(G4Colour << 
295   heliumLog->SetVisAttributes(fHeliumVisAtt);  << 
296                                                << 
297   new G4PVPlacement(0, G4ThreeVector(0., 0., 0 << 
298                                                << 
299   // Insert two rings of Aluminum into the Cyl << 
300   G4double halfThicknessRing = fThicknessRing  << 
301   G4VSolid* ringSolid =                        << 
302     new G4Tubs("ringSolid", fRadRingInner, fRa << 
303   G4LogicalVolume* ring0Log =                  << 
304     new G4LogicalVolume(ringSolid, G4Material: << 
305   G4LogicalVolume* ring1Log =                  << 
306     new G4LogicalVolume(ringSolid, G4Material: << 
307                                                << 
308   fRingVisAtt = new G4VisAttributes(G4Colour(0 << 
309   ring0Log->SetVisAttributes(fRingVisAtt);     << 
310   ring1Log->SetVisAttributes(fRingVisAtt);     << 
311                                                << 
312   new G4PVPlacement(0, G4ThreeVector(0., 0., - << 
313                     "Ring0", heliumLog, false, << 
314                                                << 
315   new G4PVPlacement(0, G4ThreeVector(0., 0., h << 
316                     "Ring1", heliumLog, false, << 
317 }                                              << 
318                                                << 
319 //....oooOO0OOooo........oooOO0OOooo........oo << 
320                                                << 
321 void ElectronBenchmarkDetector::CreateScorer(G << 
322 {                                              << 
323   G4double halfLengthWorld = fPosScorer / 2.;  << 
324   G4double halfThicknessScorer = fThicknessSco << 
325                                                << 
326   G4VSolid* scorerSolid =                      << 
327     new G4Tubs("scorerSolid", 0. * cm, fRadOve << 
328   G4LogicalVolume* scorerLog =                 << 
329     new G4LogicalVolume(scorerSolid, G4Materia << 
330                                                << 
331   fScorerVisAtt = new G4VisAttributes(G4Colour << 
332   scorerLog->SetVisAttributes(fScorerVisAtt);  << 
333   new G4PVPlacement(0, G4ThreeVector(0., 0., h << 
334                     "Scorer", worldLog, false, << 
335                                                << 
336   G4VSolid* scorerRingSolid =                  << 
337     new G4Tubs("scorerRingSolid", 0. * cm, fRa << 
338   fScorerRingLog =                             << 
339     new G4LogicalVolume(scorerRingSolid, G4Mat << 
340   new G4PVReplica("ScorerRing", fScorerRingLog << 
341                   G4int(fRadOverall / fWidthSc << 
342 }                                              << 
343                                                << 
344 //....oooOO0OOooo........oooOO0OOooo........oo << 
345                                                << 
346 // Note that this method is called both at sta << 
347 // any command causes a change to detector geo << 
348 void ElectronBenchmarkDetector::ConstructSDand << 
349 {                                              << 
350   G4SDManager::GetSDMpointer()->SetVerboseLeve << 
351                                                << 
352   // G4Cache mechanism is necessary for multi- << 
353   // as it allows us to store separate detecto << 
354   G4MultiFunctionalDetector*& sensitiveDetecto << 
355                                                << 
356   if (!sensitiveDetector) {                    << 
357     sensitiveDetector = new G4MultiFunctionalD << 
358                                                << 
359     G4VPrimitiveScorer* primitive;             << 
360                                                << 
361     G4SDParticleFilter* electronFilter = new G << 
362                                                << 
363     primitive = new G4PSCellFlux("cell flux"); << 
364     sensitiveDetector->RegisterPrimitive(primi << 
365                                                << 
366     primitive = new G4PSCellFlux("e cell flux" << 
367     primitive->SetFilter(electronFilter);      << 
368     sensitiveDetector->RegisterPrimitive(primi << 
369                                                << 
370     primitive = new G4PSPopulation("population << 
371     sensitiveDetector->RegisterPrimitive(primi << 
372                                                << 
373     primitive = new G4PSPopulation("e populati << 
374     primitive->SetFilter(electronFilter);      << 
375     sensitiveDetector->RegisterPrimitive(primi << 
376   }                                            << 
377   G4SDManager::GetSDMpointer()->AddNewDetector << 
378   fScorerRingLog->SetSensitiveDetector(sensiti << 
379 }                                              << 
380                                                << 
381 //....oooOO0OOooo........oooOO0OOooo........oo << 
382                                                << 
383 void ElectronBenchmarkDetector::SetPrimFoilMat << 
384 {                                              << 
385   G4Material* material = G4NistManager::Instan << 
386                                                << 
387   if (material && material != fMaterialPrimFoi << 
388     fMaterialPrimFoil = material;              << 
389     if (fLogPrimFoil) {                        << 
390       fLogPrimFoil->SetMaterial(fMaterialPrimF << 
391     }                                          << 
392     G4RunManager::GetRunManager()->PhysicsHasB << 
393   }                                            << 
394 }                                              << 
395                                                << 
396 //....oooOO0OOooo........oooOO0OOooo........oo << 
397                                                << 
398 void ElectronBenchmarkDetector::SetPrimFoilThi << 
399 {                                              << 
400   fHalfThicknessPrimFoil = thicknessPrimFoil / << 
401 }                                              << 
402                                                << 
403 //....oooOO0OOooo........oooOO0OOooo........oo << 
404                                                   384