MC changes to evsel for debugging
[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
30 // ================== GetAnalysisManager ===============================
31 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
32 if (!mgr) {
33 Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found.");
34 return ;
35 }
36
37 // ================== GetInputEventHandler =============================
38 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
39
40 //========= Add PID Reponse to ANALYSIS manager ====
41 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
42 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
43 AddTaskPIDResponse(isMC,1,0,4,0,"",1,1,4);
44 }
45
46 Printf("here \n");
47
48 //========= Set Cutnumber for V0Reader ================================
49 TString cutnumber = "8000000060084001001500000000";
50 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
51
52 //========= Add V0 Reader to ANALYSIS manager if not yet existent =====
53 if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
54 AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
55
56 fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
57 fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
58 fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
59
60 if (!mgr) {
61 Error("AddTask_V0ReaderV1", "No analysis manager found.");
62 return;
63 }
64
65 // Set AnalysisCut Number
66 AliConversionCuts *fCuts=NULL;
67 if(cutnumber!=""){
68 fCuts= new AliConversionCuts(cutnumber.Data(),cutnumber.Data());
69 fCuts->SetPreSelectionCutFlag(kTRUE);
70 if(fCuts->InitializeCutsFromCutString(cutnumber.Data())){
71 fV0ReaderV1->SetConversionCuts(fCuts);
72 fCuts->SetFillCutHistograms("",kTRUE);
73 }
74 }
75 if(inputHandler->IsA()==AliAODInputHandler::Class()){
76 // AOD mode
77 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
78 }
79 fV0ReaderV1->Init();
80
81 AliLog::SetGlobalLogLevel(AliLog::kFatal);
82
83 //connect input V0Reader
84 mgr->AddTask(fV0ReaderV1);
85 mgr->ConnectInput(fV0ReaderV1,0,cinput);
86
87 }
88
89 //================================================
90 //========= Add task to the ANALYSIS manager =====
91 //================================================
92 AliAnalysisTaskGammaConvCalo *task=NULL;
93 task= new AliAnalysisTaskGammaConvCalo(Form("GammaConvCalo_%i",trainConfig));
94 task->SetIsHeavyIon(2);
95 task->SetIsMC(isMC);
96 // Cut Numbers to use in Analysis
97 Int_t numberOfCuts = 2;
98
99 TString *cutarray = new TString[numberOfCuts];
100 TString *clustercutarray = new TString[numberOfCuts];
101 TString *mesonCutArray = new TString[numberOfCuts];
102
103 // cluster cuts
104 // 0 "ClusterType", 1 "EtaMin", 2 "EtaMax", 3 "PhiMin", 4 "PhiMax", 5 "DistanceToBadChannel", 6 "Timing", 7 "TrackMatching", 8 "ExoticCell",
105 // 9 "MinEnergy", 10 "MinNCells", 11 "MinM02", 12 "MaxM02", 13 "MinM20", 14 "MaxM20", 15 "MaximumDispersion", 16 "NLM"
106
107 if (trainConfig == 1){
9df9736d 108 cutarray[ 0] = "8000001002092970028250400000"; clustercutarray[0] = "10000040022030000"; mesonCutArray[0] = "01525065000000"; //standart cut, kINT7 // EMCAL clusters
109 cutarray[ 1] = "8005201002092970028250400000"; clustercutarray[1] = "10000040022030000"; mesonCutArray[1] = "01525065000000"; //standard cut, kEMC7 // EMCAL clusters
110 } else if (trainConfig == 2) {
135c1186 111 cutarray[ 0] = "8000001002092970028250400000"; clustercutarray[0] = "20000030022000000"; mesonCutArray[0] = "01525065000000"; //standart cut, kINT7 // PHOS clusters
112 cutarray[ 1] = "8006201002092970028250400000"; clustercutarray[1] = "20000030022000000"; mesonCutArray[1] = "01525065000000"; //standard cut, kPHI7 // PHOS clusters
8bdca7f1 113 } else {
114 Error(Form("GammaConvCalo_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
115 return;
116 }
117
118 TList *ConvCutList = new TList();
119 TList *ClusterCutList = new TList();
120 TList *MesonCutList = new TList();
121
122 TList *HeaderList = new TList();
123 if (doWeightingPart==1) {
124 TObjString *Header1 = new TObjString("pi0_1");
125 HeaderList->Add(Header1);
126 }
127 if (doWeightingPart==2){
128 TObjString *Header3 = new TObjString("eta_2");
129 HeaderList->Add(Header3);
130 }
131 if (doWeightingPart==3) {
132 TObjString *Header1 = new TObjString("pi0_1");
133 HeaderList->Add(Header1);
134 TObjString *Header3 = new TObjString("eta_2");
135 HeaderList->Add(Header3);
136 }
137
138 ConvCutList->SetOwner(kTRUE);
139 AliConversionCuts **analysisCuts = new AliConversionCuts*[numberOfCuts];
140 ClusterCutList->SetOwner(kTRUE);
141 AliCaloPhotonCuts **analysisClusterCuts = new AliCaloPhotonCuts*[numberOfCuts];
142 MesonCutList->SetOwner(kTRUE);
143 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
144
145 for(Int_t i = 0; i<numberOfCuts; i++){
146 analysisCuts[i] = new AliConversionCuts();
147 analysisCuts[i]->InitializeCutsFromCutString(cutarray[i].Data());
148 ConvCutList->Add(analysisCuts[i]);
149 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
150
8bdca7f1 151 analysisClusterCuts[i] = new AliCaloPhotonCuts();
152 analysisClusterCuts[i]->InitializeCutsFromCutString(clustercutarray[i].Data());
153 ClusterCutList->Add(analysisClusterCuts[i]);
154 analysisClusterCuts[i]->SetFillCutHistograms("");
155
156 analysisMesonCuts[i] = new AliConversionMesonCuts();
157 analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
158 MesonCutList->Add(analysisMesonCuts[i]);
159 analysisMesonCuts[i]->SetFillCutHistograms("");
160 analysisCuts[i]->SetAcceptedHeader(HeaderList);
161 }
162
163 task->SetConversionCutList(numberOfCuts,ConvCutList);
164 task->SetCaloCutList(numberOfCuts,ClusterCutList);
165 task->SetMesonCutList(numberOfCuts,MesonCutList);
166 task->SetMoveParticleAccordingToVertex(kTRUE);
167 task->SetDoMesonAnalysis(kTRUE);
168 task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
169 task->SetDoPhotonQA(enableQAPhotonTask); //Attention new switch small for Photon QA
170
171 //connect containers
172 AliAnalysisDataContainer *coutput =
173 mgr->CreateContainer(Form("GammaConvCalo_%i",trainConfig), TList::Class(),
174 AliAnalysisManager::kOutputContainer,Form("GammaConvCalo_%i.root",trainConfig));
175
176 mgr->AddTask(task);
177 mgr->ConnectInput(task,0,cinput);
178 mgr->ConnectOutput(task,1,coutput);
179
180 return;
181
182}