/************************************************************************* * 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. * **************************************************************************/ /************************************** * analysis task for cumulant method * * * * authors: Naomi van der Kolk * * (kolk@nikhef.nl) * * Raimond Snellings * * (snelling@nikhef.nl) * * Ante Bilandzic * * (anteb@nikhef.nl) * * ***********************************/ #include "Riostream.h" #include "TChain.h" #include "TTree.h" #include "TFile.h" #include "TList.h" #include "TH1.h" #include "TProfile.h" #include "TProfile2D.h" #include "TProfile3D.h" #include "AliAnalysisTask.h" #include "AliAnalysisDataSlot.h" #include "AliAnalysisDataContainer.h" #include "AliAnalysisManager.h" #include "AliESDEvent.h" #include "AliESDInputHandler.h" #include "AliAODEvent.h" #include "AliAODInputHandler.h" #include "AliMCEventHandler.h" #include "AliMCEvent.h" #include "../../CORRFW/AliCFManager.h" #include "AliAnalysisTaskCumulants.h" #include "AliFlowEventSimpleMaker.h" #include "AliFlowAnalysisWithCumulants.h" #include "AliFlowCumuConstants.h" #include "AliFlowCommonConstants.h" #include "AliFlowCommonHistResults.h" #include "AliCumulantsFunctions.h" ClassImp(AliAnalysisTaskCumulants) //================================================================================================================ AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name): AliAnalysisTask(name,""), fESD(NULL), fAOD(NULL), fCA(NULL),//Cumulant Analysis (CA) object fEventMaker(NULL), fAnalysisType("ESD"), fCFManager1(NULL), fCFManager2(NULL), fListHistos(NULL) { //constructor cout<<"AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name)"< (GetInputData(0)); if (!tree) { Printf("ERROR: Could not read chain from input slot 0"); } else { //disable all branches and enable only the needed ones if (fAnalysisType == "MC") { // we want to process only MC tree->SetBranchStatus("*", kFALSE); AliESDInputHandler *esdH = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); if (!esdH) { Printf("ERROR: Could not get ESDInputHandler"); } else { fESD = esdH->GetEvent(); } } else if (fAnalysisType == "ESD" || fAnalysisType == "ESDMC0" || fAnalysisType == "ESDMC1" ) { tree->SetBranchStatus("*", kFALSE); tree->SetBranchStatus("Tracks.*", kTRUE); AliESDInputHandler *esdH = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); if (!esdH) { Printf("ERROR: Could not get ESDInputHandler"); } else fESD = esdH->GetEvent(); } else if (fAnalysisType == "AOD") { AliAODInputHandler *aodH = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); if (!aodH) { Printf("ERROR: Could not get AODInputHandler"); } else { fAOD = aodH->GetEvent(); } } else { Printf("Wrong analysis type: Only ESD, ESDMC0, ESDMC1, AOD and MC types are allowed!"); } } } //================================================================================================================ void AliAnalysisTaskCumulants::CreateOutputObjects() { //called at every worker node to initialize cout<<"AliAnalysisTaskCumulants::CreateOutputObjects()"<CreateOutputObjects(); if(fCA->GetHistList()) { fListHistos = fCA->GetHistList(); //fListHistos->Print(); } else { Printf("ERROR: Could not retrieve histogram list"); } //PostData(0,fListHistos); } //================================================================================================================ void AliAnalysisTaskCumulants::Exec(Option_t *) { //main loop (called for each event) if (fAnalysisType == "MC") { // Process MC truth, therefore we receive the AliAnalysisManager and ask it for the AliMCEventHandler // This handler can return the current MC event AliMCEventHandler* eventHandler = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); if (!eventHandler) { Printf("ERROR: Could not retrieve MC event handler"); return; } AliMCEvent* mcEvent = eventHandler->MCEvent(); if (!mcEvent) { Printf("ERROR: Could not retrieve MC event"); return; } Printf("MC particles: %d", mcEvent->GetNumberOfTracks()); fCFManager1->SetEventInfo(mcEvent); fCFManager2->SetEventInfo(mcEvent); //cumulant analysis AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent,fCFManager1,fCFManager2); fCA->Make(fEvent); delete fEvent; } else if (fAnalysisType == "ESD") { if (!fESD) { Printf("ERROR: fESD not available"); return; } Printf("There are %d tracks in this event", fESD->GetNumberOfTracks()); //cumulant analysis AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD); fCA->Make(fEvent); delete fEvent; } else if (fAnalysisType == "ESDMC0") { if (!fESD) { Printf("ERROR: fESD not available"); return; } Printf("There are %d tracks in this event", fESD->GetNumberOfTracks()); AliMCEventHandler* eventHandler = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); if (!eventHandler) { Printf("ERROR: Could not retrieve MC event handler"); return; } AliMCEvent* mcEvent = eventHandler->MCEvent(); if (!mcEvent) { Printf("ERROR: Could not retrieve MC event"); return; } fCFManager1->SetEventInfo(mcEvent); fCFManager2->SetEventInfo(mcEvent); //cumulant analysis AliFlowEventSimple* fEvent=NULL; if (fAnalysisType == "ESDMC0") { fEvent = fEventMaker->FillTracks(fESD, mcEvent, fCFManager1, fCFManager2, 0); //0 = kine from ESD, 1 = kine from MC } else if (fAnalysisType == "ESDMC1") { fEvent = fEventMaker->FillTracks(fESD, mcEvent, fCFManager1, fCFManager2, 1); //0 = kine from ESD, 1 = kine from MC } fCA->Make(fEvent); delete fEvent; //delete mcEvent; } else if (fAnalysisType == "AOD") { if (!fAOD) { Printf("ERROR: fAOD not available"); return; } Printf("There are %d tracks in this event", fAOD->GetNumberOfTracks()); // analysis //For the moment don't use CF //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD,fCFManager1,fCFManager2); AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD); fCA->Make(fEvent); delete fEvent; } PostData(0,fListHistos); } //================================================================================================================ void AliAnalysisTaskCumulants::Terminate(Option_t *) { //accessing the output list which contains the merged 2D and 3D profiles from all worker nodes fListHistos = (TList*)GetOutputData(0); //fListHistos->Print(); if(fListHistos) { //profiles with avarage values of generating functions for int. and diff. flow TProfile2D *intFlowGenFun = dynamic_cast(fListHistos->FindObject("fIntFlowGenFun")); //TProfile3D *diffFlowGenFunRe=dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunRe")); //TProfile3D *diffFlowGenFunIm=dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunIm")); TProfile2D *diffFlowGenFunRe0 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunRe0")); TProfile2D *diffFlowGenFunRe1 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunRe1")); TProfile2D *diffFlowGenFunRe2 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunRe2")); TProfile2D *diffFlowGenFunRe3 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunRe3")); TProfile2D *diffFlowGenFunRe4 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunRe4")); TProfile2D *diffFlowGenFunRe5 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunRe5")); TProfile2D *diffFlowGenFunRe6 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunRe6")); TProfile2D *diffFlowGenFunRe7 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunRe7")); TProfile2D *diffFlowGenFunIm0 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunIm0")); TProfile2D *diffFlowGenFunIm1 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunIm1")); TProfile2D *diffFlowGenFunIm2 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunIm2")); TProfile2D *diffFlowGenFunIm3 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunIm3")); TProfile2D *diffFlowGenFunIm4 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunIm4")); TProfile2D *diffFlowGenFunIm5 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunIm5")); TProfile2D *diffFlowGenFunIm6 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunIm6")); TProfile2D *diffFlowGenFunIm7 = dynamic_cast(fListHistos->FindObject("fDiffFlowGenFunIm7")); //histograms to store the final results TH1D *intFlowResults = dynamic_cast(fListHistos->FindObject("fIntFlowResults")); TH1D *diffFlowResults2 = dynamic_cast(fListHistos->FindObject("fDiffFlowResults2")); TH1D *diffFlowResults4 = dynamic_cast(fListHistos->FindObject("fDiffFlowResults4")); TH1D *diffFlowResults6 = dynamic_cast(fListHistos->FindObject("fDiffFlowResults6")); TH1D *diffFlowResults8 = dynamic_cast(fListHistos->FindObject("fDiffFlowResults8")); //profile with avarage selected multiplicity for int. flow TProfile *avMult = dynamic_cast(fListHistos->FindObject("fAvMultIntFlow")); //profile with avarage values of Q-vector components (1st bin: , 2nd bin: , 3rd bin: <(Q_x)^2>, 4th bin: <(Q_y)^2>) TProfile *QVectorComponents = dynamic_cast(fListHistos->FindObject("fQVectorComponents")); //q-distribution TH1D *qDist = dynamic_cast(fListHistos->FindObject("fQDist")); AliCumulantsFunctions finalResults(intFlowGenFun,NULL,NULL, intFlowResults,diffFlowResults2,diffFlowResults4,diffFlowResults6,diffFlowResults8,avMult,QVectorComponents,qDist,diffFlowGenFunRe0,diffFlowGenFunRe1,diffFlowGenFunRe2, diffFlowGenFunRe3,diffFlowGenFunRe4,diffFlowGenFunRe5,diffFlowGenFunRe6,diffFlowGenFunRe7,diffFlowGenFunIm0,diffFlowGenFunIm1, diffFlowGenFunIm2,diffFlowGenFunIm3,diffFlowGenFunIm4,diffFlowGenFunIm5,diffFlowGenFunIm6,diffFlowGenFunIm7); finalResults.Calculate(); } else { cout<<"histogram list pointer is empty"<