From 6e81657b767bf0a0249849539c0de7226fef3a0b Mon Sep 17 00:00:00 2001 From: Reka Korei Date: Thu, 2 Nov 2017 15:00:13 +0100 Subject: [PATCH] Added Get function --- include/Lattice.hh | 5 +++++ src/Lattice.cc | 32 +++++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/include/Lattice.hh b/include/Lattice.hh index 5f35345..98e1d08 100644 --- a/include/Lattice.hh +++ b/include/Lattice.hh @@ -36,6 +36,8 @@ public: MuSigma GetMuSigma(Int_t index); Int_t GetLatticeSize(); //number of points in the lattice + Int_t GetWidth(); //number of mu values + Int_t GetHeight(); //number of sigma values private: @@ -44,6 +46,9 @@ private: std::vector ms_vect; + Int_t _width; + Int_t _height; + }; diff --git a/src/Lattice.cc b/src/Lattice.cc index d903869..327a4c9 100644 --- a/src/Lattice.cc +++ b/src/Lattice.cc @@ -1,7 +1,7 @@ #include "Lattice.hh" -Lattice::Lattice() : _nop(10), _percent(0.2){;} +Lattice::Lattice() : _nop(10), _percent(0.2), _width(10), _height(10){;} Lattice::~Lattice(){;} @@ -34,6 +34,18 @@ Int_t Lattice::GetLatticeSize(){ } +Int_t Lattice::GetWidth(){ + + return _width; + +} + +Int_t Lattice::GetHeight(){ + + return _height; + +} + void Lattice::SetLattice(Double_t mu_est, Double_t sigma_est){ Double_t loc_sigma, loc_mu; @@ -55,24 +67,38 @@ void Lattice::SetLattice(Double_t mu_est, Double_t sigma_est){ int i = 0; + _width = 0; + _height = 0; + while(loc_mu <= mumax){ loc_sigma = sigmin; + + while(loc_sigma <= sigmax) { + ms_vect.push_back(MuSigma()); ms_vect[i].mu = loc_mu; ms_vect[i].sigma = loc_sigma; - + + std::cout << "i : " << ms_vect[i].mu << " " << ms_vect[i].sigma << std::endl; + i++; loc_sigma += ds; + + if(!_width) _height++; + } - loc_mu += dm; + loc_mu += dm; + _width++; } + + std::cout << "Width " << _width << " Height " << _height << std::endl; }