void Background_incr() { Int_t i; const Int_t nbins = 3000; Double_t xmin = 0; Double_t xmax = nbins; Double_t energy_cal[nbins]; gROOT->ForceStyle(); TH1F *d = new TH1F("d","",nbins,xmin,xmax); //TString dir = gROOT->GetSortingDir(); // TString file = dir+"/output_files/R12.root"; TString file = "MCA/input/marneli.root"; TFile *f = new TFile(file.Data()); TH1F *back = (TH1F*) f->Get("energy_cal"); 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++) energy_cal[i] = back->GetBinContent(i + 1); // Estimate the background s->Background(energy_cal,nbins,6,TSpectrum::kBackIncreasingWindow, TSpectrum::kBackOrder2,kFALSE, TSpectrum::kBackSmoothing3,kFALSE); // Draw the estimated background for (i = 0; i < nbins; i++) d->SetBinContent(i + 1,energy_cal[i]); d->SetLineColor(kRed); d->Draw("SAME L"); }