Skip to content
Snippets Groups Projects
Commit 205ae278 authored by Viktor Klochkov's avatar Viktor Klochkov :eyes:
Browse files

clion fixes

parent 06feb056
No related branches found
No related tags found
No related merge requests found
......@@ -348,7 +348,7 @@ float Glauber::Fitter::NBD(float n, float mu, float k) const
* @param Nevents
* @return pointer to the histogram
*/
std::unique_ptr<TH1F> Glauber::Fitter::GetModelHisto (const float range[2], TString name, const float par[3], int nEvents)
std::unique_ptr<TH1F> Glauber::Fitter::GetModelHisto (const float range[2], const TString& name, const float par[3], int nEvents)
{
const float f = par[0];
const float mu = par[1];
......
......@@ -24,27 +24,27 @@ namespace Glauber
public:
/** Default constructor **/
Fitter() {};
Fitter(std::unique_ptr<TTree> tree) ;
Fitter() = default;;
explicit Fitter(std::unique_ptr<TTree> tree) ;
/** Destructor **/
virtual ~Fitter(){};
virtual ~Fitter()= default;;
void Init(int nEntries);
void SetGlauberFitHisto (Float_t f, Float_t mu, Float_t k, Int_t n = 10000, Bool_t Norm2Data = true);
void NormalizeGlauberFit ();
void DrawHistos (Bool_t isSim = true, Bool_t isData = true, Bool_t isGlauber = false, Bool_t isNBD = false);
void DrawHistos (Bool_t isSim = true, Bool_t isData = true, Bool_t isGlauber = false, Bool_t isNBD = false) {};
float FitGlauber (float *par, Float_t f0, Int_t k0, Int_t k1, Int_t nEvents);
void FindMuGoldenSection (Float_t *mu, Float_t *chi2, Float_t mu_min, Float_t mu_max, Float_t f, Float_t k, Int_t nEvents = 10000, Int_t nIter = 5);
Float_t GetChi2 (void) const;
Float_t GetChi2 () const;
Float_t NBD(Float_t n, Float_t mu, Float_t k) const;
void SetNBDhist(Float_t mu, Float_t k);
float Nancestors(float f) const;
float NancestorsMax(float f) const;
std::unique_ptr<TH1F> GetModelHisto (const Float_t range[2], TString name, const Float_t par[3], Int_t nEvents);
std::unique_ptr<TH1F> GetModelHisto (const Float_t range[2], const TString& name, const Float_t par[3], Int_t nEvents);
//
// Setters
......@@ -54,8 +54,8 @@ namespace Glauber
void SetFitMaxBin (Int_t min) { fFitMaxBin = min; }
void SetNormMinBin (Int_t min) { fNormMinBin = min; }
void SetBinSize (Int_t size) { fBinSize = size; }
void SetOutDirName (TString name) { fOutDirName = name; }
void SetMode (const TString mode) { fMode = mode; }
void SetOutDirName (const TString& name) { fOutDirName = name; }
void SetMode (const TString& mode) { fMode = mode; }
//
// Getters
......
......@@ -5,11 +5,9 @@
#include "FitterHelper.h"
#include "TH1.h"
#include "TH2.h"
#include "TFile.h"
#include "TLegend.h"
#include "TH2.h"
using namespace Glauber;
int main(int argc, char *argv[])
......
......@@ -16,7 +16,7 @@ class BordersFinder {
public:
BordersFinder() {}
BordersFinder() = default;
void FindBorders();
void SaveBorders(const std::string &filename, const std::string &getter_name);
......@@ -25,7 +25,7 @@ class BordersFinder {
TH1F &GetHisto() { return histo_; } // not const to use Draw etc
void SetNormalization(long int norm) { norm_ = norm; }
long int GetNormalization() const { return norm_; }
Double_t GetNormalization() const { return norm_; }
void SetRanges(const std::vector<float> &ranges) { ranges_ = ranges; }
void SetRanges(int n, float min, float max) {
......
......@@ -57,18 +57,18 @@ std::unique_ptr<TH1F> BordersFinder2D::Convert()
{
// if ( histo2d_.Integral(iBin, iBin, 0, histo2d_.GetNbinsY()) <= 1. ) continue;
const float x1 = iBin==1 ? -0.2 : histo2d_.GetXaxis()->GetBinCenter(iBin-1);
const float x2 = histo2d_.GetXaxis()->GetBinCenter(iBin);
const auto x1 = iBin==1 ? -0.2 : histo2d_.GetXaxis()->GetBinCenter(iBin-1);
const auto x2 = histo2d_.GetXaxis()->GetBinCenter(iBin);
const auto norm1 = FindNorm( par, x1);
const auto norm2 = FindNorm( par, x2);
const float integral = FindIntegral(norm1, norm2);
const auto integral = FindIntegral(norm1, norm2);
// std::cout << integral << std::endl;
histo1d->SetBinContent(iBin, integral);
}
return std::move(histo1d);
return histo1d;
}
/**
......@@ -138,7 +138,7 @@ void BordersFinder2D::SaveBorders2D(const std::string &filename, const std::stri
}
void BordersFinder2D::Fit2D(const TString func)
void BordersFinder2D::Fit2D(const TString& func)
{
std::unique_ptr<TProfile> prof{ histo2d_.ProfileX() };
fit_ = new TF1("fit", func, histo2d_.GetXaxis()->GetXmin(), histo2d_.GetXaxis()->GetXmax() );
......@@ -152,10 +152,10 @@ void BordersFinder2D::Fit2D(const TString func)
* @param x argument
* @return a0 and a1 parameters y = a0 + a1 * x
*/
std::array <float,2> BordersFinder2D::FindNorm (const std::vector <double> par, float x)
std::array <float,2> BordersFinder2D::FindNorm (const std::vector <double>& par, float x)
{
std::array <float,2> ret;
const float dx = (histo2d_.GetXaxis()->GetXmax() - histo2d_.GetXaxis()->GetXmin()) / 10000. ;
std::array <float,2> ret{};
const auto dx = (histo2d_.GetXaxis()->GetXmax() - histo2d_.GetXaxis()->GetXmin()) / 10000. ;
/* left */
const float y1 = polN(par, x - dx);
......
......@@ -23,15 +23,15 @@ class BordersFinder2D : public BordersFinder {
public:
BordersFinder2D(){}
BordersFinder2D()= default;
void SetHisto2D(TH2F&& histo2d) { histo2d_ = histo2d; }
TH2F&& GetHisto2D() { return std::move(histo2d_); }
void Init();
std::unique_ptr<TH1F> Convert();
void Fit2D(const TString func);
std::array <float,2> FindNorm (const std::vector <double> par, float x);
void Fit2D(const TString& func);
std::array <float,2> FindNorm (const std::vector <double>& par, float x);
float FindIntegral( const std::array <float,2> &norm1, const std::array <float,2> &norm2);
void SaveBorders2D(const std::string &filename, const std::string &getter_name);
......@@ -42,7 +42,7 @@ public:
* @param N order
* @return
*/
float polN (std::vector <double> par, float x)
static float polN (const std::vector <double>& par, float x)
{
float res{0.};
float xn{1.};
......
......@@ -44,7 +44,7 @@ void BordersFinderHelper::PlotHisto(const Getter& getter, TH1F& histo) const
std::unique_ptr <TCanvas> c {new TCanvas("c", "", 1200, 800)};
histo.Draw();
auto borders = getter.GetBorders();
const auto& borders = getter.GetBorders();
TLine *line;
for (int i=0; i<borders.GetNbins(); ++i)
......
......@@ -20,12 +20,12 @@ class BordersFinderHelper {
public:
BordersFinderHelper(){}
BordersFinderHelper()= default;
void QA(const Getter& getter, const TH1F &histo) const;
void PlotHisto(const Getter& getter, TH1F& histo) const;
void PlotHisto2D(const Getter& getter, TH2F& histo, TF1& func) const;
void SetName(const TString name) { name_ = name; }
void SetName(const TString& name) { name_ = name; }
void SetIsPdf(bool is = true) { ispdf_ = is; }
private:
......
......@@ -16,7 +16,7 @@ class Container{
public:
Container(){}
Container()= default;
void AddCentralityEstimator(uint num, float centrality)
{
......
......@@ -8,7 +8,7 @@
#ifndef CENTRALITY_GETTER_H
#define CENTRALITY_GETTER_H
#include <assert.h>
#include <cassert>
#include "vector"
#include "array"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment