TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaCalo_pPb.C
CommitLineData
4f699ad2 1void AddTask_GammaCalo_pPb(
2 Int_t trainConfig = 1, //change different set of cuts
3 Bool_t isMC = kFALSE, //run MC
4 Int_t enableQAMesonTask = 0, //enable QA in AliAnalysisTaskGammaConvV1
5 Int_t enableQAClusterTask = 0, // enable additional QA task
6 TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
7 Int_t doWeightingPart = 0, //enable Weighting
8 TString generatorName = "DPMJET",
9 TString cutnumberAODBranch = "8000000060084000001500000" // cutnumber for AOD branch
10 ) {
d53bf4ac 11
12 // ================= Load Librariers =================================
230b7aff 13 gSystem->Load("libCore");
14 gSystem->Load("libTree");
15 gSystem->Load("libGeom");
16 gSystem->Load("libVMC");
17 gSystem->Load("libPhysics");
d53bf4ac 18 gSystem->Load("libMinuit");
19 gSystem->Load("libSTEERBase");
20 gSystem->Load("libESD");
21 gSystem->Load("libAOD");
22 gSystem->Load("libANALYSIS");
23 gSystem->Load("libANALYSISalice");
230b7aff 24 gSystem->Load("libCDB");
25 gSystem->Load("libSTEER");
26 gSystem->Load("libSTEERBase");
27 gSystem->Load("libTender");
28 gSystem->Load("libTenderSupplies");
29 gSystem->Load("libPWGflowBase");
30 gSystem->Load("libPWGflowTasks");
31 gSystem->Load("libPWGGAGammaConv");
4e1b9acf 32
d53bf4ac 33 Int_t isHeavyIon = 2;
34
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");
48 AddTaskPIDResponse(isMC);
49 }
50
51 Printf("here \n");
52
53 //========= Set Cutnumber for V0Reader ================================
3013611f 54 TString cutnumberPhoton = "060000084001001500000000";
d53bf4ac 55 TString cutnumberEvent = "8000000";
56 Bool_t doEtaShift = kFALSE;
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 AliConvEventCuts *fEventCuts=NULL;
72 if(cutnumberEvent!=""){
73 fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data());
74 fEventCuts->SetPreSelectionCutFlag(kTRUE);
75 if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){
76 fEventCuts->DoEtaShift(doEtaShift);
77 fV0ReaderV1->SetEventCuts(fEventCuts);
78 fEventCuts->SetFillCutHistograms("",kTRUE);
79 }
80 }
81 // Set AnalysisCut Number
82 AliConversionPhotonCuts *fCuts=NULL;
83 if(cutnumberPhoton!=""){
84 fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data());
85 fCuts->SetPreSelectionCutFlag(kTRUE);
86 fCuts->SetIsHeavyIon(isHeavyIon);
87 if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){
88 fV0ReaderV1->SetConversionCuts(fCuts);
89 fCuts->SetFillCutHistograms("",kTRUE);
90 }
91 }
92 if(inputHandler->IsA()==AliAODInputHandler::Class()){
93 // AOD mode
94 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
95 }
96 fV0ReaderV1->Init();
97
98 AliLog::SetGlobalLogLevel(AliLog::kFatal);
99
100 //connect input V0Reader
101 mgr->AddTask(fV0ReaderV1);
102 mgr->ConnectInput(fV0ReaderV1,0,cinput);
103 }
104
105 //================================================
106 //========= Add task to the ANALYSIS manager =====
107 //================================================
108 AliAnalysisTaskGammaCalo *task=NULL;
109 task= new AliAnalysisTaskGammaCalo(Form("GammaCalo_%i",trainConfig));
110 task->SetIsHeavyIon(isHeavyIon);
111 task->SetIsMC(isMC);
112 // Cut Numbers to use in Analysis
113 Int_t numberOfCuts = 2;
0e006b2c 114 if (trainConfig == 2 || trainConfig == 4 ){ numberOfCuts = 6;}
115 if (trainConfig == 5 || trainConfig == 6 ){ numberOfCuts = 5;}
116 if (trainConfig == 7 || trainConfig == 8 || trainConfig == 32 || trainConfig == 33){ numberOfCuts = 1;}
d53bf4ac 117
118 TString *eventCutArray = new TString[numberOfCuts];
119 TString *clusterCutArray = new TString[numberOfCuts];
120 TString *mesonCutArray = new TString[numberOfCuts];
121
122 // cluster cuts
123 // 0 "ClusterType", 1 "EtaMin", 2 "EtaMax", 3 "PhiMin", 4 "PhiMax", 5 "DistanceToBadChannel", 6 "Timing", 7 "TrackMatching", 8 "ExoticCell",
124 // 9 "MinEnergy", 10 "MinNCells", 11 "MinM02", 12 "MaxM02", 13 "MinM20", 14 "MaxM20", 15 "MaximumDispersion", 16 "NLM"
125
0e006b2c 126 //************************************************ EMCAL clusters *************************************************
127 if (trainConfig == 1){ // min energy = 0.3 GeV/c
f1018ee5 128 eventCutArray[ 0] = "8000001"; clusterCutArray[0] = "10000040022030000"; mesonCutArray[0] = "01631031000000"; //standart cut, kINT7 // EMCAL clusters
129 eventCutArray[ 1] = "8005201"; clusterCutArray[1] = "10000040022030000"; mesonCutArray[1] = "01631031000000"; //standard cut, kEMC7 // EMCAL clusters
0e006b2c 130 } else if (trainConfig == 2){ // min energy = 0.3 GeV/c
f1018ee5 131 eventCutArray[ 0] = "8008101"; clusterCutArray[0] = "10000040022030000"; mesonCutArray[0] = "01631031000000"; //standart cut, kEMCEGA based on INT7 // EMCAL clusters
132 eventCutArray[ 1] = "8008301"; clusterCutArray[1] = "10000040022030000"; mesonCutArray[1] = "01631031000000"; //standard cut, kEMCEG1 based on INT7 // EMCAL clusters
133 eventCutArray[ 2] = "8008501"; clusterCutArray[2] = "10000040022030000"; mesonCutArray[2] = "01631031000000"; //standard cut, kEMCEG2 based on INT7 // EMCAL clusters
134 eventCutArray[ 3] = "8009101"; clusterCutArray[3] = "10000040022030000"; mesonCutArray[3] = "01631031000000"; //standard cut, kEMCEJE based on INT7 // EMCAL clusters
135 eventCutArray[ 4] = "8009301"; clusterCutArray[4] = "10000040022030000"; mesonCutArray[4] = "01631031000000"; //standard cut, kEMCEJ1 based on INT7 // EMCAL clusters
136 eventCutArray[ 5] = "8009501"; clusterCutArray[5] = "10000040022030000"; mesonCutArray[5] = "01631031000000"; //standard cut, kEMCEG2 based on INT7 // EMCAL clusters
0e006b2c 137 } else if (trainConfig == 3){ // min energy = 0.4 GeV/c
f1018ee5 138 eventCutArray[ 0] = "8000001"; clusterCutArray[0] = "10000040032030000"; mesonCutArray[0] = "01631031000000"; //standart cut, kINT7 // EMCAL clusters
139 eventCutArray[ 1] = "8005201"; clusterCutArray[1] = "10000040032030000"; mesonCutArray[1] = "01631031000000"; //standard cut, kEMC7 // EMCAL clusters
0e006b2c 140 } else if (trainConfig == 4){ // min energy = 0.4 GeV/c
f1018ee5 141 eventCutArray[ 0] = "8008101"; clusterCutArray[0] = "10000040032030000"; mesonCutArray[0] = "01631031000000"; //standart cut, kEMCEGA based on INT7 // EMCAL clusters
142 eventCutArray[ 1] = "8008301"; clusterCutArray[1] = "10000040032030000"; mesonCutArray[1] = "01631031000000"; //standard cut, kEMCEG1 based on INT7 // EMCAL clusters
143 eventCutArray[ 2] = "8008501"; clusterCutArray[2] = "10000040032030000"; mesonCutArray[2] = "01631031000000"; //standard cut, kEMCEG2 based on INT7 // EMCAL clusters
144 eventCutArray[ 3] = "8009101"; clusterCutArray[3] = "10000040032030000"; mesonCutArray[3] = "01631031000000"; //standard cut, kEMCEJE based on INT7 // EMCAL clusters
145 eventCutArray[ 4] = "8009301"; clusterCutArray[4] = "10000040032030000"; mesonCutArray[4] = "01631031000000"; //standard cut, kEMCEJ1 based on INT7 // EMCAL clusters
146 eventCutArray[ 5] = "8009501"; clusterCutArray[5] = "10000040032030000"; mesonCutArray[5] = "01631031000000"; //standard cut, kEMCEG2 based on INT7 // EMCAL clusters
0e006b2c 147 } else if (trainConfig == 5){ //EMCAL minEnergy variation
f1018ee5 148 eventCutArray[ 0] = "8000001"; clusterCutArray[0] = "10000040012030000"; mesonCutArray[0] = "01631031000000"; //0.2 GeV/c
149 eventCutArray[ 1] = "8000001"; clusterCutArray[1] = "10000040022030000"; mesonCutArray[1] = "01631031000000"; //0.3 GeV/c
150 eventCutArray[ 2] = "8000001"; clusterCutArray[2] = "10000040032030000"; mesonCutArray[2] = "01631031000000"; //0.4 GeV/c default
151 eventCutArray[ 3] = "8000001"; clusterCutArray[3] = "10000040042030000"; mesonCutArray[3] = "01631031000000"; //0.5 GeV/c
152 eventCutArray[ 4] = "8000001"; clusterCutArray[4] = "10000040052030000"; mesonCutArray[4] = "01631031000000"; //0.6 GeV/c
0e006b2c 153 } else if (trainConfig == 6){ //EMCAL minNCells variation
f1018ee5 154 eventCutArray[ 0] = "8000001"; clusterCutArray[0] = "10000040031030000"; mesonCutArray[0] = "01631031000000"; //n cells >= 1
155 eventCutArray[ 1] = "8000001"; clusterCutArray[1] = "10000040033030000"; mesonCutArray[1] = "01631031000000"; //n cells >= 3
156 eventCutArray[ 2] = "8000001"; clusterCutArray[2] = "10000040032000000"; mesonCutArray[2] = "01631031000000"; //no M02 cut
157 eventCutArray[ 3] = "8000001"; clusterCutArray[3] = "10021040032030000"; mesonCutArray[3] = "01631031000000"; //only modules with TRD infront
158 eventCutArray[ 4] = "8000001"; clusterCutArray[4] = "10013040032030000"; mesonCutArray[4] = "01631031000000"; //no modules with TRD infront
0e006b2c 159 } else if (trainConfig == 7){ // Validation EMCAL
f1018ee5 160 eventCutArray[ 0] = "8000001"; clusterCutArray[0] = "10000040032000000"; mesonCutArray[0] = "01631031000000";
ea1bc51e 161 } else if (trainConfig == 8){ // Validation EMCAL, only added signals
f1018ee5 162 eventCutArray[ 0] = "8000002"; clusterCutArray[0] = "10000040032000000"; mesonCutArray[0] = "01631031000000";
0e006b2c 163
164 //************************************************ PHOS clusters *************************************************
165 } else if (trainConfig == 31) { // min energy = 0.3 GeV/c
f1018ee5 166 eventCutArray[ 0] = "8000001"; clusterCutArray[0] = "20000040033200000"; mesonCutArray[0] = "01631031000000"; //standart cut, kINT7 // PHOS clusters
167 eventCutArray[ 1] = "8006201"; clusterCutArray[1] = "20000040033200000"; mesonCutArray[1] = "01631031000000"; //standard cut, kPHI7 // PHOS clusters
0e006b2c 168 } else if (trainConfig == 32){ // Validation PHOS
f1018ee5 169 eventCutArray[ 0] = "8000001"; clusterCutArray[0] = "20000040053200000"; mesonCutArray[0] = "01631031000000";
0e006b2c 170 } else if (trainConfig == 33){ // Validation PHOS, only added signals
f1018ee5 171 eventCutArray[ 0] = "8000002"; clusterCutArray[0] = "20000040053200000"; mesonCutArray[0] = "01631031000000";
ea1bc51e 172
173
d53bf4ac 174 } else {
175 Error(Form("GammaCalo_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
176 return;
177 }
178
179 TList *EventCutList = new TList();
180 TList *ClusterCutList = new TList();
181 TList *MesonCutList = new TList();
182
183 TList *HeaderList = new TList();
184 if (doWeightingPart==1) {
185 TObjString *Header1 = new TObjString("pi0_1");
186 HeaderList->Add(Header1);
187 }
188 if (doWeightingPart==2){
189 TObjString *Header3 = new TObjString("eta_2");
190 HeaderList->Add(Header3);
191 }
192 if (doWeightingPart==3) {
193 TObjString *Header1 = new TObjString("pi0_1");
194 HeaderList->Add(Header1);
195 TObjString *Header3 = new TObjString("eta_2");
196 HeaderList->Add(Header3);
197 }
198
199 EventCutList->SetOwner(kTRUE);
200 AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts];
201 ClusterCutList->SetOwner(kTRUE);
202 AliCaloPhotonCuts **analysisClusterCuts = new AliCaloPhotonCuts*[numberOfCuts];
203 MesonCutList->SetOwner(kTRUE);
204 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
205
206 for(Int_t i = 0; i<numberOfCuts; i++){
207 analysisEventCuts[i] = new AliConvEventCuts();
208 analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data());
209 EventCutList->Add(analysisEventCuts[i]);
210 analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
211
212 analysisClusterCuts[i] = new AliCaloPhotonCuts();
213 analysisClusterCuts[i]->InitializeCutsFromCutString(clusterCutArray[i].Data());
214 ClusterCutList->Add(analysisClusterCuts[i]);
215 analysisClusterCuts[i]->SetFillCutHistograms("");
216
217 analysisMesonCuts[i] = new AliConversionMesonCuts();
218 analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
219 MesonCutList->Add(analysisMesonCuts[i]);
220 analysisMesonCuts[i]->SetFillCutHistograms("");
221 analysisEventCuts[i]->SetAcceptedHeader(HeaderList);
222 }
223 task->SetEventCutList(numberOfCuts,EventCutList);
224 task->SetCaloCutList(numberOfCuts,ClusterCutList);
225 task->SetMesonCutList(numberOfCuts,MesonCutList);
226 task->SetDoMesonAnalysis(kTRUE);
227 task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
228 task->SetDoClusterQA(enableQAClusterTask); //Attention new switch small for Cluster QA
229
230 //connect containers
231 AliAnalysisDataContainer *coutput =
232 mgr->CreateContainer(Form("GammaCalo_%i",trainConfig), TList::Class(),
233 AliAnalysisManager::kOutputContainer,Form("GammaCalo_%i.root",trainConfig));
234
235 mgr->AddTask(task);
236 mgr->ConnectInput(task,0,cinput);
237 mgr->ConnectOutput(task,1,coutput);
238
239 return;
240
241}