another fix

This commit is contained in:
Jan Kieseler
2023-09-21 10:18:26 +02:00
parent 8d2302b5dc
commit 5344586a7a
3 changed files with 13 additions and 3 deletions
+9
View File
@@ -12,9 +12,18 @@ class G4System(_G4System):
def run_visualize(self,particleSpec : str, minEnergy_GeV: float, maxEnergy_GeV:float = -1.):
if maxEnergy_GeV < 0:
maxEnergy_GeV = minEnergy_GeV
#anpassen: run 1 event and get stuff from construction wrapper
_G4System.run_visualize(self, particleSpec, minEnergy_GeV, maxEnergy_GeV)
self.displayEvent()
def run_batch(self, nEvents: int, particleSpec : str, minEnergy_GeV: float,
maxEnergy_GeV:float = -1., outputFile:str = "dataframe.df"):
if maxEnergy_GeV < 0:
maxEnergy_GeV = minEnergy_GeV
_G4System.run_batch(self, nEvents, particleSpec, minEnergy_GeV, maxEnergy_GeV)
# here conversion from root to pandas dataframe
def displayEvent(self):
f_to_conv = max(filter(lambda x: x.endswith(".prim"), os.listdir()),
key=os.path.getctime)
+2 -2
View File
@@ -8,6 +8,6 @@ cw.addLayer(10,"G4_Si",True, 3) #10 cm of Silicon, active, 3x3 segmentation
G4s = G4System()
G4s.init(cw)
#G4s.run_batch(100, "gamma", 1000, 5000) #100 events, photons, 1000 MeV to 5000 MeV
G4s.run_batch(100, "gamma", 1, 5) #100 events, photons, 1000 MeV to 5000 MeV
G4s.run_visualize("gamma", 1000, 5000)
G4s.run_visualize("gamma", 1, 5)
+2 -1
View File
@@ -61,6 +61,7 @@ class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
//we have to pass around these global things...
static DetectorConstruction* _global_detector_construction;
static DetectorConstruction* getDetectorConstruction(){
return _global_detector_construction;
@@ -75,7 +76,7 @@ class DetectorConstruction : public G4VUserDetectorConstruction
G4VPhysicalVolume* Construct() override;
void ConstructSDandField() override;
void setConstructionWrapper(ConstructionWrapper* Cw){
void setConstructionWrapper(ConstructionWrapper* Cw){
this->cw = Cw;
}