From a8d04dbe131e62797ae91073e6fd796d55d96eeb Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Wed, 15 Mar 2023 16:57:18 +0100 Subject: [PATCH] Remove deprecated detector constructors --- DDDetectors/src/BoxSegment_geo.cpp | 21 ++++++++++++++----- .../src/CylindricalBarrelCalorimeter_geo.cpp | 2 +- .../src/CylindricalEndcapCalorimeter_geo.cpp | 1 - DDDetectors/src/DiskTracker_geo.cpp | 1 - DDDetectors/src/EcalBarrel_geo.cpp | 1 - DDDetectors/src/ForwardDetector_geo.cpp | 2 +- DDDetectors/src/MultiLayerTracker_geo.cpp | 2 +- DDDetectors/src/PolyconeSupport_geo.cpp | 1 - .../src/PolyhedraBarrelCalorimeter2_geo.cpp | 1 - .../src/PolyhedraEndcapCalorimeter2_geo.cpp | 2 +- DDDetectors/src/SiTrackerBarrel_geo.cpp | 2 +- DDDetectors/src/SiTrackerEndcap2_geo.cpp | 2 +- DDDetectors/src/TubeSegment_geo.cpp | 2 +- 13 files changed, 23 insertions(+), 17 deletions(-) diff --git a/DDDetectors/src/BoxSegment_geo.cpp b/DDDetectors/src/BoxSegment_geo.cpp index 3f7079ace..709c17254 100644 --- a/DDDetectors/src/BoxSegment_geo.cpp +++ b/DDDetectors/src/BoxSegment_geo.cpp @@ -24,15 +24,26 @@ static Ref_t create_element(Detector& description, xml_h e, Ref_t sens) { xml_det_t x_det = e; string name = x_det.nameStr(); xml_comp_t box (x_det.child(_U(box))); - xml_dim_t pos (x_det.child(_U(position))); - xml_dim_t rot (x_det.child(_U(rotation))); + xml_dim_t pos (x_det.child(_U(position), false)); + xml_dim_t rot (x_det.child(_U(rotation), false)); Material mat (description.material(x_det.materialStr())); DetElement det (name,x_det.id()); Volume det_vol(name+"_vol",Box(box.x(),box.y(),box.z()), mat); Volume mother = description.pickMotherVolume(det); - Transform3D transform(Rotation3D(RotationZYX(rot.z(),rot.y(),rot.x())),Position(pos.x(),pos.y(),pos.z())); - PlacedVolume phv = mother.placeVolume(det_vol,transform); + Transform3D transform; + if ( pos && rot ) { + transform = Transform3D(Rotation3D(RotationZYX(rot.z(),rot.y(),rot.x())), + Position(pos.x(),pos.y(),pos.z())); + } + else if ( rot ) { + transform = Transform3D(Rotation3D(RotationZYX(rot.z(),rot.y(),rot.x())), + Position()); + } + else if ( pos ) { + transform = Transform3D(Rotation3D(), Position(pos.x(),pos.y(),pos.z())); + } + PlacedVolume phv = mother.placeVolume(det_vol,transform); det_vol.setVisAttributes(description, x_det.visStr()); det_vol.setLimitSet(description, x_det.limitsStr()); det_vol.setRegion(description, x_det.regionStr()); @@ -51,4 +62,4 @@ static Ref_t create_element(Detector& description, xml_h e, Ref_t sens) { // first argument is the type from the xml file DECLARE_DETELEMENT(DD4hep_BoxSegment,create_element) -DECLARE_DEPRECATED_DETELEMENT(BoxSegment,create_element) + diff --git a/DDDetectors/src/CylindricalBarrelCalorimeter_geo.cpp b/DDDetectors/src/CylindricalBarrelCalorimeter_geo.cpp index 83f6e1df7..38f22f91c 100644 --- a/DDDetectors/src/CylindricalBarrelCalorimeter_geo.cpp +++ b/DDDetectors/src/CylindricalBarrelCalorimeter_geo.cpp @@ -77,4 +77,4 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s } DECLARE_DETELEMENT(DD4hep_CylindricalBarrelCalorimeter,create_detector) -DECLARE_DEPRECATED_DETELEMENT(CylindricalBarrelCalorimeter,create_detector) + diff --git a/DDDetectors/src/CylindricalEndcapCalorimeter_geo.cpp b/DDDetectors/src/CylindricalEndcapCalorimeter_geo.cpp index 1c84e4e20..1fc40c555 100644 --- a/DDDetectors/src/CylindricalEndcapCalorimeter_geo.cpp +++ b/DDDetectors/src/CylindricalEndcapCalorimeter_geo.cpp @@ -101,4 +101,3 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s } DECLARE_DETELEMENT(DD4hep_CylindricalEndcapCalorimeter,create_detector) -DECLARE_DEPRECATED_DETELEMENT(CylindricalEndcapCalorimeter,create_detector) diff --git a/DDDetectors/src/DiskTracker_geo.cpp b/DDDetectors/src/DiskTracker_geo.cpp index a6e91eb82..792823339 100644 --- a/DDDetectors/src/DiskTracker_geo.cpp +++ b/DDDetectors/src/DiskTracker_geo.cpp @@ -85,4 +85,3 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s } DECLARE_DETELEMENT(DD4hep_DiskTracker,create_detector) -DECLARE_DEPRECATED_DETELEMENT(DiskTracker,create_detector) diff --git a/DDDetectors/src/EcalBarrel_geo.cpp b/DDDetectors/src/EcalBarrel_geo.cpp index 1c52c31b6..6a019b0d6 100644 --- a/DDDetectors/src/EcalBarrel_geo.cpp +++ b/DDDetectors/src/EcalBarrel_geo.cpp @@ -161,4 +161,3 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s } DECLARE_DETELEMENT(DD4hep_EcalBarrel,create_detector) -DECLARE_DEPRECATED_DETELEMENT(EcalBarrel,create_detector) diff --git a/DDDetectors/src/ForwardDetector_geo.cpp b/DDDetectors/src/ForwardDetector_geo.cpp index 006d50c57..37747b282 100644 --- a/DDDetectors/src/ForwardDetector_geo.cpp +++ b/DDDetectors/src/ForwardDetector_geo.cpp @@ -195,4 +195,4 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s } DECLARE_DETELEMENT(DD4hep_ForwardDetector,create_detector) -DECLARE_DEPRECATED_DETELEMENT(ForwardDetector,create_detector) + diff --git a/DDDetectors/src/MultiLayerTracker_geo.cpp b/DDDetectors/src/MultiLayerTracker_geo.cpp index 4798586af..7de04855c 100644 --- a/DDDetectors/src/MultiLayerTracker_geo.cpp +++ b/DDDetectors/src/MultiLayerTracker_geo.cpp @@ -78,4 +78,4 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s } DECLARE_DETELEMENT(DD4hep_MultiLayerTracker,create_detector) -DECLARE_DEPRECATED_DETELEMENT(MultiLayerTracker,create_detector) + diff --git a/DDDetectors/src/PolyconeSupport_geo.cpp b/DDDetectors/src/PolyconeSupport_geo.cpp index 097d2bda6..fb4b3d030 100644 --- a/DDDetectors/src/PolyconeSupport_geo.cpp +++ b/DDDetectors/src/PolyconeSupport_geo.cpp @@ -60,4 +60,3 @@ static Ref_t create_detector(Detector& description, xml_h e, Ref_t sens) { } DECLARE_DETELEMENT(DD4hep_PolyconeSupport,create_detector) -DECLARE_DEPRECATED_DETELEMENT(PolyconeSupport,create_detector) diff --git a/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp b/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp index 029d9bab3..be45bda26 100644 --- a/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp +++ b/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp @@ -185,4 +185,3 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s } DECLARE_DETELEMENT(DD4hep_PolyhedraBarrelCalorimeter2, create_detector) -DECLARE_DEPRECATED_DETELEMENT(PolyhedraBarrelCalorimeter2,create_detector) diff --git a/DDDetectors/src/PolyhedraEndcapCalorimeter2_geo.cpp b/DDDetectors/src/PolyhedraEndcapCalorimeter2_geo.cpp index f9782d494..f770f1190 100644 --- a/DDDetectors/src/PolyhedraEndcapCalorimeter2_geo.cpp +++ b/DDDetectors/src/PolyhedraEndcapCalorimeter2_geo.cpp @@ -131,4 +131,4 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s } DECLARE_DETELEMENT(DD4hep_PolyhedraEndcapCalorimeter2,create_detector) -DECLARE_DEPRECATED_DETELEMENT(PolyhedraEndcapCalorimeter2,create_detector) + diff --git a/DDDetectors/src/SiTrackerBarrel_geo.cpp b/DDDetectors/src/SiTrackerBarrel_geo.cpp index b6970a911..99a70eef8 100644 --- a/DDDetectors/src/SiTrackerBarrel_geo.cpp +++ b/DDDetectors/src/SiTrackerBarrel_geo.cpp @@ -168,4 +168,4 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s } DECLARE_DETELEMENT(DD4hep_SiTrackerBarrel,create_detector) -DECLARE_DEPRECATED_DETELEMENT(SiTrackerBarrel,create_detector) + diff --git a/DDDetectors/src/SiTrackerEndcap2_geo.cpp b/DDDetectors/src/SiTrackerEndcap2_geo.cpp index 3337d6529..2dc3d9cd8 100644 --- a/DDDetectors/src/SiTrackerEndcap2_geo.cpp +++ b/DDDetectors/src/SiTrackerEndcap2_geo.cpp @@ -133,4 +133,4 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s } DECLARE_DETELEMENT(DD4hep_SiTrackerEndcap2,create_detector) -DECLARE_DEPRECATED_DETELEMENT(SiTrackerEndcap2,create_detector) + diff --git a/DDDetectors/src/TubeSegment_geo.cpp b/DDDetectors/src/TubeSegment_geo.cpp index 36fcb987b..866e0bffc 100644 --- a/DDDetectors/src/TubeSegment_geo.cpp +++ b/DDDetectors/src/TubeSegment_geo.cpp @@ -51,4 +51,4 @@ static Ref_t create_element(Detector& description, xml_h e, Ref_t sens) { } DECLARE_DETELEMENT(DD4hep_TubeSegment,create_element) -DECLARE_DEPRECATED_DETELEMENT(TubeSegment,create_element) + -- GitLab