- added missing pi0 histograms for calo conv
[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;
eed82f0e 117 if (trainConfig==3 || trainConfig==5 ){ numberOfCuts =6;}
ea1bc51e 118 if (trainConfig==6 || trainConfig==7 || trainConfig==8 || trainConfig==9 ){ 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
129 if (trainConfig == 1){
5cd70387 130 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "10000041022030000"; mesonCutArray[0] = "01525065000000"; //standart cut, kINT7 // EMCAL clusters
131 eventCutArray[ 1] = "8005201"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "10000041022030000"; mesonCutArray[1] = "01525065000000"; //standard cut, kEMC7 // EMCAL clusters
9df9736d 132 } else if (trainConfig == 2) {
5cd70387 133 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "20000031022000000"; mesonCutArray[0] = "01525065000000"; //standart cut, kINT7 // PHOS clusters
134 eventCutArray[ 1] = "8006201"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "20000031022000000"; mesonCutArray[1] = "01525065000000"; //standard cut, kPHI7 // PHOS clusters
ab8c8149 135 } else if (trainConfig == 3){
5cd70387 136 eventCutArray[ 0] = "8008101"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "10000041022030000"; mesonCutArray[0] = "01525065000000"; //standart cut, kEMCEGA based on INT7 // EMCAL clusters
137 eventCutArray[ 1] = "8008301"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "10000041022030000"; mesonCutArray[1] = "01525065000000"; //standard cut, kEMCEG1 based on INT7 // EMCAL clusters
138 eventCutArray[ 2] = "8008501"; photonCutArray[ 2] = "002092970028250400000"; clusterCutArray[2] = "10000041022030000"; mesonCutArray[2] = "01525065000000"; //standard cut, kEMCEG2 based on INT7 // EMCAL clusters
139 eventCutArray[ 3] = "8009101"; photonCutArray[ 3] = "002092970028250400000"; clusterCutArray[3] = "10000041022030000"; mesonCutArray[3] = "01525065000000"; //standard cut, kEMCEJE based on INT7 // EMCAL clusters
140 eventCutArray[ 4] = "8009301"; photonCutArray[ 4] = "002092970028250400000"; clusterCutArray[4] = "10000041022030000"; mesonCutArray[4] = "01525065000000"; //standard cut, kEMCEJ1 based on INT7 // EMCAL clusters
141 eventCutArray[ 5] = "8009501"; photonCutArray[ 5] = "002092970028250400000"; clusterCutArray[5] = "10000041022030000"; mesonCutArray[5] = "01525065000000"; //standard cut, kEMCEG2 based on INT7 // EMCAL clusters
eed82f0e 142 } else if (trainConfig == 4){
5cd70387 143 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "10000041052030000"; mesonCutArray[0] = "01525065000000"; //standart cut, kINT7 // EMCAL clusters
144 eventCutArray[ 1] = "8005201"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "10000041052030000"; mesonCutArray[1] = "01525065000000"; //standard cut, kEMC7 // EMCAL clusters
eed82f0e 145 } else if (trainConfig == 5){
5cd70387 146 eventCutArray[ 0] = "8008101"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "10000041052030000"; mesonCutArray[0] = "01525065000000"; //standart cut, kEMCEGA based on INT7 // EMCAL clusters
147 eventCutArray[ 1] = "8008301"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "10000041052030000"; mesonCutArray[1] = "01525065000000"; //standard cut, kEMCEG1 based on INT7 // EMCAL clusters
148 eventCutArray[ 2] = "8008501"; photonCutArray[ 2] = "002092970028250400000"; clusterCutArray[2] = "10000041052030000"; mesonCutArray[2] = "01525065000000"; //standard cut, kEMCEG2 based on INT7 // EMCAL clusters
149 eventCutArray[ 3] = "8009101"; photonCutArray[ 3] = "002092970028250400000"; clusterCutArray[3] = "10000041052030000"; mesonCutArray[3] = "01525065000000"; //standard cut, kEMCEJE based on INT7 // EMCAL clusters
150 eventCutArray[ 4] = "8009301"; photonCutArray[ 4] = "002092970028250400000"; clusterCutArray[4] = "10000041052030000"; mesonCutArray[4] = "01525065000000"; //standard cut, kEMCEJ1 based on INT7 // EMCAL clusters
151 eventCutArray[ 5] = "8009501"; photonCutArray[ 5] = "002092970028250400000"; clusterCutArray[5] = "10000041052030000"; mesonCutArray[5] = "01525065000000"; //standard cut, kEMCEG2 based on INT7 // EMCAL clusters
925a074a 152 } else if (trainConfig == 6){ //EMCAL
153 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "10000041052030000"; mesonCutArray[0] = "01525065000000";
154 eventCutArray[ 1] = "8000001"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "10000042052030000"; mesonCutArray[1] = "01525065000000";
155 eventCutArray[ 2] = "8000001"; photonCutArray[ 2] = "002092970028250400000"; clusterCutArray[2] = "10000043052030000"; mesonCutArray[2] = "01525065000000";
156 eventCutArray[ 3] = "8000001"; photonCutArray[ 3] = "002092970028250400000"; clusterCutArray[3] = "10000044052030000"; mesonCutArray[3] = "01525065000000";
157 eventCutArray[ 4] = "8000001"; photonCutArray[ 4] = "002092970028250400000"; clusterCutArray[4] = "10000045052030000"; mesonCutArray[4] = "01525065000000";
158 } else if (trainConfig == 7) { //PHOS
ee4b3d66 159 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "20000041053200000"; mesonCutArray[0] = "01525065000000";
160 eventCutArray[ 1] = "8000001"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "20000042053200000"; mesonCutArray[1] = "01525065000000";
161 eventCutArray[ 2] = "8000001"; photonCutArray[ 2] = "002092970028250400000"; clusterCutArray[2] = "20000043053200000"; mesonCutArray[2] = "01525065000000";
162 eventCutArray[ 3] = "8000001"; photonCutArray[ 3] = "002092970028250400000"; clusterCutArray[3] = "20000044053200000"; mesonCutArray[3] = "01525065000000";
163 eventCutArray[ 4] = "8000001"; photonCutArray[ 4] = "002092970028250400000"; clusterCutArray[4] = "20000045053200000"; mesonCutArray[4] = "01525065000000";
ea1bc51e 164 } else if (trainConfig == 8){ //EMCAL
165 eventCutArray[ 0] = "8000002"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "10000041052030000"; mesonCutArray[0] = "01525065000000";
166 eventCutArray[ 1] = "8000002"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "10000042052030000"; mesonCutArray[1] = "01525065000000";
167 eventCutArray[ 2] = "8000002"; photonCutArray[ 2] = "002092970028250400000"; clusterCutArray[2] = "10000043052030000"; mesonCutArray[2] = "01525065000000";
168 eventCutArray[ 3] = "8000002"; photonCutArray[ 3] = "002092970028250400000"; clusterCutArray[3] = "10000044052030000"; mesonCutArray[3] = "01525065000000";
169 eventCutArray[ 4] = "8000002"; photonCutArray[ 4] = "002092970028250400000"; clusterCutArray[4] = "10000045052030000"; mesonCutArray[4] = "01525065000000";
170 } else if (trainConfig == 9) { //PHOS
171 eventCutArray[ 0] = "8000002"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "20000041053200000"; mesonCutArray[0] = "01525065000000";
172 eventCutArray[ 1] = "8000002"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "20000042053200000"; mesonCutArray[1] = "01525065000000";
173 eventCutArray[ 2] = "8000002"; photonCutArray[ 2] = "002092970028250400000"; clusterCutArray[2] = "20000043053200000"; mesonCutArray[2] = "01525065000000";
174 eventCutArray[ 3] = "8000002"; photonCutArray[ 3] = "002092970028250400000"; clusterCutArray[3] = "20000044053200000"; mesonCutArray[3] = "01525065000000";
175 eventCutArray[ 4] = "8000002"; photonCutArray[ 4] = "002092970028250400000"; clusterCutArray[4] = "20000045053200000"; mesonCutArray[4] = "01525065000000";
176
177
8bdca7f1 178 } else {
179 Error(Form("GammaConvCalo_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
180 return;
181 }
182
344100c4 183 TList *EventCutList = new TList();
8bdca7f1 184 TList *ConvCutList = new TList();
185 TList *ClusterCutList = new TList();
186 TList *MesonCutList = new TList();
187
188 TList *HeaderList = new TList();
189 if (doWeightingPart==1) {
190 TObjString *Header1 = new TObjString("pi0_1");
191 HeaderList->Add(Header1);
192 }
193 if (doWeightingPart==2){
194 TObjString *Header3 = new TObjString("eta_2");
195 HeaderList->Add(Header3);
196 }
197 if (doWeightingPart==3) {
198 TObjString *Header1 = new TObjString("pi0_1");
199 HeaderList->Add(Header1);
200 TObjString *Header3 = new TObjString("eta_2");
201 HeaderList->Add(Header3);
202 }
203
344100c4 204 EventCutList->SetOwner(kTRUE);
205 AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts];
8bdca7f1 206 ConvCutList->SetOwner(kTRUE);
344100c4 207 AliConversionPhotonCuts **analysisCuts = new AliConversionPhotonCuts*[numberOfCuts];
8bdca7f1 208 ClusterCutList->SetOwner(kTRUE);
209 AliCaloPhotonCuts **analysisClusterCuts = new AliCaloPhotonCuts*[numberOfCuts];
210 MesonCutList->SetOwner(kTRUE);
211 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
212
213 for(Int_t i = 0; i<numberOfCuts; i++){
344100c4 214 analysisEventCuts[i] = new AliConvEventCuts();
215 analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data());
216 EventCutList->Add(analysisEventCuts[i]);
217 analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
218
219 analysisCuts[i] = new AliConversionPhotonCuts();
220 analysisCuts[i]->InitializeCutsFromCutString(photonCutArray[i].Data());
221 analysisCuts[i]->SetIsHeavyIon(isHeavyIon);
8bdca7f1 222 ConvCutList->Add(analysisCuts[i]);
223 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
344100c4 224
8bdca7f1 225 analysisClusterCuts[i] = new AliCaloPhotonCuts();
344100c4 226 analysisClusterCuts[i]->InitializeCutsFromCutString(clusterCutArray[i].Data());
8bdca7f1 227 ClusterCutList->Add(analysisClusterCuts[i]);
4e8dcc76 228 analysisClusterCuts[i]->SetExtendedMatching(enableExtendedMatching);
8bdca7f1 229 analysisClusterCuts[i]->SetFillCutHistograms("");
230
231 analysisMesonCuts[i] = new AliConversionMesonCuts();
232 analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
233 MesonCutList->Add(analysisMesonCuts[i]);
234 analysisMesonCuts[i]->SetFillCutHistograms("");
344100c4 235 analysisEventCuts[i]->SetAcceptedHeader(HeaderList);
8bdca7f1 236 }
237
344100c4 238 task->SetEventCutList(numberOfCuts,EventCutList);
8bdca7f1 239 task->SetConversionCutList(numberOfCuts,ConvCutList);
240 task->SetCaloCutList(numberOfCuts,ClusterCutList);
241 task->SetMesonCutList(numberOfCuts,MesonCutList);
242 task->SetMoveParticleAccordingToVertex(kTRUE);
243 task->SetDoMesonAnalysis(kTRUE);
244 task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
245 task->SetDoPhotonQA(enableQAPhotonTask); //Attention new switch small for Photon QA
fd94f234 246 task->SetDoClusterQA(1); //Attention new switch small for Cluster QA
8bdca7f1 247
248 //connect containers
249 AliAnalysisDataContainer *coutput =
250 mgr->CreateContainer(Form("GammaConvCalo_%i",trainConfig), TList::Class(),
251 AliAnalysisManager::kOutputContainer,Form("GammaConvCalo_%i.root",trainConfig));
252
253 mgr->AddTask(task);
254 mgr->ConnectInput(task,0,cinput);
255 mgr->ConnectOutput(task,1,coutput);
256
257 return;
258
259}