Changed AddTasks
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvV1_PbPb2.C
CommitLineData
39e8c2ce 1void AddTask_GammaConvV1_PbPb2( 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
39e8c2ce 5 TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
6 Bool_t doWeighting = kFALSE, //enable Weighting
7 TString cutnumberAODBranch = "1000000060084000001500000"
8 ) {
9
10 // ================= Load Librariers =================================
11 gSystem->Load("libCore.so");
12 gSystem->Load("libTree.so");
13 gSystem->Load("libGeom.so");
14 gSystem->Load("libVMC.so");
15 gSystem->Load("libPhysics.so");
16 gSystem->Load("libMinuit");
17 gSystem->Load("libSTEERBase");
18 gSystem->Load("libESD");
19 gSystem->Load("libAOD");
20 gSystem->Load("libANALYSIS");
21 gSystem->Load("libANALYSISalice");
22 gSystem->Load("libPWGGAGammaConv.so");
23 gSystem->Load("libCDB.so");
24 gSystem->Load("libSTEER.so");
25 gSystem->Load("libSTEERBase.so");
26 gSystem->Load("libTENDER.so");
27 gSystem->Load("libTENDERSupplies.so");
28
29 // ================== GetAnalysisManager ===============================
30 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
31 if (!mgr) {
32 Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found.");
33 return ;
34 }
35
36 // ================== GetInputEventHandler =============================
37 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
38
39 //========= Add PID Reponse to ANALYSIS manager ====
40 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
41 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
42 AddTaskPIDResponse(isMC);
43 }
44
45 //========= Set Cutnumber for V0Reader ================================
ae4f2cfb 46 TString cutnumber = "1000000000084001001500000000";
39e8c2ce 47 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
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 }
71
72 if(inputHandler->IsA()==AliAODInputHandler::Class()){
73 // AOD mode
74 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
75 }
76 fV0ReaderV1->Init();
77
78 AliLog::SetGlobalLogLevel(AliLog::kInfo);
79
80 //connect input V0Reader
81 mgr->AddTask(fV0ReaderV1);
82 mgr->ConnectInput(fV0ReaderV1,0,cinput);
83
84 }
85
86 //================================================
87 //========= Add task to the ANALYSIS manager =====
88 //================================================
89 AliAnalysisTaskGammaConvV1 *task=NULL;
90 task= new AliAnalysisTaskGammaConvV1(Form("GammaConvV1_%i",trainConfig));
91 task->SetIsHeavyIon(1);
92 task->SetIsMC(isMC);
93 // Cut Numbers to use in Analysis
94 Int_t numberOfCuts = 1;
95
96 TString *cutarray = new TString[numberOfCuts];
97 TString *mesonCutArray = new TString[numberOfCuts];
98
99 if (trainConfig == 1){
ae4f2cfb 100 cutarray[ 0] = "6010001042092970023220000000"; mesonCutArray[ 0] = "01522045009000";
39e8c2ce 101 } else if (trainConfig == 2) {
ae4f2cfb 102 cutarray[ 0] = "6120001042092970023220000000"; mesonCutArray[ 0] = "01522045009000";
39e8c2ce 103 } else if (trainConfig == 3) {
ae4f2cfb 104 cutarray[ 0] = "5010001042092970023220000000"; mesonCutArray[ 0] = "01522045009000";
39e8c2ce 105 } else if (trainConfig == 4) {
ae4f2cfb 106 cutarray[ 0] = "5020001042092970023220000000"; mesonCutArray[ 0] = "01522045009000";
39e8c2ce 107 } else if (trainConfig == 5) {
ae4f2cfb 108 cutarray[ 0] = "5120001042092970023220000000"; mesonCutArray[ 0] = "01522045009000";
39e8c2ce 109 } else if (trainConfig == 6) {
ae4f2cfb 110 cutarray[ 0] = "5240001042092970023220000000"; mesonCutArray[ 0] = "01522045009000";
39e8c2ce 111 } else if (trainConfig == 7) {
ae4f2cfb 112 cutarray[ 0] = "5460001042092970023220000000"; mesonCutArray[ 0] = "01522065009000";
39e8c2ce 113 } else if (trainConfig == 8) {
ae4f2cfb 114 cutarray[ 0] = "5480001042092970023220000000"; mesonCutArray[ 0] = "01522065009000";
39e8c2ce 115 } else if (trainConfig == 9) {
ae4f2cfb 116 cutarray[ 0] = "5450001042092970023220000000"; mesonCutArray[ 0] = "01522065009000";
39e8c2ce 117 } else if (trainConfig == 10) {
ae4f2cfb 118 cutarray[ 0] = "5560001042092970023220000000"; mesonCutArray[ 0] = "01522065009000";
39e8c2ce 119 } else if (trainConfig == 11) {
ae4f2cfb 120 cutarray[ 0] = "5680001042092970023220000000"; mesonCutArray[ 0] = "01522065009000";
39e8c2ce 121 } else if (trainConfig == 12) {
ae4f2cfb 122 cutarray[ 0] = "5670001042092970023220000000"; mesonCutArray[ 0] = "01522065009000";
39e8c2ce 123 } else if (trainConfig == 13) {
ae4f2cfb 124 cutarray[ 0] = "5780001042092970023220000000"; mesonCutArray[ 0] = "01522065009000";
39e8c2ce 125 } else if (trainConfig == 14) {
ae4f2cfb 126 cutarray[ 0] = "4690001042092970023220000000"; mesonCutArray[ 0] = "01522065009000";
39e8c2ce 127 } else if (trainConfig == 15) {
ae4f2cfb 128 cutarray[ 0] = "5890001042092970023220000000"; mesonCutArray[ 0] = "01522065009000";
c9663716 129 } else if (trainConfig == 16){
ae4f2cfb 130 cutarray[ 0] = "6010002032092970023220000000"; mesonCutArray[ 0] = "01523045009000";
c9663716 131 } else if (trainConfig == 17) {
ae4f2cfb 132 cutarray[ 0] = "6120001032092970023220000000"; mesonCutArray[ 0] = "01523045009000";
c9663716 133 } else if (trainConfig == 18) {
ae4f2cfb 134 cutarray[ 0] = "5010001032092970023220000000"; mesonCutArray[ 0] = "01523045009000";
c9663716 135 } else if (trainConfig == 19) {
ae4f2cfb 136 cutarray[ 0] = "5020001032092970023220000000"; mesonCutArray[ 0] = "01523045009000";
c9663716 137 } else if (trainConfig == 20) {
ae4f2cfb 138 cutarray[ 0] = "5120001032092970023220000000"; mesonCutArray[ 0] = "01523045009000";
c9663716 139 } else if (trainConfig == 21) {
ae4f2cfb 140 cutarray[ 0] = "5240001032092970023220000000"; mesonCutArray[ 0] = "01523045009000";
c9663716 141 } else if (trainConfig == 22) {
ae4f2cfb 142 cutarray[ 0] = "5460001032092970023220000000"; mesonCutArray[ 0] = "01523065009000";
c9663716 143 } else if (trainConfig == 23) {
ae4f2cfb 144 cutarray[ 0] = "5480001032092970023220000000"; mesonCutArray[ 0] = "01523065009000";
c9663716 145 } else if (trainConfig == 24) {
ae4f2cfb 146 cutarray[ 0] = "5450001032092970023220000000"; mesonCutArray[ 0] = "01523065009000";
c9663716 147 } else if (trainConfig == 25) {
ae4f2cfb 148 cutarray[ 0] = "5560001032092970023220000000"; mesonCutArray[ 0] = "01523065009000";
c9663716 149 } else if (trainConfig == 26) {
ae4f2cfb 150 cutarray[ 0] = "5680001032092970023220000000"; mesonCutArray[ 0] = "01523065009000";
c9663716 151 } else if (trainConfig == 27) {
ae4f2cfb 152 cutarray[ 0] = "5670001032092970023220000000"; mesonCutArray[ 0] = "01523065009000";
c9663716 153 } else if (trainConfig == 28) {
ae4f2cfb 154 cutarray[ 0] = "5780001032092970023220000000"; mesonCutArray[ 0] = "01523065009000";
c9663716 155 } else if (trainConfig == 29) {
ae4f2cfb 156 cutarray[ 0] = "4690001032092970023220000000"; mesonCutArray[ 0] = "01523065009000";
c9663716 157 } else if (trainConfig == 30) {
ae4f2cfb 158 cutarray[ 0] = "5890001032092970023220000000"; mesonCutArray[ 0] = "01523065009000";
955b2701 159 } else if (trainConfig == 31) {
ae4f2cfb 160 cutarray[ 0] = "5080001002092970023220000000"; mesonCutArray[ 0] = "01525065009000";
75f195f2
FB
161 } else if (trainConfig == 32) {
162 cutarray[ 0] = "5080002002092970023220000000"; mesonCutArray[ 0] = "01525065009000";
39e8c2ce 163 } else {
164 Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
165 return;
166 }
167
168 TList *ConvCutList = new TList();
169 TList *MesonCutList = new TList();
170
171 TList *HeaderList = new TList();
75f195f2 172 TObjString *Header1 = new TObjString("BOX");
39e8c2ce 173 HeaderList->Add(Header1);
174// TObjString *Header3 = new TObjString("eta_2");
175// HeaderList->Add(Header3);
176
177 ConvCutList->SetOwner(kTRUE);
178 AliConversionCuts **analysisCuts = new AliConversionCuts*[numberOfCuts];
179 MesonCutList->SetOwner(kTRUE);
180 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
181
182 for(Int_t i = 0; i<numberOfCuts; i++){
183 analysisCuts[i] = new AliConversionCuts();
184 analysisCuts[i]->InitializeCutsFromCutString(cutarray[i].Data());
185 ConvCutList->Add(analysisCuts[i]);
186
187 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
188 analysisMesonCuts[i] = new AliConversionMesonCuts();
189 analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
190 MesonCutList->Add(analysisMesonCuts[i]);
191 analysisMesonCuts[i]->SetFillCutHistograms("");
192 analysisCuts[i]->SetAcceptedHeader(HeaderList);
193 }
194
195 task->SetConversionCutList(numberOfCuts,ConvCutList);
196 task->SetMesonCutList(numberOfCuts,MesonCutList);
197 task->SetMoveParticleAccordingToVertex(kTRUE);
198 task->SetDoMesonAnalysis(kTRUE);
ae4f2cfb 199 task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
200 task->SetDoPhotonQA(enableQAPhotonTask); //Attention new switch small for Photon QA
39e8c2ce 201
202 //connect containers
203 AliAnalysisDataContainer *coutput =
204 mgr->CreateContainer(Form("GammaConvV1_%i",trainConfig), TList::Class(),
205 AliAnalysisManager::kOutputContainer,Form("GammaConvV1_%i.root",trainConfig));
206
207 mgr->AddTask(task);
208 mgr->ConnectInput(task,0,cinput);
209 mgr->ConnectOutput(task,1,coutput);
210
211 return;
212
213}