]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSQASDDChecker.cxx
In AliMUONTriggerQADataMakerRec:
[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);
8a55554e 125 TString results1;
126 TString results2;
127 Int_t color=1;
78fb0b3d 128
6bf3d857 129 switch(index) {
130 case AliQAv1::kRAW:{
80b9610c 131 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
6bf3d857 132// if(fRawModulePattern) { delete fRawModulePattern; fRawModulePattern = 0; }
133// if(fRawL3Pattern) { delete fRawL3Pattern; fRawL3Pattern = 0; }
134// if(fRawL4Pattern) { delete fRawL4Pattern; fRawL4Pattern = 0; }
8a55554e 135 if (list->GetEntries() == 0){AliError("Raw List for SDD is empty \n");SDDQACheckerValue += fHighSDDValue[AliQAv1::kFATAL]; break;}
6bf3d857 136 TH1 *hmodule=NULL;
137 TH2 *hlayer[2];
d2f99642 138 hdata=NULL;
8a55554e 139 for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
140
141 //check counters
142 Int_t emptymodules[2], filledmodules[2],emptyladders[2],filledladders[2],emptydriftregion[2], filleddriftregion[2], excludedmoduleperlayer[2], excludeddrperlayer[2], activemoduleperlayer[2],activedrperlayer[2],exactivemoduleperlayer[2],exactivedrperlayer[2];
143 Int_t excluded=0; //excluded modules
144 Int_t excludeddriftregion=0; //excluded single drift region
145 Int_t active=0; //active modules
146 Int_t activedriftregion=0; //active single drift region
147 Int_t exactive=0; //excluded modules but taking data
148 Int_t exactivedriftregion=0; //excluded single drift region but taking data
149 Int_t empty=0;
150 Int_t filled=0;
151 Int_t emptydr=0;
152 Int_t filleddr=0;
153 //Int_t emptyactivemodule=0;
154 Int_t emptyactivemoduleperlayer[2];
155 //Int_t emptydractivemodule=0;
156 Int_t emptyactivedrperlayer[2];
157 Int_t emptysum=0;
158 Int_t emptydiff=0;
159 Int_t emptydrsum=0;
160 Int_t emptydrdiff=0;
161
162 for(Int_t i=0;i<2;i++)
163 {
164 emptymodules[i]=0;
165 filledmodules[i]=0;
166 emptyladders[i]=0;
167 filledladders[i]=0;
168 emptydriftregion[i]=0;
169 filleddriftregion[i]=0;
170 excludedmoduleperlayer[i]=0;
171 excludeddrperlayer[i]=0;
172 activemoduleperlayer[i]=0;
173 activedrperlayer[i]=0;
174 exactivemoduleperlayer[i]=0;
175 exactivedrperlayer[i]=0;
176 emptyactivemoduleperlayer[i]=0;
177 emptyactivedrperlayer[i]=0;
178 }
179
180 Int_t neventsraw=0;
181
182 //take the number of events
183
184 while( (hdata = dynamic_cast<TH1* >(next())) ){
185 if (hdata){
186 TString hname=hdata->GetName();
187
188 if(hname.Contains("SDDRawDataCheck"))
189 {
190 neventsraw=(Int_t)hdata->GetBinContent(1);
191 //break;
192 }
193 else continue;
194 }//end if hdata
195 }//end while
196
197 next.Begin();
78fb0b3d 198 while( (hdata = dynamic_cast<TH1* >(next())) ){
6bf3d857 199 if (hdata){TString hname=hdata->GetName();
78fb0b3d 200 if(hname.Contains("SDDchargeMap"))continue;
8a55554e 201 if(hname.Contains("SDDDDLPattern"))continue;
202 if(hname.Contains("SDDEventSize"))continue;
203 if(hname.Contains("_RelativeOccupancy"))continue;
78fb0b3d 204 if(hname.Contains("SDDModPattern")){
6bf3d857 205 if(hname.Contains("NORM")) continue;
206 hmodule=(TH1*)hdata->Clone();
207 entries= hdata->GetEntries();
208 if(AliITSQADataMakerRec::AreEqual(entries,0.)){AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//endif entries
8a55554e 209 else{
210 int modmax=hdata->GetNbinsX();
6bf3d857 211 Double_t content=0;
8a55554e 212 Int_t llay=0;
213 for(Int_t i=1;i<=modmax;i++)
214 {
215 if(i<85)llay=0;
216 else llay=1;
217 content=hdata->GetBinContent(i);
218 if(AliITSQADataMakerRec::AreEqual(content,0.))
219 {
220 empty++;
221 emptymodules[llay]++;
222 }
223 else
224 {
225 filled++;
226 filledmodules[llay]++;
227 }
228 }//end for
229 //output of the check at the level of the modules. Drift region in the following checks
230
231 AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));
232 AliInfo(Form(" %s : Layer 3 empty modules %i \t filled modules %i",hname.Data(), emptymodules[0], filledmodules[0]));
233 AliInfo(Form(" %s : Layer 4 empty modules %i \t filled modules %i",hname.Data(), emptymodules[1], filledmodules[1]));
234 }//end else pattern entries !=0
235 } //modpattern (1d histogram)
78fb0b3d 236 if(hname.Contains("_RelativeOccupancy")) {
6bf3d857 237 //fRawModulePattern = (TH1F *) hdata;
238 Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS();
239 if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
240 if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
78fb0b3d 241 Int_t aboveThreshold = 0;
6bf3d857 242 for(Int_t k=0; k<= hdata->GetNbinsX(); k++) {if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (int)(hdata->GetBinContent(k));}
6753619d 243 Float_t fractionAboveThreshold=0.;
244 if(hdata->GetEntries()>0.)fractionAboveThreshold=((Float_t) aboveThreshold)/hdata->GetEntries();
78fb0b3d 245 if(hname.Contains("L3")) AliInfo(Form("SDD check number 1, L3: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
246 if(hname.Contains("L4")) AliInfo(Form("SDD check number 2, L4: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
6bf3d857 247 if(fractionAboveThreshold > fThresholdForRelativeOccupancy) {SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
78fb0b3d 248 if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: Set Warning (L3 Raw)"));
8a55554e 249 if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: Set Warning (L4 Raw)")); } }//relativeoccupancy
250
6bf3d857 251 if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){if(hname.Contains("NORM"))continue;
6bf3d857 252 Int_t layer=0;
253 if(hname.Contains("3"))layer=0;
254 else if(hname.Contains("4"))layer=1;
255 entries2[layer]=hdata->GetEntries();
256 if(entries2[layer]==0){AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
257 SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//end if getentries
258 else{
259 Int_t layer1=0;
260 if(hname.Contains("3"))layer1=0;
261 else if(hname.Contains("4"))layer1=1;
262 TH2* htemp=dynamic_cast<TH2*>(hdata);
d2f99642 263 if(htemp){
264 hlayer[layer1]=(TH2*)htemp->Clone();
265 hlayer[layer1]->SetName(Form("%s_copy",hname.Data()));
8a55554e 266 //hlayer[layer1]->RebinX(2);
d2f99642 267 int modmay=hlayer[layer1]->GetNbinsY();
268 TH1D* hproj= hlayer[layer1]->ProjectionY();
269 Double_t ladcontent=0;
270 for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
271 ladcontent=hproj->GetBinContent(i);
272 if(AliITSQADataMakerRec::AreEqual(ladcontent,0.)) emptyladders[layer1]++;
273 else filledladders[layer1]++;}//end for
8a55554e 274 AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer1], filledladders[layer1]));//end else layer 3
d2f99642 275 delete hproj;
276 hproj=NULL;
277 }//end if htemp
278 }//end else entries !=0
6bf3d857 279 }//end check on phiz
78fb0b3d 280 }//end if hdata
281 }//end while
8a55554e 282 for(Int_t ii=0;ii<2;ii++)
283 {
284 filledmodules[ii]=0;
285 emptymodules[ii]=0;
286 }
287 filled=0;
288 empty=0;
289 if(AliITSQADataMakerRec::AreEqual(entries,0.)&& AliITSQADataMakerRec::AreEqual(entries2[0],0.)&& AliITSQADataMakerRec::AreEqual(entries2[1],0.)) break;
78fb0b3d 290 //else{
291 if(hmodule || (hlayer[0] && hlayer[1])){
78fb0b3d 292 for(Int_t imod=0;imod<fgknSDDmodules;imod++){
293 Int_t lay=0;
294 Int_t lad=0;
295 Int_t det=0;
296 Int_t module=0;
297 module=imod+fgkmodoffset;
298 AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
d2f99642 299 if(cal==0) { continue;}
78fb0b3d 300 AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
301 if (cal->IsBad()){
302 excluded++;
8a55554e 303 excludedmoduleperlayer[lay-3]++;
78fb0b3d 304 Double_t content=0.;
305 Double_t contentlayer[2];
306 for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
8a55554e 307 if(hmodule)content=hmodule->GetBinContent(imod+1);//if expert bit is active the histogram will be stored in the QA file otherwise the histogram will not be written on the logbook
308 // if(hlayer[lay-3]) contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
309 if(AliITSQADataMakerRec::AreEqual(content,0.)== kFALSE) {
78fb0b3d 310 filledmodules[lay-3]++;
8a55554e 311 filled++;
312 AliError(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",module,lay,lad,det));
78fb0b3d 313 exactive++;
8a55554e 314 exactivemoduleperlayer[lay-3]++;
315 } else if(AliITSQADataMakerRec::AreEqual(content,0.))
316 {
317 emptymodules[lay-3]++; //it has to be empty
318 empty++;
319 }
78fb0b3d 320 } else {
8a55554e 321 Int_t totside=0;
322 Int_t totactiveside=0;
323 //Int_t totbadside=0;
78fb0b3d 324 Double_t contentgood=0.;
8a55554e 325
326 for(Int_t i=0;i<2;i++){
327 if(hlayer[lay-3]) contentgood=hlayer[lay-3]->GetBinContent(2*det+i-1,lad);
328 if(cal->IsWingBad(i))
329 {
330 excludeddriftregion++;
331 excludeddrperlayer[lay-3]++;
332 if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kFALSE){
333 AliError(Form("The side %d of the module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",i,module,lay,lad,det));
334 exactivedriftregion++;
335 exactivedrperlayer[lay-3]++;
336 filleddr++;
337 filleddriftregion[lay-3]++;
338 }
339 }//end wingbad
340 else{
341 if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kTRUE)
342 {
343 AliWarning(Form("The side %d of the module %d (layer %i, ladder %i det %i ) is in acquisition, but it didn't take data\n ",i,module, lay, lad, det));
344 }
345 else
346 {
347 totside++;
348 }
349 totactiveside++;
350 }
351 }//end for
352 if(totside==0){
353 AliWarning(Form("The module %d (layer %i, ladder %i det %i ) is in acquisition, but it didn't take data\n ",module, lay, lad, det));
78fb0b3d 354 emptymodules[lay-3]++;
8a55554e 355 empty++;
356
357 }
358 else
359 if(totside==2){
360 filledmodules[lay-3]++;
361 filled++;
362 }
363 else
364 if(totside==1)
365 {
366 // emptydr++;
367 //emptydriftregion[lay-3]++; //it has to be empty
368 emptydriftregion[lay-3]++;
369 emptydr++;
370 filleddr++;
371 filleddriftregion[lay-3]++;
372 }
373 if(totactiveside==1)
374 {
375 activedriftregion++;
376 activedrperlayer[lay-3]++;
377 }else if(totactiveside==2)
378 {
379 active++;
380 activemoduleperlayer[lay-3]++;
381 }
382
78fb0b3d 383 }
384 }//end for
8a55554e 385 AliInfo(Form("In total %d modules and %d single drift regions took data.\n ",filled, filleddr));
386 AliInfo(Form("In total %d modules and %d single drift regions were empty\n",empty, emptydr));
387 for(Int_t i=0;i<2;i++)
388 {
389 AliInfo(Form("Layer %i \tempty modules %i \t filled modules %i\n", i+3,emptymodules[i], filledmodules[i]));
390 AliInfo(Form("Layer %i \tempty single drift regions %i \t filled single drift regions %i\n",i+3,emptydriftregion[i], filleddriftregion[i]));
391 }//end else layers
392 emptysum=emptymodules[0]+emptymodules[1];
393 emptydiff=emptysum-excluded;
394 emptyactivemoduleperlayer[0]=emptymodules[0]- excludedmoduleperlayer[0];
395 emptyactivemoduleperlayer[1]=emptymodules[1]- excludedmoduleperlayer[1];
396
397 emptydrsum=emptydriftregion[0]+emptydriftregion[1];
398 emptydrdiff=emptydrsum-excludeddriftregion;
399 emptyactivedrperlayer[0]=emptydriftregion[0]- excludeddrperlayer[0];
400 emptyactivedrperlayer[1]=emptydriftregion[1]- excludeddrperlayer[1];
401
402
403 if(emptysum>excluded||emptydrsum>excludeddriftregion){
404 AliWarning(Form(" %i good module(s) and %i good single drift regions didn't take data! Check the calibration\n",emptydiff,emptydrdiff));
405 AliWarning(Form(" Layer 3: %i good module(s) and %i good single drift regions didn't take data! Check the calibration\n",emptyactivemoduleperlayer[0] ,emptyactivedrperlayer[0] ));
406 AliWarning(Form(" Layer 4: %i good module(s) and %i good single drift regions didn't take data! Check the calibration\n",emptyactivemoduleperlayer[1] ,emptyactivedrperlayer[1] ));
407
408
409 results1.Form("%i good module(s) and %i good drift regions didn't take data!",emptydiff,emptydrdiff);
410 if(neventsraw<500)
411 {
412 results2.Form(" Events %d .Too few events.DO NOT CALL the Expert ",neventsraw);
413 color=5;
414 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
415 }
416 else
417 {
418 results2.Form(" Events %d .Follow the TWiki instruction and call the Expert ",neventsraw);
419 color=2;
420 SDDQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
421 }
422 }
423
424 if(exactive==0 && emptydiff==0 && exactivedriftregion==0 && emptydrdiff==0){
425 AliInfo(Form("All the active modules (%i) and single drift regions (%i) are in acquisition. The number of excluded modules are %i and the excluded single drift regions are %i\n",active,activedriftregion,excluded,excludeddriftregion));
426 results1.Form("OK.");
427 results2.Form(" All active modules and drift regions in acquisition");
428 color=3;
78fb0b3d 429 SDDQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
3647765c 430 }
8a55554e 431 if(exactive!=0||exactivedriftregion!=0){
432 AliError(Form("%i modules and %i single drift regions excluded from the acquisition took data. Active modules%i single drift region %i \n ",exactive,exactivedriftregion,active,activedriftregion));
433 AliError(Form("Layer 3: %i modules and %i single drift regions excluded from the acquisition took data. Active modules%i single drift region %i \n ",exactivemoduleperlayer[0],exactivedrperlayer[0],activemoduleperlayer[0],activedrperlayer[0]));
434 AliError(Form("Layer 3: %i modules and %i single drift regions excluded from the acquisition took data. Active modules%i single drift region %i \n ",exactivemoduleperlayer[1],exactivedrperlayer[1],activemoduleperlayer[1],activedrperlayer[1]));
435 results1.Form("%i modules and %i drift region excluded from the acquisition took data",exactive,exactivedriftregion);
436 results2.Form("Follow the TWiki instructions and Call the SDD expert ");
437 color=2;
438 SDDQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
78fb0b3d 439 }
8a55554e 440 if(excluded==exactive||excludeddriftregion==exactivedriftregion){
441 AliError(Form("All the modules (%d) or single drift regions (%d) excluded from the acquisition took data!\n Active modules %i \t Active drfift regions %i\n",excluded,excludeddriftregion,active,activedriftregion));
442 results1.Form("All the modules (%d) or drift regions (%d) excluded from the acquisition took data!",excluded,excludeddriftregion );
443 results2.Form("Follow the TWiki instructions and Call the SDD expert ");
444 color=6;
445 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
78fb0b3d 446 }
8a55554e 447 if(active==0||activedriftregion==0){
448 AliError(Form("No modules or single drift regions took data: excluded %i \t excluded active %i \n\t\t excluded single drift regions %i \t excluded active drift regions %i \n", excluded, exactive, excludeddriftregion, exactivedriftregion));
449 results1.Form("No modules or drift region took data: excluded modules %i excluded drift regions %i ", excluded, excludeddriftregion );
450 results2.Form("Follow the TWiki instructions and Call the SDD expert ");
451 color=6;
78fb0b3d 452 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
453 }
8a55554e 454
455 TPaveText *pave[2];
456 next.Begin();
457
458 while( (hdata=dynamic_cast<TH1* >(next())) )
459 {
460 if (hdata){
461 TString hname=hdata->GetName();
462 if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){
463 if(hname.Contains("NORM"))continue;
464 //AliInfo("========================================Found histo 11\n");
465 Int_t lay=0;
466 if(hname.Contains("3"))lay=0;
467 else if(hname.Contains("4"))lay=1;
468 pave[lay]=new TPaveText(0.3,0.88,0.9,0.99,"NDC");
469 pave[lay]->AddText(results1.Data());
470 pave[lay]->AddText(results2.Data());
471 pave[lay]->SetFillColor(color);
472 pave[lay]->SetBorderSize(1);
473 pave[lay]->SetLineWidth(1);
474 hdata->GetListOfFunctions()->Add(pave[lay]);
475 }
476 else
477 if(hname.Contains("SDDRawDataCheck"))
478 {
479
480 //AliInfo("========================================Found histo\n");
481 ((TH1F*)hdata)->SetBinContent(5,active);
482 ((TH1F*)hdata)->SetBinContent(6,filled);
483 ((TH1F*)hdata)->SetBinContent(7,activedriftregion);
484 ((TH1F*)hdata)->SetBinContent(8,filleddr);
485 ((TH1F*)hdata)->SetBinContent(9,excluded);
486 ((TH1F*)hdata)->SetBinContent(10,empty);
487 ((TH1F*)hdata)->SetBinContent(11,excludeddriftregion);
488 ((TH1F*)hdata)->SetBinContent(12,emptydr);
489 ((TH1F*)hdata)->SetBinContent(13,exactive);
490 ((TH1F*)hdata)->SetBinContent(14,emptydiff);
491 ((TH1F*)hdata)->SetBinContent(15,exactivedriftregion);
492 ((TH1F*)hdata)->SetBinContent(16,emptydr);
493
494 //layer 3
495 ((TH1F*)hdata)->SetBinContent(19,activemoduleperlayer[0]);
496 ((TH1F*)hdata)->SetBinContent(20,filledmodules[0]);
497 ((TH1F*)hdata)->SetBinContent(21,activedrperlayer[0]);
498 ((TH1F*)hdata)->SetBinContent(22,filleddriftregion[0]);
499 ((TH1F*)hdata)->SetBinContent(23,excludedmoduleperlayer[0]);
500 ((TH1F*)hdata)->SetBinContent(24,emptymodules[0]);
501 ((TH1F*)hdata)->SetBinContent(25,excludeddrperlayer[0]);
502 ((TH1F*)hdata)->SetBinContent(26,emptydriftregion[0]);
503 ((TH1F*)hdata)->SetBinContent(27,exactivemoduleperlayer[0]);
504 ((TH1F*)hdata)->SetBinContent(28,emptyactivemoduleperlayer[0]);
505 ((TH1F*)hdata)->SetBinContent(29,activedrperlayer[0]);
506 ((TH1F*)hdata)->SetBinContent(30,emptyactivedrperlayer[0]);
507
508 //layer 4
509 ((TH1F*)hdata)->SetBinContent(33,activemoduleperlayer[1]);
510 ((TH1F*)hdata)->SetBinContent(34,filledmodules[1]);
511 ((TH1F*)hdata)->SetBinContent(35,activedrperlayer[1]);
512 ((TH1F*)hdata)->SetBinContent(36,filleddriftregion[1]);
513 ((TH1F*)hdata)->SetBinContent(37,excludedmoduleperlayer[1]);
514 ((TH1F*)hdata)->SetBinContent(38,emptymodules[1]);
515 ((TH1F*)hdata)->SetBinContent(39,excludeddrperlayer[1]);
516 ((TH1F*)hdata)->SetBinContent(40,emptydriftregion[1]);
517 ((TH1F*)hdata)->SetBinContent(41,exactivemoduleperlayer[1]);
518 ((TH1F*)hdata)->SetBinContent(42,emptyactivemoduleperlayer[1]);
519 ((TH1F*)hdata)->SetBinContent(43,activedrperlayer[1]);
520 ((TH1F*)hdata)->SetBinContent(44,emptyactivedrperlayer[1]);
521 //break;
522 }
523 }//if hdata
524
525 }//end while
6bf3d857 526
78fb0b3d 527 }//end else
6bf3d857 528 delete hmodule;
529 hmodule=NULL;
530 for(Int_t i=0;i<2;i++) {
531 delete hlayer[i];
532 hlayer[i]=NULL;
8a55554e 533 }//end for
78fb0b3d 534
8a55554e 535 }//end raw
6bf3d857 536
80b9610c 537 break;
6bf3d857 538
539 case AliQAv1::kNULLTASK:{
540 AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index)));
541 SDDQACheckerValue=1.;
542 }
543 break;
544
545 case AliQAv1::kREC:
546 {
8db5c9f9 547 Int_t uidrec=list->GetUniqueID();
80b9610c 548 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
8db5c9f9 549 if(uidrec==20){
550 //recpoints
551 if (list->GetEntries() == 0){ //check if the list is empty
552 //printf("SDDQACheckerValue = %f \t value %f\n",SDDQACheckerValue,fHighSDDValue[AliQAv1::kFATAL]);
553 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
8a55554e 554 //break;
8db5c9f9 555 }//end if getentries
6bf3d857 556
8a55554e 557
558 TH1 *hmodule=NULL;
559 TH2 *hlayer[2];
560 hdata=NULL;
561 for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
562
563 //check counters
564 Int_t emptymodules[2], filledmodules[2],emptyladders[2],filledladders[2],emptydriftregion[2], filleddriftregion[2], excludedmoduleperlayer[2], excludeddrperlayer[2], activemoduleperlayer[2],activedrperlayer[2],exactivemoduleperlayer[2],exactivedrperlayer[2];
565 Int_t excluded=0; //excluded modules
566 Int_t excludeddriftregion=0; //excluded single drift region
567 Int_t active=0; //active modules
568 Int_t activedriftregion=0; //active single drift region
569 Int_t exactive=0; //excluded modules but taking data
570 Int_t exactivedriftregion=0; //excluded single drift region but taking data
571 Int_t empty=0;
572 Int_t filled=0;
573 Int_t emptydr=0;
574 Int_t filleddr=0;
575 //Int_t emptyactivemodule=0;
576 Int_t emptyactivemoduleperlayer[2];
577 //Int_t emptydractivemodule=0;
578 Int_t emptyactivedrperlayer[2];
579 Int_t emptysum=0;
580 Int_t emptydiff=0;
581 Int_t emptydrsum=0;
582 Int_t emptydrdiff=0;
583
584 for(Int_t i=0;i<2;i++)
585 {
586 emptymodules[i]=0;
587 filledmodules[i]=0;
588 emptyladders[i]=0;
589 filledladders[i]=0;
590 emptydriftregion[i]=0;
591 filleddriftregion[i]=0;
592 excludedmoduleperlayer[i]=0;
593 excludeddrperlayer[i]=0;
594 activemoduleperlayer[i]=0;
595 activedrperlayer[i]=0;
596 exactivemoduleperlayer[i]=0;
597 exactivedrperlayer[i]=0;
598 emptyactivemoduleperlayer[i]=0;
599 emptyactivedrperlayer[i]=0;
600 }
601
602 Int_t neventsrecpoints=0;
603
604 while( (hdata = dynamic_cast<TH1* >(next())) ){
605 if (hdata){
606 TString hname=hdata->GetName();
607
608 if(hname.Contains("SDDRecPointCheck"))
609 {
610 neventsrecpoints=(Int_t)hdata->GetBinContent(1);
611 //break;
612 }
613 else{continue;}
614 }//end if hdata
615 }//end while
616
617 next.Begin();
618
8db5c9f9 619 while((hdata=dynamic_cast<TH1* >(next()))){
620 if (hdata){
621 TString hname=hdata->GetName();
622 if(hname.Contains("_RelativeOccupancy")) {
623 Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS();
624 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
625 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
626 Int_t aboveThreshold = 0;
627 for(Int_t k=0; k<= ((Int_t)hdata->GetNbinsX()); k++) {
628 if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (Int_t)(hdata->GetBinContent(k));
629 }
6753619d 630 Float_t fractionAboveThreshold=0.;
631 if(hdata->GetEntries()>0.) fractionAboveThreshold = ((Float_t) aboveThreshold)/hdata->GetEntries();
8db5c9f9 632 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3, L3: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
633 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4, L4: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
634 if(fractionAboveThreshold > fThresholdForRelativeOccupancy) {
635 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
636 if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: Set Warning (L3 RecPoints)"));
637 if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: Set Warning (L4 RecPoints)"));
638 }
78fb0b3d 639 }
8db5c9f9 640 if(hname.Contains("Rec2Raw") && !hname.Contains("2D")) {
641 //Float_t threshold = 0.;
642 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: L3 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
643 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: L4 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS()));
644 Int_t belowThreshold = 0;
645 for(Int_t k=0; k<=((TH1F *)hdata)->GetNbinsX(); k++) {
646 if(((TH1F *) hdata)->GetBinLowEdge(k) < fThresholdForRecToRawRatio) belowThreshold += ((Int_t)((TH1F *) hdata)->GetBinContent(k));
647 }
648 Double_t fractionBelowThreshold =0.;
649 Double_t entries3=((TH1F *)hdata)->GetEntries();
650 if(entries3>0.001)fractionBelowThreshold = ((Double_t)(belowThreshold))/entries3;
651 else{ AliWarning(Form("No entries on %s. The check will retuns zero.\n",hdata->GetName() )); }
652 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5, L3: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
653 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6, L4: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
654 if(fractionBelowThreshold > fThresholdForRelativeOccupancy) {
655 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
656 if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: Set Warning (L3 RecPoints2Raws)"));
657 if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: Set Warning (L4 RecPoints2Raws)"));
658 }
78fb0b3d 659 }
8db5c9f9 660 if(hname.Contains("dedx")) {
661 if(hname.Contains("L3")) AliInfo(Form("SDD check number 7: L3 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
662 if(hname.Contains("L4")) AliInfo(Form("SDD check number 8: L4 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS()));
8a55554e 663 }//end if dedx
664 if(hname.Contains("SDDModPatternRP")){
665 if(hname.Contains("NORM")) continue;
666 hmodule=(TH1*)hdata->Clone();
667 entries= hdata->GetEntries();
668 if(AliITSQADataMakerRec::AreEqual(entries,0.)){AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//endif entries
669 else{
670 int modmax=hdata->GetNbinsX();
671 Double_t content=0;
672 Int_t llay=0;
673 for(Int_t i=1;i<=modmax;i++)
674 {
675 if(i<85)llay=0;
676 else llay=1;
677 content=hdata->GetBinContent(i);
678 if(AliITSQADataMakerRec::AreEqual(content,0.))
679 {
680 empty++;
681 emptymodules[llay]++;
682 }
683 else
684 {
685 filled++;
686 filledmodules[llay]++;
687 }
688 }//end for
689 //output of the check at the level of the modules. Drift region in the following checks
690
691 AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));
692 AliInfo(Form(" %s : Layer 3 empty modules %i \t filled modules %i",hname.Data(), emptymodules[0], filledmodules[0]));
693 AliInfo(Form(" %s : Layer 4 empty modules %i \t filled modules %i",hname.Data(), emptymodules[1], filledmodules[1]));
694 }//end else pattern entries !=0
695 } //modpattern (1d histogram)
696
697 if(hname.Contains("SDDModPatternL3RP") || hname.Contains("SDDModPatternL4RP")){if(hname.Contains("NORM"))continue;
698 Int_t layer=0;
699 if(hname.Contains("3"))layer=0;
700 else if(hname.Contains("4"))layer=1;
701 entries2[layer]=hdata->GetEntries();
702 if(entries2[layer]==0){AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
703 SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//end if getentries
704 else{
705 Int_t layer1=0;
706 if(hname.Contains("3"))layer1=0;
707 else if(hname.Contains("4"))layer1=1;
708 TH2* htemp=dynamic_cast<TH2*>(hdata);
709 if(htemp){
710 hlayer[layer1]=(TH2*)htemp->Clone();
711 hlayer[layer1]->SetName(Form("%s_copy",hname.Data()));
712 //hlayer[layer1]->RebinX(2);
713 int modmay=hlayer[layer1]->GetNbinsY();
714 TH1D* hproj= hlayer[layer1]->ProjectionY();
715 Double_t ladcontent=0;
716 for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
717 ladcontent=hproj->GetBinContent(i);
718 if(AliITSQADataMakerRec::AreEqual(ladcontent,0.)) emptyladders[layer1]++;
719 else filledladders[layer1]++;}//end for
720 AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer1], filledladders[layer1]));//end else layer 3
721 delete hproj;
722 hproj=NULL;
723 }//end if htemp
724 }//end else entries !=0
725 }//end check on phiz
726 }//end if hdata
727 }//end while
728 for(Int_t ii=0;ii<2;ii++)
729 {
730 filledmodules[ii]=0;
731 emptymodules[ii]=0;
732 }
733 filled=0;
734 empty=0;
735 if(AliITSQADataMakerRec::AreEqual(entries,0.)&& AliITSQADataMakerRec::AreEqual(entries2[0],0.)&& AliITSQADataMakerRec::AreEqual(entries2[1],0.)) break;
736 //else{
737 if(hmodule || (hlayer[0] && hlayer[1])){
738 for(Int_t imod=0;imod<fgknSDDmodules;imod++){
739 Int_t lay=0;
740 Int_t lad=0;
741 Int_t det=0;
742 Int_t module=0;
743 module=imod+fgkmodoffset;
744 AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
745 if(cal==0) { continue;}
746 AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
747 if (cal->IsBad()){
748 excluded++;
749 excludedmoduleperlayer[lay-3]++;
750 Double_t content=0.;
751 Double_t contentlayer[2];
752 for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
753 if(hmodule)content=hmodule->GetBinContent(imod+1);//if expert bit is active the histogram will be stored in the QA file otherwise the histogram will not be written on the logbook
754 // if(hlayer[lay-3]) contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
755 if(AliITSQADataMakerRec::AreEqual(content,0.)== kFALSE) {
756 filledmodules[lay-3]++;
757 filled++;
758 AliError(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition,has recpoints \n ",module,lay,lad,det));
759 exactive++;
760 exactivemoduleperlayer[lay-3]++;
761 } else if(AliITSQADataMakerRec::AreEqual(content,0.))
762 {
763 emptymodules[lay-3]++; //it has to be empty
764 empty++;
765 }
766 } else {
767 Int_t totside=0;
768 Int_t totactiveside=0;
769 //Int_t totbadside=0;
770 Double_t contentgood=0.;
771
772 for(Int_t i=0;i<2;i++){
773 if(hlayer[lay-3]) contentgood=hlayer[lay-3]->GetBinContent(2*det+i-1,lad);
774 if(cal->IsWingBad(i))
775 {
776 excludeddriftregion++;
777 excludeddrperlayer[lay-3]++;
778 if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kFALSE){
779 AliError(Form("The side %d of the module %d (layer %i, ladder %i det %i ) excluded from the acquisition, has recpoints \n ",i,module,lay,lad,det));
780 exactivedriftregion++;
781 exactivedrperlayer[lay-3]++;
782 filleddr++;
783 filleddriftregion[lay-3]++;
784 }
785 }//end wingbad
786 else{
787 if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kTRUE)
788 {
789 AliWarning(Form("The side %d of the module %d (layer %i, ladder %i det %i ) is in acquisition, but no recpoints are present\n ",i,module, lay, lad, det));
790 }
791 else
792 {
793 totside++;
794 }
795 totactiveside++;
796 }
797 }//end for
798 if(totside==0){
799 AliWarning(Form("The module %d (layer %i, ladder %i det %i ) is in acquisition, but no recpoints are present \n ",module, lay, lad, det));
800 emptymodules[lay-3]++;
801 empty++;
802
78fb0b3d 803 }
8a55554e 804 else
805 if(totside==2){
806 filledmodules[lay-3]++;
807 filled++;
808 }
809 else
810 if(totside==1)
811 {
812 // emptydr++;
813 //emptydriftregion[lay-3]++; //it has to be empty
814 emptydriftregion[lay-3]++;
815 emptydr++;
816 filleddr++;
817 filleddriftregion[lay-3]++;
818 }
819 if(totactiveside==1)
820 {
821 activedriftregion++;
822 activedrperlayer[lay-3]++;
823 }else if(totactiveside==2)
824 {
825 active++;
826 activemoduleperlayer[lay-3]++;
827 }
828
78fb0b3d 829 }
8a55554e 830 }//end for
831 AliInfo(Form("In total %d modules and %d single drift regions have recpoints.\n ",filled, filleddr));
832 AliInfo(Form("In total %d modules and %d single drift regions are empty\n",empty, emptydr));
833 for(Int_t i=0;i<2;i++)
834 {
835 AliInfo(Form("Layer %i \tempty modules %i \t filled modules %i\n", i+3,emptymodules[i], filledmodules[i]));
836 AliInfo(Form("Layer %i \tempty single drift regions %i \t filled single drift regions %i\n",i+3,emptydriftregion[i], filleddriftregion[i]));
837 }//end else layers
838 emptysum=emptymodules[0]+emptymodules[1];
839 emptydiff=emptysum-excluded;
840 emptyactivemoduleperlayer[0]=emptymodules[0]- excludedmoduleperlayer[0];
841 emptyactivemoduleperlayer[1]=emptymodules[1]- excludedmoduleperlayer[1];
842
843 emptydrsum=emptydriftregion[0]+emptydriftregion[1];
844 emptydrdiff=emptydrsum-excludeddriftregion;
845 emptyactivedrperlayer[0]=emptydriftregion[0]- excludeddrperlayer[0];
846 emptyactivedrperlayer[1]=emptydriftregion[1]- excludeddrperlayer[1];
847
848
849 if(emptysum>excluded||emptydrsum>excludeddriftregion){
850 AliWarning(Form(" %i good module(s) and %i good single drift regions have not recpoints! Check the calibration\n",emptydiff,emptydrdiff));
851 AliWarning(Form(" Layer 3: %i good module(s) and %i good single drift regions have not recpoints! Check the calibration\n",emptyactivemoduleperlayer[0] ,emptyactivedrperlayer[0] ));
852 AliWarning(Form(" Layer 4: %i good module(s) and %i good single drift regions have not recpoints! Check the calibration\n",emptyactivemoduleperlayer[1] ,emptyactivedrperlayer[1] ));
853
854 //SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
855
856 results1.Form("%i good module(s) and %i good drift region(s) have not recpoints!",emptydiff,emptydrdiff);
857 if(neventsrecpoints<500)
858 {
859 results2.Form(" Events %d .Too few events.DO NOT CALL the Expert ",neventsrecpoints);
860 color=5;
861 SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
862 }
863 else
864 {
865 results2.Form(" Events %d .Follow the TWiki instruction and call the Expert ",neventsrecpoints);
866 color=2;
867 SDDQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
868 }
869 }
870
6bf3d857 871
8a55554e 872
873 if(exactive==0 && emptydiff==0 && exactivedriftregion==0 && emptydrdiff==0){
874 AliInfo(Form("All the active modules (%i) and single drift regions (%i) are in acquisition. The number of excluded modules are %i and the excluded single drift regions are %i\n",active,activedriftregion,excluded,excludeddriftregion));
875 results1.Form("OK.");
876 results2.Form(" All active modules have recpoints");
877 color=3;
878 SDDQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
879 }
880 if(exactive!=0||exactivedriftregion!=0){
881 AliError(Form("%i modules and %i single drift regions excluded from the acquisition have recpoints. Active modules %i single drift region %i \n ",exactive,exactivedriftregion,active,activedriftregion));
882 AliError(Form("Layer 3: %i modules and %i single drift regions excluded from the acquisition have recpoints. Active modules %i single drift region %i \n ",exactivemoduleperlayer[0],exactivedrperlayer[0],activemoduleperlayer[0],activedrperlayer[0]));
883 AliError(Form("Layer 3: %i modules and %i single drift regions excluded from the acquisition have recpoints. Active modules %i single drift region %i \n ",exactivemoduleperlayer[1],exactivedrperlayer[1],activemoduleperlayer[1],activedrperlayer[1]));
884 results1.Form("%i modules and %i drift region excluded from the acquisition have recpoints",exactive,exactivedriftregion);
885 results2.Form("Follow the TWiki instructions and Call the SDD expert ");
886 color=2;
887 SDDQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
888 }
889 if(excluded==exactive||excludeddriftregion==exactivedriftregion){
890 AliError(Form("All the modules (%d) or single drift regions (%d) excluded from the acquisition have recpoints!\n Active modules %i \t Active drfift regions %i\n",excluded,excludeddriftregion,active,activedriftregion));
891 results1.Form("All the modules (%d) or drift regions (%d) excluded from the acquisition have recpoints!",excluded,excludeddriftregion );
892 results2.Form("Follow the TWiki instructions and Call the SDD expert ");
893 color=6;
894 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
895 }
896 if(active==0||activedriftregion==0){
897 AliError(Form("No modules or single drift regions have recpoints: excluded %i \t excluded active %i \n\t\t excluded single drift regions %i \t excluded active drift regions %i \n", excluded, exactive, excludeddriftregion, exactivedriftregion));
898 results1.Form("No modules or drift region have recpoints: excluded modules %i excluded drift regions %i ", excluded, excludeddriftregion );
899 results2.Form("Follow the TWiki instructions and Call the SDD expert ");
900 color=6;
901 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
902 }
903
904 TPaveText *pave[2];
905 next.Begin();
906
907 while( (hdata=dynamic_cast<TH1* >(next())) )
908 {
909 if (hdata){
910 TString hname=hdata->GetName();
911 if(hname.Contains("SDDModPatternL3RP") || hname.Contains("SDDModPatternL4RP")){
912 if(hname.Contains("NORM"))continue;
913 //AliInfo("========================================Found histo 11\n");
914 Int_t lay=0;
915 if(hname.Contains("3"))lay=0;
916 else if(hname.Contains("4"))lay=1;
917 pave[lay]=new TPaveText(0.3,0.88,0.9,0.99,"NDC");
918 pave[lay]->AddText(results1.Data());
919 pave[lay]->AddText(results2.Data());
920 pave[lay]->SetFillColor(color);
921 pave[lay]->SetBorderSize(1);
922 pave[lay]->SetLineWidth(1);
923 hdata->GetListOfFunctions()->Add(pave[lay]);
924 }
925 else
926 if(hname.Contains("SDDRecPointCheck"))
927 {
928
929 //AliInfo("========================================Found histo\n");
930 ((TH1F*)hdata)->SetBinContent(5,active);
931 ((TH1F*)hdata)->SetBinContent(6,filled);
932 ((TH1F*)hdata)->SetBinContent(7,activedriftregion);
933 ((TH1F*)hdata)->SetBinContent(8,filleddr);
934 ((TH1F*)hdata)->SetBinContent(9,excluded);
935 ((TH1F*)hdata)->SetBinContent(10,empty);
936 ((TH1F*)hdata)->SetBinContent(11,excludeddriftregion);
937 ((TH1F*)hdata)->SetBinContent(12,emptydr);
938 ((TH1F*)hdata)->SetBinContent(13,exactive);
939 ((TH1F*)hdata)->SetBinContent(14,emptydiff);
940 ((TH1F*)hdata)->SetBinContent(15,exactivedriftregion);
941 ((TH1F*)hdata)->SetBinContent(16,emptydr);
942
943 //layer 3
944 ((TH1F*)hdata)->SetBinContent(19,activemoduleperlayer[0]);
945 ((TH1F*)hdata)->SetBinContent(20,filledmodules[0]);
946 ((TH1F*)hdata)->SetBinContent(21,activedrperlayer[0]);
947 ((TH1F*)hdata)->SetBinContent(22,filleddriftregion[0]);
948 ((TH1F*)hdata)->SetBinContent(23,excludedmoduleperlayer[0]);
949 ((TH1F*)hdata)->SetBinContent(24,emptymodules[0]);
950 ((TH1F*)hdata)->SetBinContent(25,excludeddrperlayer[0]);
951 ((TH1F*)hdata)->SetBinContent(26,emptydriftregion[0]);
952 ((TH1F*)hdata)->SetBinContent(27,exactivemoduleperlayer[0]);
953 ((TH1F*)hdata)->SetBinContent(28,emptyactivemoduleperlayer[0]);
954 ((TH1F*)hdata)->SetBinContent(29,activedrperlayer[0]);
955 ((TH1F*)hdata)->SetBinContent(30,emptyactivedrperlayer[0]);
956
957 //layer 4
958 ((TH1F*)hdata)->SetBinContent(35,activemoduleperlayer[1]);
959 ((TH1F*)hdata)->SetBinContent(36,filledmodules[1]);
960 ((TH1F*)hdata)->SetBinContent(37,activedrperlayer[1]);
961 ((TH1F*)hdata)->SetBinContent(38,filleddriftregion[1]);
962 ((TH1F*)hdata)->SetBinContent(39,excludedmoduleperlayer[1]);
963 ((TH1F*)hdata)->SetBinContent(40,emptymodules[1]);
964 ((TH1F*)hdata)->SetBinContent(41,excludeddrperlayer[1]);
965 ((TH1F*)hdata)->SetBinContent(42,emptydriftregion[1]);
966 ((TH1F*)hdata)->SetBinContent(43,exactivemoduleperlayer[1]);
967 ((TH1F*)hdata)->SetBinContent(44,emptyactivemoduleperlayer[1]);
968 ((TH1F*)hdata)->SetBinContent(45,activedrperlayer[1]);
969 ((TH1F*)hdata)->SetBinContent(46,emptyactivedrperlayer[1]);
970
971 }
972 }//if hadata
973
974 }//end while
975
976 }//end else
977 delete hmodule;
978 hmodule=NULL;
979 for(Int_t i=0;i<2;i++) {
980 delete hlayer[i];
981 hlayer[i]=NULL;
982 }//end for
983
984
985 //SDDQACheckerValue=1.;
986 }//end recpoint list uid = 20
8db5c9f9 987 else if(uidrec==40)
988 {
989 //digitsr
990 if (list->GetEntries() == 0){
991 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
992 break;
993 } else{
994
995 while( (hdata = dynamic_cast<TH1* >(next())) ){
996 if (hdata){
997 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
998 else {
999 TString hname=hdata->GetName();
1000 if(hname.Contains("SDD DIGITS Module Pattern")) {
1001 //see raws
1002
1003 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1004 } else if(hname.Contains("SDD Anode Distribution")) {
1005 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1006 } else if(hname.Contains("SDD Tbin Distribution")) {
1007 //to do as rp
1008 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1009 } else if(hname.Contains("SDD ADC Counts Distribution")) {
1010 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1011 }//end adc counts
1012
1013 }//end entries !=0
1014 }//end hdata
1015 }//end while
1016 }//end else
1017 SDDQACheckerValue=1.;
1018 }
1019
6bf3d857 1020 }
1021 break;
1022 case AliQAv1::kANA:
1023 {
80118b05 1024 AliInfo(Form("===================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
78fb0b3d 1025 SDDQACheckerValue=1.;
6bf3d857 1026 }
1027 break;
1028 case AliQAv1::kESD:
1029 {
80118b05 1030 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
78fb0b3d 1031 SDDQACheckerValue=1.;
6bf3d857 1032 }
1033 break;
1034 case AliQAv1::kNTASK:{
1035 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
1036 SDDQACheckerValue=1.;
1037 }
1038 break;
1039 case AliQAv1::kSIM:{
1040 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
1041 Int_t uid=list->GetUniqueID();
1042 if(uid==60) {
1043 //digits
1044 if (list->GetEntries() == 0){
1045 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1046 break;
1047 } else{
1048
1049 while( (hdata = dynamic_cast<TH1* >(next())) ){
1050 if (hdata){
1051 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1052 else {
1053 TString hname=hdata->GetName();
1054 if(hname.Contains("SDDDIGITSModulePattern")) {
1055 //see raws
1056
1057 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1058 } else if(hname.Contains("SDDAnodeDistribution")) {
1059 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1060 } else if(hname.Contains("SDDTbinDistribution")) {
1061 //to do as rp
1062 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1063 } else if(hname.Contains("SDDADCCountsDistribution")) {
1064 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1065 }//end adc counts
1066
1067 }//end entries !=0
1068 }//end hdata
1069 }//end while
1070 }//end else
1071 } else if(uid==50)
1072 {
1073 //hits
1074 if (list->GetEntries() == 0){
1075 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
1076 break;
1077 }
1078 else{
1079
1080 while( (hdata = dynamic_cast<TH1* >(next())) ){
1081 if (hdata){
1082 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1083 else {
1084 TString hname=hdata->GetName();
1085 if(hname.Contains("SDDHITSModulePattern")) {
1086 //to do as raws
1087 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1088 } else if(hname.Contains("SDDHITlenghtalonglocalYCoord")) {
1089 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1090 } else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom")) {
1091 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1092 } else if(hname.Contains("SDDDepositedEnergyDistribution")) {
1093 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1094 }//end deposited energy
1095
1096 }//end entries !=0
1097 }//end hdata
1098 }//end while
1099 }//end else
1100 } else if(uid==70)
1101 {
1102 //sdigits
78fb0b3d 1103 if (list->GetEntries() == 0){
1104 SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
6bf3d857 1105 break;
78fb0b3d 1106 } else{
6bf3d857 1107
78fb0b3d 1108 while( (hdata = dynamic_cast<TH1* >(next())) ){
1109 if (hdata){
1110 if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
1111 else {
1112 TString hname=hdata->GetName();
6bf3d857 1113 if(hname.Contains("SDDSDIGITSModulePattern")) {
1114 //to do as raws
78fb0b3d 1115 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1116 } else if(hname.Contains("SDDAnodeDistribution")) {
1117 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1118 } else if(hname.Contains("SDDTbinDistribution")) {
1119 //to do as rp
1120 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
1121 } else if(hname.Contains("SDDADCCountsDistribution")) {
1122 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
6bf3d857 1123 }//end adc counts bindistribution
78fb0b3d 1124 }//end entries !=0
1125 }//end hdata
1126 }//end while
1127 }//end else
6bf3d857 1128 }//end sdigits
1129 SDDQACheckerValue=1.;
1130 }
1131 break;
1132
1133 }//end switch
1134
80118b05 1135 fCalibration=NULL;
d2f99642 1136 if(hdata) delete hdata;
6bf3d857 1137
1138
78fb0b3d 1139 return SDDQACheckerValue;
5b716935 1140}
6bf3d857 1141
3647765c 1142//__________________________________________________________________
80b9610c 1143void AliITSQASDDChecker::SetTaskOffset(Int_t taskoffset)
1144{
f09c0b42 1145 //set the number of the histograms already present in the list before the SDD histograms
80b9610c 1146 fSubDetOffset = taskoffset;
1147}
1148
1149
1150//__________________________________________________________________
f09c0b42 1151void AliITSQASDDChecker::SetStepBit(const Double_t *steprange)
80b9610c 1152{
f09c0b42 1153 //set the values of the step bit for each QA bit range calculated in the AliITSQAChecker class
80b9610c 1154 fStepBitSDD = new Double_t[AliQAv1::kNBIT];
1155 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
1156 {
1157 fStepBitSDD[bit]=steprange[bit];
1158 }
1159}
1160
1161//__________________________________________________________________
f09c0b42 1162void AliITSQASDDChecker::SetSDDLimits(const Float_t *lowvalue, const Float_t * highvalue)
3647765c 1163{
f09c0b42 1164 //set the low and high values in for each QA bit range calculated in the AliITSQAChecker class
80b9610c 1165 fLowSDDValue = new Float_t[AliQAv1::kNBIT];
1166 fHighSDDValue= new Float_t[AliQAv1::kNBIT];
1167
1168 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
1169 {
1170 fLowSDDValue[bit]=lowvalue[bit];
1171 fHighSDDValue[bit]= highvalue[bit];
1172 }
1173
3647765c 1174}
8db5c9f9 1175//__________________________________________________________________
1176Bool_t AliITSQASDDChecker::MakeSDDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode)
1177{
1178 Bool_t rval=kFALSE;
1179 fImage=(TCanvas**)AliQAChecker::Instance()->GetDetQAChecker(0)->GetImage();
1180 //create the image for raws and recpoints. In the other case, the default methodof CheckerBase class will be used
1181 switch(task)
1182 {
1183 case AliQAv1::kRAWS:{
1184 rval=MakeSDDRawsImage(list, task,mode);
1185 }
1186 break;
1187 case AliQAv1::kRECPOINTS:{ rval=MakeSDDRecPointsImage(list, task,mode); }
1188 break;
1189 case AliQAv1::kHITS:; case AliQAv1::kESDS:; case AliQAv1::kDIGITS:;case AliQAv1::kDIGITSR:;case AliQAv1::kSDIGITS:;case AliQAv1::kTRACKSEGMENTS:;case AliQAv1::kRECPARTICLES:; default:
1190 {
1191 rval=kFALSE;
1192 //AliQAChecker::Instance()->GetDetQAChecker(0)->MakeImage(list,task,mode);
1193 }
1194 break;
1195 case AliQAv1::kNULLTASKINDEX:; case AliQAv1::kNTASKINDEX:
1196 {AliWarning(Form("No histograms for this task ( %s ) \n", AliQAv1::GetTaskName(task).Data())); rval=kFALSE;}
1197 break;
1198 }
1199return rval;
1200}
1201
1202
1203//_______________________________________________________________________
1204Bool_t AliITSQASDDChecker::MakeSDDRawsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
1205{
1206
1207 for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
1208 //printf("-------------------------> %i \n", esIndex);
1209 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0)
1210 {//printf ("Nothing for %s \n", AliRecoParam::GetEventSpecieName(esIndex));
1211 continue;
1212 }
1213 else{
1214 const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ;
1215 if ( !fImage[esIndex] ) {
1216 fImage[esIndex] = new TCanvas(title, title,1280,980) ;
1217 }
1218
1219 fImage[esIndex]->Clear() ;
1220 fImage[esIndex]->SetTitle(title) ;
1221 fImage[esIndex]->cd();
1222
1223 TPaveText someText(0.015, 0.015, 0.98, 0.98);
1224 someText.AddText(title);
1225 someText.Draw();
1226 fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ;
1227 fImage[esIndex]->Clear() ;
1228 Int_t nx =2; //TMath::Nint(TMath::Sqrt(nImages));
8a55554e 1229 Int_t ny =2; // nx ;
8db5c9f9 1230 //if (nx < TMath::Sqrt(nImages))
1231 //ny++ ;
1232 fImage[esIndex]->Divide(nx, ny) ;
1233 TIter nexthist(list[esIndex]) ;
1234 TH1* hist = NULL ;
1235 Int_t npad = 1 ;
1236 fImage[esIndex]->cd(npad);
1237 fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
1238 while ( (hist=static_cast<TH1*>(nexthist())) ) {
1239 //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
1240 TString cln(hist->ClassName()) ;
1241 if ( ! cln.Contains("TH") )
1242 continue ;
1243
1244 if(hist->TestBit(AliQAv1::GetImageBit())) {
1245 hist->GetXaxis()->SetTitleSize(0.02);
1246 hist->GetYaxis()->SetTitleSize(0.02);
1247 hist->GetXaxis()->SetLabelSize(0.02);
1248 hist->GetYaxis()->SetLabelSize(0.02);
1249 if(cln.Contains("TH2"))
1250 {
1251 gPad->SetRightMargin(0.15);
1252 gPad->SetLeftMargin(0.05);
1253 hist->SetStats(0);
1254 hist->SetOption("colz") ;
1255 //hist->GetListOfFunctions()->FindObject("palette")->SetLabelSize(0.025);
1256 //gPad->Update();
1257 }
1258 hist->DrawCopy() ;
1259 fImage[esIndex]->cd(++npad) ;
1260 fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
1261 }
1262 }
1263 fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ;
1264 }
1265 }
1266 return kTRUE;
1267}
1268
1269
1270
1271
1272//_______________________________________________________________________
1273Bool_t AliITSQASDDChecker::MakeSDDRecPointsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
1274{
80b9610c 1275
8db5c9f9 1276 for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
1277 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0)
1278 {
1279 //printf ("Nothing for %s \n", AliQAv1::GetTaskName(task).Data());
1280 continue;
1281 }
1282 const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ;
1283 if ( !fImage[esIndex] ) {
1284 fImage[esIndex] = new TCanvas(title, title,1280,980) ;
1285 }
1286 fImage[esIndex]->Clear() ;
1287 fImage[esIndex]->SetTitle(title) ;
1288 fImage[esIndex]->cd();
1289 fImage[esIndex]->SetBorderMode(0) ;
1290 TPaveText someText(0.015, 0.015, 0.98, 0.98);
1291 someText.AddText(title);
1292 someText.Draw();
1293 fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ;
1294 fImage[esIndex]->Clear() ;
1295 Int_t nx =2; //TMath::Nint(TMath::Sqrt(nImages));
1296 Int_t ny =4; // nx ;
1297 //if (nx < TMath::Sqrt(nImages))
1298 //ny++ ;
1299 fImage[esIndex]->Divide(nx, ny) ;
1300 TIter nexthist(list[esIndex]) ;
1301 TH1* hist = NULL ;
1302 Int_t npad = 1 ;
1303 fImage[esIndex]->cd(npad) ;
1304 fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
1305 while ( (hist=static_cast<TH1*>(nexthist())) ) {
1306 //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
1307 TString cln(hist->ClassName()) ;
1308 //printf("=====================> Class name %s \n",cln.Data());
1309 if ( ! cln.Contains("TH") )
1310 continue ;
1311 if(hist->TestBit(AliQAv1::GetImageBit())) {
1312 hist->GetXaxis()->SetTitleSize(0.02);
1313 hist->GetYaxis()->SetTitleSize(0.02);
1314 hist->GetXaxis()->SetLabelSize(0.02);
1315 hist->GetYaxis()->SetLabelSize(0.02);
1316 if(cln.Contains("TH1"))
1317 {
1318 hist->SetFillColor(kOrange+7);
1319 //SetFrameFillColor(kAzure-9);
1320 //hist->DrawCopy() ;
1321 }
1322 if(cln.Contains("TH2"))
1323 {
1324 gPad->SetRightMargin(0.15);
1325 gPad->SetLeftMargin(0.05);
1326 hist->SetStats(0);
1327 hist->SetOption("colz") ;
1328 // TPaletteAxis *paletta =(TPaletteAxis*)hist->GetListOfFunctions()->FindObject("palette");
1329 //paletta->SetLabelSize(0.025);
1330 //gPad->Update();
1331 }
1332 hist->DrawCopy();
1333 fImage[esIndex]->cd(++npad) ;
1334 fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
1335 }
1336 }
1337 fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ;
1338 }
1339 // }
1340 return kTRUE;
1341}