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