Line data Source code
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 : // first implementation: P. Cerello Apr 2008
22 : // last review: F. Prino Apr 2015
23 : // INFN Torino
24 :
25 : // --- ROOT system ---
26 : #include "TH1.h"
27 : #include <TH1D.h>
28 : #include <TH2.h>
29 : #include "TCanvas.h"
30 : #include "TPaveText.h"
31 : #include "TPad.h"
32 : //#include "TPaletteAxis.h"
33 : // --- AliRoot header files ---
34 : #include "AliITSQADataMakerRec.h"
35 : #include "AliITSQASDDChecker.h"
36 : #include "AliLog.h"
37 : #include "AliCDBEntry.h"
38 : #include "AliCDBManager.h"
39 : #include "AliITSCalibrationSDD.h"
40 : #include "AliITSgeomTGeo.h"
41 : #include "AliQAManager.h"
42 : #include "AliQAv1.h"
43 : #include "AliQAChecker.h"
44 : #include "AliQACheckerBase.h"
45 :
46 :
47 118 : ClassImp(AliITSQASDDChecker)
48 :
49 :
50 :
51 : //_____________________________________________________________________
52 :
53 3 : AliITSQASDDChecker::AliITSQASDDChecker():TObject(),
54 3 : fSubDetOffset(0),
55 3 : fStepBitSDD(NULL),
56 3 : fLowSDDValue(NULL),
57 3 : fHighSDDValue(NULL),
58 3 : fCalibration(NULL),
59 3 : fThresholdForRelativeOccupancy(0.01),
60 3 : fThresholdForRecToRawRatio(0.04),
61 3 : fImage(NULL),
62 3 : fESforCheck(0)
63 15 : {
64 : // Default constructor
65 6 : fStepBitSDD=new Double_t[AliQAv1::kNBIT];
66 6 : fLowSDDValue=new Float_t[AliQAv1::kNBIT];
67 6 : fHighSDDValue=new Float_t[AliQAv1::kNBIT];
68 :
69 30 : for(Int_t ibit=0;ibit<AliQAv1::kNBIT;ibit++){
70 12 : fStepBitSDD[ibit]=0.;
71 12 : fLowSDDValue[ibit]=0.;
72 12 : fHighSDDValue[ibit]=0.;
73 : }
74 36 : for(Int_t i=0;i<AliRecoParam::kNSpecies;i++) fPaveText[i] = NULL;
75 6 : } // ctor
76 :
77 :
78 :
79 : AliITSQASDDChecker::~AliITSQASDDChecker()
80 0 : {
81 : //destructor
82 0 : delete[] fStepBitSDD ;
83 0 : delete[]fLowSDDValue;
84 0 : delete[]fHighSDDValue;
85 0 : delete fCalibration;
86 0 : delete []fImage;
87 :
88 0 : for(Int_t i=0;i<AliRecoParam::kNSpecies;i++) {
89 0 : delete fPaveText[i];
90 : }
91 0 : } // dtor
92 :
93 : //__________________________________________________________________
94 : Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * list, const AliDetectorRecoParam * /*recoparam*/)
95 : {
96 : //check histograms of the different lists
97 0 : AliInfo(Form("AliITSQASDDChecker called with offset: %d \t and specie %d", fSubDetOffset,fESforCheck));
98 :
99 0 : AliDebug(1,Form("AliITSQASDDChecker called with offset: %d", fSubDetOffset));
100 :
101 : Double_t sddQACheckerValue = 0.;
102 : TH1 *hdata=NULL;
103 :
104 0 : if(!fCalibration){
105 0 : AliCDBEntry *calibSDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
106 0 : Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
107 0 : if(!calibSDD)
108 : {
109 0 : AliError("Calibration object retrieval failed! SDD will not be processed");
110 0 : fCalibration = NULL;
111 0 : sddQACheckerValue= fHighSDDValue[AliQAv1::kWARNING];
112 0 : }
113 : else{
114 0 : fCalibration = (TObjArray *)calibSDD->GetObject();
115 :
116 0 : if(!cacheStatus)calibSDD->SetObject(NULL);
117 0 : calibSDD->SetOwner(kTRUE);
118 0 : if(!cacheStatus)
119 : {
120 0 : delete calibSDD;
121 : }
122 : }//end calibsdd
123 0 : }//end fcalibration
124 :
125 0 : AliInfo("Calib SDD Created");
126 :
127 0 : TIter next(list);
128 :
129 0 : switch(index) {
130 : case AliQAv1::kRAW:{
131 :
132 0 : AliInfo(Form("Check on %s",AliQAv1::GetAliTaskName(index)));
133 0 : if (list->GetEntries() == 0){
134 0 : AliError("Raw List for SDD is empty");
135 0 : sddQACheckerValue += fHighSDDValue[AliQAv1::kFATAL];
136 0 : break;
137 : }
138 : TH1 *hmodule=NULL;
139 0 : TH2 *hlayer[2];
140 : hdata=NULL;
141 0 : for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
142 :
143 : //check counters
144 0 : Int_t counters[kNumOfSDDCheckerCounters][3];
145 0 : for(Int_t ic=0; ic<kNumOfSDDCheckerCounters; ic++){
146 0 : for(Int_t jl=0; jl<3; jl++){
147 0 : counters[ic][jl]=0;
148 : }
149 : }
150 :
151 : Int_t neventsraw=0;
152 :
153 : //take the number of events
154 :
155 0 : while( (hdata = dynamic_cast<TH1* >(next())) ){
156 0 : if (hdata){
157 0 : TString hname=hdata->GetName();
158 0 : if(hname.Contains("SDDRawDataCheck")){
159 0 : neventsraw=(Int_t)hdata->GetBinContent(1);
160 0 : }
161 0 : if(hname.Contains("SDDModPattern")){
162 0 : if(hname.Contains("NORM")) continue;
163 0 : hmodule=(TH1*)hdata->Clone("hmoduleOcc_temp");
164 0 : if(hdata->GetEntries()<0.1){
165 0 : AliWarning(Form("===================>>>>>> No entries in %s",hname.Data()));
166 : }
167 : }
168 0 : if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){
169 0 : if(hname.Contains("NORM"))continue;
170 : Int_t layer=0;
171 0 : if(hname.Contains("3"))layer=0;
172 0 : else if(hname.Contains("4"))layer=1;
173 0 : hlayer[layer]=(TH2*)hdata->Clone(Form("%s_copy",hname.Data()));
174 0 : if(hdata->GetEntries()<0.1){
175 0 : AliWarning(Form("===================>>>>>> No entries in %s",hname.Data()));
176 : }
177 0 : }//end check on phiz
178 0 : }//end if hdata
179 : }//end while
180 :
181 0 : if(hmodule || (hlayer[0] && hlayer[1])){
182 0 : FillCounters(counters,hmodule,hlayer[0],hlayer[1]);
183 :
184 0 : for(Int_t i=0;i<2;i++){
185 0 : AliInfo(Form("Layer %i \tempty modules %i \t filled modules %i", i+3,counters[kEmptyMod][i], counters[kFilledMod][i]));
186 0 : AliInfo(Form("Layer %i \tempty single drift regions %i \t filled single drift regions %i",i+3,counters[kEmptyWing][i], counters[kFilledWing][i]));
187 : }
188 :
189 0 : for(Int_t ic=0; ic<kNumOfSDDCheckerCounters; ic++){
190 0 : counters[ic][2]=counters[ic][0]+counters[ic][1];
191 : }
192 :
193 0 : AliInfo(Form("In total %d modules and %d single drift regions took data. ",counters[kFilledMod][2], counters[kFilledWing][2]));
194 0 : AliInfo(Form("In total %d modules and %d single drift regions were empty",counters[kEmptyMod][2],counters[kEmptyWing][2]));
195 :
196 0 : next.Begin();
197 : Int_t outputLay3=0,outputLay4=0,outputAll=0;
198 0 : while( (hdata=dynamic_cast<TH1* >(next())) ) {
199 0 : if (hdata){
200 0 : TString hname=hdata->GetName();
201 0 : if(hname.Contains("NORM"))continue;
202 0 : if(hname.Contains("SDDModPattern")){
203 0 : TPaveText *ptext = ((TPaveText *)hdata->GetListOfFunctions()->FindObject("TPave"));
204 0 : outputAll=CheckCounters(counters,2,neventsraw,ptext);
205 0 : }
206 0 : if(hname.Contains("SDDphizL3")){
207 0 : TPaveText *ptext = ((TPaveText *)hdata->GetListOfFunctions()->FindObject("TPave"));
208 0 : outputLay3=CheckCounters(counters,0,neventsraw,ptext);
209 0 : }else if(hname.Contains("SDDphizL4")){
210 0 : TPaveText *ptext = ((TPaveText *)hdata->GetListOfFunctions()->FindObject("TPave"));
211 0 : outputLay4=CheckCounters(counters,1,neventsraw,ptext);
212 0 : } else if(hname.Contains("SDDRawDataCheck")) {
213 0 : for(Int_t ic=0; ic<kNumOfSDDCheckerCounters; ic++){
214 0 : ((TH1F*)hdata)->SetBinContent(5+ic,counters[ic][2]);
215 : //layer 3
216 0 : ((TH1F*)hdata)->SetBinContent(19+ic,counters[ic][0]);
217 : //layer 4
218 0 : ((TH1F*)hdata)->SetBinContent(33+ic,counters[ic][1]);
219 : }
220 0 : }
221 0 : }
222 : }
223 0 : if(outputLay3==fHighSDDValue[AliQAv1::kERROR] || outputLay4==fHighSDDValue[AliQAv1::kERROR]) sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
224 0 : else if(outputLay3==fHighSDDValue[AliQAv1::kWARNING] || outputLay4==fHighSDDValue[AliQAv1::kWARNING]) sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
225 0 : else sddQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
226 0 : }
227 :
228 0 : delete hmodule;
229 : hmodule=NULL;
230 0 : for(Int_t i=0;i<2;i++) {
231 0 : delete hlayer[i];
232 0 : hlayer[i]=NULL;
233 : }
234 :
235 0 : }//end raw
236 :
237 0 : break;
238 :
239 : case AliQAv1::kNULLTASK:{
240 0 : AliInfo(Form("No Check on %s",AliQAv1::GetAliTaskName(index)));
241 : sddQACheckerValue=1.;
242 : }
243 0 : break;
244 :
245 : case AliQAv1::kREC:{
246 :
247 0 : Int_t uidrec=list->GetUniqueID();
248 0 : AliInfo(Form("Check on %s",AliQAv1::GetAliTaskName(index)));
249 0 : if(uidrec==20){
250 : //recpoints
251 0 : if (list->GetEntries() == 0){ //check if the list is empty
252 : //printf("sddQACheckerValue = %f \t value %f\n",sddQACheckerValue,fHighSDDValue[AliQAv1::kFATAL]);
253 0 : sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
254 : //break;
255 0 : }//end if getentries
256 :
257 :
258 : TH1 *hmodule=NULL;
259 0 : TH2 *hlayer[2];
260 : hdata=NULL;
261 0 : for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
262 :
263 : //check counters
264 0 : Int_t counters[kNumOfSDDCheckerCounters][3];
265 0 : for(Int_t ic=0; ic<kNumOfSDDCheckerCounters; ic++){
266 0 : for(Int_t jl=0; jl<3; jl++){
267 0 : counters[ic][jl]=0;
268 : }
269 : }
270 :
271 0 : TString results1;
272 0 : TString results2;
273 : Int_t neventsrecpoints=0;
274 :
275 0 : while( (hdata = dynamic_cast<TH1* >(next())) ){
276 0 : if (hdata){
277 0 : TString hname=hdata->GetName();
278 0 : if(hname.Contains("SDDRecPointCheck")){
279 0 : neventsrecpoints=(Int_t)hdata->GetBinContent(1);
280 0 : }
281 0 : if(hname.Contains("SDDModPatternRP")){
282 0 : if(hname.Contains("NORM")) continue;
283 0 : hmodule=(TH1*)hdata->Clone();
284 0 : if(hdata->GetEntries()<0.1){
285 0 : AliWarning(Form("===================>>>>>> No entries in %s ",hname.Data()));
286 : }
287 : }
288 0 : if(hname.Contains("SDDModPatternL3RP") || hname.Contains("SDDModPatternL4RP")){
289 0 : if(hname.Contains("NORM"))continue;
290 : Int_t layer=0;
291 0 : if(hname.Contains("3"))layer=0;
292 0 : else if(hname.Contains("4"))layer=1;
293 0 : hlayer[layer]=(TH2*)hdata->Clone(Form("%s_copy",hname.Data()));
294 0 : if(hdata->GetEntries()<0.1){
295 0 : AliWarning(Form("===================>>>>>> No entries in %s ",hname.Data()));
296 : }
297 0 : }//end check on phiz
298 0 : }//end if hdata
299 : }//end while
300 :
301 0 : if(hmodule || (hlayer[0] && hlayer[1])){
302 0 : FillCounters(counters,hmodule,hlayer[0],hlayer[1]);
303 :
304 0 : for(Int_t i=0;i<2;i++){
305 0 : AliInfo(Form("Layer %i \tempty modules %i \t filled modules %i", i+3,counters[kEmptyMod][i], counters[kFilledMod][i]));
306 0 : AliInfo(Form("Layer %i \tempty single drift regions %i \t filled single drift regions %i",i+3,counters[kEmptyWing][i], counters[kFilledWing][i]));
307 : }
308 :
309 0 : for(Int_t ic=0; ic<kNumOfSDDCheckerCounters; ic++){
310 0 : counters[ic][2]=counters[ic][0]+counters[ic][1];
311 : }
312 :
313 0 : AliInfo(Form("In total %d modules and %d single drift regions took data. ",counters[kFilledMod][2], counters[kFilledWing][2]));
314 0 : AliInfo(Form("In total %d modules and %d single drift regions were empty",counters[kEmptyMod][2],counters[kEmptyWing][2]));
315 :
316 :
317 0 : next.Begin();
318 : Int_t outputLay3=0,outputLay4=0;;
319 0 : while( (hdata=dynamic_cast<TH1* >(next())) ) {
320 0 : if (hdata){
321 0 : TString hname=hdata->GetName();
322 0 : if(hname.Contains("NORM"))continue;
323 0 : if(hname.Contains("SDDModPatternL3RP")){
324 0 : TPaveText *ptext = ((TPaveText *)hdata->GetListOfFunctions()->FindObject("TPave"));
325 0 : outputLay3=CheckCounters(counters,0,neventsrecpoints,ptext);
326 0 : }else if(hname.Contains("SDDModPatternL4RP")){
327 0 : TPaveText *ptext = ((TPaveText *)hdata->GetListOfFunctions()->FindObject("TPave"));
328 0 : outputLay4=CheckCounters(counters,1,neventsrecpoints,ptext);
329 0 : }else if(hname.Contains("SDDRecPointCheck")) {
330 0 : for(Int_t ic=0; ic<kNumOfSDDCheckerCounters; ic++){
331 0 : ((TH1F*)hdata)->SetBinContent(5+ic,counters[ic][2]);
332 : //layer 3
333 0 : ((TH1F*)hdata)->SetBinContent(19+ic,counters[ic][0]);
334 : //layer 4
335 0 : ((TH1F*)hdata)->SetBinContent(33+ic,counters[ic][1]);
336 : }
337 0 : }
338 0 : }
339 : }
340 0 : }
341 :
342 0 : delete hmodule;
343 : hmodule=NULL;
344 0 : for(Int_t i=0;i<2;i++) {
345 0 : delete hlayer[i];
346 0 : hlayer[i]=NULL;
347 : }
348 :
349 0 : }//end recpoint list uid = 20
350 0 : if(uidrec==40){
351 : //digitsr
352 0 : if (list->GetEntries() == 0){
353 0 : sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
354 0 : break;
355 : } else{
356 :
357 0 : while( (hdata = dynamic_cast<TH1* >(next())) ){
358 0 : if (hdata){
359 0 : if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
360 : else {
361 0 : TString hname=hdata->GetName();
362 0 : if(hname.Contains("SDD DIGITS Module Pattern")) {
363 : //see raws
364 :
365 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
366 0 : } else if(hname.Contains("SDD Anode Distribution")) {
367 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
368 0 : } else if(hname.Contains("SDD Tbin Distribution")) {
369 : //to do as rp
370 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
371 0 : } else if(hname.Contains("SDD ADC Counts Distribution")) {
372 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
373 0 : }//end adc counts
374 :
375 0 : }//end entries !=0
376 : }//end hdata
377 : }//end while
378 : }//end else
379 : sddQACheckerValue=1.;
380 0 : }
381 :
382 0 : }
383 : break;
384 : case AliQAv1::kANA:
385 : {
386 0 : AliInfo(Form("===================> No Check on %s",AliQAv1::GetAliTaskName(index)));
387 : sddQACheckerValue=1.;
388 : }
389 0 : break;
390 : case AliQAv1::kESD:
391 : {
392 0 : AliInfo(Form("==================> No Check on %s",AliQAv1::GetAliTaskName(index)));
393 : sddQACheckerValue=1.;
394 : }
395 0 : break;
396 : case AliQAv1::kNTASK:{
397 0 : AliInfo(Form("==================> No Check on %s",AliQAv1::GetAliTaskName(index)));
398 : sddQACheckerValue=1.;
399 : }
400 0 : break;
401 : case AliQAv1::kSIM:{
402 0 : AliInfo(Form("Check on %s",AliQAv1::GetAliTaskName(index)));
403 0 : Int_t uid=list->GetUniqueID();
404 0 : if(uid==60) {
405 : //digits
406 0 : if (list->GetEntries() == 0){
407 0 : sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
408 0 : break;
409 : } else{
410 :
411 0 : while( (hdata = dynamic_cast<TH1* >(next())) ){
412 0 : if (hdata){
413 0 : if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
414 : else {
415 0 : TString hname=hdata->GetName();
416 0 : if(hname.Contains("SDDDIGITSModulePattern")) {
417 : //see raws
418 :
419 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
420 0 : } else if(hname.Contains("SDDAnodeDistribution")) {
421 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
422 0 : } else if(hname.Contains("SDDTbinDistribution")) {
423 : //to do as rp
424 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
425 0 : } else if(hname.Contains("SDDADCCountsDistribution")) {
426 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
427 0 : }//end adc counts
428 :
429 0 : }//end entries !=0
430 : }//end hdata
431 : }//end while
432 : }//end else
433 0 : } else if(uid==50)
434 : {
435 : //hits
436 0 : if (list->GetEntries() == 0){
437 0 : sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
438 0 : break;
439 : }
440 : else{
441 :
442 0 : while( (hdata = dynamic_cast<TH1* >(next())) ){
443 0 : if (hdata){
444 0 : if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
445 : else {
446 0 : TString hname=hdata->GetName();
447 0 : if(hname.Contains("SDDHITSModulePattern")) {
448 : //to do as raws
449 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
450 0 : } else if(hname.Contains("SDDHITlenghtalonglocalYCoord")) {
451 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
452 0 : } else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom")) {
453 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
454 0 : } else if(hname.Contains("SDDDepositedEnergyDistribution")) {
455 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
456 0 : }//end deposited energy
457 :
458 0 : }//end entries !=0
459 : }//end hdata
460 : }//end while
461 : }//end else
462 0 : } else if(uid==70)
463 : {
464 : //sdigits
465 0 : if (list->GetEntries() == 0){
466 0 : sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
467 0 : break;
468 : } else{
469 :
470 0 : while( (hdata = dynamic_cast<TH1* >(next())) ){
471 0 : if (hdata){
472 0 : if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
473 : else {
474 0 : TString hname=hdata->GetName();
475 0 : if(hname.Contains("SDDSDIGITSModulePattern")) {
476 : //to do as raws
477 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
478 0 : } else if(hname.Contains("SDDAnodeDistribution")) {
479 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
480 0 : } else if(hname.Contains("SDDTbinDistribution")) {
481 : //to do as rp
482 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
483 0 : } else if(hname.Contains("SDDADCCountsDistribution")) {
484 0 : sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];
485 0 : }//end adc counts bindistribution
486 0 : }//end entries !=0
487 :
488 : }//end hdata
489 : }//end while
490 : }//end else
491 : }//end sdigits
492 : sddQACheckerValue=1.;
493 0 : }
494 : break;
495 :
496 : }//end switch
497 :
498 0 : fCalibration=NULL;
499 : return sddQACheckerValue;
500 0 : }
501 :
502 :
503 : //__________________________________________________________________
504 : void AliITSQASDDChecker::FillCounters(Int_t counters[kNumOfSDDCheckerCounters][3], TH1* hmodule, TH2* hlay3, TH2* hlay4){
505 : // fill the counters of module filling
506 0 : for(Int_t imod=0;imod<fgknSDDmodules;imod++){
507 0 : Int_t lay=0;
508 0 : Int_t lad=0;
509 0 : Int_t det=0;
510 0 : Int_t module=imod+fgkmodoffset;
511 0 : AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
512 0 : if(cal==0) continue;
513 0 : AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
514 0 : if (cal->IsBad()){
515 0 : counters[kExcludedMod][lay-3]++;
516 : Double_t content=0.;
517 0 : 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
518 0 : if(AliITSQADataMakerRec::AreEqual(content,0.)== kFALSE) {
519 0 : counters[kFilledMod][lay-3]++;
520 0 : counters[kExcludedButFilledMod][lay-3]++;
521 0 : AliError(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data ",module,lay,lad,det));
522 0 : }else{
523 0 : counters[kEmptyMod][lay-3]++; //it has to be empty
524 : }
525 0 : } else { // module is good
526 : Int_t sideFilled=0;
527 : Int_t sideActive=0;
528 0 : for(Int_t i=0;i<2;i++){
529 0 : if(cal->IsWingBad(i)==kFALSE) sideActive+=(1<<i);
530 : Double_t counts=0.;
531 0 : if(lay==3 && hlay3) counts=hlay3->GetBinContent(2*det+i-1,lad);
532 0 : else if(lay==4 && hlay4) counts=hlay4->GetBinContent(2*det+i-1,lad);
533 0 : if(counts>0.) sideFilled+=(1<<i);
534 : }
535 0 : if(sideActive==3) counters[kActiveMod][lay-3]++;
536 0 : else if(sideActive==0) counters[kExcludedMod][lay-3]++;
537 : else{
538 0 : counters[kActiveWing][lay-3]++;
539 0 : counters[kExcludedWing][lay-3]++;
540 : }
541 0 : if(sideFilled==3) counters[kFilledMod][lay-3]++;
542 0 : else if(sideFilled==0) counters[kEmptyMod][lay-3]++;
543 : else{
544 0 : counters[kEmptyWing][lay-3]++;
545 0 : counters[kFilledWing][lay-3]++;
546 : }
547 0 : if(sideFilled!=sideActive){ // error cases
548 0 : if(sideActive==3){
549 0 : if(sideFilled==0){
550 0 : AliWarning(Form("The module %d (layer %i, ladder %i det %i ) is in acquisition, but it didn't take data ",module, lay, lad, det));
551 0 : counters[kActiveButEmptyMod][lay-3]++;
552 0 : }
553 0 : else if(sideFilled ==1 || sideFilled==2){
554 0 : AliWarning(Form("The side %d of the module %d (layer %i, ladder %i det %i ) is in acquisition, but it didn't take data ",2-sideFilled,module, lay, lad, det));
555 0 : counters[kActiveButEmptyWing][lay-3]++;
556 0 : }
557 0 : }else if(sideActive==2 || sideActive==1){
558 0 : if(sideFilled==0){
559 0 : AliWarning(Form("The side %d of the module %d (layer %i, ladder %i det %i ) is in acquisition, but it didn't take data ",sideActive-1,module, lay, lad, det));
560 0 : counters[kActiveButEmptyWing][lay-3]++;
561 0 : }else if(sideFilled==1 || sideFilled==2){
562 0 : AliWarning(Form("The side %d of the module %d (layer %i, ladder %i det %i ) is in acquisition, but it didn't take data ",sideActive-1,module, lay, lad, det));
563 0 : AliError(Form("The side %d of the module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data",sideFilled-1,module,lay,lad,det));
564 0 : counters[kExcludedButFilledWing][lay-3]++;
565 0 : counters[kActiveButEmptyWing][lay-3]++;
566 0 : }else if(sideFilled==3){
567 0 : AliError(Form("The side %d of the module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data",2-sideActive,module,lay,lad,det));
568 0 : counters[kExcludedButFilledWing][lay-3]++;
569 0 : }
570 0 : }else if(sideActive==0){
571 0 : if(sideFilled==1 || sideFilled==2){
572 0 : AliError(Form("The side %d of the module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data ",sideFilled-1,module,lay,lad,det));
573 0 : counters[kExcludedButFilledWing][lay-3]++;
574 0 : }else if(sideFilled==3){
575 0 : AliError(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data",module,lay,lad,det));
576 0 : counters[kExcludedButFilledMod][lay-3]++;
577 0 : }
578 : }
579 : }
580 : }
581 0 : }
582 0 : }
583 :
584 : //__________________________________________________________________
585 : Int_t AliITSQASDDChecker::CheckCounters(Int_t counters[kNumOfSDDCheckerCounters][3], Int_t jl, Int_t nevents, TPaveText *ptext){
586 : // check the counters of module/hybrid filling
587 :
588 : Int_t numlimit=1000;
589 0 : if(AliRecoParam::ConvertIndex(GetEventSpecieForCheck())!=AliRecoParam::kCosmic) numlimit=10000;
590 :
591 0 : TString results1="";
592 0 : TString results2="";
593 : Int_t color=kBlack;
594 : Int_t textcolor=kBlack;
595 : Int_t retval=0;
596 0 : if(jl>=3) return retval;
597 : Bool_t warn=kFALSE;
598 : Bool_t err=kFALSE;
599 0 : if(jl<2) results1.Append(Form(" Layer %d:",jl+3));
600 :
601 0 : if(counters[kExcludedButFilledMod][jl]==0 && counters[kActiveButEmptyMod][jl]==0 && counters[kExcludedButFilledWing][jl]==0 && counters[kActiveButEmptyWing][jl]==0){
602 0 : 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",counters[kActiveMod][jl],counters[kActiveWing][jl],counters[kExcludedMod][jl],counters[kExcludedWing][jl]));
603 0 : results1.Append(" OK.");
604 0 : results2.Append(" All active modules and drift regions in acquisition took data");
605 : color=kGreen;
606 : textcolor=kBlack;
607 0 : retval=fHighSDDValue[AliQAv1::kINFO];
608 0 : }else{
609 0 : if(counters[kActiveButEmptyMod][jl]>0){
610 0 : results1.Append(Form(" %i good module(s) didn't take data",counters[kActiveButEmptyMod][jl]));
611 : warn=kTRUE;
612 0 : }
613 0 : if(counters[kActiveButEmptyWing][jl]>0){
614 0 : results1.Append(Form(" %i good drift regions didn't take data",counters[kActiveButEmptyWing][jl]));
615 : warn=kTRUE;
616 0 : }
617 0 : if(warn){
618 0 : if(nevents<numlimit) {
619 0 : results2.Form(" Events %d .Too few events. DO NOT CALL the Expert ",nevents);
620 : }else{
621 : err=kTRUE;
622 0 : results2.Form(" Events %d. If PHYSICS, follow the TWiki instruction and call the Expert ",nevents);
623 : }
624 : }
625 0 : if(counters[kExcludedButFilledMod][jl]!=0){
626 0 : results1.Append(Form(" %i modules excluded from the acquisition took data",counters[kExcludedButFilledMod][jl]));
627 0 : results2="Follow the TWiki instructions and Call the SDD expert ";
628 : err=kTRUE;
629 0 : }
630 0 : if(counters[kExcludedButFilledWing][jl]!=0){
631 0 : results1.Append(Form(" %i drift regions excluded from the acquisition took data",counters[kExcludedButFilledWing][jl]));
632 0 : results2="Follow the TWiki instructions and Call the SDD expert ";
633 : err=kTRUE;
634 0 : }
635 0 : if(err){
636 : color=kRed;
637 : textcolor=kWhite;
638 0 : retval=fHighSDDValue[AliQAv1::kERROR];
639 0 : AliError(results1.Data());
640 : }
641 0 : if(warn && !err){
642 : color=kYellow;
643 : textcolor=kBlack;
644 0 : retval=fHighSDDValue[AliQAv1::kWARNING];
645 0 : AliWarning(results1.Data());
646 : }
647 : }
648 0 : if(ptext) {
649 0 : ptext->Clear();
650 0 : ptext->AddText(results1.Data());
651 0 : ptext->AddText(results2.Data());
652 0 : ptext->SetFillColor(color);
653 0 : ptext->SetFillStyle(1001);
654 0 : ptext->SetTextColor(textcolor);
655 : }
656 :
657 : return retval;
658 0 : }
659 :
660 : //__________________________________________________________________
661 : void AliITSQASDDChecker::SetTaskOffset(Int_t taskoffset)
662 : {
663 : //set the number of the histograms already present in the list before the SDD histograms
664 0 : fSubDetOffset = taskoffset;
665 0 : }
666 :
667 :
668 : //__________________________________________________________________
669 : void AliITSQASDDChecker::SetStepBit(const Double_t *steprange)
670 : {
671 : //set the values of the step bit for each QA bit range calculated in the AliITSQAChecker class
672 : //if(fStepBitSDD){/*delete fStepBitSDD;*/ fStepBitSDD=NULL;}
673 : //fStepBitSDD = new Double_t[AliQAv1::kNBIT];
674 0 : for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
675 : {
676 0 : fStepBitSDD[bit]=steprange[bit];
677 : }
678 0 : }
679 :
680 : //__________________________________________________________________
681 : void AliITSQASDDChecker::SetSDDLimits(const Float_t *lowvalue, const Float_t * highvalue)
682 : {
683 : //set the low and high values in for each QA bit range calculated in the AliITSQAChecker class
684 : // fLowSDDValue = new Float_t[AliQAv1::kNBIT];
685 : // fHighSDDValue= new Float_t[AliQAv1::kNBIT];
686 :
687 33 : for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
688 : {
689 12 : fLowSDDValue[bit]=lowvalue[bit];
690 12 : fHighSDDValue[bit]= highvalue[bit];
691 : }
692 :
693 3 : }
694 : //__________________________________________________________________
695 : Bool_t AliITSQASDDChecker::MakeSDDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode)
696 : {
697 : //create the image for raws and recpoints. In the other case, the default methodof CheckerBase class will be used
698 : //
699 : Bool_t rval=kFALSE;
700 0 : fImage=(TCanvas**)AliQAChecker::Instance()->GetDetQAChecker(0)->GetImage();
701 0 : switch(task)
702 : {
703 : case AliQAv1::kRAWS:{
704 0 : rval=DrawHistos(list, task,mode);
705 : }
706 0 : break;
707 : case AliQAv1::kRECPOINTS:{
708 0 : rval=DrawHistos(list, task,mode);
709 : }
710 0 : break;
711 : case AliQAv1::kHITS:; case AliQAv1::kESDS:; case AliQAv1::kDIGITS:;case AliQAv1::kDIGITSR:;case AliQAv1::kSDIGITS:;case AliQAv1::kTRACKSEGMENTS:;case AliQAv1::kRECPARTICLES:; default:
712 : {
713 : rval=kFALSE;
714 : //AliQAChecker::Instance()->GetDetQAChecker(0)->MakeImage(list,task,mode);
715 : }
716 0 : break;
717 : case AliQAv1::kNULLTASKINDEX:; case AliQAv1::kNTASKINDEX:
718 : {
719 : Int_t ts=(Int_t)task;
720 0 : AliWarning(Form("No histograms for this task number %d", ts));
721 : rval=kFALSE;
722 : }
723 0 : break;
724 : }
725 0 : return rval;
726 : }
727 :
728 :
729 : //_______________________________________________________________________
730 : Bool_t AliITSQASDDChecker::DrawHistos(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode)
731 : {
732 : // MakeSDDRawsImage: raw data QA plots
733 :
734 0 : for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
735 0 : if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) {
736 : continue;
737 : } else {
738 0 : const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ;
739 0 : if ( !fImage[esIndex] ) {
740 0 : fImage[esIndex] = new TCanvas(title, title,1280,980) ;
741 0 : }
742 0 : fImage[esIndex]->Clear() ;
743 0 : fImage[esIndex]->SetTitle(title) ;
744 0 : fImage[esIndex]->cd();
745 0 : TPaveText someText(0.015, 0.015, 0.98, 0.98);
746 0 : someText.AddText(title);
747 0 : someText.Draw();
748 0 : fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ;
749 0 : fImage[esIndex]->Clear() ;
750 0 : if(task == AliQAv1::kRAWS) fImage[esIndex]->Divide(2,3);
751 0 : else fImage[esIndex]->Divide(2,6);
752 0 : TIter nexthist(list[esIndex]) ;
753 : TH1* hist = NULL ;
754 : Int_t npad = 1 ;
755 0 : fImage[esIndex]->cd(npad);
756 0 : fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
757 0 : while ( (hist=static_cast<TH1*>(nexthist())) ) {
758 0 : TString hname(hist->GetName());
759 0 : TString cln(hist->ClassName()) ;
760 0 : if ( ! cln.Contains("TH") ) continue ;
761 0 : if(hist->TestBit(AliQAv1::GetImageBit())) {
762 0 : hist->GetXaxis()->SetTitleSize(0.04);
763 0 : hist->GetYaxis()->SetTitleSize(0.04);
764 0 : hist->GetXaxis()->SetLabelSize(0.02);
765 0 : hist->GetYaxis()->SetLabelSize(0.02);
766 0 : if(cln.Contains("TH1") && task == AliQAv1::kRECPOINTS){
767 0 : if(!hname.Contains("Check")) hist->SetFillColor(kOrange+7);
768 : }
769 0 : if(cln.Contains("TH2")) {
770 0 : gPad->SetRightMargin(0.15);
771 0 : gPad->SetLeftMargin(0.05);
772 0 : hist->SetStats(0);
773 0 : hist->SetOption("colz") ;
774 : }
775 0 : hist->DrawCopy();
776 0 : fImage[esIndex]->cd(++npad) ;
777 0 : fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
778 : }
779 0 : }
780 0 : fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ;
781 0 : }
782 0 : }
783 0 : return kTRUE;
784 0 : }
|