/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ ///////////////////////////////////////////////////////////////////////////////////////// //Description: Maker to analyze Flow using the LeeYangZeros method // Equation numbers are from Big Paper (BP): Nucl. Phys. A 727, 373 (2003) // Practical Guide (PG): J. Phys. G: Nucl. Part. Phys. 30, S1213 (2004) // Adapted from StFlowLeeYangZerosMaker.cxx // by Markus Oldenberg and Art Poskanzer, LBNL // with advice from Jean-Yves Ollitrault and Nicolas Borghini // //Author: Naomi van der Kolk (kolk@nikhef.nl) ///////////////////////////////////////////////////////////////////////////////////////// #include "Riostream.h" #include "TObject.h" #include "TMath.h" #include "TFile.h" #include "TList.h" #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" using std::endl; using std::cout; using std::cerr; ClassImp(AliFlowAnalysisWithLeeYangZeros) //----------------------------------------------------------------------- AliFlowAnalysisWithLeeYangZeros::AliFlowAnalysisWithLeeYangZeros(): fQsum(NULL), fQ2sum(0), fEventNumber(0), fFirstRun(kTRUE), fUseSum(kTRUE), fDoubleLoop(kFALSE), fDebug(kFALSE), fHistList(NULL), fFirstRunList(NULL), fHistVtheta(NULL), fHistProVetaRP(NULL), fHistProVetaPOI(NULL), fHistProVPtRP(NULL), fHistProVPtPOI(NULL), fHistR0theta(NULL), fHistProReDenom(NULL), fHistProImDenom(NULL), fHistReDtheta(NULL), fHistImDtheta(NULL), fHistQsumforChi(NULL), fCommonHists(NULL), fCommonHistsRes(NULL) { //default constructor if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::AliFlowAnalysisWithLeeYangZeros default constructor****"<Data(),"RECREATE"); if (GetFirstRun()) { //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; } //----------------------------------------------------------------------- void AliFlowAnalysisWithLeeYangZeros::WriteHistograms(TString outputFileName) { //store the final results in output .root file TFile *output = new TFile(outputFileName.Data(),"RECREATE"); if (GetFirstRun()) { //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; } //----------------------------------------------------------------------- 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){ if (fUseSum) {fCommonHists = new AliFlowCommonHist("AliFlowCommonHistLYZ1SUM");} else {fCommonHists = new AliFlowCommonHist("AliFlowCommonHistLYZ1PROD");} fHistList->Add(fCommonHists); if (fUseSum) {fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsLYZ1SUM");} else {fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsLYZ1PROD");} fHistList->Add(fCommonHistsRes); } else { if (fUseSum) {fCommonHists = new AliFlowCommonHist("AliFlowCommonHistLYZ2SUM");} else {fCommonHists = new AliFlowCommonHist("AliFlowCommonHistLYZ2PROD");} fHistList->Add(fCommonHists); if (fUseSum) {fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsLYZ2SUM");} else {fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsLYZ2PROD");} fHistList->Add(fCommonHistsRes); } TString nameChiHist; if (fUseSum) {nameChiHist = "Flow_QsumforChi_LYZSUM";} else {nameChiHist = "Flow_QsumforChi_LYZPROD";} fHistQsumforChi = new TH1F(nameChiHist.Data(),nameChiHist.Data(),3,-1.,2.); fHistQsumforChi->SetXTitle("Qsum.X , Qsum.Y, Q2sum"); fHistQsumforChi->SetYTitle("value"); fHistList->Add(fHistQsumforChi); //for first loop over events if (fFirstRun){ TString nameR0Hist; if (fUseSum) {nameR0Hist = "First_Flow_r0theta_LYZSUM";} else {nameR0Hist = "First_Flow_r0theta_LYZPROD";} fHistR0theta = new TH1D(nameR0Hist.Data(),nameR0Hist.Data(),iNtheta,-0.5,iNtheta-0.5); fHistR0theta->SetXTitle("#theta"); fHistR0theta->SetYTitle("r_{0}^{#theta}"); fHistList->Add(fHistR0theta); TString nameVHist; if (fUseSum) {nameVHist = "First_Flow_Vtheta_LYZSUM";} else {nameVHist = "First_Flow_Vtheta_LYZPROD";} fHistVtheta = new TH1D(nameVHist.Data(),nameVHist.Data(),iNtheta,-0.5,iNtheta-0.5); fHistVtheta->SetXTitle("#theta"); fHistVtheta->SetYTitle("V_{n}^{#theta}"); fHistList->Add(fHistVtheta); //class AliFlowLYZHist1 defines the histograms: fHistProGtheta, fHistProReGtheta, fHistProImGtheta for (Int_t theta=0;thetaAdd(fHist1[theta]); } } //for second loop over events else { TString nameReDenomHist; if (fUseSum) {nameReDenomHist = "Second_FlowPro_ReDenom_LYZSUM";} else {nameReDenomHist = "Second_FlowPro_ReDenom_LYZPROD";} fHistProReDenom = new TProfile(nameReDenomHist.Data(),nameReDenomHist.Data(), iNtheta, -0.5, iNtheta-0.5); fHistProReDenom->SetXTitle("#theta"); fHistProReDenom->SetYTitle("Re(Q^{#theta}e^{ir_{0}^{#theta}Q^{#theta}})"); fHistList->Add(fHistProReDenom); TString nameImDenomHist; if (fUseSum) {nameImDenomHist = "Second_FlowPro_ImDenom_LYZSUM";} else {nameImDenomHist = "Second_FlowPro_ImDenom_LYZPROD";} fHistProImDenom = new TProfile(nameImDenomHist.Data(),nameImDenomHist.Data(), iNtheta, -0.5, iNtheta-0.5); fHistProImDenom->SetXTitle("#theta"); fHistProImDenom->SetYTitle("Im(Q^{#theta}e^{ir_{0}^{#theta}Q^{#theta}})"); fHistList->Add(fHistProImDenom); TString nameVetaRPHist; if (fUseSum) {nameVetaRPHist = "Second_FlowPro_VetaRP_LYZSUM";} else {nameVetaRPHist = "Second_FlowPro_VetaRP_LYZPROD";} fHistProVetaRP = new TProfile(nameVetaRPHist.Data(),nameVetaRPHist.Data(),iNbinsEta,dEtaMin,dEtaMax); fHistProVetaRP->SetXTitle("rapidity"); fHistProVetaRP->SetYTitle("v_{2}(#eta) for RP selection"); fHistList->Add(fHistProVetaRP); TString nameVetaPOIHist; if (fUseSum) {nameVetaPOIHist = "Second_FlowPro_VetaPOI_LYZSUM";} else {nameVetaPOIHist = "Second_FlowPro_VetaPOI_LYZPROD";} fHistProVetaPOI = new TProfile(nameVetaPOIHist.Data(),nameVetaPOIHist.Data(),iNbinsEta,dEtaMin,dEtaMax); fHistProVetaPOI->SetXTitle("rapidity"); fHistProVetaPOI->SetYTitle("v_{2}(#eta) for POI selection"); fHistList->Add(fHistProVetaPOI); TString nameVPtRPHist; if (fUseSum) {nameVPtRPHist = "Second_FlowPro_VPtRP_LYZSUM";} else {nameVPtRPHist = "Second_FlowPro_VPtRP_LYZPROD";} fHistProVPtRP = new TProfile(nameVPtRPHist.Data(),nameVPtRPHist.Data(),iNbinsPt,dPtMin,dPtMax); fHistProVPtRP->SetXTitle("Pt"); fHistProVPtRP->SetYTitle("v_{2}(p_{T}) for RP selection"); fHistList->Add(fHistProVPtRP); TString nameVPtPOIHist; if (fUseSum) {nameVPtPOIHist = "Second_FlowPro_VPtPOI_LYZSUM";} else {nameVPtPOIHist = "Second_FlowPro_VPtPOI_LYZPROD";} fHistProVPtPOI = new TProfile(nameVPtPOIHist.Data(),nameVPtPOIHist.Data(),iNbinsPt,dPtMin,dPtMax); fHistProVPtPOI->SetXTitle("p_{T}"); fHistProVPtPOI->SetYTitle("v_{2}(p_{T}) for POI selection"); fHistList->Add(fHistProVPtPOI); if (fUseSum){ fHistReDtheta = new TH1D("Second_Flow_ReDtheta_LYZSUM","Second_Flow_ReDtheta_LYZSUM",iNtheta, -0.5, (double)iNtheta-0.5); fHistReDtheta->SetXTitle("#theta"); fHistReDtheta->SetYTitle("Re(D^{#theta})"); fHistList->Add(fHistReDtheta); fHistImDtheta = new TH1D("Second_Flow_ImDtheta_LYZSUM","Second_Flow_ImDtheta_LYZSUM",iNtheta, -0.5, (double)iNtheta-0.5); fHistImDtheta->SetXTitle("#theta"); fHistImDtheta->SetYTitle("Im(D^{#theta})"); fHistList->Add(fHistImDtheta); } //class AliFlowLYZHist2 defines the histograms: for (Int_t theta=0;thetaAdd(fHist2RP[theta]); TString namePOI = "AliFlowLYZHist2POI_"; namePOI += theta; fHist2POI[theta]=new AliFlowLYZHist2(theta, "POI", namePOI, fUseSum); fHistList->Add(fHist2POI[theta]); } //read histogram fHistR0theta from the first run list if (fFirstRunList) { if (fUseSum) { fHistR0theta = (TH1D*)fFirstRunList->FindObject("First_Flow_r0theta_LYZSUM");} else{ fHistR0theta = (TH1D*)fFirstRunList->FindObject("First_Flow_r0theta_LYZPROD");} if (!fHistR0theta) {cout<<"fHistR0theta has a NULL pointer!"<Add(fHistR0theta); } else { cout<<"list is NULL pointer!"<FillControlHistograms(anEvent); FillFromFlowEvent(anEvent); } else { fCommonHists->FillControlHistograms(anEvent); SecondFillFromFlowEvent(anEvent); } } else { cout<<"##### FlowLeeYangZero: Stack pointer null"<GetNtheta(); if (outputListHistos) { //define histograms for first and second run AliFlowCommonHist *pCommonHist = NULL; AliFlowCommonHistResults *pCommonHistResults = NULL; TH1D* pHistR0theta = NULL; TH1D* pHistVtheta = NULL; TProfile* pHistProReDenom = NULL; TProfile* pHistProImDenom = NULL; TProfile* pHistProVetaRP = NULL; TProfile* pHistProVetaPOI = NULL; 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 = 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; i (outputListHistos->FindObject("AliFlowCommonHistLYZ1SUM")); pCommonHistResults = dynamic_cast (outputListHistos->FindObject("AliFlowCommonHistResultsLYZ1SUM")); //Get the histograms from the output list for(Int_t theta = 0;theta (outputListHistos->FindObject(name)); } pHistVtheta = dynamic_cast (outputListHistos->FindObject("First_Flow_Vtheta_LYZSUM")); pHistR0theta = dynamic_cast (outputListHistos->FindObject("First_Flow_r0theta_LYZSUM")); pHistQsumforChi = dynamic_cast (outputListHistos->FindObject("Flow_QsumforChi_LYZSUM")); //Set the histogram pointers and call Finish() if (pCommonHist && pCommonHistResults && pLYZHist1[0] && pHistVtheta && pHistR0theta && pHistQsumforChi ) { this->SetCommonHists(pCommonHist); this->SetCommonHistsRes(pCommonHistResults); this->SetHist1(pLYZHist1); this->SetHistVtheta(pHistVtheta); this->SetHistR0theta(pHistR0theta); this->SetHistQsumforChi(pHistQsumforChi); } else { cout<<"WARNING: Histograms needed to run Finish() firstrun (SUM) are not accessable!"< (outputListHistos->FindObject("AliFlowCommonHistLYZ1PROD")); pCommonHistResults = dynamic_cast (outputListHistos->FindObject("AliFlowCommonHistResultsLYZ1PROD")); //Get the histograms from the output list for(Int_t theta = 0;theta (outputListHistos->FindObject(name)); } pHistVtheta = dynamic_cast (outputListHistos->FindObject("First_Flow_Vtheta_LYZPROD")); pHistR0theta = dynamic_cast (outputListHistos->FindObject("First_Flow_r0theta_LYZPROD")); pHistQsumforChi = dynamic_cast (outputListHistos->FindObject("Flow_QsumforChi_LYZPROD")); //Set the histogram pointers and call Finish() if (pCommonHist && pCommonHistResults && pLYZHist1[0] && pHistVtheta && pHistR0theta && pHistQsumforChi ) { this->SetCommonHists(pCommonHist); this->SetCommonHistsRes(pCommonHistResults); this->SetHist1(pLYZHist1); this->SetHistVtheta(pHistVtheta); this->SetHistR0theta(pHistR0theta); this->SetHistQsumforChi(pHistQsumforChi); } else { cout<<"WARNING: Histograms needed to run Finish() firstrun (PROD) are not accessable!"< (outputListHistos->FindObject("AliFlowCommonHistLYZ2SUM")); pCommonHistResults = dynamic_cast (outputListHistos->FindObject("AliFlowCommonHistResultsLYZ2SUM")); pHistR0theta = dynamic_cast (outputListHistos->FindObject("First_Flow_r0theta_LYZSUM")); pHistQsumforChi = dynamic_cast (outputListHistos->FindObject("Flow_QsumforChi_LYZSUM")); //Get the histograms from the output list for(Int_t theta = 0;theta (outputListHistos->FindObject(nameRP)); TString namePOI = "AliFlowLYZHist2POI_"; namePOI += theta; pLYZHist2POI[theta] = dynamic_cast (outputListHistos->FindObject(namePOI)); } pHistProReDenom = dynamic_cast (outputListHistos->FindObject("Second_FlowPro_ReDenom_LYZSUM")); pHistProImDenom = dynamic_cast (outputListHistos->FindObject("Second_FlowPro_ImDenom_LYZSUM")); TH1D* pHistReDtheta = dynamic_cast (outputListHistos->FindObject("Second_Flow_ReDtheta_LYZSUM")); TH1D* pHistImDtheta = dynamic_cast (outputListHistos->FindObject("Second_Flow_ImDtheta_LYZSUM")); pHistProVetaRP = dynamic_cast (outputListHistos->FindObject("Second_FlowPro_VetaRP_LYZSUM")); pHistProVetaPOI = dynamic_cast (outputListHistos->FindObject("Second_FlowPro_VetaPOI_LYZSUM")); pHistProVPtRP = dynamic_cast (outputListHistos->FindObject("Second_FlowPro_VPtRP_LYZSUM")); pHistProVPtPOI = dynamic_cast (outputListHistos->FindObject("Second_FlowPro_VPtPOI_LYZSUM")); //Set the histogram pointers and call Finish() if (pCommonHist && pCommonHistResults && pLYZHist2RP[0] && pLYZHist2POI[0] && pHistR0theta && pHistProReDenom && pHistProImDenom && pHistReDtheta && pHistImDtheta && pHistProVetaRP && pHistProVetaPOI && pHistProVPtRP && pHistProVPtPOI && pHistQsumforChi) { this->SetCommonHists(pCommonHist); this->SetCommonHistsRes(pCommonHistResults); this->SetHist2RP(pLYZHist2RP); this->SetHist2POI(pLYZHist2POI); this->SetHistR0theta(pHistR0theta); this->SetHistProReDenom(pHistProReDenom); this->SetHistProImDenom(pHistProImDenom); this->SetHistReDtheta(pHistReDtheta); this->SetHistImDtheta(pHistImDtheta); this->SetHistProVetaRP(pHistProVetaRP); this->SetHistProVetaPOI(pHistProVetaPOI); this->SetHistProVPtRP(pHistProVPtRP); this->SetHistProVPtPOI(pHistProVPtPOI); this->SetHistQsumforChi(pHistQsumforChi); } else { cout<<"WARNING: Histograms needed to run Finish() secondrun (SUM) are not accessable!"< (outputListHistos->FindObject("AliFlowCommonHistLYZ2PROD")); pCommonHistResults = dynamic_cast (outputListHistos->FindObject("AliFlowCommonHistResultsLYZ2PROD")); pHistR0theta = dynamic_cast (outputListHistos->FindObject("First_Flow_r0theta_LYZPROD")); pHistQsumforChi = dynamic_cast (outputListHistos->FindObject("Flow_QsumforChi_LYZPROD")); //Get the histograms from the output list for(Int_t theta = 0;theta (outputListHistos->FindObject(nameRP)); TString namePOI = "AliFlowLYZHist2POI_"; namePOI += theta; pLYZHist2POI[theta] = dynamic_cast (outputListHistos->FindObject(namePOI)); } pHistProReDenom = dynamic_cast (outputListHistos->FindObject("Second_FlowPro_ReDenom_LYZPROD")); pHistProImDenom = dynamic_cast (outputListHistos->FindObject("Second_FlowPro_ImDenom_LYZPROD")); pHistProVetaRP = dynamic_cast (outputListHistos->FindObject("Second_FlowPro_VetaRP_LYZPROD")); pHistProVetaPOI = dynamic_cast (outputListHistos->FindObject("Second_FlowPro_VetaPOI_LYZPROD")); pHistProVPtRP = dynamic_cast (outputListHistos->FindObject("Second_FlowPro_VPtRP_LYZPROD")); pHistProVPtPOI = dynamic_cast (outputListHistos->FindObject("Second_FlowPro_VPtPOI_LYZPROD")); //Set the histogram pointers and call Finish() if (pCommonHist && pCommonHistResults && pLYZHist2RP[0] && pLYZHist2POI[0] && pHistR0theta && pHistProReDenom && pHistProImDenom && pHistProVetaRP && pHistProVetaPOI && pHistProVPtRP && pHistProVPtPOI && pHistQsumforChi) { this->SetCommonHists(pCommonHist); this->SetCommonHistsRes(pCommonHistResults); this->SetHist2RP(pLYZHist2RP); this->SetHist2POI(pLYZHist2POI); this->SetHistR0theta(pHistR0theta); this->SetHistProReDenom(pHistProReDenom); this->SetHistProImDenom(pHistProImDenom); this->SetHistProVetaRP(pHistProVetaRP); this->SetHistProVetaPOI(pHistProVetaPOI); this->SetHistProVPtRP(pHistProVPtRP); this->SetHistProVPtPOI(pHistProVPtPOI); this->SetHistQsumforChi(pHistQsumforChi); } else { cout<<"WARNING: Histograms needed to run Finish() secondrun (PROD) are not accessable!"<Print(); delete [] pLYZHist1; delete [] pLYZHist2RP; delete [] pLYZHist2POI; } //listhistos else { cout << "histogram list pointer is empty in method AliFlowAnalysisWithLeeYangZeros::GetOutputHistograms() " << endl;} } //----------------------------------------------------------------------- Bool_t AliFlowAnalysisWithLeeYangZeros::Finish() { //finish method if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::Finish()****"<GetNtheta(); //set the event number SetEventNumber((int)fCommonHists->GetHistQ()->GetEntries()); //Get multiplicity for RP selection Double_t dMultRP = fCommonHists->GetHistMultRP()->GetMean(); if (fDebug) cout<<"The average multiplicity is "<Set(fHistQsumforChi->GetBinContent(1),fHistQsumforChi->GetBinContent(2)); SetQ2sum(fHistQsumforChi->GetBinContent(3)); if (fFirstRun){ //define variables for the first run Double_t dR0 = 0; Double_t dVtheta = 0; Double_t dv = 0; Double_t dV = 0; //reset histograms in case of merged output files fHistR0theta->Reset(); fHistVtheta->Reset(); for (Int_t theta=0;thetaFillGtheta(); dR0 = fHist1[theta]->GetR0(); //calculate integrated flow 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 (!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.; if (fUseSum){ //for SUM: V=v because the Q-vector is scaled by 1/M dv = dVtheta; dvplus = dVplus; dvmin = dVmin; } else { //for PRODUCT: v=V/M if (!TMath::AreEqualAbs(dMultRP, 0., 1e-100)){ dv = dVtheta/dMultRP; dvplus = dVplus/dMultRP; dvmin = dVmin/dMultRP; }} if (fDebug) cout<<"dv = "<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->FillChi(dChi); cout<<"*************************************"<FillIntegratedFlow(dv2pro, dv2Err); if (fDebug) cout<<"****histograms filled****"<GetNbinsPt(); Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta(); Double_t dR0 = 0.; Double_t dVtheta = 0.; Double_t dV = 0.; Double_t dReDenom = 0.; Double_t dImDenom = 0.; //reset histograms in case of merged output files if (fUseSum) { fHistReDtheta->Reset(); fHistImDtheta->Reset(); } fHistProVetaRP ->Reset(); fHistProVetaPOI->Reset(); fHistProVPtRP ->Reset(); fHistProVPtPOI ->Reset(); //scale fHistR0theta by the number of merged files to undo the merging if (!fHistR0theta) { cout<<"Hist pointer R0theta in file does not exist"<GetEntries(); if (iEntries > iNtheta){ //for each individual file fHistR0theta has iNtheta entries Int_t iFiles = iEntries/iNtheta; cout<Scale(1./iFiles); } //loop over theta for (Int_t theta=0;thetaGetBinContent(theta+1); //histogram starts at bin 1 if (fDebug) cerr<<"dR0 = "< Vn^theta = j01/r0^theta if (!fHistProReDenom || !fHistProImDenom) { cout << "Hist pointer fDenom in file does not exist" <GetBinContent(theta+1); dImDenom = fHistProImDenom->GetBinContent(theta+1); cDenom(dReDenom,dImDenom); //for new method and use by others (only with the sum generating function): if (fUseSum) { cDtheta = dR0*cDenom/dJ01; fHistReDtheta->SetBinContent(theta+1,cDtheta.Re()); fHistReDtheta->SetBinError(theta+1,0.0); fHistImDtheta->SetBinContent(theta+1,cDtheta.Im()); fHistImDtheta->SetBinError(theta+1,0.0); } cDenom *= TComplex::Power(i, m-1); //v as a function of eta for RP selection for (Int_t be=1;be<=iNbinsEta;be++) { Double_t dReRatioRP = 0.0; Double_t dEtaRP = fHist2RP[theta]->GetBinCenter(be); cNumerRP = fHist2RP[theta]->GetNumerEta(be); if (cNumerRP.Rho()==0) { if (fDebug) cerr<<"WARNING: modulus of cNumerRP is zero in Finish()"<Fill(dEtaRP,dVetaRP); } //loop over bins be //v as a function of eta for POI selection for (Int_t be=1;be<=iNbinsEta;be++) { Double_t dReRatioPOI = 0.0; Double_t dEtaPOI = fHist2POI[theta]->GetBinCenter(be); cNumerPOI = fHist2POI[theta]->GetNumerEta(be); if (cNumerPOI.Rho()==0) { if (fDebug) cerr<<"WARNING: modulus of cNumerPOI is zero in Finish()"<Fill(dEtaPOI,dVetaPOI); } //loop over bins be //v as a function of Pt for RP selection for (Int_t bp=1;bp<=iNbinsPt;bp++) { Double_t dReRatioRP = 0.0; Double_t dPtRP = fHist2RP[theta]->GetBinCenterPt(bp); cNumerRP = fHist2RP[theta]->GetNumerPt(bp); if (cNumerRP.Rho()==0) { if (fDebug) cerr<<"WARNING: modulus of cNumerRP is zero"<Fill(dPtRP,dVPtRP); } //loop over bins bp //v as a function of Pt for POI selection for (Int_t bp=1;bp<=iNbinsPt;bp++) { Double_t dReRatioPOI = 0.0; Double_t dPtPOI = fHist2POI[theta]->GetBinCenterPt(bp); cNumerPOI = fHist2POI[theta]->GetNumerPt(bp); if (cNumerPOI.Rho()==0) { if (fDebug) cerr<<"WARNING: modulus of cNumerPOI is zero"<Fill(dPtPOI,dVPtPOI); } //loop over bins bp } } }//end of loop over theta //calculate the average of fVtheta = fV dV /= iNtheta; if (!fUseSum) { if (dMultRP!=0.) { dV /=dMultRP; }} //scale by the multiplicity for PRODUCT if (TMath::AreEqualAbs(dV, 0., 1e-100)) { cout<<"dV = 0! Leaving LYZ analysis."<GetBinContent(b); Double_t dNprime = fCommonHists->GetEntriesInEtaBinRP(b); Double_t dErrdifcomb = 0.; //set error to zero Double_t dErr2difcomb = 0.; //set error to zero //calculate error if (!TMath::AreEqualAbs(dNprime, 0., 1e-100)) { for (Int_t theta=0;thetaFillDifferentialFlowEtaRP(b, dv2pro, dErrdifcomb); } //loop over bins b //v as a function of eta for POI selection for(Int_t b=0;bGetBinContent(b); Double_t dNprime = fCommonHists->GetEntriesInEtaBinPOI(b); Double_t dErrdifcomb = 0.; //set error to zero Double_t dErr2difcomb = 0.; //set error to zero //calculate error if (dNprime!=0.) { for (Int_t theta=0;thetaFillDifferentialFlowEtaPOI(b, dv2pro, dErrdifcomb); } //loop over bins b //v as a function of Pt for RP selection TH1F* fHistPtRP = fCommonHists->GetHistPtRP(); //for calculating integrated flow Double_t dVRP = 0.; Double_t dSum = 0.; Double_t dErrV =0.; for(Int_t b=0;bGetBinContent(b); Double_t dNprime = fCommonHists->GetEntriesInPtBinRP(b); Double_t dErrdifcomb = 0.; //set error to zero Double_t dErr2difcomb = 0.; //set error to zero //calculate error if (dNprime!=0.) { for (Int_t theta=0;thetaFillIntegratedFlowRP(dVRP,dErrV); //v as a function of Pt for POI selection TH1F* fHistPtPOI = fCommonHists->GetHistPtPOI(); //for calculating integrated flow Double_t dVPOI = 0.; dSum = 0.; dErrV =0.; for(Int_t b=0;bGetBinContent(b); Double_t dNprime = fCommonHists->GetEntriesInPtBinPOI(b); Double_t dErrdifcomb = 0.; //set error to zero Double_t dErr2difcomb = 0.; //set error to zero //calculate error if (dNprime!=0.) { for (Int_t theta=0;thetaFillIntegratedFlowPOI(dVPOI,dErrV); } //secondrun //cout<<"----LYZ analysis finished....----"<GetNtheta(); Int_t iNbins = AliFlowLYZConstants::GetMaster()->GetNbins(); //calculate flow Double_t dOrder = 2.; //get the Q vector AliFlowVector vQ = anEvent->GetQ(); //weight by the multiplicity Double_t dQX = 0; Double_t dQY = 0; if (!TMath::AreEqualAbs(vQ.GetMult(), 0., 1e-100)) { dQX = vQ.X()/vQ.GetMult(); dQY = vQ.Y()/vQ.GetMult(); } vQ.Set(dQX,dQY); //for chi calculation: *fQsum += vQ; fHistQsumforChi->SetBinContent(1,fQsum->X()); fHistQsumforChi->SetBinContent(2,fQsum->Y()); fQ2sum += vQ.Mod2(); fHistQsumforChi->SetBinContent(3,fQ2sum); for (Int_t theta=0;thetaGetBinCenter(bin); //bincentre of bins in histogram //FIXED??? if (fUseSum) { //calculate the sum generating function cExpo(0.,dR*dQtheta); //Re=0 ; Im=dR*dQtheta cGtheta = TComplex::Exp(cExpo); } else { //calculate the product generating function cGtheta = GetGrtheta(anEvent, dR, dTheta); if (cGtheta.Rho2() > 100.) break; } //fill real and imaginary part of cGtheta fHist1[theta]->Fill(dR,cGtheta); } //loop over bins } //loop over theta return kTRUE; } //----------------------------------------------------------------------- Bool_t AliFlowAnalysisWithLeeYangZeros::SecondFillFromFlowEvent(AliFlowEventSimple* anEvent) { //for differential flow if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::SecondFillFromFlowEvent()****"<GetNtheta(); //get the Q vector AliFlowVector vQ = anEvent->GetQ(); //weight by the multiplicity Double_t dQX = 0.; Double_t dQY = 0.; if (vQ.GetMult() != 0) { dQX = vQ.X()/vQ.GetMult(); dQY = vQ.Y()/vQ.GetMult(); } vQ.Set(dQX,dQY); //for chi calculation: *fQsum += vQ; fHistQsumforChi->SetBinContent(1,fQsum->X()); fHistQsumforChi->SetBinContent(2,fQsum->Y()); fQ2sum += vQ.Mod2(); fHistQsumforChi->SetBinContent(3,fQ2sum); for (Int_t theta=0;thetaGetBinContent(theta+1); } else { cout <<"pointer fHistR0theta does not exist" << endl; } if (fUseSum) //sum generating function { cExpo(0.,dR0*dQtheta); cDenom = dQtheta*(TComplex::Exp(cExpo)); //BP eq 12 //loop over tracks in event Int_t iNumberOfTracks = anEvent->NumberOfTracks(); for (Int_t i=0;iGetTrack(i); if (pTrack) { Double_t dEta = pTrack->Eta(); Double_t dPt = pTrack->Pt(); Double_t dPhi = pTrack->Phi(); if (pTrack->InRPSelection()) { // RP selection dCosTermRP = cos(m*dOrder*(dPhi-dTheta)); cNumerRP = dCosTermRP*(TComplex::Exp(cExpo)); if (cNumerRP.Rho()==0) { cerr<<"WARNING: modulus of cNumerRP is zero in SecondFillFromFlowEvent"<Fill(dEta,dPt,cNumerRP); } } if (pTrack->InPOISelection()) { //POI selection dCosTermPOI = cos(m*dOrder*(dPhi-dTheta)); cNumerPOI = dCosTermPOI*(TComplex::Exp(cExpo)); if (cNumerPOI.Rho()==0) { cerr<<"WARNING: modulus of cNumerPOI is zero in SecondFillFromFlowEvent"<Fill(dEta,dPt,cNumerPOI); } } } //if track else {cerr << "no particle!!!"<Fill(theta,cDenom.Re()); //fill the real part of fDenom fHistProImDenom->Fill(theta,cDenom.Im()); //fill the imaginary part of fDenom } else { cout << "Pointers to cDenom mising" << endl;} }//end of loop over theta return kTRUE; } //----------------------------------------------------------------------- Double_t AliFlowAnalysisWithLeeYangZeros::GetQtheta(AliFlowVector aQ, Double_t aTheta) { //calculate Qtheta. Qtheta is the sum over all particles of cos(dOrder*(dPhi-dTheta)) BP eq. 3 if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::GetQtheta()****"<GetEventNSelTracksRP(); //weight with the multiplicity Int_t iNumberOfTracks = anEvent->NumberOfTracks(); for (Int_t i=0;iGetTrack(i) ; if (pTrack){ if (pTrack->InRPSelection()) { Double_t dPhi = pTrack->Phi(); Double_t dGIm = aR * dWgt*cos(dOrder*(dPhi - aTheta)); TComplex cGi(1., dGIm); cG *= cGi; //product over all tracks } } else {cerr << "no particle pointer !!!"<GetEventNSelTracksRP(); //weight with the multiplicity Int_t iNumberOfTracks = anEvent->NumberOfTracks(); Int_t iNtheta = AliFlowLYZConstants::GetMaster()->GetNtheta(); Double_t dTheta = ((double)theta/iNtheta)*TMath::Pi()/dOrder; //for the denominator (use all RP selected particles) for (Int_t i=0;iGetTrack(i) ; if (pTrack){ if (pTrack->InRPSelection()) { Double_t dPhi = pTrack->Phi(); Double_t dCosTerm = dWgt*cos(dOrder*(dPhi - dTheta)); //GetGr0theta Double_t dGIm = aR0 * dCosTerm; TComplex cGi(1., dGIm); TComplex cCosTermComplex(1., aR0*dCosTerm); cG *= cGi; //product over all tracks //GetdGr0theta cdGr0 +=(dCosTerm / cCosTermComplex); //sum over all tracks } } //if particle else {cerr << "no particle!!!"<GetTrack(i) ; if (pTrack){ Double_t dEta = pTrack->Eta(); Double_t dPt = pTrack->Pt(); Double_t dPhi = pTrack->Phi(); Double_t dCosTerm = cos(dOrder*(dPhi-dTheta)); TComplex cCosTermComplex(1.,aR0*dCosTerm); //RP selection if (pTrack->InRPSelection()) { TComplex cNumerRP = cG*dCosTerm/cCosTermComplex; //PG Eq. 9 fHist2RP[theta]->Fill(dEta,dPt,cNumerRP); } //POI selection if (pTrack->InPOISelection()) { TComplex cNumerPOI = cG*dCosTerm/cCosTermComplex; //PG Eq. 9 fHist2POI[theta]->Fill(dEta,dPt,cNumerPOI); } } //if particle else {cerr << "no particle pointer!!!"<