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