fix
This commit is contained in:
+1
-4
@@ -6,9 +6,6 @@ cw.addLayer(10,"G4_Si",True) #10 cm of Silicon, active
|
||||
cw.addLayer(1,"G4_Pb",False) #1 cm of Lead, passive
|
||||
cw.addLayer(10,"G4_Si",True, 3) #10 cm of Silicon, active, 3x3 segmentation
|
||||
|
||||
G4System = G4System
|
||||
#directly use G4System as a global singleton
|
||||
G4System.init(cw)
|
||||
G4System.run_batch(100, "gamma", 1, 5) #100 events, photons, 1000 MeV to 5000 MeV
|
||||
|
||||
#G4s.run_visualize("gamma", 1, 5)
|
||||
G4System.printMaterial("G4_Pb")
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
class G4System{
|
||||
public:
|
||||
|
||||
G4System(bool Gui=false):gui(Gui){};
|
||||
G4System(bool Gui=true):gui(Gui){};
|
||||
~G4System(){
|
||||
if(visManager != nullptr){
|
||||
delete visManager;
|
||||
|
||||
@@ -82,6 +82,7 @@ public:
|
||||
y = (copyNo / layer.nx) * layer.sens_ywidth*cm;
|
||||
}
|
||||
G4ThreeVector origin(x, y, z);
|
||||
// G4ThreeVector(layer.sens_xwidth * (i % layer.nx) - layer.sens_xwidth * ((float)layer.nx-1) / 2.*cm, //from sensor position below
|
||||
origin -= G4ThreeVector(layer.sens_xwidth * ((float)layer.nx-1) / 2.*cm, layer.sens_ywidth * ((float)layer.ny-1) / 2.*cm, 0);
|
||||
origin += G4ThreeVector(0., 0., position);
|
||||
physVol->SetTranslation(origin);
|
||||
@@ -270,7 +271,7 @@ G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
|
||||
if(layer.isActive){
|
||||
for(int i = 0; i < layer.nx*layer.ny; i++){
|
||||
Sensor sensor;
|
||||
sensor.position = G4ThreeVector(layer.sens_xwidth * (i % layer.nx) - layer.sens_xwidth * ((float)layer.nx-1) / 2.*cm,
|
||||
sensor.position = G4ThreeVector(layer.sens_xwidth * (i % layer.nx) - layer.sens_xwidth * ((float)layer.nx-1) / 2.*cm, // FIX!!!!
|
||||
layer.sens_ywidth * (i / layer.nx) - layer.sens_ywidth * ((float)layer.ny-1) / 2.*cm, position);
|
||||
sensor.size = G4ThreeVector(layer.sens_xwidth, layer.sens_ywidth, layer.thickness);
|
||||
sensor.energy = 0;
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ void G4System::init(GeometryDescriptor &CW){
|
||||
//
|
||||
runManager =
|
||||
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
|
||||
runManager->SetNumberOfThreads(20);//more doesn't make sense
|
||||
runManager->SetNumberOfThreads(1);//more doesn't make sense
|
||||
runManager->SetVerboseLevel(0);
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -78,7 +78,9 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
|
||||
// This function is called at the begining of event
|
||||
|
||||
G4double rand = G4INCL::Random::shoot();
|
||||
G4double rand = 0;
|
||||
while(rand > 1 || rand < 0)
|
||||
rand = G4INCL::Random::shoot();
|
||||
partEnergy = rand*(maxPartEnergy-minPartEnergy)+minPartEnergy;
|
||||
|
||||
auto particleDefinition
|
||||
|
||||
Reference in New Issue
Block a user