Import Geant4 11.3.0.beta source tree
This commit is contained in:
@@ -29,91 +29,89 @@
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "FTFP_BERT.hh"
|
||||
#include "RE03ActionInitialization.hh"
|
||||
#include "RE03DetectorConstruction.hh"
|
||||
|
||||
#include "G4RunManagerFactory.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ScoringManager.hh"
|
||||
|
||||
#include "RE03DetectorConstruction.hh"
|
||||
#include "FTFP_BERT.hh"
|
||||
#include "RE03ActionInitialization.hh"
|
||||
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "G4Types.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
|
||||
//====================================================================
|
||||
// Un-comment this line for user defined score writer
|
||||
// #include "RE03UserScoreWriter.hh"
|
||||
//====================================================================
|
||||
|
||||
int main(int argc,char** argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// Instantiate G4UIExecutive if there are no arguments (interactive mode)
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if ( argc == 1 ) {
|
||||
ui = new G4UIExecutive(argc, argv);
|
||||
}
|
||||
// Instantiate G4UIExecutive if there are no arguments (interactive mode)
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if (argc == 1) {
|
||||
ui = new G4UIExecutive(argc, argv);
|
||||
}
|
||||
|
||||
// Construct the run manager
|
||||
//
|
||||
auto* runManager = G4RunManagerFactory::CreateRunManager();
|
||||
runManager->SetNumberOfThreads(4);
|
||||
// Construct the run manager
|
||||
//
|
||||
auto* runManager = G4RunManagerFactory::CreateRunManager();
|
||||
runManager->SetNumberOfThreads(4);
|
||||
|
||||
// Activate UI-command base scorer
|
||||
G4ScoringManager * scManager = G4ScoringManager::GetScoringManager();
|
||||
scManager->SetVerboseLevel(1);
|
||||
// Activate UI-command base scorer
|
||||
G4ScoringManager* scManager = G4ScoringManager::GetScoringManager();
|
||||
scManager->SetVerboseLevel(1);
|
||||
|
||||
//====================================================================
|
||||
// Un-comment this line for user defined score writer
|
||||
// scManager->SetScoreWriter(new RE03UserScoreWriter());
|
||||
//====================================================================
|
||||
//====================================================================
|
||||
// Un-comment this line for user defined score writer
|
||||
// scManager->SetScoreWriter(new RE03UserScoreWriter());
|
||||
//====================================================================
|
||||
|
||||
// Set mandatory initialization classes
|
||||
//
|
||||
G4VUserDetectorConstruction* detector = new RE03DetectorConstruction;
|
||||
runManager->SetUserInitialization(detector);
|
||||
//
|
||||
G4VUserPhysicsList* physics = new FTFP_BERT;
|
||||
runManager->SetUserInitialization(physics);
|
||||
|
||||
// Set user action classes through Worker Initialization
|
||||
//
|
||||
RE03ActionInitialization* actions = new RE03ActionInitialization;
|
||||
runManager->SetUserInitialization(actions);
|
||||
|
||||
// Visualization manager
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
visManager->Initialize();
|
||||
// Set mandatory initialization classes
|
||||
//
|
||||
G4VUserDetectorConstruction* detector = new RE03DetectorConstruction;
|
||||
runManager->SetUserInitialization(detector);
|
||||
//
|
||||
G4VUserPhysicsList* physics = new FTFP_BERT;
|
||||
runManager->SetUserInitialization(physics);
|
||||
|
||||
// Initialize G4 kernel
|
||||
//
|
||||
runManager->Initialize();
|
||||
|
||||
// Get the pointer to the User Interface manager
|
||||
//
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
// Set user action classes through Worker Initialization
|
||||
//
|
||||
RE03ActionInitialization* actions = new RE03ActionInitialization;
|
||||
runManager->SetUserInitialization(actions);
|
||||
|
||||
if (ui) // Define UI session for interactive mode
|
||||
{
|
||||
UImanager->ApplyCommand("/control/execute vis.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
}
|
||||
else // Batch mode
|
||||
{
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UImanager->ApplyCommand(command+fileName);
|
||||
}
|
||||
// Visualization manager
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
visManager->Initialize();
|
||||
|
||||
// Initialize G4 kernel
|
||||
//
|
||||
runManager->Initialize();
|
||||
|
||||
// Get the pointer to the User Interface manager
|
||||
//
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
if (ui) // Define UI session for interactive mode
|
||||
{
|
||||
UImanager->ApplyCommand("/control/execute vis.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
}
|
||||
else // Batch mode
|
||||
{
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UImanager->ApplyCommand(command + fileName);
|
||||
}
|
||||
|
||||
// Job termination
|
||||
// Free the store: user actions, physics_list and detector_description are
|
||||
// owned and deleted by the run manager, so they should not
|
||||
// be deleted in the main() program !
|
||||
|
||||
delete visManager;
|
||||
delete runManager;
|
||||
delete visManager;
|
||||
delete runManager;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -37,14 +37,11 @@
|
||||
class RE03ActionInitialization : public G4VUserActionInitialization
|
||||
{
|
||||
public:
|
||||
RE03ActionInitialization();
|
||||
RE03ActionInitialization();
|
||||
virtual ~RE03ActionInitialization();
|
||||
|
||||
public:
|
||||
virtual void Build() const;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/// \file runAndEvent/RE03/include/RE03DetectorConstruction.hh
|
||||
/// \brief Definition of the RE03DetectorConstruction class
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef RE03DetectorConstruction_h
|
||||
#define RE03DetectorConstruction_h 1
|
||||
@@ -46,7 +46,7 @@ class RE03DetectorConstruction : public G4VUserDetectorConstruction
|
||||
public:
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
virtual void ConstructSDandField();
|
||||
|
||||
|
||||
private:
|
||||
void DefineMaterials();
|
||||
void SetupGeometry();
|
||||
@@ -60,4 +60,3 @@ class RE03DetectorConstruction : public G4VUserDetectorConstruction
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -40,17 +40,14 @@ class G4Event;
|
||||
class RE03PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
RE03PrimaryGeneratorAction();
|
||||
RE03PrimaryGeneratorAction();
|
||||
virtual ~RE03PrimaryGeneratorAction();
|
||||
|
||||
public:
|
||||
virtual void GeneratePrimaries(G4Event*);
|
||||
|
||||
private:
|
||||
G4ParticleGun* fParticleGun;
|
||||
|
||||
G4ParticleGun* fParticleGun;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -31,28 +31,24 @@
|
||||
#ifndef RE03UserScoreWriter_h
|
||||
#define RE03UserScoreWriter_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VScoreWriter.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This class represents storing the scored quantity into a file.
|
||||
//
|
||||
|
||||
class RE03UserScoreWriter : public G4VScoreWriter {
|
||||
|
||||
public:
|
||||
RE03UserScoreWriter();
|
||||
virtual ~RE03UserScoreWriter();
|
||||
|
||||
public:
|
||||
// store a quantity into a file
|
||||
virtual void DumpQuantityToFile(const G4String & psName,
|
||||
const G4String & fileName,
|
||||
const G4String & option);
|
||||
class RE03UserScoreWriter : public G4VScoreWriter
|
||||
{
|
||||
public:
|
||||
RE03UserScoreWriter();
|
||||
virtual ~RE03UserScoreWriter();
|
||||
|
||||
public:
|
||||
// store a quantity into a file
|
||||
virtual void DumpQuantityToFile(const G4String& psName, const G4String& fileName,
|
||||
const G4String& option);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
|
||||
|
||||
|
||||
**************************************************************
|
||||
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
|
||||
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
|
||||
Copyright : Geant4 Collaboration
|
||||
References : NIM A 506 (2003), 250-303
|
||||
: IEEE-TNS 53 (2006), 270-278
|
||||
@@ -44,14 +44,21 @@ Registered graphics systems are:
|
||||
RayTracerX (RayTracerX)
|
||||
Qt3D (Qt3D)
|
||||
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
|
||||
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
|
||||
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
|
||||
TOOLSSG_XT_ZB (TSG_XT_ZB, TSGXtZB)
|
||||
TOOLSSG_QT_GLES (TSG_QT_GLES, TSGQt, TSG)
|
||||
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB)
|
||||
Default graphics system is: TSG_OFFSCREEN (based on batch session).
|
||||
Default window size hint is: 600x600-0+0 (based on G4VisManager initialisation).
|
||||
Note: Parameters specified on the command line will override these defaults.
|
||||
Use "vis/open" without parameters to get these defaults.
|
||||
You may choose a graphics system (driver) with a parameter of
|
||||
the command "/vis/open" or "/vis/sceneHandler/create",
|
||||
or you may omit the driver parameter and choose at run time:
|
||||
- by argument in the construction of G4VisExecutive
|
||||
- by environment variable "G4VIS_DEFAULT_DRIVER"
|
||||
- by entry in "~/.g4session"
|
||||
- by build flags.
|
||||
- Note: This feature is not allowed in batch mode.
|
||||
For further information see "examples/basic/B1/exampleB1.cc"
|
||||
and "vis.mac".
|
||||
|
||||
Registering model factories...
|
||||
|
||||
@@ -258,7 +265,7 @@ eBrem: for e+ XStype:4 SubType=3
|
||||
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
|
||||
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
|
||||
|
||||
annihil: for e+ XStype:2 SubType=5 BuildTable=0
|
||||
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eplus2gg : Emin= 0 eV Emax= 100 TeV
|
||||
|
||||
@@ -813,7 +820,7 @@ Min energy per nucleon for multifragmentation 200 GeV
|
||||
Limit excitation energy for Fermi BreakUp 20 MeV
|
||||
Level density (1/MeV) 0.075
|
||||
Use simple level density model 1
|
||||
Use discrete excitation energy of the residual 1
|
||||
Use discrete excitation energy of the residual 0
|
||||
Time limit for long lived isomeres 1 ns
|
||||
Isomer production flag 1
|
||||
Internal e- conversion flag 1
|
||||
@@ -846,7 +853,7 @@ See commands in /vis/modeling/trajectories/ for other options.
|
||||
Run terminated.
|
||||
Run Summary
|
||||
Number of events processed : 2000
|
||||
User=43.050000s Real=45.389116s Sys=0.020000s
|
||||
User=44.460000s Real=46.031008s Sys=0.020000s
|
||||
#
|
||||
########################################
|
||||
#
|
||||
@@ -861,6 +868,6 @@ Run Summary
|
||||
Graphics systems deleted.
|
||||
Visualization Manager deleting...
|
||||
================== Deleting memory pools ===================
|
||||
Number of memory pools allocated: 14 of which, static: 0
|
||||
Dynamic pools deleted: 14 / Total memory freed: 0.19 MB
|
||||
Number of memory pools allocated: 12 of which, static: 0
|
||||
Dynamic pools deleted: 12 / Total memory freed: 0.17 MB
|
||||
============================================================
|
||||
|
||||
@@ -30,19 +30,23 @@
|
||||
//
|
||||
|
||||
#include "RE03ActionInitialization.hh"
|
||||
|
||||
#include "RE03PrimaryGeneratorAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE03ActionInitialization::RE03ActionInitialization()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE03ActionInitialization::~RE03ActionInitialization()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE03ActionInitialization::Build() const
|
||||
{
|
||||
SetUserAction(new RE03PrimaryGeneratorAction);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,42 +30,45 @@
|
||||
|
||||
#include "RE03DetectorConstruction.hh"
|
||||
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4MultiFunctionalDetector.hh"
|
||||
#include "G4VPrimitiveScorer.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4PSEnergyDeposit.hh"
|
||||
#include "G4PSTrackLength.hh"
|
||||
#include "G4PSNofStep.hh"
|
||||
#include "G4PSTrackLength.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4SDParticleFilter.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4VPrimitiveScorer.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE03DetectorConstruction::RE03DetectorConstruction()
|
||||
:G4VUserDetectorConstruction(),
|
||||
fAir(0),fWater(0),fWorldPhys(0),fPhantomPhys(0),
|
||||
fConstructed(false)
|
||||
{;}
|
||||
: G4VUserDetectorConstruction(),
|
||||
fAir(0),
|
||||
fWater(0),
|
||||
fWorldPhys(0),
|
||||
fPhantomPhys(0),
|
||||
fConstructed(false)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE03DetectorConstruction::~RE03DetectorConstruction()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4VPhysicalVolume* RE03DetectorConstruction::Construct()
|
||||
{
|
||||
if(!fConstructed)
|
||||
{
|
||||
if (!fConstructed) {
|
||||
fConstructed = true;
|
||||
DefineMaterials();
|
||||
SetupGeometry();
|
||||
@@ -75,41 +78,41 @@ G4VPhysicalVolume* RE03DetectorConstruction::Construct()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE03DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
{
|
||||
//-------- NIST Materials -----------------------------------------------
|
||||
// Material Information imported from NIST database.
|
||||
// Material Information imported from NIST database.
|
||||
G4NistManager* NISTman = G4NistManager::Instance();
|
||||
fWater = NISTman->FindOrBuildMaterial("G4_WATER");
|
||||
fAir = NISTman->FindOrBuildMaterial("G4_AIR");
|
||||
fAir = NISTman->FindOrBuildMaterial("G4_AIR");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE03DetectorConstruction::SetupGeometry()
|
||||
{
|
||||
//
|
||||
//
|
||||
// World
|
||||
//
|
||||
G4VSolid* worldSolid = new G4Box("World",2.*m,2.*m,2.*m);
|
||||
G4LogicalVolume* worldLogical = new G4LogicalVolume(worldSolid,fAir,"World");
|
||||
fWorldPhys = new G4PVPlacement(0,G4ThreeVector(),worldLogical,"World",
|
||||
0,false,0);
|
||||
|
||||
//
|
||||
G4VSolid* worldSolid = new G4Box("World", 2. * m, 2. * m, 2. * m);
|
||||
G4LogicalVolume* worldLogical = new G4LogicalVolume(worldSolid, fAir, "World");
|
||||
fWorldPhys = new G4PVPlacement(0, G4ThreeVector(), worldLogical, "World", 0, false, 0);
|
||||
|
||||
//
|
||||
// Phantom
|
||||
//
|
||||
G4VSolid* phantomSolid = new G4Box("Calor",1.*m,1.*m,1.*m);
|
||||
G4LogicalVolume* phantomLogical = new G4LogicalVolume(phantomSolid,fWater,"Phantom");
|
||||
fPhantomPhys = new G4PVPlacement(0,G4ThreeVector(),phantomLogical,"Phantom",
|
||||
worldLogical,false,0);
|
||||
//
|
||||
//
|
||||
G4VSolid* phantomSolid = new G4Box("Calor", 1. * m, 1. * m, 1. * m);
|
||||
G4LogicalVolume* phantomLogical = new G4LogicalVolume(phantomSolid, fWater, "Phantom");
|
||||
fPhantomPhys =
|
||||
new G4PVPlacement(0, G4ThreeVector(), phantomLogical, "Phantom", worldLogical, false, 0);
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
// worldLogical->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
G4VisAttributes* simpleBoxVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
|
||||
simpleBoxVisAtt->SetVisibility(true);
|
||||
phantomLogical->SetVisAttributes(simpleBoxVisAtt);
|
||||
}
|
||||
|
||||
void RE03DetectorConstruction::ConstructSDandField()
|
||||
{;}
|
||||
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
@@ -31,28 +31,26 @@
|
||||
#include "RE03PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE03PrimaryGeneratorAction::RE03PrimaryGeneratorAction()
|
||||
:G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0)
|
||||
: G4VUserPrimaryGeneratorAction(), fParticleGun(0)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle kinematic
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
G4ParticleDefinition* particle
|
||||
= particleTable->FindParticle(particleName="e-");
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle(particleName = "e-");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,-1.01*m));
|
||||
fParticleGun->SetParticleEnergy(1.*GeV);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.));
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0., 0., -1.01 * m));
|
||||
fParticleGun->SetParticleEnergy(1. * GeV);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -66,4 +64,3 @@ void RE03PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,30 +35,31 @@
|
||||
#include "G4VPrimitiveScorer.hh"
|
||||
#include "G4VScoringMesh.hh"
|
||||
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE03UserScoreWriter::RE03UserScoreWriter()
|
||||
: G4VScoreWriter()
|
||||
{;}
|
||||
RE03UserScoreWriter::RE03UserScoreWriter() : G4VScoreWriter()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE03UserScoreWriter::~RE03UserScoreWriter()
|
||||
{;}
|
||||
RE03UserScoreWriter::~RE03UserScoreWriter()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE03UserScoreWriter::DumpQuantityToFile(const G4String & psName,
|
||||
const G4String & fileName,
|
||||
const G4String & option) {
|
||||
void RE03UserScoreWriter::DumpQuantityToFile(const G4String& psName, const G4String& fileName,
|
||||
const G4String& option)
|
||||
{
|
||||
using MeshScoreMap = G4VScoringMesh::MeshScoreMap;
|
||||
//
|
||||
if(verboseLevel > 0) {
|
||||
G4cout << "User-defined DumpQuantityToFile() method is invoked."
|
||||
if (verboseLevel > 0) {
|
||||
G4cout << "User-defined DumpQuantityToFile() method is invoked." << G4endl;
|
||||
G4cout << " -- to obtain a projection of the quantity <" << psName << "> onto the x-y plane --"
|
||||
<< G4endl;
|
||||
G4cout << " -- to obtain a projection of the quantity <"
|
||||
<< psName
|
||||
<< "> onto the x-y plane --" << G4endl;
|
||||
}
|
||||
|
||||
// change the option string into lowercase to the case-insensitive.
|
||||
@@ -66,68 +67,63 @@ void RE03UserScoreWriter::DumpQuantityToFile(const G4String & psName,
|
||||
std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(int))(tolower));
|
||||
|
||||
// confirm the option
|
||||
if(opt.size() == 0) opt = "csv";
|
||||
if (opt.size() == 0) opt = "csv";
|
||||
|
||||
// open the file
|
||||
std::ofstream ofile(fileName);
|
||||
if(!ofile) {
|
||||
G4cerr << "ERROR : DumpToFile : File open error -> "
|
||||
<< fileName << G4endl;
|
||||
if (!ofile) {
|
||||
G4cerr << "ERROR : DumpToFile : File open error -> " << fileName << G4endl;
|
||||
return;
|
||||
}
|
||||
ofile << "# mesh name: " << fScoringMesh->GetWorldName() << G4endl;
|
||||
|
||||
|
||||
// retrieve the map
|
||||
MeshScoreMap scMap = fScoringMesh->GetScoreMap();
|
||||
|
||||
MeshScoreMap::const_iterator msMapItr = scMap.find(psName);
|
||||
if(msMapItr == scMap.end()) {
|
||||
G4cerr << "ERROR : DumpToFile : Unknown quantity, \""
|
||||
<< psName << "\"." << G4endl;
|
||||
if (msMapItr == scMap.end()) {
|
||||
G4cerr << "ERROR : DumpToFile : Unknown quantity, \"" << psName << "\"." << G4endl;
|
||||
return;
|
||||
}
|
||||
std::map<G4int, G4StatDouble*> * score = msMapItr->second->GetMap();
|
||||
std::map<G4int, G4StatDouble*>* score = msMapItr->second->GetMap();
|
||||
ofile << "# primitive scorer name: " << msMapItr->first << G4endl;
|
||||
|
||||
// write header info
|
||||
// write header info
|
||||
ofile << "# xy projection" << G4endl;
|
||||
ofile << fNMeshSegments[0] << " " << fNMeshSegments[1] << " " << G4endl;
|
||||
|
||||
// declare xy array
|
||||
std::vector<double> projy;
|
||||
for(int y = 0; y < fNMeshSegments[1]; y++) projy.push_back(0.);
|
||||
std::vector<std::vector<double> > projxy;
|
||||
for(int x = 0; x < fNMeshSegments[0]; x++) projxy.push_back(projy);
|
||||
for (int y = 0; y < fNMeshSegments[1]; y++)
|
||||
projy.push_back(0.);
|
||||
std::vector<std::vector<double>> projxy;
|
||||
for (int x = 0; x < fNMeshSegments[0]; x++)
|
||||
projxy.push_back(projy);
|
||||
// accumulate
|
||||
ofile << std::setprecision(16); // for double value with 8 bytes
|
||||
for(int x = 0; x < fNMeshSegments[0]; x++) {
|
||||
for(int y = 0; y < fNMeshSegments[1]; y++) {
|
||||
for(int z = 0; z < fNMeshSegments[2]; z++) {
|
||||
|
||||
ofile << std::setprecision(16); // for double value with 8 bytes
|
||||
for (int x = 0; x < fNMeshSegments[0]; x++) {
|
||||
for (int y = 0; y < fNMeshSegments[1]; y++) {
|
||||
for (int z = 0; z < fNMeshSegments[2]; z++) {
|
||||
G4int idx = GetIndex(x, y, z);
|
||||
|
||||
std::map<G4int, G4StatDouble*>::iterator value = score->find(idx);
|
||||
if(value != score->end()) projxy[x][y] += value->second->sum_wx();
|
||||
|
||||
} // z
|
||||
} // y
|
||||
} // x
|
||||
std::map<G4int, G4StatDouble*>::iterator value = score->find(idx);
|
||||
if (value != score->end()) projxy[x][y] += value->second->sum_wx();
|
||||
|
||||
} // z
|
||||
} // y
|
||||
} // x
|
||||
|
||||
// write quantity
|
||||
ofile << std::setprecision(16); // for double value with 8 bytes
|
||||
for(int x = 0; x < fNMeshSegments[0]; x++) {
|
||||
for(int y = 0; y < fNMeshSegments[1]; y++) {
|
||||
|
||||
ofile << std::setprecision(16); // for double value with 8 bytes
|
||||
for (int x = 0; x < fNMeshSegments[0]; x++) {
|
||||
for (int y = 0; y < fNMeshSegments[1]; y++) {
|
||||
ofile << x << "," << y << ",";
|
||||
ofile << projxy[x][y] << G4endl;
|
||||
|
||||
} // y
|
||||
} // x
|
||||
} // y
|
||||
} // x
|
||||
ofile << std::setprecision(6);
|
||||
|
||||
// close the file
|
||||
ofile.close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user