/************************************************************************* * Copyright(c) 1998-2008, 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. * **************************************************************************/ #define AliFlowAnalysisWithMCEventPlane_cxx #include "Riostream.h" //needed as include #include "TFile.h" //needed as include #include "TProfile.h" //needed as include #include "TComplex.h" //needed as include #include "TList.h" class TH1F; #include "AliFlowCommonConstants.h" //needed as include #include "AliFlowEventSimple.h" #include "AliFlowTrackSimple.h" #include "AliFlowCommonHist.h" #include "AliFlowCommonHistResults.h" #include "AliFlowAnalysisWithMCEventPlane.h" class AliFlowVector; // AliFlowAnalysisWithMCEventPlane: // Description: Maker to analyze Flow from the generated MC reaction plane. // This class is used to get the real value of the flow // to compare the other methods to when analysing simulated events // author: N. van der Kolk (kolk@nikhef.nl) ClassImp(AliFlowAnalysisWithMCEventPlane) //----------------------------------------------------------------------- AliFlowAnalysisWithMCEventPlane::AliFlowAnalysisWithMCEventPlane(): fQsum(NULL), fQ2sum(0), fEventNumber(0), fDebug(kFALSE), fHistList(NULL), fCommonHists(NULL), fCommonHistsRes(NULL), fHistRP(NULL), fHistProIntFlow(NULL), fHistProDiffFlowPtRP(NULL), fHistProDiffFlowEtaRP(NULL), fHistProDiffFlowPtPOI(NULL), fHistProDiffFlowEtaPOI(NULL) { // Constructor. fHistList = new TList(); fQsum = new TVector2; // flow vector sum } //----------------------------------------------------------------------- AliFlowAnalysisWithMCEventPlane::~AliFlowAnalysisWithMCEventPlane() { //destructor delete fHistList; delete fQsum; } //----------------------------------------------------------------------- void AliFlowAnalysisWithMCEventPlane::WriteHistograms(TString* outputFileName) { //store the final results in output .root file TFile *output = new TFile(outputFileName->Data(),"RECREATE"); output->WriteObject(fHistList, "cobjMCEP","SingleKey"); delete output; } //----------------------------------------------------------------------- void AliFlowAnalysisWithMCEventPlane::WriteHistograms(TString outputFileName) { //store the final results in output .root file TFile *output = new TFile(outputFileName.Data(),"RECREATE"); output->WriteObject(fHistList, "cobjMCEP","SingleKey"); delete output; } //----------------------------------------------------------------------- void AliFlowAnalysisWithMCEventPlane::Init() { //Define all histograms cout<<"---Analysis with the real MC Event Plane---"<Add(fCommonHists); fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResultsMCEP"); fHistList->Add(fCommonHistsRes); fHistRP = new TH1F("Flow_RP_MCEP","Flow_RP_MCEP",100,0.,3.14); fHistRP->SetXTitle("Reaction Plane Angle"); fHistRP->SetYTitle("Counts"); fHistList->Add(fHistRP); fHistProIntFlow = new TProfile("FlowPro_V_MCEP","FlowPro_V_MCEP",1,0.,1.); fHistProIntFlow->SetLabelSize(0.06); (fHistProIntFlow->GetXaxis())->SetBinLabel(1,"v_{n}{2}"); fHistProIntFlow->SetYTitle(""); fHistList->Add(fHistProIntFlow); fHistProDiffFlowPtRP = new TProfile("FlowPro_VPtRP_MCEP","FlowPro_VPtRP_MCEP",iNbinsPt,dPtMin,dPtMax); fHistProDiffFlowPtRP->SetXTitle("P_{t}"); fHistProDiffFlowPtRP->SetYTitle(""); fHistList->Add(fHistProDiffFlowPtRP); fHistProDiffFlowEtaRP = new TProfile("FlowPro_VetaRP_MCEP","FlowPro_VetaRP_MCEP",iNbinsEta,dEtaMin,dEtaMax); fHistProDiffFlowEtaRP->SetXTitle("#eta"); fHistProDiffFlowEtaRP->SetYTitle(""); fHistList->Add(fHistProDiffFlowEtaRP); fHistProDiffFlowPtPOI = new TProfile("FlowPro_VPtPOI_MCEP","FlowPro_VPtPOI_MCEP",iNbinsPt,dPtMin,dPtMax); fHistProDiffFlowPtPOI->SetXTitle("P_{t}"); fHistProDiffFlowPtPOI->SetYTitle(""); fHistList->Add(fHistProDiffFlowPtPOI); fHistProDiffFlowEtaPOI = new TProfile("FlowPro_VetaPOI_MCEP","FlowPro_VetaPOI_MCEP",iNbinsEta,dEtaMin,dEtaMax); fHistProDiffFlowEtaPOI->SetXTitle("#eta"); fHistProDiffFlowEtaPOI->SetYTitle(""); fHistList->Add(fHistProDiffFlowEtaPOI); fEventNumber = 0; //set number of events to zero } //----------------------------------------------------------------------- void AliFlowAnalysisWithMCEventPlane::Make(AliFlowEventSimple* anEvent) { //Calculate v2 from the MC reaction plane if (anEvent) { // get the MC reaction plane angle Double_t aRP = anEvent->GetMCReactionPlaneAngle(); //fill control histograms fCommonHists->FillControlHistograms(anEvent); //get the Q vector from the FlowEvent AliFlowVector vQ = anEvent->GetQ(); //cout<<"vQ.Mod() = " << vQ.Mod() << endl; //for chi calculation: *fQsum += vQ; //cout<<"fQsum.Mod() = "<GetBinContent(1); Double_t dErrV = fHistProIntFlow->GetBinError(1); // to be improved (treatment of errors for non-Gaussian distribution needed!) // fill no-name int. flow (to be improved): fCommonHistsRes->FillIntegratedFlow(dV,dErrV); cout<<"dV{MC} is "<GetHistPtRP(); Double_t dYieldPtRP = 0.; Double_t dVRP = 0.; Double_t dErrVRP = 0.; Double_t dSumRP = 0.; //differential flow (RP, Pt): Double_t dvPtRP = 0.; Double_t dErrvPtRP = 0.; for(Int_t b=1;bGetBinContent(b); dErrvPtRP = fHistProDiffFlowPtRP->GetBinError(b);//to be improved (treatment of errors for non-Gaussian distribution needed!) fCommonHistsRes->FillDifferentialFlowPtRP(b, dvPtRP, dErrvPtRP); if(fHistPtRP){ //integrated flow (RP) dYieldPtRP = fHistPtRP->GetBinContent(b); dVRP += dvPtRP*dYieldPtRP; dSumRP += dYieldPtRP; //error on integrated flow dErrVRP += dYieldPtRP*dYieldPtRP*dErrvPtRP*dErrvPtRP; } } if (dSumRP != 0. ) { dVRP /= dSumRP; //because pt distribution should be normalised dErrVRP /= (dSumRP*dSumRP); dErrVRP = TMath::Sqrt(dErrVRP); } // fill integrated flow (RP): fCommonHistsRes->FillIntegratedFlowRP(dVRP,dErrVRP); cout<<"dV{MC} (RP) is "<GetBinContent(b); dErrvEtaRP = fHistProDiffFlowEtaRP->GetBinError(b);//to be improved (treatment of errors for non-Gaussian distribution needed!) fCommonHistsRes->FillDifferentialFlowEtaRP(b, dvEtaRP, dErrvEtaRP); } //POI: TH1F* fHistPtPOI = fCommonHists->GetHistPtPOI(); Double_t dYieldPtPOI = 0.; Double_t dVPOI = 0.; Double_t dErrVPOI = 0.; Double_t dSumPOI = 0.; Double_t dv2proPtPOI = 0.; Double_t dErrdifcombPtPOI = 0.; Double_t dv2proEtaPOI = 0.; Double_t dErrdifcombEtaPOI = 0.; //Pt: if(fHistProDiffFlowPtPOI) { for(Int_t b=1;bGetBinContent(b); dErrdifcombPtPOI = fHistProDiffFlowPtPOI->GetBinError(b);//to be improved (treatment of errors for non-Gaussian distribution needed!) //fill TH1D fCommonHistsRes->FillDifferentialFlowPtPOI(b, dv2proPtPOI, dErrdifcombPtPOI); if (fHistPtPOI){ //integrated flow (POI) dYieldPtPOI = fHistPtPOI->GetBinContent(b); dVPOI += dv2proPtPOI*dYieldPtPOI; dSumPOI += dYieldPtPOI; //error on integrated flow dErrVPOI += dYieldPtPOI*dYieldPtPOI*dErrdifcombPtPOI*dErrdifcombPtPOI; } }//end of for(Int_t b=0;bFillIntegratedFlowPOI(dVPOI,dErrVPOI); //Eta: if(fHistProDiffFlowEtaPOI) { for(Int_t b=1;bGetBinContent(b); dErrdifcombEtaPOI = fHistProDiffFlowEtaPOI->GetBinError(b);//to be improved (treatment of errors for non-Gaussian distribution needed!) //fill common hist results: fCommonHistsRes->FillDifferentialFlowEtaPOI(b, dv2proEtaPOI, dErrdifcombEtaPOI); } } cout<