Skip to content

Commit 9cd5b1f

Browse files
authored
Fix warnings seen with gcc16. (key4hep#564)
1 parent 25106b7 commit 9cd5b1f

28 files changed

+63
-108
lines changed

detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ void buildEC(dd4hep::Detector& aLcdd, dd4hep::SensitiveDetector& aSensDet, dd4he
210210
Volume layerVolume("HCalECLayerVol1", layerShape, aLcdd.air());
211211

212212
layerVolume.setVisAttributes(aLcdd.invisible());
213-
unsigned int idxSubMod = 0;
214213

215214
dd4hep::Position moduleOffset1(0, 0, sign * extBarrelOffset1);
216215

@@ -226,8 +225,7 @@ void buildEC(dd4hep::Detector& aLcdd, dd4hep::SensitiveDetector& aSensDet, dd4he
226225
double tileZOffset = -0.5 * dzSequence;
227226

228227
// first Z loop (tiles that make up a sequence)
229-
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
230-
++xCompColl, ++idxSubMod) {
228+
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl) {
231229
xml_comp_t xComp = xCompColl;
232230
dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
233231

@@ -278,13 +276,11 @@ void buildEC(dd4hep::Detector& aLcdd, dd4hep::SensitiveDetector& aSensDet, dd4he
278276
Volume layerVolume("HCalECLayerVol2", layerShape, aLcdd.air());
279277

280278
layerVolume.setVisAttributes(aLcdd.invisible());
281-
unsigned int idxSubMod = 0;
282279

283280
double tileZOffset = -0.5 * dzSequence;
284281

285282
// first Z loop (tiles that make up a sequence)
286-
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
287-
++xCompColl, ++idxSubMod) {
283+
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl) {
288284
xml_comp_t xComp = xCompColl;
289285
dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
290286

@@ -345,13 +341,11 @@ void buildEC(dd4hep::Detector& aLcdd, dd4hep::SensitiveDetector& aSensDet, dd4he
345341
Volume layerVolume("HCalECLayerVol3", layerShape, aLcdd.air());
346342

347343
layerVolume.setVisAttributes(aLcdd.invisible());
348-
unsigned int idxSubMod = 0;
349344

350345
double tileZOffset = -0.5 * dzSequence;
351346

352347
// first Z loop (tiles that make up a sequence)
353-
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
354-
++xCompColl, ++idxSubMod) {
348+
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl) {
355349
xml_comp_t xComp = xCompColl;
356350
dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
357351

detector/calorimeter/HCalThreePartsEndcap_o1_v02_geo.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
255255
Volume layerVolume("HCalECLayerVol1", layerShape, lcdd.air());
256256

257257
layerVolume.setVisAttributes(lcdd.invisible());
258-
unsigned int idxSubMod = 0;
259258

260259
dd4hep::Position moduleOffset1(0, 0, sign * extBarrelOffset1);
261260

@@ -272,8 +271,7 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
272271
double tileZOffset = -0.5 * dzSequence;
273272

274273
// first Z loop (tiles that make up a sequence)
275-
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
276-
++xCompColl, ++idxSubMod) {
274+
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl) {
277275
xml_comp_t xComp = xCompColl;
278276
dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
279277

@@ -329,13 +327,11 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
329327
Volume layerVolume("HCalECLayerVol2", layerShape, lcdd.air());
330328

331329
layerVolume.setVisAttributes(lcdd.invisible());
332-
unsigned int idxSubMod = 0;
333330

334331
double tileZOffset = -0.5 * dzSequence;
335332

336333
// first Z loop (tiles that make up a sequence)
337-
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
338-
++xCompColl, ++idxSubMod) {
334+
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl) {
339335
xml_comp_t xComp = xCompColl;
340336
dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
341337

@@ -401,13 +397,11 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
401397
Volume layerVolume("HCalECLayerVol3", layerShape, lcdd.air());
402398

403399
layerVolume.setVisAttributes(lcdd.invisible());
404-
unsigned int idxSubMod = 0;
405400

406401
double tileZOffset = -0.5 * dzSequence;
407402

408403
// first Z loop (tiles that make up a sequence)
409-
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
410-
++xCompColl, ++idxSubMod) {
404+
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl) {
411405
xml_comp_t xComp = xCompColl;
412406
dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
413407

detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,14 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
153153
Volume layerVolume("HCalLayerVol", layerShape, lcdd.air());
154154

155155
layerVolume.setVisAttributes(lcdd.invisible());
156-
unsigned int idxSubMod = 0;
157156

158157
dd4hep::PlacedVolume placedLayerVolume = envelopeVolume.placeVolume(layerVolume);
159158
placedLayerVolume.addPhysVolID("layer", idxLayer);
160159
layers.push_back(placedLayerVolume);
161160

162161
double tileZOffset = -0.5 * dzSequence;
163162
// first Z loop (tiles that make up a sequence)
164-
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
165-
++xCompColl, ++idxSubMod) {
163+
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl) {
166164
xml_comp_t xComp = xCompColl;
167165
dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
168166

detector/calorimeter/HCalTileBarrel_o1_v02_geo.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,14 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
173173
Volume layerVolume("HCalLayerVol", layerShape, lcdd.air());
174174

175175
layerVolume.setVisAttributes(lcdd.invisible());
176-
unsigned int idxSubMod = 0;
177176

178177
dd4hep::PlacedVolume placedLayerVolume = envelopeVolume.placeVolume(layerVolume);
179178
placedLayerVolume.addPhysVolID("layer", idxLayer);
180179
layers.push_back(placedLayerVolume);
181180

182181
double tileZOffset = -0.5 * dzSequence;
183182
// first Z loop (tiles that make up a sequence)
184-
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
185-
++xCompColl, ++idxSubMod) {
183+
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl) {
186184
xml_comp_t xComp = xCompColl;
187185
dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
188186

detector/calorimeter/dual-readout-tubes/src/DRTubesconstructor.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ void DRBarrelTubes::DRTubesconstructor::calculate_tower_parameters() {
128128
Calculate the maximal distance a tower can stick out, by looping over all tower and saving the maximal one
129129
In the end, make the trapezoids (towers) a bit shorter to accomodate for this */
130130
double shortening = 0.0;
131-
unsigned int tower_number = 2;
132131
// First tower has protrusion 0 because it is placed without tilting, so start with second tower
133-
for (double theta = m_tower_theta; theta < m_barrel_endcap_angle; theta += m_tower_theta, tower_number++) {
132+
for (double theta = m_tower_theta; theta < m_barrel_endcap_angle; theta += m_tower_theta) {
134133
double protection_covered_z = std::tan(theta) * m_calo_inner_r;
135134
double protection_tower_z = std::tan(theta + m_tower_theta) * m_calo_inner_r - protection_covered_z;
136135
double protection_back_shift = std::sin(theta) * protection_tower_z;
@@ -141,7 +140,6 @@ void DRBarrelTubes::DRTubesconstructor::calculate_tower_parameters() {
141140

142141
if (protection_shortening > shortening) {
143142
shortening = protection_shortening; // Save the new highest shortening value
144-
// std::cout << "Tower number: " << tower_number << " shortening: " << shortening/mm << "mm" << std::endl;
145143
} else
146144
break; // If the required shortening is decreasing, we have found the maximal value
147145
}

detector/tracker/SiTrackerEndcap_o2_v01_geo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ static dd4hep::Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDe
4545
Assembly assembly(det_name);
4646
// Volume assembly (det_name,Box(10000,10000,10000),vacuum);
4747
Volume motherVol = theDetector.pickMotherVolume(sdet);
48-
int m_id = 0, c_id = 0, n_sensor = 0;
48+
int c_id = 0, n_sensor = 0;
4949
map<string, Volume> modules;
5050
map<string, Placements> sensitives;
5151
PlacedVolume pv;
5252

5353
assembly.setVisAttributes(theDetector.invisible());
5454
sens.setType("tracker");
5555

56-
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi, ++m_id) {
56+
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi) {
5757
xml_comp_t x_mod = mi;
5858
string m_nam = x_mod.nameStr();
5959
xml_comp_t trd = x_mod.trd();

detector/tracker/SiTrackerEndcap_o2_v01ext_geo.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
4747
string det_name = x_det.nameStr();
4848
bool reflect = x_det.reflect(false);
4949
DetElement sdet(det_name, det_id);
50-
int m_id = 0, c_id = 0, n_sensor = 0;
50+
int c_id = 0;
5151
map<string, Volume> modules;
5252
map<string, Placements> sensitives;
5353
PlacedVolume pv;
@@ -67,7 +67,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
6767
envelope.setVisAttributes(theDetector.invisible());
6868
sens.setType("tracker");
6969

70-
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi, ++m_id) {
70+
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi) {
7171
xml_comp_t x_mod = mi;
7272
string m_nam = x_mod.nameStr();
7373
xml_comp_t trd = x_mod.trd();
@@ -86,7 +86,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
8686

8787
// Loop over slices
8888
// The first slice (top in the xml) is placed at the "bottom" of the module
89-
for (ci.reset(), n_sensor = 1, c_id = 0, posY = -y1; ci; ++ci, ++c_id) {
89+
for (ci.reset(), c_id = 0, posY = -y1; ci; ++ci, ++c_id) {
9090
xml_comp_t c = ci;
9191
double c_thick = c.thickness();
9292
Material c_mat = theDetector.material(c.materialStr());
@@ -98,7 +98,6 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
9898
if (c.isSensitive()) {
9999
c_vol.setSensitiveDetector(sens);
100100
sensitives[m_nam].push_back(pv);
101-
++n_sensor;
102101
}
103102
posY += c_thick;
104103
}

detector/tracker/SiTrackerEndcap_o2_v02_geo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
4444
string det_name = x_det.nameStr();
4545
bool reflect = x_det.reflect(false);
4646
DetElement sdet(det_name, det_id);
47-
int m_id = 0, c_id = 0, n_sensor = 0;
47+
int c_id = 0, n_sensor = 0;
4848
map<string, Volume> modules;
4949
map<string, Placements> sensitives;
5050
PlacedVolume pv;
@@ -64,7 +64,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
6464

6565
// Build the sensor units
6666
// Loop over 'modules' as defined in the XML
67-
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi, ++m_id) {
67+
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi) {
6868
xml_comp_t x_mod = mi;
6969
string m_nam = x_mod.nameStr();
7070
xml_comp_t trd = x_mod.trd();

detector/tracker/SiTrackerEndcap_o2_v02ext_geo.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
5050
string det_name = x_det.nameStr();
5151
bool reflect = x_det.reflect(false);
5252
DetElement sdet(det_name, det_id);
53-
int m_id = 0, c_id = 0, n_sensor = 0;
53+
int c_id = 0;
5454
map<string, Volume> modules;
5555
map<string, Placements> sensitives;
5656
PlacedVolume pv;
@@ -80,7 +80,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
8080
envelope.setVisAttributes(theDetector.invisible());
8181
sens.setType("tracker");
8282

83-
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi, ++m_id) {
83+
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi) {
8484
xml_comp_t x_mod = mi;
8585
string m_nam = x_mod.nameStr();
8686
xml_comp_t trd = x_mod.trd();
@@ -99,7 +99,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
9999
// Loop over slices
100100
// The first slice (top in the xml) is placed at the "bottom" of the module
101101

102-
for (ci.reset(), n_sensor = 1, c_id = 0, posY = -y1; ci; ++ci, ++c_id) {
102+
for (ci.reset(), c_id = 0, posY = -y1; ci; ++ci, ++c_id) {
103103
xml_comp_t c = ci;
104104
double c_thick = c.thickness();
105105
Material c_mat = theDetector.material(c.materialStr());
@@ -110,7 +110,6 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
110110
if (c.isSensitive()) {
111111
c_vol.setSensitiveDetector(sens);
112112
sensitives[m_nam].push_back(pv);
113-
++n_sensor;
114113
}
115114
posY += c_thick;
116115
}

detector/tracker/SiTrackerEndcap_o2_v03_geo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
4444
string det_name = x_det.nameStr();
4545
bool reflect = x_det.reflect(false);
4646
DetElement sdet(det_name, det_id);
47-
int m_id = 0, c_id = 0, n_sensor = 0;
47+
int c_id = 0, n_sensor = 0;
4848
map<string, Volume> modules;
4949
map<string, Placements> sensitives;
5050
PlacedVolume pv;
@@ -64,7 +64,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
6464

6565
// Build the sensor units
6666
// Loop over 'modules' as defined in the XML
67-
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi, ++m_id) {
67+
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi) {
6868
xml_comp_t x_mod = mi;
6969
string m_nam = x_mod.nameStr();
7070
xml_comp_t trd = x_mod.trd();

0 commit comments

Comments
 (0)