TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvNeutralMesonPiPlPiMiPiZero_MixedMode_pPb.C
CommitLineData
2c75809c 1void AddTask_GammaConvNeutralMesonPiPlPiMiPiZero_MixedMode_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 = 1;
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 *ConvCutarray = new TString[numberOfCuts];
155 TString *PionCutarray = new TString[numberOfCuts];
156 TString *NeutralPionCutarray = new TString[numberOfCuts];
157 TString *MesonCutarray = new TString[numberOfCuts];
158
159 Bool_t doEtaShiftIndCuts = kFALSE;
160 TString stringShift = "";
161
162 // Shifting in pPb direction
163
164 doEtaShiftIndCuts = kTRUE;
165 stringShift = "pPb";
166
2c75809c 167 // EMCAL mode
cb287740 168 if( trainConfig == 1 ) {
925a074a 169 // everything open
3013611f 170 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "000010400"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 171 } else if( trainConfig == 2 ) {
2c75809c 172 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, min pt charged pi = 100 MeV
3013611f 173 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002010700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 174 } else if( trainConfig == 3 ) {
2c75809c 175 // 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
3013611f 176 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002013700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 177 } else if( trainConfig == 4 ) {
2c75809c 178 // 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
3013611f 179 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 180 } else if( trainConfig == 5 ) {
2c75809c 181 // 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 182 // closing neural pion cuts, 0.1 < M_gamma,gamma < 0.145
3013611f 183 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035031000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 184 } else if( trainConfig == 6 ) {
2c75809c 185 // 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 186 // closing neural pion cuts, 0.11 < M_gamma,gamma < 0.145
3013611f 187 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035032000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 188 } else if( trainConfig == 7 ) {
2c75809c 189 // 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 190 // closing neural pion cuts, 0.12 < M_gamma,gamma < 0.145
3013611f 191 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035033000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 192 } else if( trainConfig == 8 ) {
2c75809c 193 // 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 194 // closing neural pion cuts, 0.12 < M_gamma,gamma < 0.145
3013611f 195 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002013700"; NeutralPionCutarray[0] = "01035033000000"; MesonCutarray[0] = "01035030000000";
2c75809c 196 } else if( trainConfig == 9 ) {
197 // 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
198 // closing neural pion cuts, 0.1 < M_gamma,gamma < 0.145
3013611f 199 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "10000040022030000"; PionCutarray[0] = "002010702"; NeutralPionCutarray[0] = "01035031000000"; MesonCutarray[0] = "01035030000000";
cb287740 200 }
2c75809c 201
202 // PHOS mode
203 if( trainConfig == 31 ) {
204 // everything open
3013611f 205 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "000010400"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
2c75809c 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
3013611f 208 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002010700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
2c75809c 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
3013611f 211 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002013700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
2c75809c 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
3013611f 214 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
2c75809c 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
3013611f 218 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035031000000"; MesonCutarray[0] = "01035030000000";
2c75809c 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
3013611f 222 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035032000000"; MesonCutarray[0] = "01035030000000";
2c75809c 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
3013611f 226 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035033000000"; MesonCutarray[0] = "01035030000000";
2c75809c 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
3013611f 230 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002013700"; NeutralPionCutarray[0] = "01035033000000"; MesonCutarray[0] = "01035030000000";
2c75809c 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
3013611f 234 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; ClusterCutarray[0] = "20000030022000000"; PionCutarray[0] = "002010702"; NeutralPionCutarray[0] = "01035031000000"; MesonCutarray[0] = "01035030000000";
2c75809c 235 }
236
cb287740 237 TList *EventCutList = new TList();
238 TList *ConvCutList = 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];
252 ConvCutList->SetOwner(kTRUE);
253 AliConversionPhotonCuts **analysisCuts = new AliConversionPhotonCuts*[numberOfCuts];
2c75809c 254 ClusterCutList->SetOwner(kTRUE);
255 AliCaloPhotonCuts **analysisClusterCuts = new AliCaloPhotonCuts*[numberOfCuts];
cb287740 256 NeutralPionCutList->SetOwner(kTRUE);
257 AliConversionMesonCuts **analysisNeutralPionCuts = new AliConversionMesonCuts*[numberOfCuts];
258 MesonCutList->SetOwner(kTRUE);
259 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
260 PionCutList->SetOwner(kTRUE);
261 AliPrimaryPionCuts **analysisPionCuts = new AliPrimaryPionCuts*[numberOfCuts];
262
263 for(Int_t i = 0; i<numberOfCuts; i++){
264 analysisEventCuts[i] = new AliConvEventCuts();
265 analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data());
266 EventCutList->Add(analysisEventCuts[i]);
267 analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
268
269 analysisCuts[i] = new AliConversionPhotonCuts();
270 if( ! analysisCuts[i]->InitializeCutsFromCutString(ConvCutarray[i].Data()) ) {
271 cout<<"ERROR: analysisCuts [" <<i<<"]"<<endl;
272 return 0;
273 } else {
274 ConvCutList->Add(analysisCuts[i]);
2c75809c 275 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
276 }
277
278 analysisClusterCuts[i] = new AliCaloPhotonCuts();
279 if( ! analysisClusterCuts[i]->InitializeCutsFromCutString(ClusterCutarray[i].Data()) ) {
280 cout<<"ERROR: analysisClusterCuts [" <<i<<"]"<<endl;
281 return 0;
282 } else {
283 ClusterCutList->Add(analysisClusterCuts[i]);
284 analysisClusterCuts[i]->SetFillCutHistograms("");
cb287740 285 }
286
287 analysisNeutralPionCuts[i] = new AliConversionMesonCuts();
288 if( ! analysisNeutralPionCuts[i]->InitializeCutsFromCutString(NeutralPionCutarray[i].Data()) ) {
289 cout<<"ERROR: analysisMesonCuts [ " <<i<<" ] "<<endl;
290 return 0;
291 } else {
292 NeutralPionCutList->Add(analysisNeutralPionCuts[i]);
293 analysisNeutralPionCuts[i]->SetFillCutHistograms("");
294 }
295
296 analysisMesonCuts[i] = new AliConversionMesonCuts();
297 if( ! analysisMesonCuts[i]->InitializeCutsFromCutString(MesonCutarray[i].Data()) ) {
298 cout<<"ERROR: analysisMesonCuts [ " <<i<<" ] "<<endl;
299 return 0;
300 } else {
301 MesonCutList->Add(analysisMesonCuts[i]);
302 analysisMesonCuts[i]->SetFillCutHistograms("");
303 }
304 analysisEventCuts[i]->SetAcceptedHeader(HeaderList);
305
2c75809c 306 TString cutName( Form("%s_%s_%s_%s_%s_%s",eventCutArray[i].Data(), ConvCutarray[i].Data(), ClusterCutarray[i].Data(),PionCutarray[i].Data(),NeutralPionCutarray[i].Data(), MesonCutarray[i].Data() ) );
cb287740 307 analysisPionCuts[i] = new AliPrimaryPionCuts();
308 if( !analysisPionCuts[i]->InitializeCutsFromCutString(PionCutarray[i].Data())) {
309 cout<< "ERROR: analysisPionCuts [ " <<i<<" ] "<<endl;
310 return 0;
311 } else {
312 PionCutList->Add(analysisPionCuts[i]);
313 analysisPionCuts[i]->SetFillCutHistograms("",kFALSE,cutName);
314 }
315 }
316
2c75809c 317 task->SetNeutralPionMode(neutralPionMode);
cb287740 318 task->SetEventCutList(numberOfCuts,EventCutList);
2c75809c 319 task->SetConversionCutList(ConvCutList);
320 task->SetClusterCutList(ClusterCutList);
cb287740 321 task->SetNeutralPionCutList(NeutralPionCutList);
322 task->SetMesonCutList(MesonCutList);
323 task->SetPionCutList(PionCutList);
324
325 task->SetMoveParticleAccordingToVertex(kTRUE);
326
327 if(enableQAMesonTask) task->SetDoMesonQA(kTRUE);
328
329 //connect containers
330 AliAnalysisDataContainer *coutput =
2c75809c 331 mgr->CreateContainer(Form("GammaConvNeutralMesonPiPlPiMiPiZero_%i_%i",neutralPionMode, trainConfig), TList::Class(),
332 AliAnalysisManager::kOutputContainer,Form("GammaConvNeutralMesonPiPlPiMiPiZero_%i_%i.root",neutralPionMode, trainConfig));
cb287740 333
334 mgr->AddTask(task);
335 mgr->ConnectInput(task,0,cinput);
336 mgr->ConnectOutput(task,1,coutput);
337
338 return;
339
340}