#include "Riostream.h"
#include "AliFlowLYZHist2.h"
#include "AliFlowCommonConstants.h"
#include "TProfile.h"
#include "TProfile2D.h"
#include "TString.h"
#include "TComplex.h"
#include "TList.h"
#include "TBrowser.h"
class TH1D;
ClassImp(AliFlowLYZHist2)
AliFlowLYZHist2::AliFlowLYZHist2():
TNamed(),
fHistProReNumer(0),
fHistProImNumer(0),
fHistProReNumerPt(0),
fHistProImNumerPt(0),
fHistProReNumer2D(0),
fHistProImNumer2D(0),
fHistList(NULL)
{
}
AliFlowLYZHist2::AliFlowLYZHist2(Int_t theta, const char* aSelection, const char *anInput, Bool_t useSum):
TNamed(anInput,anInput),
fHistProReNumer(0),
fHistProImNumer(0),
fHistProReNumerPt(0),
fHistProImNumerPt(0),
fHistProReNumer2D(0),
fHistProImNumer2D(0),
fHistList(NULL)
{
TString title, name, addlast;
if (useSum) { addlast = "LYZSUM"; }
else { addlast = "LYZPROD"; }
Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
name = "Second_FlowPro_ReNumer";
name +=theta;
name +=aSelection;
name +=addlast;
title = name;
fHistProReNumer = new TProfile(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax);
fHistProReNumer->SetXTitle("eta");
fHistProReNumer->SetYTitle("v (%)");
name = "Second_FlowPro_ImNumer";
name +=theta;
name +=aSelection;
name +=addlast;
title = name;
fHistProImNumer = new TProfile(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax);
fHistProImNumer->SetXTitle("eta");
fHistProImNumer->SetYTitle("v (%)");
name = "Second_FlowPro_ReNumerPt";
name +=theta;
name +=aSelection;
name +=addlast;
title = name;
fHistProReNumerPt = new TProfile(name.Data(),title.Data(),iNbinsPt,dPtMin,dPtMax);
fHistProReNumerPt->SetXTitle("Pt");
fHistProReNumerPt->SetYTitle("v (%)");
name = "Second_FlowPro_ImNumerPt";
name +=theta;
name +=aSelection;
name +=addlast;
title = name;
fHistProImNumerPt = new TProfile(name.Data(),title.Data(),iNbinsPt,dPtMin,dPtMax);
fHistProImNumerPt->SetXTitle("Pt");
fHistProImNumerPt->SetYTitle("v (%)");
name = "Second_FlowPro_ReNumer2D";
name +=theta;
name +=aSelection;
name +=addlast;
title = name;
fHistProReNumer2D = new TProfile2D(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax,iNbinsPt,dPtMin,dPtMax);
fHistProReNumer2D->SetXTitle("eta");
fHistProReNumer2D->SetYTitle("Pt (GeV/c)");
name = "Second_FlowPro_ImNumer2D";
name +=theta;
name +=aSelection;
name +=addlast;
title = name;
fHistProImNumer2D = new TProfile2D(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax,iNbinsPt,dPtMin,dPtMax);
fHistProImNumer2D->SetXTitle("eta");
fHistProImNumer2D->SetYTitle("Pt (GeV/c)");
fHistList = new TList();
fHistList-> Add(fHistProReNumer);
fHistList-> Add(fHistProImNumer);
fHistList-> Add(fHistProReNumerPt);
fHistList-> Add(fHistProImNumerPt);
fHistList-> Add(fHistProReNumer2D);
fHistList-> Add(fHistProImNumer2D);
}
AliFlowLYZHist2::~AliFlowLYZHist2()
{
delete fHistProReNumer;
delete fHistProImNumer;
delete fHistProReNumerPt;
delete fHistProImNumerPt;
delete fHistProReNumer2D;
delete fHistProImNumer2D;
delete fHistList;
}
void AliFlowLYZHist2::Fill(Double_t d1, Double_t d2, TComplex c)
{
fHistProReNumer->Fill(d1, c.Re());
fHistProImNumer->Fill(d1, c.Im());
fHistProReNumerPt->Fill(d2, c.Re());
fHistProImNumerPt->Fill(d2, c.Im());
fHistProReNumer2D->Fill(d1, d2, c.Re());
fHistProImNumer2D->Fill(d1, d2, c.Im());
}
TComplex AliFlowLYZHist2::GetNumerEta(Int_t i)
{
Double_t dReNumer = fHistProReNumer->GetBinContent(i);
Double_t dImNumer = fHistProImNumer->GetBinContent(i);
TComplex cNumer(dReNumer,dImNumer);
return cNumer;
}
TComplex AliFlowLYZHist2::GetNumerPt(Int_t i)
{
Double_t dReNumer = fHistProReNumerPt->GetBinContent(i);
Double_t dImNumer = fHistProImNumerPt->GetBinContent(i);
TComplex cNumer(dReNumer,dImNumer);
return cNumer;
}
Double_t AliFlowLYZHist2::Merge(TCollection *aList)
{
if (!aList) return 0;
if (aList->IsEmpty()) return 0;
Int_t iCount = 0;
TIter next(aList);
AliFlowLYZHist2 *toMerge;
TList *pTemp = new TList();
while ((toMerge=(AliFlowLYZHist2*)next())) {
pTemp->Add(toMerge->GetHistList());
iCount++;
}
fHistList->Merge(pTemp);
delete pTemp;
return (double)iCount;
}
void AliFlowLYZHist2::Print(Option_t *option) const
{
printf( "Class.Print Name = %s, Histogram list:\n",GetName());
if (fHistList) {
fHistList->Print(option);
}
else
{
printf( "Empty histogram list \n");
}
}
void AliFlowLYZHist2::Browse(TBrowser *b)
{
if (!b) return;
if (fHistList) b->Add(fHistList,"AliFlowLYZHist2List");
}