BM1D/BM1D.cc

82 lines
1.6 KiB
C++
Raw Normal View History

2017-10-29 13:31:44 +01:00
/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári, Dávid Baranyai
2017-10-29 12:17:15 +01:00
#include <iostream>
#include "Progress.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[])
{
2017-10-30 01:11:16 +01:00
Int_t n = 1000, p0 = 1, start = 0;
2017-10-29 12:17:15 +01:00
TApplication App("tapp", &argc, argv);
TCanvas* Canv = new TCanvas("c10","Live display",800,400);
if(argc==2)
{
OpenRootFile();
}
else
{
2017-10-30 01:11:16 +01:00
Progress* Pr1 = new Progress(n,p0,start);
Progress* Pr2 = new Progress(n,p0,start);
2017-10-29 12:17:15 +01:00
Pr1->Count('u');
Pr2->Count('g');
vector<Double_t> x1 = Pr1->GetX();
vector<Double_t> y1 = Pr1->GetY();
vector<Double_t> x2 = Pr2->GetX();
vector<Double_t> 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;
}