BM1D/BM1D.cc

86 lines
2.0 KiB
C++
Raw Normal View History

2017-10-29 12:17:15 +01:00
#include <iostream>
2017-10-30 09:41:11 +01:00
#include "BM1DProcess.hh"
#include "Plotter.hh"
2017-10-29 12:17:15 +01:00
#include "TApplication.h"
2017-10-31 14:44:08 +01:00
#include "Analyse.hh"
2017-10-29 12:17:15 +01:00
using namespace std;
int main(int argc, char* argv[])
{
2017-10-31 14:25:25 +01:00
Int_t nSteps, nRuns;
Double_t p0,p1,x1,x2;
Double_t mu1, mu2, sigma1, sigma2;
string fileName="input.root";
char random_type='u';
Int_t vis, typeOfRun;
2017-10-31 14:25:25 +01:00
nSteps=nRuns=vis=typeOfRun=0;
mu1=mu2=sigma1=sigma2=p0=p1=x1=x2=0.0;
if(argc==15)
{
nSteps=atoi(argv[1]);
nRuns=atoi(argv[2]);
2017-10-31 14:25:25 +01:00
p0=atof(argv[3]);
p1=atof(argv[4]);
x1=atof(argv[5]);
x2=atof(argv[6]);
mu1=atof(argv[7]);
mu2=atof(argv[8]);
sigma1=atof(argv[9]);
sigma2=atof(argv[10]);
fileName=argv[11];
random_type=argv[13][0];
vis=atoi(argv[14]); if((vis!=0)||(vis!=1)){vis=0;}
typeOfRun=atoi(argv[15]); if((typeOfRun!=0)||(typeOfRun!=1)||(typeOfRun!=2)){typeOfRun=0;}
}
else
{
//default runs with less parameters
2017-10-31 14:25:25 +01:00
random_type = 'g';
nSteps = 1000;
2017-10-31 14:25:25 +01:00
nRuns = 1;
p0 = 0.5;
p1 = 0;
2017-10-31 14:25:25 +01:00
x1 = 0;
x2 = 0;
mu1 = 1;
mu2 = 0;
sigma1 = 2;
sigma2 = 0;
vis = 1;
typeOfRun = 1;
}
2017-10-30 09:41:11 +01:00
TApplication App("tapp", &argc, argv);
2017-10-31 12:35:01 +01:00
BM1DProcess *myBM1DProcess = new BM1DProcess();
switch(random_type){
case 'u':
myBM1DProcess->Run(nRuns, nSteps, p0, p1);
break;
case 'g':
myBM1DProcess->Run(nRuns, nSteps, p0, mu1, sigma1);
break;
case 'l':
myBM1DProcess->Run(nRuns, nSteps, p0, x1, x2, mu1, sigma1, mu2, sigma2);
break;
default:
cout<<"ERROR! Wrong parameter for type of random generator! \n No run!"<<endl;
break;
}
Plotter* myPlotter = new Plotter(vis==1);
2017-10-31 12:36:48 +01:00
myPlotter->Plot(nRuns, nSteps, myBM1DProcess->GetT(), myBM1DProcess->GetX());
2017-10-31 14:44:08 +01:00
Analyse *myAnalyse = new Analyse();
2017-10-31 14:47:28 +01:00
switch(random_type){
case 'g' :
myAnalyse->AnalyseGaus(myBM1DProcess->GetT(),myBM1DProcess->GetX());
}
2017-10-29 12:17:15 +01:00
2017-10-30 09:41:11 +01:00
App.Run();
return 0;
2017-10-29 12:17:15 +01:00
}