From 2f644b760e1566d266cd70061a6c5f2c1e3faa65 Mon Sep 17 00:00:00 2001 From: dbalazs92 Date: Sun, 29 Oct 2017 13:31:44 +0100 Subject: [PATCH] Version 1.3 - Minor fixes in Progress --- BM1D.cc | 2 +- README.md | 1 + include/Progress.hh | 15 ++++++++++++++- src/Progress.cc | 43 +++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 57 insertions(+), 4 deletions(-) diff --git a/BM1D.cc b/BM1D.cc index e781074..fc65d04 100644 --- a/BM1D.cc +++ b/BM1D.cc @@ -1,4 +1,4 @@ -/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári +/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári, Dávid Baranyai #include #include "Progress.hh" diff --git a/README.md b/README.md index ec2d573..5c6fceb 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Brownian movement in one dimension. Starter pack for data processing course from * **Balázs Demeter** - *University of Debrecen* - [E-mail](mailto:balazsdemeter92@gmail.com) * **Balázs Ujvári** - *University of Debrecen* - [E-mail](mailto:balazs.ujvari@science.unideb.hu) +* **Dávid Baranyai** - *University of Debrecen* - [E-mail](mailto:divaldo95@gmail.com) ### Requirements diff --git a/include/Progress.hh b/include/Progress.hh index 512f0f9..8c8366f 100644 --- a/include/Progress.hh +++ b/include/Progress.hh @@ -1,4 +1,4 @@ -/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári +/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári, Dávid Baranyai #ifndef Progress_h #define Progress_h 1 @@ -24,10 +24,19 @@ class Progress { public: Progress(Int_t n); + Progress(Int_t n, Double_t p0_Set); + Progress(Int_t n, Double_t p0_Set, Double_t startposition); ~Progress(); void Count(char a); + Double_t GetP0(); + Int_t GetSteps(); + Double_t GetNext(); + Double_t GetPrevious(); + + void SetP0(double p0_new); + std::vector GetX(); std::vector GetY(); @@ -38,6 +47,10 @@ private: std::vector x; std::vector y; + Double_t p0; + Double_t preVstate; + Int_t steps; + }; #endif diff --git a/src/Progress.cc b/src/Progress.cc index f4f24e4..110d818 100644 --- a/src/Progress.cc +++ b/src/Progress.cc @@ -1,9 +1,21 @@ -/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári +/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári, Dávid Baranyai #include "Progress.hh" Progress::Progress(Int_t nP) : -n (nP) +n (nP), p0(1), preVstate(0), steps(0) +{ + random1 = new TRandom(); +} + +Progress::Progress(Int_t nP, Double_t p0_Set) : +n (nP), p0(p0_Set), preVstate(0), steps(0) +{ + random1 = new TRandom(); +} + +Progress::Progress(Int_t nP, Double_t p0_Set, Double_t startposition) : +n (nP), p0(p0_Set), preVstate(startposition), steps(0) { random1 = new TRandom(); } @@ -56,6 +68,33 @@ void Progress::Count(char a) } } +Double_t Progress::GetNext() +{ + preVstate+=fmod(random1->Uniform(),(2*p0)-p0); + steps++; + return preVstate; +} + +Double_t Progress::GetPrevious() +{ + return preVstate; +} + +void Progress::SetP0(Double_t p0_new) +{ + p0=p0_new; +} + +Double_t Progress::GetP0() +{ + return p0; +} + +Int_t Progress::GetSteps() +{ + return steps; +} + std::vector Progress::GetX() { return x;