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