]>
Commit | Line | Data |
---|---|---|
0dbb51a0 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
27de2dfb | 16 | /* $Id$ */ |
17 | ||
0dbb51a0 | 18 | ///////////////////////////////////////////////////////////// |
19 | // | |
20 | // AliAnalysisTaskSE for HF quality assurance | |
21 | // | |
22 | // Author: Chiara Bianchin, chiara.bianchin@pd.infn.it | |
23 | ///////////////////////////////////////////////////////////// | |
24 | ||
25 | #include <Riostream.h> | |
26 | #include <TClonesArray.h> | |
27 | #include <TCanvas.h> | |
28 | #include <TList.h> | |
29 | #include <TH1F.h> | |
30 | #include <TH2F.h> | |
31 | #include <TDatabasePDG.h> | |
32 | ||
33 | #include <AliAnalysisDataSlot.h> | |
34 | #include <AliAnalysisDataContainer.h> | |
35 | #include "AliAnalysisManager.h" | |
36 | #include "AliESDtrack.h" | |
37 | #include "AliVertexerTracks.h" | |
38 | #include "AliPID.h" | |
39 | #include "AliTPCPIDResponse.h" | |
40 | #include "AliAODHandler.h" | |
41 | #include "AliAODEvent.h" | |
42 | #include "AliAODVertex.h" | |
43 | #include "AliAODTrack.h" | |
44 | #include "AliAODMCParticle.h" | |
a4ef4383 | 45 | #include "AliAODMCHeader.h" |
0dbb51a0 | 46 | #include "AliAODRecoDecayHF2Prong.h" |
47 | #include "AliAODRecoCascadeHF.h" | |
48 | #include "AliAnalysisVertexingHF.h" | |
49 | #include "AliAnalysisTaskSE.h" | |
a4ef4383 | 50 | #include "AliCounterCollection.h" |
0dbb51a0 | 51 | #include "AliRDHFCuts.h" |
52 | #include "AliRDHFCutsDplustoKpipi.h" | |
53 | #include "AliRDHFCutsD0toKpipipi.h" | |
54 | #include "AliRDHFCutsDstoKKpi.h" | |
55 | #include "AliRDHFCutsDStartoKpipi.h" | |
56 | #include "AliRDHFCutsD0toKpi.h" | |
57 | #include "AliRDHFCutsLctopKpi.h" | |
a4b0ffc7 | 58 | #include "AliInputEventHandler.h" |
0dbb51a0 | 59 | |
60 | #include "AliAnalysisTaskSEHFQA.h" | |
61 | ||
0dbb51a0 | 62 | ClassImp(AliAnalysisTaskSEHFQA) |
63 | ||
64 | //____________________________________________________________________________ | |
65 | ||
66 | AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA():AliAnalysisTaskSE(), | |
67 | fNEntries(0x0), | |
68 | fOutputPID(0x0), | |
69 | fOutputTrack(0x0), | |
a4ef4383 | 70 | fOutputCounters(0x0), |
71 | fOutputCheckCentrality(0x0), | |
818c1271 | 72 | fOutputEvSelection(0x0), |
0dbb51a0 | 73 | fDecayChannel(AliAnalysisTaskSEHFQA::kD0toKpi), |
a4ef4383 | 74 | fCuts(0x0), |
75 | fEstimator(AliRDHFCuts::kCentTRK), | |
19222b31 | 76 | fReadMC(kFALSE), |
5fc4893f | 77 | fSimpleMode(kFALSE), |
78 | fOnOff() | |
0dbb51a0 | 79 | { |
80 | //default constructor | |
5fc4893f | 81 | fOnOff[0]=kTRUE; |
82 | fOnOff[1]=kTRUE; | |
83 | fOnOff[2]=kTRUE; | |
818c1271 | 84 | fOnOff[3]=kTRUE; |
0dbb51a0 | 85 | } |
86 | ||
87 | //____________________________________________________________________________ | |
88 | AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA(const char *name, AliAnalysisTaskSEHFQA::DecChannel ch,AliRDHFCuts* cuts): | |
a4ef4383 | 89 | AliAnalysisTaskSE(name), |
90 | fNEntries(0x0), | |
91 | fOutputPID(0x0), | |
92 | fOutputTrack(0x0), | |
93 | fOutputCounters(0x0), | |
94 | fOutputCheckCentrality(0x0), | |
818c1271 | 95 | fOutputEvSelection(0x0), |
a4ef4383 | 96 | fDecayChannel(ch), |
97 | fCuts(0x0), | |
98 | fEstimator(AliRDHFCuts::kCentTRK), | |
19222b31 | 99 | fReadMC(kFALSE), |
5fc4893f | 100 | fSimpleMode(kFALSE), |
101 | fOnOff() | |
0dbb51a0 | 102 | { |
103 | //constructor | |
104 | ||
105 | //SetCutObject(cuts); | |
106 | fCuts=cuts; | |
107 | ||
5fc4893f | 108 | fOnOff[0]=kTRUE; |
109 | fOnOff[1]=kTRUE; | |
110 | fOnOff[2]=kTRUE; | |
818c1271 | 111 | fOnOff[3]=kTRUE; |
5fc4893f | 112 | |
0dbb51a0 | 113 | // Output slot #1 writes into a TH1F container (number of events) |
114 | DefineOutput(1,TH1F::Class()); //My private output | |
115 | // Output slot #2 writes into a TList container (PID) | |
5fc4893f | 116 | if (fOnOff[1]) DefineOutput(2,TList::Class()); //My private output |
0dbb51a0 | 117 | // Output slot #3 writes into a TList container (Tracks) |
5fc4893f | 118 | if (fOnOff[0]) DefineOutput(3,TList::Class()); //My private output |
0dbb51a0 | 119 | // Output slot #4 writes into a AliRDHFCuts container (cuts) |
120 | switch(fDecayChannel){ | |
121 | case 0: | |
122 | DefineOutput(4,AliRDHFCutsDplustoKpipi::Class()); //My private output | |
123 | break; | |
124 | case 1: | |
125 | DefineOutput(4,AliRDHFCutsD0toKpi::Class()); //My private output | |
126 | break; | |
127 | case 2: | |
128 | DefineOutput(4,AliRDHFCutsDStartoKpipi::Class()); //My private output | |
129 | break; | |
130 | case 3: | |
131 | DefineOutput(4,AliRDHFCutsDstoKKpi::Class()); //My private output | |
132 | break; | |
133 | case 4: | |
134 | DefineOutput(4,AliRDHFCutsD0toKpipipi::Class()); //My private output | |
135 | break; | |
a4ef4383 | 136 | case 5: |
0dbb51a0 | 137 | DefineOutput(4,AliRDHFCutsLctopKpi::Class()); //My private output |
138 | break; | |
a4ef4383 | 139 | } |
5fc4893f | 140 | if (fOnOff[2]) { |
141 | // Output slot #5 writes into a TList container (AliCounterCollection) | |
142 | DefineOutput(5,TList::Class()); //My private output | |
143 | // Output slot #6 writes into a TList container (TH1F) | |
144 | DefineOutput(6,TList::Class()); //My private output | |
145 | } | |
818c1271 | 146 | |
147 | if(fOnOff[3]) DefineOutput(7,TList::Class()); //My private output | |
148 | ||
0dbb51a0 | 149 | } |
150 | ||
151 | //___________________________________________________________________________ | |
152 | AliAnalysisTaskSEHFQA::~AliAnalysisTaskSEHFQA() | |
153 | { | |
154 | //destructor | |
a4ef4383 | 155 | delete fNEntries; |
156 | ||
157 | delete fOutputPID; | |
158 | ||
159 | delete fOutputTrack; | |
160 | ||
161 | delete fOutputCounters; | |
162 | ||
163 | delete fOutputCheckCentrality; | |
164 | ||
818c1271 | 165 | delete fOutputEvSelection; |
166 | ||
0dbb51a0 | 167 | } |
168 | ||
169 | //___________________________________________________________________________ | |
170 | void AliAnalysisTaskSEHFQA::Init(){ | |
171 | ||
172 | //initialization | |
173 | if(fDebug > 1) printf("AnalysisTaskSEHFQA::Init() \n"); | |
174 | ||
175 | switch(fDecayChannel){ | |
176 | case 0: | |
177 | { | |
178 | AliRDHFCutsDplustoKpipi* copycut=new AliRDHFCutsDplustoKpipi(*(static_cast<AliRDHFCutsDplustoKpipi*>(fCuts))); | |
179 | // Post the data | |
180 | PostData(4,copycut); | |
181 | } | |
182 | break; | |
183 | case 1: | |
184 | { | |
185 | AliRDHFCutsD0toKpi* copycut=new AliRDHFCutsD0toKpi(*(static_cast<AliRDHFCutsD0toKpi*>(fCuts))); | |
186 | // Post the data | |
187 | PostData(4,copycut); | |
188 | } | |
189 | break; | |
190 | case 2: | |
191 | { | |
192 | AliRDHFCutsDStartoKpipi* copycut=new AliRDHFCutsDStartoKpipi(*(static_cast<AliRDHFCutsDStartoKpipi*>(fCuts))); | |
193 | // Post the data | |
194 | PostData(4,copycut); | |
195 | } | |
196 | break; | |
197 | case 3: | |
198 | { | |
199 | AliRDHFCutsDstoKKpi* copycut=new AliRDHFCutsDstoKKpi(*(static_cast<AliRDHFCutsDstoKKpi*>(fCuts))); | |
200 | // Post the data | |
201 | PostData(4,copycut); | |
202 | } | |
203 | break; | |
204 | case 4: | |
205 | { | |
206 | AliRDHFCutsD0toKpipipi* copycut=new AliRDHFCutsD0toKpipipi(*(static_cast<AliRDHFCutsD0toKpipipi*>(fCuts))); | |
207 | // Post the data | |
208 | PostData(4,copycut); | |
209 | } | |
210 | break; | |
211 | case 5: | |
212 | { | |
213 | AliRDHFCutsLctopKpi* copycut=new AliRDHFCutsLctopKpi(*(static_cast<AliRDHFCutsLctopKpi*>(fCuts))); | |
214 | // Post the data | |
215 | PostData(4,copycut); | |
216 | } | |
217 | break; | |
218 | ||
219 | default: | |
220 | return; | |
221 | } | |
222 | ||
223 | ||
224 | ||
225 | } | |
226 | ||
227 | //___________________________________________________________________________ | |
228 | void AliAnalysisTaskSEHFQA::UserCreateOutputObjects() | |
229 | { | |
230 | ||
231 | //create the output container | |
232 | if(fDebug > 1) printf("AnalysisTaskSEHFQA::UserCreateOutputObjects() \n"); | |
233 | ||
234 | //count events | |
235 | ||
acc33385 | 236 | fNEntries=new TH1F(GetOutputSlot(1)->GetContainer()->GetName(), "Counts the number of events", 10,-0.5,9.5); |
0dbb51a0 | 237 | fNEntries->GetXaxis()->SetBinLabel(1,"nEventsAnal"); |
238 | fNEntries->GetXaxis()->SetBinLabel(2,"Pile-up Rej"); | |
239 | fNEntries->GetXaxis()->SetBinLabel(3,"No VertexingHF"); | |
9af24f46 | 240 | fNEntries->GetXaxis()->SetBinLabel(4,"nCandidates(AnCuts)"); |
241 | fNEntries->GetXaxis()->SetBinLabel(5,"EventsWithGoodVtx"); | |
5fc4893f | 242 | //fNEntries->GetXaxis()->SetBinLabel(6,"N. of 0SMH"); |
243 | fNEntries->GetXaxis()->SetBinLabel(6,"N. of CSH1"); | |
a4ef4383 | 244 | if(fReadMC){ |
245 | fNEntries->GetXaxis()->SetBinLabel(7,"MC Cand from c"); | |
246 | fNEntries->GetXaxis()->SetBinLabel(8,"MC Cand from b"); | |
acc33385 | 247 | fNEntries->GetXaxis()->SetBinLabel(9,"N fake Trks"); |
248 | fNEntries->GetXaxis()->SetBinLabel(10,"N true Trks"); | |
a4ef4383 | 249 | } else{ |
250 | fNEntries->GetXaxis()->SetBinLabel(7,"N candidates"); | |
251 | } | |
252 | ||
0dbb51a0 | 253 | fNEntries->GetXaxis()->SetNdivisions(1,kFALSE); |
254 | ||
255 | //PID | |
5fc4893f | 256 | if(fOnOff[1]){ |
257 | fOutputPID=new TList(); | |
258 | fOutputPID->SetOwner(); | |
259 | fOutputPID->SetName(GetOutputSlot(2)->GetContainer()->GetName()); | |
0dbb51a0 | 260 | |
5fc4893f | 261 | //TOF pid |
262 | TString hname="hTOFsig"; | |
263 | TH1F* hTOFsig=new TH1F(hname.Data(),"Distribution of TOF signal;TOF time [ps];Entries", 100, -2.e3,40.e3); | |
0dbb51a0 | 264 | |
5fc4893f | 265 | hname="hTOFtime"; |
266 | TH1F* hTOFtime=new TH1F(hname.Data(),"Distribution of TOF time Kaon;TOF time(Kaon) [ps];Entries", 1000, 0.,50000.); | |
0dbb51a0 | 267 | |
5fc4893f | 268 | hname="hTOFtimeKaonHyptime"; |
269 | TH2F* hTOFtimeKaonHyptime=new TH2F(hname.Data(),"TOFtime - timeHypothesisForKaon;p[GeV/c];TOFtime - timeHypothesisForKaon [ps]",200,0.,4.,1000,-20000.,20000.); | |
0dbb51a0 | 270 | |
5fc4893f | 271 | hname="hTOFtimeKaonHyptimeAC"; |
272 | TH2F* hTOFtimeKaonHyptimeAC=new TH2F(hname.Data(),"TOFtime - timeHypothesisForKaon;p[GeV/c];TOFtime - timeHypothesisForKaon [ps]",200,0.,4.,1000,-20000.,20000.); | |
0dbb51a0 | 273 | |
5fc4893f | 274 | hname="hTOFsigmaKSigPid"; |
275 | TH2F* hTOFsigmaKSigPid=new TH2F(hname.Data(),"(TOFsignal-timeK)/tofSigPid;p[GeV/c];(TOFsignal-timeK)/tofSigPid",200,0.,4.,100,-5,5); | |
0dbb51a0 | 276 | |
5fc4893f | 277 | hname="hTOFsigmaPionSigPid"; |
278 | TH2F* hTOFsigmaPionSigPid=new TH2F(hname.Data(),"(TOFsignal-time#pi)/tofSigPid;p[GeV/c];(TOFsignal-time#pi)/tofSigPid",200,0.,4.,100,-5,5); | |
a4ef4383 | 279 | |
5fc4893f | 280 | hname="hTOFsigmaProtonSigPid"; |
281 | TH2F* hTOFsigmaProtonSigPid=new TH2F(hname.Data(),"(TOFsignal-timep)/tofSigPid;p[GeV/c];(TOFsignal-time p)/tofSigPid",200,0.,4.,100,-5,5); | |
a4ef4383 | 282 | |
5fc4893f | 283 | hname="hTOFsigPid3sigPion"; |
284 | TH1F* hTOFsigPid3sigPion=new TH1F(hname.Data(),"TOF PID resolution (#pi) [ps]",500,0.,1000.); | |
a4ef4383 | 285 | |
5fc4893f | 286 | hname="hTOFsigPid3sigKaon"; |
287 | TH1F* hTOFsigPid3sigKaon=new TH1F(hname.Data(),"TOF PID resolution (K) [ps]",500,0.,1000.); | |
0dbb51a0 | 288 | |
5fc4893f | 289 | hname="hTOFsigPid3sigProton"; |
290 | TH1F* hTOFsigPid3sigProton=new TH1F(hname.Data(),"TOF PID resolution (p) [ps]",500,0.,1000.); | |
a4ef4383 | 291 | |
0dbb51a0 | 292 | |
5fc4893f | 293 | //TPC pid |
294 | hname="hTPCsig"; | |
295 | TH1F* hTPCsig=new TH1F(hname.Data(),"Distribution of TPC signal;TPC sig;Entries", 100, 35.,100.); | |
0dbb51a0 | 296 | |
5fc4893f | 297 | hname="hTPCsigvsp"; |
298 | TH2F* hTPCsigvsp=new TH2F(hname.Data(),"TPCsig vs p;TPC p[GeV/c];TPCsig",200,0.,4.,1000,35.,100.); | |
0dbb51a0 | 299 | |
5fc4893f | 300 | hname="hTPCsigvspAC"; |
301 | TH2F* hTPCsigvspAC=new TH2F(hname.Data(),"TPCsig vs p;TPCp[GeV/c];TPCsig",200,0.,4.,1000,35.,100.); | |
302 | ||
303 | hname="hTPCsigmaK"; | |
304 | TH2F* hTPCsigmaK=new TH2F(hname.Data(),"TPC Sigma for K as a function of momentum;p[GeV/c];Sigma Kaon",200,0.,4.,200,-5,5); | |
305 | ||
306 | hname="hTPCsigmaPion"; | |
307 | TH2F* hTPCsigmaPion=new TH2F(hname.Data(),"TPC Sigma for #pi as a function of momentum;p[GeV/c];Sigma #pi",200,0.,4.,200,-5,5); | |
308 | ||
309 | hname="hTPCsigmaProton"; | |
310 | TH2F* hTPCsigmaProton=new TH2F(hname.Data(),"TPC Sigma for proton as a function of momentum;p[GeV/c];Sigma Proton",200,0.,4.,200,-5,5); | |
311 | ||
312 | fOutputPID->Add(hTOFsig); | |
313 | fOutputPID->Add(hTPCsig); | |
314 | fOutputPID->Add(hTOFtime); | |
315 | fOutputPID->Add(hTOFtimeKaonHyptime); | |
316 | fOutputPID->Add(hTOFtimeKaonHyptimeAC); | |
5fc4893f | 317 | fOutputPID->Add(hTOFsigmaKSigPid); |
318 | fOutputPID->Add(hTOFsigmaPionSigPid); | |
319 | fOutputPID->Add(hTOFsigmaProtonSigPid); | |
320 | fOutputPID->Add(hTOFsigPid3sigPion); | |
321 | fOutputPID->Add(hTOFsigPid3sigKaon); | |
322 | fOutputPID->Add(hTOFsigPid3sigProton); | |
323 | fOutputPID->Add(hTPCsigvsp); | |
324 | fOutputPID->Add(hTPCsigvspAC); | |
325 | fOutputPID->Add(hTPCsigmaK); | |
326 | fOutputPID->Add(hTPCsigmaPion); | |
327 | fOutputPID->Add(hTPCsigmaProton); | |
328 | } | |
0dbb51a0 | 329 | |
330 | //quality of the tracks | |
5fc4893f | 331 | if(fOnOff[0]){ |
332 | fOutputTrack=new TList(); | |
333 | fOutputTrack->SetOwner(); | |
334 | fOutputTrack->SetName(GetOutputSlot(3)->GetContainer()->GetName()); | |
0dbb51a0 | 335 | |
5fc4893f | 336 | TString hname="hnClsITS"; |
337 | TH1F* hnClsITS=new TH1F(hname.Data(),"Distribution of number of ITS clusters;nITScls;Entries",7,-0.5,6.5); | |
0dbb51a0 | 338 | |
5fc4893f | 339 | hname="hnClsITS-SA"; |
340 | TH1F* hnClsITSSA=new TH1F(hname.Data(),"Distribution of number of ITS clusters(ITS-SA);nITScls;Entries",7,-0.5,6.5); | |
0dbb51a0 | 341 | |
bc6846db | 342 | |
343 | hname="hnLayerITS"; | |
f3e1ad2f | 344 | TH1F* hnLayerITS=new TH1F(hname.Data(),"Number of tracks with point in layer;ITS layer;",7,-1.5,5.5); |
345 | hnLayerITS->GetXaxis()->SetBinLabel(1,"n tracks"); | |
bc6846db | 346 | |
347 | hname="hnLayerITSsa"; | |
f3e1ad2f | 348 | TH1F* hnLayerITSsa=new TH1F(hname.Data(),"Number of tracks with point in layer;ITS layer;",7,-1.5,5.5); |
349 | hnLayerITSsa->GetXaxis()->SetBinLabel(1,"n tracks"); | |
350 | ||
5fc4893f | 351 | hname="hnClsSPD"; |
352 | TH1F* hnClsSPD=new TH1F(hname.Data(),"Distribution of number of SPD clusters;nSPDcls;Entries",3,-0.5,2.5); | |
0dbb51a0 | 353 | |
5fc4893f | 354 | hname="hptGoodTr"; |
355 | TH1F* hptGoodTr=new TH1F(hname.Data(),"Pt distribution of 'good' tracks;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.); | |
356 | hptGoodTr->SetTitleOffset(1.3,"Y"); | |
0dbb51a0 | 357 | |
5fc4893f | 358 | hname="hdistrGoodTr"; |
359 | TH1F* hdistrGoodTr=new TH1F(hname.Data(),"Distribution of number of 'good' tracks per event;no.good-tracks/ev;Entries",4000,-0.5,3999.5); | |
360 | hdistrGoodTr->SetTitleOffset(1.3,"Y"); | |
0dbb51a0 | 361 | |
5fc4893f | 362 | hname="hd0"; |
363 | TH1F* hd0=new TH1F(hname.Data(),"Impact parameter distribution of 'good' tracks;d_{0}[cm];Entries/10^{3} cm",200,-0.1,0.1); | |
0dbb51a0 | 364 | |
5fc4893f | 365 | fOutputTrack->Add(hnClsITS); |
366 | fOutputTrack->Add(hnClsITSSA); | |
bc6846db | 367 | fOutputTrack->Add(hnLayerITS); |
368 | fOutputTrack->Add(hnLayerITSsa); | |
5fc4893f | 369 | fOutputTrack->Add(hnClsSPD); |
370 | fOutputTrack->Add(hptGoodTr); | |
371 | fOutputTrack->Add(hdistrGoodTr); | |
372 | fOutputTrack->Add(hd0); | |
acc33385 | 373 | |
5fc4893f | 374 | if(fReadMC){ |
375 | hname="hdistrFakeTr"; | |
376 | TH1F* hdistrFakeTr=new TH1F(hname.Data(),"Distribution of number of fake tracks per event;no.fake-tracks/ev;Entries",4000,-0.5,3999.5); | |
377 | hdistrGoodTr->SetTitleOffset(1.3,"Y"); | |
acc33385 | 378 | |
5fc4893f | 379 | hname="hd0f"; |
380 | TH1F* hd0f=new TH1F(hname.Data(),"Impact parameter distribution of fake tracks;d_{0}[cm];Entries/10^{3} cm",200,-0.1,0.1); | |
acc33385 | 381 | |
5fc4893f | 382 | hname="hptFakeTr"; |
383 | TH1F* hptFakeTr=new TH1F(hname.Data(),"Pt distribution of fake tracks;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.); | |
ad42e35b | 384 | hptFakeTr->SetTitleOffset(1.3,"Y"); |
acc33385 | 385 | |
5fc4893f | 386 | fOutputTrack->Add(hptFakeTr); |
387 | fOutputTrack->Add(hdistrFakeTr); | |
388 | fOutputTrack->Add(hd0f); | |
389 | ||
390 | } | |
acc33385 | 391 | } |
392 | ||
0dbb51a0 | 393 | |
5fc4893f | 394 | if(fOnOff[2] && fCuts->GetUseCentrality()){ |
a4ef4383 | 395 | |
396 | //Centrality (Counters) | |
397 | fOutputCounters=new TList(); | |
398 | fOutputCounters->SetOwner(); | |
399 | fOutputCounters->SetName(GetOutputSlot(5)->GetContainer()->GetName()); | |
400 | ||
401 | AliCounterCollection *stdEstimator=new AliCounterCollection("stdEstimator"); | |
402 | stdEstimator->AddRubric("run",500000); | |
5fc4893f | 403 | stdEstimator->AddRubric("centralityclass","-10_0/0_10/10_20/20_30/30_40/40_50/50_60/60_70/70_80/80_90/90_100/-990_-980"); |
a4ef4383 | 404 | stdEstimator->Init(); |
405 | AliCounterCollection *secondEstimator=new AliCounterCollection("secondEstimator"); | |
406 | secondEstimator->AddRubric("run",500000); | |
5fc4893f | 407 | secondEstimator->AddRubric("centralityclass","-10_0/0_10/10_20/20_30/30_40/40_50/50_60/60_70/70_80/80_90/90_100/-990_-980"); |
a4ef4383 | 408 | secondEstimator->Init(); |
409 | ||
410 | fOutputCounters->Add(stdEstimator); | |
411 | fOutputCounters->Add(secondEstimator); | |
412 | ||
413 | //Centrality (Checks) | |
414 | fOutputCheckCentrality=new TList(); | |
415 | fOutputCheckCentrality->SetOwner(); | |
416 | fOutputCheckCentrality->SetName(GetOutputSlot(6)->GetContainer()->GetName()); | |
417 | ||
5fc4893f | 418 | TString hname="hNtrackletsIn"; |
a4ef4383 | 419 | TH1F* hNtrackletsIn=new TH1F(hname.Data(),"Number of tracklets in Centrality range;ntracklets;Entries",5000,-0.5,4999.5); |
420 | ||
421 | hname="hMultIn"; | |
422 | TH1F* hMultIn=new TH1F(hname.Data(),"Multiplicity;multiplicity in Centrality range;Entries",10000,-0.5,9999.5); | |
423 | ||
424 | hname="hNtrackletsOut"; | |
425 | TH1F* hNtrackletsOut=new TH1F(hname.Data(),"Number of tracklets out of Centrality range;ntracklets;Entries",5000,-0.5,4999.5); | |
426 | ||
427 | hname="hMultOut"; | |
428 | TH1F* hMultOut=new TH1F(hname.Data(),"Multiplicity out of Centrality range;multiplicity;Entries",10000,-0.5,9999.5); | |
429 | ||
ac0c2841 | 430 | hname="hMultvsPercentile"; |
5fc4893f | 431 | TH2F* hMultvsPercentile=new TH2F(hname.Data(),"Multiplicity vs Percentile;multiplicity;percentile",10000,-0.5,9999.5,12,-10.,110); |
ac0c2841 | 432 | |
a4ef4383 | 433 | fOutputCheckCentrality->Add(hNtrackletsIn); |
434 | fOutputCheckCentrality->Add(hNtrackletsOut); | |
435 | fOutputCheckCentrality->Add(hMultIn); | |
436 | fOutputCheckCentrality->Add(hMultOut); | |
ac0c2841 | 437 | fOutputCheckCentrality->Add(hMultvsPercentile); |
82f89d0d | 438 | |
439 | PostData(6,fOutputCheckCentrality); | |
440 | ||
a4ef4383 | 441 | } else{ |
5fc4893f | 442 | if(fOnOff[0]){ |
443 | TString hname="hNtracklets"; | |
444 | TH1F* hNtracklets=new TH1F(hname.Data(),"Number of tracklets;ntracklets;Entries",5000,-0.5,4999.5); | |
445 | ||
446 | hname="hMult"; | |
447 | TH1F* hMult=new TH1F(hname.Data(),"Multiplicity;multiplicity;Entries",10000,-0.5,9999.5); | |
448 | fOutputTrack->Add(hNtracklets); | |
449 | fOutputTrack->Add(hMult); | |
450 | } | |
a4ef4383 | 451 | } |
452 | ||
818c1271 | 453 | //event selection (z vertex for the moment) |
454 | if(fOnOff[3]){ | |
455 | fOutputEvSelection=new TList(); | |
456 | fOutputEvSelection->SetOwner(); | |
457 | fOutputEvSelection->SetName(GetOutputSlot(7)->GetContainer()->GetName()); | |
458 | AliCounterCollection *evselection=new AliCounterCollection("evselection"); | |
459 | evselection->AddRubric("run",500000); | |
460 | evselection->AddRubric("evnonsel","zvtx"); | |
461 | evselection->Init(); | |
462 | ||
463 | TH1F* hzvtx=new TH1F("hzvtx", "Distribution of z_{VTX};z_{VTX} [cm];Entries",100,-20,20); | |
464 | ||
465 | fOutputEvSelection->Add(evselection); | |
466 | fOutputEvSelection->Add(hzvtx); | |
467 | } | |
a4b0ffc7 | 468 | // AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); |
469 | // AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler(); | |
470 | // AliPIDResponse *pidResp=inputHandler->GetPIDResponse(); | |
471 | // fCuts->GetPidHF()->SetPidResponse(pidResp); | |
0dbb51a0 | 472 | // Post the data |
473 | PostData(1,fNEntries); | |
5fc4893f | 474 | if(fOnOff[1]) PostData(2,fOutputPID); |
475 | if(fOnOff[0]) PostData(3,fOutputTrack); | |
0dbb51a0 | 476 | PostData(4,fCuts); |
5fc4893f | 477 | if(fOnOff[2]) PostData(5,fOutputCounters); |
818c1271 | 478 | if(fOnOff[3]) PostData(7,fOutputEvSelection); |
479 | ||
5fc4893f | 480 | if(!fOnOff[0] && !fOnOff[1] && !fOnOff[2]) AliError("Nothing will be filled!"); |
0dbb51a0 | 481 | } |
482 | ||
483 | //___________________________________________________________________________ | |
484 | void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/) | |
485 | { | |
486 | // Execute analysis for current event | |
487 | ||
488 | AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent()); | |
489 | if(fDebug>2) printf("Analysing decay %d\n",fDecayChannel); | |
490 | // Post the data already here | |
491 | PostData(1,fNEntries); | |
5fc4893f | 492 | if(fOnOff[1]) PostData(2,fOutputPID); |
493 | if(fOnOff[0]) PostData(3,fOutputTrack); | |
0dbb51a0 | 494 | PostData(4,fCuts); |
5fc4893f | 495 | if(fOnOff[2]) { |
496 | PostData(5,fOutputCounters); | |
497 | if(fCuts->GetUseCentrality()) PostData(6,fOutputCheckCentrality); | |
498 | } | |
0dbb51a0 | 499 | |
500 | TClonesArray *arrayProng =0; | |
501 | Int_t pdg=0; | |
a4ef4383 | 502 | Int_t *pdgdaughters=0x0; |
503 | ||
0dbb51a0 | 504 | if(!aod && AODEvent() && IsStandardAOD()) { |
505 | // In case there is an AOD handler writing a standard AOD, use the AOD | |
506 | // event in memory rather than the input (ESD) event. | |
507 | aod = dynamic_cast<AliAODEvent*> (AODEvent()); | |
508 | // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root) | |
509 | // have to taken from the AOD event hold by the AliAODExtension | |
510 | AliAODHandler* aodHandler = (AliAODHandler*) | |
511 | ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); | |
512 | if(aodHandler->GetExtensions()) { | |
513 | ||
514 | AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root"); | |
515 | AliAODEvent *aodFromExt = ext->GetAOD(); | |
516 | ||
517 | ||
518 | ||
519 | switch(fDecayChannel){ | |
520 | case 0: | |
521 | arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong"); | |
522 | pdg=411; | |
a4ef4383 | 523 | if(fReadMC){ |
524 | pdgdaughters =new Int_t[3]; | |
525 | pdgdaughters[0]=211;//pi | |
526 | pdgdaughters[1]=321;//K | |
527 | pdgdaughters[2]=211;//pi | |
528 | } | |
0dbb51a0 | 529 | break; |
530 | case 1: | |
531 | arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("D0toKpi"); | |
532 | pdg=421; | |
a4ef4383 | 533 | if(fReadMC){ |
534 | pdgdaughters =new Int_t[2]; | |
535 | pdgdaughters[0]=211;//pi | |
536 | pdgdaughters[1]=321;//K | |
537 | } | |
0dbb51a0 | 538 | break; |
539 | case 2: | |
540 | arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Dstar"); | |
541 | pdg=413; | |
a4ef4383 | 542 | if(fReadMC){ |
fb9311e8 | 543 | pdgdaughters =new Int_t[3]; |
a4ef4383 | 544 | pdgdaughters[1]=211;//pi |
545 | pdgdaughters[0]=321;//K | |
546 | pdgdaughters[2]=211;//pi (soft?) | |
547 | } | |
0dbb51a0 | 548 | break; |
549 | case 3: | |
550 | arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong"); | |
551 | pdg=431; | |
a4ef4383 | 552 | if(fReadMC){ |
553 | pdgdaughters =new Int_t[3]; | |
554 | pdgdaughters[0]=321;//K | |
555 | pdgdaughters[1]=321;//K | |
556 | pdgdaughters[2]=211;//pi | |
557 | } | |
0dbb51a0 | 558 | break; |
559 | case 4: | |
560 | arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm4Prong"); | |
561 | pdg=421; | |
a4ef4383 | 562 | if(fReadMC){ |
563 | pdgdaughters =new Int_t[4]; | |
564 | pdgdaughters[0]=321; | |
565 | pdgdaughters[1]=211; | |
566 | pdgdaughters[2]=211; | |
567 | pdgdaughters[3]=211; | |
568 | } | |
0dbb51a0 | 569 | break; |
570 | case 5: | |
571 | arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong"); | |
572 | pdg=4122; | |
a4ef4383 | 573 | if(fReadMC){ |
574 | pdgdaughters =new Int_t[3]; | |
575 | pdgdaughters[0]=2212;//p | |
576 | pdgdaughters[1]=321;//K | |
577 | pdgdaughters[2]=211;//pi | |
578 | } | |
0dbb51a0 | 579 | break; |
580 | } | |
581 | } | |
dc222f77 | 582 | } else if(aod) { |
0dbb51a0 | 583 | switch(fDecayChannel){ |
584 | case 0: | |
585 | arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong"); | |
586 | pdg=411; | |
a4ef4383 | 587 | if(fReadMC){ |
588 | pdgdaughters =new Int_t[3]; | |
589 | pdgdaughters[0]=211;//pi | |
590 | pdgdaughters[1]=321;//K | |
591 | pdgdaughters[2]=211;//pi | |
592 | } | |
0dbb51a0 | 593 | break; |
594 | case 1: | |
595 | arrayProng=(TClonesArray*)aod->GetList()->FindObject("D0toKpi"); | |
596 | pdg=421; | |
a4ef4383 | 597 | if(fReadMC){ |
598 | pdgdaughters =new Int_t[2]; | |
599 | pdgdaughters[0]=211;//pi | |
600 | pdgdaughters[1]=321;//K | |
601 | } | |
0dbb51a0 | 602 | break; |
603 | case 2: | |
604 | arrayProng=(TClonesArray*)aod->GetList()->FindObject("Dstar"); | |
605 | pdg=413; | |
a4ef4383 | 606 | if(fReadMC){ |
24bcb2f3 | 607 | pdgdaughters =new Int_t[3]; |
a4ef4383 | 608 | pdgdaughters[1]=211;//pi |
609 | pdgdaughters[0]=321;//K | |
610 | pdgdaughters[2]=211;//pi (soft?) | |
611 | } | |
0dbb51a0 | 612 | break; |
613 | case 3: | |
614 | arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong"); | |
615 | pdg=431; | |
a4ef4383 | 616 | if(fReadMC){ |
617 | pdgdaughters =new Int_t[3]; | |
618 | pdgdaughters[0]=321;//K | |
619 | pdgdaughters[1]=321;//K | |
620 | pdgdaughters[2]=211;//pi | |
621 | } | |
0dbb51a0 | 622 | break; |
623 | case 4: | |
624 | arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm4Prong"); | |
625 | pdg=421; | |
a4ef4383 | 626 | if(fReadMC){ |
627 | pdgdaughters =new Int_t[4]; | |
628 | pdgdaughters[0]=321; | |
629 | pdgdaughters[1]=211; | |
630 | pdgdaughters[2]=211; | |
631 | pdgdaughters[3]=211; | |
632 | } | |
0dbb51a0 | 633 | break; |
634 | case 5: | |
635 | arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong"); | |
636 | pdg=4122; | |
a4ef4383 | 637 | if(fReadMC){ |
638 | pdgdaughters =new Int_t[3]; | |
639 | pdgdaughters[0]=2212;//p | |
640 | pdgdaughters[1]=321;//K | |
641 | pdgdaughters[2]=211;//pi | |
642 | } | |
0dbb51a0 | 643 | break; |
644 | } | |
645 | } | |
19222b31 | 646 | Bool_t isSimpleMode=fSimpleMode; |
0dbb51a0 | 647 | if(!arrayProng) { |
648 | AliInfo("Branch not found! The output will contain only trak related histograms\n"); | |
649 | isSimpleMode=kTRUE; | |
9af24f46 | 650 | fNEntries->Fill(2); |
0dbb51a0 | 651 | } |
652 | ||
a4ef4383 | 653 | TClonesArray *mcArray = 0; |
654 | AliAODMCHeader *mcHeader = 0; | |
655 | ||
3655ecf2 | 656 | if(!aod) { |
657 | delete [] pdgdaughters; | |
658 | return; | |
659 | } | |
660 | ||
a4ef4383 | 661 | //check if MC |
662 | if(fReadMC) { | |
663 | // load MC particles | |
664 | mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()); | |
665 | if(!mcArray) { | |
666 | printf("AliAnalysisTaskSEHFQA::UserExec: MC particles branch not found!\n"); | |
fb9311e8 | 667 | delete [] pdgdaughters; |
a4ef4383 | 668 | return; |
669 | } | |
670 | ||
671 | // load MC header | |
672 | mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName()); | |
673 | if(!mcHeader) { | |
674 | printf("AliAnalysisTaskSEHFQA::UserExec: MC header branch not found!\n"); | |
fb9311e8 | 675 | delete [] pdgdaughters; |
a4ef4383 | 676 | return; |
677 | } | |
678 | } | |
0dbb51a0 | 679 | // fix for temporary bug in ESDfilter |
680 | // the AODs with null vertex pointer didn't pass the PhysSel | |
3655ecf2 | 681 | if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) { |
682 | delete [] pdgdaughters; | |
683 | return; | |
684 | } | |
0dbb51a0 | 685 | |
686 | // count event | |
687 | fNEntries->Fill(0); | |
9af24f46 | 688 | |
689 | //count events with good vertex | |
690 | // AOD primary vertex | |
691 | AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex(); | |
692 | TString primTitle = vtx1->GetTitle(); | |
693 | if(primTitle.Contains("VertexerTracks") && vtx1->GetNContributors()>0) fNEntries->Fill(4); | |
694 | ||
a3aa1279 | 695 | // trigger class for PbPb C0SMH-B-NOPF-ALLNOTRD, C0SMH-B-NOPF-ALL |
5fc4893f | 696 | //TString trigclass=aod->GetFiredTriggerClasses(); |
697 | //if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL")) fNEntries->Fill(5); //tmp | |
a3aa1279 | 698 | |
818c1271 | 699 | Int_t runNumber = aod->GetRunNumber(); |
700 | ||
ac0c2841 | 701 | Bool_t evSelbyCentrality=kTRUE,evSelected=kTRUE,evSelByVertex=kTRUE,evselByPileup=kFALSE; |
0dbb51a0 | 702 | //select event |
703 | if(!fCuts->IsEventSelected(aod)) { | |
82f89d0d | 704 | evSelected=kFALSE; |
ac0c2841 | 705 | if(fCuts->GetWhyRejection()==1) {fNEntries->Fill(1); evselByPileup=kTRUE;}// rejected for pileup |
706 | if(fCuts->GetWhyRejection()==2 || fCuts->GetWhyRejection()==3) evSelbyCentrality=kFALSE; //rejected by centrality | |
707 | if(fCuts->GetWhyRejection()==4) evSelByVertex=kFALSE; //rejected by vertex | |
5fc4893f | 708 | if(fCuts->GetWhyRejection()==5) fNEntries->Fill(5);//tmp |
818c1271 | 709 | if(fCuts->GetWhyRejection()==6 && fOnOff[3]) ((AliCounterCollection*)fOutputEvSelection->FindObject("evselection"))->Count("evnonsel:zvtx/Run:%d",runNumber); |
0dbb51a0 | 710 | } |
818c1271 | 711 | |
ac0c2841 | 712 | if(evSelected || (!evSelected && !evSelbyCentrality && evSelByVertex && !evselByPileup)){ //events selected or not selected because of vtx or pileup |
5fc4893f | 713 | if(fOnOff[2] && fCuts->GetUseCentrality()){ |
818c1271 | 714 | |
ac0c2841 | 715 | Float_t stdCentf=fCuts->GetCentrality(aod); |
716 | Int_t stdCent = (Int_t)(stdCentf+0.5); | |
5fc4893f | 717 | Float_t secondCentf =fCuts->GetCentrality(aod,fEstimator); |
718 | Int_t secondCent = (Int_t)(secondCentf+0.5); | |
82f89d0d | 719 | Int_t mincent=stdCent-stdCent%10; |
5fc4893f | 720 | if(stdCentf==-1) { |
5587ae1a | 721 | mincent=-10; |
5fc4893f | 722 | stdCent=-1; |
723 | } | |
82f89d0d | 724 | ((AliCounterCollection*)fOutputCounters->FindObject("stdEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber)); |
5fc4893f | 725 | |
82f89d0d | 726 | mincent=secondCent-secondCent%10; |
5fc4893f | 727 | if(secondCentf==-1) { |
5587ae1a | 728 | mincent=-10; |
5fc4893f | 729 | secondCent=-1; |
730 | } | |
82f89d0d | 731 | ((AliCounterCollection*)fOutputCounters->FindObject("secondEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber)); |
732 | ||
733 | if(stdCent<fCuts->GetMinCentrality() || stdCent>fCuts->GetMaxCentrality()){ | |
734 | ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsOut"))->Fill(aod->GetTracklets()->GetNumberOfTracklets()); | |
735 | ((TH1F*)fOutputCheckCentrality->FindObject("hMultOut"))->Fill(aod->GetHeader()->GetRefMultiplicity()); | |
736 | }else{ | |
737 | ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsIn"))->Fill(aod->GetTracklets()->GetNumberOfTracklets()); | |
738 | ((TH1F*)fOutputCheckCentrality->FindObject("hMultIn"))->Fill(aod->GetHeader()->GetRefMultiplicity()); | |
739 | } | |
ac0c2841 | 740 | ((TH2F*)fOutputCheckCentrality->FindObject("hMultvsPercentile"))->Fill(aod->GetHeader()->GetRefMultiplicity(),stdCentf); |
0dbb51a0 | 741 | |
82f89d0d | 742 | PostData(6,fOutputCheckCentrality); |
743 | ||
744 | } else{ | |
5fc4893f | 745 | if(fOnOff[0]){ |
746 | ((TH1F*)fOutputTrack->FindObject("hNtracklets"))->Fill(aod->GetTracklets()->GetNumberOfTracklets()); | |
747 | ((TH1F*)fOutputTrack->FindObject("hMult"))->Fill(aod->GetHeader()->GetRefMultiplicity()); | |
748 | } | |
a4ef4383 | 749 | } |
82f89d0d | 750 | } |
751 | ||
818c1271 | 752 | if(fOnOff[3]){ |
753 | const AliVVertex *vertex = aod->GetPrimaryVertex(); | |
754 | Double_t zvtx=vertex->GetZ(); | |
a4b0ffc7 | 755 | if(evSelected || (!evSelected && TMath::Abs(zvtx) > 10.)) |
818c1271 | 756 | ((TH1F*)fOutputEvSelection->FindObject("hzvtx"))->Fill(zvtx); |
757 | } | |
758 | ||
82f89d0d | 759 | if(!evSelected) { |
760 | delete [] pdgdaughters; | |
761 | return; //discard all events not selected (vtx and/or centrality) | |
a4ef4383 | 762 | } |
763 | ||
818c1271 | 764 | |
476db98d | 765 | AliAODPidHF* pidHF=fCuts->GetPidHF(); |
362242bf | 766 | if(!pidHF) { |
767 | delete [] pdgdaughters; | |
768 | return; | |
769 | } | |
a4b0ffc7 | 770 | AliPIDResponse* respF=pidHF->GetPidResponse(); |
476db98d | 771 | AliTPCPIDResponse* tpcres=new AliTPCPIDResponse(); |
a4b0ffc7 | 772 | if(pidHF->GetOldPid()) pidHF->SetBetheBloch(*tpcres); |
773 | Bool_t oldPID=pidHF->GetOldPid(); | |
476db98d | 774 | |
775 | ||
0dbb51a0 | 776 | Int_t ntracks=0; |
5fc4893f | 777 | Int_t isGoodTrack=0, isFakeTrack=0; |
0dbb51a0 | 778 | |
779 | if(aod) ntracks=aod->GetNTracks(); | |
780 | ||
5fc4893f | 781 | if(fOnOff[0] || fOnOff[1]){ |
782 | //loop on tracks in the event | |
783 | for (Int_t k=0;k<ntracks;k++){ | |
784 | AliAODTrack* track=aod->GetTrack(k); | |
5fc4893f | 785 | AliAODPid *pid = track->GetDetPid(); |
786 | ||
0dbb51a0 | 787 | |
5fc4893f | 788 | if(fOnOff[1]){ |
789 | if(!pid) {if (fDebug>1)cout<<"No AliAODPid found"<<endl; continue;} | |
790 | Double_t times[AliPID::kSPECIES]; | |
791 | pid->GetIntegratedTimes(times); | |
0dbb51a0 | 792 | |
5fc4893f | 793 | Double_t tofRes[AliPID::kSPECIES]; |
794 | pid->GetTOFpidResolution(tofRes); | |
795 | ||
796 | //check TOF | |
797 | if(pidHF && pidHF->CheckStatus(track,"TOF")){ | |
798 | ((TH1F*)fOutputPID->FindObject("hTOFtime"))->Fill(times[AliPID::kProton]); | |
799 | ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptime"))->Fill(track->P(),pid->GetTOFsignal()-times[3]); //3 is kaon | |
800 | ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(pid->GetTOFsignal()); | |
801 | if (pid->GetTOFsignal()< 0) ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(-1); | |
802 | ||
5587ae1a | 803 | |
5fc4893f | 804 | // test TOF sigma PID |
805 | if (tofRes[2] != 0.) { // protection against 'old' AODs... | |
806 | ((TH2F*)fOutputPID->FindObject("hTOFsigmaKSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kKaon])/tofRes[3]); | |
807 | ((TH2F*)fOutputPID->FindObject("hTOFsigmaPionSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kPion])/tofRes[2]); | |
808 | ((TH2F*)fOutputPID->FindObject("hTOFsigmaProtonSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kProton])/tofRes[4]); | |
809 | for (Int_t iS=2; iS<5; iS++){ //we plot TOF Pid resolution for 3-sigma identified particles | |
810 | if ( (TMath::Abs(times[iS]-pid->GetTOFsignal())/tofRes[iS])<3.){ | |
811 | switch (iS) { | |
812 | case AliPID::kPion: | |
813 | ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigPion"))->Fill(tofRes[iS]); | |
814 | break; | |
815 | case AliPID::kKaon: | |
816 | ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigKaon"))->Fill(tofRes[iS]); | |
817 | break; | |
818 | case AliPID::kProton: | |
819 | ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigProton"))->Fill(tofRes[iS]); | |
820 | break; | |
821 | default: | |
822 | break; | |
823 | } | |
824 | } | |
a4ef4383 | 825 | } |
826 | } | |
5fc4893f | 827 | }//if TOF status |
828 | ||
829 | if(pidHF && pidHF->CheckStatus(track,"TPC")){ | |
476db98d | 830 | |
5fc4893f | 831 | Double_t TPCp=pid->GetTPCmomentum(); |
832 | Double_t TPCsignal=pid->GetTPCsignal(); | |
833 | ((TH1F*)fOutputPID->FindObject("hTPCsig"))->Fill(TPCsignal); | |
834 | ((TH1F*)fOutputPID->FindObject("hTPCsigvsp"))->Fill(TPCp,TPCsignal); | |
835 | //if (pidHF->IsKaonRaw(track, "TOF")) | |
a4b0ffc7 | 836 | if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaK"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kKaon)); |
837 | if (oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaK"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kKaon)); | |
5fc4893f | 838 | //if (pidHF->IsPionRaw(track, "TOF")) |
a4b0ffc7 | 839 | if(oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaPion"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kPion)); |
840 | if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaPion"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kPion)); | |
5fc4893f | 841 | //if (pidHF->IsProtonRaw(track,"TOF")) |
a4b0ffc7 | 842 | if(oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaProton"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kProton)); |
843 | if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaProton"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kProton)); | |
5fc4893f | 844 | }//if TPC status |
845 | } //end PID histograms | |
846 | ||
847 | Int_t nclsTot=0,nclsSPD=0; | |
848 | ||
849 | //check clusters of the tracks | |
850 | if(fOnOff[0]){ | |
851 | ||
bc6846db | 852 | ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(-1); |
5fc4893f | 853 | for(Int_t l=0;l<6;l++) { |
854 | if(TESTBIT(track->GetITSClusterMap(),l)) { | |
bc6846db | 855 | ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(l); |
5fc4893f | 856 | nclsTot++; if(l<2) nclsSPD++; |
857 | } | |
858 | } | |
859 | ((TH1F*)fOutputTrack->FindObject("hnClsITS"))->Fill(nclsTot); | |
860 | ((TH1F*)fOutputTrack->FindObject("hnClsSPD"))->Fill(nclsSPD); | |
0dbb51a0 | 861 | |
5fc4893f | 862 | if(!(track->GetStatus()&AliESDtrack::kTPCin) && track->GetStatus()&AliESDtrack::kITSrefit && !(track->GetStatus()&AliESDtrack::kITSpureSA)){//tracks retrieved in the ITS and not reconstructed in the TPC |
863 | ((TH1F*)fOutputTrack->FindObject("hnClsITS-SA"))->Fill(nclsTot); | |
bc6846db | 864 | ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(-1); |
865 | for(Int_t l=0;l<6;l++) { | |
866 | if(TESTBIT(track->GetITSClusterMap(),l)) { | |
867 | ((TH1F*)fOutputTrack->FindObject("hnLayerITSsa"))->Fill(l); | |
868 | } | |
869 | } | |
acc33385 | 870 | } |
5fc4893f | 871 | Int_t label=0; |
872 | if(fReadMC){ | |
873 | label=track->GetLabel(); | |
874 | if (label<0)fNEntries->Fill(8); | |
875 | else fNEntries->Fill(9); | |
acc33385 | 876 | } |
0dbb51a0 | 877 | |
5fc4893f | 878 | if(isSimpleMode){ |
879 | ||
880 | if (track->Pt()>0.3 && | |
881 | track->GetStatus()&AliESDtrack::kTPCrefit && | |
882 | track->GetStatus()&AliESDtrack::kITSrefit && | |
883 | /*nclsTot>3 &&*/ | |
884 | nclsSPD>0) {//count good tracks | |
885 | ||
886 | ||
887 | if(fReadMC && label<0) { | |
888 | ((TH1F*)fOutputTrack->FindObject("hptFakeTr"))->Fill(track->Pt()); | |
889 | isFakeTrack++; | |
890 | } else { | |
891 | ((TH1F*)fOutputTrack->FindObject("hptGoodTr"))->Fill(track->Pt()); | |
892 | isGoodTrack++; | |
893 | } | |
ad42e35b | 894 | } |
818c1271 | 895 | } //simple mode: no IsSelected on tracks: use "manual" cuts |
896 | } //fill track histos | |
5fc4893f | 897 | } //end loop on tracks |
0dbb51a0 | 898 | |
5fc4893f | 899 | //fill once per event |
900 | if(fOnOff[0]){ | |
901 | if (fReadMC) ((TH1F*)fOutputTrack->FindObject("hdistrFakeTr"))->Fill(isFakeTrack); | |
902 | ((TH1F*)fOutputTrack->FindObject("hdistrGoodTr"))->Fill(isGoodTrack); | |
903 | } | |
0dbb51a0 | 904 | |
5fc4893f | 905 | if(!isSimpleMode){ |
906 | // loop over candidates | |
907 | Int_t nCand = arrayProng->GetEntriesFast(); | |
908 | Int_t ndaugh=3; | |
909 | if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpi) ndaugh=2; | |
910 | if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpipipi) ndaugh=4; | |
911 | ||
912 | for (Int_t iCand = 0; iCand < nCand; iCand++) { | |
913 | AliAODRecoDecayHF *d = (AliAODRecoDecayHF*)arrayProng->UncheckedAt(iCand); | |
914 | if(d->GetSelectionMap()) { | |
915 | if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpi && !d->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts)) continue; //skip the D0 from Dstar | |
916 | if(fDecayChannel==AliAnalysisTaskSEHFQA::kDplustoKpipi && !d->HasSelectionBit(AliRDHFCuts::kDplusCuts)) continue; //skip the 3 prong !D+ | |
917 | } | |
acc33385 | 918 | |
5fc4893f | 919 | if(fReadMC){ |
920 | Int_t labD = d->MatchToMC(pdg,mcArray,ndaugh,pdgdaughters); | |
921 | if(labD>=0){ | |
922 | AliAODMCParticle *partD = (AliAODMCParticle*)mcArray->At(labD); | |
923 | Int_t label=partD->GetMother(); | |
924 | AliAODMCParticle *mot = (AliAODMCParticle*)mcArray->At(label); | |
925 | while(label>=0){//get first mother | |
926 | mot = (AliAODMCParticle*)mcArray->At(label); | |
927 | label=mot->GetMother(); | |
928 | } | |
929 | Int_t pdgMotCode = mot->GetPdgCode(); | |
930 | ||
931 | if(TMath::Abs(pdgMotCode)==4) fNEntries->Fill(6); //from primary charm | |
932 | if(TMath::Abs(pdgMotCode)==5) fNEntries->Fill(7); //from beauty | |
0dbb51a0 | 933 | |
acc33385 | 934 | } |
5fc4893f | 935 | }//end MC |
936 | else fNEntries->Fill(6); //count the candidates (data) | |
937 | ||
938 | for(Int_t id=0;id<ndaugh;id++){ | |
939 | ||
940 | //other histograms to be filled when the cut object is given | |
941 | AliAODTrack* track=(AliAODTrack*)d->GetDaughter(id); | |
942 | ||
943 | //track quality | |
944 | ||
945 | if (fCuts->IsInFiducialAcceptance(d->Pt(),d->Y(pdg)) && fCuts->IsSelected(d,AliRDHFCuts::kTracks,aod)) { | |
946 | ||
947 | Int_t label=0; | |
948 | if(fReadMC)label=track->GetLabel(); | |
ad42e35b | 949 | if(fOnOff[0]){ |
818c1271 | 950 | |
ad42e35b | 951 | if(fReadMC && label<0) { |
952 | isFakeTrack++; | |
953 | ((TH1F*)fOutputTrack->FindObject("hptFakeTr"))->Fill(track->Pt()); | |
5fc4893f | 954 | |
ad42e35b | 955 | ((TH1F*)fOutputTrack->FindObject("hd0f"))->Fill(d->Getd0Prong(id)); |
956 | } else { | |
957 | isGoodTrack++; | |
958 | ((TH1F*)fOutputTrack->FindObject("hptGoodTr"))->Fill(track->Pt()); | |
5fc4893f | 959 | |
ad42e35b | 960 | ((TH1F*)fOutputTrack->FindObject("hd0"))->Fill(d->Getd0Prong(id)); |
961 | } | |
818c1271 | 962 | } |
5fc4893f | 963 | if (fCuts->IsSelected(d,AliRDHFCuts::kAll,aod) && fOnOff[1]){ |
0dbb51a0 | 964 | |
5fc4893f | 965 | AliAODPid *pid = track->GetDetPid(); |
5fc4893f | 966 | Double_t times[5]; |
967 | pid->GetIntegratedTimes(times); | |
968 | if(pidHF && pidHF->CheckStatus(track,"TOF")) ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptimeAC"))->Fill(track->P(),pid->GetTOFsignal()-times[AliPID::kKaon]); | |
969 | if(pidHF && pidHF->CheckStatus(track,"TPC")) ((TH2F*)fOutputPID->FindObject("hTPCsigvspAC"))->Fill(pid->GetTPCmomentum(),pid->GetTPCsignal()); | |
970 | ||
971 | fNEntries->Fill(3); | |
972 | } //end analysis cuts | |
973 | } //end acceptance and track cuts | |
974 | } //end loop on tracks in the candidate | |
975 | } //end loop on candidates | |
976 | if(fOnOff[0]){ | |
977 | if(fReadMC) ((TH1F*)fOutputTrack->FindObject("hdistrFakeTr"))->Fill(isFakeTrack); | |
978 | ((TH1F*)fOutputTrack->FindObject("hdistrGoodTr"))->Fill(isGoodTrack); | |
979 | } | |
980 | } | |
981 | } //end if on pid or track histograms | |
fb9311e8 | 982 | |
476db98d | 983 | delete tpcres; |
fb9311e8 | 984 | delete [] pdgdaughters; |
a4ef4383 | 985 | PostData(1,fNEntries); |
5fc4893f | 986 | if(fOnOff[1]) PostData(2,fOutputPID); |
987 | if(fOnOff[0]) PostData(3,fOutputTrack); | |
a4ef4383 | 988 | PostData(4,fCuts); |
5fc4893f | 989 | if(fOnOff[2]) PostData(5,fOutputCounters); |
990 | //Post data 6 done in case of centrality on | |
82f89d0d | 991 | |
0dbb51a0 | 992 | } |
993 | ||
a4ef4383 | 994 | //____________________________________________________________________________ |
0dbb51a0 | 995 | void AliAnalysisTaskSEHFQA::Terminate(Option_t */*option*/){ |
996 | //terminate analysis | |
997 | ||
998 | fNEntries = dynamic_cast<TH1F*>(GetOutputData(1)); | |
999 | if(!fNEntries){ | |
1000 | printf("ERROR: %s not available\n",GetOutputSlot(1)->GetContainer()->GetName()); | |
1001 | return; | |
1002 | } | |
1003 | ||
1004 | fOutputPID = dynamic_cast<TList*> (GetOutputData(2)); | |
5fc4893f | 1005 | if (!fOutputPID && fOnOff[1]) { |
0dbb51a0 | 1006 | printf("ERROR: %s not available\n",GetOutputSlot(2)->GetContainer()->GetName()); |
1007 | return; | |
1008 | } | |
1009 | ||
1010 | fOutputTrack = dynamic_cast<TList*> (GetOutputData(3)); | |
5fc4893f | 1011 | if (!fOutputTrack && fOnOff[0]) { |
0dbb51a0 | 1012 | printf("ERROR: %s not available\n",GetOutputSlot(3)->GetContainer()->GetName()); |
1013 | return; | |
1014 | } | |
1015 | ||
1016 | } | |
1017 |