Additional histogram in PID monitor + adding lines to ESDTrackCut to make sqrt of...
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvV1_pp.C
CommitLineData
33bbd991 1void AddTask_GammaConvV1_pp( Int_t trainConfig = 1, //change different set of cuts
2 Bool_t isMC = kFALSE, //run MC
ae4f2cfb 3 Int_t enableQAMesonTask = 0, //enable QA in AliAnalysisTaskGammaConvV1
4 Int_t enableQAPhotonTask = 0, // enable additional QA task
a7f0b705 5 TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
6 TString cutnumberAODBranch = "0000000060084001001500000" // cutnumber for AOD branch
33bbd991 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 // ================== GetAnalysisManager ===============================
29 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
30 if (!mgr) {
31 Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found.");
32 return ;
33 }
34
35 // ================== GetInputEventHandler =============================
36 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
37
38 //========= Add PID Reponse to ANALYSIS manager ====
39 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
40 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
41 AddTaskPIDResponse(isMC);
42 }
43
44 //========= Set Cutnumber for V0Reader ================================
ae4f2cfb 45 TString cutnumber = "0000000002084000002200000000";
b0e0bc89 46 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
33bbd991 47
48 //========= Add V0 Reader to ANALYSIS manager if not yet existent =====
49 if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
50 AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
51
52 fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
53 fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
54 fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
55
56 if (!mgr) {
57 Error("AddTask_V0ReaderV1", "No analysis manager found.");
58 return;
59 }
60
61 // Set AnalysisCut Number
62 AliConversionCuts *fCuts=NULL;
63 if(cutnumber!=""){
64 fCuts= new AliConversionCuts(cutnumber.Data(),cutnumber.Data());
65 fCuts->SetPreSelectionCutFlag(kTRUE);
66 if(fCuts->InitializeCutsFromCutString(cutnumber.Data())){
67 fV0ReaderV1->SetConversionCuts(fCuts);
68 fCuts->SetFillCutHistograms("",kTRUE);
69 }
70 }
a7f0b705 71 if(inputHandler->IsA()==AliAODInputHandler::Class()){
72 // AOD mode
73 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
74 }
33bbd991 75 fV0ReaderV1->Init();
76
77 AliLog::SetGlobalLogLevel(AliLog::kInfo);
78
33bbd991 79 //connect input V0Reader
80 mgr->AddTask(fV0ReaderV1);
81 mgr->ConnectInput(fV0ReaderV1,0,cinput);
82
83 }
84
85 //================================================
86 //========= Add task to the ANALYSIS manager =====
33bbd991 87 // find input container
88 AliAnalysisTaskGammaConvV1 *task=NULL;
89 task= new AliAnalysisTaskGammaConvV1(Form("GammaConvV1_%i",trainConfig));
90 task->SetIsHeavyIon(0);
91 task->SetIsMC(isMC);
92 // Cut Numbers to use in Analysis
93 Int_t numberOfCuts = 4;
94
95 TString *cutarray = new TString[numberOfCuts];
96 TString *mesonCutArray = new TString[numberOfCuts];
97
b0e0bc89 98 if(trainConfig == 1){
ae4f2cfb 99 cutarray[ 0] = "0000012002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , only boxes
100 cutarray[ 1] = "0001012002093663003800000000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD, V0AND , only boxes
101 cutarray[ 2] = "0000012002093260003800000000"; mesonCutArray[2] = "01631031009000"; //standard cut Gamma pp 2-76TeV , only boxes
102 cutarray[ 3] = "0000012002093260003800000000"; mesonCutArray[3] = "01631031009000"; //standard cut Gamma pp 2-76TeV , only boxes
33bbd991 103 } else if (trainConfig == 2) {
ae4f2cfb 104 cutarray[ 0] = "0000011002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , only Minbias MC
105 cutarray[ 1] = "0001011002093663003800000000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD, V0AND
106 cutarray[ 2] = "0000011002093260003800000000"; mesonCutArray[2] = "01631031009000"; //standard cut Gamma pp 2-76TeV
072021d3 107 cutarray[ 3] = "0000011002093260003800000000"; mesonCutArray[3] = "01631031009000"; //standard cut Gamma pp 2-76TeV
33bbd991 108 } else if (trainConfig == 3) {
ae4f2cfb 109 cutarray[ 0] = "0002011002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , only Minbias MC
110 cutarray[ 1] = "0003011002093663003800000000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND , only Minbias MC
111 cutarray[ 2] = "0002012002093663003800000000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , only Boxes MC
112 cutarray[ 3] = "0003012002093663003800000000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND, only Boxes MC
072021d3 113 } else if (trainConfig == 4) {
114 cutarray[ 0] = "0000011002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , all photon qualities
115 cutarray[ 1] = "0000011002093663003800020000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , photon quality 1
116 cutarray[ 2] = "0000011002093663003800030000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , photon quality 2
88202ecb 117 cutarray[ 3] = "0000011002093663003800040000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , photon quality 3
072021d3 118 } else if (trainConfig == 5) {
119 cutarray[ 0] = "0000011007093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , all photon qualities, min R = 35 cm
120 cutarray[ 1] = "0000011007093663003800020000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , photon quality 1, min R = 35 cm
121 cutarray[ 2] = "0000011007093663003800030000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , photon quality 2, min R = 35 cm
122 cutarray[ 3] = "0000011007093663003800040000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 2.76TeV without SDD , photon quality 3, min R = 35 cm
e260262f 123 } else if (trainConfig == 6) {
072021d3 124 cutarray[ 0] = "0000011002083663003200000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 7TeV, with qt cut 0.05, all photon qualities
125 cutarray[ 1] = "0000011002083663003200020000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 7TeV, with qt cut 0.05, photon quality 1
126 cutarray[ 2] = "0000011002083663003200030000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 7TeV, with qt cut 0.05, photon quality 2
127 cutarray[ 3] = "0000011002083663003200040000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 7TeV, with qt cut 0.05, photon quality 3
e260262f 128 } else if (trainConfig == 7) {
072021d3 129 cutarray[ 0] = "0000011007083663003200000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 7TeV, with qt cut 0.05, all photon qualities, min R = 35 cm
130 cutarray[ 1] = "0000011007083663003200020000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 7TeV, with qt cut 0.05, photon quality 1, min R = 35 cm
131 cutarray[ 2] = "0000011007083663003200030000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 7TeV, with qt cut 0.05, photon quality 2, min R = 35 cm
132 cutarray[ 3] = "0000011007083663003200040000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 7TeV, with qt cut 0.05, photon quality 3, min R = 35 cm
e260262f 133 } else if (trainConfig == 8) {
072021d3 134 cutarray[ 0] = "0000011002083663000200000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 7TeV, all photon qualities
135 cutarray[ 1] = "0000011002083663000200020000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 7TeV, photon quality 1
136 cutarray[ 2] = "0000011002083663000200030000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 7TeV, photon quality 2
137 cutarray[ 3] = "0000011002083663000200040000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 7TeV, photon quality 3
e260262f 138 } else if (trainConfig == 9) {
072021d3 139 cutarray[ 0] = "0000011007083663000200000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 7TeV, all photon qualities, min R = 35 cm
140 cutarray[ 1] = "0000011007083663000200020000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 7TeV, photon quality 1, min R = 35 cm
141 cutarray[ 2] = "0000011007083663000200030000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 7TeV, photon quality 2, min R = 35 cm
142 cutarray[ 3] = "0000011007083663000200040000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 7TeV, photon quality 3, min R = 35 cm
048db199 143 } else if (trainConfig == 10) {
144 cutarray[ 0] = "0002011002093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , all photon qualities
145 cutarray[ 1] = "0002011002093663003800020000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 1
146 cutarray[ 2] = "0002011002093663003800030000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 2
88202ecb 147 cutarray[ 3] = "0002011002093663003800040000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 3
048db199 148 } else if (trainConfig == 11) {
149 cutarray[ 0] = "0002011007093663003800000000"; mesonCutArray[0] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , all photon qualities, min R = 35 cm
150 cutarray[ 1] = "0002011007093663003800020000"; mesonCutArray[1] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 1, min R = 35 cm
151 cutarray[ 2] = "0002011007093663003800030000"; mesonCutArray[2] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 2, min R = 35 cm
88202ecb 152 cutarray[ 3] = "0002011007093663003800040000"; mesonCutArray[3] = "01631031009000"; //standard cut Pi0 pp 2.76TeV with SDD , photon quality 3, min R = 35 cm
153 } else if (trainConfig == 12) {
8ce39d2b 154 cutarray[ 0] = "0000011002092970028250400000"; mesonCutArray[0] = "01525065000000"; //standard cut LHC11h pp 2.76TeV
60ade4a1 155 cutarray[ 1] = "0000011032092970028250400000"; mesonCutArray[1] = "01525065000000"; //variation eta 0.65
8ce39d2b 156 cutarray[ 2] = "0000011042092970028250400000"; mesonCutArray[2] = "01525065000000"; //variation eta 0.75
157 cutarray[ 3] = "0000011002092950028250400000"; mesonCutArray[3] = "01525065000000"; //variation pion p dEdx 0.3-5.
158 } else if (trainConfig == 13) { //added signals
159 cutarray[ 0] = "0000012002092970028250400000"; mesonCutArray[0] = "01525065000000"; //standard cut LHC11h pp 2.76TeV
60ade4a1 160 cutarray[ 1] = "0000012032092970028250400000"; mesonCutArray[1] = "01525065000000"; //variation eta 0.65
8ce39d2b 161 cutarray[ 2] = "0000012042092970028250400000"; mesonCutArray[2] = "01525065000000"; //variation eta 0.75
162 cutarray[ 3] = "0000012002092950028250400000"; mesonCutArray[3] = "01525065000000"; //variation pion p dEdx 0.3-5.
163 } else if (trainConfig == 14) {
164 cutarray[ 0] = "0000011002492970028250400000"; mesonCutArray[0] = "01525065000000"; //variation pt 0.075
60ade4a1 165 cutarray[ 1] = "0000011002192970028250400000"; mesonCutArray[1] = "01525065000000"; //variation pt 0.1
8ce39d2b 166 cutarray[ 2] = "0000011002062970028250400000"; mesonCutArray[2] = "01525065000000"; //variation TPC cls 0.7
167 cutarray[ 3] = "0000011002082970028250400000"; mesonCutArray[3] = "01525065000000"; //variation TPC cls 0.35
168 } else if (trainConfig == 15) { //added signals
169 cutarray[ 0] = "0000012002492970028250400000"; mesonCutArray[0] = "01525065000000"; //variation pt 0.075
60ade4a1 170 cutarray[ 1] = "0000012002192970028250400000"; mesonCutArray[1] = "01525065000000"; //variation pt 0.1
8ce39d2b 171 cutarray[ 2] = "0000012002062970028250400000"; mesonCutArray[2] = "01525065000000"; //variation TPC cls 0.7
172 cutarray[ 3] = "0000012002082970028250400000"; mesonCutArray[3] = "01525065000000"; //variation TPC cls 0.35
173 } else if (trainConfig == 16) {
174 cutarray[ 0] = "0000011002093970028250400000"; mesonCutArray[0] = "01525065000000"; //variation edEdx -4,5
60ade4a1 175 cutarray[ 1] = "0000011002096970028250400000"; mesonCutArray[1] = "01525065000000"; //variation edEdx -2.5,4
8ce39d2b 176 cutarray[ 2] = "0000011002092970038250400000"; mesonCutArray[2] = "01525065000000"; //variation TOF el. PID -3,5
177 cutarray[ 3] = "0000011002092970048250400000"; mesonCutArray[3] = "01525065000000"; //variation TOF el. PID -2,3
178 } else if (trainConfig == 17) { //added signals
179 cutarray[ 0] = "0000012002093970028250400000"; mesonCutArray[0] = "01525065000000"; //variation edEdx -4,5
60ade4a1 180 cutarray[ 1] = "0000012002096970028250400000"; mesonCutArray[1] = "01525065000000"; //variation edEdx -2.5,4
8ce39d2b 181 cutarray[ 2] = "0000012002092970038250400000"; mesonCutArray[2] = "01525065000000"; //variation TOF el. PID -3,5
182 cutarray[ 3] = "0000012002092970048250400000"; mesonCutArray[3] = "01525065000000"; //variation TOF el. PID -2,3
183 } else if (trainConfig == 18) {
184 cutarray[ 0] = "0000011002092970029250400000"; mesonCutArray[0] = "01525065000000"; //variation qt 0.03
60ade4a1 185 cutarray[ 1] = "0000011002092970022250400000"; mesonCutArray[1] = "01525065000000"; //variation qt 0.07 no2D
8ce39d2b 186 cutarray[ 2] = "0000011002092970028150400000"; mesonCutArray[2] = "01525065000000"; //variation chi2 50.
187 cutarray[ 3] = "0000011002092970028850400000"; mesonCutArray[3] = "01525065000000"; //variation chi2 20.
188 } else if (trainConfig == 19) { //added signals
189 cutarray[ 0] = "0000012002092970029250400000"; mesonCutArray[0] = "01525065000000"; //variation qt 0.03
60ade4a1 190 cutarray[ 1] = "0000012002092970022250400000"; mesonCutArray[1] = "01525065000000"; //variation qt 0.07 no2D
8ce39d2b 191 cutarray[ 2] = "0000012002092970028150400000"; mesonCutArray[2] = "01525065000000"; //variation chi2 50.
192 cutarray[ 3] = "0000012002092970028850400000"; mesonCutArray[3] = "01525065000000"; //variation chi2 20.
193 } else if (trainConfig == 20) {
194 cutarray[ 0] = "0000011002092970028260400000"; mesonCutArray[0] = "01525065000000"; //variation psi pair 0.05
60ade4a1 195 cutarray[ 1] = "0000011002092970028280400000"; mesonCutArray[1] = "01525065000000"; //variation psi pair 0.2
8ce39d2b 196 cutarray[ 2] = "0000011002092970028250000000"; mesonCutArray[2] = "01525065000000"; //variation cosPA -1
197 cutarray[ 3] = "0000011002092970028250400000"; mesonCutArray[3] = "01525055000000"; //variation alpha 0.75
198 } else if (trainConfig == 21) { //added signals
199 cutarray[ 0] = "0000012002092970028260400000"; mesonCutArray[0] = "01525065000000"; //variation psi pair 0.05
60ade4a1 200 cutarray[ 1] = "0000012002092970028280400000"; mesonCutArray[1] = "01525065000000"; //variation psi pair 0.2
8ce39d2b 201 cutarray[ 2] = "0000012002092970028250000000"; mesonCutArray[2] = "01525065000000"; //variation cosPA -1
202 cutarray[ 3] = "0000012002092970028250400000"; mesonCutArray[3] = "01525055000000"; //variation alpha 0.75
203 } else {
072021d3 204 Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
205 return;
33bbd991 206 }
207
208 TList *ConvCutList = new TList();
209 TList *MesonCutList = new TList();
210
211 TList *HeaderList = new TList();
212 TObjString *Header2 = new TObjString("BOX");
213 HeaderList->Add(Header2);
214
215 ConvCutList->SetOwner(kTRUE);
216 AliConversionCuts **analysisCuts = new AliConversionCuts*[numberOfCuts];
217 MesonCutList->SetOwner(kTRUE);
218 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
219
220
221 for(Int_t i = 0; i<numberOfCuts; i++){
222 analysisCuts[i] = new AliConversionCuts();
223 analysisCuts[i]->InitializeCutsFromCutString(cutarray[i].Data());
224 ConvCutList->Add(analysisCuts[i]);
225
226 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
227 analysisMesonCuts[i] = new AliConversionMesonCuts();
228 analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
229 MesonCutList->Add(analysisMesonCuts[i]);
230 analysisMesonCuts[i]->SetFillCutHistograms("");
231 analysisCuts[i]->SetAcceptedHeader(HeaderList);
232 }
233
234 task->SetConversionCutList(numberOfCuts,ConvCutList);
235 task->SetMesonCutList(numberOfCuts,MesonCutList);
236 task->SetMoveParticleAccordingToVertex(kTRUE);
237 task->SetDoMesonAnalysis(kTRUE);
ae4f2cfb 238 task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
239 task->SetDoPhotonQA(enableQAPhotonTask); //Attention new switch small for Photon QA
33bbd991 240
241 //connect containers
242 AliAnalysisDataContainer *coutput =
b0e0bc89 243 mgr->CreateContainer(Form("GammaConvV1_%i",trainConfig), TList::Class(),
33bbd991 244 AliAnalysisManager::kOutputContainer,Form("GammaConvV1_%i.root",trainConfig));
245
246 mgr->AddTask(task);
247 mgr->ConnectInput(task,0,cinput);
248 mgr->ConnectOutput(task,1,coutput);
249
250 return;
251
252}