Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
@@ -0,0 +1,208 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: MedLinacAnalysisManager.cc,v 1.4 2004/06/18 09:17:41 gunter Exp $
//
//
// Code developed by: M. Piergentili
//
//
#ifdef G4ANALYSIS_USE
#include <stdlib.h>
#include <fstream>
#include "MedLinacAnalysisManager.hh"
#include "G4ios.hh"
#include "AIDA/IHistogram1D.h"
#include "AIDA/IHistogram2D.h"
#include "AIDA/IManagedObject.h"
#include "AIDA/IAnalysisFactory.h"
#include "AIDA/IHistogramFactory.h"
#include "AIDA/ITupleFactory.h"
#include "AIDA/ITreeFactory.h"
#include "AIDA/ITree.h"
MedLinacAnalysisManager* MedLinacAnalysisManager::instance = 0;
MedLinacAnalysisManager::MedLinacAnalysisManager():
aFact(0), theTree(0), histFact(0),h1(0),h2(0),h3(0),h4(0),h5(0),h6(0),h7(0),h8(0)
{
//build up the factories
aFact = AIDA_createAnalysisFactory();
AIDA::ITreeFactory *treeFact = aFact->createTreeFactory();
//parameters for the TreeFactory
std::string fileName = "MedLinac.hbk";
theTree = treeFact->create(fileName,"hbook",false, true);
delete treeFact;
histFact = aFact->createHistogramFactory( *theTree );
}
MedLinacAnalysisManager::~MedLinacAnalysisManager()
{
delete histFact;
histFact = 0;
delete theTree;
histFact = 0;
delete aFact;
aFact = 0;
}
MedLinacAnalysisManager* MedLinacAnalysisManager::getInstance()
{
if (instance == 0) instance = new MedLinacAnalysisManager;
return instance;
}
void MedLinacAnalysisManager::book()
{
//creating a 2D histogram ...
h1 = histFact->createHistogram2D("10","Energy, pos x z", //histoID,histo name
340 ,-170.,170., //bins'number,xmin,xmax
340,-170.,170. );//bins'number,zmin,zmax
//creating a 1D histogram ...
h2 = histFact->createHistogram1D("20","Initial Energy", //histoID,histo name
500,3.0,9.0); //bins' number, xmin, xmax
//creating an other 2D histogram ...
h3 = histFact->createHistogram2D("30","Energy, pos x y", //histoID,histo name
340 ,-170.,170., //bins'number,xmin,xmax
340,-170.,170. );//bins'number,ymin,ymax
//creating an other 1D histogram ...
h4 = histFact->createHistogram1D("40","PDD", //histoID,histo name
300,-150.0,150.0); //bins' number, zmin, zmax
//creating an other 1D histogram ...
h5 = histFact->createHistogram1D("50","Flatness at build-up depth", //histoID,histo name
300,-150.0,150.0); //bins' number, zmin, zmax
//creating an other 1D histogram ...
h6 = histFact->createHistogram1D("60","Flatness 50mm depth", //histoID,histo name
300,-150.0,150.0); //bins' number, zmin, zmax
//creating an other 1D histogram ...
h7 = histFact->createHistogram1D("70","Flatness 100mm depth", //histoID,histo name
300,-150.0,150.0); //bins' number, zmin, zmax
//creating an other 1D histogram ...
h8 = histFact->createHistogram1D("80","Flatness 200mm depth", //histoID,histo name
300,-150.0,150.0); //bins' number, zmin, zmax
}
void MedLinacAnalysisManager::FillHistogram1WithEnergy(G4double x,
G4double z,
G4float energyDeposit)
{
//2DHistrogram: energy deposit in a voxel which center is fixed in position (x,z)
h1->fill(x,z,energyDeposit);
}
//Units: the energy deposit is in MeV; x, y, z in mm for histograms
void MedLinacAnalysisManager::PrimaryParticleEnergySpectrum(G4double pEnergy)
{
//1DHistogram: energy spectrum of primary particles
h2->fill(pEnergy/MeV);
}
void MedLinacAnalysisManager::FillHistogram3WithEnergy(G4double x,
G4double y,
G4float energyDeposit)
{
//2DHistrogram: energy deposit in a voxel which center is fixed in position (x,y)
h3->fill(x,y,energyDeposit);
}
void MedLinacAnalysisManager::FillHistogram4WithEnergy(G4double z,
G4float energyDeposit)
{
//1DHistrogram: energy deposit in a voxel which center is fixed in position (0,0,z)
h4->fill(z,energyDeposit);
}
void MedLinacAnalysisManager::FillHistogram5WithEnergy(G4double x,
G4float energyDeposit)
{
//1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,135mm)
h5->fill(x,energyDeposit);
}
void MedLinacAnalysisManager::FillHistogram6WithEnergy(G4double x,
G4float energyDeposit)
{
//1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,100mm)
h6->fill(x,energyDeposit);
}
void MedLinacAnalysisManager::FillHistogram7WithEnergy(G4double x,
G4float energyDeposit)
{
//1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,50mm)
h7->fill(x,energyDeposit);
}
void MedLinacAnalysisManager::FillHistogram8WithEnergy(G4double x,
G4float energyDeposit)
{
//1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,-50mm)
h8->fill(x,energyDeposit);
}
void MedLinacAnalysisManager::finish()
{
// write all histograms to file ...
theTree->commit();
// close (will again commit) ...
theTree->close();
}
#endif
@@ -0,0 +1,45 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: MedLinacDecorator.cc,v 1.1 2004/05/14 18:25:40 mpiergen Exp $
//
//
// Code developed by: M. Piergentili
#include "MedLinacVGeometryComponent.hh"
#include "MedLinacDecorator.hh"
MedLinacDecorator::MedLinacDecorator(MedLinacVGeometryComponent* geoComponent)
: component(geoComponent)
{
}
MedLinacDecorator::~MedLinacDecorator()
{;}
void MedLinacDecorator::ConstructComponent(G4VPhysicalVolume*,G4VPhysicalVolume*)
{;}
void MedLinacDecorator::DestroyComponent()
{;}
@@ -0,0 +1,460 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: MedLinacDetectorConstruction.cc,v 1.4 2004/05/14 18:25:40 mpiergen Exp $
//
// Code developed by: M. Piergentili
//
//
//------------------------------ beam line along z axis---------------------
#include "MedLinacDetectorMessenger.hh"
#include "MedLinacDetectorConstruction.hh"
#include "MedLinacPhantomROGeometry.hh"
#include "MedLinacPhantomSD.hh"
#include "MedLinacVGeometryComponent.hh"
#include "MedLinacHead.hh"
#include "MedLinacDecorator.hh"
#include "MedLinacTargetAndFilterDecorator.hh"
#include "G4CSGSolid.hh"
#include "G4RotationMatrix.hh"
#include "G4Transform3D.hh"
#include "G4Material.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4MaterialTable.hh"
#include "G4MaterialPropertyVector.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4PVParameterised.hh"
#include "globals.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "Randomize.hh"
#include "G4TransportationManager.hh"
#include "G4UserLimits.hh"
#include "G4GeometryManager.hh"
#include "G4BooleanSolid.hh"
#include "G4SubtractionSolid.hh"
#include "G4VSolid.hh"
#include "G4Region.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4RegionStore.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
MedLinacDetectorConstruction::MedLinacDetectorConstruction(G4String SDName)
: phantomSD(0),phantomROGeometry(0),
experimentalHall_log(0),vacuumBlock_log(0),
JawY1_log(0),JawY2_log(0),
JawX1_log(0),JawX2_log(0),
Phantom_log(0),
experimentalHall_phys(0),vacuumBlock_phys(0),
JawY1_phys(0), JawY2_phys(0),
JawX1_phys(0), JawX2_phys(0),
Phantom_phys(0)
{
numberOfVoxelsAlongX=300;
numberOfVoxelsAlongY=300;
numberOfVoxelsAlongZ=300;
ComputeDimVoxel();
sensitiveDetectorName = SDName;
// default parameter values
fieldX1 = -10.*cm;
fieldX2 = 10.*cm;
fieldY1 = -10.*cm;
fieldY2 = 10.*cm;
detectorMessenger = new MedLinacDetectorMessenger(this);
pHead = new MedLinacHead();
decorator = new MedLinacTargetAndFilterDecorator(pHead);
}
MedLinacDetectorConstruction* MedLinacDetectorConstruction::instance = 0;
MedLinacDetectorConstruction* MedLinacDetectorConstruction::GetInstance(G4String SDName)
{
if (instance == 0)
{
instance = new MedLinacDetectorConstruction(SDName);
}
return instance;
}
MedLinacDetectorConstruction::~MedLinacDetectorConstruction()
{
delete detectorMessenger;
delete pHead;
delete decorator;
//delete decorator1;
//delete decorator2;
}
G4VPhysicalVolume* MedLinacDetectorConstruction::Construct()
{
return ConstructGeom();
}
G4VPhysicalVolume* MedLinacDetectorConstruction::ConstructGeom ()
{
// Cleanup old geometry
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
// materials
G4double a; // atomic mass
G4double z; // atomic number
G4double density;
G4int ncomponents;
G4int natoms;
G4String name;
G4String symbol;
G4double fractionmass;
G4double massOfMole;
G4double pressure;
G4double temperature;
a = 14.00674*g/mole;
G4Element* elN = new G4Element(name="Nitrogen" ,symbol="N", z=7., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen",symbol="O", z=8., a);
a = 1.00794*g/mole;
G4Element* elH = new G4Element(name="Hydrogen",symbol="H", z=1., a);
density = 1.290*mg/cm3;
G4Material* Air = new G4Material(name="Air",density, ncomponents=2);
Air->AddElement(elN, fractionmass=70*perCent);
Air->AddElement(elO, fractionmass=30*perCent);
density = 1.000*g/cm3;
G4Material* H2O = new G4Material(name="Water",density, ncomponents=2);
H2O->AddElement(elH, natoms=2);
H2O->AddElement(elO, natoms=1);
a = 207.19*g/mole;
density = 11.35*g/cm3;
G4Material* Pb = new G4Material(name="Lead", z=82., a, density);
massOfMole = 1.008*g/mole;
density = 1.e-25*g/cm3;
temperature = 2.73*kelvin;
pressure = 3.e-18*pascal;
G4Material* Vacuum = new G4Material("interGalactic", z=1.,massOfMole,
density, kStateGas,temperature, pressure);
//------------------------------ beam line along z axis------------------
//---------jaws position--------
//----1Y------------------------
G4double thetaY1 = atan(-fieldY1/(100.*cm));// in rad
G4double JawY1Pos_y = -((3.9*cm+28.*cm)*sin(thetaY1)+5.*cm*cos(thetaY1));
G4double JawY1Pos_z =115.*cm-((3.9*cm+28.*cm)*cos(thetaY1))+5.*cm*sin(thetaY1);
//----2Y-------------------------
G4double thetaY2 = atan(fieldY2/(100.*cm)); // in rad
G4double JawY2Pos_y = (3.9*cm+28.*cm)*sin(thetaY2)+5.*cm*cos(thetaY2);
G4double JawY2Pos_z = 115.*cm-(3.9*cm+28.*cm)*cos(thetaY2)+5.*cm*sin(thetaY2);
//----1X-------------------------
G4double thetaX1 = atan(-fieldX1/(100.*cm));
G4double JawX1Pos_x = -((36.7*cm+3.9*cm)*sin(thetaX1)+5.*cm*cos(thetaX1));
G4double JawX1Pos_z =115.*cm-(36.7*cm+3.9*cm)*cos(thetaX1)+5.*cm*sin(thetaX1);
//----2X-------------------------
G4double thetaX2 = atan(fieldX2/(100.*cm));
G4double JawX2Pos_x = (36.7*cm+3.9*cm)*sin(thetaX2)+5.*cm*cos(thetaX2);
G4double JawX2Pos_z = 115.*cm-(36.7*cm+3.9*cm)*cos(thetaX2)+5.*cm*sin(thetaX2);
//---------rotation jaw1Y--------
G4RotationMatrix* rotatejaw1Y=new G4RotationMatrix();
rotatejaw1Y->rotateX(thetaY1);
//---------rotation jaw2Y--------
G4RotationMatrix* rotatejaw2Y=new G4RotationMatrix();
rotatejaw2Y->rotateX(-thetaY2);
//---------rotation jaw1X--------
G4RotationMatrix* rotatejaw1X=new G4RotationMatrix();
rotatejaw1X->rotateY(-thetaX1);
//---------rotation jaw2X--------
G4RotationMatrix* rotatejaw2X=new G4RotationMatrix();
rotatejaw2X->rotateY(thetaX2);
//---------------colors----------
G4Colour white (1.0, 1.0, 1.0);
G4Colour magenta (1.0, 0.0, 1.0);
G4Colour lblue (0.20, .50, .85);
//------------------------------------------------------ volumes
//------------------------------ beam line along z axis-------SSD=100cm--------------
//------------------------------ experimental hall (world volume)
G4double expHall_x = 3.0*m;
G4double expHall_y = 3.0*m;
G4double expHall_z = 3.0*m;
G4Box* experimentalHall_box
= new G4Box("expHall_box",expHall_x,expHall_y,expHall_z);
experimentalHall_log = new G4LogicalVolume(experimentalHall_box,
Air,"expHall_log",0,0,0);
experimentalHall_phys = new G4PVPlacement(0,G4ThreeVector(),
"expHall",experimentalHall_log,0,false,0);
//------------------------vacuum box------------------------
G4double vacudim_x = 9.*cm;
G4double vacudim_y = 9.*cm;
G4double vacudim_z = 8.755*cm;
G4Box* vacuumBlock_box = new G4Box("vacuumBlock_box",vacudim_x,
vacudim_y,vacudim_z);
vacuumBlock_log = new G4LogicalVolume(vacuumBlock_box,
Vacuum,"vacuumBlock_log",0,0,0);
G4double vacublockPos_x = 0.0*m;
G4double vacublockPos_y = 0.0*m;
G4double vacublockPos_z = 114.755*cm;
vacuumBlock_phys = new G4PVPlacement(0,
G4ThreeVector(vacublockPos_x,vacublockPos_y,vacublockPos_z),
"vacuBlock",vacuumBlock_log,experimentalHall_phys,false,0);
//----------------Jaw Y1 collimator---------------
G4double JawY1Dim_x = 10.0*cm;
G4double JawY1Dim_y = 5.0*cm;
G4double JawY1Dim_z = 2.5*cm;
G4Box* JawY1 = new G4Box("JawY1",JawY1Dim_x,
JawY1Dim_y,JawY1Dim_z);
JawY1_log = new G4LogicalVolume(JawY1,
Pb,"JawY1_log",0,0,0);
G4double JawY1Pos_x = 0.0*cm;
JawY1_phys = new G4PVPlacement(rotatejaw1Y,
G4ThreeVector(JawY1Pos_x,JawY1Pos_y,JawY1Pos_z),
"JawY1",JawY1_log,experimentalHall_phys,false,0);
//----------------Jaw Y2 collimator---------------
G4double JawY2Dim_x = 10.0*cm;
G4double JawY2Dim_y = 5.0*cm;
G4double JawY2Dim_z = 2.5*cm;
G4Box* JawY2 = new G4Box("JawY2",JawY2Dim_x,
JawY2Dim_y,JawY2Dim_z);
JawY2_log = new G4LogicalVolume(JawY2,
Pb,"JawY1_log",0,0,0);
G4double JawY2Pos_x = 0.0*cm;
JawY2_phys = new G4PVPlacement(rotatejaw2Y,
G4ThreeVector(JawY2Pos_x,JawY2Pos_y,JawY2Pos_z),
"JawY2",JawY2_log,experimentalHall_phys,false,0);
//----------------Jaw X1 collimator---------------
G4double JawX1Dim_x = 5.0*cm;
G4double JawX1Dim_y = 10.0*cm;
G4double JawX1Dim_z = 2.5*cm;
G4Box* JawX1 = new G4Box("JawX1",JawX1Dim_x,
JawX1Dim_y,JawX1Dim_z);
JawX1_log = new G4LogicalVolume(JawX1,
Pb,"JawX1_log",0,0,0);
G4double JawX1Pos_y = 0.0*cm;
JawX1_phys = new G4PVPlacement(rotatejaw1X,
G4ThreeVector(JawX1Pos_x,JawX1Pos_y,JawX1Pos_z),
"JawX1",JawX1_log,experimentalHall_phys,false,0);
//----------------Jaw X2 collimator---------------
G4double JawX2Dim_x = 5.0*cm;
G4double JawX2Dim_y = 10.0*cm;
G4double JawX2Dim_z = 2.5*cm;
G4Box* JawX2 = new G4Box("JawX2",JawX2Dim_x,
JawX2Dim_y,JawX2Dim_z);
JawX2_log = new G4LogicalVolume(JawX2,
Pb,"JawX1_log",0,0,0);
G4double JawX2Pos_y = 0.0*cm;
JawX2_phys = new G4PVPlacement(rotatejaw2X,
G4ThreeVector(JawX2Pos_x,JawX2Pos_y,JawX2Pos_z),
"JawX2",JawX2_log,experimentalHall_phys,false,0);
//----------------Phantom---------
phantomDim_x = 15.*cm;
phantomDim_y = 15.*cm;
phantomDim_z = 15.*cm;
G4Box* Phantom = new G4Box("Phantom",phantomDim_x,
phantomDim_y,phantomDim_z);
Phantom_log = new G4LogicalVolume(Phantom,
H2O,"Phantom_log",0,0,0);
G4double PhantomPos_x = 0.0*m;
G4double PhantomPos_y = 0.0*m;
G4double PhantomPos_z = 0.0*cm;
Phantom_phys = new G4PVPlacement(0,
G4ThreeVector(PhantomPos_x,PhantomPos_y,PhantomPos_z),
"Phantom_phys",Phantom_log,experimentalHall_phys,false,0);
PrintParameters();
//--------- Visualization attributes -------------------------------
G4VisAttributes* simpleH2OVisAtt= new G4VisAttributes(lblue);
simpleH2OVisAtt->SetVisibility(true);
simpleH2OVisAtt->SetForceSolid(true);
Phantom_log->SetVisAttributes(simpleH2OVisAtt);
G4VisAttributes* simpleVacuumWVisAtt= new G4VisAttributes(white);
simpleVacuumWVisAtt->SetVisibility(true);
simpleVacuumWVisAtt->SetForceWireframe(true);
vacuumBlock_log->SetVisAttributes(simpleVacuumWVisAtt);
G4VisAttributes* simpleLeadSVisAtt= new G4VisAttributes(magenta);
simpleLeadSVisAtt->SetVisibility(true);
simpleLeadSVisAtt->SetForceSolid(true);
JawY1_log->SetVisAttributes(simpleLeadSVisAtt);
JawY2_log->SetVisAttributes(simpleLeadSVisAtt);
JawX1_log->SetVisAttributes(simpleLeadSVisAtt);
JawX2_log->SetVisAttributes(simpleLeadSVisAtt);
G4VisAttributes* simpleWorldVisAtt= new G4VisAttributes(white);
simpleWorldVisAtt->SetVisibility(false);
experimentalHall_log ->SetVisAttributes(simpleWorldVisAtt);
//if you want not to see phantom, jaws e vacuum ...:
//Phantom_log->SetVisAttributes(simpleWorldVisAtt);
//JawY1_log->SetVisAttributes(simpleWorldVisAtt);
//JawY2_log->SetVisAttributes(simpleWorldVisAtt);
//JawX1_log->SetVisAttributes(simpleWorldVisAtt);
//JawX2_log->SetVisAttributes(simpleWorldVisAtt);
vacuumBlock_log->SetVisAttributes(simpleWorldVisAtt);
// Sets a max Step length in the detector
G4double maxStep = 0.1*mm;
Phantom_log->SetUserLimits(new G4UserLimits(maxStep));
ConstructVolume();
ConstructSensitiveDetector();
return experimentalHall_phys;
}
void MedLinacDetectorConstruction::PrintParameters()
{
G4cout <<"jaws1 x position "<< fieldX1/cm << " cm "<<G4endl ;
G4cout <<"jaws2 x position "<< fieldX2/cm << " cm "<<G4endl ;
G4cout <<"jaws1 y position "<< fieldY1/cm << " cm "<<G4endl ;
G4cout <<"jaws2 y position "<< fieldY2/cm << " cm "<<G4endl ;
}
void MedLinacDetectorConstruction::SetJawX1Pos_x (G4double val)
{
fieldX1 = val;
}
void MedLinacDetectorConstruction::SetJawX2Pos_x (G4double val)
{
fieldX2 = val;
}
void MedLinacDetectorConstruction::SetJawY1Pos_y (G4double val)
{
fieldY1 = val;
}
void MedLinacDetectorConstruction::SetJawY2Pos_y (G4double val)
{
fieldY2 = val;
}
void MedLinacDetectorConstruction::UpdateGeometry()
{
G4cout <<"UpdateGeometry "<< G4endl;
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructGeom());
}
void MedLinacDetectorConstruction::ConstructVolume()
{
pHead ->ConstructComponent(experimentalHall_phys,vacuumBlock_phys);
decorator ->ConstructComponent( experimentalHall_phys,vacuumBlock_phys);
}
void MedLinacDetectorConstruction::ConstructSensitiveDetector()
// Sensitive Detector and ReadOut geometry definition
{
G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
if(!phantomSD)
{
phantomSD = new MedLinacPhantomSD (sensitiveDetectorName);
pSDManager->AddNewDetector(phantomSD);
}
G4String ROGeometryName = "PhantomROGeometry";
phantomROGeometry = new MedLinacPhantomROGeometry (ROGeometryName, phantomDim_x,phantomDim_y,phantomDim_z,
numberOfVoxelsAlongX,numberOfVoxelsAlongY,numberOfVoxelsAlongZ);
phantomROGeometry->BuildROGeometry();
phantomSD->SetROgeometry(phantomROGeometry);
Phantom_log->SetSensitiveDetector(phantomSD);
}
@@ -0,0 +1,136 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: MedLinacDetectorMessenger.cc,v 1.3 2004/05/14 18:25:40 mpiergen Exp $
//
// Code developed by: M. Piergentili
#include "MedLinacDetectorMessenger.hh"
#include "MedLinacDetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//*********************************************************************
MedLinacDetectorMessenger::MedLinacDetectorMessenger(
MedLinacDetectorConstruction* MedLinacDet)
:MedLinacDetector(MedLinacDet)
{
MedLinacDir = new G4UIdirectory("/Jaws/");
MedLinacDir->SetGuidance("jaws position");
X1Dir = new G4UIdirectory("/Jaws/X1/");
X2Dir = new G4UIdirectory("/Jaws/X2/");
Y1Dir = new G4UIdirectory("/Jaws/Y1/");
Y2Dir = new G4UIdirectory("/Jaws/Y2/");
JawX1PosCmd = new G4UIcmdWithADoubleAndUnit("/Jaws/X1/DistanceFromAxis",this);
JawX1PosCmd->SetGuidance("Set jawsx1 position (negative)");
JawX1PosCmd->SetParameterName("JawsX1Pos_x",false);
JawX1PosCmd->SetRange("JawsX1Pos_x<=0. && JawsX1Pos_x>-1000.");
JawX1PosCmd->SetDefaultUnit( "cm" );
JawX1PosCmd->SetUnitCategory("Length");
JawX1PosCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
JawX2PosCmd = new G4UIcmdWithADoubleAndUnit("/Jaws/X2/DistanceFromAxis",this);
JawX2PosCmd->SetGuidance("Set jawsx2 position (positive)");
JawX2PosCmd->SetParameterName("JawsX2Pos_x",false);
JawX2PosCmd->SetRange("JawsX2Pos_x>=0. && JawsX2Pos_x<1000.");
JawX2PosCmd->SetDefaultUnit( "cm" );
JawX2PosCmd->SetUnitCategory("Length");
JawX2PosCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
JawY1PosCmd = new G4UIcmdWithADoubleAndUnit("/Jaws/Y1/DistanceFromAxis",this);
JawY1PosCmd->SetGuidance("Set jawsy1 position (negative)");
JawY1PosCmd->SetParameterName("JawsY1Pos_y",false);
JawY1PosCmd->SetRange("JawsY1Pos_y<=0. && JawsY1Pos_y>-1000.");
JawY1PosCmd->SetDefaultUnit( "cm" );
JawY1PosCmd->SetUnitCategory("Length");
JawY1PosCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
JawY2PosCmd = new G4UIcmdWithADoubleAndUnit("/Jaws/Y2/DistanceFromAxis",this);
JawY2PosCmd->SetGuidance("Set jawsy2 position (positive)");
JawY2PosCmd->SetParameterName("JawsY2Pos_y",false);
JawY2PosCmd->SetRange("JawsY2Pos_y>=0. && JawsY2Pos_y<1000.");
JawY2PosCmd->SetDefaultUnit( "cm" );
JawY2PosCmd->SetUnitCategory("Length");
JawY2PosCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
UpdateCmd = new G4UIcmdWithoutParameter("/Jaws/update",this);
UpdateCmd->SetGuidance("Update geometry.");
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
UpdateCmd->AvailableForStates(G4State_Idle);
}
//****************************************************************************
MedLinacDetectorMessenger::~MedLinacDetectorMessenger()
{
delete JawX1PosCmd;
delete JawX2PosCmd;
delete JawY1PosCmd;
delete JawY2PosCmd;
delete UpdateCmd;
delete MedLinacDir;
delete X1Dir;
delete X2Dir ;
delete Y1Dir;
delete Y2Dir;
}
//****************************************************************************
void MedLinacDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == JawX1PosCmd )
{ MedLinacDetector->SetJawX1Pos_x(JawX1PosCmd->GetNewDoubleValue(newValue));}
if( command == JawX2PosCmd )
{ MedLinacDetector->SetJawX2Pos_x(JawX2PosCmd->GetNewDoubleValue(newValue));}
if( command == JawY1PosCmd )
{ MedLinacDetector->SetJawY1Pos_y(JawY1PosCmd->GetNewDoubleValue(newValue));}
if( command == JawY2PosCmd )
{ MedLinacDetector->SetJawY2Pos_y(JawY2PosCmd->GetNewDoubleValue(newValue));}
if( command == UpdateCmd )
{ MedLinacDetector->UpdateGeometry(); }
}
//****************************************************************************
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: MedLinacEventAction.cc,v 1.3 2004/05/14 18:25:40 mpiergen Exp $
//
//
// Code developed by: M. Piergentili
//
#include "MedLinacEventAction.hh"
#include "MedLinacPhantomHit.hh"
#include "MedLinacPhantomSD.hh"
#include "MedLinacDetectorConstruction.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#ifdef G4ANALYSIS_USE
#include"MedLinacAnalysisManager.hh"
#endif
// Retrieve information about the energy deposit in the phantom ...
MedLinacEventAction::MedLinacEventAction() :
drawFlag("all" )
{
}
MedLinacEventAction::~MedLinacEventAction()
{
}
void MedLinacEventAction::BeginOfEventAction(const G4Event*)
{
}
void MedLinacEventAction::EndOfEventAction(const G4Event* evt)
{
// extract the trajectories and draw them ...
if (G4VVisManager::GetConcreteInstance())
{
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
for (G4int i=0; i<n_trajectories; i++)
{
G4Trajectory* trj = (G4Trajectory*)
((*(evt->GetTrajectoryContainer()))[i]);
if(drawFlag == "all") trj->DrawTrajectory(50);
else if((drawFlag == "charged")&&(trj->GetCharge() != 0.))
trj->DrawTrajectory(50);
else if ((drawFlag == "neutral")&&(trj->GetCharge() == 0.))
trj->DrawTrajectory(50);
}
}
}
@@ -0,0 +1,457 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: MedLinacHead.cc,v 1.1 2004/05/14 18:25:40 mpiergen Exp $
//
// Code developed by: M. Piergentili
//
//
//------------------------------ beam line along z axis---------------------
#include "MedLinacDetectorMessenger.hh"
#include "MedLinacDetectorConstruction.hh"
#include "MedLinacPhantomROGeometry.hh"
#include "MedLinacPhantomSD.hh"
#include "MedLinacVGeometryComponent.hh"
#include "MedLinacHead.hh"
#include "G4CSGSolid.hh"
#include "G4RotationMatrix.hh"
#include "G4Transform3D.hh"
#include "G4Material.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4MaterialTable.hh"
#include "G4MaterialPropertyVector.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4PVParameterised.hh"
#include "globals.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "Randomize.hh"
#include "G4TransportationManager.hh"
#include "G4UserLimits.hh"
#include "G4GeometryManager.hh"
#include "G4BooleanSolid.hh"
#include "G4SubtractionSolid.hh"
#include "G4VSolid.hh"
#include "G4Region.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4RegionStore.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
MedLinacHead::MedLinacHead()
: windowUp_log(0), UpperCollimator_log(0),
collim_log(0), tracker_log(0),
CylMinusCone_log(0),windowLow_log(0),
Window_log(0),SignalPlate_log(0),
Mirror_log(0),reticle_log(0),
windowUp_phys(0), UpperCollimator_phys(0),
CylMinusCone_phys(0), windowLow_phys(0),
Window1_phys(0), SignalPlate1_phys(0),
SignalPlate2_phys(0), Window2_phys(0),
SignalPlate3_phys(0), SignalPlate4_phys(0),
Window3_phys(0),Mirror_phys(0),
reticle_phys(0), aLowerCollRegion(0),aUpperCollRegion(0)
{
aLowerCollRegion = new G4Region("PrimaryCollimatorLow");
aUpperCollRegion = new G4Region("PrimaryCollimatorUp");
}
MedLinacHead::~MedLinacHead()
{;}
void MedLinacHead::ConstructComponent(G4VPhysicalVolume* world,G4VPhysicalVolume* vacuumBlock)
{
// materials
G4double a; // atomic mass
G4double z; // atomic number
G4double density;
G4int ncomponents;
G4String name;
G4String symbol;
G4double fractionmass;
G4double massOfMole;
G4double temperature;
G4double pressure;
a = 14.00674*g/mole;
G4Element* elN = new G4Element(name="Nitrogen" ,symbol="N", z=7., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen",symbol="O", z=8., a);
a = 1.00794*g/mole;
G4Element* elH = new G4Element(name="Hydrogen",symbol="H", z=1., a);
a = 12.011*g/mole;
G4Element* elC = new G4Element(name="Carbon",symbol="C", z=6. , a );
a = 49.29*g/mole;
density = 2.6989*g/cm3;
G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
density = 1.290*mg/cm3;
G4Material* Air = new G4Material(name="Air",density, ncomponents=2);
Air->AddElement(elN, fractionmass=70*perCent);
Air->AddElement(elO, fractionmass=30*perCent);
a = 207.19*g/mole;
density = 11.35*g/cm3;
G4Material* Pb = new G4Material(name="Lead", z=82., a, density);
density = 1.848*g/cm3;
a = 9.012182*g/mole;
G4Material* Be = new G4Material(name="Beryllium" , z=4., a, density);
density = 1.39*g/cm3;
G4Material* Mylar = new G4Material(name="Mylar",density , ncomponents=3, kStateUndefined, 273.15*kelvin, 1.0*atmosphere );
Mylar->AddElement( elH, 4 );
Mylar->AddElement( elC, 5 );
Mylar->AddElement( elO, 2 );
density = 1.42*g/cm3;
G4Material* Kapton = new G4Material(name="Kapton",density , ncomponents=4);
Kapton->AddElement( elH, 02.6362 *perCent);
Kapton->AddElement( elC, 69.1133 *perCent);
Kapton->AddElement( elN, 07.3270 *perCent);
Kapton->AddElement( elO, 20.9235 *perCent);
massOfMole = 1.008*g/mole;
density = 1.e-25*g/cm3;
temperature = 2.73*kelvin;
pressure = 3.e-18*pascal;
G4Material* Vacuum = new G4Material("interGalactic", z=1.,massOfMole,
density, kStateGas,temperature, pressure);
//------------------------------ beam line along z axis-------SSD=100cm-----------
//---------rotation matrix first collimator--------
G4RotationMatrix* rotateMatrix=new G4RotationMatrix();
rotateMatrix->rotateX(180.0*deg);
//---------rotation Mirror--------
G4RotationMatrix* rotateMirror=new G4RotationMatrix();
rotateMirror->rotateY(35.0*deg);
//---------------colors----------
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.20, .50, .85);
//------------------------------------------------------ volumes
//------------------------------ experimental hall (world volume)
//------------------------------ beam line along z axis---------------------
//--------------------window upper-------------------
G4double windowUpDim_x = 4.*cm;
G4double windowUpDim_y = 4.*cm;
G4double windowUpDim_z = 0.0125*cm;
G4Box* windowUp_box = new G4Box("windowUp_box",windowUpDim_x,windowUpDim_y,windowUpDim_z);
windowUp_log = new G4LogicalVolume(windowUp_box,Be,"windowUp_log",0,0,0);
G4double windowUpPos_x = 0.0*m;
G4double windowUpPos_y = 0.0*m;
G4double windowUpPos_z = 123.5225*cm;
windowUp_phys = new G4PVPlacement(0,
G4ThreeVector(windowUpPos_x,windowUpPos_y,windowUpPos_z),
"windowUp",windowUp_log,world,false,0);
//-------------------- the first collimator upper----------------
G4double innerRadiusOfTheTubeEx = 1.0*cm;
G4double outerRadiusOfTheTubeEx = 8.*cm;
G4double hightOfTheTubeEx = 3.0*cm;
G4double startAngleOfTheTubeEx = 0.*deg;
G4double spanningAngleOfTheTubeEx = 360.*deg;
G4Tubs* UpperCollimator = new G4Tubs("UpperCollimator",innerRadiusOfTheTubeEx,
outerRadiusOfTheTubeEx,hightOfTheTubeEx,
startAngleOfTheTubeEx,spanningAngleOfTheTubeEx);
UpperCollimator_log = new G4LogicalVolume(UpperCollimator,Pb,"UpperCollimator_log",0,0,0);
G4double UpperCollimatorPosX = 0.*cm;
G4double UpperCollimatorPosY = 0.*cm;
G4double UpperCollimatorPosZ = 2.6*cm;
UpperCollimator_phys = new G4PVPlacement(0,
G4ThreeVector(UpperCollimatorPosX,UpperCollimatorPosY,
UpperCollimatorPosZ),"UpperCollimator",
UpperCollimator_log,vacuumBlock,false,0);
//-------------------- the first collimator lower----------------
G4double pRmin1 = 0.*cm;
G4double pRmax1 = 0.6*cm;
G4double pRmin2 = 0.*cm;
G4double pRmax2 = 3.0*cm;
G4double hightOfTheCone =2.9*cm;
G4double startAngleOfTheCone = 0.*deg;
G4double spanningAngleOfTheCone = 360.*deg;
G4Cons* collim_cone = new G4Cons("collim_cone",pRmin1,pRmax1,pRmin2,
pRmax2,hightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
collim_log = new G4LogicalVolume(collim_cone,Vacuum,"collim_log",0,0,0);
G4double innerRadiusOfTheTube = 0.*cm;
G4double outerRadiusOfTheTube = 8.*cm;
G4double hightOfTheTube = 2.8*cm;
G4double startAngleOfTheTube = 0.*deg;
G4double spanningAngleOfTheTube = 360.*deg;
G4Tubs* tracker_tube = new G4Tubs("tracker_tube",innerRadiusOfTheTube,
outerRadiusOfTheTube,hightOfTheTube,
startAngleOfTheTube,spanningAngleOfTheTube);
tracker_log = new G4LogicalVolume(tracker_tube,Pb,"tracker_log",0,0,0);
G4SubtractionSolid* CylMinusCone = new G4SubtractionSolid("Cyl-Cone",
tracker_tube,collim_cone);
CylMinusCone_log = new G4LogicalVolume(CylMinusCone,Pb,"CylminusCone_log",0,0,0);
G4double CminusCPos_x = 0.*cm;
G4double CminusCPos_y = 0.*cm;
G4double CminusCPos_z = -3.5*cm;
CylMinusCone_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(CminusCPos_x,CminusCPos_y,CminusCPos_z),
"CylMinusCone",CylMinusCone_log,vacuumBlock,false,0);
//------------------window lower-------------------
G4double windowLowDim_x = 4.*cm;
G4double windowLowDim_y = 4.*cm;
G4double windowLowDim_z = 0.01*cm;
G4Box* windowLow_box = new G4Box("windowLow_box",windowLowDim_x,windowLowDim_y,windowLowDim_z);
windowLow_log = new G4LogicalVolume(windowLow_box,Be,"windowLow_log",0,0,0);
G4double windowLowPos_x = 0.0*m;
G4double windowLowPos_y = 0.0*m;
G4double windowLowPos_z = 105.9873*cm;
windowLow_phys = new G4PVPlacement(0,
G4ThreeVector(windowLowPos_x,windowLowPos_y,windowLowPos_z),
"windowLow",windowLow_log,world,false,0);
//---------------Ion chamber------------------------
G4double innerRadiusOfTheIonChamber = 0.*cm;
G4double outerRadiusOfTheIonChamber = 7.0*cm;
G4double hightOfTheWindows = 0.0125*cm;
G4double hightOfTheSignalPlates = 0.002*cm;
G4double startAngleOfTheIonChamber = 0.*deg;
G4double spanningAngleOfTheIonChamber = 360.*deg;
G4double IonChamberPos_x = 0.0*cm;
G4double IonChamberPos_y = 0.0*cm;
G4Tubs* Window = new G4Tubs("Window",innerRadiusOfTheIonChamber,
outerRadiusOfTheIonChamber,hightOfTheWindows,
startAngleOfTheIonChamber,spanningAngleOfTheIonChamber);
Window_log = new G4LogicalVolume(Window,Kapton,"Window_log",0,0,0);
G4Tubs* SignalPlate = new G4Tubs("SignalPlate",innerRadiusOfTheIonChamber,
outerRadiusOfTheIonChamber,hightOfTheSignalPlates,
startAngleOfTheIonChamber,spanningAngleOfTheIonChamber);
SignalPlate_log = new G4LogicalVolume(SignalPlate ,Kapton,"SignalPlate_log",0,0,0);
//-----Ion chamber----window 1---------------------
G4double Window1Pos_z = 100.165*cm;
Window1_phys = new G4PVPlacement(0,
G4ThreeVector(IonChamberPos_x,IonChamberPos_y,Window1Pos_z),
"Window",Window_log,world,false,0);
//------Ion chamber---Signal Plate 1---------------------
G4double SignalPlate1Pos_z = 99.927*cm;
SignalPlate1_phys = new G4PVPlacement(0,
G4ThreeVector(IonChamberPos_x,IonChamberPos_y,SignalPlate1Pos_z),
"SignalPlate",SignalPlate_log,world,false,0);
//------Ion chamber---Signal Plate 2---------------------
G4double SignalPlate2Pos_z = 99.688*cm;
SignalPlate2_phys = new G4PVPlacement(0,
G4ThreeVector(IonChamberPos_x,IonChamberPos_y,SignalPlate2Pos_z),
"SignalPlate",SignalPlate_log,world,false,0);
//------Ion chamber---window 2---------------------
G4double Window2Pos_z = 99.45*cm;
Window2_phys = new G4PVPlacement(0,
G4ThreeVector(IonChamberPos_x,IonChamberPos_y,Window2Pos_z),
"Window",Window_log,world,false,0);
//------Ion chamber---Signal Plate 3---------------------
G4double SignalPlate3Pos_z = 99.212*cm;
SignalPlate3_phys = new G4PVPlacement(0,
G4ThreeVector(IonChamberPos_x,IonChamberPos_y,SignalPlate3Pos_z),
"SignalPlate",SignalPlate_log,world,false,0);
//------Ion chamber---Signal Plate 4---------------------
G4double SignalPlate4Pos_z = 98.973*cm;
SignalPlate4_phys = new G4PVPlacement(0,
G4ThreeVector(IonChamberPos_x,IonChamberPos_y,SignalPlate4Pos_z),
"SignalPlate",SignalPlate_log,world,false,0);
//------Ion chamber---window 3---------------------
G4double Window3Pos_z = 98.735*cm;
Window3_phys = new G4PVPlacement(0,
G4ThreeVector(IonChamberPos_x,IonChamberPos_y,Window3Pos_z),
"Window",Window_log,world,false,0);
//----------------Mirror---------------------------
G4double innerRadiusOfTheMirror = 0.*cm;
G4double outerRadiusOfTheMirror = 6.*cm;
G4double hightOfTheMirror = 0.003*cm;
G4double startAngleOfTheMirror = 0.*deg;
G4double spanningAngleOfTheMirror = 360.*deg;
G4Tubs* Mirror = new G4Tubs("Mirror",innerRadiusOfTheMirror,
outerRadiusOfTheMirror,hightOfTheMirror,
startAngleOfTheMirror,spanningAngleOfTheMirror);
Mirror_log = new G4LogicalVolume(Mirror,Al,"Mirror_log",0,0,0);
G4double MirrorPos_x = 0.0*cm;
G4double MirrorPos_y = 0.0*cm;
G4double MirrorPos_z = 95.0*cm;
Mirror_phys = new G4PVPlacement(rotateMirror,
G4ThreeVector(MirrorPos_x,MirrorPos_y,MirrorPos_z),
"Mirror",Mirror_log,world,false,0);
//----------------Light Field Reticle
G4double reticleDim_x = 15.0*cm;
G4double reticleDim_y = 15.0*cm;
G4double reticleDim_z = 0.002*cm;
G4Box* reticle = new G4Box("reticle",reticleDim_x,
reticleDim_y,reticleDim_z);
reticle_log = new G4LogicalVolume(reticle,
Mylar,"reticle_log",0,0,0);
G4double reticlePos_x = 0.0*cm;
G4double reticlePos_y = 0.0*cm;
G4double reticlePos_z = 65.5*cm;
reticle_phys = new G4PVPlacement(0,
G4ThreeVector(reticlePos_x,reticlePos_y,reticlePos_z),
"reticle",reticle_log,world,false,0);
// Cuts by Regions
CylMinusCone_log->SetRegion(aLowerCollRegion);
aLowerCollRegion->AddRootLogicalVolume(CylMinusCone_log);
UpperCollimator_log->SetRegion(aUpperCollRegion);
aUpperCollRegion->AddRootLogicalVolume(UpperCollimator_log);
//--------- Visualization attributes -------------------------------
G4VisAttributes* simpleLeadWVisAtt= new G4VisAttributes(magenta);
simpleLeadWVisAtt->SetVisibility(true);
simpleLeadWVisAtt->SetForceWireframe(true);
collim_log->SetVisAttributes(simpleLeadWVisAtt);
CylMinusCone_log->SetVisAttributes(simpleLeadWVisAtt);
UpperCollimator_log->SetVisAttributes(simpleLeadWVisAtt);
G4VisAttributes* simpleCopperSVisAtt= new G4VisAttributes(cyan);
simpleCopperSVisAtt->SetVisibility(true);
simpleCopperSVisAtt->SetForceSolid(true);
G4VisAttributes* simpleBerylliumSVisAtt= new G4VisAttributes(red);
simpleBerylliumSVisAtt->SetVisibility(true);
simpleBerylliumSVisAtt->SetForceSolid(true);
windowUp_log->SetVisAttributes(simpleBerylliumSVisAtt);
windowLow_log->SetVisAttributes(simpleBerylliumSVisAtt);
G4VisAttributes* simpleMylarVisAtt= new G4VisAttributes(grey);
simpleMylarVisAtt->SetVisibility(true);
simpleMylarVisAtt->SetForceSolid(true);
reticle_log->SetVisAttributes(simpleMylarVisAtt);
G4VisAttributes* simpleAlVisAtt= new G4VisAttributes(white);
simpleAlVisAtt->SetVisibility(true);
simpleAlVisAtt->SetForceSolid(true);
Mirror_log->SetVisAttributes(simpleAlVisAtt);
G4VisAttributes* simpleKaptonVisAtt= new G4VisAttributes(yellow);
simpleKaptonVisAtt->SetVisibility(true);
simpleKaptonVisAtt->SetForceSolid(true);
Window_log->SetVisAttributes(simpleKaptonVisAtt);
SignalPlate_log->SetVisAttributes(simpleKaptonVisAtt);
//if you want not to see mirror ...:
//G4VisAttributes* simpleWorldVisAtt= new G4VisAttributes(white);
//simpleWorldVisAtt->SetVisibility(false);
//Mirror_log->SetVisAttributes(simpleWorldVisAtt);
//CylMinusCone_log->SetVisAttributes(simpleWorldVisAtt);
//UpperCollimator_log->SetVisAttributes(simpleWorldVisAtt);
//windowUp_log->SetVisAttributes(simpleWorldVisAtt);
//windowLow_log->SetVisAttributes(simpleWorldVisAtt);
//Window_log->SetVisAttributes(simpleWorldVisAtt);
//SignalPlate_log->SetVisAttributes(simpleWorldVisAtt);
//reticle_log->SetVisAttributes(simpleWorldVisAtt);
}
void MedLinacHead::DestroyComponent()
{;}
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: MedLinacPhantomHit.cc,v 1.3 2004/05/14 18:25:40 mpiergen Exp $
//
//
// Code developed by: M. Piergentili
//
#include "MedLinacPhantomHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
G4Allocator<MedLinacPhantomHit> MedLinacPhantomHitAllocator;
MedLinacPhantomHit::MedLinacPhantomHit(G4LogicalVolume* logVol,G4int XID,G4int YID,G4int ZID)
:logicalVolume(logVol),xHitPosition(XID),zHitPosition(ZID),yHitPosition(YID)
{
energyDeposit = 0;
}
MedLinacPhantomHit::~MedLinacPhantomHit()
{
}
MedLinacPhantomHit::MedLinacPhantomHit(const MedLinacPhantomHit &right)
: G4VHit()
{
xHitPosition = right.xHitPosition;
zHitPosition = right.zHitPosition;
yHitPosition = right.yHitPosition;
energyDeposit = right.energyDeposit;
hitPosition = right.hitPosition;
rotation = right.rotation;
logicalVolume = right.logicalVolume;
}
const MedLinacPhantomHit& MedLinacPhantomHit::operator=(const MedLinacPhantomHit &right)
{
xHitPosition = right.xHitPosition;
zHitPosition = right.zHitPosition;
yHitPosition = right.yHitPosition;
energyDeposit = right.energyDeposit;
hitPosition = right.hitPosition;
rotation = right.rotation;
logicalVolume = right.logicalVolume;
return *this;
}
int MedLinacPhantomHit::operator==(const MedLinacPhantomHit &right) const
{
return((xHitPosition==right.xHitPosition)&&(zHitPosition==right.zHitPosition)&&(yHitPosition==right.yHitPosition));
}
void MedLinacPhantomHit::Draw()
{
}
void MedLinacPhantomHit::Print()
{
}
@@ -0,0 +1,198 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: MedLinacPhantomROGeometry.cc,v 1.3 2004/05/14 18:25:40 mpiergen Exp $
//
//
// Code developed by: M. Piergentili
//
#include "MedLinacPhantomROGeometry.hh"
#include "MedLinacDummySD.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4SubtractionSolid.hh"
#include "G4ThreeVector.hh"
#include "G4Material.hh"
MedLinacPhantomROGeometry::MedLinacPhantomROGeometry(G4String aString,
G4double phantomDim_x,
G4double phantomDim_y,
G4double phantomDim_z,
G4int numberOfVoxelsX,
G4int numberOfVoxelsY,
G4int numberOfVoxelsZ):
G4VReadOutGeometry(aString),
PhantomDimensionX(phantomDim_x),
PhantomDimensionY(phantomDim_y),
PhantomDimensionZ(phantomDim_z),
NumberOfVoxelsAlongX(numberOfVoxelsX),
NumberOfVoxelsAlongY(numberOfVoxelsY),
NumberOfVoxelsAlongZ(numberOfVoxelsZ)
{}
MedLinacPhantomROGeometry::~MedLinacPhantomROGeometry()
{
}
G4VPhysicalVolume* MedLinacPhantomROGeometry::Build()
{
G4cout << " MedLinacPhantomROGeometry::Build()-----------------------" << G4endl;
//G4Material* dummyMat = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
G4double a; // atomic mass
G4double z; // atomic number
G4int natoms;
G4String name;
G4String symbol;
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen",symbol="O", z=8., a);
a = 1.00794*g/mole;
G4Element* elH = new G4Element(name="Hydrogen",symbol="H", z=1., a);
G4double density;
G4int ncomponents;
density = 1.000*g/cm3;
G4Material* H2O = new G4Material(name="Water",density, ncomponents=2);
H2O->AddElement(elH, natoms=2);
H2O->AddElement(elO, natoms=1);
G4double expHall_x = 3.0*m;
G4double expHall_y = 3.0*m;
G4double expHall_z = 3.0*m;
// variables for x division ...
G4double halfXVoxelDimensionX = PhantomDimensionX/NumberOfVoxelsAlongX;
G4double halfXVoxelDimensionZ = PhantomDimensionZ;
G4double voxelXThickness = 2*halfXVoxelDimensionX;
// variables for y division ...
G4double halfZVoxelDimensionX = PhantomDimensionX;
G4double halfZVoxelDimensionZ = PhantomDimensionZ/NumberOfVoxelsAlongZ;
G4double voxelZThickness = 2*halfZVoxelDimensionZ;
// world volume of ROGeometry ...
G4Box *ROWorld = new G4Box("ROWorld",
expHall_x,
expHall_y,
expHall_z);
G4LogicalVolume *ROWorldLog = new G4LogicalVolume(ROWorld,
H2O,
"ROWorldLog",
0,0,0);
G4VPhysicalVolume *ROWorldPhys = new G4PVPlacement(0,
G4ThreeVector(),
"ROWorldPhys",
ROWorldLog,
0,false,0);
// phantom ROGeometry ...
G4Box *ROPhantom = new G4Box("ROPhantom",
PhantomDimensionX,
PhantomDimensionY,
PhantomDimensionZ);
G4LogicalVolume *ROPhantomLog = new G4LogicalVolume(ROPhantom,
H2O,
"ROPhantomLog",
0,0,0);
G4VPhysicalVolume *ROPhantomPhys = new G4PVPlacement(0,
G4ThreeVector(),
"PhantomPhys",
ROPhantomLog,
ROWorldPhys,
false,0);
// ROGeomtry: Voxel division
// X division first...
G4Box *ROPhantomXDivision = new G4Box("ROPhantomXDivision",
halfXVoxelDimensionX,
halfXVoxelDimensionZ,
halfXVoxelDimensionZ);
G4LogicalVolume *ROPhantomXDivisionLog = new G4LogicalVolume(ROPhantomXDivision,
H2O,
"ROPhantomXDivisionLog",
0,0,0);
G4VPhysicalVolume *ROPhantomXDivisionPhys = new G4PVReplica("ROPhantomXDivisionPhys",
ROPhantomXDivisionLog,
ROPhantomPhys,
kXAxis,
NumberOfVoxelsAlongX,
voxelXThickness);
// ...then Z division
G4Box *ROPhantomZDivision = new G4Box("ROPhantomZDivision",
halfZVoxelDimensionX,
halfZVoxelDimensionX,
halfZVoxelDimensionZ);
G4LogicalVolume *ROPhantomZDivisionLog = new G4LogicalVolume(ROPhantomZDivision,
H2O,
"ROPhantomZDivisionLog",
0,0,0);
G4VPhysicalVolume *ROPhantomZDivisionPhys = new G4PVReplica("ROPhantomZDivisionPhys",
ROPhantomZDivisionLog,
ROPhantomXDivisionPhys,
kZAxis,
NumberOfVoxelsAlongZ,
voxelZThickness);
// ...then Y division
G4Box *ROPhantomYDivision = new G4Box("ROPhantomYDivision",
halfZVoxelDimensionX,
halfZVoxelDimensionX,
halfZVoxelDimensionX);
G4LogicalVolume *ROPhantomYDivisionLog = new G4LogicalVolume(ROPhantomYDivision,
H2O,
"ROPhantomYDivisionLog",
0,0,0);
ROPhantomYDivisionPhys = new G4PVReplica("ROPhantomYDivisionPhys",
ROPhantomYDivisionLog,
ROPhantomZDivisionPhys,
kYAxis,
NumberOfVoxelsAlongZ,
voxelZThickness);
MedLinacDummySD *dummySD = new MedLinacDummySD;
ROPhantomYDivisionLog->SetSensitiveDetector(dummySD);
return ROWorldPhys;
}
@@ -0,0 +1,174 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//// $Id: MedLinacPhantomSD.cc,v 1.3 2004/05/14 18:25:40 mpiergen Exp $
//
//
// Code developed by: M. Piergentili
//
//
#include "MedLinacPhantomSD.hh"
#include "MedLinacPhantomHit.hh"
#include "MedLinacAnalysisManager.hh"
#include "MedLinacDetectorConstruction.hh"
#include "G4Track.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4SDManager.hh"
#include "G4ParticleDefinition.hh"
//....
MedLinacPhantomSD::MedLinacPhantomSD(G4String name):G4VSensitiveDetector(name)
{
}
MedLinacPhantomSD::~MedLinacPhantomSD()
{
}
void MedLinacPhantomSD::Initialize(G4HCofThisEvent*)
{
}
G4bool MedLinacPhantomSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
{
if(!ROhist)
return false;
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() != "Phantom_phys")
return false;
G4double energyDep = aStep->GetTotalEnergyDeposit();
if(energyDep == 0.)
return false;
// Read Voxel indexes: i is the x index, k is the z index
G4int k = ROhist->GetReplicaNumber(1);
G4int i = ROhist->GetReplicaNumber(2);
G4int j = ROhist->GetReplicaNumber();
G4int numberOfVoxelZ = 300;
G4double voxelWidthZ = 1. *mm;
G4double x;
G4double y;
G4double z;
x = (-numberOfVoxelZ+1+2*i)*voxelWidthZ/2;
y = (- numberOfVoxelZ+1+2*j)*voxelWidthZ/2;
z = (- numberOfVoxelZ+1+2*k)*voxelWidthZ/2;
if(energyDep != 0)
{
#ifdef G4ANALYSIS_USE
MedLinacAnalysisManager* analysis =
MedLinacAnalysisManager::getInstance();
//2Dhistogram with the distribution of energy at depth=15 mm in the phantom
//(x,y,energy) (YThickness = 1. cm)
if(energyDep != 0)
{
if (z<140.*mm){if (z> 130.*mm)
{analysis->FillHistogram3WithEnergy(x,y,energyDep/MeV);}
}
}
if(energyDep != 0)
{
analysis->FillHistogram1WithEnergy(x,z,energyDep/MeV);
}
//**** PDD in isocenter (Y and X Thickness = 5. mm) **********************
if(energyDep != 0)
{
if (y<2.5*mm){if (y> -2.5*mm)
{
if(x<2.5*mm){if (x> -2.5*mm)
{analysis->FillHistogram4WithEnergy(z,energyDep/MeV);}
}}}}
//***** flatness along x ***** Depth=build-up for 6MV photon beam (15 mm)*
if(energyDep != 0)
{
if (z<137.5*mm){if (z> 132.5*mm)
{ if (y<2.5*mm){if (y> -2.5*mm)
{analysis->FillHistogram5WithEnergy(x,energyDep/MeV);}
}
}
}
}
//***** flatness along x ***** Depth=50mm*********************************
if(energyDep != 0)
{
if (z<102.5*mm){if (z> 97.5*mm)
{ if (y<2.5*mm){if (y> -2.5*mm)
{analysis->FillHistogram6WithEnergy(x,energyDep/MeV);}
}
}
}
}
//***** flatness along x ***** Depth=100 mm********************************
if(energyDep != 0)
{
if (z<52.5*mm){if (z> 47.5*mm)
{ if (y<2.5*mm){if (y> -2.5*mm)
{analysis->FillHistogram7WithEnergy(x,energyDep/MeV);}
}
}
}
}
//***** flatness along x ***** Depth=200 mm********************************
if(energyDep != 0)
{
if (z<-47.5*mm){if (z> -52.5*mm)
{ if (y<2.5*mm){if (y> -2.5*mm)
{analysis->FillHistogram8WithEnergy(x,energyDep/MeV);}
}
}
}
}
//**************************************************************************
#endif
}
return true;
}
void MedLinacPhantomSD::EndOfEvent(G4HCofThisEvent*)
{
}
void MedLinacPhantomSD::clear()
{
}
void MedLinacPhantomSD::DrawAll()
{
}
void MedLinacPhantomSD::PrintAll()
{
}
@@ -0,0 +1,202 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: MedLinacPhysicsList.cc,v 1.3 2004/05/14 18:25:40 mpiergen Exp $
//
//
// Code developed by: M. Piergentili
//
#include "globals.hh"
#include "MedLinacPhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4ios.hh"
#include <iomanip>
#include "G4UnitsTable.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4ProductionCuts.hh"
#include "G4ProductionCutsTable.hh"
MedLinacPhysicsList::MedLinacPhysicsList(): G4VUserPhysicsList()
{
defaultCutValue = 0.1*mm;
//cutForGamma = defaultCutValue;
//cutForElectron = defaultCutValue;
//cutForPositron = defaultCutValue;
SetVerboseLevel(1);
}
MedLinacPhysicsList::~MedLinacPhysicsList()
{;}
void MedLinacPhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
// This ensures that objects of these particle types will be
// created in the program.
ConstructBosons();
ConstructLeptons();
}
void MedLinacPhysicsList::ConstructBosons()
{
// gamma
G4Gamma::GammaDefinition();
}
void MedLinacPhysicsList::ConstructLeptons()
{
// leptons
// e+/-
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
}
void MedLinacPhysicsList::ConstructProcess()
{
// Define transportation process
AddTransportation();
ConstructEM();
//ConstructGeneral();
}
//****************************************************************
//#include "G4ComptonScattering.hh"
//#include "G4GammaConversion.hh"
//#include "G4PhotoElectricEffect.hh"
#include "G4LowEnergyPhotoElectric.hh"
#include "G4LowEnergyCompton.hh"
#include "G4LowEnergyGammaConversion.hh"
#include "G4LowEnergyRayleigh.hh"
#include "G4MultipleScattering.hh"
#include "G4LowEnergyIonisation.hh"
#include "G4LowEnergyBremsstrahlung.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
//********************************************************************
void MedLinacPhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// gamma
lowePhot = new G4LowEnergyPhotoElectric("LowEnPhotoElec");
pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh);
pmanager->AddDiscreteProcess(lowePhot);
pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion);
//pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
//pmanager->AddDiscreteProcess(new G4ComptonScattering);
//pmanager->AddDiscreteProcess(new G4GammaConversion);
} 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);
//pmanager->AddProcess(new G4eIonisation, -1, 2,2);
//pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3);
} else if (particleName == "e+") {
//positron
pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3);
pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4);
}
}
}
//******************************************************************
void MedLinacPhysicsList::SetCuts()
{
// uppress error messages even in case e/gamma/proton do not exist
G4int temp = GetVerboseLevel();
SetVerboseLevel(1);
// " G4VUserPhysicsList::SetCutsWithDefault" method sets
// the default cut value for all particle types
SetCutsWithDefault();
//SetCutValue(cutForGamma, "gamma");
//SetCutValue(cutForElectron, "e-");
//SetCutValue(cutForPositron, "e+");
// Retrieve verbose level
SetVerboseLevel(temp);
// Production thresholds for detector regions
G4String regName = "PrimaryCollimatorLow";
G4double cutValue = 8.*cm;
G4Region* reg = G4RegionStore::GetInstance()->GetRegion(regName);
G4ProductionCuts* cuts = new G4ProductionCuts;
cuts->SetProductionCut(cutValue);
reg->SetProductionCuts(cuts);
G4String regName1 = "PrimaryCollimatorUp";
G4double cutValue1 = 8.*cm;
G4Region* reg1 = G4RegionStore::GetInstance()->GetRegion(regName1);
G4ProductionCuts* cuts1 = new G4ProductionCuts;
cuts1->SetProductionCut(cutValue1);
reg1->SetProductionCuts(cuts1);
if (verboseLevel >0){
G4cout << "MedLinac::SetCuts: default cut length : "
<< G4BestUnit(defaultCutValue,"Length") << G4endl;
}
}
@@ -0,0 +1,101 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: MedLinacPrimaryGeneratorAction.cc,v 1.3 2004/05/14 18:25:40 mpiergen Exp $
//
//
// Code developed by: M. Piergentili
//
#include "MedLinacPrimaryGeneratorAction.hh"
#include "MedLinacPrimaryGeneratorMessenger.hh"
#ifdef G4ANALYSIS_USE
#include "MedLinacAnalysisManager.hh"
#endif
#include "MedLinacDetectorConstruction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "globals.hh"
#include "Randomize.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4IonTable.hh"
MedLinacPrimaryGeneratorAction::MedLinacPrimaryGeneratorAction()
:pEnergy(99.0*MeV),sigma(12.7*MeV)
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
//create a messenger for this class
gunMessenger = new MedLinacPrimaryGeneratorMessenger(this);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
particleGun->SetParticleDefinition(particleTable->FindParticle(particleName="e-"));
particleGun->SetParticleEnergy(pEnergy);
particleGun->SetParticlePosition(G4ThreeVector(0.0*cm, 0.0*cm, 123.0*cm));
}
MedLinacPrimaryGeneratorAction::~MedLinacPrimaryGeneratorAction()
{
delete particleGun;
delete gunMessenger;
}
void MedLinacPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
G4double energy;
#ifdef G4ANALYSIS_USE
MedLinacAnalysisManager* analysis = MedLinacAnalysisManager::getInstance();
#endif
G4double cosTheta = RandGauss::shoot(-1.,0.00003);
G4double phi = twopi * G4UniformRand();
G4double sinTheta = sqrt(1. - cosTheta*cosTheta);
G4double ux = sinTheta*cos(phi);
G4double uy = sinTheta*sin(phi);
G4double uz = cosTheta;
particleGun->SetParticleMomentumDirection(G4ThreeVector(ux,uy,uz));
energy=pEnergy;
energy = RandGauss::shoot(pEnergy,sigma);
particleGun->SetParticleEnergy(energy);
//1D Histogram of primary particle energy ...
#ifdef G4ANALYSIS_USE
analysis->PrimaryParticleEnergySpectrum(energy);
#endif
particleGun->GeneratePrimaryVertex(anEvent);
}
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: MedLinacPrimaryGeneratorMessenger.cc,v 1.3 2004/05/14 18:25:40 mpiergen Exp $
//
//
// Code developed by: M. Piergentili
//
#include "MedLinacPrimaryGeneratorMessenger.hh"
#include "MedLinacPrimaryGeneratorAction.hh"
#include "MedLinacRunAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
MedLinacPrimaryGeneratorMessenger::MedLinacPrimaryGeneratorMessenger(MedLinacPrimaryGeneratorAction* MedLinacGun)
:MedLinacAction(MedLinacGun)
{
EnergyCmd = new G4UIcmdWithADoubleAndUnit("/energy",this);
EnergyCmd->SetGuidance("Select the energy (and unit) of the primary particles");
EnergyCmd->SetGuidance("Type particle Energy");
EnergyCmd->SetParameterName("energy",true,true);
EnergyCmd->SetDefaultValue(1.);
EnergyCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
SourceTypeCmd = new G4UIcmdWithADoubleAndUnit("/sourceType",this);
SourceTypeCmd->SetGuidance("Select the standard deviation of the energy.");
SourceTypeCmd->SetParameterName("standard deviation",true);
SourceTypeCmd->SetDefaultValue(1.);
SourceTypeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
void MedLinacPrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command == EnergyCmd )
{
G4double newEnergy = EnergyCmd->GetNewDoubleValue(newValue);
MedLinacAction->SetEnergy(newEnergy);
G4cout << "Energy "<< newEnergy << G4endl;
}
if( command == SourceTypeCmd )
{
G4double newSourceType = SourceTypeCmd->GetNewDoubleValue(newValue);
MedLinacAction->SetSourceType(newSourceType);
G4cout << " standard deviation"<< newSourceType << G4endl;
}
}
MedLinacPrimaryGeneratorMessenger::~MedLinacPrimaryGeneratorMessenger()
{
delete EnergyCmd;
delete SourceTypeCmd;
}
@@ -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. *
// ********************************************************************
//
// $Id: MedLinacRunAction.cc,v 1.3 2004/05/14 18:25:40 mpiergen Exp $
//
//
// Code developed by: M. Piergentili
#include "MedLinacRunAction.hh"
#include "MedLinacEventAction.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include "MedLinacDetectorConstruction.hh"
#include "G4SDManager.hh"
#include "G4Timer.hh"
#ifdef G4ANALYSIS_USE
#include "MedLinacAnalysisManager.hh"
#endif
MedLinacRunAction::MedLinacRunAction(G4String SDName)
{
sensitiveDetectorName = SDName;
detector = MedLinacDetectorConstruction::GetInstance(sensitiveDetectorName);
}
MedLinacRunAction::~MedLinacRunAction()
{
delete detector;
}
void MedLinacRunAction::BeginOfRunAction(const G4Run* aRun)
{
#ifdef G4ANALYSIS_USE
MedLinacAnalysisManager* analysis = MedLinacAnalysisManager::getInstance();
analysis->book();
#endif
G4cout << "Run " << aRun->GetRunID() << " start." << G4endl;
}
void MedLinacRunAction::EndOfRunAction(const G4Run* aRun)
{
#ifdef G4ANALYSIS_USE
MedLinacAnalysisManager* analysis = MedLinacAnalysisManager::getInstance();
#endif
G4cout << "number of event = " << aRun->GetNumberOfEvent() << G4endl;
#ifdef G4ANALYSIS_USE
analysis->finish();
#endif
}
@@ -0,0 +1,535 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: MedLinacTargetAndFilterDecorator.cc,v 1.1 2004/05/14 18:25:40 mpiergen Exp $
//
// Code developed by: M. Piergentili
//
//
#include "MedLinacVGeometryComponent.hh"
#include "G4Material.hh"
#include "MedLinacTargetAndFilterDecorator.hh"
#include "MedLinacDecorator.hh"
#include "globals.hh"
#include "G4LogicalVolume.hh"
#include "G4RotationMatrix.hh"
#include "G4Transform3D.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4Material.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4MaterialTable.hh"
#include "G4MaterialPropertyVector.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Tubs.hh"
#include "G4ThreeVector.hh"
#include "G4VisAttributes.hh"
#include "G4GeometryManager.hh"
#include "G4BooleanSolid.hh"
#include "G4SubtractionSolid.hh"
#include "G4VSolid.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
MedLinacTargetAndFilterDecorator::MedLinacTargetAndFilterDecorator(MedLinacVGeometryComponent* comp)
: MedLinacDecorator(comp)
{
}
MedLinacTargetAndFilterDecorator::~MedLinacTargetAndFilterDecorator()
{
;
}
void MedLinacTargetAndFilterDecorator::ConstructComponent(G4VPhysicalVolume* world, G4VPhysicalVolume* vacuumBlock)
{
MedLinacDecorator::ConstructComponent(world,vacuumBlock);
ConstructTargetAndFilter(world,vacuumBlock);
}
void MedLinacTargetAndFilterDecorator::DestroyComponent()
{
;
}
void MedLinacTargetAndFilterDecorator::ConstructTargetAndFilter(G4VPhysicalVolume* world, G4VPhysicalVolume* vacuumBlock)
{
// materials
G4double a; // atomic mass
G4double z; // atomic number
G4double density;
G4String symbol;
G4String name;
G4double fractionmass;
G4int ncomponents;
a = 14.00674*g/mole;
G4Element* elN = new G4Element(name="Nitrogen" ,symbol="N", z=7., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen",symbol="O", z=8., a);
a = 49.29*g/mole;
density = 2.6989*g/cm3;
G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
a = 207.19*g/mole;
density = 11.35*g/cm3;
G4Material* Pb = new G4Material(name="Lead", z=82., a, density);
;
density = 1.290*mg/cm3;
G4Material* Air = new G4Material(name="Air",density, ncomponents=2);
Air->AddElement(elN, fractionmass=70*perCent);
Air->AddElement(elO, fractionmass=30*perCent);
// colors
G4Colour cyan (0.0, 1.0, 1.0);
G4Colour magenta (1.0, 0.0, 1.0);
//---------rotation matrix filter--------
G4RotationMatrix* rotateMatrix=new G4RotationMatrix();
rotateMatrix->rotateX(180.0*deg);
// volumes
// beam line along z axis
//------------------------target 6MV------------------------
G4double targetADim_x = 0.6*cm;
G4double targetADim_y = 0.6*cm;
G4double targetADim_z = 0.04445*cm;
G4Box* targetA_box = new G4Box("targetA_box",targetADim_x,targetADim_y,targetADim_z);
targetA_log = new G4LogicalVolume(targetA_box,Pb,"targetA_log",0,0,0);
G4double targetAPos_x = 0.0*m;
G4double targetAPos_y = 0.0*m;
G4double targetAPos_z = 0.20055*cm;
targetA_phys = new G4PVPlacement(0,
G4ThreeVector(targetAPos_x,targetAPos_y,targetAPos_z),
"targetA",targetA_log,vacuumBlock,false,0);
G4double targetBDim_x = 0.6*cm;
G4double targetBDim_y = 0.6*cm;
G4double targetBDim_z = 0.0787*cm;
G4Box* targetB_box = new G4Box("targetB_box",targetBDim_x,targetBDim_y,targetBDim_z);
targetB_log = new G4LogicalVolume(targetB_box,Al,"targetB_log",0,0,0);
G4double targetBPos_x = 0.0*m;
G4double targetBPos_y = 0.0*m;
G4double targetBPos_z = 0.0773*cm;
targetB_phys = new G4PVPlacement(0,
G4ThreeVector(targetBPos_x,targetBPos_y,targetBPos_z),
"targetB",targetB_log,vacuumBlock,false,0);
//--------------Flattening Filter---------------
G4double layerRmin1 = 0.*cm;
G4double layerRmin2 = 0.*cm;
G4double layerPos_x = 0.0*m;
G4double layerPos_y = 0.0*m;
//-----------layer1-----------------------------
G4double layer1Rmax1 = 0.00000001*cm;
G4double layer1Rmax2 = 0.025*cm;
G4double layer1HightOfTheCone = 0.006*cm;
G4double startAngleOfTheCone = 0.*deg;
G4double spanningAngleOfTheCone = 360.*deg;
G4Cons* layer1 = new G4Cons("layer1",layerRmin1,layer1Rmax1,layerRmin2,
layer1Rmax2,layer1HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer1_log = new G4LogicalVolume(layer1,Al,"layer1_log",0,0,0);
G4double layer1Pos_z = 103.404*cm;
layer1_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer1Pos_z),
"layer1",layer1_log,world,false,0);
//-----------layer2-----------------------------
G4double layer2Rmax1 = 0.025*cm;
G4double layer2Rmax2 = 0.051*cm;
G4double layer2HightOfTheCone = 0.0065*cm;
G4Cons* layer2 = new G4Cons("layer2",layerRmin1,layer2Rmax1,layerRmin2,
layer2Rmax2,layer2HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer2_log = new G4LogicalVolume(layer2,Al,"layer2_log",0,0,0);
G4double layer2Pos_z = 103.3888*cm;
layer2_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer2Pos_z),
"layer2",layer2_log,world,false,0);
//-----------layer3-----------------------------
G4double layer3Rmax1 = 0.051*cm;
G4double layer3Rmax2 = 0.077*cm;
G4double layer3HightOfTheCone = 0.0075*cm;
G4Cons* layer3 = new G4Cons("layer3",layerRmin1,layer3Rmax1,layerRmin2,
layer3Rmax2,layer3HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer3_log = new G4LogicalVolume(layer3,Al,"layer3_log",0,0,0);
G4double layer3Pos_z = 103.3748*cm;
layer3_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer3Pos_z),
"layer3",layer3_log,world,false,0);
//-----------layer4-----------------------------
G4double layer4Rmax1 = 0.077*cm;
G4double layer4Rmax2 = 0.103*cm;
G4double layer4HightOfTheCone = 0.009*cm;
G4Cons* layer4 = new G4Cons("layer4",layerRmin1,layer4Rmax1,layerRmin2,
layer4Rmax2,layer4HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer4_log = new G4LogicalVolume(layer4,Al,"layer4_log",0,0,0);
G4double layer4Pos_z = 103.3583*cm;
layer4_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer4Pos_z),
"layer4",layer4_log,world,false,0);
//-----------layer5-----------------------------
G4double layer5Rmax1 = 0.103*cm;
G4double layer5Rmax2 = 0.154*cm;
G4double layer5HightOfTheCone = 0.022*cm;
G4Cons* layer5 = new G4Cons("layer5",layerRmin1,layer5Rmax1,layerRmin2,
layer5Rmax2,layer5HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer5_log = new G4LogicalVolume(layer5,Al,"layer5_log",0,0,0);
G4double layer5Pos_z = 103.3273*cm;
layer5_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer5Pos_z),
"layer5",layer5_log,world,false,0);
//-----------layer6-----------------------------
G4double layer6Rmax1 = 0.154*cm;
G4double layer6Rmax2 = 0.205*cm;
G4double layer6HightOfTheCone = 0.024*cm;
G4Cons* layer6 = new G4Cons("layer6",layerRmin1,layer6Rmax1,layerRmin2,
layer6Rmax2,layer6HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer6_log = new G4LogicalVolume(layer6,Al,"layer6_log",0,0,0);
G4double layer6Pos_z = 103.2813*cm;
layer6_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer6Pos_z),
"layer6",layer6_log,world,false,0);
//-----------layer7-----------------------------
G4double layer7Rmax1 = 0.205*cm;
G4double layer7Rmax2 = 0.256*cm;
G4double layer7HightOfTheCone = 0.023*cm;
G4Cons* layer7 = new G4Cons("layer7",layerRmin1,layer7Rmax1,layerRmin2,
layer7Rmax2,layer7HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer7_log = new G4LogicalVolume(layer7,Al,"layer7_log",0,0,0);
G4double layer7Pos_z = 103.2343*cm;
layer7_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer7Pos_z),
"layer7",layer7_log,world,false,0);
//-----------layer8-----------------------------
G4double layer8Rmax1 = 0.256*cm;
G4double layer8Rmax2 = 0.307*cm;
G4double layer8HightOfTheCone = 0.023*cm;
G4Cons* layer8 = new G4Cons("layer8",layerRmin1,layer8Rmax1,layerRmin2,
layer8Rmax2,layer8HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer8_log = new G4LogicalVolume(layer8,Al,"layer8_log",0,0,0);
G4double layer8Pos_z = 103.1883*cm;
layer8_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer8Pos_z),
"layer8",layer8_log,world,false,0);
//-----------layer9-----------------------------
G4double layer9Rmax1 = 0.307*cm;
G4double layer9Rmax2 = 0.358*cm;
G4double layer9HightOfTheCone = 0.0225*cm;
G4Cons* layer9 = new G4Cons("layer9",layerRmin1,layer9Rmax1,layerRmin2,
layer9Rmax2,layer9HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer9_log = new G4LogicalVolume(layer9,Al,"layer9_log",0,0,0);
G4double layer9Pos_z = 103.1428*cm;
layer9_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer9Pos_z),
"layer9",layer9_log,world,false,0);
//-----------layer10-----------------------------
G4double layer10Rmax1 = 0.358*cm;
G4double layer10Rmax2 = 0.409*cm;
G4double layer10HightOfTheCone = 0.022*cm;
G4Cons* layer10 = new G4Cons("layer10",layerRmin1,layer10Rmax1,layerRmin2,
layer10Rmax2,layer10HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer10_log = new G4LogicalVolume(layer10,Al,"layer10_log",0,0,0);
G4double layer10Pos_z = 103.0983*cm;
layer10_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer10Pos_z),
"layer10",layer10_log,world,false,0);
//-----------layer11-----------------------------
G4double layer11Rmax1 = 0.409*cm;
G4double layer11Rmax2 = 0.510*cm;
G4double layer11HightOfTheCone = 0.0425*cm;
G4Cons* layer11 = new G4Cons("layer11",layerRmin1,layer11Rmax1,layerRmin2,
layer11Rmax2,layer11HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer11_log = new G4LogicalVolume(layer11,Al,"layer11_log",0,0,0);
G4double layer11Pos_z = 103.0338*cm;
layer11_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer11Pos_z),
"layer11",layer11_log,world,false,0);
//-----------layer12-----------------------------
G4double layer12Rmax1 = 0.510*cm;
G4double layer12Rmax2 = 0.620*cm;
G4double layer12HightOfTheCone = 0.0395*cm;
G4Cons* layer12 = new G4Cons("layer12",layerRmin1,layer12Rmax1,layerRmin2,
layer12Rmax2,layer12HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer12_log = new G4LogicalVolume(layer12,Al,"layer12_log",0,0,0);
G4double layer12Pos_z = 102.9518*cm;
layer12_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer12Pos_z),
"layer12",layer12_log,world,false,0);
//-----------layer13-----------------------------
G4double layer13Rmax1 = 0.620*cm;
G4double layer13Rmax2 = 0.730*cm;
G4double layer13HightOfTheCone = 0.038*cm;
G4Cons* layer13 = new G4Cons("layer13",layerRmin1,layer13Rmax1,layerRmin2,
layer13Rmax2,layer13HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer13_log = new G4LogicalVolume(layer13,Al,"layer13_log",0,0,0);
G4double layer13Pos_z = 102.8743*cm;
layer13_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer13Pos_z),
"layer13",layer13_log,world,false,0);
//-----------layer14-----------------------------
G4double layer14Rmax1 = 0.730*cm;
G4double layer14Rmax2 = 0.840*cm;
G4double layer14HightOfTheCone = 0.0335*cm;
G4Cons* layer14 = new G4Cons("layer14",layerRmin1,layer14Rmax1,layerRmin2,
layer14Rmax2,layer14HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer14_log = new G4LogicalVolume(layer14,Al,"layer14_log",0,0,0);
G4double layer14Pos_z = 102.8028*cm;
layer14_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer14Pos_z),
"layer14",layer14_log,world,false,0);
//-----------layer15-----------------------------
G4double layer15Rmax1 = 0.840*cm;
G4double layer15Rmax2 = 0.950*cm;
G4double layer15HightOfTheCone = 0.0325*cm;
G4Cons* layer15 = new G4Cons("layer15",layerRmin1,layer15Rmax1,layerRmin2,
layer15Rmax2,layer15HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer15_log = new G4LogicalVolume(layer15,Al,"layer15_log",0,0,0);
G4double layer15Pos_z = 102.7368*cm;
layer15_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer15Pos_z),
"layer15",layer15_log,world,false,0);
//-----------layer16-----------------------------
G4double layer16Rmax1 = 0.950*cm;
G4double layer16Rmax2 = 1.050*cm;
G4double layer16HightOfTheCone = 0.028*cm;
G4Cons* layer16 = new G4Cons("layer16",layerRmin1,layer16Rmax1,layerRmin2,
layer16Rmax2,layer16HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer16_log = new G4LogicalVolume(layer16,Al,"layer16_log",0,0,0);
G4double layer16Pos_z = 102.6763*cm;
layer16_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer16Pos_z),
"layer16",layer16_log,world,false,0);
//-----------layer17-----------------------------
G4double layer17Rmax1 = 1.050*cm;
G4double layer17Rmax2 = 1.150*cm;
G4double layer17HightOfTheCone = 0.0275*cm;
G4Cons* layer17 = new G4Cons("layer17",layerRmin1,layer17Rmax1,layerRmin2,
layer17Rmax2,layer17HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer17_log = new G4LogicalVolume(layer17,Al,"layer17_log",0,0,0);
G4double layer17Pos_z = 102.56208*cm;
layer17_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer17Pos_z),
"layer17",layer17_log,world,false,0);
//-----------layer18-----------------------------
G4double layer18Rmax1 = 1.150*cm;
G4double layer18Rmax2 = 1.215*cm;
G4double layer18HightOfTheCone = 0.019*cm;
G4Cons* layer18 = new G4Cons("layer18",layerRmin1,layer18Rmax1,layerRmin2,
layer18Rmax2,layer18HightOfTheCone,startAngleOfTheCone,
spanningAngleOfTheCone);
layer18_log = new G4LogicalVolume(layer18,Al,"layer18_log",0,0,0);
G4double layer18Pos_z = 102.4743*cm;
layer18_phys = new G4PVPlacement(rotateMatrix,
G4ThreeVector(layerPos_x,layerPos_y,layer18Pos_z),
"layer18",layer18_log,world,false,0);
//-----------layer19-----------------------------
G4double innerRadiusOfTheLayer19 = 0.0*cm;
G4double outerRadiusOfTheLayer19 = 1.335*cm;
G4double hightOfTheLayer19 = 0.040*cm;
G4double startAngleOfTheLayer19 = 0.*deg;
G4double spanningAngleOfTheLayer19 = 360.*deg;
G4Tubs* layer19 = new G4Tubs("layer19",innerRadiusOfTheLayer19,
outerRadiusOfTheLayer19,hightOfTheLayer19,
startAngleOfTheLayer19,spanningAngleOfTheLayer19);
layer19_log = new G4LogicalVolume(layer19,Al,"layer19_log",0,0,0);
G4double layer19PosX = 0.*cm;
G4double layer19PosY = 0.*cm;
G4double layer19PosZ = 102.4153*cm;
layer19_phys = new G4PVPlacement(0,
G4ThreeVector(layer19PosX,layer19PosY,
layer19PosZ),"layer19",
layer19_log,world,false,0);
//-----------layer20-----------------------------
G4double innerRadiusOfTheLayer20A = 1.300*cm;
G4double outerRadiusOfTheLayer20A = 1.335*cm;
G4double hightOfTheLayer20A = 0.0225*cm;
G4double startAngleOfTheLayer20A = 0.*deg;
G4double spanningAngleOfTheLayer20A = 360.*deg;
G4Tubs* layer20A = new G4Tubs("layer20A",innerRadiusOfTheLayer20A,
outerRadiusOfTheLayer20A,hightOfTheLayer20A,
startAngleOfTheLayer20A,spanningAngleOfTheLayer20A);
layer20A_log = new G4LogicalVolume(layer20A,Al,"layer20A_log",0,0,0);
G4double cone20Rmin1 = 0.*cm;
G4double cone20Rmax1 = 1.335*cm;
G4double cone20Rmin2 = 0.*cm;
G4double cone20Rmax2 = 1.301*cm;
G4double hightOfThecone20 =0.0225*cm;
G4double startAngleOfThecone20 = 0.*deg;
G4double spanningAngleOfThecone20 = 360.*deg;
G4Cons* cone20 = new G4Cons("cone20",cone20Rmin1,cone20Rmax1,cone20Rmin2,
cone20Rmax2,hightOfThecone20,startAngleOfThecone20,
spanningAngleOfThecone20);
cone20_log = new G4LogicalVolume(cone20,Air,"cone20_log",0,0,0);
G4SubtractionSolid* layer20 = new G4SubtractionSolid("layer20",layer20A,cone20);
layer20_log = new G4LogicalVolume(layer20,Al,"layer20_log",0,0,0);
G4double layer20PosX = 0.*cm;
G4double layer20PosY = 0.*cm;
G4double layer20PosZ = 102.4778*cm;
layer20_phys = new G4PVPlacement(0,
G4ThreeVector(layer20PosX,layer20PosY,
layer20PosZ),"layer20",
layer20_log,world,false,0);
//-----------layer21-----------------------------
G4double innerRadiusOfTheLayer21 = 1.335*cm;
G4double outerRadiusOfTheLayer21 = 1.600*cm;
G4double hightOfTheLayer21 = 0.0625*cm;
G4double startAngleOfTheLayer21 = 0.*deg;
G4double spanningAngleOfTheLayer21 = 360.*deg;
G4Tubs* layer21 = new G4Tubs("layer21",innerRadiusOfTheLayer21,
outerRadiusOfTheLayer21,hightOfTheLayer21,
startAngleOfTheLayer21,spanningAngleOfTheLayer21);
layer21_log = new G4LogicalVolume(layer21,Al,"layer21_log",0,0,0);
G4double layer21PosX = 0.*cm;
G4double layer21PosY = 0.*cm;
G4double layer21PosZ = 102.4378*cm;
layer21_phys = new G4PVPlacement(0,
G4ThreeVector(layer21PosX,layer21PosY,
layer21PosZ),"layer19",
layer21_log,world,false,0);
// Visualization attributes
G4VisAttributes* simpleAlSVisAtt= new G4VisAttributes(cyan);
simpleAlSVisAtt->SetVisibility(true);
simpleAlSVisAtt->SetForceSolid(true);
targetB_log->SetVisAttributes(simpleAlSVisAtt);
layer1_log->SetVisAttributes(simpleAlSVisAtt);
layer2_log->SetVisAttributes(simpleAlSVisAtt);
layer3_log->SetVisAttributes(simpleAlSVisAtt);
layer4_log->SetVisAttributes(simpleAlSVisAtt);
layer5_log->SetVisAttributes(simpleAlSVisAtt);
layer6_log->SetVisAttributes(simpleAlSVisAtt);
layer7_log->SetVisAttributes(simpleAlSVisAtt);
layer8_log->SetVisAttributes(simpleAlSVisAtt);
layer9_log->SetVisAttributes(simpleAlSVisAtt);
layer10_log->SetVisAttributes(simpleAlSVisAtt);
layer11_log->SetVisAttributes(simpleAlSVisAtt);
layer12_log->SetVisAttributes(simpleAlSVisAtt);
layer13_log->SetVisAttributes(simpleAlSVisAtt);
layer14_log->SetVisAttributes(simpleAlSVisAtt);
layer15_log->SetVisAttributes(simpleAlSVisAtt);
layer16_log->SetVisAttributes(simpleAlSVisAtt);
layer17_log->SetVisAttributes(simpleAlSVisAtt);
layer18_log->SetVisAttributes(simpleAlSVisAtt);
layer19_log->SetVisAttributes(simpleAlSVisAtt);
layer20_log->SetVisAttributes(simpleAlSVisAtt);
layer21_log->SetVisAttributes(simpleAlSVisAtt);
G4VisAttributes* simpleLeadSVisAtt= new G4VisAttributes(magenta);
simpleLeadSVisAtt->SetVisibility(true);
simpleLeadSVisAtt->SetForceSolid(true);
targetA_log->SetVisAttributes(simpleLeadSVisAtt);
}
@@ -0,0 +1,35 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: MedLinacVGeometryComponent.cc,v 1.1 2004/05/14 18:25:40 mpiergen Exp $
//
// Code developed by: M. Piergentili
//
//
#include"MedLinacVGeometryComponent.hh"
MedLinacVGeometryComponent::MedLinacVGeometryComponent()
{;}
MedLinacVGeometryComponent::~MedLinacVGeometryComponent()
{;}
@@ -0,0 +1,100 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: MedLinacVisManager.cc,v 1.3 2004/05/14 18:25:40 mpiergen Exp $
//
//
// Code developed by: M. Piergentili
#ifdef G4VIS_USE
#include "MedLinacVisManager.hh"
// Supported drivers...
// Not needing external packages or libraries...
#include "G4ASCIITree.hh"
#include "G4DAWNFILE.hh"
#include "G4GAGTree.hh"
#include "G4VRML1File.hh"
#include "G4VRML2File.hh"
// Needing external packages or libraries...
#ifdef G4VIS_USE_DAWN
#include "G4FukuiRenderer.hh"
#endif
#ifdef G4VIS_USE_OPENGLX
#include "G4OpenGLImmediateX.hh"
#include "G4OpenGLStoredX.hh"
#endif
#ifdef G4VIS_USE_VRML
#include "G4VRML1.hh"
#include "G4VRML2.hh"
#endif
//*************************************************************
MedLinacVisManager::MedLinacVisManager () {}
//*************************************************************
void MedLinacVisManager::RegisterGraphicsSystems () {
// Graphics Systems not needing external packages or libraries...
RegisterGraphicsSystem (new G4ASCIITree);
RegisterGraphicsSystem (new G4DAWNFILE);
RegisterGraphicsSystem (new G4GAGTree);
RegisterGraphicsSystem (new G4VRML1File);
RegisterGraphicsSystem (new G4VRML2File);
// Graphics systems needing external packages or libraries...
#ifdef G4VIS_USE_DAWN
RegisterGraphicsSystem (new G4FukuiRenderer);
#endif
#ifdef G4VIS_USE_OPENGLX
RegisterGraphicsSystem (new G4OpenGLImmediateX);
RegisterGraphicsSystem (new G4OpenGLStoredX);
#endif
#ifdef G4VIS_USE_VRML
RegisterGraphicsSystem (new G4VRML1);
RegisterGraphicsSystem (new G4VRML2);
#endif
if (fVerbose > 0) {
G4cout <<
"\nYou have successfully chosen to use the following graphics systems."
<< G4endl;
PrintAvailableGraphicsSystems ();
}
}
#endif