changed Resolution, Material, and PhotonQA task to be able to run on the grid
[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){ // R-minCut 7.5 cm
124       cutarray[ 0] = "601000104909297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
125       cutarray[ 1] = "612000104909297002322000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
126       cutarray[ 2] = "501000104909297002322000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
127       cutarray[ 3] = "512000104909297002322000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
128       cutarray[ 4] = "502000104909297002322000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
129    } else if (trainConfig == 6) { // R-minCut 7.5 cm
130       cutarray[ 0] = "524000104909297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
131       cutarray[ 1] = "546000104909297002322000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
132       cutarray[ 2] = "568000104909297002322000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
133       cutarray[ 3] = "548000104909297002322000000"; mesonCutArray[ 3] = "01522065009000"; // 40-80%
134       cutarray[ 4] = "549000104909297002322000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
135    } else if (trainConfig == 7) {// R-minCut 7.5 cm
136       cutarray[ 0] = "601000204909297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
137       cutarray[ 1] = "612000204909297002322000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
138       cutarray[ 2] = "501000204909297002322000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
139       cutarray[ 3] = "512000204909297002322000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
140       cutarray[ 4] = "502000204909297002322000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
141    } else if (trainConfig == 8) { // R-minCut 7.5 cm
142       cutarray[ 0] = "524000204009297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
143       cutarray[ 1] = "546000204909297002322000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
144       cutarray[ 2] = "568000204909297002322000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
145       cutarray[ 3] = "548000204909297002322000000"; mesonCutArray[ 3] = "01522065009000"; // 20-40% 
146       cutarray[ 4] = "549000204909297002322000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%   
147    } else if (trainConfig == 9){ // R-minCut 12.5 cm
148       cutarray[ 0] = "601000104809297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
149       cutarray[ 1] = "612000104809297002322000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
150       cutarray[ 2] = "501000104809297002322000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
151       cutarray[ 3] = "512000104809297002322000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
152       cutarray[ 4] = "502000104809297002322000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
153    } else if (trainConfig == 10) { // R-minCut 12.5 cm
154       cutarray[ 0] = "524000104809297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
155       cutarray[ 1] = "546000104809297002322000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
156       cutarray[ 2] = "568000104809297002322000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
157       cutarray[ 3] = "548000104809297002322000000"; mesonCutArray[ 3] = "01522065009000"; // 40-80%
158       cutarray[ 4] = "549000104809297002322000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%
159    } else if (trainConfig == 11) {// R-minCut 12.5 cm
160       cutarray[ 0] = "601000204809297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 0-5%
161       cutarray[ 1] = "612000204809297002322000000"; mesonCutArray[ 1] = "01522045009000"; // 5-10%
162       cutarray[ 2] = "501000204809297002322000000"; mesonCutArray[ 2] = "01522045009000"; // 0-10%
163       cutarray[ 3] = "512000204809297002322000000"; mesonCutArray[ 3] = "01522045009000"; // 10-20%
164       cutarray[ 4] = "502000204809297002322000000"; mesonCutArray[ 4] = "01522045009000"; // 0-20%
165    } else if (trainConfig == 12) { // R-minCut 12.5 cm
166       cutarray[ 0] = "524000204009297002322000000"; mesonCutArray[ 0] = "01522045009000"; // 20-40%
167       cutarray[ 1] = "546000204809297002322000000"; mesonCutArray[ 1] = "01522065009000"; // 40-60%
168       cutarray[ 2] = "568000204809297002322000000"; mesonCutArray[ 2] = "01522065009000"; // 60-80%
169       cutarray[ 3] = "548000204809297002322000000"; mesonCutArray[ 3] = "01522065009000"; // 20-40% 
170       cutarray[ 4] = "549000204809297002322000000"; mesonCutArray[ 4] = "01522065009000"; // 40-90%      
171    } else {
172       Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
173       return;
174    }
175
176    TList *ConvCutList = new TList();
177    TList *MesonCutList = new TList();
178
179    TList *HeaderList = new TList();
180    TObjString *Header1 = new TObjString("pi0_1");
181    HeaderList->Add(Header1);
182 //    TObjString *Header3 = new TObjString("eta_2");
183 //    HeaderList->Add(Header3);
184    
185    ConvCutList->SetOwner(kTRUE);
186    AliConversionCuts **analysisCuts = new AliConversionCuts*[numberOfCuts];
187    MesonCutList->SetOwner(kTRUE);
188    AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
189
190    for(Int_t i = 0; i<numberOfCuts; i++){
191       analysisCuts[i] = new AliConversionCuts();
192       if (trainConfig == 1 ||trainConfig == 5 || trainConfig == 9 || trainConfig == 13 || trainConfig == 17 || trainConfig == 21 || trainConfig == 25 || trainConfig == 29 || trainConfig == 33 || trainConfig == 37 || trainConfig == 41 ){
193          if (i == 0 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_0005TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0005V0M");
194          if (i == 1 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_0510TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0510V0M");
195          if (i == 2 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_0010TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0010V0M");
196          if (i == 3 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE,fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_1020TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_1020V0M");
197          if (i == 4 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE,fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_0020TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0020V0M");
198       } else if (trainConfig == 2 ||trainConfig == 6 || trainConfig == 10 || trainConfig == 14 || trainConfig == 18 || trainConfig == 22 || trainConfig == 26 || trainConfig == 30 || trainConfig == 34 || trainConfig == 38 || trainConfig == 42 ){ 
199         if (i == 0 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_2040TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_2040V0M");
200         if (i == 1 && doWeighting) analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_4060TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4060V0M");
201         if (i == 2 && doWeighting) analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_6080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_6080V0M");
202         if (i == 3 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_4080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4080V0M");
203       } else if (trainConfig == 3 ||trainConfig == 7 || trainConfig == 11 || trainConfig == 15 || trainConfig == 19 || trainConfig == 23 || trainConfig == 27 || trainConfig == 31 || trainConfig == 35 || trainConfig == 39 || trainConfig == 43 ){
204          if (i == 0 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_0005TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0005V0M");
205          if (i == 1 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_0510TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0510V0M");
206          if (i == 2 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_0010TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0010V0M");
207          if (i == 3 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE,fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_1020TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_1020V0M");
208           if (i == 0 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_0020TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0020V0M");
209       } else if (trainConfig == 4 ||trainConfig == 8 || trainConfig == 12 || trainConfig == 16 || trainConfig == 20 || trainConfig == 24 || trainConfig == 28 || trainConfig == 32 || trainConfig == 36 || trainConfig == 40 || trainConfig == 44 ){ 
210         if (i == 0 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_2040TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_2040V0M");
211         if (i == 1 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_4060TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4060V0M");
212         if (i == 2  && doWeighting) analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_6080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_6080V0M");
213         if (i == 3 && doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_4080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4080V0M");
214       }
215 //      if (trainConfig == 45 ||trainConfig == 47 || trainConfig == 49 || trainConfig == 51 || trainConfig == 53 || trainConfig == 55  ){
216 //          if ((i == 0 || i == 1 || i == 2)&& doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE,fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_0020TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0020V0M");
217 //          if ((i == 3 || i == 4 )&& doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE,fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_4080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4080V0M");
218 //      }
219 //      if (trainConfig == 46 ||trainConfig == 48 || trainConfig == 50 || trainConfig == 52 || trainConfig == 54 || trainConfig == 56  ){
220 //          if ((i == 0 || i == 1 || i == 2)&& doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE,fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_0020TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_0020V0M");
221 //          if ((i == 3 || i == 4 )&& doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE,fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_4080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4080V0M");
222 //      }
223 //      if (trainConfig == 57  ){
224 //          if (doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE,fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_4080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4080V0M");
225 //      }
226 //      if (trainConfig == 58){
227 //          if (doWeighting)  analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE,fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_4080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4080V0M");
228 //      }
229       analysisCuts[i]->InitializeCutsFromCutString(cutarray[i].Data());
230       ConvCutList->Add(analysisCuts[i]);
231
232       analysisCuts[i]->SetFillCutHistograms("",kFALSE);
233       analysisMesonCuts[i] = new AliConversionMesonCuts();
234       analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
235       MesonCutList->Add(analysisMesonCuts[i]);
236       analysisMesonCuts[i]->SetFillCutHistograms("");
237       analysisCuts[i]->SetAcceptedHeader(HeaderList);
238    }
239
240    task->SetConversionCutList(numberOfCuts,ConvCutList);
241    task->SetMesonCutList(numberOfCuts,MesonCutList);
242    task->SetMoveParticleAccordingToVertex(kTRUE);
243    task->SetDoMesonAnalysis(kTRUE);
244    if (enableQAMesonTask) task->SetDoMesonQA(kTRUE); //Attention new switch for Pi0 QA
245    if (enableQAPhotonTask) task->SetDoPhotonQA(kTRUE);  //Attention new switch small for Photon QA
246
247    //connect containers
248    AliAnalysisDataContainer *coutput =
249       mgr->CreateContainer(Form("GammaConvV1_%i",trainConfig), TList::Class(),
250                            AliAnalysisManager::kOutputContainer,Form("GammaConvV1_%i.root",trainConfig));
251
252    mgr->AddTask(task);
253    mgr->ConnectInput(task,0,cinput);
254    mgr->ConnectOutput(task,1,coutput);
255
256    return;
257
258 }