The volumes that were still coded in the Geant3 framework have been redefined within...
[u/mrichter/AliRoot.git] / ITS / AliITSQASDDChecker.cxx
CommitLineData
5b716935 1/**************************************************************************
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
18// *****************************************
19// Checks the quality assurance
20// by comparing with reference data
21// P. Cerello Apr 2008
22// INFN Torino
23
24// --- ROOT system ---
3647765c 25#include "TH1.h"
80b9610c 26#include <TH1D.h>
27#include <TH2.h>
8db5c9f9 28#include "TCanvas.h"
29#include "TPaveText.h"
30#include "TPad.h"
31//#include "TPaletteAxis.h"
5b716935 32// --- AliRoot header files ---
f09c0b42 33#include "AliITSQADataMakerRec.h"
5b716935 34#include "AliITSQASDDChecker.h"
c71529b0 35#include "AliLog.h"
3647765c 36#include "AliCDBEntry.h"
f09c0b42 37#include "AliCDBManager.h"
80b9610c 38#include "AliITSCalibrationSDD.h"
39#include "AliITSgeomTGeo.h"
8db5c9f9 40#include "AliQAManager.h"
41#include "AliQAv1.h"
42#include "AliQAChecker.h"
43#include "AliQACheckerBase.h"
f09c0b42 44
5b716935 45
3647765c 46ClassImp(AliITSQASDDChecker)
5b716935 47//__________________________________________________________________
48AliITSQASDDChecker& AliITSQASDDChecker::operator = (const AliITSQASDDChecker& qac )
49{
50 // Equal operator.
51 this->~AliITSQASDDChecker();
52 new(this) AliITSQASDDChecker(qac);
53 return *this;
54}
55
80b9610c 56AliITSQASDDChecker::~AliITSQASDDChecker()
57{
f09c0b42 58
59 //destructor
80b9610c 60 if(fStepBitSDD)
61 {
62 delete[] fStepBitSDD ;
63 fStepBitSDD = NULL;
64 }
65 if(fLowSDDValue)
66 {
67 delete[]fLowSDDValue;
68 fLowSDDValue=NULL;
69 }
70 if(fHighSDDValue)
71 {
72 delete[]fHighSDDValue;
73 fHighSDDValue=NULL;
74 }
75 if(fCalibration)
76 {
77 delete fCalibration;
78 fCalibration=NULL;
79 }
8db5c9f9 80 if(fImage)
81 {
82 delete []fImage;
83 fImage=NULL;
84 }
80b9610c 85} // dtor
86
5b716935 87//__________________________________________________________________
f09c0b42 88Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * list, const AliDetectorRecoParam * /*recoparam*/)
89{
90 //check histograms of the different lists
80b9610c 91 AliInfo(Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset) );
92
3647765c 93 AliDebug(1,Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset));
3647765c 94
78fb0b3d 95 Double_t SDDQACheckerValue = 0.;
80b9610c 96 TH1 *hdata=NULL;
97 Double_t entries=0.;
98 Double_t entries2[2];
99 for(Int_t i=0;i<2;i++)entries2[i]=0.;
80118b05 100
101 if(!fCalibration){
102 AliCDBEntry *calibSDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
103 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
104 if(!calibSDD)
105 {
106 AliError("Calibration object retrieval failed! SDD will not be processed");
107 fCalibration = NULL;
78fb0b3d 108 SDDQACheckerValue= fHighSDDValue[AliQAv1::kWARNING];
80118b05 109 }
d2f99642 110 else{
111 fCalibration = (TObjArray *)calibSDD->GetObject();
112
113 if(!cacheStatus)calibSDD->SetObject(NULL);
114 calibSDD->SetOwner(kTRUE);
115 if(!cacheStatus)
116 {
117 delete calibSDD;
118 }
119 }//end calibsdd
120 }//end f calibration
80118b05 121
78fb0b3d 122 AliInfo("Calib SDD Created\n ");
80118b05 123
78fb0b3d 124 TIter next(list);
78fb0b3d 125
6bf3d857 126 switch(index) {
127 case AliQAv1::kRAW:{
80b9610c 128 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
6bf3d857 129// if(fRawModulePattern) { delete fRawModulePattern; fRawModulePattern = 0; }
130// if(fRawL3Pattern) { delete fRawL3Pattern; fRawL3Pattern = 0; }
131// if(fRawL4Pattern) { delete fRawL4Pattern; fRawL4Pattern = 0; }
132 if (list->GetEntries() == 0){SDDQACheckerValue += fHighSDDValue[AliQAv1::kFATAL]; break;}
133 TH1 *hmodule=NULL;
134 TH2 *hlayer[2];
d2f99642 135 hdata=NULL;
6bf3d857 136 Int_t emptymodules[2], filledmodules[2],emptyladders[2],filledladders[2];
137 for(Int_t i=0;i<2;i++){emptymodules[i]=0; filledmodules[i]=0; emptyladders[i]=0; filledladders[i]=0; }
138 for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
78fb0b3d 139 while( (hdata = dynamic_cast<TH1* >(next())) ){
6bf3d857 140 if (hdata){TString hname=hdata->GetName();
78fb0b3d 141 if(hname.Contains("SDDchargeMap"))continue;
142 if(hname.Contains("SDDModPattern")){
6bf3d857 143 if(hname.Contains("NORM")) continue;
144 hmodule=(TH1*)hdata->Clone();
145 entries= hdata->GetEntries();
146 if(AliITSQADataMakerRec::AreEqual(entries,0.)){AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//endif entries
147 else{int modmax=hdata->GetNbinsX();
148 Int_t empty=0;
149 Int_t filled=0;
150 Double_t content=0;
151 for(Int_t i=1;i<=modmax;i++){content=hdata->GetBinContent(i);if(AliITSQADataMakerRec::AreEqual(content,0.)) empty++; else filled++; }//end for
152 AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));}//end else pattern entries !=0
153 }
78fb0b3d 154 if(hname.Contains("_RelativeOccupancy")) {
6bf3d857 155 //fRawModulePattern = (TH1F *) hdata;
156 Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS();
157 if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
158 if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
78fb0b3d 159 Int_t aboveThreshold = 0;
6bf3d857 160 for(Int_t k=0; k<= hdata->GetNbinsX(); k++) {if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (int)(hdata->GetBinContent(k));}
161 Float_t fractionAboveThreshold = ((Float_t) aboveThreshold)/hdata->GetEntries();
78fb0b3d 162 if(hname.Contains("L3")) AliInfo(Form("SDD check number 1, L3: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
163 if(hname.Contains("L4")) AliInfo(Form("SDD check number 2, L4: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
6bf3d857 164 if(fractionAboveThreshold > fThresholdForRelativeOccupancy) {SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
78fb0b3d 165 if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: Set Warning (L3 Raw)"));
6bf3d857 166 if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: Set Warning (L4 Raw)")); } }
167 if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){if(hname.Contains("NORM"))continue;
168 //if(hname.Contains("L3")) {fRawL3Pattern = (TH2F *) hdata;}
169 //if(hname.Contains("L4")) {fRawL4Pattern = (TH2F *) hdata;}
170 Int_t layer=0;
171 if(hname.Contains("3"))layer=0;
172 else if(hname.Contains("4"))layer=1;
173 entries2[layer]=hdata->GetEntries();
174 if(entries2[layer]==0){AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
175 SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//end if getentries
176 else{
177 Int_t layer1=0;
178 if(hname.Contains("3"))layer1=0;
179 else if(hname.Contains("4"))layer1=1;
180 TH2* htemp=dynamic_cast<TH2*>(hdata);
d2f99642 181 if(htemp){
182 hlayer[layer1]=(TH2*)htemp->Clone();
183 hlayer[layer1]->SetName(Form("%s_copy",hname.Data()));
184 hlayer[layer1]->RebinX(2);
185 int modmay=hlayer[layer1]->GetNbinsY();
186 TH1D* hproj= hlayer[layer1]->ProjectionY();
187 Double_t ladcontent=0;
188 for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
189 ladcontent=hproj->GetBinContent(i);
190 if(AliITSQADataMakerRec::AreEqual(ladcontent,0.)) emptyladders[layer1]++;
191 else filledladders[layer1]++;}//end for
192 AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer], filledladders[layer]));//end else layer 3
193 delete hproj;
194 hproj=NULL;
195 }//end if htemp
196 }//end else entries !=0
6bf3d857 197 }//end check on phiz
78fb0b3d 198 }//end if hdata
199 }//end while
200 if(AliITSQADataMakerRec::AreEqual(entries,0.)&&AliITSQADataMakerRec::AreEqual(entries2[0],0.)&&AliITSQADataMakerRec::AreEqual(entries2[1],0.)) break;
201 //else{
202 if(hmodule || (hlayer[0] && hlayer[1])){
203 Int_t excluded=0;
204 Int_t active=0;
205 Int_t exactive=0;//excluded but taking data
206 for(Int_t imod=0;imod<fgknSDDmodules;imod++){
207 Int_t lay=0;
208 Int_t lad=0;
209 Int_t det=0;
210 Int_t module=0;
211 module=imod+fgkmodoffset;
212 AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
d2f99642 213 if(cal==0) { continue;}
78fb0b3d 214 AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
215 if (cal->IsBad()){
216 excluded++;
217 Double_t content=0.;
218 Double_t contentlayer[2];
219 for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
220 if(hmodule)content=hmodule->GetBinContent(imod+1);//if expert bit is active the histogram has been created
f2fafc64 221 if(hlayer[lay-3]) contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
78fb0b3d 222 if(AliITSQADataMakerRec::AreEqual(content,0.)== kFALSE || AliITSQADataMakerRec::AreEqual(contentlayer[lay-3],0.)==kFALSE) {
223 filledmodules[lay-3]++;
224 AliWarning(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",module,lay,lad,det));
225 exactive++;
226 } else if(AliITSQADataMakerRec::AreEqual(content,0.) && AliITSQADataMakerRec::AreEqual(contentlayer[lay-3],0.))
227 emptymodules[lay-3]++;
228 } else {
229 Double_t contentgood=0.;
230 active++;
f2fafc64 231 if(hlayer[lay-3]) contentgood=hlayer[lay-3]->GetBinContent(det,lad);
78fb0b3d 232 if(AliITSQADataMakerRec::AreEqual(contentgood,0.))
233 emptymodules[lay-3]++;
234 else
235 filledmodules[lay-3]++;
236 }
237 }//end for
238 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
239 if(exactive==0){
240 AliInfo(Form("All the active modules (%i) are in acquisition. The number of excluded modules are %i \n",active,excluded));
241 SDDQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
3647765c 242 }
78fb0b3d 243 if(exactive!=0){
244 AliWarning(Form("%i modules excluded from the acquisition took data. Active modules%i \n ",exactive,active));
245 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
246 }
247 if(excluded==exactive){
248 AliWarning(Form("All the modules excluded from the acquisition (%d) took data! Active modules %i\n",excluded,active));
249 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
250 }
251 if(active==0){
252 AliWarning(Form("No modules took data: excluded %i \t exactive %i \n", excluded, exactive));
253 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
254 }
6bf3d857 255
78fb0b3d 256 }//end else
6bf3d857 257 delete hmodule;
258 hmodule=NULL;
259 for(Int_t i=0;i<2;i++) {
260 delete hlayer[i];
261 hlayer[i]=NULL;
262 }
78fb0b3d 263
6bf3d857 264 }
265
80b9610c 266 break;
6bf3d857 267
268 case AliQAv1::kNULLTASK:{
269 AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index)));
270 SDDQACheckerValue=1.;
271 }
272 break;
273
274 case AliQAv1::kREC:
275 {
8db5c9f9 276 Int_t uidrec=list->GetUniqueID();
80b9610c 277 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
8db5c9f9 278 if(uidrec==20){
279 //recpoints
280 if (list->GetEntries() == 0){ //check if the list is empty
281 //printf("SDDQACheckerValue = %f \t value %f\n",SDDQACheckerValue,fHighSDDValue[AliQAv1::kFATAL]);
282 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
283 break;
284 }//end if getentries
6bf3d857 285
8db5c9f9 286 while((hdata=dynamic_cast<TH1* >(next()))){
287 if (hdata){
288 TString hname=hdata->GetName();
289 if(hname.Contains("_RelativeOccupancy")) {
290 Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS();
291 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
292 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
293 Int_t aboveThreshold = 0;
294 for(Int_t k=0; k<= ((Int_t)hdata->GetNbinsX()); k++) {
295 if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (Int_t)(hdata->GetBinContent(k));
296 }
297 Float_t fractionAboveThreshold = ((Float_t) aboveThreshold)/hdata->GetEntries();
298 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3, L3: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
299 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4, L4: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
300 if(fractionAboveThreshold > fThresholdForRelativeOccupancy) {
301 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
302 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: Set Warning (L3 RecPoints)"));
303 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: Set Warning (L4 RecPoints)"));
304 }
78fb0b3d 305 }
8db5c9f9 306 if(hname.Contains("Rec2Raw") && !hname.Contains("2D")) {
307 //Float_t threshold = 0.;
308 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: L3 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
309 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: L4 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
310 Int_t belowThreshold = 0;
311 for(Int_t k=0; k<=((TH1F *)hdata)->GetNbinsX(); k++) {
312 if(((TH1F *) hdata)->GetBinLowEdge(k) < fThresholdForRecToRawRatio) belowThreshold += ((Int_t)((TH1F *) hdata)->GetBinContent(k));
313 }
314 Double_t fractionBelowThreshold =0.;
315 Double_t entries3=((TH1F *)hdata)->GetEntries();
316 if(entries3>0.001)fractionBelowThreshold = ((Double_t)(belowThreshold))/entries3;
317 else{ AliWarning(Form("No entries on %s. The check will retuns zero.\n",hdata->GetName() )); }
318 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5, L3: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
319 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6, L4: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
320 if(fractionBelowThreshold > fThresholdForRelativeOccupancy) {
321 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
322 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: Set Warning (L3 RecPoints2Raws)"));
323 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: Set Warning (L4 RecPoints2Raws)"));
324 }
78fb0b3d 325 }
8db5c9f9 326 if(hname.Contains("dedx")) {
327 if(hname.Contains("L3")) AliInfo(Form("SDD check number 7: L3 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
328 if(hname.Contains("L4")) AliInfo(Form("SDD check number 8: L4 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
78fb0b3d 329 }
330 }
8db5c9f9 331 }
6bf3d857 332
8db5c9f9 333 SDDQACheckerValue=1.;
334 }
335 else if(uidrec==40)
336 {
337 //digitsr
338 if (list->GetEntries() == 0){
339 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
340 break;
341 } else{
342
343 while( (hdata = dynamic_cast<TH1* >(next())) ){
344 if (hdata){
345 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
346 else {
347 TString hname=hdata->GetName();
348 if(hname.Contains("SDD DIGITS Module Pattern")) {
349 //see raws
350
351 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
352 } else if(hname.Contains("SDD Anode Distribution")) {
353 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
354 } else if(hname.Contains("SDD Tbin Distribution")) {
355 //to do as rp
356 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
357 } else if(hname.Contains("SDD ADC Counts Distribution")) {
358 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
359 }//end adc counts
360
361 }//end entries !=0
362 }//end hdata
363 }//end while
364 }//end else
365 SDDQACheckerValue=1.;
366 }
367
6bf3d857 368 }
369 break;
370 case AliQAv1::kANA:
371 {
80118b05 372 AliInfo(Form("===================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
78fb0b3d 373 SDDQACheckerValue=1.;
6bf3d857 374 }
375 break;
376 case AliQAv1::kESD:
377 {
80118b05 378 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
78fb0b3d 379 SDDQACheckerValue=1.;
6bf3d857 380 }
381 break;
382 case AliQAv1::kNTASK:{
383 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
384 SDDQACheckerValue=1.;
385 }
386 break;
387 case AliQAv1::kSIM:{
388 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
389 Int_t uid=list->GetUniqueID();
390 if(uid==60) {
391 //digits
392 if (list->GetEntries() == 0){
393 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
394 break;
395 } else{
396
397 while( (hdata = dynamic_cast<TH1* >(next())) ){
398 if (hdata){
399 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
400 else {
401 TString hname=hdata->GetName();
402 if(hname.Contains("SDDDIGITSModulePattern")) {
403 //see raws
404
405 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
406 } else if(hname.Contains("SDDAnodeDistribution")) {
407 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
408 } else if(hname.Contains("SDDTbinDistribution")) {
409 //to do as rp
410 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
411 } else if(hname.Contains("SDDADCCountsDistribution")) {
412 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
413 }//end adc counts
414
415 }//end entries !=0
416 }//end hdata
417 }//end while
418 }//end else
419 } else if(uid==50)
420 {
421 //hits
422 if (list->GetEntries() == 0){
423 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
424 break;
425 }
426 else{
427
428 while( (hdata = dynamic_cast<TH1* >(next())) ){
429 if (hdata){
430 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
431 else {
432 TString hname=hdata->GetName();
433 if(hname.Contains("SDDHITSModulePattern")) {
434 //to do as raws
435 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
436 } else if(hname.Contains("SDDHITlenghtalonglocalYCoord")) {
437 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
438 } else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom")) {
439 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
440 } else if(hname.Contains("SDDDepositedEnergyDistribution")) {
441 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
442 }//end deposited energy
443
444 }//end entries !=0
445 }//end hdata
446 }//end while
447 }//end else
448 } else if(uid==70)
449 {
450 //sdigits
78fb0b3d 451 if (list->GetEntries() == 0){
452 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
6bf3d857 453 break;
78fb0b3d 454 } else{
6bf3d857 455
78fb0b3d 456 while( (hdata = dynamic_cast<TH1* >(next())) ){
457 if (hdata){
458 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
459 else {
460 TString hname=hdata->GetName();
6bf3d857 461 if(hname.Contains("SDDSDIGITSModulePattern")) {
462 //to do as raws
78fb0b3d 463 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
464 } else if(hname.Contains("SDDAnodeDistribution")) {
465 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
466 } else if(hname.Contains("SDDTbinDistribution")) {
467 //to do as rp
468 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
469 } else if(hname.Contains("SDDADCCountsDistribution")) {
470 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
6bf3d857 471 }//end adc counts bindistribution
78fb0b3d 472 }//end entries !=0
473 }//end hdata
474 }//end while
475 }//end else
6bf3d857 476 }//end sdigits
477 SDDQACheckerValue=1.;
478 }
479 break;
480
481 }//end switch
482
80118b05 483 fCalibration=NULL;
d2f99642 484 if(hdata) delete hdata;
6bf3d857 485
486
78fb0b3d 487 return SDDQACheckerValue;
5b716935 488}
6bf3d857 489
3647765c 490//__________________________________________________________________
80b9610c 491void AliITSQASDDChecker::SetTaskOffset(Int_t taskoffset)
492{
f09c0b42 493 //set the number of the histograms already present in the list before the SDD histograms
80b9610c 494 fSubDetOffset = taskoffset;
495}
496
497
498//__________________________________________________________________
f09c0b42 499void AliITSQASDDChecker::SetStepBit(const Double_t *steprange)
80b9610c 500{
f09c0b42 501 //set the values of the step bit for each QA bit range calculated in the AliITSQAChecker class
80b9610c 502 fStepBitSDD = new Double_t[AliQAv1::kNBIT];
503 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
504 {
505 fStepBitSDD[bit]=steprange[bit];
506 }
507}
508
509//__________________________________________________________________
f09c0b42 510void AliITSQASDDChecker::SetSDDLimits(const Float_t *lowvalue, const Float_t * highvalue)
3647765c 511{
f09c0b42 512 //set the low and high values in for each QA bit range calculated in the AliITSQAChecker class
80b9610c 513 fLowSDDValue = new Float_t[AliQAv1::kNBIT];
514 fHighSDDValue= new Float_t[AliQAv1::kNBIT];
515
516 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
517 {
518 fLowSDDValue[bit]=lowvalue[bit];
519 fHighSDDValue[bit]= highvalue[bit];
520 }
521
3647765c 522}
8db5c9f9 523//__________________________________________________________________
524Bool_t AliITSQASDDChecker::MakeSDDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode)
525{
526 Bool_t rval=kFALSE;
527 fImage=(TCanvas**)AliQAChecker::Instance()->GetDetQAChecker(0)->GetImage();
528 //create the image for raws and recpoints. In the other case, the default methodof CheckerBase class will be used
529 switch(task)
530 {
531 case AliQAv1::kRAWS:{
532 rval=MakeSDDRawsImage(list, task,mode);
533 }
534 break;
535 case AliQAv1::kRECPOINTS:{ rval=MakeSDDRecPointsImage(list, task,mode); }
536 break;
537 case AliQAv1::kHITS:; case AliQAv1::kESDS:; case AliQAv1::kDIGITS:;case AliQAv1::kDIGITSR:;case AliQAv1::kSDIGITS:;case AliQAv1::kTRACKSEGMENTS:;case AliQAv1::kRECPARTICLES:; default:
538 {
539 rval=kFALSE;
540 //AliQAChecker::Instance()->GetDetQAChecker(0)->MakeImage(list,task,mode);
541 }
542 break;
543 case AliQAv1::kNULLTASKINDEX:; case AliQAv1::kNTASKINDEX:
544 {AliWarning(Form("No histograms for this task ( %s ) \n", AliQAv1::GetTaskName(task).Data())); rval=kFALSE;}
545 break;
546 }
547return rval;
548}
549
550
551//_______________________________________________________________________
552Bool_t AliITSQASDDChecker::MakeSDDRawsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
553{
554
555 for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
556 //printf("-------------------------> %i \n", esIndex);
557 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0)
558 {//printf ("Nothing for %s \n", AliRecoParam::GetEventSpecieName(esIndex));
559 continue;
560 }
561 else{
562 const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ;
563 if ( !fImage[esIndex] ) {
564 fImage[esIndex] = new TCanvas(title, title,1280,980) ;
565 }
566
567 fImage[esIndex]->Clear() ;
568 fImage[esIndex]->SetTitle(title) ;
569 fImage[esIndex]->cd();
570
571 TPaveText someText(0.015, 0.015, 0.98, 0.98);
572 someText.AddText(title);
573 someText.Draw();
574 fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ;
575 fImage[esIndex]->Clear() ;
576 Int_t nx =2; //TMath::Nint(TMath::Sqrt(nImages));
577 Int_t ny =1; // nx ;
578 //if (nx < TMath::Sqrt(nImages))
579 //ny++ ;
580 fImage[esIndex]->Divide(nx, ny) ;
581 TIter nexthist(list[esIndex]) ;
582 TH1* hist = NULL ;
583 Int_t npad = 1 ;
584 fImage[esIndex]->cd(npad);
585 fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
586 while ( (hist=static_cast<TH1*>(nexthist())) ) {
587 //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
588 TString cln(hist->ClassName()) ;
589 if ( ! cln.Contains("TH") )
590 continue ;
591
592 if(hist->TestBit(AliQAv1::GetImageBit())) {
593 hist->GetXaxis()->SetTitleSize(0.02);
594 hist->GetYaxis()->SetTitleSize(0.02);
595 hist->GetXaxis()->SetLabelSize(0.02);
596 hist->GetYaxis()->SetLabelSize(0.02);
597 if(cln.Contains("TH2"))
598 {
599 gPad->SetRightMargin(0.15);
600 gPad->SetLeftMargin(0.05);
601 hist->SetStats(0);
602 hist->SetOption("colz") ;
603 //hist->GetListOfFunctions()->FindObject("palette")->SetLabelSize(0.025);
604 //gPad->Update();
605 }
606 hist->DrawCopy() ;
607 fImage[esIndex]->cd(++npad) ;
608 fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
609 }
610 }
611 fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ;
612 }
613 }
614 return kTRUE;
615}
616
617
618
619
620//_______________________________________________________________________
621Bool_t AliITSQASDDChecker::MakeSDDRecPointsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
622{
80b9610c 623
8db5c9f9 624 for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
625 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0)
626 {
627 //printf ("Nothing for %s \n", AliQAv1::GetTaskName(task).Data());
628 continue;
629 }
630 const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ;
631 if ( !fImage[esIndex] ) {
632 fImage[esIndex] = new TCanvas(title, title,1280,980) ;
633 }
634 fImage[esIndex]->Clear() ;
635 fImage[esIndex]->SetTitle(title) ;
636 fImage[esIndex]->cd();
637 fImage[esIndex]->SetBorderMode(0) ;
638 TPaveText someText(0.015, 0.015, 0.98, 0.98);
639 someText.AddText(title);
640 someText.Draw();
641 fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ;
642 fImage[esIndex]->Clear() ;
643 Int_t nx =2; //TMath::Nint(TMath::Sqrt(nImages));
644 Int_t ny =4; // nx ;
645 //if (nx < TMath::Sqrt(nImages))
646 //ny++ ;
647 fImage[esIndex]->Divide(nx, ny) ;
648 TIter nexthist(list[esIndex]) ;
649 TH1* hist = NULL ;
650 Int_t npad = 1 ;
651 fImage[esIndex]->cd(npad) ;
652 fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
653 while ( (hist=static_cast<TH1*>(nexthist())) ) {
654 //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
655 TString cln(hist->ClassName()) ;
656 //printf("=====================> Class name %s \n",cln.Data());
657 if ( ! cln.Contains("TH") )
658 continue ;
659 if(hist->TestBit(AliQAv1::GetImageBit())) {
660 hist->GetXaxis()->SetTitleSize(0.02);
661 hist->GetYaxis()->SetTitleSize(0.02);
662 hist->GetXaxis()->SetLabelSize(0.02);
663 hist->GetYaxis()->SetLabelSize(0.02);
664 if(cln.Contains("TH1"))
665 {
666 hist->SetFillColor(kOrange+7);
667 //SetFrameFillColor(kAzure-9);
668 //hist->DrawCopy() ;
669 }
670 if(cln.Contains("TH2"))
671 {
672 gPad->SetRightMargin(0.15);
673 gPad->SetLeftMargin(0.05);
674 hist->SetStats(0);
675 hist->SetOption("colz") ;
676 // TPaletteAxis *paletta =(TPaletteAxis*)hist->GetListOfFunctions()->FindObject("palette");
677 //paletta->SetLabelSize(0.025);
678 //gPad->Update();
679 }
680 hist->DrawCopy();
681 fImage[esIndex]->cd(++npad) ;
682 fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
683 }
684 }
685 fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ;
686 }
687 // }
688 return kTRUE;
689}