From ba47b0866be5310cf6e5923299765e7f56c73e7c Mon Sep 17 00:00:00 2001
From: Julien Nabet <serval2412@yahoo.fr>
Date: Sat, 11 Nov 2017 07:09:04 +0100
Subject: [PATCH] clang format

(cherry picked from commit a4235ec91bdf35b2356855cac3fa19710259e4fd)
---
 geom/geom/src/TGeoManager.cxx            |  3 +-
 graf2d/graf/src/TMathText.cxx            |  5 +-
 graf2d/mathtext/src/fontembed.cxx        |  3 +-
 graf2d/mathtext/src/fontembedps.cxx      |  5 +-
 graf2d/mathtext/src/mathrender.cxx       | 15 +++---
 graf2d/mathtext/src/mathrendertoken.cxx  |  5 +-
 graf2d/mathtext/src/mathtext.cxx         |  8 ++-
 graf2d/mathtext/src/mathtextparse.cxx    |  8 ++-
 graf2d/mathtext/src/mathtextview.cxx     |  9 ++--
 graf3d/eve/src/TEveCalo2DGL.cxx          | 12 ++---
 graf3d/eve/src/TEveCaloLegoGL.cxx        |  7 +--
 graf3d/eve/src/TEvePointSet.cxx          |  2 +-
 graf3d/gl/src/TGLCameraOverlay.cxx       |  6 +--
 hist/hist/src/TFormula.cxx               |  9 ++--
 hist/hist/src/TGraphSmooth.cxx           |  3 +-
 hist/hist/src/TPrincipal.cxx             |  6 +--
 hist/histpainter/src/TGraph2DPainter.cxx |  4 +-
 hist/unfold/src/TUnfold.cxx              | 63 +++++++++++-------------
 hist/unfold/src/TUnfoldDensity.cxx       | 10 ++--
 19 files changed, 80 insertions(+), 103 deletions(-)

