Skip to content

Commit e0f5b02

Browse files
authored
Fixing const-ref-in-for-loop
1 parent ee404b9 commit e0f5b02

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

PWGUD/TableProducer/SGCandProducer.cxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ struct SGCandProducer {
366366
}
367367
// update SGTracks tables
368368
if (fillTrackTables) {
369-
for (auto& track : tracks) {
369+
for (const auto& track : tracks) {
370370
if (track.pt() > sameCuts.minPt() && track.eta() > sameCuts.minEta() && track.eta() < sameCuts.maxEta()) {
371371
if (track.isPVContributor()) {
372372
updateUDTrackTables(outputCollisions.lastIndex(), track, bc.globalBC());
@@ -381,7 +381,7 @@ struct SGCandProducer {
381381
// update SGFwdTracks tables
382382
if (fillFwdTrackTables) {
383383
if (sameCuts.withFwdTracks()) {
384-
for (auto& fwdtrack : fwdtracks) {
384+
for (const auto& fwdtrack : fwdtracks) {
385385
if (!sgSelector.FwdTrkSelector(fwdtrack))
386386
updateUDFwdTrackTables(fwdtrack, bc.globalBC());
387387
}
@@ -411,7 +411,7 @@ struct SGCandProducer {
411411
auto hCountersTrgBcSel = getHist(TH1, "reco/hCountersTrgBcSel");
412412
auto hLumi = getHist(TH1, "reco/hLumi");
413413
auto hLumiBcSel = getHist(TH1, "reco/hLumiBcSel");
414-
for (auto h : {hCountersTrg, hCountersTrgBcSel, hLumi, hLumiBcSel}) {
414+
for (const auto h : {hCountersTrg, hCountersTrgBcSel, hLumi, hLumiBcSel}) {
415415
h->GetXaxis()->SetBinLabel(1, "TVX");
416416
h->GetXaxis()->SetBinLabel(2, "TCE");
417417
h->GetXaxis()->SetBinLabel(3, "ZEM");
@@ -534,7 +534,7 @@ struct McSGCandProducer {
534534
// This is needed to be able to assign the new daughter indices
535535
std::map<int64_t, int64_t> oldnew;
536536
auto lastId = outputMcParticles.lastIndex();
537-
for (auto mcpart : McParts) {
537+
for (const auto& mcpart : McParts) {
538538
auto oldId = mcpart.globalIndex();
539539
if (mcPartIsSaved.find(oldId) != mcPartIsSaved.end()) {
540540
oldnew[oldId] = mcPartIsSaved[oldId];
@@ -550,7 +550,7 @@ struct McSGCandProducer {
550550
// mothers
551551
newmids.clear();
552552
auto oldmids = mcpart.mothersIds();
553-
for (auto oldmid : oldmids) {
553+
for (const auto& oldmid : oldmids) {
554554
auto m = McParts.rawIteratorAt(oldmid);
555555
if (verboseInfoMC)
556556
LOGF(debug, " m %d", m.globalIndex());
@@ -617,7 +617,7 @@ struct McSGCandProducer {
617617
void updateUDMcTrackLabels(TTrack const& udtracks, std::map<int64_t, int64_t>& mcPartIsSaved)
618618
{
619619
// loop over all tracks
620-
for (auto udtrack : udtracks) {
620+
for (const auto& udtrack : udtracks) {
621621
// udtrack (UDTCs) -> track (TCs) -> mcTrack (McParticles) -> udMcTrack (UDMcParticles)
622622
auto trackId = udtrack.trackId();
623623
if (trackId >= 0) {
@@ -727,7 +727,7 @@ struct McSGCandProducer {
727727

728728
// update UDMcParticles and UDMcTrackLabels (for each UDTrack -> UDMcParticles)
729729
// loop over tracks of dgcand
730-
for (auto sgtrack : sgTracks) {
730+
for (const auto& sgtrack : sgTracks) {
731731
if (sgtrack.has_track()) {
732732
auto track = sgtrack.track_as<TCs>();
733733
if (track.has_mcParticle()) {

0 commit comments

Comments
 (0)