1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // class for running the Quality Assurance Checker
22 ///////////////////////////////////////////////////////////////////////////////
25 #include "AliModule.h"
27 #include "AliRunLoader.h"
28 #include "AliQualAss.h"
29 #include "AliQualAssChecker.h"
31 #include <TObjArray.h>
32 #include <TStopwatch.h>
36 ClassImp(AliQualAssChecker)
38 TFile * AliQualAssChecker::fgOutFile = 0x0 ;
39 TString AliQualAssChecker::fgOutDir("/RUN/") ;
40 TString AliQualAssChecker::fgOutName("QA.root") ;
41 TString AliQualAssChecker::fgRefDir("/QA/Ref/") ;
42 TString AliQualAssChecker::fgRefName("QA.root") ;
44 //_____________________________________________________________________________
45 AliQualAssChecker::AliQualAssChecker(const char* name, const char* title) :
47 fGAliceFileName("galice.root"),
50 // create simulation object with default parameters
52 SetGAliceFile("galice.root");
55 //_____________________________________________________________________________
56 AliQualAssChecker::AliQualAssChecker(const AliQualAssChecker& qac) :
58 fGAliceFileName(qac.fGAliceFileName),
59 fStopOnError(qac.fStopOnError)
64 //_____________________________________________________________________________
65 AliQualAssChecker& AliQualAssChecker::operator = (const AliQualAssChecker& qac)
67 // assignment operator
69 this->~AliQualAssChecker();
70 new(this) AliQualAssChecker(qac);
74 //_____________________________________________________________________________
75 AliQualAssChecker::~AliQualAssChecker()
82 //_____________________________________________________________________________
83 TFile * AliQualAssChecker:: GetOutFile()
85 // Check if file to store QA exists, if not create it
88 if (fgOutFile->IsOpen()){
93 fgOutName.Prepend(fgOutDir) ;
95 if ( !gSystem->AccessPathName(fgOutName) )
99 fgOutFile = TFile::Open(fgOutName, opt) ;
104 //_____________________________________________________________________________
105 AliRunLoader* AliQualAssChecker::LoadRun(const char* mode) const
107 // delete existing run loaders, open a new one and load gAlice
108 while (AliRunLoader::GetRunLoader())
109 delete AliRunLoader::GetRunLoader();
110 AliRunLoader* runLoader =
111 AliRunLoader::Open(fGAliceFileName.Data(),
112 AliConfig::GetDefaultEventFolderName(), mode);
114 AliError(Form("no run loader found in file %s", fGAliceFileName.Data()));
117 runLoader->LoadgAlice();
118 gAlice = runLoader->GetAliRun();
120 AliError(Form("no gAlice object found in file %s",
121 fGAliceFileName.Data()));
127 //_____________________________________________________________________________
128 Bool_t AliQualAssChecker::Run()
130 // run the Quality Assurance Checker for all tasks Hits, SDigits, Digits, recpoints, tracksegments, recparticles and ESDs
134 TStopwatch stopwatch;
137 AliRunLoader* runLoader = LoadRun("READ");
141 TObjArray* detArray = runLoader->GetAliRun()->Detectors();
142 for (Int_t iDet = 0; iDet < detArray->GetEntriesFast(); iDet++) {
143 AliModule* det = (AliModule*) detArray->At(iDet);
144 if (!det || !det->IsActive())
146 AliInfo(Form("QA checking %s", det->GetName()));
152 AliInfo(Form("Execution time for QA: R:%.2fs C:%.2fs", stopwatch.RealTime(),stopwatch.CpuTime()));
157 //_____________________________________________________________________________
158 void AliQualAssChecker::SetGAliceFile(const char* fileName)
160 // set the name of the galice file
161 // the path is converted to an absolute one if it is relative
163 fGAliceFileName = fileName;
164 if (!gSystem->IsAbsoluteFileName(fGAliceFileName)) {
165 char* absFileName = gSystem->ConcatFileName(gSystem->WorkingDirectory(),
167 fGAliceFileName = absFileName;
168 delete[] absFileName;
171 AliDebug(2, Form("galice file name set to %s", fileName));
174 //_____________________________________________________________________________
175 void AliQualAssChecker::SetOutDir(const char * outDir)
177 // Set the root directory where to store the QA status object
179 fgOutDir.Prepend(outDir) ;
180 AliInfo(Form("QA results are in %s", fgOutDir.Data())) ;
181 if ( fgOutDir.Contains("local://"))
182 fgOutDir.ReplaceAll("local:/", "") ;
185 //_____________________________________________________________________________
186 void AliQualAssChecker::SetRefDir(const char * refDir)
188 // Set the root directory of reference data
190 fgRefDir.Prepend(refDir) ;
191 fgRefDir.Append(fgRefName) ;
192 AliInfo(Form("Reference data are taken from %s", fgRefDir.Data())) ;
193 if ( fgRefDir.Contains("local://"))
194 fgRefDir.ReplaceAll("local:/", "") ;