Bug corrected.
[u/mrichter/AliRoot.git] / STEER / AliQACheckerBase.cxx
CommitLineData
421ab0fb 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
16
17/* $Id$ */
18
202374b1 19//
20// Base class for detectors quality assurance checkers
21// Compares Data made by QADataMakers with reference data
22// Y. Schutz CERN August 2007
23//
421ab0fb 24
25// --- ROOT system ---
634696f5 26#include <TCanvas.h>
421ab0fb 27#include <TClass.h>
28#include <TH1F.h>
29#include <TH1I.h>
30#include <TIterator.h>
31#include <TKey.h>
32#include <TFile.h>
a4976ef3 33#include <TList.h>
a2b64fbd 34#include <TNtupleD.h>
11a18a03 35#include <TParameter.h>
634696f5 36#include <TPaveText.h>
421ab0fb 37
38// --- Standard library ---
39
40// --- AliRoot header files ---
78decf65 41#include "AliCDBEntry.h"
421ab0fb 42#include "AliLog.h"
4e25ac79 43#include "AliQAv1.h"
2e42b4d4 44#include "AliQAChecker.h"
45#include "AliQACheckerBase.h"
46#include "AliQADataMaker.h"
78decf65 47#include "AliQAManager.h"
c26cb20d 48#include "AliDetectorRecoParam.h"
421ab0fb 49
2e42b4d4 50ClassImp(AliQACheckerBase)
421ab0fb 51
52
53//____________________________________________________________________________
2e42b4d4 54AliQACheckerBase::AliQACheckerBase(const char * name, const char * title) :
421ab0fb 55 TNamed(name, title),
a5fa6165 56 fDataSubDir(0x0),
4edbc5bc 57 fRefSubDir(0x0),
aa2beccb 58 fRefOCDBSubDir(new TObjArray*[AliRecoParam::kNSpecies]),
a04582a1 59 fLowTestValue(new Float_t[AliQAv1::kNBIT]),
60 fUpTestValue(new Float_t[AliQAv1::kNBIT]),
634696f5 61 fImage(new TCanvas*[AliRecoParam::kNSpecies]),
11a18a03 62 fPrintImage(kTRUE),
a80d46d0 63 fExternParamList(new TList())
421ab0fb 64{
65 // ctor
4e25ac79 66 fLowTestValue[AliQAv1::kINFO] = 0.5 ;
67 fUpTestValue[AliQAv1::kINFO] = 1.0 ;
68 fLowTestValue[AliQAv1::kWARNING] = 0.002 ;
69 fUpTestValue[AliQAv1::kWARNING] = 0.5 ;
70 fLowTestValue[AliQAv1::kERROR] = 0.0 ;
71 fUpTestValue[AliQAv1::kERROR] = 0.002 ;
72 fLowTestValue[AliQAv1::kFATAL] = -1.0 ;
73 fUpTestValue[AliQAv1::kFATAL] = 0.0 ;
57acd2d2 74
5379c4a3 75 AliDebug(AliQAv1::GetQADebugLevel(), "Default setting is:") ;
76 if ( AliDebugLevel() == AliQAv1::GetQADebugLevel() ) {
eca4fa66 77 const Char_t * text= Form(" INFO -> %1.5f < value < %1.5f WARNING -> %1.5f < value <= %1.5f \n ERROR -> %1.5f < value <= %1.5f \n FATAL -> %1.5f <= value < %1.5f \n",
78 fLowTestValue[AliQAv1::kINFO], fUpTestValue[AliQAv1::kINFO],
79 fLowTestValue[AliQAv1::kWARNING], fUpTestValue[AliQAv1::kWARNING],
80 fLowTestValue[AliQAv1::kERROR], fUpTestValue[AliQAv1::kERROR],
81 fLowTestValue[AliQAv1::kFATAL], fUpTestValue[AliQAv1::kFATAL]) ;
82 AliInfo(Form("%s", text)) ;
5379c4a3 83 }
634696f5 84
aa2beccb 85 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
634696f5 86 fImage[specie] = NULL ;
aa2beccb 87 fRefOCDBSubDir[specie] = NULL ;
88 }
421ab0fb 89}
90
91//____________________________________________________________________________
4edbc5bc 92AliQACheckerBase::AliQACheckerBase(const AliQACheckerBase& qac) :
93 TNamed(qac.GetName(), qac.GetTitle()),
94 fDataSubDir(qac.fDataSubDir),
95 fRefSubDir(qac.fRefSubDir),
57acd2d2 96 fRefOCDBSubDir(qac.fRefOCDBSubDir),
a04582a1 97 fLowTestValue(new Float_t[AliQAv1::kNBIT]),
98 fUpTestValue(new Float_t[AliQAv1::kNBIT]),
99 fImage(new TCanvas*[AliRecoParam::kNSpecies]),
11a18a03 100 fPrintImage(kTRUE),
a80d46d0 101 fExternParamList(new TList())
421ab0fb 102{
103 //copy ctor
4e25ac79 104 for (Int_t index = 0 ; index < AliQAv1::kNBIT ; index++) {
57acd2d2 105 fLowTestValue[index] = qac.fLowTestValue[index] ;
106 fUpTestValue[index] = qac.fUpTestValue[index] ;
107 }
aa2beccb 108 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
109 fImage[specie] = qac.fImage[specie] ;
110 fRefOCDBSubDir[specie] = qac.fRefOCDBSubDir[specie] ;
111 }
11a18a03 112 if (qac.fExternParamList) {
11a18a03 113 TIter next(qac.fExternParamList) ;
114 TParameter<double> * p ;
115 while ( (p = (TParameter<double>*)next()) )
116 fExternParamList->Add(p) ;
117 }
421ab0fb 118}
119
120//____________________________________________________________________________
634696f5 121AliQACheckerBase& AliQACheckerBase::operator = (const AliQACheckerBase& qac )
421ab0fb 122{
123 // Equal operator.
2e42b4d4 124 this->~AliQACheckerBase();
634696f5 125 new(this) AliQACheckerBase(qac);
421ab0fb 126 return *this;
127}
128
57acd2d2 129//____________________________________________________________________________
130AliQACheckerBase::~AliQACheckerBase()
131{
132 delete [] fLowTestValue ;
133 delete [] fUpTestValue ;
634696f5 134 for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
135 if ( fImage[esIndex] )
136 delete fImage[esIndex] ;
aa2beccb 137 if ( fRefOCDBSubDir[esIndex] )
138 delete fRefOCDBSubDir[esIndex] ;
634696f5 139 }
140 delete[] fImage ;
aa2beccb 141 delete[] fRefOCDBSubDir ;
5d1a2a7d 142 AliQAv1::GetQAResultFile()->Close() ;
11a18a03 143 if (fExternParamList) {
144 fExternParamList->Clear() ;
145 delete fExternParamList ;
146 }
57acd2d2 147}
148
a5fa6165 149//____________________________________________________________________________
86017bd8 150void AliQACheckerBase::Check(Double_t * test, AliQAv1::ALITASK_t index, const AliDetectorRecoParam * recoParam)
a5fa6165 151{
152 // Performs a basic checking
153 // Compares all the histograms stored in the directory
4edbc5bc 154 // With reference histograms either in a file of in OCDB
a5fa6165 155
ed448a70 156 TObjArray ** list = new TObjArray *[AliRecoParam::kNSpecies] ;
c39ee44c 157 Int_t specie ;
158 for (specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
ed448a70 159 list[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ;
4e25ac79 160 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
57acd2d2 161 continue ;
c39ee44c 162 if (fDataSubDir) {
ed448a70 163 TList * keyList = fDataSubDir->GetListOfKeys() ;
164 TIter next(keyList) ;
165 TKey * key ;
166 while ( (key = static_cast<TKey *>(next())) ) {
167 TDirectory * specieDir = fDataSubDir->GetDirectory(key->GetName()) ;
168 TList * keykeyList = specieDir->GetListOfKeys() ;
169 TIter next2(keykeyList) ;
170 TKey * keykey ;
171 while ( (keykey = static_cast<TKey *>(next2())) ) {
172 TObject * odata = specieDir->Get(keykey->GetName()) ;
173 if ( odata->IsA()->InheritsFrom("TH1") ) {
174 TH1 * hdata = static_cast<TH1*>(odata) ;
175 list[specie]->Add(hdata) ;
176 } else if (!odata->IsA()->InheritsFrom("TDirectory")) // skip the expert directory
177 AliError(Form("%s Is a Classname that cannot be processed", key->GetClassName())) ;
c39ee44c 178 }
57acd2d2 179 }
57acd2d2 180 }
181 }
ed448a70 182
86017bd8 183 Check(test, index, list, recoParam) ;
ed448a70 184
185 delete[] list ;
186
a5fa6165 187}
188
a4976ef3 189//____________________________________________________________________________
86017bd8 190void AliQACheckerBase::Check(Double_t * test, AliQAv1::ALITASK_t task, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/)
a4976ef3 191{
192 // Performs a basic checking
193 // Compares all the histograms in the list
194
57acd2d2 195 Int_t count[AliRecoParam::kNSpecies] = { 0 };
196
78decf65 197 GetRefSubDir(GetName(), AliQAv1::GetTaskName(task), fRefSubDir, fRefOCDBSubDir) ;
198 // SetRefandData(refDir, refOCDBDir) ;
199
57acd2d2 200 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
201 test[specie] = 1.0 ;
6252ceeb 202 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie))
57acd2d2 203 continue ;
204 if (list[specie]->GetEntries() == 0)
205 test[specie] = 0. ; // nothing to check
206 else {
207 if (!fRefSubDir && !fRefOCDBSubDir)
208 test[specie] = -1 ; // no reference data
209 else {
210 TIter next(list[specie]) ;
211 TH1 * hdata ;
212 count[specie] = 0 ;
eca4fa66 213 while ( (hdata = static_cast<TH1 *>(next())) ) {
ab1bb842 214 if ( hdata->IsA()->InheritsFrom("TH1") ) {
7775195b 215 if ( hdata->TestBit(AliQAv1::GetExpertBit()) ) // does not perform the test for expert data
216 continue ;
217 TH1 * href = NULL ;
218 if (fRefSubDir)
219 href = static_cast<TH1*>(fRefSubDir->Get(hdata->GetName())) ;
220 else if (fRefOCDBSubDir[specie])
221 href = static_cast<TH1*>(fRefOCDBSubDir[specie]->FindObject(hdata->GetName())) ;
222 if (!href)
223 test[specie] = -1 ; // no reference data ;
224 else {
225 Double_t rv = DiffK(hdata, href) ;
226 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s ->Test = %f", hdata->GetName(), rv)) ;
227 test[specie] += rv ;
228 count[specie]++ ;
57acd2d2 229 }
c39ee44c 230 } else
57acd2d2 231 AliError("Data type cannot be processed") ;
c39ee44c 232 if (count[specie] != 0)
233 test[specie] /= count[specie] ;
57acd2d2 234 }
57acd2d2 235 }
236 }
237 }
a4976ef3 238}
239
57acd2d2 240
421ab0fb 241//____________________________________________________________________________
f12d42ce 242Double_t AliQACheckerBase::DiffC(const TH1 * href, const TH1 * hin) const
421ab0fb 243{
244 // compares two histograms using the Chi2 test
245 if ( hin->Integral() == 0 ) {
5379c4a3 246 AliDebug(AliQAv1::GetQADebugLevel(), Form("Spectrum %s is empty", hin->GetName())) ;
421ab0fb 247 return 0. ;
248 }
249
250 return hin->Chi2Test(href) ;
251}
252
253//____________________________________________________________________________
f12d42ce 254Double_t AliQACheckerBase::DiffK(const TH1 * href, const TH1 * hin) const
421ab0fb 255{
256 // compares two histograms using the Kolmogorov test
6252ceeb 257 if ( hin->Integral() == 0 || href->Integral() == 0) {
258 AliDebug(AliQAv1::GetQADebugLevel(), Form("Spectrum %s or its reference is empty", hin->GetName())) ;
421ab0fb 259 return 0. ;
260 }
261
262 return hin->KolmogorovTest(href) ;
263}
264
78decf65 265 //_____________________________________________________________________________
266void AliQACheckerBase::GetRefSubDir(const char * det, const char * task, TDirectory *& dirFile, TObjArray **& dirOCDB)
267{
268 // Opens and returns the file with the reference data
269 dirFile = NULL ;
270 TString refStorage(AliQAv1::GetQARefStorage()) ;
271 if (!refStorage.Contains(AliQAv1::GetLabLocalOCDB()) && !refStorage.Contains(AliQAv1::GetLabAliEnOCDB())) {
272 AliError(Form("%s is not a valid location for reference data", refStorage.Data())) ;
273 return ;
274 } else {
275 AliQAManager* manQA = AliQAManager::QAManager(AliQAv1::GetTaskIndex(task)) ;
a04582a1 276 // dirOCDB = new TObjArray*[AliRecoParam::kNSpecies] ;
78decf65 277 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
278 dirOCDB[specie] = NULL ;
279 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
280 continue ;
281 AliQAv1::SetQARefDataDirName(specie) ;
282 if ( ! manQA->GetLock() ) {
283 manQA->SetDefaultStorage(AliQAv1::GetQARefStorage()) ;
284 manQA->SetSpecificStorage("*", AliQAv1::GetQARefStorage()) ;
285 manQA->SetRun(AliCDBManager::Instance()->GetRun()) ;
286 manQA->SetLock() ;
287 }
288 char * detOCDBDir = Form("%s/%s/%s", det, AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ;
289 AliCDBEntry * entry = manQA->Get(detOCDBDir, manQA->GetRun()) ;
290 if (entry) {
291 TList * listDetQAD =static_cast<TList *>(entry->GetObject()) ;
292 if ( strcmp(listDetQAD->ClassName(), "TList") != 0 ) {
293 AliError(Form("Expected a Tlist and found a %s for detector %s", listDetQAD->ClassName(), det)) ;
294 listDetQAD = NULL ;
295 continue ;
296 }
297 if ( listDetQAD ) {
298 TIter next(listDetQAD) ;
299 TObjArray * ar ;
300 while ( (ar = (TObjArray*)next()) )
301 dirOCDB[specie] = static_cast<TObjArray *>(listDetQAD->FindObject(Form("%s/%s", task, AliRecoParam::GetEventSpecieName(specie)))) ;
302 }
303 }
304 }
305 }
306}
307
421ab0fb 308//____________________________________________________________________________
11a18a03 309void AliQACheckerBase::PrintExternParam()
310{
311 // Print the list of external parameter list
312 TIter next(fExternParamList) ;
313 TParameter<double> *pp ;
314 TString printit("\n") ;
315 while( (pp = (TParameter<double>*)next()) )
316 printit += Form("%s = %f\n", pp->GetName(), pp->GetVal());
317 AliInfo(Form("%s", printit.Data())) ;
318}
319
320//____________________________________________________________________________
c26cb20d 321void AliQACheckerBase::Run(AliQAv1::ALITASK_t index, AliDetectorRecoParam * recoParam)
c39ee44c 322{
323 AliDebug(AliQAv1::GetQADebugLevel(), Form("Processing %s", AliQAv1::GetAliTaskName(index))) ;
324
325 Double_t * rv = NULL ;
86017bd8 326 Check(rv, index, recoParam) ;
c39ee44c 327 SetQA(index, rv) ;
328
329 AliDebug(AliQAv1::GetQADebugLevel(), Form("Test result of %s", AliQAv1::GetAliTaskName(index))) ;
330
331 if (rv)
332 delete [] rv ;
333 Finish() ;
334}
335
336//____________________________________________________________________________
c26cb20d 337void AliQACheckerBase::Run(AliQAv1::ALITASK_t index, TObjArray ** list, AliDetectorRecoParam * recoParam)
421ab0fb 338{
5379c4a3 339 AliDebug(AliQAv1::GetQADebugLevel(), Form("Processing %s", AliQAv1::GetAliTaskName(index))) ;
a2b64fbd 340
86017bd8 341 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
342 Check(rv, index, list, recoParam) ;
a2b64fbd 343 SetQA(index, rv) ;
46b8a84d 344
5379c4a3 345 AliDebug(AliQAv1::GetQADebugLevel(), Form("Test result of %s", AliQAv1::GetAliTaskName(index))) ;
46b8a84d 346
86017bd8 347 delete [] rv ;
a2b64fbd 348 Finish() ;
421ab0fb 349}
350
351//____________________________________________________________________________
2e42b4d4 352void AliQACheckerBase::Finish() const
421ab0fb 353{
54a7f3ac 354 // wrap up and save QA in proper file
5d1a2a7d 355 AliQAv1::GetQAResultFile() ;
4e25ac79 356 AliQAv1 * qa = AliQAv1::Instance() ;
5d1a2a7d 357 qa->Write(AliQAv1::GetQAName(), kWriteDelete) ;
421ab0fb 358}
46b8a84d 359
634696f5 360//____________________________________________________________________________
361void AliQACheckerBase::MakeImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode)
362{
363 // makes the QA image for sim and rec
364 Int_t nImages = 0 ;
365 for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
366 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) )
367 continue ;
368 TIter next(list[esIndex]) ;
369 TH1 * hdata = NULL ;
370 while ( (hdata=static_cast<TH1 *>(next())) ) {
371 TString cln(hdata->ClassName()) ;
df6856f0 372 if ( ! cln.Contains("TH") )
634696f5 373 continue ;
374 if ( hdata->TestBit(AliQAv1::GetImageBit()) )
375 nImages++;
376 }
377 break ;
378 }
379 if ( nImages == 0 ) {
380 AliDebug(AliQAv1::GetQADebugLevel(), Form("No histogram will be plotted for %s %s\n", GetName(), AliQAv1::GetTaskName(task).Data())) ;
381 } else {
382 AliDebug(AliQAv1::GetQADebugLevel(), Form("%d histograms will be plotted for %s %s\n", nImages, GetName(), AliQAv1::GetTaskName(task).Data())) ;
383 for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
4851e489 384 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0)
634696f5 385 continue ;
386 const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ;
387 if ( !fImage[esIndex] ) {
388 fImage[esIndex] = new TCanvas(title, title) ;
389 }
86017bd8 390 fImage[esIndex]->Clear() ;
634696f5 391 fImage[esIndex]->SetTitle(title) ;
392 fImage[esIndex]->cd() ;
393 TPaveText someText(0.015, 0.015, 0.98, 0.98) ;
394 someText.AddText(title) ;
395 someText.Draw() ;
a80d46d0 396 fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ;
634696f5 397 fImage[esIndex]->Clear() ;
ff355e43 398 Int_t nx = TMath::Nint(TMath::Sqrt(nImages));
634696f5 399 Int_t ny = nx ;
5941084b 400 if (nx < TMath::Sqrt(nImages))
634696f5 401 ny++ ;
df6856f0 402
634696f5 403 fImage[esIndex]->Divide(nx, ny) ;
404 TIter nexthist(list[esIndex]) ;
405 TH1* hist = NULL ;
406 Int_t npad = 1 ;
407 fImage[esIndex]->cd(npad) ;
408 while ( (hist=static_cast<TH1*>(nexthist())) ) {
409 TString cln(hist->ClassName()) ;
df6856f0 410 if ( ! cln.Contains("TH") )
634696f5 411 continue ;
412 if(hist->TestBit(AliQAv1::GetImageBit())) {
5024886d 413 TString opts = hist->GetDrawOption();
414 if (opts.Contains("logy",TString::kIgnoreCase)) {
415 gPad->SetLogy();
416 opts.ReplaceAll("logy", "");
417 }
418 if (opts.Contains("logx", TString::kIgnoreCase)) {
419 gPad->SetLogx();
420 opts.ReplaceAll("logx", "");
421 }
422 hist->DrawCopy() ;
634696f5 423 fImage[esIndex]->cd(++npad) ;
424 }
425 }
a80d46d0 426 fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ;
634696f5 427 }
428 }
429}
430
46b8a84d 431//____________________________________________________________________________
57acd2d2 432void AliQACheckerBase::SetHiLo(Float_t * hiValue, Float_t * lowValue)
46b8a84d 433{
5379c4a3 434 AliDebug(AliQAv1::GetQADebugLevel(), "Previous setting was:") ;
435 if ( AliDebugLevel() == AliQAv1::GetQADebugLevel() ) {
eca4fa66 436 const Char_t * text= Form(" INFO -> %1.5f < value < %1.5f WARNING -> %1.5f < value <= %1.5f \n ERROR -> %1.5f < value <= %1.5f \n FATAL -> %1.5f <= value < %1.5f \n",
437 fLowTestValue[AliQAv1::kINFO], fUpTestValue[AliQAv1::kINFO],
438 fLowTestValue[AliQAv1::kWARNING], fUpTestValue[AliQAv1::kWARNING],
439 fLowTestValue[AliQAv1::kERROR], fUpTestValue[AliQAv1::kERROR],
440 fLowTestValue[AliQAv1::kFATAL], fUpTestValue[AliQAv1::kFATAL]) ;
441 AliInfo(Form("%s", text)) ;
5379c4a3 442 }
57acd2d2 443
4e25ac79 444 for (Int_t index = 0 ; index < AliQAv1::kNBIT ; index++) {
57acd2d2 445 fLowTestValue[index] = lowValue[index] ;
eca4fa66 446 fUpTestValue[index] = hiValue[index] ;
57acd2d2 447 }
5379c4a3 448 AliDebug(AliQAv1::GetQADebugLevel(), "Current setting is:") ;
449 if ( AliDebugLevel() == AliQAv1::GetQADebugLevel() ) {
eca4fa66 450 const Char_t * text= Form(" INFO -> %1.5f < value < %1.5f WARNING -> %1.5f < value <= %1.5f \n ERROR -> %1.5f < value <= %1.5f \n FATAL -> %1.5f <= value < %1.5f \n",
451 fLowTestValue[AliQAv1::kINFO], fUpTestValue[AliQAv1::kINFO],
452 fLowTestValue[AliQAv1::kWARNING], fUpTestValue[AliQAv1::kWARNING],
453 fLowTestValue[AliQAv1::kERROR], fUpTestValue[AliQAv1::kERROR],
454 fLowTestValue[AliQAv1::kFATAL], fUpTestValue[AliQAv1::kFATAL]) ; AliInfo(Form("%s", text)) ;
5379c4a3 455 }
57acd2d2 456}
46b8a84d 457
57acd2d2 458//____________________________________________________________________________
4e25ac79 459void AliQACheckerBase::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
57acd2d2 460{
461 // sets the QA according the return value of the Check
46b8a84d 462
4e25ac79 463 AliQAv1 * qa = AliQAv1::Instance(index) ;
d5b176f5 464
57acd2d2 465 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
d5b176f5 466 if (! qa->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)))
467 continue ;
57acd2d2 468 if ( value == NULL ) { // No checker is implemented, set all QA to Fatal
4e25ac79 469 qa->Set(AliQAv1::kFATAL, specie) ;
57acd2d2 470 } else {
4e25ac79 471 if ( value[specie] >= fLowTestValue[AliQAv1::kFATAL] && value[specie] < fUpTestValue[AliQAv1::kFATAL] )
b872fee3 472 qa->Set(AliQAv1::kFATAL, AliRecoParam::ConvertIndex(specie)) ;
4e25ac79 473 else if ( value[specie] > fLowTestValue[AliQAv1::kERROR] && value[specie] <= fUpTestValue[AliQAv1::kERROR] )
b872fee3 474 qa->Set(AliQAv1::kERROR, AliRecoParam::ConvertIndex(specie)) ;
4e25ac79 475 else if ( value[specie] > fLowTestValue[AliQAv1::kWARNING] && value[specie] <= fUpTestValue[AliQAv1::kWARNING] )
b872fee3 476 qa->Set(AliQAv1::kWARNING, AliRecoParam::ConvertIndex(specie)) ;
4e25ac79 477 else if ( value[specie] > fLowTestValue[AliQAv1::kINFO] && value[specie] <= fUpTestValue[AliQAv1::kINFO] )
b872fee3 478 qa->Set(AliQAv1::kINFO, AliRecoParam::ConvertIndex(specie)) ;
57acd2d2 479 }
480 }
46b8a84d 481}