From 30e1f549d116bed6132ed972cfa6f68cae55ee2d Mon Sep 17 00:00:00 2001 From: Reka Korei Date: Tue, 31 Oct 2017 16:00:35 +0100 Subject: [PATCH] Added new window for Analyse --- include/Analyse.hh | 2 ++ src/Analyse.cc | 24 +++++++++--------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/include/Analyse.hh b/include/Analyse.hh index 1ebfd99..b19f1e5 100644 --- a/include/Analyse.hh +++ b/include/Analyse.hh @@ -10,6 +10,7 @@ #include "TH1.h" #include "TF1.h" #include "TMath.h" +#include "TCanvas.h" class Analyse{ @@ -28,6 +29,7 @@ private: Double_t _p0; Double_t _mu; Double_t _sigma; + TCanvas* canvA; }; diff --git a/src/Analyse.cc b/src/Analyse.cc index b2dc6ac..585f85d 100644 --- a/src/Analyse.cc +++ b/src/Analyse.cc @@ -1,6 +1,8 @@ #include "Analyse.hh" -Analyse::Analyse() : _p0(0), _mu(0), _sigma(0) {} +Analyse::Analyse() : _p0(0), _mu(0), _sigma(0) { + canvA = new TCanvas("cancA","display",800,400); + } Analyse::~Analyse() {;} @@ -26,7 +28,7 @@ void Analyse::AnalyseGaus(std::vector t, std::vector x){ Double_t dx = 0.0; - Double_t q = 10000; + Double_t q = 100000000; Double_t max = std::numeric_limits::min(); Double_t min = std::numeric_limits::max(); @@ -41,12 +43,8 @@ void Analyse::AnalyseGaus(std::vector t, std::vector x){ if(TMath::Abs(x[i]-x[i-1]) < dx) _p0 += 1.0; } - //std::cout << "t.size " << t.size() << std::endl; - _p0 /= (Double_t)t.size(); - - //std::cout << "p0 = " << _p0 << std::endl; - + std::vector deltax; @@ -61,8 +59,6 @@ void Analyse::AnalyseGaus(std::vector t, std::vector x){ } - - //std::cout << deltax[i-1] << std::endl; } @@ -76,20 +72,18 @@ void Analyse::AnalyseGaus(std::vector t, std::vector x){ } - Int_t nbin = (max-min)/0.1; - - //std::cout << nbin << std::endl; + Int_t nbin = (max-min)/0.1; TH1D* 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"); dxhisto->Draw(); - - - //std::cout << dxhisto->GetFunction("gaus")->GetParameter(1) <GetFunction("gaus")->GetParameter(1); _sigma = dxhisto->GetFunction("gaus")->GetParameter(2);