Skip to content

Commit

Permalink
[hist] Implement code suggestions by clang-tidy
Browse files Browse the repository at this point in the history
Using almost all of the checks specified in `roofit/.clang-tidy`.
  • Loading branch information
guitargeek committed Sep 9, 2024
1 parent e5bc43f commit 16ecb6e
Show file tree
Hide file tree
Showing 39 changed files with 166 additions and 201 deletions.
2 changes: 1 addition & 1 deletion hist/hbook/src/THbookFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ ClassImp(THbookFile);
////////////////////////////////////////////////////////////////////////////////
///the constructor

THbookFile::THbookFile() : TNamed(),fLun(0),fLrecl(0)
THbookFile::THbookFile() : fLun(0),fLrecl(0)
{
fList = new TList();
fKeys = new TList();
Expand Down
2 changes: 1 addition & 1 deletion hist/hbook/src/THbookTree.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ ClassImp(THbookTree);
////////////////////////////////////////////////////////////////////////////////
///default constructor

THbookTree::THbookTree(): TTree()
THbookTree::THbookTree()
{
fID = 0;
fType = 0;
Expand Down
6 changes: 3 additions & 3 deletions hist/hist/src/TAxis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ See examples of various axis representations drawn by class TGaxis.
////////////////////////////////////////////////////////////////////////////////
/// Default constructor.

TAxis::TAxis(): TNamed(), TAttAxis()
TAxis::TAxis()
{
fNbins = 1;
fXmin = 0;
Expand All @@ -64,7 +64,7 @@ TAxis::TAxis(): TNamed(), TAttAxis()
////////////////////////////////////////////////////////////////////////////////
/// Axis constructor for axis with fix bin size

TAxis::TAxis(Int_t nbins,Double_t xlow,Double_t xup): TNamed(), TAttAxis()
TAxis::TAxis(Int_t nbins,Double_t xlow,Double_t xup)
{
fParent = nullptr;
fLabels = nullptr;
Expand All @@ -75,7 +75,7 @@ TAxis::TAxis(Int_t nbins,Double_t xlow,Double_t xup): TNamed(), TAttAxis()
////////////////////////////////////////////////////////////////////////////////
/// Axis constructor for variable bin size

TAxis::TAxis(Int_t nbins,const Double_t *xbins): TNamed(), TAttAxis()
TAxis::TAxis(Int_t nbins,const Double_t *xbins)
{
fParent = nullptr;
fLabels = nullptr;
Expand Down
3 changes: 1 addition & 2 deletions hist/hist/src/TF1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ TF1 *TF1::fgCurrent = nullptr;
/// TF1 default constructor.

TF1::TF1():
TNamed(), TAttLine(), TAttFill(), TAttMarker(),
fXmin(0), fXmax(0), fNpar(0), fNdim(0), fType(EFType::kFormula)
{
SetFillStyle(0);
Expand All @@ -509,7 +508,7 @@ TF1::TF1():
/// titles for the X and Y axis respectively.

TF1::TF1(const char *name, const char *formula, Double_t xmin, Double_t xmax, EAddToList addToGlobList, bool vectorize) :
TNamed(name, formula), TAttLine(), TAttFill(), TAttMarker(), fType(EFType::kFormula)
TNamed(name, formula), fType(EFType::kFormula)
{
if (xmin < xmax) {
fXmin = xmin;
Expand Down
2 changes: 1 addition & 1 deletion hist/hist/src/TF12.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ End_Macro
////////////////////////////////////////////////////////////////////////////////
/// TF12 default constructor

TF12::TF12(): TF1()
TF12::TF12()
{
fCase = 0;
fF2 = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion hist/hist/src/TF1Convolution.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void TF1Convolution::InitializeDataMembers(TF1* function1, TF1* function2, Bool_
fFunction2 = std::make_unique<TF1>();
function2->Copy(*fFunction2);
}
if (fFunction1.get() == nullptr|| fFunction2.get() == nullptr)
if (fFunction1 == nullptr|| fFunction2 == nullptr)
Fatal("InitializeDataMembers","Invalid functions - Abort");

// Set kNotGlobal bit
Expand Down
7 changes: 3 additions & 4 deletions hist/hist/src/TF1Data_v5.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ ClassImp(ROOT::v5::TF1Data);
namespace ROOT {

namespace v5 {

////////////////////////////////////////////////////////////////////////////////
/// F1 default constructor.

TF1Data::TF1Data(): ROOT::v5::TFormula(), TAttLine(), TAttFill(), TAttMarker()
TF1Data::TF1Data()
{
fXmin = 0;
fXmax = 0;
Expand Down Expand Up @@ -62,7 +62,7 @@ void TF1Data::Streamer(TBuffer &b)
UInt_t R__s, R__c;
Version_t v = b.ReadVersion(&R__s, &R__c);
Streamer(b, v, R__s, R__c, nullptr);

} else {
// this will be needed if we want to write in old format
//Int_t saved = 0;
Expand Down Expand Up @@ -150,4 +150,3 @@ void TF1Data::Streamer(TBuffer &b, Int_t v, UInt_t R__s, UInt_t R__c, const TCla

} // end namespace v5
} // end namespace ROOT

2 changes: 1 addition & 1 deletion hist/hist/src/TF2.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ See TF1 class for the list of functions formats
////////////////////////////////////////////////////////////////////////////////
/// TF2 default constructor

TF2::TF2(): TF1(),fYmin(0),fYmax(0),fNpy(100)
TF2::TF2(): fYmin(0),fYmax(0),fNpy(100)
{
}

Expand Down
2 changes: 1 addition & 1 deletion hist/hist/src/TF3.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ A 3-Dim function with parameters
////////////////////////////////////////////////////////////////////////////////
/// F3 default constructor

TF3::TF3(): TF2()
TF3::TF3()
{
fNpz = 0;
fZmin = 0;
Expand Down
6 changes: 1 addition & 5 deletions hist/hist/src/TFormulaPrimitive_v5.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ namespace {
////////////////////////////////////////////////////////////////////////////////
/// Default constructor.

TFormulaPrimitive::TFormulaPrimitive() : TNamed(),
fFuncG(nullptr),
fType(0),fNArguments(0),fNParameters(0),fIsStatic(kTRUE)
{
}
TFormulaPrimitive::TFormulaPrimitive() : fFuncG(nullptr), fType(0), fNArguments(0), fNParameters(0), fIsStatic(true) {}

////////////////////////////////////////////////////////////////////////////////
/// Constructor.
Expand Down
2 changes: 1 addition & 1 deletion hist/hist/src/TFormula_v5.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ The FORMULA class (ROOT version 5)
////////////////////////////////////////////////////////////////////////////////
/// Formula default constructor.

TFormula::TFormula(): TNamed()
TFormula::TFormula()
{
fNdim = 0;
fNpar = 0;
Expand Down
22 changes: 11 additions & 11 deletions hist/hist/src/TGraph.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ End_Macro
////////////////////////////////////////////////////////////////////////////////
/// Graph default constructor.

TGraph::TGraph(): TNamed(), TAttLine(), TAttFill(0, 1000), TAttMarker()
TGraph::TGraph() : TAttFill(0, 1000)
{
fNpoints = -1; //will be reset to 0 in CtorAllocate
if (!CtorAllocate()) return;
Expand All @@ -116,7 +116,7 @@ TGraph::TGraph(): TNamed(), TAttLine(), TAttFill(0, 1000), TAttMarker()
/// the arrays x and y will be set later

TGraph::TGraph(Int_t n)
: TNamed("Graph", "Graph"), TAttLine(), TAttFill(0, 1000), TAttMarker()
: TNamed("Graph", "Graph"), TAttFill(0, 1000)
{
fNpoints = n;
if (!CtorAllocate()) return;
Expand All @@ -127,7 +127,7 @@ TGraph::TGraph(Int_t n)
/// Graph normal constructor with ints.

TGraph::TGraph(Int_t n, const Int_t *x, const Int_t *y)
: TNamed("Graph", "Graph"), TAttLine(), TAttFill(0, 1000), TAttMarker()
: TNamed("Graph", "Graph"), TAttFill(0, 1000)
{
if (!x || !y) {
fNpoints = 0;
Expand All @@ -145,7 +145,7 @@ TGraph::TGraph(Int_t n, const Int_t *x, const Int_t *y)
/// Graph normal constructor with floats.

TGraph::TGraph(Int_t n, const Float_t *x, const Float_t *y)
: TNamed("Graph", "Graph"), TAttLine(), TAttFill(0, 1000), TAttMarker()
: TNamed("Graph", "Graph"), TAttFill(0, 1000)
{
if (!x || !y) {
fNpoints = 0;
Expand All @@ -164,7 +164,7 @@ TGraph::TGraph(Int_t n, const Float_t *x, const Float_t *y)
/// values `start`, `start+step`, `start+2*step`, `start+3*step`, etc ...

TGraph::TGraph(Int_t n, const Double_t *y, Double_t start, Double_t step)
: TNamed("Graph", "Graph"), TAttLine(), TAttFill(0, 1000), TAttMarker()
: TNamed("Graph", "Graph"), TAttFill(0, 1000)
{
if (!y) {
fNpoints = 0;
Expand All @@ -182,7 +182,7 @@ TGraph::TGraph(Int_t n, const Double_t *y, Double_t start, Double_t step)
/// Graph normal constructor with doubles.

TGraph::TGraph(Int_t n, const Double_t *x, const Double_t *y)
: TNamed("Graph", "Graph"), TAttLine(), TAttFill(0, 1000), TAttMarker()
: TNamed("Graph", "Graph"), TAttFill(0, 1000)
{
if (!x || !y) {
fNpoints = 0;
Expand Down Expand Up @@ -295,7 +295,7 @@ TGraph& TGraph::operator=(const TGraph &gr)
/// in vx and vy.

TGraph::TGraph(const TVectorF &vx, const TVectorF &vy)
: TNamed("Graph", "Graph"), TAttLine(), TAttFill(0, 1000), TAttMarker()
: TNamed("Graph", "Graph"), TAttFill(0, 1000)
{
fNpoints = TMath::Min(vx.GetNrows(), vy.GetNrows());
if (!CtorAllocate()) return;
Expand All @@ -314,7 +314,7 @@ TGraph::TGraph(const TVectorF &vx, const TVectorF &vy)
/// in vx and vy.

TGraph::TGraph(const TVectorD &vx, const TVectorD &vy)
: TNamed("Graph", "Graph"), TAttLine(), TAttFill(0, 1000), TAttMarker()
: TNamed("Graph", "Graph"), TAttFill(0, 1000)
{
fNpoints = TMath::Min(vx.GetNrows(), vy.GetNrows());
if (!CtorAllocate()) return;
Expand All @@ -330,7 +330,7 @@ TGraph::TGraph(const TVectorD &vx, const TVectorD &vy)
/// Graph constructor importing its parameters from the TH1 object passed as argument

TGraph::TGraph(const TH1 *h)
: TNamed("Graph", "Graph"), TAttLine(), TAttFill(0, 1000), TAttMarker()
: TNamed("Graph", "Graph"), TAttFill(0, 1000)
{
if (!h) {
Error("TGraph", "Pointer to histogram is null");
Expand Down Expand Up @@ -372,7 +372,7 @@ TGraph::TGraph(const TH1 *h)
/// at the fNpx+1 points of f and the integral is normalized to 1.

TGraph::TGraph(const TF1 *f, Option_t *option)
: TNamed("Graph", "Graph"), TAttLine(), TAttFill(0, 1000), TAttMarker()
: TNamed("Graph", "Graph"), TAttFill(0, 1000)
{
char coption = ' ';
if (!f) {
Expand Down Expand Up @@ -437,7 +437,7 @@ TGraph::TGraph(const TF1 *f, Option_t *option)
/// Note in that case, the instantiation is about two times slower.

TGraph::TGraph(const char *filename, const char *format, Option_t *option)
: TNamed("Graph", filename), TAttLine(), TAttFill(0, 1000), TAttMarker()
: TNamed("Graph", filename), TAttFill(0, 1000)
{
Double_t x, y;
TString fname = filename;
Expand Down
24 changes: 8 additions & 16 deletions hist/hist/src/TGraph2D.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ gives a nice practical view of Delaunay triangulation and Voronoi diagram.
/// Graph2D default constructor

TGraph2D::TGraph2D()
: TNamed("Graph2D", "Graph2D"), TAttLine(1, 1, 1), TAttFill(0, 1001),
TAttMarker(), fNpoints(0)
: TNamed("Graph2D", "Graph2D"), TAttLine(1, 1, 1), TAttFill(0, 1001), fNpoints(0)
{
fSize = 0;
fMargin = 0.;
Expand All @@ -263,8 +262,7 @@ TGraph2D::TGraph2D()
/// Graph2D constructor with three vectors of ints as input.

TGraph2D::TGraph2D(Int_t n, Int_t *x, Int_t *y, Int_t *z)
: TNamed("Graph2D", "Graph2D"), TAttLine(1, 1, 1), TAttFill(0, 1001),
TAttMarker(), fNpoints(n)
: TNamed("Graph2D", "Graph2D"), TAttLine(1, 1, 1), TAttFill(0, 1001), fNpoints(n)
{
Build(n);

Expand All @@ -281,8 +279,7 @@ TGraph2D::TGraph2D(Int_t n, Int_t *x, Int_t *y, Int_t *z)
/// Graph2D constructor with three vectors of floats as input.

TGraph2D::TGraph2D(Int_t n, Float_t *x, Float_t *y, Float_t *z)
: TNamed("Graph2D", "Graph2D"), TAttLine(1, 1, 1), TAttFill(0, 1001),
TAttMarker(), fNpoints(n)
: TNamed("Graph2D", "Graph2D"), TAttLine(1, 1, 1), TAttFill(0, 1001), fNpoints(n)
{
Build(n);

Expand All @@ -299,8 +296,7 @@ TGraph2D::TGraph2D(Int_t n, Float_t *x, Float_t *y, Float_t *z)
/// Graph2D constructor with three vectors of doubles as input.

TGraph2D::TGraph2D(Int_t n, Double_t *x, Double_t *y, Double_t *z)
: TNamed("Graph2D", "Graph2D"), TAttLine(1, 1, 1), TAttFill(0, 1001),
TAttMarker(), fNpoints(n)
: TNamed("Graph2D", "Graph2D"), TAttLine(1, 1, 1), TAttFill(0, 1001), fNpoints(n)
{
Build(n);

Expand All @@ -319,8 +315,7 @@ TGraph2D::TGraph2D(Int_t n, Double_t *x, Double_t *y, Double_t *z)
/// Empty bins, recognized when both content and errors are zero, are excluded.

TGraph2D::TGraph2D(TH2 *h2)
: TNamed("Graph2D", "Graph2D"), TAttLine(1, 1, 1), TAttFill(0, 1001),
TAttMarker(), fNpoints(0)
: TNamed("Graph2D", "Graph2D"), TAttLine(1, 1, 1), TAttFill(0, 1001), fNpoints(0)
{
Build(h2->GetNbinsX()*h2->GetNbinsY());

Expand Down Expand Up @@ -367,8 +362,7 @@ TGraph2D::TGraph2D(TH2 *h2)

TGraph2D::TGraph2D(const char *name, const char *title,
Int_t n, Double_t *x, Double_t *y, Double_t *z)
: TNamed(name, title), TAttLine(1, 1, 1), TAttFill(0, 1001),
TAttMarker(), fNpoints(n)
: TNamed(name, title), TAttLine(1, 1, 1), TAttFill(0, 1001), fNpoints(n)
{
Build(n);

Expand All @@ -386,8 +380,7 @@ TGraph2D::TGraph2D(const char *name, const char *title,
/// calls to SetPoint

TGraph2D::TGraph2D(Int_t n)
: TNamed("Graph2D", "Graph2D"), TAttLine(1, 1, 1), TAttFill(0, 1001),
TAttMarker(), fNpoints(n)
: TNamed("Graph2D", "Graph2D"), TAttLine(1, 1, 1), TAttFill(0, 1001), fNpoints(n)
{
Build(n);
for (Int_t i = 0; i < fNpoints; i++) {
Expand All @@ -408,8 +401,7 @@ TGraph2D::TGraph2D(Int_t n)
/// Note in that case, the instantiation is about 2 times slower.

TGraph2D::TGraph2D(const char *filename, const char *format, Option_t *option)
: TNamed("Graph2D", filename), TAttLine(1, 1, 1), TAttFill(0, 1001),
TAttMarker(), fNpoints(0)
: TNamed("Graph2D", filename), TAttLine(1, 1, 1), TAttFill(0, 1001), fNpoints(0)
{
Double_t x, y, z;
TString fname = filename;
Expand Down
4 changes: 1 addition & 3 deletions hist/hist/src/TGraph2DAsymmErrors.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ End_Macro
////////////////////////////////////////////////////////////////////////////////
/// TGraph2DAsymmErrors default constructor

TGraph2DAsymmErrors::TGraph2DAsymmErrors(): TGraph2D()
{
}
TGraph2DAsymmErrors::TGraph2DAsymmErrors() {}


////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 1 addition & 3 deletions hist/hist/src/TGraph2DErrors.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ End_Macro
////////////////////////////////////////////////////////////////////////////////
/// TGraph2DErrors default constructor

TGraph2DErrors::TGraph2DErrors(): TGraph2D()
{
}
TGraph2DErrors::TGraph2DErrors() {}


////////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 1 addition & 5 deletions hist/hist/src/TGraphAsymmErrors.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ End_Macro
////////////////////////////////////////////////////////////////////////////////
/// TGraphAsymmErrors default constructor.

TGraphAsymmErrors::TGraphAsymmErrors(): TGraph()
{
}
TGraphAsymmErrors::TGraphAsymmErrors() {}


////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -187,7 +185,6 @@ TGraphAsymmErrors::TGraphAsymmErrors(Int_t n, const Double_t *x, const Double_t
/// in vx and vy.

TGraphAsymmErrors::TGraphAsymmErrors(const TVectorF &vx, const TVectorF &vy, const TVectorF &vexl, const TVectorF &vexh, const TVectorF &veyl, const TVectorF &veyh)
:TGraph()
{
fNpoints = TMath::Min(vx.GetNrows(), vy.GetNrows());
if (!TGraph::CtorAllocate()) return;
Expand Down Expand Up @@ -217,7 +214,6 @@ TGraphAsymmErrors::TGraphAsymmErrors(const TVectorF &vx, const TVectorF &vy, c
/// in vx and vy.

TGraphAsymmErrors::TGraphAsymmErrors(const TVectorD &vx, const TVectorD &vy, const TVectorD &vexl, const TVectorD &vexh, const TVectorD &veyl, const TVectorD &veyh)
:TGraph()
{
fNpoints = TMath::Min(vx.GetNrows(), vy.GetNrows());
if (!TGraph::CtorAllocate()) return;
Expand Down
2 changes: 1 addition & 1 deletion hist/hist/src/TGraphBentErrors.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ End_Macro
////////////////////////////////////////////////////////////////////////////////
/// TGraphBentErrors default constructor.

TGraphBentErrors::TGraphBentErrors(): TGraph()
TGraphBentErrors::TGraphBentErrors()
{
if (!CtorAllocate()) return;
}
Expand Down
2 changes: 1 addition & 1 deletion hist/hist/src/TGraphErrors.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ End_Macro
////////////////////////////////////////////////////////////////////////////////
/// TGraphErrors default constructor.

TGraphErrors::TGraphErrors(): TGraph()
TGraphErrors::TGraphErrors()
{
if (!CtorAllocate()) return;
}
Expand Down
Loading

0 comments on commit 16ecb6e

Please sign in to comment.