- added new tasks for combination of EMCAL and PCM for pi0 and photons
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvCalo_PbPb.C
CommitLineData
8bdca7f1 1void AddTask_GammaConvCalo_PbPb( 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 headerSelectionInt = 0, // 1 pi0 header, 2 eta header, 3 both (only for "named" boxes)
7 TString cutnumberAODBranch = "1000000060084000001500000",
8 TString periodName = "LHC13d2", //name of the period for added signals and weighting
9 Bool_t doWeighting = kFALSE //enable Weighting
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");
24 gSystem->Load("libPWGGAGammaConv.so");
25 gSystem->Load("libCDB.so");
26 gSystem->Load("libSTEER.so");
27 gSystem->Load("libSTEERBase.so");
28 gSystem->Load("libTENDER.so");
29 gSystem->Load("libTENDERSupplies.so");
30
31 // ================== GetAnalysisManager ===============================
32 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
33 if (!mgr) {
34 Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found.");
35 return ;
36 }
37
38 // ================== GetInputEventHandler =============================
39 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
40
41 //========= Add PID Reponse to ANALYSIS manager ====
42 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
43 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
44 AddTaskPIDResponse(isMC,1,0,4,0,"",1,1,4);
45 }
46
47 //========= Set Cutnumber for V0Reader ================================
48 TString cutnumber = "1000000000084001001500000000";
49 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
50
51 //========= Add V0 Reader to ANALYSIS manager if not yet existent =====
52 if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
53 AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
54
55 fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
56 fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
57 fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
58
59 if (!mgr) {
60 Error("AddTask_V0ReaderV1", "No analysis manager found.");
61 return;
62 }
63
64 // Set AnalysisCut Number
65 AliConversionCuts *fCuts=NULL;
66 if(cutnumber!=""){
67 fCuts= new AliConversionCuts(cutnumber.Data(),cutnumber.Data());
68 fCuts->SetPreSelectionCutFlag(kTRUE);
69 if(fCuts->InitializeCutsFromCutString(cutnumber.Data())){
70 fV0ReaderV1->SetConversionCuts(fCuts);
71 fCuts->SetFillCutHistograms("",kTRUE);
72 }
73 }
74 if(inputHandler->IsA()==AliAODInputHandler::Class()){
75 // AOD mode
76 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
77 }
78 fV0ReaderV1->Init();
79
80 AliLog::SetGlobalLogLevel(AliLog::kFatal);
81
82 //connect input V0Reader
83 mgr->AddTask(fV0ReaderV1);
84 mgr->ConnectInput(fV0ReaderV1,0,cinput);
85
86 }
87
88 //================================================
89 //========= Add task to the ANALYSIS manager =====
90 //================================================
91 AliAnalysisTaskGammaConvCalo *task=NULL;
92 task= new AliAnalysisTaskGammaConvCalo(Form("GammaConvCalo_%i",trainConfig));
93 task->SetIsHeavyIon(1);
94 task->SetIsMC(isMC);
95 // Cut Numbers to use in Analysis
96 Int_t numberOfCuts = 5;
97
98 TString *cutarray = new TString[numberOfCuts];
99 TString *clustercutarray = new TString[numberOfCuts];
100 TString *mesonCutArray = new TString[numberOfCuts];
101
102 // meson cuts
103 // meson type (Dalitz or not), BG scheme, pool depth, rotation degrees, rapidity cut, radius cut, alpha, chi2, shared electrons, reject to close v0, MC smearing, dca, dca, dca
104
105 if (trainConfig == 1){
106 cutarray[ 0] = "6010001002092970028250400000"; clustercutarray[0] = "10000040022030000"; mesonCutArray[ 0] = "01525065000000"; // 0-5%
107 cutarray[ 1] = "6120001002092970028250400000"; clustercutarray[1] = "10000040022030000"; mesonCutArray[ 1] = "01525065000000"; // 5-10%
108 cutarray[ 2] = "5010001002092970028250400000"; clustercutarray[2] = "10000040022030000"; mesonCutArray[ 2] = "01525065000000"; // 0-10%
109 cutarray[ 3] = "5240001002092970028250400000"; clustercutarray[3] = "10000040022030000"; mesonCutArray[ 3] = "01525065000000"; // 20-40%
110 cutarray[ 4] = "5250001002092970028250400000"; clustercutarray[4] = "10000040022030000"; mesonCutArray[ 4] = "01525065000000"; // 20-50%
111 } else {
112 Error(Form("GammaConvCalo_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
113 return;
114 }
115
116 TList *ConvCutList = new TList();
117 TList *MesonCutList = new TList();
118
119 TList *HeaderList = new TList();
120 if (periodName.CompareTo("LHC13d2")==0){
121 TObjString *Header1 = new TObjString("pi0_1");
122 HeaderList->Add(Header1);
123 // TObjString *Header3 = new TObjString("eta_2");
124 // HeaderList->Add(Header3);
125
126 } else if (periodName.CompareTo("LHC12a17x_fix")==0){
127 TObjString *Header1 = new TObjString("PARAM");
128 HeaderList->Add(Header1);
129 } else if (periodName.CompareTo("LHC14a1a")==0){
130 if (headerSelectionInt == 1){
131 TObjString *Header1 = new TObjString("pi0_1");
132 HeaderList->Add(Header1);
133 } else if (headerSelectionInt == 2){
134 TObjString *Header1 = new TObjString("eta_2");
135 HeaderList->Add(Header1);
136 } else {
137 TObjString *Header1 = new TObjString("pi0_1");
138 HeaderList->Add(Header1);
139 TObjString *Header2 = new TObjString("eta_2");
140 HeaderList->Add(Header2);
141 }
142 } else if (periodName.CompareTo("LHC14a1b")==0 || periodName.CompareTo("LHC14a1c")==0){
143 TObjString *Header1 = new TObjString("BOX");
144 HeaderList->Add(Header1);
145 }
146
147 ConvCutList->SetOwner(kTRUE);
148 AliConversionCuts **analysisCuts = new AliConversionCuts*[numberOfCuts];
149 ClusterCutList->SetOwner(kTRUE);
150 AliCaloPhotonCuts **analysisClusterCuts = new AliCaloPhotonCuts*[numberOfCuts];
151 MesonCutList->SetOwner(kTRUE);
152 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
153
154 for(Int_t i = 0; i<numberOfCuts; i++){
155 analysisCuts[i] = new AliConversionCuts();
156
157 if ( trainConfig == 1){
158 if (periodName.CompareTo("LHC14a1a") ==0 || periodName.CompareTo("LHC14a1b") ==0 || periodName.CompareTo("LHC14a1c") ==0 ){
159 if ( i == 0 && doWeighting) analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kTRUE, kFALSE,fileNameInputForWeighting, Form("Pi0_Hijing_%s_PbPb_2760GeV_0005TPC",periodName.Data()), Form("Eta_Hijing_%s_PbPb_2760GeV_0005TPC",periodName.Data()), "","Pi0_Fit_Data_PbPb_2760GeV_0005V0M","Eta_Fit_Data_PbPb_2760GeV_0005V0M");
160 if ( i == 1 && doWeighting) analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kTRUE, kFALSE,fileNameInputForWeighting, Form("Pi0_Hijing_%s_PbPb_2760GeV_0510TPC",periodName.Data()), Form("Eta_Hijing_%s_PbPb_2760GeV_0510TPC",periodName.Data()), "","Pi0_Fit_Data_PbPb_2760GeV_0510V0M","Eta_Fit_Data_PbPb_2760GeV_0510V0M");
161 if ( i == 2 && doWeighting) analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kTRUE, kFALSE,fileNameInputForWeighting, Form("Pi0_Hijing_%s_PbPb_2760GeV_0010TPC",periodName.Data()), Form("Eta_Hijing_%s_PbPb_2760GeV_0010TPC",periodName.Data()), "","Pi0_Fit_Data_PbPb_2760GeV_0010V0M","Eta_Fit_Data_PbPb_2760GeV_0010V0M");
162 if ( i == 3 && doWeighting) analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kTRUE, kFALSE,fileNameInputForWeighting, Form("Pi0_Hijing_%s_PbPb_2760GeV_2040TPC",periodName.Data()), Form("Eta_Hijing_%s_PbPb_2760GeV_2040TPC",periodName.Data()), "","Pi0_Fit_Data_PbPb_2760GeV_2040V0M","Eta_Fit_Data_PbPb_2760GeV_2040V0M");
163 if ( i == 4 && doWeighting) analysisCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kTRUE, kFALSE,fileNameInputForWeighting, Form("Pi0_Hijing_%s_PbPb_2760GeV_2050TPC",periodName.Data()), Form("Eta_Hijing_%s_PbPb_2760GeV_2050TPC",periodName.Data()), "","Pi0_Fit_Data_PbPb_2760GeV_2050V0M","Eta_Fit_Data_PbPb_2760GeV_2050V0M");
164 }
165 }
166 analysisCuts[i]->InitializeCutsFromCutString(cutarray[i].Data());
167 if (periodName.CompareTo("LHC14a1b") ==0 || periodName.CompareTo("LHC14a1c") ==0 ){
168 if (headerSelectionInt == 1) analysisCuts[i]->SetAddedSignalPDGCode(111);
169 if (headerSelectionInt == 2) analysisCuts[i]->SetAddedSignalPDGCode(221);
170 }
171 ConvCutList->Add(analysisCuts[i]);
172
173 analysisClusterCuts[i] = new AliCaloPhotonCuts();
174 analysisClusterCuts[i]->InitializeCutsFromCutString(clustercutarray[i].Data());
175 ClusterCutList->Add(analysisClusterCuts[i]);
176 analysisClusterCuts[i]->SetFillCutHistograms("");
177
178 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
179 analysisMesonCuts[i] = new AliConversionMesonCuts();
180 analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
181 MesonCutList->Add(analysisMesonCuts[i]);
182 analysisMesonCuts[i]->SetFillCutHistograms("");
183 analysisCuts[i]->SetAcceptedHeader(HeaderList);
184 }
185
186 task->SetConversionCutList(numberOfCuts,ConvCutList);
187 task->SetCaloCutList(numberOfCuts,ClusterCutList);
188 task->SetMesonCutList(numberOfCuts,MesonCutList);
189 task->SetMoveParticleAccordingToVertex(kTRUE);
190 task->SetDoMesonAnalysis(kTRUE);
191 task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
192 task->SetDoPhotonQA(enableQAPhotonTask); //Attention new switch small for Photon QA
193
194 //connect containers
195 AliAnalysisDataContainer *coutput =
196 mgr->CreateContainer(Form("GammaConvCalo_%i",trainConfig), TList::Class(),
197 AliAnalysisManager::kOutputContainer,Form("GammaConvCalo_%i.root",trainConfig));
198
199 mgr->AddTask(task);
200 mgr->ConnectInput(task,0,cinput);
201 mgr->ConnectOutput(task,1,coutput);
202
203 return;
204
205}