From 04f6283bacb82cc8d4358bc0794f21ea1858ce49 Mon Sep 17 00:00:00 2001 From: snelling Date: Thu, 14 Aug 2008 14:50:21 +0000 Subject: [PATCH] persistent CommonHist (still need some improvements) --- PWG2/FLOW/AliAnalysisTaskScalarProduct.cxx | 15 +++++++ .../FLOW/AliFlowAnalysisWithScalarProduct.cxx | 24 +++++------ PWG2/FLOW/AliFlowCommonHist.cxx | 41 +++++++++++-------- PWG2/FLOW/AliFlowCommonHist.h | 8 ++-- 4 files changed, 56 insertions(+), 32 deletions(-) diff --git a/PWG2/FLOW/AliAnalysisTaskScalarProduct.cxx b/PWG2/FLOW/AliAnalysisTaskScalarProduct.cxx index 1acf40fdc5e..93fa5f8c049 100644 --- a/PWG2/FLOW/AliAnalysisTaskScalarProduct.cxx +++ b/PWG2/FLOW/AliAnalysisTaskScalarProduct.cxx @@ -37,6 +37,7 @@ class AliAnalysisTask; #include "AliAnalysisTaskScalarProduct.h" #include "AliFlowEventSimpleMaker.h" #include "AliFlowAnalysisWithScalarProduct.h" +#include "AliFlowCommonHist.h" // AliAnalysisTaskScalarProduct: // @@ -292,6 +293,20 @@ void AliAnalysisTaskScalarProduct::Terminate(Option_t *) if (fListHistos) { fListHistos->Print(); +// AliFlowCommonHist *SDHistClass = dynamic_cast +// (fListHistos->FindObject("SP")); +// if (SDHistClass) +// { +// // open a file and write the CLASS to the file +// TFile *f = new TFile("mytest.root","recreate"); +// SDHistClass->Write(); +// SDHistClass->Print(); +// f->Close(); +// } +// else +// { +// cout << "SD class pointer is NULL" << endl; +// } } else { diff --git a/PWG2/FLOW/AliFlowAnalysisWithScalarProduct.cxx b/PWG2/FLOW/AliFlowAnalysisWithScalarProduct.cxx index 0ef1ae62bc2..b3106abf3ac 100644 --- a/PWG2/FLOW/AliFlowAnalysisWithScalarProduct.cxx +++ b/PWG2/FLOW/AliFlowAnalysisWithScalarProduct.cxx @@ -78,22 +78,22 @@ void AliFlowAnalysisWithScalarProduct::Init() { fHistProUQ->SetYTitle(""); fHistList->Add(fHistProUQ); - fCommonHists = new AliFlowCommonHist("SP"); + fCommonHists = new AliFlowCommonHist("AliFlowCommonHistSP"); // fHistList->Add(fCommonHists->GetHistList()); fHistList->Add(fCommonHists); // commented for test writing full object - fHistList->Add(fCommonHists->GetHistMultOrig()); - fHistList->Add(fCommonHists->GetHistMultInt()); - fHistList->Add(fCommonHists->GetHistMultDiff()); - fHistList->Add(fCommonHists->GetHistPtInt()); - fHistList->Add(fCommonHists->GetHistPtDiff()); - fHistList->Add(fCommonHists->GetHistPhiInt()); - fHistList->Add(fCommonHists->GetHistPhiDiff()); - fHistList->Add(fCommonHists->GetHistEtaInt()); - fHistList->Add(fCommonHists->GetHistEtaDiff()); - fHistList->Add(fCommonHists->GetHistProMeanPtperBin()); - fHistList->Add(fCommonHists->GetHistQ()); + // fHistList->Add(fCommonHists->GetHistMultOrig()); + // fHistList->Add(fCommonHists->GetHistMultInt()); + // fHistList->Add(fCommonHists->GetHistMultDiff()); + // fHistList->Add(fCommonHists->GetHistPtInt()); + // fHistList->Add(fCommonHists->GetHistPtDiff()); + // fHistList->Add(fCommonHists->GetHistPhiInt()); + // fHistList->Add(fCommonHists->GetHistPhiDiff()); + // fHistList->Add(fCommonHists->GetHistEtaInt()); + // fHistList->Add(fCommonHists->GetHistEtaDiff()); + // fHistList->Add(fCommonHists->GetHistProMeanPtperBin()); + // fHistList->Add(fCommonHists->GetHistQ()); // end test //fCommonHistsRes = new AliFlowCommonHistResults("SP"); diff --git a/PWG2/FLOW/AliFlowCommonHist.cxx b/PWG2/FLOW/AliFlowCommonHist.cxx index ec7eb55f38f..d46ceb8d673 100644 --- a/PWG2/FLOW/AliFlowCommonHist.cxx +++ b/PWG2/FLOW/AliFlowCommonHist.cxx @@ -24,6 +24,7 @@ #include "TMath.h" //needed as include #include "TList.h" #include "AliFlowVector.h" +#include "TBrowser.h" class TH1F; class TH1D; @@ -91,24 +92,24 @@ AliFlowCommonHist::AliFlowCommonHist(const AliFlowCommonHist& a): } -AliFlowCommonHist& AliFlowCommonHist::operator=(const AliFlowCommonHist& a) -{ - *fHistMultOrig = *a.fHistMultOrig; - *fHistMultInt = *a.fHistMultInt; - *fHistMultDiff = *a.fHistMultDiff; - *fHistPtInt = *a.fHistPtInt; - *fHistPtDiff = *a.fHistPtDiff; - *fHistPhiInt = *a.fHistPhiInt; - *fHistPhiDiff = *a.fHistPhiDiff; - *fHistEtaInt = *a.fHistEtaInt; - *fHistEtaDiff = *a.fHistEtaDiff; - *fHistProMeanPtperBin = *a.fHistProMeanPtperBin; - *fHistQ = *a.fHistQ; - // *fHistList = *a.fHistList; - fHistList = NULL; +// AliFlowCommonHist& AliFlowCommonHist::operator=(const AliFlowCommonHist& a) +// { +// *fHistMultOrig = *a.fHistMultOrig; +// *fHistMultInt = *a.fHistMultInt; +// *fHistMultDiff = *a.fHistMultDiff; +// *fHistPtInt = *a.fHistPtInt; +// *fHistPtDiff = *a.fHistPtDiff; +// *fHistPhiInt = *a.fHistPhiInt; +// *fHistPhiDiff = *a.fHistPhiDiff; +// *fHistEtaInt = *a.fHistEtaInt; +// *fHistEtaDiff = *a.fHistEtaDiff; +// *fHistProMeanPtperBin = *a.fHistProMeanPtperBin; +// *fHistQ = *a.fHistQ; +// // *fHistList = *a.fHistList; +// fHistList = NULL; - return *this; -} +// return *this; +// } //----------------------------------------------------------------------- @@ -393,7 +394,13 @@ void AliFlowCommonHist::Print(Option_t *option) const } } +//----------------------------------------------------------------------- + void AliFlowCommonHist::Browse(TBrowser *b) +{ + if (!b) return; + if (fHistList) b->Add(fHistList,"AliFlowCommonHistList"); +} diff --git a/PWG2/FLOW/AliFlowCommonHist.h b/PWG2/FLOW/AliFlowCommonHist.h index de2bd141dcb..9987db734ac 100644 --- a/PWG2/FLOW/AliFlowCommonHist.h +++ b/PWG2/FLOW/AliFlowCommonHist.h @@ -18,6 +18,7 @@ class TH1D; class TProfile; class TCollection; class TList; +class TBrowser; class AliFlowCommonHist: public TNamed { @@ -26,10 +27,12 @@ class AliFlowCommonHist: public TNamed { AliFlowCommonHist(); AliFlowCommonHist(const char *name,const char *title = "AliFlowCommonHist"); virtual ~AliFlowCommonHist(); + AliFlowCommonHist(const AliFlowCommonHist& aSetOfHists); + Bool_t IsFolder() const {return kTRUE;}; //make fill methods here Bool_t FillControlHistograms(AliFlowEventSimple* anEvent); - + void Browse(TBrowser *b); //make get methods here Double_t GetEntriesInPtBin(Int_t iBin); //gets entries from fHistPtDiff Double_t GetMeanPt(Int_t iBin); //gets the mean pt for this bin from fHistProMeanPtperBin @@ -54,7 +57,6 @@ class AliFlowCommonHist: public TNamed { private: - AliFlowCommonHist(const AliFlowCommonHist& aSetOfHists); AliFlowCommonHist& operator=(const AliFlowCommonHist& aSetOfHists); //define histograms here @@ -73,7 +75,7 @@ class AliFlowCommonHist: public TNamed { TList* fHistList; //list to hold all histograms - ClassDef(AliFlowCommonHist,0); // macro for rootcint + ClassDef(AliFlowCommonHist,1) // macro for rootcint }; #endif -- 2.43.0