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, const 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.;
92 AliCDBEntry *calibSDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
93 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
96 AliError("Calibration object retrieval failed! SDD will not be processed");
98 test= fHighSDDValue[AliQAv1::kWARNING];
100 fCalibration = (TObjArray *)calibSDD->GetObject();
102 if(!cacheStatus)calibSDD->SetObject(NULL);
103 calibSDD->SetOwner(kTRUE);
110 AliInfo("Calib SDD Created\n ");
116 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
118 if (list->GetEntries() == 0.){ //check if the list is empty
119 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
120 test=test+fHighSDDValue[AliQAv1::kFATAL];
126 for(offset =0;offset < fSubDetOffset; offset++){hdata = dynamic_cast<TH1*>(next());}//end for
127 Int_t emptymodules[2];
128 Int_t filledmodules[2];
129 Int_t emptyladders[2];
130 Int_t filledladders[2];
131 for(Int_t i=0;i<2;i++){
139 for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
140 while( (hdata = dynamic_cast<TH1* >(next())) ){
142 TString hname=hdata->GetName();
143 if(hname.Contains("SDDchargeMap"))continue;
144 if(hname.Contains("SDDModPattern")){
146 entries= hdata->GetEntries();
148 AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
149 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
150 test=test+fStepBitSDD[AliQAv1::kFATAL];
153 int modmax=hdata->GetNbinsX();
157 for(Int_t i=1;i<=modmax;i++){
158 content=hdata->GetBinContent(i);
159 if(content==0.){empty++;}
160 else if(content!=0.){filled++;}
162 AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));
163 }//end else pattern entries !=0
165 else if(hname.Contains("SDDphizL3")||hname.Contains("SDDphizL4")){
167 if(hname.Contains("3"))layer=0;
168 else if(hname.Contains("4"))layer=1;
169 entries2[layer]=hdata->GetEntries();
170 if(entries2[layer]==0){
171 AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
172 //printf("test = %f \t value %f\n",test,fStepBitSDD[AliQAv1::kFATAL]);
173 test=test+fStepBitSDD[AliQAv1::kFATAL];
181 if(hname.Contains("3"))layer1=0;
182 else if(hname.Contains("4"))layer1=1;
183 TH2* htemp=dynamic_cast<TH2*>(hdata);
184 hlayer[layer1]=(TH2*)htemp->Clone();
186 sprintf(newname,"%s_copy",hname.Data());
187 hlayer[layer1]->SetName(newname);
188 hlayer[layer1]->RebinX(2);
189 int modmay=hlayer[layer1]->GetNbinsY();
190 TH1D* hproj= hlayer[layer1]->ProjectionY();
191 Double_t ladcontent=0;
192 for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
193 ladcontent=hproj->GetBinContent(i);
194 if(ladcontent==0){emptyladders[layer1]++;}
195 else if(ladcontent!=0){filledladders[layer1]++;}
197 AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer], filledladders[layer]));//end else layer 3
202 }//end else entries !=0
206 if(entries==0.&&entries2[0]==0.&&entries2[1]==0.) break;
208 if(hmodule||(hlayer[0]&&hlayer[1])){
211 Int_t exactive=0;//excluded but taking data
212 //AliITSCalibrationSDD *cal;
213 for(Int_t imod=0;imod<fgknSDDmodules;imod++){
218 module=imod+fgkmodoffset;
219 AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
220 if(cal==0) { delete cal; continue;}
221 AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
225 Double_t contentlayer[2];
226 for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
227 if(hmodule)content=hmodule->GetBinContent(imod+1);//if expert bit is active the histogram has been created
228 contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
229 if(content!=0.||contentlayer[lay-3]!=0.)
231 filledmodules[lay-3]++;
232 AliWarning(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",module,lay,lad,det));
235 else if(content==0.&&contentlayer[lay-3]==0.)emptymodules[lay-3]++;
236 //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) );
240 Double_t contentgood=0.;
242 //printf("lay: %i\t det %i \t lad %i \n",lay,det,lad );
243 contentgood=hlayer[lay-3]->GetBinContent(det,lad);
244 if(contentgood==0.){emptymodules[lay-3]++;}
245 else if(contentgood!=0.){filledmodules[lay-3]++;}
251 for(Int_t i=0;i<2;i++){AliInfo(Form("Layer %i \tempty modules %i \t filled modules %i\n", i+3,emptymodules[i], filledmodules[i]));}//end else layers
253 AliInfo(Form("All the active modules (%i) are in acquisition. The number of excluded modules are %i \n",active,excluded));
254 test=fHighSDDValue[AliQAv1::kINFO];}
256 AliWarning(Form("%i modules excluded from the acquisition took data. Active modules%i \n ",exactive,active));
257 test=fHighSDDValue[AliQAv1::kWARNING];
259 if(excluded==exactive){
260 AliWarning(Form("All the modules exluded from the acquisition (%d) took data! Active modules %i\n",excluded,active));
261 test=fHighSDDValue[AliQAv1::kWARNING];
264 AliWarning(Form("No modules took data: excluded %i \t exactive %i \n", excluded, exactive));
265 test=fHighSDDValue[AliQAv1::kFATAL];
267 for(Int_t i=0;i<2;i++)
274 }//end getentries !=0
281 case AliQAv1::kNULLTASK:
282 AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index)));
287 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
289 if(list->GetUniqueID()==40){
290 if (list->GetEntries() == 0.){ //check if the list is empty
291 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
292 test=fHighSDDValue[AliQAv1::kFATAL];
299 while( hdata = dynamic_cast<TH1* >(next()) ){
301 if(hdata->GetEntries()==0)test=test+fStepBitSDD[AliQAv1::kFATAL];
304 TString hname=hdata->GetName();
305 if(hname.Contains("FSE"))continue;
306 else if(hname.Contains("SDDLay3TotCh")||hname.Contains("SDDLay4TotCh")){
307 Double_t meancharge=hdata->GetMean();
308 Double_t rmscharge=hdata->GetRMS();
309 AliInfo(Form("%s : Mean value:%f RMS value%f \n ",hname.Data(),meancharge,rmscharge));
310 test=test+fStepBitSDD[AliQAv1::kINFO];
311 }//end if name charge
312 else if(hname.Contains("SDDGlobalCoordDistribYX" ))
314 test=test+fStepBitSDD[AliQAv1::kINFO];
316 else if(hname.Contains("SDDGlobalCoordDistribRZ"))
319 test=test+fStepBitSDD[AliQAv1::kINFO];
321 else if(hname.Contains("SDDGlobalCoordDistribL3PHIZ" )||hname.Contains("SDDGlobalCoordDistribL3PHIZ"))
325 else if(hname.Contains("SDDModPatternRP"))
331 else if(hname.Contains("SDDModPatternL3RP")||hname.Contains("SDDModPatternL4RP") )
335 else if(hname.Contains("SDDLocalCoordDistrib"))
337 test=test+fStepBitSDD[AliQAv1::kINFO];
339 else if(hname.Contains("SDDrdistrib_Layer3")||hname.Contains("SDDrdistrib_Layer4"))
342 }//end r distribution
343 else if(hname.Contains("SDDphidistrib_Layer3")||hname.Contains("SDDphidistrib_Layer4"))
346 }//end phi distribution
347 else if(hname.Contains("SDDdrifttime_Layer3")||hname.Contains("SDDdrifttime_Layer4"))
355 }//end else geentries
361 AliInfo(Form("===================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
365 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
368 case AliQAv1::kNTASK:
369 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
373 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
374 Int_t uid=list->GetUniqueID();
378 if (list->GetEntries() == 0.){ //check if the list is empty
379 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
380 test=fHighSDDValue[AliQAv1::kFATAL];
387 while( (hdata = dynamic_cast<TH1* >(next())) ){
389 if(hdata->GetEntries()==0)test=test+fStepBitSDD[AliQAv1::kFATAL];
392 TString hname=hdata->GetName();
393 if(hname.Contains("SDDDIGITSModulePattern"))
397 test=test+fStepBitSDD[AliQAv1::kINFO];
399 else if(hname.Contains("SDDAnodeDistribution"))
402 test=test+fStepBitSDD[AliQAv1::kINFO];
403 }//end anode distribution
404 else if(hname.Contains("SDDTbinDistribution"))
408 test=test+fStepBitSDD[AliQAv1::kINFO];
409 }//end timebindistribution
410 else if(hname.Contains("SDDADCCountsDistribution"))
412 test=test+fStepBitSDD[AliQAv1::kINFO];
423 if (list->GetEntries() == 0.){ //check if the list is empty
424 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
425 test=fHighSDDValue[AliQAv1::kFATAL];
432 while( (hdata = dynamic_cast<TH1* >(next())) ){
434 if(hdata->GetEntries()==0)test=test+fStepBitSDD[AliQAv1::kFATAL];
437 TString hname=hdata->GetName();
438 if(hname.Contains("SDDHITSModulePattern"))
441 test=test+fStepBitSDD[AliQAv1::kINFO];
443 else if(hname.Contains("SDDHITlenghtalonglocalYCoord"))
445 test=test+fStepBitSDD[AliQAv1::kINFO];
447 else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom"))
449 test=test+fStepBitSDD[AliQAv1::kINFO];
451 else if(hname.Contains("SDDDepositedEnergyDistribution"))
453 test=test+fStepBitSDD[AliQAv1::kINFO];
454 }//end deposited energy
464 if (list->GetEntries() == 0.){ //check if the list is empty
465 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
466 test=fHighSDDValue[AliQAv1::kFATAL];
473 while( (hdata = dynamic_cast<TH1* >(next())) ){
475 if(hdata->GetEntries()==0)test=test+fStepBitSDD[AliQAv1::kFATAL];
478 TString hname=hdata->GetName();
479 if(hname.Contains("SDDSDIGITSModulePattern"))
482 test=test+fStepBitSDD[AliQAv1::kINFO];
484 else if(hname.Contains("SDDAnodeDistribution"))
486 test=test+fStepBitSDD[AliQAv1::kINFO];
487 }//end anode bindistribution
488 else if(hname.Contains("SDDTbinDistribution"))
491 test=test+fStepBitSDD[AliQAv1::kINFO];
492 }//end timebindistribution
493 else if(hname.Contains("SDDADCCountsDistribution"))
495 test=test+fStepBitSDD[AliQAv1::kINFO];
496 }//end adc counts bindistribution
513 //__________________________________________________________________
514 void AliITSQASDDChecker::SetTaskOffset(Int_t taskoffset)
516 fSubDetOffset = taskoffset;
520 //__________________________________________________________________
521 void AliITSQASDDChecker::SetStepBit(Double_t *steprange)
524 fStepBitSDD = new Double_t[AliQAv1::kNBIT];
525 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
527 fStepBitSDD[bit]=steprange[bit];
531 //__________________________________________________________________
532 void AliITSQASDDChecker::SetSDDLimits(Float_t *lowvalue, Float_t * highvalue)
535 fLowSDDValue = new Float_t[AliQAv1::kNBIT];
536 fHighSDDValue= new Float_t[AliQAv1::kNBIT];
538 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
540 fLowSDDValue[bit]=lowvalue[bit];
541 fHighSDDValue[bit]= highvalue[bit];