From 4975d6a694703661f5bed52196438107e91ac78d Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Wed, 15 Nov 2023 20:59:16 +0100 Subject: [PATCH] Clean up unused variables --- detector/calorimeter/ECalBarrel_o2_v01_geo.cpp | 5 +++-- detector/calorimeter/ECalEndcap_o1_v01_geo.cpp | 2 +- .../calorimeter/GenericCalBarrel_o1_v01_geo.cpp | 5 +++-- detector/calorimeter/HCalBarrel_o1_v01_geo.cpp | 6 +++--- .../calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp | 6 +++--- detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp | 2 +- detector/calorimeter/SEcal05_ECRing.cpp | 2 +- .../calorimeter/SteppedMuonBarrel_o2_v02_geo.cpp | 4 ++-- detector/calorimeter/YokeBarrel_o1_v01_geo.cpp | 6 +++--- detector/calorimeter/YokeEndcap_o1_v01_geo.cpp | 3 +-- .../tracker/VertexBarrel_detailed_o1_v01_geo.cpp | 13 +++++++------ .../tracker/VertexEndcap_detailed_o1_v01_geo.cpp | 6 +++--- 12 files changed, 31 insertions(+), 29 deletions(-) diff --git a/detector/calorimeter/ECalBarrel_o2_v01_geo.cpp b/detector/calorimeter/ECalBarrel_o2_v01_geo.cpp index 2cce0befa..0346f45fe 100644 --- a/detector/calorimeter/ECalBarrel_o2_v01_geo.cpp +++ b/detector/calorimeter/ECalBarrel_o2_v01_geo.cpp @@ -71,8 +71,9 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s string det_type = x_det.typeStr(); Material air = theDetector.air(); double totalThickness = layering.totalThickness(); - int totalRepeat = 0; - int totalSlices = 0; + // These are used later but clang complains + int totalRepeat [[maybe_unused]] = 0; + int totalSlices [[maybe_unused]] = 0; double gap = xml_dim_t(x_det).gap(); int nsides = dim.numsides(); diff --git a/detector/calorimeter/ECalEndcap_o1_v01_geo.cpp b/detector/calorimeter/ECalEndcap_o1_v01_geo.cpp index d78650fd6..2bcae2f47 100644 --- a/detector/calorimeter/ECalEndcap_o1_v01_geo.cpp +++ b/detector/calorimeter/ECalEndcap_o1_v01_geo.cpp @@ -184,7 +184,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s // Loop over the sets of layer elements in the detector double check_thick = 0.0; int l_num = 1; - int l_set = 0; + int l_set [[maybe_unused]] = 0; for(xml_coll_t li(x_det,_U(layer)); li; ++li) { xml_comp_t x_layer = li; diff --git a/detector/calorimeter/GenericCalBarrel_o1_v01_geo.cpp b/detector/calorimeter/GenericCalBarrel_o1_v01_geo.cpp index 3b199f76c..be7e1c44c 100644 --- a/detector/calorimeter/GenericCalBarrel_o1_v01_geo.cpp +++ b/detector/calorimeter/GenericCalBarrel_o1_v01_geo.cpp @@ -74,8 +74,9 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s string det_type = x_det.typeStr(); Material air = theDetector.air(); double totalThickness = layering.totalThickness(); - int totalRepeat = 0; - int totalSlices = 0; + // These are used later but clang complains + int totalRepeat [[maybe_unused]] = 0; + int totalSlices [[maybe_unused]] = 0; double gap = xml_dim_t(x_det).gap(); int nsides = dim.numsides(); diff --git a/detector/calorimeter/HCalBarrel_o1_v01_geo.cpp b/detector/calorimeter/HCalBarrel_o1_v01_geo.cpp index dbee8243b..07c40f2d6 100644 --- a/detector/calorimeter/HCalBarrel_o1_v01_geo.cpp +++ b/detector/calorimeter/HCalBarrel_o1_v01_geo.cpp @@ -22,7 +22,7 @@ using dd4hep::Layer; using dd4hep::Layering; using dd4hep::Material; using dd4hep::PlacedVolume; -using dd4hep::PolyhedraRegular; +// using dd4hep::PolyhedraRegular; using dd4hep::Position; using dd4hep::Readout; using dd4hep::Ref_t; @@ -70,8 +70,8 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s string det_type = x_det.typeStr(); Material air = theDetector.air(); double totalThickness = layering.totalThickness(); - int totalRepeat = 0; - int totalSlices = 0; + int totalRepeat [[maybe_unused]] = 0; + int totalSlices [[maybe_unused]] = 0; double gap = xml_dim_t(x_det).gap(); int nsides = dim.numsides(); diff --git a/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp b/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp index e02d4bfea..d87c6ea91 100644 --- a/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp +++ b/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp @@ -216,7 +216,7 @@ void buildEC(dd4hep::Detector& aLcdd, dd4hep::SensitiveDetector& aSensDet, dd4he layerVolume.setVisAttributes(aLcdd.invisible()); unsigned int idxSubMod = 0; - unsigned int idxActMod = 0; + unsigned int idxActMod [[maybe_unused]] = 0; dd4hep::Position moduleOffset1 (0,0,sign * extBarrelOffset1); @@ -290,7 +290,7 @@ void buildEC(dd4hep::Detector& aLcdd, dd4hep::SensitiveDetector& aSensDet, dd4he layerVolume.setVisAttributes(aLcdd.invisible()); unsigned int idxSubMod = 0; - unsigned int idxActMod = 0; + unsigned int idxActMod [[maybe_unused]] = 0; double tileZOffset = - 0.5* dzSequence; @@ -361,7 +361,7 @@ void buildEC(dd4hep::Detector& aLcdd, dd4hep::SensitiveDetector& aSensDet, dd4he layerVolume.setVisAttributes(aLcdd.invisible()); unsigned int idxSubMod = 0; - unsigned int idxActMod = 0; + unsigned int idxActMod [[maybe_unused]] = 0; double tileZOffset = - 0.5* dzSequence; diff --git a/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp b/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp index e6d67caa8..dd738f6f3 100644 --- a/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp +++ b/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp @@ -168,7 +168,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep layerVolume.setVisAttributes(lcdd.invisible()); unsigned int idxSubMod = 0; - unsigned int idxActMod = 0; + unsigned int idxActMod [[maybe_unused]] = 0; dd4hep::PlacedVolume placedLayerVolume = envelopeVolume.placeVolume(layerVolume); diff --git a/detector/calorimeter/SEcal05_ECRing.cpp b/detector/calorimeter/SEcal05_ECRing.cpp index aee2e0b16..186ad7605 100644 --- a/detector/calorimeter/SEcal05_ECRing.cpp +++ b/detector/calorimeter/SEcal05_ECRing.cpp @@ -210,7 +210,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h element, SensitiveDete // //==================================================================== - int Number_of_Si_Layers_in_Barrel = 0; + int Number_of_Si_Layers_in_Barrel [[maybe_unused]] = 0; #ifdef VERBOSE std::cout << " Ecal total number of Silicon layers = " << Number_of_Si_Layers_in_Barrel << std::endl; diff --git a/detector/calorimeter/SteppedMuonBarrel_o2_v02_geo.cpp b/detector/calorimeter/SteppedMuonBarrel_o2_v02_geo.cpp index 11df5cee7..91fe2397d 100644 --- a/detector/calorimeter/SteppedMuonBarrel_o2_v02_geo.cpp +++ b/detector/calorimeter/SteppedMuonBarrel_o2_v02_geo.cpp @@ -52,8 +52,8 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s string det_type = x_det.typeStr(); Material air = theDetector.air(); double totalThickness = layering.totalThickness(); - int totalRepeat = 0; - int totalSlices = 0; + int totalRepeat [[maybe_unused]] = 0; + int totalSlices [[maybe_unused]] = 0; double gap = xml_dim_t(x_det).gap(); int nsides = dim.numsides(); diff --git a/detector/calorimeter/YokeBarrel_o1_v01_geo.cpp b/detector/calorimeter/YokeBarrel_o1_v01_geo.cpp index 673a5dd63..dd76ba37b 100644 --- a/detector/calorimeter/YokeBarrel_o1_v01_geo.cpp +++ b/detector/calorimeter/YokeBarrel_o1_v01_geo.cpp @@ -22,7 +22,7 @@ using dd4hep::Layer; using dd4hep::Layering; using dd4hep::Material; using dd4hep::PlacedVolume; -using dd4hep::PolyhedraRegular; +// using dd4hep::PolyhedraRegular; using dd4hep::Position; using dd4hep::Readout; using dd4hep::Ref_t; @@ -70,8 +70,8 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s string det_type = x_det.typeStr(); Material air = theDetector.air(); double totalThickness = layering.totalThickness(); - int totalRepeat = 0; - int totalSlices = 0; + int totalRepeat [[maybe_unused]] = 0; + int totalSlices [[maybe_unused]] = 0; double gap = xml_dim_t(x_det).gap(); int numSides = dim.numsides(); double detZ = dim.z(); diff --git a/detector/calorimeter/YokeEndcap_o1_v01_geo.cpp b/detector/calorimeter/YokeEndcap_o1_v01_geo.cpp index 169ee3082..e41c16e47 100644 --- a/detector/calorimeter/YokeEndcap_o1_v01_geo.cpp +++ b/detector/calorimeter/YokeEndcap_o1_v01_geo.cpp @@ -20,7 +20,6 @@ using dd4hep::RotationZYX; using dd4hep::Segmentation; using dd4hep::SensitiveDetector; using dd4hep::Transform3D; -using dd4hep::Tube; using dd4hep::Volume; using dd4hep::_toString; @@ -114,7 +113,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s double sliceZ = -l_thick/2; double totalAbsorberThickness=0.; - double th_i(0.), th_o(-1.) ; + double th_i [[maybe_unused]] = 0. , th_o = -1. ; for(xml_coll_t s(x_layer,_U(slice)); s; ++s) { xml_comp_t x_slice = s; string s_name = _toString(s_num,"slice%d"); diff --git a/detector/tracker/VertexBarrel_detailed_o1_v01_geo.cpp b/detector/tracker/VertexBarrel_detailed_o1_v01_geo.cpp index 9ade326c0..ada8d2417 100644 --- a/detector/tracker/VertexBarrel_detailed_o1_v01_geo.cpp +++ b/detector/tracker/VertexBarrel_detailed_o1_v01_geo.cpp @@ -43,10 +43,10 @@ using dd4hep::Translation3D; using dd4hep::Trapezoid; using dd4hep::Volume; using dd4hep::_toString; -using dd4hep::rec::Vector3D; -using dd4hep::rec::SurfaceType; +// using dd4hep::rec::Vector3D; +// using dd4hep::rec::SurfaceType; using dd4hep::rec::VolPlane; -using dd4hep::rec::volSurfaceList; +// using dd4hep::rec::volSurfaceList; static Ref_t create_element(Detector& theDetector, xml_h e, SensitiveDetector sens) { @@ -55,7 +55,7 @@ static Ref_t create_element(Detector& theDetector, xml_h e, SensitiveDetector se std::string det_name = x_det.nameStr(); DetElement sdet( det_name, x_det.id() ) ; - PlacedVolume pv; + // PlacedVolume pv; // put the whole detector into an assembly // - should be replaced by an envelope volume ... @@ -182,7 +182,8 @@ static Ref_t create_element(Detector& theDetector, xml_h e, SensitiveDetector se m.sensor_thickness = xml_comp_t(c_sensor).thickness(); xml_coll_t c_component = xml_coll_t(c_sensor,_U(component)); - int iSensitive, iPassive = 0; + // Is iSensitive being used later with this default value in a call to _toString? + int iSensitive = 0, iPassive = 0; for(c_component.reset(); c_component; ++c_component){ xml_comp_t component = c_component; m.sensor_sensitives.push_back(component.isSensitive()); @@ -341,7 +342,7 @@ static Ref_t create_element(Detector& theDetector, xml_h e, SensitiveDetector se // passivesDE.setPlacement(pv); // Place all sensor parts - int iSensitive = 0, iPassive = 0; + int iSensitive = 0, iPassive [[maybe_unused]] = 0; for(int i=0; i