AliPhysics  5eaf189 (5eaf189)
AliAnaVZEROQA.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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 
16 //------------------------------
17 // Analysis task for quality-assurance
18 // of VZERO ESD
19 //
20 // 05/12/2009 cvetan.cheshkov@cern.ch
21 //------------------------------
22 
23 #include "TChain.h"
24 #include "TROOT.h"
25 #include "TFile.h"
26 #include "TH1F.h"
27 #include "TH2F.h"
28 #include "TCanvas.h"
29 #include "AliLog.h"
30 #include "AliESDEvent.h"
31 #include "AliESDVZERO.h"
32 
33 #include "AliAnaVZEROQA.h"
34 
35 ClassImp(AliAnaVZEROQA)
36 
39  fListOfHistos(0),
40 
41  fhAdcNoTimeA(0),
42  fhAdcWithTimeA(0),
43  fhAdcNoTimeC(0),
44  fhAdcWithTimeC(0),
45 
46  fhAdcPMTNoTime(0),
47  fhAdcPMTWithTime(0),
48 
49  fhTimeA(0),
50  fhTimeC(0),
51 
52  fhWidthA(0),
53  fhWidthC(0),
54 
55  fhTimePMT(0),
56  fhWidthPMT(0),
57 
58  fhAdcWidthA(0),
59  fhAdcWidthC(0),
60 
61  fhTimeCorr(0),
62 
63  fhAdcTimeA(0),
64  fhAdcTimeC(0),
65 
66  fV0a(0),
67  fV0c(0),
68  fV0multA(0),
69  fV0multC(0),
70  fV0ampl(0),
71 
72  fhEvents(0),
73 
74  fhVtxXYBB(0),
75  fhVtxZBB(0),
76  fhVtxXYBGA(0),
77  fhVtxZBGA(0),
78  fhVtxXYBGC(0),
79  fhVtxZBGC(0)
80 {
81  // Default constructor
82  // Define input and output slots here
83  // Input slot #0 works with a TChain
84  DefineInput(0, TChain::Class());
85  // Output slot #1 TList
86  DefineOutput(1, TList::Class());
87 }
88 
89 AliAnaVZEROQA::AliAnaVZEROQA(const char* name):
90 AliAnalysisTaskSE(name),
91  fListOfHistos(0),
92  fhAdcNoTimeA(0),
93  fhAdcWithTimeA(0),
94  fhAdcNoTimeC(0),
95  fhAdcWithTimeC(0),
96 
97  fhAdcPMTNoTime(0),
98  fhAdcPMTWithTime(0),
99 
100  fhTimeA(0),
101  fhTimeC(0),
102 
103  fhWidthA(0),
104  fhWidthC(0),
105 
106  fhTimePMT(0),
107  fhWidthPMT(0),
108 
109  fhAdcWidthA(0),
110  fhAdcWidthC(0),
111 
112  fhTimeCorr(0),
113 
114  fhAdcTimeA(0),
115  fhAdcTimeC(0),
116 
117  fV0a(0),
118  fV0c(0),
119  fV0multA(0),
120  fV0multC(0),
121  fV0ampl(0),
122 
123  fhEvents(0),
124 
125  fhVtxXYBB(0),
126  fhVtxZBB(0),
127  fhVtxXYBGA(0),
128  fhVtxZBGA(0),
129  fhVtxXYBGC(0),
130  fhVtxZBGC(0)
131 {
132  // Constructor
133  AliInfo("Constructor AliAnaVZEROQA");
134  // Define input and output slots here
135  // Input slot #0 works with a TChain
136  DefineInput(0, TChain::Class());
137  // Output slot #1 TList
138  DefineOutput(1, TList::Class());
139 }
140 
141 TH1F * AliAnaVZEROQA::CreateHisto1D(const char* name, const char* title,Int_t nBins,
142  Double_t xMin, Double_t xMax,
143  const char* xLabel, const char* yLabel)
144 {
145  // create a histogram
146  TH1F* result = new TH1F(name, title, nBins, xMin, xMax);
147  result->SetOption("E");
148  if (xLabel) result->GetXaxis()->SetTitle(xLabel);
149  if (yLabel) result->GetYaxis()->SetTitle(yLabel);
150  result->SetMarkerStyle(kFullCircle);
151  return result;
152 }
153 
154 TH2F * AliAnaVZEROQA::CreateHisto2D(const char* name, const char* title,Int_t nBinsX,
155  Double_t xMin, Double_t xMax,
156  Int_t nBinsY,
158  const char* xLabel, const char* yLabel)
159 {
160  // create a histogram
161  TH2F* result = new TH2F(name, title, nBinsX, xMin, xMax, nBinsY, yMin, yMax);
162  if (xLabel) result->GetXaxis()->SetTitle(xLabel);
163  if (yLabel) result->GetYaxis()->SetTitle(yLabel);
164  return result;
165 }
166 
168 {
169  // Create histograms
170  AliInfo("AliAnaVZEROQA::UserCreateOutputObjects");
171  // Create output container
172  fListOfHistos = new TList();
173  fListOfHistos->SetOwner();
174 
175  fhAdcNoTimeA = CreateHisto1D("hAdcNoTimeA","ADC (no Leading Time) V0A",200,0,200,"ADC charge","Entries");
176  fhAdcWithTimeA = CreateHisto1D("hAdcWithTimeA","ADC ( with Leading Time) V0A",200,0,200,"ADC charge","Entries");
177  fhAdcNoTimeC = CreateHisto1D("hAdcNoTimeC","ADC (no Leading Time) V0C",200,0,200,"ADC charge","Entries");
178  fhAdcWithTimeC = CreateHisto1D("hAdcWithTimeC","ADC ( with Leading Time) V0C",200,0,200,"ADC charge","Entries");
179 
180  fhAdcPMTNoTime = CreateHisto2D("hadcpmtnotime","ADC vs PMT index (no leading time)",64,-0.5,63.5,200,0,200,"PMT index","ADC charge");
181  fhAdcPMTWithTime = CreateHisto2D("hadcpmtwithtime","ADC vs PMT index (with leading time)",64,-0.5,63.5,200,0,200,"PMT index","ADC charge");
182 
183  fhTimeA = CreateHisto1D("htimepmtA","Time measured by TDC V0A",400,-100,100,"Leading time (ns)","Entries");
184  fhTimeC = CreateHisto1D("htimepmtC","Time measured by TDC V0C",400,-100,100,"Leading time (ns)","Entries");
185 
186  fhWidthA = CreateHisto1D("hwidthA","Signal width measured by TDC V0A",200,0,100,"Signal width (ns)","Entries");
187  fhWidthC = CreateHisto1D("hwidthC","Signal width measured by TDC V0C",200,0,100,"Signal width (ns)","Entries");
188 
189  fhTimePMT = CreateHisto2D("htimepmt","Time measured by TDC vs PMT index",64,-0.5,63.5,200,0,100,"PMT Index","Leading time (ns)");
190  fhWidthPMT = CreateHisto2D("hwidthpmt","Time width vs PMT index",64,-0.5,63.5,200,0,100,"PMT Index","Signal width (ns)");
191 
192  fhAdcWidthA = CreateHisto2D("hadcwidthA","Time width vs ADC V0A",200,0,200,200,0,100,"ADC charge","Width (ns)");
193  fhAdcWidthC = CreateHisto2D("hadcwidthC","Time width vs ADC V0C",200,0,200,200,0,100,"ADC charge","Width (ns)");
194 
195  fhTimeCorr = CreateHisto2D("htimecorr","Average time C side vs. A side",200,0,100,200,0,100,"Time V0A (ns)","Time V0C (ns");
196 
197  fhAdcTimeA = CreateHisto2D("hAdcTimeA","ADC vs Time V0A",1000,-100,100,200,0,200,"Time (ns)","ADC charge");
198  fhAdcTimeC = CreateHisto2D("hAdcTimeC","ADC vs Time V0C",1000,-100,100,200,0,200,"Time (ns)","ADC charge");
199 
200  fV0a = CreateHisto1D("hV0a","Number of fired PMTs (V0A)",65,-0.5,64.5);
201  fV0c = CreateHisto1D("hV0c","Number of fired PMTs (V0C)",65,-0.5,64.5);
202  fV0multA = CreateHisto1D("hV0multA","Total reconstructed multiplicity (V0A)",100,0.,1000.);
203  fV0multC = CreateHisto1D("hV0multC","Total reconstructed multiplicity (V0C)",100,0.,1000.);
204  fV0ampl = CreateHisto1D("hV0ampl","V0 multiplicity in single channel (all V0 channels)",400,-0.5,99.5);
205 
206  fhEvents = CreateHisto2D("hEvents","V0C vs V0A (empty,bb,bg)",3,-0.5,2.5,3,-0.5,2.5);
207 
208  fhVtxXYBB = CreateHisto2D("fhVtxXYBB","XY SPD vertex (bb)",200,-2,2,200,-2,2);
209  fhVtxZBB = CreateHisto1D("fhVtxZBB","Z SPD vertex (bb)",400,-50,50);
210  fhVtxXYBGA = CreateHisto2D("fhVtxXYBGA","XY SPD vertex (bga)",200,-2,2,200,-2,2);
211  fhVtxZBGA = CreateHisto1D("fhVtxZBGA","Z SPD vertex (bga)",400,-50,50);
212  fhVtxXYBGC = CreateHisto2D("fhVtxXYBGC","XY SPD vertex (bgc)",200,-2,2,200,-2,2);
213  fhVtxZBGC = CreateHisto1D("fhVtxZBGC","Z SPD vertex (bgc)",400,-50,50);
214 
219 
222 
223  fListOfHistos->Add(fhTimeA);
224  fListOfHistos->Add(fhTimeC);
225 
226  fListOfHistos->Add(fhWidthA);
227  fListOfHistos->Add(fhWidthC);
228 
229  fListOfHistos->Add(fhTimePMT);
231 
234 
236 
239 
240  fListOfHistos->Add(fV0a);
241  fListOfHistos->Add(fV0c);
242  fListOfHistos->Add(fV0multA);
243  fListOfHistos->Add(fV0multC);
244  fListOfHistos->Add(fV0ampl);
245 
246  fListOfHistos->Add(fhEvents);
247 
248  fListOfHistos->Add(fhVtxXYBB);
249  fListOfHistos->Add(fhVtxZBB);
251  fListOfHistos->Add(fhVtxZBGA);
253  fListOfHistos->Add(fhVtxZBGC);
254 
255  PostData(1, fListOfHistos);
256 }
257 
259 {
260  // Fill the QA histograms
261  // using ESD data
262  AliVEvent* event = InputEvent();
263  if (!event) {
264  Printf("ERROR: Could not retrieve event");
265  return;
266  }
267 
268  AliESDEvent* esd = dynamic_cast<AliESDEvent*>(event);
269  if (!esd) {
270  Printf("ERROR: No ESD event");
271  return;
272  }
273  AliESDVZERO* esdV0 = esd->GetVZEROData();
274  if (!esdV0) {
275  Printf("ERROR: No ESD VZERO");
276  return;
277  }
278 
279  for (Int_t i=0; i<64; ++i) {
280  if (esdV0->GetTime(i) < 1e-6) {
281  if (i >= 32) {
282  fhAdcNoTimeA->Fill(esdV0->GetAdc(i));
283  }
284  else {
285  fhAdcNoTimeC->Fill(esdV0->GetAdc(i));
286  }
287  fhAdcPMTNoTime->Fill(i,esdV0->GetAdc(i));
288  }
289  else {
290  if (i >= 32) {
291  fhAdcWithTimeA->Fill(esdV0->GetAdc(i));
292  }
293  else {
294  fhAdcWithTimeC->Fill(esdV0->GetAdc(i));
295  }
296  fhAdcPMTWithTime->Fill(i,esdV0->GetAdc(i));
297  }
298 
299  if (i >= 32) {
300  fhTimeA->Fill(esdV0->GetTime(i));
301  fhWidthA->Fill(esdV0->GetWidth(i));
302  fhAdcWidthA->Fill(esdV0->GetAdc(i),esdV0->GetWidth(i));
303  fhAdcTimeA->Fill(esdV0->GetTime(i),esdV0->GetAdc(i));
304  }
305  else {
306  fhTimeC->Fill(esdV0->GetTime(i));
307  fhWidthC->Fill(esdV0->GetWidth(i));
308  fhAdcWidthC->Fill(esdV0->GetAdc(i),esdV0->GetWidth(i));
309  fhAdcTimeC->Fill(esdV0->GetTime(i),esdV0->GetAdc(i));
310  }
311  fhTimePMT->Fill(i,esdV0->GetTime(i));
312  fhWidthPMT->Fill(i,esdV0->GetWidth(i));
313 
314  }
315 
316  fhTimeCorr->Fill(esdV0->GetV0ATime(),esdV0->GetV0CTime());
317 
318  AliESDVZERO::Decision flaga = esdV0->GetV0ADecision();
319  AliESDVZERO::Decision flagc = esdV0->GetV0CDecision();
320 
321  fhEvents->Fill(flaga,flagc);
322 
323  const AliESDVertex *vtx = esd->GetPrimaryVertexSPD();
324 
325  if (flaga <= 1 && flagc <=1) {
326  fhVtxXYBB->Fill(vtx->GetX(),vtx->GetY());
327  fhVtxZBB->Fill(vtx->GetZ());
328  }
329  else {
330  if (flaga == 2) {
331  fhVtxXYBGA->Fill(vtx->GetX(),vtx->GetY());
332  fhVtxZBGA->Fill(vtx->GetZ());
333  }
334  if (flagc == 2) {
335  fhVtxXYBGC->Fill(vtx->GetX(),vtx->GetY());
336  fhVtxZBGC->Fill(vtx->GetZ());
337  }
338  }
339 
340  fV0a->Fill(esdV0->GetNbPMV0A());
341  fV0c->Fill(esdV0->GetNbPMV0C());
342  fV0multA->Fill(esdV0->GetMTotV0A());
343  fV0multC->Fill(esdV0->GetMTotV0C());
344  for(Int_t i = 0; i < 64; i++) {
345  fV0ampl->Fill(esdV0->GetMultiplicity(i));
346  }
347 
348  // Post output data.
349  PostData(1, fListOfHistos);
350 }
351 
353 {
354  // Store the output histograms
355  // from the list
356  fListOfHistos = dynamic_cast<TList*>(GetOutputData(1));
357  if (!fListOfHistos) {
358  Printf("ERROR: fListOfHistos not available");
359  return;
360  }
361 
362  Info("AliAnaVZEROQA", "Successfully finished");
363 }
TH1F * fhAdcNoTimeA
Definition: AliAnaVZEROQA.h:37
TH2F * fhTimeCorr
Definition: AliAnaVZEROQA.h:57
double Double_t
Definition: External.C:58
Definition: External.C:236
const char * title
Definition: MakeQAPdf.C:27
TH2F * fhAdcWidthC
Definition: AliAnaVZEROQA.h:55
TH1F * CreateHisto1D(const char *name, const char *title, Int_t nBins, Double_t xMin, Double_t xMax, const char *xLabel=NULL, const char *yLabel=NULL)
TH2F * fhAdcTimeC
Definition: AliAnaVZEROQA.h:60
virtual void Terminate(Option_t *)
TH2F * fhVtxXYBGC
Definition: AliAnaVZEROQA.h:74
TH2F * fhWidthPMT
Definition: AliAnaVZEROQA.h:52
TH2F * fhVtxXYBB
Definition: AliAnaVZEROQA.h:70
TH2F * CreateHisto2D(const char *name, const char *title, Int_t nBinsX, Double_t xMin, Double_t xMax, Int_t nBinsY, Double_t yMin, Double_t yMax, const char *xLabel=NULL, const char *yLabel=NULL)
TH1F * fhVtxZBGC
Definition: AliAnaVZEROQA.h:75
virtual void UserExec(Option_t *option)
int Int_t
Definition: External.C:63
TList * fListOfHistos
Definition: AliAnaVZEROQA.h:35
TH2F * fhAdcWidthA
Definition: AliAnaVZEROQA.h:54
TH2F * fhVtxXYBGA
Definition: AliAnaVZEROQA.h:72
TH1F * fhAdcWithTimeA
Definition: AliAnaVZEROQA.h:38
TH2F * fhAdcTimeA
Definition: AliAnaVZEROQA.h:59
virtual void UserCreateOutputObjects()
TH1F * fhAdcNoTimeC
Definition: AliAnaVZEROQA.h:39
TH2F * fhAdcPMTNoTime
Definition: AliAnaVZEROQA.h:42
TH1F * fhVtxZBGA
Definition: AliAnaVZEROQA.h:73
const char Option_t
Definition: External.C:48
TH1F * fhAdcWithTimeC
Definition: AliAnaVZEROQA.h:40
Double_t yMin
TH2F * fhTimePMT
Definition: AliAnaVZEROQA.h:51
Double_t yMax
TH2F * fhAdcPMTWithTime
Definition: AliAnaVZEROQA.h:43