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 "AliITSCalibrationSDD.h"
35 #include "AliITSgeomTGeo.h"
38 ClassImp(AliITSQASDDChecker)
39 //__________________________________________________________________
40 AliITSQASDDChecker& AliITSQASDDChecker::operator = (const AliITSQASDDChecker& qac )
43 this->~AliITSQASDDChecker();
44 new(this) AliITSQASDDChecker(qac);
48 AliITSQASDDChecker::~AliITSQASDDChecker()
54 delete[] fStepBitSDD ;
64 delete[]fHighSDDValue;
74 //__________________________________________________________________
75 Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * list, const AliDetectorRecoParam * /*recoparam*/)
77 //check histograms of the different lists
78 AliInfo(Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset) );
80 AliDebug(1,Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset));
82 Double_t SDDQACheckerValue = 0.;
86 for(Int_t i=0;i<2;i++)entries2[i]=0.;
89 AliCDBEntry *calibSDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
90 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
93 AliError("Calibration object retrieval failed! SDD will not be processed");
95 SDDQACheckerValue= fHighSDDValue[AliQAv1::kWARNING];
97 fCalibration = (TObjArray *)calibSDD->GetObject();
99 if(!cacheStatus)calibSDD->SetObject(NULL);
100 calibSDD->SetOwner(kTRUE);
107 AliInfo("Calib SDD Created\n ");
117 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
118 if(fRawModulePattern) { delete fRawModulePattern; fRawModulePattern = 0; }
119 if(fRawL3Pattern) { delete fRawL3Pattern; fRawL3Pattern = 0; }
120 if(fRawL4Pattern) { delete fRawL4Pattern; fRawL4Pattern = 0; }
121 if (list->GetEntries() == 0){
122 SDDQACheckerValue += fHighSDDValue[AliQAv1::kFATAL];
125 Int_t emptymodules[2];
126 Int_t filledmodules[2];
127 Int_t emptyladders[2];
128 Int_t filledladders[2];
129 for(Int_t i=0;i<2;i++){
135 for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
136 while( (hdata = dynamic_cast<TH1* >(next())) ){
138 TString hname=hdata->GetName();
139 if(hname.Contains("SDDchargeMap"))continue;
140 if(hname.Contains("SDDModPattern")){
141 if(hname.Contains("NORM")) {
144 entries= hdata->GetEntries();
145 if(AliITSQADataMakerRec::AreEqual(entries,0.)){
146 AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
147 SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
150 int modmax=hdata->GetNbinsX();
154 for(Int_t i=1;i<=modmax;i++){
155 content=hdata->GetBinContent(i);
156 if(AliITSQADataMakerRec::AreEqual(content,0.)) empty++;
159 AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));
160 }//end else pattern entries !=0
164 if(hname.Contains("_RelativeOccupancy")) {
165 fRawModulePattern = (TH1F *) hdata;
166 Float_t threshold = fRawModulePattern->GetMean() + 4*fRawModulePattern->GetRMS();
167 if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: L3 mean: %f, rms: ,%f",fRawModulePattern->GetMean(),fRawModulePattern->GetRMS()));
168 if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: L4 mean: %f, rms: ,%f",fRawModulePattern->GetMean(),fRawModulePattern->GetRMS()));
169 Int_t aboveThreshold = 0;
170 for(Int_t k=0; k<= fRawModulePattern->GetNbinsX(); k++) {
171 if(fRawModulePattern->GetBinLowEdge(k) > threshold) aboveThreshold += (int)(fRawModulePattern->GetBinContent(k));
173 Float_t fractionAboveThreshold = ((Float_t) aboveThreshold)/fRawModulePattern->GetEntries();
174 if(hname.Contains("L3")) AliInfo(Form("SDD check number 1, L3: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
175 if(hname.Contains("L4")) AliInfo(Form("SDD check number 2, L4: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
176 if(fractionAboveThreshold > fThresholdForRelativeOccupancy) {
177 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
178 if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: Set Warning (L3 Raw)"));
179 if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: Set Warning (L4 Raw)"));
183 if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){
184 if(!hname.Contains("NORM")) {
185 if(hname.Contains("L3")) {
186 fRawL3Pattern = (TH2F *) hdata;
188 if(hname.Contains("L4")) {
189 fRawL4Pattern = (TH2F *) hdata;
193 if(hname.Contains("3"))layer=0;
194 else if(hname.Contains("4"))layer=1;
195 entries2[layer]=hdata->GetEntries();
196 if(entries2[layer]==0){
197 AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
198 SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
199 if(AliITSQADataMakerRec::AreEqual(entries,0.)){
204 if(hname.Contains("3"))layer1=0;
205 else if(hname.Contains("4"))layer1=1;
206 TH2* htemp=dynamic_cast<TH2*>(hdata);
207 hlayer[layer1]=(TH2*)htemp->Clone();
209 sprintf(newname,"%s_copy",hname.Data());
210 hlayer[layer1]->SetName(newname);
211 hlayer[layer1]->RebinX(2);
212 int modmay=hlayer[layer1]->GetNbinsY();
213 TH1D* hproj= hlayer[layer1]->ProjectionY();
214 Double_t ladcontent=0;
215 for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
216 ladcontent=hproj->GetBinContent(i);
217 if(AliITSQADataMakerRec::AreEqual(ladcontent,0.)) emptyladders[layer1]++;
218 else filledladders[layer1]++;
220 AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer], filledladders[layer]));//end else layer 3
223 }//end else entries !=0
228 if(AliITSQADataMakerRec::AreEqual(entries,0.)&&AliITSQADataMakerRec::AreEqual(entries2[0],0.)&&AliITSQADataMakerRec::AreEqual(entries2[1],0.)) break;
230 if(hmodule || (hlayer[0] && hlayer[1])){
233 Int_t exactive=0;//excluded but taking data
234 for(Int_t imod=0;imod<fgknSDDmodules;imod++){
239 module=imod+fgkmodoffset;
240 AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
241 if(cal==0) { delete cal; continue;}
242 AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
246 Double_t contentlayer[2];
247 for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
248 if(hmodule)content=hmodule->GetBinContent(imod+1);//if expert bit is active the histogram has been created
249 contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
250 if(AliITSQADataMakerRec::AreEqual(content,0.)== kFALSE || AliITSQADataMakerRec::AreEqual(contentlayer[lay-3],0.)==kFALSE) {
251 filledmodules[lay-3]++;
252 AliWarning(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",module,lay,lad,det));
254 } else if(AliITSQADataMakerRec::AreEqual(content,0.) && AliITSQADataMakerRec::AreEqual(contentlayer[lay-3],0.))
255 emptymodules[lay-3]++;
257 Double_t contentgood=0.;
259 contentgood=hlayer[lay-3]->GetBinContent(det,lad);
260 if(AliITSQADataMakerRec::AreEqual(contentgood,0.))
261 emptymodules[lay-3]++;
263 filledmodules[lay-3]++;
266 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
268 AliInfo(Form("All the active modules (%i) are in acquisition. The number of excluded modules are %i \n",active,excluded));
269 SDDQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
272 AliWarning(Form("%i modules excluded from the acquisition took data. Active modules%i \n ",exactive,active));
273 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
275 if(excluded==exactive){
276 AliWarning(Form("All the modules excluded from the acquisition (%d) took data! Active modules %i\n",excluded,active));
277 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
280 AliWarning(Form("No modules took data: excluded %i \t exactive %i \n", excluded, exactive));
281 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
283 for(Int_t i=0;i<2;i++) {
292 case AliQAv1::kNULLTASK:
293 AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index)));
294 SDDQACheckerValue=1.;
298 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
299 if(fRecModulePattern) { delete fRecModulePattern; fRecModulePattern = 0; }
300 if(fRecL3Pattern) { delete fRecL3Pattern; fRecL3Pattern = 0; }
301 if(fRecL4Pattern) { delete fRecL4Pattern; fRecL4Pattern = 0; }
302 if(fModulePatternRatio) { delete fModulePatternRatio; fModulePatternRatio = 0; }
303 if (list->GetEntries() == 0){ //check if the list is empty
304 //printf("SDDQACheckerValue = %f \t value %f\n",SDDQACheckerValue,fHighSDDValue[AliQAv1::kFATAL]);
305 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
309 while((hdata=dynamic_cast<TH1* >(next()))){
311 TString hname=hdata->GetName();
312 if(hname.Contains("_RelativeOccupancy")) {
313 fRecModulePattern = (TH1F *) hdata;
314 Float_t threshold = fRecModulePattern->GetMean() + 4*fRecModulePattern->GetRMS();
315 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: L3 mean: %f, rms: ,%f",fRecModulePattern->GetMean(),fRecModulePattern->GetRMS()));
316 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: L4 mean: %f, rms: ,%f",fRecModulePattern->GetMean(),fRecModulePattern->GetRMS()));
317 Int_t aboveThreshold = 0;
318 for(Int_t k=0; k<= ((Int_t)fRecModulePattern->GetNbinsX()); k++) {
319 if(fRecModulePattern->GetBinLowEdge(k) > threshold) aboveThreshold += (Int_t)(fRecModulePattern->GetBinContent(k));
321 Float_t fractionAboveThreshold = ((Float_t) aboveThreshold)/fRecModulePattern->GetEntries();
322 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3, L3: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
323 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4, L4: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
324 if(fractionAboveThreshold > fThresholdForRelativeOccupancy) {
325 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
326 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: Set Warning (L3 RecPoints)"));
327 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: Set Warning (L4 RecPoints)"));
330 if(hname.Contains("Rec2Raw") && !hname.Contains("2D")) {
331 //Float_t threshold = 0.;
332 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: L3 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
333 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: L4 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
334 Int_t belowThreshold = 0;
335 for(Int_t k=0; k<=((TH1F *)hdata)->GetNbinsX(); k++) {
336 if(((TH1F *) hdata)->GetBinLowEdge(k) < fThresholdForRecToRawRatio) belowThreshold += ((Int_t)((TH1F *) hdata)->GetBinContent(k));
338 Double_t fractionBelowThreshold =0.;
339 Double_t entries=((TH1F *)hdata)->GetEntries();
340 if(entries!=0.)fractionBelowThreshold = ((Double_t)(belowThreshold))/entries;
341 else{ AliWarning(Form("No entries on %s. The check will retuns zero.\n",hdata->GetName() )); }
342 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5, L3: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
343 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6, L4: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
344 if(fractionBelowThreshold > fThresholdForRelativeOccupancy) {
345 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
346 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: Set Warning (L3 RecPoints2Raws)"));
347 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: Set Warning (L4 RecPoints2Raws)"));
350 if(hname.Contains("dedx")) {
351 if(hname.Contains("L3")) AliInfo(Form("SDD check number 7: L3 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
352 if(hname.Contains("L4")) AliInfo(Form("SDD check number 8: L4 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
357 SDDQACheckerValue=1.;
360 AliInfo(Form("===================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
361 SDDQACheckerValue=1.;
364 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
365 SDDQACheckerValue=1.;
367 case AliQAv1::kNTASK:
368 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
369 SDDQACheckerValue=1.;
372 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
373 Int_t uid=list->GetUniqueID();
376 if (list->GetEntries() == 0){
377 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
381 while( (hdata = dynamic_cast<TH1* >(next())) ){
383 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
385 TString hname=hdata->GetName();
386 if(hname.Contains("SDDDIGITSModulePattern")) {
389 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
390 } else if(hname.Contains("SDDAnodeDistribution")) {
391 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
392 } else if(hname.Contains("SDDTbinDistribution")) {
394 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
395 } else if(hname.Contains("SDDADCCountsDistribution")) {
396 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
406 if (list->GetEntries() == 0){
407 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
411 while( (hdata = dynamic_cast<TH1* >(next())) ){
413 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
415 TString hname=hdata->GetName();
416 if(hname.Contains("SDDHITSModulePattern")) {
418 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
419 } else if(hname.Contains("SDDHITlenghtalonglocalYCoord")) {
420 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
421 } else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom")) {
422 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
423 } else if(hname.Contains("SDDDepositedEnergyDistribution")) {
424 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
425 }//end deposited energy
434 if (list->GetEntries() == 0){
435 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
438 while( (hdata = dynamic_cast<TH1* >(next())) ){
440 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
442 TString hname=hdata->GetName();
443 if(hname.Contains("SDDSDIGITSModulePattern")) {
445 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
446 } else if(hname.Contains("SDDAnodeDistribution")) {
447 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
448 } else if(hname.Contains("SDDTbinDistribution")) {
450 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
451 } else if(hname.Contains("SDDADCCountsDistribution")) {
452 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
453 }//end adc counts bindistribution
459 SDDQACheckerValue=1.;
466 return SDDQACheckerValue;
469 //__________________________________________________________________
470 void AliITSQASDDChecker::SetTaskOffset(Int_t taskoffset)
472 //set the number of the histograms already present in the list before the SDD histograms
473 fSubDetOffset = taskoffset;
477 //__________________________________________________________________
478 void AliITSQASDDChecker::SetStepBit(const Double_t *steprange)
480 //set the values of the step bit for each QA bit range calculated in the AliITSQAChecker class
481 fStepBitSDD = new Double_t[AliQAv1::kNBIT];
482 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
484 fStepBitSDD[bit]=steprange[bit];
488 //__________________________________________________________________
489 void AliITSQASDDChecker::SetSDDLimits(const Float_t *lowvalue, const Float_t * highvalue)
491 //set the low and high values in for each QA bit range calculated in the AliITSQAChecker class
492 fLowSDDValue = new Float_t[AliQAv1::kNBIT];
493 fHighSDDValue= new Float_t[AliQAv1::kNBIT];
495 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
497 fLowSDDValue[bit]=lowvalue[bit];
498 fHighSDDValue[bit]= highvalue[bit];