1 AliAnalysisTaskParticleCorrelation *AddTaskGammaHadronCorr()
3 // Creates a gamma-hadron correlations task and adds it to the analysis manager.
5 // Get the pointer to the existing analysis manager via the static access method.
6 //==============================================================================
7 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
9 ::Error("AddTaskGammaHadronCorr", "No analysis manager to connect to.");
13 // This task requires an ESD input handler and an AOD output handler.
14 // Check this using the analysis manager.
15 //===============================================================================
16 TString type = mgr->GetInputEventHandler()->GetDataType();
17 if (!type.Contains("ESD")) {
18 ::Error("AddTaskGammaHadronCorr", "This task needs the manager to have an ESD input handler.");
21 // Check if AOD output handler exist.
22 AliAODHandler *aod_h = (AliAODHandler*)mgr->GetOutputEventHandler();
24 ::Error("AddTaskGammaHadronCorr", "This task needs the manager to have an AOD output handler.");
28 // Create the task, add it to the manager and configure it.
29 //===========================================================================
30 AliAnalysisTaskParticleCorrelation * taskpartcorr = new AliAnalysisTaskParticleCorrelation ("ParticleCorrelations");
31 mgr->AddTask(taskpartcorr);
32 taskpartcorr->SetConfigFileName("ConfigAnalysisGammaHadronCorrelation");
33 // Output histograms list for particle correlation analysis
34 AliAnalysisDataContainer *cout_partcorr = mgr->CreateContainer("partcorrhist", TList::Class(),
35 AliAnalysisManager::kOutputContainer, "partcorrhist.root");
37 // Connect to data containers
38 mgr->ConnectInput (taskpartcorr, 0, mgr->GetCommonInputContainer());
39 mgr->ConnectOutput (taskpartcorr, 1, cout_partcorr );