1.The QA data created on demand according to the event species at filling time. 2...
[u/mrichter/AliRoot.git] / ITS / AliITSQASPDDataMakerRec.cxx
CommitLineData
096292ae 1/**************************************************************************
2 * Copyright(c) 2007-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 **************************************************************************/
3f905799 15/* $Id$ */
096292ae 16// *************************************************************
17// Checks the quality assurance
18// by comparing with reference data
19// contained in a DB
20// -------------------------------------------------------------
21// W. Ferrarese + P. Cerello Feb 2008
22// INFN Torino
23// M. Nicassio D. Elia INFN Bari March 2008
24// maria.nicassio@ba.infn.it
25
26
27// --- ROOT system ---
28#include <TTree.h>
29#include <TH1.h>
30#include <TH2.h>
31#include <TMath.h>
32// --- Standard library ---
33
34// --- AliRoot header files ---
35#include "AliITSQADataMakerRec.h"
36#include "AliITSQASPDDataMakerRec.h"
37#include "AliLog.h"
4e25ac79 38#include "AliQAv1.h"
096292ae 39#include "AliRawReader.h"
379510c2 40#include "AliITSRawStreamSPD.h"
41#include "AliITSRawStreamSPDErrorLog.h"
33626263 42#include "AliITSdigitSPD.h"
096292ae 43#include "AliITSRecPoint.h"
379510c2 44
096292ae 45ClassImp(AliITSQASPDDataMakerRec)
46
47//____________________________________________________________________________
379510c2 48AliITSQASPDDataMakerRec::AliITSQASPDDataMakerRec(AliITSQADataMakerRec *aliITSQADataMakerRec, Bool_t kMode, Short_t ldc, AliITSRawStreamSPDErrorLog *aliITSRawStreamSPDErrorLog) :
096292ae 49TObject(),
50fAliITSQADataMakerRec(aliITSQADataMakerRec),
51fkOnline(kMode),
52fLDC(ldc),
7a0e5776 53fSPDhRawsTask(0),
44ed7a66 54fSPDhDigitsTask(0),
7a0e5776 55fSPDhRecPointsTask(0),
56fGenRawsOffset(0),
44ed7a66 57fGenDigitsOffset(0),
7a0e5776 58fGenRecPointsOffset(0),
379510c2 59fAdvLogger(aliITSRawStreamSPDErrorLog)
096292ae 60{
61 //ctor used to discriminate OnLine-Offline analysis
62}
63
64//____________________________________________________________________________
65AliITSQASPDDataMakerRec::AliITSQASPDDataMakerRec(const AliITSQASPDDataMakerRec& qadm) :
66TObject(),
67fAliITSQADataMakerRec(qadm.fAliITSQADataMakerRec),
68fkOnline(qadm.fkOnline),
69fLDC(qadm.fLDC),
7a0e5776 70fSPDhRawsTask(qadm.fSPDhRawsTask),
44ed7a66 71fSPDhDigitsTask(qadm.fSPDhDigitsTask),
7a0e5776 72fSPDhRecPointsTask(qadm.fSPDhRecPointsTask),
73fGenRawsOffset(qadm.fGenRawsOffset),
44ed7a66 74fGenDigitsOffset(qadm.fGenDigitsOffset),
7a0e5776 75fGenRecPointsOffset(qadm.fGenRecPointsOffset),
379510c2 76fAdvLogger(qadm.fAdvLogger)
096292ae 77{
78 //copy ctor
79 fAliITSQADataMakerRec->SetName((const char*)qadm.fAliITSQADataMakerRec->GetName()) ;
80 fAliITSQADataMakerRec->SetTitle((const char*)qadm.fAliITSQADataMakerRec->GetTitle());
81 }
82
83//__________________________________________________________________
84AliITSQASPDDataMakerRec::~AliITSQASPDDataMakerRec(){
85 // destructor
379510c2 86// delete fAdvLogger;
096292ae 87}
88//__________________________________________________________________
89
90AliITSQASPDDataMakerRec& AliITSQASPDDataMakerRec::operator = (const AliITSQASPDDataMakerRec& qac )
91{
92 // Equal operator.
93 this->~AliITSQASPDDataMakerRec();
94 new(this) AliITSQASPDDataMakerRec(qac);
95 return *this;
96}
97
98//____________________________________________________________________________
99void AliITSQASPDDataMakerRec::StartOfDetectorCycle()
100{
101 //Detector specific actions at start of cycle
5379c4a3 102 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of SPD Cycle\n");
096292ae 103}
104
105//____________________________________________________________________________
4e25ac79 106void AliITSQASPDDataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t /*task*/, TObjArray* /*list*/)
096292ae 107{
108 // launch the QA checking
5379c4a3 109 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n");
096292ae 110
4e25ac79 111 //AliQAChecker::Instance()->Run( AliQAv1::kITS , task, list);
096292ae 112}
113
114//____________________________________________________________________________
eca4fa66 115Int_t AliITSQASPDDataMakerRec::InitRaws()
096292ae 116{
117 // Initialization for RAW data - SPD -
7d297381 118 const Bool_t expert = kTRUE ;
119 const Bool_t saveCorr = kTRUE ;
120 const Bool_t image = kTRUE ;
eca4fa66 121 Int_t rv = 0 ;
122// fGenRawsOffset = (fAliITSQADataMakerRec->fRawsQAList[AliRecoParam::kDefault])->GetEntries();
b467364b 123 fAdvLogger = new AliITSRawStreamSPDErrorLog();
5379c4a3 124 AliDebug(AliQAv1::GetQADebugLevel(), "Book Offline Histograms for SPD\n ");
439e7a8a 125
379510c2 126 Char_t name[50];
127 Char_t title[50];
096292ae 128
26ee9565 129 TH1F *hlayer = new TH1F("SPDLayPattern_SPD","Layer map - SPD",6,0.,6.);
379510c2 130 hlayer->GetXaxis()->SetTitle("Layer number");
131 hlayer->GetYaxis()->SetTitle("Entries");
eca4fa66 132 rv = fAliITSQADataMakerRec->Add2RawsList(hlayer, 0+fGenRawsOffset, expert, !image, !saveCorr);
7a0e5776 133 fSPDhRawsTask++;
379510c2 134
135 TH1F **hmod = new TH1F*[2];
136 TH2F **hhitMap = new TH2F*[20];
137 TH1F **herrors = new TH1F*[20];
138 for (Int_t iLay=0; iLay<2; iLay++) {
26ee9565 139 sprintf(name,"SPDModPattern_SPD%d",iLay+1);
379510c2 140 sprintf(title,"Module map - SPD Layer %d",iLay+1);
141 hmod[iLay]=new TH1F(name,title,fgknSPDmodules,0,fgknSPDmodules);
142 hmod[iLay]->GetXaxis()->SetTitle("Module number");
143 hmod[iLay]->GetYaxis()->SetTitle("Entries");
eca4fa66 144 rv = fAliITSQADataMakerRec->Add2RawsList(hmod[iLay], 1+iLay+fGenRawsOffset, !expert, image, !saveCorr);
7a0e5776 145 fSPDhRawsTask++;
379510c2 146 }
379510c2 147 for (Int_t iDDL=0; iDDL<20; iDDL++) {
26ee9565 148 sprintf(name,"SPDHitMap_SPD_DDL%d",iDDL+1);
379510c2 149 sprintf(title,"Hit map - SPD DDL %d",iDDL+1);
150 hhitMap[iDDL]=new TH2F(name,title,320,0,10*32,1536,0,6*256);
151 hhitMap[iDDL]->GetXaxis()->SetTitle("Column");
152 hhitMap[iDDL]->GetYaxis()->SetTitle("Row");
eca4fa66 153 rv = fAliITSQADataMakerRec->Add2RawsList(hhitMap[iDDL], 3+(2*iDDL)+fGenRawsOffset, expert, !image, !saveCorr);
7a0e5776 154 fSPDhRawsTask++;
26ee9565 155 sprintf(name,"SPDErrors_SPD_DDL%d",iDDL+1);
379510c2 156 sprintf(title,"Error codes - SPD DDL %d",iDDL+1);
b467364b 157 herrors[iDDL] = new TH1F (name,title,fAdvLogger->GetNrErrorCodes(),0,fAdvLogger->GetNrErrorCodes());
379510c2 158 herrors[iDDL]->SetXTitle("Error Code");
159 herrors[iDDL]->SetYTitle("Nr of errors");
eca4fa66 160 rv = fAliITSQADataMakerRec->Add2RawsList(herrors[iDDL], 4+(2*iDDL)+fGenRawsOffset, expert, !image, !saveCorr);
7a0e5776 161 fSPDhRawsTask++;
379510c2 162 }
096292ae 163
379510c2 164 TH1F** hMultSPDhits = new TH1F*[2];
165 for (Int_t iLay=0; iLay<2; iLay++) {
26ee9565 166 sprintf(name,"SPDHitsMultiplicity_SPD%d",iLay+1);
379510c2 167 sprintf(title,"Hit multiplicity - SPD Layer %d",iLay+1);
168 hMultSPDhits[iLay]=new TH1F(name,title,200,0.,200.);
169 hMultSPDhits[iLay]->GetXaxis()->SetTitle("Hit multiplicity");
170 hMultSPDhits[iLay]->GetYaxis()->SetTitle("Entries");
eca4fa66 171 rv = fAliITSQADataMakerRec->Add2RawsList(hMultSPDhits[iLay], 43+iLay+fGenRawsOffset, expert, !image, !saveCorr);
7a0e5776 172 fSPDhRawsTask++;
379510c2 173 }
174
954ef57a 175 TH2F *hMultSPDhits2MultSPDhits1
26ee9565 176 = new TH2F("SPDHitMultCorrelation_SPD","Hit multiplicity correlation - SPD",200,0.,200.,200,0.,200.);
379510c2 177 hMultSPDhits2MultSPDhits1->GetXaxis()->SetTitle("Hit multiplicity (Layer 1)");
178 hMultSPDhits2MultSPDhits1->GetYaxis()->SetTitle("Hit multiplicity (Layer 2)");
eca4fa66 179 rv = fAliITSQADataMakerRec->Add2RawsList(hMultSPDhits2MultSPDhits1, 45+fGenRawsOffset, !expert, image, !saveCorr);
7a0e5776 180 fSPDhRawsTask++;
379510c2 181
5379c4a3 182 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SPD Raws histograms booked\n",fSPDhRawsTask));
eca4fa66 183 return rv ;
096292ae 184}
185
096292ae 186//____________________________________________________________________________
eca4fa66 187Int_t AliITSQASPDDataMakerRec::MakeRaws(AliRawReader* rawReader)
096292ae 188{
189 // Fill QA for RAW - SPD -
eca4fa66 190 Int_t rv = 0 ;
191 // Check id histograms already created for this Event Specie
192 if ( ! fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset) )
193 rv = InitRaws() ;
194
379510c2 195 rawReader->Reset();
196 AliITSRawStreamSPD *rawStreamSPD = new AliITSRawStreamSPD(rawReader);
197 rawStreamSPD->ActivateAdvancedErrorLog(kTRUE,fAdvLogger);
198
199 Int_t nDigitsL1 = 0;
200 Int_t nDigitsL2 = 0;
201 Int_t iEq;
202 Int_t iLayer;
203 Int_t iHalfStave, iChip;
204 Int_t col, row;
205 UInt_t module, colM, rowM;
206 while(rawStreamSPD->Next()) {
207
208 iEq = rawReader->GetDDLID();
209 if (iEq>=0 && iEq<20) {
210 iHalfStave = rawStreamSPD->GetHalfStaveNr();
211 iChip = rawStreamSPD->GetChipAddr();
212 col = rawStreamSPD->GetChipCol();
213 row = rawStreamSPD->GetChipRow();
214
215 rawStreamSPD->OnlineToOffline(iEq, iHalfStave, iChip, col, row, module, colM, rowM);
216
217 if (iHalfStave>=0 && iHalfStave<2) iLayer=0;
218 else iLayer=1;
219
7a0e5776 220 fAliITSQADataMakerRec->GetRawsData(0+fGenRawsOffset)->Fill(iLayer);
379510c2 221 if (iLayer==0) {
7a0e5776 222 fAliITSQADataMakerRec->GetRawsData(1+fGenRawsOffset)->Fill(module);
379510c2 223 nDigitsL1++;
224 } else {
7a0e5776 225 fAliITSQADataMakerRec->GetRawsData(2+fGenRawsOffset)->Fill(module);
379510c2 226 nDigitsL2++;
227 }
228
7a0e5776 229 fAliITSQADataMakerRec->GetRawsData((2*iEq)+3+fGenRawsOffset)->Fill(colM+(module%2)*160,rowM+iHalfStave*256);
379510c2 230 }
231
232 }
233 for (Int_t ieq=0; ieq<20; ieq++)
c71529b0 234 for (UInt_t ierr=0; ierr<fAdvLogger->GetNrErrorCodes(); ierr++)
7a0e5776 235 fAliITSQADataMakerRec->GetRawsData((2*ieq)+4+fGenRawsOffset)->Fill(ierr,fAdvLogger->GetNrErrors(ierr,ieq));
379510c2 236
237 fAdvLogger->Reset();
238
7a0e5776 239 fAliITSQADataMakerRec->GetRawsData(43+fGenRawsOffset)->Fill(nDigitsL1);
240 fAliITSQADataMakerRec->GetRawsData(44+fGenRawsOffset)->Fill(nDigitsL2);
241 fAliITSQADataMakerRec->GetRawsData(45+fGenRawsOffset)->Fill(nDigitsL1,nDigitsL2);
379510c2 242
243 delete rawStreamSPD;
5379c4a3 244 AliDebug(AliQAv1::GetQADebugLevel(),Form("Event completed, %d raw digits read",nDigitsL1+nDigitsL2));
eca4fa66 245 return rv ;
096292ae 246}
247
248//____________________________________________________________________________
eca4fa66 249Int_t AliITSQASPDDataMakerRec::InitDigits()
44ed7a66 250{
251 // Initialization for DIGIT data - SPD -
252 const Bool_t expert = kTRUE ;
253 const Bool_t image = kTRUE ;
eca4fa66 254 Int_t rv = 0 ;
255// fGenDigitsOffset = (fAliITSQADataMakerRec->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();
44ed7a66 256 //fSPDhDigitsTask must be incremented by one unit every time a histogram is ADDED to the QA List
257
258 Char_t name[50];
259 Char_t title[50];
260
261 TH1F *hlayer = new TH1F("SPDLayPattern_SPD","Layer map - SPD",6,0.,6.);
262 hlayer->GetXaxis()->SetTitle("Layer number");
263 hlayer->GetYaxis()->SetTitle("Entries");
eca4fa66 264 rv = fAliITSQADataMakerRec->Add2DigitsList(hlayer,fGenDigitsOffset, expert, !image);
44ed7a66 265 fSPDhDigitsTask++;
266
267 TH1F **hmod = new TH1F*[2];
268 for (Int_t iLay=0; iLay<2; iLay++) {
269 sprintf(name,"SPDModPattern_SPD%d",iLay+1);
270 sprintf(title,"Module map - SPD Layer %d",iLay+1);
271 hmod[iLay]=new TH1F(name,title,240,0,240);
272 hmod[iLay]->GetXaxis()->SetTitle("Module number");
273 hmod[iLay]->GetYaxis()->SetTitle("Entries");
eca4fa66 274 rv = fAliITSQADataMakerRec->Add2DigitsList(hmod[iLay],1+iLay+fGenDigitsOffset, !expert, image);
44ed7a66 275 fSPDhDigitsTask++;
276 }
277
278 TH1F *hcolumns = new TH1F("SPDColumns_SPD","Columns - SPD",160,0.,160.);
279 hcolumns->GetXaxis()->SetTitle("Column number");
280 hcolumns->GetYaxis()->SetTitle("Entries");
eca4fa66 281 rv = fAliITSQADataMakerRec->Add2DigitsList(hcolumns,3+fGenDigitsOffset, expert, !image);
44ed7a66 282 fSPDhDigitsTask++;
283
284 TH1F *hrows = new TH1F("SPDRows_SPD","Rows - SPD",256,0.,256.);
285 hrows->GetXaxis()->SetTitle("Row number");
286 hrows->GetYaxis()->SetTitle("Entries");
eca4fa66 287 rv = fAliITSQADataMakerRec->Add2DigitsList(hrows,4+fGenDigitsOffset, expert, !image);
44ed7a66 288 fSPDhDigitsTask++;
289
290 TH1F** hMultSPDdigits = new TH1F*[2];
291 for (Int_t iLay=0; iLay<2; ++iLay) {
292 sprintf(name,"SPDDigitMultiplicity_SPD%d",iLay+1);
293 sprintf(title,"Digit multiplicity - SPD Layer %d",iLay+1);
294 hMultSPDdigits[iLay]=new TH1F(name,title,200,0.,200.);
295 hMultSPDdigits[iLay]->GetXaxis()->SetTitle("Digit multiplicity");
296 hMultSPDdigits[iLay]->GetYaxis()->SetTitle("Entries");
eca4fa66 297 rv = fAliITSQADataMakerRec->Add2DigitsList(hMultSPDdigits[iLay], 5+iLay+fGenDigitsOffset, !expert, image);
44ed7a66 298 fSPDhDigitsTask++;
299 }
300
301 TH2F *hMultSPDdig2MultSPDdig1
302 = new TH2F("SPDDigitMultCorrelation_SPD","Digit multiplicity correlation - SPD",200,0.,200.,200,0.,200.);
303 hMultSPDdig2MultSPDdig1->GetXaxis()->SetTitle("Digit multiplicity (Layer 1)");
304 hMultSPDdig2MultSPDdig1->GetYaxis()->SetTitle("Digit multiplicity (Layer 2)");
eca4fa66 305 rv = fAliITSQADataMakerRec->Add2DigitsList(hMultSPDdig2MultSPDdig1,7+fGenDigitsOffset, !expert, image);
44ed7a66 306 fSPDhDigitsTask++;
307
308 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SPD Digits histograms booked\n",fSPDhDigitsTask));
eca4fa66 309 return rv ;
44ed7a66 310}
311
312//____________________________________________________________________________
eca4fa66 313Int_t AliITSQASPDDataMakerRec::MakeDigits(TTree *digits)
44ed7a66 314{
315 // Fill QA for DIGIT - SPD -
eca4fa66 316 Int_t rv = 0 ;
317 // Check id histograms already created for this Event Specie
318 if ( ! fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset) )
319 rv = InitDigits() ;
320
44ed7a66 321// AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");
322// fITS->SetTreeAddress();
323// TClonesArray *iITSdigits = fITS->DigitsAddress(0); // 0->SPD
33626263 324 TBranch *branchD = digits->GetBranch("ITSDigitsSPD");
44ed7a66 325 if (!branchD) {
33626263 326 AliError("can't get the branch with the SPD ITS digits !");
eca4fa66 327 return rv;
44ed7a66 328 }
33626263 329 static TClonesArray statDigits("AliITSdigitSPD");
44ed7a66 330 TClonesArray *iITSdigits = &statDigits;
331 branchD->SetAddress(&iITSdigits);
332 Int_t nDigitsL1=0;
333 Int_t nDigitsL2=0;
334
335 for (Int_t imod=0; imod<240; ++imod){
336 digits->GetEvent(imod);
337 Int_t ndigits = iITSdigits->GetEntries();
338 if (imod<80) {
339 fAliITSQADataMakerRec->GetDigitsData(0+fGenDigitsOffset)->Fill(0.5,ndigits);
340 fAliITSQADataMakerRec->GetDigitsData(1+fGenDigitsOffset)->Fill(imod,ndigits);
341 nDigitsL1+=ndigits;
342 }
343 else {
344 fAliITSQADataMakerRec->GetDigitsData(0+fGenDigitsOffset)->Fill(1,ndigits);
345 fAliITSQADataMakerRec->GetDigitsData(2+fGenDigitsOffset)->Fill(imod,ndigits);
346 nDigitsL2+=ndigits;
347 }
348 for (Int_t idig=0; idig<ndigits; ++idig) {
349 AliITSdigit *dig=(AliITSdigit*)iITSdigits->UncheckedAt(idig);
350 Int_t col=dig->GetCoord1(); // cell number z
351 Int_t row=dig->GetCoord2(); // cell number x
352 fAliITSQADataMakerRec->GetDigitsData(3+fGenDigitsOffset)->Fill(col);
353 fAliITSQADataMakerRec->GetDigitsData(4+fGenDigitsOffset)->Fill(row);
354 }
355 }
356 fAliITSQADataMakerRec->GetDigitsData(5+fGenDigitsOffset)->Fill(nDigitsL1);
357 fAliITSQADataMakerRec->GetDigitsData(6+fGenDigitsOffset)->Fill(nDigitsL2);
358 fAliITSQADataMakerRec->GetDigitsData(7+fGenDigitsOffset)->Fill(nDigitsL1,nDigitsL2);
eca4fa66 359 return rv ;
44ed7a66 360}
361
362//____________________________________________________________________________
eca4fa66 363Int_t AliITSQASPDDataMakerRec::InitRecPoints()
096292ae 364{
365 // Initialization for RECPOINTS - SPD -
7d297381 366 const Bool_t expert = kTRUE ;
367 const Bool_t image = kTRUE ;
eca4fa66 368 Int_t rv = 0 ;
369// fGenRecPointsOffset = (fAliITSQADataMakerRec->fRecPointsQAList[AliRecoParam::kDefault])->GetEntries();
26ee9565 370 TH1F* hlayer= new TH1F("SPDLayPattern_SPD","Layer map - SPD",6,0.,6.);
096292ae 371 hlayer->GetXaxis()->SetTitle("Layer number");
372 hlayer->GetYaxis()->SetTitle("Entries");
eca4fa66 373 rv = fAliITSQADataMakerRec->Add2RecPointsList(hlayer, 0+fGenRecPointsOffset, expert, !image);
7a0e5776 374 fSPDhRecPointsTask++;
096292ae 375
376 TH1F** hmod = new TH1F*[2];
377 TH1F** hxl = new TH1F*[2];
378 TH1F** hzl = new TH1F*[2];
379 TH1F** hxg = new TH1F*[2];
380 TH1F** hyg = new TH1F*[2];
381 TH1F** hzg = new TH1F*[2];
382 TH1F** hr = new TH1F*[2];
383 TH1F** hphi = new TH1F*[2];
384 TH1F** hMultSPDcl = new TH1F*[2];
385 TH2F** hNyNz = new TH2F*[2]; // y and z cluster length
386 TH2F** hPhiZ = new TH2F*[2];
387
388 Float_t xlim[2]={4.5,8.};
389 Float_t zlim[2]={15.,15.};
390
391 Char_t name[50];
392 Char_t title[50];
393 for (Int_t iLay=0;iLay<2;iLay++) {
26ee9565 394 sprintf(name,"SPDModPattern_SPD%d",iLay+1);
096292ae 395 sprintf(title,"Module map - SPD Layer %d",iLay+1);
396 hmod[iLay]=new TH1F(name,title,fgknSPDmodules,0,fgknSPDmodules);
397 hmod[iLay]->GetXaxis()->SetTitle("Module number");
398 hmod[iLay]->GetYaxis()->SetTitle("Entries");
eca4fa66 399 rv = fAliITSQADataMakerRec->Add2RecPointsList(hmod[iLay], 1+(10*iLay)+fGenRecPointsOffset, expert, !image);
7a0e5776 400 fSPDhRecPointsTask++;
096292ae 401
26ee9565 402 sprintf(name,"SPDxLoc_SPD%d",iLay+1);
096292ae 403 sprintf(title,"Local x coordinate - SPD Layer %d",iLay+1);
404 hxl[iLay]=new TH1F(name,title,100,-4.,4.);
405 hxl[iLay]->GetXaxis()->SetTitle("Local x [cm]");
406 hxl[iLay]->GetYaxis()->SetTitle("Entries");
eca4fa66 407 rv = fAliITSQADataMakerRec->Add2RecPointsList(hxl[iLay], 2+(10*iLay)+fGenRecPointsOffset, expert, !image);
7a0e5776 408 fSPDhRecPointsTask++;
096292ae 409
26ee9565 410 sprintf(name,"SPDzLoc_SPD%d",iLay+1);
096292ae 411 sprintf(title,"Local z coordinate - SPD Layer %d",iLay+1);
412 hzl[iLay]=new TH1F(name,title,100,-4.,4.);
413 hzl[iLay]->GetXaxis()->SetTitle("Local z [cm]");
414 hzl[iLay]->GetYaxis()->SetTitle("Entries");
eca4fa66 415 rv = fAliITSQADataMakerRec->Add2RecPointsList(hzl[iLay], 3+(10*iLay)+fGenRecPointsOffset, expert, !image);
7a0e5776 416 fSPDhRecPointsTask++;
096292ae 417
26ee9565 418 sprintf(name,"SPDxGlob_SPD%d",iLay+1);
096292ae 419 sprintf(title,"Global x coordinate - SPD Layer %d",iLay+1);
420 hxg[iLay]=new TH1F(name,title,100,-xlim[iLay],xlim[iLay]);
421 hxg[iLay]->GetXaxis()->SetTitle("Global x [cm]");
422 hxg[iLay]->GetYaxis()->SetTitle("Entries");
eca4fa66 423 rv = fAliITSQADataMakerRec->Add2RecPointsList(hxg[iLay],4+(10*iLay)+fGenRecPointsOffset, expert, !image);
7a0e5776 424 fSPDhRecPointsTask++;
096292ae 425
26ee9565 426 sprintf(name,"SPDyGlob_SPD%d",iLay+1);
096292ae 427 sprintf(title,"Global y coordinate - SPD Layer %d",iLay+1);
428 hyg[iLay]=new TH1F(name,title,100,-xlim[iLay],xlim[iLay]);
429 hyg[iLay]->GetXaxis()->SetTitle("Global y [cm]");
430 hyg[iLay]->GetYaxis()->SetTitle("Entries");
eca4fa66 431 rv = fAliITSQADataMakerRec->Add2RecPointsList(hyg[iLay], 5+(10*iLay)+fGenRecPointsOffset, expert, !image);
7a0e5776 432 fSPDhRecPointsTask++;
096292ae 433
26ee9565 434 sprintf(name,"SPDzGlob_SPD%d",iLay+1);
096292ae 435 sprintf(title,"Global z coordinate - SPD Layer %d",iLay+1);
436 hzg[iLay]=new TH1F(name,title,150,-zlim[iLay],zlim[iLay]);
437 hzg[iLay]->GetXaxis()->SetTitle("Global z [cm]");
438 hzg[iLay]->GetYaxis()->SetTitle("Entries");
eca4fa66 439 rv = fAliITSQADataMakerRec->Add2RecPointsList(hzg[iLay], 6+(10*iLay)+fGenRecPointsOffset, expert, !image);
7a0e5776 440 fSPDhRecPointsTask++;
096292ae 441
26ee9565 442 sprintf(name,"SPDr_SPD%d",iLay+1);
096292ae 443 sprintf(title,"Radius - SPD Layer %d",iLay+1);
444 hr[iLay]=new TH1F(name,title,100,0.,10.);
445 hr[iLay]->GetXaxis()->SetTitle("r [cm]");
446 hr[iLay]->GetYaxis()->SetTitle("Entries");
eca4fa66 447 rv = fAliITSQADataMakerRec->Add2RecPointsList(hr[iLay], 7+(10*iLay)+fGenRecPointsOffset, expert, !image);
7a0e5776 448 fSPDhRecPointsTask++;
096292ae 449
26ee9565 450 sprintf(name,"SPDphi_SPD%d",iLay+1);
096292ae 451 sprintf(title,"#varphi - SPD Layer %d",iLay+1);
439e7a8a 452 hphi[iLay]=new TH1F(name,title,1000,0.,2*TMath::Pi());
096292ae 453 hphi[iLay]->GetXaxis()->SetTitle("#varphi [rad]");
454 hphi[iLay]->GetYaxis()->SetTitle("Entries");
eca4fa66 455 rv = fAliITSQADataMakerRec->Add2RecPointsList(hphi[iLay], 8+(10*iLay)+fGenRecPointsOffset, expert, !image);
7a0e5776 456 fSPDhRecPointsTask++;
096292ae 457
26ee9565 458 sprintf(name,"SPDSizeYvsZ_SPD%d",iLay+1);
096292ae 459 sprintf(title,"Cluster dimension - SPD Layer %d",iLay+1);
460 hNyNz[iLay]=new TH2F(name,title,100,0.,100.,100,0.,100.);
461 hNyNz[iLay]->GetXaxis()->SetTitle("z length");
462 hNyNz[iLay]->GetYaxis()->SetTitle("y length");
eca4fa66 463 rv = fAliITSQADataMakerRec->Add2RecPointsList(hNyNz[iLay], 9+(10*iLay)+fGenRecPointsOffset, expert, !image);
7a0e5776 464 fSPDhRecPointsTask++;
096292ae 465
26ee9565 466 sprintf(name,"SPDphi_z_SPD%d",iLay+1);
096292ae 467 sprintf(title,"#varphi vs z - SPD Layer %d",iLay+1);
439e7a8a 468 hPhiZ[iLay]=new TH2F(name,title,150,-zlim[iLay],zlim[iLay],200,0.,2*TMath::Pi());
096292ae 469 hPhiZ[iLay]->GetXaxis()->SetTitle("Global z [cm]");
470 hPhiZ[iLay]->GetYaxis()->SetTitle("#varphi [rad]");
eca4fa66 471 rv = fAliITSQADataMakerRec->Add2RecPointsList(hPhiZ[iLay], 10+(10*iLay)+fGenRecPointsOffset, !expert, image);
7a0e5776 472 fSPDhRecPointsTask++;
096292ae 473
474 }
475
26ee9565 476 TH2F *hrPhi=new TH2F("SPDr_phi_SPD","#varphi vs r - SPD",100,0.,10.,100,0.,2*TMath::Pi());
096292ae 477 hrPhi->GetXaxis()->SetTitle("r [cm]");
478 hrPhi->GetYaxis()->SetTitle("#varphi [rad]");
eca4fa66 479 rv = fAliITSQADataMakerRec->Add2RecPointsList(hrPhi, 21+fGenRecPointsOffset, expert, !image);
7a0e5776 480 fSPDhRecPointsTask++;
096292ae 481
26ee9565 482 TH2F *hxy=new TH2F("SPDx_y_SPD","Global y vs x - SPD",200,-10.,10.,200,-10.,10.);
096292ae 483 hxy->GetXaxis()->SetTitle("Global x [cm]");
484 hxy->GetYaxis()->SetTitle("Global y [cm]");
eca4fa66 485 rv = fAliITSQADataMakerRec->Add2RecPointsList(hxy, 22+fGenRecPointsOffset, !expert, image);
7a0e5776 486 fSPDhRecPointsTask++;
096292ae 487
488 for (Int_t iLay=0;iLay<2;iLay++) {
26ee9565 489 sprintf(name,"SPDMultiplicity_SPD%d",iLay+1);
096292ae 490 sprintf(title,"Cluster multiplicity - SPD Layer %d",iLay+1);
491 hMultSPDcl[iLay]=new TH1F(name,title,200,0.,200.);
492 hMultSPDcl[iLay]->GetXaxis()->SetTitle("Cluster multiplicity");
493 hMultSPDcl[iLay]->GetYaxis()->SetTitle("Entries");
eca4fa66 494 rv = fAliITSQADataMakerRec->Add2RecPointsList(hMultSPDcl[iLay], 23+iLay+fGenRecPointsOffset, !expert, image);
7a0e5776 495 fSPDhRecPointsTask++;
096292ae 496 }
497
498 TH2F *hMultSPDcl2MultSPDcl1 =
26ee9565 499 new TH2F("SPDMultCorrelation_SPD","Cluster multiplicity correlation - SPD",200,0.,200.,200,0.,200.);
096292ae 500 hMultSPDcl2MultSPDcl1->GetXaxis()->SetTitle("Clusters multiplicity (Layer 1)");
501 hMultSPDcl2MultSPDcl1->GetYaxis()->SetTitle("Clusters multiplicity (Layer 2)");
eca4fa66 502 rv = fAliITSQADataMakerRec->Add2RecPointsList(hMultSPDcl2MultSPDcl1, 25+fGenRecPointsOffset, !expert, image);
7a0e5776 503 fSPDhRecPointsTask++;
096292ae 504
5379c4a3 505 AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SPD Recs histograms booked\n",fSPDhRecPointsTask));
096292ae 506
eca4fa66 507 return rv ;
096292ae 508}
509
510//____________________________________________________________________________
eca4fa66 511Int_t AliITSQASPDDataMakerRec::MakeRecPoints(TTree * clusterTree)
096292ae 512{
513 // Fill QA for RecPoints - SPD -
eca4fa66 514 Int_t rv = 0 ;
3647765c 515 static TClonesArray statITSCluster("AliITSRecPoint");
516 TClonesArray *ITSCluster = &statITSCluster;
517 TBranch* itsClusterBranch=clusterTree->GetBranch("ITSRecPoints");
518 if (!itsClusterBranch) {
519 AliError("can't get the branch with the ITS clusters !");
eca4fa66 520 return rv;
3647765c 521 }
eca4fa66 522 // Check id histograms already created for this Event Specie
523 if ( ! fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset) )
524 rv = InitRecPoints() ;
525
3647765c 526 itsClusterBranch->SetAddress(&ITSCluster);
527 Int_t nItsMods = (Int_t)clusterTree->GetEntries();
528
529 Float_t cluGlo[3] = {0.,0.,0.};
530 Int_t nClusters[2] = {0,0};
531
532 for (Int_t iIts=0; iIts < nItsMods; iIts++) {
533
534 if (!clusterTree->GetEvent(iIts)) continue;
535 Int_t nCluster = ITSCluster->GetEntriesFast();
536 // loop over clusters
537 while(nCluster--) {
538 AliITSRecPoint* cluster = (AliITSRecPoint*)ITSCluster->UncheckedAt(nCluster);
539
540 if (cluster->GetLayer()>1) continue;
541 Int_t lay=cluster->GetLayer();
7a0e5776 542 fAliITSQADataMakerRec->GetRecPointsData(0 +fGenRecPointsOffset)->Fill(lay);
3647765c 543 cluster->GetGlobalXYZ(cluGlo);
544 Float_t rad=TMath::Sqrt(cluGlo[0]*cluGlo[0]+cluGlo[1]*cluGlo[1]);
096292ae 545 Float_t phi= TMath::Pi() + TMath::ATan2(-cluGlo[1],-cluGlo[0]);
546 if (lay==0) {
7a0e5776 547 fAliITSQADataMakerRec->GetRecPointsData(1 +fGenRecPointsOffset)->Fill(iIts);
548 fAliITSQADataMakerRec->GetRecPointsData(2 +fGenRecPointsOffset)->Fill(cluster->GetDetLocalX());
549 fAliITSQADataMakerRec->GetRecPointsData(3 +fGenRecPointsOffset)->Fill(cluster->GetDetLocalZ());
550 fAliITSQADataMakerRec->GetRecPointsData(4 +fGenRecPointsOffset)->Fill(cluGlo[0]);
551 fAliITSQADataMakerRec->GetRecPointsData(5 +fGenRecPointsOffset)->Fill(cluGlo[1]);
552 fAliITSQADataMakerRec->GetRecPointsData(6 +fGenRecPointsOffset)->Fill(cluGlo[2]);
553 fAliITSQADataMakerRec->GetRecPointsData(7 +fGenRecPointsOffset)->Fill(rad);
554 fAliITSQADataMakerRec->GetRecPointsData(8 +fGenRecPointsOffset)->Fill(phi);
555 fAliITSQADataMakerRec->GetRecPointsData(9 +fGenRecPointsOffset)->Fill(cluster->GetNz(),cluster->GetNy());
556 fAliITSQADataMakerRec->GetRecPointsData(10 +fGenRecPointsOffset)->Fill(cluGlo[2],phi);
096292ae 557 } else {
7a0e5776 558 fAliITSQADataMakerRec->GetRecPointsData(11 +fGenRecPointsOffset)->Fill(iIts);
559 fAliITSQADataMakerRec->GetRecPointsData(12 +fGenRecPointsOffset)->Fill(cluster->GetDetLocalX());
560 fAliITSQADataMakerRec->GetRecPointsData(13 +fGenRecPointsOffset)->Fill(cluster->GetDetLocalZ());
561 fAliITSQADataMakerRec->GetRecPointsData(14 +fGenRecPointsOffset)->Fill(cluGlo[0]);
562 fAliITSQADataMakerRec->GetRecPointsData(15 +fGenRecPointsOffset)->Fill(cluGlo[1]);
563 fAliITSQADataMakerRec->GetRecPointsData(16 +fGenRecPointsOffset)->Fill(cluGlo[2]);
564 fAliITSQADataMakerRec->GetRecPointsData(17 +fGenRecPointsOffset)->Fill(rad);
565 fAliITSQADataMakerRec->GetRecPointsData(18 +fGenRecPointsOffset)->Fill(phi);
566 fAliITSQADataMakerRec->GetRecPointsData(19 +fGenRecPointsOffset)->Fill(cluster->GetNz(),cluster->GetNy());
567 fAliITSQADataMakerRec->GetRecPointsData(20 +fGenRecPointsOffset)->Fill(cluGlo[2],phi);
096292ae 568 }
7a0e5776 569 fAliITSQADataMakerRec->GetRecPointsData(21 +fGenRecPointsOffset)->Fill(rad,phi);
570 fAliITSQADataMakerRec->GetRecPointsData(22 +fGenRecPointsOffset)->Fill(cluGlo[0],cluGlo[1]);
3647765c 571
096292ae 572 nClusters[lay]++;
3647765c 573 } // end of cluster loop
574 } // end of its "subdetector" loop
575
576 for (Int_t iLay=0; iLay<2; iLay++)
7a0e5776 577 fAliITSQADataMakerRec->GetRecPointsData(23+iLay +fGenRecPointsOffset)->Fill(nClusters[iLay]);
3647765c 578
7a0e5776 579 fAliITSQADataMakerRec->GetRecPointsData(25 +fGenRecPointsOffset)->Fill(nClusters[0],nClusters[1]);
3647765c 580
581 statITSCluster.Clear();
eca4fa66 582 return rv ;
096292ae 583}
7a0e5776 584
585
586
587//_______________________________________________________________
588
4e25ac79 589Int_t AliITSQASPDDataMakerRec::GetOffset(AliQAv1::TASKINDEX_t task) {
7a0e5776 590 // Returns offset number according to the specified task
591 Int_t offset=0;
4e25ac79 592 if( task == AliQAv1::kRAWS ) {
7a0e5776 593 offset=fGenRawsOffset;
594 }
eca4fa66 595 else if( task == AliQAv1::kDIGITSR ) {
596 offset=fGenDigitsOffset;
597 }
4e25ac79 598 else if( task == AliQAv1::kRECPOINTS ) {
7a0e5776 599 offset=fGenRecPointsOffset;
600 }
33626263 601 else if( task == AliQAv1::kDIGITS ) {
602 offset=fGenDigitsOffset;
603 }
7a0e5776 604 else {
605 AliInfo("No task has been selected. Offset set to zero.\n");
606 }
607
608 return offset;
609}
610
611//_______________________________________________________________
612
eca4fa66 613void AliITSQASPDDataMakerRec::SetOffset(AliQAv1::TASKINDEX_t task, Int_t offset) {
614 // Returns offset number according to the specified task
615 if( task == AliQAv1::kRAWS ) {
616 fGenRawsOffset=offset;
617 }
618 else if( task == AliQAv1::kDIGITSR ) {
619 fGenDigitsOffset=offset;
620 }
621 else if( task == AliQAv1::kRECPOINTS ) {
622 fGenRecPointsOffset=offset;
623 }
624 else {
625 AliInfo("No task has been selected. Offset set to zero.\n");
626 }
627}
628
629//_______________________________________________________________
630
4e25ac79 631Int_t AliITSQASPDDataMakerRec::GetTaskHisto(AliQAv1::TASKINDEX_t task) {
7a0e5776 632 // Returns the number of histograms associated to the specified task
eca4fa66 633
7a0e5776 634 Int_t histotot=0;
635
4e25ac79 636 if( task == AliQAv1::kRAWS ) {
7a0e5776 637 histotot=fSPDhRawsTask;
638 }
eca4fa66 639 else if( task == AliQAv1::kDIGITSR ) {
640 histotot=fSPDhDigitsTask;
641 }
4e25ac79 642 else if( task == AliQAv1::kRECPOINTS ){
7a0e5776 643 histotot=fSPDhRecPointsTask;
644 }
33626263 645 else if( task == AliQAv1::kDIGITS ){
646 histotot=fSPDhDigitsTask;
647 }
7a0e5776 648 else {
649 AliInfo("No task has been selected. TaskHisto set to zero.\n");
650 }
7a0e5776 651}