fixed BM1D.cc
This commit is contained in:
		
							parent
							
								
									4d0b94e145
								
							
						
					
					
						commit
						a4ef471926
					
				
							
								
								
									
										112
									
								
								BM1D.cc
								
								
								
								
							
							
						
						
									
										112
									
								
								BM1D.cc
								
								
								
								
							| 
						 | 
					@ -4,6 +4,7 @@
 | 
				
			||||||
#include "TApplication.h"
 | 
					#include "TApplication.h"
 | 
				
			||||||
#include "Analyse.hh"
 | 
					#include "Analyse.hh"
 | 
				
			||||||
#include "BM1DSave.hh"
 | 
					#include "BM1DSave.hh"
 | 
				
			||||||
 | 
					#include "Draw2D.hh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using namespace std;
 | 
					using namespace std;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,31 +12,72 @@ int main(int argc, char* argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    Int_t nSteps, nRuns;
 | 
					    Int_t nSteps, nRuns;
 | 
				
			||||||
	Double_t p0,p1,x1,x2;
 | 
						Double_t p0,p1,x1,x2;
 | 
				
			||||||
    Double_t mu1, mu2, sigma1, sigma2;
 | 
					    Double_t mu1, mu2, sigma1, sigma2, percent;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	Double_t j_mu1, j_sigma1;//////////////////////
 | 
						Double_t j_mu1, j_sigma1;//////////////////////
 | 
				
			||||||
	Double_t rat;//////////////////////
 | 
						Double_t rat;//////////////////////
 | 
				
			||||||
    const char* fileName="input.root";
 | 
						
 | 
				
			||||||
    char random_type='j';
 | 
						int nGenerated, nop;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						const char* fileName="input.root";
 | 
				
			||||||
 | 
					    char random_type='u';
 | 
				
			||||||
    Int_t vis, typeOfRun;
 | 
					    Int_t vis, typeOfRun;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    nSteps=nRuns=vis=typeOfRun=0;
 | 
					    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]);
 | 
				
			||||||
 | 
					        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;
 | 
				
			||||||
 | 
							nop = 30;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							j_mu1=-25; 
 | 
				
			||||||
 | 
					        j_sigma1=0.3;
 | 
				
			||||||
 | 
					        rat=0.9;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
        //default runs with less parameters
 | 
					        //default runs with less parameters
 | 
				
			||||||
		random_type = 'j';
 | 
							random_type = 'g';
 | 
				
			||||||
		nSteps = 1000;
 | 
							nSteps = 2000;
 | 
				
			||||||
		nRuns = 5;
 | 
							nRuns = 1;
 | 
				
			||||||
		p0 = 0;
 | 
							p0 = 0.5;
 | 
				
			||||||
		p1 = 0;
 | 
							p1 = 0;
 | 
				
			||||||
		x1 = 200000;
 | 
							x1 = 0;
 | 
				
			||||||
		x2 = 200000;
 | 
							x2 = 0;
 | 
				
			||||||
		mu1 = 1;
 | 
							mu1 = 1;
 | 
				
			||||||
		mu2 = -6;
 | 
							mu2 = 0;
 | 
				
			||||||
		sigma1 = 0.8;
 | 
							sigma1 = 10;
 | 
				
			||||||
		sigma2 = 0.2;
 | 
							sigma2 = 0;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							j_mu1=-25; 
 | 
				
			||||||
 | 
					        j_sigma1=0.3;
 | 
				
			||||||
 | 
					        rat=0.9;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							percent = 0.99; 
 | 
				
			||||||
 | 
							nGenerated = 8000;
 | 
				
			||||||
 | 
							nop = 30;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		vis = 1;
 | 
							vis = 1;
 | 
				
			||||||
		typeOfRun = 1;
 | 
							typeOfRun = 1;
 | 
				
			||||||
        j_mu1=-25; 
 | 
					    }
 | 
				
			||||||
        j_sigma1=0.3;
 | 
					
 | 
				
			||||||
        rat=0.9;     
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TApplication App("tapp", &argc, argv);
 | 
					  TApplication App("tapp", &argc, argv);
 | 
				
			||||||
  BM1DProcess *myBM1DProcess = new BM1DProcess();
 | 
					  BM1DProcess *myBM1DProcess = new BM1DProcess();
 | 
				
			||||||
