2 /**************************************************************************
3 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
19 // *****************************************
20 // Checks the quality assurance
21 // by comparing with reference data
22 // P. Cerello Apr 2008
25 // --- ROOT system ---
34 // --- AliRoot header files ---
35 #include "AliITSQASDDChecker.h"
37 #include "AliCDBEntry.h"
38 #include "AliQAManager.h"
39 #include "AliQACheckerBase.h"
41 #include "AliITSCalibrationSDD.h"
42 #include "AliITSgeomTGeo.h"
44 ClassImp(AliITSQASDDChecker)
45 //__________________________________________________________________
46 AliITSQASDDChecker& AliITSQASDDChecker::operator = (const AliITSQASDDChecker& qac )
49 this->~AliITSQASDDChecker();
50 new(this) AliITSQASDDChecker(qac);
54 AliITSQASDDChecker::~AliITSQASDDChecker()
58 delete[] fStepBitSDD ;
68 delete[]fHighSDDValue;
78 //__________________________________________________________________
79 Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, TObjArray * list/*, AliDetectorRecoParam *recoparam*/)
81 AliInfo(Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset) );
83 AliDebug(1,Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset));
89 for(Int_t i=0;i<2;i++)entries2[i]=0.;
94 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
96 AliCDBEntry *calibSDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
97 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
100 AliError("Calibration object retrieval failed! SDD will not be processed");
102 test= fHighSDDValue[AliQAv1::kWARNING];
104 fCalibration = (TObjArray *)calibSDD->GetObject();
106 if(!cacheStatus)calibSDD->SetObject(NULL);
107 calibSDD->SetOwner(kTRUE);
113 AliInfo("Calib SDD Created\n ");
115 if (list->GetEntries() == 0.){ //check if the list is empty
116 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
117 test=test+fHighSDDValue[AliQAv1::kFATAL];
123 for(offset =0;offset < fSubDetOffset; offset++){hdata = dynamic_cast<TH1*>(next());}//end for
124 Int_t emptymodules[2];
125 Int_t filledmodules[2];
126 Int_t emptyladders[2];
127 Int_t filledladders[2];
128 for(Int_t i=0;i<2;i++){
136 for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
137 while( hdata = dynamic_cast<TH1* >(next()) ){
139 TString hname=hdata->GetName();
140 if(hname.Contains("SDDchargeMap"))continue;
141 if(hname.Contains("SDDModPattern")){
143 entries= hdata->GetEntries();
145 AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
146 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
147 test=test+fStepBitSDD[AliQAv1::kFATAL];
150 int modmax=hdata->GetNbinsX();
154 for(Int_t i=1;i<=modmax;i++){
155 content=hdata->GetBinContent(i);
156 if(content==0.){empty++;}
157 else if(content!=0.){filled++;}
159 AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));
160 }//end else pattern entries !=0
162 else if(hname.Contains("SDDphizL3")||hname.Contains("SDDphizL4")){
164 if(hname.Contains("3"))layer=0;
165 else if(hname.Contains("4"))layer=1;
166 entries2[layer]=hdata->GetEntries();
167 if(entries2[layer]==0){
168 AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
169 //printf("test = %f \t value %f\n",test,fStepBitSDD[AliQAv1::kFATAL]);
170 test=test+fStepBitSDD[AliQAv1::kFATAL];
178 if(hname.Contains("3"))layer=0;
179 else if(hname.Contains("4"))layer=1;
180 hlayer[layer]=dynamic_cast<TH2*>(hdata);
181 hlayer[layer]->RebinX(2);
182 int modmay=hlayer[layer]->GetNbinsY();
183 TH1D* hproj= hlayer[layer]->ProjectionY();
184 Double_t ladcontent=0;
185 for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
186 ladcontent=hproj->GetBinContent(i);
187 if(ladcontent==0){emptyladders[layer]++;}
188 else if(ladcontent!=0){filledladders[layer]++;}
190 AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer], filledladders[layer]));//end else layer 3
193 }//end else entries !=0
197 if(entries==0.&&entries2[0]==0.&&entries2[1]==0.) break;
199 if(hmodule||(hlayer[0]&&hlayer[1])){
202 Int_t exactive=0;//excluded but taking data
203 //AliITSCalibrationSDD *cal;
204 for(Int_t imod=0;imod<fgknSDDmodules;imod++){
209 module=imod+fgkmodoffset;
210 AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
211 if(cal==0) { delete cal; continue;}
212 AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
216 Double_t contentlayer[2];
217 for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
218 if(hmodule)content=hmodule->GetBinContent(imod+1);//if expert bit is active the histogram has been created
219 contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
220 if(content!=0.||contentlayer[lay-3]!=0.)
222 filledmodules[lay-3]++;
223 AliWarning(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",module,lay,lad,det));
226 else if(content==0.&&contentlayer[lay-3]==0.)emptymodules[lay-3]++;
227 //AliInfo(Form("The module %d (layer %i, ladder %i det %i ) is bad, content %f content layer %f filled modules position %d ",module,lay,lad,det,contentlayer[lay-3],content,lay-3) );
231 Double_t contentgood=0.;
233 //printf("lay: %i\t det %i \t lad %i \n",lay,det,lad );
234 contentgood=hlayer[lay-3]->GetBinContent(det,lad);
235 if(contentgood==0.){emptymodules[lay-3]++;}
236 else if(contentgood!=0.){filledmodules[lay-3]++;}
242 for(Int_t i=0;i<2;i++){AliInfo(Form(" %s :Layer %i \tempty modules %i \t filled modules %i\n",hlayer[i]->GetName(), i+3,emptymodules[i], filledmodules[i]));}//end else layers
244 AliInfo(Form("All the active modules (%i) are in acquisition. The number of excluded modules are %i \n",active,excluded));
245 test=fHighSDDValue[AliQAv1::kINFO];}
247 AliWarning(Form("%i modules excluded from the acquisition took data. Active modules%i \n ",exactive,active));
248 test=fHighSDDValue[AliQAv1::kWARNING];
250 if(excluded==exactive){
251 AliWarning(Form("All the modules exluded from the acquisition (%d) took data! Active modules %i\n",excluded,active));
252 test=fHighSDDValue[AliQAv1::kWARNING];
255 AliWarning(Form("No modules took data: excluded %i \t exactive %i \n", excluded, exactive));
256 test=fHighSDDValue[AliQAv1::kFATAL];
260 }//end getentries !=0
269 case AliQAv1::kNULLTASK:
270 AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index)));
274 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
278 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
282 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
286 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
289 case AliQAv1::kNTASK:
290 AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index)));
299 //__________________________________________________________________
300 void AliITSQASDDChecker::SetTaskOffset(Int_t taskoffset)
302 fSubDetOffset = taskoffset;
306 //__________________________________________________________________
307 void AliITSQASDDChecker::SetStepBit(Double_t *steprange)
310 fStepBitSDD = new Double_t[AliQAv1::kNBIT];
311 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
313 fStepBitSDD[bit]=steprange[bit];
317 //__________________________________________________________________
318 void AliITSQASDDChecker::SetSDDLimits(Float_t *lowvalue, Float_t * highvalue)
321 fLowSDDValue = new Float_t[AliQAv1::kNBIT];
322 fHighSDDValue= new Float_t[AliQAv1::kNBIT];
324 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
326 fLowSDDValue[bit]=lowvalue[bit];
327 fHighSDDValue[bit]= highvalue[bit];