modified Addtasks to comply with new format of ConversionPhotonCuts
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvCalo_pPb.C
CommitLineData
8bdca7f1 1void AddTask_GammaConvCalo_pPb( Int_t trainConfig = 1, //change different set of cuts
2 Bool_t isMC = kFALSE, //run MC
3 Int_t enableQAMesonTask = 0, //enable QA in AliAnalysisTaskGammaConvV1
4 Int_t enableQAPhotonTask = 0, // enable additional QA task
5 TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
6 Int_t doWeightingPart = 0, //enable Weighting
7 TString generatorName = "DPMJET",
4e8dcc76 8 TString cutnumberAODBranch = "8000000060084000001500000", // cutnumber for AOD branch
9 Bool_t enableExtendedMatching = kFALSE //enable or disable extended matching histograms for conversion electrons <-> cluster
8bdca7f1 10 ) {
11
12 // ================= Load Librariers =================================
13 gSystem->Load("libCore.so");
14 gSystem->Load("libTree.so");
15 gSystem->Load("libGeom.so");
16 gSystem->Load("libVMC.so");
17 gSystem->Load("libPhysics.so");
18 gSystem->Load("libMinuit");
19 gSystem->Load("libSTEERBase");
20 gSystem->Load("libESD");
21 gSystem->Load("libAOD");
22 gSystem->Load("libANALYSIS");
23 gSystem->Load("libANALYSISalice");
8bdca7f1 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");
4e1b9acf 29 gSystem->Load("libPWGflowBase.so");
30 gSystem->Load("libPWGflowTasks.so");
31 gSystem->Load("libPWGGAGammaConv.so");
32
344100c4 33 Int_t isHeavyIon = 2;
34
8bdca7f1 35 // ================== GetAnalysisManager ===============================
36 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
37 if (!mgr) {
38 Error(Form("AddTask_GammaConvV1_%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");
344100c4 48 AddTaskPIDResponse(isMC);
8bdca7f1 49 }
50
51 Printf("here \n");
52
53 //========= Set Cutnumber for V0Reader ================================
344100c4 54 TString cutnumberPhoton = "060084001001500000000";
55 TString cutnumberEvent = "8000000";
56 Bool_t doEtaShift = kFALSE;
8bdca7f1 57 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
58
59 //========= Add V0 Reader to ANALYSIS manager if not yet existent =====
60 if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
61 AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
62
63 fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
64 fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
65 fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
66
67 if (!mgr) {
68 Error("AddTask_V0ReaderV1", "No analysis manager found.");
69 return;
70 }
71
344100c4 72 AliConvEventCuts *fEventCuts=NULL;
73 if(cutnumberEvent!=""){
74 fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data());
75 fEventCuts->SetPreSelectionCutFlag(kTRUE);
76 if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){
77 fEventCuts->DoEtaShift(doEtaShift);
78 fV0ReaderV1->SetEventCuts(fEventCuts);
79 fEventCuts->SetFillCutHistograms("",kTRUE);
80 }
81 }
82
8bdca7f1 83 // Set AnalysisCut Number
344100c4 84 AliConversionPhotonCuts *fCuts=NULL;
85 if(cutnumberPhoton!=""){
86 fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data());
8bdca7f1 87 fCuts->SetPreSelectionCutFlag(kTRUE);
344100c4 88 fCuts->SetIsHeavyIon(isHeavyIon);
89 if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){
8bdca7f1 90 fV0ReaderV1->SetConversionCuts(fCuts);
91 fCuts->SetFillCutHistograms("",kTRUE);
92 }
93 }
94 if(inputHandler->IsA()==AliAODInputHandler::Class()){
95 // AOD mode
96 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
97 }
98 fV0ReaderV1->Init();
99
100 AliLog::SetGlobalLogLevel(AliLog::kFatal);
101
102 //connect input V0Reader
103 mgr->AddTask(fV0ReaderV1);
104 mgr->ConnectInput(fV0ReaderV1,0,cinput);
105
106 }
107
108 //================================================
109 //========= Add task to the ANALYSIS manager =====
110 //================================================
111 AliAnalysisTaskGammaConvCalo *task=NULL;
112 task= new AliAnalysisTaskGammaConvCalo(Form("GammaConvCalo_%i",trainConfig));
344100c4 113 task->SetIsHeavyIon(isHeavyIon);
8bdca7f1 114 task->SetIsMC(isMC);
115 // Cut Numbers to use in Analysis
116 Int_t numberOfCuts = 2;
0e006b2c 117 if (trainConfig==2 || trainConfig==4 ){ numberOfCuts =6;}
118 if (trainConfig==5 || trainConfig==6 || trainConfig==7 || trainConfig==8 || trainConfig==32 || trainConfig==33){ numberOfCuts =5;}
d53bf4ac 119
344100c4 120 TString *eventCutArray = new TString[numberOfCuts];
121 TString *photonCutArray = new TString[numberOfCuts];
122 TString *clusterCutArray = new TString[numberOfCuts];
8bdca7f1 123 TString *mesonCutArray = new TString[numberOfCuts];
124
125 // cluster cuts
126 // 0 "ClusterType", 1 "EtaMin", 2 "EtaMax", 3 "PhiMin", 4 "PhiMax", 5 "DistanceToBadChannel", 6 "Timing", 7 "TrackMatching", 8 "ExoticCell",
127 // 9 "MinEnergy", 10 "MinNCells", 11 "MinM02", 12 "MaxM02", 13 "MinM20", 14 "MaxM20", 15 "MaximumDispersion", 16 "NLM"
128
0e006b2c 129 //************************************************ EMCAL clusters **********************************************************
130 if (trainConfig == 1){ // min energy = 0.3 GeV/c
f1018ee5 131 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002093270028250400000"; clusterCutArray[0] = "10000042022030000"; mesonCutArray[0] = "01631031000000"; //standart cut, kINT7
132 eventCutArray[ 1] = "8005201"; photonCutArray[ 1] = "002093270028250400000"; clusterCutArray[1] = "10000042022030000"; mesonCutArray[1] = "01631031000000"; //standard cut, kEMC7
0e006b2c 133 } else if (trainConfig == 2){ // min energy = 0.3 GeV/c
f1018ee5 134 eventCutArray[ 0] = "8008101"; photonCutArray[ 0] = "002093270028250400000"; clusterCutArray[0] = "10000042022030000"; mesonCutArray[0] = "01631031000000"; //standart cut, kEMCEGA based on INT7
135 eventCutArray[ 1] = "8008301"; photonCutArray[ 1] = "002093270028250400000"; clusterCutArray[1] = "10000042022030000"; mesonCutArray[1] = "01631031000000"; //standard cut, kEMCEG1 based on INT7
136 eventCutArray[ 2] = "8008501"; photonCutArray[ 2] = "002093270028250400000"; clusterCutArray[2] = "10000042022030000"; mesonCutArray[2] = "01631031000000"; //standard cut, kEMCEG2 based on INT7
137 eventCutArray[ 3] = "8009101"; photonCutArray[ 3] = "002093270028250400000"; clusterCutArray[3] = "10000042022030000"; mesonCutArray[3] = "01631031000000"; //standard cut, kEMCEJE based on INT7
138 eventCutArray[ 4] = "8009301"; photonCutArray[ 4] = "002093270028250400000"; clusterCutArray[4] = "10000042022030000"; mesonCutArray[4] = "01631031000000"; //standard cut, kEMCEJ1 based on INT7
139 eventCutArray[ 5] = "8009501"; photonCutArray[ 5] = "002093270028250400000"; clusterCutArray[5] = "10000042022030000"; mesonCutArray[5] = "01631031000000"; //standard cut, kEMCEG2 based on INT7
0e006b2c 140 } else if (trainConfig == 3){ // min energy = 0.4 GeV/c
f1018ee5 141 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002093270028250400000"; clusterCutArray[0] = "10000042032030000"; mesonCutArray[0] = "01631031000000"; //standart cut, kINT7
142 eventCutArray[ 1] = "8005201"; photonCutArray[ 1] = "002093270028250400000"; clusterCutArray[1] = "10000042032030000"; mesonCutArray[1] = "01631031000000"; //standard cut, kEMC7
0e006b2c 143 } else if (trainConfig == 4){ // min energy = 0.4 GeV/c
f1018ee5 144 eventCutArray[ 0] = "8008101"; photonCutArray[ 0] = "002093270028250400000"; clusterCutArray[0] = "10000042032030000"; mesonCutArray[0] = "01631031000000"; //standart cut, kEMCEGA based on INT7
145 eventCutArray[ 1] = "8008301"; photonCutArray[ 1] = "002093270028250400000"; clusterCutArray[1] = "10000042032030000"; mesonCutArray[1] = "01631031000000"; //standard cut, kEMCEG1 based on INT7
146 eventCutArray[ 2] = "8008501"; photonCutArray[ 2] = "002093270028250400000"; clusterCutArray[2] = "10000042032030000"; mesonCutArray[2] = "01631031000000"; //standard cut, kEMCEG2 based on INT7
147 eventCutArray[ 3] = "8009101"; photonCutArray[ 3] = "002093270028250400000"; clusterCutArray[3] = "10000042032030000"; mesonCutArray[3] = "01631031000000"; //standard cut, kEMCEJE based on INT7
148 eventCutArray[ 4] = "8009301"; photonCutArray[ 4] = "002093270028250400000"; clusterCutArray[4] = "10000042032030000"; mesonCutArray[4] = "01631031000000"; //standard cut, kEMCEJ1 based on INT7
149 eventCutArray[ 5] = "8009501"; photonCutArray[ 5] = "002093270028250400000"; clusterCutArray[5] = "10000042032030000"; mesonCutArray[5] = "01631031000000"; //standard cut, kEMCEG2 based on INT7
0e006b2c 150 } else if (trainConfig == 5){ //EMCAL variation of track matching
f1018ee5 151 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002093270028250400000"; clusterCutArray[0] = "10000041032030000"; mesonCutArray[0] = "01631031000000"; //
152 eventCutArray[ 1] = "8000001"; photonCutArray[ 1] = "002093270028250400000"; clusterCutArray[1] = "10000042032030000"; mesonCutArray[1] = "01631031000000";
153 eventCutArray[ 2] = "8000001"; photonCutArray[ 2] = "002093270028250400000"; clusterCutArray[2] = "10000043032030000"; mesonCutArray[2] = "01631031000000";
154 eventCutArray[ 3] = "8000001"; photonCutArray[ 3] = "002093270028250400000"; clusterCutArray[3] = "10000044032030000"; mesonCutArray[3] = "01631031000000";
155 eventCutArray[ 4] = "8000001"; photonCutArray[ 4] = "002093270028250400000"; clusterCutArray[4] = "10000045032030000"; mesonCutArray[4] = "01631031000000";
0e006b2c 156 } else if (trainConfig == 6){ //EMCAL added signal
f1018ee5 157 eventCutArray[ 0] = "8000002"; photonCutArray[ 0] = "002093270028250400000"; clusterCutArray[0] = "10000041032030000"; mesonCutArray[0] = "01631031000000";
158 eventCutArray[ 1] = "8000002"; photonCutArray[ 1] = "002093270028250400000"; clusterCutArray[1] = "10000042032030000"; mesonCutArray[1] = "01631031000000";
159 eventCutArray[ 2] = "8000002"; photonCutArray[ 2] = "002093270028250400000"; clusterCutArray[2] = "10000043032030000"; mesonCutArray[2] = "01631031000000";
160 eventCutArray[ 3] = "8000002"; photonCutArray[ 3] = "002093270028250400000"; clusterCutArray[3] = "10000044032030000"; mesonCutArray[3] = "01631031000000";
161 eventCutArray[ 4] = "8000002"; photonCutArray[ 4] = "002093270028250400000"; clusterCutArray[4] = "10000045032030000"; mesonCutArray[4] = "01631031000000";
0e006b2c 162 } else if (trainConfig == 7){ //EMCAL minEnergy variation
f1018ee5 163 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002093270028250400000"; clusterCutArray[0] = "10000042012030000"; mesonCutArray[0] = "01631031000000"; //0.2 GeV/c
164 eventCutArray[ 1] = "8000001"; photonCutArray[ 1] = "002093270028250400000"; clusterCutArray[1] = "10000042022030000"; mesonCutArray[1] = "01631031000000"; //0.3 GeV/c
165 eventCutArray[ 2] = "8000001"; photonCutArray[ 2] = "002093270028250400000"; clusterCutArray[2] = "10000042032030000"; mesonCutArray[2] = "01631031000000"; //0.4 GeV/c default
166 eventCutArray[ 3] = "8000001"; photonCutArray[ 3] = "002093270028250400000"; clusterCutArray[3] = "10000042042030000"; mesonCutArray[3] = "01631031000000"; //0.5 GeV/c
167 eventCutArray[ 4] = "8000001"; photonCutArray[ 4] = "002093270028250400000"; clusterCutArray[4] = "10000042052030000"; mesonCutArray[4] = "01631031000000"; //0.6 GeV/c
0e006b2c 168 } else if (trainConfig == 8){ //EMCAL minNCells variation
f1018ee5 169 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002093270028250400000"; clusterCutArray[0] = "10000042031030000"; mesonCutArray[0] = "01631031000000"; //n cells >= 1
170 eventCutArray[ 1] = "8000001"; photonCutArray[ 1] = "002093270028250400000"; clusterCutArray[1] = "10000042033030000"; mesonCutArray[1] = "01631031000000"; //n cells >= 3
171 eventCutArray[ 2] = "8000001"; photonCutArray[ 2] = "002093270028250400000"; clusterCutArray[2] = "10000042032000000"; mesonCutArray[2] = "01631031000000"; //no M02 cut
172 eventCutArray[ 3] = "8000001"; photonCutArray[ 3] = "002093270028250400000"; clusterCutArray[3] = "10021042032030000"; mesonCutArray[3] = "01631031000000"; //only modules with TRD infront
173 eventCutArray[ 4] = "8000001"; photonCutArray[ 4] = "002093270028250400000"; clusterCutArray[4] = "10013042032030000"; mesonCutArray[4] = "01631031000000"; //no modules with TRD infront
ea1bc51e 174
0e006b2c 175 //************************************************ PHOS clusters **********************************************************
176 } else if (trainConfig == 31) { // min energy = 0.3 GeV/c
f1018ee5 177 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002093270028250400000"; clusterCutArray[0] = "20000042033200000"; mesonCutArray[0] = "01631031000000"; //standart cut, kINT7
178 eventCutArray[ 1] = "8006201"; photonCutArray[ 1] = "002093270028250400000"; clusterCutArray[1] = "20000042033200000"; mesonCutArray[1] = "01631031000000"; //standard cut, kPHI7
0e006b2c 179 } else if (trainConfig == 32) { //PHOS
f1018ee5 180 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002093270028250400000"; clusterCutArray[0] = "20000041033200000"; mesonCutArray[0] = "01631031000000";
181 eventCutArray[ 1] = "8000001"; photonCutArray[ 1] = "002093270028250400000"; clusterCutArray[1] = "20000042033200000"; mesonCutArray[1] = "01631031000000";
182 eventCutArray[ 2] = "8000001"; photonCutArray[ 2] = "002093270028250400000"; clusterCutArray[2] = "20000043033200000"; mesonCutArray[2] = "01631031000000";
183 eventCutArray[ 3] = "8000001"; photonCutArray[ 3] = "002093270028250400000"; clusterCutArray[3] = "20000044033200000"; mesonCutArray[3] = "01631031000000";
184 eventCutArray[ 4] = "8000001"; photonCutArray[ 4] = "002093270028250400000"; clusterCutArray[4] = "20000045033200000"; mesonCutArray[4] = "01631031000000";
0e006b2c 185 } else if (trainConfig == 33) { //PHOS
f1018ee5 186 eventCutArray[ 0] = "8000002"; photonCutArray[ 0] = "002093270028250400000"; clusterCutArray[0] = "20000041033200000"; mesonCutArray[0] = "01631031000000";
187 eventCutArray[ 1] = "8000002"; photonCutArray[ 1] = "002093270028250400000"; clusterCutArray[1] = "20000042033200000"; mesonCutArray[1] = "01631031000000";
188 eventCutArray[ 2] = "8000002"; photonCutArray[ 2] = "002093270028250400000"; clusterCutArray[2] = "20000043033200000"; mesonCutArray[2] = "01631031000000";
189 eventCutArray[ 3] = "8000002"; photonCutArray[ 3] = "002093270028250400000"; clusterCutArray[3] = "20000044033200000"; mesonCutArray[3] = "01631031000000";
190 eventCutArray[ 4] = "8000002"; photonCutArray[ 4] = "002093270028250400000"; clusterCutArray[4] = "20000045033200000"; mesonCutArray[4] = "01631031000000";
8bdca7f1 191 } else {
192 Error(Form("GammaConvCalo_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
193 return;
194 }
195
344100c4 196 TList *EventCutList = new TList();
8bdca7f1 197 TList *ConvCutList = new TList();
198 TList *ClusterCutList = new TList();
199 TList *MesonCutList = new TList();
200
201 TList *HeaderList = new TList();
202 if (doWeightingPart==1) {
203 TObjString *Header1 = new TObjString("pi0_1");
204 HeaderList->Add(Header1);
205 }
206 if (doWeightingPart==2){
207 TObjString *Header3 = new TObjString("eta_2");
208 HeaderList->Add(Header3);
209 }
210 if (doWeightingPart==3) {
211 TObjString *Header1 = new TObjString("pi0_1");
212 HeaderList->Add(Header1);
213 TObjString *Header3 = new TObjString("eta_2");
214 HeaderList->Add(Header3);
215 }
216
344100c4 217 EventCutList->SetOwner(kTRUE);
218 AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts];
8bdca7f1 219 ConvCutList->SetOwner(kTRUE);
344100c4 220 AliConversionPhotonCuts **analysisCuts = new AliConversionPhotonCuts*[numberOfCuts];
8bdca7f1 221 ClusterCutList->SetOwner(kTRUE);
222 AliCaloPhotonCuts **analysisClusterCuts = new AliCaloPhotonCuts*[numberOfCuts];
223 MesonCutList->SetOwner(kTRUE);
224 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
225
226 for(Int_t i = 0; i<numberOfCuts; i++){
344100c4 227 analysisEventCuts[i] = new AliConvEventCuts();
228 analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data());
229 EventCutList->Add(analysisEventCuts[i]);
230 analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
231
232 analysisCuts[i] = new AliConversionPhotonCuts();
233 analysisCuts[i]->InitializeCutsFromCutString(photonCutArray[i].Data());
234 analysisCuts[i]->SetIsHeavyIon(isHeavyIon);
8bdca7f1 235 ConvCutList->Add(analysisCuts[i]);
236 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
344100c4 237
8bdca7f1 238 analysisClusterCuts[i] = new AliCaloPhotonCuts();
344100c4 239 analysisClusterCuts[i]->InitializeCutsFromCutString(clusterCutArray[i].Data());
8bdca7f1 240 ClusterCutList->Add(analysisClusterCuts[i]);
4e8dcc76 241 analysisClusterCuts[i]->SetExtendedMatching(enableExtendedMatching);
8bdca7f1 242 analysisClusterCuts[i]->SetFillCutHistograms("");
243
244 analysisMesonCuts[i] = new AliConversionMesonCuts();
245 analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
246 MesonCutList->Add(analysisMesonCuts[i]);
247 analysisMesonCuts[i]->SetFillCutHistograms("");
344100c4 248 analysisEventCuts[i]->SetAcceptedHeader(HeaderList);
8bdca7f1 249 }
250
344100c4 251 task->SetEventCutList(numberOfCuts,EventCutList);
8bdca7f1 252 task->SetConversionCutList(numberOfCuts,ConvCutList);
253 task->SetCaloCutList(numberOfCuts,ClusterCutList);
254 task->SetMesonCutList(numberOfCuts,MesonCutList);
255 task->SetMoveParticleAccordingToVertex(kTRUE);
256 task->SetDoMesonAnalysis(kTRUE);
257 task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
258 task->SetDoPhotonQA(enableQAPhotonTask); //Attention new switch small for Photon QA
fd94f234 259 task->SetDoClusterQA(1); //Attention new switch small for Cluster QA
8bdca7f1 260
261 //connect containers
262 AliAnalysisDataContainer *coutput =
263 mgr->CreateContainer(Form("GammaConvCalo_%i",trainConfig), TList::Class(),
264 AliAnalysisManager::kOutputContainer,Form("GammaConvCalo_%i.root",trainConfig));
265
266 mgr->AddTask(task);
267 mgr->ConnectInput(task,0,cinput);
268 mgr->ConnectOutput(task,1,coutput);
269
270 return;
271
272}