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