#ifndef ALIGLAUBERMC_H
#define ALIGLAUBERMC_H
#include "AliGlauberNucleus.h"
#include <Riostream.h>
#include <TNamed.h>
class TObjArray;
class TNtuple;
using std::cout;
using std::endl;
class AliGlauberMC : public TNamed {
public:
enum EdNdEtaType { kSimple,
kNBD,
kNBDSV,
kTwoNBD,
kGBW,
kNone };
AliGlauberMC(Option_t* NA = "Pb", Option_t* NB = "Pb", Double_t xsect = 64);
virtual ~AliGlauberMC();
AliGlauberMC(const AliGlauberMC& in);
AliGlauberMC& operator=(const AliGlauberMC& in);
void Draw(Option_t* option);
void Run(Int_t nevents);
Bool_t NextEvent(Double_t bgen=-1);
Bool_t CalcEvent(Double_t bgen);
Double_t GetdNdEta() const;
Double_t GetdNdEtaSimple( const Double_t* param ) const;
Double_t GetdNdEtaGBW( const Double_t* param ) const;
Double_t GetdNdEtaNBD( const Double_t* param ) const;
Double_t GetdNdEtaNBDSV( const Double_t* param ) const;
Double_t GetdNdEtaTwoNBD( const Double_t* param ) const;
Double_t GetEccentricity() const;
Double_t GetStoa() const;
Double_t GetEccentricityColl() const;
Double_t GetEccentricityCom() const;
Double_t GetEccentricityPart() const;
Double_t GetEpsilon2Part() const;
Double_t GetEpsilon3Part() const;
Double_t GetEpsilon4Part() const;
Double_t GetEpsilon5Part() const;
Double_t GetEpsilon2Coll() const;
Double_t GetEpsilon3Coll() const;
Double_t GetEpsilon4Coll() const;
Double_t GetEpsilon5Coll() const;
Double_t GetEpsilon2Com() const;
Double_t GetEpsilon3Com() const;
Double_t GetEpsilon4Com() const;
Double_t GetEpsilon5Com() const;
Double_t GetPsi2() const;
Double_t GetPsi3() const;
Double_t GetPsi4() const;
Double_t GetPsi5() const;
Double_t GetEccentricityPartColl() const;
Double_t GetEccentricityPartCom() const;
Double_t GetB() const {return fBMC;}
Double_t GetBMin() const {return fBMin;}
Double_t GetBMax() const {return fBMax;}
Int_t GetNcoll() const {return fNcoll;}
Int_t GetNpart() const {return fNpart;}
Int_t GetNpartFound() const {return fMaxNpartFound;}
TNtuple* GetNtuple() const {return fnt;}
TObjArray *GetNucleons();
Double_t GetTotXSect() const;
Double_t GetTotXSectErr() const;
void Reset();
AliGlauberNucleus &GetNucA() {return fANucleus;}
AliGlauberNucleus &GetNucB() {return fBNucleus;}
static Double_t NegativeBinomialDistribution(Int_t x, Int_t k, Double_t nmean);
Int_t NegativeBinomialRandom(Int_t k, Double_t nmean) const;
Int_t NegativeBinomialRandomSV(Double_t nbar, Double_t k) const;
Int_t DoubleNegativeBinomialRandom(Int_t k1, Double_t nmean1, Int_t k2, Double_t nmean2, Double_t alpha) const;
Double_t* GetdNdEtaParam() {return fdNdEtaParam;}
void SetdNdEtaType(EdNdEtaType method) {fMultType=method;}
void SetBmin(Double_t bmin) {fBMin = bmin;}
void SetBmax(Double_t bmax) {fBMax = bmax;}
void SetMinDistance(Double_t d) {fANucleus.SetMinDist(d); fBNucleus.SetMinDist(d);}
void SetDoPartProduction(Bool_t b) { fDoPartProd = b; }
void Setr(Double_t r) {fANucleus.SetR(r); fBNucleus.SetR(r);}
void Seta(Double_t a) {fANucleus.SetA(a); fBNucleus.SetA(a);}
void SetDoFluc(Double_t omega, Double_t sig0, Double_t lam, Bool_t on=kTRUE)
{fDoFluc=on;fOmega=omega;fSig0=sig0;fLambda=lam;}
static void PrintVersion() {cout << "AliGlauberMC " << Version() << endl;}
static const char *Version() {return "v1.2";}
static void RunAndSaveNtuple( Int_t n,
const Option_t *sysA="Pb",
const Option_t *sysB="Pb",
Double_t signn=64,
Double_t mind=0.4,
Double_t r=6.62,
Double_t a=0.546,
const char *fname="glau_pbpb_ntuple.root");
void RunAndSaveNucleons( Int_t n,
const Option_t *sysA,
const Option_t *sysB,
Double_t signn,
Double_t mind,
Bool_t verbose,
const char *fname);
private:
AliGlauberNucleus fANucleus;
AliGlauberNucleus fBNucleus;
Double_t fXSect;
TObjArray* fNucleonsA;
TObjArray* fNucleonsB;
Int_t fAN;
Int_t fQAN;
Int_t fBN;
Int_t fQBN;
TNtuple* fnt;
Double_t fMeanX2;
Double_t fMeanY2;
Double_t fMeanXY;
Double_t fMeanX2Parts;
Double_t fMeanY2Parts;
Double_t fMeanXYParts;
Double_t fMeanXParts;
Double_t fMeanYParts;
Double_t fMeanOXParts;
Double_t fMeanOYParts;
Double_t fMeanXColl;
Double_t fMeanYColl;
Double_t fMeanOXColl;
Double_t fMeanOYColl;
Double_t fMeanX2Coll;
Double_t fMeanY2Coll;
Double_t fMeanXYColl;
Double_t fMeanXCom;
Double_t fMeanYCom;
Double_t fMeanOXCom;
Double_t fMeanOYCom;
Double_t fMeanX2Com;
Double_t fMeanY2Com;
Double_t fMeanXYCom;
Double_t fMeanXSystem;
Double_t fMeanYSystem;
Double_t fMeanXA;
Double_t fMeanYA;
Double_t fMeanXB;
Double_t fMeanYB;
Double_t fMeanOXA;
Double_t fMeanOYA;
Double_t fMeanOXB;
Double_t fMeanOYB;
Double_t fBMC;
Int_t fEvents;
Int_t fTotalEvents;
Double_t fBMin;
Double_t fBMax;
Double_t fdNdEtaParam[10];
EdNdEtaType fMultType;
Int_t fMaxNpartFound;
Int_t fONpart;
Int_t fONcoll;
Double_t fONcom;
Int_t fNpart;
Int_t fNcoll;
Int_t fNcollw;
Double_t fNcom;
Double_t fMeanr2;
Double_t fMeanr3;
Double_t fMeanr4;
Double_t fMeanr5;
Double_t fMeanr2Cos2Phi;
Double_t fMeanr2Sin2Phi;
Double_t fMeanr2Cos3Phi;
Double_t fMeanr2Sin3Phi;
Double_t fMeanr2Cos4Phi;
Double_t fMeanr2Sin4Phi;
Double_t fMeanr2Cos5Phi;
Double_t fMeanr2Sin5Phi;
Double_t fMeanr3Cos3Phi;
Double_t fMeanr3Sin3Phi;
Double_t fMeanr4Cos4Phi;
Double_t fMeanr4Sin4Phi;
Double_t fMeanr5Cos5Phi;
Double_t fMeanr5Sin5Phi;
Double_t fMeanr2Coll;
Double_t fMeanr3Coll;
Double_t fMeanr4Coll;
Double_t fMeanr5Coll;
Double_t fMeanr2Cos2PhiColl;
Double_t fMeanr2Sin2PhiColl;
Double_t fMeanr2Cos3PhiColl;
Double_t fMeanr2Sin3PhiColl;
Double_t fMeanr2Cos4PhiColl;
Double_t fMeanr2Sin4PhiColl;
Double_t fMeanr2Cos5PhiColl;
Double_t fMeanr2Sin5PhiColl;
Double_t fMeanr3Cos3PhiColl;
Double_t fMeanr3Sin3PhiColl;
Double_t fMeanr4Cos4PhiColl;
Double_t fMeanr4Sin4PhiColl;
Double_t fMeanr5Cos5PhiColl;
Double_t fMeanr5Sin5PhiColl;
Double_t fMeanr2Com;
Double_t fMeanr3Com;
Double_t fMeanr4Com;
Double_t fMeanr5Com;
Double_t fMeanr2Cos2PhiCom;
Double_t fMeanr2Sin2PhiCom;
Double_t fMeanr2Cos3PhiCom;
Double_t fMeanr2Sin3PhiCom;
Double_t fMeanr2Cos4PhiCom;
Double_t fMeanr2Sin4PhiCom;
Double_t fMeanr2Cos5PhiCom;
Double_t fMeanr2Sin5PhiCom;
Double_t fMeanr3Cos3PhiCom;
Double_t fMeanr3Sin3PhiCom;
Double_t fMeanr4Cos4PhiCom;
Double_t fMeanr4Sin4PhiCom;
Double_t fMeanr5Cos5PhiCom;
Double_t fMeanr5Sin5PhiCom;
Double_t fSx2Parts;
Double_t fSy2Parts;
Double_t fSxyParts;
Double_t fSx2Coll;
Double_t fSy2Coll;
Double_t fSxyColl;
Double_t fSx2Com;
Double_t fSy2Com;
Double_t fSxyCom;
Double_t fX;
Double_t fNpp;
Bool_t fDoPartProd;
Double_t fBNN;
Bool_t fDoFluc;
Double_t fOmega;
Double_t fSig0;
Double_t fLambda;
TF1 *fSigFluc;
Bool_t CalcResults(Double_t bgen);
ClassDef(AliGlauberMC,4)
};
#endif