Import Geant4 8.2.0 source tree
This commit is contained in:
@@ -24,27 +24,21 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: RE02DetectorConstruction.cc,v 1.2 2006/06/29 17:45:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: RE02DetectorConstruction.cc,v 1.3 2006/11/18 01:37:23 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
|
||||
#include "RE02DetectorConstruction.hh"
|
||||
|
||||
#include "G4MultiFunctionalDetector.hh"
|
||||
|
||||
#include "G4PSEnergyDeposit.hh"
|
||||
//#include "G4PSDoseDeposit.hh"
|
||||
#include "G4PSNofStep.hh"
|
||||
//#include "G4PSNofSecondary.hh"
|
||||
//#include "G4PSMinKinEAtGeneration.hh"
|
||||
#include "G4PSCellFlux.hh"
|
||||
//#include "G4PSTrackLength.hh"
|
||||
//#include "G4PSPassageTrackLength.hh"
|
||||
//#include "G4PSPassageCurrent.hh"
|
||||
#include "G4PSPassageCellFlux.hh"
|
||||
#include "G4PSFlatSurfaceFlux.hh"
|
||||
#include "G4PSFlatSurfaceCurrent.hh"
|
||||
//#include "G4PSSphereSurfaceCurrent.hh"
|
||||
#include "RE02PSEnergyDeposit.hh"
|
||||
#include "RE02PSNofStep.hh"
|
||||
#include "RE02PSCellFlux.hh"
|
||||
#include "RE02PSPassageCellFlux.hh"
|
||||
#include "RE02PSFlatSurfaceFlux.hh"
|
||||
#include "RE02PSFlatSurfaceCurrent.hh"
|
||||
|
||||
#include "G4SDParticleWithEnergyFilter.hh"
|
||||
#include "G4SDParticleFilter.hh"
|
||||
#include "G4SDChargedFilter.hh"
|
||||
@@ -57,7 +51,7 @@
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
#include "G4PVParameterised.hh"
|
||||
#include "RE02PhantomParameterisation.hh"
|
||||
#include "RE02NestedPhantomParameterisation.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
@@ -74,12 +68,16 @@
|
||||
// [Geometry]
|
||||
// The world volume is defined as 200 cm x 200 cm x 200 cm box with Air.
|
||||
// Water phantom is defined as 200 mm x 200 mm x 400 mm box with Water.
|
||||
// The water phantom is divided into 100 segments in x,y plane, and 200 segments
|
||||
// perpendicular to z axis using parameterised volume.
|
||||
// These values are defined at constructor,
|
||||
// e.g. the size of water phantom (fphantomSize), and number of segmentation
|
||||
// The water phantom is divided into 100 segments in x,y plane using replication,
|
||||
// and then divided into 200 segments perpendicular to z axis using nested
|
||||
// parameterised volume.
|
||||
// These values are defined at constructor,
|
||||
// e.g. the size of water phantom (fphantomSize), and number of segmentation
|
||||
// of water phantom (fNx, fNy, fNz).
|
||||
// NIST database is used for materials.
|
||||
//
|
||||
// By default, lead plates are inserted into the position of even order segments.
|
||||
// NIST database is used for materials.
|
||||
//
|
||||
//
|
||||
// [Scorer]
|
||||
// Assignment of G4MultiFunctionalDetector and G4PrimitiveScorer
|
||||
@@ -104,16 +102,11 @@
|
||||
//
|
||||
RE02DetectorConstruction::RE02DetectorConstruction()
|
||||
{
|
||||
// Default size of water phantom,and segmentation.
|
||||
fphantomSize.setX(200.*mm);
|
||||
fphantomSize.setY(200.*mm);
|
||||
fphantomSize.setZ(400.*mm);
|
||||
//fNx = fNy = fNz = 100;
|
||||
fNx = 100; fNy = 100; fNz = 200;
|
||||
//fNx = 1; fNy = 1; fNz = 200;
|
||||
G4cout << "<-- RE02DetectorConstruction -----------------" <<G4endl;
|
||||
G4cout << " Water Phantom Size " << fphantomSize/mm << G4endl;
|
||||
G4cout << " Segmentation ("<< fNx<<","<<fNy<<","<<fNz<<")"<<G4endl;
|
||||
G4cout << "<---------------------------------------------"<<G4endl;
|
||||
fNx = fNy = fNz = 100;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -131,8 +124,9 @@ RE02DetectorConstruction::~RE02DetectorConstruction()
|
||||
// Material Information imported from NIST database.
|
||||
//
|
||||
G4NistManager* NISTman = G4NistManager::Instance();
|
||||
G4Material* Air = NISTman->FindOrBuildMaterial("G4_AIR");
|
||||
G4Material* H2O = NISTman->FindOrBuildMaterial("G4_WATER");
|
||||
G4Material* Air = NISTman->FindOrBuildMaterial("G4_AIR");
|
||||
G4Material* H2O = NISTman->FindOrBuildMaterial("G4_WATER");
|
||||
G4Material* LEAD = NISTman->FindOrBuildMaterial("G4_Pb");
|
||||
|
||||
//
|
||||
// Print all the materials defined.
|
||||
@@ -199,13 +193,17 @@ RE02DetectorConstruction::~RE02DetectorConstruction()
|
||||
// Phantom segmentation using Parameterisation
|
||||
//..............................................
|
||||
//
|
||||
G4cout << "<-- RE02DetectorConstruction::Construct-------" <<G4endl;
|
||||
G4cout << " Water Phantom Size " << fphantomSize/mm << G4endl;
|
||||
G4cout << " Segmentation ("<< fNx<<","<<fNy<<","<<fNz<<")"<<G4endl;
|
||||
G4cout << " Lead plate at even copy # (0-False,1-True): " << IsLeadSegment() <<G4endl;
|
||||
G4cout << "<---------------------------------------------"<<G4endl;
|
||||
// Number of segmentation.
|
||||
// - Default number of segmentation is defined at constructor.
|
||||
G4int nxCells = fNx;
|
||||
G4int nyCells = fNy;
|
||||
G4int nzCells = fNz;
|
||||
|
||||
G4int nCells = nxCells*nyCells*nzCells;
|
||||
G4ThreeVector sensSize;
|
||||
sensSize.setX(phantomSize.x()/(G4double)nxCells);
|
||||
sensSize.setY(phantomSize.y()/(G4double)nyCells);
|
||||
@@ -213,28 +211,51 @@ RE02DetectorConstruction::~RE02DetectorConstruction()
|
||||
// i.e Voxel size will be 2.0 x 2.0 x 2.0 mm3 cube by default.
|
||||
//
|
||||
|
||||
// Replication of Water Phantom Volume.
|
||||
// Y Slice
|
||||
G4String yRepName("RepY");
|
||||
G4VSolid* solYRep =
|
||||
new G4Box(yRepName,phantomSize.x()/2.,sensSize.y()/2.,phantomSize.z()/2.);
|
||||
G4LogicalVolume* logYRep =
|
||||
new G4LogicalVolume(solYRep,H2O,yRepName);
|
||||
//G4PVReplica* yReplica =
|
||||
new G4PVReplica(yRepName,logYRep,logicPhantom,kYAxis,fNy,sensSize.y());
|
||||
// X Slice
|
||||
G4String xRepName("RepX");
|
||||
G4VSolid* solXRep =
|
||||
new G4Box(xRepName,sensSize.x()/2.,sensSize.y()/2.,phantomSize.z()/2.);
|
||||
G4LogicalVolume* logXRep =
|
||||
new G4LogicalVolume(solXRep,H2O,xRepName);
|
||||
//G4PVReplica* xReplica =
|
||||
new G4PVReplica(xRepName,logXRep,logYRep,kXAxis,fNx,sensSize.x());
|
||||
//
|
||||
//
|
||||
//
|
||||
//..................................
|
||||
// Voxel solid and logical volumes
|
||||
//..................................
|
||||
// Z Slice
|
||||
G4String zVoxName("phantomSens");
|
||||
G4VSolid* solVoxel =
|
||||
new G4Box(zVoxName,sensSize.x()/2.,sensSize.y()/2.,sensSize.z()/2.);
|
||||
G4LogicalVolume* logicPhantomSens = new G4LogicalVolume(solVoxel,H2O,zVoxName);
|
||||
//
|
||||
G4Box * solidPhantomSens
|
||||
= new G4Box("phantomSens",
|
||||
sensSize.x()/2., sensSize.y()/2., sensSize.z()/2.);
|
||||
G4LogicalVolume * logicPhantomSens
|
||||
= new G4LogicalVolume(solidPhantomSens, H2O,"PhantomSens",0,0,0);
|
||||
//
|
||||
std::vector<G4Material*> phantomMat(2,H2O);
|
||||
if ( IsLeadSegment() ) phantomMat[1]=LEAD;
|
||||
//
|
||||
// Parameterisation for transformation of voxels.
|
||||
// (voxel size is fixed in this example. i.e parameterisation handles
|
||||
// only transfomation of voxels.)
|
||||
RE02PhantomParameterisation* paramPhantom
|
||||
= new RE02PhantomParameterisation(phantomSize/2.,nxCells,nyCells,nzCells);
|
||||
// (voxel size is fixed in this example.
|
||||
// e.g. nested parameterisation handles material and transfomation of voxels.)
|
||||
RE02NestedPhantomParameterisation* paramPhantom
|
||||
= new RE02NestedPhantomParameterisation(sensSize/2.,nzCells,phantomMat);
|
||||
//G4VPhysicalVolume * physiPhantomSens =
|
||||
new G4PVParameterised("PhantomSens", // their name
|
||||
logicPhantomSens, // their logical volume
|
||||
logicPhantom, // Mother logical volume
|
||||
kUndefined, // Are placed along this axis
|
||||
nCells, // Number of cells
|
||||
paramPhantom); // Parameterisation.
|
||||
new G4PVParameterised("PhantomSens", // their name
|
||||
logicPhantomSens, // their logical volume
|
||||
logXRep, // Mother logical volume
|
||||
kUndefined, // Are placed along this axis
|
||||
nzCells, // Number of cells
|
||||
paramPhantom); // Parameterisation.
|
||||
// Optimization flag is avaiable for,
|
||||
// kUndefined, kXAxis, kYAxis, kZAxis.
|
||||
//
|
||||
@@ -291,20 +312,23 @@ RE02DetectorConstruction::~RE02DetectorConstruction()
|
||||
//-- Primitive Scorer for Energy Deposit.
|
||||
// Total, by protons, by electrons.
|
||||
G4String psName;
|
||||
G4PSEnergyDeposit* scorer0 = new G4PSEnergyDeposit(psName="totalEDep");
|
||||
G4PSEnergyDeposit* scorer1 = new G4PSEnergyDeposit(psName="protonEDep");
|
||||
G4PSEnergyDeposit* scorer0 = new RE02PSEnergyDeposit(psName="totalEDep",fNx,fNy,fNz);
|
||||
G4PSEnergyDeposit* scorer1 = new RE02PSEnergyDeposit(psName="protonEDep",fNx,fNy,fNz);
|
||||
scorer1->SetFilter(protonFilter);
|
||||
|
||||
//
|
||||
//-- Number of Steps for protons
|
||||
G4PSNofStep* scorer2 = new G4PSNofStep(psName="protonNStep");
|
||||
G4PSNofStep* scorer2 = new RE02PSNofStep(psName="protonNStep",fNx,fNy,fNz);
|
||||
scorer2->SetFilter(protonFilter);
|
||||
|
||||
//
|
||||
//-- CellFlux for charged particles
|
||||
G4PSPassageCellFlux* scorer3 = new G4PSPassageCellFlux(psName="chargedPassCellFlux");
|
||||
G4PSCellFlux* scorer4 = new G4PSCellFlux(psName="chargedCellFlux");
|
||||
G4PSFlatSurfaceFlux* scorer5 = new G4PSFlatSurfaceFlux(psName="chargedSurfFlux",fFlux_InOut);
|
||||
G4PSPassageCellFlux* scorer3 = new RE02PSPassageCellFlux(psName="chargedPassCellFlux",
|
||||
fNx,fNy,fNz);
|
||||
G4PSCellFlux* scorer4 = new RE02PSCellFlux(psName="chargedCellFlux",
|
||||
fNx,fNy,fNz);
|
||||
G4PSFlatSurfaceFlux* scorer5 = new RE02PSFlatSurfaceFlux(psName="chargedSurfFlux",
|
||||
fFlux_InOut,fNx,fNy,fNz);
|
||||
scorer3->SetFilter(chargedFilter);
|
||||
scorer4->SetFilter(chargedFilter);
|
||||
scorer5->SetFilter(chargedFilter);
|
||||
@@ -346,7 +370,7 @@ RE02DetectorConstruction::~RE02DetectorConstruction()
|
||||
pkinEFilter->show(); // Show accepting condition to stdout.
|
||||
//-- Surface Current Scorer which scores number of tracks in unit area.
|
||||
G4PSFlatSurfaceCurrent* scorer =
|
||||
new G4PSFlatSurfaceCurrent(psgName,fCurrent_InOut);
|
||||
new RE02PSFlatSurfaceCurrent(psgName,fCurrent_InOut,fNx,fNy,fNz);
|
||||
scorer->SetFilter(pkinEFilter); // Assign filter.
|
||||
MFDet->RegisterPrimitive(scorer); // Register it to MultiFunctionalDetector.
|
||||
}
|
||||
@@ -359,15 +383,20 @@ RE02DetectorConstruction::~RE02DetectorConstruction()
|
||||
G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
logicWorld ->SetVisAttributes(BoxVisAtt);
|
||||
//logicWorld->SetVisAttributes(G4VisAttributes::Invisible);
|
||||
|
||||
|
||||
// Mother volume of WaterPhantom
|
||||
G4VisAttributes* PhantomVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
|
||||
logicPhantom->SetVisAttributes(PhantomVisAtt);
|
||||
|
||||
// Replica
|
||||
G4VisAttributes* YRepVisAtt = new G4VisAttributes(G4Colour(0.0,1.0,0.0));
|
||||
logYRep->SetVisAttributes(YRepVisAtt);
|
||||
G4VisAttributes* XRepVisAtt = new G4VisAttributes(G4Colour(0.0,1.0,0.0));
|
||||
logXRep->SetVisAttributes(YRepVisAtt);
|
||||
|
||||
// Skip the visualization for those voxels.
|
||||
logicPhantomSens->SetVisAttributes(G4VisAttributes::Invisible);
|
||||
|
||||
// If number of segmentation of water phantom is too large,
|
||||
// skip the visualization for those voxels.
|
||||
if ( nCells > 1000 ) {
|
||||
logicPhantomSens->SetVisAttributes(G4VisAttributes::Invisible);
|
||||
}
|
||||
|
||||
return physiWorld;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user