]>
Commit | Line | Data |
---|---|---|
16f48098 | 1 | |
2 | /************************************************************************** | |
3 | * Authors : Iouri Belikov, Antonin Maire | |
4 | * Contributors are mentioned in the code where appropriate. * | |
5 | * * | |
6 | * Permission to use, copy, modify and distribute this software and its * | |
7 | * documentation strictly for non-commercial purposes is hereby granted * | |
8 | * without fee, provided that the above copyright notice appears in all * | |
9 | * copies and that both the copyright notice and this permission notice * | |
10 | * appear in the supporting documentation. The authors make no claims * | |
11 | * about the suitability of this software for any purpose. It is * | |
12 | * provided "as is" without express or implied warranty. * | |
13 | **************************************************************************/ | |
14 | ||
15 | //----------------------------------------------------------------- | |
16 | // AliAnalysisTaskGlobalQA class | |
17 | // This task is for running the GlobalQA over already existing ESDs | |
18 | // Origin: I.Belikov, Iouri.Belikov@cern.ch, June 2009 | |
19 | //----------------------------------------------------------------- | |
20 | ||
21 | #include <TPDGCode.h> | |
22 | ||
23 | #include "TChain.h" | |
24 | #include "TTree.h" | |
25 | #include "TH1F.h" | |
26 | #include "TH2F.h" | |
27 | #include "TCanvas.h" | |
28 | ||
29 | #include "AliAnalysisManager.h" | |
30 | ||
31 | #include "AliESDEvent.h" | |
32 | #include "AliESDv0.h" | |
33 | #include "AliESDInputHandler.h" | |
2937b8ff | 34 | #include "AliESDVZERO.h" |
35 | #include "AliMultiplicity.h" | |
36 | ||
16f48098 | 37 | |
38 | #include "AliAnalysisTaskGlobalQA.h" | |
39 | ||
40 | // | |
41 | // Run the GlobalQA analysis over already existing ESDs | |
42 | // Origin: Iouri.Belikov@cern.ch | |
43 | // | |
44 | ||
45 | ClassImp(AliAnalysisTaskGlobalQA) | |
46 | ||
47 | //________________________________________________________________________ | |
48 | AliAnalysisTaskGlobalQA::AliAnalysisTaskGlobalQA() : | |
49 | AliAnalysisTaskSE("GlobalQA"), | |
50 | fArrayQA(0) | |
51 | { | |
52 | // Default Constructor | |
53 | ||
54 | DefineOutput(1, TObjArray::Class()); | |
55 | } | |
56 | ||
57 | //________________________________________________________________________ | |
58 | void AliAnalysisTaskGlobalQA::UserCreateOutputObjects() | |
59 | { | |
60 | // Create the histograms | |
61 | // Called once | |
62 | ||
63 | fArrayQA = new TObjArray(kLast); | |
64 | ||
65 | ||
66 | {// Cluster related QA | |
67 | const Char_t *name[]={ | |
68 | "hGlobalFractionAssignedClustersITS", | |
69 | "hGlobalFractionAssignedClustersTPC", | |
2937b8ff | 70 | "hGlobalFractionAssignedClustersTRD", |
71 | "hGlobalClustersPerITSModule" | |
72 | }; | |
16f48098 | 73 | const Char_t *title[]={ |
74 | "Fraction of the assigned clusters in ITS", | |
75 | "Fraction of the assigned clusters in TPC", | |
2937b8ff | 76 | "Fraction of the assigned clusters in TRD", |
77 | "Number of clusters per an ITS module" | |
16f48098 | 78 | }; |
79 | Add2ESDsList(new TH1F(name[0],title[0],100,0.,2.),kClr0); | |
80 | Add2ESDsList(new TH1F(name[1],title[1],100,0.,2.),kClr1); | |
81 | Add2ESDsList(new TH1F(name[2],title[2],100,0.,2.),kClr2); | |
2937b8ff | 82 | Add2ESDsList(new TH1F(name[3],title[3],2240,0.,2240.),kClr3); |
16f48098 | 83 | } |
84 | ||
85 | {// Track related QA | |
86 | const Char_t *name[]={ | |
87 | "hGlobalTrackAzimuthe", // kTrk0 | |
88 | "hGlobalTrackEta", // kTrk1 | |
89 | "hGlobalTPCTrackpT", // kTrk2 | |
90 | "hGlobalTPCITSMatchedpT", // kTrk3 | |
91 | "hGlobalTPCTOFMatchedpT", // kTrk4 | |
92 | "hGlobalTPCITSMatchingProbability", // kTrk5 | |
93 | "hGlobalTPCTOFMatchingProbability", // kTrk6 | |
94 | "hGlobalTPCsideAposDCA", // kTrk7 | |
95 | "hGlobalTPCsideAnegDCA", // kTrk8 | |
96 | "hGlobalTPCsideCposDCA", // kTrk9 | |
97 | "hGlobalTPCsideCnegDCA" // kTrk10 | |
98 | }; | |
99 | const Char_t *title[]={ | |
100 | "Track azimuthal distribution (rad)", // kTrk0 | |
101 | "Track pseudo-rapidity distribution", // kTrk1 | |
102 | "TPC: track momentum distribution (GeV)", // kTrk2 | |
103 | "TPC-ITS matched: track momentum distribution (GeV)", // kTrk3 | |
104 | "TPC-TOF matched: track momentum distribution (GeV)", // kTrk4 | |
105 | "TPC-ITS track-matching probability", // kTrk5 | |
106 | "TPC-TOF track-matching probability" // kTrk6 | |
107 | "TPC side A: DCA for the positive tracks (mm)", // kTrk7 | |
108 | "TPC side A: DCA for the negative tracks (mm)", // kTrk8 | |
109 | "TPC side C: DCA for the positive tracks (mm)", // kTrk9 | |
110 | "TPC side C: DCA for the negative tracks (mm)" // kTrk10 | |
111 | }; | |
112 | Add2ESDsList(new TH1F(name[0],title[0],100, 0.,TMath::TwoPi()),kTrk0); | |
113 | Add2ESDsList(new TH1F(name[1],title[1],100,-2.00,2.00),kTrk1); | |
114 | Add2ESDsList(new TH1F(name[2],title[2],50, 0.20,5.00),kTrk2); | |
115 | Add2ESDsList(new TH1F(name[3],title[3],50, 0.20,5.00),kTrk3); | |
116 | Add2ESDsList(new TH1F(name[4],title[4],50, 0.20,5.00),kTrk4); | |
117 | Add2ESDsList(new TH1F(name[5],title[5],50, 0.20,5.00),kTrk5); | |
118 | Add2ESDsList(new TH1F(name[6],title[6],50, 0.20,5.00),kTrk6); | |
119 | Add2ESDsList(new TH1F(name[7],title[7],50, -25.0,25.0),kTrk7); | |
120 | Add2ESDsList(new TH1F(name[8],title[8],50, -25.0,25.0),kTrk8); | |
121 | Add2ESDsList(new TH1F(name[9],title[9],50, -25.0,25.0),kTrk9); | |
122 | Add2ESDsList(new TH1F(name[10],title[10],50, -25.0,25.0),kTrk10); | |
123 | } | |
124 | ||
125 | {// V0 related QA | |
126 | const Char_t *name[]={ | |
127 | "hGlobalPromptK0sMass", | |
128 | "hGlobalOfflineK0sMass", | |
129 | "hGlobalPromptLambda0Lambda0BarMass", | |
130 | "hGlobalOfflineLambda0Lambda0BarMass" | |
131 | }; | |
132 | const Char_t *title[]={ | |
133 | "On-the-fly K0s mass (GeV)", | |
134 | "Offline K0s mass (GeV)", | |
135 | "On-the-fly Lambda0 + Lambda0Bar mass (GeV)", | |
136 | "Offline Lambda0 + Lambda0Bar mass (GeV)" | |
137 | }; | |
138 | Add2ESDsList(new TH1F(name[0],title[0],50, 0.4477,0.5477),kK0on); | |
139 | Add2ESDsList(new TH1F(name[1],title[1],50, 0.4477,0.5477),kK0off); | |
140 | Add2ESDsList(new TH1F(name[2],title[2],50, 1.0657,1.1657),kL0on); | |
141 | Add2ESDsList(new TH1F(name[3],title[3],50, 1.0657,1.1657),kL0off); | |
142 | } | |
143 | ||
144 | {// PID related QA | |
145 | const Char_t *name[]={ | |
146 | "hGlobalITSdEdx", | |
147 | "hGlobalTPCdEdx", | |
148 | "hGlobalTOFTrackingvsMeasured", | |
149 | "hGlobalTPCdEdxvsMomentum" | |
150 | }; | |
151 | const Char_t *title[]={ | |
152 | "ITS: dEdx (A.U.) for particles with momentum 0.4 - 0.5 (GeV)", | |
153 | "TPC: dEdx (A.U.) for particles with momentum 0.4 - 0.5 (GeV)", | |
154 | "TOF: tracking - measured (ps)", | |
155 | "TPC: dEdx (A.U.) vs momentum (GeV)" | |
156 | }; | |
157 | Add2ESDsList(new TH1F(name[0],title[0],50,0.00,200.),kPid0); | |
158 | Add2ESDsList(new TH1F(name[1],title[1],50,0.00,100.),kPid1); | |
159 | Add2ESDsList(new TH1F(name[2],title[2],50,-3500.,3500.),kPid2); | |
160 | Add2ESDsList(new TH2F(name[3],title[3],1500,0.05,15.,700,0.,700.),kPid3); | |
161 | } | |
162 | ||
2937b8ff | 163 | {// Multiplicity related QA |
164 | const Char_t *name[]={ | |
165 | "hGlobalV0AvsITS", | |
166 | "hGlobalV0CvsITS" | |
167 | }; | |
168 | const Char_t *title[]={ | |
169 | "Multiplicity: V0A vs ITS", | |
170 | "Multiplicity: V0C vs ITS" | |
171 | }; | |
172 | TH2F *h0=new TH2F(name[0],title[0],40,0.,40., 32,0.,32.); | |
173 | Add2ESDsList(h0,kMlt0); | |
174 | TH2F *h1=new TH2F(name[1],title[1],40,0.,40., 32,0.,32.); | |
175 | Add2ESDsList(h1,kMlt1); | |
176 | } | |
177 | ||
16f48098 | 178 | } |
179 | ||
180 | //________________________________________________________________________ | |
181 | void AliAnalysisTaskGlobalQA::UserExec(Option_t *) | |
182 | { | |
183 | // Main loop | |
184 | // Called for each event | |
185 | ||
186 | const AliESDEvent *esd=(const AliESDEvent *)InputEvent(); | |
187 | ||
188 | if (!esd) { | |
189 | Printf("ERROR: ESD is not available"); | |
190 | return; | |
191 | } | |
192 | ||
193 | for (Int_t iTracks = 0; iTracks < esd->GetNumberOfTracks(); iTracks++) { | |
194 | AliESDtrack* track = esd->GetTrack(iTracks); | |
195 | if (!track) { | |
196 | Printf("ERROR: Could not receive track %d", iTracks); | |
197 | continue; | |
198 | } | |
199 | ||
200 | ||
201 | // Cluster related QA | |
202 | if (track->IsOn(AliESDtrack::kITSrefit)) { | |
203 | Int_t n=track->GetITSclusters(0); | |
204 | GetESDsData(kClr0)->Fill(Float_t(n)/6.); //6 is the number of ITS layers | |
205 | } | |
206 | ||
2937b8ff | 207 | for (Int_t i=0; i<6; i++) { |
208 | Int_t idet, sts; | |
209 | Float_t xloc,zloc; | |
210 | if (!track->GetITSModuleIndexInfo(i,idet,sts,xloc,zloc)) continue; | |
211 | if (i>=2) idet+=240; | |
212 | if (i>=4) idet+=260; | |
213 | if ((sts==1)||(sts==2)||(sts==4)) GetESDsData(kClr3)->Fill(idet); | |
214 | } | |
215 | ||
16f48098 | 216 | if (track->IsOn(AliESDtrack::kTPCrefit)) { |
217 | Int_t n =track->GetTPCNcls(); | |
218 | Int_t nf=track->GetTPCNclsF(); // number of crossed TPC pad rows | |
219 | if (nf>0) { | |
220 | Double_t val = n*1.0/nf; | |
221 | GetESDsData(kClr1)->Fill(val); | |
222 | } | |
223 | } | |
224 | ||
225 | if (track->IsOn(AliESDtrack::kTRDrefit)) { | |
226 | Int_t n=track->GetTRDclusters(0); | |
227 | GetESDsData(kClr2)->Fill(Float_t(n)/(6*24));//(6*24) is the number of TRD time bins | |
228 | } | |
229 | ||
230 | Double_t p=track->GetP(); | |
231 | ||
232 | // Track related QA | |
233 | if (track->IsOn(AliESDtrack::kTPCrefit)) { | |
234 | Float_t dz[2]; | |
235 | track->GetDZ(0.,0.,0.,esd->GetMagneticField(),dz); | |
236 | if ((TMath::Abs(dz[0])<3.) && (TMath::Abs(dz[1])<3.)) { // beam pipe | |
237 | Double_t phi=track->Phi(); | |
238 | GetESDsData(kTrk0)->Fill(phi); | |
239 | Double_t y=track->Eta(); | |
240 | GetESDsData(kTrk1)->Fill(y); | |
241 | ||
242 | if (TMath::Abs(y)<0.9) { | |
243 | GetESDsData(kTrk2)->Fill(p); | |
244 | if (track->IsOn(AliESDtrack::kITSrefit)) GetESDsData(kTrk3)->Fill(p); | |
245 | //if (track->IsOn(AliESDtrack::kTOFout)) GetESDsData(kTrk4)->Fill(p); | |
246 | if (track->GetTOFsignal()>0) GetESDsData(kTrk4)->Fill(p); | |
247 | } | |
248 | } | |
249 | } | |
250 | const AliExternalTrackParam *tpcTrack=track->GetTPCInnerParam(); | |
251 | const AliExternalTrackParam *innTrack=track->GetInnerParam(); | |
252 | if (tpcTrack) | |
253 | if (innTrack) { | |
254 | const AliESDVertex *vtx=esd->GetPrimaryVertex(); | |
255 | Double_t xv=vtx->GetXv(); | |
256 | Double_t yv=vtx->GetYv(); | |
257 | Double_t zv=vtx->GetZv(); | |
258 | Float_t dz[2]; | |
259 | tpcTrack->GetDZ(xv,yv,zv,esd->GetMagneticField(),dz); | |
260 | dz[0]*=10.; // in mm | |
261 | if (innTrack->GetZ() > 0) | |
262 | if (innTrack->GetTgl()> 0) { // TPC side A | |
263 | if (tpcTrack->GetSign() > 0) GetESDsData(kTrk7)->Fill(dz[0]); | |
264 | else GetESDsData(kTrk8)->Fill(dz[0]); | |
265 | } | |
266 | if (innTrack->GetZ() < 0) | |
267 | if (innTrack->GetTgl()< 0) { // TPC side C | |
268 | if (tpcTrack->GetSign() > 0) GetESDsData(kTrk9)->Fill(dz[0]); | |
269 | else GetESDsData(kTrk10)->Fill(dz[0]); | |
270 | } | |
271 | } | |
272 | ||
273 | // PID related QA | |
274 | if ((p>0.4) && (p<0.5)) { | |
275 | if (track->IsOn(AliESDtrack::kITSpid)) { | |
276 | Double_t dedx=track->GetITSsignal(); | |
277 | GetESDsData(kPid0)->Fill(dedx); | |
278 | } | |
279 | if (track->IsOn(AliESDtrack::kTPCpid)) { | |
280 | Double_t dedx=track->GetTPCsignal(); | |
281 | GetESDsData(kPid1)->Fill(dedx); | |
282 | } | |
283 | } | |
284 | if (p>1.0) { | |
285 | if (track->IsOn(AliESDtrack::kTOFpid)) { | |
286 | Double_t times[10]; | |
287 | track->GetIntegratedTimes(times); | |
288 | Double_t tof=track->GetTOFsignal(); | |
289 | GetESDsData(kPid2)->Fill(times[2]-tof); | |
290 | } | |
291 | } | |
292 | const AliExternalTrackParam *par=track->GetInnerParam(); | |
293 | if (par) { | |
294 | Double_t pp=par->GetP(); | |
295 | Double_t dedx=track->GetTPCsignal(); | |
296 | TH2F *h = dynamic_cast<TH2F*>(GetESDsData(kPid3)); | |
297 | h->Fill(pp,dedx); | |
298 | } | |
299 | } | |
300 | ||
2937b8ff | 301 | // Multiplicity related QA |
302 | AliESDVZERO *mltV0 =esd->GetVZEROData(); | |
303 | const AliMultiplicity *mltITS=esd->GetMultiplicity(); | |
304 | if (mltV0) | |
305 | if (mltITS) { | |
306 | Short_t nv0a=mltV0->GetNbPMV0A(); | |
307 | Short_t nv0c=mltV0->GetNbPMV0C(); | |
308 | Int_t nits=mltITS->GetNumberOfTracklets(); | |
309 | TH2F *h0=dynamic_cast<TH2F*>(GetESDsData(kMlt0)); | |
310 | h0->Fill(nits,nv0a); | |
311 | TH2F *h1=dynamic_cast<TH2F*>(GetESDsData(kMlt1)); | |
312 | h1->Fill(nits,nv0c); | |
313 | } | |
314 | ||
16f48098 | 315 | // V0 related QA |
316 | Int_t nV0=esd->GetNumberOfV0s(); | |
317 | for (Int_t i=0; i<nV0; i++) { | |
318 | Double_t mass; | |
319 | AliESDv0 v0(*esd->GetV0(i)); | |
320 | ||
321 | v0.ChangeMassHypothesis(kK0Short); | |
322 | mass=v0.GetEffMass(); | |
323 | if (v0.GetOnFlyStatus()) | |
324 | GetESDsData(kK0on)->Fill(mass); | |
325 | else | |
326 | GetESDsData(kK0off)->Fill(mass); | |
327 | ||
328 | v0.ChangeMassHypothesis(kLambda0); | |
329 | mass=v0.GetEffMass(); | |
330 | if (v0.GetOnFlyStatus()) | |
331 | GetESDsData(kL0on)->Fill(mass); | |
332 | else | |
333 | GetESDsData(kL0off)->Fill(mass); | |
334 | ||
335 | v0.ChangeMassHypothesis(kLambda0Bar); | |
336 | mass=v0.GetEffMass(); | |
337 | if (v0.GetOnFlyStatus()) | |
338 | GetESDsData(kL0on)->Fill(mass); | |
339 | else | |
340 | GetESDsData(kL0off)->Fill(mass); | |
341 | } | |
342 | ||
343 | // Post output data. | |
344 | PostData(1, fArrayQA); | |
345 | } | |
346 | ||
347 | //________________________________________________________________________ | |
348 | void AliAnalysisTaskGlobalQA::Terminate(Option_t *) | |
349 | { | |
350 | // Draw the results on the screen | |
351 | // Called once at the end of the query | |
352 | ||
353 | fArrayQA=(TObjArray*)GetOutputData(1); | |
354 | ||
355 | TH1 *tpc=GetESDsData(kTrk2); tpc->Sumw2(); | |
356 | TH1 *its=GetESDsData(kTrk3); its->Sumw2(); | |
357 | TH1 *tof=GetESDsData(kTrk4); tof->Sumw2(); | |
358 | GetESDsData(kTrk5)->Divide(its,tpc,1,1.,"b"); | |
359 | GetESDsData(kTrk6)->Divide(tof,tpc,1,1.,"b"); | |
360 | ||
361 | TH1 *hTPCdEdxMIP = GetESDsData(kPid1); | |
362 | if (!hTPCdEdxMIP) { | |
363 | Printf("ERROR: hTPCdEdxMIP not available"); | |
364 | return; | |
365 | } | |
366 | ||
367 | TH2 *hTPCdEdxVsP = dynamic_cast<TH2*>(GetESDsData(kPid3)); | |
368 | if (!hTPCdEdxVsP) { | |
369 | Printf("ERROR: hTPCdEdxVsP not available"); | |
370 | return; | |
371 | } | |
372 | ||
373 | TCanvas *c2=new TCanvas("c2","",320,32,530,590); | |
374 | ||
375 | TPad *p6=new TPad("p6","",0.,0.,1.,.5); p6->Draw(); p6->cd(); | |
376 | p6->SetFillColor(42); p6->SetFrameFillColor(10); | |
377 | hTPCdEdxMIP->SetFillColor(2); hTPCdEdxMIP->SetFillStyle(3005); | |
378 | if (hTPCdEdxMIP->GetEntries()<333) | |
379 | hTPCdEdxMIP->DrawCopy("E"); | |
380 | else | |
381 | hTPCdEdxMIP->Fit("gaus"); | |
382 | c2->cd(); | |
383 | ||
384 | TPad *p7=new TPad("p7","",0.,0.5,1.,1.); p7->Draw(); p7->cd(); p7->SetLogx(); | |
385 | p7->SetFillColor(42); p7->SetFrameFillColor(10); | |
386 | hTPCdEdxVsP->DrawCopy(); | |
387 | ||
388 | } |