]>
Commit | Line | Data |
---|---|---|
754d059d | 1 | AliAnalysisTaskBF *AddTaskBalanceFunction() { |
9d1f0df5 | 2 | // Creates a proton analysis task and adds it to the analysis manager. |
3 | // Get the pointer to the existing analysis manager via the static access method. | |
4 | //============================================================================== | |
5 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
6 | if (!mgr) { | |
7 | ::Error("AddTaskProtons", "No analysis manager to connect to."); | |
8 | return NULL; | |
9 | } | |
10 | ||
11 | // Check the analysis type using the event handlers connected to the analysis manager. | |
12 | //============================================================================== | |
13 | if (!mgr->GetInputEventHandler()) { | |
14 | ::Error("AddTaskBalanceFunction", "This task requires an input event handler"); | |
15 | return NULL; | |
16 | } | |
17 | TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" | |
a022cbd0 | 18 | gROOT->LoadMacro("$ALICE_ROOT/PWGCF/EBYE/macros/configBalanceFunctionAnalysis.C"); |
9d1f0df5 | 19 | AliBalance *bf = 0; |
20 | if (type=="ESD") bf = GetBalanceFunctionObject("ESD"); | |
21 | else if (type=="AOD") bf = GetBalanceFunctionObject("AOD"); | |
22 | else bf = GetBalanceFunctionObject("MC"); | |
23 | ||
24 | // Create the task, add it to manager and configure it. | |
25 | //=========================================================================== | |
26 | AliAnalysisTaskBF *taskBF = new AliAnalysisTaskBF("TaskBF"); | |
27 | mgr->AddTask(taskBF); | |
28 | taskBF->SetAnalysisObject(bf); | |
7f94638c | 29 | taskBF->SetVertexDiamond(0.3,0.3,10.); |
9d1f0df5 | 30 | |
5115b492 | 31 | if (type=="ESD") { |
32 | AliESDtrackCuts *trackCuts = GetTrackCutsObject(); | |
33 | taskBF->SetAnalysisCutObject(trackCuts); | |
34 | } | |
35 | ||
9d1f0df5 | 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 | //============================================================================== | |
a73b5c46 | 39 | TString outputFileName = AliAnalysisManager::GetCommonFileName(); |
a022cbd0 | 40 | outputFileName += ":PWGCFEbyE.outputBalanceFunctionAnalysis.root"; |
2cd42194 | 41 | AliAnalysisDataContainer *coutBF = mgr->CreateContainer("bfOutput", AliBalance::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data()); |
42 | AliAnalysisDataContainer *coutQA = mgr->CreateContainer("listQA", TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data()); | |
9d1f0df5 | 43 | mgr->ConnectInput(taskBF, 0, mgr->GetCommonInputContainer()); |
2cd42194 | 44 | mgr->ConnectOutput(taskBF, 1, coutBF); |
45 | mgr->ConnectOutput(taskBF, 2, coutQA); | |
9d1f0df5 | 46 | |
47 | // Return task pointer at the end | |
48 | return taskBF; | |
49 | } |