]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/macros/AddTaskGammaHadronCorr.C
Added like-sign 3Prong
[u/mrichter/AliRoot.git] / ANALYSIS / macros / AddTaskGammaHadronCorr.C
1 AliAnalysisTaskParticleCorrelation *AddTaskGammaHadronCorr()
2 {
3 // Creates a gamma-hadron correlations task and adds it to the analysis manager.
4
5    // Get the pointer to the existing analysis manager via the static access method.
6    //==============================================================================
7    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
8    if (!mgr) {
9       ::Error("AddTaskGammaHadronCorr", "No analysis manager to connect to.");
10       return NULL;
11    }   
12
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.");
19       return NULL;
20    }   
21    // Check if AOD output handler exist.
22    AliAODHandler *aod_h = (AliAODHandler*)mgr->GetOutputEventHandler();
23    if (!aod_h) {
24       ::Error("AddTaskGammaHadronCorr", "This task needs the manager to have an AOD output handler.");
25       return NULL;
26    }   
27    
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");
36    
37    // Connect to data containers
38    mgr->ConnectInput  (taskpartcorr,  0, mgr->GetCommonInputContainer());
39    mgr->ConnectOutput (taskpartcorr,  1, cout_partcorr );
40    return taskpartcorr;
41 }
42