TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvDalitzV1_PbPb.C
CommitLineData
a072aeaa 1void AddTask_GammaConvDalitzV1_PbPb( Int_t trainConfig = 1,
3c26fed2 2 Bool_t isMC = kFALSE, //run MC
3 Bool_t enableQAMesonTask = kFALSE, //enable QA in AliAnalysisTaskGammaConvDalitzV1
4 Bool_t enableDoMesonChic = kFALSE, // enable additional Chic analysis
5 TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
6 Bool_t doWeighting = kFALSE, //enable Weighting
7 TString cutnumberAODBranch = "0000000060084001001500000"
8 ) {
9
10
11
12 cout<<"Entro -1"<<endl;
13
14 // ================= Load Librariers =================================
230b7aff 15 gSystem->Load("libCore");
16 gSystem->Load("libTree");
17 gSystem->Load("libGeom");
18 gSystem->Load("libVMC");
19 gSystem->Load("libPhysics");
3c26fed2 20 gSystem->Load("libMinuit");
21 gSystem->Load("libSTEERBase");
22 gSystem->Load("libESD");
23 gSystem->Load("libAOD");
24 gSystem->Load("libANALYSIS");
25 gSystem->Load("libANALYSISalice");
230b7aff 26 gSystem->Load("libPWGGAGammaConv");
27 gSystem->Load("libCDB");
28 gSystem->Load("libSTEER");
29 gSystem->Load("libSTEERBase");
30 gSystem->Load("libTender");
31 gSystem->Load("libTenderSupplies");
80dde3ee 32
33 Int_t isHeavyIon = 1;
3c26fed2 34
35
36 cout<<"Entro 0"<<endl;
39e8c2ce 37
3c26fed2 38 // ================== GetAnalysisManager ===============================
39 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
40 if (!mgr) {
41 Error(Form("AddTask_GammaConvDalitzV1_PbPb_%i",trainConfig), "No analysis manager found.");
42 return ;
43 }
44
45 // ================== GetInputEventHandler =============================
46 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
47
48 //========= Add PID Reponse to ANALYSIS manager ====
49 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
50 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
51 AddTaskPIDResponse(isMC);
52 }
53
54 //========= Set Cutnumber for V0Reader ================================
80dde3ee 55
3013611f 56 TString cutnumberPhoton = "000000084001001500000000";
80dde3ee 57 TString cutnumberEvent = "1000000";
58 TString ElecCuts = "90006200000002000000"; //Electron Cuts
59
3c26fed2 60
61
62 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
63
64 //========= Add V0 Reader to ANALYSIS manager if not yet existent =====
65 if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
80dde3ee 66 AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
67
68 fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
69 fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
70 fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
71
72 if (!mgr) {
73 Error("AddTask_V0ReaderV1", "No analysis manager found.");
74 return;
75 }
76
77 AliConvEventCuts *fEventCuts=NULL;
78 if(cutnumberEvent!=""){
79 fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data());
80 fEventCuts->SetPreSelectionCutFlag(kTRUE);
81 if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){
82 fV0ReaderV1->SetEventCuts(fEventCuts);
83 fEventCuts->SetFillCutHistograms("",kTRUE);
84 }
85 }
86
87
88 // Set AnalysisCut Number
89 AliConversionPhotonCuts *fCuts=NULL;
90 if(cutnumberPhoton!=""){
91 fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data());
92 fCuts->SetPreSelectionCutFlag(kTRUE);
93 fCuts->SetIsHeavyIon(isHeavyIon);
94 if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){
95 fV0ReaderV1->SetConversionCuts(fCuts);
96 fCuts->SetFillCutHistograms("",kTRUE);
97 }
98 }
99
100 if(inputHandler->IsA()==AliAODInputHandler::Class()){
101 // AOD mode
102 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
103 }
104 fV0ReaderV1->Init();
105
106 AliLog::SetGlobalLogLevel(AliLog::kInfo);
107
108 //connect input V0Reader
109 mgr->AddTask(fV0ReaderV1);
110 mgr->ConnectInput(fV0ReaderV1,0,cinput);
111
112 }
3c26fed2 113
114 //================================================
115 //========= Add Electron Selector ================
116
117
118 if( !(AliDalitzElectronSelector*)mgr->GetTask("ElectronSelector") ){
119
120 AliDalitzElectronSelector *fElectronSelector = new AliDalitzElectronSelector("ElectronSelector");
121
122 // Set AnalysisCut Number
123 AliDalitzElectronCuts *fElecCuts=0;
124
125 if( ElecCuts!=""){
126 fElecCuts= new AliDalitzElectronCuts(ElecCuts.Data(),ElecCuts.Data());
127 if(fElecCuts->InitializeCutsFromCutString(ElecCuts.Data())){
128 fElectronSelector->SetDalitzElectronCuts(fElecCuts);
129 fElecCuts->SetFillCutHistograms("",kTRUE);
130 }
131 }
132
133 fElectronSelector->Init();
134 mgr->AddTask(fElectronSelector);
135
136 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
137 //connect input V0Reader
138 mgr->ConnectInput (fElectronSelector,0,cinput1);
139 }
140
141
142
143 cout<<"Entro"<<endl;
144 //================================================
145 //========= Add task to the ANALYSIS manager =====
146 //================================================
147 // find input container
148
149
150
151 AliAnalysisTaskGammaConvDalitzV1 *task=NULL;
152 task= new AliAnalysisTaskGammaConvDalitzV1(Form("GammaConvDalitzV1_%i",trainConfig));
153 task->SetIsHeavyIon(1);
154 task->SetIsMC(isMC);
155
156
157
158 // Cut Numbers to use in Analysis
159 Int_t numberOfCuts = 3;
160
80dde3ee 161 TString *eventCutArray = new TString[numberOfCuts];
162 TString *photonCutArray = new TString[numberOfCuts];
163 TString *ElecCutarray = new TString[numberOfCuts];
164 TString *MesonCutarray = new TString[numberOfCuts];
3c26fed2 165
49af2ef8 166 if ( trainConfig == 1 ) {
90b8ce7e 167
3013611f 168 eventCutArray[0]="1240001"; photonCutArray[0] = "042000092971007200000000"; MesonCutarray[0] = "01522045009000"; ElecCutarray[0] = "90516200255102521700"; //PbPb 20-40% kAny
169 eventCutArray[1]="1460001"; photonCutArray[1] = "042000092971007200000000"; MesonCutarray[1] = "01522045009000"; ElecCutarray[1] = "90516200255102521700"; //PbPb 40-60% kAny
170 eventCutArray[2]="1680001"; photonCutArray[2] = "042000092971007200000000"; MesonCutarray[2] = "01522045009000"; ElecCutarray[2] = "90516200255102521700"; //PbPb 60-80% kAny
90b8ce7e 171
49af2ef8 172 } else if ( trainConfig == 2 ) {
90b8ce7e 173
3013611f 174 eventCutArray[0]="5240001"; photonCutArray[0] = "042000092971003220000000"; MesonCutarray[0] = "01522085009000"; ElecCutarray[0] = "90516200255102521700"; //PbPb 20-40% kAny Alpha cut 0.6
175 eventCutArray[1]="5460001"; photonCutArray[1] = "042000092971001200000000"; MesonCutarray[1] = "01522065009000"; ElecCutarray[1] = "90516200255102521700"; //PbPb 40-60% kAny Alpha cut 0.8
176 eventCutArray[2]="5680001"; photonCutArray[2] = "042000092971001200000000"; MesonCutarray[2] = "01522075009000"; ElecCutarray[2] = "90516200255102521700"; //PbPb 60-80% kAny Alpha cut 0.85
c9663716 177
178 } else if ( trainConfig == 3 ) {
90b8ce7e 179
3013611f 180 eventCutArray[0]="5240001"; photonCutArray[0] = "042000092971003220000000"; MesonCutarray[0] = "01522085009000"; ElecCutarray[0] = "90516200255102521710"; //PbPb 20-40% kAny Alpha cut 0.6
181 eventCutArray[1]="5460001"; photonCutArray[1] = "042000092971001200000000"; MesonCutarray[1] = "01522065009000"; ElecCutarray[1] = "90516200255102521710"; //PbPb 40-60% kAny Alpha cut 0.8
182 eventCutArray[2]="5680001"; photonCutArray[2] = "042000092971001200000000"; MesonCutarray[2] = "01522075009000"; ElecCutarray[2] = "90516200255102521710"; //PbPb 60-80% kAny Alpha cut 0.85
90b8ce7e 183
184 } else if ( trainConfig == 4 ) {
185
3013611f 186 eventCutArray[0]="5240002"; photonCutArray[0] = "032000092971003220000000"; MesonCutarray[0] = "01523015009000"; ElecCutarray[0] = "90516200255102521710"; //PbPb 20-40% kAny Gamma |Eta| < 0.65 only added signals alpha cut Pt dependent ( 0.7, 1.2)
187 eventCutArray[1]="5460002"; photonCutArray[1] = "032000092971001200000000"; MesonCutarray[1] = "01523015009000"; ElecCutarray[1] = "90516200255102521710"; //PbPb 40-60% kAny Gamma |Eta| < 0.65 only added signals alpha cut Pt dependent ( 0.7, 1.2)
188 eventCutArray[2]="5680002"; photonCutArray[2] = "032000092971001200000000"; MesonCutarray[2] = "01523025009000"; ElecCutarray[2] = "90516200255102521710"; //PbPb 60-80% kAny Gamma |Eta| < 0.80 only added signals alpha cut Pt dependent ( 0.80, 1.2)
90b8ce7e 189
190 } else if ( trainConfig == 5 ) {
191
3013611f 192 eventCutArray[0]="5240001"; photonCutArray[0] = "032000092971003220000000"; MesonCutarray[0] = "01523015009000"; ElecCutarray[0] = "90516200255102521710"; //PbPb 20-40% kAny Gamma |Eta| < 0.65 alpha cut Pt dependent ( 0.7, 1.2)
193 eventCutArray[1]="5460001"; photonCutArray[1] = "032000092971001200000000"; MesonCutarray[1] = "01523015009000"; ElecCutarray[1] = "90516200255102521710"; //PbPb 40-60% kAny Gamma |Eta| < 0.65 alpha cut Pt dependent ( 0.7, 1.2)
194 eventCutArray[2]="5680001"; photonCutArray[2] = "032000092971001200000000"; MesonCutarray[2] = "01523025009000"; ElecCutarray[2] = "90516200255102521710"; //PbPb 60-80% kAny Gamma |Eta| < 0.65 alpha cut Pt dependent ( 0.8, 1.2)
49af2ef8 195 } else if ( trainConfig == 6 ) {
196
3013611f 197 eventCutArray[0]="5240002"; photonCutArray[0] = "032000092971003220000000"; MesonCutarray[0] = "01523095009000"; ElecCutarray[0] = "90516200255102521710"; //PbPb 20-40% kAny Gamma |Eta| < 0.65 only added signals alpha cut Pt dependent( 0.65, 1.2)
198 eventCutArray[1]="5460002"; photonCutArray[1] = "032000092971001200000000"; MesonCutarray[1] = "01523095009000"; ElecCutarray[1] = "90516200255102521710"; //PbPb 40-60% kAny Gamma |Eta| < 0.65 only added signals alpha cut Pt dependent( 0.65, 1.2)
199 eventCutArray[2]="5680002"; photonCutArray[2] = "032000092971001200000000"; MesonCutarray[2] = "01523025009000"; ElecCutarray[2] = "90516200255102521710"; //PbPb 60-80% kAny Gamma |Eta| < 0.80 only added signals alpha cut Pt dependent( 0.80, 1.2)
49af2ef8 200
201 } else if ( trainConfig == 7 ) {
202
3013611f 203 eventCutArray[0]="5240001"; photonCutArray[0] = "032000092971003220000000"; MesonCutarray[0] = "01523095009000"; ElecCutarray[0] = "90516200255102521710"; //PbPb 20-40% kAny Gamma |Eta| < 0.65 alpha cut Pt dependent ( 0.65, 1.2)
204 eventCutArray[1]="5460001"; photonCutArray[1] = "032000092971001200000000"; MesonCutarray[1] = "01523095009000"; ElecCutarray[1] = "90516200255102521710"; //PbPb 40-60% kAny Gamma |Eta| < 0.65 alpha cut Pt dependent ( 0.65, 1.2)
205 eventCutArray[2]="5680001"; photonCutArray[2] = "032000092971001200000000"; MesonCutarray[2] = "01523025009000"; ElecCutarray[2] = "90516200255102521710"; //PbPb 60-80% kAny Gamma |Eta| < 0.65 alpha cut Pt dependent ( 0.80, 1.2)
c9663716 206 }
3c26fed2 207
208
80dde3ee 209 TList *EventCutList = new TList();
3c26fed2 210 TList *ConvCutList = new TList();
211 TList *MesonCutList = new TList();
212 TList *ElecCutList = new TList();
213
214 TList *HeaderList = new TList();
215 TObjString *Header1 = new TObjString("pi0_1");
216 HeaderList->Add(Header1);
217
218 //TObjString *Header3 = new TObjString("eta_2");
219 //HeaderList->Add(Header3);
220
80dde3ee 221 EventCutList->SetOwner(kTRUE);
222 AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts];
223
3c26fed2 224 ConvCutList->SetOwner(kTRUE);
80dde3ee 225 AliConversionPhotonCuts **analysisCuts = new AliConversionPhotonCuts*[numberOfCuts];
3c26fed2 226
227 MesonCutList->SetOwner(kTRUE);
228 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
229
230 ElecCutList->SetOwner(kTRUE);
231 AliDalitzElectronCuts **analysisElecCuts = new AliDalitzElectronCuts*[numberOfCuts];
232
233
234
235 for(Int_t i = 0; i<numberOfCuts; i++){
80dde3ee 236
237 analysisEventCuts[i] = new AliConvEventCuts();
238
239 if( trainConfig == 1){
240 if (i == 0 && doWeighting) analysisEventCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_2040V0M", "", "","Pi0_Fit_Data_PbPb_2760GeV_2040V0M");
241 if (i == 1 && doWeighting) analysisEventCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_4060V0M", "", "","Pi0_Fit_Data_PbPb_2760GeV_4060V0M");
242 if (i == 2 && doWeighting) analysisEventCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_6080V0M", "", "","Pi0_Fit_Data_PbPb_2760GeV_6080V0M");
243 } else if ( trainConfig == 2 || trainConfig == 3 || trainConfig == 5 || trainConfig == 7 ) {
244 if (i == 0 && doWeighting) analysisEventCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_2040TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_2040V0M");
245 if (i == 1 && doWeighting) analysisEventCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_4060TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4060V0M");
246 if (i == 2 && doWeighting) analysisEventCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_PbPb_2760GeV_6080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_6080V0M");
247 } else if ( trainConfig == 4 || trainConfig == 6 ) {
248 if (i == 0 && doWeighting) analysisEventCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_2040TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_2040V0M");
249 if (i == 1 && doWeighting) analysisEventCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_4060TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_4060V0M");
250 if (i == 2 && doWeighting) analysisEventCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kFALSE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13d2_addSig_PbPb_2760GeV_6080TPC", "", "","Pi0_Fit_Data_PbPb_2760GeV_6080V0M");
251 }
252
253
254 if( ! analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data()) ) {
255 cout<<"ERROR: analysisEventCuts [" <<i<<"]"<<endl;
256 return 0;
257 }
258 EventCutList->Add(analysisEventCuts[i]);
259 analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
260
261
262 analysisCuts[i] = new AliConversionPhotonCuts();
263 if( ! analysisCuts[i]->InitializeCutsFromCutString(photonCutArray[i].Data()) ) {
3c26fed2 264 cout<<"ERROR: analysisCuts [" <<i<<"]"<<endl;
265 return 0;
80dde3ee 266 }
267 ConvCutList->Add(analysisCuts[i]);
268 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
269
270
3c26fed2 271 analysisMesonCuts[i] = new AliConversionMesonCuts();
272 if( ! analysisMesonCuts[i]->InitializeCutsFromCutString(MesonCutarray[i].Data()) ) {
273 cout<<"ERROR: analysisMesonCuts [ " <<i<<" ] "<<endl;
274 return 0;
275 } else {
276 MesonCutList->Add(analysisMesonCuts[i]);
277 analysisMesonCuts[i]->SetFillCutHistograms("");
278 }
279
80dde3ee 280 TString cutName( Form("%s_%s_%s_%s",eventCutArray[i].Data(),photonCutArray[i].Data(),ElecCutarray[i].Data(),MesonCutarray[i].Data() ) );
3c26fed2 281 analysisElecCuts[i] = new AliDalitzElectronCuts();
282 if( !analysisElecCuts[i]->InitializeCutsFromCutString(ElecCutarray[i].Data())) {
283 cout<< "ERROR: analysisElecCuts [ " <<i<<" ] "<<endl;
284 return 0;
285 } else {
286 ElecCutList->Add(analysisElecCuts[i]);
287 analysisElecCuts[i]->SetFillCutHistograms("",kFALSE,cutName);
288 }
80dde3ee 289 analysisEventCuts[i]->SetAcceptedHeader(HeaderList);
3c26fed2 290
291 }
292
80dde3ee 293 task->SetEventCutList(numberOfCuts,EventCutList);
3c26fed2 294 task->SetConversionCutList(numberOfCuts,ConvCutList);
295 task->SetMesonCutList(MesonCutList);
296 task->SetElectronCutList(ElecCutList);
297
298 task->SetMoveParticleAccordingToVertex(kTRUE);
299
300
301 if(enableQAMesonTask) task->SetDoMesonQA(kTRUE);
302 if(enableDoMesonChic) task->SetDoChicAnalysis(kTRUE);
303
304 //connect containers
305 AliAnalysisDataContainer *coutput =
306 mgr->CreateContainer(Form("GammaConvDalitzV1_%i",trainConfig), TList::Class(),
307 AliAnalysisManager::kOutputContainer,Form("GammaConvV1Dalitz_%i.root",trainConfig));
308
309 mgr->AddTask(task);
310 mgr->ConnectInput(task,0,cinput);
311 mgr->ConnectOutput(task,1,coutput);
312
313 return;
39e8c2ce 314}