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 **************************************************************************/
20 Base class for detectors quality assurance checkers
21 Compares Data made by QualAssDataMakers with reference data
22 Y. Schutz CERN August 2007
25 // --- ROOT system ---
29 #include <TIterator.h>
33 // --- Standard library ---
35 // --- AliRoot header files ---
37 #include "AliQualAss.h"
38 #include "AliQualAssChecker.h"
39 #include "AliQualAssCheckerBase.h"
40 #include "AliQualAssDataMaker.h"
42 ClassImp(AliQualAssCheckerBase)
45 //____________________________________________________________________________
46 AliQualAssCheckerBase::AliQualAssCheckerBase(const char * name, const char * title) :
56 //____________________________________________________________________________
57 AliQualAssCheckerBase::AliQualAssCheckerBase(const AliQualAssCheckerBase& qadm) :
58 TNamed(qadm.GetName(), qadm.GetTitle()),
60 fDetectorDir(qadm.fDetectorDir),
67 //____________________________________________________________________________
68 AliQualAssCheckerBase& AliQualAssCheckerBase::operator = (const AliQualAssCheckerBase& qadm )
71 this->~AliQualAssCheckerBase();
72 new(this) AliQualAssCheckerBase(qadm);
76 //____________________________________________________________________________
77 const Double_t AliQualAssCheckerBase::DiffC(const TH1 * href, const TH1 * hin) const
79 // compares two histograms using the Chi2 test
80 if ( hin->Integral() == 0 ) {
81 AliWarning(Form("Spectrum %s in %s is empty", hin->GetName(), fData->GetName())) ;
85 return hin->Chi2Test(href) ;
88 //____________________________________________________________________________
89 const Double_t AliQualAssCheckerBase::DiffK(const TH1 * href, const TH1 * hin) const
91 // compares two histograms using the Kolmogorov test
92 if ( hin->Integral() == 0 ) {
93 AliWarning(Form("Spectrum %s in %s is empty", hin->GetName(), fData->GetName())) ;
97 return hin->KolmogorovTest(href) ;
100 //____________________________________________________________________________
101 void AliQualAssCheckerBase::Init()
103 //open files and search for the appropriate detector directory
105 fRef = AliQualAssChecker::GetRefFile() ;
107 AliFatal(Form("Reference file %s not found", AliQualAssChecker::GetRefFileName())) ;
109 fDetectorDir = fRef->GetDirectory(AliQualAssDataMaker::GetDetectorDirName()) ;
111 AliFatal(Form("Directory %s not found in reference file %s not found", AliQualAssDataMaker::GetDetectorDirName(), AliQualAssChecker::GetRefFileName())) ;
113 fData = AliQualAssChecker::GetDataFile() ;
115 AliFatal(Form("Reference file %s not found", AliQualAss::GetOutputName())) ;
117 if (! fData->GetDirectory(AliQualAssDataMaker::GetDetectorDirName())) ;
118 AliFatal(Form("Directory %s not found in reference file %s not found", AliQualAssDataMaker::GetDetectorDirName(), AliQualAss::GetOutputName())) ;
120 AliQualAss::Instance(AliQualAss::kSIM) ;
123 //____________________________________________________________________________
124 void AliQualAssCheckerBase::Exec(const Option_t * opt)
126 AliInfo(Form("Processing %s", opt)) ;
127 // loop over detectors
128 AliQualAss * qa = AliQualAss::Instance(AliQualAss::kPHOS) ;
129 Double_t rv = Check(opt) ;
131 qa->Set(AliQualAss::kFATAL) ;
132 else if ( rv > 0 && rv <= 0.2 )
133 qa->Set(AliQualAss::kERROR) ;
134 else if ( rv > 0.2 && rv <= 0.5 )
135 qa->Set(AliQualAss::kWARNING) ;
136 else if ( rv > 0.5 && rv < 1 )
137 qa->Set(AliQualAss::kINFO) ;
138 AliInfo(Form("Test result of %s in PHOS", opt)) ;
143 //____________________________________________________________________________
144 void AliQualAssCheckerBase::Finish() const
146 // wrap up and save QA in proper file
148 AliQualAss * qa = AliQualAss::Instance() ;
150 AliQualAssChecker::GetOutFile()->cd() ;
151 qa->Write(qa->GetName(), kWriteDelete) ;
152 AliQualAssChecker::GetOutFile()->Close() ;