From fc790d0de7dd47d52b997278e4ea90990ee596cd Mon Sep 17 00:00:00 2001 From: dbalazs92 Date: Mon, 30 Oct 2017 09:41:11 +0100 Subject: [PATCH] Version 1.4 - New structure --- BM1D.cc | 83 +++++------------------------------- README.md | 2 + include/BM1DProcess.hh | 35 +++++++++++++++ include/BM1DProcess.hh~ | 0 include/Plotter.hh | 32 ++++++++++++++ include/Plotter.hh~ | 0 include/Progress.hh | 58 ------------------------- result.root | Bin 0 -> 13269 bytes setup.sh | 6 +-- src/BM1DProcess.cc | 40 +++++++++++++++++ src/BM1DProcess.cc~ | 1 + src/Plotter.cc | 35 +++++++++++++++ src/Plotter.cc~ | 0 src/Progress.cc | 92 ---------------------------------------- 14 files changed, 157 insertions(+), 227 deletions(-) create mode 100644 include/BM1DProcess.hh create mode 100644 include/BM1DProcess.hh~ create mode 100644 include/Plotter.hh create mode 100644 include/Plotter.hh~ delete mode 100644 include/Progress.hh create mode 100644 result.root mode change 100755 => 100644 setup.sh create mode 100644 src/BM1DProcess.cc create mode 100644 src/BM1DProcess.cc~ create mode 100644 src/Plotter.cc create mode 100644 src/Plotter.cc~ delete mode 100644 src/Progress.cc diff --git a/BM1D.cc b/BM1D.cc index 2eae252..4f98d29 100644 --- a/BM1D.cc +++ b/BM1D.cc @@ -1,81 +1,20 @@ -/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári, Dávid Baranyai - #include -#include "Progress.hh" +#include "BM1DProcess.hh" +#include "Plotter.hh" #include "TApplication.h" -#include "TGraph.h" using namespace std; -void OpenRootFile() -{ - TFile *fIn = TFile::Open("Plot1.root", "READ"); - fIn->ls(); - TGraph *Ga; - TGraph *Gb; - fIn->GetObject("1", Ga); - fIn->GetObject("2", Gb); - Ga->Draw(); - Gb->Draw("same"); - delete fIn; -} - - int main(int argc, char* argv[]) { - Int_t n = 1000, p0 = 1, start = 0; - - TApplication App("tapp", &argc, argv); - TCanvas* Canv = new TCanvas("c10","Live display",800,400); - - if(argc==2) - { - OpenRootFile(); - } - else - { - - Progress* Pr1 = new Progress(n,p0,start); - Progress* Pr2 = new Progress(n,p0,start); - - Pr1->Count('u'); - Pr2->Count('g'); - - vector x1 = Pr1->GetX(); - vector y1 = Pr1->GetY(); - vector x2 = Pr2->GetX(); - vector y2 = Pr2->GetY(); - - TGraph* G1 = new TGraph(n,&x1[0],&y1[0]); - TGraph* G2 = new TGraph(n,&x2[0],&y2[0]); - - TFile* fOut = new TFile("Plot1.root", "RECREATE"); - - G1->SetLineColor(1); - G1->SetLineWidth(1); - G1->SetMarkerColor(1); - G1->SetMarkerStyle(0); - G1->SetTitle("Brownian Movement D=1"); - G1->GetXaxis()->SetTitle("X"); - G1->GetYaxis()->SetTitle("Time"); - G2->SetLineColor(2); - G2->SetLineWidth(1); - G2->SetMarkerColor(2); - G2->SetMarkerStyle(0); - G2->SetTitle("Brownian Movement D=1"); - G2->GetXaxis()->SetTitle("X"); - G2->GetYaxis()->SetTitle("Time"); - - G1->Draw(); - G2->Draw("same"); - G1->Write("1"); - G2->Write("2"); - - fOut->Close(); - - } - - App.Run(); - return 0; + TApplication App("tapp", &argc, argv); + Int_t n = 1000; + BM1DProcess *myBM1DProcess = new BM1DProcess(n); + myBM1DProcess->Init(); + myBM1DProcess->Run(); + Plotter* myPlotter = new Plotter(); + myPlotter->Plot(n, myBM1DProcess->GetT(), myBM1DProcess->GetX()); + App.Run(); + return 0; } diff --git a/README.md b/README.md index 9296e62..d91fdaa 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ If there's command line argument, then program opens the created root file. Name ## Updates +* 2017/10/30 - 'v1.4' - New Structure + * 2017/10/29 - 'v1.3.1' - Release Candidate * 2017/10/29 - 'v1.3' - Minor fixes in Progress diff --git a/include/BM1DProcess.hh b/include/BM1DProcess.hh new file mode 100644 index 0000000..ba91c09 --- /dev/null +++ b/include/BM1DProcess.hh @@ -0,0 +1,35 @@ +#ifndef BM1DProcess_h +#define BM1DProcess_h 1 + +#include +#include +#include +#include + +#include "TRandom.h" + +class BM1DProcess { +public: + BM1DProcess(Int_t n); //n is the number of steps + ~BM1DProcess(); + + void SetP0(Double_t p0_new){p0 = p0_new;} + void SetP1(Double_t p1_new){p1 = p1_new;} + + void Init(); + void Run(); + + std::vector GetT(){return t;} + std::vector GetX(){return x;} + + private: + Int_t nSteps; + Double_t p0,p1,p2,p3,p4; + TRandom* randomGenerator; + Double_t rand1; + std::vector t; + std::vector x; +}; + +#endif + diff --git a/include/BM1DProcess.hh~ b/include/BM1DProcess.hh~ new file mode 100644 index 0000000..e69de29 diff --git a/include/Plotter.hh b/include/Plotter.hh new file mode 100644 index 0000000..d21ed09 --- /dev/null +++ b/include/Plotter.hh @@ -0,0 +1,32 @@ +#ifndef Plotter_h +#define Plotter_h 1 + +#include +#include +#include +#include + +#include "TROOT.h" +#include "TF1.h" +#include "TH1.h" +#include "TH2.h" +#include "TH3.h" +#include "TNtuple.h" +#include "TFile.h" +#include "TMath.h" +#include "TCanvas.h" +#include "TGraph.h" +#include "TTree.h" + +class Plotter { +public: + Plotter(); + void Plot(Int_t n, std::vector t, std::vector x); +private: + TGraph* g1; + TFile* fOut; + TCanvas* canv; + TTree *BM1DTree; + Double_t tl,xl; +}; +#endif diff --git a/include/Plotter.hh~ b/include/Plotter.hh~ new file mode 100644 index 0000000..e69de29 diff --git a/include/Progress.hh b/include/Progress.hh deleted file mode 100644 index 2762ef5..0000000 --- a/include/Progress.hh +++ /dev/null @@ -1,58 +0,0 @@ -/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári, Dávid Baranyai - -#ifndef Progress_h -#define Progress_h 1 - -#include -#include -#include -#include - -#include "TROOT.h" -#include "TF1.h" -#include "TH1.h" -#include "TH2.h" -#include "TH3.h" -#include "TNtuple.h" -#include "TFile.h" -#include "TRandom.h" -#include "TMath.h" -#include "TCanvas.h" - -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(char a); - Double_t GetPrevious(); - - void SetP0(double p0_new); - - std::vector GetX(); - std::vector GetY(); - -private: - - TRandom* random1; - const Int_t n; - std::vector x; - std::vector y; - - Double_t p0; - Double_t preVstate; - Int_t steps; - -}; - -#endif - - diff --git a/result.root b/result.root new file mode 100644 index 0000000000000000000000000000000000000000..25bbb833ee0f3228984d7c7eaa28616467ca0ca2 GIT binary patch literal 13269 zcmbum1z1~46fPRvp~am7#fw96D8Y*sin~K`f(I#9+$nBFiaQjCQY28^rMMR;S_lNY zq4%A0-+SkL@1Fa;tZyf?bXNY^JA3x5jH{EA8vrog4gdfw007<@_>lu|3&0Nq_#uq^ zKO5vA0Dv?KfUt(M=GeadbT^d*0Ra%uc?{S7r2ANb@9<3 z^{t$%sk05rpLZgltCOdrt*PTPWhW0y2TMn{XVPNadP?YJ*nm|vfEU8AABxeGa#WC0 z*Q~GaLu{m=#B_DeN9{K;C2(9N%m&w=i~le^FhQbM~FYGiva` z>WI)>cxT|Y>)L&KX`%ICT2cFZH(G4h?+rVFD#Mn99PiVa^1132F9xyG@w@Ytl$IV( zn)CpF$j13Z*O)}d5A6|dyPdg-Qe*qm(|P;TDbiDk-7nwJ6iyuNH^aF4;?~5j-W;xV zTw%21@wU@QMBuFzpG;km-M;WR1zmaHB8rFOt&^ORM!vg4^G>_vx)y}f(=+-l0yxPH z#wDsgQi5s%c#Ha)`^AitSu^ARcO(T$gZ_lgX`aCzQy*p%J_ox`rT{d7vpB3xCd)f`Jfhycm-IQ3^1Vs&7PqhSP!w4!|h;P3@ z2AT+5Bgrs#bW9?M<#g6bsZ?tEbx+_3rQ-jK+!8MTH+!PE1nqyb7onzKRTyBgVooy; zWYD8D4K;TY>?XJF))tdBQvMe?90w!Cf02KJ3~~Wv<{7VN7)bw9uRBB>aJh*x|FfX|v;>3bq@q3I#&Dgz>V5@)2>Z=$kHC^QaDJ{S@nn#TIQ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G08(f!#1oy5Mmk@0+h{8di75 zBS;NR@Y?^*R50Tpk?2O4#Me6_s#PrQ566ZVr^*&S{GtS7fw@4HTN)p?2`hNfA@9%5 z6wsei#Gjoh@O>qJN)i9qnF1HX|19+< literal 0 HcmV?d00001 diff --git a/setup.sh b/setup.sh old mode 100755 new mode 100644 index ee2b421..7587dd5 --- a/setup.sh +++ b/setup.sh @@ -1,10 +1,6 @@ #!/bin/bash -# -# Author: Balázs Demeter (balazsdemeter92@gmail.com) -# Version: 1.0 -# -# Script for build and make Brownian movement in one dimension +rm -rf bm1d_build mkdir bm1d_build cd bm1d_build cmake ../ diff --git a/src/BM1DProcess.cc b/src/BM1DProcess.cc new file mode 100644 index 0000000..364a117 --- /dev/null +++ b/src/BM1DProcess.cc @@ -0,0 +1,40 @@ +#include "BM1DProcess.hh" + +BM1DProcess::BM1DProcess(Int_t nP) : + nSteps (nP), p0(0.5), p1(0.3) +{ + randomGenerator = new TRandom(); +} + +BM1DProcess::~BM1DProcess() +{ + ; +} + +void BM1DProcess::Init(){ + t.push_back(0.0); //let's start at t=0, x=0, you can change it if you vant, please use Set methods + x.push_back(0.0); +} + +void BM1DProcess::Run(){ + for (Int_t i = 1;i < nSteps;i++) + { + rand1 = randomGenerator->Uniform(); + if(rand1 < p0) { //step in time, but no step in x + t.push_back(t[i-1] + 1); + x.push_back(x[i-1]); + } + else {//step left or right + if(rand1 < p0 + p1) + { + t.push_back(t[i-1]+1); + x.push_back(x[i-1]+1); //one step right + } + else + { + t.push_back(t[i-1]+1); + x.push_back(x[i-1]-1); //one step left + } + } + } +} diff --git a/src/BM1DProcess.cc~ b/src/BM1DProcess.cc~ new file mode 100644 index 0000000..792d600 --- /dev/null +++ b/src/BM1DProcess.cc~ @@ -0,0 +1 @@ +# diff --git a/src/Plotter.cc b/src/Plotter.cc new file mode 100644 index 0000000..b947b4e --- /dev/null +++ b/src/Plotter.cc @@ -0,0 +1,35 @@ +#include "Plotter.hh" + +Plotter::Plotter() +{ + ; +} +void Plotter::Plot(Int_t n, std::vector t, std::vector x){ + fOut = new TFile("result.root", "RECREATE"); + g1 = new TGraph(n,&t[0],&x[0]); + canv = new TCanvas("canc","display",800,400); + TTree *BM1DTree = new TTree("BM1DTree","BM1DTree"); + + g1->Draw(); + g1->SetLineColor(1); + g1->SetLineWidth(1); + g1->SetMarkerColor(1); + g1->SetMarkerStyle(0); + g1->SetTitle("Brownian Movement D=1"); + g1->GetYaxis()->SetTitle("X"); + g1->GetXaxis()->SetTitle("Time"); + + BM1DTree->Branch("tl",&tl, "tl/D"); + BM1DTree->Branch("xl",&xl, "xl/D"); + for (unsigned int i = 0; i < t.size(); i++){ + tl = t[i]; + xl = x[i]; + BM1DTree->Fill(); + } + + g1->Write(); + BM1DTree->Write(); + fOut->Close(); + +} + diff --git a/src/Plotter.cc~ b/src/Plotter.cc~ new file mode 100644 index 0000000..e69de29 diff --git a/src/Progress.cc b/src/Progress.cc deleted file mode 100644 index 9f6fa55..0000000 --- a/src/Progress.cc +++ /dev/null @@ -1,92 +0,0 @@ -/// 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), 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(); -} - -Progress::~Progress() -{ - -} - -void Progress::Count(char a) -{ - for (Int_t i=0;iUniform(-p0,p0); - break; - - case 'g': - preVstate+=random1->Gaus(-p0,p0); - break; - - default: - std::cout<<"Invalid argument!"< Progress::GetX() -{ - return x; -} - -std::vector Progress::GetY() -{ - return y; -}