- separated Pi0 and Eta for all calo related histograms in the MC routines
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaCalo_pp.C
CommitLineData
ed8bc1ca 1void AddTask_GammaCalo_pp( 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 enableQAClusterTask = 0, // enable additional QA task
5 TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
6 TString cutnumberAODBranch = "0000000060084000001500000" // cutnumber for AOD branch
7 ) {
8
9 // ================= Load Librariers =================================
10 gSystem->Load("libCore.so");
11 gSystem->Load("libTree.so");
12 gSystem->Load("libGeom.so");
13 gSystem->Load("libVMC.so");
14 gSystem->Load("libPhysics.so");
15 gSystem->Load("libMinuit");
16 gSystem->Load("libSTEERBase");
17 gSystem->Load("libESD");
18 gSystem->Load("libAOD");
19 gSystem->Load("libANALYSIS");
20 gSystem->Load("libANALYSISalice");
21 gSystem->Load("libPWGGAGammaConv.so");
22 gSystem->Load("libCDB.so");
23 gSystem->Load("libSTEER.so");
24 gSystem->Load("libSTEERBase.so");
25 gSystem->Load("libTENDER.so");
26 gSystem->Load("libTENDERSupplies.so");
27
28 Int_t isHeavyIon = 0;
29
30 // ================== GetAnalysisManager ===============================
31 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
32 if (!mgr) {
33 Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found.");
34 return ;
35 }
36
37 // ================== GetInputEventHandler =============================
38 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
39
40 //========= Add PID Reponse to ANALYSIS manager ====
41 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
42 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
43 AddTaskPIDResponse(isMC);
44 }
45
46 Printf("here \n");
47
48 //========= Set Cutnumber for V0Reader ================================
49 TString cutnumberPhoton = "060084001001500000000";
50 TString cutnumberEvent = "0000000";
51 Bool_t doEtaShift = kFALSE;
52 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
53
54 //========= Add V0 Reader to ANALYSIS manager if not yet existent =====
55 if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
56 AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
57
58 fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
59 fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
60 fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
61
62 if (!mgr) {
63 Error("AddTask_V0ReaderV1", "No analysis manager found.");
64 return;
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 fEventCuts->DoEtaShift(doEtaShift);
72 fV0ReaderV1->SetEventCuts(fEventCuts);
73 fEventCuts->SetFillCutHistograms("",kTRUE);
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 if(inputHandler->IsA()==AliAODInputHandler::Class()){
88 // AOD mode
89 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
90 }
91 fV0ReaderV1->Init();
92
93 AliLog::SetGlobalLogLevel(AliLog::kFatal);
94
95 //connect input V0Reader
96 mgr->AddTask(fV0ReaderV1);
97 mgr->ConnectInput(fV0ReaderV1,0,cinput);
98 }
99
100 //================================================
101 //========= Add task to the ANALYSIS manager =====
102 //================================================
103 AliAnalysisTaskGammaCalo *task=NULL;
104 task= new AliAnalysisTaskGammaCalo(Form("GammaCalo_%i",trainConfig));
105 task->SetIsHeavyIon(isHeavyIon);
106 task->SetIsMC(isMC);
107 // Cut Numbers to use in Analysis
108 Int_t numberOfCuts = 4;
109
110 TString *eventCutArray = new TString[numberOfCuts];
111 TString *clusterCutArray = new TString[numberOfCuts];
112 TString *mesonCutArray = new TString[numberOfCuts];
113
114 // cluster cuts
115 // 0 "ClusterType", 1 "EtaMin", 2 "EtaMax", 3 "PhiMin", 4 "PhiMax", 5 "DistanceToBadChannel", 6 "Timing", 7 "TrackMatching", 8 "ExoticCell",
116 // 9 "MinEnergy", 10 "MinNCells", 11 "MinM02", 12 "MaxM02", 13 "MinM20", 14 "MaxM20", 15 "MaximumDispersion", 16 "NLM"
117 if (trainConfig == 1){ // EMCAL clusters 2.76 TeV LHC11a, with SDD (0,1), kEMC1 (2,3)
118 eventCutArray[ 0] = "0002011"; clusterCutArray[0] = "10000040022030000"; mesonCutArray[0] = "01631031009000"; // 100 MeV cluster min energy
119 eventCutArray[ 1] = "0002011"; clusterCutArray[1] = "10000040052030000"; mesonCutArray[1] = "01631031009000"; // 300 MeV cluster min energy
120 eventCutArray[ 2] = "0005111"; clusterCutArray[2] = "10000040022030000"; mesonCutArray[2] = "01631031009000"; // 100 MeV cluster min energy
121 eventCutArray[ 3] = "0005111"; clusterCutArray[3] = "10000040052030000"; mesonCutArray[3] = "01631031009000"; // 300 MeV cluster min energy
122 } else if (trainConfig == 2){ // EMCAL clusters, EMCEGA triggers
123 eventCutArray[ 0] = "0008311"; clusterCutArray[0] = "10000040022030000"; mesonCutArray[0] = "01631031009000"; // EMCEG1, 100 MeV cluster min energy
124 eventCutArray[ 1] = "0008311"; clusterCutArray[1] = "10000040052030000"; mesonCutArray[1] = "01631031009000"; // EMCEG1, 300 MeV cluster min energy
125 eventCutArray[ 2] = "0008511"; clusterCutArray[2] = "10000040022030000"; mesonCutArray[2] = "01631031009000"; // EMCEG2, 100 MeV cluster min energy
126 eventCutArray[ 3] = "0008511"; clusterCutArray[3] = "10000040052030000"; mesonCutArray[3] = "01631031009000"; // EMCEG2, 300 MeV cluster min energy
127 } else if (trainConfig == 3){ // EMCAL clusters, EMCEJE triggers
128 eventCutArray[ 0] = "0009311"; clusterCutArray[0] = "10000040022030000"; mesonCutArray[0] = "01631031009000"; // EMCEJ1, 100 MeV cluster min energy
129 eventCutArray[ 1] = "0009311"; clusterCutArray[1] = "10000040052030000"; mesonCutArray[1] = "01631031009000"; // EMCEJ1, 300 MeV cluster min energy
130 eventCutArray[ 2] = "0009511"; clusterCutArray[2] = "10000040022030000"; mesonCutArray[2] = "01631031009000"; // EMCEJ2, 100 MeV cluster min energy
131 eventCutArray[ 3] = "0009511"; clusterCutArray[3] = "10000040052030000"; mesonCutArray[3] = "01631031009000"; // EMCEJ2, 300 MeV cluster min energy
132 } else if (trainConfig == 4){ // EMCAL clusters 2.76 TeV LHC11a, with SDD (0,1), kEMC1 (2,3), track matching 0.035
133 eventCutArray[ 0] = "0002011"; clusterCutArray[0] = "10000042022030000"; mesonCutArray[0] = "01631031009000"; // 100 MeV cluster min energy
134 eventCutArray[ 1] = "0002011"; clusterCutArray[1] = "10000042052030000"; mesonCutArray[1] = "01631031009000"; // 300 MeV cluster min energy
135 eventCutArray[ 2] = "0005111"; clusterCutArray[2] = "10000042022030000"; mesonCutArray[2] = "01631031009000"; // 100 MeV cluster min energy
136 eventCutArray[ 3] = "0005111"; clusterCutArray[3] = "10000042052030000"; mesonCutArray[3] = "01631031009000"; // 300 MeV cluster min energy
137 } else if (trainConfig == 5){ // EMCAL clusters, EMCEGA triggers, track matching 0.035
138 eventCutArray[ 0] = "0008311"; clusterCutArray[0] = "10000042022030000"; mesonCutArray[0] = "01631031009000"; // EMCEG1, 100 MeV cluster min energy
139 eventCutArray[ 1] = "0008311"; clusterCutArray[1] = "10000042052030000"; mesonCutArray[1] = "01631031009000"; // EMCEG1, 300 MeV cluster min energy
140 eventCutArray[ 2] = "0008511"; clusterCutArray[2] = "10000042022030000"; mesonCutArray[2] = "01631031009000"; // EMCEG2, 100 MeV cluster min energy
141 eventCutArray[ 3] = "0008511"; clusterCutArray[3] = "10000042052030000"; mesonCutArray[3] = "01631031009000"; // EMCEG2, 300 MeV cluster min energy
142 } else if (trainConfig == 6){ // EMCAL clusters, EMCEJE triggers, track matching 0.035
143 eventCutArray[ 0] = "0009311"; clusterCutArray[0] = "10000042022030000"; mesonCutArray[0] = "01631031009000"; // EMCEJ1, 100 MeV cluster min energy
144 eventCutArray[ 1] = "0009311"; clusterCutArray[1] = "10000042052030000"; mesonCutArray[1] = "01631031009000"; // EMCEJ1, 300 MeV cluster min energy
145 eventCutArray[ 2] = "0009511"; clusterCutArray[2] = "10000042022030000"; mesonCutArray[2] = "01631031009000"; // EMCEJ2, 100 MeV cluster min energy
146 eventCutArray[ 3] = "0009511"; clusterCutArray[3] = "10000042052030000"; mesonCutArray[3] = "01631031009000"; // EMCEJ2, 300 MeV cluster min energy
147 } else if (trainConfig == 7){ // EMCAL clusters 2.76 TeV LHC11a, with SDD (0,1), kEMC1 (2,3), track matching 0.04
148 eventCutArray[ 0] = "0002011"; clusterCutArray[0] = "10000043022030000"; mesonCutArray[0] = "01631031009000"; // 100 MeV cluster min energy
149 eventCutArray[ 1] = "0002011"; clusterCutArray[1] = "10000043052030000"; mesonCutArray[1] = "01631031009000"; // 300 MeV cluster min energy
150 eventCutArray[ 2] = "0005111"; clusterCutArray[2] = "10000043022030000"; mesonCutArray[2] = "01631031009000"; // 100 MeV cluster min energy
151 eventCutArray[ 3] = "0005111"; clusterCutArray[3] = "10000043052030000"; mesonCutArray[3] = "01631031009000"; // 300 MeV cluster min energy
152 } else if (trainConfig == 8){ // EMCAL clusters, EMCEGA triggers, track matching 0.04
153 eventCutArray[ 0] = "0008311"; clusterCutArray[0] = "10000043022030000"; mesonCutArray[0] = "01631031009000"; // EMCEG1, 100 MeV cluster min energy
154 eventCutArray[ 1] = "0008311"; clusterCutArray[1] = "10000043052030000"; mesonCutArray[1] = "01631031009000"; // EMCEG1, 300 MeV cluster min energy
155 eventCutArray[ 2] = "0008511"; clusterCutArray[2] = "10000043022030000"; mesonCutArray[2] = "01631031009000"; // EMCEG2, 100 MeV cluster min energy
156 eventCutArray[ 3] = "0008511"; clusterCutArray[3] = "10000043052030000"; mesonCutArray[3] = "01631031009000"; // EMCEG2, 300 MeV cluster min energy
157 } else if (trainConfig == 9){ // EMCAL clusters, EMCEJE triggers, track matching 0.04
158 eventCutArray[ 0] = "0009311"; clusterCutArray[0] = "10000043022030000"; mesonCutArray[0] = "01631031009000"; // EMCEJ1, 100 MeV cluster min energy
159 eventCutArray[ 1] = "0009311"; clusterCutArray[1] = "10000043052030000"; mesonCutArray[1] = "01631031009000"; // EMCEJ1, 300 MeV cluster min energy
160 eventCutArray[ 2] = "0009511"; clusterCutArray[2] = "10000043022030000"; mesonCutArray[2] = "01631031009000"; // EMCEJ2, 100 MeV cluster min energy
161 eventCutArray[ 3] = "0009511"; clusterCutArray[3] = "10000043052030000"; mesonCutArray[3] = "01631031009000"; // EMCEJ2, 300 MeV cluster min energy
162 } else if (trainConfig == 31) { //PHOS clusters
163 eventCutArray[ 0] = "0002011"; clusterCutArray[0] = "20000030022000000"; mesonCutArray[0] = "01631031009000"; //pp LHC11a with SDD, PHOS
164 eventCutArray[ 1] = "0000011"; clusterCutArray[1] = "20000030022000000"; mesonCutArray[1] = "01631031009000"; //pp LHC13g default MB
165 eventCutArray[ 2] = "0006111"; clusterCutArray[2] = "20000030022000000"; mesonCutArray[2] = "01631031009000"; //pp LHC11a PHI1
166 eventCutArray[ 3] = "0006211"; clusterCutArray[3] = "20000030022000000"; mesonCutArray[3] = "01631031009000"; //pp LHC11a PHI7
167 } else if (trainConfig == 32) { //PHOS clusters, track matching 0.035
168 eventCutArray[ 0] = "0002011"; clusterCutArray[0] = "20000032022000000"; mesonCutArray[0] = "01631031009000"; //pp LHC11a with SDD, PHOS
169 eventCutArray[ 1] = "0000011"; clusterCutArray[1] = "20000032022000000"; mesonCutArray[1] = "01631031009000"; //pp LHC13g default MB
170 eventCutArray[ 2] = "0006111"; clusterCutArray[2] = "20000032022000000"; mesonCutArray[2] = "01631031009000"; //pp LHC11a PHI1
171 eventCutArray[ 3] = "0006211"; clusterCutArray[3] = "20000032022000000"; mesonCutArray[3] = "01631031009000"; //pp LHC11a PHI7
172 } else if (trainConfig == 32) { //PHOS clusters, track matching 0.04
173 eventCutArray[ 0] = "0002011"; clusterCutArray[0] = "20000033022000000"; mesonCutArray[0] = "01631031009000"; //pp LHC11a with SDD, PHOS
174 eventCutArray[ 1] = "0000011"; clusterCutArray[1] = "20000033022000000"; mesonCutArray[1] = "01631031009000"; //pp LHC13g default MB
175 eventCutArray[ 2] = "0006111"; clusterCutArray[2] = "20000033022000000"; mesonCutArray[2] = "01631031009000"; //pp LHC11a PHI1
176 eventCutArray[ 3] = "0006211"; clusterCutArray[3] = "20000033022000000"; mesonCutArray[3] = "01631031009000"; //pp LHC11a PHI7
177 } else {
178 Error(Form("GammaCalo_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
179 return;
180 }
181
182 TList *EventCutList = new TList();
183 TList *ClusterCutList = new TList();
184 TList *MesonCutList = new TList();
185
186
187 EventCutList->SetOwner(kTRUE);
188 AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts];
189 ClusterCutList->SetOwner(kTRUE);
190 AliCaloPhotonCuts **analysisClusterCuts = new AliCaloPhotonCuts*[numberOfCuts];
191 MesonCutList->SetOwner(kTRUE);
192 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
193
194 for(Int_t i = 0; i<numberOfCuts; i++){
195 analysisEventCuts[i] = new AliConvEventCuts();
196 analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data());
197 EventCutList->Add(analysisEventCuts[i]);
198 analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
199
200 analysisClusterCuts[i] = new AliCaloPhotonCuts();
201 analysisClusterCuts[i]->InitializeCutsFromCutString(clusterCutArray[i].Data());
202 ClusterCutList->Add(analysisClusterCuts[i]);
203 analysisClusterCuts[i]->SetFillCutHistograms("");
204
205 analysisMesonCuts[i] = new AliConversionMesonCuts();
206 analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
207 MesonCutList->Add(analysisMesonCuts[i]);
208 analysisMesonCuts[i]->SetFillCutHistograms("");
209 }
210 task->SetEventCutList(numberOfCuts,EventCutList);
211 task->SetCaloCutList(numberOfCuts,ClusterCutList);
212 task->SetMesonCutList(numberOfCuts,MesonCutList);
213 task->SetDoMesonAnalysis(kTRUE);
214 task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
215 task->SetDoClusterQA(enableQAClusterTask); //Attention new switch small for Cluster QA
216
217 //connect containers
218 AliAnalysisDataContainer *coutput =
219 mgr->CreateContainer(Form("GammaCalo_%i",trainConfig), TList::Class(),
220 AliAnalysisManager::kOutputContainer,Form("GammaCalo_%i.root",trainConfig));
221
222 mgr->AddTask(task);
223 mgr->ConnectInput(task,0,cinput);
224 mgr->ConnectOutput(task,1,coutput);
225
226 return;
227
228}