]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliQAManager.cxx
CalibEnv.C calibVarDescription.txt guiAlias.C
[u/mrichter/AliRoot.git] / STEER / AliQAManager.cxx
CommitLineData
2e331c8b 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/* $Id: AliQAManager.cxx 30894 2009-02-05 13:46:48Z schutz $ */
17///////////////////////////////////////////////////////////////////////////////
18// //
19// class for running the QA makers //
20// //
bf76b847 21// AliQAManager qas; //
22// qas.Run(AliQAv1::kRAWS, rawROOTFileName); //
23// qas.Run(AliQAv1::kHITS); //
24// qas.Run(AliQAv1::kSDIGITS); //
25// qas.Run(AliQAv1::kDIGITS); //
26// qas.Run(AliQAv1::kRECPOINTS); //
27// qas.Run(AliQAv1::kESDS); //
2e331c8b 28// //
29///////////////////////////////////////////////////////////////////////////////
30
fec0891b 31#include <TCanvas.h>
2e331c8b 32#include <TKey.h>
33#include <TFile.h>
34#include <TFileMerger.h>
149a2367 35#include <TGrid.h>
36#include <TGridCollection.h>
37#include <TGridResult.h>
2e331c8b 38#include <TPluginManager.h>
39#include <TROOT.h>
40#include <TString.h>
41#include <TSystem.h>
7c9ff472 42#include <TStopwatch.h>
2e331c8b 43
44#include "AliCDBManager.h"
45#include "AliCDBEntry.h"
46#include "AliCDBId.h"
47#include "AliCDBMetaData.h"
48#include "AliCodeTimer.h"
49#include "AliCorrQADataMakerRec.h"
50#include "AliDetectorRecoParam.h"
51#include "AliESDEvent.h"
52#include "AliGeomManager.h"
53#include "AliGlobalQADataMaker.h"
54#include "AliHeader.h"
55#include "AliLog.h"
56#include "AliModule.h"
4e25ac79 57#include "AliQAv1.h"
634696f5 58#include "AliQAChecker.h"
59#include "AliQACheckerBase.h"
2e331c8b 60#include "AliQADataMakerRec.h"
61#include "AliQADataMakerSim.h"
62#include "AliQAManager.h"
63#include "AliRawReaderDate.h"
64#include "AliRawReaderFile.h"
65#include "AliRawReaderRoot.h"
66#include "AliRun.h"
67#include "AliRunLoader.h"
68#include "AliRunTag.h"
69
70ClassImp(AliQAManager)
71AliQAManager* AliQAManager::fgQAInstance = 0x0;
72
73//_____________________________________________________________________________
74AliQAManager::AliQAManager() :
75 AliCDBManager(),
76 fCurrentEvent(0),
77 fCycleSame(kFALSE),
78 fDetectors("ALL"),
79 fDetectorsW("ALL"),
80 fESD(NULL),
81 fESDTree(NULL),
82 fGAliceFileName(""),
83 fFirstEvent(0),
84 fMaxEvents(0),
85 fMode(""),
86 fNumberOfEvents(999999),
87 fRecoParam(),
88 fRunNumber(0),
89 fRawReader(NULL),
90 fRawReaderDelete(kTRUE),
91 fRunLoader(NULL),
bc8761a0 92 fTasks(""),
fec0891b 93 fEventSpecie(AliRecoParam::kDefault),
50dee02c 94 fPrintImage(kTRUE),
95 fSaveData(kTRUE)
2e331c8b 96{
97 // default ctor
98 fMaxEvents = fNumberOfEvents ;
99 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
4e25ac79 100 if (IsSelected(AliQAv1::GetDetName(iDet))) {
2e331c8b 101 fLoader[iDet] = NULL ;
102 fQADataMaker[iDet] = NULL ;
103 fQACycles[iDet] = 999999 ;
2e331c8b 104 }
105 }
75373542 106 SetWriteExpert() ;
2e331c8b 107}
108
109//_____________________________________________________________________________
634696f5 110AliQAManager::AliQAManager(AliQAv1::MODE_t mode, const Char_t* gAliceFilename) :
2e331c8b 111 AliCDBManager(),
112 fCurrentEvent(0),
113 fCycleSame(kFALSE),
114 fDetectors("ALL"),
115 fDetectorsW("ALL"),
116 fESD(NULL),
117 fESDTree(NULL),
118 fGAliceFileName(gAliceFilename),
119 fFirstEvent(0),
120 fMaxEvents(0),
634696f5 121 fMode(AliQAv1::GetModeName(mode)),
2e331c8b 122 fNumberOfEvents(999999),
123 fRecoParam(),
124 fRunNumber(0),
125 fRawReader(NULL),
126 fRawReaderDelete(kTRUE),
127 fRunLoader(NULL),
bc8761a0 128 fTasks(""),
fec0891b 129 fEventSpecie(AliRecoParam::kDefault),
50dee02c 130 fPrintImage(kTRUE),
131 fSaveData(kTRUE)
2e331c8b 132{
133 // default ctor
134 fMaxEvents = fNumberOfEvents ;
135 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
4e25ac79 136 if (IsSelected(AliQAv1::GetDetName(iDet))) {
2e331c8b 137 fLoader[iDet] = NULL ;
138 fQADataMaker[iDet] = NULL ;
139 fQACycles[iDet] = 999999 ;
65660bf3 140 }
141 }
75373542 142 SetWriteExpert() ;
2e331c8b 143}
144
145//_____________________________________________________________________________
146AliQAManager::AliQAManager(const AliQAManager & qas) :
147 AliCDBManager(),
148 fCurrentEvent(qas.fCurrentEvent),
149 fCycleSame(kFALSE),
150 fDetectors(qas.fDetectors),
151 fDetectorsW(qas.fDetectorsW),
152 fESD(NULL),
153 fESDTree(NULL),
154 fGAliceFileName(qas.fGAliceFileName),
155 fFirstEvent(qas.fFirstEvent),
156 fMaxEvents(qas.fMaxEvents),
157 fMode(qas.fMode),
158 fNumberOfEvents(qas.fNumberOfEvents),
159 fRecoParam(),
160 fRunNumber(qas.fRunNumber),
161 fRawReader(NULL),
162 fRawReaderDelete(kTRUE),
163 fRunLoader(NULL),
bc8761a0 164 fTasks(qas.fTasks),
fec0891b 165 fEventSpecie(qas.fEventSpecie),
50dee02c 166 fPrintImage(qas.fPrintImage),
167 fSaveData(qas.fSaveData)
fec0891b 168
2e331c8b 169{
170 // cpy ctor
171 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
172 fLoader[iDet] = qas.fLoader[iDet] ;
173 fQADataMaker[iDet] = qas.fQADataMaker[iDet] ;
174 fQACycles[iDet] = qas.fQACycles[iDet] ;
175 fQAWriteExpert[iDet] = qas.fQAWriteExpert[iDet] ;
176 }
177}
178
179//_____________________________________________________________________________
180AliQAManager & AliQAManager::operator = (const AliQAManager & qas)
181{
182 // assignment operator
183 this->~AliQAManager() ;
184 new(this) AliQAManager(qas) ;
185 return *this ;
186}
187
188//_____________________________________________________________________________
189AliQAManager::~AliQAManager()
190{
191 // dtor
192 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
4e25ac79 193 if (IsSelected(AliQAv1::GetDetName(iDet))) {
2e331c8b 194 fLoader[iDet] = NULL;
195 if (fQADataMaker[iDet]) {
196 (fQADataMaker[iDet])->Finish() ;
197 delete fQADataMaker[iDet] ;
198 }
199 }
200 }
201 if (fRawReaderDelete) {
202 fRunLoader = NULL ;
203 delete fRawReader ;
204 fRawReader = NULL ;
205 }
fec0891b 206 TCanvas fakeCanvas ;
207 if (fPrintImage)
7c9ff472 208 fakeCanvas.Print(Form("%s%s%d.%s]", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat()), "ps");
2e331c8b 209}
210
211//_____________________________________________________________________________
4e25ac79 212Bool_t AliQAManager::DoIt(const AliQAv1::TASKINDEX_t taskIndex)
2e331c8b 213{
214 // Runs all the QA data Maker for every detector
215
216 Bool_t rv = kFALSE ;
217 // Fill QA data in event loop
218 for (UInt_t iEvent = fFirstEvent ; iEvent < (UInt_t)fMaxEvents ; iEvent++) {
219 fCurrentEvent++ ;
220 // Get the event
221 if ( iEvent%10 == 0 )
5379c4a3 222 AliDebug(AliQAv1::GetQADebugLevel(), Form("processing event %d", iEvent));
4e25ac79 223 if ( taskIndex == AliQAv1::kRAWS ) {
2e331c8b 224 if ( !fRawReader->NextEvent() )
225 break ;
4e25ac79 226 } else if ( taskIndex == AliQAv1::kESDS ) {
2e331c8b 227 if ( fESDTree->GetEntry(iEvent) == 0 )
228 break ;
229 } else {
230 if ( fRunLoader->GetEvent(iEvent) != 0 )
231 break ;
232 }
233 // loop over active loaders
234 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
4e25ac79 235 if (IsSelected(AliQAv1::GetDetName(iDet))) {
2e331c8b 236 AliQADataMaker * qadm = GetQADataMaker(iDet) ;
237 if (!qadm) continue; // This detector doesn't have any QA (for example, HLT)
238 if ( qadm->IsCycleDone() ) {
239 qadm->EndOfCycle(taskIndex) ;
240 }
241 TTree * data = NULL ;
242 AliLoader* loader = GetLoader(qadm->GetUniqueID());
243 switch (taskIndex) {
4e25ac79 244 case AliQAv1::kNULLTASKINDEX :
2e331c8b 245 break ;
4e25ac79 246 case AliQAv1::kRAWS :
2e331c8b 247 qadm->Exec(taskIndex, fRawReader) ;
248 break ;
4e25ac79 249 case AliQAv1::kHITS :
2e331c8b 250 if( loader ) {
251 loader->LoadHits() ;
252 data = loader->TreeH() ;
253 if ( ! data ) {
4e25ac79 254 AliWarning(Form(" Hit Tree not found for %s", AliQAv1::GetDetName(iDet))) ;
2e331c8b 255 break ;
256 }
eca4fa66 257 qadm->Exec(taskIndex, data) ;
2e331c8b 258 }
2e331c8b 259 break ;
4e25ac79 260 case AliQAv1::kSDIGITS :
95144eea 261 {
262
263 TString fileName(Form("%s.SDigits.root", AliQAv1::GetDetName(iDet))) ;
264 if (gSystem->FindFile("./", fileName)) {
265 if( loader ) {
266 loader->LoadSDigits() ;
267 data = loader->TreeS() ;
268 if ( ! data ) {
269 AliWarning(Form(" SDigit Tree not found for %s", AliQAv1::GetDetName(iDet))) ;
270 break ;
271 }
272 qadm->Exec(taskIndex, data) ;
273 }
2e331c8b 274 }
95144eea 275 }
2e331c8b 276 break;
4e25ac79 277 case AliQAv1::kDIGITS :
fec0891b 278 if( loader ) {
279 loader->LoadDigits() ;
280 data = loader->TreeD() ;
281 if ( ! data ) {
282 AliWarning(Form(" Digit Tree not found for %s", AliQAv1::GetDetName(iDet))) ;
283 break ;
284 }
eca4fa66 285 qadm->Exec(taskIndex, data) ;
fec0891b 286 }
eca4fa66 287 break;
fec0891b 288 case AliQAv1::kDIGITSR :
289 if( loader ) {
290 loader->LoadDigits() ;
291 data = loader->TreeD() ;
292 if ( ! data ) {
293 AliWarning(Form(" Digit Tree not found for %s", AliQAv1::GetDetName(iDet))) ;
294 break ;
295 }
eca4fa66 296 qadm->Exec(taskIndex, data) ;
fec0891b 297 }
2e331c8b 298 break;
4e25ac79 299 case AliQAv1::kRECPOINTS :
2e331c8b 300 if( loader ) {
301 loader->LoadRecPoints() ;
302 data = loader->TreeR() ;
303 if (!data) {
4e25ac79 304 AliWarning(Form("RecPoints not found for %s", AliQAv1::GetDetName(iDet))) ;
2e331c8b 305 break ;
306 }
eca4fa66 307 qadm->Exec(taskIndex, data) ;
2e331c8b 308 }
2e331c8b 309 break;
4e25ac79 310 case AliQAv1::kTRACKSEGMENTS :
2e331c8b 311 break;
4e25ac79 312 case AliQAv1::kRECPARTICLES :
2e331c8b 313 break;
4e25ac79 314 case AliQAv1::kESDS :
2e331c8b 315 qadm->Exec(taskIndex, fESD) ;
316 break;
4e25ac79 317 case AliQAv1::kNTASKINDEX :
2e331c8b 318 break;
319 } //task switch
320 }
321 } // detector loop
5e303886 322 Increment(taskIndex) ;
2e331c8b 323 } // event loop
324 // Save QA data for all detectors
5e303886 325
2e331c8b 326 rv = Finish(taskIndex) ;
327
4e25ac79 328 if ( taskIndex == AliQAv1::kRAWS )
2e331c8b 329 fRawReader->RewindEvents() ;
330
331 return rv ;
332}
333
334//_____________________________________________________________________________
4e25ac79 335Bool_t AliQAManager::Finish(const AliQAv1::TASKINDEX_t taskIndex)
2e331c8b 336{
337 // write output to file for all detectors
8fa875cb 338
339 AliQAChecker::Instance()->SetRunNumber(fRunNumber) ;
340
2e331c8b 341 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
4e25ac79 342 if (IsSelected(AliQAv1::GetDetName(iDet))) {
2e331c8b 343 AliQADataMaker * qadm = GetQADataMaker(iDet) ;
344 if (qadm)
345 qadm->EndOfCycle(taskIndex) ;
346 }
347 }
348 return kTRUE ;
349}
350
351//_____________________________________________________________________________
fec0891b 352TObjArray * AliQAManager::GetFromOCDB(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task, const Char_t * year) const
2e331c8b 353{
354 // Retrieve the list of QA data for a given detector and a given task
355 TObjArray * rv = NULL ;
4e25ac79 356 if ( !strlen(AliQAv1::GetQARefStorage()) ) {
357 AliError("No storage defined, use AliQAv1::SetQARefStorage") ;
2e331c8b 358 return NULL ;
359 }
360 if ( ! IsDefaultStorageSet() ) {
4e25ac79 361 TString tmp(AliQAv1::GetQARefDefaultStorage()) ;
2e331c8b 362 tmp.Append(year) ;
363 tmp.Append("/") ;
364 Instance()->SetDefaultStorage(tmp.Data()) ;
4e25ac79 365 Instance()->SetSpecificStorage(Form("%s/*", AliQAv1::GetQAName()), AliQAv1::GetQARefStorage()) ;
2e331c8b 366 }
4e25ac79 367 TString detOCDBDir(Form("%s/%s/%s", AliQAv1::GetQAName(), AliQAv1::GetDetName((Int_t)det), AliQAv1::GetRefOCDBDirName())) ;
5379c4a3 368 AliDebug(AliQAv1::GetQADebugLevel(), Form("Retrieving reference data from %s/%s for %s", AliQAv1::GetQARefStorage(), detOCDBDir.Data(), AliQAv1::GetTaskName(task).Data())) ;
2e331c8b 369 AliCDBEntry* entry = QAManager()->Get(detOCDBDir.Data(), 0) ; //FIXME 0 --> Run Number
eca4fa66 370 TList * listDetQAD = static_cast<TList *>(entry->GetObject()) ;
2e331c8b 371 if ( listDetQAD )
eca4fa66 372 rv = static_cast<TObjArray *>(listDetQAD->FindObject(AliQAv1::GetTaskName(task))) ;
2e331c8b 373 return rv ;
374}
375
fec0891b 376//_____________________________________________________________________________
377TCanvas ** AliQAManager::GetImage(Char_t * detName)
378{
379 // retrieves QA Image for the given detector
380 TCanvas ** rv = NULL ;
381 Int_t detIndex = AliQAv1::GetDetIndex(detName) ;
634696f5 382 AliQACheckerBase * qac = AliQAChecker::Instance()->GetDetQAChecker(detIndex) ;
383 rv = qac->GetImage() ;
fec0891b 384 return rv ;
385}
386
2e331c8b 387//_____________________________________________________________________________
388AliLoader * AliQAManager::GetLoader(Int_t iDet)
389{
390 // get the loader for a detector
391
bf76b847 392 if ( !fRunLoader || iDet == AliQAv1::kCORR || iDet == AliQAv1::kGLOBAL )
2e331c8b 393 return NULL ;
394
4e25ac79 395 TString detName = AliQAv1::GetDetName(iDet) ;
2e331c8b 396 fLoader[iDet] = fRunLoader->GetLoader(detName + "Loader");
397 if (fLoader[iDet])
398 return fLoader[iDet] ;
399
400 // load the QA data maker object
401 TPluginManager* pluginManager = gROOT->GetPluginManager() ;
402 TString loaderName = "Ali" + detName + "Loader" ;
403
404 AliLoader * loader = NULL ;
405 // first check if a plugin is defined for the quality assurance data maker
406 TPluginHandler* pluginHandler = pluginManager->FindHandler("AliLoader", detName) ;
407 // if not, add a plugin for it
408 if (!pluginHandler) {
5379c4a3 409 AliDebug(AliQAv1::GetQADebugLevel(), Form("defining plugin for %s", loaderName.Data())) ;
2e331c8b 410 TString libs = gSystem->GetLibraries() ;
411 if (libs.Contains("lib" + detName + "base.so") || (gSystem->Load("lib" + detName + "base.so") >= 0)) {
412 pluginManager->AddHandler("AliQADataMaker", detName, loaderName, detName + "loader", loaderName + "()") ;
413 } else {
414 pluginManager->AddHandler("AliLoader", detName, loaderName, detName, loaderName + "()") ;
415 }
416 pluginHandler = pluginManager->FindHandler("AliLoader", detName) ;
417 }
418 if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) {
419 loader = (AliLoader *) pluginHandler->ExecPlugin(0) ;
420 }
421 if (loader)
422 fLoader[iDet] = loader ;
423 return loader ;
424}
425
426//_____________________________________________________________________________
4e25ac79 427AliQAv1 * AliQAManager::GetQA(UInt_t run, UInt_t evt)
2e331c8b 428{
429// retrieves the QA object stored in a file named "Run{run}.Event{evt}_1.ESD.tag.root"
fec0891b 430 Char_t * fileName = Form("Run%d.Event%d_1.ESD.tag.root", run, evt) ;
2e331c8b 431 TFile * tagFile = TFile::Open(fileName) ;
432 if ( !tagFile ) {
433 AliError(Form("File %s not found", fileName)) ;
434 return NULL ;
435 }
eca4fa66 436 TTree * tagTree = static_cast<TTree *>(tagFile->Get("T")) ;
2e331c8b 437 if ( !tagTree ) {
438 AliError(Form("Tree T not found in %s", fileName)) ;
439 tagFile->Close() ;
440 return NULL ;
441 }
442 AliRunTag * tag = new AliRunTag ;
443 tagTree->SetBranchAddress("AliTAG", &tag) ;
444 tagTree->GetEntry(evt) ;
4e25ac79 445 AliQAv1 * qa = AliQAv1::Instance(tag->GetQALength(), tag->GetQAArray(), tag->GetESLength(), tag->GetEventSpecies()) ;
2e331c8b 446 tagFile->Close() ;
447 return qa ;
448}
449
450//_____________________________________________________________________________
451AliQADataMaker * AliQAManager::GetQADataMaker(const Int_t iDet)
452{
453 // get the quality assurance data maker for a detector
454
eca4fa66 455 AliQADataMaker * qadm = fQADataMaker[iDet] ;
456
457 if (qadm) {
458
5e232cd6 459 qadm->SetEventSpecie(fEventSpecie) ;
bc8761a0 460 if ( qadm->GetRecoParam() )
eca4fa66 461 if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault)
5e232cd6 462 qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ;
2e331c8b 463
eca4fa66 464 } else if (iDet == AliQAv1::kGLOBAL) { //Global QA
465
466 qadm = new AliGlobalQADataMaker();
4e25ac79 467 qadm->SetName(AliQAv1::GetDetName(iDet));
2e331c8b 468 qadm->SetUniqueID(iDet);
469 fQADataMaker[iDet] = qadm;
5e232cd6 470 qadm->SetEventSpecie(fEventSpecie) ;
bc8761a0 471 if ( qadm->GetRecoParam() )
5e232cd6 472 if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault)
473 qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ;
2e331c8b 474
eca4fa66 475 } else if (iDet == AliQAv1::kCORR && strcmp(GetMode(), "Rec") == 0 ) { //the data maker for correlations among detectors
476 qadm = new AliCorrQADataMakerRec(fQADataMaker) ;
4e25ac79 477 qadm->SetName(AliQAv1::GetDetName(iDet));
2e331c8b 478 qadm->SetUniqueID(iDet);
eca4fa66 479 fQADataMaker[iDet] = qadm;
5e232cd6 480 qadm->SetEventSpecie(fEventSpecie) ;
bc8761a0 481 if ( qadm->GetRecoParam() )
5e232cd6 482 if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault)
483 qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ;
2e331c8b 484
6252ceeb 485 } else if ( iDet < AliQAv1::kHLT ) {
eca4fa66 486
487 // load the QA data maker object
488 TPluginManager* pluginManager = gROOT->GetPluginManager() ;
489 TString detName = AliQAv1::GetDetName(iDet) ;
490 TString qadmName = "Ali" + detName + "QADataMaker" + GetMode() ;
491
492 // first check if a plugin is defined for the quality assurance data maker
493 TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ;
494 // if not, add a plugin for it
495 if (!pluginHandler) {
496 AliDebug(AliQAv1::GetQADebugLevel(), Form("defining plugin for %s", qadmName.Data())) ;
497 TString libs = gSystem->GetLibraries() ;
bf76b847 498 TString temp(GetMode()) ;
499 temp.ToLower() ;
500 if (libs.Contains("lib" + detName + GetMode() + ".so") || (gSystem->Load("lib" + detName + temp.Data() + ".so") >= 0)) {
eca4fa66 501 pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName + "qadm", qadmName + "()") ;
502 } else {
503 pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName, qadmName + "()") ;
504 }
505 pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ;
506 }
507 if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) {
508 qadm = (AliQADataMaker *) pluginHandler->ExecPlugin(0) ;
509 }
510 if (qadm) {
511 qadm->SetName(AliQAv1::GetDetName(iDet));
512 qadm->SetUniqueID(iDet);
513 fQADataMaker[iDet] = qadm ;
514 qadm->SetEventSpecie(fEventSpecie) ;
515 if ( qadm->GetRecoParam() )
516 if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault)
517 qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ;
518 }
519 }
2e331c8b 520 return qadm ;
521}
522
523//_____________________________________________________________________________
524void AliQAManager::EndOfCycle(TObjArray * detArray)
525{
526 // End of cycle QADataMakers
527
8fa875cb 528 AliQAChecker::Instance()->SetRunNumber(fRunNumber) ;
529 if (fPrintImage) {
fec0891b 530 TCanvas fakeCanvas ;
1d46dcf4 531 fakeCanvas.Print(Form("%s%s%d.%s[", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat()), "ps") ;
fec0891b 532 }
2e331c8b 533 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
4e25ac79 534 if (IsSelected(AliQAv1::GetDetName(iDet))) {
2e331c8b 535 AliQADataMaker * qadm = GetQADataMaker(iDet) ;
634696f5 536 AliQACheckerBase * qac = AliQAChecker::Instance()->GetDetQAChecker(iDet) ;
2e331c8b 537 if (!qadm)
538 continue ;
539 // skip non active detectors
540 if (detArray) {
4e25ac79 541 AliModule* det = static_cast<AliModule*>(detArray->FindObject(AliQAv1::GetDetName(iDet))) ;
2e331c8b 542 if (!det || !det->IsActive())
543 continue ;
544 }
634696f5 545 qac->SetPrintImage(fPrintImage) ;
eca4fa66 546
50dee02c 547 if (IsSaveData()) {
548 for (UInt_t taskIndex = 0; taskIndex < AliQAv1::kNTASKINDEX; taskIndex++) {
549 if ( fTasks.Contains(Form("%d", taskIndex)) )
550 qadm->EndOfCycle(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(taskIndex))) ;
551 }
552 }
2e331c8b 553 qadm->Finish();
554 }
555 }
556}
557
558//_____________________________________________________________________________
559void AliQAManager::EndOfCycle(TString detectors)
560{
561 // End of cycle QADataMakers
562
634696f5 563 AliQAChecker::Instance()->SetRunNumber(fRunNumber) ;
fec0891b 564 if (fPrintImage) {
565 TCanvas fakeCanvas ;
1d46dcf4 566 fakeCanvas.Print(Form("%s%s%d.%s[", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat()), "ps") ;
fec0891b 567 }
568 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
4e25ac79 569 if (IsSelected(AliQAv1::GetDetName(iDet))) {
2e331c8b 570 AliQADataMaker * qadm = GetQADataMaker(iDet) ;
634696f5 571 AliQACheckerBase * qac = AliQAChecker::Instance()->GetDetQAChecker(iDet) ;
2e331c8b 572 if (!qadm)
573 continue ;
574 // skip non active detectors
4e25ac79 575 if (!detectors.Contains(AliQAv1::GetDetName(iDet)))
2e331c8b 576 continue ;
634696f5 577 qac->SetPrintImage(fPrintImage) ;
50dee02c 578 if (IsSaveData()) {
579 for (UInt_t taskIndex = 0; taskIndex < AliQAv1::kNTASKINDEX; taskIndex++) {
580 if ( fTasks.Contains(Form("%d", taskIndex)) )
581 qadm->EndOfCycle(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(taskIndex))) ;
582 }
583 }
2e331c8b 584 qadm->Finish();
585 }
586 }
587}
588
589//_____________________________________________________________________________
5e303886 590void AliQAManager::Increment(const AliQAv1::TASKINDEX_t taskIndex)
2e331c8b 591{
592 // Increments the cycle counter for all QA Data Makers
5e303886 593 static AliQAv1::TASKINDEX_t currentTask = AliQAv1::kNTASKINDEX ;
594 if (currentTask == taskIndex)
595 return ;
596 else
597 currentTask = taskIndex ;
2e331c8b 598 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
4e25ac79 599 if (IsSelected(AliQAv1::GetDetName(iDet))) {
2e331c8b 600 AliQADataMaker * qadm = GetQADataMaker(iDet) ;
601 if (qadm)
602 qadm->Increment() ;
603 }
604 }
605}
606
607//_____________________________________________________________________________
fec0891b 608Bool_t AliQAManager::InitQA(const AliQAv1::TASKINDEX_t taskIndex, const Char_t * input )
2e331c8b 609{
610 // Initialize the event source and QA data makers
611
612 fTasks += Form("%d", taskIndex) ;
613
4e25ac79 614 if (taskIndex == AliQAv1::kRAWS) {
2e331c8b 615 if (!fRawReader) {
616 fRawReader = AliRawReader::Create(input);
617 }
618 if ( ! fRawReader )
619 return kFALSE ;
620 fRawReaderDelete = kTRUE ;
621 fRawReader->NextEvent() ;
622 fRunNumber = fRawReader->GetRunNumber() ;
623 SetRun(fRunNumber) ;
624 fRawReader->RewindEvents();
625 fNumberOfEvents = 999999 ;
626 if ( fMaxEvents < 0 )
627 fMaxEvents = fNumberOfEvents ;
4e25ac79 628 } else if (taskIndex == AliQAv1::kESDS) {
629 fTasks = AliQAv1::GetTaskName(AliQAv1::kESDS) ;
2e331c8b 630 if (!gSystem->AccessPathName("AliESDs.root")) { // AliESDs.root exists
631 TFile * esdFile = TFile::Open("AliESDs.root") ;
eca4fa66 632 fESDTree = static_cast<TTree *> (esdFile->Get("esdTree")) ;
2e331c8b 633 if ( !fESDTree ) {
634 AliError("esdTree not found") ;
635 return kFALSE ;
636 } else {
637 fESD = new AliESDEvent() ;
638 fESD->ReadFromTree(fESDTree) ;
639 fESDTree->GetEntry(0) ;
640 fRunNumber = fESD->GetRunNumber() ;
641 fNumberOfEvents = fESDTree->GetEntries() ;
642 if ( fMaxEvents < 0 )
643 fMaxEvents = fNumberOfEvents ;
644 }
645 } else {
646 AliError("AliESDs.root not found") ;
647 return kFALSE ;
648 }
649 } else {
650 if ( !InitRunLoader() ) {
651 AliWarning("No Run Loader not found") ;
652 } else {
653 fNumberOfEvents = fRunLoader->GetNumberOfEvents() ;
654 if ( fMaxEvents < 0 )
655 fMaxEvents = fNumberOfEvents ;
656 }
657 }
658
659 // Get Detectors
660 TObjArray* detArray = NULL ;
661 if (fRunLoader) // check if RunLoader exists
662 if ( fRunLoader->GetAliRun() ) { // check if AliRun exists in gAlice.root
663 detArray = fRunLoader->GetAliRun()->Detectors() ;
664 fRunNumber = fRunLoader->GetHeader()->GetRun() ;
665 }
666
667 // Initialize all QA data makers for all detectors
668 fRunNumber = AliCDBManager::Instance()->GetRun() ;
669 if ( ! AliGeomManager::GetGeometry() )
670 AliGeomManager::LoadGeometry() ;
671
672 InitQADataMaker(fRunNumber, detArray) ; //, fCycleSame, kTRUE, detArray) ;
fec0891b 673 if (fPrintImage) {
674 TCanvas fakeCanvas ;
7c9ff472 675 TStopwatch timer ;
676 timer.Start() ;
677 while (timer.CpuTime()<5) {
678 timer.Continue();
679 gSystem->ProcessEvents();
680 }
1d46dcf4 681 fakeCanvas.Print(Form("%s%s%d.%s[", AliQAv1::GetImageFileName(), GetMode(), fRunNumber, AliQAv1::GetImageFileFormat()), "ps") ;
fec0891b 682 }
2e331c8b 683 return kTRUE ;
684}
685
686//_____________________________________________________________________________
687void AliQAManager::InitQADataMaker(UInt_t run, TObjArray * detArray)
688{
689 // Initializes The QADataMaker for all active detectors and for all active tasks
fec0891b 690 fRunNumber = run ;
2e331c8b 691 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
4e25ac79 692 if (IsSelected(AliQAv1::GetDetName(iDet))) {
2e331c8b 693 AliQADataMaker * qadm = GetQADataMaker(iDet) ;
694 if (!qadm) {
4e25ac79 695 AliError(Form("AliQADataMaker not found for %s", AliQAv1::GetDetName(iDet))) ;
696 fDetectorsW.ReplaceAll(AliQAv1::GetDetName(iDet), "") ;
2e331c8b 697 } else {
698 if (fQAWriteExpert[iDet])
699 qadm->SetWriteExpert() ;
5379c4a3 700 AliDebug(AliQAv1::GetQADebugLevel(), Form("Data Maker found for %s %d", qadm->GetName(), qadm->WriteExpert())) ;
2e331c8b 701 // skip non active detectors
702 if (detArray) {
4e25ac79 703 AliModule* det = static_cast<AliModule*>(detArray->FindObject(AliQAv1::GetDetName(iDet))) ;
2e331c8b 704 if (!det || !det->IsActive())
705 continue ;
706 }
2e331c8b 707 // Set default reco params
708 Bool_t sameCycle = kFALSE ;
4e25ac79 709 for (UInt_t taskIndex = 0; taskIndex < AliQAv1::kNTASKINDEX; taskIndex++) {
2e331c8b 710 if ( fTasks.Contains(Form("%d", taskIndex)) ) {
4e25ac79 711 qadm->Init(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(taskIndex)), GetQACycles(qadm->GetUniqueID())) ;
712 qadm->StartOfCycle(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(taskIndex)), run, sameCycle) ;
2e331c8b 713 sameCycle = kTRUE ;
714 }
715 }
716 }
717 }
718 }
719}
720
721
722//_____________________________________________________________________________
723Bool_t AliQAManager::InitRunLoader()
724{
725 // get or create the run loader
726 if (fRunLoader) {
727 fCycleSame = kTRUE ;
728 } else {
729 if (!gSystem->AccessPathName(fGAliceFileName.Data())) { // galice.root exists
730 // load all base libraries to get the loader classes
731 TString libs = gSystem->GetLibraries() ;
732 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
4e25ac79 733 if (!IsSelected(AliQAv1::GetDetName(iDet)))
2e331c8b 734 continue ;
4e25ac79 735 TString detName = AliQAv1::GetDetName(iDet) ;
2e331c8b 736 if (detName == "HLT")
737 continue;
738 if (libs.Contains("lib" + detName + "base.so"))
739 continue;
740 gSystem->Load("lib" + detName + "base.so");
741 }
742 fRunLoader = AliRunLoader::Open(fGAliceFileName.Data());
743 if (!fRunLoader) {
744 AliError(Form("no run loader found in file %s", fGAliceFileName.Data()));
745 return kFALSE;
746 }
747 fRunLoader->CdGAFile();
748 if (fRunLoader->LoadgAlice() == 0) {
749 gAlice = fRunLoader->GetAliRun();
750 }
751
752 if (!gAlice) {
753 AliError(Form("no gAlice object found in file %s", fGAliceFileName.Data()));
754 return kFALSE;
755 }
756
757 } else { // galice.root does not exist
758 AliError(Form("the file %s does not exist", fGAliceFileName.Data()));
759 return kFALSE;
760 }
761 }
762
763 if (!fRunNumber) {
764 fRunLoader->LoadHeader();
765 fRunNumber = fRunLoader->GetHeader()->GetRun() ;
766 }
767 return kTRUE;
768}
769
770//_____________________________________________________________________________
fec0891b 771Bool_t AliQAManager::IsSelected(const Char_t * det)
2e331c8b 772{
773 // check whether detName is contained in detectors
774 // if yes, it is removed from detectors
775
776 Bool_t rv = kFALSE;
777 const TString detName(det) ;
778 // always activates Correlation
4e25ac79 779 if ( detName.Contains(AliQAv1::GetDetName(AliQAv1::kCORR))) {
2e331c8b 780 rv = kTRUE ;
781 } else {
782 // check if all detectors are selected
783 if (fDetectors.Contains("ALL")) {
784 fDetectors = "ALL";
785 rv = kTRUE;
786 } else if ((fDetectors.CompareTo(detName) == 0) ||
787 fDetectors.BeginsWith(detName+" ") ||
788 fDetectors.EndsWith(" "+detName) ||
789 fDetectors.Contains(" "+detName+" ")) {
790 rv = kTRUE;
791 }
792 }
793 return rv ;
794}
795
796//_____________________________________________________________________________
87da0921 797Bool_t AliQAManager::Merge(Int_t runNumber, const char *fileName) const
2e331c8b 798{
bededc30 799 // Merge data from all detectors from a given run in one single file
87da0921 800 // Merge the QA results from all the data chunks in one run
801 // The 'fileName' is name of the output file with merged QA data
bededc30 802 if ( runNumber == -1)
803 runNumber = fRunNumber ;
87da0921 804 Bool_t rv = MergeData(runNumber,fileName) ;
bededc30 805 //rv *= MergeResults(runNumber) ; // not needed for the time being
2e331c8b 806 return rv ;
807}
808
149a2367 809//______________________________________________________________________
fec0891b 810Bool_t AliQAManager::MergeXML(const Char_t * collectionFile, const Char_t * subFile, const Char_t * outFile)
149a2367 811{
812 // merges files listed in a xml collection
813 // usage Merge(collection, outputFile))
814 // collection: is a xml collection
815
816 Bool_t rv = kFALSE ;
817
818 if ( strstr(collectionFile, ".xml") == 0 ) {
819 AliError("Input collection file must be an \".xml\" file\n") ;
820 return kFALSE ;
821 }
822
823 if ( !gGrid )
824 TGrid::Connect("alien://");
825 if ( !gGrid )
826 return kFALSE ;
827
828 // Open the file collection
5e232cd6 829 AliInfoClass(Form("*** Create Collection ***\n*** Wk-Dir = |%s| \n*** Coll = |%s| \n",gSystem->WorkingDirectory(), collectionFile));
149a2367 830
bededc30 831 TGridCollection * collection = (TGridCollection*)gROOT->ProcessLine(Form("TAlienCollection::Open(\"%s\")",collectionFile));
149a2367 832 TGridResult* result = collection->GetGridResult("", 0, 0);
833
834 Int_t index = 0 ;
fec0891b 835 const Char_t * turl ;
adae62c9 836 TFileMerger merger(kFALSE) ;
149a2367 837 if (!outFile) {
838 TString tempo(collectionFile) ;
839 if ( subFile)
840 tempo.ReplaceAll(".xml", subFile) ;
841 else
842 tempo.ReplaceAll(".xml", "_Merged.root") ;
843 outFile = tempo.Data() ;
844 }
845 merger.OutputFile(outFile) ;
846
847 while ( (turl = result->GetKey(index, "turl")) ) {
fec0891b 848 Char_t * file ;
149a2367 849 if ( subFile )
850 file = Form("%s#%s", turl, subFile) ;
851 else
852 file = Form("%s", turl) ;
853
5379c4a3 854 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s\n", file)) ;
149a2367 855 merger.AddFile(file) ;
856 index++ ;
857 }
858
859 if (index)
860 merger.Merge() ;
861
5379c4a3 862 AliDebug(AliQAv1::GetQADebugLevel(), Form("Files merged into %s\n", outFile)) ;
149a2367 863
864 rv = kFALSE;
865 return rv ;
866}
867
69a898e3 868//_____________________________________________________________________________
869void AliQAManager::MergeCustom() const
870{
871 // Custom Merge of QA data from all detectors for all runs in one single file
872 // search all the run numbers
873 // search all the run numbers
874 gROOT->ProcessLine(".! ls *QA*.root > QAtempo.txt") ;
875 TString QAfile ;
876 FILE * QAfiles = fopen("QAtempo.txt", "r") ;
877 Int_t index = 0 ;
878 TList srunList ;
879 TIter nextRun(&srunList) ;
880 TObjString * srun = NULL ;
881 Int_t loRun = 999999999 ;
882 Int_t hiRun = 0 ;
883 while ( QAfile.Gets(QAfiles) ) {
884 Bool_t runExist = kFALSE ;
885 TString srunNew(QAfile(QAfile.Index("QA.")+3, QAfile.Index(".root")-(QAfile.Index("QA.")+3))) ;
886 Int_t cuRun = srunNew.Atoi() ;
887 if (cuRun < loRun)
888 loRun = cuRun ;
889 if (cuRun > hiRun)
890 hiRun = cuRun ;
eca4fa66 891 while ( (srun = static_cast<TObjString *> (nextRun())) ) {
69a898e3 892 if ( cuRun == (srun->String()).Atoi() ) {
893 runExist = kTRUE ;
894 break ;
895 }
896 }
897 nextRun.Reset() ;
898 if ( ! runExist )
899 srunList.Add(new TObjString(srunNew.Data()));
900 }
901 nextRun.Reset() ;
902 Int_t runNumber = 0 ;
4e25ac79 903 TFile mergedFile(Form("Merged.%s.Data.root", AliQAv1::GetQADataFileName()), "RECREATE") ;
69a898e3 904 TH1I * hisRun = new TH1I("hLMR", "List of merged runs", hiRun-loRun+10, loRun, hiRun+10) ;
905 // create the structure into the merged file
4e25ac79 906 for (Int_t iDet = 0; iDet < AliQAv1::kNDET ; iDet++) {
907 TDirectory * detDir = mergedFile.mkdir(AliQAv1::GetDetName(iDet)) ;
908 for (Int_t taskIndex = 0; taskIndex < AliQAv1::kNTASKINDEX; taskIndex++) {
69a898e3 909 detDir->cd() ;
4e25ac79 910 TDirectory * taskDir = gDirectory->mkdir(AliQAv1::GetTaskName(taskIndex)) ;
69a898e3 911 for (Int_t es = 0 ; es < AliRecoParam::kNSpecies ; es++) {
912 taskDir->cd() ;
913 TDirectory * esDir = gDirectory->mkdir(AliRecoParam::GetEventSpecieName(es)) ;
914 esDir->cd() ;
4e25ac79 915 gDirectory->mkdir(AliQAv1::GetExpert()) ;
69a898e3 916 }
917 }
918 }
eca4fa66 919 while ( (srun = static_cast<TObjString *> (nextRun())) ) {
69a898e3 920 runNumber = (srun->String()).Atoi() ;
921 hisRun->Fill(runNumber) ;
5379c4a3 922 AliDebug(AliQAv1::GetQADebugLevel(), Form("Merging run number %d", runNumber)) ;
69a898e3 923 // search all QA files for runNumber in the current directory
fec0891b 924 Char_t * fileList[AliQAv1::kNDET] ;
69a898e3 925 index = 0 ;
4e25ac79 926 for (Int_t iDet = 0; iDet < AliQAv1::kNDET ; iDet++) {
fec0891b 927 Char_t * file = gSystem->Which(gSystem->WorkingDirectory(), Form("%s.%s.%d.root", AliQAv1::GetDetName(iDet), AliQAv1::GetQADataFileName(), runNumber));
69a898e3 928 if (file)
929 fileList[index++] = file ;
930 }
931 if ( index == 0 ) {
932 AliError("No QA data file found\n") ;
933 return ;
934 }
935 for ( Int_t i = 0 ; i < index ; i++) {
936 TFile * inFile = TFile::Open(fileList[i]) ;
937 TList * listOfKeys =inFile->GetListOfKeys() ;
938 TIter nextkey(listOfKeys) ;
939 TObject * obj1 ;
940 TString dirName("") ;
941 while ( (obj1 = nextkey()) ) {
942 TDirectory * directoryDet = inFile->GetDirectory(obj1->GetName()) ;
943 if ( directoryDet ) {
5379c4a3 944 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s dir = %s", inFile->GetName(), directoryDet->GetName())) ;
69a898e3 945 dirName += Form("%s/", directoryDet->GetName() ) ;
946 directoryDet->cd() ;
947 TList * listOfTasks = directoryDet->GetListOfKeys() ;
948 TIter nextTask(listOfTasks) ;
949 TObject * obj2 ;
950 while ( (obj2 = nextTask()) ) {
951 TDirectory * directoryTask = directoryDet->GetDirectory(obj2->GetName()) ;
952 if ( directoryTask ) {
953 dirName += Form("%s", obj2->GetName()) ;
5379c4a3 954 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s", dirName.Data())) ;
69a898e3 955 directoryTask->cd() ;
956 TList * listOfEventSpecie = directoryTask->GetListOfKeys() ;
957 TIter nextEventSpecie(listOfEventSpecie) ;
958 TObject * obj3 ;
959 while ( (obj3 = nextEventSpecie()) ) {
960 TDirectory * directoryEventSpecie = directoryTask->GetDirectory(obj3->GetName()) ;
961 if ( directoryEventSpecie ) {
962 dirName += Form("/%s/", obj3->GetName()) ;
5379c4a3 963 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s\n", dirName.Data())) ;
69a898e3 964 directoryEventSpecie->cd() ;
965 // histograms are here
966 TDirectory * mergedDirectory = mergedFile.GetDirectory(dirName.Data()) ;
967 TList * listOfData = directoryEventSpecie->GetListOfKeys() ;
968 TIter nextData(listOfData) ;
969 TKey * key ;
eca4fa66 970 while ( (key = static_cast<TKey *>(nextData())) ) {
69a898e3 971 TString className(key->GetClassName()) ;
972 if ( className.Contains("TH") || className.Contains("TProfile") ) {
eca4fa66 973 TH1 * histIn = static_cast<TH1*> (key->ReadObj()) ;
974 TH1 * histOu = static_cast<TH1*> (mergedDirectory->FindObjectAny(histIn->GetName())) ;
5379c4a3 975 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s %x %x\n", key->GetName(), histIn, histOu)) ;
69a898e3 976 mergedDirectory->cd() ;
977 if ( ! histOu ) {
978 histIn->Write() ;
979 } else {
980 histOu->Add(histIn) ;
981 histOu->Write(histOu->GetName(), kOverwrite) ;
982 }
983 }
984 else if ( className.Contains("TDirectoryFile") ) {
985 TDirectory * dirExpert = directoryEventSpecie->GetDirectory(key->GetName()) ;
986 dirExpert->cd() ;
987 TDirectory * mergedDirectoryExpert = mergedDirectory->GetDirectory(dirExpert->GetName()) ;
988 TList * listOfExpertData = dirExpert->GetListOfKeys() ;
989 TIter nextExpertData(listOfExpertData) ;
990 TKey * keykey ;
eca4fa66 991 while ( (keykey = static_cast<TKey *>(nextExpertData())) ) {
69a898e3 992 TString classNameExpert(keykey->GetClassName()) ;
993 if (classNameExpert.Contains("TH")) {
eca4fa66 994 TH1 * histInExpert = static_cast<TH1*> (keykey->ReadObj()) ;
995 TH1 * histOuExpert = static_cast<TH1*> (mergedDirectory->FindObjectAny(histInExpert->GetName())) ;
69a898e3 996 mergedDirectoryExpert->cd() ;
997 if ( ! histOuExpert ) {
998 histInExpert->Write() ;
999 } else {
1000 histOuExpert->Add(histInExpert) ;
1001 histOuExpert->Write(histOuExpert->GetName(), kOverwrite) ;
1002 }
1003 }
1004 }
1005 } else {
1006 AliError(Form("No merge done for this object %s in %s", key->GetName(), dirName.Data())) ;
1007 }
1008 }
1009 dirName.ReplaceAll(Form("/%s/",obj3->GetName()), "") ;
1010 }
1011 }
1012 dirName.ReplaceAll(obj2->GetName(), "") ;
1013 }
1014 }
1015 }
1016 }
1017 inFile->Close() ;
1018 }
1019 }
1020 mergedFile.cd() ;
1021 hisRun->Write() ;
1022 mergedFile.Close() ;
1023 srunList.Delete() ;
1024}
1025
2e331c8b 1026//_____________________________________________________________________________
87da0921 1027Bool_t AliQAManager::MergeData(const Int_t runNumber, const char *fileName) const
2e331c8b 1028{
bededc30 1029 // Merge QA data from all detectors for a given run in one single file
1030
87da0921 1031 TFileMerger merger(kFALSE) ;
1032 TString outFileName = fileName;
1033 if (outFileName.IsNull()) outFileName.Form("Merged.%s.Data.root",AliQAv1::GetQADataFileName());
2e331c8b 1034 merger.OutputFile(outFileName.Data()) ;
bededc30 1035 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
fec0891b 1036 Char_t * file = gSystem->Which(gSystem->WorkingDirectory(), Form("%s.%s.%d.root", AliQAv1::GetDetName(iDet), AliQAv1::GetQADataFileName(), runNumber));
bededc30 1037 if (file)
1038 merger.AddFile(file) ;
1039 }
2e331c8b 1040 merger.Merge() ;
1041 return kTRUE ;
1042}
1043
1044//_____________________________________________________________________________
1045Bool_t AliQAManager::MergeResults(const Int_t runNumber) const
1046{
1047 // Merge the QA result from all the data chunks in a run
bededc30 1048 // to be revised whwn it will be used (see MergeData)
2e331c8b 1049 TString cmd ;
4e25ac79 1050 cmd = Form(".! ls %s*.root > tempo.txt", AliQAv1::GetQADataFileName()) ;
2e331c8b 1051 gROOT->ProcessLine(cmd.Data()) ;
1052 ifstream in("tempo.txt") ;
1053 const Int_t chunkMax = 100 ;
1054 TString fileList[chunkMax] ;
1055
1056 Int_t index = 0 ;
1057 while ( 1 ) {
1058 TString file ;
1059 in >> fileList[index] ;
1060 if ( !in.good() )
1061 break ;
5379c4a3 1062 AliDebug(AliQAv1::GetQADebugLevel(), Form("index = %d file = %s", index, (fileList[index].Data()))) ;
2e331c8b 1063 index++ ;
1064 }
1065
1066 if ( index == 0 ) {
1067 AliError("No QA Result File found") ;
1068 return kFALSE ;
1069 }
1070
1071 TFileMerger merger ;
fc07289e 1072 TString outFileName ;
1073 if (runNumber != -1)
4e25ac79 1074 outFileName = Form("Merged.%s.Result.%d.root",AliQAv1::GetQADataFileName(),runNumber);
fc07289e 1075 else
4e25ac79 1076 outFileName = Form("Merged.%s.Result.root",AliQAv1::GetQADataFileName());
2e331c8b 1077 merger.OutputFile(outFileName.Data()) ;
1078 for (Int_t ifile = 0 ; ifile < index ; ifile++) {
1079 TString file = fileList[ifile] ;
1080 merger.AddFile(file) ;
1081 }
1082 merger.Merge() ;
1083
1084 return kTRUE ;
1085}
1086
1087//_____________________________________________________________________________
1088void AliQAManager::Reset(const Bool_t sameCycle)
1089{
1090 // Reset the default data members
1091
1092 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
4e25ac79 1093 if (IsSelected(AliQAv1::GetDetName(iDet))) {
2e331c8b 1094 AliQADataMaker * qadm = GetQADataMaker(iDet);
1095 qadm->Reset();
1096 }
1097 }
1098 if (fRawReaderDelete) {
1099 delete fRawReader ;
1100 fRawReader = NULL ;
1101 }
1102
1103 fCycleSame = sameCycle ;
1104 fESD = NULL ;
1105 fESDTree = NULL ;
1106 //fFirst = kTRUE ;
1107 fNumberOfEvents = 999999 ;
1108}
1109
1110//_____________________________________________________________________________
634696f5 1111AliQAManager * AliQAManager::QAManager(AliQAv1::MODE_t mode, TMap *entryCache, Int_t run)
2e331c8b 1112{
1113 // returns AliQAManager instance (singleton)
1114
1115 if (!fgQAInstance) {
634696f5 1116 if ( (mode != AliQAv1::kSIMMODE) && (mode != AliQAv1::kRECMODE) ) {
1117 AliErrorClass("You must specify kSIMMODE or kRECMODE") ;
bf76b847 1118 return NULL ;
1119 }
2e331c8b 1120 fgQAInstance = new AliQAManager(mode) ;
1121 if (!entryCache)
1122 fgQAInstance->Init();
1123 else
1124 fgQAInstance->InitFromCache(entryCache,run);
1125 }
1126 return fgQAInstance;
1127}
1128
5e303886 1129//_____________________________________________________________________________
1130AliQAManager * AliQAManager::QAManager(AliQAv1::TASKINDEX_t task)
1131{
1132 // returns AliQAManager instance (singleton)
634696f5 1133 return QAManager(AliQAv1::Mode(task)) ;
5e303886 1134}
1135
2e331c8b 1136//_____________________________________________________________________________
fec0891b 1137TString AliQAManager::Run(const Char_t * detectors, AliRawReader * rawReader, const Bool_t sameCycle)
2e331c8b 1138{
1139 //Runs all the QA data Maker for Raws only
1140
1141 fCycleSame = sameCycle ;
1142 fRawReader = rawReader ;
1143 fDetectors = detectors ;
1144 fDetectorsW = detectors ;
1145
1146 AliCDBManager* man = AliCDBManager::Instance() ;
1147
1148 if ( man->GetRun() == -1 ) {// check if run number not set previously and set it from raw data
1149 rawReader->NextEvent() ;
1150 man->SetRun(fRawReader->GetRunNumber()) ;
1151 rawReader->RewindEvents() ;
1152 }
1153
1154 if (!fCycleSame)
4e25ac79 1155 if ( !InitQA(AliQAv1::kRAWS) )
9b4aee57 1156 return "" ;
2e331c8b 1157 fRawReaderDelete = kFALSE ;
1158
4e25ac79 1159 DoIt(AliQAv1::kRAWS) ;
2e331c8b 1160 return fDetectorsW ;
1161}
1162
1163//_____________________________________________________________________________
fec0891b 1164TString AliQAManager::Run(const Char_t * detectors, const Char_t * fileName, const Bool_t sameCycle)
2e331c8b 1165{
1166 //Runs all the QA data Maker for Raws only
1167
1168 fCycleSame = sameCycle ;
1169 fDetectors = detectors ;
1170 fDetectorsW = detectors ;
1171
1172 AliCDBManager* man = AliCDBManager::Instance() ;
1173 if ( man->GetRun() == -1 ) { // check if run number not set previously and set it from AliRun
1174 AliRunLoader * rl = AliRunLoader::Open("galice.root") ;
1175 if ( ! rl ) {
1176 AliFatal("galice.root file not found in current directory") ;
1177 } else {
1178 rl->CdGAFile() ;
1179 rl->LoadgAlice() ;
1180 if ( ! rl->GetAliRun() ) {
1181 AliFatal("AliRun not found in galice.root") ;
1182 } else {
1183 rl->LoadHeader() ;
1184 man->SetRun(rl->GetHeader()->GetRun());
1185 }
1186 }
1187 }
1188
1189 if (!fCycleSame)
4e25ac79 1190 if ( !InitQA(AliQAv1::kRAWS, fileName) )
9b4aee57 1191 return "" ;
2e331c8b 1192
4e25ac79 1193 DoIt(AliQAv1::kRAWS) ;
2e331c8b 1194 return fDetectorsW ;
1195}
1196
1197//_____________________________________________________________________________
fec0891b 1198TString AliQAManager::Run(const Char_t * detectors, const AliQAv1::TASKINDEX_t taskIndex, Bool_t const sameCycle, const Char_t * fileName )
2e331c8b 1199{
1200 // Runs all the QA data Maker for every detector
1201
1202 fCycleSame = sameCycle ;
1203 fDetectors = detectors ;
1204 fDetectorsW = detectors ;
1205
1206 AliCDBManager* man = AliCDBManager::Instance() ;
1207 if ( man->GetRun() == -1 ) { // check if run number not set previously and set it from AliRun
1208 AliRunLoader * rl = AliRunLoader::Open("galice.root") ;
1209 if ( ! rl ) {
1210 AliFatal("galice.root file not found in current directory") ;
1211 } else {
1212 rl->CdGAFile() ;
1213 rl->LoadgAlice() ;
1214 if ( ! rl->GetAliRun() ) {
5379c4a3 1215 AliDebug(AliQAv1::GetQADebugLevel(), "AliRun not found in galice.root") ;
2e331c8b 1216 } else {
1217 rl->LoadHeader() ;
1218 man->SetRun(rl->GetHeader()->GetRun()) ;
1219 }
1220 }
1221 }
fec0891b 1222 if ( taskIndex == AliQAv1::kNULLTASKINDEX) {
4e25ac79 1223 for (UInt_t task = 0; task < AliQAv1::kNTASKINDEX; task++) {
2e331c8b 1224 if ( fTasks.Contains(Form("%d", task)) ) {
1225 if (!fCycleSame)
4e25ac79 1226 if ( !InitQA(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(task)), fileName) )
9b4aee57 1227 return "" ;
4e25ac79 1228 DoIt(AliQAv1::GetTaskIndex(AliQAv1::GetTaskName(task))) ;
2e331c8b 1229 }
1230 }
1231 } else {
1232 if (! fCycleSame )
1233 if ( !InitQA(taskIndex, fileName) )
9b4aee57 1234 return "" ;
2e331c8b 1235 DoIt(taskIndex) ;
1236 }
2e331c8b 1237 return fDetectorsW ;
2e331c8b 1238}
1239
1240//_____________________________________________________________________________
1241void AliQAManager::RunOneEvent(AliRawReader * rawReader)
1242{
1243 //Runs all the QA data Maker for Raws only and on one event only (event loop done by calling method)
1244 if ( ! rawReader )
1245 return ;
99c136e1 1246 AliCodeTimerAuto("",0) ;
0d105c36 1247 if (fTasks.Contains(Form("%d", AliQAv1::kRAWS))){
2e331c8b 1248 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
4e25ac79 1249 if (!IsSelected(AliQAv1::GetDetName(iDet)))
2e331c8b 1250 continue;
1251 AliQADataMaker *qadm = GetQADataMaker(iDet);
1252 if (!qadm)
1253 continue;
1254 if ( qadm->IsCycleDone() ) {
1255 qadm->EndOfCycle() ;
1256 }
4e25ac79 1257 AliCodeTimerStart(Form("running RAW quality assurance data maker for %s", AliQAv1::GetDetName(iDet)));
5e232cd6 1258 qadm->SetEventSpecie(fEventSpecie) ;
13a2370e 1259 if ( qadm->GetRecoParam() )
5e232cd6 1260 if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault)
1261 qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ;
4e25ac79 1262 qadm->Exec(AliQAv1::kRAWS, rawReader) ;
1263 AliCodeTimerStop(Form("running RAW quality assurance data maker for %s", AliQAv1::GetDetName(iDet)));
2e331c8b 1264 }
1265 }
1266}
1267
1268//_____________________________________________________________________________
1269void AliQAManager::RunOneEvent(AliESDEvent *& esd)
1270{
1271 //Runs all the QA data Maker for ESDs only and on one event only (event loop done by calling method)
1272
99c136e1 1273 AliCodeTimerAuto("",0) ;
0d105c36 1274 if (fTasks.Contains(Form("%d", AliQAv1::kESDS))) {
2e331c8b 1275 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
4e25ac79 1276 if (!IsSelected(AliQAv1::GetDetName(iDet)))
2e331c8b 1277 continue;
1278 AliQADataMaker *qadm = GetQADataMaker(iDet);
1279 if (!qadm)
1280 continue;
5e232cd6 1281 qadm->SetEventSpecie(fEventSpecie) ;
82a30871 1282 if ( qadm->GetRecoParam() )
5e232cd6 1283 if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault)
1284 qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ;
2e331c8b 1285 if ( qadm->IsCycleDone() ) {
1286 qadm->EndOfCycle() ;
1287 }
4e25ac79 1288 AliCodeTimerStart(Form("running ESD quality assurance data maker for %s", AliQAv1::GetDetName(iDet)));
1289 qadm->Exec(AliQAv1::kESDS, esd) ;
1290 AliCodeTimerStop(Form("running ESD quality assurance data maker for %s", AliQAv1::GetDetName(iDet)));
2e331c8b 1291 }
1292 }
1293}
1294
1295//_____________________________________________________________________________
1296void AliQAManager::RunOneEventInOneDetector(Int_t det, TTree * tree)
1297{
1298 // Runs all the QA data Maker for ESDs only and on one event only (event loop done by calling method)
44ed7a66 1299
1300 TString test(tree->GetName()) ;
99c136e1 1301 AliCodeTimerAuto("",0) ;
0d105c36 1302 if (fTasks.Contains(Form("%d", AliQAv1::kRECPOINTS))) {
4e25ac79 1303 if (IsSelected(AliQAv1::GetDetName(det))) {
2e331c8b 1304 AliQADataMaker *qadm = GetQADataMaker(det);
1305 if (qadm) {
5e232cd6 1306 qadm->SetEventSpecie(fEventSpecie) ;
31c31326 1307 if ( qadm->GetRecoParam() ) {
5e232cd6 1308 if ( AliRecoParam::Convert(qadm->GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault)
31c31326 1309 qadm->SetEventSpecie(qadm->GetRecoParam()->GetEventSpecie()) ;
1310 else
5c5ea798 1311 AliError(Form("%d defined by %s is not an event specie", qadm->GetRecoParam()->GetEventSpecie(), qadm->GetName())) ;
31c31326 1312 }
2e331c8b 1313 if ( qadm->IsCycleDone() ) {
1314 qadm->EndOfCycle() ;
1315 }
4e25ac79 1316 AliCodeTimerStart(Form("running RecPoints quality assurance data maker for %s", AliQAv1::GetDetName(det)));
44ed7a66 1317 if (test.Contains("TreeD")) {
1318 qadm->Exec(AliQAv1::kDIGITSR, tree) ;
44ed7a66 1319 } else if (test.Contains("TreeR")) {
1320 qadm->Exec(AliQAv1::kRECPOINTS, tree) ;
1321 AliCodeTimerStop(Form("running RecPoints quality assurance data maker for %s", AliQAv1::GetDetName(det)));
1322 }
2e331c8b 1323 }
1324 }
1325 }
1326}
1327
1328//_____________________________________________________________________________
fec0891b 1329Bool_t AliQAManager::Save2OCDB(const Int_t runNumber, AliRecoParam::EventSpecie_t es, const Char_t * year, const Char_t * detectors) const
2e331c8b 1330{
1331 // take the locasl QA data merge into a single file and save in OCDB
1332 Bool_t rv = kTRUE ;
4e25ac79 1333 TString tmp(AliQAv1::GetQARefStorage()) ;
2e331c8b 1334 if ( tmp.IsNull() ) {
4e25ac79 1335 AliError("No storage defined, use AliQAv1::SetQARefStorage") ;
2e331c8b 1336 return kFALSE ;
1337 }
4e25ac79 1338 if ( !(tmp.Contains(AliQAv1::GetLabLocalOCDB()) || tmp.Contains(AliQAv1::GetLabAliEnOCDB())) ) {
1339 AliError(Form("%s is a wrong storage, use %s or %s", AliQAv1::GetQARefStorage(), AliQAv1::GetLabLocalOCDB().Data(), AliQAv1::GetLabAliEnOCDB().Data())) ;
2e331c8b 1340 return kFALSE ;
1341 }
1342 TString sdet(detectors) ;
1343 sdet.ToUpper() ;
1344 TFile * inputFile ;
1345 if ( sdet.Contains("ALL") ) {
1346 rv = Merge(runNumber) ;
1347 if ( ! rv )
1348 return kFALSE ;
4e25ac79 1349 TString inputFileName(Form("Merged.%s.Data.%d.root", AliQAv1::GetQADataFileName(), runNumber)) ;
2e331c8b 1350 inputFile = TFile::Open(inputFileName.Data()) ;
1351 rv = SaveIt2OCDB(runNumber, inputFile, year, es) ;
1352 } else {
4e25ac79 1353 for (Int_t index = 0; index < AliQAv1::kNDET; index++) {
1354 if (sdet.Contains(AliQAv1::GetDetName(index))) {
1355 TString inputFileName(Form("%s.%s.%d.root", AliQAv1::GetDetName(index), AliQAv1::GetQADataFileName(), runNumber)) ;
2e331c8b 1356 inputFile = TFile::Open(inputFileName.Data()) ;
1357 rv *= SaveIt2OCDB(runNumber, inputFile, year, es) ;
1358 }
1359 }
1360 }
1361 return rv ;
1362}
1363
1364//_____________________________________________________________________________
fec0891b 1365Bool_t AliQAManager::SaveIt2OCDB(const Int_t runNumber, TFile * inputFile, const Char_t * year, AliRecoParam::EventSpecie_t es) const
2e331c8b 1366{
1367 // reads the TH1 from file and adds it to appropriate list before saving to OCDB
1368 Bool_t rv = kTRUE ;
5379c4a3 1369 AliDebug(AliQAv1::GetQADebugLevel(), Form("Saving TH1s in %s to %s", inputFile->GetName(), AliQAv1::GetQARefStorage())) ;
2e331c8b 1370 if ( ! IsDefaultStorageSet() ) {
4e25ac79 1371 TString tmp( AliQAv1::GetQARefStorage() ) ;
1372 if ( tmp.Contains(AliQAv1::GetLabLocalOCDB()) )
1373 Instance()->SetDefaultStorage(AliQAv1::GetQARefStorage()) ;
2e331c8b 1374 else {
4e25ac79 1375 TString tmp1(AliQAv1::GetQARefDefaultStorage()) ;
2e331c8b 1376 tmp1.Append(year) ;
1377 tmp1.Append("?user=alidaq") ;
1378 Instance()->SetDefaultStorage(tmp1.Data()) ;
1379 }
1380 }
4e25ac79 1381 Instance()->SetSpecificStorage("*", AliQAv1::GetQARefStorage()) ;
2e331c8b 1382 if(GetRun() < 0)
1383 Instance()->SetRun(runNumber);
1384
1385 AliCDBMetaData mdr ;
1386 mdr.SetResponsible("yves schutz");
1387
4e25ac79 1388 for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++) {
1389 TDirectory * detDir = inputFile->GetDirectory(AliQAv1::GetDetName(detIndex)) ;
2e331c8b 1390 if ( detDir ) {
5379c4a3 1391 AliDebug(AliQAv1::GetQADebugLevel(), Form("Entering %s", detDir->GetName())) ;
4e25ac79 1392 AliQAv1::SetQARefDataDirName(es) ;
1393 TString detOCDBDir(Form("%s/%s/%s", AliQAv1::GetDetName(detIndex), AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName())) ;
2e331c8b 1394 AliCDBId idr(detOCDBDir.Data(), runNumber, AliCDBRunRange::Infinity()) ;
1395 TList * listDetQAD = new TList() ;
4e25ac79 1396 TString listName(Form("%s QA data Reference", AliQAv1::GetDetName(detIndex))) ;
1397 mdr.SetComment(Form("%s QA stuff", AliQAv1::GetDetName(detIndex)));
2e331c8b 1398 listDetQAD->SetName(listName) ;
1399 TList * taskList = detDir->GetListOfKeys() ;
1400 TIter nextTask(taskList) ;
1401 TKey * taskKey ;
eca4fa66 1402 while ( (taskKey = static_cast<TKey*>(nextTask())) ) {
2e331c8b 1403 TDirectory * taskDir = detDir->GetDirectory(taskKey->GetName()) ;
1404 TDirectory * esDir = taskDir->GetDirectory(AliRecoParam::GetEventSpecieName(es)) ;
5379c4a3 1405 AliDebug(AliQAv1::GetQADebugLevel(), Form("Saving %s", esDir->GetName())) ;
2e331c8b 1406 TObjArray * listTaskQAD = new TObjArray(100) ;
1407 listTaskQAD->SetName(Form("%s/%s", taskKey->GetName(), AliRecoParam::GetEventSpecieName(es))) ;
1408 listDetQAD->Add(listTaskQAD) ;
1409 TList * histList = esDir->GetListOfKeys() ;
1410 TIter nextHist(histList) ;
1411 TKey * histKey ;
eca4fa66 1412 while ( (histKey = static_cast<TKey*>(nextHist())) ) {
2e331c8b 1413 TObject * odata = esDir->Get(histKey->GetName()) ;
1414 if ( !odata ) {
1415 AliError(Form("%s in %s/%s returns a NULL pointer !!", histKey->GetName(), detDir->GetName(), taskDir->GetName())) ;
1416 } else {
4e25ac79 1417 if ( AliQAv1::GetExpert() == histKey->GetName() ) {
2e331c8b 1418 TDirectory * expertDir = esDir->GetDirectory(histKey->GetName()) ;
1419 TList * expertHistList = expertDir->GetListOfKeys() ;
1420 TIter nextExpertHist(expertHistList) ;
1421 TKey * expertHistKey ;
eca4fa66 1422 while ( (expertHistKey = static_cast<TKey*>(nextExpertHist())) ) {
2e331c8b 1423 TObject * expertOdata = expertDir->Get(expertHistKey->GetName()) ;
1424 if ( !expertOdata ) {
1425 AliError(Form("%s in %s/%s/Expert returns a NULL pointer !!", expertHistKey->GetName(), detDir->GetName(), taskDir->GetName())) ;
1426 } else {
5379c4a3 1427 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding %s", expertHistKey->GetName())) ;
2e331c8b 1428 if ( expertOdata->IsA()->InheritsFrom("TH1") ) {
5379c4a3 1429 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding %s", expertHistKey->GetName())) ;
2e331c8b 1430 TH1 * hExpertdata = static_cast<TH1*>(expertOdata) ;
1431 listTaskQAD->Add(hExpertdata) ;
1432 }
1433 }
1434 }
1435 }
5379c4a3 1436 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding %s", histKey->GetName())) ;
2e331c8b 1437 if ( odata->IsA()->InheritsFrom("TH1") ) {
5379c4a3 1438 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding %s", histKey->GetName())) ;
2e331c8b 1439 TH1 * hdata = static_cast<TH1*>(odata) ;
1440 listTaskQAD->Add(hdata) ;
1441 }
1442 }
1443 }
1444 }
1445 Instance()->Put(listDetQAD, idr, &mdr) ;
1446 }
1447 }
1448 return rv ;
1449}
1450
7c9ff472 1451//_____________________________________________________________________________
1452
1453void AliQAManager::SetCheckerExternParam(AliQAv1::DETECTORINDEX_t detIndex, TList * parameterList)
1454{
1455 // set the external parameters list for the detector checkers
1456 AliQACheckerBase * qac = AliQAChecker::Instance()->GetDetQAChecker(detIndex) ;
1457 qac->SetExternParamlist(parameterList) ;
1458 qac->PrintExternParam() ;
1459}
1460
2e331c8b 1461//_____________________________________________________________________________
1462void AliQAManager::SetEventSpecie(AliRecoParam::EventSpecie_t es)
1463{
4e25ac79 1464 // set the current event specie and inform AliQAv1 that this event specie has been encountered
bc8761a0 1465 fEventSpecie = es ;
4e25ac79 1466 AliQAv1::Instance()->SetEventSpecie(es) ;
2e331c8b 1467}
1468
1469//_____________________________________________________________________________
1470void AliQAManager::SetRecoParam(const Int_t det, const AliDetectorRecoParam *par)
1471{
1472 // Set custom reconstruction parameters for a given detector
1473 // Single set of parameters for all the events
1474 GetQADataMaker(det)->SetRecoParam(par) ;
1475}
1476
75373542 1477//_____________________________________________________________________________
1478void AliQAManager::SetWriteExpert()
1479{
1480 // enable the writing of QA expert data
1481 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
4e25ac79 1482 if (IsSelected(AliQAv1::GetDetName(iDet)))
75373542 1483 fQAWriteExpert[iDet] = kTRUE ;
1484 }
1485}
7cade814 1486
1487//_____________________________________________________________________________
1488void AliQAManager::Destroy() {
bf76b847 1489 // delete AliQAManager instance and
1490 // all associated objects
7cade814 1491
1492 if (fgQAInstance) {
eca4fa66 1493 delete fgQAInstance ;
1494 fgQAInstance = NULL ;
7cade814 1495 }
1496}
1497
bf76b847 1498//_____________________________________________________________________________
1499void AliQAManager::ShowQA() {
1500 // Show the result of the QA checking
1501 // for all detectors
1502 for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++)
1503 AliQAv1::Instance(AliQAv1::GetDetIndex(AliQAv1::GetDetName(detIndex)))->Show() ;
1504}