From 986b9cce7c6d8df6b96c45ddaaa181ea59ff3d46 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck <wdconinc@gmail.com> Date: Sun, 23 Jan 2022 22:41:58 +0000 Subject: [PATCH] CMakeLists.txt: -Werror --- CMakeLists.txt | 2 ++ src/B0Tracker_geo.cpp | 2 +- src/CylindricalDipoleMagnet_geo.cpp | 2 +- src/IP6BeamPipe.cpp | 4 +-- src/OffMomentumTracker_geo.cpp | 18 +++++------ src/ZeroDegreeCalorimeterSampling_geo.cpp | 38 +++++++++++------------ 6 files changed, 32 insertions(+), 34 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa896f4..95b5f29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,8 @@ PROJECT(ip6 ) SET(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror") + find_package(Acts REQUIRED COMPONENTS Core PluginTGeo PluginDD4hep ) #----------------------------------------------------------------------------------- diff --git a/src/B0Tracker_geo.cpp b/src/B0Tracker_geo.cpp index f59b440..6846797 100644 --- a/src/B0Tracker_geo.cpp +++ b/src/B0Tracker_geo.cpp @@ -28,7 +28,7 @@ static Ref_t create_B0Tracker(Detector& description, xml_h e, SensitiveDetector Material vacuum = description.vacuum(); int det_id = x_det.id(); string det_name = x_det.nameStr(); - bool reflect = false; + //bool reflect = false; DetElement sdet(det_name, det_id); Assembly assembly(det_name); xml::Component pos = x_det.position(); diff --git a/src/CylindricalDipoleMagnet_geo.cpp b/src/CylindricalDipoleMagnet_geo.cpp index 9b41bae..0ca4e45 100644 --- a/src/CylindricalDipoleMagnet_geo.cpp +++ b/src/CylindricalDipoleMagnet_geo.cpp @@ -11,7 +11,7 @@ using namespace dd4hep; using namespace dd4hep::rec; using namespace ROOT::Math; -static Ref_t build_magnet(Detector& dtor, xml_h e, SensitiveDetector sens) { +static Ref_t build_magnet(Detector& dtor, xml_h e, SensitiveDetector /* sens */) { xml_det_t x_det = e; int det_id = x_det.id(); string det_name = x_det.nameStr(); diff --git a/src/IP6BeamPipe.cpp b/src/IP6BeamPipe.cpp index 9c64ff1..b88a884 100644 --- a/src/IP6BeamPipe.cpp +++ b/src/IP6BeamPipe.cpp @@ -31,15 +31,13 @@ using namespace dd4hep; * \endcode * */ -static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector /* sens */) { using namespace ROOT::Math; xml_det_t x_det = e; string det_name = x_det.nameStr(); - Material air = det.air(); DetElement sdet (det_name,x_det.id()); Assembly assembly (det_name+"_assembly"); - Material m_Cu = det.material("Copper"); Material m_Al = det.material("Aluminum"); Material m_Be = det.material("Beryllium"); Material m_Au = det.material("Gold"); diff --git a/src/OffMomentumTracker_geo.cpp b/src/OffMomentumTracker_geo.cpp index cdc2f0a..2888623 100644 --- a/src/OffMomentumTracker_geo.cpp +++ b/src/OffMomentumTracker_geo.cpp @@ -53,8 +53,8 @@ static Ref_t create_OffMomentumTracker(Detector& description, xml_h e, Sensitive double support_zstart = getAttrOrDefault(x_support, _U(zstart), 2.0 * mm); std::string support_name = getAttrOrDefault<std::string>(x_support, _Unicode(name), "support_tube"); std::string support_vis = getAttrOrDefault<std::string>(x_support, _Unicode(vis), "AnlRed"); - xml_dim_t pos (x_support.child(_U(position), false)); - xml_dim_t rot (x_support.child(_U(rotation), false)); + xml_dim_t support_pos (x_support.child(_U(position), false)); + xml_dim_t support_rot (x_support.child(_U(rotation), false)); Solid support_solid; if(x_support.hasChild("shape")){ xml_comp_t shape(x_support.child(_U(shape))); @@ -64,16 +64,16 @@ static Ref_t create_OffMomentumTracker(Detector& description, xml_h e, Sensitive support_solid = Tube(support_rmin, support_rmin + support_thickness, support_length / 2); } Transform3D tr = Transform3D(Rotation3D(),Position(0,0,(support_zstart + support_length / 2))); - if ( pos.ptr() && rot.ptr() ) { - Rotation3D rot3D(RotationZYX(rot.z(0),rot.y(0),rot.x(0))); - Position pos3D(pos.x(0),pos.y(0),pos.z(0)); + if ( support_pos.ptr() && support_rot.ptr() ) { + Rotation3D rot3D(RotationZYX(support_rot.z(0),support_rot.y(0),support_rot.x(0))); + Position pos3D(support_pos.x(0),support_pos.y(0),support_pos.z(0)); tr = Transform3D(rot3D, pos3D); } - else if ( pos.ptr() ) { - tr = Transform3D(Rotation3D(),Position(pos.x(0),pos.y(0),pos.z(0))); + else if ( support_pos.ptr() ) { + tr = Transform3D(Rotation3D(),Position(support_pos.x(0),support_pos.y(0),support_pos.z(0))); } - else if ( rot.ptr() ) { - Rotation3D rot3D(RotationZYX(rot.z(0),rot.y(0),rot.x(0))); + else if ( support_rot.ptr() ) { + Rotation3D rot3D(RotationZYX(support_rot.z(0),support_rot.y(0),support_rot.x(0))); tr = Transform3D(rot3D,Position()); } Material support_mat = description.material(x_support.materialStr()); diff --git a/src/ZeroDegreeCalorimeterSampling_geo.cpp b/src/ZeroDegreeCalorimeterSampling_geo.cpp index 0561e92..b3179fa 100644 --- a/src/ZeroDegreeCalorimeterSampling_geo.cpp +++ b/src/ZeroDegreeCalorimeterSampling_geo.cpp @@ -35,8 +35,6 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens) envelopeVol.setVisAttributes(desc.visAttributes(x_det.visStr())); PlacedVolume pv; - xml_comp_t x_layer = x_det.child(_U(layer)); - int layer_num = 1; // Read layers for(xml_coll_t c(x_det,_U(layer)); c; ++c) { @@ -56,30 +54,30 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens) int slice_num = 1; // Loop over slices for(xml_coll_t l(x_layer,_U(slice)); l; ++l) { - xml_comp_t x_slice = l; - double w = x_slice.thickness(); - string slice_name = layer_name + _toString(slice_num,"slice%d"); - Material slice_mat = desc.material(x_slice.materialStr()); - Volume slice_vol (slice_name,Box(Width/2.0, Width/2.0,w/2.0),slice_mat); - - if(x_slice.isSensitive()) { - sens.setType("calorimeter"); - slice_vol.setSensitiveDetector(sens); - } - - slice_vol.setAttributes(desc,x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); - pv = layer_vol.placeVolume(slice_vol, Transform3D(RotationZYX(0, 0, 0),Position(0.0,0.0,z-zlayer-layerWidth/2.0+w/2.0))); - pv.addPhysVolID("slice", slice_num); - z += w; - ++slice_num; - } + xml_comp_t x_slice = l; + double w = x_slice.thickness(); + string slice_name = layer_name + _toString(slice_num,"slice%d"); + Material slice_mat = desc.material(x_slice.materialStr()); + Volume slice_vol (slice_name,Box(Width/2.0, Width/2.0,w/2.0),slice_mat); + + if(x_slice.isSensitive()) { + sens.setType("calorimeter"); + slice_vol.setSensitiveDetector(sens); + } + + slice_vol.setAttributes(desc,x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + pv = layer_vol.placeVolume(slice_vol, Transform3D(RotationZYX(0, 0, 0),Position(0.0,0.0,z-zlayer-layerWidth/2.0+w/2.0))); + pv.addPhysVolID("slice", slice_num); + z += w; + ++slice_num; + } string layer_vis = dd4hep::getAttrOrDefault(x_layer, _Unicode(vis), "InvisibleWithDaughters"); layer_vol.setAttributes(desc, x_layer.regionStr(), x_layer.limitsStr(), layer_vis); pv = envelopeVol.placeVolume(layer_vol, Transform3D(RotationZYX(0, 0, 0), Position(0,0,zlayer-pos.z()-totWidth/2.0+layerWidth/2.0))); pv.addPhysVolID("layer", layer_num); ++layer_num; - } + } } DetElement det(detName, detID); -- GitLab