diff --git a/CMakeLists.txt b/CMakeLists.txt
index aa896f49c2aca7891785cd07a7d8c1c3b0e16fc1..95b5f2956d7f0c4bfb3cad567547b180bc49f459 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 f59b4404c52e9caf766e123e2082c0b95e09fe1c..684679762997ee68ea149819d18289a752cf6a72 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 9b41bae4e63d1fe12174c00d2430774ca71efffd..0ca4e45a1eb4f289ef0ca36480d3a974cb8f4d89 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 9c64ff1259a29677f1f33a82ec65f36b812b4240..b88a8840445db9e5b71be1c6d39b0be9ff94253c 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 cdc2f0a0918014e03066f28a5d0dde3ffb6fdef3..2888623a0472b4d3f8d522a2f21a9a6064f9b5e1 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 0561e92b23ddaed35e52f9d9ec256bddf53a55d3..b3179fab66ed440481cbdf8db59eac4c44984c9d 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);