1 /**************************************************************************
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // *****************************************
19 // Checks the quality assurance
20 // by comparing with reference data
21 // P. Cerello Apr 2008
24 // --- ROOT system ---
28 // --- AliRoot header files ---
29 #include "AliITSQADataMakerRec.h"
30 #include "AliITSQASDDChecker.h"
32 #include "AliCDBEntry.h"
33 #include "AliCDBManager.h"
34 //#include "AliQAManager.h"
35 //#include "AliQACheckerBase.h"
36 //#include "TSystem.h"
37 #include "AliITSCalibrationSDD.h"
38 #include "AliITSgeomTGeo.h"
39 //#include "AliITSQAChecker.h"
42 ClassImp(AliITSQASDDChecker)
43 //__________________________________________________________________
44 AliITSQASDDChecker& AliITSQASDDChecker::operator = (const AliITSQASDDChecker& qac )
47 this->~AliITSQASDDChecker();
48 new(this) AliITSQASDDChecker(qac);
52 AliITSQASDDChecker::~AliITSQASDDChecker()
58 delete[] fStepBitSDD ;
68 delete[]fHighSDDValue;
78 //__________________________________________________________________
79 Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * list, const AliDetectorRecoParam * /*recoparam*/)
81 //check histograms of the different lists
82 AliInfo(Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset) );
84 AliDebug(1,Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset));
90 for(Int_t i=0;i<2;i++)entries2[i]=0.;
93 AliCDBEntry *calibSDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
94 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
97 AliError("Calibration object retrieval failed! SDD will not be processed");
99 test= fHighSDDValue[AliQAv1::kWARNING];
101 fCalibration = (TObjArray *)calibSDD->GetObject();
103 if(!cacheStatus)calibSDD->SetObject(NULL);
104 calibSDD->SetOwner(kTRUE);
111 AliInfo("Calib SDD Created\n ");
117 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
119 if (list->GetEntries() == 0){ //check if the list is empty
120 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
121 test=test+fHighSDDValue[AliQAv1::kFATAL];
127 for(offset =0;offset < fSubDetOffset; offset++){hdata = dynamic_cast<TH1*>(next());}//end for
128 Int_t emptymodules[2];
129 Int_t filledmodules[2];
130 Int_t emptyladders[2];
131 Int_t filledladders[2];
132 for(Int_t i=0;i<2;i++){
140 for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
141 while( (hdata = dynamic_cast<TH1* >(next())) ){
143 TString hname=hdata->GetName();
144 if(hname.Contains("SDDchargeMap"))continue;
145 if(hname.Contains("SDDModPattern")){
146 if(hname.Contains("NORM")) continue;
149 entries= hdata->GetEntries();
150 if(AliITSQADataMakerRec::AreEqual(entries,0.)){
151 AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
152 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
153 test=test+fStepBitSDD[AliQAv1::kFATAL];
156 int modmax=hdata->GetNbinsX();
160 for(Int_t i=1;i<=modmax;i++){
161 content=hdata->GetBinContent(i);
162 if(AliITSQADataMakerRec::AreEqual(content,0.)){empty++;}
163 else if((AliITSQADataMakerRec::AreEqual(content,0.)==kFALSE)){filled++;}
165 AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));
166 }//end else pattern entries !=0
169 else if(hname.Contains("SDDphizL3")||hname.Contains("SDDphizL4")){
170 if(hname.Contains("NORM")) continue;
173 if(hname.Contains("3"))layer=0;
174 else if(hname.Contains("4"))layer=1;
175 entries2[layer]=hdata->GetEntries();
176 if(entries2[layer]==0){
177 AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
178 //printf("test = %f \t value %f\n",test,fStepBitSDD[AliQAv1::kFATAL]);
179 test=test+fStepBitSDD[AliQAv1::kFATAL];
180 if(AliITSQADataMakerRec::AreEqual(entries,0.)){
187 if(hname.Contains("3"))layer1=0;
188 else if(hname.Contains("4"))layer1=1;
189 TH2* htemp=dynamic_cast<TH2*>(hdata);
190 hlayer[layer1]=(TH2*)htemp->Clone();
192 sprintf(newname,"%s_copy",hname.Data());
193 hlayer[layer1]->SetName(newname);
194 hlayer[layer1]->RebinX(2);
195 int modmay=hlayer[layer1]->GetNbinsY();
196 TH1D* hproj= hlayer[layer1]->ProjectionY();
197 Double_t ladcontent=0;
198 for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
199 ladcontent=hproj->GetBinContent(i);
200 if(AliITSQADataMakerRec::AreEqual(ladcontent,0.)){emptyladders[layer1]++;}
201 else {filledladders[layer1]++;}
203 AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer], filledladders[layer]));//end else layer 3
208 }//end else entries !=0
213 if(AliITSQADataMakerRec::AreEqual(entries,0.)&&AliITSQADataMakerRec::AreEqual(entries2[0],0.)&&AliITSQADataMakerRec::AreEqual(entries2[1],0.)) break;
215 if(hmodule||(hlayer[0]&&hlayer[1])){
218 Int_t exactive=0;//excluded but taking data
219 //AliITSCalibrationSDD *cal;
220 for(Int_t imod=0;imod<fgknSDDmodules;imod++){
225 module=imod+fgkmodoffset;
226 AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
227 if(cal==0) { delete cal; continue;}
228 AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
232 Double_t contentlayer[2];
233 for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
234 if(hmodule)content=hmodule->GetBinContent(imod+1);//if expert bit is active the histogram has been created
235 contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
236 if(AliITSQADataMakerRec::AreEqual(content,0.)==kFALSE||AliITSQADataMakerRec::AreEqual(contentlayer[lay-3],0.)==kFALSE)
238 filledmodules[lay-3]++;
239 AliWarning(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",module,lay,lad,det));
242 else if(AliITSQADataMakerRec::AreEqual(content,0.)&&AliITSQADataMakerRec::AreEqual(contentlayer[lay-3],0.))emptymodules[lay-3]++;
243 //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) );
247 Double_t contentgood=0.;
249 //printf("lay: %i\t det %i \t lad %i \n",lay,det,lad );
250 contentgood=hlayer[lay-3]->GetBinContent(det,lad);
251 if(AliITSQADataMakerRec::AreEqual(contentgood,0.)){emptymodules[lay-3]++;}
252 else {filledmodules[lay-3]++;}
258 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
260 AliInfo(Form("All the active modules (%i) are in acquisition. The number of excluded modules are %i \n",active,excluded));
261 test=fHighSDDValue[AliQAv1::kINFO];}
263 AliWarning(Form("%i modules excluded from the acquisition took data. Active modules%i \n ",exactive,active));
264 test=fHighSDDValue[AliQAv1::kWARNING];
266 if(excluded==exactive){
267 AliWarning(Form("All the modules exluded from the acquisition (%d) took data! Active modules %i\n",excluded,active));
268 test=fHighSDDValue[AliQAv1::kWARNING];
271 AliWarning(Form("No modules took data: excluded %i \t exactive %i \n", excluded, exactive));
272 test=fHighSDDValue[AliQAv1::kFATAL];
274 for(Int_t i=0;i<2;i++)
281 }//end getentries !=0
288 case AliQAv1::kNULLTASK:
289 AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index)));
294 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
296 if(list->GetUniqueID()==40){
297 if (list->GetEntries() == 0){ //check if the list is empty
298 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
299 test=fHighSDDValue[AliQAv1::kFATAL];
306 while( hdata = dynamic_cast<TH1* >(next()) ){
308 if(AliITSQADataMakerRec::AreEqual(hdata->GetEntries(),0.))test=test+fStepBitSDD[AliQAv1::kFATAL];
311 TString hname=hdata->GetName();
312 if(hname.Contains("FSE"))continue;
313 else if(hname.Contains("SDDLay3TotCh")||hname.Contains("SDDLay4TotCh")){
314 Double_t meancharge=hdata->GetMean();
315 Double_t rmscharge=hdata->GetRMS();
316 AliInfo(Form("%s : Mean value:%f RMS value%f \n ",hname.Data(),meancharge,rmscharge));
317 test=test+fStepBitSDD[AliQAv1::kINFO];
318 }//end if name charge
319 else if(hname.Contains("SDDGlobalCoordDistribYX" ))
321 test=test+fStepBitSDD[AliQAv1::kINFO];
323 else if(hname.Contains("SDDGlobalCoordDistribRZ"))
326 test=test+fStepBitSDD[AliQAv1::kINFO];
328 else if(hname.Contains("SDDGlobalCoordDistribL3PHIZ" )||hname.Contains("SDDGlobalCoordDistribL3PHIZ"))
332 else if(hname.Contains("SDDModPatternRP"))
338 else if(hname.Contains("SDDModPatternL3RP")||hname.Contains("SDDModPatternL4RP") )
342 else if(hname.Contains("SDDLocalCoordDistrib"))
344 test=test+fStepBitSDD[AliQAv1::kINFO];
346 else if(hname.Contains("SDDrdistrib_Layer3")||hname.Contains("SDDrdistrib_Layer4"))
349 }//end r distribution
350 else if(hname.Contains("SDDphidistrib_Layer3")||hname.Contains("SDDphidistrib_Layer4"))
353 }//end phi distribution
354 else if(hname.Contains("SDDdrifttime_Layer3")||hname.Contains("SDDdrifttime_Layer4"))
362 }//end else geentries
368 AliInfo(Form("===================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
372 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
375 case AliQAv1::kNTASK:
376 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
380 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
381 Int_t uid=list->GetUniqueID();
385 if (list->GetEntries() == 0){ //check if the list is empty
386 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
387 test=fHighSDDValue[AliQAv1::kFATAL];
394 while( (hdata = dynamic_cast<TH1* >(next())) ){
396 if(hdata->GetEntries()==0)test=test+fStepBitSDD[AliQAv1::kFATAL];
399 TString hname=hdata->GetName();
400 if(hname.Contains("SDDDIGITSModulePattern"))
404 test=test+fStepBitSDD[AliQAv1::kINFO];
406 else if(hname.Contains("SDDAnodeDistribution"))
409 test=test+fStepBitSDD[AliQAv1::kINFO];
410 }//end anode distribution
411 else if(hname.Contains("SDDTbinDistribution"))
415 test=test+fStepBitSDD[AliQAv1::kINFO];
416 }//end timebindistribution
417 else if(hname.Contains("SDDADCCountsDistribution"))
419 test=test+fStepBitSDD[AliQAv1::kINFO];
430 if (list->GetEntries() == 0){ //check if the list is empty
431 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
432 test=fHighSDDValue[AliQAv1::kFATAL];
439 while( (hdata = dynamic_cast<TH1* >(next())) ){
441 if(hdata->GetEntries()==0)test=test+fStepBitSDD[AliQAv1::kFATAL];
444 TString hname=hdata->GetName();
445 if(hname.Contains("SDDHITSModulePattern"))
448 test=test+fStepBitSDD[AliQAv1::kINFO];
450 else if(hname.Contains("SDDHITlenghtalonglocalYCoord"))
452 test=test+fStepBitSDD[AliQAv1::kINFO];
454 else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom"))
456 test=test+fStepBitSDD[AliQAv1::kINFO];
458 else if(hname.Contains("SDDDepositedEnergyDistribution"))
460 test=test+fStepBitSDD[AliQAv1::kINFO];
461 }//end deposited energy
471 if (list->GetEntries() == 0){ //check if the list is empty
472 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
473 test=fHighSDDValue[AliQAv1::kFATAL];
480 while( (hdata = dynamic_cast<TH1* >(next())) ){
482 if(hdata->GetEntries()==0)test=test+fStepBitSDD[AliQAv1::kFATAL];
485 TString hname=hdata->GetName();
486 if(hname.Contains("SDDSDIGITSModulePattern"))
489 test=test+fStepBitSDD[AliQAv1::kINFO];
491 else if(hname.Contains("SDDAnodeDistribution"))
493 test=test+fStepBitSDD[AliQAv1::kINFO];
494 }//end anode bindistribution
495 else if(hname.Contains("SDDTbinDistribution"))
498 test=test+fStepBitSDD[AliQAv1::kINFO];
499 }//end timebindistribution
500 else if(hname.Contains("SDDADCCountsDistribution"))
502 test=test+fStepBitSDD[AliQAv1::kINFO];
503 }//end adc counts bindistribution
520 //__________________________________________________________________
521 void AliITSQASDDChecker::SetTaskOffset(Int_t taskoffset)
523 //set the number of the histograms already present in the list before the SDD histograms
524 fSubDetOffset = taskoffset;
528 //__________________________________________________________________
529 void AliITSQASDDChecker::SetStepBit(const Double_t *steprange)
531 //set the values of the step bit for each QA bit range calculated in the AliITSQAChecker class
532 fStepBitSDD = new Double_t[AliQAv1::kNBIT];
533 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
535 fStepBitSDD[bit]=steprange[bit];
539 //__________________________________________________________________
540 void AliITSQASDDChecker::SetSDDLimits(const Float_t *lowvalue, const Float_t * highvalue)
542 //set the low and high values in for each QA bit range calculated in the AliITSQAChecker class
543 fLowSDDValue = new Float_t[AliQAv1::kNBIT];
544 fHighSDDValue= new Float_t[AliQAv1::kNBIT];
546 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
548 fLowSDDValue[bit]=lowvalue[bit];
549 fHighSDDValue[bit]= highvalue[bit];