1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //------------------------------
17 // Analysis task for quality-assurance
20 // 05/12/2009 cvetan.cheshkov@cern.ch
21 //------------------------------
30 #include "AliESDEvent.h"
31 #include "AliESDVZERO.h"
33 #include "AliAnaVZEROQA.h"
35 ClassImp(AliAnaVZEROQA)
37 AliAnaVZEROQA::AliAnaVZEROQA():
38 AliAnalysisTaskSE("AliAnaVZEROQA"),
82 // Default constructor
83 // Define input and output slots here
84 // Input slot #0 works with a TChain
85 DefineInput(0, TChain::Class());
86 // Output slot #1 TList
87 DefineOutput(1, TList::Class());
90 AliAnaVZEROQA::AliAnaVZEROQA(const char* name):
91 AliAnalysisTaskSE(name),
135 AliInfo("Constructor AliAnaVZEROQA");
136 // Define input and output slots here
137 // Input slot #0 works with a TChain
138 DefineInput(0, TChain::Class());
139 // Output slot #1 TList
140 DefineOutput(1, TList::Class());
143 TH1F * AliAnaVZEROQA::CreateHisto1D(const char* name, const char* title,Int_t nBins,
144 Double_t xMin, Double_t xMax,
145 const char* xLabel, const char* yLabel)
147 // create a histogram
148 TH1F* result = new TH1F(name, title, nBins, xMin, xMax);
149 result->SetOption("E");
150 if (xLabel) result->GetXaxis()->SetTitle(xLabel);
151 if (yLabel) result->GetYaxis()->SetTitle(yLabel);
152 result->SetMarkerStyle(kFullCircle);
156 TH2F * AliAnaVZEROQA::CreateHisto2D(const char* name, const char* title,Int_t nBinsX,
157 Double_t xMin, Double_t xMax,
159 Double_t yMin, Double_t yMax,
160 const char* xLabel, const char* yLabel)
162 // create a histogram
163 TH2F* result = new TH2F(name, title, nBinsX, xMin, xMax, nBinsY, yMin, yMax);
164 if (xLabel) result->GetXaxis()->SetTitle(xLabel);
165 if (yLabel) result->GetYaxis()->SetTitle(yLabel);
169 void AliAnaVZEROQA::UserCreateOutputObjects()
172 AliInfo("AliAnaVZEROQA::UserCreateOutputObjects");
173 // Create output container
174 fListOfHistos = new TList();
176 fhAdcNoTimeA = CreateHisto1D("hAdcNoTimeA","ADC (no Leading Time) V0A",200,0,200,"ADC charge","Entries");
177 fhAdcWithTimeA = CreateHisto1D("hAdcWithTimeA","ADC ( with Leading Time) V0A",200,0,200,"ADC charge","Entries");
178 fhAdcNoTimeC = CreateHisto1D("hAdcNoTimeC","ADC (no Leading Time) V0C",200,0,200,"ADC charge","Entries");
179 fhAdcWithTimeC = CreateHisto1D("hAdcWithTimeC","ADC ( with Leading Time) V0C",200,0,200,"ADC charge","Entries");
181 fhAdcPMTNoTime = CreateHisto2D("hadcpmtnotime","ADC vs PMT index (no leading time)",64,-0.5,63.5,200,0,200,"PMT index","ADC charge");
182 fhAdcPMTWithTime = CreateHisto2D("hadcpmtwithtime","ADC vs PMT index (with leading time)",64,-0.5,63.5,200,0,200,"PMT index","ADC charge");
184 fhTimeA = CreateHisto1D("htimepmtA","Time measured by TDC V0A",400,-100,100,"Leading time (ns)","Entries");
185 fhTimeC = CreateHisto1D("htimepmtC","Time measured by TDC V0C",400,-100,100,"Leading time (ns)","Entries");
187 fhWidthA = CreateHisto1D("hwidthA","Signal width measured by TDC V0A",200,0,100,"Signal width (ns)","Entries");
188 fhWidthC = CreateHisto1D("hwidthC","Signal width measured by TDC V0C",200,0,100,"Signal width (ns)","Entries");
190 fhTimePMT = CreateHisto2D("htimepmt","Time measured by TDC vs PMT index",64,-0.5,63.5,200,0,100,"PMT Index","Leading time (ns)");
191 fhWidthPMT = CreateHisto2D("hwidthpmt","Time width vs PMT index",64,-0.5,63.5,200,0,100,"PMT Index","Signal width (ns)");
193 fhAdcWidthA = CreateHisto2D("hadcwidthA","Time width vs ADC V0A",200,0,200,200,0,100,"ADC charge","Width (ns)");
194 fhAdcWidthC = CreateHisto2D("hadcwidthC","Time width vs ADC V0C",200,0,200,200,0,100,"ADC charge","Width (ns)");
196 fhTimeCorr = CreateHisto2D("htimecorr","Average time C side vs. A side",200,0,100,200,0,100,"Time V0A (ns)","Time V0C (ns");
198 fhAdcTimeA = CreateHisto2D("hAdcTimeA","ADC vs Time V0A",1000,-100,100,200,0,200,"Time (ns)","ADC charge");
199 fhAdcTimeC = CreateHisto2D("hAdcTimeC","ADC vs Time V0C",1000,-100,100,200,0,200,"Time (ns)","ADC charge");
201 fV0a = CreateHisto1D("hV0a","Number of fired PMTs (V0A)",65,-0.5,64.5);
202 fV0c = CreateHisto1D("hV0c","Number of fired PMTs (V0C)",65,-0.5,64.5);
203 fV0multA = CreateHisto1D("hV0multA","Total reconstructed multiplicity (V0A)",100,0.,1000.);
204 fV0multC = CreateHisto1D("hV0multC","Total reconstructed multiplicity (V0C)",100,0.,1000.);
205 fV0ampl = CreateHisto1D("hV0ampl","V0 multiplicity in single channel (all V0 channels)",400,-0.5,99.5);
207 fhTimePMTCorr = CreateHisto2D("htimepmtcorr","Time measured by TDC (corrected for slewing, channels aligned) vs PMT index",64,-0.5,63.5,200,0,100,"PMT Index","Leading time (ns)");
208 fhEvents = CreateHisto2D("hEvents","V0C vs V0A (empty,bb,bg)",3,-0.5,2.5,3,-0.5,2.5);
210 fhVtxXYBB = CreateHisto2D("fhVtxXYBB","XY SPD vertex (bb)",200,-2,2,200,-2,2);
211 fhVtxZBB = CreateHisto1D("fhVtxZBB","Z SPD vertex (bb)",400,-50,50);
212 fhVtxXYBGA = CreateHisto2D("fhVtxXYBGA","XY SPD vertex (bga)",200,-2,2,200,-2,2);
213 fhVtxZBGA = CreateHisto1D("fhVtxZBGA","Z SPD vertex (bga)",400,-50,50);
214 fhVtxXYBGC = CreateHisto2D("fhVtxXYBGC","XY SPD vertex (bgc)",200,-2,2,200,-2,2);
215 fhVtxZBGC = CreateHisto1D("fhVtxZBGC","Z SPD vertex (bgc)",400,-50,50);
217 fListOfHistos->Add(fhAdcNoTimeA);
218 fListOfHistos->Add(fhAdcWithTimeA);
219 fListOfHistos->Add(fhAdcNoTimeC);
220 fListOfHistos->Add(fhAdcWithTimeC);
222 fListOfHistos->Add(fhAdcPMTNoTime);
223 fListOfHistos->Add(fhAdcPMTWithTime);
225 fListOfHistos->Add(fhTimeA);
226 fListOfHistos->Add(fhTimeC);
228 fListOfHistos->Add(fhWidthA);
229 fListOfHistos->Add(fhWidthC);
231 fListOfHistos->Add(fhTimePMT);
232 fListOfHistos->Add(fhWidthPMT);
234 fListOfHistos->Add(fhAdcWidthA);
235 fListOfHistos->Add(fhAdcWidthC);
237 fListOfHistos->Add(fhTimeCorr);
239 fListOfHistos->Add(fhAdcTimeA);
240 fListOfHistos->Add(fhAdcTimeC);
242 fListOfHistos->Add(fV0a);
243 fListOfHistos->Add(fV0c);
244 fListOfHistos->Add(fV0multA);
245 fListOfHistos->Add(fV0multC);
246 fListOfHistos->Add(fV0ampl);
248 fListOfHistos->Add(fhTimePMTCorr);
249 fListOfHistos->Add(fhEvents);
251 fListOfHistos->Add(fhVtxXYBB);
252 fListOfHistos->Add(fhVtxZBB);
253 fListOfHistos->Add(fhVtxXYBGA);
254 fListOfHistos->Add(fhVtxZBGA);
255 fListOfHistos->Add(fhVtxXYBGC);
256 fListOfHistos->Add(fhVtxZBGC);
259 void AliAnaVZEROQA::UserExec(Option_t */*option*/)
261 // Fill the QA histograms
263 AliVEvent* event = InputEvent();
265 Printf("ERROR: Could not retrieve event");
269 AliESDEvent* esd = dynamic_cast<AliESDEvent*>(event);
271 Printf("ERROR: No ESD event");
274 AliESDVZERO* esdV0 = esd->GetVZEROData();
276 Printf("ERROR: No ESD VZERO");
280 Float_t timeA = 0,timeC = 0;
281 Int_t ntimeA = 0, ntimeC = 0;
282 for (Int_t i=0; i<64; ++i) {
283 if (esdV0->GetTime(i) < 1e-6) {
285 fhAdcNoTimeA->Fill(esdV0->GetAdc(i));
288 fhAdcNoTimeC->Fill(esdV0->GetAdc(i));
290 fhAdcPMTNoTime->Fill(i,esdV0->GetAdc(i));
294 fhAdcWithTimeA->Fill(esdV0->GetAdc(i));
297 fhAdcWithTimeC->Fill(esdV0->GetAdc(i));
299 fhAdcPMTWithTime->Fill(i,esdV0->GetAdc(i));
303 fhTimeA->Fill(esdV0->GetTime(i));
304 fhWidthA->Fill(esdV0->GetWidth(i));
305 fhAdcWidthA->Fill(esdV0->GetAdc(i),esdV0->GetTime(i));
306 fhAdcTimeA->Fill(esdV0->GetTime(i),esdV0->GetAdc(i));
309 fhTimeC->Fill(esdV0->GetTime(i));
310 fhWidthC->Fill(esdV0->GetWidth(i));
311 fhAdcWidthC->Fill(esdV0->GetAdc(i),esdV0->GetTime(i));
312 fhAdcTimeC->Fill(esdV0->GetTime(i),esdV0->GetAdc(i));
314 fhTimePMT->Fill(i,esdV0->GetTime(i));
315 fhWidthPMT->Fill(i,esdV0->GetWidth(i));
317 Float_t correctedTime = CorrectLeadingTime(i,esdV0->GetTime(i),esdV0->GetAdc(i));
318 fhTimePMTCorr->Fill(i,correctedTime);
320 if (esdV0->GetTime(i) > 1e-6) {
322 timeA += correctedTime;
326 timeC += correctedTime;
332 if (ntimeA > 0) timeA = timeA/ntimeA;
333 if (ntimeC > 0) timeC = timeC/ntimeC;
335 fhTimeCorr->Fill(timeA,timeC);
337 Int_t flaga = 0, flagc = 0;
338 TString stra("emptyA"),strc("emptyC");
339 if (timeA > 48 && timeA < 62) { flaga = 1; stra = "BBA"; }
340 if (timeA > 26 && timeA < 33) { flaga = 2; stra = "BGA"; }
341 if (timeC > 49 && timeC < 60) { flagc = 1; strc = "BBC"; }
342 if (timeC > 43 && timeC < 48.5) { flagc = 2; strc = "BGC"; }
344 fhEvents->Fill(flaga,flagc);
346 const AliESDVertex *vtx = esd->GetPrimaryVertexSPD();
348 if (flaga <= 1 && flagc <=1) {
349 fhVtxXYBB->Fill(vtx->GetXv(),vtx->GetYv());
350 fhVtxZBB->Fill(vtx->GetZv());
354 fhVtxXYBGA->Fill(vtx->GetXv(),vtx->GetYv());
355 fhVtxZBGA->Fill(vtx->GetZv());
358 fhVtxXYBGC->Fill(vtx->GetXv(),vtx->GetYv());
359 fhVtxZBGC->Fill(vtx->GetZv());
363 fV0a->Fill(esdV0->GetNbPMV0A());
364 fV0c->Fill(esdV0->GetNbPMV0C());
365 fV0multA->Fill(esdV0->GetMTotV0A());
366 fV0multC->Fill(esdV0->GetMTotV0C());
367 for(Int_t i = 0; i < 64; i++) {
368 fV0ampl->Fill(esdV0->GetMultiplicity(i));
372 PostData(1, fListOfHistos);
375 void AliAnaVZEROQA::Terminate(Option_t *)
377 // Store the output histograms
379 fListOfHistos = dynamic_cast<TList*>(GetOutputData(1));
380 if (!fListOfHistos) {
381 Printf("ERROR: fListOfHistos not available");
385 Info("AliAnaVZEROQA", "Successfully finished");
388 Float_t AliAnaVZEROQA::CorrectLeadingTime(Int_t i, Float_t time, Float_t adc) const
390 // Correct for slewing and align the channels
392 if (time < 1e-6) return 0;
394 // Time offsets between channels
395 Float_t timeShift[64] = {30.2914 , 30.0019 , 30.7429 , 30.1997 , 30.1511 , 29.6437 , 30.0609 , 29.5452 , 30.1437 , 30.745 , 30.7537 , 30.446 , 30.2771 , 30.838 , 30.3748 , 30.0635 , 30.1786 , 30.282 , 31.0992 , 30.7491 , 30.624 , 30.9268 , 30.6585 , 30.4895 , 31.5815 , 31.3871 , 31.2032 , 31.5778 , 31.0838 , 31.2259 , 31.2122 , 31.5989 , 28.3792 , 28.8325 , 27.8719 , 28.3475 , 26.9925 , 27.9300 , 28.4223 , 28.4996 , 28.2934 , 28.1281 , 27.209 , 28.5327 , 28.1181 , 28.0888 , 29.5111 , 28.6601 , 29.7705 , 29.6531 , 30.3373 , 30.2345 , 30.5935 , 29.8164 , 30.2235 , 29.6505 , 30.1225 , 31.2045 , 30.8399 , 30.6789 , 30.2784 , 31.7028 , 31.4239 , 30.1814};
396 time -= timeShift[i];
398 // Slewing correction
399 if (adc < 1e-6) return time;
402 if (adc > 300.) adc = 300.;
407 adc*adc*2.68348e-05);
413 adc*adc*2.74668e-02 +
414 adc*adc*adc*6.61224e-04 -
415 adc*adc*adc*adc*7.77105e-06 +
416 adc*adc*adc*adc*adc*3.51229e-08);