From 31eccc3cb5feabb3db7f5ce3a81becb8715998fc Mon Sep 17 00:00:00 2001 From: Markus Frank Date: Wed, 3 Jul 2024 17:57:49 +0200 Subject: [PATCH] Fix python style errors. --- DDG4/python/DDG4.py | 6 ++---- examples/ClientTests/compact/BoxOfStraws.xml | 2 +- examples/ClientTests/src/BoxOfStraws_geo.cpp | 16 ++++++++-------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/DDG4/python/DDG4.py b/DDG4/python/DDG4.py index d98cc39b2..eb0822034 100644 --- a/DDG4/python/DDG4.py +++ b/DDG4/python/DDG4.py @@ -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 @@ -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 @@ -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] diff --git a/examples/ClientTests/compact/BoxOfStraws.xml b/examples/ClientTests/compact/BoxOfStraws.xml index 243e4eaee..82a9f6766 100644 --- a/examples/ClientTests/compact/BoxOfStraws.xml +++ b/examples/ClientTests/compact/BoxOfStraws.xml @@ -68,7 +68,7 @@ - system:8,module:16,straw:16,y:-12 + system:8,layer:16,straw:16,y:-12 diff --git a/examples/ClientTests/src/BoxOfStraws_geo.cpp b/examples/ClientTests/src/BoxOfStraws_geo.cpp index fca3363a1..afd12b1c3 100644 --- a/examples/ClientTests/src/BoxOfStraws_geo.cpp +++ b/examples/ClientTests/src/BoxOfStraws_geo.cpp @@ -52,14 +52,14 @@ 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); } @@ -67,10 +67,10 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s 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));