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 // Checks the quality assurance.
21 // By comparing with reference data
25 // --- ROOT system ---
30 #include <TIterator.h>
34 // --- Standard library ---
36 // --- AliRoot header files ---
39 #include "AliQAChecker.h"
40 #include "AliHMPIDQAChecker.h"
41 #include "AliCDBEntry.h"
42 #include "AliQAManager.h"
44 ClassImp(AliHMPIDQAChecker)
45 //_________________________________________________________________
46 AliHMPIDQAChecker::AliHMPIDQAChecker() :
47 AliQACheckerBase("HMPID","HMPID Quality Assurance Data Checker"),
51 //ctor, fetches the reference data from OCDB
52 char * detOCDBDir = Form("HMPID/%s/%s", AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ;
53 AliCDBEntry * QARefRec = AliQAManager::QAManager()->Get(detOCDBDir);
55 fQARefRec = dynamic_cast<TObjArray*> (QARefRec->GetObject()) ;
57 if (fQARefRec->GetEntries())
58 fNoReference = kFALSE ;
60 AliInfo("QA reference data NOT retrieved for Reconstruction check. No HMPIDChecker!");
64 //_________________________________________________________________
65 AliHMPIDQAChecker::AliHMPIDQAChecker(const AliHMPIDQAChecker& qac) :
66 AliQACheckerBase(qac.GetName(), qac.GetTitle()),
67 fNoReference(qac.fNoReference),
70 fNoReference = qac.fNoReference ;
72 fQARefRec = new TObjArray(qac.fQARefRec->GetEntries()) ;
73 for (Int_t index=0; index < qac.fQARefRec->GetEntries(); index++)
74 fQARefRec->Add(qac.fQARefRec->At(index)) ;
78 //_________________________________________________________________
79 AliHMPIDQAChecker::~AliHMPIDQAChecker()
81 if(fQARefRec) { fQARefRec->Delete() ; delete fQARefRec ; }
83 //_________________________________________________________________
84 void AliHMPIDQAChecker::Check(Double_t * check, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/)
87 // Main check function: Depending on the TASK, different checks are applied
88 // At the moment: check for empty histograms and checks for RecPoints
92 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
94 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
96 // checking for empy histograms
97 if(CheckEntries(list[specie]) == 0) {
98 AliWarning("histograms are empty");
99 check[specie] = 0.4;//-> Corresponds to kWARNING see AliQACheckerBase::Run
103 if(index == AliQAv1::kSIM) check[specie] = CheckSim(list[specie], fQARefRec);
105 // checking rec points
106 if(index == AliQAv1::kREC) check[specie] = CheckRec(list[specie], fQARefRec);
108 //default check response. It will be changed when reasonable checks will be considered
109 else check[specie] = 0.7 ; // /-> Corresponds to kINFO see AliQACheckerBase::Run
112 //_________________________________________________________________
113 Double_t AliHMPIDQAChecker::CheckEntries(TObjArray * list) const
116 // check on the QA histograms on the input list:
119 Double_t test = 0.0 ;
122 if (list->GetEntries() == 0){
123 test = 1. ; // nothing to check
129 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
132 //Printf("hitogram %s has entries: %f ",hdata->GetName(),hdata->GetEntries());
133 if(hdata->GetEntries()>0)rv=1;
138 AliError("Data type cannot be processed") ;
144 AliWarning("Histograms are booked for THIS specific Task, but they are all empty: setting flag to kWARNING");
145 test = 0.; //upper limit value to set kWARNING flag for a task
153 //_________________________________________________________________
154 Double_t AliHMPIDQAChecker::CheckSim(TObjArray *listsim, TObjArray *listref) const
157 // check on the HMPID RecPoints by using expo fit and Kolmogorov Test:
160 Float_t checkresponse = 0;
162 Float_t counter = 0 ;
163 TIter next(listsim) ;
165 while ( (histo = dynamic_cast<TH1 *>(next())) ) {
166 //PH The histogram should have at least 10 bins with at least 5 entries
167 Int_t nbinsabove = 0;
168 for (Int_t ibin=histo->FindBin(1); ibin<=histo->FindBin(50); ibin++) {
169 if (histo->GetBinContent(ibin)>5) nbinsabove++;
172 if( nbinsabove < 10 ) counter++;
174 TString h = histo->GetTitle();
175 if(h.Contains("Zoom")){
176 histo->Fit("expo","LQ0","",5,50);
177 if(histo->GetFunction("expo")->GetParameter(1) !=0 ) if(TMath::Abs((-1./(histo->GetFunction("expo"))->GetParameter(1)) - 35 ) > 5) counter++;
179 if(h.Contains("size MIP")) if(TMath::Abs(histo->GetMean()-5) > 2) counter++;
180 if(h.Contains("size Phots")) if(TMath::Abs(histo->GetMean()-2) > 2) counter++;
181 if(h.Contains("distribution")) if(histo->KolmogorovTest((TH1F *)listref->At(0))<0.8) counter++;
182 AliDebug(AliQAv1::GetQADebugLevel(),Form(" Kolm. test : %f ",histo->KolmogorovTest((TH1F *)listref->At(0))));
185 Float_t response = counter/(7.+7.+42.+42.); // 7.+7.+42 +42 = N checked histograms (-> To be replaced by listsim->GetEntries())
187 if(response < 0.1) checkresponse = 0.7; // <10% of the check histograms show a failing check -> Corresponds to kINFO see AliQACheckerBase::Run
188 else if(response < 0.5) checkresponse = 0.4; // 50% of the check histograms show a failing check -> Corresponds to kWARNING see AliQACheckerBase::Run
189 else checkresponse = 0.001; // > 50% of the check histograms show a failing check -> Corresponds to kERROR see AliQACheckerBase::Run
190 return checkresponse;
193 //___________________________________________________________________________________________________
194 Double_t AliHMPIDQAChecker::CheckRec(TObjArray *listrec, TObjArray *listref) const
197 // check on the HMPID RecPoints by using expo fit and Kolmogorov Test:
200 Float_t checkresponse = 0;
202 Float_t counter = 0 ;
203 TIter next(listrec) ;
205 while ( (histo = dynamic_cast<TH1 *>(next())) ) {
206 //PH The histogram should have at least 10 bins with at least 5 entries
207 Int_t nbinsabove = 0;
208 for (Int_t ibin=histo->FindBin(1); ibin<=histo->FindBin(50); ibin++) {
209 if (histo->GetBinContent(ibin)>5) nbinsabove++;
212 if( nbinsabove < 10 ) counter++;
214 TString h = histo->GetTitle();
215 if(h.Contains("Zoom")){
216 histo->Fit("expo","LQ0","",5,50);
217 if(histo->GetFunction("expo")->GetParameter(1) !=0 ) if(TMath::Abs((-1./(histo->GetFunction("expo"))->GetParameter(1)) - 35 ) > 5) counter++;
219 if(h.Contains("size MIP")) if(TMath::Abs(histo->GetMean()-5) > 2) counter++;
220 if(h.Contains("size Phots")) if(TMath::Abs(histo->GetMean()-2) > 2) counter++;
221 if(h.Contains("distribution")) if(histo->KolmogorovTest((TH1F *)listref->At(0))<0.8) counter++;
222 AliDebug(AliQAv1::GetQADebugLevel(),Form(" Kolm. test : %f ",histo->KolmogorovTest((TH1F *)listref->At(0))));
225 Float_t response = counter/(7.+7.+42.+42.); // 7.+7.+42 +42 = N checked histograms (-> To be replaced by listrec->GetEntries())
227 if(response < 0.1) checkresponse = 0.7; // <10% of the check histograms show a failing check -> Corresponds to kINFO see AliQACheckerBase::Run
228 else if(response < 0.5) checkresponse = 0.4; // 50% of the check histograms show a failing check -> Corresponds to kWARNING see AliQACheckerBase::Run
229 else checkresponse = 0.001; // > 50% of the check histograms show a failing check -> Corresponds to kERROR see AliQACheckerBase::Run
230 return checkresponse;