Import Geant4 5.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:57:27 +02:00
parent 330b82b769
commit 37fff30d2e
5733 changed files with 263867 additions and 74574 deletions
@@ -1,5 +1,38 @@
//
// ********************************************************************
// * 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.9 2002/12/12 19:16:18 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#ifdef G4ANALYSIS_USE
#include <stdlib.h>
#include "g4std/fstream"
#include "BrachyAnalysisManager.hh"
@@ -25,20 +58,19 @@ BrachyAnalysisManager::BrachyAnalysisManager() :
{
//build up the factories
aFact = AIDA_createAnalysisFactory();
aFact = AIDA_createAnalysisFactory();
ITreeFactory * treeFact = aFact->createTreeFactory();
AIDA::ITreeFactory *treeFact = aFact->createTreeFactory();
//parameters for the TreeFactory
bool fileExists = false;
bool readOnly = false;
std::string fileName="Brachy3.hbk";
theTree = treeFact->create(fileName, readOnly, fileExists, "hbook");
//parameters for the TreeFactory
std::string fileName="brachytherapy.hbk";
theTree = treeFact->create(fileName,"hbook",false, true);
delete treeFact;
//HistoFactory and TupleFactory depend on theTree
histFact = aFact->createHistogramFactory( *theTree );
tupFact = aFact->createTupleFactory ( *theTree );
@@ -51,7 +83,7 @@ BrachyAnalysisManager::~BrachyAnalysisManager()
delete tupFact;
tupFact=0;
delete histFact;
delete histFact;
histFact=0;
delete theTree;
@@ -71,71 +103,53 @@ BrachyAnalysisManager* BrachyAnalysisManager::getInstance()
void BrachyAnalysisManager::book()
{
h1 = histFact->createHistogram2D("10","Energy, pos",300 ,-150.,150.,300,-150.,150.);
// histograms and ntuple are managed by theTree
// h2 e h3 are not necessary ,useful for:check for non-zero
//you could do histFact->create2D("20","Energy, pos",300 ,-150.,150.,300,-15 //0.,150.);
IHistogram2D *h2 = histFact->create2D("20","Energy, pos",300 ,-150.,150.,300,-150.,150.);
// check for non-zero
h2= histFact->createHistogram1D("20","Initial Energy", 100,0.,4.);
IHistogram1D *h3 = histFact->create1D("30","Initial Energy", 100,0.,1.);
// check for non-zero
//Ntuple management
std::string columnNames = "float energy, float x, float z";
std::string options = "";
ITuple *tup = tupFact->create("1","brachy",columnNames, options);
// check for non-zero ...
if (tup) G4cout<<"The Ntuple is non-zero"<<G4endl;
std::string columnNames = "float energy, float x,float y, float z";
std::string options = "";
if (tupFact) ntuple = tupFact->create("1","1",columnNames, options);
// check for non-zero ...
if (ntuple) G4cout<<"The Ntuple is non-zero"<<G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyAnalysisManager::analyse(G4double xx,G4double zz,G4float en)
void BrachyAnalysisManager::fill_Tuple(G4double xx,G4double yy, G4double zz,G4float en)
{
ITuple * ntuple = dynamic_cast<ITuple *> ( theTree->find("1") );
//ntuple = dynamic_cast<ITuple *> ( theTree->find("1") );
if (ntuple == 0) {
cout << "AAAAAAAGH" << endl;
return;
}
ntuple->fill(1, en);// fill ( int column, double value )
ntuple->fill(2, xx);
ntuple->fill(3, zz);
ntuple->fill(3, yy);
ntuple->fill(4, zz);
// alternatively(if all the columns are of the same type):
// std::vector<float> row;
// row.push_back(en);
// row.push_back(xx);
// row.push_back(zz);
// ntuple->fill(row);
// write Ntuple-row to file
// Should be called after fill is called for the columns.
// Unfilled columns will be filled with the default value for that column.
ntuple->addRow();
}
void BrachyAnalysisManager::hist(G4double x,G4double z, G4float enn)
{
IHistogram2D* h2 = dynamic_cast<IHistogram2D *> ( theTree->find("20") );
h2->fill(x,z,enn);
h1->fill(x,z,enn);
}
void BrachyAnalysisManager::Spectrum(G4double Init_En)
{
IHistogram1D* h3 = dynamic_cast<IHistogram1D *> ( theTree->find("30") );
h3->fill(Init_En);
{
h2->fill(Init_En);
}
void BrachyAnalysisManager::finish()
{
// write all histograms to file
@@ -145,7 +159,7 @@ void BrachyAnalysisManager::finish()
theTree->close();
}
#endif
@@ -1,9 +1,44 @@
//
// ********************************************************************
// * 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. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
//
//
// ****************************************
// * *
// * BrachyDetectorConstruction.cc *
// * *
// ****************************************
//
// $Id: BrachyDetectorConstruction.cc,v 1.13 2002/12/12 19:16:18 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "BrachyPhantomROGeometry.hh"
#include "BrachyPhantomSD.hh"
#include "BrachyDetectorMessenger.hh"
@@ -23,8 +58,8 @@
#include "G4PVPlacement.hh"
#include "globals.hh"
#include "G4MaterialTable.hh"
#include "Randomize.hh"
#include "G4RunManager.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4PVParameterised.hh"
@@ -38,386 +73,258 @@
#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):
NumVoxelX(0),NumVoxelZ(0),m_BoxDimX(0), m_BoxDimY(0), m_BoxDimZ(0),
ExpHall(0),ExpHallLog(0),ExpHallPhys(0),
Phantom(0), PhantomLog(0), PhantomPhys(0),
Capsule(0),CapsuleLog(0),CapsulePhys(0),
CapsuleTip(0),CapsuleTipLog(0),CapsuleTipPhys(0),
IridiumCore(0),IridiumCoreLog(0),IridiumCorePhys(0)
NumVoxelX(0),NumVoxelZ(0),m_BoxDimX(0), m_BoxDimY(0), m_BoxDimZ(0),
ExpHall(0),ExpHallLog(0),ExpHallPhys(0),
Phantom(0), PhantomLog (0), PhantomPhys (0),
detectorChoice(0)
{
NumVoxelX=300;
NumVoxelZ=300;
NumVoxelX=300;
NumVoxelZ=300;
m_BoxDimX=30*cm ;
m_BoxDimY=30*cm;
m_BoxDimZ=30*cm;
m_BoxDimX=30*cm ;
m_BoxDimY=30*cm;
m_BoxDimZ=30*cm;
ComputeDimVoxel();
ComputeDimVoxel();
m_SDName = SDName;//pointer to sensitive detector
// create commands for interactive definition of the calorimeter
detectorMessenger = new BrachyDetectorMessenger(this);
ExpHall_x = 4.0*m;
ExpHall_y = 4.0*m;
ExpHall_z = 4.0*m;
m_SDName = SDName;
m_SDName = SDName;//pointer to sensitive detector
detectorMessenger = new BrachyDetectorMessenger(this);
G4Colour white (1.0, 1.0, 1.0) ;
G4Colour grey (0.5, 0.5, 0.5) ;
G4Colour lgrey (.75, .75, .75) ;
G4Colour red (1.0, 0.0, 0.0) ;
G4Colour blue (0.0, 0.0, 1.0) ;
G4Colour cyan (0.0, 1.0, 1.0) ;
G4Colour magenta (1.0, 0.0, 1.0) ;
G4Colour yellow (1.0, 1.0, 0.0) ;
G4Colour lblue (0.0, 0.0, .75);
factoryIr=new BrachyFactoryIr();
pMat= new BrachyMaterial();
}
//....
BrachyDetectorConstruction::~BrachyDetectorConstruction()
{
delete detectorMessenger;
delete pMat;
if (factoryLeipzig) delete factoryLeipzig;
if (factoryI) delete factoryI;
delete factoryIr;
}
//....
G4VPhysicalVolume* BrachyDetectorConstruction::Construct()
{
DefineMaterials();
return ConstructDetector();
}
{ pMat-> DefineMaterials();
void BrachyDetectorConstruction::DefineMaterials()
if (ExpHallPhys==0)
{
// Define required materials
ConstructPhantom(); }
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);
switch(detectorChoice)
{
case 1:
factoryI=new BrachyFactoryI();
factoryI->CreateSource(PhantomPhys);
A = 16.00*g/mole;
G4Element* elO = new G4Element("Oxygen","O",Z=8.,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);
break;
// Elements for source capsule and cable
case 2:
factoryLeipzig=new BrachyFactoryLeipzig();
factoryLeipzig->CreateSource(PhantomPhys);
break;
A=65.38*g/mole;
G4Element* elZn=new G4Element("Zinc","Zn",Z=30.,A);
A=26.98*g/mole;
G4Element* elAl=new G4Element("Aluminum","Al", Z=13.,A);
case 3:
factoryIr->CreateSource(PhantomPhys);
break;
default:
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);
// Lead material
A = 207.19*g/mole;
Z = 82;
d = 11.35*g/cm3;
G4Material* 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;
G4Material* matIr192 = new G4Material("Iridium",Z,A,d);
//titanium
A=47.88*g/mole;
d=4.50*g/cm3;
G4Material* 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;
G4Material* matH2O = new G4Material("Water",d,2);
matH2O->AddElement(elH,2);
matH2O->AddElement(elO,1);
//soft tissue(NIST data)
d=1.0*g/cm3;
G4Material* 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 ;
G4Material* 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);
//--elements for Iodium source which will be introduced in the next release
//--elements for Iodium source which will be introduced in the next release
//gold(chimica degli elementi N.N Greenwood,A.Earnshaw)
A=196.97*g/mole;
d=19.32*g/cm3;
G4Material* 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;
G4Material* matI=new G4Material("Iodium",Z=53.,A,d);
//ceramica(Medical Physics, May 2000)
d=2.88*g/cm3;
G4Material* ceramica=new G4Material("allumina",d,2);
ceramica->AddElement(elAl,2);
ceramica->AddElement(elO,3);
AbsorberMaterial=matH2O;
air= matAir;
CapsuleMat=matSteel;
IridiumMat=matIr192;
factoryIr->CreateSource(PhantomPhys);
}
ConstructSensitiveDetector();
G4VPhysicalVolume* BrachyDetectorConstruction::ConstructDetector()
{// Volumes
ComputeDimVoxel();
// EXPERIMENTAL HALL (our world volume)
G4double ExpHall_x = 4.0*m;
G4double ExpHall_y = 4.0*m;
G4double ExpHall_z = 4.0*m;
return ExpHallPhys;
}
void BrachyDetectorConstruction::SwitchDetector()
{
factoryIr->CleanSource();
switch(detectorChoice)
{
case 1:
factoryI=new BrachyFactoryI();
factoryI->CreateSource(PhantomPhys);
break;
case 2:
factoryLeipzig=new BrachyFactoryLeipzig();
factoryLeipzig->CreateSource(PhantomPhys);
break;
case 3:
factoryIr->CreateSource(PhantomPhys);
break;
default:
factoryIr->CreateSource(PhantomPhys);
}
// Notify run manager that the new geometry has been built
G4RunManager::GetRunManager()->DefineWorldVolume( ExpHallPhys );
G4RunManager::GetRunManager()->GeometryHasBeenModified();
// Let the navigator to know about the new top of the new geometry
G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->SetWorldVolume(ExpHallPhys);
// We have to tweak the navigator's state. By the following dummy call we ensure that navigator's
// state is reset properly
G4ThreeVector center(0,0,0);
G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->LocateGlobalPointAndSetup(center,0,false);
G4Colour white (1.0, 1.0, 1.0) ;
G4Colour grey (0.5, 0.5, 0.5) ;
G4Colour lgrey (.75, .75, .75) ;
G4Colour red (1.0, 0.0, 0.0) ;
G4Colour blue (0.0, 0.0, 1.0) ;
G4Colour cyan (0.0, 1.0, 1.0) ;
G4Colour magenta (1.0, 0.0, 1.0) ;
G4Colour yellow (1.0, 1.0, 0.0) ;
G4Colour lblue (0.0, 0.0, .75);
}
//World volume
ExpHall = new G4Box("ExpHall",ExpHall_x,ExpHall_y,ExpHall_z);
ExpHallLog = new G4LogicalVolume(ExpHall,air,"ExpHallLog",0,0,0);
ExpHallPhys = new G4PVPlacement(0,G4ThreeVector(),"ExpHallPhys",ExpHallLog,NULL,false,0);
void BrachyDetectorConstruction::SelectDetector(G4String val)
{ if(val=="Iodium")
{ detectorChoice = 1; }
else
{if(val=="Leipzig") detectorChoice = 2;
else { if(val=="Iridium")detectorChoice = 3;}}
// Water Box
Phantom= new G4Box("Phantom",m_BoxDimX/2,m_BoxDimY/2,m_BoxDimZ/2);
PhantomLog = new G4LogicalVolume(Phantom,AbsorberMaterial,"PhantomLog",0,0,0);
G4cout << "Now Detector is " << val << G4endl;
}
void BrachyDetectorConstruction::ConstructPhantom()
{
G4Colour white (1.0, 1.0, 1.0) ;
G4Colour grey (0.5, 0.5, 0.5) ;
G4Colour lgrey (.75, .75, .75) ;
G4Colour red (1.0, 0.0, 0.0) ;
G4Colour blue (0.0, 0.0, 1.0) ;
G4Colour cyan (0.0, 1.0, 1.0) ;
G4Colour magenta (1.0, 0.0, 1.0) ;
G4Colour yellow (1.0, 1.0, 0.0) ;
G4Colour lblue (0.0, 0.0, .75);
PhantomPhys = new G4PVPlacement(0,G4ThreeVector(),"WaterBoxPhys",PhantomLog,ExpHallPhys,false,0);
G4Material* air=pMat->GetMat("Air") ;
G4Material* soft=pMat->GetMat("tissue");
ComputeDimVoxel();
//World volume
ExpHall = new G4Box("ExpHall",ExpHall_x,ExpHall_y,ExpHall_z);
ExpHallLog = new G4LogicalVolume(ExpHall,air,"ExpHallLog",0,0,0);
ExpHallPhys = new G4PVPlacement(0,G4ThreeVector(),"ExpHallPhys",ExpHallLog,NULL,false,0);
// Water Box
Phantom = new G4Box("Phantom",m_BoxDimX/2,m_BoxDimY/2,m_BoxDimZ/2);
PhantomLog = new G4LogicalVolume(Phantom,soft,"PhantomLog",0,0,0);
PhantomPhys = new G4PVPlacement(0,G4ThreeVector(),"PhantomPhys",PhantomLog,ExpHallPhys,false,0);
ExpHallLog->SetVisAttributes (G4VisAttributes::Invisible);
// Capsule main body
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(lblue);
simpleBoxVisAtt->SetVisibility(true);
simpleBoxVisAtt->SetForceWireframe(true);
PhantomLog->SetVisAttributes(simpleBoxVisAtt);
G4Tubs* Capsule = new G4Tubs("Capsule",0,0.55*mm,3.725*mm,0.*deg,360.*deg);
G4LogicalVolume* CapsuleLog = new G4LogicalVolume(Capsule,CapsuleMat,"CapsuleLog");
G4VPhysicalVolume* CapsulePhys = new G4PVPlacement(0,G4ThreeVector(0,0,-1.975),"CapsulePhys",CapsuleLog,PhantomPhys,false,0);
}
// Capsule tip
void BrachyDetectorConstruction::ConstructSensitiveDetector()
// Sensitive Detector and ReadOut geometry definition
{
G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
G4Sphere* CapsuleTip = new G4Sphere("CapsuleTip",0.*mm,0.55*mm,0.*deg,360.*deg,0.*deg,90.*deg);
G4LogicalVolume* CapsuleTipLog = new G4LogicalVolume(CapsuleTip,CapsuleMat,"CapsuleTipLog");
G4VPhysicalVolume* CapsuleTipPhys = new G4PVPlacement(0,G4ThreeVector(0.,0.,1.75*mm),"CapsuleTipPhys",CapsuleTipLog,PhantomPhys,false,0);
// Iridium core
G4Tubs* IridiumCore = new G4Tubs("IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg);
G4LogicalVolume* IridiumCoreLog = new G4LogicalVolume(IridiumCore,IridiumMat,"IridiumCoreLog");
G4VPhysicalVolume* IridiumCorePhys = new G4PVPlacement(0,G4ThreeVector(),"IridiumCorePhys",IridiumCoreLog,CapsulePhys,false,0);
// Sensitive Detector and ReadOut geometry definition
//
G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
BrachyPhantomSD* pPhantomSD = new BrachyPhantomSD(m_SDName,NumVoxelX,NumVoxelZ);
if(pPhantomSD)
{
if( pPhantomSD ==0)
{
pPhantomSD = new BrachyPhantomSD(m_SDName,NumVoxelX,NumVoxelZ);
if(pPhantomSD)
{
G4String ROGeometryName = "PhantomROGeometry";
BrachyPhantomROGeometry* pPhantomROGeometry = new BrachyPhantomROGeometry(ROGeometryName,m_BoxDimX,m_BoxDimZ,NumVoxelX,NumVoxelZ);
pPhantomROGeometry = new BrachyPhantomROGeometry(ROGeometryName,m_BoxDimX,m_BoxDimZ,NumVoxelX,NumVoxelZ);
pPhantomROGeometry->BuildROGeometry();
pPhantomSD->SetROgeometry(pPhantomROGeometry);
pSDManager->AddNewDetector(pPhantomSD);
PhantomLog->SetSensitiveDetector(pPhantomSD);
CapsuleLog->SetSensitiveDetector(pPhantomSD);
CapsuleTipLog->SetSensitiveDetector(pPhantomSD);
IridiumCoreLog->SetSensitiveDetector(pPhantomSD);
}
//
// Visualization attributes
//
ExpHallLog->SetVisAttributes (G4VisAttributes::Invisible);
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(lblue);
simpleBoxVisAtt->SetVisibility(true);
simpleBoxVisAtt->SetForceWireframe(true);
PhantomLog->SetVisAttributes(simpleBoxVisAtt);
G4VisAttributes* simpleIridiumVisAtt= new G4VisAttributes(magenta);
simpleIridiumVisAtt->SetVisibility(true);
simpleIridiumVisAtt->SetForceWireframe(true);
IridiumCoreLog->SetVisAttributes(simpleIridiumVisAtt);
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);
//always return the physical World
PrintDetectorParameters();
return ExpHallPhys;
}
}
}
void BrachyDetectorConstruction::PrintDetectorParameters()
{
G4cout << "-----------------------------------------------------------------------"
<< G4endl
<<"the detector is a box whose size is: "
<<G4endl
<<m_BoxDimX/cm
<< " cm * "
<<m_BoxDimY/cm
<< " cm * "
<<m_BoxDimZ/cm
<< " cm"
<< G4endl
<<"numVoxel: "
<<NumVoxelX
<<G4endl
<<"dim voxel: "
<<dimVoxel/mm
<<"mm"
<<G4endl
<<"material of the box : "
<<AbsorberMaterial->GetName()
<<G4endl
<<"the source is at the center of the detector"
<<G4endl
G4cout << "-----------------------------------------------------------------------"
<< G4endl
<<"the detector is a box whose size is: "
<<G4endl
<<m_BoxDimX/cm
<< " cm * "
<<m_BoxDimY/cm
<< " cm * "
<<m_BoxDimZ/cm
<< " cm"
<< G4endl
<<"numVoxel: "
<<NumVoxelX
<<G4endl
<<"dim voxel: "
<<dimVoxel/mm
<<"mm"
<<G4endl
<<"material of the box : "
<<AbsorberMaterial->GetName()
<<G4endl
<<"the source is at the center of the detector"
<<G4endl
<<"-------------------------------------------------------------------------"
<< G4endl;
<<"-------------------------------------------------------------------------"
<< G4endl;
}
void BrachyDetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial)
{AbsorberMaterial = pttoMaterial;
PhantomLog->SetMaterial(pttoMaterial);
PrintDetectorParameters();
}
else G4cout<<"that's not avaiable!"<<G4endl;
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial)
{AbsorberMaterial = pttoMaterial;
PhantomLog->SetMaterial(pttoMaterial);
PrintDetectorParameters();
}
else G4cout<<"that's not avaiable!"<<G4endl;
}
@@ -433,12 +340,6 @@ void BrachyDetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
@@ -0,0 +1,207 @@
//
// ********************************************************************
// * 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 2002/11/18 15:18:37 guatelli Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#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 "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 "G4UnionSolid.hh"
#include "BrachyMaterial.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
BrachyDetectorConstructionI::BrachyDetectorConstructionI():
DefaultTub(0), DefaultTub_log(0),DefaultTub_Phys(0),
Capsule(0),CapsuleLog(0),CapsulePhys(0),
CapsuleTip(0),CapsuleTipLog(0),CapsuleTipPhys1(0),CapsuleTipPhys2(0),
IodiumCore(0),ICoreLog(0),ICorePhys(0),
Marker(0),MarkerLog(0),MarkerPhys(0)
{
pMat= new BrachyMaterial() ;
}
//....
BrachyDetectorConstructionI::~BrachyDetectorConstructionI()
{
delete pMat;
}
//....
void BrachyDetectorConstructionI::ConstructIodium(G4VPhysicalVolume* mother)
{
// Volumes
G4Material* titanium=pMat->GetMat("titanium");
G4Material* air =pMat->GetMat("Air");
G4Material* Iodio=pMat->GetMat("Iodium");
G4Material* Gold=pMat->GetMat("gold");
G4Colour white (1.0, 1.0, 1.0) ;
G4Colour grey (0.5, 0.5, 0.5) ;
G4Colour lgrey (.75, .75, .75) ;
G4Colour red (1.0, 0.0, 0.0) ;
G4Colour blue (0.0, 0.0, 1.0) ;
G4Colour cyan (0.0, 1.0, 1.0) ;
G4Colour magenta (1.0, 0.0, 1.0) ;
G4Colour yellow (1.0, 1.0, 0.0) ;
G4Colour lblue (0.0, 0.0, .75);
// Rotation Matrix
G4RotationMatrix* rotateMatrix=new G4RotationMatrix(); //=new G4RotationMatrix() ;
rotateMatrix->rotateX(180.0*deg);
DefaultTub=new G4Tubs("DefaultTub",
0.*mm,
0.40*mm,
1.84*mm,
0.*deg,
360.*deg);
DefaultTub_log = new G4LogicalVolume(DefaultTub,air,"DefaultTub_Log");
DefaultTub_Phys = new G4PVPlacement(0,G4ThreeVector(),"DefaultTub_Phys",DefaultTub_log,
mother,false,0);
// Capsule main body
G4double CapsuleR=0.35*mm;
Capsule = new G4Tubs("Capsule",
CapsuleR,//raggio interno
0.40*mm,//raggio esterno
1.84*mm,//meta' lunghezza
0.*deg,//angolo di partenza
360.*deg);//angolo di rotazione
CapsuleLog = new G4LogicalVolume(Capsule,titanium,"CapsuleLog");
CapsulePhys = new G4PVPlacement
(0,G4ThreeVector(),"CapsulePhys",CapsuleLog,
DefaultTub_Phys,false,0);
// Capsule tip
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);
CapsuleTipPhys2 = new G4PVPlacement(rotateMatrix, G4ThreeVector(0,0,-1.84*mm),"CapsuleTipPhys2",CapsuleTipLog,mother,false,0);
IodiumCore = new G4Tubs("ICore",0.085*mm,0.35*mm,1.75*mm,0.*deg,360.*deg);
ICoreLog = new G4LogicalVolume(IodiumCore,Iodio,"IodiumCoreLog");
ICorePhys = new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),
"IodiumCorePhys",ICoreLog,DefaultTub_Phys,false,0);
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,DefaultTub_Phys,false,0);
G4VisAttributes* simpleMarkerVisAtt= new G4VisAttributes(lblue);
simpleMarkerVisAtt->SetVisibility(true);
simpleMarkerVisAtt->SetForceSolid(true);
G4VisAttributes* simpleIodiumVisAtt= new G4VisAttributes(magenta);
simpleIodiumVisAtt->SetVisibility(true);
simpleIodiumVisAtt->SetForceWireframe(true);
ICoreLog->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,203 @@
//
// ********************************************************************
// * 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. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
//
// ****************************************
// * *
// * BrachyDetectorConstructionIr.cc *
// * *
// ****************************************
//
// $Id: BrachyDetectorConstructionIr.cc,v 1.3 2002/12/12 19:16:18 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#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 "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 "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)
{
pMat= new BrachyMaterial() ;
}
//....
BrachyDetectorConstructionIr::~BrachyDetectorConstructionIr()
{
delete pMat;
}
//....
void BrachyDetectorConstructionIr::ConstructIridium(G4VPhysicalVolume* mother)
{
G4Colour white (1.0, 1.0, 1.0) ;
G4Colour grey (0.5, 0.5, 0.5) ;
G4Colour lgrey (.75, .75, .75) ;
G4Colour red (1.0, 0.0, 0.0) ;
G4Colour blue (0.0, 0.0, 1.0) ;
G4Colour cyan (0.0, 1.0, 1.0) ;
G4Colour magenta (1.0, 0.0, 1.0) ;
G4Colour yellow (1.0, 1.0, 0.0) ;
G4Colour lblue (0.0, 0.0, .75);
G4Material* CapsuleMat=pMat->GetMat("Stainless steel");
G4Material*IridiumMat=pMat->GetMat("Iridium");
// Capsule main body
G4Tubs* Capsule = new G4Tubs("Capsule",0,0.55*mm,3.725*mm,0.*deg,360.*deg);
G4LogicalVolume* CapsuleLog = new G4LogicalVolume(Capsule,CapsuleMat,"CapsuleLog");
G4VPhysicalVolume* CapsulePhys = new G4PVPlacement
(0,G4ThreeVector(0,0,-1.975),"CapsulePhys",CapsuleLog,mother,false,0);
// Capsule tip
G4Sphere* CapsuleTip = new G4Sphere("CapsuleTipIridium",0.*mm,0.55*mm,0.*deg,360.*deg,0.*deg,90.*deg);
G4LogicalVolume* CapsuleTipLog = new G4LogicalVolume(CapsuleTip,CapsuleMat,"CapsuleTipIridumLog");
G4VPhysicalVolume* CapsuleTipPhys = new G4PVPlacement(0,G4ThreeVector(0.,0.,1.75*mm),"CapsuleTipIridiumPhys",CapsuleTipLog,mother,false,0);
// Iridium core
G4Tubs* IridiumCore = new G4Tubs("IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg);
G4LogicalVolume* IridiumCoreLog = new G4LogicalVolume(IridiumCore,IridiumMat,"IridiumCoreLog");
G4VPhysicalVolume* IridiumCorePhys = new G4PVPlacement(0,G4ThreeVector(),"IridiumCorePhys",IridiumCoreLog,CapsulePhys,false,0);
simpleIridiumVisAtt= new G4VisAttributes(magenta);
simpleIridiumVisAtt->SetVisibility(true);
simpleIridiumVisAtt->SetForceWireframe(true);
IridiumCoreLog->SetVisAttributes(simpleIridiumVisAtt);
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);
}
void BrachyDetectorConstructionIr::CleanIridium()
{
G4VPhysicalVolume* toDieCapsule = CapsulePhys;
G4VPhysicalVolume* toDieTip =CapsuleTipPhys;
G4VPhysicalVolume* toDieCore = IridiumCorePhys;
if ( toDieTip != 0 ){delete toDieTip;}
if ( toDieCore !=0){delete toDieCore;}
if(toDieCapsule !=0){delete toDieCapsule;}
if(CapsuleTipLog !=0)
{G4VSolid* solToDieTip =CapsuleTipLog->GetSolid();
if (solToDieTip !=0)
{delete solToDieTip;}
delete CapsuleTipLog;
CapsuleTipLog=0; }
if( CapsuleLog !=0)
{G4VSolid* solToDieCapsule =CapsuleLog->GetSolid();
if (solToDieCapsule !=0)
{delete solToDieCapsule;}
delete CapsuleLog;
CapsuleLog=0;}
if (IridiumCoreLog !=0)
{G4VSolid* solToDieCore =IridiumCoreLog->GetSolid();
if (solToDieCore !=0)
{delete solToDieCore;}
delete IridiumCoreLog;
IridiumCoreLog=0 ;}
if( simpleIridiumVisAtt !=0){delete simpleIridiumVisAtt;}
if (simpleCapsuleVisAtt !=0){ delete simpleCapsuleVisAtt;}
if (simpleCapsuleTipVisAtt !=0) {delete simpleCapsuleTipVisAtt;}
}
@@ -0,0 +1,158 @@
//
// ********************************************************************
// * 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. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
//
// *******************************************
// * *
// * BrachyDetectorConstructionLeipzig.cc *
// * *
// *******************************************
//
//
// $Id: BrachyDetectorConstructionLeipzig.cc,v 1.3 2002/12/12 19:16:18 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#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 "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 "G4UnionSolid.hh"
#include "BrachyMaterial.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
BrachyDetectorConstructionLeipzig::BrachyDetectorConstructionLeipzig():
Capsule(0),CapsuleLog(0),CapsulePhys(0),
CapsuleTip(0),CapsuleTipLog(0),CapsuleTipPhys(0),
IridiumCore(0),IridiumCoreLog(0),IridiumCorePhys(0),
Appl1(0),Appl1Log(0),Appl1Phys(0),
Appl2(0),Appl2Log(0),Appl2Phys(0)
{
pMat= new BrachyMaterial() ;
}
//....
BrachyDetectorConstructionLeipzig::~BrachyDetectorConstructionLeipzig()
{
delete pMat;
}
void BrachyDetectorConstructionLeipzig::ConstructLeipzig(G4VPhysicalVolume* WaterBoxPhys)
{
G4Colour white (1.0, 1.0, 1.0) ;
G4Colour grey (0.5, 0.5, 0.5) ;
G4Colour lgrey (.75, .75, .75) ;
G4Colour red (1.0, 0.0, 0.0) ;
G4Colour blue (0.0, 0.0, 1.0) ;
G4Colour cyan (0.0, 1.0, 1.0) ;
G4Colour magenta (1.0, 0.0, 1.0) ;
G4Colour yellow (1.0, 1.0, 0.0) ;
G4Colour lblue (0.0, 0.0, .75);
G4Material* CapsuleMat=pMat->GetMat("Stainless steel");
G4Material*IridiumMat=pMat->GetMat("Iridium");
G4Material* matTung=pMat->GetMat("Tungsten");
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,WaterBoxPhys,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,WaterBoxPhys,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(0.,0.,1.975*mm),"IridiumCorePhys",
IridiumCoreLog,CapsulePhys,false,0);
// Applicator
Appl1 = new G4Tubs("Appl1",5*mm,10.5*mm,12*mm,0.*deg,360.*deg);
Appl1Log = new G4LogicalVolume(Appl1,matTung,"Appl1");
Appl1Phys = new G4PVPlacement (0,G4ThreeVector(0,0,4.0*mm),"Appl1Phys", Appl1Log,
WaterBoxPhys,false,0);
Appl2 = new G4Tubs("Appl2",0.55*mm,5.*mm,3.125*mm,0.*deg,360.*deg);
Appl2Log = new G4LogicalVolume(Appl2,matTung,"Appl2");
Appl2Phys = new G4PVPlacement(0,G4ThreeVector(0,0,-4.875*mm),"Appl2Phys",Appl2Log,
WaterBoxPhys,false,0);
simpleCapsuleVisAtt= new G4VisAttributes(red);
simpleCapsuleVisAtt->SetVisibility(true);
simpleCapsuleVisAtt->SetForceSolid(true);
CapsuleLog->SetVisAttributes(simpleCapsuleVisAtt);
//CapsuleTipLog->SetVisAttributes (G4VisAttributes::Invisible);
simpleCapsuleTipVisAtt= new G4VisAttributes(red);
simpleCapsuleTipVisAtt->SetVisibility(true);
simpleCapsuleTipVisAtt->SetForceSolid(true);
CapsuleTipLog->SetVisAttributes(simpleCapsuleTipVisAtt);
}
@@ -21,8 +21,18 @@
// ********************************************************************
//
//
// $Id: BrachyDetectorMessenger.cc,v 1.2 2002/06/18 22:30:31 guatelli Exp $
// GEANT4 tag $Name: geant4-04-01 $
// Code developed by:
// S.Guatelli
//
// *********************************
// * *
// * BrachyDetectorMessenger.cc *
// * *
// *********************************
//
//
// $Id: BrachyDetectorMessenger.cc,v 1.5 2002/12/06 16:32:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
@@ -30,7 +40,8 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "BrachyDetectorMessenger.hh"
#include "BrachyFactoryIr.hh"
#include "BrachyRunAction.hh"
#include "BrachyDetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
@@ -40,8 +51,8 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
BrachyDetectorMessenger::BrachyDetectorMessenger( BrachyDetectorConstruction* Det)
:Detector(Det)
BrachyDetectorMessenger::BrachyDetectorMessenger( BrachyDetectorConstruction* Det):
Detector(Det)
{
detDir = new G4UIdirectory("/detector/");
detDir->SetGuidance(" detector control.");
@@ -49,9 +60,32 @@ BrachyDetectorMessenger::BrachyDetectorMessenger( BrachyDetectorConstruction* De
AbsMaterCmd = new G4UIcmdWithAString("/detector/setMaterial",this);
AbsMaterCmd->SetGuidance("Select Material of the detector.");
AbsMaterCmd->SetParameterName("choice",false);
AbsMaterCmd->AvailableForStates(Idle);
}
AbsMaterCmd->AvailableForStates(G4State_Idle);
selDetCmd = new G4UIcmdWithAString("/geom/select",this);
mydetDir = new G4UIdirectory("/geom/");
mydetDir->SetGuidance("Geometry setup commands.");
selDetCmd->SetGuidance("Select the way detector geometry is built.");
selDetCmd->SetGuidance(" Iodium: Iodium Source ");
selDetCmd->SetGuidance(" Iridium: Iridium Source " );
selDetCmd->SetGuidance(" Leipzig: Leipzig Source " );
selDetCmd->SetParameterName("choice",true);
selDetCmd->SetDefaultValue("Iridium");
selDetCmd->SetCandidates("Iridium / Iodium / Leipzig");
selDetCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
switchCmd = new G4UIcmdWithAString("/geom/switch",this);
switchCmd->SetGuidance("Assign the selected geometry to G4RunManager.");
switchCmd->SetGuidance("In case the choice is present to this command,");
switchCmd->SetGuidance("\"/geom/select\" will be invoked and then switched.");
switchCmd->SetParameterName("choice",true);
switchCmd->SetDefaultValue(" ");
switchCmd->SetCandidates("Iridium Iodium Leipzig ");
switchCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -59,7 +93,7 @@ BrachyDetectorMessenger::~BrachyDetectorMessenger()
{
delete AbsMaterCmd;
delete UpdateCmd;
delete mydetDir;
delete detDir;
}
@@ -68,11 +102,20 @@ BrachyDetectorMessenger::~BrachyDetectorMessenger()
void BrachyDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == AbsMaterCmd )
{ Detector->SetAbsorberMaterial(newValue);}
{ Detector->SetAbsorberMaterial(newValue);}
if( command == selDetCmd )
{
Detector->SelectDetector(newValue);
}
if( command == switchCmd )
{
if(newValue=="Iodium" || newValue=="Iridium"|| newValue=="Leipzig")
{
Detector->SelectDetector(newValue);
Detector->SwitchDetector();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -20,12 +20,19 @@
// * statement, and all its terms. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli
//
// *******************************
// * *
// * BrachyEventAction.cc *
// * BrachyEventAction.cc *
// * *
// *******************************
//
// $Id: BrachyEventAction.cc,v 1.13 2002/11/27 11:11:22 guatelli Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "BrachyPrimaryGeneratorActionI.hh"
#include "BrachyEventAction.hh"
#include "BrachyPhantomHit.hh"
#include "BrachyPhantomSD.hh"
@@ -41,22 +48,30 @@
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#ifdef G4ANALYSIS_USE
#include"BrachyAnalysisManager.hh"
#endif
#include "BrachyPrimaryGeneratorActionIr.hh"
//....
BrachyEventAction::BrachyEventAction(G4String &SDName) :
drawFlag("all" ),printModulo(1)
{
m_HitsCollectionID = -1;
SDname=SDName;
pDetector=new BrachyDetectorConstruction(SDname);
m_NumVoxelX=pDetector-> GetNumVoxelX();
m_NumVoxelZ=pDetector->GetNumVoxelZ();
VoxelWidth_Z= pDetector -> VoxelWidth_Z() ;
VoxelWidth_X=pDetector->VoxelWidth_X();
SDname=SDName;
pDetector=new BrachyDetectorConstruction(SDname);
m_NumVoxelX=pDetector-> GetNumVoxelX();
m_NumVoxelZ=pDetector->GetNumVoxelZ();
VoxelWidth_Z= 0.1*cm ;
VoxelWidth_X=0.1*cm;
}
@@ -64,7 +79,7 @@ BrachyEventAction::BrachyEventAction(G4String &SDName) :
BrachyEventAction::~BrachyEventAction()
{
delete pDetector;
delete pDetector;
}
@@ -73,80 +88,82 @@ BrachyEventAction::~BrachyEventAction()
void BrachyEventAction::BeginOfEventAction(const G4Event* aEvent)
{
G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
if(m_HitsCollectionID == -1)
m_HitsCollectionID = pSDManager->GetCollectionID("PhantomHitsCollection");
G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
if(m_HitsCollectionID == -1)
m_HitsCollectionID = pSDManager->GetCollectionID("PhantomHitsCollection");
}
//....
void BrachyEventAction::EndOfEventAction(const G4Event* evt)
{
G4int evno = fpEventManager->GetConstCurrentEvent()->GetEventID() ;
if((evno==100)||(evno==500)||(evno==1000)||(evno==2500)
||(evno==5000)||(evno==7000)||(evno==9000)||
(evno==9500)||(evno==29000000)||(evno==29500000))
G4cout << evno << G4endl;
if(m_HitsCollectionID < 0)
return;
if(m_HitsCollectionID < 0)
return;
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
BrachyPhantomHitsCollection* CHC = NULL;
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
BrachyPhantomHitsCollection* CHC = NULL;
if(HCE)
CHC = (BrachyPhantomHitsCollection*)(HCE->GetHC(m_HitsCollectionID));
if(HCE)
CHC = (BrachyPhantomHitsCollection*)(HCE->GetHC(m_HitsCollectionID));
if(CHC)
{
if(CHC)
{
G4int HitCount = CHC->entries();
G4int HitCount = CHC->entries();
for (G4int h=0; h<HitCount; h++)
{
for (G4int h=0; h<HitCount; h++)
{
BrachyAnalysisManager* analysis = BrachyAnalysisManager::getInstance();
i=((*CHC)[h])->GetZID();
k=((*CHC)[h])->GetXID();
j=i+k*m_NumVoxelX;
#ifdef G4ANALYSIS_USE
BrachyAnalysisManager* analysis = BrachyAnalysisManager::getInstance();
#endif
i=((*CHC)[h])->GetZID();
k=((*CHC)[h])->GetXID();
j=((*CHC)[h])->GetYID();
EnergyDep=(*CHC)[h]->GetEdep();
EnergyDep=((*CHC)[h]->GetEdep())/keV;
x = (-m_NumVoxelZ+1+2*k)*VoxelWidth_X/2;
z = (- m_NumVoxelZ+1+2*i)*VoxelWidth_Z/2;
if(EnergyDep!=0){
{ if( abs(x)>0.56*mm && abs(z)>3.8*mm)
analysis->hist(x,z,EnergyDep); analysis->analyse(x,z,EnergyDep);}}}
}
// extract the trajectories and draw them
x = (-m_NumVoxelZ+1+2*k)*VoxelWidth_X/2;
z = (- m_NumVoxelZ+1+2*i)*VoxelWidth_Z/2;
y=(- m_NumVoxelZ+1+2*j)*VoxelWidth_Z/2;
#ifdef G4ANALYSIS_USE
if(EnergyDep!=0)
{
if (y<1.*mm){if (y> -1.*mm)
{analysis->hist(x,z,EnergyDep);}}
}
if(EnergyDep!=0)analysis->fill_Tuple(x,y,z,EnergyDep);
#endif
}
}
// extract the trajectories and draw them
if (G4VVisManager::GetConcreteInstance())
{
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
for (G4int i=0; i<n_trajectories; i++)
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);
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,54 @@
//
// ********************************************************************
// * 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.3 2002/12/12 19:16:18 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include"BrachyFactory.hh"
BrachyFactory::BrachyFactory()
{ ;}
BrachyFactory::~BrachyFactory()
{
;
}
G4VUserPrimaryGeneratorAction* BrachyFactory::CreatePrimaryGeneratorAction()
{;}
void BrachyFactory::CreateSource(G4VPhysicalVolume* mother)
{;}
void BrachyFactory::CleanSource()
{;}
@@ -0,0 +1,83 @@
//
// ********************************************************************
// * 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.2 2002/11/18 15:18:38 guatelli Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#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 "G4RadioactiveDecay.hh"
#include "G4UImanager.hh"
#include "globals.hh"
#include <math.h>
#include "G4RunManager.hh"
BrachyFactoryI:: BrachyFactoryI()
{
pIodio=new BrachyDetectorConstructionI();
}
BrachyFactoryI:: ~BrachyFactoryI()
{
delete pIodio;
}
G4VUserPrimaryGeneratorAction* BrachyFactoryI::CreatePrimaryGeneratorAction()
{
G4VUserPrimaryGeneratorAction* pIodium =new BrachyPrimaryGeneratorActionI();
if(pIodium) return pIodium ;
}
void BrachyFactoryI::CreateSource(G4VPhysicalVolume* mother)
{
pIodio -> ConstructIodium(mother);
}
void BrachyFactoryI::CleanSource()
{;}
@@ -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. *
// ********************************************************************
//
// Code developed by:
// S.Guatelli
//
// *******************************
// * *
// * BrachyFactoryIr *
// * *
// *******************************
//
// $Id: BrachyFactoryIr.cc,v 1.2 2002/11/18 15:18:38 guatelli Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "BrachyFactoryIr.hh"
#include"BrachyPrimaryGeneratorActionIr.hh"
#include "G4ParticleTable.hh"
#include "Randomize.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4IonTable.hh"
#include "G4RadioactiveDecay.hh"
#include "G4UImanager.hh"
#include "globals.hh"
#include <math.h>
#include "G4RunManager.hh"
#include"BrachyDetectorMessenger.hh"
#include"BrachyDetectorConstructionIr.hh"
BrachyFactoryIr:: BrachyFactoryIr()
{
pIridio=new BrachyDetectorConstructionIr();
}
BrachyFactoryIr:: ~BrachyFactoryIr()
{
delete pIridio;
}
G4VUserPrimaryGeneratorAction* BrachyFactoryIr::CreatePrimaryGeneratorAction()
{
G4VUserPrimaryGeneratorAction* pIridium =new BrachyPrimaryGeneratorActionIr();
if(pIridium) return pIridium ;
}
void BrachyFactoryIr::CreateSource(G4VPhysicalVolume* mother)
{
pIridio -> ConstructIridium(mother);
}
void BrachyFactoryIr::CleanSource()
{
pIridio -> CleanIridium();
}
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * 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 2002/11/18 15:18:38 guatelli Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "BrachyFactoryLeipzig.hh"
#include"BrachyPrimaryGeneratorActionIr.hh"
#include "G4ParticleTable.hh"
#include "Randomize.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4IonTable.hh"
#include "G4RadioactiveDecay.hh"
#include "G4UImanager.hh"
#include "globals.hh"
#include <math.h>
#include "G4RunManager.hh"
#include"BrachyDetectorMessenger.hh"
#include"BrachyDetectorConstructionLeipzig.hh"
BrachyFactoryLeipzig:: BrachyFactoryLeipzig()
{
pLeipzig=new BrachyDetectorConstructionLeipzig();
}
BrachyFactoryLeipzig:: ~BrachyFactoryLeipzig()
{
delete pLeipzig;
}
G4VUserPrimaryGeneratorAction* BrachyFactoryLeipzig::CreatePrimaryGeneratorAction()
{
G4VUserPrimaryGeneratorAction* pIridium =new BrachyPrimaryGeneratorActionIr();
if(pIridium) return pIridium ;
}
void BrachyFactoryLeipzig::CreateSource(G4VPhysicalVolume* mother)
{
pLeipzig -> ConstructLeipzig(mother);
}
void BrachyFactoryLeipzig::CleanSource()
{
;
}
@@ -0,0 +1,262 @@
//
// ********************************************************************
// * 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 2002/11/18 15:18:38 guatelli Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#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);
// Elements for source capsule and cable
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);
// Material for Leipzig applicator and cup
// Tungsten
A= 183.84* g/mole;
d=19.3*g/cm3;
G4Material* matW = new G4Material("Tungsten",Z=74.,A,d);
// Perspex, plexiglass, lucite
d= 1.19*g/cm3;
G4Material* 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;
G4Material* 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;
G4Material* matir192 = new G4Material("Iridium",Z,A,d);
//titanium
A=47.88*g/mole;
d=4.50*g/cm3;
G4Material* 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;
G4Material* matH2O = new G4Material("Water",d,2);
matH2O->AddElement(elH,2);
matH2O->AddElement(elO,1);
//soft tissue(NIST data)
d=1.0*g/cm3;
G4Material* 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 ;
G4Material* 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;
G4Material* 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;
G4Material* matI=new G4Material("Iodium",Z=53.,A,d);
//ceramica(Medical Physics, May 2000)
d=2.88*g/cm3;
G4Material* ceramica=new G4Material("allumina",d,2);
ceramica->AddElement(elAl,2);
ceramica->AddElement(elO,3);
G4double density = universe_mean_density;
G4double pressure = 3.e-18*pascal;
G4double temperature = 2.73*kelvin;
A=1.01*g/mole;
G4Material*Vacuum = new G4Material("Galactic", Z=1., A,
density,kStateGas,temperature,pressure);
//compact bone
d=1.85*g/cm3;
G4Material* 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);
G4Material* 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);
if (pttoMaterial) return pttoMaterial;
}
@@ -20,12 +20,19 @@
// * statement, and all its terms. *
// ********************************************************************
//
//
// Code developed by:
// S. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
//
// ********************************
// * *
// * BrachyPhantomHit.cc *
// * BrachyPhantomHit.cc *
// * *
// ********************************
//
// $Id: BrachyPhantomHit.cc,v 1.3 2002/11/18 15:18:38 guatelli Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "BrachyPhantomHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
@@ -37,10 +44,10 @@ G4Allocator<BrachyPhantomHit> BrachyPhantomHitAllocator;
//....
BrachyPhantomHit::BrachyPhantomHit(G4LogicalVolume* logVol,G4int XID,G4int ZID)
:m_pLogV(logVol),m_XID(XID),m_ZID(ZID)
BrachyPhantomHit::BrachyPhantomHit(G4LogicalVolume* logVol,G4int XID,G4int YID,G4int ZID)
:m_pLogV(logVol),m_XID(XID),m_ZID(ZID),m_YID(YID)
{
m_Edep=0;
m_Edep=0;
}
//....
@@ -53,32 +60,34 @@ BrachyPhantomHit::~BrachyPhantomHit()
BrachyPhantomHit::BrachyPhantomHit(const BrachyPhantomHit &right)
{
m_XID = right.m_XID;
m_ZID = right.m_ZID;
m_Edep = right.m_Edep;
m_Pos = right.m_Pos;
m_Rot = right.m_Rot;
m_pLogV = right.m_pLogV;
m_XID = right.m_XID;
m_ZID = right.m_ZID;
m_YID = right.m_YID;
m_Edep = right.m_Edep;
m_Pos = right.m_Pos;
m_Rot = right.m_Rot;
m_pLogV = right.m_pLogV;
}
//....
const BrachyPhantomHit& BrachyPhantomHit::operator=(const BrachyPhantomHit &right)
{
m_XID = right.m_XID;
m_ZID = right.m_ZID;
m_Edep = right.m_Edep;
m_Pos = right.m_Pos;
m_Rot = right.m_Rot;
m_pLogV = right.m_pLogV;
return *this;
m_XID = right.m_XID;
m_ZID = right.m_ZID;
m_YID = right.m_YID;
m_Edep = right.m_Edep;
m_Pos = right.m_Pos;
m_Rot = right.m_Rot;
m_pLogV = right.m_pLogV;
return *this;
}
//....
int BrachyPhantomHit::operator==(const BrachyPhantomHit &right) const
{
return((m_XID==right.m_XID)&&(m_ZID==right.m_ZID));
return((m_XID==right.m_XID)&&(m_ZID==right.m_ZID)&&(m_YID==right.m_YID));
}
//....
@@ -20,12 +20,19 @@
// * statement, and all its terms. *
// ********************************************************************
//
//
// Code developed by:
// S. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
//
// ************************************
// * *
// * BrachyWaterBoxROGeometry.cc *
// * BrachyPhantomROGeometry.cc *
// * *
// ************************************
//
// $Id: BrachyPhantomROGeometry.cc,v 1.3 2002/11/18 15:18:38 guatelli Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "BrachyPhantomROGeometry.hh"
#include "BrachyDummySD.hh"
@@ -43,7 +50,7 @@
//....
BrachyPhantomROGeometry::BrachyPhantomROGeometry(G4String aString,G4double DetDimX,G4double DetDimZ,G4int NumVoxelX,G4int NumVoxelZ)
: G4VReadOutGeometry(aString),m_DetDimX(DetDimX),m_DetDimZ(DetDimZ),m_NumVoxelX(NumVoxelX),m_NumVoxelZ(NumVoxelZ)
: G4VReadOutGeometry(aString),m_DetDimX(DetDimX),m_DetDimZ(DetDimZ),m_NumVoxelX(NumVoxelX),m_NumVoxelZ(NumVoxelZ)
{
}
@@ -57,59 +64,70 @@ 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.)
// 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);
G4Material* dummyMat = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
// Slice thickness is the average of Voxel X and Z sizes
G4double DetVoxel_y = (m_DetDimX/m_NumVoxelX+m_DetDimZ/m_NumVoxelZ)/2.0;
G4double DetVoxel_y = (m_DetDimX/m_NumVoxelX+m_DetDimZ/m_NumVoxelZ)/2.0;
G4double ExpHall_x = 4.0*m;
G4double ExpHall_y = 4.0*m;
G4double ExpHall_z = 4.0*m;
G4double ExpHall_x = 4.0*m;
G4double ExpHall_y = 4.0*m;
G4double ExpHall_z = 4.0*m;
G4double Det_x = m_DetDimX/2;
G4double Det_y = DetVoxel_y;
G4double Det_z = m_DetDimZ/2;
G4double Det_x = m_DetDimX/2;
G4double Det_y = DetVoxel_y;
G4double Det_z = m_DetDimZ/2;
G4double Det_y2 =m_DetDimX/2 ;
G4double DetVoxelX_x = Det_x/m_NumVoxelX;
G4double DetVoxelX_y = DetVoxel_y;
G4double DetVoxelX_z = Det_z;
G4double DetVoxelX_dx = 2*DetVoxelX_x;
G4double DetVoxelX_x = Det_x/m_NumVoxelX;
G4double DetVoxelX_y = DetVoxel_y;
G4double DetVoxelX_z = Det_z;
G4double DetVoxelX_dx = 2*DetVoxelX_x;
G4double DetVoxelZ_x = Det_x;
G4double DetVoxelZ_y = DetVoxel_y;
G4double DetVoxelZ_z = Det_z/m_NumVoxelZ;
G4double DetVoxelZ_dz = 2*DetVoxelZ_z;
G4double DetVoxelZ_x = Det_x;
G4double DetVoxelZ_y = DetVoxel_y;
G4double DetVoxelZ_z = Det_z/m_NumVoxelZ;
G4double DetVoxelZ_dz = 2*DetVoxelZ_z;
G4Box *ROExpHall = new G4Box("ROExpHall",ExpHall_x,ExpHall_y,ExpHall_z);
G4LogicalVolume *ROExpHallLog = new G4LogicalVolume(ROExpHall,dummyMat,"ROExpHallLog",0,0,0);
G4VPhysicalVolume *ROExpHallPhys = new G4PVPlacement(0,G4ThreeVector(),"ROExpHallPhys",ROExpHallLog,0,false,0);
G4Box *ROExpHall = new G4Box("ROExpHall",ExpHall_x,ExpHall_y,ExpHall_z);
G4LogicalVolume *ROExpHallLog = new G4LogicalVolume(ROExpHall,dummyMat,"ROExpHallLog",0,0,0);
G4VPhysicalVolume *ROExpHallPhys = new G4PVPlacement(0,G4ThreeVector(),"ROExpHallPhys",ROExpHallLog,0,false,0);
G4Box *RODetector = new G4Box("RODetector", Det_x, Det_y, Det_z);
G4LogicalVolume *RODetectorLog = new G4LogicalVolume(RODetector,dummyMat,"RODetectorLog",0,0,0);
G4VPhysicalVolume *RODetectorPhys = new G4PVPlacement(0,G4ThreeVector(),"DetectorPhys",RODetectorLog,ROExpHallPhys,false,0);
G4Box *RODetector = new G4Box("RODetector", Det_x, Det_y2, Det_z);
G4LogicalVolume *RODetectorLog = new G4LogicalVolume(RODetector,dummyMat,"RODetectorLog",0,0,0);
G4VPhysicalVolume *RODetectorPhys = new G4PVPlacement(0,G4ThreeVector(),"DetectorPhys",RODetectorLog,ROExpHallPhys,false,0);
// ReadOut Voxel division
// ReadOut Voxel division
// X division first...
G4Box *RODetectorXDivision = new G4Box("RODetectorXDivision",DetVoxelX_x,DetVoxelX_y,DetVoxelX_z);
G4LogicalVolume *RODetectorXDivisionLog = new G4LogicalVolume(RODetectorXDivision,dummyMat,"RODetectorXDivisionLog",0,0,0);
G4VPhysicalVolume *RODetectorXDivisionPhys = new G4PVReplica("RODetectorXDivisionPhys",RODetectorXDivisionLog,RODetectorPhys,kXAxis,m_NumVoxelX,DetVoxelX_dx);
G4Box *RODetectorXDivision = new G4Box("RODetectorXDivision",DetVoxelX_x,DetVoxelX_z,DetVoxelX_z);
G4LogicalVolume *RODetectorXDivisionLog = new G4LogicalVolume(RODetectorXDivision,dummyMat,"RODetectorXDivisionLog",0,0,0);
G4VPhysicalVolume *RODetectorXDivisionPhys = new G4PVReplica("RODetectorXDivisionPhys",RODetectorXDivisionLog,RODetectorPhys,kXAxis,m_NumVoxelX,DetVoxelX_dx);
// ...then Z division
G4Box *RODetectorZDivision = new G4Box("RODetectorZDivision",DetVoxelZ_x,DetVoxelZ_y,DetVoxelZ_z);
G4LogicalVolume *RODetectorZDivisionLog = new G4LogicalVolume(RODetectorZDivision,dummyMat,"RODetectorZDivisionLog",0,0,0);
G4VPhysicalVolume *RODetectorZDivisionPhys = new G4PVReplica("RODetectorZDivisionPhys",RODetectorZDivisionLog,RODetectorXDivisionPhys,kZAxis,m_NumVoxelZ,DetVoxelZ_dz);
BrachyDummySD *dummySD = new BrachyDummySD;
RODetectorZDivisionLog->SetSensitiveDetector(dummySD);
return ROExpHallPhys;
// ...then Z division
G4Box *RODetectorZDivision = new G4Box("RODetectorZDivision",DetVoxelZ_x,DetVoxelZ_x,DetVoxelZ_z);
G4LogicalVolume *RODetectorZDivisionLog = new G4LogicalVolume(RODetectorZDivision,dummyMat,"RODetectorZDivisionLog",0,0,0);
G4VPhysicalVolume *RODetectorZDivisionPhys = new G4PVReplica("RODetectorZDivisionPhys",RODetectorZDivisionLog,RODetectorXDivisionPhys,kZAxis,m_NumVoxelZ,DetVoxelZ_dz);
// ...then Y division
G4Box *RODetectorYDivision = new G4Box("RODetectorYDivision",DetVoxelZ_x,DetVoxelZ_y,DetVoxelZ_x);
G4LogicalVolume *RODetectorYDivisionLog = new G4LogicalVolume(RODetectorYDivision,dummyMat,"RODetectorYDivisionLog",0,0,0);
G4VPhysicalVolume *RODetectorYDivisionPhys = new G4PVReplica("RODetectorYDivisionPhys",RODetectorYDivisionLog,RODetectorZDivisionPhys,kYAxis,m_NumVoxelZ,DetVoxelZ_dz);
BrachyDummySD *dummySD = new BrachyDummySD;
RODetectorYDivisionLog->SetSensitiveDetector(dummySD);
return ROExpHallPhys;
}
@@ -20,16 +20,23 @@
// * statement, and all its terms. *
// ********************************************************************
//
//
// Code developed by:
// S. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
//
// ********************************
// * *
// * BrachyWaterBoxSD.cc *
// * BrachyPhantomSD.cc *
// * *
// ********************************
//
// $Id: BrachyPhantomSD.cc,v 1.3 2002/11/18 15:18:38 guatelli Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "BrachyPhantomSD.hh"
#include "BrachyPhantomHit.hh"
#include "BrachyDetectorConstruction.hh"
#include "BrachyDetectorConstruction.hh"
#include "G4Track.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
@@ -42,72 +49,75 @@
//....
BrachyPhantomSD::BrachyPhantomSD(G4String name, G4int NumVoxelX, G4int NumVoxelZ)
:G4VSensitiveDetector(name),m_NumVoxelX(NumVoxelX),m_NumVoxelZ(NumVoxelZ)
:G4VSensitiveDetector(name),m_NumVoxelX(NumVoxelX),m_NumVoxelZ(NumVoxelZ)
{
G4String HCname;
collectionName.insert(HCname="PhantomHitsCollection");
m_pVoxelID = new G4int[NumVoxelX*NumVoxelZ];
m_pPhantomHitsCollection = NULL;
G4String HCname;
collectionName.insert(HCname="PhantomHitsCollection");
m_pVoxelID = new G4int[NumVoxelX*NumVoxelZ*NumVoxelZ];
m_pPhantomHitsCollection = NULL;
}
//....
BrachyPhantomSD::~BrachyPhantomSD()
{
delete[] m_pVoxelID;
delete[] m_pVoxelID;
}
//....
void BrachyPhantomSD::Initialize(G4HCofThisEvent*HCE)
{
m_pPhantomHitsCollection = new BrachyPhantomHitsCollection(SensitiveDetectorName,collectionName[0]);
G4int m_NumVoxelY=300;
m_pPhantomHitsCollection = new BrachyPhantomHitsCollection(SensitiveDetectorName,collectionName[0]);
for(G4int k=0;k<m_NumVoxelZ;k++)
for(G4int i=0;i<m_NumVoxelX;i++)
for(G4int j=0;j<m_NumVoxelY;j++)
m_pVoxelID[i+k*m_NumVoxelX+j*m_NumVoxelY*m_NumVoxelY] = -1;
for(G4int k=0;k<m_NumVoxelZ;k++)
for(G4int i=0;i<m_NumVoxelX;i++)
m_pVoxelID[i+k*m_NumVoxelX] = -1;
}
//....
G4bool BrachyPhantomSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
{
if(!ROhist)
return false;
if(!ROhist)
return false;
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() != "WaterBoxPhys")
return false;
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() != "PhantomPhys")
return false;
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.)
return false;
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.)
return false;
G4VPhysicalVolume* physVol = ROhist->GetVolume();
G4VPhysicalVolume* mothVol = ROhist->GetVolume(1);
G4VPhysicalVolume* physVol = ROhist->GetVolume();
G4VPhysicalVolume* mothVol = ROhist->GetVolume(1);
// Read Voxel indexes: i is the x index, k is the z index
G4int k = ROhist->GetReplicaNumber();
G4int i = ROhist->GetReplicaNumber(1);
if(m_pVoxelID[i+k*m_NumVoxelX]==-1)
{
BrachyPhantomHit* PhantomHit = new BrachyPhantomHit(physVol->GetLogicalVolume(),i,k);
// 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();
if(m_pVoxelID[i+k*m_NumVoxelX+j*m_NumVoxelX*m_NumVoxelX]==-1)
{
BrachyPhantomHit* PhantomHit = new BrachyPhantomHit(physVol->GetLogicalVolume(),i,j,k);
G4RotationMatrix rotM;
if(physVol->GetObjectRotation())
rotM = *(physVol->GetObjectRotation());
G4RotationMatrix rotM;
if(physVol->GetObjectRotation())
rotM = *(physVol->GetObjectRotation());
PhantomHit->SetEdep(edep);
PhantomHit->SetPos(physVol->GetTranslation());
PhantomHit->SetRot(rotM);
PhantomHit->SetEdep(edep);
PhantomHit->SetPos(physVol->GetTranslation());
PhantomHit->SetRot(rotM);
G4int VoxelID = m_pPhantomHitsCollection->insert(PhantomHit);
m_pVoxelID[i+k*m_NumVoxelX] = VoxelID - 1;
}
else
(*m_pPhantomHitsCollection)[m_pVoxelID[i+k*m_NumVoxelX]]->AddEdep(edep);
G4int VoxelID = m_pPhantomHitsCollection->insert(PhantomHit);
m_pVoxelID[i+k*m_NumVoxelX+j*m_NumVoxelX*m_NumVoxelX] = VoxelID - 1;
}
else
(*m_pPhantomHitsCollection)[m_pVoxelID[i+k*m_NumVoxelX+j*m_NumVoxelX*m_NumVoxelX]]->AddEdep(edep);
return true;
return true;
}
//....
@@ -116,9 +126,9 @@ void BrachyPhantomSD::EndOfEvent(G4HCofThisEvent*HCE)
{
static G4int HCID = -1;
if(HCID<0)
{
HCID = GetCollectionID(0);
}
{
HCID = GetCollectionID(0);
}
HCE->AddHitsCollection(HCID,m_pPhantomHitsCollection);
}
@@ -139,3 +149,6 @@ void BrachyPhantomSD::DrawAll()
void BrachyPhantomSD::PrintAll()
{
}
@@ -20,12 +20,19 @@
// * statement, and all its terms. *
// ********************************************************************
//
//
// Code developed by:
// S. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
//
// **********************************
// * *
// * BrachyPhysicsList.cc *
// * *
// **********************************
//
// $Id: BrachyPhysicsList.cc,v 1.6 2002/11/18 15:18:38 guatelli Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "BrachyPhysicsList.hh"
#include "G4ParticleDefinition.hh"
@@ -41,7 +48,7 @@
BrachyPhysicsList::BrachyPhysicsList(): G4VUserPhysicsList()
{
defaultCutValue = 1*mm;
defaultCutValue = 0.1*mm;
cutForGamma = defaultCutValue;
cutForElectron = defaultCutValue;
cutForPositron = defaultCutValue;
@@ -121,12 +128,10 @@ void BrachyPhysicsList::ConstructEM()
G4String particleName = particle->GetParticleName();
//processes
lowePhot = new G4LowEnergyPhotoElectric("LowEnPhotoElec");
loweIon = new G4LowEnergyIonisation("LowEnergyIoni");
loweBrem = new G4LowEnergyBremsstrahlung("LowEnBrem");
if (particleName == "gamma") {
//gamma
//gamma
lowePhot = new G4LowEnergyPhotoElectric("LowEnPhotoElec");
pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh);
pmanager->AddDiscreteProcess(lowePhot);
pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
@@ -134,6 +139,9 @@ void BrachyPhysicsList::ConstructEM()
} else if (particleName == "e-") {
//electron
loweIon = new G4LowEnergyIonisation("LowEnergyIoni");
loweBrem = new G4LowEnergyBremsstrahlung("LowEnBrem");
pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
pmanager->AddProcess(loweIon, -1, 2,2);
pmanager->AddProcess(loweBrem, -1,-1,3);
@@ -1,9 +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. *
// ********************************************************************
// ********************************************************************
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
// --------------------------------------------------------------
//
// Code developed by:
// S.Guatelli
//
// ********************************************
// * *
// * BrachyPrimaryGeneratorAction.cc *
// * *
// ********************************************
//
// $Id: BrachyPrimaryGeneratorAction.cc,v 1.12 2002/12/12 19:16:19 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "BrachyPrimaryGeneratorAction.hh"
#include "BrachyAnalysisManager.hh"
#include "G4ParticleTable.hh"
@@ -22,16 +56,8 @@
BrachyPrimaryGeneratorAction::BrachyPrimaryGeneratorAction()
{
G4int NumParticles = 1;
m_pParticleGun = new G4ParticleGun(NumParticles);
m_pParticleGun = new G4ParticleGun(NumParticles);
;
}
@@ -39,9 +65,8 @@ BrachyPrimaryGeneratorAction::BrachyPrimaryGeneratorAction()
BrachyPrimaryGeneratorAction::~BrachyPrimaryGeneratorAction()
{
if(m_pParticleGun)
delete m_pParticleGun;
;
}
@@ -49,60 +74,12 @@ BrachyPrimaryGeneratorAction::~BrachyPrimaryGeneratorAction()
void BrachyPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
BrachyAnalysisManager* analysis = BrachyAnalysisManager::getInstance();
G4ParticleTable* pParticleTable = G4ParticleTable::GetParticleTable();
G4String ParticleName = "gamma";
G4ParticleDefinition* pParticle = pParticleTable->FindParticle(ParticleName);
m_pParticleGun->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 ;
G4ThreeVector position(x,y,z);
m_pParticleGun->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);
m_pParticleGun->SetParticleMomentumDirection(direction);
//Energy = 0.356*MeV;
Energy = 356*keV;
m_pParticleGun->SetParticleEnergy(Energy);
//Check the energy
analysis->Spectrum(Energy);
m_pParticleGun->GeneratePrimaryVertex(anEvent);
;
}
@@ -0,0 +1,165 @@
//
// ********************************************************************
// * 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.4 2002/12/12 19:16:19 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "BrachyPrimaryGeneratorActionI.hh"
#ifdef G4ANALYSIS_USE
#include "BrachyAnalysisManager.hh"
#endif
//#include "BrachyPrimaryGeneratorMessenger.hh"
#include "G4ParticleTable.hh"
#include "Randomize.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4IonTable.hh"
#include "G4RadioactiveDecay.hh"
#include "G4UImanager.hh"
#include "globals.hh"
#include <math.h>
#include "G4RunManager.hh"
//....
BrachyPrimaryGeneratorActionI::BrachyPrimaryGeneratorActionI()
{
G4int NumParticles = 1;
m_pParticleGun = new G4ParticleGun(NumParticles);
//create a messenger for this class
// gunMessenger = new BrachyPrimaryGeneratorMessenger(this);
vettore.push_back(0.783913);
vettore.push_back(0.170416);
vettore.push_back(0.045671);
}
//....
BrachyPrimaryGeneratorActionI::~BrachyPrimaryGeneratorActionI()
{
if(m_pParticleGun)
delete m_pParticleGun;
//delete gunMessenger;
}
//....
void BrachyPrimaryGeneratorActionI::GeneratePrimaries(G4Event* anEvent)
{
#ifdef G4ANALYSIS_USE
BrachyAnalysisManager* analysis = BrachyAnalysisManager::getInstance();
#endif
G4ParticleTable* pParticleTable = G4ParticleTable::GetParticleTable();
G4String ParticleName = "gamma";
G4ParticleDefinition* pParticle = pParticleTable->FindParticle(ParticleName);
// G4cout<<"arrivo allfind particle"<<G4endl;
m_pParticleGun->SetParticleDefinition(pParticle);
// Random generation of gamma source point inside the Iodium core
G4double x,y,z;
G4double radiusmax = 0.30*mm;
G4double radiusmin=0.085*mm;
do{
x = (G4UniformRand()-0.5)*(radiusmax)/0.5;
y = (G4UniformRand()-0.5)*(radiusmax)/0.5;
}while(((x*x+y*y )> (radiusmax*radiusmax))||((x*x+y*y)<(radiusmin*radiusmin)));
z = (G4UniformRand()-0.5)*1.75*mm/0.5 ;
G4ThreeVector position(x,y,z);
m_pParticleGun->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);
m_pParticleGun->SetParticleMomentumDirection(direction);
G4double random=G4UniformRand();
G4double sum=0;
G4int i=0;
while(sum<random){sum+=vettore[i];
i++;}
if(i==1){Energy=27.4*keV;}
else{
if(i==2){Energy=31.4*keV;}
else {Energy=35.5*keV;}}
//G4double Energy= 28.451602*keV;
m_pParticleGun->SetParticleEnergy(Energy);
#ifdef G4ANALYSIS_USE
analysis->Spectrum(Energy);
#endif
m_pParticleGun->GeneratePrimaryVertex(anEvent);
}
G4double BrachyPrimaryGeneratorActionI::GetEnergy()
{ return Energy;}
@@ -0,0 +1,140 @@
//
// ********************************************************************
// * 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. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
//
// ********************************************
// * *
// * BrachyPrimaryGeneratorActionIr.cc *
// * *
// ********************************************
//
// $Id: BrachyPrimaryGeneratorActionIr.cc,v 1.4 2002/12/12 19:16:19 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "BrachyPrimaryGeneratorActionIr.hh"
#ifdef G4ANALYSIS_USE
#include "BrachyAnalysisManager.hh"
#endif
#include "G4ParticleTable.hh"
#include "Randomize.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4IonTable.hh"
#include "G4RadioactiveDecay.hh"
#include "G4UImanager.hh"
#include "globals.hh"
#include <math.h>
#include "G4RunManager.hh"
//....
BrachyPrimaryGeneratorActionIr::BrachyPrimaryGeneratorActionIr()
{
G4int NumParticles = 1;
m_pParticleGun = new G4ParticleGun(NumParticles);
}
//....
BrachyPrimaryGeneratorActionIr::~BrachyPrimaryGeneratorActionIr()
{
if(m_pParticleGun)
delete m_pParticleGun;
}
//....
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);
m_pParticleGun->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 ;
G4ThreeVector position(x,y,z);
m_pParticleGun->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);
m_pParticleGun->SetParticleMomentumDirection(direction);
//Energy = 0.356*MeV;
Energy = 356*keV;
m_pParticleGun->SetParticleEnergy(Energy);
//Check the energy
#ifdef G4ANALYSIS_USE
analysis->Spectrum(Energy);
#endif
m_pParticleGun->GeneratePrimaryVertex(anEvent);
}
@@ -1,52 +1,126 @@
//
// ********************************************************************
// * 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.10 2002/12/12 19:16:19 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#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"
BrachyRunAction::BrachyRunAction()
#include "BrachyFactoryIr.hh"
#include "BrachyFactoryI.hh"
#include "BrachyFactory.hh"
#include "BrachyRunAction.hh"
BrachyRunAction::BrachyRunAction(G4String &SDNAME)
{
SDname=SDNAME;
pDet=new BrachyDetectorConstruction(SDname);
pRun= new BrachyRunMessenger(this);
}
BrachyRunAction::~BrachyRunAction()
{
{ delete pDet;
delete pDetector;
delete pRun;
}
void BrachyRunAction::BeginOfRunAction(const G4Run* aRun)
{ BrachyAnalysisManager* analysis = BrachyAnalysisManager::getInstance();
analysis->book();
G4RunManager* pRunManager=G4RunManager::GetRunManager() ;
{
#ifdef G4ANALYSIS_USE
BrachyAnalysisManager* analysis = BrachyAnalysisManager::getInstance();
analysis->book();
#endif
G4RunManager* pRunManager=G4RunManager::GetRunManager() ;
if(pRunManager)
{ switch(a)
{ case 1:
factory=new BrachyFactoryI;
break;
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
default:
factory=new BrachyFactoryIr;
}
G4VUserPrimaryGeneratorAction* irPrimary=factory->CreatePrimaryGeneratorAction();
if(irPrimary)
{ pRunManager->SetUserAction (irPrimary);}
}
}
void BrachyRunAction::SelectEnergy(G4int choice)
{a=choice;
if (a==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;
G4cout << "number of event = " << aRun->GetNumberOfEvent() << G4endl;
analysis->finish();
#ifdef G4ANALYSIS_USE
analysis->finish();
#endif
delete factory;
}
@@ -0,0 +1,96 @@
//
// ********************************************************************
// * 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.3 2002/12/08 22:40:55 stesting Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
//
// *******************************
// * *
// * BrachyRunMessenger.cc *
// * *
// *******************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "BrachyRunMessenger.hh"
#include"BrachyFactoryIr.hh"
#include "BrachyRunAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
BrachyRunMessenger::BrachyRunMessenger( BrachyRunAction* pBrachyRun):
pRun(pBrachyRun)
{
mydetDir = new G4UIdirectory("/run/");
mydetDir->SetGuidance("Control gamma energy.");
selDetCmd=new G4UIcmdWithAString("/run/energy",this);
selDetCmd->SetGuidance("Select the energy of gamma emitted by the source.");
selDetCmd->SetGuidance(" Iodium: Iodium Source ");
selDetCmd->SetGuidance(" Iridium: Iridium Source " );
selDetCmd->SetParameterName("choice",true);
selDetCmd->SetDefaultValue("Iridium");
selDetCmd->SetCandidates("Iridium / Iodium");
selDetCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
BrachyRunMessenger::~BrachyRunMessenger()
{
delete selDetCmd;
delete mydetDir;
//delete detDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void BrachyRunMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == selDetCmd )
{if (newValue== "Iodium") pRun->SelectEnergy(1);
else pRun->SelectEnergy(0);
}
}
@@ -1,3 +1,40 @@
//
// ********************************************************************
// * 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.5 2002/11/18 15:18:39 guatelli Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#ifdef G4VIS_USE
#include "BrachyVisManager.hh"