Updating macros for LEGO train
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / macros / AddTaskZDCPbPb.C
CommitLineData
db835285 1AliAnalysisTaskSE* AddTaskZDCPbPb(Bool_t applyPS = kFALSE,
2 Float_t centrlowlim = 0.,
3 Float_t centruplim = 100.,
f8bda64c 4 TString centrest = "V0M",
db835285 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 //===========================================================================
29 gROOT->LoadMacro("AliAnalysisTaskZDCPbPb.cxx++g");
30 AliAnalysisTaskZDCPbPb* task = new AliAnalysisTaskZDCPbPb("taskZDCPbPb");
31
32 if(inputDataType.CompareTo("ESD")==0){
33 task->SetInput(1);
34 printf(" AliAnalysisTaskZDCPbPb initialized for ESD analysis\n");
35 }
36 else if(inputDataType.CompareTo("AOD")==0){
37 task->SetInput(2);
38 printf(" AliAnalysisTaskZDCPbPb initialized for AOD analysis\n");
39 }
40 task->SetCentralityRange(centrlowlim, centruplim);
41 task->SetCentralityEstimator(centrest);
42
43 if(isMC==kTRUE) task->SetMCInput();
44
45 // apply physics selection
db835285 46 if(applyPS) task->SelectCollisionCandidates();
f8bda64c 47
48 mgr->AddTask(task);
49
50 TString outputFileName = AliAnalysisManager::GetCommonFileName();
f8bda64c 51
f8bda64c 52 AliAnalysisDataContainer *coutput = mgr->CreateContainer("ZDChistos", TList::Class(),
db835285 53 AliAnalysisManager::kOutputContainer,
54 Form("%s:%s", mgr->GetCommonFileName(), outfname));
f8bda64c 55
56 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
57 mgr->ConnectOutput (task, 1, coutput);
58
59 return task;
60}
61
62