]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSQASPDDataMakerRec.cxx
AliTPCcalibCalib.cxx - use also alignmnet - not implemented yet
[u/mrichter/AliRoot.git] / ITS / AliITSQASPDDataMakerRec.cxx
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  **************************************************************************/
15 /* $Id$  */
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"
38 #include "AliQAv1.h"
39 #include "AliRawReader.h"
40 #include "AliITSRawStreamSPD.h"
41 #include "AliITSRawStreamSPDErrorLog.h"
42 #include "AliITSdigitSPD.h"
43 #include "AliITSRecPoint.h"
44 #include "AliITSRecPointContainer.h"
45
46 ClassImp(AliITSQASPDDataMakerRec)
47
48 //____________________________________________________________________________
49 AliITSQASPDDataMakerRec::AliITSQASPDDataMakerRec(AliITSQADataMakerRec *aliITSQADataMakerRec, Bool_t kMode, Short_t ldc, AliITSRawStreamSPDErrorLog *aliITSRawStreamSPDErrorLog) :
50 TObject(),
51 fAliITSQADataMakerRec(aliITSQADataMakerRec),
52 fkOnline(kMode),
53 fLDC(ldc),
54 fSPDhRawsTask(0),
55 fSPDhDigitsTask(0),
56 fSPDhRecPointsTask(0),
57 fGenRawsOffset(0),
58 fGenDigitsOffset(0),
59 fGenRecPointsOffset(0),
60 fAdvLogger(aliITSRawStreamSPDErrorLog) 
61 {
62   //ctor used to discriminate OnLine-Offline analysis  
63   //AliInfo(Form("AliRecoParam::kNSpecies %d\n",AliRecoParam::kNSpecies));
64         fGenRawsOffset = new Int_t[AliRecoParam::kNSpecies];
65         fGenRecPointsOffset = new Int_t[AliRecoParam::kNSpecies];
66         fGenDigitsOffset = new Int_t[AliRecoParam::kNSpecies];
67         for(Int_t i=0; i<AliRecoParam::kNSpecies;i++) {
68                 fGenRawsOffset[i] = 0;
69                 fGenRecPointsOffset[i] = 0;
70                 fGenDigitsOffset[i]=0;
71         }
72 }
73
74 //____________________________________________________________________________ 
75 AliITSQASPDDataMakerRec::AliITSQASPDDataMakerRec(const AliITSQASPDDataMakerRec& qadm) :
76 TObject(),
77 fAliITSQADataMakerRec(qadm.fAliITSQADataMakerRec),
78 fkOnline(qadm.fkOnline),
79 fLDC(qadm.fLDC),
80 fSPDhRawsTask(qadm.fSPDhRawsTask),
81 fSPDhDigitsTask(qadm.fSPDhDigitsTask),
82 fSPDhRecPointsTask(qadm.fSPDhRecPointsTask),
83 fGenRawsOffset(qadm.fGenRawsOffset),
84 fGenDigitsOffset(qadm.fGenDigitsOffset),
85 fGenRecPointsOffset(qadm.fGenRecPointsOffset),
86 fAdvLogger(qadm.fAdvLogger)
87 {
88   //copy ctor 
89   fAliITSQADataMakerRec->SetName((const char*)qadm.fAliITSQADataMakerRec->GetName()) ; 
90   fAliITSQADataMakerRec->SetTitle((const char*)qadm.fAliITSQADataMakerRec->GetTitle());
91   }
92
93 //__________________________________________________________________
94 AliITSQASPDDataMakerRec::~AliITSQASPDDataMakerRec(){
95   // destructor
96 //  delete fAdvLogger;
97 }
98 //__________________________________________________________________
99
100 AliITSQASPDDataMakerRec& AliITSQASPDDataMakerRec::operator = (const AliITSQASPDDataMakerRec& qac )
101 {
102   // Equal operator.
103   this->~AliITSQASPDDataMakerRec();
104   new(this) AliITSQASPDDataMakerRec(qac);
105   return *this;
106 }
107
108 //____________________________________________________________________________ 
109 void AliITSQASPDDataMakerRec::StartOfDetectorCycle()
110 {
111   //Detector specific actions at start of cycle
112   AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of SPD Cycle\n");
113 }
114
115 //____________________________________________________________________________ 
116 void AliITSQASPDDataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t /*task*/, TObjArray* /*list*/)
117 {
118   // launch the QA checking
119   AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n"); 
120   
121   //AliQAChecker::Instance()->Run( AliQAv1::kITS , task, list);
122 }
123
124 //____________________________________________________________________________ 
125 Int_t AliITSQASPDDataMakerRec::InitRaws()
126
127   // Initialization for RAW data - SPD -
128   const Bool_t expert   = kTRUE ; 
129   const Bool_t saveCorr = kTRUE ; 
130   const Bool_t image    = kTRUE ; 
131   Int_t rv = 0 ; 
132 //  fGenRawsOffset = (fAliITSQADataMakerRec->fRawsQAList[AliRecoParam::kDefault])->GetEntries();
133   if(!fAdvLogger) fAdvLogger = new AliITSRawStreamSPDErrorLog();  
134   AliDebug(AliQAv1::GetQADebugLevel(), "Book Offline Histograms for SPD\n ");
135
136   Char_t name[50];
137   Char_t title[50];
138
139   TH1F *hlayer = new TH1F("SPDLayPattern_SPD","Layer map - SPD",6,0.,6.);
140   hlayer->GetXaxis()->SetTitle("Layer number");
141   hlayer->GetYaxis()->SetTitle("Entries");
142   rv = fAliITSQADataMakerRec->Add2RawsList(hlayer, 0+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
143   fSPDhRawsTask++;
144
145   TH1F **hmod = new TH1F*[2];
146   TH2F **hhitMap = new TH2F*[20];
147   TH1F **herrors = new TH1F*[20];
148   for (Int_t iLay=0; iLay<2; iLay++) {
149     sprintf(name,"SPDModPattern_SPD%d",iLay+1);
150     sprintf(title,"Module map - SPD Layer %d",iLay+1);
151     hmod[iLay]=new TH1F(name,title,fgknSPDmodules,0,fgknSPDmodules);
152     hmod[iLay]->GetXaxis()->SetTitle("Module number");
153     hmod[iLay]->GetYaxis()->SetTitle("Entries");
154     rv = fAliITSQADataMakerRec->Add2RawsList(hmod[iLay], 1+iLay+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
155     fSPDhRawsTask++;
156   }
157
158   TH2F *hHitMapHalfStaveChipSideA 
159      = new TH2F("SPDHitMapHalfStaveChipSideA_SPD","Hit map per HalfStave per Chip Side A - SPD",60,0.,60.,10,0.,10.);
160   hHitMapHalfStaveChipSideA->GetXaxis()->SetTitle("HalfStave");
161   hHitMapHalfStaveChipSideA->GetYaxis()->SetTitle("Chip");
162   rv = fAliITSQADataMakerRec->Add2RawsList(hHitMapHalfStaveChipSideA, 3+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
163   fSPDhRawsTask++;
164
165   TH2F *hHitMapHalfStaveChipSideC 
166      = new TH2F("SPDHitMapHalfStaveChipSideC_SPD","Hit map per HalfStave per Chip Side C - SPD",60,0.,60.,10,0.,10.);
167   hHitMapHalfStaveChipSideC->GetXaxis()->SetTitle("HalfStave");
168   hHitMapHalfStaveChipSideC->GetYaxis()->SetTitle("Chip");
169   rv = fAliITSQADataMakerRec->Add2RawsList(hHitMapHalfStaveChipSideC, 4+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
170   fSPDhRawsTask++;
171
172   TH1F *herrorsAll = new TH1F("SPDErrorsAll_SPD","Error codes - SPD",20,0.,20.);
173   herrorsAll->GetXaxis()->SetTitle("DDL");
174   herrorsAll->GetYaxis()->SetTitle("Entries");
175   rv = fAliITSQADataMakerRec->Add2RawsList(herrorsAll, 5+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, !saveCorr);
176   fSPDhRawsTask++;
177
178   for (Int_t iDDL=0; iDDL<20; iDDL++) {
179     sprintf(name,"SPDHitMap_SPD_DDL%d",iDDL+1);
180     sprintf(title,"Hit map - SPD DDL %d",iDDL+1);
181     hhitMap[iDDL]=new TH2F(name,title,320,0,10*32,1536,0,6*256);
182     hhitMap[iDDL]->GetXaxis()->SetTitle("Column");
183     hhitMap[iDDL]->GetYaxis()->SetTitle("Row");
184     rv = fAliITSQADataMakerRec->Add2RawsList(hhitMap[iDDL], 6+(2*iDDL)+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
185     fSPDhRawsTask++;
186     sprintf(name,"SPDErrors_SPD_DDL%d",iDDL+1);
187     sprintf(title,"Error codes - SPD DDL %d",iDDL+1);
188     herrors[iDDL] = new TH1F (name,title,fAdvLogger->GetNrErrorCodes(),0,fAdvLogger->GetNrErrorCodes());
189     herrors[iDDL]->SetXTitle("Error Code");
190     herrors[iDDL]->SetYTitle("Nr of errors");
191     rv = fAliITSQADataMakerRec->Add2RawsList(herrors[iDDL], 7+(2*iDDL)+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
192     fSPDhRawsTask++;
193   }
194
195   TH1F** hMultSPDhits = new TH1F*[2];
196   for (Int_t iLay=0; iLay<2; iLay++) {
197     sprintf(name,"SPDHitsMultiplicity_SPD%d",iLay+1);
198     sprintf(title,"Hit multiplicity - SPD Layer %d",iLay+1);
199     hMultSPDhits[iLay]=new TH1F(name,title,200,0.,200.);
200     hMultSPDhits[iLay]->GetXaxis()->SetTitle("Hit multiplicity");
201     hMultSPDhits[iLay]->GetYaxis()->SetTitle("Entries");
202     rv = fAliITSQADataMakerRec->Add2RawsList(hMultSPDhits[iLay], 46+iLay+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
203     fSPDhRawsTask++;
204   }
205
206   TH2F *hMultSPDhits2MultSPDhits1 
207          = new TH2F("SPDHitMultCorrelation_SPD","Hit multiplicity correlation - SPD",200,0.,200.,200,0.,200.);
208   hMultSPDhits2MultSPDhits1->GetXaxis()->SetTitle("Hit multiplicity (Layer 1)");
209   hMultSPDhits2MultSPDhits1->GetYaxis()->SetTitle("Hit multiplicity (Layer 2)");
210   rv = fAliITSQADataMakerRec->Add2RawsList(hMultSPDhits2MultSPDhits1, 48+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, !saveCorr);
211   fSPDhRawsTask++;
212
213   TH2F *hFastOrMapHalfStaveChip 
214          = new TH2F("SPDFastOrMapHalfStaveChip_SPD","FastOr map per HalfStave per Chip - SPD",120,0.,120.,10,0.,10.);
215   hFastOrMapHalfStaveChip->GetXaxis()->SetTitle("HalfStave");
216   hFastOrMapHalfStaveChip->GetYaxis()->SetTitle("Chip");
217   rv = fAliITSQADataMakerRec->Add2RawsList(hFastOrMapHalfStaveChip, 49+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, !saveCorr);
218   fSPDhRawsTask++;
219
220   TH1F *hFastOrFiredMap = new TH1F("SPDFastOrPattern_SPD","FastOrFiredChip map - SPD",1200,0.,1200.);
221   hFastOrFiredMap->GetXaxis()->SetTitle("Chip number");
222   hFastOrFiredMap->GetYaxis()->SetTitle("Entries");
223   rv = fAliITSQADataMakerRec->Add2RawsList(hFastOrFiredMap, 50+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
224   fSPDhRawsTask++;
225
226   TH2F *hHitMapHalfStaveChipInner 
227      = new TH2F("SPDHitMapHalfStaveChipInner_SPD","Hit map per HalfStave per Chip Inner - SPD",20,0.,20.,20,0.,20.);
228   hHitMapHalfStaveChipInner->GetXaxis()->SetTitle("Chip");
229   hHitMapHalfStaveChipInner->GetYaxis()->SetTitle("HalfStave");
230   rv = fAliITSQADataMakerRec->Add2RawsList(hHitMapHalfStaveChipInner, 51+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, !saveCorr);
231   fSPDhRawsTask++;
232
233   TH2F *hHitMapHalfStaveChipOuter 
234      = new TH2F("SPDHitMapHalfStaveChipOuter_SPD","Hit map per HalfStave per Chip Outer - SPD",20,0.,20.,40,0.,40.);
235   hHitMapHalfStaveChipOuter->GetXaxis()->SetTitle("Chip");
236   hHitMapHalfStaveChipOuter->GetYaxis()->SetTitle("HalfStave");
237   rv = fAliITSQADataMakerRec->Add2RawsList(hHitMapHalfStaveChipOuter, 52+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, !saveCorr);
238   fSPDhRawsTask++;
239
240   TH1F *hHitMapChipInnerZ = new TH1F("SPDHitMapChipInnerZ_SPD","Hit map per ChipZ Inner - SPD",20,0.,20.);
241   hHitMapChipInnerZ->GetXaxis()->SetTitle("Chip");
242   hHitMapChipInnerZ->GetYaxis()->SetTitle("Entries");
243   rv = fAliITSQADataMakerRec->Add2RawsList(hHitMapChipInnerZ, 53+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, !saveCorr);
244   fSPDhRawsTask++;
245
246   TH1F *hHitMapChipOuterZ = new TH1F("SPDHitMapChipOuterZ_SPD","Hit map per ChipZ Outer - SPD",20,0.,20.);
247   hHitMapChipOuterZ->GetXaxis()->SetTitle("Chip");
248   hHitMapChipOuterZ->GetYaxis()->SetTitle("Entries");
249   rv = fAliITSQADataMakerRec->Add2RawsList(hHitMapChipOuterZ, 54+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, !saveCorr);
250   fSPDhRawsTask++;
251
252   TH1F *hHitMapHalfStaveInnerPhi = new TH1F("SPDHitMapChipInnerPhi_SPD","Hit map per HalfStavePhi Inner - SPD",20,0.,20.);
253   hHitMapHalfStaveInnerPhi->GetXaxis()->SetTitle("HalfStave");
254   hHitMapHalfStaveInnerPhi->GetYaxis()->SetTitle("Entries");
255   rv = fAliITSQADataMakerRec->Add2RawsList(hHitMapHalfStaveInnerPhi, 55+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, !saveCorr);
256   fSPDhRawsTask++;
257
258   TH1F *hHitMapHalfStaveOuterPhi = new TH1F("SPDHitMapChipOuterPhi_SPD","Hit map per HalfStavePhi Outer - SPD",40,0.,40.);
259   hHitMapHalfStaveOuterPhi->GetXaxis()->SetTitle("HalfStave");
260   hHitMapHalfStaveOuterPhi->GetYaxis()->SetTitle("Entries");
261   rv = fAliITSQADataMakerRec->Add2RawsList(hHitMapHalfStaveOuterPhi, 56+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, !saveCorr);
262   fSPDhRawsTask++;
263
264   TH1F *hFastOrFiredChips = new TH1F("SPDFastOrFiredChips_SPD","FastOrFiredChips - SPD",20,0.,20.);
265   hFastOrFiredChips->GetXaxis()->SetTitle("DDL");
266   hFastOrFiredChips->GetYaxis()->SetTitle("nFastOrFiredChips");
267   rv = fAliITSQADataMakerRec->Add2RawsList(hFastOrFiredChips, 57+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
268   fSPDhRawsTask++;
269
270   TH1F *hFiredChips = new TH1F("SPDFiredChips_SPD","FiredChips - SPD",20,0.,20.);
271   hFiredChips->GetXaxis()->SetTitle("DDL");
272   hFiredChips->GetYaxis()->SetTitle("nFiredChips");
273   rv = fAliITSQADataMakerRec->Add2RawsList(hFiredChips, 58+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
274   fSPDhRawsTask++;
275
276   TH1F *hFastOrEff = new TH1F("SPDFastOrEff_SPD","FastOr efficiency - SPD",20,0.,20.);
277   hFastOrEff->GetXaxis()->SetTitle("DDL");
278   hFastOrEff->GetYaxis()->SetTitle("Efficiency");
279   rv = fAliITSQADataMakerRec->Add2RawsList(hFastOrEff, 59+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, !saveCorr);
280   fSPDhRawsTask++;
281
282   AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SPD Raws histograms booked\n",fSPDhRawsTask));
283   return rv ; 
284 }
285
286 //____________________________________________________________________________
287 Int_t AliITSQASPDDataMakerRec::MakeRaws(AliRawReader* rawReader)
288
289   // Fill QA for RAW - SPD -
290   Int_t rv = 0 ; 
291   
292   rawReader->Reset();
293   AliITSRawStreamSPD rawStreamSPD(rawReader);
294   rawStreamSPD.ActivateAdvancedErrorLog(kTRUE,fAdvLogger);
295
296   Int_t nDigitsL1 = 0;
297   Int_t nDigitsL2 = 0;
298   Int_t iEq;
299   Int_t iLayer;
300   Int_t iHalfStave, iChip;
301   Int_t chipKey;
302   Int_t col, row; 
303   UInt_t module, colM, rowM;
304   Bool_t isFiredChip[1200];
305   for(Int_t ichK=0; ichK<1200; ichK++) isFiredChip[ichK] = kFALSE;
306
307   while(rawStreamSPD.Next()) {
308
309     iEq = rawReader->GetDDLID();
310     if (iEq>=0 && iEq<20) {
311       iHalfStave = rawStreamSPD.GetHalfStaveNr();
312       iChip = rawStreamSPD.GetChipAddr();
313       col  = rawStreamSPD.GetChipCol();
314       row  = rawStreamSPD.GetChipRow();
315
316       chipKey = rawStreamSPD.GetOfflineChipKeyFromOnline(iEq,iHalfStave,iChip);
317       isFiredChip[chipKey] = kTRUE;
318
319       rawStreamSPD.OnlineToOffline(iEq, iHalfStave, iChip, col, row, module, colM, rowM);
320
321       if (iHalfStave>=0 && iHalfStave<2) iLayer=0;
322       else iLayer=1;
323       
324       fAliITSQADataMakerRec->GetRawsData(0+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iLayer);
325       if (iLayer==0) {
326         fAliITSQADataMakerRec->GetRawsData(1+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(module);
327         nDigitsL1++;
328       } else {
329         fAliITSQADataMakerRec->GetRawsData(2+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(module);
330         nDigitsL2++;
331       }
332       
333       if(iEq<10) {
334          fAliITSQADataMakerRec->GetRawsData(3+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iHalfStave+iEq*6,iChip);
335       } 
336       else       {
337          fAliITSQADataMakerRec->GetRawsData(4+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iHalfStave+(iEq-10)*6,iChip);
338       }
339
340       if(iLayer==0) {
341          if(iEq<10)  { 
342             fAliITSQADataMakerRec->GetRawsData(51+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(19-iChip,1-iHalfStave+iEq*2);
343             fAliITSQADataMakerRec->GetRawsData(53+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(19-iChip);
344             fAliITSQADataMakerRec->GetRawsData(55+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(1-iHalfStave+iEq*2);
345          }
346          else {
347             fAliITSQADataMakerRec->GetRawsData(51+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iChip,1-iHalfStave+(iEq-10)*2);
348             fAliITSQADataMakerRec->GetRawsData(53+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iChip);
349             fAliITSQADataMakerRec->GetRawsData(55+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(1-iHalfStave+(iEq-10)*2);
350          }
351       }
352       else         {   
353          if(iEq<10)  { 
354             fAliITSQADataMakerRec->GetRawsData(52+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(19-iChip,iHalfStave-2+iEq*4);
355             fAliITSQADataMakerRec->GetRawsData(54+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(19-iChip);
356             fAliITSQADataMakerRec->GetRawsData(56+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iHalfStave-2+iEq*4);
357          }
358          else {
359             fAliITSQADataMakerRec->GetRawsData(52+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iChip,iHalfStave-2+(iEq-10)*4);
360             fAliITSQADataMakerRec->GetRawsData(54+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iChip);
361             fAliITSQADataMakerRec->GetRawsData(56+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iHalfStave-2+(iEq-10)*4);
362          }
363       }
364       fAliITSQADataMakerRec->GetRawsData(6+(2*iEq)+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(colM+(module%2)*160,rowM+iHalfStave*256);
365     }
366   }
367
368   UInt_t nErrorsDDL[20];
369   UInt_t nFiredChipsDDL[20];
370   UInt_t nFastOrFiredChipsDDL[20];
371   for (Int_t ieq=0; ieq<20; ieq++) {
372     nErrorsDDL[ieq] = 0;
373     nFiredChipsDDL[ieq] = 0;
374     nFastOrFiredChipsDDL[ieq] = 0;
375     for (UInt_t ierr=0; ierr<fAdvLogger->GetNrErrorCodes(); ierr++) {
376       fAliITSQADataMakerRec->GetRawsData(7+(2*ieq)+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(ierr,fAdvLogger->GetNrErrors(ierr,ieq));
377       if(ierr>0) nErrorsDDL[ieq] = nErrorsDDL[ieq] + fAdvLogger->GetNrErrors(ierr,ieq);   
378     }  
379     fAliITSQADataMakerRec->GetRawsData(5+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(ieq,nErrorsDDL[ieq]);
380
381     for (Int_t ihs=0; ihs<6; ihs++) {
382       for (Int_t ichip=0; ichip<10; ichip++) {
383         chipKey = rawStreamSPD.GetOfflineChipKeyFromOnline(ieq,ihs,ichip);
384         if(isFiredChip[chipKey]) nFiredChipsDDL[ieq]++;
385         if(rawStreamSPD.GetFastOrSignal(ieq,ihs,ichip)) {
386           nFastOrFiredChipsDDL[ieq]++;
387           fAliITSQADataMakerRec->GetRawsData(49+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(ihs+ieq*6,ichip);
388           fAliITSQADataMakerRec->GetRawsData(50+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(chipKey);
389         }
390       }
391     } 
392     fAliITSQADataMakerRec->GetRawsData(57+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(ieq,nFastOrFiredChipsDDL[ieq]);
393     fAliITSQADataMakerRec->GetRawsData(58+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(ieq,nFiredChipsDDL[ieq]);
394     fAliITSQADataMakerRec->GetRawsData(59+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Divide(fAliITSQADataMakerRec->GetRawsData(57+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()]),fAliITSQADataMakerRec->GetRawsData(58+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()]));
395   }
396
397   fAdvLogger->Reset();
398   fAliITSQADataMakerRec->GetRawsData(46+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(nDigitsL1);
399   fAliITSQADataMakerRec->GetRawsData(47+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(nDigitsL2);
400   fAliITSQADataMakerRec->GetRawsData(48+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(nDigitsL1,nDigitsL2);
401   
402   AliDebug(AliQAv1::GetQADebugLevel(),Form("Event completed, %d raw digits read",nDigitsL1+nDigitsL2));
403   return rv ; 
404 }
405
406 //____________________________________________________________________________ 
407 Int_t AliITSQASPDDataMakerRec::InitDigits()
408
409   // Initialization for DIGIT data - SPD -
410   const Bool_t expert   = kTRUE ; 
411   const Bool_t image    = kTRUE ;
412   Int_t rv = 0 ; 
413 //  fGenDigitsOffset = (fAliITSQADataMakerRec->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();
414   //fSPDhDigitsTask must be incremented by one unit every time a histogram is ADDED to the QA List
415   
416   Char_t name[50];
417   Char_t title[50];
418   
419   TH1F *hlayer = new TH1F("SPDLayPattern_SPD","Layer map - SPD",6,0.,6.);
420   hlayer->GetXaxis()->SetTitle("Layer number");
421   hlayer->GetYaxis()->SetTitle("Entries");
422   rv = fAliITSQADataMakerRec->Add2DigitsList(hlayer,fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
423   fSPDhDigitsTask++;
424   
425   TH1F **hmod = new TH1F*[2];
426   for (Int_t iLay=0; iLay<2; iLay++) {
427     sprintf(name,"SPDModPattern_SPD%d",iLay+1);
428     sprintf(title,"Module map - SPD Layer %d",iLay+1);
429     hmod[iLay]=new TH1F(name,title,240,0,240);
430     hmod[iLay]->GetXaxis()->SetTitle("Module number");
431     hmod[iLay]->GetYaxis()->SetTitle("Entries");
432     rv = fAliITSQADataMakerRec->Add2DigitsList(hmod[iLay],1+iLay+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
433     fSPDhDigitsTask++;
434   }
435   
436   TH1F *hcolumns = new TH1F("SPDColumns_SPD","Columns - SPD",160,0.,160.);
437   hcolumns->GetXaxis()->SetTitle("Column number");
438   hcolumns->GetYaxis()->SetTitle("Entries");
439   rv = fAliITSQADataMakerRec->Add2DigitsList(hcolumns,3+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
440   fSPDhDigitsTask++;
441   
442   TH1F *hrows = new TH1F("SPDRows_SPD","Rows - SPD",256,0.,256.);
443   hrows->GetXaxis()->SetTitle("Row number");
444   hrows->GetYaxis()->SetTitle("Entries");
445   rv = fAliITSQADataMakerRec->Add2DigitsList(hrows,4+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
446   fSPDhDigitsTask++;
447   
448   TH1F** hMultSPDdigits = new TH1F*[2];
449   for (Int_t iLay=0; iLay<2; ++iLay) {
450     sprintf(name,"SPDDigitMultiplicity_SPD%d",iLay+1);
451     sprintf(title,"Digit multiplicity - SPD Layer %d",iLay+1);
452     hMultSPDdigits[iLay]=new TH1F(name,title,200,0.,200.);
453     hMultSPDdigits[iLay]->GetXaxis()->SetTitle("Digit multiplicity");
454     hMultSPDdigits[iLay]->GetYaxis()->SetTitle("Entries");
455     rv = fAliITSQADataMakerRec->Add2DigitsList(hMultSPDdigits[iLay], 5+iLay+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
456     fSPDhDigitsTask++;
457   }
458   
459   TH2F *hMultSPDdig2MultSPDdig1 
460     = new TH2F("SPDDigitMultCorrelation_SPD","Digit multiplicity correlation - SPD",200,0.,200.,200,0.,200.);
461   hMultSPDdig2MultSPDdig1->GetXaxis()->SetTitle("Digit multiplicity (Layer 1)");
462   hMultSPDdig2MultSPDdig1->GetYaxis()->SetTitle("Digit multiplicity (Layer 2)");
463   rv = fAliITSQADataMakerRec->Add2DigitsList(hMultSPDdig2MultSPDdig1,7+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
464   fSPDhDigitsTask++;
465   
466   AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SPD Digits histograms booked\n",fSPDhDigitsTask));
467   return rv ; 
468 }
469
470 //____________________________________________________________________________
471 Int_t AliITSQASPDDataMakerRec::MakeDigits(TTree *digits)
472
473   // Fill QA for DIGIT - SPD -
474   Int_t rv = 0 ; 
475
476 //  AliITS *fITS  = (AliITS*)gAlice->GetModule("ITS");
477 //  fITS->SetTreeAddress();
478 //  TClonesArray *iITSdigits  = fITS->DigitsAddress(0);  // 0->SPD
479   TBranch *branchD = digits->GetBranch("ITSDigitsSPD");
480   if (!branchD) { 
481     AliError("can't get the branch with the SPD ITS digits !");
482     return rv;
483   }
484   static TClonesArray statDigits("AliITSdigitSPD");
485   TClonesArray *iITSdigits = &statDigits;
486   branchD->SetAddress(&iITSdigits);  
487   Int_t nDigitsL1=0;
488   Int_t nDigitsL2=0;
489   
490   for (Int_t imod=0; imod<240; ++imod){
491     digits->GetEvent(imod);
492     Int_t ndigits = iITSdigits->GetEntries();
493     if (imod<80) {
494       fAliITSQADataMakerRec->GetDigitsData(0+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(0.5,ndigits);
495       fAliITSQADataMakerRec->GetDigitsData(1+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(imod,ndigits);
496       nDigitsL1+=ndigits;
497     }
498     else {
499       fAliITSQADataMakerRec->GetDigitsData(0+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(1,ndigits);
500       fAliITSQADataMakerRec->GetDigitsData(2+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(imod,ndigits);
501       nDigitsL2+=ndigits;
502     }
503     for (Int_t idig=0; idig<ndigits; ++idig) {
504       AliITSdigit *dig=(AliITSdigit*)iITSdigits->UncheckedAt(idig);
505       Int_t col=dig->GetCoord1();  // cell number z
506       Int_t row=dig->GetCoord2();  // cell number x
507       fAliITSQADataMakerRec->GetDigitsData(3+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(col);
508       fAliITSQADataMakerRec->GetDigitsData(4+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(row);
509     }
510   }
511   fAliITSQADataMakerRec->GetDigitsData(5+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(nDigitsL1);
512   fAliITSQADataMakerRec->GetDigitsData(6+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(nDigitsL2);
513   fAliITSQADataMakerRec->GetDigitsData(7+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(nDigitsL1,nDigitsL2);
514   return rv ; 
515 }
516
517 //____________________________________________________________________________ 
518 Int_t AliITSQASPDDataMakerRec::InitRecPoints()
519 {
520   // Initialization for RECPOINTS - SPD -
521   const Bool_t expert   = kTRUE ; 
522   const Bool_t image    = kTRUE ; 
523   Int_t rv = 0 ; 
524   //AliInfo(Form("fAliITSQADataMakerRec->GetEventSpecie() %d\n",fAliITSQADataMakerRec->GetEventSpecie()));
525   //AliInfo(Form("fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()] %d\n",fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()]));
526 //  fGenRecPointsOffset = (fAliITSQADataMakerRec->fRecPointsQAList[AliRecoParam::kDefault])->GetEntries();
527   TH1F* hlayer= new TH1F("SPDLayPattern_SPD","Layer map - SPD",6,0.,6.);
528   hlayer->GetXaxis()->SetTitle("Layer number");
529   hlayer->GetYaxis()->SetTitle("Entries");
530   rv = fAliITSQADataMakerRec->Add2RecPointsList(hlayer, 0+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image); 
531   fSPDhRecPointsTask++;
532
533   TH1F** hmod = new TH1F*[2];
534   TH1F** hxl  = new TH1F*[2];
535   TH1F** hzl  = new TH1F*[2];
536   TH1F** hxg  = new TH1F*[2];
537   TH1F** hyg  = new TH1F*[2];
538   TH1F** hzg  = new TH1F*[2];
539   TH1F** hr   = new TH1F*[2];
540   TH1F** hphi = new TH1F*[2];
541   TH1F** hMultSPDcl = new TH1F*[2];
542   TH2F** hNyNz    = new TH2F*[2];  // y and z cluster length
543   TH1F** hNpixels = new TH1F*[2];  // cluster size in number of pixels
544   TH1F** hType    = new TH1F*[2];  // cluster type according to conventional table
545   TH2F** hPhiZ    = new TH2F*[2];
546
547   Float_t xlim[2]={4.5,8.};
548   Float_t zlim[2]={15.,15.};
549
550   Char_t name[50];
551   Char_t title[50];
552   for (Int_t iLay=0;iLay<2;iLay++) {
553     sprintf(name,"SPDModPattern_SPD%d",iLay+1);
554     sprintf(title,"Module map - SPD Layer %d",iLay+1);
555     hmod[iLay]=new TH1F(name,title,fgknSPDmodules,0,fgknSPDmodules);
556     hmod[iLay]->GetXaxis()->SetTitle("Module number");
557     hmod[iLay]->GetYaxis()->SetTitle("Entries");
558     rv = fAliITSQADataMakerRec->Add2RecPointsList(hmod[iLay], 1+(12*iLay)+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image); 
559     fSPDhRecPointsTask++;
560
561     sprintf(name,"SPDxLoc_SPD%d",iLay+1);
562     sprintf(title,"Local x coordinate - SPD Layer %d",iLay+1);
563     hxl[iLay]=new TH1F(name,title,100,-4.,4.);
564     hxl[iLay]->GetXaxis()->SetTitle("Local x [cm]");
565     hxl[iLay]->GetYaxis()->SetTitle("Entries");
566     rv = fAliITSQADataMakerRec->Add2RecPointsList(hxl[iLay], 2+(12*iLay)+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
567     fSPDhRecPointsTask++;
568
569     sprintf(name,"SPDzLoc_SPD%d",iLay+1);
570     sprintf(title,"Local z coordinate - SPD Layer %d",iLay+1);
571     hzl[iLay]=new TH1F(name,title,100,-4.,4.);
572     hzl[iLay]->GetXaxis()->SetTitle("Local z [cm]");
573     hzl[iLay]->GetYaxis()->SetTitle("Entries");
574     rv = fAliITSQADataMakerRec->Add2RecPointsList(hzl[iLay], 3+(12*iLay)+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image); 
575     fSPDhRecPointsTask++;
576
577     sprintf(name,"SPDxGlob_SPD%d",iLay+1);
578     sprintf(title,"Global x coordinate - SPD Layer %d",iLay+1);
579     hxg[iLay]=new TH1F(name,title,100,-xlim[iLay],xlim[iLay]);
580     hxg[iLay]->GetXaxis()->SetTitle("Global x [cm]");
581     hxg[iLay]->GetYaxis()->SetTitle("Entries");
582     rv = fAliITSQADataMakerRec->Add2RecPointsList(hxg[iLay],4+(12*iLay)+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);  
583     fSPDhRecPointsTask++;
584
585     sprintf(name,"SPDyGlob_SPD%d",iLay+1);
586     sprintf(title,"Global y coordinate - SPD Layer %d",iLay+1);
587     hyg[iLay]=new TH1F(name,title,100,-xlim[iLay],xlim[iLay]);
588     hyg[iLay]->GetXaxis()->SetTitle("Global y [cm]");
589     hyg[iLay]->GetYaxis()->SetTitle("Entries");
590     rv = fAliITSQADataMakerRec->Add2RecPointsList(hyg[iLay], 5+(12*iLay)+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image); 
591     fSPDhRecPointsTask++;
592
593     sprintf(name,"SPDzGlob_SPD%d",iLay+1);
594     sprintf(title,"Global z coordinate - SPD Layer %d",iLay+1);
595     hzg[iLay]=new TH1F(name,title,150,-zlim[iLay],zlim[iLay]);
596     hzg[iLay]->GetXaxis()->SetTitle("Global z [cm]");
597     hzg[iLay]->GetYaxis()->SetTitle("Entries");
598     rv = fAliITSQADataMakerRec->Add2RecPointsList(hzg[iLay], 6+(12*iLay)+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image); 
599     fSPDhRecPointsTask++;
600
601     sprintf(name,"SPDr_SPD%d",iLay+1);
602     sprintf(title,"Radius - SPD Layer %d",iLay+1);
603     hr[iLay]=new TH1F(name,title,100,0.,10.);
604     hr[iLay]->GetXaxis()->SetTitle("r [cm]");
605     hr[iLay]->GetYaxis()->SetTitle("Entries");
606     rv = fAliITSQADataMakerRec->Add2RecPointsList(hr[iLay], 7+(12*iLay)+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);  
607     fSPDhRecPointsTask++;
608
609     sprintf(name,"SPDphi_SPD%d",iLay+1);
610     sprintf(title,"#varphi - SPD Layer %d",iLay+1);
611     hphi[iLay]=new TH1F(name,title,1000,0.,2*TMath::Pi());
612     hphi[iLay]->GetXaxis()->SetTitle("#varphi [rad]");
613     hphi[iLay]->GetYaxis()->SetTitle("Entries");
614     rv = fAliITSQADataMakerRec->Add2RecPointsList(hphi[iLay], 8+(12*iLay)+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
615     fSPDhRecPointsTask++;
616     
617     sprintf(name,"SPDSizeYvsZ_SPD%d",iLay+1);
618     sprintf(title,"Cluster dimension - SPD Layer %d",iLay+1);
619     hNyNz[iLay]=new TH2F(name,title,100,0.,100.,100,0.,100.);
620     hNyNz[iLay]->GetXaxis()->SetTitle("z length");
621     hNyNz[iLay]->GetYaxis()->SetTitle("y length");
622     rv = fAliITSQADataMakerRec->Add2RecPointsList(hNyNz[iLay], 9+(12*iLay)+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image); 
623     fSPDhRecPointsTask++;
624
625     sprintf(name,"SPDSizeTot_SPD%d",iLay+1);
626     sprintf(title,"Cluster size - SPD Layer %d",iLay+1);
627     hNpixels[iLay]=new TH1F(name,title,100,0.,100.);
628     hNpixels[iLay]->GetXaxis()->SetTitle("Cluster size");
629     hNpixels[iLay]->GetYaxis()->SetTitle("Entries");
630     rv = fAliITSQADataMakerRec->Add2RecPointsList(hNpixels[iLay], 10+(12*iLay)+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);  
631     fSPDhRecPointsTask++;
632
633     sprintf(name,"SPDType_SPD%d",iLay+1);
634     sprintf(title,"Cluster type - SPD Layer %d",iLay+1);
635     hType[iLay]=new TH1F(name,title,20,0.,20.);
636     hType[iLay]->GetXaxis()->SetTitle("Cluster type");
637     hType[iLay]->GetYaxis()->SetTitle("Entries");
638     rv = fAliITSQADataMakerRec->Add2RecPointsList(hType[iLay], 11+(12*iLay)+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);  
639     fSPDhRecPointsTask++;
640
641     sprintf(name,"SPDphi_z_SPD%d",iLay+1);
642     sprintf(title,"#varphi vs z - SPD Layer %d",iLay+1);
643     hPhiZ[iLay]=new TH2F(name,title,150,-zlim[iLay],zlim[iLay],200,0.,2*TMath::Pi());
644     hPhiZ[iLay]->GetXaxis()->SetTitle("Global z [cm]");
645     hPhiZ[iLay]->GetYaxis()->SetTitle("#varphi [rad]");
646     rv = fAliITSQADataMakerRec->Add2RecPointsList(hPhiZ[iLay], 12+(12*iLay)+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
647     fSPDhRecPointsTask++;
648
649   }
650
651   TH2F *hrPhi=new TH2F("SPDr_phi_SPD","#varphi vs r - SPD",100,0.,10.,100,0.,2*TMath::Pi());
652   hrPhi->GetXaxis()->SetTitle("r [cm]");
653   hrPhi->GetYaxis()->SetTitle("#varphi [rad]");
654   rv = fAliITSQADataMakerRec->Add2RecPointsList(hrPhi, 25+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);
655   fSPDhRecPointsTask++;
656
657   TH2F *hxy=new TH2F("SPDx_y_SPD","Global y vs x - SPD",200,-10.,10.,200,-10.,10.);
658   hxy->GetXaxis()->SetTitle("Global x [cm]");
659   hxy->GetYaxis()->SetTitle("Global y [cm]");
660   rv = fAliITSQADataMakerRec->Add2RecPointsList(hxy, 26+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
661   fSPDhRecPointsTask++;
662
663   for (Int_t iLay=0;iLay<2;iLay++) {
664     sprintf(name,"SPDMultiplicity_SPD%d",iLay+1);
665     sprintf(title,"Cluster multiplicity - SPD Layer %d",iLay+1);
666     hMultSPDcl[iLay]=new TH1F(name,title,200,0.,200.);
667     hMultSPDcl[iLay]->GetXaxis()->SetTitle("Cluster multiplicity");
668     hMultSPDcl[iLay]->GetYaxis()->SetTitle("Entries");
669     rv = fAliITSQADataMakerRec->Add2RecPointsList(hMultSPDcl[iLay], 27+iLay+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
670     fSPDhRecPointsTask++;
671   } 
672
673   TH2F *hMultSPDcl2MultSPDcl1 =
674         new TH2F("SPDMultCorrelation_SPD","Cluster multiplicity correlation - SPD",200,0.,200.,200,0.,200.);
675   hMultSPDcl2MultSPDcl1->GetXaxis()->SetTitle("Clusters multiplicity (Layer 1)");
676   hMultSPDcl2MultSPDcl1->GetYaxis()->SetTitle("Clusters multiplicity (Layer 2)"); 
677   rv = fAliITSQADataMakerRec->Add2RecPointsList(hMultSPDcl2MultSPDcl1, 29+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
678   fSPDhRecPointsTask++;
679
680   AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SPD Recs histograms booked\n",fSPDhRecPointsTask));
681
682   return rv ; 
683 }
684
685 //____________________________________________________________________________ 
686 Int_t AliITSQASPDDataMakerRec::MakeRecPoints(TTree * clusterTree)
687 {
688   // Fill QA for RecPoints - SPD -
689   Int_t rv = 0 ;
690   AliITSRecPointContainer* rpcont=AliITSRecPointContainer::Instance();
691   TClonesArray *recpoints = rpcont->FetchClusters(0,clusterTree);
692   if(!rpcont->GetStatusOK() || !rpcont->IsSPDActive()){
693     AliError("can't get SPD clusters !");
694     return rv;
695   }
696
697   //AliInfo(Form("fAliITSQADataMakerRec->GetEventSpecie() %d\n",fAliITSQADataMakerRec->GetEventSpecie()));
698   //AliInfo(Form("fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()] %d\n",fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()]));
699   Int_t nSPDmod = AliITSgeomTGeo::GetModuleIndex(3,1,1);
700
701   Float_t cluGlo[3] = {0.,0.,0.};
702   Int_t nClusters[2] = {0,0};
703
704   for (Int_t iIts=0; iIts < nSPDmod; iIts++) {
705     recpoints = rpcont->UncheckedGetClusters(iIts);
706     Int_t nCluster = recpoints->GetEntriesFast();
707     if(nCluster == 0)continue;
708     // loop over clusters
709     while(nCluster--) {
710       AliITSRecPoint* cluster =
711                       (AliITSRecPoint*)recpoints->UncheckedAt(nCluster);
712       if (cluster->GetLayer()>1)continue;
713       Int_t lay=cluster->GetLayer();
714       fAliITSQADataMakerRec->GetRecPointsData(0 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(lay);
715       cluster->GetGlobalXYZ(cluGlo);
716       Float_t rad=TMath::Sqrt(cluGlo[0]*cluGlo[0]+cluGlo[1]*cluGlo[1]);
717         Float_t phi= TMath::Pi() + TMath::ATan2(-cluGlo[1],-cluGlo[0]);
718         if (lay==0) {
719           fAliITSQADataMakerRec->GetRecPointsData(1 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iIts);
720           fAliITSQADataMakerRec->GetRecPointsData(2 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluster->GetDetLocalX());
721           fAliITSQADataMakerRec->GetRecPointsData(3 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluster->GetDetLocalZ());
722           fAliITSQADataMakerRec->GetRecPointsData(4 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluGlo[0]);
723           fAliITSQADataMakerRec->GetRecPointsData(5 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluGlo[1]);
724           fAliITSQADataMakerRec->GetRecPointsData(6 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluGlo[2]);
725           fAliITSQADataMakerRec->GetRecPointsData(7 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(rad);
726           fAliITSQADataMakerRec->GetRecPointsData(8 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(phi);
727           fAliITSQADataMakerRec->GetRecPointsData(9 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluster->GetNz(),cluster->GetNy());
728           fAliITSQADataMakerRec->GetRecPointsData(10 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluster->GetNpixels());
729           fAliITSQADataMakerRec->GetRecPointsData(11 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluster->GetSPDclusterType());
730           fAliITSQADataMakerRec->GetRecPointsData(12 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluGlo[2],phi);
731         } else  {
732           fAliITSQADataMakerRec->GetRecPointsData(13 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iIts);
733           fAliITSQADataMakerRec->GetRecPointsData(14 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluster->GetDetLocalX());
734           fAliITSQADataMakerRec->GetRecPointsData(15 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluster->GetDetLocalZ());
735           fAliITSQADataMakerRec->GetRecPointsData(16 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluGlo[0]);
736           fAliITSQADataMakerRec->GetRecPointsData(17 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluGlo[1]);
737           fAliITSQADataMakerRec->GetRecPointsData(18 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluGlo[2]);
738           fAliITSQADataMakerRec->GetRecPointsData(19 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(rad);
739           fAliITSQADataMakerRec->GetRecPointsData(20 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(phi);
740           fAliITSQADataMakerRec->GetRecPointsData(21 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluster->GetNz(),cluster->GetNy());
741           fAliITSQADataMakerRec->GetRecPointsData(22 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluster->GetNpixels());
742           fAliITSQADataMakerRec->GetRecPointsData(23 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluster->GetSPDclusterType());
743           fAliITSQADataMakerRec->GetRecPointsData(24 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluGlo[2],phi);
744         }
745         fAliITSQADataMakerRec->GetRecPointsData(25 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(rad,phi);
746         fAliITSQADataMakerRec->GetRecPointsData(26 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluGlo[0],cluGlo[1]);
747
748         nClusters[lay]++;
749     } // end of cluster loop
750   } // end of its "subdetector" loop
751
752   for (Int_t iLay=0; iLay<2; iLay++)
753     fAliITSQADataMakerRec->GetRecPointsData(27 +iLay +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(nClusters[iLay]);
754
755   fAliITSQADataMakerRec->GetRecPointsData(29 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(nClusters[0],nClusters[1]);
756
757   return rv ;
758 }
759
760
761
762 //_______________________________________________________________
763
764 Int_t AliITSQASPDDataMakerRec::GetOffset(AliQAv1::TASKINDEX_t task,Int_t specie) {
765   // Returns offset number according to the specified task
766   Int_t offset=0;
767   if( task == AliQAv1::kRAWS ) {
768     offset=fGenRawsOffset[specie];
769   }
770   else if( task == AliQAv1::kDIGITSR ) {
771     offset=fGenDigitsOffset[specie];
772   }
773   else if( task == AliQAv1::kRECPOINTS ) {
774     offset=fGenRecPointsOffset[specie];
775   }
776
777   return offset;
778 }
779
780 //_______________________________________________________________
781
782 void AliITSQASPDDataMakerRec::SetOffset(AliQAv1::TASKINDEX_t task, Int_t offset, Int_t specie) {
783   // Returns offset number according to the specified task
784   if( task == AliQAv1::kRAWS ) {
785     fGenRawsOffset[specie]=offset;
786   }
787   else if( task == AliQAv1::kDIGITSR ) {
788     fGenDigitsOffset[specie]=offset;
789   }
790   else if( task == AliQAv1::kRECPOINTS ) {
791     fGenRecPointsOffset[specie]=offset;
792   }
793 }
794
795 //_______________________________________________________________
796
797 Int_t AliITSQASPDDataMakerRec::GetTaskHisto(AliQAv1::TASKINDEX_t task) {
798   // Returns the number of histograms associated to the specified task
799
800   Int_t histotot=0;
801
802   if( task == AliQAv1::kRAWS ) {
803     histotot=fSPDhRawsTask;
804   }
805   else if( task == AliQAv1::kDIGITSR ) {
806     histotot=fSPDhDigitsTask;
807   }
808   else if( task == AliQAv1::kRECPOINTS ){
809     histotot=fSPDhRecPointsTask;
810   }
811
812   return histotot;
813 }