diff --git a/include/Analyse.hh b/include/Analyse.hh index b19f1e5..5922b95 100644 --- a/include/Analyse.hh +++ b/include/Analyse.hh @@ -12,6 +12,12 @@ #include "TMath.h" #include "TCanvas.h" +////////////////////////////////////////////////// +// // +// Estimate p0, mu, sigma for one particle // +// // +////////////////////////////////////////////////// + class Analyse{ @@ -22,6 +28,7 @@ public: Double_t GetP0(); Double_t GetMu(); Double_t GetSigma(); + TH1D* GetHist(); void AnalyseGaus(std::vector t, std::vector x); @@ -30,6 +37,7 @@ private: Double_t _mu; Double_t _sigma; TCanvas* canvA; + TH1D* dxhisto; }; diff --git a/src/Analyse.cc b/src/Analyse.cc index 585f85d..158341c 100644 --- a/src/Analyse.cc +++ b/src/Analyse.cc @@ -2,6 +2,7 @@ Analyse::Analyse() : _p0(0), _mu(0), _sigma(0) { canvA = new TCanvas("cancA","display",800,400); + dxhisto = new TH1D("dxhisto","dxhisto", 50, -5.0,5.0); } Analyse::~Analyse() {;} @@ -23,6 +24,10 @@ Double_t Analyse::GetSigma(){ return _sigma; } + +TH1D* Analyse::GetHist(){ + return dxhisto; + } void Analyse::AnalyseGaus(std::vector t, std::vector x){ @@ -74,15 +79,13 @@ void Analyse::AnalyseGaus(std::vector t, std::vector x){ Int_t nbin = (max-min)/0.1; - TH1D* dxhisto = new TH1D("dxhisto","dxhisto", nbin, min+0.1*min,max+0.1*max); + dxhisto = new TH1D("dxhisto","dxhisto", nbin, min+0.1*min,max+0.1*max); for (int i = 0; i < deltax.size(); i++) dxhisto->Fill(deltax[i]); - - canvA->cd(); - dxhisto->Fit("gaus"); + canvA->cd(); dxhisto->Draw(); _mu = dxhisto->GetFunction("gaus")->GetParameter(1);