]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/macros/AddTaskZDCpAcalib.C
Train corrections: verbose mode + modification of AddTask
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / macros / AddTaskZDCpAcalib.C
1 AliAnalysisTaskSE* AddTaskZDCpAcalib(Bool_t  applyPS = kTRUE,
2                                   TString outfname = "ZDCpAcalib",
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    AliAnalysisTaskZDCpAcalib* task = new AliAnalysisTaskZDCpAcalib("taskZDCpA");
27
28    if(inputDataType.CompareTo("ESD")==0){
29       task->SetInput("ESD");
30       //
31       // apply physics selection
32       if(applyPS) task->SelectCollisionCandidates();
33    }
34    else if(inputDataType.CompareTo("AOD")==0){
35       task->SetInput("AOD");
36       //printf("  AliAnalysisTaskZDCpAcalib initialized for AOD analysis\n");
37    }
38    
39    if(isMC==kTRUE) task->SetMCInput();
40
41    mgr->AddTask(task);
42
43    TString outputFileName = AliAnalysisManager::GetCommonFileName();
44    
45    AliAnalysisDataContainer *coutput  = mgr->CreateContainer(outfname.Data(), 
46                                         TList::Class(),
47                                         AliAnalysisManager::kOutputContainer,   
48                                         Form("%s:ZDCtree", mgr->GetCommonFileName()));
49
50    mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
51    mgr->ConnectOutput (task, 1, coutput);
52
53    return task;   
54 }
55
56