TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvV1_PbPb2.C
CommitLineData
39e8c2ce 1void AddTask_GammaConvV1_PbPb2( Int_t trainConfig = 1, //change different set of cuts
2 Bool_t isMC = kFALSE, //run MC
ae4f2cfb 3 Int_t enableQAMesonTask = 0, //enable QA in AliAnalysisTaskGammaConvV1
4 Int_t enableQAPhotonTask = 0, // enable additional QA task
39e8c2ce 5 TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
6 Bool_t doWeighting = kFALSE, //enable Weighting
7 TString cutnumberAODBranch = "1000000060084000001500000"
8 ) {
9
344100c4 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");
344100c4 22 gSystem->Load("libCDB.so");
23 gSystem->Load("libSTEER.so");
24 gSystem->Load("libSTEERBase.so");
af472fff 25 gSystem->Load("libTender.so");
26 gSystem->Load("libTenderSupplies.so");
4e1b9acf 27 gSystem->Load("libPWGflowBase.so");
28 gSystem->Load("libPWGflowTasks.so");
29 gSystem->Load("libPWGGAGammaConv.so");
344100c4 30
31 Int_t isHeavyIon = 1;
32
33 // ================== GetAnalysisManager ===============================
34 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
35 if (!mgr) {
36 Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found.");
37 return ;
38 }
39
40 // ================== GetInputEventHandler =============================
41 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
42
43 //========= Add PID Reponse to ANALYSIS manager ====
44 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
45 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
46 AddTaskPIDResponse(isMC);
47 }
48
49 //========= Set Cutnumber for V0Reader ================================
48a2b226 50 TString cutnumberPhoton = "000000084001001500000000";
344100c4 51 TString cutnumberEvent = "1000000";
52 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
53 //========= Add V0 Reader to ANALYSIS manager if not yet existent =====
54 if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
55 AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
56
57 fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
58 fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
59 fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
60
61 if (!mgr) {
62 Error("AddTask_V0ReaderV1", "No analysis manager found.");
63 return;
64 }
65
66 AliConvEventCuts *fEventCuts=NULL;
67 if(cutnumberEvent!=""){
68 fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data());
69 fEventCuts->SetPreSelectionCutFlag(kTRUE);
70 if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){
71 fV0ReaderV1->SetEventCuts(fEventCuts);
72 fEventCuts->SetFillCutHistograms("",kTRUE);
73 }
74 }
75
76 // Set AnalysisCut Number
77 AliConversionPhotonCuts *fCuts=NULL;
78 if(cutnumberPhoton!=""){
79 fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data());
80 fCuts->SetPreSelectionCutFlag(kTRUE);
81 fCuts->SetIsHeavyIon(isHeavyIon);
82 if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){
83 fV0ReaderV1->SetConversionCuts(fCuts);
84 fCuts->SetFillCutHistograms("",kTRUE);
85 }
86 }
87
88 if(inputHandler->IsA()==AliAODInputHandler::Class()){
89 // AOD mode
90 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
91 }
92 fV0ReaderV1->Init();
93
94 AliLog::SetGlobalLogLevel(AliLog::kInfo);
95
96 //connect input V0Reader
97 mgr->AddTask(fV0ReaderV1);
98 mgr->ConnectInput(fV0ReaderV1,0,cinput);
99
100 }
101
102 //================================================
103 //========= Add task to the ANALYSIS manager =====
104 //================================================
105 AliAnalysisTaskGammaConvV1 *task=NULL;
106 task= new AliAnalysisTaskGammaConvV1(Form("GammaConvV1_%i",trainConfig));
107 task->SetIsHeavyIon(isHeavyIon);
108 task->SetIsMC(isMC);
109 // Cut Numbers to use in Analysis
110 Int_t numberOfCuts = 1;
111
112 TString *eventCutArray = new TString[numberOfCuts];
113 TString *photonCutArray = new TString[numberOfCuts];
114 TString *mesonCutArray = new TString[numberOfCuts];
115
116 if (trainConfig == 1){
48a2b226 117 eventCutArray[ 0] = "6010001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522045009000";
344100c4 118 } else if (trainConfig == 2) {
48a2b226 119 eventCutArray[ 0] = "6120001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522045009000";
344100c4 120 } else if (trainConfig == 3) {
48a2b226 121 eventCutArray[ 0] = "5010001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522045009000";
344100c4 122 } else if (trainConfig == 4) {
48a2b226 123 eventCutArray[ 0] = "5020001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522045009000";
344100c4 124 } else if (trainConfig == 5) {
48a2b226 125 eventCutArray[ 0] = "5120001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522045009000";
344100c4 126 } else if (trainConfig == 6) {
48a2b226 127 eventCutArray[ 0] = "5240001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522045009000";
344100c4 128 } else if (trainConfig == 7) {
48a2b226 129 eventCutArray[ 0] = "5460001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522065009000";
344100c4 130 } else if (trainConfig == 8) {
48a2b226 131 eventCutArray[ 0] = "5480001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522065009000";
344100c4 132 } else if (trainConfig == 9) {
48a2b226 133 eventCutArray[ 0] = "5450001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522065009000";
344100c4 134 } else if (trainConfig == 10) {
48a2b226 135 eventCutArray[ 0] = "5560001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522065009000";
344100c4 136 } else if (trainConfig == 11) {
48a2b226 137 eventCutArray[ 0] = "5680001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522065009000";
344100c4 138 } else if (trainConfig == 12) {
48a2b226 139 eventCutArray[ 0] = "5670001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522065009000";
344100c4 140 } else if (trainConfig == 13) {
48a2b226 141 eventCutArray[ 0] = "5780001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522065009000";
344100c4 142 } else if (trainConfig == 14) {
48a2b226 143 eventCutArray[ 0] = "4690001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522065009000";
344100c4 144 } else if (trainConfig == 15) {
48a2b226 145 eventCutArray[ 0] = "5890001"; photonCutArray[ 0] = "042000092970023220000000"; mesonCutArray[ 0] = "01522065009000";
344100c4 146 } else if (trainConfig == 16){
48a2b226 147 eventCutArray[ 0] = "6010001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 148 } else if (trainConfig == 17) {
48a2b226 149 eventCutArray[ 0] = "6120001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 150 } else if (trainConfig == 18) {
48a2b226 151 eventCutArray[ 0] = "5010001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 152 } else if (trainConfig == 19) {
48a2b226 153 eventCutArray[ 0] = "5020001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 154 } else if (trainConfig == 20) {
48a2b226 155 eventCutArray[ 0] = "5120001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 156 } else if (trainConfig == 21) {
48a2b226 157 eventCutArray[ 0] = "5240001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 158 } else if (trainConfig == 22) {
48a2b226 159 eventCutArray[ 0] = "5460001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 160 } else if (trainConfig == 23) {
48a2b226 161 eventCutArray[ 0] = "5480001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 162 } else if (trainConfig == 24) {
48a2b226 163 eventCutArray[ 0] = "5450001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 164 } else if (trainConfig == 25) {
48a2b226 165 eventCutArray[ 0] = "5560001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 166 } else if (trainConfig == 26) {
48a2b226 167 eventCutArray[ 0] = "5680001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 168 } else if (trainConfig == 27) {
48a2b226 169 eventCutArray[ 0] = "5670001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 170 } else if (trainConfig == 28) {
48a2b226 171 eventCutArray[ 0] = "5780001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 172 } else if (trainConfig == 29) {
48a2b226 173 eventCutArray[ 0] = "4690001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 174 } else if (trainConfig == 30) {
48a2b226 175 eventCutArray[ 0] = "5890001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 176 } else if (trainConfig == 31) {
48a2b226 177 eventCutArray[ 0] = "5080001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 178 } else if (trainConfig == 32) {
48a2b226 179 eventCutArray[ 0] = "5250001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 180 } else if (trainConfig == 33) {
48a2b226 181 eventCutArray[ 0] = "5350001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 182 } else if (trainConfig == 34) {
48a2b226 183 eventCutArray[ 0] = "5450001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 184 } else if (trainConfig == 35) {
48a2b226 185 eventCutArray[ 0] = "5340001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
344100c4 186 } else if (trainConfig == 36) {
48a2b226 187 eventCutArray[ 0] = "5230001"; photonCutArray[ 0] = "002000092970028250400000"; mesonCutArray[ 0] = "01525065000000";
7e6c9796 188 } else {
344100c4 189 Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
190 return;
191 }
192
193 TList *EventCutList = new TList();
194 TList *ConvCutList = new TList();
195 TList *MesonCutList = new TList();
196
197 TList *HeaderList = new TList();
198 TObjString *Header1 = new TObjString("BOX");
199 HeaderList->Add(Header1);
200 // TObjString *Header3 = new TObjString("eta_2");
201 // HeaderList->Add(Header3);
202
203 EventCutList->SetOwner(kTRUE);
204 AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts];
205 ConvCutList->SetOwner(kTRUE);
206 AliConversionPhotonCuts **analysisCuts = new AliConversionPhotonCuts*[numberOfCuts];
207 MesonCutList->SetOwner(kTRUE);
208 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
209
210 for(Int_t i = 0; i<numberOfCuts; i++){
211 analysisEventCuts[i] = new AliConvEventCuts();
212 analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data());
213 EventCutList->Add(analysisEventCuts[i]);
214 analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
215
216 analysisCuts[i] = new AliConversionPhotonCuts();
217 analysisCuts[i]->InitializeCutsFromCutString(photonCutArray[i].Data());
218 ConvCutList->Add(analysisCuts[i]);
219 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
220
221 analysisMesonCuts[i] = new AliConversionMesonCuts();
222 analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
223 MesonCutList->Add(analysisMesonCuts[i]);
224 analysisMesonCuts[i]->SetFillCutHistograms("");
225
226 analysisEventCuts[i]->SetAcceptedHeader(HeaderList);
227 }
228
229 task->SetEventCutList(numberOfCuts,EventCutList);
230 task->SetConversionCutList(numberOfCuts,ConvCutList);
231 task->SetMesonCutList(numberOfCuts,MesonCutList);
232 task->SetMoveParticleAccordingToVertex(kTRUE);
233 task->SetDoMesonAnalysis(kTRUE);
234 task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
235 task->SetDoPhotonQA(enableQAPhotonTask); //Attention new switch small for Photon QA
236
237 //connect containers
238 AliAnalysisDataContainer *coutput =
239 mgr->CreateContainer(Form("GammaConvV1_%i",trainConfig), TList::Class(),
240 AliAnalysisManager::kOutputContainer,Form("GammaConvV1_%i.root",trainConfig));
241
242 mgr->AddTask(task);
243 mgr->ConnectInput(task,0,cinput);
244 mgr->ConnectOutput(task,1,coutput);
245
246 return;
39e8c2ce 247
248}