From e5fcd61d1afcd1e613eb5d5685d6f0e4f125e616 Mon Sep 17 00:00:00 2001 From: Axel Naumann <Axel.Naumann@cern.ch> Date: Thu, 19 Jan 2017 12:42:10 +0100 Subject: [PATCH] Declare variables, make it proper C++. --- tutorials/fit/fitCircle.C | 2 +- tutorials/geom/RadioNuclides.C | 10 +++++----- tutorials/geom/csgdemo.C | 6 +++--- tutorials/geom/xtruSamples.C | 2 +- tutorials/graphics/gaxis3.C | 2 +- tutorials/graphics/manyaxis.C | 2 +- tutorials/hist/DynamicSlice.C | 2 +- tutorials/hist/hksimple.C | 2 +- tutorials/hist/xyplot.C | 2 +- tutorials/spectrum/DeconvolutionRL_wide.C | 4 ++-- tutorials/spectrum/DeconvolutionRL_wide_boost.C | 4 ++-- 11 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tutorials/fit/fitCircle.C b/tutorials/fit/fitCircle.C index 5c87100c3c9..6f3175c585f 100644 --- a/tutorials/fit/fitCircle.C +++ b/tutorials/fit/fitCircle.C @@ -29,7 +29,7 @@ void fitCircle(Int_t n=10000) { //generates n points around a circle and fit them TCanvas *c1 = new TCanvas("c1","c1",600,600); c1->SetGrid(); - gr = new TGraph(n); + TGraph* gr = new TGraph(n); if (n> 999) gr->SetMarkerStyle(1); else gr->SetMarkerStyle(3); TRandom3 r; diff --git a/tutorials/geom/RadioNuclides.C b/tutorials/geom/RadioNuclides.C index 2828f4e6078..f019bb5e435 100644 --- a/tutorials/geom/RadioNuclides.C +++ b/tutorials/geom/RadioNuclides.C @@ -129,11 +129,11 @@ void RadioNuclides() pt->SetFillColor(5); pt->SetTextAlign(12); pt->SetTextColor(4); - text = pt->AddText("Time evolution of a population of radionuclides."); - text = pt->AddText("The concentration of a nuclide X represent the "); - text = pt->AddText("ratio between the number of X nuclei and the "); - text = pt->AddText("number of nuclei of the top element of the decay"); - text = pt->AddText("from which X derives from at T=0. "); + pt->AddText("Time evolution of a population of radionuclides."); + pt->AddText("The concentration of a nuclide X represent the "); + pt->AddText("ratio between the number of X nuclei and the "); + pt->AddText("number of nuclei of the top element of the decay"); + pt->AddText("from which X derives from at T=0. "); pt->Draw(); c1->Modified(); vect->Clear(); diff --git a/tutorials/geom/csgdemo.C b/tutorials/geom/csgdemo.C index a295e6d7c0f..f289c2a4d31 100644 --- a/tutorials/geom/csgdemo.C +++ b/tutorials/geom/csgdemo.C @@ -13,7 +13,7 @@ Bool_t raytracing = kTRUE; void csgdemo () { gSystem->Load("libGeom"); - bar = new TControlBar("vertical", "TGeo composite shapes",20,20); + TControlBar* bar = new TControlBar("vertical", "TGeo composite shapes",20,20); bar->AddButton("How to run ","help()","Instructions "); bar->AddButton("Union ", "s_union()", "A + B "); bar->AddButton("Intersection ", "s_intersection()","A * B "); @@ -344,14 +344,14 @@ void help() { new TCanvas("chelp","Help to run demos",200,10,700,600); - welcome = new TPaveText(.1,.8,.9,.97); + TPaveText* welcome = new TPaveText(.1,.8,.9,.97); welcome->AddText("Welcome to the new geometry package"); welcome->SetTextFont(32); welcome->SetTextColor(4); welcome->SetFillColor(24); welcome->Draw(); - hdemo = new TPaveText(.05,.05,.95,.7); + TPaveText* hdemo = new TPaveText(.05,.05,.95,.7); hdemo->SetTextAlign(12); hdemo->SetTextFont(52); hdemo->AddText("- Demo for building TGeo composite shapes"); diff --git a/tutorials/geom/xtruSamples.C b/tutorials/geom/xtruSamples.C index 42a50c80b8f..5fff09145d4 100644 --- a/tutorials/geom/xtruSamples.C +++ b/tutorials/geom/xtruSamples.C @@ -25,7 +25,7 @@ void xtruSamples() Bool_t domalformed = kFALSE; // domalformed = kTRUE; - c1 = new TCanvas("c1","sample TXTRU Shapes",200,10,640,640); + TCanvas* c1 = new TCanvas("c1","sample TXTRU Shapes",200,10,640,640); // Create a new geometry TGeometry* geom = new TGeometry("sample","sample"); diff --git a/tutorials/graphics/gaxis3.C b/tutorials/graphics/gaxis3.C index f0d8ff04b0a..d7b5fca45df 100644 --- a/tutorials/graphics/gaxis3.C +++ b/tutorials/graphics/gaxis3.C @@ -19,7 +19,7 @@ /// \author Olivier Couet void gaxis3() { - c1 = new TCanvas("c1","Examples of Gaxis",10,10,800,400); + TCanvas* c1 = new TCanvas("c1","Examples of Gaxis",10,10,800,400); c1->Range(-6,-0.1,6,0.1); TGaxis *axis = new TGaxis(-5.5,0.,5.5,0.,0.0,100,510,""); diff --git a/tutorials/graphics/manyaxis.C b/tutorials/graphics/manyaxis.C index 4203083be18..a6ef5a1a668 100644 --- a/tutorials/graphics/manyaxis.C +++ b/tutorials/graphics/manyaxis.C @@ -10,7 +10,7 @@ void manyaxis() { - c1 = new TCanvas("c1","Examples of Gaxis",10,10,700,500); + TCanvas* c1 = new TCanvas("c1","Examples of Gaxis",10,10,700,500); c1->Range(-10,-1,10,1); diff --git a/tutorials/hist/DynamicSlice.C b/tutorials/hist/DynamicSlice.C index 53cf43f9d02..aa682f1b34f 100644 --- a/tutorials/hist/DynamicSlice.C +++ b/tutorials/hist/DynamicSlice.C @@ -12,7 +12,7 @@ void DynamicSlice() { // Create a new canvas. - c1 = new TCanvas("c1","Dynamic Slice Example",10,10,700,500); + TCanvas* c1 = new TCanvas("c1","Dynamic Slice Example",10,10,700,500); //create a 2-d histogram, fill and draw it TH2F *hpxpy = new TH2F("hpxpy","py vs px",40,-4,4,40,-4,4); diff --git a/tutorials/hist/hksimple.C b/tutorials/hist/hksimple.C index de165357fb5..fec4a087016 100644 --- a/tutorials/hist/hksimple.C +++ b/tutorials/hist/hksimple.C @@ -26,7 +26,7 @@ void padRefresh(TPad *pad,int flag=0) void hksimple() { // Create a new canvas. - c1 = new TCanvas("c1","Dynamic Filling Example",200,10,600,900); + TCanvas* c1 = new TCanvas("c1","Dynamic Filling Example",200,10,600,900); // Create a normal histogram and two TH1K histograms TH1 *hpx[3]; diff --git a/tutorials/hist/xyplot.C b/tutorials/hist/xyplot.C index 4b472961a94..6dca3335fc6 100644 --- a/tutorials/hist/xyplot.C +++ b/tutorials/hist/xyplot.C @@ -22,7 +22,7 @@ void xyplot() const Int_t n = 4; Double_t x[n] = {-1, -3, -9, 3}; Double_t y[n] = {-1000, 900, 300, 300}; - gr = new TGraph(n,x,y); + TGraph* gr = new TGraph(n,x,y); gr->SetTitle("XY plot"); gr->SetMinimum(-1080); gr->SetMaximum(1080); diff --git a/tutorials/spectrum/DeconvolutionRL_wide.C b/tutorials/spectrum/DeconvolutionRL_wide.C index fd15aa5d4b5..f292c5e0279 100644 --- a/tutorials/spectrum/DeconvolutionRL_wide.C +++ b/tutorials/spectrum/DeconvolutionRL_wide.C @@ -20,9 +20,9 @@ void DeconvolutionRL_wide() { TString dir = gROOT->GetTutorialsDir(); TString file = dir+"/spectrum/TSpectrum.root"; TFile *f = new TFile(file.Data()); - h = (TH1F*) f->Get("decon3"); + TH1F* h = (TH1F*) f->Get("decon3"); h->SetTitle("Deconvolution of closely positioned overlapping peaks using Richardson-Lucy deconvolution method"); - d = (TH1F*) f->Get("decon_response_wide"); + TH1F* d = (TH1F*) f->Get("decon_response_wide"); for (i = 0; i < nbins; i++) source[i]=h->GetBinContent(i + 1); for (i = 0; i < nbins; i++) response[i]=d->GetBinContent(i + 1); diff --git a/tutorials/spectrum/DeconvolutionRL_wide_boost.C b/tutorials/spectrum/DeconvolutionRL_wide_boost.C index aa711fc05d0..0cdeb1904c8 100644 --- a/tutorials/spectrum/DeconvolutionRL_wide_boost.C +++ b/tutorials/spectrum/DeconvolutionRL_wide_boost.C @@ -20,9 +20,9 @@ void DeconvolutionRL_wide_boost() { TString dir = gROOT->GetTutorialsDir(); TString file = dir+"/spectrum/TSpectrum.root"; TFile *f = new TFile(file.Data()); - h = (TH1F*) f->Get("decon3"); + TH1F* h = (TH1F*) f->Get("decon3"); h->SetTitle("Deconvolution of closely positioned overlapping peaks using boosted Richardson-Lucy deconvolution method"); - d = (TH1F*) f->Get("decon_response_wide"); + TH1F* d = (TH1F*) f->Get("decon_response_wide"); for (i = 0; i < nbins; i++) source[i]=h->GetBinContent(i + 1); for (i = 0; i < nbins; i++) response[i]=d->GetBinContent(i + 1); -- GitLab