]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSQASDDDataMakerRec.cxx
bugfix: correctly handle steering events in order to avoid warning 'Data source compo...
[u/mrichter/AliRoot.git] / ITS / AliITSQASDDDataMakerRec.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
16 /* $Id$ */
17
18 //  *************************************************************
19 //  Checks the quality assurance 
20 //  by comparing with reference data
21 //  contained in a DB
22 //  -------------------------------------------------------------
23 //  W. Ferrarese + P. Cerello Feb 2008
24 //  M.Siciliano Aug 2008 QA RecPoints and HLT mode
25 //  INFN Torino
26
27 // --- ROOT system ---
28 #include <TProfile2D.h>
29 #include <TH2D.h>
30 #include <TBranch.h>
31 #include <TTree.h>
32 #include <TGaxis.h>
33 #include <TMath.h>
34 #include <TDirectory.h>
35 #include <TSystem.h>
36 // --- Standard library ---
37
38 // --- AliRoot header files ---
39 #include "AliITSQASDDDataMakerRec.h"
40 #include "AliLog.h"
41 #include "AliQA.h"
42 #include "AliQAChecker.h"
43 #include "AliRawReader.h"
44 #include "AliITSRawStream.h"
45 #include "AliITSRawStreamSDD.h"
46 #include "AliITSRawStreamSDDCompressed.h"
47 #include "AliITSDetTypeRec.h"
48 #include "AliITSRecPoint.h"
49 #include "AliITSgeomTGeo.h"
50 #include "AliITSHLTforSDD.h"
51 #include "AliCDBManager.h"
52 #include "AliCDBStorage.h"
53 #include "AliCDBEntry.h"
54
55
56 ClassImp(AliITSQASDDDataMakerRec)
57
58 //____________________________________________________________________________ 
59 AliITSQASDDDataMakerRec::AliITSQASDDDataMakerRec(AliITSQADataMakerRec *aliITSQADataMakerRec, Bool_t kMode, Short_t ldc) :
60 TObject(),
61 fAliITSQADataMakerRec(aliITSQADataMakerRec),
62 fkOnline(kMode),
63 fLDC(ldc),
64 fSDDhTask(0),
65 fGenOffset(0),
66 fTimeBinSize(1),
67 fDDLModuleMap(0),
68 fHLTMode(0),
69 fHLTSDD(0)
70 {
71   //ctor used to discriminate OnLine-Offline analysis
72   if(fLDC < 0 || fLDC > 4) {
73         AliError("Error: LDC number out of range; return\n");
74   }
75   if(!fkOnline){AliInfo("Offline mode: HLT set from AliITSDetTypeRec for SDD\n");}
76   else
77     if(fkOnline){
78       AliInfo("Online mode: HLT set from environment for SDD\n");
79       SetHLTModeFromEnvironment();
80     }
81   //fDDLModuleMap=NULL;
82 }
83
84 //____________________________________________________________________________ 
85 AliITSQASDDDataMakerRec::AliITSQASDDDataMakerRec(const AliITSQASDDDataMakerRec& qadm) :
86 TObject(),
87 fAliITSQADataMakerRec(qadm.fAliITSQADataMakerRec),
88 fkOnline(qadm.fkOnline),
89 fLDC(qadm.fLDC),
90 fSDDhTask(qadm.fSDDhTask),
91 fGenOffset(qadm.fGenOffset),
92 fTimeBinSize(1),
93 fDDLModuleMap(0),
94 fHLTMode(qadm.fHLTMode),
95 fHLTSDD( qadm.fHLTSDD)
96 {
97   //copy ctor 
98   fAliITSQADataMakerRec->SetName((const char*)qadm.fAliITSQADataMakerRec->GetName()) ; 
99   fAliITSQADataMakerRec->SetTitle((const char*)qadm.fAliITSQADataMakerRec->GetTitle());
100   fDDLModuleMap=NULL;
101 }
102
103 //____________________________________________________________________________ 
104 AliITSQASDDDataMakerRec::~AliITSQASDDDataMakerRec(){
105   // destructor
106   //    if(fDDLModuleMap) delete fDDLModuleMap;
107 }
108 //__________________________________________________________________
109 AliITSQASDDDataMakerRec& AliITSQASDDDataMakerRec::operator = (const AliITSQASDDDataMakerRec& qac )
110 {
111   // Equal operator.
112   this->~AliITSQASDDDataMakerRec();
113   new(this) AliITSQASDDDataMakerRec(qac);
114   return *this;
115 }
116
117 //____________________________________________________________________________ 
118 void AliITSQASDDDataMakerRec::StartOfDetectorCycle()
119 {
120   //Detector specific actions at start of cycle
121   AliDebug(1,"AliITSQADM::Start of SDD Cycle\n");
122 }
123
124 //____________________________________________________________________________ 
125 void AliITSQASDDDataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t /*task*/, TObjArray* /*list*/)
126 {
127   // launch the QA checking
128   AliDebug(1,"AliITSDM instantiates checker with Run(AliQA::kITS, task, list)\n"); 
129 }
130
131 //____________________________________________________________________________ 
132 void AliITSQASDDDataMakerRec::InitRaws()
133
134   // Initialization for RAW data - SDD -
135   fGenOffset = (fAliITSQADataMakerRec->fRawsQAList)->GetEntries();
136
137   AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD");
138   Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
139   if(!ddlMapSDD)
140     {
141       AliError("Calibration object retrieval failed! SDD will not be processed");
142       fDDLModuleMap = NULL;
143       return;
144     }
145   fDDLModuleMap = (AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
146   if(!cacheStatus)ddlMapSDD->SetObject(NULL);
147   ddlMapSDD->SetOwner(kTRUE);
148   if(!cacheStatus)
149     {
150       delete ddlMapSDD;
151     }
152
153   if(fkOnline==kFALSE){
154     AliInfo("Offline mode: HLTforSDDobject used \n");
155     AliCDBEntry *hltforSDD = AliCDBManager::Instance()->Get("ITS/Calib/HLTforSDD");
156     if(!hltforSDD){
157       AliError("Calibration object retrieval failed! SDD will not be processed");    
158       fHLTSDD=NULL;
159       return;
160     }  
161     fHLTSDD = (AliITSHLTforSDD*)hltforSDD->GetObject();
162     if(!cacheStatus)hltforSDD->SetObject(NULL);
163     hltforSDD->SetOwner(kTRUE);
164     if(!cacheStatus)
165       {
166         delete hltforSDD;
167       }
168   }
169   Int_t lay, lad, det;
170   Int_t LAY = -1;  //, LAD = -1;
171   char hname0[50];
172   Int_t indexlast = 0;
173   Int_t index1 = 0;
174
175   if(fLDC == 1 || fLDC == 2) LAY = 2;
176   if(fLDC == 3 || fLDC == 4) LAY = 3;
177   
178   if(fkOnline) {
179     AliInfo("Book Online Histograms for SDD\n");
180   }
181   else {
182     AliInfo("Book Offline Histograms for SDD\n ");
183   }
184   TH1D *h0 = new TH1D("SDDModPattern","HW Modules pattern",fgknSDDmodules,239.5,499.5);
185   h0->GetXaxis()->SetTitle("Module Number");
186   h0->GetYaxis()->SetTitle("Counts");
187   fAliITSQADataMakerRec->Add2RawsList((new TH1D(*h0)),0+fGenOffset,kTRUE,kFALSE);
188   delete h0;
189   fSDDhTask++;
190   if(fLDC==0 || fLDC==1 || fLDC==2){
191     TH1D *h1 = new TH1D("SDDLadPatternL3","Ladder pattern L3",14,0.5,14.5);  
192     h1->GetXaxis()->SetTitle("Ladder Number on Lay3");
193     h1->GetYaxis()->SetTitle("Counts");
194     fAliITSQADataMakerRec->Add2RawsList((new TH1D(*h1)),1+fGenOffset, kTRUE,kFALSE);
195         delete h1;
196     fSDDhTask++;
197   }     
198   if(fLDC==0 || fLDC==3 || fLDC==4){
199     TH1D *h2 = new TH1D("SDDLadPatternL4","Ladder pattern L4",22,0.5,22.5);  
200     h2->GetXaxis()->SetTitle("Ladder Number on Lay4");
201     h2->GetYaxis()->SetTitle("Counts");
202     fAliITSQADataMakerRec->Add2RawsList((new TH1D(*h2)),2+fGenOffset, kTRUE,kFALSE);
203         delete h2;
204     fSDDhTask++;
205   }
206   if(fLDC==0 || fLDC==1 || fLDC==2){
207         for(Int_t i=1; i<=fgkLADDonLAY3; i++) {
208       sprintf(hname0,"SDDModPattern_L3_%d",i);
209       TH1D *h3 = new TH1D(hname0,hname0,6,0.5,6.5);
210       h3->GetXaxis()->SetTitle("Module Number");
211       h3->GetYaxis()->SetTitle("Counts");
212       fAliITSQADataMakerRec->Add2RawsList((new TH1D(*h3)),i-1+3+fGenOffset, kTRUE, kFALSE);
213           delete h3;
214       fSDDhTask++;
215     }
216   }
217   if(fLDC==0 || fLDC==3 || fLDC==4){
218     for(Int_t i=1; i<=fgkLADDonLAY4; i++) {
219       sprintf(hname0,"SDDModPattern_L4_%d",i);
220       TH1D *h4 = new TH1D(hname0,hname0,8,0.5,8.5);
221       h4->GetXaxis()->SetTitle("Module Number");
222       h4->GetYaxis()->SetTitle("Counts");
223       fAliITSQADataMakerRec->Add2RawsList((new TH1D(*h4)),i-1+17+fGenOffset, kTRUE,kFALSE);
224           delete h4;
225       fSDDhTask++;
226     }
227   }
228
229   //zPhi distribution using ladder and modules numbers
230       TH2D *hphil3 = new TH2D("SDDphizL3","SDD #varphiz Layer3 ",6,0.5,6.5,14,0.5,14.5);
231       hphil3->GetXaxis()->SetTitle("z[#Module L3 ]");
232       hphil3->GetYaxis()->SetTitle("#varphi[#Ladder L3]");
233       fAliITSQADataMakerRec->Add2RawsList((new TH2D(*hphil3)),39+fGenOffset, kFALSE,kTRUE);
234       delete hphil3;
235       fSDDhTask++;
236
237       TH2D *hphil4 = new TH2D("SDDphizL4","SDD #varphiz Layer4 ",8,0.5,8.5,22,0.5,22.5);
238       hphil4->GetXaxis()->SetTitle("z[#Module L4]");
239       hphil4->GetYaxis()->SetTitle("#varphi[#Ladder L4]");
240       fAliITSQADataMakerRec->Add2RawsList((new TH2D(*hphil4)),40+fGenOffset, kFALSE,kTRUE);
241       delete hphil4;
242       fSDDhTask++;
243
244
245   Int_t indexlast1 = 0;
246   Int_t indexlast2 = 0;
247
248   if(fkOnline) {
249         fTimeBinSize = 4;
250     indexlast = 0;
251     index1 = 0;
252     indexlast1 = fSDDhTask;
253     //   cout<<"Last of the offline "<<fSDDhTask<<endl;
254     indexlast2 = 0;
255     char *hname[3];
256     for(Int_t i=0; i<3; i++) hname[i]= new char[50];
257     for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
258                 for(Int_t iside=0;iside<fgknSide;iside++){
259                         AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
260                         sprintf(hname[0],"SDDchargeMapFSE_L%d_%d_%d_%d",lay,lad,det,iside);
261                         sprintf(hname[1],"SDDChargeMapForSingleEvent_L%d_%d_%d_%d",lay,lad,det,iside);
262                         sprintf(hname[2],"SDDhmonoDMap_L%d_%d_%d_%d",lay,lad,det,iside);
263                         TProfile2D *fModuleChargeMapFSE = new TProfile2D(hname[0],hname[1],256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
264                         fModuleChargeMapFSE->GetXaxis()->SetTitle("Time Bin");
265                         fModuleChargeMapFSE->GetYaxis()->SetTitle("Anode");
266                         fAliITSQADataMakerRec->Add2RawsList((new TProfile2D(*fModuleChargeMapFSE)),indexlast1 + index1 + fGenOffset,kTRUE,kFALSE);
267                         delete fModuleChargeMapFSE;
268                         
269                         fSDDhTask++;
270                         index1++;        
271                         indexlast2 = indexlast1 + index1;
272                 }
273         }
274
275     for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
276                 for(Int_t iside=0;iside<fgknSide;iside++){
277                         AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
278                         sprintf(hname[0],"SDDchargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
279                         sprintf(hname[1],"SDDChargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
280                         TProfile2D *fModuleChargeMap = new TProfile2D(hname[0],hname[1],256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
281                         fModuleChargeMap->GetXaxis()->SetTitle("Time Bin");
282                         fModuleChargeMap->GetYaxis()->SetTitle("Anode");
283                         fAliITSQADataMakerRec->Add2RawsList((new TProfile2D(*fModuleChargeMap)),indexlast1 + index1 + fGenOffset,kTRUE,kFALSE);
284                         delete fModuleChargeMap;
285
286                         fSDDhTask++;
287                         index1++;        
288                         indexlast2 = indexlast1 + index1;
289                 }
290         }
291   
292 }  // kONLINE
293
294   AliDebug(1,Form("%d SDD Raws histograms booked\n",fSDDhTask));
295 }
296
297
298 //____________________________________________________________________________
299 void AliITSQASDDDataMakerRec::MakeRaws(AliRawReader* rawReader)
300
301   // Fill QA for RAW - SDD -
302   if(!fDDLModuleMap){
303     AliError("SDD DDL module map not available - skipping SDD QA");
304     return;
305   }
306   if(rawReader->GetType() != 7) return;  // skips non physical triggers
307   AliDebug(1,"entering MakeRaws\n");                 
308
309   rawReader->Reset();       
310   AliITSRawStream *stream;
311   
312   if(fkOnline==kTRUE)
313     {
314       if(GetHLTMode()==kTRUE)
315         {
316           AliInfo("Online  mode: HLT C compressed mode used for SDD\n");
317           stream = new AliITSRawStreamSDDCompressed(rawReader); }
318       else{ 
319         AliInfo("Online  mode: HLT A mode used for SDD\n");
320         stream = new AliITSRawStreamSDD(rawReader);}     
321     }
322   else 
323     {
324       if(fHLTSDD->IsHLTmodeC()==kTRUE){
325           AliInfo("Offline  mode: HLT C compressed mode used for SDD\n");
326         stream = new AliITSRawStreamSDDCompressed(rawReader);
327       }else 
328         {
329         AliInfo("Offline  mode: HLT A mode used for SDD\n");
330         stream = new AliITSRawStreamSDD(rawReader);
331       }
332     }
333   
334   //ckeck on HLT mode
335                   
336
337   
338   //  AliITSRawStreamSDD s(rawReader); 
339   stream->SetDDLModuleMap(fDDLModuleMap);
340   
341   Int_t lay, lad, det; 
342
343   Int_t index=0;
344   if(fkOnline) {
345     for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
346         for(Int_t iside=0;iside<fgknSide;iside++) {
347           if(fSDDhTask > 41 + index) fAliITSQADataMakerRec->GetRawsData(41 + index +fGenOffset)->Reset();
348           index++;
349         }
350     }
351   }
352   
353   Int_t cnt = 0;
354   Int_t ildcID = -1;
355   Int_t iddl = -1;
356   Int_t isddmod = -1;
357   Int_t coord1, coord2, signal, moduleSDD, ioffset, iorder, activeModule, index1;
358   
359   while(stream->Next()) {
360     ildcID = rawReader->GetLDCId();
361     iddl = rawReader->GetDDLID() - fgkDDLIDshift;
362     isddmod = fDDLModuleMap->GetModuleNumber(iddl,stream->GetCarlosId());
363     //  cout<<"isddmod "<<isddmod<<endl;
364     if(isddmod==-1){
365       AliDebug(1,Form("Found module with iddl: %d, stream->GetCarlosId: %d \n",iddl,stream->GetCarlosId() ));
366       continue;
367     }
368     if(stream->IsCompletedModule()) {
369       AliDebug(1,Form("IsCompletedModule == KTRUE\n"));
370       continue;
371     } 
372     
373     coord1 = stream->GetCoord1();
374     coord2 = stream->GetCoord2();
375     signal = stream->GetSignal();
376     
377      moduleSDD = isddmod - fgkmodoffset;
378
379     if(isddmod <fgkmodoffset|| isddmod>fgknSDDmodules+fgkmodoffset-1) {
380       AliDebug(1,Form( "Module SDD = %d, resetting it to 1 \n",isddmod));
381       isddmod = 1;
382     }
383
384     fAliITSQADataMakerRec->GetRawsData(0 +fGenOffset)->Fill(isddmod); 
385     
386     AliITSgeomTGeo::GetModuleId(isddmod, lay, lad, det);
387     ioffset = 3;
388     iorder = 1;
389     if(lay==4) { 
390       ioffset += 14;
391       iorder = 2;   
392     } 
393     fAliITSQADataMakerRec->GetRawsData(iorder +fGenOffset)->Fill(lad);
394     fAliITSQADataMakerRec->GetRawsData(ioffset+lad-1 +fGenOffset)->Fill(det); //-1 because ladder# starts from 1    
395     
396     if(lay==3)    fAliITSQADataMakerRec->GetRawsData(39+fGenOffset)->Fill(det,lad);
397     if(lay==4) { 
398       fAliITSQADataMakerRec->GetRawsData(40+fGenOffset)->Fill(det,lad);}
399
400     Short_t iside = stream->GetChannel();
401     activeModule = moduleSDD;
402     index1 = activeModule * 2 + iside;
403     
404     if(index1<0){
405       AliDebug(1,Form("Wrong index number %d - patched to 0\n",index1));
406       index1 = 0;
407     }
408     
409     //    cout<< fSDDhTask<<endl;
410     if(fkOnline) {
411       if(fSDDhTask > 41 + index1) {
412         //      cout<<index1<<endl;
413         //cout<<"Fill"<< fAliITSQADataMakerRec->GetRawsData(41 + index1 +fGenOffset)->GetName()<<endl;
414         ((TProfile2D *)(fAliITSQADataMakerRec->GetRawsData(41 + index1 +fGenOffset)))->Fill(coord2, coord1, signal);
415         ((TProfile2D *)(fAliITSQADataMakerRec->GetRawsData(41 + index1 + 260*2 +fGenOffset)))->Fill(coord2, coord1, signal);
416       }
417     }
418     cnt++;
419     if(!(cnt%10000)) AliDebug(1,Form(" %d raw digits read",cnt));
420   }
421   AliDebug(1,Form("Event completed, %d raw digits read",cnt)); 
422   delete stream;
423   stream = NULL; 
424  }
425
426 //____________________________________________________________________________ 
427 void AliITSQASDDDataMakerRec::InitRecPoints()
428 {
429   // Initialization for RECPOINTS - SDD -
430
431  fGenOffset = (fAliITSQADataMakerRec->fRecPointsQAList)->GetEntries();
432   Int_t nOnline=1;
433   Int_t  nOnline2=1;
434   Int_t  nOnline3=1; 
435   Int_t  nOnline4=1;
436   if(fkOnline)
437     {
438       //      cout<<"konline"<<endl;
439       nOnline=4;
440       nOnline2=28;
441       nOnline3=64;
442       nOnline4=14;
443     }
444
445   
446   TH1F *h0 = new TH1F("SDDLay3TotCh","Layer 3 total charge",1000/nOnline,-0.5, 499.5); //position number 0
447   h0->GetXaxis()->SetTitle("ADC value");
448   h0->GetYaxis()->SetTitle("Entries");
449   fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h0)), 0 +fGenOffset,kFALSE);
450   delete h0;
451   fSDDhTask++;
452  
453   TH1F *h1 = new TH1F("SDDLay4TotCh","Layer 4 total charge",1000/nOnline,-0.5, 499.5);//position number 1
454   h1->GetXaxis()->SetTitle("ADC value");
455   h1->GetYaxis()->SetTitle("Entries");
456   fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h1)), 1 +fGenOffset,kFALSE);
457   delete h1;
458   fSDDhTask++;
459
460   char hisnam[50];
461   TH2F *h2 = new TH2F("SDDGlobalCoordDistribYX","YX Global Coord Distrib",5600/nOnline2,-28,28,5600/nOnline2,-28,28);//position number 2
462   h2->GetYaxis()->SetTitle("Y[cm]");
463   h2->GetXaxis()->SetTitle("X[cm]");
464   fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h2)),2+fGenOffset,kTRUE);
465   delete h2;
466   fSDDhTask++;
467
468   TH2F *h3 = new TH2F("SDDGlobalCoordDistribRZ","RZ Global Coord Distrib",6400/nOnline3,-32,32,1400/nOnline4,12,26);//position number 3
469   h3->GetYaxis()->SetTitle("R[cm]");
470   h3->GetXaxis()->SetTitle("Z[cm]");
471   fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h3)),3+fGenOffset,kTRUE);
472   delete h3;
473   fSDDhTask++;
474   
475   TH2F *h4 = new TH2F("SDDGlobalCoordDistribL3PHIZ","#varphi Z Global Coord Distrib L3",6400/nOnline3,-32,32,360/nOnline,-TMath::Pi(),TMath::Pi());//position number 4
476   h4->GetYaxis()->SetTitle("#phi[rad]");
477   h4->GetXaxis()->SetTitle("Z[cm]");
478   fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h4)),4+fGenOffset,kFALSE);
479   delete h4;
480   fSDDhTask++;
481
482   TH2F *h5 = new TH2F("SDDGlobalCoordDistribL4PHIZ","#varphi Z Global Coord Distrib L4",6400/nOnline3,-32,32,360/nOnline,-TMath::Pi(),TMath::Pi());//position number 5
483   h5->GetYaxis()->SetTitle("#phi[rad]");
484   h5->GetXaxis()->SetTitle("Z[cm]");
485   fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h5)),5+fGenOffset,kFALSE);
486   delete h5;
487   fSDDhTask++;
488   
489   TH1F *h6 = new TH1F("SDDModPatternRP","Modules pattern RP",fgknSDDmodules,239.5,499.5); //position number 6
490   h6->GetXaxis()->SetTitle("Module number"); //spd offset = 240
491   h6->GetYaxis()->SetTitle("Entries");
492   fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h6)),6 +fGenOffset,kTRUE);
493   delete h6;
494   fSDDhTask++;
495   TH1F *h7 = new TH1F("SDDLadPatternL3RP","Ladder pattern L3 RP",14,0.5,14.5);  //position number 7
496   h7->GetXaxis()->SetTitle("Ladder #, Layer 3");
497   h7->GetYaxis()->SetTitle("Entries");
498   fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h7)),7 +fGenOffset,kTRUE);
499   delete h7;
500   fSDDhTask++;
501   TH1F *h8 = new TH1F("SDDLadPatternL4RP","Ladder pattern L4 RP",22,0.5,22.5); //position number 8
502   h8->GetXaxis()->SetTitle("Ladder #, Layer 4");
503   h8->GetYaxis()->SetTitle("Entries");
504   fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h8)),8 +fGenOffset,kTRUE);
505   delete h8;
506   fSDDhTask++;
507   TH2F *h9 = new TH2F("SDDLocalCoordDistrib","Local Coord Distrib",1000/nOnline,-4,4,1000/nOnline,-4,4);//position number 9
508   h9->GetXaxis()->SetTitle("X local coord, drift, cm");
509   h9->GetYaxis()->SetTitle("Z local coord, anode, cm");
510   fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h9)),9 +fGenOffset,kTRUE);
511   delete h9;
512   fSDDhTask++;
513
514
515     TH1F *h10 = new TH1F("SDDrdistrib_Layer3" ,"SDD r distribution Layer3" ,100,14.,18.);//position number 10 (L3)
516     h10->GetXaxis()->SetTitle("r[cm]");
517     h10->GetXaxis()->CenterTitle();
518     h10->GetYaxis()->SetTitle("Entries");
519     fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h10)),10 +fGenOffset,kTRUE);
520     delete h10;
521     fSDDhTask++;
522
523     TH1F *h11 = new TH1F("SDDrdistrib_Layer4" ,"SDD r distribution Layer4" ,100,22.,26.);// and position number 11 (L4)
524     h11->GetXaxis()->SetTitle("r[cm]");
525     h11->GetXaxis()->CenterTitle();
526     h11->GetYaxis()->SetTitle("Entries");
527     fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h11)),11 +fGenOffset,kTRUE);
528     delete h11;
529     fSDDhTask++;
530
531   for(Int_t iLay=0; iLay<=1; iLay++){
532     sprintf(hisnam,"SDDphidistrib_Layer%d",iLay+3);
533     TH1F *h12 = new TH1F(hisnam,hisnam,180,-TMath::Pi(),TMath::Pi());//position number 12 (L3) and position number 13 (L4)
534     h12->GetXaxis()->SetTitle("#varphi[rad]");
535     h12->GetXaxis()->CenterTitle();
536     h12->GetYaxis()->SetTitle("Entries");
537     fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h12)),iLay+12+fGenOffset,kTRUE);
538     delete h12;
539     fSDDhTask++;
540   }
541
542   if(fkOnline)
543     {
544       TH2F *h14 = new TH2F("SDDGlobalCoordDistribYXFSE","YX Global Coord Distrib FSE",5600/nOnline2,-28,28,5600/nOnline2,-28,28);//position number 14
545       h14->GetYaxis()->SetTitle("Y[cm]");
546       h14->GetXaxis()->SetTitle("X[cm]");
547       fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h14)),14+fGenOffset,kTRUE);
548       delete h14;
549       fSDDhTask++;
550       
551       TH2F *h15 = new TH2F("SDDGlobalCoordDistribRZFSE","RZ Global Coord Distrib FSE",Int_t(6400/nOnline3),-32,32,1400/nOnline4,12,26);//position number 15
552       h15->GetYaxis()->SetTitle("R[cm]");
553       h15->GetXaxis()->SetTitle("Z[cm]");
554       fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h15)),15+fGenOffset,kTRUE);
555       delete h15;
556       fSDDhTask++;
557       
558     }//online
559
560
561
562   AliDebug(1,Form("%d SDD Recs histograms booked\n",fSDDhTask));
563
564
565 }
566
567 //____________________________________________________________________________ 
568 void AliITSQASDDDataMakerRec::MakeRecPoints(TTree * clustersTree)
569 {
570
571  // Fill QA for RecPoints - SDD -
572   Int_t lay, lad, det; 
573   TBranch *branchRecP = clustersTree->GetBranch("ITSRecPoints");
574   if (!branchRecP) {
575     AliError("can't get the branch with the ITS clusters !");
576     return;
577   }
578
579   static TClonesArray statRecpoints("AliITSRecPoint") ;
580   TClonesArray *recpoints = &statRecpoints;
581   branchRecP->SetAddress(&recpoints);
582   Int_t npoints = 0;      
583   Float_t cluglo[3]={0.,0.,0.}; 
584   if(fkOnline)
585     {
586       for(Int_t i=14;i<16;i++)
587         {
588           fAliITSQADataMakerRec->GetRecPointsData(i+fGenOffset)->Reset();
589         }
590     }
591   for(Int_t module=0; module<clustersTree->GetEntries();module++){
592     branchRecP->GetEvent(module);
593     npoints += recpoints->GetEntries();
594     AliITSgeomTGeo::GetModuleId(module, lay, lad, det);
595     //printf("modnumb %d, lay %d, lad %d, det %d \n",module, lay, lad, det);
596     for(Int_t j=0;j<recpoints->GetEntries();j++){
597       AliITSRecPoint *recp = (AliITSRecPoint*)recpoints->At(j);    
598       fAliITSQADataMakerRec->GetRecPointsData(6 +fGenOffset)->Fill(module);//modpatternrp
599       recp->GetGlobalXYZ(cluglo);
600       Float_t rad=TMath::Sqrt(cluglo[0]*cluglo[0]+cluglo[1]*cluglo[1]); 
601       Float_t phi=TMath::ATan2(cluglo[1],cluglo[0]);
602       fAliITSQADataMakerRec->GetRecPointsData(9 +fGenOffset)->Fill(recp->GetDetLocalX(),recp->GetDetLocalZ());//local distribution
603       fAliITSQADataMakerRec->GetRecPointsData(2 +fGenOffset)->Fill(cluglo[0],cluglo[1]);//global distribution YX
604       fAliITSQADataMakerRec->GetRecPointsData(3 +fGenOffset)->Fill(cluglo[2],rad);//global distribution rz
605       if(fkOnline)
606         {
607           fAliITSQADataMakerRec->GetRecPointsData(14 +fGenOffset)->Fill(cluglo[0],cluglo[1]);//global distribution YX FSE
608           fAliITSQADataMakerRec->GetRecPointsData(15 +fGenOffset)->Fill(cluglo[2],rad);//global distribution rz FSE
609         }
610       if(recp->GetLayer() ==2) {
611         fAliITSQADataMakerRec->GetRecPointsData(0 +fGenOffset)->Fill(recp->GetQ()) ;//total charge of layer 3
612         fAliITSQADataMakerRec->GetRecPointsData(7 +fGenOffset)->Fill(lad);//lad pattern layer 3
613         fAliITSQADataMakerRec->GetRecPointsData(10 +fGenOffset)->Fill(rad);//r distribution layer 3
614         fAliITSQADataMakerRec->GetRecPointsData(12 +fGenOffset)->Fill(phi);// phi distribution layer 3
615         fAliITSQADataMakerRec->GetRecPointsData(4 +fGenOffset)->Fill(cluglo[2],phi);// phi distribution layer 3
616       }
617       else if(recp->GetLayer() ==3) {
618         fAliITSQADataMakerRec->GetRecPointsData(1 +fGenOffset)->Fill(recp->GetQ()) ;//total charge layer 4
619         fAliITSQADataMakerRec->GetRecPointsData(8 +fGenOffset)->Fill(lad);//ladpatternlayer4
620         fAliITSQADataMakerRec->GetRecPointsData(11 +fGenOffset)->Fill(rad);//r distribution
621         fAliITSQADataMakerRec->GetRecPointsData(13 +fGenOffset)->Fill(phi);//phi distribution
622         fAliITSQADataMakerRec->GetRecPointsData(5 +fGenOffset)->Fill(cluglo[2],phi);// phi distribution layer 4
623       }
624     }
625   }
626   statRecpoints.Clear();
627
628 }
629
630 //_______________________________________________________________
631
632 void AliITSQASDDDataMakerRec::SetHLTModeFromEnvironment()
633 {
634
635    Int_t  hltmode= ::atoi(gSystem->Getenv("HLT_MODE"));
636
637    if(hltmode==1)
638      {
639        AliInfo("Online mode: HLT mode A selected from environment for SDD\n");
640        SetHLTMode(kFALSE);
641      }
642    else
643      if(hltmode==2)
644        {
645        AliInfo("Online mode: HLT mode C compressed selected from environment for SDD\n");
646        SetHLTMode(kTRUE);
647        }
648 }