diff --git a/examples/ClientTests/compact/BoxOfStraws.xml b/examples/ClientTests/compact/BoxOfStraws.xml
index 94f7c676d..47ed35142 100644
--- a/examples/ClientTests/compact/BoxOfStraws.xml
+++ b/examples/ClientTests/compact/BoxOfStraws.xml
@@ -39,17 +39,18 @@
+
-
+
-
+
diff --git a/examples/ClientTests/scripts/BoxOfStraws.py b/examples/ClientTests/scripts/BoxOfStraws.py
index 45c766dbf..4d5db5951 100644
--- a/examples/ClientTests/scripts/BoxOfStraws.py
+++ b/examples/ClientTests/scripts/BoxOfStraws.py
@@ -49,6 +49,11 @@ def run():
# Configure field
geant4.setupTrackingField(prt=True)
#
+ prt = DDG4.EventAction(kernel, 'Geant4ParticlePrint/ParticlePrint')
+ prt.OutputLevel = Output.DEBUG
+ prt.OutputType = 3 # Print both: table and tree
+ kernel.eventAction().adopt(prt)
+ #
# Configure G4 geometry setup
seq, act = geant4.addDetectorConstruction('Geant4DetectorGeometryConstruction/ConstructGeo')
act.DebugVolumes = True
@@ -67,7 +72,8 @@ def run():
geant4.setupROOTOutput('RootOutput', 'BoxOfStraws_' + time.strftime('%Y-%m-%d_%H-%M'))
#
# Setup particle gun
- gun = geant4.setupGun('Gun', particle='pi+', energy=100 * GeV, multiplicity=1)
+ gun = geant4.setupGun('Gun', particle='pi+', energy=10 * GeV, multiplicity=1)
+ gun.OutputLevel = Output.INFO
gun.enableUI()
#
# And handle the simulation particles.
@@ -83,7 +89,12 @@ def run():
# Map sensitive detectors of type 'BoxOfStraws' to Geant4CalorimeterAction
sd = geant4.description.sensitiveDetector(str('BoxOfStrawsDet'))
logger.info(f'+++ BoxOfStraws: SD type: {str(sd.type())}')
+ filter = DDG4.Filter(kernel, 'EnergyDepositMinimumCut')
+ filter.Cut = 1.0 * MeV
+ filter.enableUI()
+ kernel.registerGlobalFilter(filter)
seq, act = geant4.setupDetector(name='BoxOfStrawsDet', action='MyTrackerSDAction')
+ seq.adopt(filter)
act.HaveCellID = False
#
# Now build the physics list:
diff --git a/examples/ClientTests/src/BoxOfStraws_geo.cpp b/examples/ClientTests/src/BoxOfStraws_geo.cpp
index 29637c6a9..21ae66d0c 100644
--- a/examples/ClientTests/src/BoxOfStraws_geo.cpp
+++ b/examples/ClientTests/src/BoxOfStraws_geo.cpp
@@ -34,7 +34,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
const double thick = x_straw.thickness();
const double delta = 2e0*x_straw.rmax();
const int num_x = int(2e0*x_box.x() / delta);
- const int num_z = int(2e0*x_box.z() / delta);
+ const int num_z = int(2e0*x_box.z() / (delta+2*tol));
Tube straw(0., x_straw.rmax()-tol, x_straw.y()-tol);
Volume straw_vol("straw", straw, description.material(x_straw.materialStr()));
@@ -54,26 +54,26 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
straw_gas_vol.setSensitiveDetector(sens);
}
- Box box(x_box.x(), x_box.y(), x_box.z());
+ // Envelope: make envelope box 'tol' bigger on each side, so that the straws
+ Box box(x_box.x()+tol, x_box.y()+tol, x_box.z()+tol);
Volume box_vol(nam, box, description.air());
box_vol.setAttributes(description, x_box.regionStr(), x_box.limitsStr(), x_box.visStr());
Box layer(x_box.x(), x_box.y(), x_straw.rmax());
Volume layer_vol("layer", layer, description.air());
- layer_vol.setVisAttributes(description.visAttributes("InvisibleWithChildren"));
+ layer_vol.setVisAttributes(description.visAttributes("VisibleGray"));
printout(INFO, "BoxOfStraws", "%s: Layer: nx: %7d nz: %7d delta: %7.3f", nam.c_str(), num_x, num_z, delta);
+ Rotation3D rot(RotationZYX(0e0, 0e0, M_PI/2e0));
for( int ix=0; ix < num_x; ++ix ) {
- double x = -box.x() + (double(ix)+0.5) * delta;
- PlacedVolume pv = layer_vol.placeVolume(straw_vol, Position(x, 0e0, 0e0));
+ double x = -box.x() + (double(ix)+0.5) * (delta + 2e0*tol);
+ PlacedVolume pv = layer_vol.placeVolume(straw_vol, Transform3D(rot,Position(x, 0e0, 0e0)));
pv.addPhysVolID("straw", ix);
}
-
- // Not terribly clever: better would be to place layers instead of single straws....
- Rotation3D rot(RotationZYX(0e0, 0e0, M_PI/2e0));
for( int iz=0; iz < num_z; ++iz ) {
- double z = -box.z() + (double(iz)+0.5) * delta;
- PlacedVolume pv = box_vol.placeVolume(layer_vol, Transform3D(rot, Position(0e0, 0e0, z)));
+ // leave 'tol' space between the layers
+ double z = -box.z() + (double(iz)+0.5) * (2.0*tol + delta);
+ PlacedVolume pv = box_vol.placeVolume(layer_vol, Position(0e0, 0e0, z));
pv.addPhysVolID("layer", iz);
}
printout(INFO, "BoxOfStraws", "%s: Created %d layers of %d straws each.", nam.c_str(), num_z, num_x);