]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSQASDDDataMakerRec.cxx
be0b67ffc5520fbda233cc5b5e768a77a735845e
[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 
25 //  INFN Torino
26
27 // --- ROOT system ---
28
29 #include <TProfile2D.h>
30 #include <TH2D.h>
31 #include <TH1F.h>
32 #include <TBranch.h>
33 #include <TTree.h>
34 #include <TGaxis.h>
35 #include <TMath.h>
36 #include <TF1.h>
37 #include <TDirectory.h>
38 #include <TSystem.h>
39 // --- Standard library ---
40
41 // --- AliRoot header files ---
42 #include "AliITSQASDDDataMakerRec.h"
43 #include "AliLog.h"
44 #include "AliQAv1.h"
45 #include "AliQAChecker.h"
46 #include "AliRawReader.h"
47 #include "AliITSRawStream.h"
48 #include "AliITSRawStreamSDD.h"
49 #include "AliITSRawStreamSDDCompressed.h"
50 #include "AliITSDetTypeRec.h"
51 #include "AliITSdigit.h"
52 #include "AliITSRecPoint.h"
53 #include "AliITSgeomTGeo.h"
54 #include "AliCDBManager.h"
55 #include "AliCDBStorage.h"
56 #include "AliCDBEntry.h"
57 #include "Riostream.h"
58 #include "AliITSdigitSDD.h"
59 #include "AliITS.h"
60 #include "AliRunLoader.h"
61 #include "AliITSLoader.h"
62 #include "AliITSDetTypeRec.h"
63
64
65
66 ClassImp(AliITSQASDDDataMakerRec)
67
68 //____________________________________________________________________________ 
69 AliITSQASDDDataMakerRec::AliITSQASDDDataMakerRec(AliITSQADataMakerRec *aliITSQADataMakerRec, Bool_t kMode, Short_t ldc) :
70 TObject(),
71 fAliITSQADataMakerRec(aliITSQADataMakerRec),
72 fkOnline(kMode),
73 fLDC(ldc),
74 fSDDhRawsTask(0),
75 fSDDhDigitsTask(0),
76 fSDDhRecPointsTask(0),
77 fGenRawsOffset(0),
78 fGenDigitsOffset(0),
79 fGenRecPointsOffset(0),
80 fTimeBinSize(1),
81 fDDLModuleMap(0),
82 fGoodAnodes(0),
83 fBadAnodes(0),
84 fGoodAnodesCurrent(0),
85 fBadAnodesCurrent(0)
86 {
87   //ctor used to discriminate OnLine-Offline analysis
88   if(fLDC < 0 || fLDC > 6) {
89         AliError("Error: LDC number out of range; return\n");
90   }
91         fGenRawsOffset = new Int_t[AliRecoParam::kNSpecies];
92         fGenRecPointsOffset = new Int_t[AliRecoParam::kNSpecies];
93         fGenDigitsOffset = new Int_t[AliRecoParam::kNSpecies];
94         for(Int_t i=0; i<AliRecoParam::kNSpecies; i++) {
95                 fGenRawsOffset[i] = 0;
96                 fGenRecPointsOffset[i] = 0;
97                 fGenDigitsOffset[i]=0;
98         }
99 }
100
101 //____________________________________________________________________________ 
102 AliITSQASDDDataMakerRec::AliITSQASDDDataMakerRec(const AliITSQASDDDataMakerRec& qadm) :
103 TObject(),
104 fAliITSQADataMakerRec(qadm.fAliITSQADataMakerRec),
105 fkOnline(qadm.fkOnline),
106 fLDC(qadm.fLDC),
107 fSDDhRawsTask(qadm.fSDDhRawsTask),
108 fSDDhDigitsTask(qadm.fSDDhDigitsTask),
109 fSDDhRecPointsTask(qadm.fSDDhRecPointsTask),
110 fGenRawsOffset(qadm.fGenRawsOffset),
111 fGenDigitsOffset(qadm.fGenDigitsOffset),
112 fGenRecPointsOffset(qadm.fGenRecPointsOffset),
113 fTimeBinSize(1),
114 fDDLModuleMap(0),
115 fGoodAnodes(qadm.fGoodAnodes),
116 fBadAnodes(qadm.fBadAnodes),
117 fGoodAnodesCurrent(qadm.fGoodAnodesCurrent),
118 fBadAnodesCurrent(qadm.fBadAnodesCurrent)
119 {
120   //copy ctor 
121   fAliITSQADataMakerRec->SetName((const char*)qadm.fAliITSQADataMakerRec->GetName()) ; 
122   fAliITSQADataMakerRec->SetTitle((const char*)qadm.fAliITSQADataMakerRec->GetTitle());
123   fDDLModuleMap=NULL;
124 }
125
126 //____________________________________________________________________________ 
127 AliITSQASDDDataMakerRec::~AliITSQASDDDataMakerRec(){
128   // destructor
129   //if(fDDLModuleMap) delete fDDLModuleMap;
130 }
131 //__________________________________________________________________
132 AliITSQASDDDataMakerRec& AliITSQASDDDataMakerRec::operator = (const AliITSQASDDDataMakerRec& qac )
133 {
134   // Equal operator.
135   this->~AliITSQASDDDataMakerRec();
136   new(this) AliITSQASDDDataMakerRec(qac);
137   return *this;
138 }
139
140 //____________________________________________________________________________ 
141 void AliITSQASDDDataMakerRec::StartOfDetectorCycle()
142 {
143   //Detector specific actions at start of cycle
144   AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of SDD Cycle\n");
145 }
146
147 //____________________________________________________________________________ 
148 void AliITSQASDDDataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t /*task*/, TObjArray* /*list*/)
149 {
150   
151   // launch the QA checking
152         if(fkOnline) {
153                 AnalyseBNG(); // Analyse Baseline, Noise, Gain
154                 AnalyseINJ(); // Analyse Injectors
155         }
156   
157         AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n"); 
158 }
159
160 //____________________________________________________________________________ 
161 Int_t AliITSQASDDDataMakerRec::InitRaws()
162
163   // Initialization for RAW data - SDD -
164   const Bool_t expert   = kTRUE ; 
165   const Bool_t saveCorr = kTRUE ; 
166   const Bool_t image    = kTRUE ; 
167
168
169
170   Int_t rv = 0 ; 
171   /*
172   AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD");
173   Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
174   if(!ddlMapSDD)
175     {
176       AliError("Calibration object retrieval failed! SDD will not be processed");
177       fDDLModuleMap = NULL;
178       return rv;
179     }
180   fDDLModuleMap = (AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
181   if(!cacheStatus)ddlMapSDD->SetObject(NULL);
182   ddlMapSDD->SetOwner(kTRUE);
183   if(!cacheStatus)
184     {
185       delete ddlMapSDD;
186     }
187   */
188   Int_t lay, lad, det;
189   Int_t indexlast = 0;
190   Int_t index1 = 0;
191
192   if(fkOnline) 
193     {
194       AliInfo("Book Online Histograms for SDD\n");
195     }
196   else 
197     {
198       AliInfo("Book Offline Histograms for SDD\n ");
199     }
200   TH1D *h0 = new TH1D("SDDModPattern","HW Modules pattern",fgknSDDmodules,239.5,499.5); //0
201   h0->GetXaxis()->SetTitle("Module Number");
202   h0->GetYaxis()->SetTitle("Counts");
203   rv = fAliITSQADataMakerRec->Add2RawsList(h0,0+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
204   fSDDhRawsTask++;
205   
206   //zPhi distribution using ladder and modules numbers
207   TH2D *hphil3 = new TH2D("SDDphizL3","SDD #varphiz Layer3 ",12,0.5,6.5,14,0.5,14.5);
208   hphil3->GetXaxis()->SetTitle("z[#Module L3 ]");
209   hphil3->GetYaxis()->SetTitle("#varphi[#Ladder L3]");
210   rv = fAliITSQADataMakerRec->Add2RawsList(hphil3,1+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, saveCorr); 
211   fSDDhRawsTask++;
212   
213   TH2D *hphil4 = new TH2D("SDDphizL4","SDD #varphiz Layer4 ",16,0.5,8.5,22,0.5,22.5); 
214   hphil4->GetXaxis()->SetTitle("z[#Module L4]");
215   hphil4->GetYaxis()->SetTitle("#varphi[#Ladder L4]");
216    rv = fAliITSQADataMakerRec->Add2RawsList(hphil4,2+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image, saveCorr); 
217   fSDDhRawsTask++;
218   
219
220   if(fkOnline) 
221     {
222
223       //DDL Pattern 
224       TH2D *hddl = new TH2D("SDDDDLPattern","SDD DDL Pattern ",24,-0.5,11.5,24,-0.5,23.5); 
225       hddl->GetXaxis()->SetTitle("Channel");
226       hddl->GetYaxis()->SetTitle("#DDL");
227       rv = fAliITSQADataMakerRec->Add2RawsList(hddl,3+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
228       fSDDhRawsTask++;
229       Int_t indexlast1 = 0;
230   
231       fTimeBinSize = 4;
232       indexlast = 0;
233       index1 = 0;
234       indexlast1 = fSDDhRawsTask;
235       char *hname[3];
236       for(Int_t i=0; i<3; i++) hname[i]= new char[50];
237       for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
238         for(Int_t iside=0;iside<fgknSide;iside++){
239           AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
240           sprintf(hname[0],"SDDchargeMapFSE_L%d_%d_%d_%d",lay,lad,det,iside);
241           sprintf(hname[1],"SDDChargeMapForSingleEvent_L%d_%d_%d_%d",lay,lad,det,iside);
242           //      sprintf(hname[2],"SDDhmonoDMap_L%d_%d_%d_%d",lay,lad,det,iside);
243           TProfile2D *fModuleChargeMapFSE = new TProfile2D(hname[0],hname[1],256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
244           fModuleChargeMapFSE->GetXaxis()->SetTitle("Time Bin");
245           fModuleChargeMapFSE->GetYaxis()->SetTitle("Anode");
246            rv = fAliITSQADataMakerRec->Add2RawsList(fModuleChargeMapFSE,indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);        
247           fSDDhRawsTask++;
248           index1++;      
249         }
250       }
251       
252       for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
253         for(Int_t iside=0;iside<fgknSide;iside++){
254           AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
255           sprintf(hname[0],"SDDchargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
256           sprintf(hname[1],"SDDChargeMap_L%d_%d_%d_%d",lay,lad,det,iside);
257           TProfile2D *fModuleChargeMap = new TProfile2D(hname[0],hname[1],256/fTimeBinSize,-0.5,255.5,256,-0.5,255.5);
258           fModuleChargeMap->GetXaxis()->SetTitle("Time Bin");
259           fModuleChargeMap->GetYaxis()->SetTitle("Anode");
260            rv = fAliITSQADataMakerRec->Add2RawsList(fModuleChargeMap,indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
261   
262           fSDDhRawsTask++;
263           index1++;      
264         }
265       }
266       
267       //Event Size 
268       TH1F *hsize = new TH1F("SDDEventSize","SDD Event Size ",1000,-0.5,999.5); 
269       hsize->GetXaxis()->SetTitle("Event Size [kB]");
270       hsize->GetYaxis()->SetTitle("Entries");
271       rv = fAliITSQADataMakerRec->Add2RawsList(hsize,indexlast1 + index1 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image, !saveCorr);
272       fSDDhRawsTask++;
273           
274     }  // kONLINE
275   
276   AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Raws histograms booked\n",fSDDhRawsTask));
277   return rv ; 
278 }
279
280
281 //____________________________________________________________________________
282 Int_t AliITSQASDDDataMakerRec::MakeRaws(AliRawReader* rawReader)
283
284   // Fill QA for RAW - SDD -
285         Int_t rv = 0;
286   // Check id histograms already created for this Event Specie
287
288   if(!fDDLModuleMap){
289     CreateTheMap();
290     //AliError("SDD DDL module map not available - skipping SDD QA");
291     //return rv;
292   
293   }
294   if(rawReader->GetType() != 7) return rv;  // skips non physical triggers
295   AliDebug(AliQAv1::GetQADebugLevel(),"entering MakeRaws\n");                 
296   rawReader->Reset();       
297   rawReader->Select("ITSSDD");
298   AliITSRawStream *stream=AliITSRawStreamSDD::CreateRawStreamSDD(rawReader);
299    stream->SetDDLModuleMap(fDDLModuleMap);
300   
301   Int_t lay, lad, det; 
302   
303   Int_t index=0;
304   if(fkOnline) {
305     for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
306       for(Int_t iside=0;iside<fgknSide;iside++) {
307                 if(fSDDhRawsTask > 4 + index) fAliITSQADataMakerRec->GetRawsData(4 + index +fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();   
308         // 4  because the 2D histos for single events start after the fourth position
309         index++;
310       }
311     }
312   }
313   
314   Int_t cnt = 0;
315   Int_t ildcID = -1;
316   Int_t iddl = -1;
317   Int_t isddmod = -1;
318   Int_t coord1, coord2, signal, moduleSDD, activeModule, index1; 
319   //if(fkOnline)
320   //{
321       Int_t prevDDLID = -1;
322       UInt_t size = 0;
323       int totalddl=static_cast<int>(fDDLModuleMap->GetNDDLs());
324       Bool_t *ddldata=new Bool_t[totalddl];
325       for(Int_t jddl=0;jddl<totalddl;jddl++){ddldata[jddl]=kFALSE;}
326       //}
327   while(stream->Next()) {
328     ildcID = rawReader->GetLDCId();
329     iddl = rawReader->GetDDLID();// - fgkDDLIDshift;
330
331
332     isddmod = fDDLModuleMap->GetModuleNumber(iddl,stream->GetCarlosId());
333     if(isddmod==-1){
334       AliDebug(AliQAv1::GetQADebugLevel(),Form("Found module with iddl: %d, stream->GetCarlosId: %d \n",iddl,stream->GetCarlosId()));
335       continue;
336     }
337     if(stream->IsCompletedModule()) {
338       AliDebug(AliQAv1::GetQADebugLevel(),Form("IsCompletedModule == KTRUE\n"));
339       continue;
340     } 
341     if(stream->IsCompletedDDL()) {
342
343       if(fkOnline){
344         if ((rawReader->GetDDLID() != prevDDLID)&&(ddldata[iddl])==kFALSE){
345           size += rawReader->GetDataSize();//in bytes
346           prevDDLID = rawReader->GetDDLID();
347           ddldata[iddl]=kTRUE;
348         }
349       }
350       AliDebug(AliQAv1::GetQADebugLevel(),Form("IsCompletedDDL == KTRUE\n"));
351       continue;
352     } 
353     
354     coord1 = stream->GetCoord1();
355     coord2 = stream->GetCoord2();
356     signal = stream->GetSignal();
357     
358     moduleSDD = isddmod - fgkmodoffset;
359     
360     if(isddmod <fgkmodoffset|| isddmod>fgknSDDmodules+fgkmodoffset-1) {
361       AliDebug(AliQAv1::GetQADebugLevel(),Form( "Module SDD = %d, resetting it to 1 \n",isddmod));
362       isddmod = 1;
363     }
364     
365     AliITSgeomTGeo::GetModuleId(isddmod, lay, lad, det);
366     Short_t iside = stream->GetChannel();
367
368     //printf(" \n%i %i %i %i \n ",lay, lad, det,iside );
369     fAliITSQADataMakerRec->GetRawsData( 0 + fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()] )->Fill(isddmod);   
370     if(lay==3)    fAliITSQADataMakerRec->GetRawsData(1+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(det+0.5*iside-0.5,lad); 
371     if(lay==4) { 
372       fAliITSQADataMakerRec->GetRawsData(2+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(det+0.5*iside-0.5,lad);}  
373  
374     if(fkOnline) {
375       fAliITSQADataMakerRec->GetRawsData(3+fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill((stream->GetCarlosId())+0.5*iside -0.5,iddl);
376
377       activeModule = moduleSDD;
378       index1 = activeModule * 2 + iside;
379       
380       if(index1<0){
381         AliDebug(AliQAv1::GetQADebugLevel(),Form("Wrong index number %d - patched to 0\n",index1));
382         index1 = 0;
383       }      
384
385       if(fSDDhRawsTask > 4 + index1) {                                  
386         ((TProfile2D *)(fAliITSQADataMakerRec->GetRawsData(4 + index1 +fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])))->Fill(coord2, coord1, signal);     
387         ((TProfile2D *)(fAliITSQADataMakerRec->GetRawsData(4 + index1 + 260*2 +fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])))->Fill(coord2, coord1, signal); 
388       }
389
390     }//online
391     cnt++;
392     if(!(cnt%10000)) AliDebug(AliQAv1::GetQADebugLevel(),Form(" %d raw digits read",cnt));
393   }//end next()
394   if(fkOnline)
395     {
396       ((TH1F*)(fAliITSQADataMakerRec->GetRawsData(4 + 260*4 +fGenRawsOffset[fAliITSQADataMakerRec->GetEventSpecie()])))->Fill(size/1024.);//KB
397     }
398   AliDebug(AliQAv1::GetQADebugLevel(),Form("Event completed, %d raw digits read",cnt)); 
399   delete stream;
400   stream = NULL; 
401
402 //      if(fkOnline) {
403 //              AnalyseBNG(); // Analyse Baseline, Noise, Gain
404 //              AnalyseINJ(); // Analyse Injectors
405 //      }
406
407   delete []ddldata;
408   ddldata=NULL;
409   return rv ; 
410 }
411
412 //____________________________________________________________________________ 
413 Int_t AliITSQASDDDataMakerRec::InitDigits()
414
415
416
417   // Initialization for DIGIT data - SDD -  
418   const Bool_t expert   = kTRUE ; 
419   const Bool_t image    = kTRUE ;
420   Int_t rv = 0 ; 
421 //  fGenDigitsOffset = (fAliITSQADataMakerRec->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();
422   //fSDDhTask must be incremented by one unit every time a histogram is ADDED to the QA List
423   TH1F* h0=new TH1F("SDD DIGITS Module Pattern","SDD DIGITS Module Pattern",260,239.5,499.5);       //hmod
424   h0->GetXaxis()->SetTitle("SDD Module Number");
425   h0->GetYaxis()->SetTitle("# DIGITS");
426   rv = fAliITSQADataMakerRec->Add2DigitsList(h0,fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
427   fSDDhDigitsTask ++;
428   // printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetName() , fSDDhDigitsTask );
429   TH1F* h1=new TH1F("SDD Anode Distribution","DIGITS Anode Distribution",512,-0.5,511.5);      //hanocc
430   h1->GetXaxis()->SetTitle("Anode Number");
431   h1->GetYaxis()->SetTitle("# DIGITS");
432   rv = fAliITSQADataMakerRec->Add2DigitsList(h1,1+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
433   fSDDhDigitsTask ++;
434   //printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(1+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetName() , fSDDhDigitsTask );
435   TH1F* h2=new TH1F("SDD Tbin Distribution","DIGITS Tbin Distribution",256,-0.5,255.5);      //htbocc
436   h2->GetXaxis()->SetTitle("Tbin Number");
437   h2->GetYaxis()->SetTitle("# DIGITS");
438   rv = fAliITSQADataMakerRec->Add2DigitsList(h2,2+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
439   fSDDhDigitsTask ++;
440   //printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(2+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetName() , fSDDhDigitsTask );
441   TH1F* h3=new TH1F("SDD ADC Counts Distribution","DIGITS ADC Counts Distribution",200,0.,1024.);          //hsig
442   h3->GetXaxis()->SetTitle("ADC Value");
443   h3->GetYaxis()->SetTitle("# DIGITS");
444   rv = fAliITSQADataMakerRec->Add2DigitsList(h3,3+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);
445   fSDDhDigitsTask ++;
446   //printf("Add %s \t the task offset is %i\n",fAliITSQADataMakerRec->GetDigitsData(3+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->GetName() , fSDDhDigitsTask );
447   AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Digits histograms booked\n",fSDDhDigitsTask));
448   return rv ; 
449 }
450
451 //____________________________________________________________________________
452 Int_t AliITSQASDDDataMakerRec::MakeDigits(TTree * digits)
453
454
455   // Fill QA for DIGIT - SDD -
456   //AliITS *fITS  = (AliITS*)gAlice->GetModule("ITS");
457   //fITS->SetTreeAddress();
458   //TClonesArray *iITSdigits  = fITS->DigitsAddress(1);
459
460
461   Int_t rv = 0 ; 
462
463   TBranch *branchD = digits->GetBranch("ITSDigitsSDD");
464
465   if (!branchD) {
466     AliError("can't get the branch with the ITS SDD digits !");
467     return rv ;
468   }
469   // Check id histograms already created for this Event Specie
470 //  if ( ! fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset) )
471 //    rv = InitDigits() ;
472   
473   static TClonesArray statDigits("AliITSdigitSDD");
474   TClonesArray *iITSdigits = &statDigits;
475   branchD->SetAddress(&iITSdigits);
476
477   for(Int_t i=0; i<260; i++){
478     Int_t nmod=i+240;
479     digits->GetEvent(nmod);
480     Int_t ndigits = iITSdigits->GetEntries();
481     fAliITSQADataMakerRec->GetDigitsData(fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(nmod,ndigits);
482
483     for (Int_t idig=0; idig<ndigits; idig++) {
484       AliITSdigit *dig=(AliITSdigit*)iITSdigits->UncheckedAt(idig);
485       Int_t iz=dig->GetCoord1();  // cell number z
486       Int_t ix=dig->GetCoord2();  // cell number x
487       Int_t sig=dig->GetSignal();
488       fAliITSQADataMakerRec->GetDigitsData(1+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(iz);
489       fAliITSQADataMakerRec->GetDigitsData(2+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(ix);
490       fAliITSQADataMakerRec->GetDigitsData(3+fGenDigitsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(sig);
491     }
492   }
493   return rv ; 
494 }
495
496 //____________________________________________________________________________ 
497 Int_t AliITSQASDDDataMakerRec::InitRecPoints()
498 {
499
500         //AliInfo("Initialize SDD recpoints histos\n");
501   // Initialization for RECPOINTS - SDD -
502   const Bool_t expert   = kTRUE ; 
503   const Bool_t image    = kTRUE ; 
504   Int_t rv = 0 ; 
505 //  fGenRecPointsOffset = (fAliITSQADataMakerRec->fRecPointsQAList[AliRecoParam::kDefault])->GetEntries();
506
507   Int_t  nOnline=1;
508   Int_t  nOnline2=1;
509   Int_t  nOnline3=1; 
510   Int_t  nOnline4=1;
511   Int_t nOnline5=1;
512   if(fkOnline)
513     {
514       nOnline=4;
515       nOnline2=28;
516       nOnline3=64;
517       nOnline4=14;
518     }
519
520   //AliInfo(Form("fAliITSQADataMakerRec->GetEventSpecie() %d\n",fAliITSQADataMakerRec->GetEventSpecie()));
521   //AliInfo(Form("fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()] %d\n",fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()]));
522   TH1F *h0 = new TH1F("SDDLay3TotCh","Layer 3 total charge",1000/nOnline,-0.5, 499.5); //position number 0
523   h0->GetXaxis()->SetTitle("ADC value");
524   h0->GetYaxis()->SetTitle("Entries");
525   rv = fAliITSQADataMakerRec->Add2RecPointsList(h0, 0 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);//NON expert image
526   fSDDhRecPointsTask++;
527  
528   TH1F *h1 = new TH1F("SDDLay4TotCh","Layer 4 total charge",1000/nOnline,-0.5, 499.5);//position number 1
529   h1->GetXaxis()->SetTitle("ADC value");
530   h1->GetYaxis()->SetTitle("Entries");
531   rv = fAliITSQADataMakerRec->Add2RecPointsList(h1, 1 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);//NON expert image
532   fSDDhRecPointsTask++;
533
534   char hisnam[50];
535   TH2F *h2 = new TH2F("SDDGlobalCoordDistribYX","YX Global Coord Distrib",5600/nOnline2,-28,28,5600/nOnline2,-28,28);//position number 2
536   h2->GetYaxis()->SetTitle("Y[cm]");
537   h2->GetXaxis()->SetTitle("X[cm]");
538   rv = fAliITSQADataMakerRec->Add2RecPointsList(h2,2+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);// NON expert image
539   fSDDhRecPointsTask++;
540
541   TH2F *h3 = new TH2F("SDDGlobalCoordDistribRZ","RZ Global Coord Distrib",6400/nOnline3,-32,32,1400/nOnline4,12,26);//position number 3
542   h3->GetYaxis()->SetTitle("R[cm]");
543   h3->GetXaxis()->SetTitle("Z[cm]");
544   rv = fAliITSQADataMakerRec->Add2RecPointsList(h3,3+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);// NON expert image
545   fSDDhRecPointsTask++;
546   
547   TH2F *h4 = new TH2F("SDDGlobalCoordDistribL3PHIZ","#varphi Z Global Coord Distrib L3",6400/nOnline3,-32,32,360/nOnline,-TMath::Pi(),TMath::Pi());//position number 4
548   h4->GetYaxis()->SetTitle("#phi[rad]");
549   h4->GetXaxis()->SetTitle("Z[cm]");
550   rv = fAliITSQADataMakerRec->Add2RecPointsList(h4,4+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);//NON expert image
551   fSDDhRecPointsTask++;
552
553   TH2F *h5 = new TH2F("SDDGlobalCoordDistribL4PHIZ","#varphi Z Global Coord Distrib L4",6400/nOnline3,-32,32,360/nOnline,-TMath::Pi(),TMath::Pi());//position number 5
554   h5->GetYaxis()->SetTitle("#phi[rad]");
555   h5->GetXaxis()->SetTitle("Z[cm]");
556   rv = fAliITSQADataMakerRec->Add2RecPointsList(h5,5+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);//NON expert image
557   fSDDhRecPointsTask++;
558   
559   TH1F *h6 = new TH1F("SDDModPatternRP","Modules pattern RP",fgknSDDmodules,239.5,499.5); //position number 6
560   h6->GetXaxis()->SetTitle("Module number"); //spd offset = 240
561   h6->GetYaxis()->SetTitle("Entries");
562   rv = fAliITSQADataMakerRec->Add2RecPointsList(h6,6 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
563   fSDDhRecPointsTask++;
564
565   TH1F *h7 = new TH1F("SDDLadPatternL3RP","Ladder pattern L3 RP",14,0.5,14.5);  //position number 7
566   h7->GetXaxis()->SetTitle("Ladder #, Layer 3");
567   h7->GetYaxis()->SetTitle("Entries");
568   rv = fAliITSQADataMakerRec->Add2RecPointsList(h7,7 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
569   fSDDhRecPointsTask++;
570
571   TH1F *h8 = new TH1F("SDDLadPatternL4RP","Ladder pattern L4 RP",22,0.5,22.5); //position number 8
572   h8->GetXaxis()->SetTitle("Ladder #, Layer 4");
573   h8->GetYaxis()->SetTitle("Entries");
574   rv = fAliITSQADataMakerRec->Add2RecPointsList(h8,8 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);//  expert  NO image
575   fSDDhRecPointsTask++;
576
577   TH2F *h9 = new TH2F("SDDLocalCoordDistrib","Local Coord Distrib",1000/nOnline,-4,4,1000/nOnline,-4,4);//position number 9
578   h9->GetXaxis()->SetTitle("X local coord, drift, cm");
579   h9->GetYaxis()->SetTitle("Z local coord, anode, cm");
580   rv = fAliITSQADataMakerRec->Add2RecPointsList(h9,9 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);//  expert  NO image
581   fSDDhRecPointsTask++;
582   
583   //AliInfo("Create SDD recpoints histos\n");
584   
585   TH1F *h10 = new TH1F("SDDrdistrib_Layer3" ,"SDD r distribution Layer3" ,100,14.,18.);//position number 10 (L3)
586   h10->GetXaxis()->SetTitle("r[cm]");
587   h10->GetXaxis()->CenterTitle();
588   h10->GetYaxis()->SetTitle("Entries");
589   rv = fAliITSQADataMakerRec->Add2RecPointsList(h10,10 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
590   fSDDhRecPointsTask++;
591   
592   TH1F *h11 = new TH1F("SDDrdistrib_Layer4" ,"SDD r distribution Layer4" ,100,22.,26.);// and position number 11 (L4)
593   h11->GetXaxis()->SetTitle("r[cm]");
594   h11->GetXaxis()->CenterTitle();
595   h11->GetYaxis()->SetTitle("Entries");
596   rv = fAliITSQADataMakerRec->Add2RecPointsList(h11,11 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
597   fSDDhRecPointsTask++;
598   
599   for(Int_t iLay=0; iLay<=1; iLay++){
600     sprintf(hisnam,"SDDphidistrib_Layer%d",iLay+3);
601     TH1F *h12 = new TH1F(hisnam,hisnam,180,-TMath::Pi(),TMath::Pi());//position number 12 (L3) and position number 13 (L4)
602     h12->GetXaxis()->SetTitle("#varphi[rad]");
603     h12->GetXaxis()->CenterTitle();
604     h12->GetYaxis()->SetTitle("Entries");
605     rv = fAliITSQADataMakerRec->Add2RecPointsList(h12,iLay+12+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
606     fSDDhRecPointsTask++;
607   }
608   
609   for(Int_t iLay=0; iLay<=1; iLay++){
610     sprintf(hisnam,"SDDdrifttime_Layer%d",iLay+3);
611     TH1F *h14 = new TH1F(hisnam,hisnam,200/nOnline5,-0.5,9999.5);//position number 14 (L3) and position number 15 (L4)
612     h14->GetXaxis()->SetTitle("drift time[#mus]");
613     h14->GetXaxis()->CenterTitle();
614     h14->GetYaxis()->SetTitle("Entries");
615     rv = fAliITSQADataMakerRec->Add2RecPointsList(h14,iLay+14+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], !expert, image);// NON expert  image
616     fSDDhRecPointsTask++;
617   }
618   
619   if(fkOnline)
620     {
621       TH2F *h16 = new TH2F("SDDGlobalCoordDistribYXFSE","YX Global Coord Distrib FSE",5600/nOnline2,-28,28,5600/nOnline2,-28,28);//position number 16
622       h16->GetYaxis()->SetTitle("Y[cm]");
623       h16->GetXaxis()->SetTitle("X[cm]");
624       rv = fAliITSQADataMakerRec->Add2RecPointsList(h16,16+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
625       fSDDhRecPointsTask++;
626       
627       TH2F *h17 = new TH2F("SDDGlobalCoordDistribRZFSE","RZ Global Coord Distrib FSE",Int_t(6400/nOnline3),-32,32,1400/nOnline4,12,26);//position number 17
628       h17->GetYaxis()->SetTitle("R[cm]");
629       h17->GetXaxis()->SetTitle("Z[cm]");
630       rv = fAliITSQADataMakerRec->Add2RecPointsList(h17,17+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()], expert, !image);// expert NO image
631       fSDDhRecPointsTask++;
632       
633     }//online
634   
635   AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SDD Recs histograms booked\n",fSDDhRecPointsTask));
636   
637   return rv ; 
638 }
639
640 //____________________________________________________________________________ 
641 Int_t AliITSQASDDDataMakerRec::MakeRecPoints(TTree * clustersTree)
642 {
643  // Fill QA for RecPoints - SDD -
644   Int_t rv = 0 ; 
645
646   Int_t lay, lad, det; 
647   //AliInfo("get the branch with the ITS clusters !\n");
648   TBranch *branchRecP = clustersTree->GetBranch("ITSRecPoints");
649   if (!branchRecP) {
650     AliError("can't get the branch with the ITS clusters !");
651     return rv ;
652   }
653
654   static TClonesArray statRecpoints("AliITSRecPoint") ;
655   TClonesArray *recpoints = &statRecpoints;
656   branchRecP->SetAddress(&recpoints);
657   Int_t npoints = 0;      
658   Float_t cluglo[3]={0.,0.,0.}; 
659   if(fkOnline)
660     {
661       for(Int_t i=16;i<18;i++)
662         {
663           fAliITSQADataMakerRec->GetRecPointsData(i+fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Reset();
664         }
665     }
666   for(Int_t module=0; module<clustersTree->GetEntries();module++){
667     //AliInfo(Form("Module %d\n",module));
668     branchRecP->GetEvent(module);
669     npoints += recpoints->GetEntries();
670     //AliInfo(Form("modnumb %d, npoints %d, total points %d\n",module, recpoints->GetEntries(),npoints));
671     //AliITSgeomTGeo::GetModuleId(module, lay, lad, det);
672     //AliInfo(Form("modnumb %d, lay %d, lad %d, det %d \n",module, lay, lad, det));
673     
674     //AliInfo(Form("modnumb %d, entries %d\n",module, recpoints->GetEntries()));
675     for(Int_t j=0;j<recpoints->GetEntries();j++){
676       //AliInfo(Form("modnumb %d, entry %d \n",module, j));
677       AliITSRecPoint *recp = (AliITSRecPoint*)recpoints->At(j); 
678       Int_t index = recp->GetDetectorIndex();
679       lay=recp->GetLayer();
680       Int_t modnumb=index+AliITSgeomTGeo::GetModuleIndex(lay+1,1,1);
681       //printf("modnumb  %i\n",modnumb);  
682       AliITSgeomTGeo::GetModuleId(modnumb, lay, lad, det);  
683       fAliITSQADataMakerRec->GetRecPointsData(6 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(modnumb);//modpatternrp
684       recp->GetGlobalXYZ(cluglo);
685       Float_t rad=TMath::Sqrt(cluglo[0]*cluglo[0]+cluglo[1]*cluglo[1]); 
686       Float_t phi=TMath::ATan2(cluglo[1],cluglo[0]);
687       Float_t drifttime=recp->GetDriftTime();
688       fAliITSQADataMakerRec->GetRecPointsData(9 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(recp->GetDetLocalX(),recp->GetDetLocalZ());//local distribution
689       if(lay==3||lay==4)fAliITSQADataMakerRec->GetRecPointsData(2 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[0],cluglo[1]);//global distribution YX
690       fAliITSQADataMakerRec->GetRecPointsData(3 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[2],rad);//global distribution rz
691       if(fkOnline) {
692         fAliITSQADataMakerRec->GetRecPointsData(16 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[0],cluglo[1]);//global distribution YX FSE
693         fAliITSQADataMakerRec->GetRecPointsData(17 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[2],rad);//global distribution rz FSE
694       }
695       if(recp->GetLayer() == 2) {
696         fAliITSQADataMakerRec->GetRecPointsData(0  +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(recp->GetQ()) ;//total charge of layer 3
697         fAliITSQADataMakerRec->GetRecPointsData(7  +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(lad);//lad pattern layer 3
698         fAliITSQADataMakerRec->GetRecPointsData(10 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(rad);//r distribution layer 3
699         fAliITSQADataMakerRec->GetRecPointsData(12 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(phi);// phi distribution layer 3
700         fAliITSQADataMakerRec->GetRecPointsData(4  +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[2],phi);// zphi distribution layer
701         fAliITSQADataMakerRec->GetRecPointsData(14  +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(drifttime);// time distribution layer 3
702       } else if(recp->GetLayer() == 3) {
703         fAliITSQADataMakerRec->GetRecPointsData(1  +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(recp->GetQ()) ;//total charge layer 4
704         fAliITSQADataMakerRec->GetRecPointsData(8  +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(lad);//ladpatternlayer4
705         fAliITSQADataMakerRec->GetRecPointsData(11 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(rad);//r distribution
706         fAliITSQADataMakerRec->GetRecPointsData(13 +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(phi);//phi distribution
707         fAliITSQADataMakerRec->GetRecPointsData(5  +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(cluglo[2],phi);// zphi distribution layer 4
708         fAliITSQADataMakerRec->GetRecPointsData(15  +fGenRecPointsOffset[fAliITSQADataMakerRec->GetEventSpecie()])->Fill(drifttime);// time distribution layer 4
709       }
710     }
711   }
712   statRecpoints.Clear();
713   return rv ; 
714 }
715
716 //_______________________________________________________________
717
718 Int_t AliITSQASDDDataMakerRec::GetOffset(AliQAv1::TASKINDEX_t task, Int_t specie)
719 {
720   Int_t offset=0;
721   if( task == AliQAv1::kRAWS )
722     {
723       offset=fGenRawsOffset[specie];  
724     }
725   else if(task == AliQAv1::kDIGITSR )
726     {
727       offset=fGenDigitsOffset[specie];
728     }
729   else if( task == AliQAv1::kRECPOINTS )
730     {
731       offset=fGenRecPointsOffset[specie];   
732     }
733   return offset;
734 }
735
736 //_______________________________________________________________
737
738 void AliITSQASDDDataMakerRec::SetOffset(AliQAv1::TASKINDEX_t task, Int_t offset, Int_t specie) {
739   // Returns offset number according to the specified task
740   if( task == AliQAv1::kRAWS ) {
741     fGenRawsOffset[specie]=offset;
742   }
743   else if( task == AliQAv1::kDIGITSR ) {
744     fGenDigitsOffset[specie]=offset;
745   }
746   else if( task == AliQAv1::kRECPOINTS ) {
747     fGenRecPointsOffset[specie]=offset;
748   }
749 }
750
751 //_______________________________________________________________
752
753 Int_t AliITSQASDDDataMakerRec::GetTaskHisto(AliQAv1::TASKINDEX_t task)
754 {
755
756   Int_t histotot=0;
757
758   if( task == AliQAv1::kRAWS )
759     {
760       histotot=fSDDhRawsTask ;  
761     }
762   else if(task == AliQAv1::kDIGITSR)
763     {
764       histotot=fSDDhDigitsTask;
765     }
766   else if( task == AliQAv1::kRECPOINTS )
767     {
768       histotot=fSDDhRecPointsTask;   
769     }
770   else {
771     AliInfo("No task has been selected. TaskHisto set to zero.\n");
772   }
773   return histotot;
774 }
775
776 //_______________________________________________________________
777
778 void AliITSQASDDDataMakerRec::AnalyseBNG()
779 {
780
781 // get file time for Previous test
782         AliInfo("AnalyseBNG\n");
783         Int_t bngtimeBasPrevious; 
784         FILE *filepinPreviousBas = fopen( "SDDbasHistos.time", "r" );
785         if(filepinPreviousBas) {
786           fscanf(filepinPreviousBas,"%d",&bngtimeBasPrevious);
787           fclose (filepinPreviousBas);
788         } else 
789           bngtimeBasPrevious = 0;
790         Int_t bngtimeBasCurrent = 0; 
791         gSystem->Exec("perl -e '@d=localtime ((stat(shift))[9]); printf \"%02d%02d%02d%02d%02d\n\", $d[5]-100,$d[4]+1,$d[3],$d[2],$d[1]'  SDDbasHistos.root > SDDbasHistos.time");
792         FILE *filepinBas = fopen( "SDDbasHistos.time", "r" );
793         fscanf(filepinBas,"%d",&bngtimeBasCurrent);
794         if(bngtimeBasCurrent>bngtimeBasPrevious )AliInfo(Form("bngtimeBasCurrent %d, bngtimeBasPrevious %d\n",bngtimeBasCurrent,bngtimeBasPrevious));
795        
796         Bool_t kAnalyseBas = kTRUE;
797         if(bngtimeBasCurrent <= bngtimeBasPrevious) kAnalyseBas = kFALSE;
798         if(kAnalyseBas) {
799                 // new bng file found
800                 bngtimeBasPrevious = bngtimeBasCurrent;
801                 Bool_t kFilesExist = kTRUE;
802                 TFile basFile("SDDbasHistos.root");
803                 if(basFile.IsZombie()) kFilesExist = kFALSE;
804                 if(kFilesExist) {
805                   AnodeStatus();
806                   AnalyseHistos(1); // Baseline
807                   AnalyseHistos(2); // Uncorrected Noise
808                   AnalyseHistos(3); // Common Mode Noise
809                   AnalyseHistos(4); // Corrected Noise
810                   gSystem->Exec("cp SDDbasHistos.root SDDbasHistosPrevious.root");
811                 } else {
812                         AliInfo("file SDDbasHistos.root not found \n");
813                 }
814         }
815         fclose (filepinBas);
816 //      delete filepinBas;
817
818         Int_t bngtimeGainPrevious; 
819         FILE *filepinPrevious = fopen( "SDDgainHistos.time", "r" );
820         if(filepinPrevious) {
821           fscanf(filepinPrevious,"%d",&bngtimeGainPrevious);
822           fclose (filepinPrevious);
823         } else 
824           bngtimeGainPrevious = 0;
825         Int_t bngtimeGainCurrent = 0; 
826         gSystem->Exec("perl -e '@d=localtime ((stat(shift))[9]); printf \"%02d%02d%02d%02d%02d\n\", $d[5]-100,$d[4]+1,$d[3],$d[2],$d[1]'  SDDgainHistos.root > SDDgainHistos.time");
827         FILE *filepin = fopen( "SDDgainHistos.time", "r" );
828         fscanf(filepin,"%d",&bngtimeGainCurrent);
829         if(bngtimeGainCurrent>bngtimeGainPrevious )AliInfo(Form("bngtimeGainCurrent %d, bngtimeGainPrevious %d\n",bngtimeGainCurrent,bngtimeGainPrevious));
830        
831         Bool_t kAnalyse = kTRUE;
832         if(bngtimeGainCurrent <= bngtimeGainPrevious) kAnalyse = kFALSE;
833         if(kAnalyse) {
834                 // new bng file found
835                 bngtimeGainPrevious = bngtimeGainCurrent;
836                 Bool_t kFilesExist = kTRUE;
837                 TFile gainFile("SDDgainHistos.root");
838                 if(gainFile.IsZombie()) kFilesExist = kFALSE;
839                 if(kFilesExist) {
840                   AnalyseHistos(5); // Gain
841                   gSystem->Exec("cp SDDgainHistos.root SDDgainHistosPrevious.root");
842                 } else {
843                         AliInfo("file SDDgainHistos.root not found \n");
844                 }
845         }
846         fclose (filepin);
847 //      delete filepin;
848
849 }
850
851 //_______________________________________________________________
852
853 void AliITSQASDDDataMakerRec::AnalyseINJ()
854 {
855 // get file time for last test
856
857         AliInfo("AnalyseINJ\n");
858         Int_t injtimePrevious; 
859         FILE *filepinPrevious = fopen( "SDDinjectHistos.time", "r" );
860         if(filepinPrevious) {
861           fscanf(filepinPrevious,"%d",&injtimePrevious);
862           fclose (filepinPrevious);
863         } else 
864           injtimePrevious = 0;
865         Int_t injtimeCurrent = 0; 
866         gSystem->Exec("perl -e '@d=localtime ((stat(shift))[9]); printf \"%02d%02d%02d%02d%02d\n\", $d[5]-100,$d[4]+1,$d[3],$d[2],$d[1]'  SDDinjectHistos.root > SDDinjectHistos.time");
867         FILE *filepin = fopen( "SDDinjectHistos.time", "r" );
868         fscanf(filepin,"%d",&injtimeCurrent);
869         if(injtimeCurrent>injtimePrevious )AliInfo(Form("injtimeCurrent %d, injtimePrevious %d\n",injtimeCurrent,injtimePrevious));
870        
871         Bool_t kAnalyse = kTRUE;
872         if(injtimeCurrent <= injtimePrevious) kAnalyse = kFALSE;
873         if(kAnalyse) {
874                 // new inj file found
875                 injtimePrevious = injtimeCurrent;
876                 Bool_t kFilesExist = kTRUE;
877                 TFile gainFile("SDDinjectHistos.root");
878                 if(gainFile.IsZombie()) kFilesExist = kFALSE;
879                 
880                 if(kFilesExist) {
881                         AnalyseHistos(6); // Drift Speed
882                         gSystem->Exec("cp SDDinjectHistos.root SDDinjectHistosPrevious.root");
883                 } else {
884                         AliInfo("file(s) SDDinjectHistos.root not found \n");
885                 }
886         }
887         fclose (filepin);
888 //      delete filepin;
889 }
890
891 //_______________________________________________________________
892
893 void AliITSQASDDDataMakerRec::AnodeStatus()
894 {
895         char *hnamePrevious = new char[50];
896         fGoodAnodes = 0;
897
898         TFile basFilePrevious("SDDbasHistosPrevious.root");
899         if(!basFilePrevious.IsZombie()) {
900           for(Int_t ddl =0; ddl<fDDLModuleMap->GetNDDLs(); ddl++){
901                 for(Int_t crx =0; crx<fDDLModuleMap->GetNModPerDDL(); crx++){
902                         for(Int_t iside=0;iside<fgknSide;iside++){
903                                 Int_t moduleSDD = fDDLModuleMap->GetModuleNumber(ddl,crx);
904                 //AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
905                                 sprintf(hnamePrevious,"hgood%02dc%02ds%d",ddl,crx,iside);
906                         //AliInfo(Form("get histo %s\n",hnamePrevious));
907                                 TH1F *hgood = (TH1F *) basFilePrevious.Get(hnamePrevious);
908                                 if(!hgood) continue;
909                                 for(Int_t i=0; i<hgood->GetNbinsX();i++) {
910                                         fkAnodeMap[moduleSDD-fgkmodoffset][iside][i] = hgood->GetBinContent(i);
911                                         if(fkAnodeMap[moduleSDD-fgkmodoffset][iside][i]) fGoodAnodes++;
912                                 }
913                                 delete hgood;
914                         }
915                 }
916           }
917           basFilePrevious.Close();
918         }
919         fGoodAnodesCurrent = 0;
920         fBadAnodesCurrent = 0;
921         char *hname = new char[50];
922         Int_t nChangedStatus = 0;
923         Bool_t CurrentAnodeMap[fgknSDDmodules][fgknSide][fgknAnode];    
924         TFile basFile("SDDbasHistos.root");
925         if(!basFile.IsZombie()) {
926           for(Int_t ddl =0; ddl<fDDLModuleMap->GetNDDLs(); ddl++){
927                 for(Int_t crx =0; crx<fDDLModuleMap->GetNModPerDDL(); crx++){
928                         for(Int_t iside=0;iside<fgknSide;iside++){
929                                 Int_t moduleSDD = fDDLModuleMap->GetModuleNumber(ddl,crx);
930                         //AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
931                                 sprintf(hname,"hgood%02dc%02ds%d",ddl,crx,iside);
932                         //AliInfo(Form("get histo %s\n",hname));
933                                 TH1F *hgood = (TH1F *) basFile.Get(hname);
934                                 if(!hgood) continue;
935                                 for(Int_t i=0; i<hgood->GetNbinsX();i++) {
936                                         CurrentAnodeMap[moduleSDD-fgkmodoffset][iside][i] = hgood->GetBinContent(i);
937                                         if(CurrentAnodeMap[moduleSDD-fgkmodoffset][iside][i]) fGoodAnodesCurrent++;
938                                         else fBadAnodesCurrent++;
939                                         if(CurrentAnodeMap[moduleSDD-fgkmodoffset][iside][i] != fkAnodeMap[moduleSDD-fgkmodoffset][iside][i]) {
940                                                 fkAnodeMap[moduleSDD-fgkmodoffset][iside][i] = CurrentAnodeMap[moduleSDD-fgkmodoffset][iside][i];
941                                                 nChangedStatus++;
942                                                 //      AliWarning(Form("DDL %d, CRX %d, Side %d, Anode %d changed status to %d \n",ddl,crx,iside,i,fkAnodeMap[moduleSDD-fgkmodoffset][iside][i]));
943                                         }
944                                 }
945                                 delete hgood;
946                         }
947                 }
948           }
949           basFile.Close();
950         }
951
952         AliWarning(Form("Number of good anodes changed from %d to %d, that is %f %%\n",fGoodAnodes,fGoodAnodesCurrent,((Float_t) TMath::Abs(fGoodAnodes-fGoodAnodesCurrent))/(fBadAnodesCurrent+fGoodAnodesCurrent)));
953         if(fGoodAnodesCurrent != fGoodAnodes) {
954                 fGoodAnodes = fGoodAnodesCurrent;
955         }
956         AliWarning(Form("Number of bad anodes changed from %d to %d, that is %f %%\n",fBadAnodes,fBadAnodesCurrent,((Float_t) TMath::Abs(fBadAnodes-fBadAnodesCurrent))/(fBadAnodesCurrent+fGoodAnodesCurrent)));
957         if(fBadAnodesCurrent != fBadAnodes) {
958                 fBadAnodes = fBadAnodesCurrent;
959         }
960 //      delete hname;
961 }
962
963 //_______________________________________________________________
964
965 void AliITSQASDDDataMakerRec::AnalyseHistos(Int_t type)
966 {
967
968         if(type < 1 || type > 6) {
969           AliWarning(Form("Wrong type (%d), must be between 1 and 6\n",type));
970           return;
971         }
972
973         Double_t Current[fgknSDDmodules][fgknSide][fgknAnode];  
974         char *hnamePrevious = new char[50];
975         TString *filenamePrevious=NULL;
976
977                 if(type < 5) filenamePrevious = new TString("SDDbasHistosPrevious.root");
978                 else if(type == 5) filenamePrevious = new TString("SDDgainHistosPrevious.root");
979                 else if(type == 6) filenamePrevious = new TString("SDDinjectHistosPrevious.root");
980                 TFile *gainFilePrevious = new TFile(filenamePrevious->Data());
981                 if(!gainFilePrevious->IsZombie()) {
982
983                   for(Int_t ddl =0; ddl<fDDLModuleMap->GetNDDLs(); ddl++){
984                     for(Int_t crx =0; crx<fDDLModuleMap->GetNModPerDDL(); crx++){
985                                 for(Int_t iside=0;iside<fgknSide;iside++){
986                                         Int_t moduleSDD = fDDLModuleMap->GetModuleNumber(ddl,crx);
987                         //AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
988                                         if(type == 1) sprintf(hnamePrevious,"hbase%02dc%02ds%d",ddl,crx,iside);
989                                         else if(type == 2) sprintf(hnamePrevious,"hnois%02dc%02ds%d",ddl,crx,iside);
990                                         else if(type == 3) sprintf(hnamePrevious,"hcmn%02dc%02ds%d",ddl,crx,iside);
991                                         else if(type == 4) sprintf(hnamePrevious,"hcorn%02dc%02ds%d",ddl,crx,iside);
992                                         else if(type == 5) sprintf(hnamePrevious,"hgain%02dc%02ds%d",ddl,crx,iside);
993                                         else if(type == 6) sprintf(hnamePrevious,"hdrsp%02dc%02ds%d",ddl,crx,iside);
994                                 //AliInfo(Form("get histo %s\n",hnamePrevious));
995                                         TH1F *hhist = (TH1F *) gainFilePrevious->Get(hnamePrevious);
996                                         if(!hhist) continue;
997                                         for(Int_t i=0; i<hhist->GetNbinsX();i++) {
998                                                 Current[moduleSDD-fgkmodoffset][iside][i] = hhist->GetBinContent(i);
999                                         }
1000                                         delete hhist;
1001                                 }
1002                         }
1003                   }
1004                   gainFilePrevious->Close();
1005                   delete gainFilePrevious;
1006                 }
1007                 delete filenamePrevious;
1008
1009         Float_t xmin = 0.;
1010         Float_t xmax = 0;
1011         Int_t nbins = 1;
1012         TH1F *hDist = 0;
1013         TH1F *hDistDiff = 0;
1014         if(type == 1) {
1015                 xmin = 0.;
1016                 xmax = 500.;
1017                 nbins = (Int_t)(xmax-xmin);
1018                 hDist = new TH1F("hBaseline","Baseline",nbins,xmin,xmax);
1019                 hDistDiff = new TH1F("hBaselineDiff","Baseline Difference",200,-100.,100.);
1020         } else if(type == 2) {
1021                 xmin = 0.;
1022                 xmax = 10.;
1023                 nbins = (Int_t) (100.*(xmax-xmin));
1024                 hDist = new TH1F("hNoiseUnc","Noise (before correction)",nbins,xmin,xmax);
1025                 hDistDiff = new TH1F("hNoiseUncDiff","Noise (before correction) Difference",200,-10.,10.);
1026         } else if(type == 3) {
1027                 xmin = 0.;
1028                 xmax = 10.;
1029                 nbins = (Int_t)( 100.*(xmax-xmin));
1030                 hDist = new TH1F("hNoiseCMN","Noise (common mode)",nbins,xmin,xmax);
1031                 hDistDiff = new TH1F("hNoiseCMNDiff","Noise (common mode) Difference",200,-10.,10.);
1032         } else if(type == 4) {
1033                 xmin = 0.;
1034                 xmax = 10.;
1035                 nbins = (Int_t)(100.*(xmax-xmin));
1036                 hDist = new TH1F("hNoiseCor","Noise (after correction)",nbins,xmin,xmax);
1037                 hDistDiff = new TH1F("hNoiseCorDiff","Noise (after correction) Difference",200,-10.,10.);
1038         } else if(type == 5) {
1039                 xmin = 0.;
1040                 xmax = 5.;
1041                 nbins = (Int_t)(100.*(xmax-xmin));
1042                 hDist = new TH1F("hGain","Gain",nbins,xmin,xmax);
1043                 hDistDiff = new TH1F("hGainDiff","Gain Difference",200,-10.,10.);
1044         } else if(type == 6) {
1045                 xmin = 0.;
1046                 xmax = 10.;
1047                 nbins = (Int_t)(100.*(xmax-xmin));
1048                 hDist = new TH1F("hDriftSpeed","Drift Speed",nbins,xmin,xmax);
1049                 hDistDiff = new TH1F("hDriftSpeedDiff","Drift Speed Difference",200,-10.,10.);
1050         }
1051
1052         Float_t binw = (xmax-xmin)/nbins;
1053
1054         TString *filenamePrevious2=NULL;
1055
1056                 if(type < 5) filenamePrevious2 = new TString("SDDbasHistosPrevious.root");
1057                 else if(type == 5) filenamePrevious2 = new TString("SDDgainHistosPrevious.root");
1058                 else if(type == 6) filenamePrevious2 = new TString("SDDinjectHistosPrevious.root");
1059                 TFile *gainFile = new TFile(filenamePrevious2->Data());
1060                 if(!gainFile->IsZombie()) {
1061
1062                   for(Int_t ddl =0; ddl<fDDLModuleMap->GetNDDLs(); ddl++){
1063                         for(Int_t crx =0; crx<fDDLModuleMap->GetNModPerDDL(); crx++){
1064                                 for(Int_t iside=0;iside<fgknSide;iside++){
1065                                         Int_t moduleSDD = fDDLModuleMap->GetModuleNumber(ddl,crx);
1066                         //AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
1067                                         if(type == 1) sprintf(hnamePrevious,"hbase%02dc%02ds%d",ddl,crx,iside);
1068                                         else if(type == 2) sprintf(hnamePrevious,"hnois%02dc%02ds%d",ddl,crx,iside);
1069                                         else if(type == 3) sprintf(hnamePrevious,"hcmn%02dc%02ds%d",ddl,crx,iside);
1070                                         else if(type == 4) sprintf(hnamePrevious,"hcorn%02dc%02ds%d",ddl,crx,iside);
1071                                         else if(type == 5) sprintf(hnamePrevious,"hgain%02dc%02ds%d",ddl,crx,iside);
1072                                         else if(type == 6) sprintf(hnamePrevious,"hdrsp%02dc%02ds%d",ddl,crx,iside);
1073                                 //AliInfo(Form("get histo %s\n",hname));
1074                                         TH1F *hhist = (TH1F *) gainFile->Get(hnamePrevious);
1075                                         if(!hhist) continue;
1076                                         for(Int_t i=0; i<hhist->GetNbinsX();i++) {
1077                                                 if(!fkAnodeMap[moduleSDD-fgkmodoffset][iside][i]) continue;
1078                                                 hDist->Fill(hhist->GetBinContent(i));
1079                                                 hDistDiff->Fill(hhist->GetBinContent(i)-Current[moduleSDD-fgkmodoffset][iside][i]);
1080                                         }
1081                                         delete hhist;
1082                                 }
1083                         }
1084                   }
1085                   gainFile->Close();
1086                   delete gainFile;
1087                 }
1088                 delete filenamePrevious2;
1089
1090         TF1 ff("ff", "gaus", xmin+0.1, xmax-0.1);
1091         hDist->Fit("ff","NWR");
1092 //      hDist->Fit("gaus","","",xmin+0.1, xmax-0.1);
1093 //      Float_t ChiSquared = (Float_t) ff.GetChisquare();
1094 //      Int_t NDF = ff.GetNumberFitPoints() - ff.GetNpar();
1095         Float_t average = (Float_t) ff.GetParameter(1);
1096         Float_t sigma = (Float_t) ff.GetParameter(2);
1097 //      Float_t mean = hDist->GetMean();
1098 //      Float_t rms = hDist->GetRMS();
1099         Int_t badB = 0;
1100         for(Int_t i=0; i<hDist->GetNbinsX();i++) {
1101 //              if(type < 6) 
1102           if(TMath::Abs(i*binw-average) > 4.*sigma) badB += (Int_t)hDist->GetBinContent(i);
1103 //              else
1104 //                      if(TMath::Abs(i-mean) > 4*rms) badB += hDist->GetBinContent(i);
1105         }
1106         Double_t denomi = hDist->GetEntries();
1107         if(denomi == 0) {
1108           denomi = 1;
1109           badB = 0; 
1110         } 
1111         if(type == 1) {
1112                 AliInfo(Form("Number of anodes with baseline out of 4*sigma from average: %d, %f%%\n",badB,100.*((Float_t) badB)/denomi));
1113         } else if(type == 2) {
1114                 AliInfo(Form("Number of anodes with uncorrected noise out of 4*sigma from average: %d, %f%%\n",badB,100.*((Float_t) badB)/denomi));
1115         } else if(type == 3) {
1116                 AliInfo(Form("Number of anodes with common mode noise out of 4*sigma from average: %d, %f%%\n",badB,100.*((Float_t) badB)/denomi));
1117         } else if(type == 4) {
1118                 AliInfo(Form("Number of anodes with corrected noise out of 4*sigma from average: %d, %f%%\n",badB,100.*((Float_t) badB)/denomi));
1119         } else if(type == 5) {
1120                 AliInfo(Form("Number of anodes with gain out of 4*sigma from average: %d, %f%%\n",badB,100.*((Float_t) badB)/denomi));
1121         } else if(type == 6) {
1122                 Int_t badspeed = (Int_t)hDist->GetBinContent(1);
1123                 AliInfo(Form("Number of anodes with drift speed equal to 0: %d\n",badspeed));
1124                 AliInfo(Form("Number of anodes with drift speed out of 4*sigma from average: %d, %f%%\n",badB-badspeed,100.*((Float_t) (badB-badspeed))/(denomi-badspeed)));
1125         }
1126         
1127         TH1F *hDistHistoryCurrent = NULL;
1128         TH1F *hDistHistoryPrevious = NULL;
1129
1130         TFile *gainHistoryFile=NULL;
1131         if(type < 5) 
1132                 gainHistoryFile = new TFile("SDDbasHistory.root","UPDATE");
1133         else if(type ==5) 
1134                 gainHistoryFile = new TFile("SDDgainHistory.root","UPDATE");
1135         else if(type == 6)
1136                 gainHistoryFile = new TFile("SDDinjectHistory.root","UPDATE");
1137         hDist->Write();
1138         hDistDiff->Write();
1139
1140         //AliInfo("SDDgainHistory.root file opened\n");
1141         if(!gainHistoryFile->IsZombie()) {
1142           if(type == 1) {
1143             hDistHistoryPrevious = (TH1F *) gainHistoryFile->Get("hBaselineHistory"); 
1144           }
1145           else if(type == 2){ 
1146             hDistHistoryPrevious = (TH1F *) gainHistoryFile->Get("hNoiseUncHistory");
1147           }
1148           else if(type == 3) {
1149             hDistHistoryPrevious = (TH1F *) gainHistoryFile->Get("hNoiseCMNHistory");
1150           }
1151           else if(type == 4) {
1152             hDistHistoryPrevious = (TH1F *) gainHistoryFile->Get("hNoiseCorHistory");
1153           }
1154           else if(type == 5) {
1155             hDistHistoryPrevious = (TH1F *) gainHistoryFile->Get("hGainHistory");
1156           }
1157           else if(type == 6){
1158             hDistHistoryPrevious = (TH1F *) gainHistoryFile->Get("hDriftSpeedHistory");
1159           }
1160           Char_t newname[30];
1161           if(hDistHistoryPrevious){
1162             sprintf(newname,"%sPrev",hDistHistoryPrevious->GetName());
1163             hDistHistoryPrevious->SetName(newname);
1164             sprintf(newname,"%sPrev",hDistHistoryPrevious->GetTitle());
1165             hDistHistoryPrevious->SetTitle(newname);
1166           }
1167                 //AliInfo(Form("hDistHistoryPrevious %x\n",hDistHistoryPrevious));
1168
1169
1170                 if(!hDistHistoryPrevious) {
1171                         if(type == 1) hDistHistoryCurrent = new TH1F("hBaselineHistory","Average Baseline History",2,0,2);
1172                         else if(type == 2) hDistHistoryCurrent = new TH1F("hNoiseUncHistory","Average Uncorrected Noise History",2,0,2);
1173                         else if(type == 3) hDistHistoryCurrent = new TH1F("hNoiseCMNHistory","Average Common Mode Noise History",2,0,2);
1174                         else if(type == 4) hDistHistoryCurrent = new TH1F("hNoiseCorHistory","Average Corrected Noise History",2,0,2);
1175                         else if(type == 5) hDistHistoryCurrent = new TH1F("hGainHistory","Average Gain History",2,0,2);
1176                         else if(type == 6) hDistHistoryCurrent = new TH1F("hDriftSpeedHistory","Average Drift Speed History",2,0,2);
1177                         //AliInfo(Form("hDistHistoryCurrent 1 %x\n",hDistHistoryCurrent));
1178 //                      if(type < 6) {
1179                                 hDistHistoryCurrent->SetBinContent(1,average);
1180                                 hDistHistoryCurrent->SetBinError(1,sigma);
1181 /*
1182                         } else {
1183                                 hDistHistoryCurrent->SetBinContent(1,mean);
1184                                 hDistHistoryCurrent->SetBinError(1,rms);
1185                         }
1186 */
1187                 } else {
1188                         if(type == 1) hDistHistoryCurrent = new TH1F("hBaselineHistory","Average Baseline History",hDistHistoryPrevious->GetNbinsX()+1,0,hDistHistoryPrevious->GetNbinsX()+1);
1189                         else if(type == 2) hDistHistoryCurrent = new TH1F("hNoiseUncHistory","Average Uncorrected Noise History",hDistHistoryPrevious->GetNbinsX()+1,0,hDistHistoryPrevious->GetNbinsX()+1);
1190                         else if(type == 3) hDistHistoryCurrent = new TH1F("hNoiseCMNHistory","Average Common Mode Noise History",hDistHistoryPrevious->GetNbinsX()+1,0,hDistHistoryPrevious->GetNbinsX()+1);
1191                         else if(type == 4) hDistHistoryCurrent = new TH1F("hNoiseCorHistory","Average Corrected Noise History",hDistHistoryPrevious->GetNbinsX()+1,0,hDistHistoryPrevious->GetNbinsX()+1);
1192                         else if(type == 5) hDistHistoryCurrent = new TH1F("hGainHistory","Average Gain History",hDistHistoryPrevious->GetNbinsX()+1,0,hDistHistoryPrevious->GetNbinsX()+1);
1193                         else if(type == 6) hDistHistoryCurrent = new TH1F("hDriftSpeedHistory","Average Drift Speed History",hDistHistoryPrevious->GetNbinsX()+1,0,hDistHistoryPrevious->GetNbinsX()+1);
1194                         //AliInfo(Form("hBaselineHistory 2 %x\n",hDistHistory));
1195                         for(Int_t i=0;i<hDistHistoryPrevious->GetNbinsX();i++) {
1196                                 hDistHistoryCurrent->SetBinContent(i,hDistHistoryPrevious->GetBinContent(i));
1197                                 hDistHistoryCurrent->SetBinError(i,hDistHistoryPrevious->GetBinError(i));
1198                         }
1199                         hDistHistoryCurrent->SetBinContent(hDistHistoryPrevious->GetNbinsX(),average);
1200                         hDistHistoryCurrent->SetBinError(hDistHistoryPrevious->GetNbinsX(),sigma);
1201                 }
1202
1203         }
1204         hDistHistoryCurrent->Write();
1205         gainHistoryFile->Close();
1206         delete gainHistoryFile;
1207         //delete hname;
1208         delete hDist;
1209         delete hDistDiff;
1210
1211         //if(hDistHistoryCurrent) delete hDistHistoryCurrent;
1212         //if(hDistHistoryPrevious) delete hDistHistoryPrevious;
1213 }
1214
1215 //_______________________________________________________________
1216
1217
1218 void AliITSQASDDDataMakerRec::CreateTheMap()
1219 {
1220
1221   AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD");
1222   Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
1223   if(!ddlMapSDD)
1224     {
1225       AliError("Calibration object retrieval failed! SDD will not be processed");
1226       fDDLModuleMap = NULL;
1227       //return rv;
1228     }
1229   fDDLModuleMap = (AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
1230   if(!cacheStatus)ddlMapSDD->SetObject(NULL);
1231   ddlMapSDD->SetOwner(kTRUE);
1232   if(!cacheStatus)
1233     {
1234       delete ddlMapSDD;
1235     }
1236   AliInfo("DDL Map Created\n ");
1237 }