Import Geant4 11.3.0.beta source tree
This commit is contained in:
@@ -29,17 +29,22 @@
|
||||
//
|
||||
|
||||
#include "RE02ActionInitialization.hh"
|
||||
|
||||
#include "RE02EventAction.hh"
|
||||
#include "RE02PrimaryGeneratorAction.hh"
|
||||
#include "RE02RunAction.hh"
|
||||
#include "RE02EventAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02ActionInitialization::RE02ActionInitialization()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02ActionInitialization::~RE02ActionInitialization()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE02ActionInitialization::Build() const
|
||||
@@ -59,4 +64,3 @@ void RE02ActionInitialization::BuildForMaster() const
|
||||
G4UserRunAction* run_action = new RE02RunAction;
|
||||
SetUserAction(run_action);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,34 +28,30 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#include "RE02DetectorConstruction.hh"
|
||||
|
||||
#include "G4PSEnergyDeposit3D.hh"
|
||||
#include "G4PSNofStep3D.hh"
|
||||
#include "G4PSCellFlux3D.hh"
|
||||
#include "G4PSPassageCellFlux3D.hh"
|
||||
#include "G4PSFlatSurfaceFlux3D.hh"
|
||||
#include "G4PSFlatSurfaceCurrent3D.hh"
|
||||
|
||||
#include "G4SDParticleWithEnergyFilter.hh"
|
||||
#include "G4SDParticleFilter.hh"
|
||||
#include "G4SDChargedFilter.hh"
|
||||
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
#include "G4PVParameterised.hh"
|
||||
#include "RE02NestedPhantomParameterisation.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4PSCellFlux3D.hh"
|
||||
#include "G4PSEnergyDeposit3D.hh"
|
||||
#include "G4PSFlatSurfaceCurrent3D.hh"
|
||||
#include "G4PSFlatSurfaceFlux3D.hh"
|
||||
#include "G4PSNofStep3D.hh"
|
||||
#include "G4PSPassageCellFlux3D.hh"
|
||||
#include "G4PVParameterised.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4SDChargedFilter.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4SDParticleFilter.hh"
|
||||
#include "G4SDParticleWithEnergyFilter.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//=======================================================================
|
||||
@@ -64,34 +60,34 @@
|
||||
// (Description)
|
||||
//
|
||||
// Detector construction for example RE02.
|
||||
//
|
||||
// [Geometry]
|
||||
//
|
||||
// [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 using
|
||||
// replication,
|
||||
// and then divided into 200 segments perpendicular to z axis using nested
|
||||
// parameterised volume.
|
||||
// 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).
|
||||
//
|
||||
// By default, lead plates are inserted into the position of even order
|
||||
// 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
|
||||
// Assignment of G4MultiFunctionalDetector and G4PrimitiveScorer
|
||||
// is demonstrated in this example.
|
||||
// -------------------------------------------------
|
||||
// The collection names of defined Primitives are
|
||||
// 0 PhantomSD/totalEDep
|
||||
// 0 PhantomSD/totalEDep
|
||||
// 1 PhantomSD/protonEDep
|
||||
// 2 PhantomSD/protonNStep
|
||||
// 3 PhantomSD/chargedPassCellFlux
|
||||
// 4 PhantomSD/chargedCellFlux
|
||||
// 5 PhantomSD/chargedSurfFlux
|
||||
// 4 PhantomSD/chargedCellFlux
|
||||
// 5 PhantomSD/chargedSurfFlux
|
||||
// 6 PhantomSD/gammaSurfCurr000
|
||||
// 7 PhantomSD/gammaSurfCurr001
|
||||
// 9 PhantomSD/gammaSurdCurr002
|
||||
@@ -102,34 +98,35 @@
|
||||
//=======================================================================
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02DetectorConstruction::RE02DetectorConstruction()
|
||||
: G4VUserDetectorConstruction()
|
||||
RE02DetectorConstruction::RE02DetectorConstruction() : G4VUserDetectorConstruction()
|
||||
{
|
||||
// Default size of water phantom,and segmentation.
|
||||
fPhantomSize.setX(200.*mm);
|
||||
fPhantomSize.setY(200.*mm);
|
||||
fPhantomSize.setZ(400.*mm);
|
||||
fNx = fNy = fNz = 100;
|
||||
fInsertLead = TRUE;
|
||||
fPhantomSize.setX(200. * mm);
|
||||
fPhantomSize.setY(200. * mm);
|
||||
fPhantomSize.setZ(400. * mm);
|
||||
fNx = fNy = fNz = 100;
|
||||
fInsertLead = TRUE;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02DetectorConstruction::~RE02DetectorConstruction()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4VPhysicalVolume* RE02DetectorConstruction::Construct()
|
||||
G4VPhysicalVolume* RE02DetectorConstruction::Construct()
|
||||
{
|
||||
//=====================
|
||||
// Material Definitions
|
||||
//=====================
|
||||
//
|
||||
//
|
||||
//-------- NIST Materials ----------------------------------------------------
|
||||
// Material Information imported from NIST database.
|
||||
//
|
||||
G4NistManager* NISTman = G4NistManager::Instance();
|
||||
G4Material* air = NISTman->FindOrBuildMaterial("G4_AIR");
|
||||
G4Material* water = NISTman->FindOrBuildMaterial("G4_WATER");
|
||||
G4Material* air = NISTman->FindOrBuildMaterial("G4_AIR");
|
||||
G4Material* water = NISTman->FindOrBuildMaterial("G4_WATER");
|
||||
G4Material* lead = NISTman->FindOrBuildMaterial("G4_Pb");
|
||||
|
||||
//
|
||||
@@ -138,31 +135,29 @@ RE02DetectorConstruction::~RE02DetectorConstruction()
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
|
||||
//============================================================================
|
||||
// Definitions of Solids, Logical Volumes, Physical Volumes
|
||||
// Definitions of Solids, Logical Volumes, Physical Volumes
|
||||
//============================================================================
|
||||
|
||||
//-------------
|
||||
// World Volume
|
||||
// World Volume
|
||||
//-------------
|
||||
|
||||
G4ThreeVector worldSize = G4ThreeVector(200*cm, 200*cm, 200*cm);
|
||||
|
||||
G4Box * solidWorld
|
||||
= new G4Box("world", worldSize.x()/2., worldSize.y()/2., worldSize.z()/2.);
|
||||
G4LogicalVolume * logicWorld
|
||||
= new G4LogicalVolume(solidWorld, air, "World", 0, 0, 0);
|
||||
G4ThreeVector worldSize = G4ThreeVector(200 * cm, 200 * cm, 200 * cm);
|
||||
|
||||
//
|
||||
G4Box* solidWorld =
|
||||
new G4Box("world", worldSize.x() / 2., worldSize.y() / 2., worldSize.z() / 2.);
|
||||
G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, air, "World", 0, 0, 0);
|
||||
|
||||
//
|
||||
// Must place the World Physical volume unrotated at (0,0,0).
|
||||
G4VPhysicalVolume * physiWorld
|
||||
= new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicWorld, // its logical volume
|
||||
"World", // its name
|
||||
0, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
|
||||
G4VPhysicalVolume* physiWorld = new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicWorld, // its logical volume
|
||||
"World", // its name
|
||||
0, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
|
||||
//---------------
|
||||
// Water Phantom
|
||||
//---------------
|
||||
@@ -172,36 +167,33 @@ RE02DetectorConstruction::~RE02DetectorConstruction()
|
||||
//................................
|
||||
|
||||
//-- Default size of water phantom is defined at constructor.
|
||||
G4ThreeVector phantomSize = fPhantomSize;
|
||||
|
||||
G4Box * solidPhantom
|
||||
= new G4Box("phantom",
|
||||
phantomSize.x()/2., phantomSize.y()/2., phantomSize.z()/2.);
|
||||
G4LogicalVolume * logicPhantom
|
||||
= new G4LogicalVolume(solidPhantom, water, "Phantom", 0, 0, 0);
|
||||
G4ThreeVector phantomSize = fPhantomSize;
|
||||
|
||||
G4Box* solidPhantom =
|
||||
new G4Box("phantom", phantomSize.x() / 2., phantomSize.y() / 2., phantomSize.z() / 2.);
|
||||
G4LogicalVolume* logicPhantom = new G4LogicalVolume(solidPhantom, water, "Phantom", 0, 0, 0);
|
||||
|
||||
G4RotationMatrix* rot = new G4RotationMatrix();
|
||||
//rot->rotateY(30.*deg);
|
||||
// rot->rotateY(30.*deg);
|
||||
G4ThreeVector positionPhantom;
|
||||
//G4VPhysicalVolume * physiPhantom =
|
||||
new G4PVPlacement(rot, // no rotation
|
||||
positionPhantom, // at (x,y,z)
|
||||
logicPhantom, // its logical volume
|
||||
"Phantom", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
// G4VPhysicalVolume * physiPhantom =
|
||||
new G4PVPlacement(rot, // no rotation
|
||||
positionPhantom, // at (x,y,z)
|
||||
logicPhantom, // its logical volume
|
||||
"Phantom", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
|
||||
//..............................................
|
||||
// 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;
|
||||
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;
|
||||
@@ -209,29 +201,27 @@ RE02DetectorConstruction::~RE02DetectorConstruction()
|
||||
G4int nzCells = fNz;
|
||||
|
||||
G4ThreeVector sensSize;
|
||||
sensSize.setX(phantomSize.x()/(G4double)nxCells);
|
||||
sensSize.setY(phantomSize.y()/(G4double)nyCells);
|
||||
sensSize.setZ(phantomSize.z()/(G4double)nzCells);
|
||||
sensSize.setX(phantomSize.x() / (G4double)nxCells);
|
||||
sensSize.setY(phantomSize.y() / (G4double)nyCells);
|
||||
sensSize.setZ(phantomSize.z() / (G4double)nzCells);
|
||||
// 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,water,yRepName);
|
||||
//G4PVReplica* yReplica =
|
||||
new G4PVReplica(yRepName,logYRep,logicPhantom,kYAxis,fNy,sensSize.y());
|
||||
new G4Box(yRepName, phantomSize.x() / 2., sensSize.y() / 2., phantomSize.z() / 2.);
|
||||
G4LogicalVolume* logYRep = new G4LogicalVolume(solYRep, water, 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,water,xRepName);
|
||||
//G4PVReplica* xReplica =
|
||||
new G4PVReplica(xRepName,logXRep,logYRep,kXAxis,fNx,sensSize.x());
|
||||
new G4Box(xRepName, sensSize.x() / 2., sensSize.y() / 2., phantomSize.z() / 2.);
|
||||
G4LogicalVolume* logXRep = new G4LogicalVolume(solXRep, water, xRepName);
|
||||
// G4PVReplica* xReplica =
|
||||
new G4PVReplica(xRepName, logXRep, logYRep, kXAxis, fNx, sensSize.x());
|
||||
|
||||
//
|
||||
//..................................
|
||||
@@ -239,57 +229,55 @@ RE02DetectorConstruction::~RE02DetectorConstruction()
|
||||
//..................................
|
||||
// Z Slice
|
||||
G4String zVoxName("phantomSens");
|
||||
G4VSolid* solVoxel =
|
||||
new G4Box(zVoxName,sensSize.x()/2.,sensSize.y()/2.,sensSize.z()/2.);
|
||||
fLVPhantomSens = new G4LogicalVolume(solVoxel,water,zVoxName);
|
||||
G4VSolid* solVoxel = new G4Box(zVoxName, sensSize.x() / 2., sensSize.y() / 2., sensSize.z() / 2.);
|
||||
fLVPhantomSens = new G4LogicalVolume(solVoxel, water, zVoxName);
|
||||
//
|
||||
//
|
||||
std::vector<G4Material*> phantomMat(2,water);
|
||||
if ( IsLeadSegment() ) phantomMat[1]=lead;
|
||||
std::vector<G4Material*> phantomMat(2, water);
|
||||
if (IsLeadSegment()) phantomMat[1] = lead;
|
||||
//
|
||||
// Parameterisation for transformation of voxels.
|
||||
// (voxel size is fixed in this example.
|
||||
// (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
|
||||
fLVPhantomSens, // their logical volume
|
||||
logXRep, // Mother logical volume
|
||||
kUndefined, // Are placed along this axis
|
||||
nzCells, // Number of cells
|
||||
paramPhantom); // Parameterisation.
|
||||
RE02NestedPhantomParameterisation* paramPhantom =
|
||||
new RE02NestedPhantomParameterisation(sensSize / 2., nzCells, phantomMat);
|
||||
// G4VPhysicalVolume * physiPhantomSens =
|
||||
new G4PVParameterised("PhantomSens", // their name
|
||||
fLVPhantomSens, // 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.
|
||||
//
|
||||
|
||||
//===============================
|
||||
// Visualization attributes
|
||||
//===============================
|
||||
// Visualization attributes
|
||||
//===============================
|
||||
|
||||
G4VisAttributes* boxVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
logicWorld ->SetVisAttributes(boxVisAtt);
|
||||
//logicWorld->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
G4VisAttributes* boxVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
|
||||
logicWorld->SetVisAttributes(boxVisAtt);
|
||||
// logicWorld->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
|
||||
// Mother volume of WaterPhantom
|
||||
G4VisAttributes* phantomVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
|
||||
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));
|
||||
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));
|
||||
G4VisAttributes* xRepVisAtt = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
|
||||
logXRep->SetVisAttributes(xRepVisAtt);
|
||||
|
||||
|
||||
// Skip the visualization for those voxels.
|
||||
fLVPhantomSens->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
|
||||
|
||||
return physiWorld;
|
||||
}
|
||||
|
||||
void RE02DetectorConstruction::ConstructSDandField() {
|
||||
|
||||
void RE02DetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
//================================================
|
||||
// Sensitive detectors : MultiFunctionalDetector
|
||||
//================================================
|
||||
@@ -299,17 +287,16 @@ void RE02DetectorConstruction::ConstructSDandField() {
|
||||
//
|
||||
// Sensitive Detector Name
|
||||
G4String phantomSDname = "PhantomSD";
|
||||
|
||||
|
||||
//------------------------
|
||||
// MultiFunctionalDetector
|
||||
//------------------------
|
||||
//
|
||||
// Define MultiFunctionalDetector with name.
|
||||
G4MultiFunctionalDetector* mFDet
|
||||
= new G4MultiFunctionalDetector(phantomSDname);
|
||||
pSDman->AddNewDetector( mFDet ); // Register SD to SDManager.
|
||||
fLVPhantomSens->SetSensitiveDetector(mFDet); // Assign SD to the logical volume.
|
||||
|
||||
G4MultiFunctionalDetector* mFDet = new G4MultiFunctionalDetector(phantomSDname);
|
||||
pSDman->AddNewDetector(mFDet); // Register SD to SDManager.
|
||||
fLVPhantomSens->SetSensitiveDetector(mFDet); // Assign SD to the logical volume.
|
||||
|
||||
//---------------------------------------
|
||||
// SDFilter : Sensitive Detector Filters
|
||||
//---------------------------------------
|
||||
@@ -318,22 +305,20 @@ void RE02DetectorConstruction::ConstructSDandField() {
|
||||
// and particle name(particleName),
|
||||
// or particle names are given by add("particle name"); method.
|
||||
//
|
||||
G4String fltName,particleName;
|
||||
G4String fltName, particleName;
|
||||
//
|
||||
//-- proton filter
|
||||
G4SDParticleFilter* protonFilter =
|
||||
new G4SDParticleFilter(fltName="protonFilter", particleName="proton");
|
||||
new G4SDParticleFilter(fltName = "protonFilter", particleName = "proton");
|
||||
//
|
||||
//-- electron filter
|
||||
G4SDParticleFilter* electronFilter =
|
||||
new G4SDParticleFilter(fltName="electronFilter");
|
||||
electronFilter->add(particleName="e+"); // accept electrons.
|
||||
electronFilter->add(particleName="e-"); // accept positorons.
|
||||
G4SDParticleFilter* electronFilter = new G4SDParticleFilter(fltName = "electronFilter");
|
||||
electronFilter->add(particleName = "e+"); // accept electrons.
|
||||
electronFilter->add(particleName = "e-"); // accept positorons.
|
||||
//
|
||||
//-- charged particle filter
|
||||
G4SDChargedFilter* chargedFilter =
|
||||
new G4SDChargedFilter(fltName="chargedFilter");
|
||||
|
||||
G4SDChargedFilter* chargedFilter = new G4SDChargedFilter(fltName = "chargedFilter");
|
||||
|
||||
//------------------------
|
||||
// PS : Primitive Scorers
|
||||
//------------------------
|
||||
@@ -343,30 +328,26 @@ void RE02DetectorConstruction::ConstructSDandField() {
|
||||
//-- Primitive Scorer for Energy Deposit.
|
||||
// Total, by protons, by electrons.
|
||||
G4String psName;
|
||||
G4PSEnergyDeposit3D * scorer0 = new G4PSEnergyDeposit3D(psName="totalEDep",
|
||||
fNx,fNy,fNz);
|
||||
G4PSEnergyDeposit3D * scorer1 = new G4PSEnergyDeposit3D(psName="protonEDep",
|
||||
fNx,fNy,fNz);
|
||||
G4PSEnergyDeposit3D* scorer0 = new G4PSEnergyDeposit3D(psName = "totalEDep", fNx, fNy, fNz);
|
||||
G4PSEnergyDeposit3D* scorer1 = new G4PSEnergyDeposit3D(psName = "protonEDep", fNx, fNy, fNz);
|
||||
scorer1->SetFilter(protonFilter);
|
||||
|
||||
|
||||
//
|
||||
//-- Number of Steps for protons
|
||||
G4PSNofStep3D * scorer2 =
|
||||
new G4PSNofStep3D(psName="protonNStep",fNx,fNy,fNz);
|
||||
G4PSNofStep3D* scorer2 = new G4PSNofStep3D(psName = "protonNStep", fNx, fNy, fNz);
|
||||
scorer2->SetFilter(protonFilter);
|
||||
|
||||
|
||||
//
|
||||
//-- CellFlux for charged particles
|
||||
G4PSPassageCellFlux3D * scorer3 =
|
||||
new G4PSPassageCellFlux3D(psName="chargedPassCellFlux", fNx,fNy,fNz);
|
||||
G4PSCellFlux3D * scorer4 =
|
||||
new G4PSCellFlux3D(psName="chargedCellFlux", fNx,fNy,fNz);
|
||||
G4PSFlatSurfaceFlux3D * scorer5 =
|
||||
new G4PSFlatSurfaceFlux3D(psName="chargedSurfFlux", fFlux_InOut,fNx,fNy,fNz);
|
||||
G4PSPassageCellFlux3D* scorer3 =
|
||||
new G4PSPassageCellFlux3D(psName = "chargedPassCellFlux", fNx, fNy, fNz);
|
||||
G4PSCellFlux3D* scorer4 = new G4PSCellFlux3D(psName = "chargedCellFlux", fNx, fNy, fNz);
|
||||
G4PSFlatSurfaceFlux3D* scorer5 =
|
||||
new G4PSFlatSurfaceFlux3D(psName = "chargedSurfFlux", fFlux_InOut, fNx, fNy, fNz);
|
||||
scorer3->SetFilter(chargedFilter);
|
||||
scorer4->SetFilter(chargedFilter);
|
||||
scorer5->SetFilter(chargedFilter);
|
||||
|
||||
|
||||
//
|
||||
//------------------------------------------------------------
|
||||
// Register primitive scorers to MultiFunctionalDetector
|
||||
@@ -377,7 +358,7 @@ void RE02DetectorConstruction::ConstructSDandField() {
|
||||
mFDet->RegisterPrimitive(scorer3);
|
||||
mFDet->RegisterPrimitive(scorer4);
|
||||
mFDet->RegisterPrimitive(scorer5);
|
||||
|
||||
|
||||
//========================
|
||||
// More additional Primitive Scoreres
|
||||
//========================
|
||||
@@ -390,23 +371,21 @@ void RE02DetectorConstruction::ConstructSDandField() {
|
||||
// 100 keV to 1 MeV, gammaSurfCurr002
|
||||
// 1 MeV to 10 MeV. gammaSurfCurr003
|
||||
//
|
||||
for ( G4int i = 0; i < 4; i++){
|
||||
for (G4int i = 0; i < 4; i++) {
|
||||
std::ostringstream name;
|
||||
name << "gammaSurfCurr" << std::setfill('0') << std::setw(3) << i;
|
||||
G4String psgName = name.str();
|
||||
G4double kmin = std::pow(10.,(G4double)i)*keV;
|
||||
G4double kmax = std::pow(10.,(G4double)(i+1))*keV;
|
||||
G4double kmin = std::pow(10., (G4double)i) * keV;
|
||||
G4double kmax = std::pow(10., (G4double)(i + 1)) * keV;
|
||||
//-- Particle with kinetic energy filter.
|
||||
G4SDParticleWithEnergyFilter* pkinEFilter =
|
||||
new G4SDParticleWithEnergyFilter(fltName="gammaE filter",kmin,kmax);
|
||||
new G4SDParticleWithEnergyFilter(fltName = "gammaE filter", kmin, kmax);
|
||||
pkinEFilter->add("gamma"); // Accept only gamma.
|
||||
pkinEFilter->show(); // Show accepting condition to stdout.
|
||||
pkinEFilter->show(); // Show accepting condition to stdout.
|
||||
//-- Surface Current Scorer which scores number of tracks in unit area.
|
||||
G4PSFlatSurfaceCurrent3D * scorer =
|
||||
new G4PSFlatSurfaceCurrent3D(psgName,fCurrent_InOut,fNx,fNy,fNz);
|
||||
scorer->SetFilter(pkinEFilter); // Assign filter.
|
||||
G4PSFlatSurfaceCurrent3D* scorer =
|
||||
new G4PSFlatSurfaceCurrent3D(psgName, fCurrent_InOut, fNx, fNy, fNz);
|
||||
scorer->SetFilter(pkinEFilter); // Assign filter.
|
||||
mFDet->RegisterPrimitive(scorer); // Register it to MultiFunctionalDetector.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -28,38 +28,33 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#include "RE02EventAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02EventAction::RE02EventAction()
|
||||
: G4UserEventAction()
|
||||
{}
|
||||
RE02EventAction::RE02EventAction() : G4UserEventAction() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02EventAction::~RE02EventAction()
|
||||
{}
|
||||
RE02EventAction::~RE02EventAction() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE02EventAction::BeginOfEventAction(const G4Event*)
|
||||
{}
|
||||
void RE02EventAction::BeginOfEventAction(const G4Event*) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE02EventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4int event_id = evt->GetEventID();
|
||||
|
||||
|
||||
// periodic printing
|
||||
//
|
||||
if (event_id < 10 ||
|
||||
(event_id < 1000 && event_id%100 == 0) ||
|
||||
(event_id < 10000 && event_id%1000 == 0) ||
|
||||
(event_id < 100000 && event_id%10000 == 0)) {
|
||||
if (event_id < 10 || (event_id < 1000 && event_id % 100 == 0)
|
||||
|| (event_id < 10000 && event_id % 1000 == 0) || (event_id < 100000 && event_id % 10000 == 0))
|
||||
{
|
||||
G4cout << ">>> Event " << evt->GetEventID() << G4endl;
|
||||
#ifdef print_stored_trajectories
|
||||
// get number of stored trajectories
|
||||
@@ -67,11 +62,9 @@ void RE02EventAction::EndOfEventAction(const G4Event* evt)
|
||||
G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
|
||||
G4int n_trajectories = 0;
|
||||
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
|
||||
G4cout << " " << n_trajectories
|
||||
<< " trajectories stored in this event." << G4endl;
|
||||
G4cout << " " << n_trajectories << " trajectories stored in this event." << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include "RE02NestedPhantomParameterisation.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
|
||||
//=======================================================================
|
||||
// (RE02NestedPhantomParameterisation)
|
||||
@@ -49,29 +49,30 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02NestedPhantomParameterisation
|
||||
::RE02NestedPhantomParameterisation(const G4ThreeVector& voxelSize,
|
||||
G4int nz,
|
||||
std::vector<G4Material*>& mat):
|
||||
G4VNestedParameterisation(),
|
||||
fdX(voxelSize.x()),fdY(voxelSize.y()),fdZ(voxelSize.z()),
|
||||
fNz(nz),fMat(mat)
|
||||
RE02NestedPhantomParameterisation ::RE02NestedPhantomParameterisation(
|
||||
const G4ThreeVector& voxelSize, G4int nz, std::vector<G4Material*>& mat)
|
||||
: G4VNestedParameterisation(),
|
||||
fdX(voxelSize.x()),
|
||||
fdY(voxelSize.y()),
|
||||
fdZ(voxelSize.z()),
|
||||
fNz(nz),
|
||||
fMat(mat)
|
||||
{
|
||||
// Position of voxels.
|
||||
// x and y positions are already defined in DetectorConstruction
|
||||
// Position of voxels.
|
||||
// x and y positions are already defined in DetectorConstruction
|
||||
// by using replicated volume. Here only we need to define is z positions
|
||||
// of voxles.
|
||||
fpZ.clear();
|
||||
G4double zp;
|
||||
for ( G4int iz = 0; iz < fNz; iz++){
|
||||
zp = (-fNz+1+2*iz)*fdZ;
|
||||
for (G4int iz = 0; iz < fNz; iz++) {
|
||||
zp = (-fNz + 1 + 2 * iz) * fdZ;
|
||||
fpZ.push_back(zp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02NestedPhantomParameterisation::~RE02NestedPhantomParameterisation(){
|
||||
RE02NestedPhantomParameterisation::~RE02NestedPhantomParameterisation()
|
||||
{
|
||||
fpZ.clear();
|
||||
}
|
||||
|
||||
@@ -79,22 +80,25 @@ RE02NestedPhantomParameterisation::~RE02NestedPhantomParameterisation(){
|
||||
//
|
||||
// Material assignment to geometry.
|
||||
//
|
||||
G4Material* RE02NestedPhantomParameterisation
|
||||
::ComputeMaterial(G4VPhysicalVolume* /*currentVol*/, const G4int copyNo,
|
||||
const G4VTouchable* parentTouch)
|
||||
G4Material* RE02NestedPhantomParameterisation ::ComputeMaterial(G4VPhysicalVolume* /*currentVol*/,
|
||||
const G4int copyNo,
|
||||
const G4VTouchable* parentTouch)
|
||||
{
|
||||
if(parentTouch==0) return fMat[0]; // protection for initialization and
|
||||
// vis at idle state
|
||||
// Copy number of voxels.
|
||||
if (parentTouch == 0)
|
||||
return fMat[0]; // protection for initialization and
|
||||
// vis at idle state
|
||||
// Copy number of voxels.
|
||||
// Copy number of X and Y are obtained from replication number.
|
||||
// Copy nymber of Z is the copy number of current voxel.
|
||||
G4int ix = parentTouch->GetReplicaNumber(0);
|
||||
G4int iy = parentTouch->GetReplicaNumber(1);
|
||||
G4int iz = copyNo;
|
||||
// For demonstration purpose,a couple of materials are chosen alternately.
|
||||
G4Material* mat=0;
|
||||
if ( ix%2 == 0 && iy%2 == 0 && iz%2 == 0 ) mat = fMat[0];
|
||||
else mat = fMat[1];
|
||||
G4Material* mat = 0;
|
||||
if (ix % 2 == 0 && iy % 2 == 0 && iz % 2 == 0)
|
||||
mat = fMat[0];
|
||||
else
|
||||
mat = fMat[1];
|
||||
|
||||
return mat;
|
||||
}
|
||||
@@ -102,9 +106,10 @@ G4Material* RE02NestedPhantomParameterisation
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// Number of Materials
|
||||
// Material scanner is required for preparing physics tables and so on before
|
||||
// Material scanner is required for preparing physics tables and so on before
|
||||
// stating simulation, so that G4 has to know number of materials.
|
||||
G4int RE02NestedPhantomParameterisation::GetNumberOfMaterials() const{
|
||||
G4int RE02NestedPhantomParameterisation::GetNumberOfMaterials() const
|
||||
{
|
||||
return fMat.size();
|
||||
}
|
||||
|
||||
@@ -113,7 +118,8 @@ G4int RE02NestedPhantomParameterisation::GetNumberOfMaterials() const{
|
||||
// GetMaterial
|
||||
// This is needed for material scanner and realizing geometry.
|
||||
//
|
||||
G4Material* RE02NestedPhantomParameterisation::GetMaterial(G4int i) const{
|
||||
G4Material* RE02NestedPhantomParameterisation::GetMaterial(G4int i) const
|
||||
{
|
||||
return fMat[i];
|
||||
}
|
||||
|
||||
@@ -121,9 +127,10 @@ G4Material* RE02NestedPhantomParameterisation::GetMaterial(G4int i) const{
|
||||
//
|
||||
// Transformation of voxels.
|
||||
//
|
||||
void RE02NestedPhantomParameterisation
|
||||
::ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* physVol) const{
|
||||
G4ThreeVector position(0.,0.,fpZ[copyNo]);
|
||||
void RE02NestedPhantomParameterisation ::ComputeTransformation(const G4int copyNo,
|
||||
G4VPhysicalVolume* physVol) const
|
||||
{
|
||||
G4ThreeVector position(0., 0., fpZ[copyNo]);
|
||||
physVol->SetTranslation(position);
|
||||
}
|
||||
|
||||
@@ -131,8 +138,9 @@ void RE02NestedPhantomParameterisation
|
||||
//
|
||||
// Dimensions are always same in this RE02 example.
|
||||
//
|
||||
void RE02NestedPhantomParameterisation
|
||||
::ComputeDimensions(G4Box& box, const G4int, const G4VPhysicalVolume* ) const{
|
||||
void RE02NestedPhantomParameterisation ::ComputeDimensions(G4Box& box, const G4int,
|
||||
const G4VPhysicalVolume*) const
|
||||
{
|
||||
box.SetXHalfLength(fdX);
|
||||
box.SetYHalfLength(fdY);
|
||||
box.SetZHalfLength(fdZ);
|
||||
|
||||
@@ -47,23 +47,27 @@
|
||||
// This is a primitive scorer class for scoring cell charge.
|
||||
// The Cell Charge is defined by a sum of charge inside the cell
|
||||
// which calculates the deposited charge in the cell.
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Created: 2006-06-20 Tsukasa ASO, Akinori Kimura.
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02PSCellFlux::RE02PSCellFlux(G4String name,G4int nx, G4int ny, G4int nz)
|
||||
:G4PSCellFlux(name),fNx(nx),fNy(ny),fNz(nz)
|
||||
{;}
|
||||
RE02PSCellFlux::RE02PSCellFlux(G4String name, G4int nx, G4int ny, G4int nz)
|
||||
: G4PSCellFlux(name), fNx(nx), fNy(ny), fNz(nz)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02PSCellFlux::~RE02PSCellFlux()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4int RE02PSCellFlux::GetIndex(G4Step* aStep)
|
||||
@@ -72,8 +76,10 @@ G4int RE02PSCellFlux::GetIndex(G4Step* aStep)
|
||||
G4int ix = touchable->GetReplicaNumber(1);
|
||||
G4int iy = touchable->GetReplicaNumber(2);
|
||||
G4int iz = touchable->GetReplicaNumber(0);
|
||||
|
||||
|
||||
G4int tmp = fNy;
|
||||
if (tmp) return iy*fNx*fNz+ix*fNz+iz;
|
||||
else return iy*fNx*fNz+ix*fNz+iz;
|
||||
if (tmp)
|
||||
return iy * fNx * fNz + ix * fNz + iz;
|
||||
else
|
||||
return iy * fNx * fNz + ix * fNz + iz;
|
||||
}
|
||||
|
||||
@@ -47,24 +47,27 @@
|
||||
// This is a primitive scorer class for scoring cell charge.
|
||||
// The Cell Charge is defined by a sum of charge inside the cell
|
||||
// which calculates the deposited charge in the cell.
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Created: 2006-06-20 Tsukasa ASO, Akinori Kimura.
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02PSEnergyDeposit::RE02PSEnergyDeposit(G4String name,
|
||||
G4int nx, G4int ny, G4int nz)
|
||||
:G4PSEnergyDeposit(name),fNx(nx),fNy(ny),fNz(nz)
|
||||
{;}
|
||||
RE02PSEnergyDeposit::RE02PSEnergyDeposit(G4String name, G4int nx, G4int ny, G4int nz)
|
||||
: G4PSEnergyDeposit(name), fNx(nx), fNy(ny), fNz(nz)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02PSEnergyDeposit::~RE02PSEnergyDeposit()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4int RE02PSEnergyDeposit::GetIndex(G4Step* aStep)
|
||||
@@ -75,6 +78,8 @@ G4int RE02PSEnergyDeposit::GetIndex(G4Step* aStep)
|
||||
G4int iz = touchable->GetReplicaNumber(0);
|
||||
|
||||
G4int tmp = fNy;
|
||||
if (tmp) return iy*fNx*fNz+ix*fNz+iz;
|
||||
else return iy*fNx*fNz+ix*fNz+iz;
|
||||
if (tmp)
|
||||
return iy * fNx * fNz + ix * fNz + iz;
|
||||
else
|
||||
return iy * fNx * fNz + ix * fNz + iz;
|
||||
}
|
||||
|
||||
@@ -47,25 +47,28 @@
|
||||
// This is a primitive scorer class for scoring cell charge.
|
||||
// The Cell Charge is defined by a sum of charge inside the cell
|
||||
// which calculates the deposited charge in the cell.
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Created: 2006-06-20 Tsukasa ASO, Akinori Kimura.
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02PSFlatSurfaceCurrent::RE02PSFlatSurfaceCurrent(G4String name,
|
||||
G4int direction,
|
||||
G4int nx, G4int ny, G4int nz)
|
||||
:G4PSFlatSurfaceCurrent(name,direction),fNx(nx),fNy(ny),fNz(nz)
|
||||
{;}
|
||||
RE02PSFlatSurfaceCurrent::RE02PSFlatSurfaceCurrent(G4String name, G4int direction, G4int nx,
|
||||
G4int ny, G4int nz)
|
||||
: G4PSFlatSurfaceCurrent(name, direction), fNx(nx), fNy(ny), fNz(nz)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02PSFlatSurfaceCurrent::~RE02PSFlatSurfaceCurrent()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4int RE02PSFlatSurfaceCurrent::GetIndex(G4Step* aStep)
|
||||
@@ -74,8 +77,10 @@ G4int RE02PSFlatSurfaceCurrent::GetIndex(G4Step* aStep)
|
||||
G4int ix = touchable->GetReplicaNumber(1);
|
||||
G4int iy = touchable->GetReplicaNumber(2);
|
||||
G4int iz = touchable->GetReplicaNumber(0);
|
||||
|
||||
|
||||
G4int tmp = fNy;
|
||||
if (tmp) return iy*fNx*fNz+ix*fNz+iz;
|
||||
else return iy*fNx*fNz+ix*fNz+iz;
|
||||
if (tmp)
|
||||
return iy * fNx * fNz + ix * fNz + iz;
|
||||
else
|
||||
return iy * fNx * fNz + ix * fNz + iz;
|
||||
}
|
||||
|
||||
@@ -47,24 +47,28 @@
|
||||
// This is a primitive scorer class for scoring cell charge.
|
||||
// The Cell Charge is defined by a sum of charge inside the cell
|
||||
// which calculates the deposited charge in the cell.
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Created: 2006-06-20 Tsukasa ASO, Akinori Kimura.
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02PSFlatSurfaceFlux::RE02PSFlatSurfaceFlux(G4String name, G4int direction,
|
||||
G4int nx, G4int ny, G4int nz)
|
||||
:G4PSFlatSurfaceFlux(name,direction),fNx(nx),fNy(ny),fNz(nz)
|
||||
{;}
|
||||
RE02PSFlatSurfaceFlux::RE02PSFlatSurfaceFlux(G4String name, G4int direction, G4int nx, G4int ny,
|
||||
G4int nz)
|
||||
: G4PSFlatSurfaceFlux(name, direction), fNx(nx), fNy(ny), fNz(nz)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02PSFlatSurfaceFlux::~RE02PSFlatSurfaceFlux()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4int RE02PSFlatSurfaceFlux::GetIndex(G4Step* aStep)
|
||||
@@ -73,8 +77,10 @@ G4int RE02PSFlatSurfaceFlux::GetIndex(G4Step* aStep)
|
||||
G4int ix = touchable->GetReplicaNumber(1);
|
||||
G4int iy = touchable->GetReplicaNumber(2);
|
||||
G4int iz = touchable->GetReplicaNumber(0);
|
||||
|
||||
|
||||
G4int tmp = fNy;
|
||||
if (tmp) return iy*fNx*fNz+ix*fNz+iz;
|
||||
else return iy*fNx*fNz+ix*fNz+iz;
|
||||
if (tmp)
|
||||
return iy * fNx * fNz + ix * fNz + iz;
|
||||
else
|
||||
return iy * fNx * fNz + ix * fNz + iz;
|
||||
}
|
||||
|
||||
@@ -47,23 +47,27 @@
|
||||
// This is a primitive scorer class for scoring cell charge.
|
||||
// The Cell Charge is defined by a sum of charge inside the cell
|
||||
// which calculates the deposited charge in the cell.
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Created: 2006-06-20 Tsukasa ASO, Akinori Kimura.
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02PSNofStep::RE02PSNofStep(G4String name,G4int nx, G4int ny, G4int nz)
|
||||
:G4PSNofStep(name),fNx(nx),fNy(ny),fNz(nz)
|
||||
{;}
|
||||
RE02PSNofStep::RE02PSNofStep(G4String name, G4int nx, G4int ny, G4int nz)
|
||||
: G4PSNofStep(name), fNx(nx), fNy(ny), fNz(nz)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02PSNofStep::~RE02PSNofStep()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4int RE02PSNofStep::GetIndex(G4Step* aStep)
|
||||
@@ -72,8 +76,10 @@ G4int RE02PSNofStep::GetIndex(G4Step* aStep)
|
||||
G4int ix = touchable->GetReplicaNumber(1);
|
||||
G4int iy = touchable->GetReplicaNumber(2);
|
||||
G4int iz = touchable->GetReplicaNumber(0);
|
||||
|
||||
|
||||
G4int tmp = fNy;
|
||||
if (tmp) return iy*fNx*fNz+ix*fNz+iz;
|
||||
else return iy*fNx*fNz+ix*fNz+iz;
|
||||
if (tmp)
|
||||
return iy * fNx * fNz + ix * fNz + iz;
|
||||
else
|
||||
return iy * fNx * fNz + ix * fNz + iz;
|
||||
}
|
||||
|
||||
@@ -47,24 +47,27 @@
|
||||
// This is a primitive scorer class for scoring cell charge.
|
||||
// The Cell Charge is defined by a sum of charge inside the cell
|
||||
// which calculates the deposited charge in the cell.
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Created: 2006-06-20 Tsukasa ASO, Akinori Kimura.
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02PSPassageCellFlux::RE02PSPassageCellFlux(G4String name,
|
||||
G4int nx, G4int ny, G4int nz)
|
||||
:G4PSPassageCellFlux(name),fNx(nx),fNy(ny),fNz(nz)
|
||||
{;}
|
||||
RE02PSPassageCellFlux::RE02PSPassageCellFlux(G4String name, G4int nx, G4int ny, G4int nz)
|
||||
: G4PSPassageCellFlux(name), fNx(nx), fNy(ny), fNz(nz)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE02PSPassageCellFlux::~RE02PSPassageCellFlux()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4int RE02PSPassageCellFlux::GetIndex(G4Step* aStep)
|
||||
@@ -73,8 +76,10 @@ G4int RE02PSPassageCellFlux::GetIndex(G4Step* aStep)
|
||||
G4int ix = touchable->GetReplicaNumber(1);
|
||||
G4int iy = touchable->GetReplicaNumber(2);
|
||||
G4int iz = touchable->GetReplicaNumber(0);
|
||||
|
||||
|
||||
G4int tmp = fNy;
|
||||
if (tmp) return iy*fNx*fNz+ix*fNz+iz;
|
||||
else return iy*fNx*fNz+ix*fNz+iz;
|
||||
if (tmp)
|
||||
return iy * fNx * fNz + ix * fNz + iz;
|
||||
else
|
||||
return iy * fNx * fNz + ix * fNz + iz;
|
||||
}
|
||||
|
||||
@@ -32,38 +32,37 @@
|
||||
#include "RE02PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
RE02PrimaryGeneratorAction::RE02PrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0)
|
||||
: G4VUserPrimaryGeneratorAction(), fParticleGun(0)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle
|
||||
// default particle
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle("proton");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.0,0.0,1.));
|
||||
fParticleGun->SetParticleEnergy(150.0*MeV);
|
||||
//
|
||||
// default beam position
|
||||
G4double position = -200./2.*cm;
|
||||
//
|
||||
// Initial beam spot size in sigma.; This is not a part of ParticleGun.
|
||||
fSigmaPosition = 10.* mm;
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.0, 0.0, 1.));
|
||||
fParticleGun->SetParticleEnergy(150.0 * MeV);
|
||||
//
|
||||
// default beam position
|
||||
G4double position = -200. / 2. * cm;
|
||||
//
|
||||
// Initial beam spot size in sigma.; This is not a part of ParticleGun.
|
||||
fSigmaPosition = 10. * mm;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0.*cm, 0.*cm, position));
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0. * cm, 0. * cm, position));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -76,11 +75,10 @@ RE02PrimaryGeneratorAction::~RE02PrimaryGeneratorAction()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
void RE02PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
|
||||
{
|
||||
G4ThreeVector position = fParticleGun->GetParticlePosition();
|
||||
G4double dx = (G4UniformRand()-0.5)*fSigmaPosition;
|
||||
G4double dy = (G4UniformRand()-0.5)*fSigmaPosition;
|
||||
G4double dx = (G4UniformRand() - 0.5) * fSigmaPosition;
|
||||
G4double dy = (G4UniformRand() - 0.5) * fSigmaPosition;
|
||||
position.setX(dx);
|
||||
position.setY(dy);
|
||||
fParticleGun->SetParticlePosition(position);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
//=====================================================================
|
||||
//
|
||||
// (Description)
|
||||
// RE02Run Class is for accumulating scored quantities which is
|
||||
// RE02Run Class is for accumulating scored quantities which is
|
||||
// scored using G4MutiFunctionalDetector and G4VPrimitiveScorer.
|
||||
// Accumulation is done using G4THitsMap object.
|
||||
//
|
||||
@@ -41,10 +41,10 @@
|
||||
// was assigned at instantiation of MultiFunctionalDetector(MFD).
|
||||
// Then RE02Run constructor automatically scans primitive scorers
|
||||
// in the MFD, and obtains collectionIDs of all collections associated
|
||||
// to those primitive scorers. Futhermore, the G4THitsMap objects
|
||||
// to those primitive scorers. Futhermore, the G4THitsMap objects
|
||||
// for accumulating during a RUN are automatically created too.
|
||||
// (*) Collection Name is same as primitive scorer name.
|
||||
//
|
||||
//
|
||||
// The resultant information is kept inside RE02Run objects as
|
||||
// data members.
|
||||
// std::vector<G4String> fCollName; // Collection Name,
|
||||
@@ -57,14 +57,14 @@
|
||||
//=====================================================================
|
||||
|
||||
#include "RE02Run.hh"
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
#include "G4MultiFunctionalDetector.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4VPrimitiveScorer.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// Constructor.
|
||||
// Constructor.
|
||||
// (The vector of MultiFunctionalDetector name has to given.)
|
||||
RE02Run::RE02Run(const std::vector<G4String> mfdName) : G4Run()
|
||||
{
|
||||
@@ -74,36 +74,35 @@ RE02Run::RE02Run(const std::vector<G4String> mfdName) : G4Run()
|
||||
// Get CollectionIDs for HitCollections.
|
||||
//=================================================
|
||||
G4int nMfd = mfdName.size();
|
||||
for ( G4int idet = 0; idet < nMfd ; idet++){ // Loop for all MFD.
|
||||
for (G4int idet = 0; idet < nMfd; idet++) { // Loop for all MFD.
|
||||
G4String detName = mfdName[idet];
|
||||
//--- Seek and Obtain MFD objects from SDmanager.
|
||||
G4MultiFunctionalDetector* mfd =
|
||||
(G4MultiFunctionalDetector*)(pSDman->FindSensitiveDetector(detName));
|
||||
//
|
||||
if ( mfd ){
|
||||
if (mfd) {
|
||||
//--- Loop over the registered primitive scorers.
|
||||
for (G4int icol = 0; icol < mfd->GetNumberOfPrimitives(); icol++){
|
||||
for (G4int icol = 0; icol < mfd->GetNumberOfPrimitives(); icol++) {
|
||||
// Get Primitive Scorer object.
|
||||
G4VPrimitiveScorer* scorer=mfd->GetPrimitive(icol);
|
||||
G4VPrimitiveScorer* scorer = mfd->GetPrimitive(icol);
|
||||
// collection name and collectionID for HitsCollection,
|
||||
// where type of HitsCollection is G4THitsMap in case of primitive
|
||||
// where type of HitsCollection is G4THitsMap in case of primitive
|
||||
// scorer.
|
||||
// The collection name is given by <MFD name>/<Primitive Scorer name>.
|
||||
G4String collectionName = scorer->GetName();
|
||||
G4String fullCollectionName = detName+"/"+collectionName;
|
||||
G4int collectionID = pSDman->GetCollectionID(fullCollectionName);
|
||||
G4String fullCollectionName = detName + "/" + collectionName;
|
||||
G4int collectionID = pSDman->GetCollectionID(fullCollectionName);
|
||||
//
|
||||
if ( collectionID >= 0 ){
|
||||
G4cout << "++ "<<fullCollectionName<< " id " << collectionID
|
||||
<< G4endl;
|
||||
if (collectionID >= 0) {
|
||||
G4cout << "++ " << fullCollectionName << " id " << collectionID << G4endl;
|
||||
// Store obtained HitsCollection information into data members.
|
||||
// And, creates new G4THitsMap for accumulating quantities during RUN.
|
||||
fCollName.push_back(fullCollectionName);
|
||||
fCollID.push_back(collectionID);
|
||||
fRunMap.push_back(new G4THitsMap<G4double>(detName,collectionName));
|
||||
}else{
|
||||
G4cout << "** collection " << fullCollectionName << " not found. "
|
||||
<< G4endl;
|
||||
fRunMap.push_back(new G4THitsMap<G4double>(detName, collectionName));
|
||||
}
|
||||
else {
|
||||
G4cout << "** collection " << fullCollectionName << " not found. " << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,8 +117,8 @@ RE02Run::~RE02Run()
|
||||
{
|
||||
//--- Clear HitsMap for RUN
|
||||
G4int nMap = fRunMap.size();
|
||||
for ( G4int i = 0; i < nMap; i++){
|
||||
if(fRunMap[i] ) fRunMap[i]->clear();
|
||||
for (G4int i = 0; i < nMap; i++) {
|
||||
if (fRunMap[i]) fRunMap[i]->clear();
|
||||
}
|
||||
fCollName.clear();
|
||||
fCollID.clear();
|
||||
@@ -145,14 +144,15 @@ void RE02Run::RecordEvent(const G4Event* aEvent)
|
||||
// Sum up HitsMap of this Event into HitsMap of this RUN
|
||||
//=======================================================
|
||||
G4int nCol = fCollID.size();
|
||||
for ( G4int i = 0; i < nCol ; i++ ){ // Loop over HitsCollection
|
||||
G4THitsMap<G4double>* evtMap=0;
|
||||
if ( fCollID[i] >= 0 ){ // Collection is attached to pHCE
|
||||
for (G4int i = 0; i < nCol; i++) { // Loop over HitsCollection
|
||||
G4THitsMap<G4double>* evtMap = 0;
|
||||
if (fCollID[i] >= 0) { // Collection is attached to pHCE
|
||||
evtMap = (G4THitsMap<G4double>*)(pHCE->GetHC(fCollID[i]));
|
||||
}else{
|
||||
G4cout <<" Error evtMap Not Found "<< i << G4endl;
|
||||
}
|
||||
if ( evtMap ) {
|
||||
else {
|
||||
G4cout << " Error evtMap Not Found " << i << G4endl;
|
||||
}
|
||||
if (evtMap) {
|
||||
//=== Sum up HitsMap of this event to HitsMap of RUN.===
|
||||
*fRunMap[i] += *evtMap;
|
||||
//======================================================
|
||||
@@ -160,21 +160,21 @@ void RE02Run::RecordEvent(const G4Event* aEvent)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE02Run::Merge(const G4Run * aRun) {
|
||||
const RE02Run * localRun = static_cast<const RE02Run *>(aRun);
|
||||
|
||||
void RE02Run::Merge(const G4Run* aRun)
|
||||
{
|
||||
const RE02Run* localRun = static_cast<const RE02Run*>(aRun);
|
||||
|
||||
//=======================================================
|
||||
// Merge HitsMap of working threads
|
||||
//=======================================================
|
||||
G4int nCol = localRun->fCollID.size();
|
||||
for ( G4int i = 0; i < nCol ; i++ ){ // Loop over HitsCollection
|
||||
if ( localRun->fCollID[i] >= 0 ){
|
||||
for (G4int i = 0; i < nCol; i++) { // Loop over HitsCollection
|
||||
if (localRun->fCollID[i] >= 0) {
|
||||
*fRunMap[i] += *localRun->fRunMap[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
G4Run::Merge(aRun);
|
||||
}
|
||||
|
||||
@@ -185,10 +185,10 @@ void RE02Run::Merge(const G4Run * aRun) {
|
||||
//-----
|
||||
// Access HitsMap.
|
||||
// By MultiFunctionalDetector name and Collection Name.
|
||||
G4THitsMap<G4double>* RE02Run::GetHitsMap(const G4String& detName,
|
||||
const G4String& colName){
|
||||
G4String fullName = detName+"/"+colName;
|
||||
return GetHitsMap(fullName);
|
||||
G4THitsMap<G4double>* RE02Run::GetHitsMap(const G4String& detName, const G4String& colName)
|
||||
{
|
||||
G4String fullName = detName + "/" + colName;
|
||||
return GetHitsMap(fullName);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -197,14 +197,15 @@ G4THitsMap<G4double>* RE02Run::GetHitsMap(const G4String& detName,
|
||||
// Access HitsMap.
|
||||
// By full description of collection name, that is
|
||||
// <MultiFunctional Detector Name>/<Primitive Scorer Name>
|
||||
G4THitsMap<G4double>* RE02Run::GetHitsMap(const G4String& fullName){
|
||||
G4int nCol = fCollName.size();
|
||||
for ( G4int i = 0; i < nCol; i++){
|
||||
if ( fCollName[i] == fullName ){
|
||||
return fRunMap[i];
|
||||
}
|
||||
G4THitsMap<G4double>* RE02Run::GetHitsMap(const G4String& fullName)
|
||||
{
|
||||
G4int nCol = fCollName.size();
|
||||
for (G4int i = 0; i < nCol; i++) {
|
||||
if (fCollName[i] == fullName) {
|
||||
return fRunMap[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -212,25 +213,23 @@ G4THitsMap<G4double>* RE02Run::GetHitsMap(const G4String& fullName){
|
||||
//-----
|
||||
// - Dump All HitsMap of this RUN. (for debuging and monitoring of quantity).
|
||||
// This method calls G4THisMap::PrintAll() for individual HitsMap.
|
||||
void RE02Run::DumpAllScorer(){
|
||||
|
||||
void RE02Run::DumpAllScorer()
|
||||
{
|
||||
// - Number of HitsMap in this RUN.
|
||||
G4int n = GetNumberOfHitsMap();
|
||||
// - GetHitsMap and dump values.
|
||||
for ( G4int i = 0; i < n ; i++ ){
|
||||
G4THitsMap<G4double>* runMap =GetHitsMap(i);
|
||||
if ( runMap ) {
|
||||
G4cout << " PrimitiveScorer RUN "
|
||||
<< runMap->GetSDname() <<","<< runMap->GetName() << G4endl;
|
||||
for (G4int i = 0; i < n; i++) {
|
||||
G4THitsMap<G4double>* runMap = GetHitsMap(i);
|
||||
if (runMap) {
|
||||
G4cout << " PrimitiveScorer RUN " << runMap->GetSDname() << "," << runMap->GetName()
|
||||
<< G4endl;
|
||||
G4cout << " Number of entries " << runMap->entries() << G4endl;
|
||||
//// std::map<G4int,G4double*>::iterator itr = runMap->GetMap()->begin();
|
||||
//// for(; itr != runMap->GetMap()->end(); itr++) {
|
||||
//// G4cout << " copy no.: " << itr->first
|
||||
//// << " Run Value : " << *(itr->second)
|
||||
//// << G4endl;
|
||||
//// }
|
||||
//// std::map<G4int,G4double*>::iterator itr = runMap->GetMap()->begin();
|
||||
//// for(; itr != runMap->GetMap()->end(); itr++) {
|
||||
//// G4cout << " copy no.: " << itr->first
|
||||
//// << " Run Value : " << *(itr->second)
|
||||
//// << G4endl;
|
||||
//// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,31 +27,30 @@
|
||||
/// \brief Implementation of the RE02RunAction class
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
#include "RE02RunAction.hh"
|
||||
|
||||
#include "RE02Run.hh"
|
||||
|
||||
//-- In order to obtain detector information.
|
||||
#include "G4RunManager.hh"
|
||||
#include "RE02DetectorConstruction.hh"
|
||||
#include "G4THitsMap.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4THitsMap.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include <fstream>
|
||||
//=======================================================================
|
||||
// RE02RunAction
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//=======================================================================
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
// Constructor
|
||||
RE02RunAction::RE02RunAction()
|
||||
: G4UserRunAction(),
|
||||
fNx(0), fNy(0), fNz(0)
|
||||
RE02RunAction::RE02RunAction() : G4UserRunAction(), fNx(0), fNy(0), fNz(0)
|
||||
{
|
||||
// - Prepare data member for RE02Run.
|
||||
// vector represents a list of MultiFunctionalDetector names.
|
||||
@@ -66,7 +65,7 @@ RE02RunAction::~RE02RunAction()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//==
|
||||
//==
|
||||
G4Run* RE02RunAction::GenerateRun()
|
||||
{
|
||||
// Generate new RUN object, which is specially
|
||||
@@ -83,10 +82,10 @@ void RE02RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//==
|
||||
//==
|
||||
void RE02RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
if(!IsMaster()) return;
|
||||
if (!IsMaster()) return;
|
||||
|
||||
//- RE02Run object.
|
||||
RE02Run* re02Run = (RE02Run*)aRun;
|
||||
@@ -98,38 +97,28 @@ void RE02RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
//- water phantom (Detector) Information.
|
||||
//-- Number of segments in the water phantom.
|
||||
const RE02DetectorConstruction* detector =
|
||||
(const RE02DetectorConstruction*)
|
||||
(G4RunManager::GetRunManager()->GetUserDetectorConstruction());
|
||||
detector->GetNumberOfSegmentsInPhantom(fNx,fNy,fNz); //Fill fNx,y,z.
|
||||
(const RE02DetectorConstruction*)(G4RunManager::GetRunManager()->GetUserDetectorConstruction());
|
||||
detector->GetNumberOfSegmentsInPhantom(fNx, fNy, fNz); // Fill fNx,y,z.
|
||||
|
||||
//---------------------------------------------
|
||||
// Dump accumulated quantities for this RUN.
|
||||
// (Display only central region of x-y plane)
|
||||
//---------------------------------------------
|
||||
G4THitsMap<G4double>* totEdep = re02Run->GetHitsMap("PhantomSD/totalEDep");
|
||||
G4THitsMap<G4double>* proEdep = re02Run->GetHitsMap("PhantomSD/protonEDep");
|
||||
G4THitsMap<G4double>* totEdep = re02Run->GetHitsMap("PhantomSD/totalEDep");
|
||||
G4THitsMap<G4double>* proEdep = re02Run->GetHitsMap("PhantomSD/protonEDep");
|
||||
G4THitsMap<G4double>* proNstep = re02Run->GetHitsMap("PhantomSD/protonNStep");
|
||||
G4THitsMap<G4double>* passCFx =
|
||||
re02Run->GetHitsMap("PhantomSD/chargedPassCellFlux");
|
||||
G4THitsMap<G4double>* cFx =
|
||||
re02Run->GetHitsMap("PhantomSD/chargedCellFlux");
|
||||
G4THitsMap<G4double>* surfFx =
|
||||
re02Run->GetHitsMap("PhantomSD/chargedSurfFlux");
|
||||
G4THitsMap<G4double>* gCurr00 =
|
||||
re02Run->GetHitsMap("PhantomSD/gammaSurfCurr000");
|
||||
G4THitsMap<G4double>* gCurr01 =
|
||||
re02Run->GetHitsMap("PhantomSD/gammaSurfCurr001");
|
||||
G4THitsMap<G4double>* gCurr02 =
|
||||
re02Run->GetHitsMap("PhantomSD/gammaSurfCurr002");
|
||||
G4THitsMap<G4double>* gCurr03 =
|
||||
re02Run->GetHitsMap("PhantomSD/gammaSurfCurr003");
|
||||
G4THitsMap<G4double>* passCFx = re02Run->GetHitsMap("PhantomSD/chargedPassCellFlux");
|
||||
G4THitsMap<G4double>* cFx = re02Run->GetHitsMap("PhantomSD/chargedCellFlux");
|
||||
G4THitsMap<G4double>* surfFx = re02Run->GetHitsMap("PhantomSD/chargedSurfFlux");
|
||||
G4THitsMap<G4double>* gCurr00 = re02Run->GetHitsMap("PhantomSD/gammaSurfCurr000");
|
||||
G4THitsMap<G4double>* gCurr01 = re02Run->GetHitsMap("PhantomSD/gammaSurfCurr001");
|
||||
G4THitsMap<G4double>* gCurr02 = re02Run->GetHitsMap("PhantomSD/gammaSurfCurr002");
|
||||
G4THitsMap<G4double>* gCurr03 = re02Run->GetHitsMap("PhantomSD/gammaSurfCurr003");
|
||||
|
||||
G4cout << "============================================================="
|
||||
<< G4endl;
|
||||
G4cout << " Number of event processed : "<< aRun->GetNumberOfEvent() << G4endl;
|
||||
G4cout << "============================================================="
|
||||
<< G4endl;
|
||||
G4cout << std::setw( 8) << "#Z Cell#";
|
||||
G4cout << "=============================================================" << G4endl;
|
||||
G4cout << " Number of event processed : " << aRun->GetNumberOfEvent() << G4endl;
|
||||
G4cout << "=============================================================" << G4endl;
|
||||
G4cout << std::setw(8) << "#Z Cell#";
|
||||
G4cout << std::setw(16) << totEdep->GetName();
|
||||
G4cout << std::setw(16) << proEdep->GetName();
|
||||
G4cout << std::setw(12) << proNstep->GetName();
|
||||
@@ -139,56 +128,49 @@ void RE02RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
G4cout << std::setw(20) << gCurr00->GetName();
|
||||
G4cout << std::setw(20) << gCurr01->GetName();
|
||||
G4cout << std::setw(20) << gCurr02->GetName();
|
||||
G4cout << std::setw(20) << gCurr03->GetName()
|
||||
<< G4endl;
|
||||
G4int ix = fNx/2;
|
||||
G4int iy = fNy/2;
|
||||
G4cout << std::setw(20) << gCurr03->GetName() << G4endl;
|
||||
G4int ix = fNx / 2;
|
||||
G4int iy = fNy / 2;
|
||||
G4int iz;
|
||||
//G4double totE, proE, proN,pasCF,CF,surfF,gCr0,gCr1,gCr2,gCr3;
|
||||
for ( iz = 0; iz < fNz; iz++){
|
||||
G4double* totED = (*totEdep)[CopyNo(ix,iy,iz)];
|
||||
G4double* proED = (*proEdep)[CopyNo(ix,iy,iz)];
|
||||
G4double* proNS = (*proNstep)[CopyNo(ix,iy,iz)];
|
||||
G4double* pasCF = (*passCFx)[CopyNo(ix,iy,iz)];
|
||||
G4double* cF = (*cFx)[CopyNo(ix,iy,iz)];
|
||||
G4double* sfx = (*surfFx)[CopyNo(ix,iy,iz)];
|
||||
G4double* gcur0 = (*gCurr00)[CopyNo(ix,iy,iz)];
|
||||
G4double* gcur1 = (*gCurr01)[CopyNo(ix,iy,iz)];
|
||||
G4double* gcur2 = (*gCurr02)[CopyNo(ix,iy,iz)];
|
||||
G4double* gcur3 = (*gCurr03)[CopyNo(ix,iy,iz)];
|
||||
if ( !totED ) totED = new G4double(0.0);
|
||||
if ( !proED ) proED = new G4double(0.0);
|
||||
if ( !proNS ) proNS = new G4double(0.0);
|
||||
if ( !pasCF ) pasCF = new G4double(0.0);
|
||||
if ( !cF ) cF = new G4double(0.0);
|
||||
if ( !sfx ) sfx = new G4double(0.0);
|
||||
if ( !gcur0 ) gcur0 = new G4double(0.0);
|
||||
if ( !gcur1 ) gcur1 = new G4double(0.0);
|
||||
if ( !gcur2 ) gcur2 = new G4double(0.0);
|
||||
if ( !gcur3 ) gcur3 = new G4double(0.0);
|
||||
G4cout << std::setw( 6) << iz << " "
|
||||
<< std::setw(12) << G4BestUnit(*totED,"Energy")
|
||||
<< std::setw(12) << G4BestUnit(*proED,"Energy")
|
||||
<< std::setw(12) << (*proNS) << " "
|
||||
<< std::setw(13) << (*pasCF)*cm*cm <<" /cm2"
|
||||
<< std::setw(15) << (*cF)*cm*cm <<" /cm2"
|
||||
<< std::setw(15) << (*sfx)*cm*cm <<" /cm2"
|
||||
<< std::setw(15) << (*gcur0)*cm*cm <<" /cm2"
|
||||
<< std::setw(15) << (*gcur1)*cm*cm <<" /cm2"
|
||||
<< std::setw(15) << (*gcur2)*cm*cm <<" /cm2"
|
||||
<< std::setw(15) << (*gcur3)*cm*cm <<" /cm2"
|
||||
<< G4endl;
|
||||
// G4double totE, proE, proN,pasCF,CF,surfF,gCr0,gCr1,gCr2,gCr3;
|
||||
for (iz = 0; iz < fNz; iz++) {
|
||||
G4double* totED = (*totEdep)[CopyNo(ix, iy, iz)];
|
||||
G4double* proED = (*proEdep)[CopyNo(ix, iy, iz)];
|
||||
G4double* proNS = (*proNstep)[CopyNo(ix, iy, iz)];
|
||||
G4double* pasCF = (*passCFx)[CopyNo(ix, iy, iz)];
|
||||
G4double* cF = (*cFx)[CopyNo(ix, iy, iz)];
|
||||
G4double* sfx = (*surfFx)[CopyNo(ix, iy, iz)];
|
||||
G4double* gcur0 = (*gCurr00)[CopyNo(ix, iy, iz)];
|
||||
G4double* gcur1 = (*gCurr01)[CopyNo(ix, iy, iz)];
|
||||
G4double* gcur2 = (*gCurr02)[CopyNo(ix, iy, iz)];
|
||||
G4double* gcur3 = (*gCurr03)[CopyNo(ix, iy, iz)];
|
||||
if (!totED) totED = new G4double(0.0);
|
||||
if (!proED) proED = new G4double(0.0);
|
||||
if (!proNS) proNS = new G4double(0.0);
|
||||
if (!pasCF) pasCF = new G4double(0.0);
|
||||
if (!cF) cF = new G4double(0.0);
|
||||
if (!sfx) sfx = new G4double(0.0);
|
||||
if (!gcur0) gcur0 = new G4double(0.0);
|
||||
if (!gcur1) gcur1 = new G4double(0.0);
|
||||
if (!gcur2) gcur2 = new G4double(0.0);
|
||||
if (!gcur3) gcur3 = new G4double(0.0);
|
||||
G4cout << std::setw(6) << iz << " " << std::setw(12) << G4BestUnit(*totED, "Energy")
|
||||
<< std::setw(12) << G4BestUnit(*proED, "Energy") << std::setw(12) << (*proNS) << " "
|
||||
<< std::setw(13) << (*pasCF) * cm * cm << " /cm2" << std::setw(15) << (*cF) * cm * cm
|
||||
<< " /cm2" << std::setw(15) << (*sfx) * cm * cm << " /cm2" << std::setw(15)
|
||||
<< (*gcur0) * cm * cm << " /cm2" << std::setw(15) << (*gcur1) * cm * cm << " /cm2"
|
||||
<< std::setw(15) << (*gcur2) * cm * cm << " /cm2" << std::setw(15) << (*gcur3) * cm * cm
|
||||
<< " /cm2" << G4endl;
|
||||
}
|
||||
G4cout << "============================================="<<G4endl;
|
||||
|
||||
std::ofstream file("totED.txt");
|
||||
for ( iz = 0; iz < fNz; iz++){
|
||||
for ( iy = 0; iy < fNy; iy++){
|
||||
for ( ix = 0; ix < fNx; ix++){
|
||||
G4double* totED = (*totEdep)[CopyNo(ix,iy,iz)];
|
||||
if ( !totED ) totED = new G4double(0.0);
|
||||
file << ix << " "<<iy<<" "<<iz<<" "<< *totED/MeV << G4endl;
|
||||
G4cout << "=============================================" << G4endl;
|
||||
|
||||
std::ofstream file("totED.txt");
|
||||
for (iz = 0; iz < fNz; iz++) {
|
||||
for (iy = 0; iy < fNy; iy++) {
|
||||
for (ix = 0; ix < fNx; ix++) {
|
||||
G4double* totED = (*totEdep)[CopyNo(ix, iy, iz)];
|
||||
if (!totED) totED = new G4double(0.0);
|
||||
file << ix << " " << iy << " " << iz << " " << *totED / MeV << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user