@@ -2794,6 +2794,7 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch
27942794 lims[iElem++] = lim.GetDouble ();
27952795 }
27962796 binLimits[iDim++] = TArrayD (v.GetArray ().Size (), lims);
2797+ delete[] lims;
27972798 }
27982799 }
27992800
@@ -2820,6 +2821,16 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch
28202821 }
28212822 }
28222823
2824+ delete[] vars;
2825+ if (isConstantBinning) {
2826+ delete[] nBins;
2827+ delete[] xmin;
2828+ delete[] xmax;
2829+ } else {
2830+ delete[] binLimits;
2831+ }
2832+ delete[] axLabels;
2833+
28232834 } else { // TH1, TH2 or TH3
28242835
28252836 LOG (debug) << " is TH1, TH2 or TH3 " ;
@@ -2921,36 +2932,31 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch
29212932 VarManager::fgVarNamesMap[varT], VarManager::fgVarNamesMap[varW], isdouble, isFillLabelx);
29222933 }
29232934 } else {
2924- int xBinsSize = xbinsVec.size ();
2925- if (xBinsSize != (nXbins + 1 )) {
2935+ if (static_cast <int >(xbinsVec.size ()) != (nXbins + 1 )) {
29262936 LOG (fatal) << " Histogram not properly defined in the JSON file. Wrong x binning for histogram" ;
29272937 continue ;
29282938 }
2929- auto * xbins = new double [xbinsVec.size ()];
2930- std::copy (xbinsVec.begin (), xbinsVec.end (), xbins);
29312939
29322940 double * ybins = nullptr ;
29332941 if (isTH2 || isTH3) {
29342942 if (static_cast <int >(ybinsVec.size ()) != (nYbins + 1 )) {
29352943 LOG (fatal) << " Histogram not properly defined in the JSON file. Wrong y binning for histogram" ;
29362944 continue ;
29372945 }
2938- ybins = new double [ybinsVec.size ()];
2939- std::copy (ybinsVec.begin (), ybinsVec.end (), ybins);
2946+ ybins = ybinsVec.data ();
29402947 }
29412948
29422949 double * zbins = nullptr ;
29432950 if (isTH3) {
2944- if (static_cast <float >(zbinsVec.size ()) != (nZbins + 1 )) {
2951+ if (static_cast <int >(zbinsVec.size ()) != (nZbins + 1 )) {
29452952 LOG (fatal) << " Histogram not properly defined in the JSON file. Wrong z binning for histogram" ;
29462953 continue ;
29472954 }
2948- zbins = new double [zbinsVec.size ()];
2949- std::copy (zbinsVec.begin (), zbinsVec.end (), zbins);
2955+ zbins = zbinsVec.data ();
29502956 }
29512957 for (auto histClass : histClasses) {
29522958 hm->AddHistogram (histClass, histName, title, isProfile,
2953- nXbins, xbins , VarManager::fgVarNamesMap[varX],
2959+ nXbins, xbinsVec. data () , VarManager::fgVarNamesMap[varX],
29542960 nYbins, ybins, VarManager::fgVarNamesMap[varY],
29552961 nZbins, zbins, VarManager::fgVarNamesMap[varZ],
29562962 xLabels, yLabels, zLabels,
0 commit comments