X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=sidebyside;f=HMPID%2FAliHMPIDQAChecker.cxx;h=be9785375c9b9a7752269bef245599904521c680;hb=f299cdeffcfa52cfbc735284787258ef4870c42e;hp=08a141c4311988a61fb7a8ed59ab8f36f8dff35d;hpb=fdd7f4043c9b8db6ae097b12160e74aa934a8ed0;p=u%2Fmrichter%2FAliRoot.git diff --git a/HMPID/AliHMPIDQAChecker.cxx b/HMPID/AliHMPIDQAChecker.cxx index 08a141c4311..be9785375c9 100644 --- a/HMPID/AliHMPIDQAChecker.cxx +++ b/HMPID/AliHMPIDQAChecker.cxx @@ -35,52 +35,65 @@ // --- AliRoot header files --- #include "AliLog.h" -#include "AliQA.h" +#include "AliQAv1.h" #include "AliQAChecker.h" #include "AliHMPIDQAChecker.h" #include "AliCDBEntry.h" -#include "AliCDBManager.h" +#include "AliQAManager.h" ClassImp(AliHMPIDQAChecker) + //_________________________________________________________________ +AliHMPIDQAChecker::AliHMPIDQAChecker() : +AliQACheckerBase("HMPID","HMPID Quality Assurance Data Checker"), +fNoReference(kTRUE), +fQARefRec(NULL) +{ + //ctor, fetches the reference data from OCDB + char * detOCDBDir = Form("HMPID/%s/%s", AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ; + AliCDBEntry * QARefRec = AliQAManager::QAManager()->Get(detOCDBDir); + if(QARefRec) { + fQARefRec = dynamic_cast (QARefRec->GetObject()) ; + if (fQARefRec) + if (fQARefRec->GetEntries()) + fNoReference = kFALSE ; + if (fNoReference) + AliInfo("QA reference data NOT retrieved for Reconstruction check. No HMPIDChecker!"); + } +} -//__________________________________________________________________ -AliHMPIDQAChecker& AliHMPIDQAChecker::operator = (const AliHMPIDQAChecker& qac ) +//_________________________________________________________________ +AliHMPIDQAChecker::~AliHMPIDQAChecker() { - // Equal operator. - this->~AliHMPIDQAChecker(); - new(this) AliHMPIDQAChecker(qac); - return *this; + if(fQARefRec) { fQARefRec->Delete() ; delete fQARefRec ; } } //_________________________________________________________________ -const Double_t AliHMPIDQAChecker::Check(AliQA::ALITASK_t index, TObjArray * list) +void AliHMPIDQAChecker::Check(Double_t * check, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) { // // Main check function: Depending on the TASK, different checks are applied // At the moment: check for empty histograms and checks for RecPoints - AliDebug(1,Form("AliHMPIDChecker")); - AliCDBEntry *QARefRec = AliCDBManager::Instance()->Get("HMPID/QARef/Rec"); - if( !QARefRec){ - AliInfo("QA reference data NOT retrieved for Recostruction check. No HMPIDChecker ...exiting"); - return 1.; - } - -// checking for empy histograms - Double_t check =0; - if(CheckEntries(list) == 0) { - AliWarning("histograms are empty"); - check = 0.4;//-> Corresponds to kWARNING see AliQACheckerBase::Run - return check; - } - -// checking rec points - if(index == AliQA::kREC) check = CheckRecPoints(list,(TObjArray *)QARefRec->GetObject()); - -//default check response. It will be changed when reasonable checks will be considered - else check = 0.7 ; // /-> Corresponds to kINFO see AliQACheckerBase::Run - - return check; + if(fNoReference) + for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { + check[specie] = 1.0; + if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) + continue ; + // checking for empy histograms + if(CheckEntries(list[specie]) == 0) { + AliWarning("histograms are empty"); + check[specie] = 0.4;//-> Corresponds to kWARNING see AliQACheckerBase::Run + } + + //check sim + if(index == AliQAv1::kSIM) check[specie] = CheckSim(list[specie], fQARefRec); + + // checking rec points + if(index == AliQAv1::kREC) check[specie] = CheckRec(list[specie], fQARefRec); + + //default check response. It will be changed when reasonable checks will be considered + else check[specie] = 0.7 ; // /-> Corresponds to kINFO see AliQACheckerBase::Run + } // species loop } //_________________________________________________________________ Double_t AliHMPIDQAChecker::CheckEntries(TObjArray * list) const @@ -124,9 +137,51 @@ Double_t AliHMPIDQAChecker::CheckEntries(TObjArray * list) const return test ; } //_________________________________________________________________ +Double_t AliHMPIDQAChecker::CheckSim(TObjArray *listsim, TObjArray *listref) const +{ + // + // check on the HMPID RecPoints by using expo fit and Kolmogorov Test: + // + + Float_t checkresponse = 0; + + Float_t counter = 0 ; + TIter next(listsim) ; + TH1* histo; + while ( (histo = dynamic_cast(next())) ) { + //PH The histogram should have at least 10 bins with at least 5 entries + Int_t nbinsabove = 0; + for (Int_t ibin=histo->FindBin(1); ibin<=histo->FindBin(50); ibin++) { + if (histo->GetBinContent(ibin)>5) nbinsabove++; + } -Double_t AliHMPIDQAChecker::CheckRecPoints(TObjArray *listrec, TObjArray *listref) const + if( nbinsabove < 10 ) counter++; + else { + TString h = histo->GetTitle(); + if(h.Contains("Zoom")){ + histo->Fit("expo","LQ0","",5,50); + if(histo->GetFunction("expo")->GetParameter(1) !=0 ) if(TMath::Abs((-1./(histo->GetFunction("expo"))->GetParameter(1)) - 35 ) > 5) counter++; + } + if(h.Contains("size MIP")) if(TMath::Abs(histo->GetMean()-5) > 2) counter++; + if(h.Contains("size Phots")) if(TMath::Abs(histo->GetMean()-2) > 2) counter++; + if(h.Contains("distribution")) if(histo->KolmogorovTest((TH1F *)listref->At(0))<0.8) counter++; + AliDebug(AliQAv1::GetQADebugLevel(),Form(" Kolm. test : %f ",histo->KolmogorovTest((TH1F *)listref->At(0)))); + } + } + Float_t response = counter/(7.+7.+42.+42.); // 7.+7.+42 +42 = N checked histograms (-> To be replaced by listsim->GetEntries()) + + if(response < 0.1) checkresponse = 0.7; // <10% of the check histograms show a failing check -> Corresponds to kINFO see AliQACheckerBase::Run + else if(response < 0.5) checkresponse = 0.4; // 50% of the check histograms show a failing check -> Corresponds to kWARNING see AliQACheckerBase::Run + else checkresponse = 0.001; // > 50% of the check histograms show a failing check -> Corresponds to kERROR see AliQACheckerBase::Run + return checkresponse; +} + +//___________________________________________________________________________________________________ +Double_t AliHMPIDQAChecker::CheckRec(TObjArray *listrec, TObjArray *listref) const { + // + // check on the HMPID RecPoints by using expo fit and Kolmogorov Test: + // Float_t checkresponse = 0; @@ -134,17 +189,23 @@ Double_t AliHMPIDQAChecker::CheckRecPoints(TObjArray *listrec, TObjArray *listre TIter next(listrec) ; TH1* histo; while ( (histo = dynamic_cast(next())) ) { - if( histo->GetEntries() == 0 ) counter++; + //PH The histogram should have at least 10 bins with at least 5 entries + Int_t nbinsabove = 0; + for (Int_t ibin=histo->FindBin(1); ibin<=histo->FindBin(50); ibin++) { + if (histo->GetBinContent(ibin)>5) nbinsabove++; + } + + if( nbinsabove < 10 ) counter++; else { TString h = histo->GetTitle(); if(h.Contains("Zoom")){ - histo->Fit("expo","Q0","",1,50); + histo->Fit("expo","LQ0","",5,50); if(histo->GetFunction("expo")->GetParameter(1) !=0 ) if(TMath::Abs((-1./(histo->GetFunction("expo"))->GetParameter(1)) - 35 ) > 5) counter++; } if(h.Contains("size MIP")) if(TMath::Abs(histo->GetMean()-5) > 2) counter++; if(h.Contains("size Phots")) if(TMath::Abs(histo->GetMean()-2) > 2) counter++; if(h.Contains("distribution")) if(histo->KolmogorovTest((TH1F *)listref->At(0))<0.8) counter++; - AliDebug(1,Form(" Kolm. test : %f ",histo->KolmogorovTest((TH1F *)listref->At(0)))); + AliDebug(AliQAv1::GetQADebugLevel(),Form(" Kolm. test : %f ",histo->KolmogorovTest((TH1F *)listref->At(0)))); } } Float_t response = counter/(7.+7.+42.+42.); // 7.+7.+42 +42 = N checked histograms (-> To be replaced by listrec->GetEntries()) @@ -154,5 +215,4 @@ Double_t AliHMPIDQAChecker::CheckRecPoints(TObjArray *listrec, TObjArray *listre else checkresponse = 0.001; // > 50% of the check histograms show a failing check -> Corresponds to kERROR see AliQACheckerBase::Run return checkresponse; } -//________________________________________________________________