fixed a few little things
This commit is contained in:
+5
-3
@@ -10,7 +10,7 @@ import uproot
|
||||
from IPython.display import Image, display
|
||||
|
||||
|
||||
class G4System(_G4System):
|
||||
class __G4System(_G4System):
|
||||
def run_visualize(
|
||||
self, particleSpec: str, minEnergy_GeV: float, maxEnergy_GeV: float = -1.0
|
||||
):
|
||||
@@ -47,7 +47,7 @@ class G4System(_G4System):
|
||||
|
||||
z0=0
|
||||
# loop over materials
|
||||
for layer_i, layer in enumerate(self.cw.getLayers()):
|
||||
for layer_i, layer in enumerate(self.getConstructionWrapper().getLayers()):
|
||||
#layer_i = len(self.cw.getLayers()) - layer_i -1
|
||||
print(layer_i)
|
||||
|
||||
@@ -241,4 +241,6 @@ col_dict = {
|
||||
"G4_W": 'grey',
|
||||
"G4_Cu": 'dimgray',
|
||||
"G4_BRASS": 'slategrey',
|
||||
}
|
||||
}
|
||||
|
||||
G4System = __G4System()#singleton instance
|
||||
+4
-3
@@ -18,6 +18,7 @@ void makeConstructionWrapper(M & m, std::string name){
|
||||
// bind overloaded getLayers function
|
||||
.def("getLayers", (std::vector<Layer> & (ConstructionWrapper::*)()) &ConstructionWrapper::getLayers)
|
||||
.def("getLayers", (const std::vector<Layer> & (ConstructionWrapper::*)() const) &ConstructionWrapper::getLayers)
|
||||
.def("isAssigned", &ConstructionWrapper::isAssigned)
|
||||
.def("getNSensors", &ConstructionWrapper::getNSensors);
|
||||
|
||||
}
|
||||
@@ -31,9 +32,9 @@ void makeG4System(M &m, std::string name)
|
||||
.def("run_gui", &G4System::run_gui).def("run_batch", &G4System::run_batch, py::arg("nEvents"), py::arg("partSpecies"), py::arg("minEnergy_GeV"), py::arg("maxEnergy_GeV"))
|
||||
.def("applyUICommand", &G4System::applyUICommand, py::arg("command"))
|
||||
.def("displayEvent", &G4System::displayEvent)
|
||||
.def("printMaterial", &G4System::printMaterial, py::arg("name"))
|
||||
.def("check", &G4System::check)
|
||||
.def_readwrite("cw", &G4System::cw);
|
||||
// .def("printMaterial", &G4System::printMaterial, py::arg("name"))
|
||||
//.def("check", &G4System::check)
|
||||
.def("getConstructionWrapper", &G4System::getConstructionWrapper);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -6,9 +6,9 @@ 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
|
||||
|
||||
G4s = G4System()
|
||||
G4s.init(cw)
|
||||
G4s.run_batch(100, "gamma", 1, 5) #100 events, photons, 1000 MeV to 5000 MeV
|
||||
G4System = G4System
|
||||
G4System.init(cw)
|
||||
G4System.run_batch(100, "gamma", 1, 5) #100 events, photons, 1000 MeV to 5000 MeV
|
||||
|
||||
#G4s.run_visualize("gamma", 1, 5)
|
||||
G4s.printMaterial("G4_Pb")
|
||||
G4System.printMaterial("G4_Pb")
|
||||
Reference in New Issue
Block a user