Skip to content

Commit

Permalink
Run git-clang on all of the visualisation tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
martamaja10 committed Nov 27, 2024
1 parent 72f6365 commit 570e76a
Show file tree
Hide file tree
Showing 312 changed files with 32,776 additions and 31,349 deletions.
30 changes: 16 additions & 14 deletions tutorials/legacy/spectrum/Background_compton.C
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,33 @@
///
/// \authors Miroslav Morhac, Olivier Couet

void Background_compton() {
void Background_compton()
{
Int_t i;
const Int_t nbins = 256;
Double_t xmin = 0;
Double_t xmax = nbins;
Double_t xmin = 0;
Double_t xmax = nbins;
Double_t source[nbins];
gROOT->ForceStyle();

TH1F *d1 = new TH1F("d1","",nbins,xmin,xmax);
TH1F *d1 = new TH1F("d1", "", nbins, xmin, xmax);

TString dir = gROOT->GetTutorialDir();
TString file = dir+"/spectrum/TSpectrum.root";
TFile *f = new TFile(file.Data());
TH1F *back = (TH1F*) f->Get("back3");
TString dir = gROOT->GetTutorialDir();
TString file = dir + "/spectrum/TSpectrum.root";
TFile *f = new TFile(file.Data());
TH1F *back = (TH1F *)f->Get("back3");
back->SetTitle("Estimation of background with Compton edges under peaks");
back->GetXaxis()->SetRange(1,nbins);
back->GetXaxis()->SetRange(1, nbins);
back->Draw("L");

TSpectrum *s = new TSpectrum();

for (i = 0; i < nbins; i++) source[i]=back->GetBinContent(i + 1);
s->Background(source,nbins,10,TSpectrum::kBackDecreasingWindow,
TSpectrum::kBackOrder8,kTRUE,
TSpectrum::kBackSmoothing5,kTRUE);
for (i = 0; i < nbins; i++) d1->SetBinContent(i + 1,source[i]);
for (i = 0; i < nbins; i++)
source[i] = back->GetBinContent(i + 1);
s->Background(source, nbins, 10, TSpectrum::kBackDecreasingWindow, TSpectrum::kBackOrder8, kTRUE,
TSpectrum::kBackSmoothing5, kTRUE);
for (i = 0; i < nbins; i++)
d1->SetBinContent(i + 1, source[i]);
d1->SetLineColor(kRed);
d1->Draw("SAME L");
}
30 changes: 16 additions & 14 deletions tutorials/legacy/spectrum/Background_decr.C
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,37 @@
///
/// \authors Miroslav Morhac, Olivier Couet

void Background_decr() {
void Background_decr()
{
Int_t i;
const Int_t nbins = 1024;
Double_t xmin = 0;
Double_t xmax = nbins;
Double_t xmin = 0;
Double_t xmax = nbins;
Double_t source[nbins];
gROOT->ForceStyle();

TH1F *d = new TH1F("d","",nbins,xmin,xmax);
TH1F *d = new TH1F("d", "", nbins, xmin, xmax);

TString dir = gROOT->GetTutorialDir();
TString file = dir+"/spectrum/TSpectrum.root";
TFile *f = new TFile(file.Data());
TH1F *back = (TH1F*) f->Get("back1");
TString dir = gROOT->GetTutorialDir();
TString file = dir + "/spectrum/TSpectrum.root";
TFile *f = new TFile(file.Data());
TH1F *back = (TH1F *)f->Get("back1");
back->SetTitle("Estimation of background with decreasing window");
back->GetXaxis()->SetRange(1,nbins);
back->GetXaxis()->SetRange(1, nbins);
back->Draw("L");

TSpectrum *s = new TSpectrum();

for (i = 0; i < nbins; i++) source[i]=back->GetBinContent(i + 1);
for (i = 0; i < nbins; i++)
source[i] = back->GetBinContent(i + 1);

// Estimate the background
s->Background(source,nbins,6,TSpectrum::kBackDecreasingWindow,
TSpectrum::kBackOrder2,kFALSE,
TSpectrum::kBackSmoothing3,kFALSE);
s->Background(source, nbins, 6, TSpectrum::kBackDecreasingWindow, TSpectrum::kBackOrder2, kFALSE,
TSpectrum::kBackSmoothing3, kFALSE);

// Draw the estimated background
for (i = 0; i < nbins; i++) d->SetBinContent(i + 1,source[i]);
for (i = 0; i < nbins; i++)
d->SetBinContent(i + 1, source[i]);
d->SetLineColor(kRed);
d->Draw("SAME L");
}
29 changes: 15 additions & 14 deletions tutorials/legacy/spectrum/Background_gamma256.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,33 @@

#include <TSpectrum2.h>

void Background_gamma256() {
void Background_gamma256()
{
Int_t i, j;
const Int_t nbinsx = 64;
const Int_t nbinsy = 64;
Double_t xmin = 0;
Double_t xmax = (Double_t)nbinsx;
Double_t ymin = 0;
Double_t ymax = (Double_t)nbinsy;
Double_t** source = new Double_t*[nbinsx];
for (i=0;i<nbinsx;i++)
source[i]=new Double_t[nbinsy];
TString dir = gROOT->GetTutorialDir();
TString file = dir+"/spectrum/TSpectrum2.root";
TFile *f = new TFile(file.Data());
auto back = (TH2F*) f->Get("back2");
Double_t **source = new Double_t *[nbinsx];
for (i = 0; i < nbinsx; i++)
source[i] = new Double_t[nbinsy];
TString dir = gROOT->GetTutorialDir();
TString file = dir + "/spectrum/TSpectrum2.root";
TFile *f = new TFile(file.Data());
auto back = (TH2F *)f->Get("back2");
gStyle->SetOptStat(0);
auto *s = new TSpectrum2();
for (i = 0; i < nbinsx; i++){
for (j = 0; j < nbinsy; j++){
source[i][j] = back->GetBinContent(i + 1,j + 1);
for (i = 0; i < nbinsx; i++) {
for (j = 0; j < nbinsy; j++) {
source[i][j] = back->GetBinContent(i + 1, j + 1);
}
}
s->Background(source,nbinsx,nbinsy,8,8,TSpectrum2::kBackIncreasingWindow,TSpectrum2::kBackSuccessiveFiltering);
for (i = 0; i < nbinsx; i++){
s->Background(source, nbinsx, nbinsy, 8, 8, TSpectrum2::kBackIncreasingWindow, TSpectrum2::kBackSuccessiveFiltering);
for (i = 0; i < nbinsx; i++) {
for (j = 0; j < nbinsy; j++)
back->SetBinContent(i + 1,j + 1, source[i][j]);
back->SetBinContent(i + 1, j + 1, source[i][j]);
}
back->Draw("SURF2");
}
29 changes: 15 additions & 14 deletions tutorials/legacy/spectrum/Background_gamma64.C
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,33 @@
#include <TSpectrum2.h>

#include <TSpectrum2.h>
void Background_gamma64() {
void Background_gamma64()
{
Int_t i, j;
const Int_t nbinsx = 64;
const Int_t nbinsy = 64;
Double_t xmin = 0;
Double_t xmax = (Double_t)nbinsx;
Double_t ymin = 0;
Double_t ymax = (Double_t)nbinsy;
Double_t ** source = new Double_t*[nbinsx];
for (i=0;i<nbinsx;i++)
source[i]=new Double_t[nbinsy];
TString dir = gROOT->GetTutorialDir();
TString file = dir+"/spectrum/TSpectrum2.root";
TFile *f = new TFile(file.Data());
auto back = (TH2F*) f->Get("back1");
Double_t **source = new Double_t *[nbinsx];
for (i = 0; i < nbinsx; i++)
source[i] = new Double_t[nbinsy];
TString dir = gROOT->GetTutorialDir();
TString file = dir + "/spectrum/TSpectrum2.root";
TFile *f = new TFile(file.Data());
auto back = (TH2F *)f->Get("back1");
gStyle->SetOptStat(0);
auto s = new TSpectrum2();
for (i = 0; i < nbinsx; i++){
for (j = 0; j < nbinsy; j++){
source[i][j] = back->GetBinContent(i + 1,j + 1);
for (i = 0; i < nbinsx; i++) {
for (j = 0; j < nbinsy; j++) {
source[i][j] = back->GetBinContent(i + 1, j + 1);
}
}
s->Background(source,nbinsx,nbinsy,4,4,TSpectrum2::kBackDecreasingWindow,TSpectrum2::kBackSuccessiveFiltering);
for (i = 0; i < nbinsx; i++){
s->Background(source, nbinsx, nbinsy, 4, 4, TSpectrum2::kBackDecreasingWindow, TSpectrum2::kBackSuccessiveFiltering);
for (i = 0; i < nbinsx; i++) {
for (j = 0; j < nbinsy; j++)
back->SetBinContent(i + 1,j + 1, source[i][j]);
back->SetBinContent(i + 1, j + 1, source[i][j]);
}
back->Draw("SURF1");
}
30 changes: 16 additions & 14 deletions tutorials/legacy/spectrum/Background_incr.C
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,37 @@
///
/// \authors Miroslav Morhac, Olivier Couet

void Background_incr() {
void Background_incr()
{
Int_t i;
const Int_t nbins = 1024;
Double_t xmin = 0;
Double_t xmax = nbins;
Double_t xmin = 0;
Double_t xmax = nbins;
Double_t source[nbins];
gROOT->ForceStyle();

TH1F *d = new TH1F("d","",nbins,xmin,xmax);
TH1F *d = new TH1F("d", "", nbins, xmin, xmax);

TString dir = gROOT->GetTutorialDir();
TString file = dir+"/spectrum/TSpectrum.root";
TFile *f = new TFile(file.Data());
TH1F *back = (TH1F*) f->Get("back1");
back->GetXaxis()->SetRange(1,nbins);
TString dir = gROOT->GetTutorialDir();
TString file = dir + "/spectrum/TSpectrum.root";
TFile *f = new TFile(file.Data());
TH1F *back = (TH1F *)f->Get("back1");
back->GetXaxis()->SetRange(1, nbins);
back->SetTitle("Estimation of background with increasing window");
back->Draw("L");

TSpectrum *s = new TSpectrum();

for (i = 0; i < nbins; i++) source[i] = back->GetBinContent(i + 1);
for (i = 0; i < nbins; i++)
source[i] = back->GetBinContent(i + 1);

// Estimate the background
s->Background(source,nbins,6,TSpectrum::kBackIncreasingWindow,
TSpectrum::kBackOrder2,kFALSE,
TSpectrum::kBackSmoothing3,kFALSE);
s->Background(source, nbins, 6, TSpectrum::kBackIncreasingWindow, TSpectrum::kBackOrder2, kFALSE,
TSpectrum::kBackSmoothing3, kFALSE);

// Draw the estimated background
for (i = 0; i < nbins; i++) d->SetBinContent(i + 1,source[i]);
for (i = 0; i < nbins; i++)
d->SetBinContent(i + 1, source[i]);
d->SetLineColor(kRed);
d->Draw("SAME L");
}
69 changes: 37 additions & 32 deletions tutorials/legacy/spectrum/Background_order.C
Original file line number Diff line number Diff line change
Expand Up @@ -9,59 +9,64 @@
///
/// \authors Miroslav Morhac, Olivier Couet

void Background_order() {
void Background_order()
{
Int_t i;
const Int_t nbins = 4096;
Double_t xmin = 0;
Double_t xmax = 4096;
Double_t xmin = 0;
Double_t xmax = 4096;
Double_t source[nbins];
gROOT->ForceStyle();

TH1F *d1 = new TH1F("d1","",nbins,xmin,xmax);
TH1F *d2 = new TH1F("d2","",nbins,xmin,xmax);
TH1F *d3 = new TH1F("d3","",nbins,xmin,xmax);
TH1F *d4 = new TH1F("d4","",nbins,xmin,xmax);
TH1F *d1 = new TH1F("d1", "", nbins, xmin, xmax);
TH1F *d2 = new TH1F("d2", "", nbins, xmin, xmax);
TH1F *d3 = new TH1F("d3", "", nbins, xmin, xmax);
TH1F *d4 = new TH1F("d4", "", nbins, xmin, xmax);

TString dir = gROOT->GetTutorialDir();
TString file = dir+"/spectrum/TSpectrum.root";
TFile *f = new TFile(file.Data());
TH1F *back = (TH1F*) f->Get("back2");
TString dir = gROOT->GetTutorialDir();
TString file = dir + "/spectrum/TSpectrum.root";
TFile *f = new TFile(file.Data());
TH1F *back = (TH1F *)f->Get("back2");
back->SetTitle("Influence of clipping filter difference order on the estimated background");
back->SetAxisRange(1220,1460);
back->SetAxisRange(1220, 1460);
back->SetMaximum(3000);
back->Draw("L");

TSpectrum *s = new TSpectrum();

for (i = 0; i < nbins; i++) source[i]=back->GetBinContent(i + 1);
s->Background(source,nbins,40,TSpectrum::kBackDecreasingWindow,
TSpectrum::kBackOrder2,kFALSE,
TSpectrum::kBackSmoothing3,kFALSE);
for (i = 0; i < nbins; i++) d1->SetBinContent(i + 1,source[i]);
for (i = 0; i < nbins; i++)
source[i] = back->GetBinContent(i + 1);
s->Background(source, nbins, 40, TSpectrum::kBackDecreasingWindow, TSpectrum::kBackOrder2, kFALSE,
TSpectrum::kBackSmoothing3, kFALSE);
for (i = 0; i < nbins; i++)
d1->SetBinContent(i + 1, source[i]);
d1->SetLineColor(kRed);
d1->Draw("SAME L");

for (i = 0; i < nbins; i++) source[i]=back->GetBinContent(i + 1);
s->Background(source,nbins,40,TSpectrum::kBackDecreasingWindow,
TSpectrum::kBackOrder4,kFALSE,
TSpectrum::kBackSmoothing3,kFALSE);
for (i = 0; i < nbins; i++) d2->SetBinContent(i + 1,source[i]);
for (i = 0; i < nbins; i++)
source[i] = back->GetBinContent(i + 1);
s->Background(source, nbins, 40, TSpectrum::kBackDecreasingWindow, TSpectrum::kBackOrder4, kFALSE,
TSpectrum::kBackSmoothing3, kFALSE);
for (i = 0; i < nbins; i++)
d2->SetBinContent(i + 1, source[i]);
d2->SetLineColor(kBlue);
d2->Draw("SAME L");

for (i = 0; i < nbins; i++) source[i]=back->GetBinContent(i + 1);
s->Background(source,nbins,40,TSpectrum::kBackDecreasingWindow,
TSpectrum::kBackOrder6,kFALSE,
TSpectrum::kBackSmoothing3,kFALSE);
for (i = 0; i < nbins; i++) d3->SetBinContent(i + 1,source[i]);
for (i = 0; i < nbins; i++)
source[i] = back->GetBinContent(i + 1);
s->Background(source, nbins, 40, TSpectrum::kBackDecreasingWindow, TSpectrum::kBackOrder6, kFALSE,
TSpectrum::kBackSmoothing3, kFALSE);
for (i = 0; i < nbins; i++)
d3->SetBinContent(i + 1, source[i]);
d3->SetLineColor(kGreen);
d3->Draw("SAME L");

for (i = 0; i < nbins; i++) source[i]=back->GetBinContent(i + 1);
s->Background(source,nbins,40,TSpectrum::kBackDecreasingWindow,
TSpectrum::kBackOrder8,kFALSE,
TSpectrum::kBackSmoothing3,kFALSE);
for (i = 0; i < nbins; i++) d4->SetBinContent(i + 1,source[i]);
for (i = 0; i < nbins; i++)
source[i] = back->GetBinContent(i + 1);
s->Background(source, nbins, 40, TSpectrum::kBackDecreasingWindow, TSpectrum::kBackOrder8, kFALSE,
TSpectrum::kBackSmoothing3, kFALSE);
for (i = 0; i < nbins; i++)
d4->SetBinContent(i + 1, source[i]);
d4->SetLineColor(kMagenta);
d4->Draw("SAME L");
}
Loading

0 comments on commit 570e76a

Please sign in to comment.