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
+10
View File
@@ -32,6 +32,7 @@
#include "G4VUserActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
namespace B4
{
@@ -66,12 +67,21 @@ class ActionInitialization : public G4VUserActionInitialization
fDetConstruction = det;
}
void setFileName(G4String fileName){
this->filename = fileName;
if(runact!=nullptr){
runact -> setFileName(fileName);
}
}
private:
B4::DetectorConstruction* fDetConstruction = nullptr;
mutable B4::PrimaryGeneratorAction * gen = nullptr;
mutable B4::RunAction * runact = nullptr;
G4double minEnergy=1000;
G4double maxEnergy=1000;
G4String partSpecies="e-";
G4String filename="";
};
}
+3 -1
View File
@@ -19,6 +19,7 @@
#include "Randomize.hh"
class G4System{
friend class GeometryDescriptor;
public:
G4System(bool Gui=false):gui(Gui){};
@@ -37,7 +38,8 @@ void init(GeometryDescriptor &cw);
void run_visualize(const std::string& partSpecies, double minEnergy_GeV, double maxEnergy_GeV);
//runs the whole gui if available
void run_gui();
void run_batch(int nEvents, const std::string& partSpecies, double minEnergy_GeV, double maxEnergy_GeV);
void run_batch(int nEvents, const std::string& partSpecies, double minEnergy_GeV,
double maxEnergy_GeV, std::string filename="_1234567890_Hits.root");
void applyUICommand(const std::string& command){
check();
+6 -3
View File
@@ -7,7 +7,7 @@
#include <string>
//#include "G4VPhysicalVolume.hh"
class G4VPhysicalVolume;
class G4System;
class Sensor{
public:
@@ -90,7 +90,7 @@ class GeometryDescriptor{
public:
GeometryDescriptor(double xy_width=50);
~GeometryDescriptor() {};
~GeometryDescriptor();
void addLayer(double thickness_cm, std::string material, bool isActive=true, int nx=1, int ny=-1);
@@ -134,10 +134,13 @@ public:
}
}
void setG4System(G4System* g4system){
this->g4system = g4system;
}
private:
double xywidth;
std::vector<Layer> layers;
G4System * g4system;
};
#endif
+6
View File
@@ -65,6 +65,10 @@ class RunAction : public G4UserRunAction
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void setFileName(G4String name){
filename = name;
}
//now this is dumb but the way this is setup it has to be done like this
//yeah mutable fine whatever
@@ -78,6 +82,8 @@ class RunAction : public G4UserRunAction
mutable std::vector<int> hitLayer;
mutable std::vector<int> hitCopyNumber;
mutable G4String filename;
};
}