Skip to content

Commit

Permalink
Fix python style errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusFrankATcernch committed Jul 3, 2024
1 parent c795839 commit 31eccc3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
6 changes: 2 additions & 4 deletions DDG4/python/DDG4.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ def setupDetector(self, name, action, collections=None):
return (seq, acts)
return (seq, acts[0])

def setupCalorimeter(self, name, type=None, collections=None): # noqa: A001
def setupCalorimeter(self, name, type=None, collections=None): # noqa: A002
"""
Setup subdetector of type 'calorimeter' and assign the proper sensitive action
Expand All @@ -680,13 +680,12 @@ def setupCalorimeter(self, name, type=None, collections=None): # noqa: A001
self.description.sensitiveDetector(str(name))
# sd.setType('calorimeter')
if typ is None:
type = 'calorimeter'
typ = self.sensitive_types['calorimeter']
elif typ is not None and self.sensitive_types.get(typ):
typ = self.sensitive_types[typ]
return self.setupDetector(name, typ, collections)

def setupTracker(self, name, type=None, collections=None): # noqa: A001
def setupTracker(self, name, type=None, collections=None): # noqa: A002
"""
Setup subdetector of type 'tracker' and assign the proper sensitive action
Expand All @@ -696,7 +695,6 @@ def setupTracker(self, name, type=None, collections=None): # noqa: A001
self.description.sensitiveDetector(str(name))
# sd.setType('tracker')
if typ is None:
type = 'tracker'
typ = self.sensitive_types['tracker']
elif typ is not None and self.sensitive_types.get(typ):
typ = self.sensitive_types[typ]
Expand Down
2 changes: 1 addition & 1 deletion examples/ClientTests/compact/BoxOfStraws.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

<readouts>
<readout name="BoxOfStrawsHits">
<id>system:8,module:16,straw:16,y:-12</id>
<id>system:8,layer:16,straw:16,y:-12</id>
</readout>
</readouts>

Expand Down
16 changes: 8 additions & 8 deletions examples/ClientTests/src/BoxOfStraws_geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,25 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
Volume box_vol(nam, box, description.air());
box_vol.setAttributes(description, x_box.regionStr(), x_box.limitsStr(), x_box.visStr());

Box row(x_box.x(), x_box.y(), x_straw.rmax());
Volume row_vol("row", row, description.air());
row_vol.setVisAttributes(description.visAttributes("InvisibleWithChildren"));
Box layer(x_box.x(), x_box.y(), x_straw.rmax());
Volume layer_vol("layer", layer, description.air());
layer_vol.setVisAttributes(description.visAttributes("InvisibleWithChildren"));

printout(INFO, "BoxOfStraws", "%s: Row: nx: %7d nz: %7d delta: %7.3f", nam.c_str(), num_x, num_z, delta);
printout(INFO, "BoxOfStraws", "%s: Layer: nx: %7d nz: %7d delta: %7.3f", nam.c_str(), num_x, num_z, delta);
for( int ix=0; ix < num_x; ++ix ) {
double x = -box.x() + (double(ix)+0.5) * delta;
PlacedVolume pv = row_vol.placeVolume(straw_vol, Position(x, 0e0, 0e0));
PlacedVolume pv = layer_vol.placeVolume(straw_vol, 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(row_vol, Transform3D(rot, Position(0e0, 0e0, z)));
pv.addPhysVolID("module", iz);
PlacedVolume pv = box_vol.placeVolume(layer_vol, Transform3D(rot, Position(0e0, 0e0, z)));
pv.addPhysVolID("layer", iz);
}
printout(INFO, "BoxOfStraws", "%s: Created %d rows of %d straws each.", nam.c_str(), num_z, num_x);
printout(INFO, "BoxOfStraws", "%s: Created %d layers of %d straws each.", nam.c_str(), num_z, num_x);

DetElement sdet (nam, x_det.id());
Volume mother(description.pickMotherVolume(sdet));
Expand Down

0 comments on commit 31eccc3

Please sign in to comment.