output file

This commit is contained in:
Jan Kieseler
2023-10-13 09:09:02 +02:00
parent 69cc376c5f
commit 381aa6ea91
9 changed files with 42 additions and 9 deletions
+2 -1
View File
@@ -62,7 +62,8 @@ void ActionInitialization::Build() const
gen->setMaxPartEnergy(maxEnergy);
gen->setPartSpecies(partSpecies);
SetUserAction(gen);
auto runact = new RunAction;
runact = new RunAction;
runact -> setFileName(filename);
SetUserAction(runact);
auto eventAction = new EventAction;
eventAction->setRunAction(runact);
+4 -1
View File
@@ -19,6 +19,7 @@ void G4System::init(GeometryDescriptor &CW){
assigned_cw->unAssign();
}
assigned_cw = &CW;
CW.setG4System(this);//link both ways
char* argv[]={(char*)"dummy"};
@@ -156,7 +157,8 @@ void G4System::run_gui(){
}
}
void G4System::run_batch(int nEvents,const std::string& partSpecies, double minEnergy, double maxEnergy){
void G4System::run_batch(int nEvents,const std::string& partSpecies, double minEnergy,
double maxEnergy, std::string filename){
check();
@@ -165,6 +167,7 @@ void G4System::run_batch(int nEvents,const std::string& partSpecies, double minE
UImanager->ApplyCommand("/run/initialize");
UImanager->ApplyCommand("/vis/disable");
actionInitialization->setGeneratorProperties(minEnergy, maxEnergy, partSpec);
actionInitialization->setFileName(filename);
runManager->BeamOn(nEvents);
}
+8
View File
@@ -2,6 +2,7 @@
#include "GeometryDescriptor.hh"
#include "G4VPhysicalVolume.hh"
#include "G4System.hh"
Layer::Layer(){
thickness = 0;
@@ -40,6 +41,13 @@ GeometryDescriptor::GeometryDescriptor(double xy_width){
xywidth = xy_width;
}
GeometryDescriptor::~GeometryDescriptor() {
if(g4system != nullptr){
if(this == g4system->assigned_cw){ //unassign
g4system->assigned_cw = nullptr;}
}
};
void GeometryDescriptor::addLayer(double thickness, std::string material, bool isActive, int nx, int ny){
if(ny<0){
ny = nx;
+1 -2
View File
@@ -96,12 +96,11 @@ void RunAction::BeginOfRunAction(const G4Run* /*run*/)
// Open an output file
//
G4String fileName = "_1234567890_Hits.root";
// Other supported output types:
// G4String fileName = "B4.csv";
// G4String fileName = "B4.hdf5";
// G4String fileName = "B4.xml";
analysisManager->OpenFile(fileName);
analysisManager->OpenFile(filename);
G4cout << "Using " << analysisManager->GetType() << G4endl;
}