feat: debug mode; fix: root file name
This commit is contained in:
parent
9a58b5a071
commit
c6fab20c6c
10
include/GeneConst.hh
Normal file
10
include/GeneConst.hh
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef GeneConst_hh
|
||||
#define GeneConst_hh 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
extern G4double innerR;
|
||||
extern G4double outerR;
|
||||
extern G4double fBeamEnergy;
|
||||
|
||||
#endif
|
@ -19,9 +19,6 @@ public:
|
||||
private:
|
||||
G4LogicalVolume* logicalWorld;
|
||||
G4VPhysicalVolume* physicalWorld;
|
||||
|
||||
G4double innerR = 8.5 * cm;
|
||||
G4double outerR = 13.0 * cm;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -19,7 +19,6 @@ public:
|
||||
|
||||
private:
|
||||
G4ParticleGun* particleGun;
|
||||
G4double fBeamEnergy;
|
||||
G4double mass[4];
|
||||
G4double beta;
|
||||
G4double gamma;
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "globals.hh"
|
||||
|
||||
class G4String;
|
||||
class GeneRunActionMessenger;
|
||||
|
||||
class GeneRunAction : public G4UserRunAction {
|
||||
public:
|
||||
@ -15,9 +14,6 @@ public:
|
||||
public:
|
||||
void BeginOfRunAction(const G4Run*);
|
||||
void EndOfRunAction(const G4Run*);
|
||||
inline void SetRunNo(G4String val) { RunNo = val; };
|
||||
G4String RunNo;
|
||||
GeneRunActionMessenger* pMessenger;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,25 +0,0 @@
|
||||
#ifndef GeneRunActionMessenger_hh
|
||||
#define GeneRunActionMessenger_hh 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class GeneRunAction;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithAString;
|
||||
|
||||
class GeneRunActionMessenger : public G4UImessenger {
|
||||
public:
|
||||
GeneRunActionMessenger(GeneRunAction*);
|
||||
virtual ~GeneRunActionMessenger();
|
||||
|
||||
virtual void SetNewValue(G4UIcommand*, G4String);
|
||||
|
||||
private:
|
||||
GeneRunAction* pRunAction;
|
||||
|
||||
G4UIdirectory* RunDir;
|
||||
G4UIcmdWithAString* RunNoCmd;
|
||||
};
|
||||
|
||||
#endif
|
2
loop.mac
Normal file
2
loop.mac
Normal file
@ -0,0 +1,2 @@
|
||||
/Gene/PrimaryGA/SetBeamEnergy {energy} MeV # alpha energy for 22Ne(a,n)25Mg reaction
|
||||
/run/beamOn 10000
|
9
run.mac
9
run.mac
@ -5,12 +5,5 @@
|
||||
|
||||
/run/initialize
|
||||
|
||||
# energy setting
|
||||
/Gene/PrimaryGA/SetBeamEnergy 1.0 MeV # alpha energy for 22Ne(a,n)25Mg reaction
|
||||
|
||||
# user setting for runNo of output file
|
||||
/Gene/Run/RunNo 1000keV_i85_o130_10000evts
|
||||
|
||||
# gsp particle
|
||||
/gun/particle neutron
|
||||
/run/beamOn 10000
|
||||
/control/loop loop.mac energy 0.1 5 0.1
|
||||
|
7
src/GeneConst.cc
Normal file
7
src/GeneConst.cc
Normal file
@ -0,0 +1,7 @@
|
||||
#include "GeneConst.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
G4double innerR = 8.5 * cm;
|
||||
G4double outerR = 13.0 * cm;
|
||||
G4double fBeamEnergy;
|
@ -16,6 +16,7 @@
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "GeneConst.hh"
|
||||
#include "GeneHe3detSD.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "GeneAnalysisManager.hh"
|
||||
#include "GeneConst.hh"
|
||||
#include "GenePrimaryGeneratorAction.hh"
|
||||
#include "GenePrimaryGeneratorActionMessenger.hh"
|
||||
#include "Randomize.hh"
|
||||
|
@ -6,14 +6,16 @@
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "GeneAnalysisManager.hh"
|
||||
#include "GeneRunActionMessenger.hh"
|
||||
#include "GeneConst.hh"
|
||||
|
||||
GeneRunAction::GeneRunAction() : G4UserRunAction() {
|
||||
RunNo = "00";
|
||||
pMessenger = new GeneRunActionMessenger(this);
|
||||
static G4String RunNo() {
|
||||
return std::to_string(int(fBeamEnergy * 1000)) + "kev_" + std::to_string(int(innerR)) + "mm_" +
|
||||
std::to_string(int(outerR)) + "mm";
|
||||
}
|
||||
|
||||
GeneRunAction::~GeneRunAction() { delete pMessenger; }
|
||||
GeneRunAction::GeneRunAction() : G4UserRunAction() {}
|
||||
|
||||
GeneRunAction::~GeneRunAction() {}
|
||||
|
||||
void GeneRunAction::BeginOfRunAction(const G4Run*) {
|
||||
// Prepare the visualization
|
||||
@ -23,7 +25,7 @@ void GeneRunAction::BeginOfRunAction(const G4Run*) {
|
||||
}
|
||||
|
||||
GeneAnalysisManager* analysisManager = GeneAnalysisManager::GetInstance();
|
||||
G4String sFileName = "Simulation_RunNo" + RunNo + ".root";
|
||||
G4String sFileName = "Simulation_RunNo_" + RunNo() + ".root";
|
||||
analysisManager->SetAnalysisFileName(sFileName);
|
||||
// Open an output file
|
||||
analysisManager->book();
|
||||
|
@ -1,26 +0,0 @@
|
||||
#include "GeneRunActionMessenger.hh"
|
||||
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "GeneRunAction.hh"
|
||||
|
||||
GeneRunActionMessenger::GeneRunActionMessenger(GeneRunAction* pRun) : pRunAction(pRun) {
|
||||
RunDir = new G4UIdirectory("/Gene/Run/");
|
||||
RunDir->SetGuidance("Commands to set RunNo");
|
||||
|
||||
RunNoCmd = new G4UIcmdWithAString("/Gene/Run/RunNo", this);
|
||||
RunNoCmd->SetGuidance("Set RunNo of file");
|
||||
RunNoCmd->SetParameterName("RunNo", false);
|
||||
RunNoCmd->AvailableForStates(G4State_PreInit);
|
||||
}
|
||||
|
||||
GeneRunActionMessenger::~GeneRunActionMessenger() {
|
||||
delete RunNoCmd;
|
||||
delete RunDir;
|
||||
}
|
||||
|
||||
void GeneRunActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue) {
|
||||
if (command == RunNoCmd) {
|
||||
pRunAction->SetRunNo(newValue);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user