]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSQASSDDataMakerRec.cxx
New macro to keep track of timing performances of the segmentation methods (Laurent)
[u/mrichter/AliRoot.git] / ITS / AliITSQASSDDataMakerRec.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
24 // --- ROOT system ---
25 #include <TH2D.h>
26 #include <TTree.h>
27 #include <TMath.h>
28 #include <TString.h>
29 #include <TSystem.h>
30
31 // --- Standard library ---
32
33 // --- AliRoot header files ---
34 #include "AliITSQASSDDataMakerRec.h"
35 #include "AliQADataMakerRec.h"
36 #include "AliLog.h"
37 #include "AliQA.h"
38 #include "AliQAChecker.h"
39 #include "AliRawReader.h"
40 #include "AliRawReaderRoot.h"
41 #include "AliITSRawStreamSSD.h"
42 #include "AliITSgeomTGeo.h"
43 #include "AliRawEventHeaderBase.h"
44 #include "AliITSRecPoint.h"
45 #include "AliITSBadChannelsSSDv2.h"
46
47 #include "AliCDBManager.h"
48 #include "AliCDBEntry.h"
49
50 ClassImp(AliITSQASSDDataMakerRec)
51
52 AliITSQASSDDataMakerRec::AliITSQASSDDataMakerRec(AliITSQADataMakerRec *aliITSQADataMakerRec, Bool_t kMode, Int_t ldc) :
53 TObject(),
54 fAliITSQADataMakerRec(aliITSQADataMakerRec),
55 fSSDEvent(0),
56 fSSDEventPerCycle(0),
57 fkOnline(kMode),
58 fLDC(ldc),
59 fSSDRawsOffset(0), fSSDRawsDAOffset(0),
60 fSSDRawsCommonLevelOffset(0),
61 fSSDhRawsTask(0),
62 fSSDhRecPointsTask(0),
63 fGenRawsOffset(0),
64 fGenRecPointsOffset(0),
65 fCDBManager(0) {
66   // Default constructor   
67   //initilize the raw signal vs strip number histograms
68   if(fkOnline) {
69     fCDBManager = AliCDBManager::Instance();
70     //fCDBManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
71     fCDBManager->SetDefaultStorage(gSystem->Getenv("AMORE_CDB_URI"));
72     Int_t runNumber = atoi(gSystem->Getenv("DATE_RUN_NUMBER"));
73     if(!runNumber) 
74       AliInfo("DATE_RUN_NUMBER not defined!!!\n");
75     
76     fCDBManager->SetRun(runNumber);
77     AliCDBEntry *geomGRP = fCDBManager->Get("GRP/Geometry/Data");
78     if(!geomGRP) AliInfo("GRP geometry not found!!!\n");
79     
80     Int_t gLayer = 0,gLadder = 0, gModule = 0;
81     Int_t gHistCounter = 0;
82     TString gTitle; 
83
84     for(Int_t iModule = 500; iModule < fgkSSDMODULES + 500; iModule++) {
85       AliITSgeomTGeo::GetModuleId(iModule,gLayer,gLadder,gModule);
86       gTitle = "SSD_RawSignal_Layer"; gTitle += gLayer;
87       gTitle += "_Ladder"; gTitle += gLadder;
88       gTitle += "_Module"; gTitle += gModule;
89       fHistSSDRawSignalModule[gHistCounter] = new TH1D(gTitle.Data(),gTitle.Data(),
90                                                        2*fgkNumberOfPSideStrips,0,2*fgkNumberOfPSideStrips);
91       gHistCounter += 1;
92       
93       for(Int_t iStrip = 0; iStrip < 2*fgkNumberOfPSideStrips; iStrip++)
94         fOccupancyMatrix[iModule-500][iStrip] = 0; 
95     }//module loop
96   }//online flag
97   else {
98     for(Int_t iModule = 0; iModule < fgkSSDMODULES; iModule++) 
99       fHistSSDRawSignalModule[iModule]=NULL;
100     fCDBManager = NULL;
101   }
102 }
103
104 //____________________________________________________________________________ 
105 AliITSQASSDDataMakerRec::AliITSQASSDDataMakerRec(const AliITSQASSDDataMakerRec& qadm) :
106 TObject(),
107 fAliITSQADataMakerRec(qadm.fAliITSQADataMakerRec),
108 fSSDEvent(qadm.fSSDEvent),
109 fSSDEventPerCycle(qadm.fSSDEventPerCycle),
110 fkOnline(qadm.fkOnline),
111 fLDC(qadm.fLDC),
112 fSSDRawsOffset(qadm.fSSDRawsOffset), fSSDRawsDAOffset(qadm.fSSDRawsDAOffset),
113 fSSDRawsCommonLevelOffset(qadm.fSSDRawsCommonLevelOffset),
114 fSSDhRawsTask(qadm.fSSDhRawsTask),
115 fSSDhRecPointsTask(qadm.fSSDhRecPointsTask),
116 fGenRawsOffset(qadm.fGenRawsOffset),
117 fGenRecPointsOffset(qadm.fGenRecPointsOffset),
118 fCDBManager(qadm.fCDBManager) {
119   //copy ctor 
120   fAliITSQADataMakerRec->SetName((const char*)qadm.fAliITSQADataMakerRec->GetName()) ; 
121   fAliITSQADataMakerRec->SetTitle((const char*)qadm.fAliITSQADataMakerRec->GetTitle());
122 }
123
124 //__________________________________________________________________
125 AliITSQASSDDataMakerRec& AliITSQASSDDataMakerRec::operator = (const AliITSQASSDDataMakerRec& qac )
126 {
127   // Equal operator.
128   this->~AliITSQASSDDataMakerRec();
129   new(this) AliITSQASSDDataMakerRec(qac);
130   return *this;
131 }
132
133 //__________________________________________________________________
134 AliITSQASSDDataMakerRec::~AliITSQASSDDataMakerRec() {
135   // destructor
136   for(Int_t iModule = 0; iModule < fgkSSDMODULES; iModule++)
137     if(fHistSSDRawSignalModule[iModule]) delete fHistSSDRawSignalModule[iModule];
138   if(fCDBManager) delete fCDBManager;
139 }
140
141 //____________________________________________________________________________ 
142 void AliITSQASSDDataMakerRec::StartOfDetectorCycle()
143 {
144   if (  fAliITSQADataMakerRec->GetRawsData(0) == NULL ) // Raws not defined
145     return ; 
146
147   //Detector specific actions at start of cycle
148   AliDebug(1,"AliITSQADM::Start of SSD Cycle\n");    
149
150   //Data size per DDL
151   ((TH1D *)(fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+4)))->Reset();
152   //Data size per LDC
153   ((TH1D *)(fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+22)))->Reset();
154
155   //online part
156   if(fkOnline) {
157     for(Int_t iModule = 500; iModule < fgkSSDMODULES + 500; iModule++) {
158       for(Int_t iStrip = 0; iStrip < 2*fgkNumberOfPSideStrips; iStrip++)
159         fOccupancyMatrix[iModule-500][iStrip] = 0; 
160     }//module loop
161
162     Int_t gHistPositionOccupancyPerLadder = 0;
163     Int_t gLayer = 0, gLadder = 0, gModule = 0;
164     for(Int_t iModule = 0; iModule < fgkSSDMODULES; iModule++) {
165       AliITSgeomTGeo::GetModuleId(iModule+500,gLayer,gLadder,gModule);
166       
167       gHistPositionOccupancyPerLadder = (gLayer == 5) ? 2*(gLadder - 1) : 2*(gLadder - 1 + fgkSSDLADDERSLAYER5);
168       
169       //P-SIDE OCCUPANCY
170       fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+gHistPositionOccupancyPerLadder)->Reset();
171       //N-SIDE OCCUPANCY
172       fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+gHistPositionOccupancyPerLadder+1)->Reset();
173
174       ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6))->Reset();
175       ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6+1))->Reset();
176     }//module loop
177   }//online flag
178 }
179
180 //____________________________________________________________________________ 
181 void AliITSQASSDDataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray* list)
182 {
183   // launch the QA checking
184   if (  fAliITSQADataMakerRec->GetRawsData(0) == NULL ) // Raws not defined
185     return ; 
186  
187   // launch the QA checking
188   AliDebug(1,"AliITSDM instantiates checker with Run(AliQA::kITS, task, list)\n"); 
189   AliInfo(Form("Offset: %d\n",fGenRawsOffset));
190   //Data size per DDL
191   for(Int_t i = 0; i < fgkNumOfDDLs; i++) {
192     Double_t gSizePerDDL = TMath::Power(10,(fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+5+i))->GetMean())/1e+06;
193     //cout<<"DDL: "<<i+2<<" - Size: "<<gSizePerDDL<<" - Mean: "<<
194     //(fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+5+i))->GetMean()<<endl;
195     ((TH1D *)(fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+4)))->SetBinContent(i+2,gSizePerDDL);
196   }
197   
198   //Data size per LDC
199   for(Int_t i = 0; i < fgkNumOfLDCs; i++) {
200     Double_t gSizePerLDC = TMath::Power(10,(fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+23+i))->GetMean())/1e+06;
201     ((TH1D *)(fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+22)))->SetBinContent(i+6,gSizePerLDC);
202   }
203
204   //online part
205   if(fkOnline) {
206     //Output of the DA
207     MonitorOCDBObjects();
208
209     Int_t gHistPositionOccupancyPerModule = 0;
210     Int_t gLayer = 0, gLadder = 0, gModule = 0;
211     //occupancy per module
212     for(Int_t iModule = 0; iModule < fgkSSDMODULES; iModule++) {
213       AliITSgeomTGeo::GetModuleId(iModule+500,gLayer,gLadder,gModule);
214
215       gHistPositionOccupancyPerModule = (gLayer == 5) ? ((gLadder - 1)*fgkSSDMODULESPERLADDERLAYER5 + gModule - 1) : ((gLadder - 1)*fgkSSDMODULESPERLADDERLAYER6 + gModule + fgkSSDMODULESLAYER5 - 1);
216       for(Int_t iBins = 1; iBins < fHistSSDRawSignalModule[iModule]->GetXaxis()->GetNbins(); iBins++)
217         fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+gHistPositionOccupancyPerModule)->SetBinContent(iBins,fOccupancyMatrix[iModule][iBins-1]);
218       
219       if(fSSDEventPerCycle != 0)
220         ((TH1F *)(fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+gHistPositionOccupancyPerModule)))->Scale(100./fSSDEventPerCycle);
221     }//module loop
222
223     //occupancy per ladder
224     Int_t gHistPositionOccupancyPerLadder = 0;
225     Int_t lLadderLocationY = 0;
226     Double_t occupancy = 0.0, occupancyThreshold = 0.0, occupancyAverage = 0.0;
227     for(Int_t iModule = 0; iModule < fgkSSDMODULES; iModule++) {
228       AliITSgeomTGeo::GetModuleId(iModule+500,gLayer,gLadder,gModule);
229       
230       gHistPositionOccupancyPerModule = (gLayer == 5) ? ((gLadder - 1)*fgkSSDMODULESPERLADDERLAYER5 + gModule - 1) : ((gLadder - 1)*fgkSSDMODULESPERLADDERLAYER6 + gModule + fgkSSDMODULESLAYER5 - 1);
231       gHistPositionOccupancyPerLadder = (gLayer == 5) ? 2*(gLadder - 1) : 2*(gLadder - 1 + fgkSSDLADDERSLAYER5);
232       
233       //P-SIDE OCCUPANCY
234       occupancy = GetOccupancyModule((TH1 *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+gHistPositionOccupancyPerModule),0,0,0);
235       occupancyThreshold = GetOccupancyModule((TH1 *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+gHistPositionOccupancyPerModule),0,1,3);
236       occupancyAverage = GetOccupancyModule((TH1 *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+gHistPositionOccupancyPerModule),0,2,0);
237
238       fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+gHistPositionOccupancyPerLadder)->Fill(gModule,occupancy);
239       lLadderLocationY = 3*gLadder; // sideP=1 sideN=0 
240       if(gLayer == 5) {
241         //occupancy per module - no threshold
242         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6))->SetBinContent(gModule,lLadderLocationY,occupancy);
243         //occupancy per module - threshold @ 3%
244         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6+2))->SetBinContent(gModule,lLadderLocationY,occupancyThreshold);
245         //average occupancy per module
246         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6+4))->SetBinContent(gModule,lLadderLocationY,occupancyAverage);
247       }
248       else if(gLayer == 6) {
249         //occupancy per module - no threshold
250         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6+1))->SetBinContent(gModule,lLadderLocationY,occupancy);
251         //occupancy per module - threshold @ 3%
252         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6+3))->SetBinContent(gModule,lLadderLocationY,occupancyThreshold);
253         //average occupancy per module
254         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6+5))->SetBinContent(gModule,lLadderLocationY,occupancyAverage);
255       }
256
257       //N-SIDE OCCUPANCY
258       occupancy = GetOccupancyModule((TH1 *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+gHistPositionOccupancyPerModule),1,0,0);   
259       occupancyThreshold = GetOccupancyModule((TH1 *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+gHistPositionOccupancyPerModule),1,1,3);   
260       occupancyAverage = GetOccupancyModule((TH1 *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+gHistPositionOccupancyPerModule),1,2,0);   
261
262       fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+gHistPositionOccupancyPerLadder+1)->Fill(gModule,occupancy);
263       if(gLayer == 5) {
264         //occupancy per module - no threshold
265         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6))->SetBinContent(gModule,lLadderLocationY-1,occupancy);
266         //occupancy per module - threshold @ 3%
267         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6+2))->SetBinContent(gModule,lLadderLocationY-1,occupancyThreshold);
268         //average occupancy per module
269         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6+4))->SetBinContent(gModule,lLadderLocationY-1,occupancyAverage);
270       }
271       else if(gLayer == 6) {
272         //occupancy per module - no threshold
273         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6+1))->SetBinContent(gModule,lLadderLocationY-1,occupancy);
274         //occupancy per module - threshold @ 3%
275         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6+3))->SetBinContent(gModule,lLadderLocationY-1,occupancyThreshold);
276         //average occupancy per module
277         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsCommonLevelOffset+fgkSSDMODULES+2*fgkSSDLADDERSLAYER5+2*fgkSSDLADDERSLAYER6+5))->SetBinContent(gModule,lLadderLocationY-1,occupancyAverage);
278       }
279     }//module loop
280   }//online flag for SSD
281
282   fSSDEventPerCycle = 0;
283   
284  // AliQAChecker::Instance()->Run( AliQA::kITS , task, list);
285 }
286
287 //____________________________________________________________________________ 
288 void AliITSQASSDDataMakerRec::InitRaws() {  
289   // Initialization for RAW data - SSD -
290   fGenRawsOffset = (fAliITSQADataMakerRec->fRawsQAList[AliRecoParam::kDefault])->GetEntries();
291
292   if(fkOnline) {
293     AliInfo("Book Online Histograms for SSD\n");
294   }
295   else {
296     AliInfo("Book Offline Histograms for SSD\n ");
297   }
298   AliInfo(Form("Number of histograms (SPD+SDD): %d\n",fGenRawsOffset));
299   TString gTitle = 0;
300   //book online-offline QA histos
301   TH1D *fHistSSDEventType = new TH1D("SSD/DataSize/fHistSSDEventType",
302                                      ";Event type;Events",
303                                      31,-1,30);
304   fAliITSQADataMakerRec->Add2RawsList(fHistSSDEventType, 
305                                       fGenRawsOffset+fSSDRawsOffset, kTRUE);
306   fSSDRawsOffset += 1;
307   TH1D *fHistSSDDataSize = new TH1D("SSD/DataSize/fHistSSDDataSize",
308                                     ";log(SSD data size) [Bytes];Events",
309                                     100,3,8);
310   fAliITSQADataMakerRec->Add2RawsList(fHistSSDDataSize, 
311                                       fGenRawsOffset+fSSDRawsOffset, kTRUE);
312   fSSDRawsOffset += 1;
313   TH1D *fHistSSDDataSizePercentage = new TH1D("SSD/DataSize/fHistSSDDataSizePercentage",
314                                               ";SSD data size [%];Events",
315                                               100,0,100);
316   fAliITSQADataMakerRec->Add2RawsList(fHistSSDDataSizePercentage, 
317                                       fGenRawsOffset+fSSDRawsOffset, kTRUE);
318   fSSDRawsOffset += 1;
319   TH1D *fHistSSDDDLId = new TH1D("SSD/DDL/fHistSSDDDLId",
320                                  ";DDL id;Events",20,510.5,530.5);
321   fAliITSQADataMakerRec->Add2RawsList(fHistSSDDDLId, 
322                                       fGenRawsOffset+fSSDRawsOffset, kTRUE);
323   fSSDRawsOffset += 1;
324   TH1D *fHistSSDDataSizePerDDL = new TH1D("SSD/DataSize/fHistSSDDataSizePerDDL",
325                                           ";DDL id;<SSD data size> [MB]",
326                                           20,510.5,530.5);
327   fAliITSQADataMakerRec->Add2RawsList(fHistSSDDataSizePerDDL, 
328                                       fGenRawsOffset+fSSDRawsOffset);
329   fSSDRawsOffset += 1;
330   TH1D *fHistSSDDataSizeDDL[fgkNumOfDDLs];
331   for(Int_t i = 1; i < fgkNumOfDDLs+1; i++) {
332     gTitle = "SSD/DDL/fHistSSDDataSizeDDL"; gTitle += i+511;
333     fHistSSDDataSizeDDL[i-1] = new TH1D(gTitle.Data(),
334                                         ";log(SSD data size) [Bytes];Events",
335                                         100,1,8);
336     fAliITSQADataMakerRec->Add2RawsList(fHistSSDDataSizeDDL[i-1], 
337                                         fGenRawsOffset+fSSDRawsOffset, kTRUE);
338     fSSDRawsOffset += 1;
339   }
340   
341   TH1D *fHistSSDLDCId = new TH1D("SSD/LDC/fHistSSDLDCId",";LDC id;Events",10,0.5,10.5);
342   fAliITSQADataMakerRec->Add2RawsList(fHistSSDLDCId, 
343                                       fGenRawsOffset+fSSDRawsOffset, kTRUE);
344   fSSDRawsOffset += 1;
345   TH1D *fHistSSDDataSizePerLDC = new TH1D("SSD/DataSize/fHistSSDDataSizePerLDC",
346                                           ";LDC id;<SSD data size> [MB]",
347                                           20,0.5,20.5);
348   fAliITSQADataMakerRec->Add2RawsList(fHistSSDDataSizePerLDC, 
349                                       fGenRawsOffset+fSSDRawsOffset);
350   fSSDRawsOffset += 1;
351   TH1D *fHistSSDDataSizeLDC[fgkNumOfLDCs];
352   for(Int_t i = 1; i < fgkNumOfLDCs+1; i++) {
353     gTitle = "SSD/LDC/fHistSSDDataSizeLDC"; 
354     if(i == 1) gTitle += "082";
355     if(i == 2) gTitle += "086";
356     if(i == 3) gTitle += "085";
357     fHistSSDDataSizeLDC[i-1] = new TH1D(gTitle.Data(),
358                                         ";log(SSD data size) [Bytes];Events",
359                                         100,1,8);
360     fAliITSQADataMakerRec->Add2RawsList(fHistSSDDataSizeLDC[i-1], 
361                                         fGenRawsOffset+fSSDRawsOffset, kTRUE);
362     fSSDRawsOffset += 1;
363   }
364   fSSDRawsCommonLevelOffset = fSSDRawsOffset;
365
366   if(fkOnline) {
367     Int_t gLayer = 0, gLadder = 0, gModule = 0;
368     //occupancy per SSD module
369     TH1D *fHistSSDOccupancyModule[fgkSSDMODULES]; 
370     for(Int_t i = 500; i < fgkSSDMODULES + 500; i++) {
371       AliITSgeomTGeo::GetModuleId(i,gLayer,gLadder,gModule);
372       gTitle = "SSD/Occupancy/Layer"; gTitle += gLayer;
373       gTitle += "/Ladder"; 
374       if(gLayer == 5) {
375         gTitle +=  499+gLadder;
376         gTitle += "/fHistSSD_Occupancy_Layer"; gTitle += gLayer;
377         gTitle += "_Ladder"; 
378         gTitle += 499+gLadder;
379       }
380       if(gLayer == 6) {
381         gTitle += 599+gLadder;
382         gTitle += "/fHistSSD_Occupancy_Layer"; gTitle += gLayer;
383         gTitle += "_Ladder"; 
384         gTitle += 599+gLadder;
385       }
386       gTitle += "_Module"; gTitle += gModule; 
387       fHistSSDOccupancyModule[i-500] = new TH1D(gTitle.Data(),gTitle.Data(),
388                                                 2*fgkNumberOfPSideStrips,0,2*fgkNumberOfPSideStrips);
389       fHistSSDOccupancyModule[i-500]->GetXaxis()->SetTitleColor(1);
390       fHistSSDOccupancyModule[i-500]->GetXaxis()->SetTitle("N_{strip}");
391       fHistSSDOccupancyModule[i-500]->GetYaxis()->SetTitle("Occupancy [%]");
392       fAliITSQADataMakerRec->Add2RawsList(fHistSSDOccupancyModule[i-500], 
393                                           fGenRawsOffset+fSSDRawsOffset, kTRUE);
394       fSSDRawsOffset += 1;
395     }
396
397     //Occupancy per SSD ladder
398     Int_t occupancyCounter = 0;
399     TH1D *fHistSSDOccupancyLadder[2*(fgkSSDLADDERSLAYER5 + fgkSSDLADDERSLAYER6)];
400     for(Int_t iLayer = 5; iLayer < 7; iLayer++) {
401       for(Int_t iLadder = 1; iLadder < AliITSgeomTGeo::GetNLadders(iLayer) + 1; iLadder++) {
402         //P-side occupancy plots
403         gTitle = "SSD/Occupancy/Layer"; gTitle += iLayer;
404         gTitle += "/Ladder";
405         if(iLayer == 5) {
406           gTitle += 499+iLadder;
407           gTitle += "/fHistSSD_Occupancy_Layer"; gTitle += iLayer;
408           gTitle += "_Ladder"; 
409           gTitle += 499+iLadder;
410         }
411         if(iLayer == 6) {
412           gTitle += 599+iLadder;
413           gTitle += "/fHistSSD_Occupancy_Layer"; gTitle += iLayer;
414           gTitle += "_Ladder"; 
415           gTitle += 599+iLadder;
416         }
417         gTitle += "_PSide";
418         fHistSSDOccupancyLadder[occupancyCounter] = new TH1D(gTitle.Data(),
419                                                              gTitle.Data(),
420                                                              AliITSgeomTGeo::GetNDetectors(iLayer),
421                                                              0.5,AliITSgeomTGeo::GetNDetectors(iLayer)+0.5);
422         fHistSSDOccupancyLadder[occupancyCounter]->GetXaxis()->SetTitleColor(1);
423         fHistSSDOccupancyLadder[occupancyCounter]->GetXaxis()->SetTitle("Module number");
424         fHistSSDOccupancyLadder[occupancyCounter]->GetYaxis()->SetTitle("Occupancy [%]");
425         fAliITSQADataMakerRec->Add2RawsList(fHistSSDOccupancyLadder[occupancyCounter], 
426                                             fGenRawsOffset+fSSDRawsOffset, kTRUE);
427         occupancyCounter += 1; fSSDRawsOffset += 1;
428         //N-side occupancy plots
429         gTitle = "SSD/Occupancy/Layer"; gTitle += iLayer;
430         gTitle += "/Ladder";
431         if(iLayer == 5) {
432           gTitle += 499+iLadder;
433           gTitle += "/fHistSSD_Occupancy_Layer"; gTitle += iLayer;
434           gTitle += "_Ladder"; 
435           gTitle += 499+iLadder;
436         }
437         if(iLayer == 6) {
438           gTitle += 599+iLadder;
439           gTitle += "/fHistSSD_Occupancy_Layer"; gTitle += iLayer;
440           gTitle += "_Ladder"; 
441           gTitle += 599+iLadder;
442         }
443         gTitle += "_NSide";
444         fHistSSDOccupancyLadder[occupancyCounter] = new TH1D(gTitle.Data(),
445                                                              gTitle.Data(),
446                                                              AliITSgeomTGeo::GetNDetectors(iLayer),
447                                                              0.5,AliITSgeomTGeo::GetNDetectors(iLayer)+0.5);
448         fHistSSDOccupancyLadder[occupancyCounter]->GetXaxis()->SetTitleColor(1);
449         fHistSSDOccupancyLadder[occupancyCounter]->GetXaxis()->SetTitle("Module number");
450         fHistSSDOccupancyLadder[occupancyCounter]->GetYaxis()->SetTitle("Occupancy [%]");
451         fAliITSQADataMakerRec->Add2RawsList(fHistSSDOccupancyLadder[occupancyCounter], 
452                                             fGenRawsOffset+fSSDRawsOffset, kTRUE);
453         occupancyCounter += 1; fSSDRawsOffset += 1;
454       }//ladder loop
455     }//layer loop
456
457     //top level occupancy plots
458     //occupancy per module - no threshold
459     TH2D *fHistSSDOccupancyLayer5 = new TH2D("SSD/Occupancy/Layer5/fHistSSDOccupancyLayer5",
460                                              ";N_{modules};N_{Ladders}",
461                                              fgkSSDMODULESPERLADDERLAYER5,
462                                              0,fgkSSDMODULESPERLADDERLAYER5,
463                                              3*fgkSSDLADDERSLAYER5,
464                                              5000,500+fgkSSDLADDERSLAYER5);  
465     fHistSSDOccupancyLayer5->SetTitle("Occupancy per module (Layer 5) - No threshold");
466     fHistSSDOccupancyLayer5->GetZaxis()->SetRangeUser(0.0,100.0);
467     Char_t fLabel[3];
468     for(Int_t iBin = 1; iBin < fgkSSDMODULESPERLADDERLAYER5 + 1; iBin++){
469       sprintf(fLabel,"%d",iBin);
470       fHistSSDOccupancyLayer5->GetXaxis()->SetBinLabel(iBin,fLabel);
471     }
472     fAliITSQADataMakerRec->Add2RawsList(fHistSSDOccupancyLayer5, 
473                                         fGenRawsOffset+fSSDRawsOffset, kTRUE);
474     fSSDRawsOffset += 1;
475     TH2D *fHistSSDOccupancyLayer6 = new TH2D("SSD/Occupancy/Layer6/fHistSSDOccupancyLayer6",
476                                              ";N_{modules};N_{Ladders}",
477                                              fgkSSDMODULESPERLADDERLAYER6,
478                                              0,fgkSSDMODULESPERLADDERLAYER6,
479                                              3*fgkSSDLADDERSLAYER6,
480                                              600,600+fgkSSDLADDERSLAYER6);
481     fHistSSDOccupancyLayer6->SetTitle("Occupancy per module (Layer 6) - No threshold");
482     fHistSSDOccupancyLayer6->GetZaxis()->SetRangeUser(0.0,100.0);
483     for(Int_t iBin = 1; iBin < fgkSSDMODULESPERLADDERLAYER6 + 1; iBin++){
484       sprintf(fLabel,"%d",iBin);
485       fHistSSDOccupancyLayer6->GetXaxis()->SetBinLabel(iBin,fLabel);
486     }
487     fAliITSQADataMakerRec->Add2RawsList(fHistSSDOccupancyLayer6, 
488                                         fGenRawsOffset+fSSDRawsOffset, kTRUE);
489     fSSDRawsOffset += 1;
490
491     //occupancy per module - threshold @ 3%
492     TH2D *fHistSSDOccupancyThresholdLayer5 = new TH2D("SSD/Occupancy/Layer5/fHistSSDOccupancyThresholdLayer5",
493                                              ";N_{modules};N_{Ladders}",
494                                              fgkSSDMODULESPERLADDERLAYER5,
495                                              0,fgkSSDMODULESPERLADDERLAYER5,
496                                              3*fgkSSDLADDERSLAYER5,
497                                              500,500+fgkSSDLADDERSLAYER5);  
498     fHistSSDOccupancyThresholdLayer5->SetTitle("Occupancy per module (Layer 5) - Threshold 3%");
499     fHistSSDOccupancyThresholdLayer5->GetZaxis()->SetRangeUser(3.0,10.0);
500     for(Int_t iBin = 1; iBin < fgkSSDMODULESPERLADDERLAYER5 + 1; iBin++){
501       sprintf(fLabel,"%d",iBin);
502       fHistSSDOccupancyThresholdLayer5->GetXaxis()->SetBinLabel(iBin,fLabel);
503      }
504      fAliITSQADataMakerRec->Add2RawsList(fHistSSDOccupancyThresholdLayer5, 
505                                          fGenRawsOffset+fSSDRawsOffset, kTRUE);
506     fSSDRawsOffset += 1;
507     TH2D *fHistSSDOccupancyThresholdLayer6 = new TH2D("SSD/Occupancy/Layer6/fHistSSDOccupancyThresholdLayer6",
508                                              ";N_{modules};N_{Ladders}",
509                                              fgkSSDMODULESPERLADDERLAYER6,
510                                              0,fgkSSDMODULESPERLADDERLAYER6,
511                                              3*fgkSSDLADDERSLAYER6,
512                                              600,600+fgkSSDLADDERSLAYER6);
513     fHistSSDOccupancyThresholdLayer6->SetTitle("Occupancy per module (Layer 6) - Threshold 3%");
514     fHistSSDOccupancyThresholdLayer6->GetZaxis()->SetRangeUser(3.0,10.0);
515     for(Int_t iBin = 1; iBin < fgkSSDMODULESPERLADDERLAYER6 + 1; iBin++){
516       sprintf(fLabel,"%d",iBin);
517       fHistSSDOccupancyThresholdLayer6->GetXaxis()->SetBinLabel(iBin,fLabel);
518     }
519     fAliITSQADataMakerRec->Add2RawsList(fHistSSDOccupancyThresholdLayer6, 
520                                         fGenRawsOffset+fSSDRawsOffset, kTRUE);
521     fSSDRawsOffset += 1;
522
523     //Average occupancy per module
524     TH2D *fHistSSDAverageOccupancyLayer5 = new TH2D("SSD/Occupancy/Layer5/fHistSSDAverageOccupancyLayer5",
525                                              ";N_{modules};N_{Ladders}",
526                                              fgkSSDMODULESPERLADDERLAYER5,
527                                              0,fgkSSDMODULESPERLADDERLAYER5,
528                                              3*fgkSSDLADDERSLAYER5,
529                                              500,500+fgkSSDLADDERSLAYER5);  
530     fHistSSDAverageOccupancyLayer5->SetTitle("Average occupancy per module (Layer 5)");
531     fHistSSDAverageOccupancyLayer5->GetZaxis()->SetRangeUser(0.0,5.0);
532     for(Int_t iBin = 1; iBin < fgkSSDMODULESPERLADDERLAYER5 + 1; iBin++){
533       sprintf(fLabel,"%d",iBin);
534       fHistSSDAverageOccupancyLayer5->GetXaxis()->SetBinLabel(iBin,fLabel);
535     }
536     fAliITSQADataMakerRec->Add2RawsList(fHistSSDAverageOccupancyLayer5, 
537                                         fGenRawsOffset+fSSDRawsOffset);
538     fSSDRawsOffset += 1;
539     TH2D *fHistSSDAverageOccupancyLayer6 = new TH2D("SSD/Occupancy/Layer6/fHistSSDAverageOccupancyLayer6",
540                                              ";N_{modules};N_{Ladders}",
541                                              fgkSSDMODULESPERLADDERLAYER6,
542                                              0,fgkSSDMODULESPERLADDERLAYER6,
543                                              3*fgkSSDLADDERSLAYER6,
544                                              600,600+fgkSSDLADDERSLAYER6);
545     fHistSSDAverageOccupancyLayer6->SetTitle("Average occupancy per module (Layer 6)");
546     fHistSSDAverageOccupancyLayer6->GetZaxis()->SetRangeUser(0.0,5.0);
547     for(Int_t iBin = 1; iBin < fgkSSDMODULESPERLADDERLAYER6 + 1; iBin++){
548       sprintf(fLabel,"%d",iBin);
549       fHistSSDAverageOccupancyLayer6->GetXaxis()->SetBinLabel(iBin,fLabel);
550     }
551     fAliITSQADataMakerRec->Add2RawsList(fHistSSDAverageOccupancyLayer6, 
552                                         fGenRawsOffset+fSSDRawsOffset);
553     fSSDRawsOffset += 1;
554
555     //Output of the DA
556     TH2D *fHistPSideBadChannelMapLayer5 = new TH2D("SSD/BadChannels/fHistPSideBadChannelMapLayer5",
557                                                    "Layer 5;N_{module};N_{ladder}",
558                                                    22,1,23,
559                                                    34,500,534);
560     fHistPSideBadChannelMapLayer5->GetXaxis()->SetTitleColor(1);
561     fHistPSideBadChannelMapLayer5->SetStats(kFALSE);
562     fHistPSideBadChannelMapLayer5->GetYaxis()->SetTitleOffset(1.8);
563     fHistPSideBadChannelMapLayer5->GetXaxis()->SetNdivisions(22);
564     fHistPSideBadChannelMapLayer5->GetYaxis()->SetNdivisions(34);
565     fHistPSideBadChannelMapLayer5->GetXaxis()->SetLabelSize(0.03);
566     fHistPSideBadChannelMapLayer5->GetYaxis()->SetLabelSize(0.03);
567     fHistPSideBadChannelMapLayer5->GetZaxis()->SetTitleOffset(1.6);
568     fHistPSideBadChannelMapLayer5->GetZaxis()->SetTitle("Bad channels (p-side)[%]");
569     fAliITSQADataMakerRec->Add2RawsList(fHistPSideBadChannelMapLayer5, 
570                                         fGenRawsOffset+fSSDRawsOffset, kTRUE);
571     fSSDRawsOffset += 1; fSSDRawsDAOffset += 1;
572
573     TH2D *fHistNSideBadChannelMapLayer5 = new TH2D("SSD/BadChannels/fHistNSideBadChannelMapLayer5",
574                                                    "Layer 5;N_{module};N_{ladder}",
575                                                    22,1,23,
576                                                    34,500,534);
577     fHistNSideBadChannelMapLayer5->GetXaxis()->SetTitleColor(1);
578     fHistNSideBadChannelMapLayer5->SetStats(kFALSE);
579     fHistNSideBadChannelMapLayer5->GetYaxis()->SetTitleOffset(1.8);
580     fHistNSideBadChannelMapLayer5->GetXaxis()->SetNdivisions(22);
581     fHistNSideBadChannelMapLayer5->GetYaxis()->SetNdivisions(34);
582     fHistNSideBadChannelMapLayer5->GetXaxis()->SetLabelSize(0.03);
583     fHistNSideBadChannelMapLayer5->GetYaxis()->SetLabelSize(0.03);
584     fHistNSideBadChannelMapLayer5->GetZaxis()->SetTitleOffset(1.6);
585     fHistNSideBadChannelMapLayer5->GetZaxis()->SetTitle("Bad channels (n-side)[%]");
586     fAliITSQADataMakerRec->Add2RawsList(fHistNSideBadChannelMapLayer5, 
587                                         fGenRawsOffset+fSSDRawsOffset, kTRUE);
588     fSSDRawsOffset += 1; fSSDRawsDAOffset += 1;
589
590     TH2D *fHistPSideBadChannelMapLayer6 = new TH2D("SSD/BadChannels/fHistPSideBadChannelMapLayer6",
591                                                    "Layer 6;N_{module};N_{ladder}",
592                                                    25,1,26,
593                                                    38,600,638);
594     fHistPSideBadChannelMapLayer6->GetXaxis()->SetTitleColor(1);
595     fHistPSideBadChannelMapLayer6->SetStats(kFALSE);
596     fHistPSideBadChannelMapLayer6->GetYaxis()->SetTitleOffset(1.8);
597     fHistPSideBadChannelMapLayer6->GetXaxis()->SetNdivisions(25);
598     fHistPSideBadChannelMapLayer6->GetYaxis()->SetNdivisions(38);
599     fHistPSideBadChannelMapLayer6->GetXaxis()->SetLabelSize(0.03);
600     fHistPSideBadChannelMapLayer6->GetYaxis()->SetLabelSize(0.03);
601     fHistPSideBadChannelMapLayer6->GetZaxis()->SetTitleOffset(1.6);
602     fHistPSideBadChannelMapLayer6->GetZaxis()->SetTitle("Bad channels (p-side)[%]");
603     fAliITSQADataMakerRec->Add2RawsList(fHistPSideBadChannelMapLayer6, 
604                                         fGenRawsOffset+fSSDRawsOffset, kTRUE);
605     fSSDRawsOffset += 1; fSSDRawsDAOffset += 1;
606
607     TH2D *fHistNSideBadChannelMapLayer6 = new TH2D("SSD/BadChannels/fHistNSideBadChannelMapLayer6",
608                                                    "Layer 6;N_{module};N_{ladder}",
609                                                    25,1,26,
610                                                    38,600,638);
611     fHistNSideBadChannelMapLayer6->GetXaxis()->SetTitleColor(1);
612     fHistNSideBadChannelMapLayer6->SetStats(kFALSE);
613     fHistNSideBadChannelMapLayer6->GetYaxis()->SetTitleOffset(1.8);
614     fHistNSideBadChannelMapLayer6->GetXaxis()->SetNdivisions(25);
615     fHistNSideBadChannelMapLayer6->GetYaxis()->SetNdivisions(38);
616     fHistNSideBadChannelMapLayer6->GetXaxis()->SetLabelSize(0.03);
617     fHistNSideBadChannelMapLayer6->GetYaxis()->SetLabelSize(0.03);
618     fHistNSideBadChannelMapLayer6->GetZaxis()->SetTitleOffset(1.6);
619     fHistNSideBadChannelMapLayer6->GetZaxis()->SetTitle("Bad channels (n-side)[%]");
620     fAliITSQADataMakerRec->Add2RawsList(fHistNSideBadChannelMapLayer6, 
621                                         fGenRawsOffset+fSSDRawsOffset, kTRUE);
622     fSSDRawsOffset += 1; fSSDRawsDAOffset += 1;
623   }//online flag
624
625   fSSDhRawsTask = fSSDRawsOffset;
626   AliDebug(1,Form("%d SSD Raws histograms booked\n",fSSDhRawsTask));
627   AliInfo(Form("Number of histograms (SPD+SDD+SSD): %d\n",fGenRawsOffset+fSSDhRawsTask));  
628   AliDebug(1,Form("Number of histograms (SPD+SDD+SSD): %d\n",fGenRawsOffset+fSSDRawsOffset));
629   
630   /*
631   fSSDhTask = fSSDRawsOffset;
632   AliDebug(1,Form("%d SSD Raws histograms booked\n",fSSDhTask));
633   AliInfo(Form("Number of histograms (SPD+SDD+SSD): %d\n",fGenRawsOffset+fSSDhTask));  
634   AliDebug(1,Form("Number of histograms (SPD+SDD+SSD): %d\n",fGenRawsOffset+fSSDRawsOffset));
635   */
636 }
637
638 //____________________________________________________________________________
639 void AliITSQASSDDataMakerRec::MakeRaws(AliRawReader* rawReader) { 
640   // Fill QA for RAW - SSD -
641   Int_t gStripNumber;
642   Int_t gHistPosition;
643   Int_t gLayer = 0,gLadder = 0, gModule = 0;
644   
645   Double_t gSizePerDDL[fgkNumOfDDLs] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
646   Double_t gSizePerLDC[fgkNumOfLDCs] = {0.,0.,0.};
647   Double_t sumSSDDataSize = 0.0;
648   Double_t eventSize = -1.0;
649
650   if(fkOnline) {
651     //reset the signal vs strip number histograms
652     for(Int_t iModule = 0; iModule < fgkSSDMODULES; iModule++)
653       fHistSSDRawSignalModule[iModule]->Reset();
654   }//online flag
655
656   rawReader->Select("ITSSSD",-1,-1);  
657   rawReader->Reset(); //rawReader->NextEvent();   
658   (fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset))->Fill(rawReader->GetType());
659   if(rawReader->GetType() == 7) {
660     fSSDEvent += 1;
661     fSSDEventPerCycle += 1;
662   }
663
664   AliITSRawStreamSSD gSSDStream(rawReader);    
665   AliRawReaderRoot *rootReader = (AliRawReaderRoot *)rawReader;
666   if(rootReader) {
667     const AliRawEventHeaderBase *header = rootReader->GetEventHeader();
668     if(header)
669       eventSize = header->GetEventSize();
670   }
671   while (gSSDStream.Next()) {
672     if(gSSDStream.GetModuleID() < 0) continue;
673     /*cout<<"DDL: "<<rawReader->GetDDLID()<<
674       " - LDC: "<<rawReader->GetLDCId()<<
675       " - Size: "<<rawReader->GetDataSize()<<
676       " - Equipment size: "<<rawReader->GetEquipmentSize()<<endl;*/
677     gSizePerDDL[rawReader->GetDDLID()] = rawReader->GetDataSize();
678     gSizePerLDC[rawReader->GetLDCId()-6] = rawReader->GetDataSize();
679     AliITSgeomTGeo::GetModuleId(gSSDStream.GetModuleID(),gLayer,gLadder,gModule);
680     if(gSSDStream.GetStrip() < 0) continue;
681     gStripNumber = (gSSDStream.GetSideFlag() == 0) ? gSSDStream.GetStrip() : -gSSDStream.GetStrip() + 2*fgkNumberOfPSideStrips;
682     gHistPosition = (gLayer == 5) ? ((gLadder - 1)*fgkSSDMODULESPERLADDERLAYER5 + gModule - 1) : ((gLadder - 1)*fgkSSDMODULESPERLADDERLAYER6 + gModule + fgkSSDMODULESLAYER5 - 1);
683     //AliInfo(Form("ModulePosition: %d - Layer: %d - Ladder: %d - Module: %d\n",gHistPosition,gLayer,gLadder,gModule));
684     if(fkOnline)
685       fHistSSDRawSignalModule[gHistPosition]->Fill(gStripNumber,gSSDStream.GetSignal());
686     //fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+gHistPosition+fSSDRawsCommonLevelOffset)->Fill(gStripNumber,gSSDStream.GetSignal());
687   }//streamer loop   
688   
689   //event size calculation and filling info
690   for(Int_t i = 0; i < fgkNumOfDDLs; i++) {
691     sumSSDDataSize += gSizePerDDL[i];
692     if(gSizePerDDL[i] > 0) {
693       (fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+3))->Fill(i+512);
694       (fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+5+i))->Fill(TMath::Log10(gSizePerDDL[i]));
695     }
696     //(fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+4))->Fill(i+512,gSizePerDDL[i]/1e+06);
697   }
698   for(Int_t i = 0; i < fgkNumOfLDCs; i++) {
699     if(gSizePerLDC[i] > 0) {
700       (fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+21))->Fill(i+6);
701       //LDC 082
702       if(i == 0)
703         gSizePerLDC[i] = gSizePerDDL[8] + gSizePerDDL[9] + gSizePerDDL[10] +
704           gSizePerDDL[11] + gSizePerDDL[12] + gSizePerDDL[13];
705       //LDC 086
706       if(i == 1)
707         gSizePerLDC[i] = gSizePerDDL[3] + gSizePerDDL[4] + gSizePerDDL[5] +
708           gSizePerDDL[6] + gSizePerDDL[7];
709       //LDC 085
710       if(i == 2)
711         gSizePerLDC[i] = gSizePerDDL[0] + gSizePerDDL[1] + gSizePerDDL[2] +
712           gSizePerDDL[14] + gSizePerDDL[15];
713       (fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+23+i))->Fill(TMath::Log10(gSizePerLDC[i]));
714       //cout<<"Event: "<<fSSDEventPerCycle<<" - LDC: "<<i+6<<
715       //" - Data size: "<<gSizePerLDC[i]<<endl;
716     }
717     //(fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+22))->Fill(i+6,gSizePerLDC[i]/1e+06);
718   }
719   if(sumSSDDataSize) 
720     (fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+1))->Fill(TMath::Log10(sumSSDDataSize));
721   if(eventSize)
722     (fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+2))->Fill(100.*sumSSDDataSize/eventSize);
723
724   //Occupancy calculation
725   if(fkOnline) {
726     for(Int_t iModule = 0; iModule < fgkSSDMODULES; iModule++) {
727       GetOccupancyStrip(fHistSSDRawSignalModule[iModule],fOccupancyMatrix[iModule]);
728       //if(iModule == 156) {    
729         //cout<<"========================================"<<endl;
730         //AliITSgeomTGeo::GetModuleId(656,gLayer,gLadder,gModule);
731         /*for(Int_t iBin = 1; iBin < fHistSSDRawSignalModule[iModule]->GetXaxis()->GetNbins(); iBin++) {
732           if((iBin >= 750)&&(iBin <= 780))
733           cout<<"Event: "<<fSSDEventPerCycle<<" - Ladder: "<<gLadder+499<<
734           " - Module: "<<gModule<<" - Strip: "<<iBin<<
735           " - Signal: "<<fHistSSDRawSignalModule[iModule]->GetBinContent(iBin)<<endl;
736           }*///strip loop --> to be removed
737       //}//module cut --> to be removed
738     }//module loop
739   }//online flag for SSD
740 }
741
742 //____________________________________________________________________________ //
743 void AliITSQASSDDataMakerRec::GetOccupancyStrip(TH1 *lHisto, Int_t *occupancyMatrix) { 
744   //Increments the entries in the occupancy matrix based 
745   //on whether the signal for each strip is larger than the cutoff
746   //Currently the cutoff is at 0 which means that if ZS
747   //works, whatever comes from the FEROM is considered as "signal"
748   //Double_t cutoff = 0.0;
749   TString histname = lHisto->GetName();
750   //cout<<histname.Data()<<endl;
751   //if(histname.Contains("Layer5_Ladder8_Module3")) {
752   for(Int_t iBin = 1; iBin < lHisto->GetXaxis()->GetNbins(); iBin++) {
753     Double_t y = lHisto->GetBinContent(iBin);
754     if(y) {
755       occupancyMatrix[iBin-1] += 1;
756     }
757     //if((iBin >= 750)&&(iBin <= 780))
758     //cout<<"Strip: "<<iBin<<
759     //" - Signal: "<<y<<
760     //" - Occupancy: "<<occupancyMatrix[iBin-1]<<endl;
761     
762   }
763   //}
764 }
765
766 //____________________________________________________________________________ 
767 Double_t AliITSQASSDDataMakerRec::GetOccupancyModule(TH1 *lHisto, 
768                                                      Int_t stripside,
769                                                      Int_t mode,
770                                                      Double_t threshold) {
771   //Mode 0: calculates the occupancy of a module 
772   //        without a threshold in the strip occupancy
773   //Mode 1: calculates the occupancy of a module 
774   //        with the set threshold in the strip occupancy
775   //Mode 2: calculates the average occupancy of a module 
776
777   // bo: TDC >0 or # of sigmas wrt noise ?
778   //stripside == 0 --> P-side
779   //stripside == 1 --> N-side
780   Int_t lNumFiredBins = 0;
781   Double_t sumOccupancy = 0.0;
782   TString histname = lHisto->GetName();
783   for(Int_t iBin = 1 + stripside*fgkNumberOfPSideStrips; iBin < fgkNumberOfPSideStrips*(1 + stripside); iBin++){
784     /*if(histname.Contains("Layer5_Ladder507_Module3")) {
785       cout<<lHisto->GetName()<<
786       " - Strip: "<<iBin<<
787       " - Bin content: "<<lHisto->GetBinContent(iBin)<<endl;
788       }*/
789     if (lHisto->GetBinContent(iBin) > threshold) {
790       lNumFiredBins++; 
791       sumOccupancy = lHisto->GetBinContent(iBin);
792     }
793   }
794   
795   Double_t lOccupancy = 0.0;
796   if((mode == 0)||(mode == 1))
797     lOccupancy = (100.*lNumFiredBins)/fgkNumberOfPSideStrips; // percentage  
798   else if(mode == 2)
799     lOccupancy = 100.*sumOccupancy/fgkNumberOfPSideStrips;
800
801   /*if(histname.Contains("Layer5_Ladder507_Module3"))
802     cout<<"Fired strips: "<<lNumFiredBins<<
803     " - Occupancy: "<<lOccupancy<<endl;*/
804   //AliInfo(Form("Fired strips: %d - Total strips: %d - Occupancy :%lf\n",lNumFiredBins,lHisto->GetNbinsX(),lOccupancy));
805   
806   return lOccupancy;
807 }
808
809 //____________________________________________________________________________
810 void AliITSQASSDDataMakerRec::MonitorOCDBObjects() { 
811   //Monitor in AMORE the output of the DA
812   //Currently only the bad channel list is monitored
813   //Todo: Noise - Pedestal
814   ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsOffset-fSSDRawsDAOffset))->Reset();
815   ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsOffset-fSSDRawsDAOffset+1))->Reset();
816   ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsOffset-fSSDRawsDAOffset+2))->Reset();
817   ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsOffset-fSSDRawsDAOffset+3))->Reset();
818
819   AliCDBEntry *entryBadChannelsSSD = fCDBManager->Get("ITS/Calib/BadChannelsSSD");
820   if(!entryBadChannelsSSD) 
821     AliError("OCDB entry for the bad channel list is not valid!"); 
822   AliITSBadChannelsSSDv2 *badchannelsSSD = (AliITSBadChannelsSSDv2 *)entryBadChannelsSSD->GetObject();
823   if(!badchannelsSSD)
824     AliError("Bad channel list object is not a valid AliITSBadChannelsSSD object!");
825
826   //_____________________________________________________________________________//                       
827   Int_t nBadPSideChannels = 0, nBadNSideChannels = 0;
828   Int_t layer = 0, ladder = 0, module = 0;
829   Int_t nPSideChannelsLayer5 = 0, nNSideChannelsLayer5 = 0;
830   Int_t nPSideChannelsLayer6 = 0, nNSideChannelsLayer6 = 0;
831   //_____________________________________________________________________________//                      
832
833   for(Int_t i = 0; i < fgkSSDMODULES; i++) {
834     AliITSgeomTGeo::GetModuleId(i+500,layer,ladder,module);
835     nBadPSideChannels = 0, nBadNSideChannels = 0;
836     nPSideChannelsLayer5 = 0, nNSideChannelsLayer5 = 0;
837     nPSideChannelsLayer6 = 0, nNSideChannelsLayer6 = 0;
838
839     Int_t badChannel = 0;
840     for(Int_t j = 0; j < fgkNumberOfPSideStrips; j++) {
841       badChannel = (Int_t)(badchannelsSSD->GetBadChannelP(i,j));
842       if(badChannel != 0) {
843         if(layer == 5)
844           nPSideChannelsLayer5 += 1;
845         if(layer == 6)
846           nPSideChannelsLayer6 += 1;
847         nBadPSideChannels += 1;
848       }//badchannel flag != 0
849       badChannel = (Int_t)(badchannelsSSD->GetBadChannelN(i,j));
850       if(badChannel != 0) {
851         if(layer == 5)
852           nNSideChannelsLayer5 += 1;
853         if(layer == 6)
854           nNSideChannelsLayer6 += 1;
855         nBadNSideChannels += 1;
856       }//badchannel flag != 0
857     }//loop over strips
858     if(layer == 5) {
859       if(nPSideChannelsLayer5 > 0)
860         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsOffset-fSSDRawsDAOffset))->Fill(module,499+ladder,
861                                                                             100.*nPSideChannelsLayer5/fgkNumberOfPSideStrips);
862       else ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsOffset-fSSDRawsDAOffset))->Fill(module,499+ladder,0.0001);
863       if(nNSideChannelsLayer5 > 0)
864         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsOffset-fSSDRawsDAOffset+1))->Fill(module,499+ladder,
865                                                                             100.*nNSideChannelsLayer5/fgkNumberOfPSideStrips);
866       else ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsOffset-fSSDRawsDAOffset+1))->Fill(module,499+ladder,0.0001);
867     }//layer 5                                                                                                                      
868     if(layer == 6) {
869       if(nPSideChannelsLayer6 > 0)
870         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsOffset-fSSDRawsDAOffset+2))->Fill(module,599+ladder,
871                                                                             100.*nPSideChannelsLayer6/fgkNumberOfPSideStrips);
872       else ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsOffset-fSSDRawsDAOffset+2))->Fill(module,599+ladder,0.0001);
873       if(nNSideChannelsLayer6 > 0)
874         ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsOffset-fSSDRawsDAOffset+3))->Fill(module,599+ladder,
875                                                                             100.*nNSideChannelsLayer6/fgkNumberOfPSideStrips);
876       else ((TH2D *)fAliITSQADataMakerRec->GetRawsData(fGenRawsOffset+fSSDRawsOffset-fSSDRawsDAOffset+3))->Fill(module,599+ladder,0.0001);
877     }//layer 6                                                                                                                      
878   }//module loop
879 }
880
881 //____________________________________________________________________________ 
882 void AliITSQASSDDataMakerRec::InitRecPoints()
883 {
884   // Initialization for RECPOINTS - SSD -
885   fGenRecPointsOffset = (fAliITSQADataMakerRec->fRecPointsQAList[AliRecoParam::kDefault])->GetEntries();
886   //AliInfo(Form("**-------*-*-*-*-*-*-***************AliITSQASSDataMakerRec::MakeRecpoints offset %d \t %d \n",fGenOffset,fGenRecPointsOffset));
887   Int_t nModuleOffset = 500;
888   Int_t nITSTotalModules = AliITSgeomTGeo::GetNModules();
889
890   TH1F *fHistSSDModuleIdLayer5 = new TH1F("SSD/Statistics/fHistSSDModuleIdLayer5",
891                                        "Module Id - Layer 5;Module Id;Entries",
892                                        fgkSSDMODULESLAYER5,
893                                        nModuleOffset - 0.5,
894                                        nITSTotalModules-fgkSSDMODULESLAYER6+0.5);
895   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDModuleIdLayer5, 
896                                            fGenRecPointsOffset + 0, kTRUE);
897   fSSDhRecPointsTask += 1;
898   TH1F *fHistSSDModuleIdLayer6 = new TH1F("SSD/Statistics/fHistSSDModuleIdLayer6",
899                                        "Module Id - Layer 6;Module Id;Entries",
900                                        fgkSSDMODULESLAYER6,
901                                        nModuleOffset+fgkSSDMODULESLAYER5 - 0.5,
902                                        nITSTotalModules + 0.5);
903   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDModuleIdLayer6, 
904                                            fGenRecPointsOffset + 1, kTRUE);
905   fSSDhRecPointsTask += 1;
906   TH1F *fHistSSDClusterPerEventLayer5 = new TH1F("SSD/Statistics/fHistSSDClusterPerEventLayer5",
907                                               "N_{clusters} - Layer 5;N_{clusters};Entries;",
908                                               100,0.1,5000);
909   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDClusterPerEventLayer5,
910                                            fGenRecPointsOffset + 2, kTRUE);
911   fSSDhRecPointsTask += 1;
912   TH1F *fHistSSDClusterPerEventLayer6 = new TH1F("SSD/Statistics/fHistSSDClusterPerEventLayer6",
913                                               "N_{clusters} - Layer 6;N_{clusters};Entries;",
914                                               100,0.1,5000);
915   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDClusterPerEventLayer6,
916                                            fGenRecPointsOffset + 3, kTRUE);
917   fSSDhRecPointsTask += 1;
918   TH1F *fHistSSDLocalXLayer5 = new TH1F("SSD/Coordinates/fHistSSDLocalXLayer5",
919                                      "Local x coord.- Layer 5;x [cm];Entries;",
920                                      100,-4.,4.);
921   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDLocalXLayer5,
922                                            fGenRecPointsOffset + 4, kTRUE);
923   fSSDhRecPointsTask += 1;
924   TH1F *fHistSSDLocalXLayer6 = new TH1F("SSD/Coordinates/fHistSSDLocalXLayer6",
925                                      "Local x coord.- Layer 6;x [cm];Entries;",
926                                      100,-4.,4.);
927   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDLocalXLayer6, 
928                                            fGenRecPointsOffset + 5, kTRUE);
929   fSSDhRecPointsTask += 1;
930   TH1F *fHistSSDLocalZLayer5 = new TH1F("SSD/Coordinates/fHistSSDLocalZLayer5",
931                                      "Local z coord.- Layer 5;z [cm];Entries;",
932                                      100,-4.,4.);
933   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDLocalZLayer5, 
934                                            fGenRecPointsOffset + 6, kTRUE);
935   fSSDhRecPointsTask += 1;
936   TH1F *fHistSSDLocalZLayer6 = new TH1F("SSD/Coordinates/fHistSSDLocalZLayer6",
937                                      "Local z coord.- Layer 6;z [cm];Entries;",
938                                      100,-4.,4.);
939   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDLocalZLayer6, 
940                                            fGenRecPointsOffset + 7, kTRUE);
941   fSSDhRecPointsTask += 1;
942   TH1F *fHistSSDGlobalXLayer5 = new TH1F("SSD/Coordinates/fHistSSDGlobalXLayer5",
943                                       "Global x - Layer 5;x [cm];Entries;",
944                                       100,-40.,40.);
945   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDGlobalXLayer5, 
946                                            fGenRecPointsOffset + 8, kTRUE);
947   fSSDhRecPointsTask += 1;
948   TH1F *fHistSSDGlobalXLayer6 = new TH1F("SSD/Coordinates/fHistSSDGlobalXLayer6",
949                                       "Global x - Layer 6;x [cm];Entries;",
950                                       100,-45.,45.);
951   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDGlobalXLayer6, 
952                                            fGenRecPointsOffset + 9, kTRUE);
953   fSSDhRecPointsTask += 1;
954   TH1F *fHistSSDGlobalYLayer5 = new TH1F("SSD/Coordinates/fHistSSDGlobalYLayer5",
955                                       "Global y - Layer 5;y [cm];Entries;",
956                                       100,-40.,40);
957   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDGlobalYLayer5, 
958                                            fGenRecPointsOffset + 10, kTRUE);
959   fSSDhRecPointsTask += 1;
960   TH1F *fHistSSDGlobalYLayer6 = new TH1F("SSD/Coordinates/fHistSSDGlobalYLayer6",
961                                       "Global y - Layer 6;y [cm];Entries;",
962                                       100,-45.,45.);
963   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDGlobalYLayer6, 
964                                            fGenRecPointsOffset + 11, kTRUE);
965   fSSDhRecPointsTask += 1;
966   TH1F *fHistSSDGlobalZLayer5 = new TH1F("SSD/Coordinates/fHistSSDGlobalZLayer5",
967                                       "Global z - Layer 5;z [cm];Entries;",
968                                       100,-45.,45);
969   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDGlobalZLayer5, 
970                                            fGenRecPointsOffset + 12, kTRUE);
971   fSSDhRecPointsTask += 1;
972   TH1F *fHistSSDGlobalZLayer6 = new TH1F("SSD/Coordinates/fHistSSDGlobalZLayer6",
973                                       "Global z - Layer 6;z [cm];Entries;",
974                                       100,-55.,55.);
975   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDGlobalZLayer6, 
976                                            fGenRecPointsOffset + 13, kTRUE);
977   fSSDhRecPointsTask += 1;
978   TH1F *fHistSSDPhiLayer5 = new TH1F("SSD/Coordinates/fHistSSDPhiLayer5",
979                                   "#phi - Layer 5;#phi [rad];Entries;",
980                                   100,-TMath::Pi(),TMath::Pi());
981   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDPhiLayer5, 
982                                            fGenRecPointsOffset + 14, kTRUE);
983   fSSDhRecPointsTask += 1;
984   TH1F *fHistSSDPhiLayer6 = new TH1F("SSD/Coordinates/fHistSSDPhiLayer6",
985                                   "#phi - Layer 6;#phi [rad];Entries;",
986                                   100,-TMath::Pi(),TMath::Pi());
987   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDPhiLayer6, 
988                                            fGenRecPointsOffset + 15, kTRUE);
989   fSSDhRecPointsTask += 1;
990   TH1F *fHistSSDThetaLayer5 = new TH1F("SSD/Coordinates/fHistSSDThetaLayer5",
991                                     "#theta - Layer 5;#theta [rad];Entries;",
992                                     100,-TMath::Pi(),TMath::Pi());
993   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDThetaLayer5, 
994                                            fGenRecPointsOffset + 16, kTRUE);
995   fSSDhRecPointsTask += 1;
996   TH1F *fHistSSDThetaLayer6 = new TH1F("SSD/Coordinates/fHistSSDThetaLayer6",
997                                     "#theta - Layer 6;#theta [rad];Entries;",
998                                     100,-TMath::Pi(),TMath::Pi());
999   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDThetaLayer6, 
1000                                            fGenRecPointsOffset + 17, kTRUE);
1001   fSSDhRecPointsTask += 1;
1002   TH1F *fHistSSDRadiusLayer5 = new TH1F("SSD/Coordinates/fHistSSDRadiusLayer5",
1003                                      "r - Layer 5;r [cm];Entries;",
1004                                      100,35.,50.);
1005   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDRadiusLayer5, 
1006                                            fGenRecPointsOffset + 18, kTRUE);
1007   fSSDhRecPointsTask += 1;
1008   TH1F *fHistSSDRadiusLayer6 = new TH1F("SSD/Coordinates/fHistSSDRadiusLayer6",
1009                                      "r - Layer 6;r [cm];Entries;",
1010                                      100,35.,50.);
1011   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDRadiusLayer6, 
1012                                            fGenRecPointsOffset + 19, kTRUE);
1013   fSSDhRecPointsTask += 1;
1014   TH1F *fHistSSDClusterTypeLayer5 = new TH1F("SSD/ClusterCharge/Layer5/fHistSSDClusterTypeLayer5",
1015                                           "CL type - Layer 5;Cluster type;Entries;",
1016                                           150,0,150);
1017   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDClusterTypeLayer5, 
1018                                            fGenRecPointsOffset + 20, kTRUE);
1019   fSSDhRecPointsTask += 1;
1020   TH1F *fHistSSDClusterTypeLayer6 = new TH1F("SSD/ClusterCharge/Layer6/fHistSSDClusterTypeLayer6",
1021                                           "CL type - Layer 6;Cluster type;Entries;",
1022                                           150,0,150);
1023   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDClusterTypeLayer6, 
1024                                            fGenRecPointsOffset + 21, kTRUE);
1025   fSSDhRecPointsTask += 1;
1026   TH1F *fHistSSDChargeRatioLayer5 = new TH1F("SSD/ClusterCharge/Layer5/fHistSSDChargeRatioLayer5",
1027                                           "Charge ratio - Layer 5;q_{ratio};Entries;",
1028                                           100,-2.0,2.0);
1029   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargeRatioLayer5, 
1030                                            fGenRecPointsOffset + 22, kTRUE);
1031   fSSDhRecPointsTask += 1;
1032   TH1F *fHistSSDChargeRatioLayer6 = new TH1F("SSD/ClusterCharge/Layer6/fHistSSDChargeRatioLayer6",
1033                                           "Charge ratio - Layer 6;q_{ratio};Entries;",
1034                                           100,-2.0,2.0);
1035   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargeRatioLayer6, 
1036                                            fGenRecPointsOffset + 23, kTRUE);
1037   fSSDhRecPointsTask += 1;
1038   TH1F *fHistSSDChargekeVLayer5 = new TH1F("SSD/ClusterCharge/Layer5/fHistSSDChargekeVLayer5",
1039                                         "Charge - Layer 5;q [keV];Entries;",
1040                                         100,0.,300.);
1041   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargekeVLayer5, 
1042                                            fGenRecPointsOffset + 24);
1043   fSSDhRecPointsTask += 1;
1044   TH1F *fHistSSDChargekeVLayer6 = new TH1F("SSD/ClusterCharge/Layer6/fHistSSDChargekeVLayer6",
1045                                         "Charge - Layer 6;q [keV];Entries;",
1046                                         100,0.,300.);
1047   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargekeVLayer6, 
1048                                            fGenRecPointsOffset + 25);
1049   fSSDhRecPointsTask += 1;
1050   TH1F *fHistSSDChargePSideLayer5 = new TH1F("SSD/ClusterCharge/Layer5/fHistSSDChargePSideLayer5",
1051                                           "Charge P- Layer 5;q_{P} [keV];Entries;",
1052                                           100,0.,300.);
1053   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargePSideLayer5,
1054                                            fGenRecPointsOffset + 26, kTRUE);
1055   fSSDhRecPointsTask += 1;
1056   TH1F *fHistSSDChargePSideLayer6 = new TH1F("SSD/ClusterCharge/Layer6/fHistSSDChargePSideLayer6",
1057                                           "Charge P- Layer 6;q_{P} [keV];Entries;",
1058                                           100,0.,300.);
1059   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargePSideLayer6,
1060                                            fGenRecPointsOffset + 27, kTRUE);
1061   fSSDhRecPointsTask += 1;
1062   TH1F *fHistSSDChargeNSideLayer5 = new TH1F("SSD/ClusterCharge/Layer5/fHistSSDChargeNSideLayer5",
1063                                           "Charge N- Layer 5;q_{N} [keV];Entries;",
1064                                           100,0.,300.);
1065   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargeNSideLayer5,
1066                                            fGenRecPointsOffset + 28, kTRUE);
1067   fSSDhRecPointsTask += 1;
1068   TH1F *fHistSSDChargeNSideLayer6 = new TH1F("SSD/ClusterCharge/Layer6/fHistSSDChargeNSideLayer6",
1069                                           "Charge N- Layer 6;q_{N} [keV];Entries;",
1070                                           100,0.,300.);
1071   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargeNSideLayer6,
1072                                            fGenRecPointsOffset + 29, kTRUE);
1073   fSSDhRecPointsTask += 1;
1074   TH1F *fHistSSDChargeRatio2Layer5 = new TH1F("SSD/ClusterCharge/Layer5/fHistSSDChargeRatio2Layer5",
1075                                           "Charge Ratio qN/qP - Layer 5;q_{N}/q_{P};Entries;",
1076                                           100,0,2);
1077   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargeRatio2Layer5,
1078                                            fGenRecPointsOffset + 30, kTRUE);
1079   fSSDhRecPointsTask += 1;
1080   TH1F *fHistSSDChargeRatio2Layer6 = new TH1F("SSD/ClusterCharge/Layer6/fHistSSDChargeRatio2Layer6",
1081                                            "Charge Ratio qN/qP - Layer 6;q_{N}/q_{P};Entries;",
1082                                            100,0,2);
1083   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargeRatio2Layer6,
1084                                            fGenRecPointsOffset + 31, kTRUE);
1085   fSSDhRecPointsTask += 1;
1086   TH2F *fHistSSDChargePNSideLayer5 = new TH2F("SSD/ClusterCharge/Layer5/fHistSSDChargePNSideLayer5",
1087                                            "Charge correlation - Layer 5;q_{P} [keV];q_{N} [keV]",
1088                                            100,0.,300.,
1089                                            100,0.,300.);
1090   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargePNSideLayer5,
1091                                            fGenRecPointsOffset + 32, kTRUE);
1092   fSSDhRecPointsTask += 1;
1093   TH2F *fHistSSDChargePNSideLayer6 = new TH2F("SSD/ClusterCharge/Layer6/fHistSSDChargePNSideLayer6",
1094                                            "Charge correlation - Layer 6;q_{P} [keV];q_{N} [keV]",
1095                                            100,0.,300.,
1096                                            100,0.,300.);
1097   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargePNSideLayer6,
1098                                            fGenRecPointsOffset + 33, kTRUE);
1099   fSSDhRecPointsTask += 1;
1100   TH2F *fHistSSDChargeMapLayer5 = new TH2F("SSD/ClusterCharge/Layer5/fHistSSDChargeMapLayer5",
1101                                         "Charge map;N_{modules};N_{Ladders}",
1102                                         fgkSSDMODULESPERLADDERLAYER5,
1103                                         -0.5,fgkSSDMODULESPERLADDERLAYER5+0.5,
1104                                         3*fgkSSDLADDERSLAYER5,
1105                                         -0.5,fgkSSDLADDERSLAYER5+0.5);
1106   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargeMapLayer5, 
1107                                            fGenRecPointsOffset + 34, kTRUE);
1108   fSSDhRecPointsTask += 1;
1109   TH2F *fHistSSDChargeMapLayer6 = new TH2F("SSD/ClusterCharge/Layer6/fHistSSDChargeMapLayer6",
1110                                         "Charge map;N_{modules};N_{Ladders}",
1111                                         fgkSSDMODULESPERLADDERLAYER6,
1112                                         -0.5,fgkSSDMODULESPERLADDERLAYER6+0.5,
1113                                         3*fgkSSDLADDERSLAYER6,
1114                                         -0.5,fgkSSDLADDERSLAYER6+0.5);
1115   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDChargeMapLayer6, 
1116                                            fGenRecPointsOffset + 35, kTRUE);
1117   fSSDhRecPointsTask += 1;
1118   TH2F *fHistSSDClusterMapLayer5 = new TH2F("SSD/Statistics/Layer5/fHistSSDClusterMapLayer5",
1119                                          "Layer 5;N_{module};N_{ladder}",
1120                                          22,1,23,
1121                                          34,500,534);
1122   fHistSSDClusterMapLayer5->GetXaxis()->SetTitleColor(1);
1123   fHistSSDClusterMapLayer5->SetStats(kFALSE);
1124   fHistSSDClusterMapLayer5->GetYaxis()->SetTitleOffset(1.8);
1125   fHistSSDClusterMapLayer5->GetXaxis()->SetNdivisions(22);
1126   fHistSSDClusterMapLayer5->GetYaxis()->SetNdivisions(34);
1127   fHistSSDClusterMapLayer5->GetXaxis()->SetLabelSize(0.03);
1128   fHistSSDClusterMapLayer5->GetYaxis()->SetLabelSize(0.03);
1129   fHistSSDClusterMapLayer5->GetZaxis()->SetTitleOffset(1.4);
1130   fHistSSDClusterMapLayer5->GetZaxis()->SetTitle("N_{clusters}");
1131   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDClusterMapLayer5,
1132                                            fGenRecPointsOffset + 36);
1133   fSSDhRecPointsTask += 1;
1134   TH2F *fHistSSDClusterMapLayer6 = new TH2F("SSD/Statistics/Layer6/fHistSSDClusterMapLayer6",
1135                                          "Layer 6;N_{module};N_{ladder}",
1136                                          25,1,26,
1137                                          38,600,638);
1138   fHistSSDClusterMapLayer6->GetXaxis()->SetTitleColor(1);
1139   fHistSSDClusterMapLayer6->SetStats(kFALSE);
1140   fHistSSDClusterMapLayer6->GetYaxis()->SetTitleOffset(1.8);
1141   fHistSSDClusterMapLayer6->GetXaxis()->SetNdivisions(25);
1142   fHistSSDClusterMapLayer6->GetYaxis()->SetNdivisions(38);
1143   fHistSSDClusterMapLayer6->GetXaxis()->SetLabelSize(0.03);
1144   fHistSSDClusterMapLayer6->GetYaxis()->SetLabelSize(0.03);
1145   fHistSSDClusterMapLayer6->GetZaxis()->SetTitleOffset(1.4);
1146   fHistSSDClusterMapLayer6->GetZaxis()->SetTitle("N_{clusters}");
1147   fAliITSQADataMakerRec->Add2RecPointsList(fHistSSDClusterMapLayer6,
1148                                            fGenRecPointsOffset + 37);
1149   fSSDhRecPointsTask += 1;
1150   //printf ("%d SSD Recs histograms booked\n",fSSDhRecPointsTask);
1151   AliDebug(1,Form("%d SSD Recs histograms booked\n",fSSDhRecPointsTask));
1152 }
1153
1154 //____________________________________________________________________________ 
1155 void AliITSQASSDDataMakerRec::MakeRecPoints(TTree *clustersTree)
1156 {
1157   // Fill QA for recpoints - SSD -
1158   //printf("*-*-*-*-*-*-*---*-*-*-------*-*-*-*-*-*-***************AliITSQASSDataMakerRec::MakeRecpoints called \n");
1159   Int_t gLayer = 0, gLadder = 0, gModule = 0;
1160   Int_t lLadderLocationY = 0;
1161   TBranch *branchRecP = clustersTree->GetBranch("ITSRecPoints");
1162   if (!branchRecP) { 
1163     AliError("can't get the branch with the ITS clusters !");
1164     return;
1165   }
1166   static TClonesArray statRecpoints("AliITSRecPoint");
1167   TClonesArray *recpoints = &statRecpoints;
1168   branchRecP->SetAddress(&recpoints);
1169   Int_t nClustersLayer5 = 0, nClustersLayer6 = 0;
1170   Int_t npoints = 0;      
1171   Float_t cluglo[3]={0.,0.,0.}; 
1172   //printf("*-*-*-*-*-*-*---*-*-*-------*-*-*-*-*-*-***************AliITSQASSDataMakerRec::MakeRecpoints STEP1 \n");
1173   for(Int_t module = 0; module < clustersTree->GetEntries(); module++){
1174     branchRecP->GetEvent(module);
1175     npoints += recpoints->GetEntries();
1176     AliITSgeomTGeo::GetModuleId(module,gLayer,gLadder,gModule);
1177     //printf("SSDDataMAkerRec:::::::::::::::::::::::gLayer ========== %d \n\n",gLayer);
1178     lLadderLocationY = 3*gLadder;
1179     ////printf("*-*-*-*-*-*-*---*-*-*-------*-*-*-*-*-*-***************AliITSQASSDataMakerRec::MakeRecpoints inside loop \n");
1180     for(Int_t j = 0;j < recpoints->GetEntries(); j++){
1181       ////printf("*-*-*-*-*-*-*---*-*-*-------*-*-*-*-*-*-***************AliITSQASSDataMakerRec::MakeRecpoints inside loop 2\n");
1182       AliITSRecPoint *recp = (AliITSRecPoint*)recpoints->At(j);    
1183       Int_t layer = recp->GetLayer();
1184       //printf("SSDDataMAkerRec:::::::::::::::::::::::layer ========== %d \n\n",layer);
1185       recp->GetGlobalXYZ(cluglo);
1186       Float_t radius = TMath::Sqrt(cluglo[0]*cluglo[0]+cluglo[1]*cluglo[1]); 
1187       Float_t phi = TMath::ATan2(cluglo[1],cluglo[0]);
1188       Float_t theta = TMath::ATan2(radius,cluglo[2]);
1189       Double_t chargeRatio = recp->GetChargeRatio();
1190       Double_t clusterCharge = recp->GetQ();
1191       Double_t chargePSide = clusterCharge*(1. + chargeRatio);
1192       Double_t chargeNSide = clusterCharge*(1. - chargeRatio);
1193       if(layer == 4) {
1194         //printf("-*-*-*-*-*-***************AliITSQASSDataMakerRec::MakeRecpoints Filling 4 called \n");
1195         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 0)->Fill(module);
1196         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 4)->Fill(recp->GetDetLocalX());
1197         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 6)->Fill(recp->GetDetLocalZ());
1198         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 8)->Fill(cluglo[0]);
1199         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 10)->Fill(cluglo[1]);
1200         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 12)->Fill(cluglo[2]);
1201         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 14)->Fill(phi);
1202         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 16)->Fill(theta);
1203         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 18)->Fill(radius);
1204         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 20)->Fill(recp->GetType());
1205         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 22)->Fill(recp->GetChargeRatio());
1206         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 24)->Fill(recp->GetQ());
1207         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 26)->Fill(chargePSide);
1208         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 28)->Fill(chargeNSide);
1209         if(chargePSide != 0.) fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 30)->Fill(chargeNSide/chargePSide);
1210         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 32)->Fill(chargePSide,chargeNSide);
1211         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 34)->SetBinContent(gModule,lLadderLocationY,recp->GetQ());
1212         ((TH2F *)fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 36))->Fill(gModule,499+gLadder,1);
1213         nClustersLayer5 += 1;
1214       }//layer 5 histograms
1215       if(layer == 5) {
1216         //printf("-*-*-*-*-*-***************AliITSQASSDataMakerRec::MakeRecpoints Filling 5 called \n");
1217         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 1)->Fill(module);
1218         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 5)->Fill(recp->GetDetLocalX());
1219         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 7)->Fill(recp->GetDetLocalZ());
1220         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 9)->Fill(cluglo[0]);
1221         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 11)->Fill(cluglo[1]);
1222         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 13)->Fill(cluglo[2]);
1223         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 15)->Fill(phi);
1224         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 17)->Fill(theta);
1225         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 19)->Fill(radius);
1226         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 21)->Fill(recp->GetType());
1227         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 23)->Fill(recp->GetChargeRatio());
1228         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 25)->Fill(recp->GetQ());
1229         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 27)->Fill(chargePSide);
1230         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 29)->Fill(chargeNSide);
1231         if(chargePSide != 0.) fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 31)->Fill(chargeNSide/chargePSide);
1232         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 33)->Fill(chargePSide,chargeNSide);
1233         fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 35)->SetBinContent(gModule,lLadderLocationY,recp->GetQ());
1234         ((TH2F *)fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 37))->Fill(gModule,599+gLadder,1);
1235         nClustersLayer6 += 1;
1236       }//layer 6 histograms
1237     }//rec. points loop
1238   }//module loop
1239   
1240   //printf("-*-*-*-*-*-***************AliITSQASSDataMakerRec::MakeRecpoints Filling called \n");
1241   fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 2)->Fill(nClustersLayer5);
1242   fAliITSQADataMakerRec->GetRecPointsData(fGenRecPointsOffset + 3)->Fill(nClustersLayer6);
1243
1244   statRecpoints.Clear();
1245 }
1246
1247 //____________________________________________________________________________ 
1248 Int_t AliITSQASSDDataMakerRec::GetOffset(AliQA::TASKINDEX_t task) {
1249   // Returns offset number according to the specified task 
1250   Int_t offset=0;
1251   if( task == AliQA::kRAWS ) {
1252     offset=fGenRawsOffset;  
1253   }
1254   else if( task == AliQA::kRECPOINTS ) {
1255     offset=fGenRecPointsOffset;   
1256   }
1257   else {
1258     AliInfo("No task has been selected. Offset set to zero.\n");
1259   }
1260
1261   return offset;
1262 }
1263
1264 //____________________________________________________________________________ 
1265 Int_t AliITSQASSDDataMakerRec::GetTaskHisto(AliQA::TASKINDEX_t task) {
1266   // Returns the number of histograms associated to the specified task
1267   Int_t histotot=0;
1268
1269   if( task == AliQA::kRAWS ) {
1270     histotot=fSSDhRawsTask;  
1271   }
1272   else if( task == AliQA::kRECPOINTS ){
1273     histotot=fSSDhRecPointsTask;   
1274   }
1275   else { 
1276     AliInfo("No task has been selected. TaskHisto set to zero.\n");
1277   }
1278
1279   return histotot;
1280 }