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 "AliCDBManager.h"
44 ClassImp(AliHMPIDQAChecker)
46 //__________________________________________________________________
47 AliHMPIDQAChecker& AliHMPIDQAChecker::operator = (const AliHMPIDQAChecker& qac )
50 this->~AliHMPIDQAChecker();
51 new(this) AliHMPIDQAChecker(qac);
54 //_________________________________________________________________
55 const Double_t AliHMPIDQAChecker::Check(AliQA::ALITASK_t index, TObjArray * list)
58 // Main check function: Depending on the TASK, different checks are applied
59 // At the moment: check for empty histograms and checks for RecPoints
61 AliDebug(1,Form("AliHMPIDChecker"));
62 AliCDBEntry *QARefRec = AliCDBManager::Instance()->Get("HMPID/QARef/Rec");
64 AliInfo("QA reference data NOT retrieved for Recostruction check. No HMPIDChecker ...exiting");
68 // checking for empy histograms
70 if(CheckEntries(list) == 0) {
71 AliWarning("histograms are empty");
72 check = 0.4;//-> Corresponds to kWARNING see AliQACheckerBase::Run
76 // checking rec points
77 if(index == AliQA::kREC) check = CheckRecPoints(list,(TObjArray *)QARefRec->GetObject());
79 //default check response. It will be changed when reasonable checks will be considered
80 else check = 0.7 ; // /-> Corresponds to kINFO see AliQACheckerBase::Run
85 //_________________________________________________________________
86 Double_t AliHMPIDQAChecker::CheckEntries(TObjArray * list) const
89 // check on the QA histograms on the input list:
95 if (list->GetEntries() == 0){
96 test = 1. ; // nothing to check
102 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
105 //Printf("hitogram %s has entries: %f ",hdata->GetName(),hdata->GetEntries());
106 if(hdata->GetEntries()>0)rv=1;
111 AliError("Data type cannot be processed") ;
117 AliWarning("Histograms are booked for THIS specific Task, but they are all empty: setting flag to kWARNING");
118 test = 0.; //upper limit value to set kWARNING flag for a task
126 //_________________________________________________________________
128 Double_t AliHMPIDQAChecker::CheckRecPoints(TObjArray *listrec, TObjArray *listref) const
131 Float_t checkresponse = 0;
133 Float_t counter = 0 ;
134 TIter next(listrec) ;
136 while ( (histo = dynamic_cast<TH1 *>(next())) ) {
137 if( histo->GetEntries() == 0 ) counter++;
139 TString h = histo->GetTitle();
140 if(h.Contains("Zoom")){
141 histo->Fit("expo","Q0","",1,50);
142 if(histo->GetFunction("expo")->GetParameter(1) !=0 ) if(TMath::Abs((-1./(histo->GetFunction("expo"))->GetParameter(1)) - 35 ) > 5) counter++;
144 if(h.Contains("size MIP")) if(TMath::Abs(histo->GetMean()-5) > 2) counter++;
145 if(h.Contains("size Phots")) if(TMath::Abs(histo->GetMean()-2) > 2) counter++;
146 if(h.Contains("distribution")) if(histo->KolmogorovTest((TH1F *)listref->At(0))<0.8) counter++;
147 AliDebug(1,Form(" Kolm. test : %f ",histo->KolmogorovTest((TH1F *)listref->At(0))));
150 Float_t response = counter/(7.+7.+42.+42.); // 7.+7.+42 +42 = N checked histograms (-> To be replaced by listrec->GetEntries())
152 if(response < 0.1) checkresponse = 0.7; // <10% of the check histograms show a failing check -> Corresponds to kINFO see AliQACheckerBase::Run
153 else if(response < 0.5) checkresponse = 0.4; // 50% of the check histograms show a failing check -> Corresponds to kWARNING see AliQACheckerBase::Run
154 else checkresponse = 0.001; // > 50% of the check histograms show a failing check -> Corresponds to kERROR see AliQACheckerBase::Run
155 return checkresponse;
157 //________________________________________________________________