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 ");
113 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
114 // if(fRawModulePattern) { delete fRawModulePattern; fRawModulePattern = 0; }
115 // if(fRawL3Pattern) { delete fRawL3Pattern; fRawL3Pattern = 0; }
116 // if(fRawL4Pattern) { delete fRawL4Pattern; fRawL4Pattern = 0; }
117 if (list->GetEntries() == 0){SDDQACheckerValue += fHighSDDValue[AliQAv1::kFATAL]; break;}
120 Int_t emptymodules[2], filledmodules[2],emptyladders[2],filledladders[2];
121 for(Int_t i=0;i<2;i++){emptymodules[i]=0; filledmodules[i]=0; emptyladders[i]=0; filledladders[i]=0; }
122 for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
123 while( (hdata = dynamic_cast<TH1* >(next())) ){
124 if (hdata){TString hname=hdata->GetName();
125 if(hname.Contains("SDDchargeMap"))continue;
126 if(hname.Contains("SDDModPattern")){
127 if(hname.Contains("NORM")) continue;
128 hmodule=(TH1*)hdata->Clone();
129 entries= hdata->GetEntries();
130 if(AliITSQADataMakerRec::AreEqual(entries,0.)){AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//endif entries
131 else{int modmax=hdata->GetNbinsX();
135 for(Int_t i=1;i<=modmax;i++){content=hdata->GetBinContent(i);if(AliITSQADataMakerRec::AreEqual(content,0.)) empty++; else filled++; }//end for
136 AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));}//end else pattern entries !=0
138 if(hname.Contains("_RelativeOccupancy")) {
139 //fRawModulePattern = (TH1F *) hdata;
140 Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS();
141 if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
142 if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
143 Int_t aboveThreshold = 0;
144 for(Int_t k=0; k<= hdata->GetNbinsX(); k++) {if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (int)(hdata->GetBinContent(k));}
145 Float_t fractionAboveThreshold = ((Float_t) aboveThreshold)/hdata->GetEntries();
146 if(hname.Contains("L3")) AliInfo(Form("SDD check number 1, L3: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
147 if(hname.Contains("L4")) AliInfo(Form("SDD check number 2, L4: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
148 if(fractionAboveThreshold > fThresholdForRelativeOccupancy) {SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
149 if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: Set Warning (L3 Raw)"));
150 if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: Set Warning (L4 Raw)")); } }
151 if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){if(hname.Contains("NORM"))continue;
152 //if(hname.Contains("L3")) {fRawL3Pattern = (TH2F *) hdata;}
153 //if(hname.Contains("L4")) {fRawL4Pattern = (TH2F *) hdata;}
155 if(hname.Contains("3"))layer=0;
156 else if(hname.Contains("4"))layer=1;
157 entries2[layer]=hdata->GetEntries();
158 if(entries2[layer]==0){AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
159 SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//end if getentries
162 if(hname.Contains("3"))layer1=0;
163 else if(hname.Contains("4"))layer1=1;
164 TH2* htemp=dynamic_cast<TH2*>(hdata);
165 hlayer[layer1]=(TH2*)htemp->Clone();
167 sprintf(newname,"%s_copy",hname.Data());
168 hlayer[layer1]->SetName(newname);
169 hlayer[layer1]->RebinX(2);
170 int modmay=hlayer[layer1]->GetNbinsY();
171 TH1D* hproj= hlayer[layer1]->ProjectionY();
172 Double_t ladcontent=0;
173 for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
174 ladcontent=hproj->GetBinContent(i);
175 if(AliITSQADataMakerRec::AreEqual(ladcontent,0.)) emptyladders[layer1]++;
176 else filledladders[layer1]++;}//end for
177 AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer], filledladders[layer]));//end else layer 3
179 hproj=NULL;}//end else entries !=0
183 if(AliITSQADataMakerRec::AreEqual(entries,0.)&&AliITSQADataMakerRec::AreEqual(entries2[0],0.)&&AliITSQADataMakerRec::AreEqual(entries2[1],0.)) break;
185 if(hmodule || (hlayer[0] && hlayer[1])){
188 Int_t exactive=0;//excluded but taking data
189 for(Int_t imod=0;imod<fgknSDDmodules;imod++){
194 module=imod+fgkmodoffset;
195 AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
196 if(cal==0) { delete cal; continue;}
197 AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
201 Double_t contentlayer[2];
202 for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
203 if(hmodule)content=hmodule->GetBinContent(imod+1);//if expert bit is active the histogram has been created
204 if(hlayer[lay-3]) contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
205 if(AliITSQADataMakerRec::AreEqual(content,0.)== kFALSE || AliITSQADataMakerRec::AreEqual(contentlayer[lay-3],0.)==kFALSE) {
206 filledmodules[lay-3]++;
207 AliWarning(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",module,lay,lad,det));
209 } else if(AliITSQADataMakerRec::AreEqual(content,0.) && AliITSQADataMakerRec::AreEqual(contentlayer[lay-3],0.))
210 emptymodules[lay-3]++;
212 Double_t contentgood=0.;
214 if(hlayer[lay-3]) contentgood=hlayer[lay-3]->GetBinContent(det,lad);
215 if(AliITSQADataMakerRec::AreEqual(contentgood,0.))
216 emptymodules[lay-3]++;
218 filledmodules[lay-3]++;
221 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
223 AliInfo(Form("All the active modules (%i) are in acquisition. The number of excluded modules are %i \n",active,excluded));
224 SDDQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
227 AliWarning(Form("%i modules excluded from the acquisition took data. Active modules%i \n ",exactive,active));
228 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
230 if(excluded==exactive){
231 AliWarning(Form("All the modules excluded from the acquisition (%d) took data! Active modules %i\n",excluded,active));
232 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
235 AliWarning(Form("No modules took data: excluded %i \t exactive %i \n", excluded, exactive));
236 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
242 for(Int_t i=0;i<2;i++) {
251 case AliQAv1::kNULLTASK:{
252 AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index)));
253 SDDQACheckerValue=1.;
260 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
262 if (list->GetEntries() == 0){ //check if the list is empty
263 //printf("SDDQACheckerValue = %f \t value %f\n",SDDQACheckerValue,fHighSDDValue[AliQAv1::kFATAL]);
264 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
268 while((hdata=dynamic_cast<TH1* >(next()))){
270 TString hname=hdata->GetName();
271 if(hname.Contains("_RelativeOccupancy")) {
272 Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS();
273 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
274 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
275 Int_t aboveThreshold = 0;
276 for(Int_t k=0; k<= ((Int_t)hdata->GetNbinsX()); k++) {
277 if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (Int_t)(hdata->GetBinContent(k));
279 Float_t fractionAboveThreshold = ((Float_t) aboveThreshold)/hdata->GetEntries();
280 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3, L3: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
281 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4, L4: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
282 if(fractionAboveThreshold > fThresholdForRelativeOccupancy) {
283 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
284 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: Set Warning (L3 RecPoints)"));
285 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: Set Warning (L4 RecPoints)"));
288 if(hname.Contains("Rec2Raw") && !hname.Contains("2D")) {
289 //Float_t threshold = 0.;
290 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: L3 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
291 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: L4 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
292 Int_t belowThreshold = 0;
293 for(Int_t k=0; k<=((TH1F *)hdata)->GetNbinsX(); k++) {
294 if(((TH1F *) hdata)->GetBinLowEdge(k) < fThresholdForRecToRawRatio) belowThreshold += ((Int_t)((TH1F *) hdata)->GetBinContent(k));
296 Double_t fractionBelowThreshold =0.;
297 Double_t entries3=((TH1F *)hdata)->GetEntries();
298 if(entries3>0.001)fractionBelowThreshold = ((Double_t)(belowThreshold))/entries3;
299 else{ AliWarning(Form("No entries on %s. The check will retuns zero.\n",hdata->GetName() )); }
300 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5, L3: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
301 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6, L4: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
302 if(fractionBelowThreshold > fThresholdForRelativeOccupancy) {
303 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
304 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: Set Warning (L3 RecPoints2Raws)"));
305 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: Set Warning (L4 RecPoints2Raws)"));
308 if(hname.Contains("dedx")) {
309 if(hname.Contains("L3")) AliInfo(Form("SDD check number 7: L3 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
310 if(hname.Contains("L4")) AliInfo(Form("SDD check number 8: L4 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
315 SDDQACheckerValue=1.;
320 AliInfo(Form("===================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
321 SDDQACheckerValue=1.;
326 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
327 SDDQACheckerValue=1.;
330 case AliQAv1::kNTASK:{
331 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
332 SDDQACheckerValue=1.;
336 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
337 Int_t uid=list->GetUniqueID();
340 if (list->GetEntries() == 0){
341 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
345 while( (hdata = dynamic_cast<TH1* >(next())) ){
347 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
349 TString hname=hdata->GetName();
350 if(hname.Contains("SDDDIGITSModulePattern")) {
353 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
354 } else if(hname.Contains("SDDAnodeDistribution")) {
355 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
356 } else if(hname.Contains("SDDTbinDistribution")) {
358 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
359 } else if(hname.Contains("SDDADCCountsDistribution")) {
360 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
370 if (list->GetEntries() == 0){
371 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
376 while( (hdata = dynamic_cast<TH1* >(next())) ){
378 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
380 TString hname=hdata->GetName();
381 if(hname.Contains("SDDHITSModulePattern")) {
383 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
384 } else if(hname.Contains("SDDHITlenghtalonglocalYCoord")) {
385 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
386 } else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom")) {
387 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
388 } else if(hname.Contains("SDDDepositedEnergyDistribution")) {
389 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
390 }//end deposited energy
399 if (list->GetEntries() == 0){
400 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
404 while( (hdata = dynamic_cast<TH1* >(next())) ){
406 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
408 TString hname=hdata->GetName();
409 if(hname.Contains("SDDSDIGITSModulePattern")) {
411 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
412 } else if(hname.Contains("SDDAnodeDistribution")) {
413 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
414 } else if(hname.Contains("SDDTbinDistribution")) {
416 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
417 } else if(hname.Contains("SDDADCCountsDistribution")) {
418 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
419 }//end adc counts bindistribution
425 SDDQACheckerValue=1.;
435 return SDDQACheckerValue;
438 //__________________________________________________________________
439 void AliITSQASDDChecker::SetTaskOffset(Int_t taskoffset)
441 //set the number of the histograms already present in the list before the SDD histograms
442 fSubDetOffset = taskoffset;
446 //__________________________________________________________________
447 void AliITSQASDDChecker::SetStepBit(const Double_t *steprange)
449 //set the values of the step bit for each QA bit range calculated in the AliITSQAChecker class
450 fStepBitSDD = new Double_t[AliQAv1::kNBIT];
451 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
453 fStepBitSDD[bit]=steprange[bit];
457 //__________________________________________________________________
458 void AliITSQASDDChecker::SetSDDLimits(const Float_t *lowvalue, const Float_t * highvalue)
460 //set the low and high values in for each QA bit range calculated in the AliITSQAChecker class
461 fLowSDDValue = new Float_t[AliQAv1::kNBIT];
462 fHighSDDValue= new Float_t[AliQAv1::kNBIT];
464 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
466 fLowSDDValue[bit]=lowvalue[bit];
467 fHighSDDValue[bit]= highvalue[bit];