]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliQACheckerBase.cxx
Fix in composition of QAChecked output image file (Melinda S.)
[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
92664bc8 195 Int_t count[AliRecoParam::kNSpecies] = { 0 };
57acd2d2 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 ;
92664bc8 202 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie)) continue ;
57acd2d2 203 if (list[specie]->GetEntries() == 0)
204 test[specie] = 0. ; // nothing to check
205 else {
206 if (!fRefSubDir && !fRefOCDBSubDir)
207 test[specie] = -1 ; // no reference data
208 else {
209 TIter next(list[specie]) ;
210 TH1 * hdata ;
211 count[specie] = 0 ;
eca4fa66 212 while ( (hdata = static_cast<TH1 *>(next())) ) {
ab1bb842 213 if ( hdata->IsA()->InheritsFrom("TH1") ) {
7775195b 214 if ( hdata->TestBit(AliQAv1::GetExpertBit()) ) // does not perform the test for expert data
215 continue ;
92664bc8 216 //
217 // First try to find the ref histo with exact name (with possible trigger clon ending)
218 TString hname = hdata->GetName();
219 TH1 * href = NULL ;
220 if (fRefSubDir) href = static_cast<TH1*>(fRefSubDir->Get(hname.Data())) ;
221 else if (fRefOCDBSubDir[specie]) href = static_cast<TH1*>(fRefOCDBSubDir[specie]->FindObject(hname.Data()));
222 //
223 if (!href && hdata->TestBit(AliQAv1::GetClonedBit())) { // try to find the histo for the base name (w/o trigger ending
224 int ind = hname.Index(AliQADataMaker::GetTriggerPrefix());
225 if (ind>0) {
226 hname.Resize(ind);
227 if (fRefSubDir) href = static_cast<TH1*>(fRefSubDir->Get(hname.Data())) ;
228 else if (fRefOCDBSubDir[specie]) href = static_cast<TH1*>(fRefOCDBSubDir[specie]->FindObject(hname.Data()));
229 }
230 }
231 //
7775195b 232 if (!href)
233 test[specie] = -1 ; // no reference data ;
234 else {
235 Double_t rv = DiffK(hdata, href) ;
236 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s ->Test = %f", hdata->GetName(), rv)) ;
237 test[specie] += rv ;
238 count[specie]++ ;
57acd2d2 239 }
c39ee44c 240 } else
57acd2d2 241 AliError("Data type cannot be processed") ;
c39ee44c 242 if (count[specie] != 0)
243 test[specie] /= count[specie] ;
57acd2d2 244 }
57acd2d2 245 }
246 }
247 }
a4976ef3 248}
249
57acd2d2 250
421ab0fb 251//____________________________________________________________________________
f12d42ce 252Double_t AliQACheckerBase::DiffC(const TH1 * href, const TH1 * hin) const
421ab0fb 253{
254 // compares two histograms using the Chi2 test
255 if ( hin->Integral() == 0 ) {
5379c4a3 256 AliDebug(AliQAv1::GetQADebugLevel(), Form("Spectrum %s is empty", hin->GetName())) ;
421ab0fb 257 return 0. ;
258 }
259
260 return hin->Chi2Test(href) ;
261}
262
263//____________________________________________________________________________
f12d42ce 264Double_t AliQACheckerBase::DiffK(const TH1 * href, const TH1 * hin) const
421ab0fb 265{
266 // compares two histograms using the Kolmogorov test
6252ceeb 267 if ( hin->Integral() == 0 || href->Integral() == 0) {
268 AliDebug(AliQAv1::GetQADebugLevel(), Form("Spectrum %s or its reference is empty", hin->GetName())) ;
421ab0fb 269 return 0. ;
270 }
271
272 return hin->KolmogorovTest(href) ;
273}
274
78decf65 275 //_____________________________________________________________________________
276void AliQACheckerBase::GetRefSubDir(const char * det, const char * task, TDirectory *& dirFile, TObjArray **& dirOCDB)
277{
278 // Opens and returns the file with the reference data
279 dirFile = NULL ;
280 TString refStorage(AliQAv1::GetQARefStorage()) ;
281 if (!refStorage.Contains(AliQAv1::GetLabLocalOCDB()) && !refStorage.Contains(AliQAv1::GetLabAliEnOCDB())) {
282 AliError(Form("%s is not a valid location for reference data", refStorage.Data())) ;
283 return ;
284 } else {
285 AliQAManager* manQA = AliQAManager::QAManager(AliQAv1::GetTaskIndex(task)) ;
a04582a1 286 // dirOCDB = new TObjArray*[AliRecoParam::kNSpecies] ;
78decf65 287 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
288 dirOCDB[specie] = NULL ;
289 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
290 continue ;
291 AliQAv1::SetQARefDataDirName(specie) ;
292 if ( ! manQA->GetLock() ) {
293 manQA->SetDefaultStorage(AliQAv1::GetQARefStorage()) ;
294 manQA->SetSpecificStorage("*", AliQAv1::GetQARefStorage()) ;
295 manQA->SetRun(AliCDBManager::Instance()->GetRun()) ;
296 manQA->SetLock() ;
297 }
298 char * detOCDBDir = Form("%s/%s/%s", det, AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ;
299 AliCDBEntry * entry = manQA->Get(detOCDBDir, manQA->GetRun()) ;
300 if (entry) {
301 TList * listDetQAD =static_cast<TList *>(entry->GetObject()) ;
1c871ee3 302 if ( listDetQAD && strcmp(listDetQAD->ClassName(), "TList") != 0 ) {
78decf65 303 AliError(Form("Expected a Tlist and found a %s for detector %s", listDetQAD->ClassName(), det)) ;
304 listDetQAD = NULL ;
305 continue ;
306 }
307 if ( listDetQAD ) {
308 TIter next(listDetQAD) ;
d90c4827 309 while ( (TObjArray*)next() )
78decf65 310 dirOCDB[specie] = static_cast<TObjArray *>(listDetQAD->FindObject(Form("%s/%s", task, AliRecoParam::GetEventSpecieName(specie)))) ;
311 }
312 }
313 }
314 }
315}
316
c39ee44c 317//____________________________________________________________________________
11a18a03 318void AliQACheckerBase::PrintExternParam()
319{
320 // Print the list of external parameter list
321 TIter next(fExternParamList) ;
322 TParameter<double> *pp ;
323 TString printit("\n") ;
324 while( (pp = (TParameter<double>*)next()) )
325 printit += Form("%s = %f\n", pp->GetName(), pp->GetVal());
326 AliInfo(Form("%s", printit.Data())) ;
327}
328
329//____________________________________________________________________________
c26cb20d 330void AliQACheckerBase::Run(AliQAv1::ALITASK_t index, AliDetectorRecoParam * recoParam)
c39ee44c 331{
92664bc8 332 AliDebug(AliQAv1::GetQADebugLevel(), Form("Processing %s", AliQAv1::GetAliTaskName(index))) ;
c39ee44c 333
92664bc8 334 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
86017bd8 335 Check(rv, index, recoParam) ;
92664bc8 336 SetQA(index, rv) ;
337
c39ee44c 338 AliDebug(AliQAv1::GetQADebugLevel(), Form("Test result of %s", AliQAv1::GetAliTaskName(index))) ;
92664bc8 339
d9e8b603 340 delete [] rv ;
c39ee44c 341 Finish() ;
342}
343
421ab0fb 344//____________________________________________________________________________
c26cb20d 345void AliQACheckerBase::Run(AliQAv1::ALITASK_t index, TObjArray ** list, AliDetectorRecoParam * recoParam)
421ab0fb 346{
92664bc8 347 // RS: perform check for all trigger classes in loop
348 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
349 //
350 TObjArray ** listTrig = new TObjArray *[AliRecoParam::kNSpecies];
351 //
352 for (int itc=-1;itc<AliQADataMaker::GetNTrigClasses();itc++) {
353 //
354 // RS: fetch the histograms for each specie and for given trigger
355 //AliInfo(Form("Processing %s for trigger: %s", AliQAv1::GetAliTaskName(index),AliQADataMaker::GetTrigClassName(itc)));
356
357 for (int specie=0;specie<AliRecoParam::kNSpecies;specie++) {
358 listTrig[specie] = 0;
359 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) || !list[specie]) continue;
360 listTrig[specie] = new TObjArray( list[specie]->GetSize() ); // destination for clones of this trigger
361 AliQADataMaker::GetDataOfTrigClass(list[specie],itc, listTrig[specie]);
362 }
363 AliDebug(AliQAv1::GetQADebugLevel(), Form("Processing %s for trigger: %s", AliQAv1::GetAliTaskName(index),AliQADataMaker::GetTrigClassName(itc)));
364 Check(rv, index, listTrig, recoParam) ;
365 SetQA(index, rv) ;
366 AliDebug(AliQAv1::GetQADebugLevel(), Form("Test result of %s for trigger: %s", AliQAv1::GetAliTaskName(index),AliQADataMaker::GetTrigClassName(itc)));
367 //
368 for (int specie=0;specie<AliRecoParam::kNSpecies;specie++) if (listTrig[specie]) delete listTrig[specie]; // clean temporary container
369 }
86017bd8 370 delete [] rv ;
a2b64fbd 371 Finish() ;
421ab0fb 372}
373
374//____________________________________________________________________________
2e42b4d4 375void AliQACheckerBase::Finish() const
421ab0fb 376{
92664bc8 377 // wrap up and save QA in proper file
378 AliQAv1::GetQAResultFile() ;
379 AliQAv1 * qa = AliQAv1::Instance() ;
380 qa->Write(AliQAv1::GetQAName(), kWriteDelete) ;
421ab0fb 381}
46b8a84d 382
634696f5 383//____________________________________________________________________________
384void AliQACheckerBase::MakeImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode)
385{
386 // makes the QA image for sim and rec
92664bc8 387 TObjArray tmpArr; // array to store flat version of original array (which may contain clones)
388 //
389 for (Int_t esIndex = 0; esIndex < AliRecoParam::kNSpecies; esIndex++) {
390 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) continue;
391 Int_t nImages = 0;
392 TIter next(list[esIndex]);
393 TObject* hdata = NULL;
394 tmpArr.Clear();
395 while ( (hdata=(next())) ) { // count histos and transfere to flat array
396 if (hdata->InheritsFrom(TH1::Class()) && hdata->TestBit(AliQAv1::GetImageBit()) ) { // histo, not cloned
397 nImages++;
398 tmpArr.AddLast(hdata);
399 continue;
94b94b5f 400 }
92664bc8 401 if (!hdata->TestBit(AliQAv1::GetClonedBit())) continue; // not an array of clones, unknown object
402 TIter nextCl((TObjArray*)hdata); // array of histo clones
403 TObject* hcl = 0;
404 while ((hcl=nextCl())) if (hcl->InheritsFrom(TH1::Class()) && hcl->TestBit(AliQAv1::GetImageBit())) {tmpArr.AddLast(hcl); nImages++;}
405 }
406 //
407 if ( nImages == 0 ) {
408 AliDebug(AliQAv1::GetQADebugLevel(), Form("No histogram will be plotted for %s %s %s\n", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)));
409 continue;
634696f5 410 }
92664bc8 411 AliDebug(AliQAv1::GetQADebugLevel(), Form("%d histograms will be plotted for %s %s %s\n", nImages, GetName(), AliQAv1::GetTaskName(task).Data(),AliRecoParam::GetEventSpecieName(esIndex)));
412 //
413 const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex));
414 //
415 if ( !fImage[esIndex] ) fImage[esIndex] = new TCanvas(title, title);
416 //
417 fImage[esIndex]->Clear();
418 fImage[esIndex]->SetTitle(title);
419 fImage[esIndex]->cd();
420 TPaveText someText(0.015, 0.015, 0.98, 0.98);
421 someText.AddText(title);
422 someText.Draw();
8386cd34 423 fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()));
92664bc8 424 fImage[esIndex]->Clear();
425 Int_t nx = TMath::Nint(TMath::Sqrt(nImages));
426 Int_t ny = nx;
427 if (nx < TMath::Sqrt(nImages)) ny++;
428 //
429 fImage[esIndex]->Divide(nx, ny);
430 TIter nexthist(&tmpArr);
431 Int_t npad = 1;
432 fImage[esIndex]->cd(npad);
433 TH1* histo = 0;
434 while ( (histo=(TH1*)nexthist()) ) { // tmpArr is guaranteed to contain only plottable histos, no checks needed
435 TString opts = histo->GetDrawOption();
436 if (opts.Contains("logy",TString::kIgnoreCase)) gPad->SetLogy();
437 if (opts.Contains("logx",TString::kIgnoreCase)) gPad->SetLogx();
438 histo->DrawCopy();
439 fImage[esIndex]->cd(++npad);
440 }
441 fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps");
442 }
634696f5 443}
444
46b8a84d 445//____________________________________________________________________________
57acd2d2 446void AliQACheckerBase::SetHiLo(Float_t * hiValue, Float_t * lowValue)
46b8a84d 447{
5379c4a3 448 AliDebug(AliQAv1::GetQADebugLevel(), "Previous setting was:") ;
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]) ;
455 AliInfo(Form("%s", text)) ;
5379c4a3 456 }
57acd2d2 457
4e25ac79 458 for (Int_t index = 0 ; index < AliQAv1::kNBIT ; index++) {
57acd2d2 459 fLowTestValue[index] = lowValue[index] ;
eca4fa66 460 fUpTestValue[index] = hiValue[index] ;
57acd2d2 461 }
5379c4a3 462 AliDebug(AliQAv1::GetQADebugLevel(), "Current setting is:") ;
463 if ( AliDebugLevel() == AliQAv1::GetQADebugLevel() ) {
eca4fa66 464 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",
465 fLowTestValue[AliQAv1::kINFO], fUpTestValue[AliQAv1::kINFO],
466 fLowTestValue[AliQAv1::kWARNING], fUpTestValue[AliQAv1::kWARNING],
467 fLowTestValue[AliQAv1::kERROR], fUpTestValue[AliQAv1::kERROR],
468 fLowTestValue[AliQAv1::kFATAL], fUpTestValue[AliQAv1::kFATAL]) ; AliInfo(Form("%s", text)) ;
5379c4a3 469 }
57acd2d2 470}
46b8a84d 471
57acd2d2 472//____________________________________________________________________________
4e25ac79 473void AliQACheckerBase::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
57acd2d2 474{
475 // sets the QA according the return value of the Check
46b8a84d 476
4e25ac79 477 AliQAv1 * qa = AliQAv1::Instance(index) ;
d5b176f5 478
57acd2d2 479 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
d5b176f5 480 if (! qa->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)))
481 continue ;
57acd2d2 482 if ( value == NULL ) { // No checker is implemented, set all QA to Fatal
4e25ac79 483 qa->Set(AliQAv1::kFATAL, specie) ;
57acd2d2 484 } else {
4e25ac79 485 if ( value[specie] >= fLowTestValue[AliQAv1::kFATAL] && value[specie] < fUpTestValue[AliQAv1::kFATAL] )
b872fee3 486 qa->Set(AliQAv1::kFATAL, AliRecoParam::ConvertIndex(specie)) ;
4e25ac79 487 else if ( value[specie] > fLowTestValue[AliQAv1::kERROR] && value[specie] <= fUpTestValue[AliQAv1::kERROR] )
b872fee3 488 qa->Set(AliQAv1::kERROR, AliRecoParam::ConvertIndex(specie)) ;
4e25ac79 489 else if ( value[specie] > fLowTestValue[AliQAv1::kWARNING] && value[specie] <= fUpTestValue[AliQAv1::kWARNING] )
b872fee3 490 qa->Set(AliQAv1::kWARNING, AliRecoParam::ConvertIndex(specie)) ;
4e25ac79 491 else if ( value[specie] > fLowTestValue[AliQAv1::kINFO] && value[specie] <= fUpTestValue[AliQAv1::kINFO] )
b872fee3 492 qa->Set(AliQAv1::kINFO, AliRecoParam::ConvertIndex(specie)) ;
57acd2d2 493 }
494 }
46b8a84d 495}