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