]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliQAv1.cxx
1.The QA data created on demand according to the event species at filling time. 2...
[u/mrichter/AliRoot.git] / STEER / AliQAv1.cxx
CommitLineData
4e25ac79 1
2/**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16/* $Id: AliQAv1.cxx 31503 2009-03-16 11:01:16Z schutz $ */
17
18//////////////////////////////////////////////////////////////////////////////
19//
20// Quality Assurance Object//_________________________________________________________________________
21// Quality Assurance object. The QA status is held in one word per detector,
22// each bit corresponds to a different status.
23// bit 0-3 : QA raised during simulation (RAW)
24// bit 4-7 : QA raised during simulation (SIM)
25// bit 8-11 : QA raised during reconstruction (REC)
26// bit 12-15 : QA raised during ESD checking (ESD)
27// bit 16-19 : QA raised during analysis (ANA)
28// Each of the 4 bits corresponds to a severity level of increasing importance
29// from lower to higher bit (INFO, WARNING, ERROR, FATAL)
30//
31//*-- Yves Schutz CERN, July 2007
32//////////////////////////////////////////////////////////////////////////////
33
34
35#include <cstdlib>
36// --- ROOT system ---
34709735 37#include <TClass.h>
4e25ac79 38#include <TFile.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
49ClassImp(AliQAv1)
7d297381 50AliQAv1 * AliQAv1::fgQA = 0x0 ;
4e25ac79 51TFile * AliQAv1::fgQADataFile = 0x0 ;
52TString AliQAv1::fgQADataFileName = "QA" ; // will transform into Det.QA.run.root
53TFile * AliQAv1::fgQARefFile = 0x0 ;
54TString AliQAv1::fgQARefDirName = "" ;
55TString AliQAv1::fgQARefFileName = "QA.root" ;
56TFile * AliQAv1::fgQAResultFile = 0x0 ;
57TString AliQAv1::fgQAResultDirName = "" ;
58TString AliQAv1::fgQAResultFileName = "QA.root" ;
59TString AliQAv1::fgDetNames[] = {"ITS", "TPC", "TRD", "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD",
60 "ZDC", "PMD", "T0", "VZERO", "ACORDE", "HLT", "Global", "CORR"} ;
61TString AliQAv1::fgGRPPath = "GRP/GRP/Data" ;
44ed7a66 62TString AliQAv1::fgTaskNames[] = {"Raws", "Hits", "SDigits", "Digits", "DigitsR", "RecPoints", "TrackSegments", "RecParticles", "ESDs"} ;
4e25ac79 63const TString AliQAv1::fgkLabLocalFile = "file://" ;
64const TString AliQAv1::fgkLabLocalOCDB = "local://" ;
65const TString AliQAv1::fgkLabAliEnOCDB = "alien://" ;
66const TString AliQAv1::fgkRefFileName = "QA.root" ;
67const TString AliQAv1::fgkQAName = "QA" ;
68const TString AliQAv1::fgkQACorrNtName = "CorrQA" ;
69const TString AliQAv1::fgkRefOCDBDirName = "QA" ;
70TString AliQAv1::fgRefDataDirName = "" ;
71const TString AliQAv1::fgkQARefOCDBDefault = "alien://folder=/alice/QA/20" ;
72const TString AliQAv1::fgkExpert = "Expert" ;
b2db43c5 73const UInt_t AliQAv1::fgkExpertBit = 0x40000 ;
74const UInt_t AliQAv1::fgkQABit = 0x80000 ;
75const UInt_t AliQAv1::fgkImageBit = 0x100000 ;
fec0891b 76const Int_t AliQAv1::fgkQADebugLevel = 99 ;
77const TString AliQAv1::fImageFileName = "QAImage" ;
78const TString AliQAv1::fImageFileFormat = "eps" ;
79
4e25ac79 80//____________________________________________________________________________
81AliQAv1::AliQAv1() :
82 TNamed("", ""),
83 fNdet(kNDET),
84 fNEventSpecies(AliRecoParam::kNSpecies),
85 fLengthQA(fNdet*fNEventSpecies),
86 fQA(new ULong_t[fLengthQA]),
87 fDet(kNULLDET),
88 fTask(kNULLTASK),
89 fEventSpecie(AliRecoParam::kDefault),
90 fEventSpecies(new Bool_t[fNEventSpecies])
91{
92 // default constructor
93 memset(fQA,0,fLengthQA*sizeof(ULong_t));
94 memset(fEventSpecies,kFALSE,fNEventSpecies*sizeof(Bool_t));
95}
96
97//____________________________________________________________________________
98AliQAv1::AliQAv1(const AliQAv1& qa) :
99 TNamed(qa),
100 fNdet(qa.fNdet),
101 fNEventSpecies(qa.fNEventSpecies),
102 fLengthQA(qa.fLengthQA),
103 fQA(new ULong_t[fLengthQA]),
104 fDet(qa.fDet),
105 fTask(qa.fTask),
106 fEventSpecie(qa.fEventSpecie),
107 fEventSpecies(new Bool_t[fNEventSpecies])
108{
109 // cpy ctor
110 memcpy(fQA,qa.fQA,fLengthQA*sizeof(ULong_t));
111 memcpy(fEventSpecies,qa.fEventSpecies,fNEventSpecies*sizeof(Bool_t));
112}
113
114//_____________________________________________________________________________
115AliQAv1& AliQAv1::operator = (const AliQAv1& qa)
116{
117 // assignment operator
118 if(&qa != this) {
119 TNamed::operator=(qa);
120 fNdet = qa.fNdet;
121 fNEventSpecies = qa.fNEventSpecies;
122 fLengthQA = qa.fLengthQA;
123
124 if(fQA) delete [] fQA;
125 fQA = new ULong_t[fLengthQA];
126 memcpy(fQA,qa.fQA,fLengthQA*sizeof(ULong_t));
127
128 fDet = qa.fDet;
129 fTask = qa.fTask;
130 fEventSpecie = qa.fEventSpecie;
131 if(fEventSpecies) delete [] fEventSpecies;
132 fEventSpecies = new Bool_t[fNEventSpecies];
133 memcpy(fEventSpecies,qa.fEventSpecies,fNEventSpecies*sizeof(Bool_t));
134 }
135 return *this;
136}
137
138//_______________________________________________________________
139AliQAv1::AliQAv1(const Int_t qalength, ULong_t * qa, const Int_t eslength, Bool_t * es) :
140TNamed("QA", "Quality Assurance status"),
141fNdet(kNDET),
142fNEventSpecies(eslength),
143fLengthQA(qalength),
144fQA(new ULong_t[fLengthQA]),
145fDet(kNULLDET),
146fTask(kNULLTASK),
147fEventSpecie(AliRecoParam::kDefault),
148fEventSpecies(new Bool_t[fNEventSpecies])
149{
150 // constructor to be used
151 memcpy(fQA, qa, fLengthQA*sizeof(ULong_t));
152 memcpy(fEventSpecies, es, fNEventSpecies*sizeof(Bool_t));
153}
154
155//_______________________________________________________________
156AliQAv1::AliQAv1(const DETECTORINDEX_t det) :
157 TNamed("QA", "Quality Assurance status"),
158 fNdet(kNDET),
159 fNEventSpecies(AliRecoParam::kNSpecies),
160 fLengthQA(fNdet*fNEventSpecies),
161 fQA(new ULong_t[fLengthQA]),
162 fDet(det),
163 fTask(kNULLTASK),
164 fEventSpecie(AliRecoParam::kDefault),
165 fEventSpecies(new Bool_t[fNEventSpecies])
166{
167 // constructor to be used
168 if (! CheckRange(det) ) fDet = kNULLDET ;
169 memset(fQA,0,fLengthQA*sizeof(ULong_t));
170 memset(fEventSpecies,kFALSE,fNEventSpecies*sizeof(Bool_t));
171}
172
173//_______________________________________________________________
174AliQAv1::AliQAv1(const ALITASK_t tsk) :
175 TNamed("QA", "Quality Assurance status"),
176 fNdet(kNDET),
177 fNEventSpecies(AliRecoParam::kNSpecies),
178 fLengthQA(fNdet*fNEventSpecies),
179 fQA(new ULong_t[fLengthQA]),
180 fDet(kNULLDET),
181 fTask(tsk),
182 fEventSpecie(AliRecoParam::kDefault),
183 fEventSpecies(new Bool_t[fNEventSpecies])
184{
185 // constructor to be used in the AliRoot module (SIM, REC, ESD or ANA)
186 if (! CheckRange(tsk) ) fTask = kNULLTASK ;
187 memset(fQA,0,fLengthQA*sizeof(ULong_t));
188 memset(fEventSpecies,kFALSE,fNEventSpecies*sizeof(Bool_t));
189}
190
191//____________________________________________________________________________
192AliQAv1::~AliQAv1()
193{
194 // dtor
195 delete [] fQA;
196 delete [] fEventSpecies;
197}
198
199//_______________________________________________________________
200void AliQAv1::Close()
201{
202 // close the open files
203 if (fgQADataFile)
204 if (fgQADataFile->IsOpen())
205 fgQADataFile->Close() ;
206 if (fgQAResultFile)
207 if (fgQAResultFile->IsOpen())
208 fgQAResultFile->Close() ;
209 if (fgQARefFile)
210 if (fgQARefFile->IsOpen())
211 fgQARefFile->Close() ;
212}
213
214//_______________________________________________________________
215Bool_t AliQAv1::CheckFatal() const
216{
217 // check if any FATAL status is set
218 Bool_t rv = kFALSE ;
219 Int_t index ;
220 for (index = 0; index < kNDET ; index++)
221 rv = rv || IsSet(DETECTORINDEX_t(index), fTask, fEventSpecie, kFATAL) ;
222 return rv ;
223}
224
225//_______________________________________________________________
226Bool_t AliQAv1::CheckRange(DETECTORINDEX_t det) const
227{
228 // check if detector is in given detector range: 0-kNDET
229
230 Bool_t rv = ( det < 0 || det > kNDET ) ? kFALSE : kTRUE ;
231 if (!rv)
232 AliFatal(Form("Detector index %d is out of range: 0 <= index <= %d", det, kNDET)) ;
233 return rv ;
234}
235
236//_______________________________________________________________
237Bool_t AliQAv1::CheckRange(ALITASK_t task) const
238{
239 // check if task is given taskk range: 0:kNTASK
240 Bool_t rv = ( task < kRAW || task > kNTASK ) ? kFALSE : kTRUE ;
241 if (!rv)
242 AliFatal(Form("Module index %d is out of range: 0 <= index <= %d", task, kNTASK)) ;
243 return rv ;
244}
245
246//_______________________________________________________________
247Bool_t AliQAv1::CheckRange(QABIT_t bit) const
248{
249 // check if bit is in given bit range: 0-kNBit
250
251 Bool_t rv = ( bit < 0 || bit > kNBIT ) ? kFALSE : kTRUE ;
252 if (!rv)
253 AliFatal(Form("Status bit %d is out of range: 0 <= bit <= %d", bit, kNBIT)) ;
254 return rv ;
255}
256
257//_______________________________________________________________
258Bool_t AliQAv1::CheckRange(AliRecoParam::EventSpecie_t es) const
259{
260 // check if bit is in given bit range: 0-kNBit
261 Bool_t rv = kFALSE ;
262 switch (es) {
263 case AliRecoParam::kDefault:
264 rv = kTRUE ;
265 break ;
266 case AliRecoParam::kLowMult:
267 rv = kTRUE ;
268 break ;
269 case AliRecoParam::kHighMult:
270 rv = kTRUE ;
271 break ;
272 case AliRecoParam::kCosmic:
273 rv = kTRUE ;
274 break ;
275 case AliRecoParam::kCalib:
276 rv = kTRUE ;
277 break ;
278 }
279 if (!rv)
280 AliFatal(Form("Event Specie %d is not valid", es)) ;
281 return rv ;
282}
283
284//_______________________________________________________________
285const char * AliQAv1::GetAliTaskName(ALITASK_t tsk)
286{
287 // returns the char name corresponding to module index
288 TString tskName ;
289 switch (tsk) {
290 case kNULLTASK:
291 break ;
292 case kRAW:
293 tskName = "RAW" ;
294 break ;
295 case kSIM:
296 tskName = "SIM" ;
297 break ;
298 case kREC:
299 tskName = "REC" ;
300 break ;
301 case kESD:
302 tskName = "ESD" ;
303 break ;
304 case kANA:
305 tskName = "ANA" ;
306 break ;
307 default:
308 tsk = kNULLTASK ;
309 break ;
310 }
311 return tskName.Data() ;
312}
313
314//_______________________________________________________________
315const char * AliQAv1::GetBitName(QABIT_t bit) const
316{
317 // returns the char name corresponding to bit
318 TString bitName ;
319 switch (bit) {
320 case kNULLBit:
321 break ;
322 case kINFO:
323 bitName = "INFO" ;
324 break ;
325 case kWARNING:
326 bitName = "WARNING" ;
327 break ;
328 case kERROR:
329 bitName = "ERROR" ;
330 break ;
331 case kFATAL:
332 bitName = "FATAL" ;
333 break ;
334 default:
335 bit = kNULLBit ;
336 break ;
337 }
338 return bitName.Data() ;
339}
340
341//_______________________________________________________________
342AliQAv1::DETECTORINDEX_t AliQAv1::GetDetIndex(const char * name)
343{
344 // returns the detector index corresponding to a given name
345 TString sname(name) ;
346 DETECTORINDEX_t rv = kNULLDET ;
347 for (Int_t det = 0; det < kNDET ; det++) {
348 if ( GetDetName(det) == sname ) {
349 rv = DETECTORINDEX_t(det) ;
350 break ;
351 }
352 }
353 return rv ;
354}
355
356//_______________________________________________________________
357const char * AliQAv1::GetDetName(Int_t det)
358{
359 // returns the detector name corresponding to a given index (needed in a loop)
360
361 if ( det >= 0 && det < kNDET)
362 return (fgDetNames[det]).Data() ;
363 else
364 return NULL ;
365}
366
367//_______________________________________________________________
368TFile * AliQAv1::GetQADataFile(const char * name, Int_t run)
369{
370 // opens the file to store the detectors Quality Assurance Data Maker results
371 const char * temp = Form("%s.%s.%d.root", name, fgQADataFileName.Data(), run) ;
372 TString opt ;
373 if (! fgQADataFile ) {
374 if (gSystem->AccessPathName(temp))
375 opt = "NEW" ;
376 else
377 opt = "UPDATE" ;
378 fgQADataFile = TFile::Open(temp, opt.Data()) ;
379 } else {
380 if ( strcmp(temp, fgQADataFile->GetName()) != 0 ) {
eca4fa66 381 fgQADataFile = static_cast<TFile *>(gROOT->FindObject(temp)) ;
4e25ac79 382 if ( !fgQADataFile ) {
eca4fa66 383 if (gSystem->AccessPathName(temp))
384 opt = "NEW" ;
385 else
386 opt = "UPDATE" ;
4e25ac79 387 fgQADataFile = TFile::Open(temp, opt.Data()) ;
388 }
389 }
390 }
391 return fgQADataFile ;
392}
393
394//_____________________________________________________________________________
395TFile * AliQAv1::GetQADataFile(const char * fileName)
396{
397 // Open if necessary the Data file and return its pointer
398
399 if (!fgQADataFile)
400 if (!fileName)
401 fileName = AliQAv1::GetQADataFileName() ;
402 if (!gSystem->AccessPathName(fileName)) {
403 fgQADataFile = TFile::Open(fileName) ;
404 } else {
34709735 405 AliFatalClass(Form("File %s not found", fileName)) ;
4e25ac79 406 }
407 return fgQADataFile ;
408}
409
410//_______________________________________________________________
411TFile * AliQAv1::GetQAResultFile()
412{
413 // opens the file to store the Quality Assurance Data Checker results
414 if (fgQAResultFile)
415 fgQAResultFile->Close() ;
416 fgQAResultFile = 0x0 ;
417// if (!fgQAResultFile) {
418 TString dirName(fgQAResultDirName) ;
419 if ( dirName.Contains(fgkLabLocalFile))
420 dirName.ReplaceAll(fgkLabLocalFile, "") ;
421 TString fileName(dirName + fgQAResultFileName) ;
422 TString opt("") ;
423 if ( !gSystem->AccessPathName(fileName) )
424 opt = "UPDATE" ;
425 else {
426 if ( gSystem->AccessPathName(dirName) )
427 gSystem->mkdir(dirName) ;
428 opt = "NEW" ;
429 }
430 fgQAResultFile = TFile::Open(fileName, opt) ;
431// }
432
433 return fgQAResultFile ;
434}
435
436//_______________________________________________________________
437AliQAv1::TASKINDEX_t AliQAv1::GetTaskIndex(const char * name)
438{
439 // returns the detector index corresponding to a given name
440 TString sname(name) ;
441 TASKINDEX_t rv = kNULLTASKINDEX ;
442 for (Int_t tsk = 0; tsk < kNTASKINDEX ; tsk++) {
443 if ( GetTaskName(tsk) == sname ) {
444 rv = TASKINDEX_t(tsk) ;
445 break ;
446 }
447 }
448 return rv ;
449}
450
451//_______________________________________________________________
452Bool_t AliQAv1::IsSet(DETECTORINDEX_t det, ALITASK_t tsk, Int_t ies, QABIT_t bit) const
453{
454 // Checks is the requested bit is set
455
456 const AliRecoParam::EventSpecie_t es = AliRecoParam::Convert(ies) ;
457 return IsSet(det, tsk, es, bit) ;
458
459}
460
461//_______________________________________________________________
462Bool_t AliQAv1::IsSet(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) const
463{
464 // Checks is the requested bit is set
465
466 CheckRange(det) ;
467 CheckRange(tsk) ;
468 CheckRange(bit) ;
469 CheckRange(es) ;
470
471 ULong_t offset = Offset(tsk) ;
472 ULong_t status = GetStatus(det, es) ;
473 offset+= bit ;
474 status = (status & 1 << offset) != 0 ;
475 return status ;
476}
477
478//_______________________________________________________________
479Bool_t AliQAv1::IsSetAny(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es) const
480{
481 // Checks is the requested bit is set
482
483 CheckRange(det) ;
484 CheckRange(tsk) ;
485 CheckRange(es) ;
486
487 ULong_t offset = Offset(tsk) ;
488 ULong_t status = GetStatus(det, es) ;
489 ULong_t st = 0 ;
490 for ( Int_t bit = 0 ; bit < kNBIT ; bit++) {
491 offset+= bit ;
492 st += (status & 1 << offset) != 0 ;
493 }
494 if ( st == 0 )
495 return kFALSE ;
496 else
497 return kTRUE ;
498}
499//_______________________________________________________________
500Bool_t AliQAv1::IsSetAny(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es) const
501{
502 // Checks is the requested bit is set
503
504 CheckRange(det) ;
505 CheckRange(es) ;
506
507 ULong_t status = GetStatus(det, es) ;
508 ULong_t st = 0 ;
509 for ( Int_t tsk = 0 ; tsk < kNTASK ; tsk++) {
510 ULong_t offset = Offset(ALITASK_t(tsk)) ;
511 for ( Int_t bit = 0 ; bit < kNBIT ; bit++) {
512 offset+= bit ;
513 st += (status & 1 << offset) != 0 ;
514 }
515 }
516 if ( st == 0 )
517 return kFALSE ;
518 else
519 return kTRUE ;
520}
521
522//_______________________________________________________________
523AliQAv1 * AliQAv1::Instance()
524{
525 // Get an instance of the singleton. The only authorized way to call the ctor
526
527 if ( ! fgQA) {
528 TFile * f = GetQAResultFile() ;
eca4fa66 529 fgQA = static_cast<AliQAv1 *>(f->Get("QA")) ;
4e25ac79 530 if ( ! fgQA )
531 fgQA = new AliQAv1() ;
eca4fa66 532 }
4e25ac79 533 return fgQA ;
534}
535
536//_______________________________________________________________
537AliQAv1 * AliQAv1::Instance(const Int_t qalength, ULong_t * qa, const Int_t eslength, Bool_t * es)
538{
539 // Get an instance of the singleton. The only authorized way to call the ctor
540
541 if ( ! fgQA)
542 fgQA = new AliQAv1(qalength, qa, eslength, es) ;
543 return fgQA ;
544}
545
546//_______________________________________________________________
547AliQAv1 * AliQAv1::Instance(const DETECTORINDEX_t det)
548{
549 // Get an instance of the singleton. The only authorized way to call the ctor
550
551 if ( ! fgQA) {
552 TFile * f = GetQAResultFile() ;
eca4fa66 553 fgQA = static_cast<AliQAv1 *>(f->Get("QA")) ;
4e25ac79 554 if ( ! fgQA )
eca4fa66 555 fgQA = new AliQAv1(det) ;
4e25ac79 556 }
557 fgQA->Set(det) ;
558 return fgQA ;
559}
560
561//_______________________________________________________________
562AliQAv1 * AliQAv1::Instance(const ALITASK_t tsk)
563{
564 // Get an instance of the singleton. The only authorized way to call the ctor
565
566 if ( ! fgQA)
567 switch (tsk) {
568 case kNULLTASK:
569 break ;
570 case kRAW:
571 fgQA = new AliQAv1(tsk) ;
572 break ;
573 case kSIM:
574 fgQA = new AliQAv1(tsk) ;
575 break ;
576 case kREC:
34709735 577 AliInfoClass("fgQA = gAlice->GetQA()") ;
4e25ac79 578 break ;
579 case kESD:
eca4fa66 580 AliInfoClass("fgQA = static_cast<AliQAv1 *> (esdFile->Get(\"QA\")") ;
4e25ac79 581 break ;
582 case kANA:
eca4fa66 583 AliInfoClass("fgQA = static_cast<AliQAv1 *> (esdFile->Get(\"QA\")") ;
4e25ac79 584 break ;
585 case kNTASK:
586 break ;
587 }
588 if (fgQA)
589 fgQA->Set(tsk) ;
590 return fgQA ;
591}
592
593//_______________________________________________________________
594AliQAv1 * AliQAv1::Instance(const TASKINDEX_t tsk)
595{
596 // get an instance of the singleton.
597
598 ALITASK_t index = kNULLTASK ;
599
600 if ( tsk == kRAWS )
601 index = kRAW ;
602 else if (tsk < kDIGITS)
603 index = kSIM ;
604 else if (tsk < kRECPARTICLES)
605 index = kREC ;
606 else if (tsk == kESDS)
607 index = kESD ;
608
609 return Instance(index) ;
610}
611
612//_______________________________________________________________
613void AliQAv1::Merge(TCollection * list) {
614 // Merge the QA resuls in the list into this single AliQAv1 object
615
616 for (Int_t det = 0 ; det < kNDET ; det++) {
617 Set(DETECTORINDEX_t(det)) ;
618 for (Int_t task = 0 ; task < kNTASK ; task++) {
619 Set(ALITASK_t(task)) ;
620 for (Int_t bit = 0 ; bit < kNBIT ; bit++) {
621 TIter next(list) ;
622 AliQAv1 * qa ;
623 while ( (qa = (AliQAv1*)next() ) ) {
624 for (Int_t es = 0 ; es < fNEventSpecies ; es++) {
625 if (qa->IsSet(DETECTORINDEX_t(det), ALITASK_t(task), es, QABIT_t(bit)))
626 Set(QABIT_t(bit), es) ;
627 }
628 } // qa list
629 } // bit
630 } // task
631 } // detector
632}
633
634//_______________________________________________________________
635ULong_t AliQAv1::Offset(ALITASK_t tsk) const
636{
637 // Calculates the bit offset for a given module (SIM, REC, ESD, ANA)
638
639 CheckRange(tsk) ;
640
641 ULong_t offset = 0 ;
642 switch (tsk) {
643 case kNULLTASK:
644 break ;
645 case kRAW:
646 offset+= 0 ;
647 break ;
648 case kSIM:
649 offset+= 4 ;
650 break ;
651 case kREC:
652 offset+= 8 ;
653 break ;
654 case kESD:
655 offset+= 12 ;
656 break ;
657 case kANA:
658 offset+= 16 ;
659 break ;
660 case kNTASK:
661 break ;
662 }
663
664 return offset ;
665}
666
667//_______________________________________________________________
668void AliQAv1::ResetStatus(DETECTORINDEX_t det)
669{
670 // reset the status of det for all event specie
671 for (Int_t es = 0 ; es < fNEventSpecies ; es++)
672 fQA[det*fNdet+es] = 0 ;
673}
674
675//_______________________________________________________________
676void AliQAv1::Set(QABIT_t bit, Int_t ies)
677{
678 // Set the status bit of the current detector in the current module and for the current event specie
679 Set(bit, AliRecoParam::Convert(ies)) ;
680}
681
682//_______________________________________________________________
683void AliQAv1::Set(QABIT_t bit, AliRecoParam::EventSpecie_t es)
684{
685 // Set the status bit of the current detector in the current module and for the current event specie
686
687 SetStatusBit(fDet, fTask, es, bit) ;
688}
689
690//_____________________________________________________________________________
691void AliQAv1::SetQARefStorage(const char * name)
692{
693 // Set the root directory where the QA reference data are stored
694
695 fgQARefDirName = name ;
696 if ( fgQARefDirName.Contains(fgkLabLocalFile) )
697 fgQARefFileName = fgkRefFileName ;
698 else if ( fgQARefDirName.Contains(fgkLabLocalOCDB) )
699 fgQARefFileName = fgkQAName ;
700 else if ( fgQARefDirName.Contains(fgkLabAliEnOCDB) )
701 fgQARefFileName = fgkQAName ;
702
703 else {
34709735 704 AliErrorClass(Form("ERROR: %s is an invalid storage definition\n", name)) ;
4e25ac79 705 fgQARefDirName = "" ;
706 fgQARefFileName = "" ;
707 }
708 TString tmp(fgQARefDirName) ; // + fgQARefFileName) ;
34709735 709 AliInfoClass(Form("AliQAv1::SetQARefDir: QA references are in %s\n", tmp.Data() )) ;
4e25ac79 710}
711
712//_____________________________________________________________________________
713void AliQAv1::SetQAResultDirName(const char * name)
714{
715 // Set the root directory where to store the QA status object
716
717 fgQAResultDirName.Prepend(name) ;
34709735 718 AliInfoClass(Form("AliQAv1::SetQAResultDirName: QA results are in %s\n", fgQAResultDirName.Data())) ;
4e25ac79 719 if ( fgQAResultDirName.Contains(fgkLabLocalFile))
720 fgQAResultDirName.ReplaceAll(fgkLabLocalFile, "") ;
721 fgQAResultFileName.Prepend(fgQAResultDirName) ;
722}
723
724//_______________________________________________________________
725void AliQAv1::SetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit)
726{
727 // Set the status bit for a given detector and a given task
728
729 CheckRange(det) ;
730 CheckRange(tsk) ;
731 CheckRange(bit) ;
732 CheckRange(es) ;
733
734 ULong_t offset = Offset(tsk) ;
735 ULong_t status = GetStatus(det, es) ;
736 offset+= bit ;
737 status = status | 1 << offset ;
738 SetStatus(det, es, status) ;
739}
740
741//_______________________________________________________________
742void AliQAv1::Show(DETECTORINDEX_t det) const
743{
744 // dispplay the QA status word
745 if ( det == kNULLDET)
746 det = fDet ;
747 for (Int_t ies = 0 ; ies < fNEventSpecies ; ies++) {
eca4fa66 748 if ( IsEventSpecieSet(ies) )
749 ShowStatus(det, kNULLTASK, AliRecoParam::ConvertIndex(ies)) ;
4e25ac79 750 }
751}
752
753//_______________________________________________________________
754void AliQAv1::ShowAll() const
755{
756 // dispplay the QA status word
757 Int_t index ;
758 for (index = 0 ; index < kNDET ; index++) {
759 for (Int_t tsk = kRAW ; tsk < kNTASK ; tsk++) {
760 for (Int_t ies = 0 ; ies < fNEventSpecies ; ies++) {
eca4fa66 761 if ( IsEventSpecieSet(ies) )
762 ShowStatus(DETECTORINDEX_t(index), ALITASK_t(tsk), AliRecoParam::ConvertIndex(ies)) ;
4e25ac79 763 }
764 }
765 }
766}
767
768//_______________________________________________________________
769void AliQAv1::ShowStatus(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es) const
770{
771 // Prints the full QA status of a given detector
772 CheckRange(det) ;
773 CheckRange(es) ;
774 ULong_t status = GetStatus(det, es) ;
775 ULong_t tskStatus[kNTASK] ;
776 tskStatus[kRAW] = status & 0x0000f ;
777 tskStatus[kSIM] = status & 0x000f0 ;
778 tskStatus[kREC] = status & 0x00f00 ;
779 tskStatus[kESD] = status & 0x0f000 ;
780 tskStatus[kANA] = status & 0xf0000 ;
781
782 AliInfo(Form("====> QA Status for %8s %8s raw =0x%x, sim=0x%x, rec=0x%x, esd=0x%x, ana=0x%x", GetDetName(det).Data(), AliRecoParam::GetEventSpecieName(es),
783 tskStatus[kRAW], tskStatus[kSIM], tskStatus[kREC], tskStatus[kESD], tskStatus[kANA] )) ;
784 if (tsk == kNULLTASK) {
785 for (Int_t itsk = kRAW ; itsk < kNTASK ; itsk++) {
786 ShowASCIIStatus(es, det, ALITASK_t(itsk), tskStatus[itsk]) ;
787 }
788 } else {
789 ShowASCIIStatus(es, det, tsk, tskStatus[tsk]) ;
790 }
791}
792
793//_______________________________________________________________
794void AliQAv1::ShowASCIIStatus(AliRecoParam::EventSpecie_t es, DETECTORINDEX_t det, ALITASK_t tsk, const ULong_t status) const
795{
796 // print the QA status in human readable format
797 TString text;
798 for (Int_t bit = kINFO ; bit < kNBIT ; bit++) {
799 if (IsSet(det, tsk, es, QABIT_t(bit))) {
800 text = GetBitName(QABIT_t(bit)) ;
801 text += " " ;
802 }
803 }
804 if (! text.IsNull())
34709735 805 AliInfoClass(Form(" %8s %8s %4s 0x%4lx, Problem signalled: %8s \n", AliRecoParam::GetEventSpecieName(es), GetDetName(det).Data(), GetAliTaskName(tsk), status, text.Data())) ;
4e25ac79 806}
807
808//_______________________________________________________________
809void AliQAv1::UnSet(QABIT_t bit, Int_t ies)
810{
811 // UnSet the status bit of the current detector in the current module
812 UnSet(bit, AliRecoParam::Convert(ies)) ;
813}
814
815//_______________________________________________________________
816void AliQAv1::UnSet(QABIT_t bit, AliRecoParam::EventSpecie_t es)
817{
818 // UnSet the status bit of the current detector in the current module
819
820 UnSetStatusBit(fDet, fTask, es, bit) ;
821}
822
823//_______________________________________________________________
824void AliQAv1::UnSetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit)
825{
826 // UnSet the status bit for a given detector and a given task
827
828 CheckRange(det) ;
829 CheckRange(tsk) ;
830 CheckRange(bit) ;
831 CheckRange(es) ;
832
833 ULong_t offset = Offset(tsk) ;
834 ULong_t status = GetStatus(det, es) ;
835 offset+= bit ;
836 status = status & 0 << offset ;
837 SetStatus(det, es, status) ;
838}