]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/SPECTRA/PiKaPr/TOF/pp7/AddTOFTask.C
charged hadrons up to 10 GeV/c
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / PiKaPr / TOF / pp7 / AddTOFTask.C
CommitLineData
414be7d1 1TOFSpectrappAnalysis* AddTOFTask()
2{
3 //pp settings
4 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
5 if (!mgr)
6 {
7 ::Error("AddTOFTask", "No analysis manager to connect to.");
8 return NULL;
9 }
10 // Check the analysis type using the event handlers connected to the analysis manager.
11 //==============================================================================
12 if (!mgr->GetInputEventHandler())
13 {
14 ::Error("AddTOFTask", "This task requires an input event handler");
15 return NULL;
16 }
17
18 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
19 if(type.Contains("AOD"))
20 {
21 ::Error("AddTOFTask", "This task requires to run on ESD");
22 return NULL;
23 }
24
25 //TString outputFileName = AliAnalysisManager::GetCommonFileName();
26 //outputFileName += ":PWG2SpectraTOF";
27
28 TOFSpectrappAnalysis* task = new TOFSpectrappAnalysis("TOFSpectrappAnalysis");
29 mgr->AddTask(task);
30
31 //Attach input
32 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
33 mgr->ConnectInput(task,0,cinput);
34
35 AliAnalysisDataContainer *cOutputT1= mgr->CreateContainer("cOutputT1",TTree::Class(), AliAnalysisManager::kOutputContainer, "treeTOF.root");
36 mgr->ConnectOutput(task, 1, cOutputT1);
37
38 AliAnalysisDataContainer *cOutputT2= mgr->CreateContainer("cOutputT2",TH1D::Class(), AliAnalysisManager::kOutputContainer, "NumEv.root");
39 mgr->ConnectOutput(task, 2, cOutputT2);
40
41 return task;
42
43}
44