| 
						 | 
					@ -49,17 +91,16 @@ int main(int argc, char* argv[])
 | 
				
			||||||
        case 'l':
 | 
					        case 'l':
 | 
				
			||||||
            myBM1DProcess->Run(nRuns, nSteps, p0, x1, x2, mu1, sigma1, mu2, sigma2);
 | 
					            myBM1DProcess->Run(nRuns, nSteps, p0, x1, x2, mu1, sigma1, mu2, sigma2);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 'j':
 | 
							 case 'j':
 | 
				
			||||||
            myBM1DProcess->Run(nRuns, nSteps, p0, x1, x2, mu1, sigma1, mu2, sigma2, j_mu1, j_sigma1, rat);
 | 
					            myBM1DProcess->Run(nRuns, nSteps, p0, x1, x2, mu1, sigma1, mu2, sigma2, j_mu1, j_sigma1, rat);
 | 
				
			||||||
            //cout << "\nOK\n";
 | 
					 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        default:
 | 
					        default:
 | 
				
			||||||
            cout<<"ERROR! Wrong parameter for type of random generator! \n No run!"<<endl;
 | 
					            cout<<"ERROR! Wrong parameter for type of random generator! \n No run!"<<endl;
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
						
 | 
				
			||||||
  
 | 
						/*
 | 
				
			||||||
  TH1D *hJump = new TH1D("h", "test", 100, -30., 30.);                         
 | 
						TH1D *hJump = new TH1D("h", "test", 100, -30., 30.);                         
 | 
				
			||||||
  hJump->Sumw2();                                                          
 | 
					  hJump->Sumw2();                                                          
 | 
				
			||||||
  std::vector<Double_t> x = myBM1DProcess->GetX();                                                   
 | 
					  std::vector<Double_t> x = myBM1DProcess->GetX();                                                   
 | 
				
			||||||
  hJump->Fill(0);
 | 
					  hJump->Fill(0);
 | 
				
			||||||
| 
						 | 
					@ -67,25 +108,22 @@ int main(int argc, char* argv[])
 | 
				
			||||||
    hJump->Fill(x[i]-x[i-1]);
 | 
					    hJump->Fill(x[i]-x[i-1]);
 | 
				
			||||||
  }    
 | 
					  }    
 | 
				
			||||||
  hJump->Draw();
 | 
					  hJump->Draw();
 | 
				
			||||||
 | 
						*/
 | 
				
			||||||
 // std::cout << "Pontok szama: "<< x.size() << "\n";
 | 
						
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						Plotter* myPlotter = new Plotter(vis==1);
 | 
				
			||||||
 | 
						myPlotter->Plot(nRuns, nSteps, myBM1DProcess->GetT(), myBM1DProcess->GetX()); 
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					  Draw2D *myDraw2D = new Draw2D(nop, percent, nGenerated, myBM1DProcess->GetT(), myBM1DProcess->GetX()); //nop percent nruns
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Plotter* myPlotter = new Plotter(vis==1);
 | 
					  switch(random_type){
 | 
				
			||||||
  myPlotter->Plot(nRuns, nSteps, myBM1DProcess->GetT(), myBM1DProcess->GetX()); 
 | 
					  	case 'g' :
 | 
				
			||||||
 | 
							Analyse *myAnalyse = new Analyse();
 | 
				
			||||||
 | 
							myAnalyse->AnalyseGaus(myBM1DProcess->GetT(),myBM1DProcess->GetX());
 | 
				
			||||||
 | 
							myDraw2D -> Histo2D();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  BM1DSave *save = new BM1DSave();
 | 
				
			||||||
 // Analyse *myAnalyse = new Analyse();
 | 
					  save->SaveToTree(myPlotter->GetTmultiGraph(), p0, p1, nSteps, nRuns, x1, x2, mu1, mu2, sigma1, sigma2, myBM1DProcess->GetT(), myBM1DProcess->GetX(),fileName);
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
 // switch(random_type){
 | 
					 | 
				
			||||||
 // 	case 'g' :
 | 
					 | 
				
			||||||
 // 	  myAnalyse->AnalyseGaus(myBM1DProcess->GetT(),myBM1DProcess->GetX());
 | 
					 | 
				
			||||||
//  }
 | 
					 | 
				
			||||||
//  BM1DSave *save = new BM1DSave();
 | 
					 | 
				
			||||||
//  save->SaveToTree(myPlotter->GetTmultiGraph(), p0, p1, nSteps, nRuns, x1, x2, mu1, mu2, sigma1, sigma2, myBM1DProcess->GetT(), myBM1DProcess->GetX(),fileName);
 | 
					 | 
				
			||||||
  App.Run();
 | 
					  App.Run();
 | 
				
			||||||
  return 0;
 | 
					  return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue