TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvNeutralMesonPiPlPiMiPiZero_ConvMode_pPb.C
CommitLineData
2c75809c 1void AddTask_GammaConvNeutralMesonPiPlPiMiPiZero_ConvMode_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 = 0;
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];
153 TString *ConvCutarray = new TString[numberOfCuts];
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
166 if( trainConfig == 1 ) {
2c75809c 167 // everything open, min pt charged pi = 100 MeV
3013611f 168 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; PionCutarray[0] = "000010400"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 169 } else if( trainConfig == 2 ) {
2c75809c 170 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, min pt charged pi = 100 MeV
3013611f 171 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; PionCutarray[0] = "002010700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 172 } else if( trainConfig == 3 ) {
2c75809c 173 // 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 174 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; PionCutarray[0] = "002013700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 175 } else if( trainConfig == 4 ) {
2c75809c 176 // 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 177 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035030000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 178 } else if( trainConfig == 5 ) {
2c75809c 179 // 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 180 // closing neural pion cuts, 0.1 < M_gamma,gamma < 0.145
3013611f 181 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035031000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 182 } else if( trainConfig == 6 ) {
2c75809c 183 // 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 184 // closing neural pion cuts, 0.11 < M_gamma,gamma < 0.145
3013611f 185 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035032000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 186 } else if( trainConfig == 7 ) {
2c75809c 187 // 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 188 // closing neural pion cuts, 0.12 < M_gamma,gamma < 0.145
3013611f 189 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; PionCutarray[0] = "002016700"; NeutralPionCutarray[0] = "01035033000000"; MesonCutarray[0] = "01035030000000";
42fe34e2 190 } else if( trainConfig == 8 ) {
2c75809c 191 // 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 192 // closing neural pion cuts, 0.12 < M_gamma,gamma < 0.145
3013611f 193 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; PionCutarray[0] = "002013700"; NeutralPionCutarray[0] = "01035033000000"; MesonCutarray[0] = "01035030000000";
2c75809c 194 } else if( trainConfig == 9 ) {
195 // closing charged pion cuts, minimum TPC cluster = 80, TPC dEdx pi = \pm 3 sigma, pi+pi- mass cut of 0.75, min pt charged pi = 100 MeV
196 // closing neural pion cuts, 0.1 < M_gamma,gamma < 0.145
3013611f 197 eventCutArray[ 0] = "8000011"; ConvCutarray[0] = "002000091170008260400000"; PionCutarray[0] = "002010702"; NeutralPionCutarray[0] = "01035031000000"; MesonCutarray[0] = "01035030000000";
cb287740 198 }
199
200 TList *EventCutList = new TList();
201 TList *ConvCutList = new TList();
202 TList *NeutralPionCutList = new TList();
203 TList *MesonCutList = new TList();
204 TList *PionCutList = new TList();
205
206 TList *HeaderList = new TList();
207 TObjString *Header1 = new TObjString("pi0_1");
208 HeaderList->Add(Header1);
209 TObjString *Header3 = new TObjString("eta_2");
210 HeaderList->Add(Header3);
211
212 EventCutList->SetOwner(kTRUE);
213 AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts];
214 ConvCutList->SetOwner(kTRUE);
215 AliConversionPhotonCuts **analysisCuts = new AliConversionPhotonCuts*[numberOfCuts];
216 NeutralPionCutList->SetOwner(kTRUE);
217 AliConversionMesonCuts **analysisNeutralPionCuts = new AliConversionMesonCuts*[numberOfCuts];
218 MesonCutList->SetOwner(kTRUE);
219 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
220 PionCutList->SetOwner(kTRUE);
221 AliPrimaryPionCuts **analysisPionCuts = new AliPrimaryPionCuts*[numberOfCuts];
222
223 for(Int_t i = 0; i<numberOfCuts; i++){
224 analysisEventCuts[i] = new AliConvEventCuts();
225 analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data());
226 EventCutList->Add(analysisEventCuts[i]);
227 analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
228
229 analysisCuts[i] = new AliConversionPhotonCuts();
230 if( ! analysisCuts[i]->InitializeCutsFromCutString(ConvCutarray[i].Data()) ) {
231 cout<<"ERROR: analysisCuts [" <<i<<"]"<<endl;
232 return 0;
233 } else {
234 ConvCutList->Add(analysisCuts[i]);
235 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
236
237 }
238
239 analysisNeutralPionCuts[i] = new AliConversionMesonCuts();
240 if( ! analysisNeutralPionCuts[i]->InitializeCutsFromCutString(NeutralPionCutarray[i].Data()) ) {
241 cout<<"ERROR: analysisMesonCuts [ " <<i<<" ] "<<endl;
242 return 0;
243 } else {
244 NeutralPionCutList->Add(analysisNeutralPionCuts[i]);
245 analysisNeutralPionCuts[i]->SetFillCutHistograms("");
246 }
247
248 analysisMesonCuts[i] = new AliConversionMesonCuts();
249 if( ! analysisMesonCuts[i]->InitializeCutsFromCutString(MesonCutarray[i].Data()) ) {
250 cout<<"ERROR: analysisMesonCuts [ " <<i<<" ] "<<endl;
251 return 0;
252 } else {
253 MesonCutList->Add(analysisMesonCuts[i]);
254 analysisMesonCuts[i]->SetFillCutHistograms("");
255 }
256 analysisEventCuts[i]->SetAcceptedHeader(HeaderList);
257
258 TString cutName( Form("%s_%s_%s_%s_%s",eventCutArray[i].Data(), ConvCutarray[i].Data(),PionCutarray[i].Data(),NeutralPionCutarray[i].Data(), MesonCutarray[i].Data() ) );
259 analysisPionCuts[i] = new AliPrimaryPionCuts();
260 if( !analysisPionCuts[i]->InitializeCutsFromCutString(PionCutarray[i].Data())) {
261 cout<< "ERROR: analysisPionCuts [ " <<i<<" ] "<<endl;
262 return 0;
263 } else {
264 PionCutList->Add(analysisPionCuts[i]);
265 analysisPionCuts[i]->SetFillCutHistograms("",kFALSE,cutName);
266 }
267 }
268
2c75809c 269 task->SetNeutralPionMode(0);
cb287740 270 task->SetEventCutList(numberOfCuts,EventCutList);
2c75809c 271 task->SetConversionCutList(ConvCutList);
cb287740 272 task->SetNeutralPionCutList(NeutralPionCutList);
273 task->SetMesonCutList(MesonCutList);
274 task->SetPionCutList(PionCutList);
275
276 task->SetMoveParticleAccordingToVertex(kTRUE);
277
278 if(enableQAMesonTask) task->SetDoMesonQA(kTRUE);
279
280 //connect containers
281 AliAnalysisDataContainer *coutput =
2c75809c 282 mgr->CreateContainer(Form("GammaConvNeutralMesonPiPlPiMiPiZero_%i_%i",neutralPionMode, trainConfig), TList::Class(),
283 AliAnalysisManager::kOutputContainer,Form("GammaConvNeutralMesonPiPlPiMiPiZero_%i_%i.root",neutralPionMode, trainConfig));
cb287740 284
285 mgr->AddTask(task);
286 mgr->ConnectInput(task,0,cinput);
287 mgr->ConnectOutput(task,1,coutput);
288
289 return;
290
291}