Skip to content

Commit 4cb4fea

Browse files
authored
Merge pull request cms-sw#34032 from smuzaffar/12_0-code-checks-ALCA
[ALCA] Apply code-checks/format with misc-definitions-in-headers
2 parents aed1e1d + ee540cd commit 4cb4fea

File tree

10 files changed

+79
-92
lines changed

10 files changed

+79
-92
lines changed

Alignment/APEEstimation/interface/TrackerSectorStruct.h

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
212212
const std::string &o(options);
213213
CorrelationHists correlationHists;
214214

215-
if (!(o.find("n") != std::string::npos || o.find("p") != std::string::npos || o.find("h") != std::string::npos ||
216-
o.find("t") != std::string::npos || o.find("r") != std::string::npos))
215+
if (!(o.find('n') != std::string::npos || o.find('p') != std::string::npos || o.find('h') != std::string::npos ||
216+
o.find('t') != std::string::npos || o.find('r') != std::string::npos))
217217
return correlationHists;
218218

219219
TFileDirectory *directory(directory_);
@@ -228,7 +228,7 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
228228
minBinX,
229229
maxBinX);
230230

231-
if (options.find("n") != std::string::npos)
231+
if (options.find('n') != std::string::npos)
232232
correlationHists.NorResXVsVar =
233233
directory->make<TH2F>("h2_norRes" + xY + "Vs" + varName,
234234
"r_{" + xy + "}/#sigma_{r," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX +
@@ -239,7 +239,7 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
239239
25,
240240
-norResXMax,
241241
norResXMax);
242-
if (options.find("p") != std::string::npos)
242+
if (options.find('p') != std::string::npos)
243243
correlationHists.ProbXVsVar =
244244
directory->make<TH2F>("h2_prob" + xY + "Vs" + varName,
245245
"prob_{" + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";prob_{" + xy + "}",
@@ -249,7 +249,7 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
249249
60,
250250
-0.1,
251251
1.1);
252-
if (options.find("h") != std::string::npos)
252+
if (options.find('h') != std::string::npos)
253253
correlationHists.SigmaXHitVsVar = directory->make<TH2F>(
254254
"h2_sigma" + xY + "HitVs" + varName,
255255
"#sigma_{hit," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";#sigma_{hit," + xy + "} [#mum]",
@@ -259,7 +259,7 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
259259
50,
260260
0 * 10000.,
261261
sigmaXHitMax * 10000.);
262-
if (options.find("t") != std::string::npos)
262+
if (options.find('t') != std::string::npos)
263263
correlationHists.SigmaXTrkVsVar = directory->make<TH2F>(
264264
"h2_sigma" + xY + "TrkVs" + varName,
265265
"#sigma_{trk," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";#sigma_{trk," + xy + "} [#mum]",
@@ -269,7 +269,7 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
269269
50,
270270
0 * 10000.,
271271
sigmaXMax * 10000.);
272-
if (options.find("r") != std::string::npos)
272+
if (options.find('r') != std::string::npos)
273273
correlationHists.SigmaXVsVar = directory->make<TH2F>(
274274
"h2_sigma" + xY + "Vs" + varName,
275275
"#sigma_{r," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";#sigma_{r," + xy + "} [#mum]",
@@ -280,7 +280,7 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
280280
0 * 10000.,
281281
sigmaXMax * 10000.);
282282

