DA rpms
[u/mrichter/AliRoot.git] / TOF / AddTaskTOFCalib.C
CommitLineData
4db98a6a 1//=============================================================================
2//
3// *** AddTaskTOFCalib.C ***
4//
5// This macro initialize a complete AnalysisTask object for TOF Calibration.
6//
7//=============================================================================
8
9AliTOFCalibTask *AddTaskTOFCalib()
10{
11 // A. Get the pointer to the existing analysis manager via the static access method.
12 //==============================================================================
13
14 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
15 if (!mgr) {
16 Error("AddTaskTOFCalib", "No analysis manager to connect to.");
17 return NULL;
18 }
19
20 // B. Check the analysis type using the event handlers connected to the analysis
21 // manager. The availability of MC handler cann also be checked here.
22 //==============================================================================
23
24 if (!mgr->GetInputEventHandler()) {
25 ::Error("AddTask", "This task requires an input event handler");
26 return NULL;
27 }
28 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
29
30 // C. Create the task, add it to manager.
31 //===========================================================================
32
33 AliTOFCalibTask *taskTOF = new AliTOFCalibTask("TOFCalibTask");
34 mgr->AddTask(taskTOF);
35
36 // D. Configure the analysis task. Extra parameters can be used via optional
37 // arguments of the AddTaskXXX() function.
38 //===========================================================================
39
40 // E. Create ONLY the output containers for the data produced by the task.
41 // Get and connect other common input/output containers via the manager as below
42 //==============================================================================
43 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("histoList", TList::Class(),
44 AliAnalysisManager::kOutputContainer,"outputHistos.root");
45 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("tofArray", TList::Class(),
46 AliAnalysisManager::kOutputContainer);
47
48 mgr->ConnectInput(taskTOF, 0, mgr->GetCommonInputContainer());
49 mgr->ConnectOutput(taskTOF, 1, coutput1);
50 mgr->ConnectOutput(taskTOF, 2, coutput2);
51
52 // Return task pointer at the end
53 return taskTOF;
54}