diff --git a/geom/geom/src/TGeoManager.cxx b/geom/geom/src/TGeoManager.cxx
index 03c2c80c81b..d75eb4e7bf8 100644
--- a/geom/geom/src/TGeoManager.cxx
+++ b/geom/geom/src/TGeoManager.cxx
@@ -919,8 +919,7 @@ void TGeoManager::ClearNavigators()
 void TGeoManager::RemoveNavigator(const TGeoNavigator *nav)
 {
    if (fMultiThread) fgMutex.lock();
-   for (NavigatorsMap_t::iterator it = fNavigators.begin();
-        it != fNavigators.end(); ++it) {
+   for (NavigatorsMap_t::iterator it = fNavigators.begin(); it != fNavigators.end(); ++it) {
       TGeoNavigatorArray *arr = (*it).second;
       if (arr) {
          if ((TGeoNavigator*)arr->Remove((TObject*)nav)) {
diff --git a/graf2d/graf/src/TMathText.cxx b/graf2d/graf/src/TMathText.cxx
index e01bb049e04..cb115b4a17d 100644
--- a/graf2d/graf/src/TMathText.cxx
+++ b/graf2d/graf/src/TMathText.cxx
@@ -279,7 +279,7 @@ public:
          bounding_box(*iterator, current_x, family);
 
       ++iterator;
-      for(; iterator != string.end(); ++iterator) {
+      for (; iterator != string.end(); ++iterator) {
          const mathtext::point_t position =
             mathtext::point_t(current_x, 0);
          const mathtext::bounding_box_t glyph_bounding_box =
@@ -302,8 +302,7 @@ public:
       float advance = 0;
 
       buf[1] = L'\0';
-      for(std::wstring::const_iterator iterator = string.begin();
-         iterator != string.end(); ++iterator) {
+      for (std::wstring::const_iterator iterator = string.begin(); iterator != string.end(); ++iterator) {
          buf[0] = *iterator;
          const bool cyrillic_or_cjk = is_cyrillic_or_cjk(buf[0]);
 
diff --git a/graf2d/mathtext/src/fontembed.cxx b/graf2d/mathtext/src/fontembed.cxx
index aa29ecf4858..c016b816a71 100644
--- a/graf2d/mathtext/src/fontembed.cxx
+++ b/graf2d/mathtext/src/fontembed.cxx
@@ -1012,8 +1012,7 @@ namespace mathtext {
 
                                         if (char_strings.empty() && !cid_map.empty()) {
                                            char_strings.resize(cid_map.size());
-                                           for (std::map<wchar_t, uint16_t>::const_iterator iterator =
-                                                cid_map.begin();
+                                           for (std::map<wchar_t, uint16_t>::const_iterator iterator = cid_map.begin();
                                                 iterator != cid_map.end(); ++iterator) {
                                               if (iterator->second < char_strings.size()) {
 #include "table/adobeglyphlist.h"
diff --git a/graf2d/mathtext/src/fontembedps.cxx b/graf2d/mathtext/src/fontembedps.cxx
index 3e959bed1a5..a1ec4284840 100644
--- a/graf2d/mathtext/src/fontembedps.cxx
+++ b/graf2d/mathtext/src/fontembedps.cxx
@@ -443,9 +443,8 @@ namespace mathtext {
 
       unsigned int char_strings_count = 0;
 
-      for (std::vector<std::string>::const_iterator iterator =
-           char_strings.begin();
-           iterator < char_strings.end(); ++iterator) {
+      for (std::vector<std::string>::const_iterator iterator = char_strings.begin(); iterator < char_strings.end();
+           ++iterator) {
          if (!iterator->empty()) {
             char_strings_count++;
          }
diff --git a/graf2d/mathtext/src/mathrender.cxx b/graf2d/mathtext/src/mathrender.cxx
index 7d7ecc7c757..b200c5f0fcb 100644
--- a/graf2d/mathtext/src/mathrender.cxx
+++ b/graf2d/mathtext/src/mathrender.cxx
@@ -313,7 +313,7 @@ namespace mathtext {
       bounding_box_t ret = iterator->_offset +
       iterator->_bounding_box;
 
-      for(; iterator != token.end(); ++iterator)
+      for (; iterator != token.end(); ++iterator)
          ret = ret.merge(iterator->_offset +
                          iterator->_bounding_box);
 
@@ -332,9 +332,7 @@ namespace mathtext {
       std::vector<math_token_t> token =
       math_tokenize(math_symbol, style, height);
 
-      for(std::vector<math_token_t>::const_iterator iterator =
-          token.begin();
-          iterator != token.end(); ++iterator)
+      for (std::vector<math_token_t>::const_iterator iterator = token.begin(); iterator != token.end(); ++iterator)
          math_text(origin +
                    transform_pixel_to_logical().linear() *
                    iterator->_offset,
@@ -365,7 +363,7 @@ namespace mathtext {
       bounding_box_t ret = iterator->_offset +
       iterator->_bounding_box;
 
-      for(; iterator != token.end(); ++iterator)
+      for (; iterator != token.end(); ++iterator)
          ret = ret.merge(iterator->_offset +
                          iterator->_bounding_box);
 
@@ -457,9 +455,8 @@ namespace mathtext {
       }
       else
          // Incrementally process a math list
-         for(std::vector<math_text_t::item_t>::const_iterator
-             iterator = math_list_begin_interior;
-             iterator != math_list_end_interior; ++iterator) {
+         for (std::vector<math_text_t::item_t>::const_iterator iterator = math_list_begin_interior;
+              iterator != math_list_end_interior; ++iterator) {
             switch(iterator->_type) {
                case math_text_t::item_t::TYPE_ATOM:
                   if(render_structure)
@@ -558,7 +555,7 @@ namespace mathtext {
       bounding_box_t ret = iterator->_offset +
       iterator->_bounding_box;
 
-      for(; iterator != token.end(); ++iterator)
+      for (; iterator != token.end(); ++iterator)
          ret = ret.merge(iterator->_offset +
                          iterator->_bounding_box);
 
diff --git a/graf2d/mathtext/src/mathrendertoken.cxx b/graf2d/mathtext/src/mathrendertoken.cxx
index a7342233a9f..420c4aa0da7 100644
--- a/graf2d/mathtext/src/mathrendertoken.cxx
+++ b/graf2d/mathtext/src/mathrendertoken.cxx
@@ -381,9 +381,8 @@ namespace mathtext {
       }
       else
          // Incrementally process a math list
-         for(std::vector<math_text_t::item_t>::const_iterator
-             iterator = math_list_begin_interior;
-             iterator != math_list_end_interior; ++iterator) {
+         for (std::vector<math_text_t::item_t>::const_iterator iterator = math_list_begin_interior;
+              iterator != math_list_end_interior; ++iterator) {
             unsigned int atom_type;
             bounding_box_t item_bounding_box;
             unsigned int current_style = has_accent ?
diff --git a/graf2d/mathtext/src/mathtext.cxx b/graf2d/mathtext/src/mathtext.cxx
index ab46261cd0e..681fdd41273 100644
--- a/graf2d/mathtext/src/mathtext.cxx
+++ b/graf2d/mathtext/src/mathtext.cxx
@@ -149,9 +149,8 @@ namespace mathtext {
    bool math_text_t::field_t::generalized_fraction(void) const
    {
       if(_type == TYPE_MATH_LIST)
-         for(std::vector<item_t>::const_iterator iterator =
-             _math_list.begin();
-             iterator != _math_list.end(); ++iterator)
+         for (std::vector<item_t>::const_iterator iterator = _math_list.begin(); iterator != _math_list.end();
+              ++iterator)
             if(iterator->_type ==
                item_t::TYPE_GENERALIZED_FRACTION)
                return true;
@@ -223,8 +222,7 @@ namespace mathtext {
    {
       std::wstring wstring;
 
-      for(std::string::const_iterator iterator = string.begin();
-          iterator != string.end(); ++iterator) {
+      for (std::string::const_iterator iterator = string.begin(); iterator != string.end(); ++iterator) {
          wstring.push_back(*iterator);
       }
 
diff --git a/graf2d/mathtext/src/mathtextparse.cxx b/graf2d/mathtext/src/mathtextparse.cxx
index a2f93f3e24b..e9e6e64d22b 100644
--- a/graf2d/mathtext/src/mathtextparse.cxx
+++ b/graf2d/mathtext/src/mathtextparse.cxx
@@ -61,9 +61,8 @@ namespace mathtext {
       std::vector<std::string> radical_index;
       bool horizontal_box = false;
 
-      for(std::vector<std::string>::const_iterator iterator =
-          str_split.begin();
-          iterator != str_split.end(); ++iterator) {
+      for (std::vector<std::string>::const_iterator iterator = str_split.begin(); iterator != str_split.end();
+           ++iterator) {
          // ONLY LEVEL 0 superscript and subscript are interpreted,
          // and they are ignored afterwards.
          if(level == 0 && delimiter_level == 0) {
@@ -344,8 +343,7 @@ namespace mathtext {
    {
       std::string code = raw_code;
 
-      for(std::string::iterator iterator = code.begin();
-          iterator != code.end(); ++iterator) {
+      for (std::string::iterator iterator = code.begin(); iterator != code.end(); ++iterator) {
          if(*iterator == escape_character) {
             *iterator = '\\';
          }
diff --git a/graf2d/mathtext/src/mathtextview.cxx b/graf2d/mathtext/src/mathtextview.cxx
index 96c9b3e299a..ea17f8cb975 100644
--- a/graf2d/mathtext/src/mathtextview.cxx
+++ b/graf2d/mathtext/src/mathtextview.cxx
@@ -32,9 +32,7 @@ namespace mathtext {
    {
       if(branch.size() > 0) {
          std::cerr << ' ';
-         for(std::vector<bool>::const_iterator iterator =
-             branch.begin();
-             iterator != branch.end(); ++iterator) {
+         for (std::vector<bool>::const_iterator iterator = branch.begin(); iterator != branch.end(); ++iterator) {
             if(*iterator) {
                if(iterator + 1 == branch.end()) {
                   if(final)
@@ -83,9 +81,8 @@ namespace mathtext {
                std::vector<bool> branch_copy = branch;
 
                branch_copy.back() = !final;
-               for(std::vector<item_t>::const_iterator iterator =
-                   field._math_list.begin();
-                   iterator != field._math_list.end(); ++iterator) {
+               for (std::vector<item_t>::const_iterator iterator = field._math_list.begin();
+                    iterator != field._math_list.end(); ++iterator) {
                   branch_copy.back() = !final;
                   branch_copy.push_back(true);
                   tree_view(*iterator, branch_copy,
diff --git a/graf3d/eve/src/TEveCalo2DGL.cxx b/graf3d/eve/src/TEveCalo2DGL.cxx
index 80e98623a27..605111df83c 100644
--- a/graf3d/eve/src/TEveCalo2DGL.cxx
+++ b/graf3d/eve/src/TEveCalo2DGL.cxx
@@ -166,8 +166,8 @@ void TEveCalo2DGL::DrawRPhiHighlighted(std::vector<TEveCaloData::vCellId_t*>& ce
       if (cellLists[phiBin])
       {
          if (!fM->fCellLists[phiBin]) {
-            delete [] sliceVal;
-            delete [] sliceValRef;
+            delete[] sliceVal;
+            delete[] sliceValRef;
             throw eh + "selected cell not in cell list cache.";
          }
 
@@ -369,10 +369,10 @@ void TEveCalo2DGL::DrawRhoZHighlighted(std::vector<TEveCaloData::vCellId_t*>& ce
       if (cellLists[etaBin])
       {
          if (!fM->fCellLists[etaBin]) {
-            delete [] sliceValsUp;
-            delete [] sliceValsLow;
-            delete [] sliceValsUpRef;
-            delete [] sliceValsLowRef;
+            delete[] sliceValsUp;
+            delete[] sliceValsLow;
+            delete[] sliceValsUpRef;
+            delete[] sliceValsLowRef;
             throw(eh + "selected cell not in cell list cache.");
          }
 
diff --git a/graf3d/eve/src/TEveCaloLegoGL.cxx b/graf3d/eve/src/TEveCaloLegoGL.cxx
index c02b2521fe9..ea9b026fd31 100644
--- a/graf3d/eve/src/TEveCaloLegoGL.cxx
+++ b/graf3d/eve/src/TEveCaloLegoGL.cxx
@@ -1155,7 +1155,8 @@ void TEveCaloLegoGL::DrawSelectedCells(TGLRnrCtx & rnrCtx, TEveCaloData::vCellId
       fM->fData->Rebin(fEtaAxis, fPhiAxis, cellsSelected, fM->fPlotEt, rebinDataSelected);
       if (fM->fNormalizeRebin) {
          Float_t scale = 1.f / (fBinStep * fBinStep);
-         for (std::vector<Float_t>::iterator it = rebinDataSelected.fSliceData.begin(); it != rebinDataSelected.fSliceData.end(); ++it)
+         for (std::vector<Float_t>::iterator it = rebinDataSelected.fSliceData.begin();
+              it != rebinDataSelected.fSliceData.end(); ++it)
             (*it) *= scale;
       }
    }
@@ -1296,8 +1297,8 @@ void TEveCaloLegoGL::DirectDraw(TGLRnrCtx & rnrCtx) const
          if (fM->fNormalizeRebin)
          {
             Float_t scale = 1.f / (fBinStep * fBinStep);
-            for (std::vector<Float_t>::iterator it = fRebinData.fSliceData.begin(); it != fRebinData.fSliceData.end(); ++it)
-            {
+            for (std::vector<Float_t>::iterator it = fRebinData.fSliceData.begin(); it != fRebinData.fSliceData.end();
+                 ++it) {
                (*it) *= scale;
             }
             fMaxVal *= scale;
diff --git a/graf3d/eve/src/TEvePointSet.cxx b/graf3d/eve/src/TEvePointSet.cxx
index bc039eef77a..26429424d64 100644
--- a/graf3d/eve/src/TEvePointSet.cxx
+++ b/graf3d/eve/src/TEvePointSet.cxx
@@ -351,7 +351,7 @@ void TEvePointSet::TakeAction(TEvePointSelector* sel)
       for (Int_t i=0; i<fIntIdsPerPoint; ++i) {
          subarr[i] = sel->GetVal(sel->GetDimension() - fIntIdsPerPoint + i);
          if (subarr[i] == 0) {
-            delete [] subarr;
+            delete[] subarr;
             throw(eh + "sub-id array not available.");
          }
       }
diff --git a/graf3d/gl/src/TGLCameraOverlay.cxx b/graf3d/gl/src/TGLCameraOverlay.cxx
index ae71db4ed00..2da30224ebc 100644
--- a/graf3d/gl/src/TGLCameraOverlay.cxx
+++ b/graf3d/gl/src/TGLCameraOverlay.cxx
@@ -246,8 +246,7 @@ void TGLCameraOverlay::RenderAxis(TGLRnrCtx& rnrCtx, Bool_t grid)
       // draw label vertical lines
       TGLUtil::ColorTransparency(lineColor, alpha);
       glBegin(GL_LINES);
-      for ( TGLAxisPainter::LabVec_t::iterator i = labs.begin(); i != labs.end(); ++i)
-      {
+      for (TGLAxisPainter::LabVec_t::iterator i = labs.begin(); i != labs.end(); ++i) {
          tmp = vy1 + xdir * (i->first);
          glVertex3dv(tmp.Arr());
          tmp = vy2 + xdir * (i->first);
@@ -323,8 +322,7 @@ void TGLCameraOverlay::RenderAxis(TGLRnrCtx& rnrCtx, Bool_t grid)
       // draw label horizontal lines
       TGLUtil::ColorTransparency(lineColor, alpha);
       glBegin(GL_LINES);
-      for ( TGLAxisPainter::LabVec_t::iterator i = labs.begin(); i != labs.end(); ++i)
-      {
+      for (TGLAxisPainter::LabVec_t::iterator i = labs.begin(); i != labs.end(); ++i) {
          tmp = vx1 + ydir *(i->first);
          glVertex3dv(tmp.Arr());
          tmp = vx2 + ydir *(i->first);
diff --git a/hist/hist/src/TFormula.cxx b/hist/hist/src/TFormula.cxx
index 6b90342aa3d..fd6417c39b9 100644
--- a/hist/hist/src/TFormula.cxx
+++ b/hist/hist/src/TFormula.cxx
@@ -2224,8 +2224,7 @@ void TFormula::ProcessFormula(TString &formula)
    // check that all formula components are matched otherwise emit an error
    if (!fClingInitialized) {
       Bool_t allFunctorsMatched = true;
-      for(list<TFormulaFunction>::iterator it = fFuncs.begin(); it != fFuncs.end(); ++it)
-         {
+      for (list<TFormulaFunction>::iterator it = fFuncs.begin(); it != fFuncs.end(); ++it) {
          if (!it->fFound) {
             allFunctorsMatched = false;
             if (it->GetNargs() == 0)
@@ -2734,8 +2733,7 @@ void TFormula::SetParameter(const char *name, Double_t value)
    fParams[name].fFound = true;
    fClingParameters[fParams[name].fArrayPos] = value;
    fAllParametersSetted = true;
-   for(map<TString,TFormulaVariable>::iterator it = fParams.begin(); it != fParams.end(); ++it)
-      {
+   for (map<TString, TFormulaVariable>::iterator it = fParams.begin(); it != fParams.end(); ++it) {
       if (!it->second.fFound) {
          fAllParametersSetted = false;
          break;
@@ -2767,8 +2765,7 @@ void TFormula::SetParameters(const pair<TString,Double_t> *params,const Int_t si
       fClingParameters[fParams[p.first].fArrayPos] = p.second;
    }
    fAllParametersSetted = true;
-   for(map<TString,TFormulaVariable>::iterator it = fParams.begin(); it != fParams.end(); ++it)
-      {
+   for (map<TString, TFormulaVariable>::iterator it = fParams.begin(); it != fParams.end(); ++it) {
       if (!it->second.fFound) {
          fAllParametersSetted = false;
          break;
diff --git a/hist/hist/src/TGraphSmooth.cxx b/hist/hist/src/TGraphSmooth.cxx
index 406bb7f5594..cf76225bea9 100644
--- a/hist/hist/src/TGraphSmooth.cxx
+++ b/hist/hist/src/TGraphSmooth.cxx
@@ -170,7 +170,8 @@ void TGraphSmooth::BDRksmooth(Double_t *x, Double_t *y, Int_t n, Double_t *xp,
       cutoff = 4*bw;
    }
 
-   while ((imin < n) && (x[imin] < xp[0] - cutoff)) imin++;
+   while ((imin < n) && (x[imin] < xp[0] - cutoff))
+      imin++;
 
    for (Int_t j=0;j<np;j++) {
       Double_t xx, w;
diff --git a/hist/hist/src/TPrincipal.cxx b/hist/hist/src/TPrincipal.cxx
index 8de6a230dc1..a206275fbeb 100644
--- a/hist/hist/src/TPrincipal.cxx
+++ b/hist/hist/src/TPrincipal.cxx
@@ -712,11 +712,11 @@ void TPrincipal::MakeHistograms(const char *name, Option_t *opt)
    }
    if (!makeX && !makeP && !makeD && !makeS) {
       if (hX)
-         delete [] hX;
+         delete[] hX;
       if (hD)
-         delete [] hD;
+         delete[] hD;
       if (hP)
-         delete [] hP;
+         delete[] hP;
       return;
    }
 
diff --git a/hist/histpainter/src/TGraph2DPainter.cxx b/hist/histpainter/src/TGraph2DPainter.cxx
index 4907c945ad8..bc3a3d75afc 100644
--- a/hist/histpainter/src/TGraph2DPainter.cxx
+++ b/hist/histpainter/src/TGraph2DPainter.cxx
@@ -413,7 +413,7 @@ TList *TGraph2DPainter::GetContourList(Double_t contour)
          js = 0;
 L01:
          findNew = kFALSE;
-         if (js<nbSeg && segUsed[js]) {
+         if (js < nbSeg && segUsed[js]) {
             js++;
             goto L01;
          } else if (xc==xs0[js] && yc==ys0[js]) {
@@ -452,7 +452,7 @@ L01:
       graph->SetPoint(npg,xc,yc); npg++;
 L02:
       findNew = kFALSE;
-      if (js<nbSeg && segUsed[js]) {
+      if (js < nbSeg && segUsed[js]) {
          js++;
          goto L02;
       } else if (xc==xs0[js] && yc==ys0[js]) {
diff --git a/hist/unfold/src/TUnfold.cxx b/hist/unfold/src/TUnfold.cxx
index 64bee8bfd3c..37862937c10 100644
--- a/hist/unfold/src/TUnfold.cxx
+++ b/hist/unfold/src/TUnfold.cxx
@@ -730,8 +730,7 @@ TMatrixDSparse *TUnfold::MultiplyMSparseTranspMSparse
    }
 
    Int_t n=0;
-   for(MMatrix_t::const_iterator irow=matrix.begin();
-       irow!=matrix.end();++irow) {
+   for (MMatrix_t::const_iterator irow = matrix.begin(); irow != matrix.end(); ++irow) {
       n += (*irow).second.size();
    }
    if(n>0) {
@@ -740,10 +739,8 @@ TMatrixDSparse *TUnfold::MultiplyMSparseTranspMSparse
       Int_t *r_cols=new Int_t[n];
       Double_t *r_data=new Double_t[n];
       n=0;
-      for(MMatrix_t::const_iterator irow=matrix.begin();
-          irow!=matrix.end();++irow) {
-         for(MMatrixRow_t::const_iterator icol=(*irow).second.begin();
-             icol!=(*irow).second.end();++icol) {
+      for (MMatrix_t::const_iterator irow = matrix.begin(); irow != matrix.end(); ++irow) {
+         for (MMatrixRow_t::const_iterator icol = (*irow).second.begin(); icol != (*irow).second.end(); ++icol) {
             r_rows[n]=(*irow).first;
             r_cols[n]=(*icol).first;
             r_data[n]=(*icol).second;
@@ -2694,17 +2691,17 @@ Int_t TUnfold::ScanLcurve(Int_t nPoint,
     i1=i0;
     Double_t logTau=(*i0).first;
     Double_t distMax=0.0;
-    for(++i1;i1!=curve.end();++i1) {
-      const std::pair<Double_t,Double_t> &xy0=(*i0).second;
-      const std::pair<Double_t,Double_t> &xy1=(*i1).second;
-      Double_t dx=xy1.first-xy0.first;
-      Double_t dy=xy1.second-xy0.second;
-      Double_t d=TMath::Sqrt(dx*dx+dy*dy);
-      if(d>=distMax) {
-        distMax=d;
-        logTau=0.5*((*i0).first+(*i1).first);
-      }
-      i0=i1;
+    for (++i1; i1 != curve.end(); ++i1) {
+       const std::pair<Double_t, Double_t> &xy0 = (*i0).second;
+       const std::pair<Double_t, Double_t> &xy1 = (*i1).second;
+       Double_t dx = xy1.first - xy0.first;
+       Double_t dy = xy1.second - xy0.second;
+       Double_t d = TMath::Sqrt(dx * dx + dy * dy);
+       if (d >= distMax) {
+          distMax = d;
+          logTau = 0.5 * ((*i0).first + (*i1).first);
+       }
+       i0 = i1;
     }
     DoUnfold(TMath::Power(10.,logTau));
     if((!TMath::Finite(GetLcurveX())) ||(!TMath::Finite(GetLcurveY()))) {
@@ -2734,11 +2731,11 @@ Int_t TUnfold::ScanLcurve(Int_t nPoint,
       Double_t *lXi=new Double_t[curve.size()]();
       Double_t *lYi=new Double_t[curve.size()]();
       Double_t *lTi=new Double_t[curve.size()]();
-      for( XYtau_t::const_iterator i=curve.begin();i!=curve.end();++i) {
-        lXi[n]=(*i).second.first;
-        lYi[n]=(*i).second.second;
-        lTi[n]=(*i).first;
-        n++;
+      for (XYtau_t::const_iterator i = curve.begin(); i != curve.end(); ++i) {
+         lXi[n] = (*i).second.first;
+         lYi[n] = (*i).second.second;
+         lTi[n] = (*i).first;
+         n++;
       }
       TSpline3 *splineX=new TSpline3("x vs tau",lTi,lXi,n);
       TSpline3 *splineY=new TSpline3("y vs tau",lTi,lYi,n);
@@ -2861,14 +2858,14 @@ Int_t TUnfold::ScanLcurve(Int_t nPoint,
     Double_t *y=new Double_t[curve.size()]();
     Double_t *logT=new Double_t[curve.size()]();
     int n=0;
-    for( XYtau_t::const_iterator i=curve.begin();i!=curve.end();++i) {
-      if(logTauFin==(*i).first) {
-        bestChoice=n;
-      }
-      x[n]=(*i).second.first;
-      y[n]=(*i).second.second;
-      logT[n]=(*i).first;
-      n++;
+    for (XYtau_t::const_iterator i = curve.begin(); i != curve.end(); ++i) {
+       if (logTauFin == (*i).first) {
+          bestChoice = n;
+       }
+       x[n] = (*i).second.first;
+       y[n] = (*i).second.second;
+       logT[n] = (*i).first;
+       n++;
     }
     if(lCurve) {
        (*lCurve)=new TGraph(n,x,y);
@@ -3323,8 +3320,7 @@ void TUnfold::GetOutput(TH1 *output,const Int_t *binMap) const
          //output->SetBinError(destBinI,TMath::Sqrt(e2));
       }
    }
-   for(std::map<Int_t,Double_t>::const_iterator i=e2.begin();
-       i!=e2.end();++i) {
+   for (std::map<Int_t, Double_t>::const_iterator i = e2.begin(); i != e2.end(); ++i) {
       //cout<<(*i).first<<" "<<(*i).second<<"\n";
       output->SetBinError((*i).first,TMath::Sqrt((*i).second));
    }
@@ -3558,8 +3554,7 @@ Double_t TUnfold::GetRhoIFromMatrix(TH1 *rhoi,const TMatrixDSparse *eOrig,
       // construct inverse mapping function
       //    local index -> histogram bin
       Int_t *localBinToHist=new Int_t[nBin];
-      for(std::map<int,int>::const_iterator i=histToLocalBin.begin();
-          i!=histToLocalBin.end();++i) {
+      for (std::map<int, int>::const_iterator i = histToLocalBin.begin(); i != histToLocalBin.end(); ++i) {
          localBinToHist[(*i).second]=(*i).first;
       }
 
diff --git a/hist/unfold/src/TUnfoldDensity.cxx b/hist/unfold/src/TUnfoldDensity.cxx
index f8a9bfe32fc..98dfe674164 100644
--- a/hist/unfold/src/TUnfoldDensity.cxx
+++ b/hist/unfold/src/TUnfoldDensity.cxx
@@ -1452,7 +1452,7 @@ Int_t TUnfoldDensity::ScanTau
       // locate minimum
       Double_t logTauYMin=(*i0).first;
       Double_t yMin=(*i0).second;
-      for(;i0!=curve.end();++i0) {
+      for (; i0 != curve.end(); ++i0) {
          if((*i0).second<yMin) {
             yMin=(*i0).second;
             logTauYMin=(*i0).first;
@@ -1464,7 +1464,7 @@ Int_t TUnfoldDensity::ScanTau
       i1=i0;
       Double_t distMax=0.0;
       Double_t logTau=0.0;
-      for(++i1;i1!=curve.end();++i1) {
+      for (++i1; i1 != curve.end(); ++i1) {
          Double_t dist;
          // check size of rho interval
          dist=TMath::Abs((*i0).first-(*i1).first)
@@ -1496,7 +1496,7 @@ Int_t TUnfoldDensity::ScanTau
    Double_t *cTi=new Double_t[curve.size()];
    Double_t *cCi=new Double_t[curve.size()];
    Int_t n=0;
-   for(TauScan_t::const_iterator i=curve.begin();i!=curve.end();++i) {
+   for (TauScan_t::const_iterator i = curve.begin(); i != curve.end(); ++i) {
       cTi[n]=(*i).first;
       cCi[n]=(*i).second;
       n++;
@@ -1592,7 +1592,7 @@ Int_t TUnfoldDensity::ScanTau
       Double_t *y=new Double_t[curve.size()];
       Double_t *logT=new Double_t[curve.size()];
       int n=0;
-      for( TauScan_t::const_iterator i=curve.begin();i!=curve.end();++i) {
+      for (TauScan_t::const_iterator i = curve.begin(); i != curve.end(); ++i) {
          if(logTauFin==(*i).first) {
             bestChoice=n;
          }
@@ -1617,7 +1617,7 @@ Int_t TUnfoldDensity::ScanTau
       Double_t *x=new Double_t[lcurve.size()];
       Double_t *y=new Double_t[lcurve.size()];
       Int_t n=0;
-      for(LCurve_t::const_iterator i=lcurve.begin();i!=lcurve.end();++i) {
+      for (LCurve_t::const_iterator i = lcurve.begin(); i != lcurve.end(); ++i) {
          logT[n]=(*i).first;
          x[n]=(*i).second.first;
          y[n]=(*i).second.second;
-- 
GitLab