283-
if (options.find("n") != std::string::npos)
283+
if (options.find('n') != std::string::npos)
284284
correlationHists.PNorResXVsVar =
285285
directory->make<TProfile>("p_norRes" + xY + "Vs" + varName,
286286
"r_{" + xy + "}/#sigma_{r," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX +
@@ -289,29 +289,29 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
289289
minBinX,
290290
maxBinX,
291291
"s");
292-
if (options.find("p") != std::string::npos)
292+
if (options.find('p') != std::string::npos)
293293
correlationHists.PProbXVsVar = directory->make<TProfile>(
294294
"p_prob" + xY + "Vs" + varName,
295295
"prob_{" + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";prob_{" + xy + "}",
296296
nBinX2D,
297297
minBinX,
298298
maxBinX,
299299
"s");
300-
if (options.find("h") != std::string::npos)
300+
if (options.find('h') != std::string::npos)
301301
correlationHists.PSigmaXHitVsVar = directory->make<TProfile>(
302302
"p_sigma" + xY + "HitVs" + varName,
303303
"#sigma_{hit," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";#sigma_{hit," + xy + "} [#mum]",
304304
nBinX2D,
305305
minBinX,
306306
maxBinX);
307-
if (options.find("t") != std::string::npos)
307+
if (options.find('t') != std::string::npos)
308308
correlationHists.PSigmaXTrkVsVar = directory->make<TProfile>(
309309
"p_sigma" + xY + "TrkVs" + varName,
310310
"#sigma_{trk," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";#sigma_{trk," + xy + "} [#mum]",
311311
nBinX2D,
312312
minBinX,
313313
maxBinX);
314-
if (options.find("r") != std::string::npos)
314+
if (options.find('r') != std::string::npos)
315315
correlationHists.PSigmaXVsVar = directory->make<TProfile>(
316316
"p_sigma" + xY + "Vs" + varName,
317317
"#sigma_{r," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";#sigma_{r," + xy + "} [#mum]",
@@ -349,8 +349,8 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
349349
const std::string &o(options);
350350
CorrelationHists correlationHists;
351351

352-
if (!(o.find("n") != std::string::npos || o.find("p") != std::string::npos || o.find("h") != std::string::npos ||
353-
o.find("t") != std::string::npos || o.find("r") != std::string::npos))
352+
if (!(o.find('n') != std::string::npos || o.find('p') != std::string::npos || o.find('h') != std::string::npos ||
353+
o.find('t') != std::string::npos || o.find('r') != std::string::npos))
354354
return correlationHists;
355355

356356
TFileDirectory *directory(directory_);
@@ -359,7 +359,7 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
359359
if (!directory)
360360
return correlationHists;
361361

362-
if (options.find("n") != std::string::npos)
362+
if (options.find('n') != std::string::npos)
363363
correlationHists.NorResXVsVar =
364364
directory->make<TH2F>("h2_norRes" + xY + "Vs" + varName,
365365
"r_{" + xy + "}/#sigma_{r," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX +
@@ -370,7 +370,7 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
370370
25,
371371
-norResXMax,
372372
norResXMax);
373-
if (options.find("p") != std::string::npos)
373+
if (options.find('p') != std::string::npos)
374374
correlationHists.ProbXVsVar =
375375
directory->make<TH2F>("h2_prob" + xY + "Vs" + varName,
376376
"prob_{" + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";prob_{" + xy + "}",
@@ -380,7 +380,7 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
380380
60,
381381
-0.1,
382382
1.1);
383-
if (options.find("h") != std::string::npos)
383+
if (options.find('h') != std::string::npos)
384384
correlationHists.SigmaXHitVsVar = directory->make<TH2F>(
385385
"h2_sigma" + xY + "HitVs" + varName,
386386
"#sigma_{hit," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";#sigma_{hit," + xy + "} [#mum]",
@@ -390,7 +390,7 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
390390
50,
391391
0 * 10000.,
392392
sigmaXHitMax * 10000.);
393-
if (options.find("t") != std::string::npos)
393+
if (options.find('t') != std::string::npos)
394394
correlationHists.SigmaXTrkVsVar = directory->make<TH2F>(
395395
"h2_sigma" + xY + "TrkVs" + varName,
396396
"#sigma_{trk," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";#sigma_{trk," + xy + "} [#mum]",
@@ -400,7 +400,7 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
400400
50,
401401
0 * 10000.,
402402
sigmaXMax * 10000.);
403-
if (options.find("r") != std::string::npos)
403+
if (options.find('r') != std::string::npos)
404404
correlationHists.SigmaXVsVar = directory->make<TH2F>(
405405
"h2_sigma" + xY + "Vs" + varName,
406406
"#sigma_{r," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";#sigma_{r," + xy + "} [#mum]",
@@ -411,7 +411,7 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
411411
0 * 10000.,
412412
sigmaXMax * 10000.);
413413

414-
if (options.find("n") != std::string::npos)
414+
if (options.find('n') != std::string::npos)
415415
correlationHists.PNorResXVsVar =
416416
directory->make<TProfile>("p_norRes" + xY + "Vs" + varName,
417417
"r_{" + xy + "}/#sigma_{r," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX +
@@ -420,29 +420,29 @@ TrackerSectorStruct::CorrelationHists TrackerSectorStruct::bookCorrHists(TString
420420
minBinX,
421421
maxBinX,
422422
"s");
423-
if (options.find("p") != std::string::npos)
423+
if (options.find('p') != std::string::npos)
424424
correlationHists.PProbXVsVar = directory->make<TProfile>(
425425
"p_prob" + xY + "Vs" + varName,
426426
"prob_{" + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";prob_{" + xy + "}",
427427
nBinX,
428428
minBinX,
429429
maxBinX,
430430
"s");
431-
if (options.find("h") != std::string::npos)
431+
if (options.find('h') != std::string::npos)
432432
correlationHists.PSigmaXHitVsVar = directory->make<TProfile>(
433433
"p_sigma" + xY + "HitVs" + varName,
434434
"#sigma_{hit," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";#sigma_{hit," + xy + "} [#mum]",
435435
nBinX,
436436
minBinX,
437437
maxBinX);
438-
if (options.find("t") != std::string::npos)
438+
if (options.find('t') != std::string::npos)
439439
correlationHists.PSigmaXTrkVsVar = directory->make<TProfile>(
440440
"p_sigma" + xY + "TrkVs" + varName,
441441
"#sigma_{trk," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";#sigma_{trk," + xy + "} [#mum]",
442442
nBinX,
443443
minBinX,
444444
maxBinX);
445-
if (options.find("r") != std::string::npos)
445+
if (options.find('r') != std::string::npos)
446446
correlationHists.PSigmaXVsVar = directory->make<TProfile>(
447447
"p_sigma" + xY + "Vs" + varName,
448448
"#sigma_{r," + xy + "} vs. " + labelX + ";" + labelX + " " + unitX + ";#sigma_{r," + xy + "} [#mum]",

Alignment/CommonAlignment/src/AlignableObjectId.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,9 @@ namespace {
225225
}
226226

227227
constexpr enum align::StructureType stringToObjectId(char const *name, AlignableObjectId::entry const *entries) {
228-
return !entries->name ? align::invalid
229-
: same(entries->name, name) ? entries->type : stringToObjectId(name, entries + 1);
228+
return !entries->name ? align::invalid
229+
: same(entries->name, name) ? entries->type
230+
: stringToObjectId(name, entries + 1);
230231
}
231232
} // namespace
232233

CalibCalorimetry/CastorCalib/src/CastorDbASCIIIO.cc

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ namespace CastorDbASCIIIO {
2424
if (first.isHcalDetId()) {
2525
HcalDetId f1(first);
2626
HcalDetId s1(second);
27-
return f1.zside() != s1.zside()
28-
? f1.zside() < s1.zside()
29-
: f1.iphi() != s1.iphi()
30-
? f1.iphi() < s1.iphi()
31-
: f1.ietaAbs() != s1.ietaAbs() ? f1.ietaAbs() < s1.ietaAbs() : f1.depth() < s1.depth();
27+
return f1.zside() != s1.zside() ? f1.zside() < s1.zside()
28+
: f1.iphi() != s1.iphi() ? f1.iphi() < s1.iphi()
29+
: f1.ietaAbs() != s1.ietaAbs() ? f1.ietaAbs() < s1.ietaAbs()
30+
: f1.depth() < s1.depth();
3231
} else {
3332
return first.rawId() < second.rawId();
3433
}
@@ -39,12 +38,10 @@ namespace CastorDbASCIIIO {
3938
bool operator()(CastorElectronicsId first, CastorElectronicsId second) const {
4039
return first.readoutVMECrateId() != second.readoutVMECrateId()
4140
? first.readoutVMECrateId() < second.readoutVMECrateId()
42-
: first.htrSlot() != second.htrSlot()
43-
? first.htrSlot() < second.htrSlot()
44-
: first.htrTopBottom() != second.htrTopBottom()
45-
? first.htrTopBottom() < second.htrTopBottom()
46-
: first.fiberIndex() != second.fiberIndex() ? first.fiberIndex() < second.fiberIndex()
47-
: first.fiberChanId() < second.fiberChanId();
41+
: first.htrSlot() != second.htrSlot() ? first.htrSlot() < second.htrSlot()
42+
: first.htrTopBottom() != second.htrTopBottom() ? first.htrTopBottom() < second.htrTopBottom()
43+
: first.fiberIndex() != second.fiberIndex() ? first.fiberIndex() < second.fiberIndex()
44+
: first.fiberChanId() < second.fiberChanId();
4845
}
4946
};
5047

CalibCalorimetry/HcalAlgos/src/HcalDbASCIIIO.cc

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ namespace {
2828
if (first.isHcalDetId()) {
2929
HcalDetId f1(first);
3030
HcalDetId s1(second);
31-
return f1.zside() != s1.zside()
32-
? f1.zside() < s1.zside()
33-
: f1.iphi() != s1.iphi()
34-
? f1.iphi() < s1.iphi()
35-
: f1.ietaAbs() != s1.ietaAbs() ? f1.ietaAbs() < s1.ietaAbs() : f1.depth() < s1.depth();
31+
return f1.zside() != s1.zside() ? f1.zside() < s1.zside()
32+
: f1.iphi() != s1.iphi() ? f1.iphi() < s1.iphi()
33+
: f1.ietaAbs() != s1.ietaAbs() ? f1.ietaAbs() < s1.ietaAbs()
34+
: f1.depth() < s1.depth();
3635
} else {
3736
return first.rawId() < second.rawId();
3837
}
@@ -43,12 +42,10 @@ namespace {
4342
bool operator()(HcalElectronicsId first, HcalElectronicsId second) const {
4443
return first.readoutVMECrateId() != second.readoutVMECrateId()
4544
? first.readoutVMECrateId() < second.readoutVMECrateId()
46-
: first.htrSlot() != second.htrSlot()
47-
? first.htrSlot() < second.htrSlot()
48-
: first.htrTopBottom() != second.htrTopBottom()
49-
? first.htrTopBottom() < second.htrTopBottom()
50-
: first.fiberIndex() != second.fiberIndex() ? first.fiberIndex() < second.fiberIndex()
51-
: first.fiberChanId() < second.fiberChanId();
45+
: first.htrSlot() != second.htrSlot() ? first.htrSlot() < second.htrSlot()
46+
: first.htrTopBottom() != second.htrTopBottom() ? first.htrTopBottom() < second.htrTopBottom()
47+
: first.fiberIndex() != second.fiberIndex() ? first.fiberIndex() < second.fiberIndex()
48+
: first.fiberChanId() < second.fiberChanId();
5249
}
5350
};
5451
} // namespace

CalibCalorimetry/HcalAlgos/src/HcalLedAnalysis.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,13 +1003,11 @@ void HcalLedAnalysis::ProcessCalibEvent(int fiberChan, HcalCalibDetId calibId, c
10031003
char name[1024];
10041004
std::string prefix;
10051005
if (calibId.calibFlavor() == HcalCalibDetId::CalibrationBox) {
1006-
std::string sector = (calibId.hcalSubdet() == HcalBarrel)
1007-
? ("HB")
1008-
: (calibId.hcalSubdet() == HcalEndcap)
1009-
? ("HE")
1010-
: (calibId.hcalSubdet() == HcalOuter)
1011-
? ("HO")
1012-
: (calibId.hcalSubdet() == HcalForward) ? ("HF") : "";
1006+
std::string sector = (calibId.hcalSubdet() == HcalBarrel) ? ("HB")
1007+
: (calibId.hcalSubdet() == HcalEndcap) ? ("HE")
1008+
: (calibId.hcalSubdet() == HcalOuter) ? ("HO")
1009+
: (calibId.hcalSubdet() == HcalForward) ? ("HF")
1010+
: "";
10131011
snprintf(name,
10141012
sizeof name,
10151013
"%s %+d iphi=%d %s",

CalibFormats/CastorObjects/src/CastorText2DetIdConverter.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ bool CastorText2DetIdConverter::init(const std::string& fFlavor,
8585
field2 = strip(fField2);
8686
field3 = strip(fField3);
8787
if (flavorName.find("CASTOR_") == 0) {
88-
HcalCastorDetId::Section section =
89-
flavorName == "CASTOR_EM" ? HcalCastorDetId::EM
90-
: flavorName == "CASTOR_HAD" ? HcalCastorDetId::HAD : HcalCastorDetId::Unknown;
88+
HcalCastorDetId::Section section = flavorName == "CASTOR_EM" ? HcalCastorDetId::EM
89+
: flavorName == "CASTOR_HAD" ? HcalCastorDetId::HAD
90+
: HcalCastorDetId::Unknown;
9191
mId = HcalCastorDetId(section, getField(1) > 0, getField(2), getField(3));
9292
}
9393

CalibFormats/HcalObjects/src/HcalText2DetIdConverter.cc

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,14 @@ namespace {
2626
}
2727

2828
int calibChannel(const std::string& fName) {
29-
return fName == "Mixer-High"
30-
? 1
31-
: fName == "Mixer-Low"
32-
? 2
33-
: fName == "Megatile"
34-
? 3
35-
: fName == "Mixer-Scintillator"
36-
? 4
37-
: fName == "RadDam1"
38-
? 5
39-
: fName == "RadDam2" ? 6 : fName == "RadDam3" ? 7 : atoi(fName.c_str());
29+
return fName == "Mixer-High" ? 1
30+
: fName == "Mixer-Low" ? 2
31+
: fName == "Megatile" ? 3
32+
: fName == "Mixer-Scintillator" ? 4
33+
: fName == "RadDam1" ? 5
34+
: fName == "RadDam2" ? 6
35+
: fName == "RadDam3" ? 7
36+
: atoi(fName.c_str());
4037
// 0;
4138
}
4239
} // namespace
@@ -73,13 +70,11 @@ bool HcalText2DetIdConverter::init(DetId fId) {
7370
flavorName = "NA";
7471
} else if (genId.isHcalDetId()) {
7572
HcalDetId hcalId(mId);
76-
flavorName = genId.genericSubdet() == HcalGenericDetId::HcalGenBarrel
77-
? "HB"
78-
: genId.genericSubdet() == HcalGenericDetId::HcalGenEndcap
79-
? "HE"
80-
: genId.genericSubdet() == HcalGenericDetId::HcalGenOuter
81-
? "HO"
82-
: genId.genericSubdet() == HcalGenericDetId::HcalGenForward ? "HF" : "H_UNKNOWN";
73+
flavorName = genId.genericSubdet() == HcalGenericDetId::HcalGenBarrel ? "HB"
74+
: genId.genericSubdet() == HcalGenericDetId::HcalGenEndcap ? "HE"
75+
: genId.genericSubdet() == HcalGenericDetId::HcalGenOuter ? "HO"
76+
: genId.genericSubdet() == HcalGenericDetId::HcalGenForward ? "HF"
77+
: "H_UNKNOWN";
8378
setField(1, hcalId.ieta());
8479
setField(2, hcalId.iphi());
8580
setField(3, hcalId.depth());
@@ -199,9 +194,10 @@ bool HcalText2DetIdConverter::init(const std::string& fFlavor,
199194
field2 = strip(fField2);
200195
field3 = strip(fField3);
201196
if (flavorName == "HB" || flavorName == "HE" || flavorName == "HF" || flavorName == "HO") {
202-
HcalSubdetector sub = flavorName == "HB"
203-
? HcalBarrel
204-
: flavorName == "HE" ? HcalEndcap : flavorName == "HO" ? HcalOuter : HcalForward;
197+
HcalSubdetector sub = flavorName == "HB" ? HcalBarrel
198+
: flavorName == "HE" ? HcalEndcap
199+
: flavorName == "HO" ? HcalOuter
200+
: HcalForward;
205201
mId = HcalDetId(sub, getField(1), getField(2), getField(3));
206202
} else if (flavorName == "HT") {
207203
// We use the depth to signal the "version" being used (RCT or 1x1 HF). RCT

0 commit comments

Comments
 (0)