AliRoot Core  3dc7879 (3dc7879)
AliQAv1.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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 /* $Id: AliQAv1.cxx 31503 2009-03-16 11:01:16Z schutz $ */
16 
18 //
19 // Quality Assurance Object//_________________________________________________________________________
20 // Quality Assurance object. The QA status is held in one word per detector,
21 // each bit corresponds to a different status.
22 // bit 0-3 : QA raised during simulation (RAW)
23 // bit 4-7 : QA raised during simulation (SIM)
24 // bit 8-11 : QA raised during reconstruction (REC)
25 // bit 12-15 : QA raised during ESD checking (ESD)
26 // bit 16-19 : QA raised during analysis (ANA)
27 // Each of the 4 bits corresponds to a severity level of increasing importance
28 // from lower to higher bit (INFO, WARNING, ERROR, FATAL)
29 //
30 //*-- Yves Schutz CERN, July 2007
32 
33 
34 #include <cstdlib>
35 // --- ROOT system ---
36 #include <TClass.h>
37 #include <TFile.h>
38 #include <TH1.h>
39 #include <TSystem.h>
40 #include <TROOT.h>
41 
42 // --- Standard library ---
43 
44 // --- AliRoot header files ---
45 #include "AliLog.h"
46 #include "AliQAv1.h"
47 
48 
49 ClassImp(AliQAv1)
50 AliQAv1 * AliQAv1::fgQA = 0x0 ;
51 TFile * AliQAv1::fgQADataFile = 0x0 ;
52 TString AliQAv1::fgQADataFileName = "QA" ; // will transform into Det.QA.run.root
53 TFile * AliQAv1::fgQARefFile = 0x0 ;
54 TString AliQAv1::fgQARefDirName = "" ;
55 TString AliQAv1::fgQARefFileName = "QA.root" ;
56 TFile * AliQAv1::fgQAResultFile = 0x0 ;
57 TString AliQAv1::fgQAResultDirName = "" ;
58 TString AliQAv1::fgQAResultFileName = "QA.root" ;
59 TString AliQAv1::fgDetNames[] = {"ITS", "TPC", "TRD", "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD",
60  "ZDC", "PMD", "T0", "VZERO", "ACORDE","AD","FIT","MFT", "HLT", "Global", "CORR" } ;
61 TString AliQAv1::fgGRPPath = "GRP/GRP/Data" ;
62 TString AliQAv1::fgTaskNames[] = {"Raws", "Hits", "SDigits", "Digits", "DigitsR", "RecPoints", "TrackSegments", "RecParticles", "ESDs"} ;
63 TString AliQAv1::fgModeNames[] = {"", "Sim", "Rec", "QA"} ;
64 const TString AliQAv1::fgkLabLocalFile = "file://" ;
65 const TString AliQAv1::fgkLabLocalOCDB = "local://" ;
66 const TString AliQAv1::fgkLabAliEnOCDB = "alien://" ;
67 const TString AliQAv1::fgkRefFileName = "QA.root" ;
68 const TString AliQAv1::fgkQAName = "QA" ;
69 const TString AliQAv1::fgkQACorrNtName = "CorrQA" ;
70 const TString AliQAv1::fgkRefOCDBDirName = "QA" ;
71 TString AliQAv1::fgRefDataDirName = "" ;
72 const TString AliQAv1::fgkQARefOCDBDefault = "alien://folder=/alice/QA/20" ;
73 const TString AliQAv1::fgkExpert = "Expert" ;
74 //
75 const UInt_t AliQAv1::fgkQAClonedBit = BIT(14); // RS: bits set to the histos or arrays of cloned histos
76 const UInt_t AliQAv1::fgkForbidCloningBit = BIT(15); // to flag the state (cloned or not) of the
77 const UInt_t AliQAv1::fgkOrigHistoKeptBit = BIT(16); // object at the given slot of fXXXQAList[]
78 //
79 const UInt_t AliQAv1::fgkExpertBit = BIT(19);
80 const UInt_t AliQAv1::fgkQABit = BIT(20) ;
81 const UInt_t AliQAv1::fgkImageBit = BIT(21) ;
82 const Int_t AliQAv1::fgkQADebugLevel = 99 ;
83 const TString AliQAv1::fgkImageFileName = "QAImage" ;
84 const TString AliQAv1::fImageFileFormat = "ps" ;
85 const UShort_t AliQAv1::fgkMaxQAObjects = 10000 ;
86 
87 //____________________________________________________________________________
89  TNamed("", ""),
90  fNdet(kNDET),
91  fNEventSpecies(AliRecoParam::kNSpecies),
92  fLengthQA(fNdet*fNEventSpecies),
93  fQA(new ULong_t[fLengthQA]),
94  fDet(kNULLDET),
95  fTask(kNULLTASK),
96  fEventSpecie(AliRecoParam::kDefault),
97  fEventSpecies(new Bool_t[fNEventSpecies])
98 {
99  // default constructor
100  memset(fQA,0,fLengthQA*sizeof(ULong_t));
101  memset(fEventSpecies,kFALSE,fNEventSpecies*sizeof(Bool_t));
102 }
103 
104 //____________________________________________________________________________
106  TNamed(qa),
107  fNdet(qa.fNdet),
109  fLengthQA(qa.fLengthQA),
110  fQA(new ULong_t[fLengthQA]),
111  fDet(qa.fDet),
112  fTask(qa.fTask),
114  fEventSpecies(new Bool_t[fNEventSpecies])
115 {
116  // cpy ctor
117  memcpy(fQA,qa.fQA,fLengthQA*sizeof(ULong_t));
118  memcpy(fEventSpecies,qa.fEventSpecies,fNEventSpecies*sizeof(Bool_t));
119 }
120 
121 //_____________________________________________________________________________
123 {
124  // assignment operator
125  if(&qa != this) {
126  TNamed::operator=(qa);
127  fNdet = qa.fNdet;
129  fLengthQA = qa.fLengthQA;
130 
131  if(fQA) delete [] fQA;
132  fQA = new ULong_t[fLengthQA];
133  memcpy(fQA,qa.fQA,fLengthQA*sizeof(ULong_t));
134 
135  fDet = qa.fDet;
136  fTask = qa.fTask;
138  if(fEventSpecies) delete [] fEventSpecies;
139  fEventSpecies = new Bool_t[fNEventSpecies];
140  memcpy(fEventSpecies,qa.fEventSpecies,fNEventSpecies*sizeof(Bool_t));
141  }
142  return *this;
143 }
144 
145 //_______________________________________________________________
146 AliQAv1::AliQAv1(const Int_t qalength, ULong_t * qa, const Int_t eslength, Bool_t * es) :
147 TNamed("QA", "Quality Assurance status"),
148 fNdet(kNDET),
149 fNEventSpecies(eslength),
150 fLengthQA(qalength),
151 fQA(new ULong_t[fLengthQA]),
152 fDet(kNULLDET),
153 fTask(kNULLTASK),
154 fEventSpecie(AliRecoParam::kDefault),
155 fEventSpecies(new Bool_t[fNEventSpecies])
156 {
157  // constructor to be used
158  memcpy(fQA, qa, fLengthQA*sizeof(ULong_t));
159  memcpy(fEventSpecies, es, fNEventSpecies*sizeof(Bool_t));
160 }
161 
162 //_______________________________________________________________
164  TNamed("QA", "Quality Assurance status"),
165  fNdet(kNDET),
166  fNEventSpecies(AliRecoParam::kNSpecies),
168  fQA(new ULong_t[fLengthQA]),
169  fDet(det),
170  fTask(kNULLTASK),
171  fEventSpecie(AliRecoParam::kDefault),
172  fEventSpecies(new Bool_t[fNEventSpecies])
173 {
174  // constructor to be used
175  if (! CheckRange(det) ) fDet = kNULLDET ;
176  memset(fQA,0,fLengthQA*sizeof(ULong_t));
177  memset(fEventSpecies,kFALSE,fNEventSpecies*sizeof(Bool_t));
178 }
179 
180 //_______________________________________________________________
182  TNamed("QA", "Quality Assurance status"),
183  fNdet(kNDET),
184  fNEventSpecies(AliRecoParam::kNSpecies),
186  fQA(new ULong_t[fLengthQA]),
187  fDet(kNULLDET),
188  fTask(tsk),
189  fEventSpecie(AliRecoParam::kDefault),
190  fEventSpecies(new Bool_t[fNEventSpecies])
191 {
192  // constructor to be used in the AliRoot module (SIM, REC, ESD or ANA)
193  if (! CheckRange(tsk) ) fTask = kNULLTASK ;
194  memset(fQA,0,fLengthQA*sizeof(ULong_t));
195  memset(fEventSpecies,kFALSE,fNEventSpecies*sizeof(Bool_t));
196 }
197 
198 //____________________________________________________________________________
200 {
201  // dtor
202  delete [] fQA;
203  delete [] fEventSpecies;
204 }
205 
206 //_______________________________________________________________
208 {
209  // close the open files
210  if (fgQADataFile)
211  if (fgQADataFile->IsOpen())
212  fgQADataFile->Close() ;
213  if (fgQAResultFile)
214  if (fgQAResultFile->IsOpen())
215  fgQAResultFile->Close() ;
216  if (fgQARefFile)
217  if (fgQARefFile->IsOpen())
218  fgQARefFile->Close() ;
219 }
220 
221 //_______________________________________________________________
222 Bool_t AliQAv1::CheckFatal() const
223 {
224  // check if any FATAL status is set
225  Bool_t rv = kFALSE ;
226  Int_t index ;
227  for (index = 0; index < kNDET ; index++)
228  rv = rv || IsSet(DETECTORINDEX_t(index), fTask, fEventSpecie, kFATAL) ;
229  return rv ;
230 }
231 
232 //_______________________________________________________________
234 {
235  // check if detector is in given detector range: 0-kNDET
236 
237  Bool_t rv = ( det < 0 || det > kNDET ) ? kFALSE : kTRUE ;
238  if (!rv)
239  AliFatal(Form("Detector index %d is out of range: 0 <= index <= %d", det, kNDET)) ;
240  return rv ;
241 }
242 
243 //_______________________________________________________________
244 Bool_t AliQAv1::CheckRange(ALITASK_t task) const
245 {
246  // check if task is given taskk range: 0:kNTASK
247  Bool_t rv = ( task < kRAW || task > kNTASK ) ? kFALSE : kTRUE ;
248  if (!rv)
249  AliFatal(Form("Module index %d is out of range: 0 <= index <= %d", task, kNTASK)) ;
250  return rv ;
251 }
252 
253 //_______________________________________________________________
254 Bool_t AliQAv1::CheckRange(QABIT_t bit) const
255 {
256  // check if bit is in given bit range: 0-kNBit
257 
258  Bool_t rv = ( bit < 0 || bit > kNBIT ) ? kFALSE : kTRUE ;
259  if (!rv)
260  AliFatal(Form("Status bit %d is out of range: 0 <= bit <= %d", bit, kNBIT)) ;
261  return rv ;
262 }
263 
264 //_______________________________________________________________
266 {
267  // check if bit is in given bit range: 0-kNBit
268  Bool_t rv = kFALSE ;
269  switch (es) {
271  rv = kTRUE ;
272  break ;
274  rv = kTRUE ;
275  break ;
277  rv = kTRUE ;
278  break ;
279  case AliRecoParam::kCosmic:
280  rv = kTRUE ;
281  break ;
282  case AliRecoParam::kCalib:
283  rv = kTRUE ;
284  break ;
285  }
286  if (!rv)
287  AliFatal(Form("Event Specie %d is not valid", es)) ;
288  return rv ;
289 }
290 
291 //_______________________________________________________________
293 {
294  // returns the char name corresponding to module index
295  switch (tsk) {
296  case kNULLTASK:
297  break ;
298  case kRAW:
299  return "RAW" ;
300  break ;
301  case kSIM:
302  return "SIM" ;
303  break ;
304  case kREC:
305  return "REC" ;
306  break ;
307  case kESD:
308  return "ESD" ;
309  break ;
310  case kANA:
311  return "ANA" ;
312  break ;
313  default:
314  return "" ;
315  break ;
316  }
317  return "" ;
318 }
319 
320 //_______________________________________________________________
321 const char * AliQAv1::GetBitName(QABIT_t bit) const
322 {
323  const char* bitName[kNBIT+1]={"NONE","INFO","WARNING","ERROR","FATAL"};
324  if (bit>=kNULLBit && bit<kNBIT) return bitName[int(bit)-kNULLBit];
325  return 0;
326 }
327 
328 //_______________________________________________________________
329 TH1 * AliQAv1::GetData(TObjArray** list, Int_t index, AliRecoParam::EventSpecie_t eventSpecie)
330 {
331  // retrieve QA data from the list at a given index and for a given event specie
332  TH1 * rv = NULL ;
333  Int_t esindex = AliRecoParam::AConvert(eventSpecie) ;
334  TObjArray * arr = list[esindex] ;
335  if (arr) {
336  if ( index > AliQAv1::GetMaxQAObj() ) {
337  AliErrorClass(Form("Max number of authorized QA objects is %d", AliQAv1::GetMaxQAObj())) ;
338  } else {
339  if ( arr->At(index) ) {
340  rv = static_cast<TH1*>(arr->At(index)) ;
341  }
342  }
343  }
344  return rv ;
345 }
346 
347 //_______________________________________________________________
349 {
350  // returns the detector index corresponding to a given name
351  TString sname(name) ;
352  DETECTORINDEX_t rv = kNULLDET ;
353  for (Int_t det = 0; det < kNDET ; det++) {
354  if ( GetDetName(det) == sname ) {
355  rv = DETECTORINDEX_t(det) ;
356  break ;
357  }
358  }
359  return rv ;
360 }
361 
362 //_______________________________________________________________
363 const char * AliQAv1::GetDetName(Int_t det)
364 {
365  // returns the detector name corresponding to a given index (needed in a loop)
366 
367  if ( det >= 0 && det < kNDET)
368  return (fgDetNames[det]).Data() ;
369  else
370  return NULL ;
371 }
372 
373 //_______________________________________________________________
374 TFile * AliQAv1::GetQADataFile(const char * name, Int_t run)
375 {
376  // opens the file to store the detectors Quality Assurance Data Maker results
377  const char * temp = Form("%s.%s.%d.root", name, fgQADataFileName.Data(), run) ;
378  TString opt ;
379  if (! fgQADataFile ) {
380  if (gSystem->AccessPathName(temp))
381  opt = "NEW" ;
382  else
383  opt = "UPDATE" ;
384  fgQADataFile = TFile::Open(temp, opt.Data()) ;
385  } else {
386  if ( strcmp(temp, fgQADataFile->GetName()) != 0 ) {
387  fgQADataFile = static_cast<TFile *>(gROOT->FindObject(temp)) ;
388  if ( !fgQADataFile ) {
389  if (gSystem->AccessPathName(temp))
390  opt = "NEW" ;
391  else
392  opt = "UPDATE" ;
393  fgQADataFile = TFile::Open(temp, opt.Data()) ;
394  }
395  }
396  }
397  return fgQADataFile ;
398 }
399 
400 //_____________________________________________________________________________
402  // return "rec" or "sim" depending on the task
403 
404  switch (task) {
405  case AliQAv1::kRAWS:
406  return kRECMODE ;
407  break;
408  case AliQAv1::kHITS:
409  return kSIMMODE ;
410  break;
411  case AliQAv1::kSDIGITS:
412  return kSIMMODE ;
413  break;
414  case AliQAv1::kDIGITS:
415  return kSIMMODE ;
416  break;
417  case AliQAv1::kDIGITSR:
418  return kRECMODE ;
419  break;
420  case AliQAv1::kRECPOINTS:
421  return kRECMODE ;
422  break ;
424  return kRECMODE ;
425  break;
427  return kRECMODE ;
428  break;
429  case AliQAv1::kESDS:
430  return kRECMODE ;
431  break;
432  default:
433  break;
434  }
435  return AliQAv1::kNULLMODE;
436 }
437 
438 //_____________________________________________________________________________
439 TFile * AliQAv1::GetQADataFile(const char * fileName)
440 {
441  // Open if necessary the Data file and return its pointer
442 
443  if (!fgQADataFile) {
444  if (!fileName)
445  fileName = AliQAv1::GetQADataFileName() ;
446  if (!gSystem->AccessPathName(fileName)) {
447  fgQADataFile = TFile::Open(fileName) ;
448  } else {
449  AliFatalClass(Form("File %s not found", fileName)) ;
450  }
451  }
452  return fgQADataFile ;
453 }
454 
455 //_______________________________________________________________
457 {
458  // opens the file to store the Quality Assurance Data Checker results
459  if (fgQAResultFile) {
460  if (fgQAResultFile->IsOpen())
461  fgQAResultFile->Close();
462  delete fgQAResultFile;
463  }
464  TString dirName(fgQAResultDirName) ;
465  if ( dirName.Contains(fgkLabLocalFile))
466  dirName.ReplaceAll(fgkLabLocalFile, "") ;
467  TString fileName(dirName + fgQAResultFileName) ;
468  TString opt("") ;
469  if ( !gSystem->AccessPathName(fileName) )
470  opt = "UPDATE" ;
471  else {
472  if ( gSystem->AccessPathName(dirName) )
473  gSystem->mkdir(dirName) ;
474  opt = "NEW" ;
475  }
476  fgQAResultFile = TFile::Open(fileName, opt) ;
477  return fgQAResultFile ;
478 }
479 
480 //_______________________________________________________________
482 {
483  // returns the QA bit set
484  QABIT_t rv = kNULLBit ;
485  if ( es == AliRecoParam::kDefault)
486  es = fEventSpecie ;
487  if ( det == kNULLDET )
488  det = fDet ;
489  if ( tsk == kNULLTASK )
490  tsk = fTask ;
491  for (Int_t bit = kINFO ; bit < kNBIT ; bit++) {
492  if (IsSet(det, tsk, es, QABIT_t(bit)))
493  rv = QABIT_t(bit) ;
494  }
495  return rv ;
496 }
497 
498 //_______________________________________________________________
500 {
501  // returns the detector index corresponding to a given name
502  TString sname(name) ;
504  for (Int_t tsk = 0; tsk < kNTASKINDEX ; tsk++) {
505  if ( GetTaskName(tsk) == sname ) {
506  rv = TASKINDEX_t(tsk) ;
507  break ;
508  }
509  }
510  return rv ;
511 }
512 
513 //_______________________________________________________________
514 Bool_t AliQAv1::IsSet(DETECTORINDEX_t det, ALITASK_t tsk, Int_t ies, QABIT_t bit) const
515 {
516  // Checks is the requested bit is set
517 
519  return IsSet(det, tsk, es, bit) ;
520 
521 }
522 
523 //_______________________________________________________________
525 {
526  // Checks is the requested bit is set
527 
528  CheckRange(det) ;
529  CheckRange(tsk) ;
530  CheckRange(bit) ;
531  CheckRange(es) ;
532 
533  ULong_t offset = Offset(tsk) ;
534  ULong_t status = GetStatus(det, es) ;
535  offset+= bit ;
536  status = (status & 1 << offset) != 0 ;
537  return status ;
538 }
539 
540 //_______________________________________________________________
542 {
543  // Checks is the requested bit is set
544 
545  CheckRange(det) ;
546  CheckRange(tsk) ;
547  CheckRange(es) ;
548 
549  ULong_t offset = Offset(tsk) ;
550  ULong_t status = GetStatus(det, es) ;
551  ULong_t st = 0 ;
552  for ( Int_t bit = 0 ; bit < kNBIT ; bit++) {
553  offset+= bit ;
554  st += (status & 1 << offset) != 0 ;
555  }
556  if ( st == 0 )
557  return kFALSE ;
558  else
559  return kTRUE ;
560 }
561 //_______________________________________________________________
563 {
564  // Checks is the requested bit is set
565 
566  CheckRange(det) ;
567  CheckRange(es) ;
568 
569  ULong_t status = GetStatus(det, es) ;
570  ULong_t st = 0 ;
571  for ( Int_t tsk = 0 ; tsk < kNTASK ; tsk++) {
572  ULong_t offset = Offset(ALITASK_t(tsk)) ;
573  for ( Int_t bit = 0 ; bit < kNBIT ; bit++) {
574  offset+= bit ;
575  st += (status & 1 << offset) != 0 ;
576  }
577  }
578  if ( st == 0 )
579  return kFALSE ;
580  else
581  return kTRUE ;
582 }
583 
584 //_______________________________________________________________
586 {
587  // Get an instance of the singleton. The only authorized way to call the ctor
588 
589  if ( ! fgQA) {
590  if (GetQAResultFile()) fgQA = static_cast<AliQAv1 *>(fgQAResultFile->Get("QA")) ;
591  if ( ! fgQA )
592  fgQA = new AliQAv1() ;
593  }
594  return fgQA ;
595 }
596 
597 //_______________________________________________________________
598 AliQAv1 * AliQAv1::Instance(const Int_t qalength, ULong_t * qa, const Int_t eslength, Bool_t * es)
599 {
600  // Get an instance of the singleton. The only authorized way to call the ctor
601 
602  if ( ! fgQA)
603  fgQA = new AliQAv1(qalength, qa, eslength, es) ;
604  return fgQA ;
605 }
606 
607 //_______________________________________________________________
609 {
610  // Get an instance of the singleton. The only authorized way to call the ctor
611 
612  if ( ! fgQA) {
613  GetQAResultFile() ;
614  fgQA = static_cast<AliQAv1 *>(fgQAResultFile->Get(GetQAName())) ;
615  if ( ! fgQA )
616  fgQA = new AliQAv1(det) ;
617  }
618  fgQA->Set(det) ;
619  return fgQA ;
620 }
621 
622 //_______________________________________________________________
624 {
625  // Get an instance of the singleton. The only authorized way to call the ctor
626 
627  if ( ! fgQA)
628  switch (tsk) {
629  case kNULLTASK:
630  break ;
631  case kRAW:
632  fgQA = new AliQAv1(tsk) ;
633  break ;
634  case kSIM:
635  fgQA = new AliQAv1(tsk) ;
636  break ;
637  case kREC:
638  AliInfoClass("fgQA = gAlice->GetQA()") ;
639  break ;
640  case kESD:
641  AliInfoClass("fgQA = static_cast<AliQAv1 *> (esdFile->Get(\"QA\")") ;
642  break ;
643  case kANA:
644  AliInfoClass("fgQA = static_cast<AliQAv1 *> (esdFile->Get(\"QA\")") ;
645  break ;
646  case kNTASK:
647  break ;
648  }
649  if (fgQA)
650  fgQA->Set(tsk) ;
651  return fgQA ;
652 }
653 
654 //_______________________________________________________________
656 {
657  // get an instance of the singleton.
658  ALITASK_t index = kNULLTASK ;
659 
660  if ( tsk == kRAWS )
661  index = kRAW ;
662  else if (tsk < kDIGITS)
663  index = kSIM ;
664  else if (tsk < kRECPARTICLES)
665  index = kREC ;
666  else if (tsk == kESDS)
667  index = kESD ;
668 
669  return Instance(index) ;
670 }
671 
672 //_______________________________________________________________
673 Long64_t AliQAv1::Merge(const TCollection * list) {
674  // Merge the QA resuls in the list into this single AliQAv1 object
675 
676  Long64_t nmerge = 0;
677  for (Int_t det = 0 ; det < kNDET ; det++) {
678  Set(DETECTORINDEX_t(det)) ;
679  for (Int_t task = 0 ; task < kNTASK ; task++) {
680  Set(ALITASK_t(task)) ;
681  for (Int_t bit = 0 ; bit < kNBIT ; bit++) {
682  TIter next(list) ;
683  AliQAv1 * qa ;
684  while ( (qa = (AliQAv1*)next() ) ) {
685  for (Int_t es = 0 ; es < fNEventSpecies ; es++) {
686  ++nmerge;
687  if (qa->IsSet(DETECTORINDEX_t(det), ALITASK_t(task), es, QABIT_t(bit)))
688  Set(QABIT_t(bit), es) ;
689  }
690  } // qa list
691  } // bit
692  } // task
693  } // detector
694  return nmerge;
695 }
696 
697 //_______________________________________________________________
698 ULong_t AliQAv1::Offset(ALITASK_t tsk) const
699 {
700  // Calculates the bit offset for a given module (SIM, REC, ESD, ANA)
701 
702  CheckRange(tsk) ;
703 
704  ULong_t offset = 0 ;
705  switch (tsk) {
706  case kNULLTASK:
707  break ;
708  case kRAW:
709  offset+= 0 ;
710  break ;
711  case kSIM:
712  offset+= 4 ;
713  break ;
714  case kREC:
715  offset+= 8 ;
716  break ;
717  case kESD:
718  offset+= 12 ;
719  break ;
720  case kANA:
721  offset+= 16 ;
722  break ;
723  case kNTASK:
724  break ;
725  }
726 
727  return offset ;
728 }
729 
730 //_______________________________________________________________
732 {
733  // resets all the bits for a given tsk and event specie
734  CheckRange(det) ;
735  CheckRange(tsk) ;
736  CheckRange(es) ;
737 
738  ULong_t offset = Offset(tsk) ;
739  ULong_t status = GetStatus(det, es) ;
740  for ( Int_t bit = 0 ; bit < kNBIT ; bit++) {
741  offset+= bit ;
742  status = status & ~1 << offset ;
743  }
744  SetStatus(det, es, status) ;
745 }
746 
747 //_______________________________________________________________
749 {
750  // reset the status of det for all event specie
751  for (Int_t es = 0 ; es < fNEventSpecies ; es++)
752  fQA[det*fNdet+es] = 0 ;
753 }
754 
755 //_______________________________________________________________
756 void AliQAv1::Set(QABIT_t bit, Int_t ies)
757 {
758  // Set the status bit of the current detector in the current module and for the current event specie
759  Set(bit, AliRecoParam::Convert(ies)) ;
760 }
761 
762 //_______________________________________________________________
764 {
765  // Set the status bit of the current detector in the current module and for the current event specie
766 
767  SetStatusBit(fDet, fTask, es, bit) ;
768 }
769 
770 //_____________________________________________________________________________
771 void AliQAv1::SetQARefStorage(const char * name)
772 {
773  // Set the root directory where the QA reference data are stored
774 
775  fgQARefDirName = name ;
776  if ( fgQARefDirName.Contains(fgkLabLocalFile) )
778  else if ( fgQARefDirName.Contains(fgkLabLocalOCDB) )
780  else if ( fgQARefDirName.Contains(fgkLabAliEnOCDB) )
782 
783  else {
784  AliErrorClass(Form("ERROR: %s is an invalid storage definition", name)) ;
785  fgQARefDirName = "" ;
786  fgQARefFileName = "" ;
787  }
788  TString tmp(fgQARefDirName) ; // + fgQARefFileName) ;
789  AliInfoClass(Form("AliQAv1::SetQARefDir: QA references are in %s\n", tmp.Data() )) ;
790 }
791 
792 //_____________________________________________________________________________
793 void AliQAv1::SetQAResultDirName(const char * name)
794 {
795  // Set the root directory where to store the QA status object
796 
797  fgQAResultDirName.Prepend(name) ;
798  AliInfoClass(Form("AliQAv1::SetQAResultDirName: QA results are in %s\n", fgQAResultDirName.Data())) ;
799  if ( fgQAResultDirName.Contains(fgkLabLocalFile))
800  fgQAResultDirName.ReplaceAll(fgkLabLocalFile, "") ;
802 }
803 
804 //_______________________________________________________________
806 {
807  // Set the status bit for a given detector and a given task
808 
809  CheckRange(det) ;
810  CheckRange(tsk) ;
811  CheckRange(bit) ;
812  CheckRange(es) ;
813 
814  Reset(det, tsk, es) ;
815 
816  ULong_t offset = Offset(tsk) ;
817  ULong_t status = GetStatus(det, es) ;
818  offset+= bit ;
819  status = status | 1 << offset ;
820  SetStatus(det, es, status) ;
821 }
822 
823 //_______________________________________________________________
825 {
826  // dispplay the QA status word
827  if ( det == kNULLDET)
828  det = fDet ;
829  for (Int_t ies = 0 ; ies < fNEventSpecies ; ies++) {
830  if ( IsEventSpecieSet(ies) )
832  }
833 }
834 
835 //_______________________________________________________________
836 void AliQAv1::ShowAll() const
837 {
838  // dispplay the QA status word
839  Int_t index ;
840  for (index = 0 ; index < kNDET ; index++) {
841  for (Int_t tsk = kRAW ; tsk < kNTASK ; tsk++) {
842  for (Int_t ies = 0 ; ies < fNEventSpecies ; ies++) {
843  if ( IsEventSpecieSet(ies) )
845  }
846  }
847  }
848 }
849 
850 //_______________________________________________________________
852 {
853  // Prints the full QA status of a given detector
854  CheckRange(det) ;
855  CheckRange(es) ;
856  ULong_t status = GetStatus(det, es) ;
857  ULong_t tskStatus[kNTASK] ;
858  tskStatus[kRAW] = status & 0x0000f ;
859  tskStatus[kSIM] = status & 0x000f0 ;
860  tskStatus[kREC] = status & 0x00f00 ;
861  tskStatus[kESD] = status & 0x0f000 ;
862  tskStatus[kANA] = status & 0xf0000 ;
863 
864  AliInfo(Form("====> QA Status for %8s %8s raw =0x%lx, sim=0x%lx, rec=0x%lx, esd=0x%lx, ana=0x%lx", GetDetName(det).Data(), AliRecoParam::GetEventSpecieName(es),
865  tskStatus[kRAW], tskStatus[kSIM], tskStatus[kREC], tskStatus[kESD], tskStatus[kANA] )) ;
866  if (tsk == kNULLTASK) {
867  for (Int_t itsk = kRAW ; itsk < kNTASK ; itsk++) {
868  ShowASCIIStatus(es, det, ALITASK_t(itsk), tskStatus[itsk]) ;
869  }
870  } else {
871  ShowASCIIStatus(es, det, tsk, tskStatus[tsk]) ;
872  }
873 }
874 
875 //_______________________________________________________________
876 void AliQAv1::ShowASCIIStatus(AliRecoParam::EventSpecie_t es, DETECTORINDEX_t det, ALITASK_t tsk, const ULong_t status) const
877 {
878  // print the QA status in human readable format
879  const QABIT_t bit = GetQAStatusBit(es, det, tsk) ;
880  if ( bit != kNULLBit ) {
881  AliInfoClass(Form(" %8s %8s %4s \n", AliRecoParam::GetEventSpecieName(es), GetDetName(det).Data(), GetAliTaskName(tsk))) ;
882  AliInfoClass(Form(" %8s %8s %4s 0x%4lx, Problem signalled: %8s \n", AliRecoParam::GetEventSpecieName(es), GetDetName(det).Data(), GetAliTaskName(tsk), status, GetBitName(bit))) ;
883  }
884 }
885 
886 //_______________________________________________________________
887 void AliQAv1::UnSet(QABIT_t bit, Int_t ies)
888 {
889  // UnSet the status bit of the current detector in the current module
890  UnSet(bit, AliRecoParam::Convert(ies)) ;
891 }
892 
893 //_______________________________________________________________
895 {
896  // UnSet the status bit of the current detector in the current module
897 
898  UnSetStatusBit(fDet, fTask, es, bit) ;
899 }
900 
901 //_______________________________________________________________
903 {
904  // UnSet the status bit for a given detector and a given task
905 
906  CheckRange(det) ;
907  CheckRange(tsk) ;
908  CheckRange(bit) ;
909  CheckRange(es) ;
910 
911  ULong_t offset = Offset(tsk) ;
912  ULong_t status = GetStatus(det, es) ;
913  offset+= bit ;
914  status = status & 0 << offset ;
915  SetStatus(det, es, status) ;
916 }
static UShort_t GetMaxQAObj()
Definition: AliQAv1.h:75
static const char * GetEventSpecieName(EventSpecie_t es)
static AliQAv1 * fgQA
Definition: AliQAv1.h:138
static TFile * fgQARefFile
the name of the file where the quality assurance maker store their results
Definition: AliQAv1.h:150
TFile * Open(const char *filename, Long64_t &nevents)
static const TString fgkQACorrNtName
name of QA object
Definition: AliQAv1.h:169
static const TString fgkRefFileName
label to identify a file as AliEn OCDB
Definition: AliQAv1.h:165
void SetStatus(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es, ULong_t status)
Definition: AliQAv1.h:134
Bool_t * fEventSpecies
default storage for QA in OCDB
Definition: AliQAv1.h:173
#define TObjArray
static const UInt_t fgkQABit
name of Reference File Name
Definition: AliQAv1.h:166
static const UInt_t fgkImageBit
TObject bit identifing the object as "expert".
Definition: AliQAv1.h:161
static TString fgDetNames[]
the current event specie
Definition: AliQAv1.h:146
static TFile * fgQAResultFile
file name where to find the reference data
Definition: AliQAv1.h:153
ALITASK_t
Definition: AliQAv1.h:26
static const TString fgkLabLocalOCDB
label to identify a file as local
Definition: AliQAv1.h:163
DETECTORINDEX_t fDet
Definition: AliQAv1.h:143
QABIT_t
Definition: AliQAv1.h:28
static TFile * GetQAResultFile()
Definition: AliQAv1.cxx:456
Int_t fNEventSpecies
Definition: AliQAv1.h:140
QABIT_t GetQAStatusBit(AliRecoParam::EventSpecie_t es=AliRecoParam::kDefault, DETECTORINDEX_t det=kNULLDET, ALITASK_t tsk=kNULLTASK) const
Definition: AliQAv1.cxx:481
Bool_t CheckRange(DETECTORINDEX_t det) const
Definition: AliQAv1.cxx:233
ULong_t GetStatus(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es) const
Definition: AliQAv1.h:125
TROOT * gROOT
MODE_t
Definition: AliQAv1.h:32
static const UInt_t fgkForbidCloningBit
flag that the histrogram was cloned per trigger class
Definition: AliQAv1.h:179
static void SetQAResultDirName(const char *name)
Definition: AliQAv1.cxx:793
static const TString fgkLabAliEnOCDB
label to identify a file as local OCDB
Definition: AliQAv1.h:164
virtual ~AliQAv1()
Definition: AliQAv1.cxx:199
static TString fgQADataFileName
the output file where the quality assurance maker store their results
Definition: AliQAv1.h:149
Bool_t CheckFatal() const
Definition: AliQAv1.cxx:222
void ShowAll() const
Definition: AliQAv1.cxx:836
static TString fgQAResultFileName
the location of the output file where the QA results are stored
Definition: AliQAv1.h:155
#define AliFatalClass(message)
Definition: AliLog.h:645
Int_t fLengthQA
Definition: AliQAv1.h:141
static void SetQARefStorage(const char *name)
Definition: AliQAv1.cxx:771
ULong_t Offset(ALITASK_t tsk) const
Definition: AliQAv1.cxx:698
#define AliInfoClass(message)
Definition: AliLog.h:489
TString fileName(const char *dir, int runNumber, const char *da, int i, const char *type)
void ShowASCIIStatus(AliRecoParam::EventSpecie_t es, DETECTORINDEX_t det, ALITASK_t tsk, ULong_t status) const
Definition: AliQAv1.cxx:876
Int_t fNdet
Definition: AliQAv1.h:139
AliQAv1 & operator=(const AliQAv1 &qa)
Definition: AliQAv1.cxx:122
#define AliErrorClass(message)
Definition: AliLog.h:596
static void Close()
Definition: AliQAv1.cxx:207
static DETECTORINDEX_t GetDetIndex(const char *name)
Definition: AliQAv1.cxx:348
void ShowStatus(DETECTORINDEX_t det, ALITASK_t tsk=kNULLTASK, AliRecoParam::EventSpecie_t es=AliRecoParam::kDefault) const
Definition: AliQAv1.cxx:851
static EventSpecie_t ConvertIndex(Int_t index)
static TH1 * GetData(TObjArray **list, Int_t index, AliRecoParam::EventSpecie_t eventSpecie)
Definition: AliQAv1.cxx:329
void Show(DETECTORINDEX_t det=kNULLDET) const
Definition: AliQAv1.cxx:824
static const UInt_t fgkOrigHistoKeptBit
flag that the histogram is forbiden to clone per trigger class
Definition: AliQAv1.h:180
static const TString fgkImageFileName
Definition: AliQAv1.h:174
#define AliInfo(message)
Definition: AliLog.h:484
ULong_t * fQA
Definition: AliQAv1.h:142
Long64_t Merge(const TCollection *list)
Definition: AliQAv1.cxx:673
const char * GetBitName(QABIT_t bit) const
Definition: AliQAv1.cxx:321
Bool_t IsSetAny(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es) const
Definition: AliQAv1.cxx:541
static TFile * GetQADataFile(const char *name, Int_t run)
Definition: AliQAv1.cxx:374
void Reset(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es)
Definition: AliQAv1.cxx:731
static const Int_t fgkQADebugLevel
bit in the QA data object which is set when Checker does not return 0
Definition: AliQAv1.h:167
static const TString GetDetName(DETECTORINDEX_t det)
Definition: AliQAv1.h:62
static const char * GetAliTaskName(ALITASK_t tsk)
Definition: AliQAv1.cxx:292
#define AliFatal(message)
Definition: AliLog.h:640
static const TString fImageFileFormat
name of the file that contains all the QA images
Definition: AliQAv1.h:175
ALITASK_t fTask
the current detector (ITS, TPC, ....)
Definition: AliQAv1.h:144
static TString fgQARefFileName
name of directory where to find the reference data file
Definition: AliQAv1.h:152
void UnSetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit)
Definition: AliQAv1.cxx:902
void SetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit)
Definition: AliQAv1.cxx:805
static const UShort_t fgkMaxQAObjects
format of the file that contains all the QA images
Definition: AliQAv1.h:176
Bool_t IsSet(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) const
Definition: AliQAv1.cxx:524
static MODE_t Mode(TASKINDEX_t task)
Definition: AliQAv1.cxx:401
void Set(QABIT_t bit, AliRecoParam::EventSpecie_t es)
Definition: AliQAv1.cxx:763
static TString fgQARefDirName
the output file where the quality assurance maker store their results
Definition: AliQAv1.h:151
static TString fgQAResultDirName
File where to find the QA result.
Definition: AliQAv1.h:154
DETECTORINDEX_t
Definition: AliQAv1.h:23
static TString fgRefDataDirName
name of Reference directory name in OCDB
Definition: AliQAv1.h:171
static const UInt_t fgkQAClonedBit
maximum number of QA objects allowed dor each task (Raws, digits,....)
Definition: AliQAv1.h:178
static const TString fgkExpert
list of mode names
Definition: AliQAv1.h:159
TASKINDEX_t
Definition: AliQAv1.h:30
AliQAv1()
Definition: AliQAv1.cxx:88
static const TString fgkRefOCDBDirName
name of QA Correlation Ntuple
Definition: AliQAv1.h:170
void ResetStatus(DETECTORINDEX_t det)
Definition: AliQAv1.cxx:748
Bool_t IsEventSpecieSet(AliRecoParam::EventSpecie_t es) const
Definition: AliQAv1.h:92
static EventSpecie_t Convert(Int_t ies)
static const UInt_t fgkExpertBit
name for the expert directory
Definition: AliQAv1.h:160
static const TString fgkQAName
debug level used for QA verbosity
Definition: AliQAv1.h:168
static const char * GetQAName()
Definition: AliQAv1.h:73
void UnSet(QABIT_t bit, AliRecoParam::EventSpecie_t es)
Definition: AliQAv1.cxx:894
static Int_t AConvert(EventSpecie_t es)
static TString fgGRPPath
list of detector names
Definition: AliQAv1.h:147
static const char * GetQADataFileName()
Definition: AliQAv1.h:71
static TString fgTaskNames[]
list of Run Type names
Definition: AliQAv1.h:157
static TString GetTaskName(UInt_t tsk)
Definition: AliQAv1.h:90
static const TString fgkLabLocalFile
TObject bit identifing the object to be plotted on the QA image.
Definition: AliQAv1.h:162
static const TString fgkQARefOCDBDefault
name of Reference directory name in OCDB for data
Definition: AliQAv1.h:172
static TString fgModeNames[]
list of tasks names
Definition: AliQAv1.h:158
static TFile * fgQADataFile
path of the GRP object in OCDB
Definition: AliQAv1.h:148
AliRecoParam::EventSpecie_t fEventSpecie
the current environment (SIM, REC, ESD, ANA)
Definition: AliQAv1.h:145
static AliQAv1 * Instance()
Definition: AliQAv1.cxx:585
static TASKINDEX_t GetTaskIndex(const char *name)
Definition: AliQAv1.cxx:499