Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: Brachy.cc
// GEANT4 tag $Name: geant4-06-02 $
//
// --------------------------------------------------------------
// GEANT 4 - ExDiane example
// --------------------------------------------------------------
//
// Code developed by: S.Guatelli
#include "BrachySimulation.hh"
int main(int argc, char** argv){
BrachySimulation * simulation = new BrachySimulation(0);
simulation -> initialize(argc,argv);
G4String mn;
if(argc>1)
mn = argv[1];
if(mn=="")
{
std::cerr << "error: please give a macro file name" << std::endl;
return -1;
}
simulation -> executeMacro(mn);
simulation -> finish();
delete simulation;
G4cout << "The job ends! " << G4endl;
return 0;
}
@@ -0,0 +1,30 @@
# $Id: GNUmakefile,v 1.3 2004/05/25 12:46:46 guatelli Exp $
# --------------------------------------------------------------
name := Brachy
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
.PHONY: all
ifdef G4DIANE_USE
G4LIB_BUILD_SHARED = 1
all: lib bin
@echo "Linking DIANE libraries..."
@g++ -shared -o${G4WORKDIR}/tmp/${G4SYSTEM}/${name}/libDIANE_${name}.so -L${G4WORKDIR}/tmp/${G4SYSTEM}/${name} -l${name} ${LDFLAGS} ${LDLIBS}
else
all: lib bin
endif
include $(G4INSTALL)/config/binmake.gmk
ifdef G4ANALYSIS_USE
CPPFLAGS += `aida-config --include`
LDFLAGS += `aida-config --lib`
LOADLIBS += `aida-config --lib`
endif
@@ -0,0 +1,15 @@
-------------------------------------------------------------------
$Id: History,v 1.1 2004/05/25 08:36:17 guatelli Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - ExDiane
=========================================================
Category History file
---------------------
25.5.2004 - Susanna Guatelli
Migration to AIDA 3.2.1 and PI 1.2.1
Cleaning of the code for public release
@@ -0,0 +1,8 @@
# Iodium source
/control/verbose 1
/run/verbose 1
/event/verbose 0
/source/switch Iodium
/run/energy Iodium
/run/initialize
/run/beamOn 500
@@ -0,0 +1,6 @@
# Iridium source
/control/verbose 1
/run/verbose 1
/event/verbose 0
/run/initialize
/run/beamOn 500
+94
View File
@@ -0,0 +1,94 @@
=========================================================
Geant4 - ExDiane example
=========================================================
README
---------------------
------------------------------------------------------------------------
----> Introduction
This example shows how to run a Geant4 application in a parallel mode
using DIANE (DIstributed ANalysis Environment).
With DIANE the simulation may be run in sequential or parallel mode
without changing the code of the Geant4 application. Using a dedicated
cluster or geographically distributed resources (e.g. GRID) is
completely transparent for the user.
For more details about DIANE, have a look at http://cern.ch/diane
The ExDiane example derives from the Geant4 advanced example
brachytherapy. The original application code is the same. An
interface class (BrachySimulation) has been added to replace the
main() function.
Please look at the documentation of the brachytherapy advanced example
to know details about the functionality of the application:
- geant4/examples/advanced/brachytherapy
- http://www.ge.infn.it/geant4/examples/index.html
-------------------------------------------------------------------------
----> 2.SET-UP
- example enviroment with the compiler 3.2.3
compiler = gcc-3.2.3
G4SYSTEM = linux-g++
- other environment variables which need to be set:
G4LEDATA: points to low energy data base - G4EMLOW2.3
- download DIANE
You need to have python 2.2 or greater.
* AUTOMATIC INSTALLATION OF DIANE
Execute this command:
> python2 diane.installation.manager --packages=brachy DIANE-1.0.0 download
Get the diane.installation.manager script from
http://cern.ch/diane/download.html
* MANUAL INSTALLATION OF DIANE
Make sure that you have AIDA 3.2.1, PI 1.2.1. Download them from
http://aida.freehep.org/
http://www.cern.ch/PI
Download DIANE executing this command:
> python2 diane.installation.manager DIANE-1.0.0 download
------------------------------------------------------------------------
----> 3.How to compile the example.
setenv G4ANALYSIS_USE 1 -> to activate the analysis
setenv G4DIANE_USE 1 -> to activate the use of DIANE
> gmake
------------------------------------------------------------------------
----> 4.How to run the example.
Two macros are provided as example: iridium.job and iodium.job
They correspond to the Geant4 macros: IridiumSourceMacro.mac and
IodiumSourceMacro.mac
- batch mode running through DIANE:
diane.startjob --job=iodium.job -w 3@localhost --wms=xterm ^ ^
input macro number of workers
------------------------------------------------------------------------
----> 4. Simulation output
if ANALYSIS_USE = 1 in the set-up, the output is brachytherapy.xml
It contains:
1)1Dhistogram with the primary particle energy
2)2Dhistogram with the distribution of energy in the plane
(x,z,energy) containing the source
3)1Dhistogram with the energy deposit along the X axis in the plane
containing the source.
Units: the energy deposit is in MeV;
x, y, z in mm for histograms
-------------------------------------------------------------------------
Authors: Susanna Guatelli, Kuba Moscicki
for comments, advices, doubts and questions:
guatelli@ge.infn.it, Jakub.Moscicki@cern.ch
- last modified: Susanna Guatelli and Kuba Moscicki 25/5/2004
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// Code developed by:
// S.Guatelli
//
//
// $Id: BrachyAnalysisManager.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// **********************************
// * *
// * BrachyAnalysisManager.hh *
// * *
// **********************************
//
//
// the class Analysis creates and managed histograms and ntuples
//
#ifdef G4ANALYSIS_USE
#ifndef G4PROCESSTESTANALYSIS_HH
#define G4PROCESSTESTANALYSIS_HH
#include "globals.hh"
#include <vector>
#include "G4ThreeVector.hh"
#include "AIDA/IHistogram1D.h"
#include "AIDA/IHistogram2D.h"
#include "AIDA/IAnalysisFactory.h"
namespace AIDA{
class ITree;
class IHistogramFactory;
class IAnalysisFactory;
class ITupleFactory;
class ITuple;
class ITreeFactory;
};
class BrachyAnalysisManager
{
private:
BrachyAnalysisManager();
public:
~BrachyAnalysisManager();
static BrachyAnalysisManager* getInstance();
void book();
void FillHistogramWithEnergy(G4double,G4double,G4double);
void PrimaryParticleEnergySpectrum(G4double);
void DoseDistribution(G4double,G4double);
void finish();
private:
static BrachyAnalysisManager* instance;
private:
AIDA::IAnalysisFactory* aFact;
AIDA::ITree* theTree;
AIDA::IHistogramFactory *histFact;
AIDA::ITreeFactory *treeFact;
AIDA::IHistogram2D *h1;
AIDA::IHistogram1D *h2;
AIDA::IHistogram1D *h3;
};
#endif
#endif
@@ -0,0 +1,114 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyDetectorConstruction.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// ****************************************
// * *
// * BrachyDetectorConstruction.hh *
// * *
// ****************************************
#ifndef BrachyDetectorConstruction_H
#define BrachyDetectorConstruction_H 1
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4LogicalVolume.hh"
class BrachyPhantomSD;
class BrachyDetectorMessenger;
class G4LogicalVolume;
class G4Material;
class G4Tubs;
class G4Box;
class G4Sphere;
class G4Tubs;
class G4Colour;
class G4VPhysicalVolume;
class BrachyPhantomSD;
class BrachyPhantomROGeometry;
class G4VPhysicalVolume;
class BrachyMaterial;
class BrachyFactory;
class BrachyVoxelParameterisation;
class BrachyDetectorConstruction : public G4VUserDetectorConstruction
{
public:
BrachyDetectorConstruction(G4String&);
~BrachyDetectorConstruction();
G4VPhysicalVolume* Construct();
void SwitchBrachytherapicSeed();
void SelectBrachytherapicSeed(G4String val);
void ConstructPhantom();
void ConstructSensitiveDetector();
void PrintDetectorParameters();
void SetPhantomMaterial(G4String);
const G4double VoxelWidth_X(){return phantomDimensionX/numberOfVoxelsAlongX;}
const G4double VoxelWidth_Z(){return phantomDimensionZ/numberOfVoxelsAlongZ;}
const G4int GetNumVoxelX() {return numberOfVoxelsAlongX;}
const G4int GetNumVoxelZ() {return numberOfVoxelsAlongZ;}
const G4double GetDimX() {return phantomDimensionX;}
const G4double GetBoxDim_Z() {return phantomDimensionZ;}
void ComputeDimVoxel() {dimVoxel = phantomDimensionX/numberOfVoxelsAlongX;}
private:
G4int detectorChoice; //Select brachytherapic seed
BrachyPhantomSD* phantomSD;//pointer to sensitive detector
BrachyPhantomROGeometry* phantomROGeometry;//pointer to ROGeometry
BrachyFactory* factory;
// World ...
G4Box* World; //pointer to the solid World
G4LogicalVolume* WorldLog; //pointer to the logical World
G4VPhysicalVolume* WorldPhys; //pointer to the physical World
// Phantom ...
G4Box* Phantom; //pointer to solid phantom
G4LogicalVolume* PhantomLog; //pointer to logic phantom
G4VPhysicalVolume* PhantomPhys; //pointer to physical phantom
G4Material* phantomAbsorberMaterial;
G4double phantomDimensionX; //Phantom XDimension
G4double phantomDimensionY; //Phantom YDimension
G4double phantomDimensionZ; //Phantom ZDimension
G4int numberOfVoxelsAlongX; //Number of voxels along x axis
G4int numberOfVoxelsAlongZ; //Number of voxels along z axis
G4double Worldx ; //World XDimension
G4double Worldy ; //World YDimension
G4double Worldz ; //World XDimension
G4String sensitiveDetectorName;
BrachyDetectorMessenger* detectorMessenger;
BrachyMaterial* pMaterial;
G4double dimVoxel;
};
#endif
@@ -0,0 +1,94 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyDetectorConstructionI.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// ****************************************
// * *
// * BrachyDetectorConstructionI.hh *
// * *
// ****************************************
//Author: Susanna Guatelli
//
#ifndef BrachyDetectorConstructionI_H
#define BrachyDetectorConstructionI_H 1
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4LogicalVolume.hh"
class G4LogicalVolume;
class G4Tubs;
class G4Box;
class G4Sphere;
class G4Tubs;
class G4Colour;
class G4VPhysicalVolume;
class G4VPhysicalVolume;
class BrachyMaterial;
class BrachyDetectorConstructionI
{
public:
BrachyDetectorConstructionI();
~BrachyDetectorConstructionI();
void ConstructIodium(G4VPhysicalVolume*);// Construct iodium source
private:
//air tub ...
G4Tubs* defaultTub;
G4LogicalVolume* defaultTubLog;
G4VPhysicalVolume* defaultTubPhys;
//source titanium capsule ...
G4Tubs* capsule ;
G4LogicalVolume* capsuleLog;
G4VPhysicalVolume* capsulePhys;
G4Sphere* capsuleTip;
G4LogicalVolume* capsuleTipLog;
G4VPhysicalVolume* capsuleTipPhys1;
G4VPhysicalVolume* capsuleTipPhys2;
//radioactive core ...
G4Tubs* iodiumCore;
G4LogicalVolume* iodiumCoreLog;
G4VPhysicalVolume* iodiumCorePhys;
// golden marker ...
G4Tubs* marker;
G4LogicalVolume* markerLog;
G4VPhysicalVolume* markerPhys;
BrachyMaterial* pMaterial;
};
#endif
@@ -0,0 +1,88 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyDetectorConstructionIr.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// ****************************************
// * *
// * BrachyDetectorConstructionIr.hh *
// * *
// ****************************************
//
// Author: Susanna Guatelli
//
#ifndef BrachyDetectorConstructionIr_H
#define BrachyDetectorConstructionIr_H 1
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4LogicalVolume.hh"
class G4LogicalVolume;
class G4Tubs;
class G4Box;
class G4Sphere;
class G4Tubs;
class G4Colour;
class G4VPhysicalVolume;
class G4VPhysicalVolume;
class BrachyMaterial;
class BrachyDetectorConstructionIr
{
public:
BrachyDetectorConstructionIr();
~BrachyDetectorConstructionIr();
void ConstructIridium(G4VPhysicalVolume*);
void CleanIridium();
private:
G4Tubs* capsule ;
G4LogicalVolume* capsuleLog;
G4VPhysicalVolume* capsulePhys;
G4Sphere* capsuleTip;
G4LogicalVolume* capsuleTipLog;
G4VPhysicalVolume* capsuleTipPhys;
G4Tubs* iridiumCore;
G4LogicalVolume* iridiumCoreLog;
G4VPhysicalVolume* iridiumCorePhys;
BrachyMaterial* pMat;
G4VisAttributes* simpleCapsuleVisAtt;
G4VisAttributes* simpleCapsuleTipVisAtt;
G4VisAttributes* simpleIridiumVisAtt;
};
#endif
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyDetectorConstructionLeipzig.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//Author: Susanna Guatelli
//
// ************************************************
// * *
// * BrachyDetectorConstructionLeipzig.hh *
// * *
// ************************************************
//
//Management of Leipzig applicator
//
#ifndef BrachyDetectorConstructionLeipzig_H
#define BrachyDetectorConstructionLeipzig_H 1
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4LogicalVolume.hh"
class G4LogicalVolume;
class G4Tubs;
class G4Box;
class G4Sphere;
class G4Tubs;
class G4Colour;
class G4VPhysicalVolume;
class G4VPhysicalVolume;
class BrachyMaterial;
class BrachyDetectorConstructionLeipzig
{
public:
BrachyDetectorConstructionLeipzig();
~BrachyDetectorConstructionLeipzig();
void ConstructLeipzig(G4VPhysicalVolume*);
private:
G4Tubs* capsule ;
G4LogicalVolume* capsuleLog;
G4VPhysicalVolume* capsulePhys;
G4Sphere* capsuleTip;
G4LogicalVolume* capsuleTipLog;
G4VPhysicalVolume* capsuleTipPhys;
G4Tubs* iridiumCore;
G4LogicalVolume* iridiumCoreLog;
G4VPhysicalVolume* iridiumCorePhys;
G4Tubs* applicator1;
G4LogicalVolume* applicator1Log ;
G4VPhysicalVolume* applicator1Phys;
G4Tubs* applicator2;
G4LogicalVolume* applicator2Log ;
G4VPhysicalVolume* applicator2Phys;
BrachyMaterial* pMaterial;
};
#endif
@@ -0,0 +1,66 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//Author: Susanna Guatelli
//
//
// *****************************************
// * *
// * BrachyDetectrorMessenger.hh *
// * *
// *****************************************
//
// $Id: BrachyDetectorMessenger.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
#ifndef BrachyDetectorMessenger_h
#define BrachyDetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class BrachyDetectorConstruction;
class BrachyFactoryIr;
class BrachyRunAction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithoutParameter;
class BrachyDetectorMessenger: public G4UImessenger
{
public:
BrachyDetectorMessenger(BrachyDetectorConstruction* );
~BrachyDetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
BrachyDetectorConstruction* detector;//pointer to detector
G4UIdirectory* detectorDir;
G4UIcmdWithAString* phantomMaterialCmd; // change phantom material
G4UIcmdWithAString* sourceCmd; //change brachytherapis source
};
#endif
@@ -0,0 +1,53 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// ********************************
// * *
// * BrachyDummySD.hh *
// * *
// ********************************
// Dummy sensitive used only to flag sensitivity in cells of RO geometry.
#ifndef BrachyDummySD_h
#define BrachyDummySD_h 1
#include "G4VSensitiveDetector.hh"
class G4Step;
class BrachyDummySD : public G4VSensitiveDetector
{
public:
BrachyDummySD();
~BrachyDummySD() {};
void Initialize(G4HCofThisEvent* ) {};
G4bool ProcessHits(G4Step* ,G4TouchableHistory*) {return false;}
void EndOfEvent(G4HCofThisEvent*) {};
void clear() {};
void DrawAll() {};
void PrintAll() {};
};
BrachyDummySD::BrachyDummySD() : G4VSensitiveDetector("dummySD")
{}
#endif
@@ -0,0 +1,61 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyEventAction.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// Code developed by:
// S.Guatelli
//
// **********************************
// * *
// * BrachyEventAction.hh *
// * *
// **********************************
#ifndef BrachyEventAction_h
#define BrachyEventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class BrachyDetectorConstruction;
class BrachyAnalysisManager;
class BrachyEventAction : public G4UserEventAction
{
public:
BrachyEventAction();
~BrachyEventAction();
public:
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
private:
G4String drawFlag; //Visualisation flag
};
#endif
@@ -0,0 +1,68 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// Code developed by: Susanna Guatelli
//
// $Id: BrachyFactory.hh,v 1.1 2004/05/25 07:32:35 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// **********************************
// * *
// * BrachyFactory.hh *
// * *
// **********************************
//
// this is the abstract class which manages the sources' realisation
// in terms of geometry and primary particle generated in the radioactive core
#ifndef BrachyFactory_h
#define BrachyFactory_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
class G4ParticleGun;
class G4Run;
class G4Event;
class G4VPhysicalVolume;
class BrachyAnalysisManager;
class BrachyFactory
{
public:
BrachyFactory();
virtual ~BrachyFactory();
//Source primary particles' management ...
virtual G4VUserPrimaryGeneratorAction* CreatePrimaryGeneratorAction() = 0;
// ...
// this function manages the creation of the source in terms of
// geometry ...
virtual void CreateSource(G4VPhysicalVolume*) = 0;
// ...
// This function deletes the source in the geometry (phantom); to be
// used when the user needs to substitute one source with another one ...
virtual void CleanSource() = 0;
};
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// *******************************
// * *
// * BrachyFactoryI.cc *
// * *
// *******************************
//
//
// Code developed by:
// S.Guatelli
//
//
// $Id: BrachyFactoryI.hh,v 1.1 2004/05/25 07:32:35 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// --------------------------------------------------------------
#ifndef BrachyFactoryI_h
#define BrachyFactoryI_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "BrachyDetectorConstructionI.hh"
#include "BrachyFactory.hh"
#include "G4RunManager.hh"
class G4ParticleGun;
class G4Run;
class G4Event;
class BrachyAnalysisManager;
class BrachyFactory;
class BrachyPrimaryGeneratorActionI;
class BrachyDetectorConstructionI;
// This class manages the creation of Bebig Isoseed I-125 source
// used in interstitial brachytherapy ...
class BrachyFactoryI:public BrachyFactory
{
public:
BrachyFactoryI();
~BrachyFactoryI();
G4VUserPrimaryGeneratorAction* CreatePrimaryGeneratorAction();
void CreateSource(G4VPhysicalVolume*);
void CleanSource();
private:
BrachyDetectorConstructionI* iodiumSource;
};
#endif
@@ -0,0 +1,65 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyFactoryIr.hh,v 1.1 2004/05/25 07:32:35 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// **********************************
// * *
// * BrachyFactoryIr.hh *
// * *
// **********************************
//
//
//
#ifndef BrachyFactoryIr_h
#define BrachyFactoryIr_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "BrachyFactory.hh"
#include "G4RunManager.hh"
class G4ParticleGun;
class G4Run;
class G4Event;
class BrachyAnalysisManager;
class BrachyFactory;
class BrachyPrimaryGeneratorActionIr;
class BrachyDetectorConstructionIr;
// This class manages the creation of iridum source used in endocavitary
// brachytherapy ...
class BrachyFactoryIr : public BrachyFactory
{
public:
BrachyFactoryIr();
~BrachyFactoryIr();
G4VUserPrimaryGeneratorAction* CreatePrimaryGeneratorAction();
void CreateSource(G4VPhysicalVolume*);
void CleanSource();
private:
BrachyDetectorConstructionIr* iridiumSource;
};
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyFactoryLeipzig.hh,v 1.1 2004/05/25 07:32:35 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// **********************************
// * *
// * BrachyFactoryLeipzig.hh *
// * *
// **********************************
//code developed by: Susanna Guatelli
//
// This class manages the creation of iridum source used in superficial
// brachytherapy ...
#ifndef BrachyFactoryLeipzig_h
#define BrachyFactoryLeipzig_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "BrachyFactory.hh"
#include "G4RunManager.hh"
class G4ParticleGun;
class G4Run;
class G4Event;
class BrachyAnalysisManager;
class BrachyFactory;
class BrachyPrimaryGeneratorActionIr;
class BrachyDetectorConstructionLeipzig;
class BrachyFactoryLeipzig : public BrachyFactory
{
public:
BrachyFactoryLeipzig();
~BrachyFactoryLeipzig();
G4VUserPrimaryGeneratorAction* CreatePrimaryGeneratorAction();
void CreateSource(G4VPhysicalVolume*);
void CleanSource();
private:
BrachyDetectorConstructionLeipzig* leipzigSource;
};
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyMaterial.hh,v 1.1 2004/05/25 07:32:35 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// **********************************
// * *
// * BrachyMaterial.hh *
// * *
// **********************************
//
//Code developed by: Susanna Guatelli
//
//This class manages the elements and materials needed by the simulation
// set-up ...
//
#ifndef BrachyMaterial_H
#define BrachyMaterial_H 1
#include "globals.hh"
class G4Material;
class BrachyMaterial
{
public:
BrachyMaterial();
~ BrachyMaterial();
public:
void DefineMaterials();
G4Material* GetMat(G4String); //returns the material
private:
G4Material* matW;
G4Material* matplexiglass;
G4Material* matPb;
G4Material* matir192;
G4Material* Titanium;
G4Material* matAir;
G4Material* matH2O;
G4Material* soft;
G4Material* matsteel;
G4Material* gold;
G4Material* matI;
G4Material* ceramic;
G4Material*Vacuum;
G4Material* bone;
G4Material* muscle;
};
#endif
@@ -0,0 +1,132 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyPhantomHit.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// ********************************
// * *
// * BrachyPhantomHit.hh *
// * *
// ********************************
//
//Code developed by: S. Guatelli
//
// It manages the hits and the enrgy deposit in the phantom associated with
// each hit ...
#ifndef BrachyPhantomHit_h
#define BrachyPhantomHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4LogicalVolume.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
class BrachyPhantomHit : public G4VHit
{
public:
BrachyPhantomHit(G4LogicalVolume* ,G4int ,G4int ,G4int );
~BrachyPhantomHit();
BrachyPhantomHit(const BrachyPhantomHit &right);
const BrachyPhantomHit& operator = (const BrachyPhantomHit &right);
int operator == (const BrachyPhantomHit &right) const;
inline void *operator new(size_t);
inline void operator delete(void *aHit);
void Draw();
void Print();
private:
const G4LogicalVolume* logicalVolume;// Logical volume where the hit happened
G4int xHitPosition; // Hit x coordinate
G4int zHitPosition; // Hit z coordinate
G4int yHitPosition; // Hit y coordinate
G4ThreeVector hitPosition; //position of the hit
G4RotationMatrix rotation; // rotation of the logical volume
G4double energyDeposit; // energy deposit associated with the hit
public:
//...
// Set Hit position
inline void SetCellID(G4int XID,G4int YID,G4int ZID)
{xHitPosition = XID; zHitPosition = ZID; yHitPosition = YID; }
inline G4int GetXID() // Get hit x coordinate
{return xHitPosition;}
inline G4int GetZID() // Get hit z coordinate
{return zHitPosition;}
inline G4int GetYID() // Get hit y coordinate
{return yHitPosition;}
inline void SetEdep(G4double edep) //Set hit energy deposit
{energyDeposit = edep;}
inline void AddEdep(G4double edep) // Add energy deposit
{energyDeposit += edep;}
inline G4double GetEdep() // Get energy deposit
{return energyDeposit;}
inline void SetPos(G4ThreeVector xyz) // Set hit position
{hitPosition = xyz;}
inline G4ThreeVector GetPos() // Get hit position
{return hitPosition;}
inline void SetRot(G4RotationMatrix rmat) //set rotation
{rotation = rmat;}
inline G4RotationMatrix GetRot() //get rotation
{return rotation;}
//...
// It returns the logical volume where the hit happened
inline const G4LogicalVolume * GetLogicalVolume()
{return logicalVolume;}
};
typedef G4THitsCollection<BrachyPhantomHit> BrachyPhantomHitsCollection;
extern G4Allocator<BrachyPhantomHit> BrachyPhantomHitAllocator;
inline void* BrachyPhantomHit::operator new(size_t)
{
void *aHit;
aHit = (void *) BrachyPhantomHitAllocator.MallocSingle();
return aHit;
}
inline void BrachyPhantomHit::operator delete(void *aHit)
{
BrachyPhantomHitAllocator.FreeSingle((BrachyPhantomHit*) aHit);
}
#endif
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyPhantomROGeometry.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// ************************************
// * *
// * BrachyPhantomROGeometry.hh *
// * *
// ************************************
//
//The phantom is devided in voxels. the dimension of the voxel is 1mm
//
#ifndef BrachyPhantomROGeometry_h
#define BrachyPhantomROGeometry_h
#include "G4VReadOutGeometry.hh"
class BrachyPhantomROGeometry : public G4VReadOutGeometry
{
public:
BrachyPhantomROGeometry(G4String aString,
G4double phantomDimX,
G4double phantomDimZ,
G4int numberOfVoxelsX,
G4int numberOfVoxelsZ);
~BrachyPhantomROGeometry();
private:
G4VPhysicalVolume* Build();
private:
const G4double phantomDimensionX;
const G4double phantomDimensionZ;
const G4int numberOfVoxelsAlongX;
const G4int numberOfVoxelsAlongZ;
G4VPhysicalVolume *ROPhantomYDivisionPhys;
};
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyPhantomSD.hh,v 1.1 2004/05/25 07:32:35 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// ********************************
// * *
// * BrachyPhantomSD.hh *
// * *
// ********************************
#ifndef BrachyPhantomSD_h
#define BrachyPhantomSD_h 1
#include "G4VSensitiveDetector.hh"
#include "BrachyPhantomHit.hh"
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
class BrachyPhantomSD : public G4VSensitiveDetector
{
public:
BrachyPhantomSD(G4String name, G4int NumVoxelX, G4int NumVoxelZ);
~BrachyPhantomSD();
void Initialize(G4HCofThisEvent*);
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
void EndOfEvent(G4HCofThisEvent*HCE);
void clear();
void DrawAll();
void PrintAll();
private:
const G4int numberOfVoxelsX;
const G4int numberOfVoxelsZ;
G4int *voxelID;
BrachyPhantomHitsCollection *phantomHitsCollection;
};
#endif
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyPhysicsList.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// **********************************
// * *
// * BrachyPhysicsList.hh *
// * *
// **********************************
//
//Author: Susanna Guatelli
//
#ifndef BrachyPhysicsList_h
#define BrachyPhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
class G4LowEnergyIonisation;
class G4LowEnergyPhotoElectric;
class G4LowEnergyBremsstrahlung;
class BrachyPhysicsList: public G4VUserPhysicsList
{
public:
BrachyPhysicsList();
~BrachyPhysicsList();
protected:
// Construct particle and physics
void ConstructParticle();
void ConstructProcess();
void SetCuts();
private:
G4double cutForGamma;
G4double cutForElectron;
G4double cutForPositron;
protected:
// these methods Construct particles
void ConstructBosons();
void ConstructLeptons();
protected:
// these methods Construct physics processes and register them
void ConstructGeneral();
void ConstructEM();
private:
G4LowEnergyIonisation* loweIon;
G4LowEnergyPhotoElectric* lowePhot;
G4LowEnergyBremsstrahlung* loweBrem;
};
#endif
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyPrimaryGeneratorAction.hh,v 1.1 2004/05/25 07:32:35 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// ********************************************
// * *
// * BrachyPrimaryGeneratorAction.hh *
// * *
// ********************************************
// This class must be implemented because it is mandatory
#ifndef BrachyPrimaryGeneratorAction_h
#define BrachyPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
class G4ParticleGun;
class G4Run;
class G4Event;
class BrachyAnalysisManager;
class BrachyPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
BrachyPrimaryGeneratorAction();
~BrachyPrimaryGeneratorAction();
public:
virtual void GeneratePrimaries(G4Event* anEvent) = 0;
};
#endif
@@ -0,0 +1,68 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyPrimaryGeneratorActionI.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//
// ********************************************
// * *
// * BrachyPrimaryGeneratorActionI.hh *
// * *
// ********************************************
//Primary particles of the Iodium source. They are delivered from a random
//point of the radionuclide with random direction. The energy spectrum
// of the gamma delivered is activated
#ifndef BrachyPrimaryGeneratorActionI_h
#define BrachyPrimaryGeneratorActionI_h 1
#include "globals.hh"
#include <vector>
#include "G4VUserPrimaryGeneratorAction.hh"
#include "BrachyPrimaryGeneratorAction.hh"
class G4ParticleGun;
class G4Run;
class G4Event;
class BrachyAnalysisManager;
class BrachyPrimaryGeneratorAction;
class BrachyPrimaryGeneratorActionI : public G4VUserPrimaryGeneratorAction
{
public:
BrachyPrimaryGeneratorActionI();
~BrachyPrimaryGeneratorActionI();
public:
void GeneratePrimaries(G4Event* anEvent);
G4double GetEnergy();
private:
G4ParticleGun* particleGun;
G4double primaryParticleEnergy;
std::vector<G4double> energySpectrum;
};
#endif
@@ -0,0 +1,127 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//Author: Susanna Guatelli
//
// $Id: BrachyPrimaryGeneratorActionIr.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// *************************************************
// * *
// * BrachyPrimaryGeneratorActionIr.hh" *
// * *
// *************************************************
//
//
//Primary particles of the Iridium source. They are delivered from a random
//point of the radionuclide with random direction.
#ifndef BrachyPrimaryGeneratorActionIr_h
#define BrachyPrimaryGeneratorActionIr_h 1
#include "globals.hh"
#include <vector>
#include "G4VUserPrimaryGeneratorAction.hh"
#include "BrachyPrimaryGeneratorAction.hh"
class G4ParticleGun;
class G4Run;
class G4Event;
class BrachyAnalysisManager;
class BrachyPrimaryGeneratorAction;
class BrachyPrimaryGeneratorActionIr: public G4VUserPrimaryGeneratorAction
{
public:
BrachyPrimaryGeneratorActionIr();
~BrachyPrimaryGeneratorActionIr();
void GeneratePrimaries(G4Event* anEvent);
G4double GetEnergy(){return primaryParticleEnergy;};
private:
G4ParticleGun* particleGun;
G4double primaryParticleEnergy;
};
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyRunAction.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//Author: Susanna Guatelli
//
// ********************************************
// * *
// * BrachyRunAction.hh *
// * *
// ********************************************
//
#ifndef BrachyRunAction_h
#define BrachyRunAction_h 1
#include "G4UserRunAction.hh"
#include "G4RunManager.hh"
#include "globals.hh"
class G4Run;
class BrachyAnalysisManager;
class BrachyDetectorConstruction;
class BrachyRunMessenger;
class BrachyFactory;
class BrachyFactoryIr;
class BrachyFactoryI;
class BrachyRunAction : public G4UserRunAction
{
public:
BrachyRunAction();
~BrachyRunAction();
public:
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run* );
void SelectEnergy(G4int);
private:
BrachyRunMessenger* runMessenger;
BrachyFactory *factory;
G4int sourceChoice; //select primary particle
};
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyRunMessenger.hh,v 1.2 2004/05/25 08:36:17 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//Author: Susanna Guatelli
//
// ********************************************
// * *
// * BrachyRunMessenger.hh *
// * *
// ********************************************
// This class permits to switch the energy of the gamma delivered from the
//radionuclides (Iodium/Iridium)
//
#ifndef BrachyRunMessenger_h
#define BrachyRunMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class BrachyRunAction;
class BrachyRunAction;
class G4UIdirectory;
class G4UIcmdWithAString;
class BrachyRunMessenger: public G4UImessenger
{
public:
BrachyRunMessenger(BrachyRunAction* );
~BrachyRunMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
G4UIdirectory* runDir;
G4UIcmdWithAString* primaryParticleEnergySpectrumCmd;
BrachyRunAction* runManager;
};
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachySimulation.hh
// GEANT4 tag $Name: geant4-06-02 $
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
// --------------------------------------------------------------
//
// Code developed by: S.Guatelli, K. Moscicki
//
// *******************************
// * *
// * BrachySimulation.cc *
// * *
// *******************************
//
#include "globals.hh"
#include "Randomize.hh"
#include "IG4Simulation.h"
#include "G4RunManager.hh"
class BrachySimulation : virtual public DIANE::IG4Simulation
{
public:
BrachySimulation(G4int);
~BrachySimulation();
void setSeed(G4int seed);
G4bool initialize(int argc, char** argv);
void executeMacro(std::string macroFileName);
std::string getOutputFilename();
void finish();
private:
G4int seed;
G4RunManager* pRunManager;
};
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachyVisManager.hh,v 1.1 2004/05/25 07:32:36 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//
// ********************************************
// * *
// * BrachyVisManager.hh *
// * *
// ********************************************
//
//This class permits the visualisation of the experimerimental set up
//
#ifndef BrachyVisManager_h
#define BrachyVisManager_h 1
#ifdef G4VIS_USE
#include "G4VisManager.hh"
class BrachyVisManager: public G4VisManager
{
public:
BrachyVisManager ();
private:
void RegisterGraphicsSystems ();
};
#endif
#endif
@@ -0,0 +1,34 @@
#ifndef IG4SIMULATION_H
#define IG4SIMULATION_H
/* ==========================================
DIANE - Distributed Analysis Environment
Copyright (C) Jakub T. Moscicki, 2000-2003
------------------------------------------
See $DIANE_TOP/LICENSE for details.
==========================================
*/
#include "globals.hh"
namespace DIANE
{
class IG4Simulation
{
public:
virtual void setSeed(G4int seed) = 0;
virtual G4bool initialize(int argc, char** argv) = 0;
virtual void executeMacro(std::string macroFileName) = 0;
virtual std::string getOutputFilename() = 0;
virtual void finish() = 0;
virtual ~IG4Simulation() {}
};
}
extern "C"
DIANE::IG4Simulation* createG4Simulation(int);
#endif
@@ -0,0 +1,25 @@
#-*-python-*-
Application = "G4Analysis"
WorkerInitData = {
'G4ApplicationComponentName' : "G4Brachy",
'initMacroFile' : """
/control/verbose 1
/run/verbose 0
/event/verbose 0
/source/switch Iodium
/run/energy Iodium
/run/initialize
"""
}
JobInitData = {
'runParams' : {
'seed' : 0 ,
'eventNumber' : 5000,
'macroFileTemplate': "/run/beamOn " },
'eventsPerWorker' : 500,
'workerInit' : WorkerInitData
}
@@ -0,0 +1,23 @@
#-*-python-*-
Application = "G4Analysis"
WorkerInitData = {
'G4ApplicationComponentName' : "G4Brachy",
'initMacroFile' : """
/control/verbose 1
/run/verbose 0
/event/verbose 0
/run/initialize
"""
}
JobInitData = {
'runParams' : {
'seed' : 0 ,
'eventNumber' : 5000,
'macroFileTemplate': "/run/beamOn " },
'eventsPerWorker' : 500,
'workerInit' : WorkerInitData
}
@@ -0,0 +1,143 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli
//
// *******************************
// * *
// * BrachyAnalysisManager.cc *
// * *
// *******************************
//
// $Id: BrachyAnalysisManager.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#ifdef G4ANALYSIS_USE
#include <stdlib.h>
#include <fstream>
#include "BrachyAnalysisManager.hh"
#include "G4ios.hh"
#include "AIDA/IHistogram1D.h"
#include "AIDA/IHistogram2D.h"
#include "AIDA/IManagedObject.h"
#include "AIDA/IAnalysisFactory.h"
#include "AIDA/IHistogramFactory.h"
#include "AIDA/ITupleFactory.h"
#include "AIDA/ITreeFactory.h"
#include "AIDA/ITree.h"
#include "AIDA/ITuple.h"
BrachyAnalysisManager* BrachyAnalysisManager::instance = 0;
BrachyAnalysisManager::BrachyAnalysisManager() :
aFact(0), theTree(0), histFact(0), h1(0), h2(0)
{
//build up the factories
aFact = AIDA_createAnalysisFactory();
AIDA::ITreeFactory *treeFact = aFact -> createTreeFactory();
//parameters for the TreeFactory
std::string fileName = "brachytherapy.xml";
theTree = treeFact -> create(fileName,"xml",false, true, "uncompressed");
delete treeFact;
histFact = aFact -> createHistogramFactory( *theTree );
}
BrachyAnalysisManager::~BrachyAnalysisManager()
{
delete histFact;
histFact = 0;
delete theTree;
histFact = 0;
delete aFact;
aFact = 0;
}
BrachyAnalysisManager* BrachyAnalysisManager::getInstance()
{
if (instance == 0) instance = new BrachyAnalysisManager;
return instance;
}
void BrachyAnalysisManager::book()
{
//creating a 1D histogram ...
h1 = histFact -> createHistogram2D("10","Energy, pos", //histoID,histo name
300 ,-150.,150., //bins'number,xmin,xmax
300,-150.,150. );//bins'number,ymin,ymax
//creating a 2D histogram ...
h2 = histFact -> createHistogram1D("20","Initial Energy", //histoID,histo name
100,0.,1.); //bins' number, xmin, xmax
h3 = histFact -> createHistogram1D("30","Dose Distribution",
300,-150.,150.); //bins' number, xmin, xmax
}
void BrachyAnalysisManager::FillHistogramWithEnergy(G4double x,
G4double z,
G4double energyDeposit)
{
h1 -> fill(x,z,energyDeposit);
}
void BrachyAnalysisManager::PrimaryParticleEnergySpectrum(G4double primaryParticleEnergy)
{
//1DHisotgram: energy spectrum of primary particles
h2 -> fill(primaryParticleEnergy);
}
void BrachyAnalysisManager::DoseDistribution(G4double x,G4double energy)
{
//1DHisotgram: energy spectrum of primary particles
h3 -> fill(x,energy);
}
void BrachyAnalysisManager::finish()
{
// write all histograms to file ...
theTree -> commit();
// close (will again commit) ...
theTree -> close();
}
#endif
@@ -0,0 +1,261 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
// --------------------------------------------------------------
//
// Code developed by: S.Guatelli
//
//
// ****************************************
// * *
// * BrachyDetectorConstruction.cc *
// * *
// ****************************************
//
// $Id: BrachyDetectorConstruction.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "BrachyPhantomROGeometry.hh"
#include "BrachyPhantomSD.hh"
#include "BrachyDetectorMessenger.hh"
#include "BrachyDetectorConstruction.hh"
#include "G4CSGSolid.hh"
#include "G4Sphere.hh"
#include "G4MaterialPropertyVector.hh"
#include "G4SDManager.hh"
#include "G4SubtractionSolid.hh"
#include "G4RunManager.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "globals.hh"
#include "G4MaterialTable.hh"
#include "Randomize.hh"
#include "G4RunManager.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4PVParameterised.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4SDManager.hh"
#include "G4Colour.hh"
#include "G4UserLimits.hh"
#include "G4UnionSolid.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "BrachyMaterial.hh"
#include "BrachyFactoryLeipzig.hh"
#include "BrachyFactoryIr.hh"
#include "BrachyFactoryI.hh"
BrachyDetectorConstruction::BrachyDetectorConstruction(G4String &SDName)
: detectorChoice(0), phantomSD(0), phantomROGeometry(0), factory(0),
World(0), WorldLog(0), WorldPhys(0),
Phantom(0), PhantomLog(0), PhantomPhys(0),
phantomAbsorberMaterial(0)
{
phantomDimensionX = 15.*cm ;
phantomDimensionY = 15.*cm;
phantomDimensionZ = 15.*cm;
numberOfVoxelsAlongX = 300;
numberOfVoxelsAlongZ = 300;
ComputeDimVoxel();
Worldx = 4.0*m;
Worldy = 4.0*m;
Worldz = 4.0*m;
sensitiveDetectorName = SDName;
detectorMessenger = new BrachyDetectorMessenger(this);
factory = new BrachyFactoryIr();
pMaterial = new BrachyMaterial();
}
BrachyDetectorConstruction::~BrachyDetectorConstruction()
{
delete pMaterial;
delete factory;
delete detectorMessenger;
if (phantomROGeometry) delete phantomROGeometry;
}
G4VPhysicalVolume* BrachyDetectorConstruction::Construct()
{
pMaterial -> DefineMaterials();
ConstructPhantom();
factory ->CreateSource(PhantomPhys);
ConstructSensitiveDetector();
return WorldPhys;
}
void BrachyDetectorConstruction::SwitchBrachytherapicSeed()
{
factory -> CleanSource();
delete factory;
switch(detectorChoice)
{
case 1:
factory = new BrachyFactoryI();
break;
case 2:
factory = new BrachyFactoryLeipzig();
break;
case 3:
factory = new BrachyFactoryIr();
break;
default:
factory = new BrachyFactoryIr();
break;
}
factory -> CreateSource(PhantomPhys);
// Notify run manager that the new geometry has been built
G4RunManager::GetRunManager()->DefineWorldVolume( WorldPhys );
}
void BrachyDetectorConstruction::SelectBrachytherapicSeed(G4String val)
{
if(val=="Iodium")
{
detectorChoice = 1;
}
else
{
if(val=="Leipzig")
{
detectorChoice = 2;
}
else
{
if(val=="Iridium")
{
detectorChoice = 3;
}
}
}
G4cout << "Now Detector is " << val << G4endl;
}
void BrachyDetectorConstruction::ConstructPhantom()
{
G4Colour lblue (0.0, 0.0, .75);
G4Material* air = pMaterial -> GetMat("Air") ;
G4Material* water = pMaterial -> GetMat("Water");
ComputeDimVoxel();
// World volume
World = new G4Box("World",Worldx,Worldy,Worldz);
WorldLog = new G4LogicalVolume(World,air,"WorldLog",0,0,0);
WorldPhys = new G4PVPlacement(0,G4ThreeVector(),"WorldPhys",WorldLog,0,false,0);
// Water Box
Phantom = new G4Box("Phantom",phantomDimensionX,phantomDimensionY,phantomDimensionZ);
PhantomLog = new G4LogicalVolume(Phantom,water,"PhantomLog",0,0,0);
PhantomPhys = new G4PVPlacement(0,G4ThreeVector(),"PhantomPhys",PhantomLog,WorldPhys,false,0);
WorldLog->SetVisAttributes (G4VisAttributes::Invisible);
G4VisAttributes* simpleBoxVisAtt = new G4VisAttributes(lblue);
simpleBoxVisAtt -> SetVisibility(true);
simpleBoxVisAtt -> SetForceWireframe(true);
PhantomLog -> SetVisAttributes(simpleBoxVisAtt);
}
void BrachyDetectorConstruction::ConstructSensitiveDetector()
// Sensitive Detector and ReadOut geometry definition
{
G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
if(!phantomSD)
{
phantomSD = new BrachyPhantomSD(sensitiveDetectorName,
numberOfVoxelsAlongX,
numberOfVoxelsAlongZ);
G4String ROGeometryName = "PhantomROGeometry";
phantomROGeometry = new BrachyPhantomROGeometry(ROGeometryName,
phantomDimensionX,
phantomDimensionZ,
numberOfVoxelsAlongX,
numberOfVoxelsAlongZ);
phantomROGeometry -> BuildROGeometry();
phantomSD -> SetROgeometry(phantomROGeometry);
pSDManager -> AddNewDetector(phantomSD);
PhantomLog -> SetSensitiveDetector(phantomSD);
}
}
void BrachyDetectorConstruction::PrintDetectorParameters()
{
G4cout << "-----------------------------------------------------------------------"
<< G4endl
<< "the detector is a box whose size is: " << G4endl
<< phantomDimensionX/cm
<< " cm * "
<< phantomDimensionY/cm
<< " cm * "
<< phantomDimensionZ/cm
<< " cm" << G4endl
<< "numVoxel: "
<< numberOfVoxelsAlongX <<G4endl
<< "dim voxel: "
<< dimVoxel/mm
<< "mm" << G4endl
<< "material of the box : "
<< phantomAbsorberMaterial -> GetName() <<G4endl
<< "the source is at the center of the detector" << G4endl
<< "-------------------------------------------------------------------------"
<< G4endl;
}
void BrachyDetectorConstruction::SetPhantomMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial)
{
phantomAbsorberMaterial = pttoMaterial;
PhantomLog -> SetMaterial(pttoMaterial);
PrintDetectorParameters();
}
else
G4cout << "WARNING: material '" << materialChoice
<< "' not available!" << G4endl;
}
@@ -0,0 +1,187 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
// --------------------------------------------------------------
//
// Code developed by: S.Guatelli
//
/// ****************************************
// * *
// * BrachyDetectorConstructionI.cc *
// * *
// ****************************************
//
// $Id: BrachyDetectorConstructionI.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "globals.hh"
#include "BrachyDetectorConstructionI.hh"
#include "G4CSGSolid.hh"
#include "G4Sphere.hh"
#include "G4MaterialPropertyVector.hh"
#include "G4SDManager.hh"
#include "G4SubtractionSolid.hh"
#include "G4RunManager.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4MaterialTable.hh"
#include "Randomize.hh"
#include "G4RunManager.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4PVParameterised.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4UnionSolid.hh"
#include "BrachyMaterial.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
BrachyDetectorConstructionI::BrachyDetectorConstructionI()
: defaultTub(0), defaultTubLog(0), defaultTubPhys(0),
capsule(0), capsuleLog(0), capsulePhys(0),
capsuleTip(0), capsuleTipLog(0),capsuleTipPhys1(0),
capsuleTipPhys2(0), iodiumCore(0), iodiumCoreLog(0),
iodiumCorePhys(0), marker(0), markerLog(0), markerPhys(0)
{
pMaterial = new BrachyMaterial();
}
BrachyDetectorConstructionI::~BrachyDetectorConstructionI()
{
delete pMaterial;
}
void BrachyDetectorConstructionI::ConstructIodium(G4VPhysicalVolume* mother)
{
// source Bebig Isoseed I-125 ...
//Get materials for source construction ...
G4Material* titanium = pMaterial -> GetMat("titanium");
G4Material* air = pMaterial -> GetMat("Air");
G4Material* iodium = pMaterial -> GetMat("Iodium");
G4Material* gold = pMaterial -> GetMat("gold");
G4Colour red (1.0, 0.0, 0.0) ;
G4Colour magenta (1.0, 0.0, 1.0) ;
G4Colour lblue (0.0, 0.0, .75);
defaultTub = new G4Tubs("DefaultTub",0.*mm,0.40*mm,1.84*mm,0.*deg,360.*deg);
defaultTubLog = new G4LogicalVolume(defaultTub,air,"DefaultTub_Log");
defaultTubPhys = new G4PVPlacement(0,
G4ThreeVector(),
"defaultTub_Phys",
defaultTubLog,
mother,
false,
0);
// Capsule main body ...
G4double capsuleR = 0.35*mm;
capsule = new G4Tubs("Capsule", capsuleR,0.40*mm,1.84*mm,0.*deg,360.*deg);
capsuleLog = new G4LogicalVolume(capsule,titanium,"CapsuleLog");
capsulePhys = new G4PVPlacement(0,
G4ThreeVector(),
"CapsulePhys",
capsuleLog,
defaultTubPhys,
false,
0);
// Capsule tips
capsuleTip = new G4Sphere("CapsuleTip",
0.*mm,
0.40*mm,
0.*deg,
360.*deg,
0.*deg,
90.*deg);
capsuleTipLog = new G4LogicalVolume(capsuleTip,titanium,"CapsuleTipLog");
capsuleTipPhys1 = new G4PVPlacement(0,
G4ThreeVector(0.,0.,1.84*mm),
"CapsuleTipPhys1",
capsuleTipLog,
mother,
false,
0);
G4RotationMatrix* rotateMatrix = new G4RotationMatrix();
rotateMatrix -> rotateX(180.0*deg);
capsuleTipPhys2 = new G4PVPlacement(rotateMatrix,
G4ThreeVector(0,0,-1.84*mm),
"CapsuleTipPhys2",
capsuleTipLog,
mother,
false,
0);
// radiactive core ...
iodiumCore = new G4Tubs("ICore",0.085*mm,0.35*mm,1.75*mm,0.*deg,360.*deg);
iodiumCoreLog = new G4LogicalVolume(iodiumCore,iodium,"iodiumCoreLog");
iodiumCorePhys = new G4PVPlacement(0,
G4ThreeVector(0.,0.,0.),
"iodiumCorePhys",
iodiumCoreLog,
defaultTubPhys,
false,
0);
// golden marker
marker = new G4Tubs("GoldenMarker",0.*mm,0.085*mm,1.75*mm,0.*deg,360.*deg);
markerLog = new G4LogicalVolume(marker,gold,"MarkerLog");
markerPhys = new G4PVPlacement(0,
G4ThreeVector(0.,0.,0.),
"MarkerPhys",
markerLog,
defaultTubPhys,
false,
0);
// Visual attributes ...
G4VisAttributes* simpleMarkerVisAtt = new G4VisAttributes(lblue);
simpleMarkerVisAtt -> SetVisibility(true);
simpleMarkerVisAtt -> SetForceSolid(true);
markerLog -> SetVisAttributes(simpleMarkerVisAtt);
G4VisAttributes* simpleiodiumVisAtt = new G4VisAttributes(magenta);
simpleiodiumVisAtt -> SetVisibility(true);
simpleiodiumVisAtt -> SetForceWireframe(true);
iodiumCoreLog -> SetVisAttributes(simpleiodiumVisAtt);
G4VisAttributes* simpleCapsuleVisAtt = new G4VisAttributes(red);
simpleCapsuleVisAtt -> SetVisibility(true);
simpleCapsuleVisAtt -> SetForceWireframe(true);
capsuleLog -> SetVisAttributes(simpleCapsuleVisAtt);
G4VisAttributes* simpleCapsuleTipVisAtt = new G4VisAttributes(red);
simpleCapsuleTipVisAtt -> SetVisibility(true);
simpleCapsuleTipVisAtt -> SetForceSolid(true);
capsuleTipLog -> SetVisAttributes(simpleCapsuleTipVisAtt);
}
@@ -0,0 +1,188 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
// --------------------------------------------------------------
//
// Code developed by: S.Guatelli
//
// ****************************************
// * *
// * BrachyDetectorConstructionIr.cc *
// * *
// ****************************************
//
// $Id: BrachyDetectorConstructionIr.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "globals.hh"
#include "BrachyDetectorConstructionIr.hh"
#include "G4CSGSolid.hh"
#include "G4Sphere.hh"
#include "G4MaterialPropertyVector.hh"
#include "G4SDManager.hh"
#include "G4SubtractionSolid.hh"
#include "G4RunManager.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4MaterialTable.hh"
#include "Randomize.hh"
#include "G4RunManager.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4PVParameterised.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4UnionSolid.hh"
#include "BrachyMaterial.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
BrachyDetectorConstructionIr::BrachyDetectorConstructionIr()
: capsule(0), capsuleLog(0), capsulePhys(0),
capsuleTip(0), capsuleTipLog(0), capsuleTipPhys(0),
iridiumCore(0), iridiumCoreLog(0), iridiumCorePhys(0),
simpleCapsuleVisAtt(0), simpleCapsuleTipVisAtt(0), simpleIridiumVisAtt(0)
{
pMat = new BrachyMaterial();
}
BrachyDetectorConstructionIr::~BrachyDetectorConstructionIr()
{
delete pMat;
}
void BrachyDetectorConstructionIr::ConstructIridium(G4VPhysicalVolume* mother)
{
G4Colour red (1.0, 0.0, 0.0) ;
G4Colour magenta (1.0, 0.0, 1.0) ;
G4Material* capsuleMat = pMat -> GetMat("Stainless steel");
G4Material* iridiumMat = pMat -> GetMat("Iridium");
// Capsule main body
capsule = new G4Tubs("Capsule",0,0.55*mm,3.725*mm,0.*deg,360.*deg);
capsuleLog = new G4LogicalVolume(capsule,capsuleMat,"CapsuleLog");
capsulePhys= new G4PVPlacement(0,
G4ThreeVector(0,0,-1.975*mm),
"CapsulePhys",
capsuleLog,
mother,
false,
0);
// Capsule tip
capsuleTip = new G4Sphere("CapsuleTipIridium",
0.*mm,
0.55*mm,
0.*deg,
360.*deg,
0.*deg,
90.*deg);
capsuleTipLog = new G4LogicalVolume(capsuleTip,
capsuleMat,
"CapsuleTipIridumLog");
capsuleTipPhys = new G4PVPlacement(0,
G4ThreeVector(0.,0.,1.75*mm),
"CapsuleTipIridiumPhys",
capsuleTipLog,
mother,
false,
0);
// Iridium core
iridiumCore = new G4Tubs("IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg);
iridiumCoreLog = new G4LogicalVolume(iridiumCore,
iridiumMat,
"IridiumCoreLog");
iridiumCorePhys = new G4PVPlacement(0,
G4ThreeVector(),
"IridiumCorePhys",
iridiumCoreLog,
capsulePhys,
false,
0);
simpleCapsuleVisAtt = new G4VisAttributes(red);
simpleCapsuleVisAtt -> SetVisibility(true);
simpleCapsuleVisAtt -> SetForceWireframe(true);
capsuleLog -> SetVisAttributes(simpleCapsuleVisAtt);
simpleCapsuleTipVisAtt = new G4VisAttributes(red);
simpleCapsuleTipVisAtt -> SetVisibility(true);
simpleCapsuleTipVisAtt -> SetForceSolid(true);
capsuleTipLog -> SetVisAttributes(simpleCapsuleTipVisAtt);
simpleIridiumVisAtt = new G4VisAttributes(magenta);
simpleIridiumVisAtt -> SetVisibility(true);
simpleIridiumVisAtt -> SetForceWireframe(true);
iridiumCoreLog -> SetVisAttributes(simpleIridiumVisAtt);
}
void BrachyDetectorConstructionIr::CleanIridium()
{
delete simpleIridiumVisAtt;
simpleIridiumVisAtt = 0;
delete iridiumCorePhys;
iridiumCorePhys = 0;
delete iridiumCore;
iridiumCore = 0;
delete iridiumCoreLog;
iridiumCoreLog = 0 ;
delete simpleCapsuleTipVisAtt;
simpleCapsuleTipVisAtt = 0;
delete capsuleTipPhys;
capsuleTipPhys = 0;
delete capsuleTip;
capsuleTip = 0;
delete capsuleTipLog;
capsuleTipLog = 0;
delete simpleCapsuleVisAtt;
simpleCapsuleVisAtt = 0;
delete capsulePhys;
capsulePhys = 0;
delete capsule;
capsule = 0;
delete capsuleLog;
capsuleLog = 0;
}
@@ -0,0 +1,163 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
// --------------------------------------------------------------
//
// Code developed by: S.Guatelli
//
// *******************************************
// * *
// * BrachyDetectorConstructionLeipzig.cc *
// * *
// *******************************************
//
//
// $Id: BrachyDetectorConstructionLeipzig.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "globals.hh"
#include "BrachyDetectorConstructionLeipzig.hh"
#include "G4CSGSolid.hh"
#include "G4Sphere.hh"
#include "G4MaterialPropertyVector.hh"
#include "G4SDManager.hh"
#include "G4SubtractionSolid.hh"
#include "G4RunManager.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4MaterialTable.hh"
#include "Randomize.hh"
#include "G4RunManager.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4PVParameterised.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4UnionSolid.hh"
#include "BrachyMaterial.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
// Leipzig Applicator ...
BrachyDetectorConstructionLeipzig::BrachyDetectorConstructionLeipzig()
: capsule(0), capsuleLog(0), capsulePhys(0),
capsuleTip(0), capsuleTipLog(0), capsuleTipPhys(0),
iridiumCore(0), iridiumCoreLog(0), iridiumCorePhys(0),
applicator1(0), applicator1Log(0), applicator1Phys(0),
applicator2(0), applicator2Log(0), applicator2Phys(0)
{
pMaterial = new BrachyMaterial();
}
BrachyDetectorConstructionLeipzig::~BrachyDetectorConstructionLeipzig()
{
delete pMaterial;
}
void BrachyDetectorConstructionLeipzig::ConstructLeipzig(G4VPhysicalVolume* mother)
{
G4Colour red (1.0, 0.0, 0.0) ;
G4Material* capsuleMat = pMaterial -> GetMat("Stainless steel");
G4Material* iridium = pMaterial -> GetMat("Iridium");
G4Material* tungsten =pMaterial -> GetMat("Tungsten");
//Iridium source ...
capsule = new G4Tubs("Capsule",0,0.55*mm,3.725*mm,0.*deg,360.*deg);
capsuleLog = new G4LogicalVolume(capsule,capsuleMat,"CapsuleLog");
capsulePhys = new G4PVPlacement(0,
G4ThreeVector(0,0,-1.975*mm),
"CapsulePhys",
capsuleLog,
mother, //mother volume: phantom
false,
0);
// Capsule tip
capsuleTip = new G4Sphere("CapsuleTip",0.*mm,0.55*mm,0.*deg,360.*deg,0.*deg,90.*deg);
capsuleTipLog = new G4LogicalVolume(capsuleTip,capsuleMat,"CapsuleTipLog");
capsuleTipPhys = new G4PVPlacement(0,
G4ThreeVector(0.,0.,1.75*mm),
"CapsuleTipPhys",
capsuleTipLog,
mother,
false,
0);
// Iridium core
iridiumCore = new G4Tubs("IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg);
iridiumCoreLog = new G4LogicalVolume(iridiumCore,
iridium,
"IridiumCoreLog");
iridiumCorePhys = new G4PVPlacement(0,
G4ThreeVector(0.,0.,1.975*mm),
"IridiumCorePhys",
iridiumCoreLog,
capsulePhys,
false,
0);
// Applicator
//Leipzig Applicator is given by two different volumes
applicator1 = new G4Tubs("Appl1",5*mm,10.5*mm,12*mm,0.*deg,360.*deg);
applicator1Log = new G4LogicalVolume(applicator1,tungsten,"Appl1Log");
applicator1Phys = new G4PVPlacement(0,
G4ThreeVector(0,0,4.0*mm),
"Appl1Phys",
applicator1Log,
mother,
false,
0);
applicator2 = new G4Tubs("Appl2",0.55*mm,5.*mm,3.125*mm,0.*deg,360.*deg);
applicator2Log = new G4LogicalVolume(applicator2,tungsten,"Appl2");
applicator2Phys = new G4PVPlacement(0,
G4ThreeVector(0,0,-4.875*mm),
"Appl2Phys",
applicator2Log,
mother,
false,
0);
G4VisAttributes* simpleCapsuleVisAtt = new G4VisAttributes(red);
simpleCapsuleVisAtt -> SetVisibility(true);
simpleCapsuleVisAtt -> SetForceSolid(true);
capsuleLog -> SetVisAttributes(simpleCapsuleVisAtt);
G4VisAttributes* simpleCapsuleTipVisAtt = new G4VisAttributes(red);
simpleCapsuleTipVisAtt -> SetVisibility(true);
simpleCapsuleTipVisAtt -> SetForceSolid(true);
capsuleTipLog -> SetVisAttributes(simpleCapsuleTipVisAtt);
}
@@ -0,0 +1,88 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// Code developed by:
// S.Guatelli
//
// *********************************
// * *
// * BrachyDetectorMessenger.cc *
// * *
// *********************************
//
//
// $Id: BrachyDetectorMessenger.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
#include "BrachyDetectorMessenger.hh"
#include "BrachyFactoryIr.hh"
#include "BrachyRunAction.hh"
#include "BrachyDetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
BrachyDetectorMessenger::BrachyDetectorMessenger( BrachyDetectorConstruction* Det): detector(Det)
{
detectorDir = new G4UIdirectory("/phantom/");
detectorDir -> SetGuidance(" phantom control.");
phantomMaterialCmd = new G4UIcmdWithAString("/phantom/selectMaterial",this);
phantomMaterialCmd -> SetGuidance("Select Material of the detector.");
phantomMaterialCmd -> SetParameterName("choice",false);
phantomMaterialCmd -> AvailableForStates(G4State_Idle);
sourceCmd = new G4UIcmdWithAString("/source/switch",this);
sourceCmd -> SetGuidance("Assign the selected geometry to G4RunManager.");
sourceCmd -> SetParameterName("choice",true);
sourceCmd -> SetDefaultValue(" ");
sourceCmd -> SetCandidates("Iridium Iodium Leipzig ");
sourceCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
}
BrachyDetectorMessenger::~BrachyDetectorMessenger()
{
delete sourceCmd;
delete phantomMaterialCmd;
delete detectorDir;
}
void BrachyDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == phantomMaterialCmd )
{ detector -> SetPhantomMaterial(newValue);}
if( command == sourceCmd )
{
if(newValue=="Iodium" || newValue=="Iridium"|| newValue=="Leipzig")
{
detector -> SelectBrachytherapicSeed(newValue);
detector -> SwitchBrachytherapicSeed();
}
}
}
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli
//
// *******************************
// * *
// * BrachyEventAction.cc *
// * *
// *******************************
//
// $Id: BrachyEventAction.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "BrachyEventAction.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
BrachyEventAction::BrachyEventAction():
drawFlag("all" )
{
}
BrachyEventAction::~BrachyEventAction()
{
}
void BrachyEventAction::BeginOfEventAction(const G4Event*)
{
}
void BrachyEventAction::EndOfEventAction(const G4Event* evt)
{
// extract the trajectories and draw them ...
if (G4VVisManager::GetConcreteInstance())
{
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
for (G4int i=0; i<n_trajectories; i++)
{
G4Trajectory* trj = (G4Trajectory*)
((*(evt -> GetTrajectoryContainer()))[i]);
if(drawFlag == "all") trj -> DrawTrajectory(50);
else if((drawFlag == "charged")&&(trj -> GetCharge() != 0.))
trj -> DrawTrajectory(50);
else if ((drawFlag == "neutral")&&(trj -> GetCharge() == 0.))
trj -> DrawTrajectory(50);
}
}
}
@@ -0,0 +1,43 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// Code developed by:
// S.Guatelli
//
//
// *******************************
// * *
// * BrachyFactory.cc *
// * *
// *******************************
//
// $Id: BrachyFactory.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include"BrachyFactory.hh"
BrachyFactory::BrachyFactory()
{;}
BrachyFactory::~BrachyFactory()
{;}
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli
//
// *******************************
// * *
// * BrachyFactoryI.cc
// * *
// *******************************
//
// $Id: BrachyFactoryI.cc,v 1.1 2004/05/25 07:32:36 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "BrachyFactoryI.hh"
#include "BrachyPrimaryGeneratorActionI.hh"
#include "BrachyDetectorConstructionI.hh"
#include "G4ParticleTable.hh"
#include "Randomize.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4IonTable.hh"
#include "G4UImanager.hh"
#include "globals.hh"
#include "G4RunManager.hh"
BrachyFactoryI:: BrachyFactoryI()
{
iodiumSource = new BrachyDetectorConstructionI();
}
BrachyFactoryI::~BrachyFactoryI()
{
delete iodiumSource;
}
G4VUserPrimaryGeneratorAction* BrachyFactoryI::CreatePrimaryGeneratorAction()
{
G4VUserPrimaryGeneratorAction* iodiumPrimaryParticle =
new BrachyPrimaryGeneratorActionI();
return iodiumPrimaryParticle;
}
void BrachyFactoryI::CreateSource(G4VPhysicalVolume* mother)
{
iodiumSource->ConstructIodium(mother);
}
void BrachyFactoryI::CleanSource()
{;}
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli
//
// *******************************
// * *
// * BrachyFactoryIr *
// * *
// *******************************
//
// $Id: BrachyFactoryIr.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "globals.hh"
#include "BrachyFactoryIr.hh"
#include "BrachyPrimaryGeneratorActionIr.hh"
#include "G4ParticleTable.hh"
#include "Randomize.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4IonTable.hh"
#include "G4UImanager.hh"
#include "G4RunManager.hh"
#include "BrachyDetectorMessenger.hh"
#include "BrachyDetectorConstructionIr.hh"
BrachyFactoryIr:: BrachyFactoryIr()
{
iridiumSource =new BrachyDetectorConstructionIr();
}
BrachyFactoryIr:: ~BrachyFactoryIr()
{
delete iridiumSource;
}
G4VUserPrimaryGeneratorAction* BrachyFactoryIr::CreatePrimaryGeneratorAction(){
G4VUserPrimaryGeneratorAction* iridiumPrimaryParticle =
new BrachyPrimaryGeneratorActionIr();
return iridiumPrimaryParticle;
}
void BrachyFactoryIr::CreateSource(G4VPhysicalVolume* mother)
{
iridiumSource -> ConstructIridium(mother);
}
void BrachyFactoryIr::CleanSource()
{
iridiumSource -> CleanIridium();
}
@@ -0,0 +1,74 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli
//
// *******************************
// * *
// * BrachyFactoryLeipzig.cc *
// * *
// *******************************
//
// $Id: BrachyFactoryLeipzig.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "globals.hh"
#include "BrachyFactoryLeipzig.hh"
#include"BrachyPrimaryGeneratorActionIr.hh"
#include "G4ParticleTable.hh"
#include "Randomize.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4IonTable.hh"
#include "G4UImanager.hh"
#include "G4RunManager.hh"
#include "BrachyDetectorMessenger.hh"
#include "BrachyDetectorConstructionLeipzig.hh"
BrachyFactoryLeipzig:: BrachyFactoryLeipzig()
{
leipzigSource = new BrachyDetectorConstructionLeipzig();
}
BrachyFactoryLeipzig:: ~BrachyFactoryLeipzig()
{
delete leipzigSource;
}
G4VUserPrimaryGeneratorAction* BrachyFactoryLeipzig::CreatePrimaryGeneratorAction()
{
G4VUserPrimaryGeneratorAction* iridiumPrimaryParticle =
new BrachyPrimaryGeneratorActionIr();
return iridiumPrimaryParticle;
}
void BrachyFactoryLeipzig::CreateSource(G4VPhysicalVolume* mother)
{
leipzigSource -> ConstructLeipzig(mother);
}
void BrachyFactoryLeipzig::CleanSource()
{
;
}
@@ -0,0 +1,237 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli
//
// *******************************
// * *
// * BrachyMaterial.cc *
// * *
// *******************************
//
// $Id: BrachyMaterial.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "G4MaterialPropertiesTable.hh"
#include "G4MaterialPropertyVector.hh"
#include "globals.hh"
#include "G4MaterialTable.hh"
#include "Randomize.hh"
#include "G4RunManager.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "BrachyMaterial.hh"
BrachyMaterial::BrachyMaterial()
{;}
BrachyMaterial::~BrachyMaterial()
{;}
void BrachyMaterial::DefineMaterials()
{
// Define required materials
G4double A; // atomic mass
G4double Z; // atomic number
G4double d; // density
// General elements
A = 1.01*g/mole;
G4Element* elH = new G4Element ("Hydrogen","H",Z = 1.,A);
A = 14.01*g/mole;
G4Element* elN = new G4Element("Nitrogen","N",Z = 7.,A);
A = 16.00*g/mole;
G4Element* elO = new G4Element("Oxygen","O",Z = 8.,A);
A=26.98*g/mole;
G4Element* elAl = new G4Element("Aluminum","Al", Z = 13.,A);
A = 12.011*g/mole;
G4Element* elC = new G4Element("Carbon","C",Z = 6.,A);
A = 22.99*g/mole;
G4Element* elNa = new G4Element("Sodium","Na",Z = 11.,A);
A = 24.305*g/mole;
G4Element* elMg = new G4Element("Magnesium","Mg",Z = 12.,A);
A = 30.974*g/mole;
G4Element* elP = new G4Element("Phosphorus","P",Z = 15.,A);
A = 32.06*g/mole;
G4Element* elS = new G4Element("Sulfur","S",Z = 16.,A);
A = 35.453*g/mole;
G4Element* elCl = new G4Element("Chlorine","Cl",Z = 17.,A);
A = 39.098*g/mole;
G4Element* elK = new G4Element("Potassium","K",Z = 19.,A);
A = 40.08*g/mole;
G4Element* elCa = new G4Element("Calcium","Ca",Z = 20.,A);
A = 65.38*g/mole;
G4Element* elZn = new G4Element("Zinc","Zn",Z = 30.,A);
A = 54.94*g/mole;
G4Element* elMn = new G4Element("Manganese","Mn",Z = 25.,A);
A = 28.09*g/mole;
G4Element* elSi = new G4Element("Silicon","Si",Z = 14.,A);
A = 52.00*g/mole;
G4Element* elCr = new G4Element("Chromium","Cr",Z = 24.,A);
A = 58.70*g/mole;
G4Element* elNi = new G4Element("Nickel","Ni",Z = 28.,A);
A = 55.85*g/mole;
G4Element* elFe = new G4Element("Iron","Fe",Z = 26.,A);
A = 183.84* g/mole;
d = 19.3*g/cm3;
matW = new G4Material("Tungsten",Z = 74.,A,d);
// Perspex, plexiglass, lucite
d = 1.19*g/cm3;
matplexiglass = new G4Material("Plexiglass",d,3);
matplexiglass -> AddElement(elH,0.08);
matplexiglass -> AddElement(elC,0.60);
matplexiglass -> AddElement(elO,0.32);
// Lead material
A = 207.19*g/mole;
Z = 82;
d = 11.35*g/cm3;
matPb = new G4Material("Lead",Z,A,d);
// Iridium (Medical Physics, Vol 25, No 10, Oct 1998)
d = 22.42*g/cm3;
A = 191.96260*g/mole ;
Z = 77;
matir192 = new G4Material("Iridium",Z,A,d);
//titanium
A = 47.88*g/mole;
d = 4.50*g/cm3;
Titanium = new G4Material("titanium" ,Z = 22.,A,d);
// Air material
d = 1.290*mg/cm3;
G4Material* matAir = new G4Material("Air",d,2);
matAir -> AddElement(elN,0.7);
matAir -> AddElement(elO,0.3);
// Water
d = 1.000*g/cm3;
matH2O = new G4Material("Water",d,2);
matH2O -> AddElement(elH,2);
matH2O -> AddElement(elO,1);
matH2O -> GetIonisation() -> SetMeanExcitationEnergy(75.0*eV);
//soft tissue(http://www.nist.gov)
d = 1.0*g/cm3;
soft = new G4Material("tissue",d,13);
soft -> AddElement(elH,0.104472);
soft -> AddElement(elC,0.23219);
soft -> AddElement(elN,0.02488);
soft -> AddElement(elO,0.630238);
soft -> AddElement(elNa,0.00113);
soft -> AddElement(elMg,0.00013);
soft -> AddElement(elP,0.00133);
soft -> AddElement(elS,0.00199);
soft -> AddElement(elCl,0.00134);
soft -> AddElement(elK,0.00199);
soft -> AddElement(elCa,0.00023);
soft -> AddElement(elFe,0.00005);
soft -> AddElement(elZn,0.00003);
// Stainless steel (Medical Physics, Vol 25, No 10, Oct 1998)
d = 8.02*g/cm3 ;
matsteel = new G4Material("Stainless steel",d,5);
matsteel -> AddElement(elMn, 0.02);
matsteel -> AddElement(elSi, 0.01);
matsteel -> AddElement(elCr, 0.19);
matsteel -> AddElement(elNi, 0.10);
matsteel -> AddElement(elFe, 0.68);
//gold(chimica degli elementi N.N Greenwood,A.Earnshaw)
A = 196.97*g/mole;
d = 19.32*g/cm3;
gold = new G4Material("gold",Z = 79.,A,d);
//IodiumCore(chimica degli elementi N.N Greenwood,A.Earnshaw)
A = 124.9*g/mole;
d = 4.862*g/cm3;
matI = new G4Material("Iodium",Z = 53.,A,d);
//ceramic(Medical Physics, May 2000)
d = 2.88*g/cm3;
ceramic = new G4Material("allumina",d,2);
ceramic -> AddElement(elAl,2);
ceramic -> AddElement(elO,3);
G4double density = universe_mean_density;
G4double pressure = 3.e-18*pascal;
G4double temperature = 2.73*kelvin;
A=1.01*g/mole;
Vacuum = new G4Material("Galactic", Z = 1., A,
density,kStateGas,temperature,pressure);
//compact bone (http://www.NIST.gov)
d = 1.85*g/cm3;
bone = new G4Material("bone",d,8);
bone -> AddElement(elH,0.063984);
bone -> AddElement(elC,0.278);
bone -> AddElement(elN,0.027);
bone -> AddElement(elO,0.410016);
bone -> AddElement(elMg,0.002);
bone -> AddElement(elP,0.07);
bone -> AddElement(elS,0.002);
bone -> AddElement(elCa,0.147);
//muscle(http://www.NIST.gov)
muscle = new G4Material("muscle",d,9);
muscle -> AddElement(elH,0.101997);
muscle -> AddElement(elC,0.123);
muscle -> AddElement(elN,0.035);
muscle -> AddElement(elNa,0.0008);
muscle -> AddElement(elO,0.729);
muscle -> AddElement(elMg,0.0002);
muscle -> AddElement(elP,0.002);
muscle -> AddElement(elS,0.005);
muscle -> AddElement(elK,0.003);
}
G4Material* BrachyMaterial::GetMat(G4String material)
{
G4Material* pttoMaterial = G4Material::GetMaterial(material);
return pttoMaterial;
}
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// Code developed by: S.Guatelli
//
// ********************************
// * *
// * BrachyPhantomHit.cc *
// * *
// ********************************
//
// $Id: BrachyPhantomHit.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "BrachyPhantomHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
G4Allocator<BrachyPhantomHit> BrachyPhantomHitAllocator;
BrachyPhantomHit::BrachyPhantomHit(G4LogicalVolume* logVol,G4int XID,G4int YID,G4int ZID): logicalVolume(logVol),
xHitPosition(XID),
zHitPosition(ZID),
yHitPosition(YID)
{
energyDeposit = 0;
}
BrachyPhantomHit::~BrachyPhantomHit()
{
}
BrachyPhantomHit::BrachyPhantomHit(const BrachyPhantomHit &right)
: G4VHit()
{
xHitPosition = right.xHitPosition;
zHitPosition = right.zHitPosition;
yHitPosition = right.yHitPosition;
energyDeposit = right.energyDeposit;
hitPosition = right.hitPosition;
rotation = right.rotation;
logicalVolume = right.logicalVolume;
}
const BrachyPhantomHit& BrachyPhantomHit::operator=(const BrachyPhantomHit &right)
{
xHitPosition = right.xHitPosition;
zHitPosition = right.zHitPosition;
yHitPosition = right.yHitPosition;
energyDeposit = right.energyDeposit;
hitPosition = right.hitPosition;
rotation = right.rotation;
logicalVolume = right.logicalVolume;
return *this;
}
int BrachyPhantomHit::operator==(const BrachyPhantomHit &right) const
{
return((xHitPosition==right.xHitPosition)&&(zHitPosition==right.zHitPosition)&&(yHitPosition==right.yHitPosition));
}
void BrachyPhantomHit::Draw()
{
}
void BrachyPhantomHit::Print()
{
}
@@ -0,0 +1,185 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// Code developed by: S.Guatelli
//
// ************************************
// * *
// * BrachyPhantomROGeometry.cc *
// * *
// ************************************
//
// $Id: BrachyPhantomROGeometry.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "BrachyPhantomROGeometry.hh"
#include "BrachyDummySD.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4SubtractionSolid.hh"
#include "G4ThreeVector.hh"
#include "G4Material.hh"
BrachyPhantomROGeometry::BrachyPhantomROGeometry(G4String aString,
G4double phantomDimX,
G4double phantomDimZ,
G4int numberOfVoxelsX,
G4int numberOfVoxelsZ):
G4VReadOutGeometry(aString),
phantomDimensionX(phantomDimX),
phantomDimensionZ(phantomDimZ),
numberOfVoxelsAlongX(numberOfVoxelsX),
numberOfVoxelsAlongZ(numberOfVoxelsZ)
{
}
BrachyPhantomROGeometry::~BrachyPhantomROGeometry()
{
}
G4VPhysicalVolume* BrachyPhantomROGeometry::Build()
{
// A dummy material is used to fill the volumes of the readout geometry.
// (It will be allowed to set a NULL pointer in volumes of such virtual
// division in future, since this material is irrelevant for tracking.)
G4Material* dummyMat = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
G4double worldDimensionX = 4.0*m;
G4double worldDimensionY = 4.0*m;
G4double worldDimensionZ = 4.0*m;
G4double halfPhantomDimensionX = phantomDimensionX;
G4double halfPhantomDimensionZ = phantomDimensionZ;
G4double halfPhantomDimensionY = phantomDimensionX;
// variables for x division ...
G4double halfXVoxelDimensionX = halfPhantomDimensionX/numberOfVoxelsAlongX;
G4double halfXVoxelDimensionZ = halfPhantomDimensionZ;
G4double voxelXThickness = 2*halfXVoxelDimensionX;
// world volume of ROGeometry ...
G4Box *ROWorld = new G4Box("ROWorld",
worldDimensionX,
worldDimensionY,
worldDimensionZ);
G4LogicalVolume *ROWorldLog = new G4LogicalVolume(ROWorld,
dummyMat,
"ROWorldLog",
0,0,0);
G4VPhysicalVolume *ROWorldPhys = new G4PVPlacement(0,
G4ThreeVector(),
"ROWorldPhys",
ROWorldLog,
0,false,0);
// phantom ROGeometry ...
G4Box *ROPhantom = new G4Box("ROPhantom",
halfPhantomDimensionX,
halfPhantomDimensionY,
halfPhantomDimensionZ);
G4LogicalVolume *ROPhantomLog = new G4LogicalVolume(ROPhantom,
dummyMat,
"ROPhantomLog",
0,0,0);
G4VPhysicalVolume *ROPhantomPhys = new G4PVPlacement(0,
G4ThreeVector(),
"PhantomPhys",
ROPhantomLog,
ROWorldPhys,
false,0);
// ROGeomtry: Voxel division
// X division first...
G4Box *ROPhantomXDivision = new G4Box("ROPhantomXDivision",
halfXVoxelDimensionX,
halfXVoxelDimensionZ,
halfXVoxelDimensionZ);
G4LogicalVolume *ROPhantomXDivisionLog = new G4LogicalVolume(ROPhantomXDivision,
dummyMat,
"ROPhantomXDivisionLog",
0,0,0);
G4VPhysicalVolume *ROPhantomXDivisionPhys = new G4PVReplica("ROPhantomXDivisionPhys",
ROPhantomXDivisionLog,
ROPhantomPhys,
kXAxis,
numberOfVoxelsAlongX,
voxelXThickness);
// ...then Z division
G4Box *ROPhantomZDivision = new G4Box("ROPhantomZDivision",
halfXVoxelDimensionX,
halfXVoxelDimensionZ,
halfXVoxelDimensionX);
G4LogicalVolume *ROPhantomZDivisionLog = new G4LogicalVolume(ROPhantomZDivision,
dummyMat,
"ROPhantomZDivisionLog",
0,0,0);
G4VPhysicalVolume *ROPhantomZDivisionPhys = new G4PVReplica("ROPhantomZDivisionPhys",
ROPhantomZDivisionLog,
ROPhantomXDivisionPhys,
kZAxis,
numberOfVoxelsAlongZ,
voxelXThickness);
// ...then Y division
G4Box *ROPhantomYDivision = new G4Box("ROPhantomYDivision",
halfXVoxelDimensionX,
halfXVoxelDimensionX,
halfXVoxelDimensionX);
G4LogicalVolume *ROPhantomYDivisionLog = new G4LogicalVolume(ROPhantomYDivision,
dummyMat,
"ROPhantomYDivisionLog",
0,0,0);
ROPhantomYDivisionPhys = new G4PVReplica("ROPhantomYDivisionPhys",
ROPhantomYDivisionLog,
ROPhantomZDivisionPhys,
kYAxis,
numberOfVoxelsAlongZ,
voxelXThickness);
BrachyDummySD *dummySD = new BrachyDummySD;
ROPhantomYDivisionLog -> SetSensitiveDetector(dummySD);
return ROWorldPhys;
}
@@ -0,0 +1,120 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// Code developed by: S.Guatelli
//
// ********************************
// * *
// * BrachyPhantomSD.cc *
// * *
// ********************************
//
// $Id: BrachyPhantomSD.cc,v 1.3 2004/05/25 12:39:09 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "BrachyPhantomSD.hh"
#include "BrachyPhantomHit.hh"
#include "BrachyAnalysisManager.hh"
#include "BrachyDetectorConstruction.hh"
#include "G4Track.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4SDManager.hh"
#include "G4ParticleDefinition.hh"
BrachyPhantomSD::BrachyPhantomSD(G4String name, G4int NumVoxelX, G4int NumVoxelZ)
:G4VSensitiveDetector(name),numberOfVoxelsX(NumVoxelX),
numberOfVoxelsZ(NumVoxelZ)
{
}
BrachyPhantomSD::~BrachyPhantomSD()
{
}
void BrachyPhantomSD::Initialize(G4HCofThisEvent*)
{
}
G4bool BrachyPhantomSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
{
if(!ROhist)
return false;
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() != "PhantomPhys")
return false;
G4double energyDeposit = aStep -> GetTotalEnergyDeposit();
if(energyDeposit == 0.)
return false;
if(energyDeposit != 0)
{
#ifdef G4ANALYSIS_USE
// Read Voxel indexes: i is the x index, k is the z index
G4int k = ROhist -> GetReplicaNumber(1);
G4int i = ROhist -> GetReplicaNumber(2);
G4int j = ROhist -> GetReplicaNumber();
G4int numberOfVoxelZ = 300;
G4double voxelWidthZ = 1. *mm;
G4double x = (- numberOfVoxelZ+1+2*i)*voxelWidthZ/2;
G4double y = (- numberOfVoxelZ+1+2*j)*voxelWidthZ/2;
G4double z = (- numberOfVoxelZ+1+2*k)*voxelWidthZ/2;
BrachyAnalysisManager* analysis =
BrachyAnalysisManager::getInstance();
if (y < 0.8*mm && y > -0.8*mm)
{
analysis -> FillHistogramWithEnergy(x,z,energyDeposit/MeV);
if (z < 0.8*mm && z > -0.8*mm)
analysis -> DoseDistribution(x,energyDeposit/MeV);
}
#endif
}
return true;
}
void BrachyPhantomSD::EndOfEvent(G4HCofThisEvent*)
{
}
void BrachyPhantomSD::clear()
{
}
void BrachyPhantomSD::DrawAll()
{
}
void BrachyPhantomSD::PrintAll()
{
}
@@ -0,0 +1,159 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// Code developed by: S.Guatelli
//
// **********************************
// * *
// * BrachyPhysicsList.cc *
// * *
// **********************************
//
// $Id: BrachyPhysicsList.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "BrachyPhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
BrachyPhysicsList::BrachyPhysicsList(): G4VUserPhysicsList()
{
defaultCutValue = 0.1*mm;
cutForGamma = defaultCutValue;
cutForElectron = defaultCutValue;
cutForPositron = defaultCutValue;
SetVerboseLevel(1);
}
BrachyPhysicsList::~BrachyPhysicsList()
{
}
void BrachyPhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
// This ensures that objects of these particle types will be
// created in the program.
ConstructBosons();
ConstructLeptons();
}
void BrachyPhysicsList::ConstructBosons()
{
// gamma
G4Gamma::GammaDefinition();
}
void BrachyPhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
}
void BrachyPhysicsList::ConstructProcess()
{
AddTransportation();
ConstructEM();
}
#include "G4MultipleScattering.hh"
// gamma
#include "G4LowEnergyRayleigh.hh"
#include "G4LowEnergyPhotoElectric.hh"
#include "G4LowEnergyCompton.hh"
#include "G4LowEnergyGammaConversion.hh"
// e-
#include "G4LowEnergyIonisation.hh"
#include "G4LowEnergyBremsstrahlung.hh"
// e+
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
void BrachyPhysicsList::ConstructEM()
{
theParticleIterator -> reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator -> value();
G4ProcessManager* pmanager = particle -> GetProcessManager();
G4String particleName = particle -> GetParticleName();
//processes
if (particleName == "gamma") {
//gamma
lowePhot = new G4LowEnergyPhotoElectric("LowEnPhotoElec");
pmanager -> AddDiscreteProcess(new G4LowEnergyRayleigh);
pmanager -> AddDiscreteProcess(lowePhot);
pmanager -> AddDiscreteProcess(new G4LowEnergyCompton);
pmanager -> AddDiscreteProcess(new G4LowEnergyGammaConversion);
} else if (particleName == "e-") {
//electron
loweIon = new G4LowEnergyIonisation("LowEnergyIoni");
loweBrem = new G4LowEnergyBremsstrahlung("LowEnBrem");
loweBrem -> SetAngularGenerator("tsai");
pmanager -> AddProcess(new G4MultipleScattering, -1, 1,1);
pmanager -> AddProcess(loweIon, -1, 2,2);
pmanager -> AddProcess(loweBrem, -1,-1,3);
} else if (particleName == "e+") {
//positron
pmanager -> AddProcess(new G4MultipleScattering, -1, 1,1);
pmanager -> AddProcess(new G4eIonisation, -1, 2,2);
pmanager -> AddProcess(new G4eBremsstrahlung, -1,-1,3);
pmanager -> AddProcess(new G4eplusAnnihilation, 0,-1,4);
}
}
}
void BrachyPhysicsList::SetCuts()
{
if (verboseLevel >0){
G4cout << "BrachyPhysicsList::SetCuts:";
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
}
SetCutValue(cutForGamma, "gamma");
SetCutValue(cutForElectron, "e-");
SetCutValue(cutForPositron, "e+");
if (verboseLevel>0) DumpCutValuesTable();
}
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
// --------------------------------------------------------------
//
// Code developed by:
// S.Guatelli
//
// ********************************************
// * *
// * BrachyPrimaryGeneratorAction.cc *
// * *
// ********************************************
//
// $Id: BrachyPrimaryGeneratorAction.cc,v 1.1 2004/05/25 07:32:37 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "globals.hh"
#include "BrachyPrimaryGeneratorAction.hh"
#include "BrachyAnalysisManager.hh"
#include "G4ParticleTable.hh"
#include "Randomize.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4IonTable.hh"
#include "G4UImanager.hh"
#include "G4RunManager.hh"
BrachyPrimaryGeneratorAction::BrachyPrimaryGeneratorAction()
{;}
BrachyPrimaryGeneratorAction::~BrachyPrimaryGeneratorAction()
{;}
void BrachyPrimaryGeneratorAction::GeneratePrimaries(G4Event*)
{;}
@@ -0,0 +1,144 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
// --------------------------------------------------------------
//
// Code developed by: S.Guatelli
//
// ********************************************
// * *
// * BrachyPrimaryGeneratorActionI.cc *
// * *
// ********************************************
//
// $Id: BrachyPrimaryGeneratorActionI.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "BrachyPrimaryGeneratorActionI.hh"
#ifdef G4ANALYSIS_USE
#include "BrachyAnalysisManager.hh"
#endif
#include "globals.hh"
#include "G4ParticleTable.hh"
#include "Randomize.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4IonTable.hh"
#include "G4UImanager.hh"
#include "G4RunManager.hh"
BrachyPrimaryGeneratorActionI::BrachyPrimaryGeneratorActionI()
{
G4int numberParticles = 1;
particleGun = new G4ParticleGun(numberParticles);
// Gamma energy spectrum ...
energySpectrum.push_back(0.783913);
energySpectrum.push_back(0.170416);
energySpectrum.push_back(0.045671);
}
BrachyPrimaryGeneratorActionI::~BrachyPrimaryGeneratorActionI()
{
if(particleGun)
delete particleGun;
}
void BrachyPrimaryGeneratorActionI::GeneratePrimaries(G4Event* anEvent)
{
#ifdef G4ANALYSIS_USE
BrachyAnalysisManager* analysis = BrachyAnalysisManager::getInstance();
#endif
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String ParticleName = "gamma";
G4ParticleDefinition* particle = particleTable -> FindParticle(ParticleName);
particleGun->SetParticleDefinition(particle);
// Random generation of gamma source point inside the Iodium core ...
G4double x,y,z;
G4double radiuMax = 0.30*mm;
G4double radiusMin = 0.085*mm;
do{
x = (G4UniformRand()-0.5)*(radiuMax)/0.5;
y = (G4UniformRand()-0.5)*(radiuMax)/0.5;
}while(((x*x+y*y )> (radiuMax*radiuMax))||((x*x+y*y)<(radiusMin*radiusMin)));
z = (G4UniformRand()-0.5)*1.75*mm/0.5 ;
G4ThreeVector position(x,y,z);
particleGun -> SetParticlePosition(position);
// Random generation of the impulse direction of primary particles ...
G4double a,b,c;
G4double n;
do{
a = (G4UniformRand()-0.5)/0.5;
b = (G4UniformRand()-0.5)/0.5;
c = (G4UniformRand()-0.5)/0.5;
n = a*a+b*b+c*c;
}while(n > 1 || n == 0.0);
n = sqrt(n);
a /= n;
b /= n;
c /= n;
G4ThreeVector direction(a,b,c);
particleGun -> SetParticleMomentumDirection(direction);
G4double random = G4UniformRand();
G4double sum = 0;
G4int i = 0;
while(sum<random){sum+=energySpectrum[i];
i++;}
// energy spectrum
if(i==1){primaryParticleEnergy = 27.4*keV;}
else{
if(i==2){primaryParticleEnergy = 31.4*keV;}
else {primaryParticleEnergy = 35.5*keV;}
}
particleGun -> SetParticleEnergy(primaryParticleEnergy);
// Fill 1D histogram with gamma energy spectrum ...
#ifdef G4ANALYSIS_USE
analysis -> PrimaryParticleEnergySpectrum(primaryParticleEnergy);
#endif
// generate primary particle
particleGun -> GeneratePrimaryVertex(anEvent);
}
G4double BrachyPrimaryGeneratorActionI::GetEnergy()
{
return primaryParticleEnergy;
}
@@ -0,0 +1,115 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
// --------------------------------------------------------------
//
// Code developed by: S.Guatelli
//
// ********************************************
// * *
// * BrachyPrimaryGeneratorActionIr.cc *
// * *
// ********************************************
//
// $Id: BrachyPrimaryGeneratorActionIr.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "BrachyPrimaryGeneratorActionIr.hh"
#ifdef G4ANALYSIS_USE
#include "BrachyAnalysisManager.hh"
#endif
#include "globals.hh"
#include "G4ParticleTable.hh"
#include "Randomize.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4IonTable.hh"
#include "G4UImanager.hh"
#include "G4RunManager.hh"
BrachyPrimaryGeneratorActionIr::BrachyPrimaryGeneratorActionIr()
{
G4int NumParticles = 1;
particleGun = new G4ParticleGun(NumParticles);
}
BrachyPrimaryGeneratorActionIr::~BrachyPrimaryGeneratorActionIr()
{
if(particleGun)
delete particleGun;
}
void BrachyPrimaryGeneratorActionIr::GeneratePrimaries(G4Event* anEvent)
{
#ifdef G4ANALYSIS_USE
BrachyAnalysisManager* analysis = BrachyAnalysisManager::getInstance();
#endif
G4ParticleTable* pParticleTable = G4ParticleTable::GetParticleTable();
G4String ParticleName = "gamma";
G4ParticleDefinition* pParticle = pParticleTable->FindParticle(ParticleName);
particleGun->SetParticleDefinition(pParticle);
// Random generation of gamma source point inside the Iodium core
G4double x,y,z;
G4double radius = 0.30*mm;
do{
x = (G4UniformRand()-0.5)*(radius)/0.5;
y = (G4UniformRand()-0.5)*(radius)/0.5;
}while(x*x+y*y > radius*radius);
z = (G4UniformRand()-0.5)*1.75*mm/0.5 -1.975*mm ;
G4ThreeVector position(x,y,z);
particleGun->SetParticlePosition(position);
// Random generation of the impulse direction
G4double a,b,c;
G4double n;
do{
a = (G4UniformRand()-0.5)/0.5;
b = (G4UniformRand()-0.5)/0.5;
c = (G4UniformRand()-0.5)/0.5;
n = a*a+b*b+c*c;
}while(n > 1 || n == 0.0);
n = sqrt(n);
a /= n;
b /= n;
c /= n;
G4ThreeVector direction(a,b,c);
particleGun -> SetParticleMomentumDirection(direction);
primaryParticleEnergy = 356*keV;
particleGun -> SetParticleEnergy(primaryParticleEnergy);
//1D Histogram of primary particle energy ...
#ifdef G4ANALYSIS_USE
analysis -> PrimaryParticleEnergySpectrum(primaryParticleEnergy);
#endif
particleGun -> GeneratePrimaryVertex(anEvent);
}
@@ -0,0 +1,118 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
// --------------------------------------------------------------
//
// Code developed by:
// S.Guatelli
//
//
// *******************************
// * *
// * BrachyRunAction.cc *
// * *
// *******************************
//
// $Id: BrachyRunAction.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "BrachyRunAction.hh"
#include "BrachyEventAction.hh"
#ifdef G4ANALYSIS_USE
#include "BrachyAnalysisManager.hh"
#endif
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "BrachyDetectorConstruction.hh"
#include "BrachyRunMessenger.hh"
#include "G4SDManager.hh"
#include "G4Timer.hh"
#include "BrachyFactoryIr.hh"
#include "BrachyFactoryI.hh"
#include "BrachyFactory.hh"
#include "BrachyRunAction.hh"
BrachyRunAction::BrachyRunAction()
{
runMessenger = new BrachyRunMessenger(this);
}
BrachyRunAction::~BrachyRunAction()
{
delete runMessenger;
}
void BrachyRunAction::BeginOfRunAction(const G4Run*)
{
#ifdef G4ANALYSIS_USE
BrachyAnalysisManager* analysis = BrachyAnalysisManager::getInstance();
analysis -> book();
#endif
G4RunManager* runManager = G4RunManager::GetRunManager();
if(runManager)
{ switch(sourceChoice)
{
case 1:
factory = new BrachyFactoryI;
break;
default:
factory = new BrachyFactoryIr;
}
G4VUserPrimaryGeneratorAction* sourcePrimaryParicle =
factory -> CreatePrimaryGeneratorAction();
if(sourcePrimaryParicle) runManager -> SetUserAction(sourcePrimaryParicle);
}
}
void BrachyRunAction::SelectEnergy(G4int choice)
{
sourceChoice = choice;
if (sourceChoice == 1) factory = new BrachyFactoryI;
else factory = new BrachyFactoryIr;
}
void BrachyRunAction::EndOfRunAction(const G4Run* aRun)
{
#ifdef G4ANALYSIS_USE
BrachyAnalysisManager* analysis = BrachyAnalysisManager::getInstance();
#endif
G4cout << "number of event = " << aRun -> GetNumberOfEvent() << G4endl;
#ifdef G4ANALYSIS_USE
analysis -> finish();
#endif
delete factory;
}
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli
//
// $Id: BrachyRunMessenger.cc,v 1.2 2004/05/25 08:36:18 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//
// *******************************
// * *
// * BrachyRunMessenger.cc *
// * *
// *******************************
#include "BrachyRunMessenger.hh"
#include "BrachyRunAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
BrachyRunMessenger::BrachyRunMessenger( BrachyRunAction* pBrachyRun):
runManager(pBrachyRun)
{
runDir = new G4UIdirectory("/run/");
runDir -> SetGuidance("Control gamma energy spectrum.");
primaryParticleEnergySpectrumCmd =
new G4UIcmdWithAString("/run/energy",this);
primaryParticleEnergySpectrumCmd -> SetGuidance("Select the energy of gamma emitted by the source.");
primaryParticleEnergySpectrumCmd -> SetGuidance(" Iodium: Iodium Source ");
primaryParticleEnergySpectrumCmd -> SetGuidance(" Iridium: Iridium Source " );
primaryParticleEnergySpectrumCmd -> SetParameterName("choice",true);
primaryParticleEnergySpectrumCmd -> SetDefaultValue("Iridium");
primaryParticleEnergySpectrumCmd -> SetCandidates("Iridium / Iodium");
primaryParticleEnergySpectrumCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
}
BrachyRunMessenger::~BrachyRunMessenger()
{
delete primaryParticleEnergySpectrumCmd;
delete runDir;
}
void BrachyRunMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if(command == primaryParticleEnergySpectrumCmd)
{
if (newValue == "Iodium") runManager -> SelectEnergy(1);
else runManager -> SelectEnergy(0);
}
}
@@ -0,0 +1,151 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: BrachySimulation.cc
// GEANT4 tag $Name: geant4-06-02 $
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
// --------------------------------------------------------------
//
// Code developed by: S.Guatelli, K. Moscicki
//
//
// *******************************
// * *
// * BrachySimualtion.cc *
// * *
// *******************************
//
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "BrachyFactoryIr.hh"
#ifdef G4UI_USE_XM
#include "G4UIXm.hh"
#endif
#ifdef G4VIS_USE
#include "BrachyVisManager.hh"
#endif
#include "BrachyEventAction.hh"
#include "BrachyDetectorConstruction.hh"
#include "BrachyPhysicsList.hh"
#include "BrachyPhantomSD.hh"
#include "BrachyPrimaryGeneratorActionIr.hh"
#include "G4SDManager.hh"
#include "BrachyRunAction.hh"
#include "Randomize.hh"
#include "G4RunManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4UImessenger.hh"
#include "BrachySimulation.hh"
BrachySimulation::BrachySimulation(G4int sd)
{
pRunManager = 0;
seed = sd;
}
BrachySimulation::~BrachySimulation()
{ }
void BrachySimulation::setSeed(G4int sd)
{
seed = sd;
HepRandom ::setTheSeed(seed);
}
G4bool BrachySimulation::initialize(int ,char** )
{
HepRandom::setTheEngine(new RanecuEngine);
G4cout << "G4 initializing" << G4endl;
pRunManager = new G4RunManager;
G4String sensitiveDetectorName = "Phantom";
BrachyDetectorConstruction *pDetectorConstruction = new BrachyDetectorConstruction(sensitiveDetectorName);
pRunManager -> SetUserInitialization(pDetectorConstruction);
pRunManager -> SetUserInitialization(new BrachyPhysicsList);
// output environment variables:
#ifdef G4ANALYSIS_USE
G4cout << G4endl << G4endl << G4endl
<< " User Environment " << G4endl
<< " Using AIDA 3.2.1 analysis " << G4endl;
# else
G4cout << G4endl << G4endl << G4endl
<< " User Environment " << G4endl
<< " G4ANALYSIS_USE environment variable not set, NO ANALYSIS "
<< G4endl;
#endif
BrachyEventAction *pEventAction = new BrachyEventAction();
pRunManager -> SetUserAction(pEventAction );
BrachyRunAction *pRunAction = new BrachyRunAction();
pRunManager -> SetUserAction(pRunAction);
//Initialize G4 kernel
pRunManager -> Initialize();
return true;
}
void BrachySimulation::executeMacro(std::string macroFileName)
{
G4UImanager* UI = G4UImanager::GetUIpointer();
// Batch mode
std::string fileName = macroFileName;
G4cout << fileName << " <---------- in batch -----------------" << G4endl;
G4cout << macroFileName << " executed"<<G4endl;
std::string command = "/control/execute ";
if(!UI)
G4cout << "FATAL ERROR: UI pointer does not exist" << G4endl;
else
UI -> ApplyCommand(command+fileName);
}
std::string BrachySimulation::getOutputFilename()
{
return "brachytherapy.xml";
}
void BrachySimulation::finish()
{
delete pRunManager;
}
//// This is all the application needs to run in parallel mode through DIANE
extern "C"
DIANE::IG4Simulation* createG4Simulation(int seed)
{return new BrachySimulation(seed); }
///////////
@@ -0,0 +1,151 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
//
// *******************************
// * *
// * BrachyVisManager.cc *
// * *
// *******************************
//
// $Id: BrachyVisManager.cc,v 1.1 2004/05/25 07:32:37 guatelli Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#ifdef G4VIS_USE
#include "BrachyVisManager.hh"
// Supported drivers...
#ifdef G4VIS_USE_DAWN
#include "G4FukuiRenderer.hh"
#endif
#ifdef G4VIS_USE_DAWNFILE
#include "G4DAWNFILE.hh"
#endif
#ifdef G4VIS_USE_OPENGLX
#include "G4OpenGLImmediateX.hh"
#include "G4OpenGLStoredX.hh"
#endif
#ifdef G4VIS_USE_OPENGLWIN32
#include "G4OpenGLImmediateWin32.hh"
#include "G4OpenGLStoredWin32.hh"
#endif
#ifdef G4VIS_USE_OPENGLXM
#include "G4OpenGLImmediateXm.hh"
#include "G4OpenGLStoredXm.hh"
#endif
#ifdef G4VIS_USE_OIX
#include "G4OpenInventorX.hh"
#endif
#ifdef G4VIS_USE_OIWIN32
#include "G4OpenInventorWin32.hh"
#endif
#ifdef G4VIS_USE_VRML
#include "G4VRML1.hh"
#include "G4VRML2.hh"
#endif
#ifdef G4VIS_USE_VRMLFILE
#include "G4VRML1File.hh"
#include "G4VRML2File.hh"
#endif
#ifdef G4VIS_USE_RAYTRACER
#include "G4RayTracer.hh"
#endif
BrachyVisManager::BrachyVisManager ()
{}
void BrachyVisManager::RegisterGraphicsSystems ()
{
#ifdef G4VIS_USE_DAWN
RegisterGraphicsSystem (new G4FukuiRenderer);
#endif
#ifdef G4VIS_USE_DAWNFILE
RegisterGraphicsSystem (new G4DAWNFILE);
#endif
#ifdef G4VIS_USE_OPENGLX
RegisterGraphicsSystem (new G4OpenGLImmediateX);
RegisterGraphicsSystem (new G4OpenGLStoredX);
#endif
#ifdef G4VIS_USE_OPENGLWIN32
RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
RegisterGraphicsSystem (new G4OpenGLStoredWin32);
#endif
#ifdef G4VIS_USE_OPENGLXM
RegisterGraphicsSystem (new G4OpenGLImmediateXm);
RegisterGraphicsSystem (new G4OpenGLStoredXm);
#endif
#ifdef G4VIS_USE_OIX
RegisterGraphicsSystem (new G4OpenInventorX);
#endif
#ifdef G4VIS_USE_OIWIN32
RegisterGraphicsSystem (new G4OpenInventorWin32);
#endif
#ifdef G4VIS_USE_VRML
RegisterGraphicsSystem (new G4VRML1);
RegisterGraphicsSystem (new G4VRML2);
#endif
#ifdef G4VIS_USE_VRMLFILE
RegisterGraphicsSystem (new G4VRML1File);
RegisterGraphicsSystem (new G4VRML2File);
#endif
#ifdef G4VIS_USE_RAYTRACER
RegisterGraphicsSystem (new G4RayTracer);
#endif
if (fVerbose > 0) {
G4cout <<
"\nYou have successfully chosen to use the following graphics systems."
<< G4endl;
PrintAvailableGraphicsSystems ();
}
}
#endif
+5 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.4 2003/12/03 14:15:02 gcosmo Exp $
$Id: History,v 1.5 2004/06/21 09:46:23 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -15,6 +15,10 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
June 20th, 2004 G.Cooperman
----------------------------
- Fixed bug in ParRunManager class, showing up with Geant4 6.1.
Dec 2nd, 2003 G.Cosmo
----------------------
- Brought up-to-date classes from exampleN02.
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: ParRunManager.cc,v 1.5 2003/06/16 16:49:34 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: ParRunManager.cc,v 1.6 2004/06/19 20:50:42 cooperma Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// --------------------------------------------------------------------
// Parallel Library for Geant4
@@ -168,7 +168,8 @@ TOPC_BUF ParRunManager::DoEvent( void *input_buf )
ParMarshaledRandomState buf = ParMarshaledRandomState( input_buf );
buf.unmarshalEventIDandSetState( i_event );
stateManager->SetNewState(G4State_EventProc);
// removed for Geant4.6
// stateManager->SetNewState(G4State_EventProc);
currentEvent = GenerateEvent(i_event);
@@ -184,7 +185,11 @@ TOPC_ACTION ParRunManager::CheckEventResult( void * input_buf, void *output_buf
MarshaledObj buf = MarshaledObj(input_buf);
buf.Unmarshal(i_event);
stateManager->SetNewState(G4State_EventProc);
// removed for Geant4.6
//stateManager->SetNewState(G4State_EventProc);
// Geant4.6 requires the state to be G4State_GeomClosed
// before calling EventManager::ProcessOneEvent(..)
if(!userPrimaryGeneratorAction)
{
G4Exception
@@ -201,6 +206,7 @@ TOPC_ACTION ParRunManager::CheckEventResult( void * input_buf, void *output_buf
// When Geant4 4.0 sees empty event, it still calls userStackingAction.
// On master, only trivial events exist, so we delete userStackingAction
SetUserAction( (G4UserStackingAction*)NULL );
eventManager->ProcessOneEvent(currentEvent); // Processing the trivial event
// Called with output_buf and no size, creates object for unmarshaling
+5 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.3 2003/12/03 14:28:03 gcosmo Exp $
$Id: History,v 1.4 2004/06/21 09:46:23 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -15,6 +15,10 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
June 20th, 2004 G.Cooperman
----------------------------
- Fixed bug in ParRunManager class, showing up with Geant4 6.1.
December 2nd, 2003 G.Cosmo
---------------------------
- Brought classes up-to-date with exampleN04.
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: ParRunManager.cc,v 1.5 2003/06/16 16:49:43 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: ParRunManager.cc,v 1.6 2004/06/19 20:51:09 cooperma Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// --------------------------------------------------------------------
// Parallel Library for Geant4
@@ -70,7 +70,7 @@ G4StateManager* ParRunManager::stateManager;
G4int ParRunManager::n_event;
G4int ParRunManager::n_select;
G4String ParRunManager::msg;
ParRunManager* ParRunManager::myRunManager = 0;
ParRunManager* ParRunManager::myRunManager = NULL;
// TOP-C callbacks (static functions)
// If this->*(&ParRunManager::GenerateEventInput), created a thunk,
@@ -101,7 +101,7 @@ void ParRunManager::DoEventLoop(G4int n_event,const char* macroFile,G4int n_sele
{ timer->Start(); }
G4String msg;
if(macroFile!=0)
if(macroFile!=NULL)
{
if(n_select<0) n_select = n_event;
msg = "/control/execute ";
@@ -122,7 +122,7 @@ void ParRunManager::DoEventLoop(G4int n_event,const char* macroFile,G4int n_sele
if ( eventManager->GetUserEventAction() )
{
origUserEventAction = eventManager->GetUserEventAction();
SetUserAction( (G4UserEventAction *)0 );
SetUserAction( (G4UserEventAction *)NULL );
}
// Make these variables accessible to TOP-C callback functions
@@ -130,7 +130,7 @@ void ParRunManager::DoEventLoop(G4int n_event,const char* macroFile,G4int n_sele
// This is where all the parallelism occurs
i_event = -1; // ParRunManager::GenerateEventInput() will increment this.
TOPC_master_slave(MyGenerateEventInput, MyDoEvent, MyCheckEventResult, 0);
TOPC_master_slave(MyGenerateEventInput, MyDoEvent, MyCheckEventResult, NULL);
if(verboseLevel>0)
{
@@ -168,7 +168,8 @@ TOPC_BUF ParRunManager::DoEvent( void *input_buf )
ParMarshaledRandomState buf = ParMarshaledRandomState( input_buf );
buf.unmarshalEventIDandSetState( i_event );
stateManager->SetNewState(G4State_EventProc);
// removed for Geant4.6
// stateManager->SetNewState(G4State_EventProc);
currentEvent = GenerateEvent(i_event);
@@ -184,7 +185,11 @@ TOPC_ACTION ParRunManager::CheckEventResult( void * input_buf, void *output_buf
MarshaledObj buf = MarshaledObj(input_buf);
buf.Unmarshal(i_event);
stateManager->SetNewState(G4State_EventProc);
// removed for Geant4.6
//stateManager->SetNewState(G4State_EventProc);
// Geant4.6 requires the state to be G4State_GeomClosed
// before calling EventManager::ProcessOneEvent(..)
if(!userPrimaryGeneratorAction)
{
G4Exception
@@ -200,7 +205,8 @@ TOPC_ACTION ParRunManager::CheckEventResult( void * input_buf, void *output_buf
// When Geant4 4.0 sees empty event, it still calls userStackingAction.
// On master, only trivial events exist, so we delete userStackingAction
SetUserAction( (G4UserStackingAction*)0 );
SetUserAction( (G4UserStackingAction*)NULL );
eventManager->ProcessOneEvent(currentEvent); // Processing the trivial event
// Called with output_buf and no size, creates object for unmarshaling
@@ -217,7 +223,7 @@ TOPC_ACTION ParRunManager::CheckEventResult( void * input_buf, void *output_buf
if(i_event<n_select) G4UImanager::GetUIpointer()->ApplyCommand(msg);
stateManager->SetNewState(G4State_GeomClosed);
StackPreviousEvent(currentEvent);
currentEvent = 0;
currentEvent = NULL;
// Move this to GenerateEventInput:
// if(runAborted) break;
return NO_ACTION;
+14
View File
@@ -0,0 +1,14 @@
Examples for event parallelism
------------------------------
This directory includes example applications to demonstrate the usage of
different techniques for achieving event parallelism with Geant4.
- ParN02 and ParN04 are modified versions of the novice examples N02 and N04
adapted to be run together with the TOP-C communication layer application
on either a cluster of systems or multi-processor machines.
- ExDiane is a simplified version of the advanced application "brachytherapy"
showing how to run Geant4 in a parallel mode using DIANE (DIstributed
ANalysis Environment).