- fixed for Omega task, updates for pp 8 TeV running
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvNeutralMesonPiPlPiMiPiZero_pp.C
CommitLineData
b5d519c0 1void AddTask_GammaConvNeutralMesonPiPlPiMiPiZero_pp(
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 = "Pythia",
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");
23 gSystem->Load("libPWGGAGammaConv.so");
24 gSystem->Load("libCDB.so");
25 gSystem->Load("libSTEER.so");
26 gSystem->Load("libSTEERBase.so");
27 gSystem->Load("libTENDER.so");
28 gSystem->Load("libTENDERSupplies.so");
29
30 Int_t isHeavyIon = 2;
31
32 // ================== GetAnalysisManager ===============================
33 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
34 if (!mgr) {
35 Error(Form("AddTask_GammaConvNeutralMesonPiPlPiMiPiZero_pPb_%i",trainConfig), "No analysis manager found.");
36 return ;
37 }
38
39 // ================== GetInputEventHandler =============================
40 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
41
42 //========= Add PID Reponse to ANALYSIS manager ====
43 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
44 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
45 AddTaskPIDResponse(isMC);
46 }
47
48 //========= Set Cutnumber for V0Reader ================================
49 TString cutnumberPhoton = "060084001001500000000";
50 TString cutnumberEvent = "0000000";
51 TString PionCuts = "000000200"; //Electron Cuts
52
53 Bool_t doEtaShift = kFALSE;
54
55 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
56
57 //========= Add V0 Reader to ANALYSIS manager if not yet existent =====
58 if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
59 AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
60
61 fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
62 fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
63 fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
64
65 if (!mgr) {
66 Error("AddTask_V0ReaderV1", "No analysis manager found.");
67 return;
68 }
69
70 AliConvEventCuts *fEventCuts=NULL;
71 if(cutnumberEvent!=""){
72 fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data());
73 fEventCuts->SetPreSelectionCutFlag(kTRUE);
74 if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){
75 fEventCuts->DoEtaShift(doEtaShift);
76 fV0ReaderV1->SetEventCuts(fEventCuts);
77 fEventCuts->SetFillCutHistograms("",kTRUE);
78 }
79 }
80
81 // Set AnalysisCut Number
82 AliConversionPhotonCuts *fCuts=NULL;
83 if(cutnumberPhoton!=""){
84 fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data());
85 fCuts->SetPreSelectionCutFlag(kTRUE);
86 fCuts->SetIsHeavyIon(isHeavyIon);
87 if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){
88 fV0ReaderV1->SetConversionCuts(fCuts);
89 fCuts->SetFillCutHistograms("",kTRUE);
90 }
91 }
92
93 if(inputHandler->IsA()==AliAODInputHandler::Class()){
94 // AOD mode
95 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
96 }
97 fV0ReaderV1->Init();
98
99 AliLog::SetGlobalLogLevel(AliLog::kInfo);
100
101 //connect input V0Reader
102 mgr->AddTask(fV0ReaderV1);
103 mgr->ConnectInput(fV0ReaderV1,0,cinput);
104 }
105
106 //================================================
107 //========= Add Electron Selector ================
108
109
110 if( !(AliPrimaryPionSelector*)mgr->GetTask("PionSelector") ){
111
112 AliPrimaryPionSelector *fPionSelector = new AliPrimaryPionSelector("PionSelector");
113 // Set AnalysisCut Number
114
115 AliPrimaryPionCuts *fPionCuts=0;
116 if( PionCuts!=""){
117 fPionCuts= new AliPrimaryPionCuts(PionCuts.Data(),PionCuts.Data());
118 if(fPionCuts->InitializeCutsFromCutString(PionCuts.Data())){
119 fPionSelector->SetPrimaryPionCuts(fPionCuts);
120 fPionCuts->SetFillCutHistograms("",kTRUE);
121
122 }
123 }
124
125 fPionSelector->Init();
126 mgr->AddTask(fPionSelector);
127
128 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
129
130 //connect input V0Reader
131 mgr->ConnectInput (fPionSelector,0,cinput1);
132
133 }
134
135
136
137 AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero *task=NULL;
138
139 task= new AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero(Form("GammaConvNeutralMesonPiPlPiMiPiZero_%i",trainConfig));
140
141 task->SetIsHeavyIon(2);
142 task->SetIsMC(isMC);
143
144 // Cut Numbers to use in Analysis
145 Int_t numberOfCuts = 1;
146
147 TString *eventCutArray = new TString[numberOfCuts];
148 TString *ConvCutarray = new TString[numberOfCuts];
149 TString *PionCutarray = new TString[numberOfCuts];
150 TString *NeutralPionCutarray = new TString[numberOfCuts];
151 TString *MesonCutarray = new TString[numberOfCuts];
152
153 Bool_t doEtaShiftIndCuts = kFALSE;
154 TString stringShift = "";
155
156 // Shifting in pPb direction
157
158 doEtaShiftIndCuts = kTRUE;
159 stringShift = "pPb";
160
161 if( trainConfig == 1 ) {
162 eventCutArray[ 0] = "0000010"; ConvCutarray[0] = "002091170008260400000"; PionCutarray[0] = "000000400"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
163 } else if( trainConfig == 2 ) {
164 eventCutArray[ 0] = "0000010"; ConvCutarray[0] = "002091170008260400000"; PionCutarray[0] = "002000700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
165 } else if( trainConfig == 3 ) {
166 eventCutArray[ 0] = "0000010"; ConvCutarray[0] = "002091170008260400000"; PionCutarray[0] = "002003700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
167 } else if( trainConfig == 4 ) {
168 eventCutArray[ 0] = "0000010"; ConvCutarray[0] = "002091170008260400000"; PionCutarray[0] = "002006700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
169 } else if( trainConfig == 5 ) {
170 eventCutArray[ 0] = "0000010"; ConvCutarray[0] = "002091170008260400000"; PionCutarray[0] = "002006700"; NeutralPionCutarray[0] = "01035031000000"; MesonCutarray[0] = "01035030000000";
171 } else if( trainConfig == 6 ) {
172 eventCutArray[ 0] = "0000010"; ConvCutarray[0] = "002091170008260400000"; PionCutarray[0] = "002006700"; NeutralPionCutarray[0] = "01035032000000"; MesonCutarray[0] = "01035030000000";
173 } else if( trainConfig == 7 ) {
174 eventCutArray[ 0] = "0000010"; ConvCutarray[0] = "002091170008260400000"; PionCutarray[0] = "002006700"; NeutralPionCutarray[0] = "01035033000000"; MesonCutarray[0] = "01035030000000";
175 } else if( trainConfig == 8 ) {
176 eventCutArray[ 0] = "0000010"; ConvCutarray[0] = "002091170008260400000"; PionCutarray[0] = "002003700"; NeutralPionCutarray[0] = "01035033000000"; MesonCutarray[0] = "01035030000000";
177 }
178
179 TList *EventCutList = new TList();
180 TList *ConvCutList = new TList();
181 TList *NeutralPionCutList = new TList();
182 TList *MesonCutList = new TList();
183 TList *PionCutList = new TList();
184
185 TList *HeaderList = new TList();
186 TObjString *Header1 = new TObjString("pi0_1");
187 HeaderList->Add(Header1);
188 TObjString *Header3 = new TObjString("eta_2");
189 HeaderList->Add(Header3);
190
191 EventCutList->SetOwner(kTRUE);
192 AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts];
193 ConvCutList->SetOwner(kTRUE);
194 AliConversionPhotonCuts **analysisCuts = new AliConversionPhotonCuts*[numberOfCuts];
195 NeutralPionCutList->SetOwner(kTRUE);
196 AliConversionMesonCuts **analysisNeutralPionCuts = new AliConversionMesonCuts*[numberOfCuts];
197 MesonCutList->SetOwner(kTRUE);
198 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
199 PionCutList->SetOwner(kTRUE);
200 AliPrimaryPionCuts **analysisPionCuts = new AliPrimaryPionCuts*[numberOfCuts];
201
202 for(Int_t i = 0; i<numberOfCuts; i++){
203 analysisEventCuts[i] = new AliConvEventCuts();
204 analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data());
205 EventCutList->Add(analysisEventCuts[i]);
206 analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
207
208 analysisCuts[i] = new AliConversionPhotonCuts();
209 if( ! analysisCuts[i]->InitializeCutsFromCutString(ConvCutarray[i].Data()) ) {
210 cout<<"ERROR: analysisCuts [" <<i<<"]"<<endl;
211 return 0;
212 } else {
213 ConvCutList->Add(analysisCuts[i]);
214 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
215
216 }
217
218 analysisNeutralPionCuts[i] = new AliConversionMesonCuts();
219 if( ! analysisNeutralPionCuts[i]->InitializeCutsFromCutString(NeutralPionCutarray[i].Data()) ) {
220 cout<<"ERROR: analysisMesonCuts [ " <<i<<" ] "<<endl;
221 return 0;
222 } else {
223 NeutralPionCutList->Add(analysisNeutralPionCuts[i]);
224 analysisNeutralPionCuts[i]->SetFillCutHistograms("");
225 }
226
227 analysisMesonCuts[i] = new AliConversionMesonCuts();
228 if( ! analysisMesonCuts[i]->InitializeCutsFromCutString(MesonCutarray[i].Data()) ) {
229 cout<<"ERROR: analysisMesonCuts [ " <<i<<" ] "<<endl;
230 return 0;
231 } else {
232 MesonCutList->Add(analysisMesonCuts[i]);
233 analysisMesonCuts[i]->SetFillCutHistograms("");
234 }
235 analysisEventCuts[i]->SetAcceptedHeader(HeaderList);
236
237 TString cutName( Form("%s_%s_%s_%s_%s",eventCutArray[i].Data(), ConvCutarray[i].Data(),PionCutarray[i].Data(),NeutralPionCutarray[i].Data(), MesonCutarray[i].Data() ) );
238 analysisPionCuts[i] = new AliPrimaryPionCuts();
239 if( !analysisPionCuts[i]->InitializeCutsFromCutString(PionCutarray[i].Data())) {
240 cout<< "ERROR: analysisPionCuts [ " <<i<<" ] "<<endl;
241 return 0;
242 } else {
243 PionCutList->Add(analysisPionCuts[i]);
244 analysisPionCuts[i]->SetFillCutHistograms("",kFALSE,cutName);
245 }
246 }
247
248 task->SetEventCutList(numberOfCuts,EventCutList);
249 task->SetConversionCutList(numberOfCuts,ConvCutList);
250 task->SetNeutralPionCutList(NeutralPionCutList);
251 task->SetMesonCutList(MesonCutList);
252 task->SetPionCutList(PionCutList);
253
254 task->SetMoveParticleAccordingToVertex(kTRUE);
255
256 if(enableQAMesonTask) task->SetDoMesonQA(kTRUE);
257
258 //connect containers
259 AliAnalysisDataContainer *coutput =
260 mgr->CreateContainer(Form("GammaConvNeutralMesonPiPlPiMiPiZero_%i",trainConfig), TList::Class(),
261 AliAnalysisManager::kOutputContainer,Form("GammaConvNeutralMesonPiPlPiMiPiZero_%i.root",trainConfig));
262
263 mgr->AddTask(task);
264 mgr->ConnectInput(task,0,cinput);
265 mgr->ConnectOutput(task,1,coutput);
266
267 return;
268
269}