Update PR task: drathee
[u/mrichter/AliRoot.git] / PWGCF / EBYE / PIDFluctuation / macros / AddEbyEPidRatioTask.C
CommitLineData
0a28d543 1/* *************************************************************************
2 * AliEbyE Analysis for Particle Ratio Fluctuation *
3 * Deepika Rathee | Satyajit Jena *
4 * drathee@cern.ch | sjena@cern.ch *
5 * Date: Wed Jul 9 18:38:30 CEST 2014 *
6 * New approch to find particle ratio to reduce memory *
7 * (Test Only) *
8 ***************************************************************************/
9
6ce4ad92 10AliAnalysisTask *AddEbyEPidRatioTask(const Char_t *name = "NuDyn", // 0
11 Bool_t isModeDist = 1, // 1
12 Bool_t isModeEff = 0, // 2
13 Bool_t isModeDCA = 0, // 3
14 Bool_t isModeQA = 0, // 4
15 Int_t isRatio = 3, // 5
16 Bool_t isModeAOD = 0, // 6
17 Bool_t isSetExt = 0, // 7
18 Int_t aodFilterBit = 1024, // 8
19 Float_t gEta = 0.8, // 9
20 Int_t modeCuts = 0, // 10
21 Int_t modePID =-1, // 11
22 Float_t gMinPt = 0.3, // 12
23 Float_t gMaxPt = 2.5, // 13
24 Float_t gMinPtForTof = 0.21, // 14
25 Float_t gMaxPtForTPClow = 0.69, // 15
26 Float_t gMinPtEff = 0.3, // 16
27 Float_t gMaxPtEff = 2.5, // 17
28 Float_t gSigmaITS = 4.0, // 18
29 Float_t gSigmaTOF = 4.0, // 19
30 Float_t gSigmaTPC = 4.0, // 20
31 Float_t gSigmaTPClow = 3.0) { // 21
0a28d543 32
33 TString sName(name);
34
0a28d543 35 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
36 if (!mgr) {
37 Error("AddTaskNetParticle", "No analysis manager found.");
38 return NULL;
39 }
40
41 Bool_t isMC = (mgr->GetMCtruthEventHandler() != NULL);
42 if (isMC)
43 Info("AddTaskNetParticle", "This task has MC.");
44
45 AliEbyEPidRatioTask *task = new AliEbyEPidRatioTask("EbyEPidRatio");
46 if (!task) {
47 Error("EbyEPidRatio", "Task could not be created.");
48 return NULL;
49 }
50
51 if (isMC)
52 task->SetIsMC();
53 if (isModeEff)
54 task->SetModeEffCreation(1); // => 1 = on | 0 = off (default)
55 if (isModeDCA)
56 task->SetModeDCACreation(1); // => 1 = on | 0 = off (default)
57 if (isModeDist)
58 task->SetModeDistCreation(1); // => 1 = on | 0 = off (default)
59 if (isModeAOD) {
60 task->SetIsAOD(1); // => 1 = AOD | 0 = ESD (default)
61 task->SetTrackFilterBit(aodFilterBit);
62 }
63 if (isModeQA)
64 task->SetModeQACreation(1); // => 1 = on | 0 = off (default)
1648d22e 65
66 task->SetIsRatio(isRatio);
f7ea34d2 67
0a28d543 68 Float_t minPt, maxPt, minPtEff, maxPtEff, minPtForTOF;
69 Float_t nSigmaITS, nSigmaTPC, nSigmaTPClow, nSigmaTOF, maxPtForTPClow;
9b5bc5a1 70 Float_t etaMax, etaMaxEff, maxRap;
0a28d543 71 Int_t pidStrategy;
72
73 minPtForTOF = 0.69;
74 maxPtForTPClow = 0.69;
75 minPt = 0.5;
76 maxPt = 2.0;
77 minPtEff = 0.3;
78 maxPtEff = 2.5;
79
9b5bc5a1 80 maxRap = 0.5;
0a28d543 81 etaMax = 0.8;
9b5bc5a1 82
0a28d543 83 etaMaxEff = 0.8;
84 nSigmaITS = 4.0;
85 nSigmaTPC = 4.0;
86 nSigmaTPClow = 3.0;
87 nSigmaTOF = 4.0;
f7ea34d2 88
0a28d543 89 if (isSetExt) {
90 minPt = gMinPt;
91 maxPt = gMaxPt;
92 minPtForTOF = gMinPtForTof;
93 maxPtForTPClow = gMaxPtForTPClow;
94 minPtEff = gMinPtEff;
95 maxPtEff = gMaxPtEff;
6ce4ad92 96
97 etaMax = gEta;
98
0a28d543 99 nSigmaITS = gSigmaITS;
100 nSigmaTPC = gSigmaTPC;
101 nSigmaTPClow = gSigmaTPClow;
102 nSigmaTOF = gSigmaTOF;
103 }
104
6ce4ad92 105 if (modePID == -1) { // default
0a28d543 106 pidStrategy = 7; // 7: ITS + TPC + TOF (using minPtForTOF)
107 if (modeCuts == 1)
108 pidStrategy = 5; // 5: TPC + TOF (using minPtForTOF)
109 }
110 else
111 pidStrategy = modePID;
112
113 AliEbyEPidRatioHelper *helper = new AliEbyEPidRatioHelper;
114 if (!helper) {
115 Error("AddTaskNetParticle", "Helper could not be created.");
116 delete task;
117 return NULL;
118 }
119
120
121 task->SetESDTrackCutMode(modeCuts); // => 0 = normal | 1 = LF
122 task->SetEtaMax(etaMax); // eta cut
123 task->SetEtaMaxEff(etaMaxEff); // eta cut for efficiency
124 task->SetPtRange(minPt, maxPt); // pt cut range for the analysis
125 task->SetPtRangeEff(minPtEff, maxPtEff); // pt cut range for the correction / efficiency / contamination creation
6ce4ad92 126
0a28d543 127 helper->SetVertexZMax(10.);
bdb6c35e 128 helper->SetCentralityBinMax(11);
9b5bc5a1 129 helper->SetRapidityMax(maxRap);
0a28d543 130 helper->SetMinTrackLengthMC(70.);
6ce4ad92 131 helper->SetNSigmaMaxCdd(0.); // 3. || ->> Turn off sigmaDCA cuts for now
132 helper->SetNSigmaMaxCzz(0.); // 3. || ->> Turn off sigmaDCA cuts for now
133 helper->SetPhiRange(0., 3.88); // Only used if requested in task - default is TwoPi
0a28d543 134 helper->SetPIDStrategy(pidStrategy);
135 helper->SetNSigmaMaxITS(nSigmaITS);
136 helper->SetNSigmaMaxTPC(nSigmaTPC);
137 helper->SetNSigmaMaxTPClow(nSigmaTPClow);
138 helper->SetNSigmaMaxTOF(nSigmaTOF);
139 helper->SetMinPtForTOFRequired(minPtForTOF);
140 helper->SetMaxPtForTPClow(maxPtForTPClow);
f7ea34d2 141
0a28d543 142 task->SetNetParticleHelper(helper);
143 mgr->AddTask(task);
144
145 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
146 TString outputFileName = Form("%s:%s", AliAnalysisManager::GetCommonFileName(), name);
147 TString outputQAFileName = Form("%s:%s", AliAnalysisManager::GetCommonFileName(), name);
148
149 AliAnalysisDataContainer *coutput = mgr->CreateContainer(name, TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
150 AliAnalysisDataContainer *coutputEff = mgr->CreateContainer(Form("%s_eff", name), TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
151 AliAnalysisDataContainer *coutputCont = mgr->CreateContainer(Form("%s_cont", name), TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
152 AliAnalysisDataContainer *coutputDca = mgr->CreateContainer(Form("%s_dca", name), TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
153
154 AliAnalysisDataContainer *coutputQA = mgr->CreateContainer(Form("%sQA", name), TList::Class(), AliAnalysisManager::kOutputContainer, outputQAFileName);
155
156 mgr->ConnectInput (task, 0, cinput );
157 mgr->ConnectOutput (task, 1, coutput);
158 mgr->ConnectOutput (task, 2, coutputEff);
159 mgr->ConnectOutput (task, 3, coutputCont);
160 mgr->ConnectOutput (task, 4, coutputDca);
161 mgr->ConnectOutput (task, 5, coutputQA);
162
163 return task;
164}