diff --git a/BM1D.cc b/BM1D.cc index fc65d04..2eae252 100644 --- a/BM1D.cc +++ b/BM1D.cc @@ -23,7 +23,7 @@ void OpenRootFile() int main(int argc, char* argv[]) { - Int_t n = 1000; + Int_t n = 1000, p0 = 1, start = 0; TApplication App("tapp", &argc, argv); TCanvas* Canv = new TCanvas("c10","Live display",800,400); @@ -35,8 +35,8 @@ int main(int argc, char* argv[]) else { - Progress* Pr1 = new Progress(n); - Progress* Pr2 = new Progress(n); + Progress* Pr1 = new Progress(n,p0,start); + Progress* Pr2 = new Progress(n,p0,start); Pr1->Count('u'); Pr2->Count('g'); diff --git a/README.md b/README.md index aed0666..9296e62 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Brownian movement in one dimension. Starter pack for data processing course from * **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 +### Requirements * Linux (Tested on Ubuntu 16.04 LTS) * CERN ROOT (Tested on v6.10/08) @@ -51,6 +51,8 @@ If there's command line argument, then program opens the created root file. Name ## Updates +* 2017/10/29 - 'v1.3.1' - Release Candidate + * 2017/10/29 - 'v1.3' - Minor fixes in Progress * 2017/10/29 - 'v1.2' - Creation of reloaded version and it's repository diff --git a/include/Progress.hh b/include/Progress.hh index 8c8366f..2762ef5 100644 --- a/include/Progress.hh +++ b/include/Progress.hh @@ -32,7 +32,7 @@ public: Double_t GetP0(); Int_t GetSteps(); - Double_t GetNext(); + Double_t GetNext(char a); Double_t GetPrevious(); void SetP0(double p0_new); diff --git a/src/Progress.cc b/src/Progress.cc index 110d818..9f6fa55 100644 --- a/src/Progress.cc +++ b/src/Progress.cc @@ -31,46 +31,32 @@ void Progress::Count(char a) { if(i==0) { - x.push_back(0.0); + x.push_back(p0); y.push_back(0.0); } - - y.push_back((Double_t)i); - switch(a) - { + x.push_back(GetNext(a)); + y.push_back(steps); + } +} + +Double_t Progress::GetNext(char a) +{ + switch(a){ case 'u': - if(random1->Uniform()>=0.5) - { - x.push_back(x[i-1]-0.1); - } - else - { - x.push_back(x[i-1]+0.1); - } + preVstate+=random1->Uniform(-p0,p0); break; case 'g': - if(random1->Gaus()>=0.5) - { - x.push_back(x[i-1]-0.1); - } - else - { - x.push_back(x[i-1]+0.1); - } + preVstate+=random1->Gaus(-p0,p0); break; default: std::cout<<"Invalid argument!"<Uniform(),(2*p0)-p0); + steps++; return preVstate; }