Skip to content

Commit 59b56c0

Browse files
committed
const-ref-in-for-loop
1 parent 9002cef commit 59b56c0

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

PWGDQ/Core/HistogramsLibrary.cxx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2527,7 +2527,7 @@ bool o2::aod::dqhistograms::ValidateJSONHistogram(T hist)
25272527
LOG(fatal) << "histClass field should be an array of strings, e.g. [class1, class2]";
25282528
return false;
25292529
}
2530-
for (auto& v : hist->FindMember("histClass")->value.GetArray()) {
2530+
for (const auto& v : hist->FindMember("histClass")->value.GetArray()) {
25312531
if (!v.IsString()) {
25322532
LOG(fatal) << "histClass field should be an array of strings, e.g. [class1, class2]";
25332533
return false;
@@ -2682,7 +2682,7 @@ bool o2::aod::dqhistograms::ValidateJSONHistogram(T hist)
26822682
}
26832683
}
26842684
if (isTHn) {
2685-
for (auto& v : hist->FindMember("vars")->value.GetArray()) {
2685+
for (const auto& v : hist->FindMember("vars")->value.GetArray()) {
26862686
if (VarManager::fgVarNamesMap.find(v.GetString()) == VarManager::fgVarNamesMap.end()) {
26872687
LOG(fatal) << "Bad variable in vars (" << v.GetString() << ") specified for histogram";
26882688
return false;
@@ -2745,7 +2745,7 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch
27452745

27462746
// create an array of strings to store the different histogram classes
27472747
std::vector<const char*> histClasses;
2748-
for (auto& v : hist.FindMember("histClass")->value.GetArray()) {
2748+
for (const auto& v : hist.FindMember("histClass")->value.GetArray()) {
27492749
histClasses.push_back(v.GetString());
27502750
}
27512751
const char* title = hist.FindMember("title")->value.GetString();
@@ -2756,7 +2756,7 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch
27562756

27572757
int* vars = new int[nDimensions];
27582758
int iDim = 0;
2759-
for (auto& v : hist.FindMember("vars")->value.GetArray()) {
2759+
for (const auto& v : hist.FindMember("vars")->value.GetArray()) {
27602760
LOG(debug) << "iDim " << iDim << ": " << v.GetString();
27612761
vars[iDim++] = VarManager::fgVarNamesMap[v.GetString()];
27622762
}
@@ -2770,27 +2770,27 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch
27702770
xmin = new double[nDimensions];
27712771
xmax = new double[nDimensions];
27722772
iDim = 0;
2773-
for (auto& v : hist.FindMember("nBins")->value.GetArray()) {
2773+
for (const auto& v : hist.FindMember("nBins")->value.GetArray()) {
27742774
nBins[iDim++] = v.GetInt();
27752775
LOG(debug) << "nBins " << iDim << ": " << nBins[iDim - 1];
27762776
}
27772777
iDim = 0;
2778-
for (auto& v : hist.FindMember("xmin")->value.GetArray()) {
2778+
for (const auto& v : hist.FindMember("xmin")->value.GetArray()) {
27792779
xmin[iDim++] = v.GetDouble();
27802780
LOG(debug) << "xmin " << iDim << ": " << xmin[iDim - 1];
27812781
}
27822782
iDim = 0;
2783-
for (auto& v : hist.FindMember("xmax")->value.GetArray()) {
2783+
for (const auto& v : hist.FindMember("xmax")->value.GetArray()) {
27842784
xmax[iDim++] = v.GetDouble();
27852785
LOG(debug) << "xmax " << iDim << ": " << xmax[iDim - 1];
27862786
}
27872787
} else {
27882788
iDim = 0;
27892789
binLimits = new TArrayD[nDimensions];
2790-
for (auto& v : hist.FindMember("binLimits")->value.GetArray()) {
2790+
for (const auto& v : hist.FindMember("binLimits")->value.GetArray()) {
27912791
auto* lims = new double[v.GetArray().Size()];
27922792
int iElem = 0;
2793-
for (auto& lim : v.GetArray()) {
2793+
for (const auto& lim : v.GetArray()) {
27942794
lims[iElem++] = lim.GetDouble();
27952795
}
27962796
binLimits[iDim++] = TArrayD(v.GetArray().Size(), lims);
@@ -2802,7 +2802,7 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch
28022802
if (hist.HasMember("axLabels")) {
28032803
axLabels = new TString[hist.FindMember("axLabels")->value.GetArray().Size()];
28042804
iDim = 0;
2805-
for (auto& v : hist.FindMember("axLabels")->value.GetArray()) {
2805+
for (const auto& v : hist.FindMember("axLabels")->value.GetArray()) {
28062806
axLabels[iDim++] = v.GetString();
28072807
}
28082808
}
@@ -2812,11 +2812,11 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch
28122812
bool isDouble = (hist.HasMember("isDouble") ? hist.FindMember("isDouble")->value.GetBool() : false);
28132813

28142814
if (isConstantBinning) {
2815-
for (auto histClass : histClasses) {
2815+
for (const auto& histClass : histClasses) {
28162816
hm->AddHistogram(histClass, histName, title, nDimensions, vars, nBins, xmin, xmax, axLabels, varW, useSparse, isDouble);
28172817
}
28182818
} else {
2819-
for (auto histClass : histClasses) {
2819+
for (const auto& histClass : histClasses) {
28202820
hm->AddHistogram(histClass, histName, title, nDimensions, vars, binLimits, axLabels, varW, useSparse, isDouble);
28212821
}
28222822
}
@@ -2853,7 +2853,7 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch
28532853
std::vector<double> xbinsVec;
28542854
if (hist.HasMember("xbins")) {
28552855
LOG(debug) << "xbins: ";
2856-
for (auto& v : hist.FindMember("xbins")->value.GetArray()) {
2856+
for (const auto& v : hist.FindMember("xbins")->value.GetArray()) {
28572857
xbinsVec.push_back(v.GetDouble());
28582858
LOG(debug) << v.GetDouble();
28592859
}
@@ -2874,7 +2874,7 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch
28742874
std::vector<double> ybinsVec;
28752875
if (hist.HasMember("ybins")) {
28762876
LOG(debug) << "ybins: ";
2877-
for (auto& v : hist.FindMember("ybins")->value.GetArray()) {
2877+
for (const auto& v : hist.FindMember("ybins")->value.GetArray()) {
28782878
ybinsVec.push_back(v.GetDouble());
28792879
LOG(debug) << v.GetDouble();
28802880
}
@@ -2895,7 +2895,7 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch
28952895
std::vector<double> zbinsVec;
28962896
if (hist.HasMember("zbins")) {
28972897
LOG(debug) << "zbins: ";
2898-
for (auto& v : hist.FindMember("zbins")->value.GetArray()) {
2898+
for (const auto& v : hist.FindMember("zbins")->value.GetArray()) {
28992899
zbinsVec.push_back(v.GetDouble());
29002900
LOG(debug) << v.GetDouble();
29012901
}
@@ -2923,7 +2923,7 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch
29232923
LOG(debug) << "isFillLabelx: " << isFillLabelx;
29242924

29252925
if (isConstantBinning) {
2926-
for (auto histClass : histClasses) {
2926+
for (const auto& histClass : histClasses) {
29272927
hm->AddHistogram(histClass, histName, title, isProfile,
29282928
nXbins, xmin, xmax, VarManager::fgVarNamesMap[varX],
29292929
nYbins, ymin, ymax, VarManager::fgVarNamesMap[varY],
@@ -2954,7 +2954,7 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch
29542954
}
29552955
zbins = zbinsVec.data();
29562956
}
2957-
for (auto histClass : histClasses) {
2957+
for (const auto& histClass : histClasses) {
29582958
hm->AddHistogram(histClass, histName, title, isProfile,
29592959
nXbins, xbinsVec.data(), VarManager::fgVarNamesMap[varX],
29602960
nYbins, ybins, VarManager::fgVarNamesMap[varY],

0 commit comments

Comments
 (0)