X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PWG2%2FFLOW%2FAliFlowCommon%2FAliFlowAnalysisWithLeeYangZeros.cxx;h=ff29c7f61fd88a83b156dd5fdc2bf3058dd6f719;hb=85d2ee8d3c6f05e0e72c8896a94b71451022ff0c;hp=14ecb243339c8f417b61cc71f3f460a13d8c5a6c;hpb=5b40431dea3d0b7e50a48a6c89ecdb27fb2ae14c;p=u%2Fmrichter%2FAliRoot.git diff --git a/PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithLeeYangZeros.cxx b/PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithLeeYangZeros.cxx index 14ecb243339..ff29c7f61fd 100644 --- a/PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithLeeYangZeros.cxx +++ b/PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithLeeYangZeros.cxx @@ -24,29 +24,27 @@ //Author: Naomi van der Kolk (kolk@nikhef.nl) ///////////////////////////////////////////////////////////////////////////////////////// -#include "Riostream.h" //needed as include -#include "TObject.h" //needed as include -#include "AliFlowCommonConstants.h" //needed as include -#include "AliFlowLYZConstants.h" //needed as include -#include "AliFlowAnalysisWithLeeYangZeros.h" -#include "AliFlowLYZHist1.h" //needed as include -#include "AliFlowLYZHist2.h" //needed as include -#include "AliFlowCommonHist.h" //needed as include -#include "AliFlowCommonHistResults.h" //needed as include -#include "AliFlowEventSimple.h" //needed as include -#include "AliFlowTrackSimple.h" //needed as include - -class AliFlowVector; - -#include "TMath.h" //needed as include -#include "TFile.h" //needed as include +#include "Riostream.h" +#include "TObject.h" +#include "TMath.h" +#include "TFile.h" #include "TList.h" - -class TComplex; -class TProfile; -class TH1F; -class TH1D; - +#include "TVector2.h" +#include "TH1F.h" +#include "TComplex.h" +#include "TProfile.h" +#include "TDirectoryFile.h" + +#include "AliFlowCommonConstants.h" +#include "AliFlowLYZConstants.h" +#include "AliFlowAnalysisWithLeeYangZeros.h" +#include "AliFlowLYZHist1.h" +#include "AliFlowLYZHist2.h" +#include "AliFlowCommonHist.h" +#include "AliFlowCommonHistResults.h" +#include "AliFlowEventSimple.h" +#include "AliFlowTrackSimple.h" +#include "AliFlowVector.h" ClassImp(AliFlowAnalysisWithLeeYangZeros) @@ -118,12 +116,14 @@ void AliFlowAnalysisWithLeeYangZeros::WriteHistograms(TString* outputFileName) //output->WriteObject(fHistList, "cobjLYZ1","SingleKey"); if (fUseSum) { fHistList->SetName("cobjLYZ1SUM");} else {fHistList->SetName("cobjLYZ1PROD");} + fHistList->SetOwner(kTRUE); fHistList->Write(fHistList->GetName(), TObject::kSingleKey); } else { //output->WriteObject(fHistList, "cobjLYZ2","SingleKey"); if (fUseSum) { fHistList->SetName("cobjLYZ2SUM"); } else { fHistList->SetName("cobjLYZ2PROD"); } + fHistList->SetOwner(kTRUE); fHistList->Write(fHistList->GetName(), TObject::kSingleKey); } delete output; @@ -140,12 +140,14 @@ void AliFlowAnalysisWithLeeYangZeros::WriteHistograms(TString outputFileName) //output->WriteObject(fHistList, "cobjLYZ1","SingleKey"); if (fUseSum) { fHistList->SetName("cobjLYZ1SUM");} else {fHistList->SetName("cobjLYZ1PROD");} + fHistList->SetOwner(kTRUE); fHistList->Write(fHistList->GetName(), TObject::kSingleKey); } else { //output->WriteObject(fHistList, "cobjLYZ2","SingleKey"); if (fUseSum) { fHistList->SetName("cobjLYZ2SUM"); } else { fHistList->SetName("cobjLYZ2PROD"); } + fHistList->SetOwner(kTRUE); fHistList->Write(fHistList->GetName(), TObject::kSingleKey); } delete output; @@ -153,20 +155,47 @@ void AliFlowAnalysisWithLeeYangZeros::WriteHistograms(TString outputFileName) //----------------------------------------------------------------------- +void AliFlowAnalysisWithLeeYangZeros::WriteHistograms(TDirectoryFile *outputFileName) +{ + //store the final results in output .root file + if (GetFirstRun()) { + if (fUseSum) { fHistList->SetName("cobjLYZ1SUM");} + else {fHistList->SetName("cobjLYZ1PROD");} + fHistList->SetOwner(kTRUE); + outputFileName->Add(fHistList); + outputFileName->Write(outputFileName->GetName(), TObject::kSingleKey); + } + else { + if (fUseSum) { fHistList->SetName("cobjLYZ2SUM"); } + else { fHistList->SetName("cobjLYZ2PROD"); } + fHistList->SetOwner(kTRUE); + outputFileName->Add(fHistList); + outputFileName->Write(outputFileName->GetName(), TObject::kSingleKey); + } +} + +//----------------------------------------------------------------------- + Bool_t AliFlowAnalysisWithLeeYangZeros::Init() { //init method if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::Init()****"<GetNtheta(); + 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(); //for control histograms if (fFirstRun){ @@ -311,7 +340,10 @@ Bool_t AliFlowAnalysisWithLeeYangZeros::Init() if (fDebug) cout<<"****Histograms initialised****"<GetNtheta(); if (outputListHistos) { @@ -365,9 +397,18 @@ void AliFlowAnalysisWithLeeYangZeros::GetOutputHistograms(TList *outputListHisto TProfile* pHistProVPtRP = NULL; TProfile* pHistProVPtPOI = NULL; TH1F* pHistQsumforChi = NULL; - AliFlowLYZHist1 *pLYZHist1[iNtheta] = {NULL}; //array of pointers to AliFlowLYZHist1 - AliFlowLYZHist2 *pLYZHist2RP[iNtheta] = {NULL}; //array of pointers to AliFlowLYZHist2 - AliFlowLYZHist2 *pLYZHist2POI[iNtheta] = {NULL}; //array of pointers to AliFlowLYZHist2 + //AliFlowLYZHist1 *pLYZHist1[iNtheta] = {NULL}; //array of pointers to AliFlowLYZHist1 + //AliFlowLYZHist2 *pLYZHist2RP[iNtheta] = {NULL}; //array of pointers to AliFlowLYZHist2 + //AliFlowLYZHist2 *pLYZHist2POI[iNtheta] = {NULL}; //array of pointers to AliFlowLYZHist2 + AliFlowLYZHist1 **pLYZHist1 = new AliFlowLYZHist1*[iNtheta]; //array of pointers to AliFlowLYZHist1 + AliFlowLYZHist2 **pLYZHist2RP = new AliFlowLYZHist2*[iNtheta]; //array of pointers to AliFlowLYZHist2 + AliFlowLYZHist2 **pLYZHist2POI = new AliFlowLYZHist2*[iNtheta]; //array of pointers to AliFlowLYZHist2 + for (Int_t i=0; iPrint(); + delete [] pLYZHist1; + delete [] pLYZHist2RP; + delete [] pLYZHist2POI; } //listhistos else { cout << "histogram list pointer is empty in method AliFlowAnalysisWithLeeYangZeros::GetOutputHistograms() " << endl;} @@ -584,7 +628,7 @@ void AliFlowAnalysisWithLeeYangZeros::GetOutputHistograms(TList *outputListHisto //define variables for both runs Double_t dJ01 = 2.405; - Int_t iNtheta = AliFlowLYZConstants::kTheta; + Int_t iNtheta = AliFlowLYZConstants::GetMaster()->GetNtheta(); //set the event number SetEventNumber((int)fCommonHists->GetHistMultOrig()->GetEntries()); //cout<<"number of events processed is "<GetR0(); //calculate integrated flow - if (dR0!=0.) { dVtheta = dJ01/dR0; } + if (!TMath::AreEqualAbs(dR0, 0., 1e-100)) { dVtheta = dJ01/dR0; } else { cout<<"r0 is not found! Leaving LYZ analysis."<GetMaxSUM())/(AliFlowLYZConstants::GetMaster()->GetNbins());} + else { dBinsize = (AliFlowLYZConstants::GetMaster()->GetMaxPROD())/(AliFlowLYZConstants::GetMaster()->GetNbins());} Double_t dVplus = -1.; Double_t dVmin = -1.; - if (dR0+dBinsize!=0.) {dVplus = dJ01/(dR0+dBinsize);} - if (dR0-dBinsize!=0.) {dVmin = dJ01/(dR0-dBinsize);} + if (!TMath::AreEqualAbs(dR0+dBinsize, 0., 1e-100)) {dVplus = dJ01/(dR0+dBinsize);} + if (!TMath::AreEqualAbs(dR0-dBinsize, 0., 1e-100)) {dVmin = dJ01/(dR0-dBinsize);} //convert V to v Double_t dvplus = -1.; Double_t dvmin= -1.; @@ -628,7 +674,7 @@ void AliFlowAnalysisWithLeeYangZeros::GetOutputHistograms(TList *outputListHisto dvmin = dVmin; } else { //for PRODUCT: v=V/M - if (dMultRP!=0.){ + if (!TMath::AreEqualAbs(dMultRP, 0., 1e-100)){ dv = dVtheta/dMultRP; dvplus = dVplus/dMultRP; dvmin = dVmin/dMultRP; }} @@ -645,14 +691,17 @@ void AliFlowAnalysisWithLeeYangZeros::GetOutputHistograms(TList *outputListHisto //get average value of fVtheta = fV dV /=iNtheta; if (!fUseSum) { if (dMultRP!=0.){dV /=dMultRP;}} //scale with multiplicity for PRODUCT - + //sigma2 and chi Double_t dSigma2 = 0; Double_t dChi= 0; if (fEventNumber!=0) { *fQsum /= fEventNumber; + //cout<<"fQsum is "<X()<<" "<Y()<X(),2.) - TMath::Power(fQsum->Y(),2.) - TMath::Power(dV,2.); //BP eq. 62 + //cout<<"dSigma2 is "<0) dChi = dV/TMath::Sqrt(dSigma2); else dChi = -1.; fCommonHistsRes->FillChiRP(dChi); @@ -714,8 +763,8 @@ void AliFlowAnalysisWithLeeYangZeros::GetOutputHistograms(TList *outputListHisto Int_t m = 1; TComplex i = TComplex::I(); Double_t dBesselRatio[3] = {1., 1.202, 2.69}; - Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt(); - Int_t iNbinsEta = AliFlowCommonConstants::GetNbinsEta(); + Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt(); + Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta(); Double_t dEtaRP, dPtRP, dReRatioRP, dVetaRP, dVPtRP, dEtaPOI, dPtPOI, dReRatioPOI, dVetaPOI, dVPtPOI; @@ -730,7 +779,7 @@ void AliFlowAnalysisWithLeeYangZeros::GetOutputHistograms(TList *outputListHisto } else { dR0 = fHistProR0theta->GetBinContent(theta+1); //histogram starts at bin 1 if (fDebug) cerr<<"dR0 = "< Vn^theta = j01/r0^theta if (!fHistProReDenom && !fHistProImDenom) { @@ -758,7 +807,7 @@ void AliFlowAnalysisWithLeeYangZeros::GetOutputHistograms(TList *outputListHisto if (fDebug) cerr<<"WARNING: modulus of cNumerRP is zero in Finish()"<GetNtheta(); + Int_t iNbins = AliFlowLYZConstants::GetMaster()->GetNbins(); //calculate flow @@ -1097,7 +1146,7 @@ void AliFlowAnalysisWithLeeYangZeros::GetOutputHistograms(TList *outputListHisto //weight by the multiplicity Double_t dQX = 0; Double_t dQY = 0; - if (vQ.GetMult() != 0) { + if (!TMath::AreEqualAbs(vQ.GetMult(), 0., 1e-100)) { dQX = vQ.X()/vQ.GetMult(); dQY = vQ.Y()/vQ.GetMult(); } @@ -1166,7 +1215,7 @@ void AliFlowAnalysisWithLeeYangZeros::GetOutputHistograms(TList *outputListHisto Double_t dCosTermPOI = 0.; Double_t m = 1.; Double_t dOrder = 2.; - Int_t iNtheta = AliFlowLYZConstants::kTheta; + Int_t iNtheta = AliFlowLYZConstants::GetMaster()->GetNtheta(); //get the Q vector @@ -1328,7 +1377,7 @@ TComplex AliFlowAnalysisWithLeeYangZeros::GetDiffFlow(AliFlowEventSimple* const Int_t iNumberOfTracks = anEvent->NumberOfTracks(); - Int_t iNtheta = AliFlowLYZConstants::kTheta; + Int_t iNtheta = AliFlowLYZConstants::GetMaster()->GetNtheta(); Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi()/dOrder; //for the denominator (use all RP selected particles)