- added new tasks for combination of EMCAL and PCM for pi0 and photons
[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){
108 cutarray[ 0] = "8000001002092970028250400000"; clustercutarray[0] = "10000040022030000"; mesonCutArray[0] = "01525065000000"; //standart cut, kINT7
109 cutarray[ 1] = "8005201002092970028250400000"; clustercutarray[1] = "10000040022030000"; mesonCutArray[1] = "01525065000000"; //standard cut, kEMC7
110 } else {
111 Error(Form("GammaConvCalo_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
112 return;
113 }
114
115 TList *ConvCutList = new TList();
116 TList *ClusterCutList = new TList();
117 TList *MesonCutList = new TList();
118
119 TList *HeaderList = new TList();
120 if (doWeightingPart==1) {
121 TObjString *Header1 = new TObjString("pi0_1");
122 HeaderList->Add(Header1);
123 }
124 if (doWeightingPart==2){
125 TObjString *Header3 = new TObjString("eta_2");
126 HeaderList->Add(Header3);
127 }
128 if (doWeightingPart==3) {
129 TObjString *Header1 = new TObjString("pi0_1");
130 HeaderList->Add(Header1);
131 TObjString *Header3 = new TObjString("eta_2");
132 HeaderList->Add(Header3);
133 }
134
135 ConvCutList->SetOwner(kTRUE);
136 AliConversionCuts **analysisCuts = new AliConversionCuts*[numberOfCuts];
137 ClusterCutList->SetOwner(kTRUE);
138 AliCaloPhotonCuts **analysisClusterCuts = new AliCaloPhotonCuts*[numberOfCuts];
139 MesonCutList->SetOwner(kTRUE);
140 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
141
142 for(Int_t i = 0; i<numberOfCuts; i++){
143 analysisCuts[i] = new AliConversionCuts();
144 analysisCuts[i]->InitializeCutsFromCutString(cutarray[i].Data());
145 ConvCutList->Add(analysisCuts[i]);
146 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
147
148 Printf("here %d %s\n", i, clustercutarray[i].Data() );
149
150 analysisClusterCuts[i] = new AliCaloPhotonCuts();
151 analysisClusterCuts[i]->InitializeCutsFromCutString(clustercutarray[i].Data());
152 ClusterCutList->Add(analysisClusterCuts[i]);
153 analysisClusterCuts[i]->SetFillCutHistograms("");
154
155 analysisMesonCuts[i] = new AliConversionMesonCuts();
156 analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
157 MesonCutList->Add(analysisMesonCuts[i]);
158 analysisMesonCuts[i]->SetFillCutHistograms("");
159 analysisCuts[i]->SetAcceptedHeader(HeaderList);
160 }
161
162 task->SetConversionCutList(numberOfCuts,ConvCutList);
163 task->SetCaloCutList(numberOfCuts,ClusterCutList);
164 task->SetMesonCutList(numberOfCuts,MesonCutList);
165 task->SetMoveParticleAccordingToVertex(kTRUE);
166 task->SetDoMesonAnalysis(kTRUE);
167 task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
168 task->SetDoPhotonQA(enableQAPhotonTask); //Attention new switch small for Photon QA
169
170 //connect containers
171 AliAnalysisDataContainer *coutput =
172 mgr->CreateContainer(Form("GammaConvCalo_%i",trainConfig), TList::Class(),
173 AliAnalysisManager::kOutputContainer,Form("GammaConvCalo_%i.root",trainConfig));
174
175 mgr->AddTask(task);
176 mgr->ConnectInput(task,0,cinput);
177 mgr->ConnectOutput(task,1,coutput);
178
179 return;
180
181}