13 #include "StMessMgr.h"
19 #include "StGlauberCumulantHistogramMaker.h"
28 const Int_t ybin, const Double_t ymin, const Double_t ymax, const Bool_t isUnitWeight)
36 StGlauberCumulantHistogramMaker::~StGlauberCumulantHistogramMaker()
47 for(UInt_t io=0; io<mNOrder; io++){
48 const UInt_t order = GetOrder(io);
52 TH1* h1D = (TH1D*) GetTH1D(Form(
"%s_%d", GetName().Data(), order), ix) ;
53 mHistogram1DCumulant[io].push_back( (TH1D*) h1D );
56 TProfile* hProfile = (TProfile*) GetTProfile(Form(
"%s_%d", GetName().Data(), order), ix,
"Profile");
57 mProfileCumulant[io].push_back( (TProfile*) hProfile );
61 for(vector<TProfile*>::iterator iter = mProfileCumulant[io].begin();
62 iter != mProfileCumulant[io].end(); iter++){
63 TProfile* h = (TProfile*) (*iter);
64 LOG_INFO << Form(
"StGlauberCumulantHistogramMaker::Init Initialize TProfile: %s (%s), x:(bin, min, max) = (%4d, %1.2f, %1.2f)",
65 h->GetName(), h->GetTitle(), h->GetNbinsX(), h->GetXaxis()->GetXmin(), h->GetXaxis()->GetXmax())
74 void StGlauberCumulantHistogramMaker::Reset()
78 for(UInt_t io=0; io<mNOrder; io++){
79 mProfileCumulant[io].clear() ;
80 mHistogram1DCumulant[io].clear() ;
91 for(UInt_t io=0; io<mNOrder; io++){
93 if( io == 1 ) yval = y*y*y*y ;
94 if( io == 2 ) yval = y*y*y*y*y*y ;
108 for(UInt_t io=0; io<mNOrder; io++){
113 LOG_INFO <<
"StGlauberCumulantHistogramMaker::Finish Calculate cumulant" << endm;
115 for(UInt_t ix=0; ix<mHistogram1DCumulant[0].size(); ix++){
117 TH1* h1raw2 = (TH1D*) mHistogram1DCumulant[0][ix]->Clone() ;
118 TH1* h1raw4 = (TH1D*) mHistogram1DCumulant[1][ix]->Clone() ;
119 TH1* h1raw6 = (TH1D*) mHistogram1DCumulant[2][ix]->Clone() ;
121 for(Int_t i=0; i<h1raw2->GetNbinsX(); i++){
122 const Double_t val[] = { h1raw2->GetBinContent(i+1), h1raw4->GetBinContent(i+1), h1raw6->GetBinContent(i+1) } ;
123 const Double_t err[] = { h1raw2->GetBinError(i+1), h1raw4->GetBinError(i+1), h1raw6->GetBinError(i+1) } ;
125 for(Int_t io=0; io<mNOrder; io++){
126 const UInt_t order = GetOrder(io) ;
127 mHistogram1DCumulant[io][ix]->SetBinContent(i+1, GetCumulant(order, val));
128 mHistogram1DCumulant[io][ix]->SetBinError(i+1, GetCumulantError(order, val, err));
138 for(Int_t io=0; io<mNOrder; io++){
139 const TString name(type +
"_" + GetName()) ;
140 WriteTable(mHistogram1DCumulant[io], Form(
"%s_%d", name.Data(), GetOrder(io))) ;
144 for(Int_t io=0; io<mNOrder; io++){
150 UInt_t StGlauberCumulantHistogramMaker::GetOrder(
const UInt_t io)
const
156 Double_t StGlauberCumulantHistogramMaker::Get4thOrderCumulant(
const Double_t c2,
const Double_t c4)
const
158 const Double_t raw = 2.0*c2*c2 - c4 ;
159 const Double_t sign = (raw>0.0) ? 1.0 : -1.0 ;
161 return TMath::Power(sign*raw, 0.25) ;
165 Double_t StGlauberCumulantHistogramMaker::Get6thOrderCumulant(
const Double_t c2,
const Double_t c4,
const Double_t c6)
const
167 const Double_t raw = 0.25*(c6 - 9.0*c4*c2 + 12.0*c2*c2*c2) ;
168 const Double_t sign = (raw>0.0) ? 1.0 : -1.0 ;
170 return TMath::Power(sign*raw, 1.0/6.0) ;
174 Double_t StGlauberCumulantHistogramMaker::GetNthOrderCumulantError(
const Double_t order,
const Double_t val,
const Double_t err)
const
176 if( val == 0.0 )
return 0.0 ;
178 return TMath::Abs(order) * TMath::Power(TMath::Abs(val), order-1.0) * err ;
182 Double_t StGlauberCumulantHistogramMaker::Get2ndOrderCumulantError(
const Double_t c2,
const Double_t c2error)
const
184 return GetNthOrderCumulantError(0.5, c2, c2error) ;
188 Double_t StGlauberCumulantHistogramMaker::Get4thOrderCumulantError(
const Double_t c2,
const Double_t c4,
189 const Double_t c2error,
const Double_t c4error)
const
191 const Double_t cumulant = Get4thOrderCumulant(c2, c4) ;
192 const Double_t error = TMath::Sqrt(16.0*c2*c2*c2error*c2error + c4error*c4error) ;
194 return GetNthOrderCumulantError(0.25, cumulant, error) ;
198 Double_t StGlauberCumulantHistogramMaker::Get6thOrderCumulantError(
const Double_t c2,
const Double_t c4,
const Double_t c6,
199 const Double_t c2error,
const Double_t c4error,
const Double_t c6error)
const
201 const Double_t cumulant = Get6thOrderCumulant(c2, c4, c6) ;
202 const Double_t error1 = (c4!=0.0 && c2!=0.0) ?
203 9.0 * TMath::Abs(c4*c2) * TMath::Sqrt(TMath::Power(c4error/c4, 2.0) + TMath::Power(c2error/c2, 2.0)) : 0.0;
204 const Double_t error2 = 12.0 * 3.0 * c2*c2*c2error ;
205 const Double_t error = 0.25 * TMath::Sqrt(c6error*c6error + error1*error1 + error2*error2) ;
207 return GetNthOrderCumulantError(1.0/6.0, cumulant, error) ;
211 Double_t StGlauberCumulantHistogramMaker::GetCumulant(
const UInt_t order,
const Double_t* val)
const
214 if(!val)
return -9999. ;
216 const Double_t invalid = -9999. ;
220 return (val[0]<0.0) ? invalid : TMath::Sqrt(val[0]) ;
223 return Get4thOrderCumulant(val[0], val[1]) ;
226 return Get6thOrderCumulant(val[0], val[1], val[2]) ;
229 Error(
"StGlauberCumulantHistogramMaker::GetCumulant",
"Unknown order, order=%3d. abort", order);
237 Double_t StGlauberCumulantHistogramMaker::GetCumulantError(
const UInt_t order,
const Double_t* val,
const Double_t* err)
const
240 if(!val)
return -9999. ;
241 if(!err)
return -9999. ;
245 return Get2ndOrderCumulantError(val[0], err[0]);
248 return Get4thOrderCumulantError(val[0], val[1], err[0], err[1]) ;
251 return Get6thOrderCumulantError(val[0], val[1], val[2], err[0], err[1], err[2]) ;
254 Error(
"StGlauberCumulantHistogramMaker::GetCumulantError",
"Unknown order, order=%3d. abort", order);
void FillProfile(std::vector< TProfile * > collection, const Double_t y)
void WriteTable(std::vector< TH1 * > collection, const TString name)
Write text table, average quantity vs centrality (table: table_{mName}_vs_centrality.txt)
void DoWeightCorrection(std::vector< TH1 * > collection1d, std::vector< TProfile * > collectionp)
Calculate sum(w*val)/sum(w) for each profile histogram.
virtual void Reset()
Debug flag.
virtual void Fill(const Double_t y, const Double_t weight)
Set X-axis variable.
void Fill(const Double_t y, const Double_t weight)
Set X-axis variable.
UInt_t GetNXaxis() const
Naxis.
virtual void Finish(const TString type)
Fill histogram 'y' value with 'weight'.
void Finish(const TString type)
void Init()
Default destructor.
void WriteGraphs(std::vector< TH1 * > collection)
Write TGraphErrors (vs centrality, 0-80%)