modified psi-pair cut for GG-Task
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvV1_PbPb.C
1 void AddTask_GammaConvV1_PbPb(  Int_t trainConfig = 1,  //change different set of cuts
2                               Bool_t isMC   = kFALSE, //run MC 
3                               Bool_t enableQAMesonTask = kFALSE, //enable QA in AliAnalysisTaskGammaConvV1
4                               Bool_t enableQAPhotonTask = kFALSE, // enable additional QA task
5                               TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
6                               Bool_t doWeighting = kFALSE,  //enable Weighting
7                               TString cutnumberAODBranch = "1000000060084000001500000" 
8                            ) {
9
10    // ================= Load Librariers =================================
11    gSystem->Load("libCore.so");  
12    gSystem->Load("libTree.so");
13    gSystem->Load("libGeom.so");
14    gSystem->Load("libVMC.so");
15    gSystem->Load("libPhysics.so");
16    gSystem->Load("libMinuit");
17    gSystem->Load("libSTEERBase");
18    gSystem->Load("libESD");
19    gSystem->Load("libAOD");
20    gSystem->Load("libANALYSIS");
21    gSystem->Load("libANALYSISalice");  
22    gSystem->Load("libPWGGAGammaConv.so");
23    gSystem->Load("libCDB.so");
24    gSystem->Load("libSTEER.so");
25    gSystem->Load("libSTEERBase.so");
26    gSystem->Load("libTENDER.so");
27    gSystem->Load("libTENDERSupplies.so");
28       
29    // ================== GetAnalysisManager ===============================
30    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
31    if (!mgr) {
32       Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found.");
33       return ;
34    }
35
36    // ================== GetInputEventHandler =============================
37    AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
38    
39    //========= Add PID Reponse to ANALYSIS manager ====
40    if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
41       gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
42       AddTaskPIDResponse(isMC);
43    }
44    
45    //=========  Set Cutnumber for V0Reader ================================
46    TString cutnumber = "100000000008400100150000000"; 
47    AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
48    //========= Add V0 Reader to  ANALYSIS manager if not yet existent =====
49    if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
50       AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
51       
52       fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
53       fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
54       fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
55
56       if (!mgr) {
57          Error("AddTask_V0ReaderV1", "No analysis manager found.");
58          return;
59       }
60
61       // Set AnalysisCut Number
62       AliConversionCuts *fCuts=NULL;
63       if(cutnumber!=""){
64          fCuts= new AliConversionCuts(cutnumber.Data(),cutnumber.Data());
65          fCuts->SetPreSelectionCutFlag(kTRUE);
66          if(fCuts->InitializeCutsFromCutString(cutnumber.Data())){
67             fV0ReaderV1->SetConversionCuts(fCuts);
68             fCuts->SetFillCutHistograms("",kTRUE);
69          }
70       }
71       
72       if(inputHandler->IsA()==AliAODInputHandler::Class()){
73       // AOD mode
74          fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
75       }
76       fV0ReaderV1->Init();
77
78       AliLog::SetGlobalLogLevel(AliLog::kInfo);
79
80       //connect input V0Reader
81       mgr->AddTask(fV0ReaderV1);
82       mgr->ConnectInput(fV0ReaderV1,0,cinput);
83
84    }
85
86    //================================================
87    //========= Add task to the ANALYSIS manager =====
88    //================================================
89    AliAnalysisTaskGammaConvV1 *task=NULL;
90    task= new AliAnalysisTaskGammaConvV1(Form("GammaConvV1_%i",trainConfig));
91    task->SetIsHeavyIon(1);
92    task->SetIsMC(isMC);
93    // Cut Numbers to use in Analysis
94    Int_t numberOfCuts = 5;
95
96    TString *cutarray = new TString[numberOfCuts];
97    TString *mesonCutArray = new TString[numberOfCuts];
98
99    if (trainConfig == 1){ // Standard cuts
100       cutarray[ 0] = "601000104209297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
101       cutarray[ 1] = "612000104209297002322000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
102       cutarray[ 2] = "501000104209297002322000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
103       cutarray[ 3] = "512000104209297002322000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
104       cutarray[ 4] = "502000104209297002322000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
105    } else if (trainConfig == 2) { // Standard cuts
106       cutarray[ 0] = "524000104209297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
107       cutarray[ 1] = "546000104209297002322000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
108       cutarray[ 2] = "568000104209297002322000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
109       cutarray[ 3] = "548000104209297002322000000"; mesonCutArray[ 3] = "01522065009000"; // 40-80%
110       cutarray[ 4] = "549000104209297002322000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
111    } else if (trainConfig == 3) { // Standard cuts only added signals
112       cutarray[ 0] = "601000204209297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
113       cutarray[ 1] = "612000204209297002322000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
114       cutarray[ 2] = "501000204209297002322000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
115       cutarray[ 3] = "512000204209297002322000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
116       cutarray[ 4] = "502000204209297002322000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
117    } else if (trainConfig == 4) { // Standard cuts only added signals
118       cutarray[ 0] = "524000204209297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
119       cutarray[ 1] = "546000204209297002322000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
120       cutarray[ 2] = "568000204209297002322000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
121       cutarray[ 3] = "548000204209297002322000000"; mesonCutArray[ 3] = "01522065009000"; // 20-40% 
122       cutarray[ 4] = "549000204209297002322000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
123    } else if (trainConfig == 5){  // Psi pair 0.2 (constant, 4) 
124       cutarray[ 0] = "601000104209297002324000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
125       cutarray[ 1] = "612000104209297002324000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
126       cutarray[ 2] = "501000104209297002324000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
127       cutarray[ 3] = "512000104209297002324000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
128       cutarray[ 4] = "502000104209297002324000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
129    } else if (trainConfig == 6) { // Psi pair 0.2 (constant, 4) 
130       cutarray[ 0] = "524000104209297002324000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
131       cutarray[ 1] = "546000104209297002324000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
132       cutarray[ 2] = "568000104209297002324000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
133       cutarray[ 3] = "548000104209297002324000000"; mesonCutArray[ 3] = "01522065009000"; // 40-80%
134       cutarray[ 4] = "549000104209297002324000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
135    } else if (trainConfig == 7) { // Psi pair 0.2 (constant, 4) 
136       cutarray[ 0] = "601000204209297002324000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
137       cutarray[ 1] = "612000204209297002324000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
138       cutarray[ 2] = "501000204209297002324000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
139       cutarray[ 3] = "512000204209297002324000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
140       cutarray[ 4] = "502000204209297002324000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
141    } else if (trainConfig == 8) { // Psi pair 0.2 (constant, 4) 
142       cutarray[ 0] = "524000204209297002324000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
143       cutarray[ 1] = "546000204209297002324000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
144       cutarray[ 2] = "568000204209297002324000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
145       cutarray[ 3] = "548000204209297002324000000"; mesonCutArray[ 3] = "01522065009000"; // 20-40% 
146       cutarray[ 4] = "549000204209297002324000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
147    } else if (trainConfig == 9){ // Psi pair 0.1 (triangle to 1, 5) 
148       cutarray[ 0] = "601000104209297002325000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
149       cutarray[ 1] = "612000104209297002325000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
150       cutarray[ 2] = "501000104209297002325000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
151       cutarray[ 3] = "512000104209297002325000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
152       cutarray[ 4] = "502000104209297002325000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
153    } else if (trainConfig == 10) { // Psi pair 0.1 (triangle to 1, 5) 
154       cutarray[ 0] = "524000104209297002325000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
155       cutarray[ 1] = "546000104209297002325000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
156       cutarray[ 2] = "568000104209297002325000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
157       cutarray[ 3] = "548000104209297002325000000"; mesonCutArray[ 3] = "01522065009000"; // 40-80%
158       cutarray[ 4] = "549000104209297002325000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
159    } else if (trainConfig == 11) { // Psi pair 0.1 (triangle to 1, 5) 
160       cutarray[ 0] = "601000204209297002325000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
161       cutarray[ 1] = "612000204209297002325000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
162       cutarray[ 2] = "501000204209297002325000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
163       cutarray[ 3] = "512000204209297002325000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
164       cutarray[ 4] = "502000204209297002325000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
165    } else if (trainConfig == 12) { // Psi pair 0.1 (triangle to 1, 5) 
166       cutarray[ 0] = "524000204209297002325000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
167       cutarray[ 1] = "546000204209297002325000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
168       cutarray[ 2] = "568000204209297002325000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
169       cutarray[ 3] = "548000204209297002325000000"; mesonCutArray[ 3] = "01522065009000"; // 20-40% 
170       cutarray[ 4] = "549000204209297002325000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
171    } else if (trainConfig == 13){ // Psi pair 0.05 (triangle to 1, 6) 
172       cutarray[ 0] = "601000104209297002326000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
173       cutarray[ 1] = "612000104209297002326000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
174       cutarray[ 2] = "501000104209297002326000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
175       cutarray[ 3] = "512000104209297002326000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
176       cutarray[ 4] = "502000104209297002326000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
177    } else if (trainConfig == 14) { // Psi pair 0.05 (triangle to 1, 6) 
178       cutarray[ 0] = "524000104209297002326000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
179       cutarray[ 1] = "546000104209297002326000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
180       cutarray[ 2] = "568000104209297002326000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
181       cutarray[ 3] = "548000104209297002326000000"; mesonCutArray[ 3] = "01522065009000"; // 40-80%
182       cutarray[ 4] = "549000104209297002326000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
183    } else if (trainConfig == 15) { // Psi pair 0.05 (triangle to 1, 6) 
184       cutarray[ 0] = "601000204209297002326000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
185       cutarray[ 1] = "612000204209297002326000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
186       cutarray[ 2] = "501000204209297002326000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
187       cutarray[ 3] = "512000204209297002326000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
188       cutarray[ 4] = "502000204209297002326000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
189    } else if (trainConfig == 16) { // Psi pair 0.05 (triangle to 1, 6) 
190       cutarray[ 0] = "524000204209297002326000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
191       cutarray[ 1] = "546000204209297002326000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
192       cutarray[ 2] = "568000204209297002326000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
193       cutarray[ 3] = "548000204209297002326000000"; mesonCutArray[ 3] = "01522065009000"; // 20-40% 
194       cutarray[ 4] = "549000204209297002326000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
195    } else if (trainConfig == 17){ // Psi pair 0.2 (triangle to 1, 8) 
196       cutarray[ 0] = "601000104209297002328000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
197       cutarray[ 1] = "612000104209297002328000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
198       cutarray[ 2] = "501000104209297002328000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
199       cutarray[ 3] = "512000104209297002328000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
200       cutarray[ 4] = "502000104209297002328000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
201    } else if (trainConfig == 18) { // Psi pair 0.2 (triangle to 1, 8) 
202       cutarray[ 0] = "524000104209297002328000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
203       cutarray[ 1] = "546000104209297002328000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
204       cutarray[ 2] = "568000104209297002328000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
205       cutarray[ 3] = "548000104209297002328000000"; mesonCutArray[ 3] = "01522065009000"; // 40-80%
206       cutarray[ 4] = "549000104209297002328000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
207    } else if (trainConfig == 19) { // Psi pair 0.2 (triangle to 1, 8) 
208       cutarray[ 0] = "601000204209297002328000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
209       cutarray[ 1] = "612000204209297002328000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
210       cutarray[ 2] = "501000204209297002328000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
211       cutarray[ 3] = "512000204209297002328000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
212       cutarray[ 4] = "502000204209297002328000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
213    } else if (trainConfig == 20) { // Psi pair 0.2 (triangle to 1, 8) 
214       cutarray[ 0] = "524000204209297002328000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
215       cutarray[ 1] = "546000204209297002328000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
216       cutarray[ 2] = "568000204209297002328000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
217       cutarray[ 3] = "548000204209297002328000000"; mesonCutArray[ 3] = "01522065009000"; // 20-40% 
218       cutarray[ 4] = "549000204209297002328000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
219    } else if (trainConfig == 21){ // Psi pair 0.1 (triangle to 1, 5) without min R
220       cutarray[ 0] = "601000104009297002325000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
221       cutarray[ 1] = "612000104009297002325000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
222       cutarray[ 2] = "501000104009297002325000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
223       cutarray[ 3] = "512000104009297002325000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
224       cutarray[ 4] = "502000104009297002325000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
225    } else if (trainConfig == 22) { // Psi pair 0.1 (triangle to 1, 5) without min R
226       cutarray[ 0] = "524000104009297002325000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
227       cutarray[ 1] = "546000104009297002325000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
228       cutarray[ 2] = "568000104009297002325000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
229       cutarray[ 3] = "548000104009297002325000000"; mesonCutArray[ 3] = "01522065009000"; // 40-80%
230       cutarray[ 4] = "549000104009297002325000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
231    } else if (trainConfig == 23) { // Psi pair 0.1 (triangle to 1, 5) without min R
232       cutarray[ 0] = "601000204009297002325000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
233       cutarray[ 1] = "612000204009297002325000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
234       cutarray[ 2] = "501000204009297002325000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
235       cutarray[ 3] = "512000204009297002325000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
236       cutarray[ 4] = "502000204009297002325000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
237    } else if (trainConfig == 24) { // Psi pair 0.1 (triangle to 1, 5) without min R
238       cutarray[ 0] = "524000204009297002325000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
239       cutarray[ 1] = "546000204009297002325000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
240       cutarray[ 2] = "568000204009297002325000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
241       cutarray[ 3] = "548000204009297002325000000"; mesonCutArray[ 3] = "01522065009000"; // 20-40% 
242       cutarray[ 4] = "549000204009297002325000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
243    } else if (trainConfig == 25){ // Psi pair 0.05 (triangle to 1, 6) without min R
244       cutarray[ 0] = "601000104009297002326000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
245       cutarray[ 1] = "612000104009297002326000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
246       cutarray[ 2] = "501000104009297002326000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
247       cutarray[ 3] = "512000104009297002326000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
248       cutarray[ 4] = "502000104009297002326000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
249    } else if (trainConfig == 26) { // Psi pair 0.05 (triangle to 1, 6) without min R
250       cutarray[ 0] = "524000104009297002326000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
251       cutarray[ 1] = "546000104009297002326000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
252       cutarray[ 2] = "568000104009297002326000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
253       cutarray[ 3] = "548000104009297002326000000"; mesonCutArray[ 3] = "01522065009000"; // 40-80%
254       cutarray[ 4] = "549000104009297002326000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
255    } else if (trainConfig == 27) { // Psi pair 0.05 (triangle to 1, 6) without min R
256       cutarray[ 0] = "601000204009297002326000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
257       cutarray[ 1] = "612000204009297002326000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
258       cutarray[ 2] = "501000204009297002326000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
259       cutarray[ 3] = "512000204009297002326000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
260       cutarray[ 4] = "502000204009297002326000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
261    } else if (trainConfig == 28) { // Psi pair 0.05 (triangle to 1, 6) without min R
262       cutarray[ 0] = "524000204009297002326000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
263       cutarray[ 1] = "546000204009297002326000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
264       cutarray[ 2] = "568000204009297002326000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
265       cutarray[ 3] = "548000204009297002326000000"; mesonCutArray[ 3] = "01522065009000"; // 20-40% 
266       cutarray[ 4] = "549000204009297002326000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
267    } else if (trainConfig == 29){ // Psi pair 0.2 (triangle to 1, 8) without min R
268       cutarray[ 0] = "601000104009297002328000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
269       cutarray[ 1] = "612000104009297002328000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
270       cutarray[ 2] = "501000104009297002328000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
271       cutarray[ 3] = "512000104009297002328000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
272       cutarray[ 4] = "502000104009297002328000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
273    } else if (trainConfig == 30) { // Psi pair 0.2 (triangle to 1, 8) without min R
274       cutarray[ 0] = "524000104009297002328000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
275       cutarray[ 1] = "546000104009297002328000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
276       cutarray[ 2] = "568000104009297002328000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
277       cutarray[ 3] = "548000104009297002328000000"; mesonCutArray[ 3] = "01522065009000"; // 40-80%
278       cutarray[ 4] = "549000104009297002328000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
279    } else if (trainConfig == 31) { // Psi pair 0.2 (triangle to 1, 8) without min R
280       cutarray[ 0] = "601000204009297002328000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
281       cutarray[ 1] = "612000204009297002328000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
282       cutarray[ 2] = "501000204009297002328000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
283       cutarray[ 3] = "512000204009297002328000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
284       cutarray[ 4] = "502000204009297002328000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
285    } else if (trainConfig == 32) { // Psi pair 0.2 (triangle to 1, 8) without min R
286       cutarray[ 0] = "524000204009297002328000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
287       cutarray[ 1] = "546000204009297002328000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
288       cutarray[ 2] = "568000204009297002328000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
289       cutarray[ 3] = "548000204009297002328000000"; mesonCutArray[ 3] = "01522065009000"; // 20-40% 
290       cutarray[ 4] = "549000204009297002328000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
291    }else if (trainConfig == 33){ // Asymmetry 1- 0.04 above 3.5 GeV
292       cutarray[ 0] = "601000104209297002322100000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
293       cutarray[ 1] = "612000104209297002322100000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
294       cutarray[ 2] = "501000104209297002322100000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
295       cutarray[ 3] = "512000104209297002322100000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
296       cutarray[ 4] = "502000104209297002322100000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
297    } else if (trainConfig == 34) { // Asymmetry 1- 0.04 above 3.5 GeV
298       cutarray[ 0] = "524000104209297002322100000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
299       cutarray[ 1] = "546000104209297002322100000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
300       cutarray[ 2] = "568000104209297002322100000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
301       cutarray[ 3] = "548000104209297002322100000"; mesonCutArray[ 3] = "01522065009000"; // 40-80%
302       cutarray[ 4] = "549000104209297002322100000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
303    } else if (trainConfig == 35) { // Asymmetry 1- 0.04 above 3.5 GeV
304       cutarray[ 0] = "601000204209297002322100000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
305       cutarray[ 1] = "612000204209297002322100000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
306       cutarray[ 2] = "501000204209297002322100000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
307       cutarray[ 3] = "512000204209297002322100000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
308       cutarray[ 4] = "502000204209297002322100000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
309    } else if (trainConfig == 36) { // Asymmetry 1- 0.04 above 3.5 GeV
310       cutarray[ 0] = "524000204209297002322100000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
311       cutarray[ 1] = "546000204209297002322100000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
312       cutarray[ 2] = "568000204209297002322100000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
313       cutarray[ 3] = "548000204209297002322100000"; mesonCutArray[ 3] = "01522065009000"; // 20-40% 
314       cutarray[ 4] = "549000204209297002322100000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
315    } else if (trainConfig == 37){ // Asymmetry 1- 0.06 above 3.5 GeV
316       cutarray[ 0] = "601000104209297002322200000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
317       cutarray[ 1] = "612000104209297002322200000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
318       cutarray[ 2] = "501000104209297002322200000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
319       cutarray[ 3] = "512000104209297002322200000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
320       cutarray[ 4] = "502000104209297002322200000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
321    } else if (trainConfig == 38) { // Asymmetry 1- 0.06 above 3.5 GeV
322       cutarray[ 0] = "524000104209297002322200000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
323       cutarray[ 1] = "546000104209297002322200000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
324       cutarray[ 2] = "568000104209297002322200000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
325       cutarray[ 3] = "548000104209297002322200000"; mesonCutArray[ 3] = "01522065009000"; // 40-80%
326       cutarray[ 4] = "549000104209297002322200000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
327    } else if (trainConfig == 39) { // Asymmetry 1- 0.06 above 3.5 GeV
328       cutarray[ 0] = "601000204209297002322200000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
329       cutarray[ 1] = "612000204209297002322200000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
330       cutarray[ 2] = "501000204209297002322200000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
331       cutarray[ 3] = "512000204209297002322200000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
332       cutarray[ 4] = "502000204209297002322200000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
333    } else if (trainConfig == 40) { // Asymmetry 1- 0.06 above 3.5 GeV
334       cutarray[ 0] = "524000204209297002322200000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
335       cutarray[ 1] = "546000204209297002322200000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
336       cutarray[ 2] = "568000204209297002322200000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
337       cutarray[ 3] = "548000204209297002322200000"; mesonCutArray[ 3] = "01522065009000"; // 20-40% 
338       cutarray[ 4] = "549000204209297002322200000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
339    } else if (trainConfig == 41){ // Asymmetry 1- 0.05
340       cutarray[ 0] = "601000104209297002322300000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
341       cutarray[ 1] = "612000104209297002322300000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
342       cutarray[ 2] = "501000104209297002322300000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
343       cutarray[ 3] = "512000104209297002322300000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
344       cutarray[ 4] = "502000104209297002322300000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
345    } else if (trainConfig == 42) {// Asymmetry 1- 0.05 
346       cutarray[ 0] = "524000104209297002322300000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
347       cutarray[ 1] = "546000104209297002322300000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
348       cutarray[ 2] = "568000104209297002322300000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
349       cutarray[ 3] = "548000104209297002322300000"; mesonCutArray[ 3] = "01522065009000"; // 40-80%
350       cutarray[ 4] = "549000104209297002322300000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
351    } else if (trainConfig == 43) { // Asymmetry 1- 0.05
352       cutarray[ 0] = "601000204209297002322300000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
353       cutarray[ 1] = "612000204209297002322300000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
354       cutarray[ 2] = "501000204209297002322300000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
355       cutarray[ 3] = "512000204209297002322300000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
356       cutarray[ 4] = "502000204209297002322300000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
357    } else if (trainConfig == 44) { // Asymmetry 1- 0.05
358       cutarray[ 0] = "524000204209297002322300000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
359       cutarray[ 1] = "546000204209297002322300000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
360       cutarray[ 2] = "568000204209297002322300000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
361       cutarray[ 3] = "548000204209297002322300000"; mesonCutArray[ 3] = "01522065009000"; // 20-40% 
362       cutarray[ 4] = "549000204209297002322300000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
363    
364    } else {
365       Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
366       return;
367    }
368
369    TList *ConvCutList = new TList();
370    TList *MesonCutList = new TList();
371
372    TList *HeaderList = new TList();
373    TObjString *Header1 = new TObjString("pi0_1");
374    HeaderList->Add(Header1);
375 //    TObjString *Header3 = new TObjString("eta_2");
376 //    HeaderList->Add(Header3);
377    
378    ConvCutList->SetOwner(kTRUE);
379    AliConversionCuts **analysisCuts = new AliConversionCuts*[numberOfCuts];
380    MesonCutList->SetOwner(kTRUE);
381    AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
382
383    for(Int_t i = 0; i<numberOfCuts; i++){
384       analysisCuts[i] = new AliConversionCuts();
385       if (trainConfig == 1 ||trainConfig == 5 || trainConfig == 9 || trainConfig == 13 || trainConfig == 17 || trainConfig == 21 || trainConfig == 25 || trainConfig == 29 || trainConfig == 33 || trainConfig == 37 || trainConfig == 41 || trainConfig == 45 || trainConfig == 49 || trainConfig == 53 || trainConfig == 57){
386          if (i == 0 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_0005TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0005V0M");
387          if (i == 1 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_0510TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0510V0M");
388          if (i == 2 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_0010TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0010V0M");
389          if (i == 3 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE,fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_1020TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_1020V0M");
390          if (i == 4 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE,fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_0020TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0020V0M");
391       } else if (trainConfig == 2 ||trainConfig == 6 || trainConfig == 10 || trainConfig == 14 || trainConfig == 18 || trainConfig == 22 || trainConfig == 26 || trainConfig == 30 || trainConfig == 34 || trainConfig == 38 || trainConfig == 42 || trainConfig == 46 || trainConfig == 50 || trainConfig == 54 || trainConfig == 58){ 
392         if (i == 0 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_2040TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_2040V0M");
393         if (i == 1 && doWeighting) analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_4060TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4060V0M");
394         if (i == 2 && doWeighting) analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_6080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_6080V0M");
395         if (i == 3 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_4080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4080V0M");
396       } else if (trainConfig == 3 ||trainConfig == 7 || trainConfig == 11 || trainConfig == 15 || trainConfig == 19 || trainConfig == 23 || trainConfig == 27 || trainConfig == 31 || trainConfig == 35 || trainConfig == 39 || trainConfig == 43 || trainConfig == 47 || trainConfig == 51 || trainConfig == 55 || trainConfig == 59){
397          if (i == 0 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_0005TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0005V0M");
398          if (i == 1 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_0510TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0510V0M");
399          if (i == 2 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_0010TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0010V0M");
400          if (i == 3 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE,fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_1020TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_1020V0M");
401           if (i == 0 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_0020TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0020V0M");
402       } else if (trainConfig == 4 ||trainConfig == 8 || trainConfig == 12 || trainConfig == 16 || trainConfig == 20 || trainConfig == 24 || trainConfig == 28 || trainConfig == 32 || trainConfig == 36 || trainConfig == 40 || trainConfig == 44 || trainConfig == 48 || trainConfig == 52 || trainConfig == 56 || trainConfig == 60){ 
403         if (i == 0 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_2040TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_2040V0M");
404         if (i == 1 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_4060TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4060V0M");
405         if (i == 2  && doWeighting) analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_6080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_6080V0M");
406         if (i == 3 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_4080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4080V0M");
407       }
408       
409       analysisCuts[i]->InitializeCutsFromCutString(cutarray[i].Data());
410       ConvCutList->Add(analysisCuts[i]);
411
412       analysisCuts[i]->SetFillCutHistograms("",kFALSE);
413       analysisMesonCuts[i] = new AliConversionMesonCuts();
414       analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
415       MesonCutList->Add(analysisMesonCuts[i]);
416       analysisMesonCuts[i]->SetFillCutHistograms("");
417       analysisCuts[i]->SetAcceptedHeader(HeaderList);
418    }
419
420    task->SetConversionCutList(numberOfCuts,ConvCutList);
421    task->SetMesonCutList(numberOfCuts,MesonCutList);
422    task->SetMoveParticleAccordingToVertex(kTRUE);
423    task->SetDoMesonAnalysis(kTRUE);
424    if (enableQAMesonTask) task->SetDoMesonQA(kTRUE); //Attention new switch for Pi0 QA
425    if (enableQAPhotonTask) task->SetDoPhotonQA(kTRUE);  //Attention new switch small for Photon QA
426
427    //connect containers
428    AliAnalysisDataContainer *coutput =
429       mgr->CreateContainer(Form("GammaConvV1_%i",trainConfig), TList::Class(),
430                            AliAnalysisManager::kOutputContainer,Form("GammaConvV1_%i.root",trainConfig));
431
432    mgr->AddTask(task);
433    mgr->ConnectInput(task,0,cinput);
434    mgr->ConnectOutput(task,1,coutput);
435
436    return;
437
438 }