#ifndef ROOT_TF1NormSum__
#define ROOT_TF1NormSum__
#include <iostream>
#include "TF1.h"
#include <memory>
class TF1NormSum {
protected:
unsigned int fNOfFunctions;
Double_t fScale;
std::vector < std::shared_ptr < TF1 > > fFunctions;
std::vector < Double_t > fCoeffs;
std::vector < Int_t > fCstIndexes;
std::vector< TString > fParNames;
void InitializeDataMembers(const std::vector <std::shared_ptr < TF1 >> &functions, const std::vector <Double_t> &coeffs, Double_t scale);
public:
TF1NormSum();
TF1NormSum(const std::vector <TF1*>&functions, const std::vector <Double_t> &coeffs, Double_t scale = 1.);
TF1NormSum(TF1* function1, TF1* function2, Double_t coeff1 = 1., Double_t coeff2 = 1., Double_t scale = 1.);
TF1NormSum(TF1* function1, TF1* function2, TF1*function3, Double_t coeff1 = 1., Double_t coeff2 = 1., Double_t coeff3 = 1., Double_t scale = 1.);
TF1NormSum(const TString &formula, Double_t xmin, Double_t xmax);
double operator()(double* x, double* p);
std::vector<double> GetParameters() const;
void SetScale(Double_t scale) { fScale = scale; };
void SetParameters(const double* params);
void SetParameters(Double_t p0, Double_t p1, Double_t p2=0., Double_t p3=0., Double_t p4=0.,
Double_t p5=0., Double_t p6=0., Double_t p7=0., Double_t p8=0., Double_t p9=0., Double_t p10=0.);
Int_t GetNpar() const;
Double_t GetScale() const { return fScale; }
const char * GetParName(Int_t ipar) const { return fParNames.at(ipar).Data(); }
};
#endif /* defined(ROOT_TF1NormSum__) */