make ptmin setteable
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvCalo_pPb.C
CommitLineData
8bdca7f1 1void AddTask_GammaConvCalo_pPb( 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 doWeightingPart = 0, //enable Weighting
7 TString generatorName = "DPMJET",
8 TString cutnumberAODBranch = "8000000060084000001500000" // cutnumber for AOD branch
9 ) {
10
11 // ================= Load Librariers =================================
12 gSystem->Load("libCore.so");
13 gSystem->Load("libTree.so");
14 gSystem->Load("libGeom.so");
15 gSystem->Load("libVMC.so");
16 gSystem->Load("libPhysics.so");
17 gSystem->Load("libMinuit");
18 gSystem->Load("libSTEERBase");
19 gSystem->Load("libESD");
20 gSystem->Load("libAOD");
21 gSystem->Load("libANALYSIS");
22 gSystem->Load("libANALYSISalice");
23 gSystem->Load("libPWGGAGammaConv.so");
24 gSystem->Load("libCDB.so");
25 gSystem->Load("libSTEER.so");
26 gSystem->Load("libSTEERBase.so");
27 gSystem->Load("libTENDER.so");
28 gSystem->Load("libTENDERSupplies.so");
29
344100c4 30 Int_t isHeavyIon = 2;
31
8bdca7f1 32 // ================== GetAnalysisManager ===============================
33 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
34 if (!mgr) {
35 Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found.");
36 return ;
37 }
38
39 // ================== GetInputEventHandler =============================
40 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
41
42 //========= Add PID Reponse to ANALYSIS manager ====
43 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
44 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
344100c4 45 AddTaskPIDResponse(isMC);
8bdca7f1 46 }
47
48 Printf("here \n");
49
50 //========= Set Cutnumber for V0Reader ================================
344100c4 51 TString cutnumberPhoton = "060084001001500000000";
52 TString cutnumberEvent = "8000000";
53 Bool_t doEtaShift = kFALSE;
8bdca7f1 54 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
55
56 //========= Add V0 Reader to ANALYSIS manager if not yet existent =====
57 if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
58 AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
59
60 fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
61 fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
62 fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
63
64 if (!mgr) {
65 Error("AddTask_V0ReaderV1", "No analysis manager found.");
66 return;
67 }
68
344100c4 69 AliConvEventCuts *fEventCuts=NULL;
70 if(cutnumberEvent!=""){
71 fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data());
72 fEventCuts->SetPreSelectionCutFlag(kTRUE);
73 if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){
74 fEventCuts->DoEtaShift(doEtaShift);
75 fV0ReaderV1->SetEventCuts(fEventCuts);
76 fEventCuts->SetFillCutHistograms("",kTRUE);
77 }
78 }
79
8bdca7f1 80 // Set AnalysisCut Number
344100c4 81 AliConversionPhotonCuts *fCuts=NULL;
82 if(cutnumberPhoton!=""){
83 fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data());
8bdca7f1 84 fCuts->SetPreSelectionCutFlag(kTRUE);
344100c4 85 fCuts->SetIsHeavyIon(isHeavyIon);
86 if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){
8bdca7f1 87 fV0ReaderV1->SetConversionCuts(fCuts);
88 fCuts->SetFillCutHistograms("",kTRUE);
89 }
90 }
91 if(inputHandler->IsA()==AliAODInputHandler::Class()){
92 // AOD mode
93 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
94 }
95 fV0ReaderV1->Init();
96
97 AliLog::SetGlobalLogLevel(AliLog::kFatal);
98
99 //connect input V0Reader
100 mgr->AddTask(fV0ReaderV1);
101 mgr->ConnectInput(fV0ReaderV1,0,cinput);
102
103 }
104
105 //================================================
106 //========= Add task to the ANALYSIS manager =====
107 //================================================
108 AliAnalysisTaskGammaConvCalo *task=NULL;
109 task= new AliAnalysisTaskGammaConvCalo(Form("GammaConvCalo_%i",trainConfig));
344100c4 110 task->SetIsHeavyIon(isHeavyIon);
8bdca7f1 111 task->SetIsMC(isMC);
112 // Cut Numbers to use in Analysis
113 Int_t numberOfCuts = 2;
eed82f0e 114 if (trainConfig==3 || trainConfig==5 ){ numberOfCuts =6;}
8bdca7f1 115
344100c4 116 TString *eventCutArray = new TString[numberOfCuts];
117 TString *photonCutArray = new TString[numberOfCuts];
118 TString *clusterCutArray = new TString[numberOfCuts];
8bdca7f1 119 TString *mesonCutArray = new TString[numberOfCuts];
120
121 // cluster cuts
122 // 0 "ClusterType", 1 "EtaMin", 2 "EtaMax", 3 "PhiMin", 4 "PhiMax", 5 "DistanceToBadChannel", 6 "Timing", 7 "TrackMatching", 8 "ExoticCell",
123 // 9 "MinEnergy", 10 "MinNCells", 11 "MinM02", 12 "MaxM02", 13 "MinM20", 14 "MaxM20", 15 "MaximumDispersion", 16 "NLM"
124
125 if (trainConfig == 1){
344100c4 126 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "10000040022030000"; mesonCutArray[0] = "01525065000000"; //standart cut, kINT7 // EMCAL clusters
127 eventCutArray[ 1] = "8005201"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "10000040022030000"; mesonCutArray[1] = "01525065000000"; //standard cut, kEMC7 // EMCAL clusters
9df9736d 128 } else if (trainConfig == 2) {
344100c4 129 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "20000030022000000"; mesonCutArray[0] = "01525065000000"; //standart cut, kINT7 // PHOS clusters
130 eventCutArray[ 1] = "8006201"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "20000030022000000"; mesonCutArray[1] = "01525065000000"; //standard cut, kPHI7 // PHOS clusters
ab8c8149 131 } else if (trainConfig == 3){
132 eventCutArray[ 0] = "8008101"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "10000040022030000"; mesonCutArray[0] = "01525065000000"; //standart cut, kEMCEGA based on INT7 // EMCAL clusters
133 eventCutArray[ 1] = "8008301"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "10000040022030000"; mesonCutArray[1] = "01525065000000"; //standard cut, kEMCEG1 based on INT7 // EMCAL clusters
134 eventCutArray[ 2] = "8008501"; photonCutArray[ 2] = "002092970028250400000"; clusterCutArray[2] = "10000040022030000"; mesonCutArray[2] = "01525065000000"; //standard cut, kEMCEG2 based on INT7 // EMCAL clusters
135 eventCutArray[ 3] = "8009101"; photonCutArray[ 3] = "002092970028250400000"; clusterCutArray[3] = "10000040022030000"; mesonCutArray[3] = "01525065000000"; //standard cut, kEMCEJE based on INT7 // EMCAL clusters
136 eventCutArray[ 4] = "8009301"; photonCutArray[ 4] = "002092970028250400000"; clusterCutArray[4] = "10000040022030000"; mesonCutArray[4] = "01525065000000"; //standard cut, kEMCEJ1 based on INT7 // EMCAL clusters
137 eventCutArray[ 5] = "8009501"; photonCutArray[ 5] = "002092970028250400000"; clusterCutArray[5] = "10000040022030000"; mesonCutArray[5] = "01525065000000"; //standard cut, kEMCEG2 based on INT7 // EMCAL clusters
eed82f0e 138 } else if (trainConfig == 4){
139 eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "10000040052030000"; mesonCutArray[0] = "01525065000000"; //standart cut, kINT7 // EMCAL clusters
140 eventCutArray[ 1] = "8005201"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "10000040052030000"; mesonCutArray[1] = "01525065000000"; //standard cut, kEMC7 // EMCAL clusters
141 } else if (trainConfig == 5){
142 eventCutArray[ 0] = "8008101"; photonCutArray[ 0] = "002092970028250400000"; clusterCutArray[0] = "10000040052030000"; mesonCutArray[0] = "01525065000000"; //standart cut, kEMCEGA based on INT7 // EMCAL clusters
143 eventCutArray[ 1] = "8008301"; photonCutArray[ 1] = "002092970028250400000"; clusterCutArray[1] = "10000040052030000"; mesonCutArray[1] = "01525065000000"; //standard cut, kEMCEG1 based on INT7 // EMCAL clusters
144 eventCutArray[ 2] = "8008501"; photonCutArray[ 2] = "002092970028250400000"; clusterCutArray[2] = "10000040052030000"; mesonCutArray[2] = "01525065000000"; //standard cut, kEMCEG2 based on INT7 // EMCAL clusters
145 eventCutArray[ 3] = "8009101"; photonCutArray[ 3] = "002092970028250400000"; clusterCutArray[3] = "10000040052030000"; mesonCutArray[3] = "01525065000000"; //standard cut, kEMCEJE based on INT7 // EMCAL clusters
146 eventCutArray[ 4] = "8009301"; photonCutArray[ 4] = "002092970028250400000"; clusterCutArray[4] = "10000040052030000"; mesonCutArray[4] = "01525065000000"; //standard cut, kEMCEJ1 based on INT7 // EMCAL clusters
147 eventCutArray[ 5] = "8009501"; photonCutArray[ 5] = "002092970028250400000"; clusterCutArray[5] = "10000040052030000"; mesonCutArray[5] = "01525065000000"; //standard cut, kEMCEG2 based on INT7 // EMCAL clusters
8bdca7f1 148 } else {
149 Error(Form("GammaConvCalo_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
150 return;
151 }
152
344100c4 153 TList *EventCutList = new TList();
8bdca7f1 154 TList *ConvCutList = new TList();
155 TList *ClusterCutList = new TList();
156 TList *MesonCutList = new TList();
157
158 TList *HeaderList = new TList();
159 if (doWeightingPart==1) {
160 TObjString *Header1 = new TObjString("pi0_1");
161 HeaderList->Add(Header1);
162 }
163 if (doWeightingPart==2){
164 TObjString *Header3 = new TObjString("eta_2");
165 HeaderList->Add(Header3);
166 }
167 if (doWeightingPart==3) {
168 TObjString *Header1 = new TObjString("pi0_1");
169 HeaderList->Add(Header1);
170 TObjString *Header3 = new TObjString("eta_2");
171 HeaderList->Add(Header3);
172 }
173
344100c4 174 EventCutList->SetOwner(kTRUE);
175 AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts];
8bdca7f1 176 ConvCutList->SetOwner(kTRUE);
344100c4 177 AliConversionPhotonCuts **analysisCuts = new AliConversionPhotonCuts*[numberOfCuts];
8bdca7f1 178 ClusterCutList->SetOwner(kTRUE);
179 AliCaloPhotonCuts **analysisClusterCuts = new AliCaloPhotonCuts*[numberOfCuts];
180 MesonCutList->SetOwner(kTRUE);
181 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
182
183 for(Int_t i = 0; i<numberOfCuts; i++){
344100c4 184 analysisEventCuts[i] = new AliConvEventCuts();
185 analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data());
186 EventCutList->Add(analysisEventCuts[i]);
187 analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
188
189 analysisCuts[i] = new AliConversionPhotonCuts();
190 analysisCuts[i]->InitializeCutsFromCutString(photonCutArray[i].Data());
191 analysisCuts[i]->SetIsHeavyIon(isHeavyIon);
8bdca7f1 192 ConvCutList->Add(analysisCuts[i]);
193 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
344100c4 194
8bdca7f1 195 analysisClusterCuts[i] = new AliCaloPhotonCuts();
344100c4 196 analysisClusterCuts[i]->InitializeCutsFromCutString(clusterCutArray[i].Data());
8bdca7f1 197 ClusterCutList->Add(analysisClusterCuts[i]);
198 analysisClusterCuts[i]->SetFillCutHistograms("");
199
200 analysisMesonCuts[i] = new AliConversionMesonCuts();
201 analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
202 MesonCutList->Add(analysisMesonCuts[i]);
203 analysisMesonCuts[i]->SetFillCutHistograms("");
344100c4 204 analysisEventCuts[i]->SetAcceptedHeader(HeaderList);
8bdca7f1 205 }
206
344100c4 207 task->SetEventCutList(numberOfCuts,EventCutList);
8bdca7f1 208 task->SetConversionCutList(numberOfCuts,ConvCutList);
209 task->SetCaloCutList(numberOfCuts,ClusterCutList);
210 task->SetMesonCutList(numberOfCuts,MesonCutList);
211 task->SetMoveParticleAccordingToVertex(kTRUE);
212 task->SetDoMesonAnalysis(kTRUE);
213 task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
214 task->SetDoPhotonQA(enableQAPhotonTask); //Attention new switch small for Photon QA
fd94f234 215 task->SetDoClusterQA(1); //Attention new switch small for Cluster QA
8bdca7f1 216
217 //connect containers
218 AliAnalysisDataContainer *coutput =
219 mgr->CreateContainer(Form("GammaConvCalo_%i",trainConfig), TList::Class(),
220 AliAnalysisManager::kOutputContainer,Form("GammaConvCalo_%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}