]>
Commit | Line | Data |
---|---|---|
b5fc8a3e | 1 | Bool_t runProtonCorrection(Int_t stats = 0, const char* dataset = 0x0) { |
2 | //macro used to extract the correction maps | |
3 | //using the official correction framework of ALICE | |
4 | //for protons and antiprotons | |
5 | //Author: Panos.Christakoglou@cern.ch | |
6 | ||
7 | //________________________________________// | |
8 | //Connect to proof | |
9 | //TProof::Reset("proof://lxb6046.cern.ch"); | |
10 | TProof::Open("proof://lxb6046.cern.ch"); | |
11 | ||
12 | // Enable the STEERBase Package | |
13 | gProof->UploadPackage("STEERBase.par"); | |
14 | gProof->EnablePackage("STEERBase"); | |
15 | // Enable the ESD Package | |
16 | gProof->UploadPackage("ESD.par"); | |
17 | gProof->EnablePackage("ESD"); | |
18 | // Enable the AOD Package | |
19 | gProof->UploadPackage("AOD.par"); | |
20 | gProof->EnablePackage("AOD"); | |
21 | // Enable the Analysis Package | |
22 | gProof->UploadPackage("ANALYSIS.par"); | |
23 | gProof->EnablePackage("ANALYSIS"); | |
24 | gProof->UploadPackage("ANALYSISalice.par"); | |
25 | gProof->EnablePackage("ANALYSISalice"); | |
26 | // Enable the CORRFW Package | |
27 | gProof->UploadPackage("CORRFW.par"); | |
28 | gProof->EnablePackage("CORRFW"); | |
29 | ||
30 | gProof->Load("./AliProtonCorrectionTask.cxx+g"); | |
31 | ||
32 | //________________________________________// | |
33 | //Container definition | |
34 | //Variables of the GRID | |
35 | //For the time being: y-pT | |
36 | //Next step: add Vz | |
37 | //Setting up the container grid... | |
340705b3 | 38 | //===============// |
39 | //Global tracking// | |
40 | //===============// | |
b5fc8a3e | 41 | const Double_t ymin = -1.0; |
42 | const Double_t ymax = 1.0; | |
340705b3 | 43 | const Int_t nbin1 = 20; //bins in y |
b5fc8a3e | 44 | const Double_t ptmin = 0.4; |
45 | const Double_t ptmax = 3.1; | |
340705b3 | 46 | const Int_t nbin2 = 27; //bins in pT |
47 | //===============// | |
48 | // TPC tracking // | |
49 | //===============// | |
50 | /*const Double_t ymin = -0.5; | |
51 | const Double_t ymax = 0.5; | |
52 | const Int_t nbin1 = 10; //bins in y | |
53 | const Double_t ptmin = 0.4; | |
54 | const Double_t ptmax = 0.9; | |
55 | const Int_t nbin2 = 15;*/ //bins in pT | |
56 | ||
b5fc8a3e | 57 | //Setting up the container grid... |
58 | UInt_t nstep = 4; //number of selection steps MC | |
340705b3 | 59 | UInt_t iy = 0; |
60 | UInt_t ipT = 1; | |
b5fc8a3e | 61 | const Int_t nvar = 2; //number of variables on the grid:y-pT |
340705b3 | 62 | //arrays for the number of bins in each dimension |
b5fc8a3e | 63 | Int_t iBin[nvar]; |
64 | iBin[0]=nbin1; | |
65 | iBin[1]=nbin2; | |
66 | //arrays for lower bounds : | |
67 | Double_t *binLim1=new Double_t[nbin1+1]; | |
68 | Double_t *binLim2=new Double_t[nbin2+1]; | |
69 | //values for bin lower bounds | |
70 | for(Int_t i=0; i<=nbin1; i++) binLim1[i]=(Double_t)ymin + (ymax-ymin) /nbin1*(Double_t)i; | |
71 | for(Int_t i=0; i<=nbin2; i++) binLim2[i]=(Double_t)ptmin + (ptmax-ptmin)/nbin2*(Double_t)i; | |
3079041e | 72 | //CF container for protons |
73 | AliCFContainer* containerProtons = new AliCFContainer("containerProtons","container for protons", | |
74 | nstep,nvar,iBin); | |
b5fc8a3e | 75 | //setting the bin limits |
3079041e | 76 | containerProtons->SetBinLimits(iy,binLim1); |
77 | containerProtons->SetBinLimits(ipT,binLim2); | |
78 | //CF container for protons | |
79 | AliCFContainer* containerAntiProtons = new AliCFContainer("containerAntiProtons","container for antiprotons", | |
80 | nstep,nvar,iBin); | |
81 | //setting the bin limits | |
82 | containerAntiProtons->SetBinLimits(iy,binLim1); | |
83 | containerAntiProtons->SetBinLimits(ipT,binLim2); | |
b5fc8a3e | 84 | |
85 | //________________________________________// | |
86 | // SET TLIST FOR QA HISTOS | |
87 | TList* qaList = new TList(); | |
88 | //Cuts | |
89 | const Int_t mintrackrefsTPC = 2; | |
90 | const Int_t mintrackrefsITS = 3; | |
3079041e | 91 | const Int_t chargeProtons = 1; |
92 | const Int_t PDGProtons = 2212; | |
93 | const Int_t chargeAntiProtons = -1; | |
94 | const Int_t PDGAntiProtons = -2212; | |
340705b3 | 95 | |
b5fc8a3e | 96 | const Int_t minclustersTPC = 50; |
340705b3 | 97 | const Float_t maxChi2PerTPCCluster = 3.5; |
98 | const Float_t maxCov11 = 2.0; | |
99 | const Float_t maxCov22 = 2.0; | |
100 | const Float_t maxCov33 = 0.5; | |
101 | const Float_t maxCov44 = 0.5; | |
102 | const Float_t maxCov55 = 2.0; | |
103 | const Float_t maxSigmaToVertexTPC = 2.5; | |
104 | ||
105 | const Int_t minclustersITS = 5; | |
106 | const Float_t maxSigmaToVertex = 2.5; | |
107 | ||
b5fc8a3e | 108 | // Gen-Level kinematic cuts |
3079041e | 109 | AliCFTrackKineCuts *mcKineCutsProtons = new AliCFTrackKineCuts("mcKineCutsProtons", |
110 | "MC-level kinematic cuts"); | |
111 | mcKineCutsProtons->SetPtRange(ptmin,ptmax); | |
112 | mcKineCutsProtons->SetRapidityRange(ymin,ymax); | |
113 | mcKineCutsProtons->SetChargeMC(chargeProtons); | |
114 | mcKineCutsProtons->SetQAOn(qaList); | |
115 | ||
116 | AliCFTrackKineCuts *mcKineCutsAntiProtons = new AliCFTrackKineCuts("mcKineCutsAntiProtons", | |
117 | "MC-level kinematic cuts"); | |
118 | mcKineCutsAntiProtons->SetPtRange(ptmin,ptmax); | |
119 | mcKineCutsAntiProtons->SetRapidityRange(ymin,ymax); | |
120 | mcKineCutsAntiProtons->SetChargeMC(chargeAntiProtons); | |
121 | mcKineCutsAntiProtons->SetQAOn(qaList); | |
b5fc8a3e | 122 | |
123 | //Particle-Level cuts: | |
3079041e | 124 | AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts", |
125 | "MC particle generation cuts"); | |
b5fc8a3e | 126 | mcGenCuts->SetRequireIsPrimary(); |
3079041e | 127 | mcGenCuts->SetRequirePdgCode(PDGProtons); |
b5fc8a3e | 128 | mcGenCuts->SetQAOn(qaList); |
129 | ||
130 | //Acceptance Cuts | |
3079041e | 131 | AliCFAcceptanceCuts *mcAccCuts = new AliCFAcceptanceCuts("mcAccCuts", |
132 | "MC acceptance cuts"); | |
b5fc8a3e | 133 | mcAccCuts->SetMinNHitITS(mintrackrefsITS); |
134 | mcAccCuts->SetMinNHitTPC(mintrackrefsTPC); | |
135 | mcAccCuts->SetQAOn(qaList); | |
136 | ||
137 | // Rec-Level kinematic cuts | |
3079041e | 138 | AliCFTrackKineCuts *recKineCutsProtons = new AliCFTrackKineCuts("recKineCutsProtons", |
139 | "rec-level kine cuts"); | |
140 | recKineCutsProtons->SetPtRange(ptmin,ptmax); | |
141 | recKineCutsProtons->SetRapidityRange(ymin,ymax); | |
142 | recKineCutsProtons->SetChargeRec(chargeProtons); | |
143 | recKineCutsProtons->SetQAOn(qaList); | |
144 | ||
145 | AliCFTrackKineCuts *recKineCutsAntiProtons = new AliCFTrackKineCuts("recKineCutsAntiProtons", | |
146 | "rec-level kine cuts"); | |
147 | recKineCutsAntiProtons->SetPtRange(ptmin,ptmax); | |
148 | recKineCutsAntiProtons->SetRapidityRange(ymin,ymax); | |
149 | recKineCutsAntiProtons->SetChargeRec(chargeAntiProtons); | |
150 | recKineCutsAntiProtons->SetQAOn(qaList); | |
b5fc8a3e | 151 | |
3079041e | 152 | AliCFTrackQualityCuts *recQualityCuts = new AliCFTrackQualityCuts("recQualityCuts", |
153 | "rec-level quality cuts"); | |
b5fc8a3e | 154 | recQualityCuts->SetMinNClusterTPC(minclustersTPC); |
340705b3 | 155 | recQualityCuts->SetMaxChi2PerClusterTPC(maxChi2PerTPCCluster); |
156 | recQualityCuts->SetMaxCovDiagonalElements(maxCov11,maxCov22,maxCov33,maxCov44,maxCov55); | |
157 | recQualityCuts->SetRequireTPCRefit(kTRUE); | |
158 | ||
159 | //recQualityCuts->SetRequireITSRefit(kTRUE); | |
b5fc8a3e | 160 | recQualityCuts->SetQAOn(qaList); |
161 | ||
3079041e | 162 | AliCFTrackIsPrimaryCuts *recIsPrimaryCuts = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts", |
163 | "rec-level isPrimary cuts"); | |
340705b3 | 164 | recIsPrimaryCuts->SetMaxNSigmaToVertex(maxSigmaToVertex); |
b5fc8a3e | 165 | recIsPrimaryCuts->SetQAOn(qaList); |
166 | ||
167 | AliCFTrackCutPid* cutPID = new AliCFTrackCutPid("cutPID","ESD_PID"); | |
168 | int n_species = AliPID::kSPECIES; | |
169 | Double_t* prior = new Double_t[n_species]; | |
170 | ||
171 | prior[0] = 0.0244519; | |
172 | prior[1] = 0.0143988; | |
173 | prior[2] = 0.805747 ; | |
174 | prior[3] = 0.0928785; | |
175 | prior[4] = 0.0625243; | |
176 | ||
177 | cutPID->SetPriors(prior); | |
178 | cutPID->SetProbabilityCut(0.0); | |
179 | cutPID->SetDetectors("ITS TPC TOF"); | |
340705b3 | 180 | cutPID->SetParticleType(AliPID::kProton , kTRUE); |
b5fc8a3e | 181 | cutPID->SetQAOn(qaList); |
182 | ||
183 | //________________________________________// | |
3079041e | 184 | TObjArray* mcListProtons = new TObjArray(0); |
185 | mcListProtons->AddLast(mcKineCutsProtons); | |
186 | mcListProtons->AddLast(mcGenCuts); | |
187 | TObjArray* mcListAntiProtons = new TObjArray(0); | |
188 | mcListAntiProtons->AddLast(mcKineCutsAntiProtons); | |
189 | mcListAntiProtons->AddLast(mcGenCuts); | |
b5fc8a3e | 190 | |
191 | printf("CREATE ACCEPTANCE CUTS\n"); | |
192 | TObjArray* accList = new TObjArray(0); | |
193 | accList->AddLast(mcAccCuts); | |
194 | ||
195 | printf("CREATE RECONSTRUCTION CUTS\n"); | |
3079041e | 196 | TObjArray* recListProtons = new TObjArray(0); |
197 | recListProtons->AddLast(recKineCutsProtons); | |
198 | recListProtons->AddLast(recQualityCuts); | |
199 | recListProtons->AddLast(recIsPrimaryCuts); | |
200 | TObjArray* recListAntiProtons = new TObjArray(0); | |
201 | recListAntiProtons->AddLast(recKineCutsAntiProtons); | |
202 | recListAntiProtons->AddLast(recQualityCuts); | |
203 | recListAntiProtons->AddLast(recIsPrimaryCuts); | |
b5fc8a3e | 204 | |
205 | printf("CREATE PID CUTS\n"); | |
206 | TObjArray* fPIDCutList = new TObjArray(0); | |
207 | fPIDCutList->AddLast(cutPID); | |
208 | ||
209 | //________________________________________// | |
210 | //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK | |
3079041e | 211 | AliCFManager* manProtons = new AliCFManager(); |
212 | manProtons->SetParticleContainer(containerProtons); | |
213 | manProtons->SetParticleCutsList(AliCFManager::kPartGenCuts,mcListProtons); | |
214 | manProtons->SetParticleCutsList(AliCFManager::kPartAccCuts,accList); | |
215 | manProtons->SetParticleCutsList(AliCFManager::kPartRecCuts,recListProtons); | |
216 | manProtons->SetParticleCutsList(AliCFManager::kPartSelCuts,fPIDCutList); | |
217 | ||
218 | AliCFManager* manAntiProtons = new AliCFManager(); | |
219 | manAntiProtons->SetParticleContainer(containerAntiProtons); | |
220 | manAntiProtons->SetParticleCutsList(AliCFManager::kPartGenCuts,mcListAntiProtons); | |
221 | manAntiProtons->SetParticleCutsList(AliCFManager::kPartAccCuts,accList); | |
222 | manAntiProtons->SetParticleCutsList(AliCFManager::kPartRecCuts,recListAntiProtons); | |
223 | manAntiProtons->SetParticleCutsList(AliCFManager::kPartSelCuts,fPIDCutList); | |
b5fc8a3e | 224 | |
225 | //________________________________________// | |
226 | //CREATE THE TASK | |
227 | AliProtonCorrectionTask *task = new AliProtonCorrectionTask("AliProtonCorrectionTask"); | |
3079041e | 228 | task->SetCFManagerProtons(manProtons); //here is set the CF manager |
229 | task->SetCFManagerAntiProtons(manAntiProtons); //here is set the CF manager | |
b5fc8a3e | 230 | task->SetQAList(qaList); |
231 | ||
232 | //SETUP THE ANALYSIS MANAGER TO READ INPUT CHAIN AND WRITE DESIRED OUTPUTS | |
233 | printf("CREATE ANALYSIS MANAGER\n"); | |
234 | // Make the analysis manager | |
235 | AliAnalysisManager *mgr = new AliAnalysisManager("TestManager"); | |
236 | ||
237 | AliMCEventHandler* mcHandler = new AliMCEventHandler(); | |
238 | AliESDInputHandler* esdHandler = new AliESDInputHandler(); | |
239 | mgr->SetMCtruthEventHandler(mcHandler); | |
240 | mgr->SetInputEventHandler(esdHandler); | |
241 | ||
242 | //------ input data ------ | |
243 | AliAnalysisDataContainer *cinput0 = mgr->CreateContainer("cchain0",TChain::Class(),AliAnalysisManager::kInputContainer); | |
244 | ||
245 | // ----- output data ----- | |
246 | //slot 0 : default output tree (by default handled by AliAnalysisTaskSE) | |
3079041e | 247 | AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("ctree0", TTree::Class(), |
248 | AliAnalysisManager::kOutputContainer,"corrections.root"); | |
b5fc8a3e | 249 | // output TH1I for event counting |
3079041e | 250 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist0", TH1I::Class(), |
251 | AliAnalysisManager::kOutputContainer,"corrections.root"); | |
252 | // output Correction Framework Container (for acceptance & efficiency calculations) | |
253 | AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("ccontainer0", | |
254 | AliCFContainer::Class(), | |
255 | AliAnalysisManager::kOutputContainer,"corrections.root"); | |
b5fc8a3e | 256 | // output Correction Framework Container (for acceptance & efficiency calculations) |
3079041e | 257 | AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("ccontainer1", |
258 | AliCFContainer::Class(), | |
259 | AliAnalysisManager::kOutputContainer,"corrections.root"); | |
b5fc8a3e | 260 | // output QA histograms |
3079041e | 261 | AliAnalysisDataContainer *coutput4 = mgr->CreateContainer("clist0", |
262 | TList::Class(), | |
263 | AliAnalysisManager::kOutputContainer,"corrections.root"); | |
b5fc8a3e | 264 | |
265 | mgr->AddTask(task); | |
266 | mgr->ConnectInput(task,0,cinput0); | |
267 | mgr->ConnectOutput(task,0,coutput0); | |
268 | mgr->ConnectOutput(task,1,coutput1); | |
269 | mgr->ConnectOutput(task,2,coutput2); | |
270 | mgr->ConnectOutput(task,3,coutput3); | |
3079041e | 271 | mgr->ConnectOutput(task,4,coutput4); |
b5fc8a3e | 272 | |
273 | //________________________________________// | |
274 | if (mgr->InitAnalysis()) { | |
275 | if(dataset) | |
276 | mgr->StartAnalysis("proof",dataset,stats); | |
277 | else { | |
278 | // You should get this macro and the txt file from: | |
279 | // http://aliceinfo.cern.ch/Offline/Analysis/CAF/ | |
280 | gROOT->LoadMacro("CreateESDChain.C"); | |
281 | TChain* chain = 0x0; | |
282 | chain = CreateESDChain("ESD82XX_30K.txt",stats); | |
283 | chain->SetBranchStatus("*Calo*",0); | |
284 | ||
285 | mgr->StartAnalysis("proof",chain); | |
286 | } | |
287 | } | |
288 | ||
289 | return kTRUE; | |
290 | } | |
291 |