Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
+27 -7
View File
@@ -1,4 +1,4 @@
//$Id$
//$Id: .README 78001 2013-12-02 08:24:53Z gcosmo $
///\file "B3/.README"
///\brief Example B3 README page
@@ -42,10 +42,27 @@
the G4RADIOACTIVEDATA envirnoment variable.
See more on installation of the datasets in
<a href="http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/html/ch03s03.html">
<a href="http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides
/InstallationGuide/html/ch03s03.html">
Geant4 Installation Guide, Chapter 3.3: Note On Geant4 Datasets </a>.
\section B3_s3 ACTION INITALIZATION
\section B3_s3 PRIMARY GENERATOR
A newly introduced class, B1ActionInitialization, instantiates and registers
to Geant4 kernel all user action classes.
While in sequential mode the action classes are instatiated just once,
via invoking the method:
B3ActionInitialization::Build()
in multi-threading mode the same method is invoked for each thread worker
and so all user action classes are defined thread-local.
A run action class is instantiated both thread-local
and global that's why its instance is created also in the method
B3ActionInitialization::BuildForMaster()
which is invoked only in multi-threading mode.
\section B3_s4 PRIMARY GENERATOR
The default particle beam is an ion (F18), at rest, randomly distributed
within a zone inside a patient and is defined in
@@ -53,22 +70,25 @@
The type of a primary particle can be changed with G4ParticleGun commands
(see run2.mac).
\section B3_s4 DETECTOR RESPONSE : scorers
\section B3_s5 DETECTOR RESPONSE : scorers
A 'good' event is an event in which an identical energy of 511 keV is
deposited in two separate Crystals. A count of the number of such events
corresponds to a measure of the efficiency of the PET system.
The total dose deposited in a patient during a run is also computed.
Scorers are defined in DetectorConstruction::CreateScorers(). There are
Scorers are defined in DetectorConstruction::ConstructSDandField(). There are
two G4MultiFunctionalDetector objects: one for the Crystal (EnergyDeposit),
and one for the Patient (DoseDeposit)
EventAction::EndOfEventAction() collects informations event per event
B3Run::RecordEvent() collects informations event per event
from the hits collections, and accumulates statistic for
RunAction::EndOfRunAction().
In multi-threading mode the statistics accumulated per workers is merged
to the master in Run::Merge().
\section B3_s5 STACKING ACTION
\section B3_s6 STACKING ACTION
Beta decay of Fluor generates a neutrino. One wishes not to track this
neutrino; therefore one kills it immediately, before created particles
+2
View File
@@ -1,3 +1,5 @@
# $Id: CMakeLists.txt 68058 2013-03-13 14:47:43Z gcosmo $
#----------------------------------------------------------------------------
# Setup the project
#
+1 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.2 2000-10-19 12:22:10 stanaka Exp $
# $Id: GNUmakefile 68058 2013-03-13 14:47:43Z gcosmo $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
+36 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.132 2010-12-01 05:56:40 allison Exp $
$Id: History 75217 2013-10-29 16:09:26Z gcosmo $
--------------------------------------------------
=========================================================
@@ -15,6 +15,41 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
29/10/13 I. Hrivnacova (exampleB3-V09-06-06)
- Removed SetNumberOfThreads(4) from main (use Geant4 default)
- Updated README
09/09/13 M.Asai (exampleB3-V09-06-05)
- B3PrimaryGeneratorAction.cc : Change G4ParticleTable::GetIon() to
G4IonTable::GetIon(), as the former method becomes obsolete.
13/06/13 mma (exampleB3-V09-06-04)
Fixes for MT:
- Set sensitive detector via SetSensitiveDetector(..)
- Get hits collection IDs in B3Run::RecordEvent (and not B3Run constructor)
- Add a test for primary generator action in B3RunAction::EndOfRunAction()
as it does not exist on master
05/06/13 mma (exampleB3-V09-06-03)
- add section about ACTION INITALIZATION to README and .README
01/06/13 mma (exampleB3-V09-06-02)
- Migration for MT:
forgotten to add B3Run
31/05/13 mma (exampleB3-V09-06-01)
- Migration for MT:
Added B3ActionInitialization, B3Run
Removed B3EventAction
and updated actions classes accordingly.
README files still need to be updated.
28/02/13 I. Hrivnacova
- When building materials with NistManager
do not set fromIsotopes argument (which was set to false),
as since 9.6 all materials have to be built from isotopes.
Thanks to V. Ivantchenko for pointing at this.
21/11/11 I. Hrivnacova
- Improved vis.mac
- Removed alternative detector construction class
+28 -9
View File
@@ -1,4 +1,4 @@
$Id$
$Id: README 78001 2013-12-02 08:24:53Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -46,9 +46,25 @@ $Id$
See more on installation of the datasets in Geant4 Installation Guide,
Chapter 3.3: Note On Geant4 Datasets:
http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/html/ch03s03.html
3- PRIMARY GENERATOR
http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides
/InstallationGuide/html/ch03s03.html
3- ACTION INITALIZATION
A newly introduced class, B1ActionInitialization, instantiates and registers
to Geant4 kernel all user action classes.
While in sequential mode the action classes are instatiated just once,
via invoking the method:
B3ActionInitialization::Build()
in multi-threading mode the same method is invoked for each thread worker
and so all user action classes are defined thread-local.
A run action class is instantiated both thread-local
and global that's why its instance is created also in the method
B3ActionInitialization::BuildForMaster()
which is invoked only in multi-threading mode.
4- PRIMARY GENERATOR
The default particle beam is an ion (F18), at rest, randomly distributed
within a zone inside a patient and is defined in
@@ -56,22 +72,25 @@ $Id$
The type of a primary particle can be changed with G4ParticleGun commands
(see run2.mac).
4- DETECTOR RESPONSE: scorers
5- DETECTOR RESPONSE: scorers
A 'good' event is an event in which an identical energy of 511 keV is
deposited in two separate Crystals. A count of the number of such events
corresponds to a measure of the efficiency of the PET system.
The total dose deposited in a patient during a run is also computed.
Scorers are defined in DetectorConstruction::CreateScorers(). There are
Scorers are defined in DetectorConstruction::ConstructSDandField(). There are
two G4MultiFunctionalDetector objects: one for the Crystal (EnergyDeposit),
and one for the Patient (DoseDeposit)
EventAction::EndOfEventAction() collects informations event per event
from the hits collections, and accumulates statistic for
B3Run::RecordEvent(), called at end of event, collects informations
event per event from the hits collections, and accumulates statistic for
RunAction::EndOfRunAction().
In multi-threading mode the statistics accumulated per workers is merged
to the master in Run::Merge().
5- STACKING ACTION
6- STACKING ACTION
Beta decay of Fluor generates a neutrino. One wishes not to track this
neutrino; therefore one kills it immediately, before created particles
+15 -16
View File
@@ -23,22 +23,24 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: exampleB3.cc 75217 2013-10-29 16:09:26Z gcosmo $
//
/// \file exampleB3.cc
/// \brief Main program of the B3 example
#ifdef G4MULTITHREADED
#include "G4MTRunManager.hh"
#else
#include "G4RunManager.hh"
#endif
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "B3DetectorConstruction.hh"
#include "B3PhysicsList.hh"
#include "B3PrimaryGeneratorAction.hh"
#include "B3RunAction.hh"
#include "B3EventAction.hh"
#include "B3StackingAction.hh"
#include "B3ActionInitialization.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
@@ -54,11 +56,15 @@ int main(int argc,char** argv)
{
// Choose the Random engine
//
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
G4Random::setTheEngine(new CLHEP::RanecuEngine);
// Construct the default run manager
//
G4RunManager * runManager = new G4RunManager;
#ifdef G4MULTITHREADED
G4MTRunManager* runManager = new G4MTRunManager;
#else
G4RunManager* runManager = new G4RunManager;
#endif
// Set mandatory initialization classes
//
@@ -66,16 +72,9 @@ int main(int argc,char** argv)
//
runManager->SetUserInitialization(new B3PhysicsList);
// Set user action classes
// Set user action initialization
//
runManager->SetUserAction(new B3PrimaryGeneratorAction);
//
B3RunAction* runAction = new B3RunAction();
runManager->SetUserAction(runAction);
//
runManager->SetUserAction(new B3EventAction(runAction));
//
runManager->SetUserAction(new B3StackingAction);
runManager->SetUserInitialization(new B3ActionInitialization());
// Initialize G4 kernel
//
+17 -13
View File
@@ -4,7 +4,7 @@
############################################
*************************************************************
Geant4 version Name: geant4-09-06-ref-00 (30-November-2012)
Geant4 version Name: geant4-10-00-ref-00 (6-December-2013)
Copyright : Geant4 Collaboration
Reference : NIM A 506 (2003), 250-303
WWW : http://cern.ch/geant4
@@ -56,7 +56,9 @@ Checking overlaps for volume Patient ... OK!
***** Table : Nb of materials = 3 *****
Material: Lu2SiO5 density: 7.400 g/cm3 RadL: 1.143 cm Nucl.Int.Length: 20.922 cm Imean: 418.807 eV
Material: Lu2SiO5 density: 7.400 g/cm3 RadL: 1.143 cm Nucl.Int.Length: 20.915 cm
Imean: 418.807 eV
---> Element: Lu (Lu) Z = 71.0 N = 175.0 A = 174.97 g/mole
---> Isotope: Lu175 Z = 71 N = 175 A = 174.94 g/mole abundance: 97.41 %
---> Isotope: Lu176 Z = 71 N = 176 A = 175.94 g/mole abundance: 2.59 %
@@ -75,7 +77,9 @@ Checking overlaps for volume Patient ... OK!
ElmMassFraction: 17.47 % ElmAbundance 62.50 %
Material: G4_AIR density: 1.205 mg/cm3 RadL: 303.921 m Nucl.Int.Length: 710.261 m Imean: 85.700 eV temperature: 273.15 K pressure: 1.00 atm
Material: G4_AIR density: 1.205 mg/cm3 RadL: 303.921 m Nucl.Int.Length: 710.137 m
Imean: 85.700 eV temperature: 273.15 K pressure: 1.00 atm
---> Element: C (C) Z = 6.0 N = 12.0 A = 12.01 g/mole
---> Isotope: C12 Z = 6 N = 12 A = 12.00 g/mole abundance: 98.93 %
---> Isotope: C13 Z = 6 N = 13 A = 13.00 g/mole abundance: 1.07 %
@@ -92,14 +96,16 @@ Checking overlaps for volume Patient ... OK!
---> Isotope: O18 Z = 8 N = 18 A = 18.00 g/mole abundance: 0.20 %
ElmMassFraction: 23.18 % ElmAbundance 21.07 %
---> Element: Ar (Ar) Z = 18.0 N = 39.9 A = 39.95 g/mole
---> Element: Ar (Ar) Z = 18.0 N = 40.0 A = 39.95 g/mole
---> Isotope: Ar36 Z = 18 N = 36 A = 35.97 g/mole abundance: 0.34 %
---> Isotope: Ar38 Z = 18 N = 38 A = 37.96 g/mole abundance: 0.06 %
---> Isotope: Ar40 Z = 18 N = 40 A = 39.96 g/mole abundance: 99.60 %
ElmMassFraction: 1.28 % ElmAbundance 0.47 %
Material: G4_BRAIN_ICRP density: 1.040 g/cm3 RadL: 35.403 cm Nucl.Int.Length: 72.293 cm Imean: 73.300 eV
Material: G4_BRAIN_ICRP density: 1.040 g/cm3 RadL: 35.403 cm Nucl.Int.Length: 72.275 cm
Imean: 73.300 eV
---> Element: H (H) Z = 1.0 N = 1.0 A = 1.01 g/mole
---> Isotope: H1 Z = 1 N = 1 A = 1.01 g/mole abundance: 99.99 %
---> Isotope: H2 Z = 1 N = 2 A = 2.01 g/mole abundance: 0.01 %
@@ -163,12 +169,10 @@ Current available graphics systems are:
DAWNFILE (DAWNFILE)
G4HepRep (HepRepXML)
G4HepRepFile (HepRepFile)
OpenGLImmediateQt (OGLI, OGLIQt)
OpenGLImmediateX (OGLIX)
OpenGLImmediateXm (OGLIXm, OGLI_FALLBACK, OGLIQt_FALLBACK)
OpenGLStoredQt (OGL, OGLS, OGLSQt)
OpenGLImmediateXm (OGLI, OGLIXm)
OpenGLStoredX (OGLSX)
OpenGLStoredXm (OGLSXm, OGL_FALLBACK, OGLS_FALLBACK, OGLSQt_FALLBACK)
OpenGLStoredXm (OGL, OGLS, OGLSXm)
RayTracer (RayTracer)
RayTracerX (RayTracerX)
VRML1FILE (VRML1FILE)
@@ -204,11 +208,11 @@ Available colours:
/run/beamOn 10000
### Run 0 start.
---> Begin of event: 0
---> end of event: 0
--------------------End of Run------------------------------
The run was 10000 F18[0.0] Nb of 'good' e+ annihilations: 1266
Total dose in patient : 310.47 picoGy
--------------------End of Global Run-----------------------
The run was 10000 events Nb of 'good' e+ annihilations: 1237
Total dose in patient : 304.105 picoGy
------------------------------------------------------------
Graphics systems deleted.
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B3ActionInitialization.hh 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file B3ActionInitialization.hh
/// \brief Definition of the B3ActionInitialization class
#ifndef B3ActionInitialization_h
#define B3ActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
/// Action initialization class.
///
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class B3ActionInitialization : public G4VUserActionInitialization
{
public:
B3ActionInitialization();
virtual ~B3ActionInitialization();
virtual void BuildForMaster() const;
virtual void Build() const;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B3DetectorConstruction.hh 71323 2013-06-13 16:54:23Z gcosmo $
//
/// \file B3DetectorConstruction.hh
/// \brief Definition of the B3DetectorConstruction class
@@ -50,14 +50,11 @@ class B3DetectorConstruction : public G4VUserDetectorConstruction
public:
virtual G4VPhysicalVolume* Construct();
virtual void ConstructSDandField();
private:
void DefineMaterials();
void CreateScorers();
G4LogicalVolume* fLogicCryst;
G4LogicalVolume* fLogicPatient;
G4bool fCheckOverlaps;
};
+1 -1
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B3PhysicsList.hh 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file B3PhysicsList.hh
/// \brief Definition of the B3PhysicsList class
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B3PrimaryGeneratorAction.hh 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file B3PrimaryGeneratorAction.hh
/// \brief Definition of the B3PrimaryGeneratorAction class
@@ -23,39 +23,41 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B3Run.hh 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file B3EventAction.hh
/// \brief Definition of the B3EventAction class
/// \file B3Run.hh
/// \brief Definition of the B3Run class
#ifndef B3EventAction_h
#define B3EventAction_h 1
#ifndef B3Run_h
#define B3Run_h 1
#include "G4UserEventAction.hh"
#include "G4Run.hh"
#include "globals.hh"
class B3RunAction;
/// Event action class
/// Run class
///
/// In EndOfEventAction() there is collected information event per event
/// from Hits Collections, and accumulated statistic for
/// B3RunAction::EndOfRunAction().
/// In RecordEvent() there is collected information event per event
/// from Hits Collections, and accumulated statistic for the run
class B3EventAction : public G4UserEventAction
class B3Run : public G4Run
{
public:
B3EventAction(B3RunAction* runAction);
virtual ~B3EventAction();
B3Run();
virtual ~B3Run();
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
virtual void RecordEvent(const G4Event*);
virtual void Merge(const G4Run*);
public:
G4int GetNbGoodEvents() const { return fGoodEvents; }
G4double GetSumDose() const { return fSumDose; }
private:
B3RunAction* fRunAct;
G4int fCollID_cryst;
G4int fCollID_patient;
G4int fPrintModulo;
G4int fPrintModulo;
G4int fGoodEvents;
G4double fSumDose;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+3 -9
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B3RunAction.hh 70599 2013-06-03 11:14:56Z gcosmo $
//
/// \file B3RunAction.hh
/// \brief Definition of the B3RunAction class
@@ -43,16 +43,10 @@ class B3RunAction : public G4UserRunAction
public:
B3RunAction();
virtual ~B3RunAction();
virtual G4Run* GenerateRun();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
void CountEvents() { fGoodEvents++;};
void SumDose(G4double dose) { fSumDose += dose;};
public:
G4int fGoodEvents;
G4double fSumDose;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B3StackingAction.hh 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file B3StackingAction.hh
/// \brief Definition of the B3StackingAction class
+1 -1
View File
@@ -1,4 +1,4 @@
# $Id: run1.mac,v 1.6 2002-12-16 16:37:25 maire Exp $
# $Id: run1.mac 68058 2013-03-13 14:47:43Z gcosmo $
#
# Macro file of "exampleB3.cc"
#
+1 -1
View File
@@ -1,4 +1,4 @@
# $Id: run2.mac,v 1.6 2002-12-16 16:37:25 maire Exp $
# $Id: run2.mac 68058 2013-03-13 14:47:43Z gcosmo $
#
# Macro file of "exampleB3.cc"
#
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B3ActionInitialization.cc 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file B3ActionInitialization.cc
/// \brief Implementation of the B3ActionInitialization class
#include "B3ActionInitialization.hh"
#include "B3PrimaryGeneratorAction.hh"
#include "B3RunAction.hh"
#include "B3StackingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B3ActionInitialization::B3ActionInitialization()
: G4VUserActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B3ActionInitialization::~B3ActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B3ActionInitialization::BuildForMaster() const
{
SetUserAction(new B3RunAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B3ActionInitialization::Build() const
{
SetUserAction(new B3PrimaryGeneratorAction);
SetUserAction(new B3RunAction);
SetUserAction(new B3StackingAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+14 -22
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B3DetectorConstruction.cc 71323 2013-06-13 16:54:23Z gcosmo $
//
/// \file B3DetectorConstruction.cc
/// \brief Implementation of the B3DetectorConstruction class
@@ -50,7 +50,6 @@
B3DetectorConstruction::B3DetectorConstruction()
: G4VUserDetectorConstruction(),
fLogicCryst(0),fLogicPatient(0),
fCheckOverlaps(true)
{
DefineMaterials();
@@ -99,7 +98,7 @@ G4VPhysicalVolume* B3DetectorConstruction::Construct()
G4double detector_dZ = nb_rings*cryst_dX;
//
G4NistManager* nist = G4NistManager::Instance();
G4Material* default_mat = nist->FindOrBuildMaterial("G4_AIR", false);
G4Material* default_mat = nist->FindOrBuildMaterial("G4_AIR");
G4Material* cryst_mat = nist->FindOrBuildMaterial("Lu2SiO5");
//
@@ -145,10 +144,10 @@ G4VPhysicalVolume* B3DetectorConstruction::Construct()
G4double dX = cryst_dX - gap, dY = cryst_dY - gap;
G4Box* solidCryst = new G4Box("crystal", dX/2, dY/2, cryst_dZ/2);
fLogicCryst =
G4LogicalVolume* logicCryst =
new G4LogicalVolume(solidCryst, //its solid
cryst_mat, //its material
"crystal"); //its name
"CrystalLV"); //its name
// place crystals within a ring
//
@@ -162,7 +161,7 @@ G4VPhysicalVolume* B3DetectorConstruction::Construct()
G4Transform3D transform = G4Transform3D(rotm,position);
new G4PVPlacement(transform, //rotation,position
fLogicCryst, //its logical volume
logicCryst, //its logical volume
"crystal", //its name
logicRing, //its mother volume
false, //no boolean operation
@@ -214,22 +213,22 @@ G4VPhysicalVolume* B3DetectorConstruction::Construct()
//
G4double patient_radius = 8*cm;
G4double patient_dZ = 10*cm;
G4Material* patient_mat = nist->FindOrBuildMaterial("G4_BRAIN_ICRP", false);
G4Material* patient_mat = nist->FindOrBuildMaterial("G4_BRAIN_ICRP");
G4Tubs* solidPatient =
new G4Tubs("Patient", 0., patient_radius, 0.5*patient_dZ, 0., twopi);
fLogicPatient =
G4LogicalVolume* logicPatient =
new G4LogicalVolume(solidPatient, //its solid
patient_mat, //its material
"Patient"); //its name
"PatientLV"); //its name
//
// place patient in world
//
new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicPatient, //its logical volume
logicPatient, //its logical volume
"Patient", //its name
logicWorld, //its mother volume
false, //no boolean operation
@@ -243,11 +242,7 @@ G4VPhysicalVolume* B3DetectorConstruction::Construct()
// Print materials
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
//
CreateScorers();
//
//always return the physical World
//
return physWorld;
@@ -255,26 +250,23 @@ G4VPhysicalVolume* B3DetectorConstruction::Construct()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B3DetectorConstruction::CreateScorers()
void B3DetectorConstruction::ConstructSDandField()
{
G4SDManager* SDman = G4SDManager::GetSDMpointer();
SDman->SetVerboseLevel(2);
G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
// declare crystal as a MultiFunctionalDetector scorer
//
G4MultiFunctionalDetector* cryst = new G4MultiFunctionalDetector("crystal");
G4VPrimitiveScorer* primitiv1 = new G4PSEnergyDeposit("edep");
cryst->RegisterPrimitive(primitiv1);
SDman->AddNewDetector(cryst);
fLogicCryst->SetSensitiveDetector(cryst);
SetSensitiveDetector("CrystalLV",cryst);
// declare patient as a MultiFunctionalDetector scorer
//
G4MultiFunctionalDetector* patient = new G4MultiFunctionalDetector("patient");
G4VPrimitiveScorer* primitiv2 = new G4PSDoseDeposit("dose");
patient->RegisterPrimitive(primitiv2);
SDman->AddNewDetector(patient);
fLogicPatient->SetSensitiveDetector(patient);
SetSensitiveDetector("PatientLV",patient);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+1 -1
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B3PhysicsList.cc 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file B3PhysicsList.cc
/// \brief Implementation of the B3PhysicsList class
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B3PrimaryGeneratorAction.cc 73766 2013-09-10 12:57:13Z gcosmo $
//
/// \file B3PrimaryGeneratorAction.cc
/// \brief Implementation of the B3PrimaryGeneratorAction class
@@ -34,6 +34,7 @@
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4IonTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4ChargedGeantino.hh"
#include "G4SystemOfUnits.hh"
@@ -78,7 +79,7 @@ void B3PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
G4double excitEnergy = 0.*keV;
G4ParticleDefinition* ion
= G4ParticleTable::GetParticleTable()->GetIon(Z,A,excitEnergy);
= G4IonTable::GetIonTable()->GetIon(Z,A,excitEnergy);
fParticleGun->SetParticleDefinition(ion);
fParticleGun->SetParticleCharge(ionCharge);
}
@@ -23,14 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B3Run.cc 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file B3EventAction.cc
/// \brief Implementation of the B3EventAction class
/// \file B3Run.cc
/// \brief Implementation of the B3Run class
#include "B3EventAction.hh"
#include "B3RunAction.hh"
#include "B3Run.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
@@ -38,48 +36,50 @@
#include "G4SDManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4THitsMap.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B3EventAction::B3EventAction(B3RunAction* runAction)
: G4UserEventAction(),
fRunAct(runAction),
fCollID_cryst(0),
fCollID_patient(0),
fPrintModulo(10000)
{}
B3Run::B3Run()
: G4Run(),
fCollID_cryst(-1),
fCollID_patient(-1),
fPrintModulo(10000),
fGoodEvents(0),
fSumDose(0.)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B3EventAction::~B3EventAction()
B3Run::~B3Run()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B3EventAction::BeginOfEventAction(const G4Event* evt )
void B3Run::RecordEvent(const G4Event* event)
{
G4int evtNb = evt->GetEventID();
if (evtNb == 0) {
G4SDManager* SDMan = G4SDManager::GetSDMpointer();
fCollID_cryst = SDMan->GetCollectionID("crystal/edep");
fCollID_patient = SDMan->GetCollectionID("patient/dose");
if ( fCollID_cryst < 0 ) {
fCollID_cryst
= G4SDManager::GetSDMpointer()->GetCollectionID("crystal/edep");
//G4cout << " fCollID_cryst: " << fCollID_cryst << G4endl;
}
if ( fCollID_patient < 0 ) {
fCollID_patient
= G4SDManager::GetSDMpointer()->GetCollectionID("patient/dose");
//G4cout << " fCollID_patient: " << fCollID_patient << G4endl;
}
G4int evtNb = event->GetEventID();
if (evtNb%fPrintModulo == 0) {
G4cout << "\n---> Begin of event: " << evtNb << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B3EventAction::EndOfEventAction(const G4Event* evt )
{
//Hits collections
G4cout << "\n---> end of event: " << evtNb << G4endl;
}
//Hits collections
//
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
G4HCofThisEvent* HCE = event->GetHCofThisEvent();
if(!HCE) return;
//Energy in crystals : identify 'good events'
@@ -88,28 +88,41 @@ void B3EventAction::EndOfEventAction(const G4Event* evt )
G4int nbOfFired = 0;
G4THitsMap<G4double>* evtMap =
(G4THitsMap<G4double>*)(HCE->GetHC(fCollID_cryst));
static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_cryst));
std::map<G4int,G4double*>::iterator itr;
for (itr = evtMap->GetMap()->begin(); itr != evtMap->GetMap()->end(); itr++) {
///G4int copyNb = (itr->first);
G4double edep = *(itr->second);
if (edep > eThreshold) nbOfFired++;
///G4int copyNb = (itr->first);
///G4cout << "\n cryst" << copyNb << ": " << edep/keV << " keV ";
}
if (nbOfFired == 2) fRunAct->CountEvents();
if (nbOfFired == 2) fGoodEvents++;
//Dose deposit in patient
//
G4double dose = 0.;
evtMap = (G4THitsMap<G4double>*)(HCE->GetHC(fCollID_patient));
evtMap = static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_patient));
for (itr = evtMap->GetMap()->begin(); itr != evtMap->GetMap()->end(); itr++) {
///G4int copyNb = (itr->first);
dose = *(itr->second);
}
if (dose > 0.) fRunAct->SumDose(dose);
fSumDose += dose;
G4Run::RecordEvent(event);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B3Run::Merge(const G4Run* aRun)
{
const B3Run* localRun = static_cast<const B3Run*>(aRun);
fGoodEvents += localRun->fGoodEvents;
fSumDose += localRun->fSumDose;
G4Run::Merge(aRun);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+43 -21
View File
@@ -23,13 +23,14 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B3RunAction.cc 71323 2013-06-13 16:54:23Z gcosmo $
//
/// \file B3RunAction.cc
/// \brief Implementation of the B3RunAction class
#include "B3RunAction.hh"
#include "B3PrimaryGeneratorAction.hh"
#include "B3Run.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
@@ -39,9 +40,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B3RunAction::B3RunAction()
: G4UserRunAction(),
fGoodEvents(0),
fSumDose(0.)
: G4UserRunAction()
{
//add new units for dose
//
@@ -59,7 +58,12 @@ B3RunAction::B3RunAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B3RunAction::~B3RunAction()
{}
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Run* B3RunAction::GenerateRun()
{ return new B3Run; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -67,9 +71,6 @@ void B3RunAction::BeginOfRunAction(const G4Run* run)
{
G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
fGoodEvents = 0;
fSumDose = 0.;
//inform the runManager to save random number seed
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
}
@@ -78,25 +79,46 @@ void B3RunAction::BeginOfRunAction(const G4Run* run)
void B3RunAction::EndOfRunAction(const G4Run* run)
{
G4int NbOfEvents = run->GetNumberOfEvent();
if (NbOfEvents == 0) return;
G4int nofEvents = run->GetNumberOfEvent();
if (nofEvents == 0) return;
//run conditions
//
const B3PrimaryGeneratorAction* kinematic
// Run conditions
// note: There is no primary generator action object for "master"
// run manager for multi-threaded mode.
const B3PrimaryGeneratorAction* generatorAction
= static_cast<const B3PrimaryGeneratorAction*>(
G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
G4ParticleDefinition* particle
= kinematic->GetParticleGun()->GetParticleDefinition();
G4String partName = particle->GetParticleName();
G4String partName;
if (generatorAction)
{
G4ParticleDefinition* particle
= generatorAction->GetParticleGun()->GetParticleDefinition();
partName = particle->GetParticleName();
}
//results
//
const B3Run* b3Run = static_cast<const B3Run*>(run);
G4int nbGoodEvents = b3Run->GetNbGoodEvents();
G4double sumDose = b3Run->GetSumDose();
//print
//
//
if (IsMaster())
{
G4cout
<< "\n--------------------End of Global Run-----------------------"
<< " \n The run was " << nofEvents << " events ";
}
else
{
G4cout
<< "\n--------------------End of Local Run------------------------"
<< " \n The run was " << nofEvents << " "<< partName;
}
G4cout
<< "\n--------------------End of Run------------------------------\n"
<< " The run was " << NbOfEvents << " "<< partName
<< "; Nb of 'good' e+ annihilations: " << fGoodEvents
<< "\n Total dose in patient : " << G4BestUnit(fSumDose,"Dose")
<< "; Nb of 'good' e+ annihilations: " << nbGoodEvents
<< "\n Total dose in patient : " << G4BestUnit(sumDose,"Dose")
<< "\n------------------------------------------------------------\n"
<< G4endl;
}
+1 -1
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: B3StackingAction.cc 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file B3StackingAction.cc
/// \brief Implementation of the B3StackingAction class