TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvNeutralMesonPiPlPiMiPiZero_CaloMode_pPb.C
CommitLineData
2c75809c 1void AddTask_GammaConvNeutralMesonPiPlPiMiPiZero_CaloMode_pPb(
cb287740 2 Int_t trainConfig = 1,
3 Bool_t isMC = kFALSE, //run MC
4 Bool_t enableQAMesonTask = kTRUE, //enable QA in AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero
5 TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
6 Bool_t doWeighting = kFALSE, //enable Weighting
7 TString generatorName = "HIJING",
8 TString cutnumberAODBranch = "0000000060084001001500000"
9 ) {
10
11 // ================= Load Librariers =================================
12 gSystem->Load("libCore.so");
13 gSystem->Load("libTree.so");
14 gSystem->Load("libGeom.so");
15 gSystem->Load("libVMC.so");
16 gSystem->Load("libPhysics.so");
17 gSystem->Load("libMinuit");
18 gSystem->Load("libSTEERBase");
19 gSystem->Load("libESD");
20 gSystem->Load("libAOD");
21 gSystem->Load("libANALYSIS");
22 gSystem->Load("libANALYSISalice");
cb287740 23 gSystem->Load("libCDB.so");
24 gSystem->Load("libSTEER.so");
25 gSystem->Load("libSTEERBase.so");
af472fff 26 gSystem->Load("libTender.so");
27 gSystem->Load("libTenderSupplies.so");
4e1b9acf 28 gSystem->Load("libPWGflowBase.so");
29 gSystem->Load("libPWGflowTasks.so");
30 gSystem->Load("libPWGGAGammaConv.so");
cb287740 31
32 Int_t isHeavyIon = 2;
2c75809c 33 Int_t neutralPionMode = 2;
cb287740 34
35 // ================== GetAnalysisManager ===============================
36 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
37 if (!mgr) {
38 Error(Form("AddTask_GammaConvNeutralMesonPiPlPiMiPiZero_pPb_%i",trainConfig), "No analysis manager found.");
39 return ;
40 }
41
42 // ================== GetInputEventHandler =============================
43 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
44
45 //========= Add PID Reponse to ANALYSIS manager ====
46 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
47 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
48 AddTaskPIDResponse(isMC);
49 }
50
51 //========= Set Cutnumber for V0Reader ================================
3013611f 52 TString cutnumberPhoton = "060000084001001500000000";
cb287740 53 TString cutnumberEvent = "8000000";
54 TString PionCuts = "000000200"; //Electron Cuts
2c75809c 55
56
57
cb287740 58 Bool_t doEtaShift = kFALSE;
59
60 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
61
62 //========= Add V0 Reader to ANALYSIS manager if not yet existent =====
63 if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
64 AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
65
66 fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
67 fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
68 fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
69
70 if (!mgr) {
71 Error("AddTask_V0ReaderV1", "No analysis manager found.");
72 return;
73 }
74
75 AliConvEventCuts *fEventCuts=NULL;
76 if(cutnumberEvent!=""){
77 fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data());
78 fEventCuts->SetPreSelectionCutFlag(kTRUE);
79 if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){
80 fEventCuts->DoEtaShift(doEtaShift);
81 fV0ReaderV1->SetEventCuts(fEventCuts);
82 fEventCuts->SetFillCutHistograms("",kTRUE);
83 }
84 }
85
86 // Set AnalysisCut Number
87 AliConversionPhotonCuts *fCuts=NULL;
88 if(cutnumberPhoton!=""){
89 fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data());
90 fCuts->SetPreSelectionCutFlag(kTRUE);
91 fCuts->SetIsHeavyIon(isHeavyIon);
92 if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){
93 fV0ReaderV1->SetConversionCuts(fCuts);
94 fCuts->SetFillCutHistograms("",kTRUE);
95 }
96 }
97
98 if(inputHandler->IsA()==AliAODInputHandler::Class()){
99 // AOD mode
100 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
101 }
102 fV0ReaderV1->Init();
103
104 AliLog::SetGlobalLogLevel(AliLog::kInfo);
105
106 //connect input V0Reader
107 mgr->AddTask(fV0ReaderV1);
108 mgr->ConnectInput(fV0ReaderV1,0,cinput);
109 }
110
111 //================================================
112 //========= Add Electron Selector ================
113
114
115 if( !(AliPrimaryPionSelector*)mgr->GetTask("PionSelector") ){
116
117 AliPrimaryPionSelector *fPionSelector = new AliPrimaryPionSelector("PionSelector");
118 // Set AnalysisCut Number
119
120 AliPrimaryPionCuts *fPionCuts=0;
121 if( PionCuts!=""){
122 fPionCuts= new AliPrimaryPionCuts(PionCuts.Data(),PionCuts.Data());
123 if(fPionCuts->InitializeCutsFromCutString(PionCuts.Data())){
124 fPionSelector->SetPrimaryPionCuts(fPionCuts);
125 fPionCuts->SetFillCutHistograms("",kTRUE);
126
127 }
128 }
129
130 fPionSelector->Init();
131 mgr->AddTask(fPionSelector);
132
133 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
134
135 //connect input V0Reader
136 mgr->ConnectInput (fPionSelector,0,cinput1);
137
138 }
139
140
141
142 AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero *task=NULL;
143
2c75809c 144 task= new AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero(Form("GammaConvNeutralMesonPiPlPiMiPiZero_%i_%i",neutralPionMode, trainConfig));
cb287740 145
146 task->SetIsHeavyIon(2);
147 task->SetIsMC(isMC);
148
149 // Cut Numbers to use in Analysis
150 Int_t numberOfCuts = 1;
151
152 TString *eventCutArray = new TString[numberOfCuts];
2c75809c 153 TString *ClusterCutarray = new TString[numberOfCuts];
cb287740 154 TString *PionCutarray = new TString[numberOfCuts];
155 TString *NeutralPionCutarray = new TString[numberOfCuts];
156 TString *MesonCutarray = new TString[numberOfCuts];
157
158 Bool_t doEtaShiftIndCuts = kFALSE;
159 TString stringShift = "";
160
161 // Shifting in pPb direction
162
163 doEtaShiftIndCuts = kTRUE;
164 stringShift = "pPb";
165
2c75809c 166 // EMCAL modes
cb287740 167 if( trainConfig == 1 ) {
925a074a 168 // everything open
2c75809c 169 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "000010400"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 170 } else if( trainConfig == 2 ) {
2c75809c 171 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, min pt charged pi = 100 MeV
172 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002010700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 173 } else if( trainConfig == 3 ) {
2c75809c 174 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, ITS dEdx = \pm 5 sigma, min pt charged pi = 100 MeV
175 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002013700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 176 } else if( trainConfig == 4 ) {
2c75809c 177 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, ITS dEdx = \pm 4 sigma, min pt charged pi = 100 MeV
178 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 179 } else if( trainConfig == 5 ) {
2c75809c 180 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, ITS dEdx = \pm 4 sigma, min pt charged pi = 100 MeV
925a074a 181 // closing neural pion cuts, 0.1 < M_gamma,gamma < 0.145
2c75809c 182 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035031000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 183 } else if( trainConfig == 6 ) {
2c75809c 184 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, ITS dEdx = \pm 4 sigma, min pt charged pi = 100 MeV
925a074a 185 // closing neural pion cuts, 0.11 < M_gamma,gamma < 0.145
2c75809c 186 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035032000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 187 } else if( trainConfig == 7 ) {
2c75809c 188 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, ITS dEdx = \pm 4 sigma, min pt charged pi = 100 MeV
925a074a 189 // closing neural pion cuts, 0.12 < M_gamma,gamma < 0.145
2c75809c 190 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035033000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 191 } else if( trainConfig == 8 ) {
2c75809c 192 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, ITS dEdx = \pm 5 sigma, min pt charged pi = 100 MeV
925a074a 193 // closing neural pion cuts, 0.12 < M_gamma,gamma < 0.145
2c75809c 194 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002013700"; NeutralPionCutarray[0] = "01035033000000"; MesonCutarray[0] = "01035030000000";
195 } else if( trainConfig == 9 ) {
196 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, pi+pi- mass Cut at 0.75, min pt charged pi = 100 MeV
197 // closing neural pion cuts, 0.1 < M_gamma,gamma < 0.145
198 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002010702"; NeutralPionCutarray[0] = "01035031000000"; MesonCutarray[0] = "01035030000000";
cb287740 199 }
2c75809c 200
201
202 // PHOS modes
203 if( trainConfig == 31 ) {
204 // everything open
205 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "000010400"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
206 } else if( trainConfig == 32 ) {
207 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, min pt charged pi = 100 MeV
208 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002010700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
209 } else if( trainConfig == 33 ) {
210 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, ITS dEdx = \pm 5 sigma, min pt charged pi = 100 MeV
211 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002013700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
212 } else if( trainConfig == 34 ) {
213 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, ITS dEdx = \pm 4 sigma, min pt charged pi = 100 MeV
214 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
215 } else if( trainConfig == 35 ) {
216 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, ITS dEdx = \pm 4 sigma, min pt charged pi = 100 MeV
217 // closing neural pion cuts, 0.1 < M_gamma,gamma < 0.145
218 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035031000000"; MesonCutarray[0] = "01035030000000";
219 } else if( trainConfig == 36 ) {
220 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, ITS dEdx = \pm 4 sigma, min pt charged pi = 100 MeV
221 // closing neural pion cuts, 0.11 < M_gamma,gamma < 0.145
222 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035032000000"; MesonCutarray[0] = "01035030000000";
223 } else if( trainConfig == 37 ) {
224 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, ITS dEdx = \pm 4 sigma, min pt charged pi = 100 MeV
225 // closing neural pion cuts, 0.12 < M_gamma,gamma < 0.145
226 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035033000000"; MesonCutarray[0] = "01035030000000";
227 } else if( trainConfig == 38 ) {
228 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, ITS dEdx = \pm 5 sigma, min pt charged pi = 100 MeV
229 // closing neural pion cuts, 0.12 < M_gamma,gamma < 0.145
230 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002013700"; NeutralPionCutarray[0] = "01035033000000"; MesonCutarray[0] = "01035030000000";
231 } else if( trainConfig == 39 ) {
232 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, pi+pi- mass Cut at 0.75, min pt charged pi = 100 MeV
233 // closing neural pion cuts, 0.1 < M_gamma,gamma < 0.145
234 eventCutArray[ 0] = "8000011"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002010702"; NeutralPionCutarray[0] = "01035031000000"; MesonCutarray[0] = "01035030000000";
235 }
236
cb287740 237
238 TList *EventCutList = new TList();
2c75809c 239 TList *ClusterCutList = new TList();
cb287740 240 TList *NeutralPionCutList = new TList();
241 TList *MesonCutList = new TList();
242 TList *PionCutList = new TList();
243
244 TList *HeaderList = new TList();
245 TObjString *Header1 = new TObjString("pi0_1");
246 HeaderList->Add(Header1);
247 TObjString *Header3 = new TObjString("eta_2");
248 HeaderList->Add(Header3);
249
250 EventCutList->SetOwner(kTRUE);
251 AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts];
2c75809c 252 ClusterCutList->SetOwner(kTRUE);
253 AliCaloPhotonCuts **analysisClusterCuts = new AliCaloPhotonCuts*[numberOfCuts];
cb287740 254 NeutralPionCutList->SetOwner(kTRUE);
255 AliConversionMesonCuts **analysisNeutralPionCuts = new AliConversionMesonCuts*[numberOfCuts];
256 MesonCutList->SetOwner(kTRUE);
257 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
258 PionCutList->SetOwner(kTRUE);
259 AliPrimaryPionCuts **analysisPionCuts = new AliPrimaryPionCuts*[numberOfCuts];
260
261 for(Int_t i = 0; i<numberOfCuts; i++){
262 analysisEventCuts[i] = new AliConvEventCuts();
263 analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data());
264 EventCutList->Add(analysisEventCuts[i]);
265 analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
266
2c75809c 267 analysisClusterCuts[i] = new AliCaloPhotonCuts();
268 if( ! analysisClusterCuts[i]->InitializeCutsFromCutString(ClusterCutarray[i].Data()) ) {
269 cout<<"ERROR: analysisClusterCuts [" <<i<<"]"<<endl;
cb287740 270 return 0;
271 } else {
2c75809c 272 ClusterCutList->Add(analysisClusterCuts[i]);
273 analysisClusterCuts[i]->SetFillCutHistograms("");
cb287740 274 }
275
276 analysisNeutralPionCuts[i] = new AliConversionMesonCuts();
277 if( ! analysisNeutralPionCuts[i]->InitializeCutsFromCutString(NeutralPionCutarray[i].Data()) ) {
278 cout<<"ERROR: analysisMesonCuts [ " <<i<<" ] "<<endl;
279 return 0;
280 } else {
281 NeutralPionCutList->Add(analysisNeutralPionCuts[i]);
282 analysisNeutralPionCuts[i]->SetFillCutHistograms("");
283 }
284
285 analysisMesonCuts[i] = new AliConversionMesonCuts();
286 if( ! analysisMesonCuts[i]->InitializeCutsFromCutString(MesonCutarray[i].Data()) ) {
287 cout<<"ERROR: analysisMesonCuts [ " <<i<<" ] "<<endl;
288 return 0;
289 } else {
290 MesonCutList->Add(analysisMesonCuts[i]);
291 analysisMesonCuts[i]->SetFillCutHistograms("");
292 }
293 analysisEventCuts[i]->SetAcceptedHeader(HeaderList);
294
2c75809c 295 TString cutName( Form("%s_%s_%s_%s_%s",eventCutArray[i].Data(), ClusterCutarray[i].Data(),PionCutarray[i].Data(),NeutralPionCutarray[i].Data(), MesonCutarray[i].Data() ) );
cb287740 296 analysisPionCuts[i] = new AliPrimaryPionCuts();
297 if( !analysisPionCuts[i]->InitializeCutsFromCutString(PionCutarray[i].Data())) {
298 cout<< "ERROR: analysisPionCuts [ " <<i<<" ] "<<endl;
299 return 0;
300 } else {
301 PionCutList->Add(analysisPionCuts[i]);
302 analysisPionCuts[i]->SetFillCutHistograms("",kFALSE,cutName);
303 }
304 }
305
2c75809c 306 task->SetNeutralPionMode(neutralPionMode);
cb287740 307 task->SetEventCutList(numberOfCuts,EventCutList);
2c75809c 308 task->SetClusterCutList(ClusterCutList);
cb287740 309 task->SetNeutralPionCutList(NeutralPionCutList);
310 task->SetMesonCutList(MesonCutList);
311 task->SetPionCutList(PionCutList);
312
313 task->SetMoveParticleAccordingToVertex(kTRUE);
314
315 if(enableQAMesonTask) task->SetDoMesonQA(kTRUE);
316
317 //connect containers
318 AliAnalysisDataContainer *coutput =
2c75809c 319 mgr->CreateContainer(Form("GammaConvNeutralMesonPiPlPiMiPiZero_%i_%i",neutralPionMode, trainConfig), TList::Class(),
320 AliAnalysisManager::kOutputContainer,Form("GammaConvNeutralMesonPiPlPiMiPiZero_%i_%i.root",neutralPionMode, trainConfig));
cb287740 321
322 mgr->AddTask(task);
323 mgr->ConnectInput(task,0,cinput);
324 mgr->ConnectOutput(task,1,coutput);
325
326 return;
327
328}