diff --git a/BM1D.cc b/BM1D.cc index cd0f45a..5aafb73 100644 --- a/BM1D.cc +++ b/BM1D.cc @@ -45,7 +45,7 @@ int main(int argc, char* argv[]) //todo fix parameters percent = 0.99; nGenerated = 7000; - nop = 43; + nop = 30; j_mu1=-25; j_sigma1=0.3; diff --git a/include/Crusher.hh b/include/Crusher.hh index a153fcb..bb83175 100644 --- a/include/Crusher.hh +++ b/include/Crusher.hh @@ -11,8 +11,10 @@ class Crusher { public: - Crusher(std::vector tp, std::vector xp, double p0p); - Crusher(std::vector tp, std::vector xp); + Crusher(const std::vector & tp, const std::vector & xp, double p0p); + Crusher(const std::vector & tp, const std::vector & xp); + + ~Crusher(); bool RunMachine(const int & nRunsm, const MuSigma & parameters); @@ -23,13 +25,14 @@ class Crusher private: int nSteps; double p0; - std::vector t; - std::vector x; + double BiggerLimit; + std::vector t; + std::vector x; BM1DProcess *myBM1DProcess; Analyse *myAnalyse; - bool Bigger(double percent); + inline bool Bigger(); std::vector multipleRunVectorT; std::vector multipleRunVectorX; diff --git a/include/Draw2DWorkerThread.hh b/include/Draw2DWorkerThread.hh index 7d2d8a5..42a9dd7 100644 --- a/include/Draw2DWorkerThread.hh +++ b/include/Draw2DWorkerThread.hh @@ -28,7 +28,7 @@ class Draw2DWorkerThread { public: - Draw2DWorkerThread(int jobOffset_, int jobSize_, std::vector x_, std::vector t_, int nRuns_, Lattice *myLattice_, TH2D *BM1D_histo_, TH2D *BM1D_histo2_, struct graphArray graphArray_, pthread_mutex_t *histoMutex_); + Draw2DWorkerThread(int jobOffset_, int jobSize_, const std::vector & x_, const std::vector & t_, int nRuns_, Lattice *myLattice_, TH2D *BM1D_histo_, TH2D *BM1D_histo2_, struct graphArray graphArray_, pthread_mutex_t *histoMutex_); ~Draw2DWorkerThread(); @@ -45,8 +45,8 @@ private: int nRuns; //Chrusher parameter number of tested "kukac" - std::vector t; //original "kukac" - std::vector x; + //std::vector t; //original "kukac" + //std::vector x; Crusher *myCrusher; diff --git a/setup.sh b/setup.sh index 942a4f2..cf5cec7 100755 --- a/setup.sh +++ b/setup.sh @@ -3,6 +3,6 @@ rm -rf ../bm1d_build mkdir ../bm1d_build cd ../bm1d_build -cmake ../BM1D +cmake -DCMAKE_BUILD_TYPE=Release ../BM1D make echo Setup complete. diff --git a/src/Crusher.cc b/src/Crusher.cc index d6ae3cd..18cae32 100644 --- a/src/Crusher.cc +++ b/src/Crusher.cc @@ -1,23 +1,30 @@ #include "Crusher.hh" -Crusher::Crusher(std::vector tp, std::vector xp, double p0p) +Crusher::Crusher(const std::vector & tp, const std::vector & xp, double p0p) { - nSteps = tp.size(); t = tp; x = xp; p0 = p0p; + + nSteps = t.size(); + + const double percent = 0.5; + BiggerLimit = nSteps * percent; myBM1DProcess = new BM1DProcess(); - } -Crusher::Crusher(std::vector tp, std::vector xp) +Crusher::Crusher(const std::vector & tp, const std::vector & xp) { - nSteps = tp.size(); t = tp; x = xp; p0 = 0.5; - + + nSteps = t.size(); + + const double percent = 0.5; + BiggerLimit = nSteps * percent; + myBM1DProcess = new BM1DProcess(); } @@ -26,22 +33,23 @@ Crusher::~Crusher() delete myBM1DProcess; } -bool Crusher::Bigger(double percent) +inline bool Crusher::Bigger() { int counterBig = 0; - double limit = nSteps * percent; + //double limit = nSteps * percent; + const std::vector & refx = myBM1DProcess -> GetX(); for(int i = 0; i < nSteps; i++) { - if(myBM1DProcess -> GetX()[i] < x[i]) // reference < origin + if(refx[i] < x[i]) // reference < origin { counterBig ++; } } - if(counterBig >= limit) + if(counterBig >= BiggerLimit) { return true; } @@ -71,7 +79,7 @@ bool Crusher::RunMachine(const int & nRuns, const MuSigma & parameters) } - if(Bigger(0.5)) + if(Bigger()) { counter ++; } diff --git a/src/Draw2D.cc b/src/Draw2D.cc index b4b2007..ceab58a 100644 --- a/src/Draw2D.cc +++ b/src/Draw2D.cc @@ -27,8 +27,8 @@ Draw2D::Draw2D(int nop, double percent, int nRunsp, std::vector tp, st BM1D_histo2 = new TH2D("BM1D_histo2", "BM1D_histo2", myLattice -> GetWidth() , myLattice -> GetMuMin(), (myLattice -> GetMuMax()) , myLattice -> GetHeight() , myLattice -> GetSigmaMin(), (myLattice -> GetSigmaMax()) ); graphArray.size = myLattice -> GetLatticeSize(); - graphArray.X = new double[graphArray.size]; - graphArray.Y = new double[graphArray.size]; + graphArray.X = new double[graphArray.size] {}; + graphArray.Y = new double[graphArray.size] {}; gr = new TGraph(graphArray.size); diff --git a/src/Draw2DWorkerThread.cc b/src/Draw2DWorkerThread.cc index be73203..87687bb 100644 --- a/src/Draw2DWorkerThread.cc +++ b/src/Draw2DWorkerThread.cc @@ -1,11 +1,11 @@ #include "Draw2DWorkerThread.hh" -Draw2DWorkerThread::Draw2DWorkerThread(int jobOffset_, int jobSize_, std::vector x_, std::vector t_, int nRuns_, Lattice *myLattice_, TH2D *BM1D_histo_, TH2D *BM1D_histo2_, struct graphArray graphArray_, pthread_mutex_t *histoMutex_) +Draw2DWorkerThread::Draw2DWorkerThread(int jobOffset_, int jobSize_, const std::vector & x_, const std::vector & t_, int nRuns_, Lattice *myLattice_, TH2D *BM1D_histo_, TH2D *BM1D_histo2_, struct graphArray graphArray_, pthread_mutex_t *histoMutex_) { std::cout << "Draw2DWorkerThread::Draw2DWorkerThread" < GetMuMax() - myLattice -> GetMuMin())/ myLattice -> GetWidth() ; @@ -63,5 +63,5 @@ void Draw2DWorkerThread::WorkerFunction() } } - pthread_exit((void*) 0); //kell?? vagy NULL?? + pthread_exit((void*) 0); } \ No newline at end of file