fixes
This commit is contained in:
+3
-3
@@ -43,9 +43,9 @@ target_link_libraries(exampleB4a ${Geant4_LIBRARIES})
|
||||
|
||||
file(GLOB_RECURSE SOURCES "${PROJECT_SOURCE_DIR}/src/*.cc" )
|
||||
add_subdirectory(lib/pybind11)
|
||||
pybind11_add_module(bindings ${SOURCES} "${PROJECT_SOURCE_DIR}/bind/bindings.cpp")
|
||||
target_include_directories(bindings PUBLIC lib/pybind11/include)
|
||||
target_link_libraries(bindings PUBLIC ${Geant4_LIBRARIES})
|
||||
pybind11_add_module(minicalo ${SOURCES} "${PROJECT_SOURCE_DIR}/bind/bindings.cpp")
|
||||
target_include_directories(minicalo PUBLIC lib/pybind11/include)
|
||||
target_link_libraries(minicalo PUBLIC ${Geant4_LIBRARIES})
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Copy all scripts to the build directory, i.e. the directory in which we
|
||||
|
||||
+2
-2
@@ -25,8 +25,8 @@ void makeSystemBuilder(M& m, std::string name){
|
||||
.def("visualize", &SystemBuilder::visualize);
|
||||
}
|
||||
|
||||
PYBIND11_MODULE(bindings, m) {
|
||||
m.doc() = "pybind11 example plugin"; // optional module docstring
|
||||
PYBIND11_MODULE(minicalo, m) {
|
||||
m.doc() = "pybind11 plugin"; // optional module docstring
|
||||
makeConstructionWrapper(m, "ConstructionWrapper");
|
||||
makeSystemBuilder(m, "SystemBuilder");
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
|
||||
from bindings import ConstructionWrapper, SystemBuilder
|
||||
from minicalo import ConstructionWrapper, SystemBuilder
|
||||
|
||||
cw = ConstructionWrapper()
|
||||
cw.addLayer(10,"G4_Si",True)
|
||||
@@ -8,4 +8,4 @@ cw.addLayer(10,"G4_Si",False)
|
||||
|
||||
sb = SystemBuilder()
|
||||
sb.init(cw)
|
||||
sb.run_batch(100, "e-", 1000, 5000)
|
||||
sb.run_batch(100, "e-", 1000, 5000)
|
||||
|
||||
+2
-1
@@ -273,7 +273,7 @@ int main(){
|
||||
SystemBuilder builder;
|
||||
builder.init(cw, true);
|
||||
//builder.run_gui();
|
||||
builder.run_batch(10000, "e-", 1, 100);
|
||||
builder.run_batch(10000, ((std::string)"e-").data(), 1, 100);
|
||||
|
||||
//run(cw, 1000, "e-", 1, 100, true);
|
||||
|
||||
@@ -281,3 +281,4 @@ int main(){
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ SystemBuilder(){};
|
||||
void init(ConstructionWrapper &cw, bool gui=false);
|
||||
void visualize()const{} //TBI
|
||||
void run_gui();
|
||||
void run_batch(int nEvents, std::string partSpecies, double minEnergy, double maxEnergy);
|
||||
void run_batch(int nEvents, char* partSpecies, double minEnergy, double maxEnergy);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -251,6 +251,7 @@ G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
|
||||
layer.assignPhysicalVolume(ppv); //maybe this needs to be ppv - check
|
||||
|
||||
// assign sensors to layer by copyNumber; access the copyNumber of the volumes
|
||||
|
||||
if(layer.isActive){
|
||||
for(int i = 0; i < layer.nx*layer.ny; i++){
|
||||
Sensor sensor;
|
||||
@@ -263,6 +264,7 @@ G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
|
||||
}
|
||||
|
||||
position += layer.thickness / 2 *cm; //assign the physical volume to the layer
|
||||
|
||||
}
|
||||
//
|
||||
// Visualization attributes
|
||||
|
||||
@@ -59,10 +59,10 @@ void SystemBuilder::run_gui(){
|
||||
}
|
||||
}
|
||||
|
||||
void SystemBuilder::run_batch(int nEvents, std::string partSpecies, double minEnergy, double maxEnergy){
|
||||
G4String partSpec = (G4String)partSpecies;
|
||||
void SystemBuilder::run_batch(int nEvents, char* partSpecies, double minEnergy, double maxEnergy){
|
||||
G4String partSpec = partSpecies;
|
||||
G4cout << "running with particle species " << partSpec << G4endl;
|
||||
actionInitialization->setGeneratorProperties(minEnergy, maxEnergy, partSpec);
|
||||
UImanager->ApplyCommand("/run/initialize");
|
||||
runManager->BeamOn(nEvents);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user