]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/FEMTOSCOPY/macros/Train/AddTaskFemtoAzimtuhalHBT.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / macros / Train / AddTaskFemtoAzimtuhalHBT.C
CommitLineData
49921cd6 1//=============================================================================
2//
3// *** AddTaskFemtoAzimtuhalHBT.C ***
4//
5// This macro initialize a complete AnalysisTask object for femtoscopy.
6//
7//=============================================================================
8
9AliAnalysisTaskFemto *AddTaskFemtoAzimtuhalHBT(TString configMacroName, const char *containerName="femtolist", const char *configMacroParameters="" )
10{
11// Creates a proton 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("AddTaskFemtoAzimtuhalHBT", "No analysis manager to connect to.");
18 return NULL;
19 }
20 TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
21 Bool_t useEtaGap=kFALSE;
22 Float_t etaGap=0.;
23 Bool_t posTPCAOD=kFALSE;
24 TString containername = "EPStat_ttd";
25
26 // B. Check the analysis type using the event handlers connected to the analysis
27 // manager. The availability of MC handler cann also be checked here.
28 //==============================================================================
29 if (!mgr->GetInputEventHandler()) {
30 ::Error("AddTaskFemtoAzimtuhalHBT", "This task requires an input event handler");
31 return NULL;
32 }
33 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
e8b68b98 34 // cout << "Found " <<type << " event handler" << endl;
49921cd6 35
36 //gROOT->LoadMacro("AliEPSelectionTask3.cxx+g");
37 //gROOT->LoadMacro("AddTaskEventplane.C");
38 //AliEPSelectionTask3* epsel = AddTaskEventplane();
39 AliEPSelectionTask *eventplaneTask = new AliEPSelectionTask("EventplaneSelection4");
40 eventplaneTask->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kSemiCentral | AliVEvent::kCentral);
41 if (inputDataType == "AOD"){
42 eventplaneTask->SetInput("AOD");
43 }
44 eventplaneTask->SetTrackType("TPC");
45 eventplaneTask->SetUsePtWeight();
46 eventplaneTask->SetUsePhiWeight();
47 eventplaneTask->SetSaveTrackContribution();
48 if(useEtaGap){
49 eventplaneTask->SetSubeventsSplitMethod(AliEPSelectionTask3::kEta);
50 eventplaneTask->SetEtaGap(etaGap);
51 }
52 if(posTPCAOD){
53 eventplaneTask->SetPersonalAODtrackCuts(128,0.,0.8,0.15,20.);
54 eventplaneTask->SetSubeventsSplitMethod(AliEPSelectionTask3::kRandom);
55 }
56
57
58 mgr->AddTask(eventplaneTask);
59
60
61
62
63 // C. Create the task, add it to manager.
64 //===========================================================================
65// gSystem->SetIncludePath("-I$ROOTSYS/include -I./PWG2AOD/AOD -I./PWG2femtoscopy/FEMTOSCOPY/AliFemto -I./PWG2femtoscopyUser/FEMTOSCOPY/AliFemtoUser -I$ALICE_ROOT/include");
66
67 if (TProofMgr::GetListOfManagers()->GetEntries()) {
68// if (dynamic_cast<TProofLite *> gProof) {
69// char *macrocommand[10000];
70// sprintf(macrocommand, ".L %s", configMacroName);
71// gProof->Exec(macrocommand);
72// }
73// else
74 gProof->Load(configMacroName);
75 }
76 // gROOT->LoadMacro("ConfigFemtoAnalysis.C++");
77
02d24c7e 78 AliAnalysisTaskFemto *taskfemto = new AliAnalysisTaskFemto("TaskFemto","$ALICE_ROOT/"+configMacroName,configMacroParameters,kFALSE);
49921cd6 79 //taskfemto->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral) ;
80
81 mgr->AddTask(taskfemto);
82
83 // D. Configure the analysis task. Extra parameters can be used via optional
84 // arguments of the AddTaskXXX() function.
85 //===========================================================================
86
87 // E. Create ONLY the output containers for the data produced by the task.
88 // Get and connect other common input/output containers via the manager as below
89 //==============================================================================
90 TString outputfile = AliAnalysisManager::GetCommonFileName();
91 // outputfile += ":PWG2FEMTO";
92 AliAnalysisDataContainer *cout_femto = mgr->CreateContainer(containerName, TList::Class(),
93 AliAnalysisManager::kOutputContainer,outputfile);
94
95
96 mgr->ConnectInput(taskfemto, 0, mgr->GetCommonInputContainer());
97 mgr->ConnectOutput(taskfemto, 0, cout_femto);
02d24c7e 98 AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
99 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(containername, TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);
100
101 mgr->ConnectInput(eventplaneTask, 0, mgr->GetCommonInputContainer());
102 mgr->ConnectOutput(eventplaneTask,1,coutput1);
49921cd6 103
104 // Return task pointer at the end
105 return taskfemto;
106}