]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/STRANGENESS/Correlations/macros/AddTaskV0ChCorrelations.C
Change the name of the output file to default one.
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / Correlations / macros / AddTaskV0ChCorrelations.C
1 // runV0ChCorrelations.C
2 //
3 // AddTask for AliAnalysisTaskV0ChCorrelations task
4 //
5 AliAnalysisTaskV0ChCorrelations *AddTaskV0ChCorrelations(const Bool_t bMCtruth=kTRUE,
6                                                                                                                  Float_t DcaDToPV = 0.5,
7                                                                                                                  Float_t DcaV0D = 0.1
8                                                                                                                 )
9 {
10   // Creates a V0Ch correlations analysis task and adds it to the analysis manager.
11
12   // Get the pointer to the existing analysis manager via the static access method.
13   //==============================================================================
14
15     AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
16     if (!mgr) {
17       ::Error("AddTaskV0ChCorrelations", "No analysis manager to connect to.");
18       return NULL;
19     }
20
21     // mc event handlerrunEx01.C
22     /*
23         if(bMCtruth) {
24                 cout << "I am here too! " << endl;
25         AliAODMCEventHandler* mchandler = new AliAODMCEventHandler();
26         // Not reading track references
27         mchandler->SetReadTR(kFALSE);
28         mgr->SetMCtruthEventHandler(mchandler);
29     }   
30 */
31         // create task
32     AliAnalysisTaskV0ChCorrelations* task = new AliAnalysisTaskV0ChCorrelations("V0ChCorrelations_task");
33     task->SetAnalysisMC(bMCtruth);
34         task->SetDcaDToPV(DcaDToPV);
35         task->SetDcaV0D(DcaV0D);
36     mgr->AddTask(task);
37     
38     // Create ONLY the output containers for the data produced by the task.
39     // Get and connect other common input/output containers via the manager as below
40     //==============================================================================
41     TString outputFileName = AliAnalysisManager::GetCommonFileName();
42     //outputFileName = "list.grid.v0ch.root";
43
44     // create containers for input/output
45     AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
46     AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("coutput1", TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
47         
48     // connect input/output
49     mgr->ConnectInput(task, 0, cinput);
50     mgr->ConnectOutput(task, 1, coutput1);
51         
52     // Return task pointer at the end
53     return task;
54 }
55