]>
Commit | Line | Data |
---|---|---|
faa02a10 | 1 | AliAnalysisTaskSE* AddTaskZDCTree(Bool_t applyPS = kTRUE, |
2 | TString outfname = "ZDCpPb", | |
3 | Bool_t isMC = kFALSE) | |
4 | { | |
5 | ||
6 | // Get the pointer to the existing analysis manager via the static access method. | |
7 | //============================================================================== | |
8 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
9 | if(!mgr){ | |
10 | ::Error("AddTaskZDCPbPb", "No analysis manager to connect to."); | |
11 | return NULL; | |
12 | } | |
13 | ||
14 | AliVEventHandler *inputHandler = mgr->GetInputEventHandler(); | |
15 | ||
16 | // Check the analysis type using the event handlers connected to the analysis manager. | |
17 | //============================================================================== | |
18 | if(!inputHandler){ | |
19 | ::Error("AddTaskZDCPbPb", "This task requires an input event handler"); | |
20 | return NULL; | |
21 | } | |
22 | TString inputDataType = inputHandler->GetDataType(); // can be "ESD" or "AOD" | |
23 | ||
24 | // Configure analysis | |
25 | //=========================================================================== | |
26 | AliAnalysisTaskZDCTreeMaker* task = new AliAnalysisTaskZDCTreeMaker("taskZDC"); | |
27 | ||
28 | if(inputDataType.CompareTo("ESD")==0){ | |
29 | task->SetInput(1); | |
30 | //printf(" AliAnalysisTaskZDCTreeMaker initialized for ESD analysis\n"); | |
31 | // | |
32 | // apply physics selection | |
33 | if(applyPS) task->SelectCollisionCandidates(); | |
34 | } | |
35 | else if(inputDataType.CompareTo("AOD")==0){ | |
36 | task->SetInput(2); | |
37 | //printf(" AliAnalysisTaskZDCTreeMaker initialized for AOD analysis\n"); | |
38 | } | |
39 | ||
40 | if(isMC==kTRUE) task->SetMCInput(); | |
41 | ||
42 | mgr->AddTask(task); | |
43 | ||
44 | TString outputFileName = AliAnalysisManager::GetCommonFileName(); | |
45 | ||
46 | AliAnalysisDataContainer *coutput = mgr->CreateContainer(outfname.Data(), | |
47 | TList::Class(), | |
48 | AliAnalysisManager::kOutputContainer, | |
49 | Form("%s:ZDCHistos", mgr->GetCommonFileName())); | |
50 | ||
51 | mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer()); | |
52 | mgr->ConnectOutput (task, 1, coutput); | |
53 | ||
54 | return task; | |
55 | } | |
56 | ||
57 |