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