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