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-31 15:36:02 +01:00
|
|
|
#include "BM1DSave.hh"
|
2017-11-06 23:06:18 +01:00
|
|
|
#include "Draw2D.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;
|
2017-11-06 23:06:18 +01:00
|
|
|
Double_t mu1, mu2, sigma1, sigma2, percent;
|
|
|
|
|
2017-11-03 15:45:39 +01:00
|
|
|
Double_t j_mu1, j_sigma1;//////////////////////
|
|
|
|
Double_t rat;//////////////////////
|
2017-11-06 23:06:18 +01:00
|
|
|
|
|
|
|
int nGenerated, nop;
|
|
|
|
|
|
|
|
const char* fileName="input.root";
|
|
|
|
char random_type='u';
|
2017-10-31 10:39:23 +01:00
|
|
|
Int_t vis, typeOfRun;
|
2017-11-06 23:06:18 +01:00
|
|
|
|
2017-10-31 10:39:23 +01:00
|
|
|
|
2017-10-31 14:25:25 +01:00
|
|
|
nSteps=nRuns=vis=typeOfRun=0;
|
2017-11-06 23:06:18 +01:00
|
|
|
mu1=mu2=sigma1=sigma2=p0=p1=x1=x2=0.0;
|
|
|
|
if(argc==15)
|
|
|
|
{
|
|
|
|
nSteps=atoi(argv[1]);
|
|
|
|
nRuns=atoi(argv[2]);
|
|
|
|
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[12][0];
|
|
|
|
vis=atoi(argv[13]); if((vis!=0)&&(vis!=1)){vis=0;}
|
|
|
|
typeOfRun=atoi(argv[14]); if((typeOfRun!=0)&&(typeOfRun!=1)&&(typeOfRun!=2)){typeOfRun=0;}
|
|
|
|
//todo fix parameters
|
|
|
|
percent = 0.99;
|
|
|
|
nGenerated = 7000;
|
2018-01-24 10:40:46 +01:00
|
|
|
nop = 30;
|
2017-11-06 23:06:18 +01:00
|
|
|
|
|
|
|
j_mu1=-25;
|
|
|
|
j_sigma1=0.3;
|
|
|
|
rat=0.9;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-10-31 10:39:23 +01:00
|
|
|
//default runs with less parameters
|
2017-11-06 23:06:18 +01:00
|
|
|
random_type = 'g';
|
|
|
|
nSteps = 2000;
|
|
|
|
nRuns = 1;
|
|
|
|
p0 = 0.5;
|
2017-10-31 14:03:30 +01:00
|
|
|
p1 = 0;
|
2017-11-06 23:06:18 +01:00
|
|
|
x1 = 0;
|
|
|
|
x2 = 0;
|
2017-10-31 14:25:25 +01:00
|
|
|
mu1 = 1;
|
2017-11-06 23:06:18 +01:00
|
|
|
mu2 = 0;
|
|
|
|
sigma1 = 10;
|
|
|
|
sigma2 = 0;
|
|
|
|
|
|
|
|
j_mu1=-25;
|
|
|
|
j_sigma1=0.3;
|
|
|
|
rat=0.9;
|
|
|
|
|
|
|
|
percent = 0.99;
|
2018-01-23 22:07:32 +01:00
|
|
|
nGenerated = 8000;
|
|
|
|
nop = 40;
|
2017-11-06 23:06:18 +01:00
|
|
|
|
2017-10-31 14:03:30 +01:00
|
|
|
vis = 1;
|
|
|
|
typeOfRun = 1;
|
2017-11-06 23:06:18 +01:00
|
|
|
}
|
|
|
|
|
2017-10-31 10:39:23 +01:00
|
|
|
|
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();
|
2017-10-31 11:28:19 +01:00
|
|
|
switch(random_type){
|
|
|
|
case 'u':
|
2017-10-31 12:07:39 +01:00
|
|
|
myBM1DProcess->Run(nRuns, nSteps, p0, p1);
|
2017-10-31 11:28:19 +01:00
|
|
|
break;
|
|
|
|
case 'g':
|
2017-10-31 12:07:39 +01:00
|
|
|
myBM1DProcess->Run(nRuns, nSteps, p0, mu1, sigma1);
|
2017-10-31 11:28:19 +01:00
|
|
|
break;
|
|
|
|
case 'l':
|
2017-10-31 12:07:39 +01:00
|
|
|
myBM1DProcess->Run(nRuns, nSteps, p0, x1, x2, mu1, sigma1, mu2, sigma2);
|
2017-10-31 11:28:19 +01:00
|
|
|
break;
|
2017-11-06 23:06:18 +01:00
|
|
|
case 'j':
|
2017-11-03 15:45:39 +01:00
|
|
|
myBM1DProcess->Run(nRuns, nSteps, p0, x1, x2, mu1, sigma1, mu2, sigma2, j_mu1, j_sigma1, rat);
|
|
|
|
break;
|
2017-10-31 11:28:19 +01:00
|
|
|
default:
|
|
|
|
cout<<"ERROR! Wrong parameter for type of random generator! \n No run!"<<endl;
|
|
|
|
break;
|
|
|
|
}
|
2017-11-06 23:06:18 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
TH1D *hJump = new TH1D("h", "test", 100, -30., 30.);
|
2017-11-03 15:45:39 +01:00
|
|
|
hJump->Sumw2();
|
|
|
|
std::vector<Double_t> x = myBM1DProcess->GetX();
|
|
|
|
hJump->Fill(0);
|
|
|
|
for(int i=1; i<x.size(); i++){
|
|
|
|
hJump->Fill(x[i]-x[i-1]);
|
|
|
|
}
|
|
|
|
hJump->Draw();
|
2017-11-06 23:06:18 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
Plotter* myPlotter = new Plotter(vis==1);
|
|
|
|
myPlotter->Plot(nRuns, nSteps, myBM1DProcess->GetT(), myBM1DProcess->GetX());
|
2017-11-03 15:45:39 +01:00
|
|
|
|
2018-01-23 22:07:32 +01:00
|
|
|
int numCPU = sysconf(_SC_NPROCESSORS_ONLN);
|
|
|
|
std::cout <<"cpus:"<<numCPU <<std::endl;
|
2018-01-23 20:10:54 +01:00
|
|
|
|
2018-01-23 22:07:32 +01:00
|
|
|
Draw2D *myDraw2D = new Draw2D(nop, percent, nGenerated, myBM1DProcess->GetT(), myBM1DProcess->GetX(),numCPU); //nop percent nruns
|
2017-11-03 15:45:39 +01:00
|
|
|
|
2017-11-06 23:06:18 +01:00
|
|
|
switch(random_type){
|
|
|
|
case 'g' :
|
|
|
|
Analyse *myAnalyse = new Analyse();
|
|
|
|
myAnalyse->AnalyseGaus(myBM1DProcess->GetT(),myBM1DProcess->GetX());
|
|
|
|
myDraw2D -> Histo2D();
|
|
|
|
}
|
|
|
|
BM1DSave *save = new BM1DSave();
|
|
|
|
save->SaveToTree(myPlotter->GetTmultiGraph(), p0, p1, nSteps, nRuns, x1, x2, mu1, mu2, sigma1, sigma2, myBM1DProcess->GetT(), myBM1DProcess->GetX(),fileName);
|
2017-10-30 09:41:11 +01:00
|
|
|
App.Run();
|
|
|
|
return 0;
|
2017-10-29 12:17:15 +01:00
|
|
|
}
|