]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSQASDDDataMakerRec.cxx
8a5f299b17a916c82ab53c1d3025474c24d6000a
[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   rawReader->SelectEquipment(17,fgkeqOffset,fgkeqOffset + fgkDDLidRange); 
309
310   rawReader->Reset();       
311   AliITSRawStream *stream;
312   
313   if(fkOnline==kTRUE)
314     {
315       if(GetHLTMode()==kTRUE)
316         {
317           AliInfo("Online  mode: HLT C compressed mode used for SDD\n");
318           stream = new AliITSRawStreamSDDCompressed(rawReader); }
319       else{ 
320         AliInfo("Online  mode: HLT A mode used for SDD\n");
321         stream = new AliITSRawStreamSDD(rawReader);}     
322     }
323   else 
324     {
325       if(fHLTSDD->IsHLTmodeC()==kTRUE){
326           AliInfo("Offline  mode: HLT C compressed mode used for SDD\n");
327         stream = new AliITSRawStreamSDDCompressed(rawReader);
328       }else 
329         {
330         AliInfo("Offline  mode: HLT A mode used for SDD\n");
331         stream = new AliITSRawStreamSDD(rawReader);
332       }
333     }
334   
335   //ckeck on HLT mode
336                   
337
338   
339   //  AliITSRawStreamSDD s(rawReader); 
340   stream->SetDDLModuleMap(fDDLModuleMap);
341   
342   Int_t lay, lad, det; 
343
344   Int_t index=0;
345   if(fkOnline) {
346     for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
347         for(Int_t iside=0;iside<fgknSide;iside++) {
348           if(fSDDhTask > 41 + index) fAliITSQADataMakerRec->GetRawsData(41 + index +fGenOffset)->Reset();
349           index++;
350         }
351     }
352   }
353   
354   Int_t cnt = 0;
355   Int_t ildcID = -1;
356   Int_t iddl = -1;
357   Int_t isddmod = -1;
358   Int_t coord1, coord2, signal, moduleSDD, ioffset, iorder, activeModule, index1;
359   
360   while(stream->Next()) {
361     ildcID = rawReader->GetLDCId();
362     iddl = rawReader->GetDDLID() - fgkDDLIDshift;
363     isddmod = fDDLModuleMap->GetModuleNumber(iddl,stream->GetCarlosId());
364     //  cout<<"isddmod "<<isddmod<<endl;
365     if(isddmod==-1){
366       AliDebug(1,Form("Found module with iddl: %d, stream->GetCarlosId: %d \n",iddl,stream->GetCarlosId() ));
367       continue;
368     }
369     if(stream->IsCompletedModule()) {
370       AliDebug(1,Form("IsCompletedModule == KTRUE\n"));
371       continue;
372     } 
373     
374     coord1 = stream->GetCoord1();
375     coord2 = stream->GetCoord2();
376     signal = stream->GetSignal();
377     
378      moduleSDD = isddmod - fgkmodoffset;
379
380     if(moduleSDD <fgkmodoffset|| moduleSDD>fgknSDDmodules+fgkmodoffset-1) {
381       AliDebug(1,Form( "Module SDD = %d, resetting it to 1 \n",isddmod));
382       moduleSDD = 1;
383     }
384
385     fAliITSQADataMakerRec->GetRawsData(0 +fGenOffset)->Fill(isddmod); 
386     
387     AliITSgeomTGeo::GetModuleId(isddmod, lay, lad, det);
388     ioffset = 3;
389     iorder = 1;
390     if(lay==4) { 
391       ioffset += 14;
392       iorder = 2;   
393     } 
394     fAliITSQADataMakerRec->GetRawsData(iorder +fGenOffset)->Fill(lad);
395     fAliITSQADataMakerRec->GetRawsData(ioffset+lad-1 +fGenOffset)->Fill(det); //-1 because ladder# starts from 1    
396     
397     if(lay==3)    fAliITSQADataMakerRec->GetRawsData(39+fGenOffset)->Fill(det,lad);
398     if(lay==4) { 
399       fAliITSQADataMakerRec->GetRawsData(40+fGenOffset)->Fill(det,lad);}
400
401     Short_t iside = stream->GetChannel();
402     activeModule = moduleSDD;
403     index1 = activeModule * 2 + iside;
404     
405     if(index1<0){
406       AliDebug(1,Form("Wrong index number %d - patched to 0\n",index1));
407       index1 = 0;
408     }
409     
410     if(fkOnline) {
411       if(fSDDhTask > 41 + index1) {
412         ((TProfile2D *)(fAliITSQADataMakerRec->GetRawsData(41 + index1 +fGenOffset)))->Fill(coord2, coord1, signal);
413         ((TProfile2D *)(fAliITSQADataMakerRec->GetRawsData(41 + index1 + 260*2 +fGenOffset)))->Fill(coord2, coord1, signal);
414       }
415     }
416     cnt++;
417     if(!(cnt%10000)) AliDebug(1,Form(" %d raw digits read",cnt));
418   }
419   AliDebug(1,Form("Event completed, %d raw digits read",cnt)); 
420   delete stream;
421   stream = NULL; 
422  }
423
424 //____________________________________________________________________________ 
425 void AliITSQASDDDataMakerRec::InitRecPoints()
426 {
427   // Initialization for RECPOINTS - SDD -
428
429  fGenOffset = (fAliITSQADataMakerRec->fRecPointsQAList)->GetEntries();
430   Int_t nOnline=1;
431   Int_t  nOnline2=1;
432   Int_t  nOnline3=1; 
433   Int_t  nOnline4=1;
434   if(fkOnline)
435     {
436       //      cout<<"konline"<<endl;
437       nOnline=4;
438       nOnline2=28;
439       nOnline3=64;
440       nOnline4=14;
441     }
442
443   
444   TH1F *h0 = new TH1F("SDDLay3TotCh","Layer 3 total charge",1000/nOnline,-0.5, 499.5); //position number 0
445   h0->GetXaxis()->SetTitle("ADC value");
446   h0->GetYaxis()->SetTitle("Entries");
447   fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h0)), 0 +fGenOffset,kFALSE);
448   delete h0;
449   fSDDhTask++;
450  
451   TH1F *h1 = new TH1F("SDDLay4TotCh","Layer 4 total charge",1000/nOnline,-0.5, 499.5);//position number 1
452   h1->GetXaxis()->SetTitle("ADC value");
453   h1->GetYaxis()->SetTitle("Entries");
454   fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h1)), 1 +fGenOffset,kFALSE);
455   delete h1;
456   fSDDhTask++;
457
458   char hisnam[50];
459   TH2F *h2 = new TH2F("SDDGlobalCoordDistribYX","YX Global Coord Distrib",5600/nOnline2,-28,28,5600/nOnline2,-28,28);//position number 2
460   h2->GetYaxis()->SetTitle("Y[cm]");
461   h2->GetXaxis()->SetTitle("X[cm]");
462   fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h2)),2+fGenOffset,kTRUE);
463   delete h2;
464   fSDDhTask++;
465
466   TH2F *h3 = new TH2F("SDDGlobalCoordDistribRZ","RZ Global Coord Distrib",6400/nOnline3,-32,32,1400/nOnline4,12,26);//position number 3
467   h3->GetYaxis()->SetTitle("R[cm]");
468   h3->GetXaxis()->SetTitle("Z[cm]");
469   fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h3)),3+fGenOffset,kTRUE);
470   delete h3;
471   fSDDhTask++;
472   
473   TH2F *h4 = new TH2F("SDDGlobalCoordDistribL3PHIZ","#varphi Z Global Coord Distrib L3",6400/nOnline3,-32,32,360/nOnline,-TMath::Pi(),TMath::Pi());//position number 4
474   h4->GetYaxis()->SetTitle("#phi[rad]");
475   h4->GetXaxis()->SetTitle("Z[cm]");
476   fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h4)),4+fGenOffset,kFALSE);
477   delete h4;
478   fSDDhTask++;
479
480   TH2F *h5 = new TH2F("SDDGlobalCoordDistribL4PHIZ","#varphi Z Global Coord Distrib L4",6400/nOnline3,-32,32,360/nOnline,-TMath::Pi(),TMath::Pi());//position number 5
481   h5->GetYaxis()->SetTitle("#phi[rad]");
482   h5->GetXaxis()->SetTitle("Z[cm]");
483   fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h5)),5+fGenOffset,kFALSE);
484   delete h5;
485   fSDDhTask++;
486   
487   TH1F *h6 = new TH1F("SDDModPatternRP","Modules pattern RP",fgknSDDmodules,239.5,499.5); //position number 6
488   h6->GetXaxis()->SetTitle("Module number"); //spd offset = 240
489   h6->GetYaxis()->SetTitle("Entries");
490   fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h6)),6 +fGenOffset,kTRUE);
491   delete h6;
492   fSDDhTask++;
493   TH1F *h7 = new TH1F("SDDLadPatternL3RP","Ladder pattern L3 RP",14,0.5,14.5);  //position number 7
494   h7->GetXaxis()->SetTitle("Ladder #, Layer 3");
495   h7->GetYaxis()->SetTitle("Entries");
496   fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h7)),7 +fGenOffset,kTRUE);
497   delete h7;
498   fSDDhTask++;
499   TH1F *h8 = new TH1F("SDDLadPatternL4RP","Ladder pattern L4 RP",22,0.5,22.5); //position number 8
500   h8->GetXaxis()->SetTitle("Ladder #, Layer 4");
501   h8->GetYaxis()->SetTitle("Entries");
502   fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h8)),8 +fGenOffset,kTRUE);
503   delete h8;
504   fSDDhTask++;
505   TH2F *h9 = new TH2F("SDDLocalCoordDistrib","Local Coord Distrib",1000/nOnline,-4,4,1000/nOnline,-4,4);//position number 9
506   h9->GetXaxis()->SetTitle("X local coord, drift, cm");
507   h9->GetYaxis()->SetTitle("Z local coord, anode, cm");
508   fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h9)),9 +fGenOffset,kTRUE);
509   delete h9;
510   fSDDhTask++;
511
512
513     TH1F *h10 = new TH1F("SDDrdistrib_Layer3" ,"SDD r distribution Layer3" ,100,14.,18.);//position number 10 (L3)
514     h10->GetXaxis()->SetTitle("r[cm]");
515     h10->GetXaxis()->CenterTitle();
516     h10->GetYaxis()->SetTitle("Entries");
517     fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h10)),10 +fGenOffset,kTRUE);
518     delete h10;
519
520
521     TH1F *h11 = new TH1F("SDDrdistrib_Layer4" ,"SDD r distribution Layer4" ,100,22.,26.);// and position number 11 (L4)
522     h11->GetXaxis()->SetTitle("r[cm]");
523     h11->GetXaxis()->CenterTitle();
524     h11->GetYaxis()->SetTitle("Entries");
525     fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h11)),11 +fGenOffset,kTRUE);
526     delete h11;
527
528   for(Int_t iLay=0; iLay<=1; iLay++){
529     sprintf(hisnam,"SDDphidistrib_Layer%d",iLay+3);
530     TH1F *h12 = new TH1F(hisnam,hisnam,180,-TMath::Pi(),TMath::Pi());//position number 12 (L3) and position number 13 (L4)
531     h12->GetXaxis()->SetTitle("#varphi[rad]");
532     h12->GetXaxis()->CenterTitle();
533     h12->GetYaxis()->SetTitle("Entries");
534     fAliITSQADataMakerRec->Add2RecPointsList((new TH1F(*h12)),iLay+12+fGenOffset,kTRUE);
535     delete h12;
536     fSDDhTask++;
537   }
538
539   if(fkOnline)
540     {
541       TH2F *h14 = new TH2F("SDDGlobalCoordDistribYXFSE","YX Global Coord Distrib FSE",5600/nOnline2,-28,28,5600/nOnline2,-28,28);//position number 14
542       h14->GetYaxis()->SetTitle("Y[cm]");
543       h14->GetXaxis()->SetTitle("X[cm]");
544       fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h14)),14+fGenOffset,kTRUE);
545       delete h14;
546       fSDDhTask++;
547       
548       TH2F *h15 = new TH2F("SDDGlobalCoordDistribRZFSE","RZ Global Coord Distrib FSE",Int_t(6400/nOnline3),-32,32,1400/nOnline4,12,26);//position number 15
549       h15->GetYaxis()->SetTitle("R[cm]");
550       h15->GetXaxis()->SetTitle("Z[cm]");
551       fAliITSQADataMakerRec->Add2RecPointsList((new TH2F(*h15)),15+fGenOffset,kTRUE);
552       delete h15;
553       fSDDhTask++;
554       
555     }//online
556
557
558
559   AliDebug(1,Form("%d SDD Recs histograms booked\n",fSDDhTask));
560
561
562 }
563
564 //____________________________________________________________________________ 
565 void AliITSQASDDDataMakerRec::MakeRecPoints(TTree * clustersTree)
566 {
567
568  // Fill QA for RecPoints - SDD -
569   Int_t lay, lad, det; 
570   TBranch *branchRecP = clustersTree->GetBranch("ITSRecPoints");
571   if (!branchRecP) {
572     AliError("can't get the branch with the ITS clusters !");
573     return;
574   }
575
576   static TClonesArray statRecpoints("AliITSRecPoint") ;
577   TClonesArray *recpoints = &statRecpoints;
578   branchRecP->SetAddress(&recpoints);
579   Int_t npoints = 0;      
580   Float_t cluglo[3]={0.,0.,0.}; 
581   if(fkOnline)
582     {
583       for(Int_t i=14;i<16;i++)
584         {
585           fAliITSQADataMakerRec->GetRecPointsData(i+fGenOffset)->Reset();
586         }
587     }
588   for(Int_t module=0; module<clustersTree->GetEntries();module++){
589     branchRecP->GetEvent(module);
590     npoints += recpoints->GetEntries();
591     AliITSgeomTGeo::GetModuleId(module, lay, lad, det);
592     //printf("modnumb %d, lay %d, lad %d, det %d \n",module, lay, lad, det);
593     for(Int_t j=0;j<recpoints->GetEntries();j++){
594       AliITSRecPoint *recp = (AliITSRecPoint*)recpoints->At(j);    
595       fAliITSQADataMakerRec->GetRecPointsData(6 +fGenOffset)->Fill(module);//modpatternrp
596       recp->GetGlobalXYZ(cluglo);
597       Float_t rad=TMath::Sqrt(cluglo[0]*cluglo[0]+cluglo[1]*cluglo[1]); 
598       Float_t phi=TMath::ATan2(cluglo[1],cluglo[0]);
599       fAliITSQADataMakerRec->GetRecPointsData(9 +fGenOffset)->Fill(recp->GetDetLocalX(),recp->GetDetLocalZ());//local distribution
600       fAliITSQADataMakerRec->GetRecPointsData(2 +fGenOffset)->Fill(cluglo[0],cluglo[1]);//global distribution YX
601       fAliITSQADataMakerRec->GetRecPointsData(3 +fGenOffset)->Fill(cluglo[2],rad);//global distribution rz
602       if(fkOnline)
603         {
604           fAliITSQADataMakerRec->GetRecPointsData(14 +fGenOffset)->Fill(cluglo[0],cluglo[1]);//global distribution YX FSE
605           fAliITSQADataMakerRec->GetRecPointsData(15 +fGenOffset)->Fill(cluglo[2],rad);//global distribution rz FSE
606         }
607       if(recp->GetLayer() ==2) {
608         fAliITSQADataMakerRec->GetRecPointsData(0 +fGenOffset)->Fill(recp->GetQ()) ;//total charge of layer 3
609         fAliITSQADataMakerRec->GetRecPointsData(7 +fGenOffset)->Fill(lad);//lad pattern layer 3
610         fAliITSQADataMakerRec->GetRecPointsData(10 +fGenOffset)->Fill(rad);//r distribution layer 3
611         fAliITSQADataMakerRec->GetRecPointsData(12 +fGenOffset)->Fill(phi);// phi distribution layer 3
612         fAliITSQADataMakerRec->GetRecPointsData(4 +fGenOffset)->Fill(cluglo[2],phi);// phi distribution layer 3
613       }
614       else if(recp->GetLayer() ==3) {
615         fAliITSQADataMakerRec->GetRecPointsData(1 +fGenOffset)->Fill(recp->GetQ()) ;//total charge layer 4
616         fAliITSQADataMakerRec->GetRecPointsData(8 +fGenOffset)->Fill(lad);//ladpatternlayer4
617         fAliITSQADataMakerRec->GetRecPointsData(11 +fGenOffset)->Fill(rad);//r distribution
618         fAliITSQADataMakerRec->GetRecPointsData(13 +fGenOffset)->Fill(phi);//phi distribution
619         fAliITSQADataMakerRec->GetRecPointsData(5 +fGenOffset)->Fill(cluglo[2],phi);// phi distribution layer 4
620       }
621     }
622   }
623   statRecpoints.Clear();
624
625 }
626
627 //_______________________________________________________________
628
629 void AliITSQASDDDataMakerRec::SetHLTModeFromEnvironment()
630 {
631
632    Int_t  hltmode= ::atoi(gSystem->Getenv("HLT_MODE"));
633
634    if(hltmode==1)
635      {
636        AliInfo("Online mode: HLT mode A selected from environment for SDD\n");
637        SetHLTMode(kFALSE);
638      }
639    else
640      if(hltmode==2)
641        {
642        AliInfo("Online mode: HLT mode C compressed selected from environment for SDD\n");
643        SetHLTMode(kTRUE);
644        }
645 }