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