]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/EVCHAR/macros/AddTaskSPDdNdEta.C
UNICOR becomes part of FEMTOSCOPY
[u/mrichter/AliRoot.git] / PWGPP / EVCHAR / macros / AddTaskSPDdNdEta.C
1 //=============================================================================
2 //
3 // *** AddTaskSPDdNdEta.C ***
4 //
5 // This macro initialize a complete AnalysisTask object for SPD dNdEta analysis.
6 //
7 //=============================================================================
8
9 AliAnalysisTaskSPDdNdEta *AddTaskSPDdNdEta()
10 {
11 // Creates an analysis task and adds it to the analysis manager.
12   
13   // A. Get the pointer to the existing analysis manager via the static access method.
14   //==============================================================================
15   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
16   if (!mgr) {
17     Error("AddTaskSPDdNdEta", "No analysis manager to connect to.");
18     return NULL;
19   }  
20
21   // B. Check the analysis type using the event handlers connected to the analysis
22   //    manager. The availability of MC handler cann also be checked here.
23   //==============================================================================
24   if (!mgr->GetInputEventHandler()) {
25     ::Error("AddTaskSPDdNdEta", "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   AliAnalysisTaskSPDdNdEta *taskSPDdNdEta = new AliAnalysisTaskSPDdNdEta("TaskSPDdNdEta");
34   mgr->AddTask(taskSPDdNdEta);
35
36   // D. Configure the analysis task. Extra parameters can be used via optional
37   // arguments of the AddTaskXXX() function.
38   //===========================================================================
39   taskSPDdNdEta->SetReadMC(kTRUE); // MC
40 //  taskSPDdNdEta->SetppAnalysis(kTRUE); //pp analysis
41   taskSPDdNdEta->SetTrigger(1);  // 0 = notrigger, 1 = MB1 trigger
42   taskSPDdNdEta->SetEvtGen(kTRUE);  //to read Pythia data (kFALSE for Phojet)
43   
44   // E. Create ONLY the output containers for the data produced by the task.
45   // Get and connect other common input/output containers via the manager as below
46   //==============================================================================
47   TString outputfile = AliAnalysisManager::GetCommonFileName();  
48   outputfile += ":PWG2EVCHAR";
49
50   AliAnalysisDataContainer *cout_SPDdNdEta= mgr->CreateContainer("evcharlist", TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);  
51
52
53    mgr->ConnectInput(taskSPDdNdEta, 0, mgr->GetCommonInputContainer());
54    mgr->ConnectOutput(taskSPDdNdEta, 0, cout_SPDdNdEta);
55
56    // Return task pointer at the end
57    return taskSPDdNdEta;
58 }