Updated macros for Grid/AAF + new macros for trains
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / macros / AddTaskCheckPerformanceCascadePbPb.C
1 AliAnalysisTaskCheckPerformanceCascadePbPb *AddTaskCheckPerformanceCascadePbPb( Float_t  centrlowlim         = 0.,
2                                                                                 Float_t  centruplim          = 90.,
3                                                                                 TString  centrest            = "V0M",
4                                                                                 Float_t  vtxlim              = 10.,
5                                                                                 Bool_t   kextrasel           = kFALSE,
6                                                                                 Bool_t   kacccut             = kFALSE,
7                                                                                 Bool_t   krelaunchvertexers  = kFALSE,
8                                                                                 TString  anatype             = "AOD")
9 {
10 // Creates, configures and attaches to the train a cascades check task.
11    // Get the pointer to the existing analysis manager via the static access method.
12    //==============================================================================
13    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
14    if (!mgr) {
15       ::Error("AddTaskCheckPerformanceCascade", "No analysis manager to connect to.");
16       return NULL;
17    }   
18
19    // Check the analysis type using the event handlers connected to the analysis manager.
20    //==============================================================================
21    if (!mgr->GetInputEventHandler()) {
22       ::Error("AddTaskCheckPerformanceCascade", "This task requires an input event handler");
23       return NULL;
24    }   
25    TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
26
27    // Create and configure the task
28         AliAnalysisTaskCheckPerformanceCascadePbPb *taskCheckPerfCascadePbPb = new AliAnalysisTaskCheckPerformanceCascadePbPb("TaskCheckPerfCascadePbPb");
29
30    taskCheckPerfCascadePbPb->SetAnalysisType                (anatype);
31    taskCheckPerfCascadePbPb-> SetRelaunchV0CascVertexers    (krelaunchvertexers);     
32    taskCheckPerfCascadePbPb-> SetQualityCutZprimVtxPos      (kTRUE);
33    taskCheckPerfCascadePbPb-> SetRejectEventPileUp          (kFALSE);
34    taskCheckPerfCascadePbPb-> SetQualityCutNoTPConlyPrimVtx (kTRUE);
35    taskCheckPerfCascadePbPb-> SetQualityCutTPCrefit         (kTRUE);
36    taskCheckPerfCascadePbPb-> SetQualityCut80TPCcls         (kTRUE);
37    taskCheckPerfCascadePbPb-> SetExtraSelections            (kextrasel);
38    taskCheckPerfCascadePbPb-> SetApplyAccCut                (kacccut);
39    taskCheckPerfCascadePbPb-> SetCentralityLowLim           (centrlowlim);       // setting centrality selection vriables
40    taskCheckPerfCascadePbPb-> SetCentralityUpLim            (centruplim);
41    taskCheckPerfCascadePbPb-> SetCentralityEst              (centrest);
42    taskCheckPerfCascadePbPb-> SetVertexRange                (vtxlim);
43    
44    mgr->AddTask(taskCheckPerfCascadePbPb);
45
46    // Create ONLY the output containers for the data produced by the task.
47    // Get and connect other common input/output containers via the manager as below
48    //==============================================================================
49
50    // User file name (if need be)
51
52    TString outputFileName = AliAnalysisManager::GetCommonFileName();
53    outputFileName += ":PWGLFCheckPerformanceCascadePbPb";
54    if (mgr->GetMCtruthEventHandler()) outputFileName += "_MC";
55    
56    Printf("AddTaskCheckPerfCascadePbPb - Set OutputFileName : \n %s\n", outputFileName.Data() );
57    
58    AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clistCascMC",
59                                                              TList::Class(),
60                                                              AliAnalysisManager::kOutputContainer,
61                                                              outputFileName );
62
63    mgr->ConnectInput( taskCheckPerfCascadePbPb, 0, mgr->GetCommonInputContainer());
64    mgr->ConnectOutput(taskCheckPerfCascadePbPb, 1, coutput1);
65    
66    return taskCheckPerfCascadePbPb;
67 }