1 /**************************************************************************
2 * Copyright(c) 2007-2009, 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 // Checks the quality assurance
18 // by comparing with reference data
20 // -------------------------------------------------------------
21 // W. Ferrarese + P. Cerello Feb 2008
23 // M. Nicassio D. Elia INFN Bari March 2008
24 // maria.nicassio@ba.infn.it
27 // --- ROOT system ---
32 // --- Standard library ---
34 // --- AliRoot header files ---
35 #include "AliITSQADataMakerRec.h"
36 #include "AliITSQASPDDataMakerRec.h"
39 #include "AliRawReader.h"
40 #include "AliITSRawStreamSPD.h"
41 #include "AliITSRawStreamSPDErrorLog.h"
42 #include "AliITSRecPoint.h"
44 ClassImp(AliITSQASPDDataMakerRec)
46 //____________________________________________________________________________
47 AliITSQASPDDataMakerRec::AliITSQASPDDataMakerRec(AliITSQADataMakerRec *aliITSQADataMakerRec, Bool_t kMode, Short_t ldc, AliITSRawStreamSPDErrorLog *aliITSRawStreamSPDErrorLog) :
49 fAliITSQADataMakerRec(aliITSQADataMakerRec),
54 fAdvLogger(aliITSRawStreamSPDErrorLog)
56 //ctor used to discriminate OnLine-Offline analysis
59 //____________________________________________________________________________
60 AliITSQASPDDataMakerRec::AliITSQASPDDataMakerRec(const AliITSQASPDDataMakerRec& qadm) :
62 fAliITSQADataMakerRec(qadm.fAliITSQADataMakerRec),
63 fkOnline(qadm.fkOnline),
65 fSPDhTask(qadm.fSPDhTask),
66 fGenOffset(qadm.fGenOffset),
67 fAdvLogger(qadm.fAdvLogger)
70 fAliITSQADataMakerRec->SetName((const char*)qadm.fAliITSQADataMakerRec->GetName()) ;
71 fAliITSQADataMakerRec->SetTitle((const char*)qadm.fAliITSQADataMakerRec->GetTitle());
74 //__________________________________________________________________
75 AliITSQASPDDataMakerRec::~AliITSQASPDDataMakerRec(){
79 //__________________________________________________________________
81 AliITSQASPDDataMakerRec& AliITSQASPDDataMakerRec::operator = (const AliITSQASPDDataMakerRec& qac )
84 this->~AliITSQASPDDataMakerRec();
85 new(this) AliITSQASPDDataMakerRec(qac);
89 //____________________________________________________________________________
90 void AliITSQASPDDataMakerRec::StartOfDetectorCycle()
92 //Detector specific actions at start of cycle
93 AliDebug(1,"AliITSQADM::Start of SPD Cycle\n");
96 //____________________________________________________________________________
97 void AliITSQASPDDataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t /*task*/, TObjArray* /*list*/)
99 // launch the QA checking
100 AliDebug(1,"AliITSDM instantiates checker with Run(AliQA::kITS, task, list)\n");
102 //AliQAChecker::Instance()->Run( AliQA::kITS , task, list);
105 //____________________________________________________________________________
106 void AliITSQASPDDataMakerRec::InitRaws()
108 // Initialization for RAW data - SPD -
109 fGenOffset = (fAliITSQADataMakerRec->fRawsQAList)->GetEntries();
111 AliInfo("Book Offline Histograms for SPD\n ");
116 TH1F *hlayer = new TH1F("SPD/LayPattern_SPD","Layer map - SPD",6,0.,6.);
117 hlayer->GetXaxis()->SetTitle("Layer number");
118 hlayer->GetYaxis()->SetTitle("Entries");
119 fAliITSQADataMakerRec->Add2RawsList(hlayer, 0+fGenOffset, kTRUE);
122 TH1F **hmod = new TH1F*[2];
123 TH2F **hhitMap = new TH2F*[20];
124 TH1F **herrors = new TH1F*[20];
125 for (Int_t iLay=0; iLay<2; iLay++) {
126 sprintf(name,"SPD/ModPattern_SPD%d",iLay+1);
127 sprintf(title,"Module map - SPD Layer %d",iLay+1);
128 hmod[iLay]=new TH1F(name,title,fgknSPDmodules,0,fgknSPDmodules);
129 hmod[iLay]->GetXaxis()->SetTitle("Module number");
130 hmod[iLay]->GetYaxis()->SetTitle("Entries");
131 fAliITSQADataMakerRec->Add2RawsList(hmod[iLay], 1+iLay+fGenOffset);
134 fAdvLogger = new AliITSRawStreamSPDErrorLog();
135 for (Int_t iDDL=0; iDDL<20; iDDL++) {
136 sprintf(name,"SPD/HitMap_SPD_DDL%d",iDDL+1);
137 sprintf(title,"Hit map - SPD DDL %d",iDDL+1);
138 hhitMap[iDDL]=new TH2F(name,title,320,0,10*32,1536,0,6*256);
139 hhitMap[iDDL]->GetXaxis()->SetTitle("Column");
140 hhitMap[iDDL]->GetYaxis()->SetTitle("Row");
141 fAliITSQADataMakerRec->Add2RawsList(hhitMap[iDDL], 3+(2*iDDL)+fGenOffset, kTRUE);
143 sprintf(name,"SPD/Errors_SPD_DDL%d",iDDL+1);
144 sprintf(title,"Error codes - SPD DDL %d",iDDL+1);
145 herrors[iDDL] = new TH1F (name,title,15,0,15);
146 herrors[iDDL]->SetXTitle("Error Code");
147 herrors[iDDL]->SetYTitle("Nr of errors");
148 fAliITSQADataMakerRec->Add2RawsList(herrors[iDDL], 4+(2*iDDL)+fGenOffset, kTRUE);
152 TH1F** hMultSPDhits = new TH1F*[2];
153 for (Int_t iLay=0; iLay<2; iLay++) {
154 sprintf(name,"SPD/HitsMultiplicity_SPD%d",iLay+1);
155 sprintf(title,"Hit multiplicity - SPD Layer %d",iLay+1);
156 hMultSPDhits[iLay]=new TH1F(name,title,200,0.,200.);
157 hMultSPDhits[iLay]->GetXaxis()->SetTitle("Hit multiplicity");
158 hMultSPDhits[iLay]->GetYaxis()->SetTitle("Entries");
159 fAliITSQADataMakerRec->Add2RawsList(hMultSPDhits[iLay], 43+iLay+fGenOffset, kTRUE);
163 TH2F *hMultSPDhits2MultSPDhits1
164 = new TH2F("SPD/HitMultCorrelation_SPD","Hit multiplicity correlation - SPD",200,0.,200.,200,0.,200.);
165 hMultSPDhits2MultSPDhits1->GetXaxis()->SetTitle("Hit multiplicity (Layer 1)");
166 hMultSPDhits2MultSPDhits1->GetYaxis()->SetTitle("Hit multiplicity (Layer 2)");
167 fAliITSQADataMakerRec->Add2RawsList(hMultSPDhits2MultSPDhits1, 45+fGenOffset);
170 AliDebug(1,Form("%d SPD Raws histograms booked\n",fSPDhTask));
174 //____________________________________________________________________________
175 void AliITSQASPDDataMakerRec::MakeRaws(AliRawReader* rawReader)
177 // Fill QA for RAW - SPD -
179 AliITSRawStreamSPD *rawStreamSPD = new AliITSRawStreamSPD(rawReader);
180 rawStreamSPD->ActivateAdvancedErrorLog(kTRUE,fAdvLogger);
186 Int_t iHalfStave, iChip;
188 UInt_t module, colM, rowM;
189 while(rawStreamSPD->Next()) {
191 iEq = rawReader->GetDDLID();
192 if (iEq>=0 && iEq<20) {
193 iHalfStave = rawStreamSPD->GetHalfStaveNr();
194 iChip = rawStreamSPD->GetChipAddr();
195 col = rawStreamSPD->GetChipCol();
196 row = rawStreamSPD->GetChipRow();
198 rawStreamSPD->OnlineToOffline(iEq, iHalfStave, iChip, col, row, module, colM, rowM);
200 if (iHalfStave>=0 && iHalfStave<2) iLayer=0;
203 fAliITSQADataMakerRec->GetRawsData(0+fGenOffset)->Fill(iLayer);
205 fAliITSQADataMakerRec->GetRawsData(1+fGenOffset)->Fill(module);
208 fAliITSQADataMakerRec->GetRawsData(2+fGenOffset)->Fill(module);
212 fAliITSQADataMakerRec->GetRawsData((2*iEq)+3+fGenOffset)->Fill(colM+(module%2)*160,rowM+iHalfStave*256);
216 for (Int_t ieq=0; ieq<20; ieq++)
217 for (UInt_t ierr=0; ierr<fAdvLogger->GetNrErrorCodes(); ierr++)
218 fAliITSQADataMakerRec->GetRawsData((2*ieq)+4+fGenOffset)->Fill(ierr,fAdvLogger->GetNrErrors(ierr,ieq));
222 fAliITSQADataMakerRec->GetRawsData(43+fGenOffset)->Fill(nDigitsL1);
223 fAliITSQADataMakerRec->GetRawsData(44+fGenOffset)->Fill(nDigitsL2);
224 fAliITSQADataMakerRec->GetRawsData(45+fGenOffset)->Fill(nDigitsL1,nDigitsL2);
227 AliDebug(1,Form("Event completed, %d raw digits read",nDigitsL1+nDigitsL2));
230 //____________________________________________________________________________
231 void AliITSQASPDDataMakerRec::InitRecPoints()
233 // Initialization for RECPOINTS - SPD -
234 fGenOffset = (fAliITSQADataMakerRec->fRecPointsQAList)->GetEntries();
236 TH1F* hlayer= new TH1F("SPD/LayPattern_SPD","Layer map - SPD",6,0.,6.);
237 hlayer->GetXaxis()->SetTitle("Layer number");
238 hlayer->GetYaxis()->SetTitle("Entries");
239 fAliITSQADataMakerRec->Add2RecPointsList(hlayer, 0+fGenOffset, kTRUE);
242 TH1F** hmod = new TH1F*[2];
243 TH1F** hxl = new TH1F*[2];
244 TH1F** hzl = new TH1F*[2];
245 TH1F** hxg = new TH1F*[2];
246 TH1F** hyg = new TH1F*[2];
247 TH1F** hzg = new TH1F*[2];
248 TH1F** hr = new TH1F*[2];
249 TH1F** hphi = new TH1F*[2];
250 TH1F** hMultSPDcl = new TH1F*[2];
251 TH2F** hNyNz = new TH2F*[2]; // y and z cluster length
252 TH2F** hPhiZ = new TH2F*[2];
254 Float_t xlim[2]={4.5,8.};
255 Float_t zlim[2]={15.,15.};
259 for (Int_t iLay=0;iLay<2;iLay++) {
260 sprintf(name,"SPD/ModPattern_SPD%d",iLay+1);
261 sprintf(title,"Module map - SPD Layer %d",iLay+1);
262 hmod[iLay]=new TH1F(name,title,fgknSPDmodules,0,fgknSPDmodules);
263 hmod[iLay]->GetXaxis()->SetTitle("Module number");
264 hmod[iLay]->GetYaxis()->SetTitle("Entries");
265 fAliITSQADataMakerRec->Add2RecPointsList(hmod[iLay], 1+(10*iLay)+fGenOffset, kTRUE);
268 sprintf(name,"SPD/xLoc_SPD%d",iLay+1);
269 sprintf(title,"Local x coordinate - SPD Layer %d",iLay+1);
270 hxl[iLay]=new TH1F(name,title,100,-4.,4.);
271 hxl[iLay]->GetXaxis()->SetTitle("Local x [cm]");
272 hxl[iLay]->GetYaxis()->SetTitle("Entries");
273 fAliITSQADataMakerRec->Add2RecPointsList(hxl[iLay], 2+(10*iLay)+fGenOffset, kTRUE);
276 sprintf(name,"SPD/zLoc_SPD%d",iLay+1);
277 sprintf(title,"Local z coordinate - SPD Layer %d",iLay+1);
278 hzl[iLay]=new TH1F(name,title,100,-4.,4.);
279 hzl[iLay]->GetXaxis()->SetTitle("Local z [cm]");
280 hzl[iLay]->GetYaxis()->SetTitle("Entries");
281 fAliITSQADataMakerRec->Add2RecPointsList(hzl[iLay], 3+(10*iLay)+fGenOffset, kTRUE);
284 sprintf(name,"SPD/xGlob_SPD%d",iLay+1);
285 sprintf(title,"Global x coordinate - SPD Layer %d",iLay+1);
286 hxg[iLay]=new TH1F(name,title,100,-xlim[iLay],xlim[iLay]);
287 hxg[iLay]->GetXaxis()->SetTitle("Global x [cm]");
288 hxg[iLay]->GetYaxis()->SetTitle("Entries");
289 fAliITSQADataMakerRec->Add2RecPointsList(hxg[iLay],4+(10*iLay)+fGenOffset, kTRUE);
292 sprintf(name,"SPD/yGlob_SPD%d",iLay+1);
293 sprintf(title,"Global y coordinate - SPD Layer %d",iLay+1);
294 hyg[iLay]=new TH1F(name,title,100,-xlim[iLay],xlim[iLay]);
295 hyg[iLay]->GetXaxis()->SetTitle("Global y [cm]");
296 hyg[iLay]->GetYaxis()->SetTitle("Entries");
297 fAliITSQADataMakerRec->Add2RecPointsList(hyg[iLay], 5+(10*iLay)+fGenOffset, kTRUE);
300 sprintf(name,"SPD/zGlob_SPD%d",iLay+1);
301 sprintf(title,"Global z coordinate - SPD Layer %d",iLay+1);
302 hzg[iLay]=new TH1F(name,title,150,-zlim[iLay],zlim[iLay]);
303 hzg[iLay]->GetXaxis()->SetTitle("Global z [cm]");
304 hzg[iLay]->GetYaxis()->SetTitle("Entries");
305 fAliITSQADataMakerRec->Add2RecPointsList(hzg[iLay], 6+(10*iLay)+fGenOffset, kTRUE);
308 sprintf(name,"SPD/r_SPD%d",iLay+1);
309 sprintf(title,"Radius - SPD Layer %d",iLay+1);
310 hr[iLay]=new TH1F(name,title,100,0.,10.);
311 hr[iLay]->GetXaxis()->SetTitle("r [cm]");
312 hr[iLay]->GetYaxis()->SetTitle("Entries");
313 fAliITSQADataMakerRec->Add2RecPointsList(hr[iLay], 7+(10*iLay)+fGenOffset, kTRUE);
316 sprintf(name,"SPD/phi_SPD%d",iLay+1);
317 sprintf(title,"#varphi - SPD Layer %d",iLay+1);
318 hphi[iLay]=new TH1F(name,title,1000,0.,2*TMath::Pi());
319 hphi[iLay]->GetXaxis()->SetTitle("#varphi [rad]");
320 hphi[iLay]->GetYaxis()->SetTitle("Entries");
321 fAliITSQADataMakerRec->Add2RecPointsList(hphi[iLay], 8+(10*iLay)+fGenOffset, kTRUE);
324 sprintf(name,"SPD/SizeYvsZ_SPD%d",iLay+1);
325 sprintf(title,"Cluster dimension - SPD Layer %d",iLay+1);
326 hNyNz[iLay]=new TH2F(name,title,100,0.,100.,100,0.,100.);
327 hNyNz[iLay]->GetXaxis()->SetTitle("z length");
328 hNyNz[iLay]->GetYaxis()->SetTitle("y length");
329 fAliITSQADataMakerRec->Add2RecPointsList(hNyNz[iLay], 9+(10*iLay)+fGenOffset, kTRUE);
332 sprintf(name,"SPD/phi_z_SPD%d",iLay+1);
333 sprintf(title,"#varphi vs z - SPD Layer %d",iLay+1);
334 hPhiZ[iLay]=new TH2F(name,title,150,-zlim[iLay],zlim[iLay],200,0.,2*TMath::Pi());
335 hPhiZ[iLay]->GetXaxis()->SetTitle("Global z [cm]");
336 hPhiZ[iLay]->GetYaxis()->SetTitle("#varphi [rad]");
337 fAliITSQADataMakerRec->Add2RecPointsList(hPhiZ[iLay], 10+(10*iLay)+fGenOffset);
342 TH2F *hrPhi=new TH2F("SPD/r_phi_SPD","#varphi vs r - SPD",100,0.,10.,100,0.,2*TMath::Pi());
343 hrPhi->GetXaxis()->SetTitle("r [cm]");
344 hrPhi->GetYaxis()->SetTitle("#varphi [rad]");
345 fAliITSQADataMakerRec->Add2RecPointsList(hrPhi, 21+fGenOffset, kTRUE);
348 TH2F *hxy=new TH2F("SPD/x_y_SPD","Global y vs x - SPD",200,-10.,10.,200,-10.,10.);
349 hxy->GetXaxis()->SetTitle("Global x [cm]");
350 hxy->GetYaxis()->SetTitle("Global y [cm]");
351 fAliITSQADataMakerRec->Add2RecPointsList(hxy, 22+fGenOffset);
354 for (Int_t iLay=0;iLay<2;iLay++) {
355 sprintf(name,"SPD/Multiplicity_SPD%d",iLay+1);
356 sprintf(title,"Cluster multiplicity - SPD Layer %d",iLay+1);
357 hMultSPDcl[iLay]=new TH1F(name,title,200,0.,200.);
358 hMultSPDcl[iLay]->GetXaxis()->SetTitle("Cluster multiplicity");
359 hMultSPDcl[iLay]->GetYaxis()->SetTitle("Entries");
360 fAliITSQADataMakerRec->Add2RecPointsList(hMultSPDcl[iLay], 23+iLay+fGenOffset);
364 TH2F *hMultSPDcl2MultSPDcl1 =
365 new TH2F("SPD/MultCorrelation_SPD","Cluster multiplicity correlation - SPD",200,0.,200.,200,0.,200.);
366 hMultSPDcl2MultSPDcl1->GetXaxis()->SetTitle("Clusters multiplicity (Layer 1)");
367 hMultSPDcl2MultSPDcl1->GetYaxis()->SetTitle("Clusters multiplicity (Layer 2)");
368 fAliITSQADataMakerRec->Add2RecPointsList(hMultSPDcl2MultSPDcl1, 25+fGenOffset, kFALSE);
371 AliDebug(1,Form("%d SPD Recs histograms booked\n",fSPDhTask));
376 //____________________________________________________________________________
377 void AliITSQASPDDataMakerRec::MakeRecPoints(TTree * clusterTree)
379 // Fill QA for RecPoints - SPD -
380 static TClonesArray statITSCluster("AliITSRecPoint");
381 TClonesArray *ITSCluster = &statITSCluster;
382 TBranch* itsClusterBranch=clusterTree->GetBranch("ITSRecPoints");
383 if (!itsClusterBranch) {
384 AliError("can't get the branch with the ITS clusters !");
387 itsClusterBranch->SetAddress(&ITSCluster);
388 Int_t nItsMods = (Int_t)clusterTree->GetEntries();
390 Float_t cluGlo[3] = {0.,0.,0.};
391 Int_t nClusters[2] = {0,0};
393 for (Int_t iIts=0; iIts < nItsMods; iIts++) {
395 if (!clusterTree->GetEvent(iIts)) continue;
396 Int_t nCluster = ITSCluster->GetEntriesFast();
397 // loop over clusters
399 AliITSRecPoint* cluster = (AliITSRecPoint*)ITSCluster->UncheckedAt(nCluster);
401 if (cluster->GetLayer()>1) continue;
402 Int_t lay=cluster->GetLayer();
403 fAliITSQADataMakerRec->GetRecPointsData(0 +fGenOffset)->Fill(lay);
404 cluster->GetGlobalXYZ(cluGlo);
405 Float_t rad=TMath::Sqrt(cluGlo[0]*cluGlo[0]+cluGlo[1]*cluGlo[1]);
406 Float_t phi= TMath::Pi() + TMath::ATan2(-cluGlo[1],-cluGlo[0]);
408 fAliITSQADataMakerRec->GetRecPointsData(1 +fGenOffset)->Fill(iIts);
409 fAliITSQADataMakerRec->GetRecPointsData(2 +fGenOffset)->Fill(cluster->GetDetLocalX());
410 fAliITSQADataMakerRec->GetRecPointsData(3 +fGenOffset)->Fill(cluster->GetDetLocalZ());
411 fAliITSQADataMakerRec->GetRecPointsData(4 +fGenOffset)->Fill(cluGlo[0]);
412 fAliITSQADataMakerRec->GetRecPointsData(5 +fGenOffset)->Fill(cluGlo[1]);
413 fAliITSQADataMakerRec->GetRecPointsData(6 +fGenOffset)->Fill(cluGlo[2]);
414 fAliITSQADataMakerRec->GetRecPointsData(7 +fGenOffset)->Fill(rad);
415 fAliITSQADataMakerRec->GetRecPointsData(8 +fGenOffset)->Fill(phi);
416 fAliITSQADataMakerRec->GetRecPointsData(9 +fGenOffset)->Fill(cluster->GetNz(),cluster->GetNy());
417 fAliITSQADataMakerRec->GetRecPointsData(10 +fGenOffset)->Fill(cluGlo[2],phi);
419 fAliITSQADataMakerRec->GetRecPointsData(11 +fGenOffset)->Fill(iIts);
420 fAliITSQADataMakerRec->GetRecPointsData(12 +fGenOffset)->Fill(cluster->GetDetLocalX());
421 fAliITSQADataMakerRec->GetRecPointsData(13 +fGenOffset)->Fill(cluster->GetDetLocalZ());
422 fAliITSQADataMakerRec->GetRecPointsData(14 +fGenOffset)->Fill(cluGlo[0]);
423 fAliITSQADataMakerRec->GetRecPointsData(15 +fGenOffset)->Fill(cluGlo[1]);
424 fAliITSQADataMakerRec->GetRecPointsData(16 +fGenOffset)->Fill(cluGlo[2]);
425 fAliITSQADataMakerRec->GetRecPointsData(17 +fGenOffset)->Fill(rad);
426 fAliITSQADataMakerRec->GetRecPointsData(18 +fGenOffset)->Fill(phi);
427 fAliITSQADataMakerRec->GetRecPointsData(19 +fGenOffset)->Fill(cluster->GetNz(),cluster->GetNy());
428 fAliITSQADataMakerRec->GetRecPointsData(20 +fGenOffset)->Fill(cluGlo[2],phi);
430 fAliITSQADataMakerRec->GetRecPointsData(21 +fGenOffset)->Fill(rad,phi);
431 fAliITSQADataMakerRec->GetRecPointsData(22 +fGenOffset)->Fill(cluGlo[0],cluGlo[1]);
434 } // end of cluster loop
435 } // end of its "subdetector" loop
437 for (Int_t iLay=0; iLay<2; iLay++)
438 fAliITSQADataMakerRec->GetRecPointsData(23+iLay +fGenOffset)->Fill(nClusters[iLay]);
440 fAliITSQADataMakerRec->GetRecPointsData(25 +fGenOffset)->Fill(nClusters[0],nClusters[1]);
442 statITSCluster.Clear();