Skip to content

Commit 32d62ad

Browse files
committed
const-ref-in-for-loop (MC)
1 parent 09c8d2f commit 32d62ad

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ struct TableMakerMC {
367367
}
368368
// Barrel track histograms after cuts; one directory per cut
369369
if (fConfigHistOutput.fConfigQA) {
370-
for (auto& cut : fTrackCuts) {
370+
for (const auto& cut : fTrackCuts) {
371371
histClasses += Form("TrackBarrel_%s;", cut->GetName());
372372
}
373373
}
@@ -380,7 +380,7 @@ struct TableMakerMC {
380380
}
381381
// Muon track histograms after cuts; one directory per cut
382382
if (fConfigHistOutput.fConfigQA) {
383-
for (auto& muonCut : fMuonCuts) {
383+
for (const auto& muonCut : fMuonCuts) {
384384
histClasses += Form("Muons_%s;", muonCut->GetName());
385385
}
386386
}
@@ -402,27 +402,27 @@ struct TableMakerMC {
402402
TString addMCSignalsStr = fConfigMCSignalsJSON.value;
403403
if (addMCSignalsStr != "") {
404404
std::vector<MCSignal*> addMCSignals = dqmcsignals::GetMCSignalsFromJSON(addMCSignalsStr.Data());
405-
for (auto& mcIt : addMCSignals) {
405+
for (const auto& mcIt : addMCSignals) {
406406
if (mcIt != nullptr) {
407407
fMCSignals.push_back(mcIt);
408408
}
409409
}
410410
}
411411

412-
for (auto& mcIt : fMCSignals) {
412+
for (const auto& mcIt : fMCSignals) {
413413
if (fConfigHistOutput.fConfigQA) {
414414
histClasses += Form("MCTruth_%s;", mcIt->GetName());
415415
}
416416
if (fDoDetailedQA) {
417417
if (isBarrelEnabled) {
418418
// in case of detailed QA, setup histogram directories for each combination of reconstructed track cuts and MC signals
419-
for (auto& cut : fTrackCuts) {
419+
for (const auto& cut : fTrackCuts) {
420420
histClasses += Form("TrackBarrel_%s_%s;", cut->GetName(), mcIt->GetName());
421421
}
422422
}
423423
if (isMuonEnabled) {
424424
// in case of detailed QA, setup histogram directories for each combination of reconstructed muon cuts and MC signals
425-
for (auto& cut : fMuonCuts) {
425+
for (const auto& cut : fMuonCuts) {
426426
histClasses += Form("Muons_%s_%s;", cut->GetName(), mcIt->GetName());
427427
}
428428
}
@@ -476,7 +476,7 @@ struct TableMakerMC {
476476
TString addEvCutsStr = fConfigCuts.fConfigEventCutsJSON.value;
477477
if (addEvCutsStr != "") {
478478
std::vector<AnalysisCut*> addEvCuts = dqcuts::GetCutsFromJSON(addEvCutsStr.Data());
479-
for (auto& cutIt : addEvCuts) {
479+
for (const auto& cutIt : addEvCuts) {
480480
fEventCut->AddCut(cutIt);
481481
}
482482
}
@@ -493,7 +493,7 @@ struct TableMakerMC {
493493
TString addTrackCutsStr = fConfigCuts.fConfigTrackCutsJSON.value;
494494
if (addTrackCutsStr != "") {
495495
std::vector<AnalysisCut*> addTrackCuts = dqcuts::GetCutsFromJSON(addTrackCutsStr.Data());
496-
for (auto& t : addTrackCuts) {
496+
for (const auto& t : addTrackCuts) {
497497
fTrackCuts.push_back(static_cast<AnalysisCompositeCut*>(t));
498498
}
499499
}
@@ -510,7 +510,7 @@ struct TableMakerMC {
510510
TString addMuonCutsStr = fConfigCuts.fConfigMuonCutsJSON.value;
511511
if (addMuonCutsStr != "") {
512512
std::vector<AnalysisCut*> addMuonCuts = dqcuts::GetCutsFromJSON(addMuonCutsStr.Data());
513-
for (auto& t : addMuonCuts) {
513+
for (const auto& t : addMuonCuts) {
514514
fMuonCuts.push_back(static_cast<AnalysisCompositeCut*>(t));
515515
}
516516
}
@@ -532,7 +532,7 @@ struct TableMakerMC {
532532
VarManager::ResetValues(0, VarManager::kNVars);
533533

534534
// Loop over MC collisions
535-
for (auto& mcCollision : mcCollisions) {
535+
for (const auto& mcCollision : mcCollisions) {
536536
// Get MC collision information into the VarManager
537537
VarManager::FillEvent<gkEventMcFillMapWithCent>(mcCollision);
538538
// Fill histograms
@@ -559,11 +559,11 @@ struct TableMakerMC {
559559
auto mcflags = static_cast<uint16_t>(0); // flags which will hold the decisions for each MC signal
560560
int trackCounter = 0;
561561

562-
for (auto& mctrack : mcTracks) {
562+
for (const auto& mctrack : mcTracks) {
563563
// check all the requested MC signals and fill the decision bit map
564564
mcflags = 0;
565565
int i = 0;
566-
for (auto& sig : fMCSignals) {
566+
for (const auto& sig : fMCSignals) {
567567
bool checked = false;
568568
if constexpr (soa::is_soa_filtered_v<aod::McParticles>) {
569569
auto mctrack_raw = mcTracks.rawIteratorAt(mctrack.globalIndex());
@@ -587,7 +587,7 @@ struct TableMakerMC {
587587
PrintBitMap(mcflags, 16);
588588
cout << endl;
589589
if (mctrack.has_mothers()) {
590-
for (auto& m : mctrack.mothersIds()) {
590+
for (const auto& m : mctrack.mothersIds()) {
591591
if (m < mcTracks.size()) { // protect against bad mother indices
592592
auto aMother = mcTracks.rawIteratorAt(m);
593593
cout << "<<<<<< mother idx / pdg: " << m << " / " << aMother.pdgCode() << endl;
@@ -949,13 +949,13 @@ struct TableMakerMC {
949949
int i = 0; // runs over the MC signals
950950
int j = 0; // runs over the track cuts
951951
// check all the specified signals and fill histograms for MC truth matched tracks
952-
for (auto& sig : fMCSignals) {
952+
for (const auto& sig : fMCSignals) {
953953
if (sig->CheckSignal(true, mctrack)) {
954954
mcflags |= (static_cast<uint16_t>(1) << i);
955955
// If detailed QA is on, fill histograms for each MC signal and track cut combination
956956
if (fDoDetailedQA) {
957957
j = 0;
958-
for (auto& cut : fTrackCuts) {
958+
for (const auto& cut : fTrackCuts) {
959959
if (trackTempFilterMap & (uint8_t(1) << j)) {
960960
fHistMan->FillHistClass(Form("TrackBarrel_%s_%s", cut->GetName(), sig->GetName()), dqtablemakermc_helpers::varValues()); // fill the reconstructed truth
961961
}
@@ -1014,7 +1014,7 @@ struct TableMakerMC {
10141014
mcflags = 0;
10151015
int i = 0; // runs over the MC signals
10161016
// check all the specified signals and fill histograms for MC truth matched tracks
1017-
for (auto& sig : fMCSignals) {
1017+
for (const auto& sig : fMCSignals) {
10181018
if (sig->CheckSignal(true, mctrack)) {
10191019
mcflags |= (static_cast<uint16_t>(1) << i);
10201020
// If detailed QA is on, fill histograms for each MC signal and track cut combination
@@ -1057,7 +1057,7 @@ struct TableMakerMC {
10571057
}
10581058
}
10591059
}
1060-
for (auto& pairCand : mCandidates) {
1060+
for (const auto& pairCand : mCandidates) {
10611061
fBestMatch[pairCand.second.second] = true;
10621062
}
10631063
}
@@ -1091,7 +1091,7 @@ struct TableMakerMC {
10911091
}
10921092
}
10931093
}
1094-
for (auto& pairCand : mCandidates) {
1094+
for (const auto& pairCand : mCandidates) {
10951095
fBestMatch[pairCand.second.second] = true;
10961096
}
10971097
}
@@ -1196,12 +1196,12 @@ struct TableMakerMC {
11961196
int i = 0; // runs over the MC signals
11971197
int j = 0; // runs over the track cuts
11981198
// check all the specified signals and fill histograms for MC truth matched tracks
1199-
for (auto& sig : fMCSignals) {
1199+
for (const auto& sig : fMCSignals) {
12001200
if (sig->CheckSignal(true, mctrack)) {
12011201
mcflags |= (static_cast<uint16_t>(1) << i);
12021202
if (fDoDetailedQA) {
12031203
j = 0;
1204-
for (auto& cut : fMuonCuts) {
1204+
for (const auto& cut : fMuonCuts) {
12051205
if (trackTempFilterMap & (uint8_t(1) << j)) {
12061206
fHistMan->FillHistClass(Form("Muons_%s_%s", cut->GetName(), sig->GetName()), dqtablemakermc_helpers::varValues()); // fill the reconstructed truth
12071207
}
@@ -1402,7 +1402,7 @@ struct TableMakerMC {
14021402
}
14031403

14041404
if constexpr (static_cast<bool>(TMFTFillMap & VarManager::ObjTypes::MFTCov)) {
1405-
for (auto& mfttrackConv : mftCovs) {
1405+
for (const auto& mfttrackConv : mftCovs) {
14061406
map_mfttrackcovs[mfttrackConv.matchMFTTrackId()] = mfttrackConv.globalIndex();
14071407
}
14081408
}
@@ -1452,7 +1452,7 @@ struct TableMakerMC {
14521452

14531453
std::vector<int> mothers;
14541454
if (mctrack.has_mothers()) {
1455-
for (auto& m : mctrack.mothersIds()) {
1455+
for (const auto& m : mctrack.mothersIds()) {
14561456
if (m < mcParticles.size()) { // protect against bad mother indices
14571457
if (fLabelsMap.contains(m)) {
14581458
mothers.push_back(fLabelsMap.find(m)->second);
@@ -1662,7 +1662,7 @@ struct TableMakerMC {
16621662
{
16631663
fullSkimming<gkEventFillMapWithCentAndMults, 0u, gkMuonFillMapWithCov, gkMFTFillMap, gkEventMcFillMapWithCent>(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr);
16641664
/*LOGP(info, "---------------------------");
1665-
for (auto& mcCollision : mcCollisions) {
1665+
for (const auto& mcCollision : mcCollisions) {
16661666
LOGP(info, "Gen. FT0C centrality = {}", mcCollision.bestCollisionCentFT0C());
16671667
//LOGP(info, "Gen. FT0C centrality = {}", mcCollision.posZ());
16681668
}

0 commit comments

Comments
 (0)