TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvDalitzV1_pp.C
CommitLineData
78f10f58 1void AddTask_GammaConvDalitzV1_pp( Int_t trainConfig = 1, //change different set of cuts
2 Bool_t isMC = kFALSE, //run MC
3 TString fileNameInputForWeighting = "MCSpectraInput.root" // path to file for weigting input
4 ) {
5
6 // ================= Load Librariers =================================
230b7aff 7 gSystem->Load("libCore");
8 gSystem->Load("libTree");
9 gSystem->Load("libGeom");
10 gSystem->Load("libVMC");
11 gSystem->Load("libPhysics");
78f10f58 12 gSystem->Load("libMinuit");
13 gSystem->Load("libSTEERBase");
14 gSystem->Load("libESD");
15 gSystem->Load("libAOD");
16 gSystem->Load("libANALYSIS");
17 gSystem->Load("libANALYSISalice");
230b7aff 18 gSystem->Load("libPWGGAGammaConv");
19 gSystem->Load("libCDB");
20 gSystem->Load("libSTEER");
21 gSystem->Load("libSTEERBase");
22 gSystem->Load("libTender");
23 gSystem->Load("libTenderSupplies");
80dde3ee 24
25 Int_t isHeavyIon = 0;
78f10f58 26
27 // ================== GetAnalysisManager ===============================
28 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
29 if (!mgr) {
30 Error(Form("AddTask_GammaConvDalitzV1_%i",trainConfig), "No analysis manager found.");
31 return ;
32 }
33
34 // ================== GetInputEventHandler =============================
35 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
36
37 //========= Add PID Reponse to ANALYSIS manager ====
38 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
39 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
40 AddTaskPIDResponse(isMC);
41 }
42
43 //========= Set Cutnumber for V0Reader ================================
44
45
80dde3ee 46 //TString cutnumber = "00000000000840010015000000";
3013611f 47 TString cutnumberPhoton = "002000084000002200000000";
80dde3ee 48 TString cutnumberEvent = "0000000";
49
50
78f10f58 51 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
52
53 //========= Add V0 Reader to ANALYSIS manager if not yet existent =====
80dde3ee 54 if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
55
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
67 AliConvEventCuts *fEventCuts=NULL;
68 if(cutnumberEvent!=""){
69 fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data());
70 fEventCuts->SetPreSelectionCutFlag(kTRUE);
71 if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){
72 fV0ReaderV1->SetEventCuts(fEventCuts);
73 fEventCuts->SetFillCutHistograms("",kTRUE);
74 }
75 }
76
77 // Set AnalysisCut Number
78 AliConversionPhotonCuts *fCuts=NULL;
79 if(cutnumberPhoton!=""){
80 fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data());
81 fCuts->SetPreSelectionCutFlag(kTRUE);
82 fCuts->SetIsHeavyIon(isHeavyIon);
83 if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){
84 fV0ReaderV1->SetConversionCuts(fCuts);
85 fCuts->SetFillCutHistograms("",kTRUE);
86 }
87 }
88 if(inputHandler->IsA()==AliAODInputHandler::Class()){
89 // AOD mode
90 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
91 }
92 fV0ReaderV1->Init();
93
94 AliLog::SetGlobalLogLevel(AliLog::kInfo);
95
96 //connect input V0Reader
97 mgr->AddTask(fV0ReaderV1);
98 mgr->ConnectInput(fV0ReaderV1,0,cinput);
99
100 }
78f10f58 101
78f10f58 102
103
80dde3ee 104 if( !(AliDalitzElectronSelector*)mgr->GetTask("ElectronSelector") ){
78f10f58 105
80dde3ee 106
78f10f58 107
108 AliDalitzElectronSelector *fElectronSelector = new AliDalitzElectronSelector("ElectronSelector");
109
110 //ConfigV0ReaderV1(fV0ReaderV1,ConvCutnumber,IsHeavyIon);
111
112
113
114 // Set AnalysisCut Number
115
116 AliDalitzElectronCuts *fElecCuts=0;
117
80dde3ee 118 TString ElecCuts = "90005400000002000000";
78f10f58 119
120
121
122 if( ElecCuts!=""){
123
124 fElecCuts= new AliDalitzElectronCuts(ElecCuts.Data(),ElecCuts.Data());
125
126 if(fElecCuts->InitializeCutsFromCutString(ElecCuts.Data())){
127
128 fElectronSelector->SetDalitzElectronCuts(fElecCuts);
129
130 fElecCuts->SetFillCutHistograms("",kTRUE);
131
132 }
133
134 }
135
136 fElectronSelector->Init();
80dde3ee 137 mgr->AddTask(fElectronSelector);
138 //connect input fElectronSelector
139
140 mgr->ConnectInput (fElectronSelector,0,cinput);
141
78f10f58 142 }
143
144
145
80dde3ee 146
78f10f58 147
148
149
150
151
152 //================================================
153 //========= Add task to the ANALYSIS manager =====
154 // find input container
155 AliAnalysisTaskGammaConvDalitzV1 *task=NULL;
156 task= new AliAnalysisTaskGammaConvDalitzV1(Form("GammaConvDalitzV1_%i",trainConfig));
157 task->SetIsHeavyIon(0);
158 task->SetIsMC(isMC);
159
160
161 // Cut Numbers to use in Analysis
162 Int_t numberOfCuts = 2;
78f10f58 163
80dde3ee 164 TString *eventCutArray = new TString[numberOfCuts];
165 TString *photonCutArray = new TString[numberOfCuts];
166 TString *MesonCutarray = new TString[numberOfCuts];
167 TString *ElecCutarray = new TString[numberOfCuts];
78f10f58 168
80dde3ee 169
78f10f58 170
171
172 if(trainConfig == 1){
80dde3ee 173 //TOF PID
3013611f 174 eventCutArray[0]="0000011"; photonCutArray[0] = "002000093663027800000000"; MesonCutarray[0] = "01631031009000";ElecCutarray[0] = "90478403253102621000"; //TOF[-3,5] 0.0 sigmas at low Pt for pion rejection, Pt 0.125 cut, DCAxy Pt Dep, No Mass(e+,e-) FindCluster > 0.0
175 eventCutArray[1]="0000011"; photonCutArray[1] = "002000093663027800000000"; MesonCutarray[1] = "01631031009000";ElecCutarray[1] = "90478404253102621000"; //TOF[-2,3] 0.0 sigmas at low Pt for pion rejection, Pt 0.125 cut, DCAxy Pt Dep, No Mass(e+,e-) FindCluster > 0.0
78f10f58 176 } else if (trainConfig == 2) {
177 //TOF PID
3013611f 178 eventCutArray[0]="0000011"; photonCutArray[0] = "002000093663027800000000"; MesonCutarray[0] = "01631031009000";ElecCutarray[0] = "90478403253102621000"; //TOF[-3,5] 0.0 sigmas at low Pt for pion rejection, Pt 0.125 cut, DCAxy Pt Dep, No Mass(e+,e-) FindCluster > 0.0
179 eventCutArray[1]="0000011"; photonCutArray[1] = "002000093663027800000000"; MesonCutarray[1] = "01631031009000";ElecCutarray[1] = "90478404253102621000"; //TOF[-2,3] 0.0 sigmas at low Pt for pion rejection, Pt 0.125 cut, DCAxy Pt Dep, No Mass(e+,e-) FindCluster > 0.0
78f10f58 180 } else if (trainConfig == 3) {
181 //TOF PID
3013611f 182 eventCutArray[0]="0000011"; photonCutArray[0] = "002000093663027800000000"; MesonCutarray[0] = "01631031009000";ElecCutarray[0] = "90478403253102621000"; //TOF[-3,5] 0.0 sigmas at low Pt for pion rejection, Pt 0.125 cut, DCAxy Pt Dep, No Mass(e+,e-) FindCluster > 0.0
183 eventCutArray[1]="0000011"; photonCutArray[1] = "002000093663027800000000"; MesonCutarray[1] = "01631031009000";ElecCutarray[1] = "90478404253102621000"; //TOF[-2,3] 0.0 sigmas at low Pt for pion rejection, Pt 0.125 cut, DCAxy Pt Dep, No Mass(e+,e-) FindCluster > 0.0
78f10f58 184 } else {
185 Error(Form("GammaConvDalitzV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
186 return;
187 }
188
80dde3ee 189 TList *EventCutList = new TList();
78f10f58 190 TList *ConvCutList = new TList();
191 TList *MesonCutList = new TList();
192 TList *ElecCutList = new TList();
193
194 TList *HeaderList = new TList();
195 TObjString *Header2 = new TObjString("BOX");
196 HeaderList->Add(Header2);
80dde3ee 197
198 EventCutList->SetOwner(kTRUE);
199 AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts];
78f10f58 200 ConvCutList->SetOwner(kTRUE);
80dde3ee 201 AliConversionPhotonCuts **analysisCuts = new AliConversionPhotonCuts*[numberOfCuts];
78f10f58 202 MesonCutList->SetOwner(kTRUE);
203 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
204 ElecCutList->SetOwner(kTRUE);
205 AliDalitzElectronCuts **analysisElecCuts = new AliDalitzElectronCuts*[numberOfCuts];
206
207
208
209 for(Int_t i = 0; i<numberOfCuts; i++){
210
211
80dde3ee 212 TString cutName( Form("%s_%s_%s_%s",eventCutArray[i].Data(),photonCutArray[i].Data(),ElecCutarray[i].Data(),MesonCutarray[i].Data() ) );
78f10f58 213
80dde3ee 214 analysisEventCuts[i] = new AliConvEventCuts();
215 analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data());
216 EventCutList->Add(analysisEventCuts[i]);
217 analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
218
219
220 analysisCuts[i] = new AliConversionPhotonCuts();
221 analysisCuts[i]->InitializeCutsFromCutString(photonCutArray[i].Data());
78f10f58 222 ConvCutList->Add(analysisCuts[i]);
223 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
224
225 analysisMesonCuts[i] = new AliConversionMesonCuts();
226 analysisMesonCuts[i]->InitializeCutsFromCutString(MesonCutarray[i].Data());
227 MesonCutList->Add(analysisMesonCuts[i]);
228 analysisMesonCuts[i]->SetFillCutHistograms("");
229
230
231 analysisElecCuts[i] = new AliDalitzElectronCuts();
232 analysisElecCuts[i]->InitializeCutsFromCutString(ElecCutarray[i].Data());
233 ElecCutList->Add(analysisElecCuts[i]);
234 analysisElecCuts[i]->SetFillCutHistograms("",kFALSE,cutName);
78f10f58 235
80dde3ee 236
237 analysisEventCuts[i]->SetAcceptedHeader(HeaderList);
78f10f58 238
239 }
240
80dde3ee 241 task->SetEventCutList(numberOfCuts,EventCutList);
78f10f58 242 task->SetConversionCutList(numberOfCuts,ConvCutList);
243 task->SetMesonCutList(MesonCutList);
244 task->SetElectronCutList(ElecCutList);
245 task->SetMoveParticleAccordingToVertex(kTRUE);
246 //task->SetDoMesonAnalysis(kTRUE);
247 //if (enableQAMesonTask) task->SetDoMesonQA(kTRUE); //Attention new switch for Pi0 QA
248 //if (enableQAMesonTask) task->SetDoPhotonQA(kTRUE); //Attention new switch small for Photon QA
249
250 //connect containers
251 AliAnalysisDataContainer *coutput =
80dde3ee 252 mgr->CreateContainer(Form("GammaConvDalitzV1_%i",trainConfig), TList::Class(),
78f10f58 253 AliAnalysisManager::kOutputContainer,Form("GammaConvV1_%i.root",trainConfig));
254
255 mgr->AddTask(task);
256 mgr->ConnectInput(task,0,cinput);
257 mgr->ConnectOutput(task,1,coutput);
258
259 return;
260
261}