]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/macros/AddTaskDiJets.C
end-of-line normalization
[u/mrichter/AliRoot.git] / PWGJE / macros / AddTaskDiJets.C
1 AliAnalysisTaskDiJets *AddTaskDiJets(Char_t *jb="jets")
2 {
3 // Creates a dijet task, configures it 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("AddTaskDiJets", "No analysis manager to connect to.");
10       return NULL;
11    }
12
13    // Check the analysis type using the event handlers connected to the analysis manager.
14    //==============================================================================
15    if (!mgr->GetInputEventHandler()) {
16       ::Error("AddTaskDiJets", "This task requires an input event handler");
17       return NULL;
18    }
19
20    // Create the task and configure it.
21    //===========================================================================
22
23    AliAnalysisTaskDiJets *dijetana = new AliAnalysisTaskDiJets(Form("DiJetAnalysis_%s",jb));
24    dijetana->SetDebugLevel(0);
25 //   dijetana->SetFillAOD(kTRUE);
26    dijetana->SetJetBranch(jb);
27    mgr->AddTask(dijetana);
28    
29    TString jbOut(jb);
30    jbOut = jbOut(4,jbOut.Sizeof());
31    jbOut.ToLower();
32
33    AliAnalysisDataContainer *cout_dijet = mgr->CreateContainer(Form("dijets_%s",jbOut.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,
34      Form("%s:PWG4_DiJets_%s",AliAnalysisManager::GetCommonFileName(),jbOut.Data()));
35
36    // Create ONLY the output containers for the data produced by the task.
37    // Get and connect other common input/output containers via the manager as below
38    //==============================================================================
39    mgr->ConnectInput  (dijetana, 0, mgr->GetCommonInputContainer());
40    mgr->ConnectOutput (dijetana, 0, mgr->GetCommonOutputContainer());
41    mgr->ConnectOutput (dijetana, 1, cout_dijet);
42
43    return dijetana;
44 }