end-of-line normalization
[u/mrichter/AliRoot.git] / PWGCF / EBYE / macros / AddTaskBalanceFunctionInpp.C
CommitLineData
7fac8669 1//_________________________________________________________//
2AliAnalysisTaskBF *AddTaskBalanceFunctionInpp(Double_t vertexZ=10.,
3 Double_t DCAxy=2.4,
4 Double_t DCAz=3.2,
5 Double_t ptMin=0.3,
6 Double_t ptMax=1.5,
7 Double_t etaMin=-0.8,
8 Double_t etaMax=0.8,
9 TString fileNameBase="AnalysisResults") {
10 // Creates a balance function analysis task and adds it to the analysis manager.
11 // Get the pointer to the existing analysis manager via the static access method.
12 TString outputFileName(fileNameBase);
13 outputFileName.Append(".root");
14
15 //===========================================================================
16 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
17 if (!mgr) {
18 ::Error("AddTaskBF", "No analysis manager to connect to.");
19 return NULL;
20 }
21
22 // Check the analysis type using the event handlers connected to the analysis manager.
23 //===========================================================================
24 if (!mgr->GetInputEventHandler()) {
25 ::Error("AddTaskBF", "This task requires an input event handler");
26 return NULL;
27 }
28 TString analysisType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
29 gROOT->LoadMacro("./configBalanceFunctionAnalysis.C");
30 AliBalance *bf = 0; // Balance Function object
31 AliBalance *bfs = 0; // shuffled Balance function object
32
33 if (analysisType=="ESD"){
34 bf = GetBalanceFunctionObject("ESD");
35 bfs = GetBalanceFunctionObject("ESD",kTRUE);
36 }
37 else if (analysisType=="AOD"){
38 bf = GetBalanceFunctionObject("AOD");
39 bfs = GetBalanceFunctionObject("AOD",kTRUE);
40 }
41 else{
42 bf = GetBalanceFunctionObject("MC");
43 bfs = GetBalanceFunctionObject("MC",kTRUE);
44 }
45
46 // Create the task, add it to manager and configure it.
47 //===========================================================================
48 AliAnalysisTaskBF *taskBF = new AliAnalysisTaskBF("TaskBF");
49 taskBF->SetAnalysisObject(bf);
50 taskBF->SetShufflingObject(bfs);
51 if(analysisType == "ESD") {
52 AliESDtrackCuts *trackCuts = GetTrackCutsObject();
53 taskBF->SetAnalysisCutObject(trackCuts);
54
55 // offline trigger selection (AliVEvent.h)
56 // taskBF->UseOfflineTrigger(); // NOT used (selection is done with the AliAnalysisTaskSE::SelectCollisionCandidates())
57 // with this only selected events are analyzed (first 2 bins in event QA histogram are the same))
58 taskBF->SelectCollisionCandidates(AliVEvent::kMB);
59 }
60 else if(analysisType == "AOD") {
61 // pt and eta cut (pt_min, pt_max, eta_min, eta_max)
62 taskBF->SetAODtrackCutBit(128);
63 taskBF->SetKinematicsCutsAOD(ptMin,ptMax,etaMin,etaMax);
64 taskBF->SetExtraDCACutsAOD(DCAxy,DCAz);
65 }
66
67 // vertex cut (x,y,z)
68 taskBF->SetVertexDiamond(.3,.3,vertexZ);
69
70 //bf->PrintAnalysisSettings();
71 mgr->AddTask(taskBF);
72
73 // Create ONLY the output containers for the data produced by the task.
74 // Get and connect other common input/output containers via the manager as below
75 //======================================================================
76 AliAnalysisDataContainer *coutQA = mgr->CreateContainer("listQA", TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
77 AliAnalysisDataContainer *coutBF = mgr->CreateContainer("listBF", TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
78 AliAnalysisDataContainer *coutBFS= mgr->CreateContainer("listBFshuffled", TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
79 mgr->ConnectInput(taskBF, 0, mgr->GetCommonInputContainer());
80 mgr->ConnectOutput(taskBF, 1, coutQA);
81 mgr->ConnectOutput(taskBF, 2, coutBF);
82 mgr->ConnectOutput(taskBF, 3, coutBFS);
83
84 return taskBF;
85}