X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HMPID%2FAliHMPIDQAChecker.cxx;h=389713c9cf40719e22c1c6e88c1137a863cd93d6;hb=5c2a4a98ff219a1559a2deec1a054615891e396b;hp=6d834659a0b98b066f4937dc9188e646c99bffdc;hpb=57acd2d2f484e474d764cf49c17bf8a0af5bdd5e;p=u%2Fmrichter%2FAliRoot.git diff --git a/HMPID/AliHMPIDQAChecker.cxx b/HMPID/AliHMPIDQAChecker.cxx index 6d834659a0b..389713c9cf4 100644 --- a/HMPID/AliHMPIDQAChecker.cxx +++ b/HMPID/AliHMPIDQAChecker.cxx @@ -25,69 +25,101 @@ // --- ROOT system --- #include #include -#include +#include +#include #include #include #include -#include - +#include +#include +#include +#include // --- Standard library --- // --- 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" +#include "AliQAThresholds.h" ClassImp(AliHMPIDQAChecker) + //_________________________________________________________________ +AliHMPIDQAChecker::AliHMPIDQAChecker() : +AliQACheckerBase("HMPID","HMPID Quality Assurance Data Checker"), +fNoReference(kTRUE), +fQARefRec(NULL), + +fHmpQaThr_NumberOfExcludedDDL(0), +fHmpQaThr_DataSizeLowerThreshold(900), +fHmpQaThr_DataSizeUpperThreshold(1500), +fHmpQaThr_PadOccupancyLowerThreshold(0.005), +fHmpQaThr_PadOccupancyUpperThreshold(0.8), +fHmpQaThr_SectorGainLossWarningThreshold(3), +fHmpQaThr_SectorGainLossErrorThreshold(6), +fHmpQaThr_MissingPadFractionWarningThreshold(0.3), +fHmpQaThr_MissingPadFractionErrorThreshold(0.5), +fIsOnlineThr(kFALSE) + + -//____________________________________________________________________________ -Double_t * AliHMPIDQAChecker::Check(AliQA::ALITASK_t /*index*/) { - Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ; - for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) - rv[specie] = 0.0 ; - return rv ; + //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!"); + } + } //_________________________________________________________________ -Double_t * AliHMPIDQAChecker::Check(AliQA::ALITASK_t index, TObjArray ** list) +AliHMPIDQAChecker::~AliHMPIDQAChecker() +{ + if(fQARefRec) { fQARefRec->Delete() ; delete fQARefRec ; } +} +//_________________________________________________________________ +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 - Double_t * check = new Double_t[AliRecoParam::kNSpecies] ; + InitOnlineThresholds(); -//YS THIS IS NOT CORRECT - AliInfo(Form("Fix needed .....")); - AliCDBEntry *QARefRec = AliCDBManager::Instance()->Get("HMPID/QARef/Rec"); - if( !QARefRec){ - AliInfo("QA reference data NOT retrieved for Reconstruction check. No HMPIDChecker ...exiting"); - return check; - } -//YS THIS IS NOT CORRECT + if(fNoReference) -// checking for empy histograms for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { - check[specie] = 1.0; - if ( !AliQA::Instance()->IsEventSpecieSet(specie) ) - continue ; + check[specie] = 1.0; + //printf("+++++++++++++++++++++ specie %d name: %s \n",specie,AliRecoParam::GetEventSpecieName(specie)); + 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 } - // checking rec points - if(index == AliQA::kREC) check[specie] = CheckRecPoints(list[specie],(TObjArray *)QARefRec->GetObject()); - - //default check response. It will be changed when reasonable checks will be considered - else check[specie] = 0.7 ; // /-> Corresponds to kINFO see AliQACheckerBase::Run - } - return check; + check[specie] = AliQAv1::kINFO ; + + + //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); + + //checking raw data + if(index == AliQAv1::kRAW) { check[specie] = CheckRaw(specie,list[specie]); } + + + } // species loop } //_________________________________________________________________ Double_t AliHMPIDQAChecker::CheckEntries(TObjArray * list) const @@ -109,7 +141,6 @@ Double_t AliHMPIDQAChecker::CheckEntries(TObjArray * list) const while ( (hdata = dynamic_cast(next())) ) { if (hdata) { Double_t rv = 0.; - //Printf("hitogram %s has entries: %f ",hdata->GetName(),hdata->GetEntries()); if(hdata->GetEntries()>0)rv=1; count++ ; test += rv ; @@ -131,8 +162,47 @@ 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: @@ -144,17 +214,23 @@ Double_t AliHMPIDQAChecker::CheckRecPoints(TObjArray *listrec, TObjArray *listre TIter next(listrec) ; TH1* histo; while ( (histo = dynamic_cast(next())) ) { - if( histo->GetEntries() < 3 ) 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()) @@ -164,5 +240,488 @@ 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; } -//________________________________________________________________ +//___________________________________________________________________________________________________ +Double_t AliHMPIDQAChecker::CheckRaw(Int_t specie, TObjArray* list) +{ + // + // Check the raw data for offline / online using default or updated thresholds from AMORE + // As of now (06/07/2012) the quality flag of all histos in raw will be est to the result of teh CheckRaw and displayed + // in AMORE. But we can pu undividual labels. + // + + //Int_t raqQualFlag = AliQAv1::kNULLBit; + + Int_t hmpQaFlags[4]={-1}; //init for the 4 shifter histos + + TString histname ="null"; + TPaveText text(0.65,0.8,0.9,0.99,"NDC"); + TPaveText text1(0.65,0.8,0.9,0.99,"NDC"); + + + Int_t entries = list->GetEntriesFast(); + + if ( entries == 0 ) { + AliWarning(Form("HMPID QA Checker RAWS: no object to analyse! Exiting...")); + return AliQAv1::kFATAL; + } + + TLine* lineDdlDataSizeMin = new TLine(1536,fHmpQaThr_DataSizeUpperThreshold,1548,fHmpQaThr_DataSizeUpperThreshold); + TLine* lineDdlDataSizeMax = new TLine(1536,fHmpQaThr_DataSizeLowerThreshold,1548,fHmpQaThr_DataSizeLowerThreshold); + + TLine* linePadOccupMin = new TLine(1536,fHmpQaThr_PadOccupancyUpperThreshold,1548,fHmpQaThr_PadOccupancyUpperThreshold); + TLine* linePadOccupMax = new TLine(1536,fHmpQaThr_PadOccupancyLowerThreshold,1548,fHmpQaThr_PadOccupancyLowerThreshold); + + + Int_t badDdlCnt = 0, badOccCnt = 0; + + //___ check data size per ddl + if( list->FindObject(Form("%s_hHmpDdlDataSize",AliRecoParam::GetEventSpecieName(specie)) )) + { + TH1* h1 = dynamic_cast( list->FindObject(Form("%s_hHmpDdlDataSize",AliRecoParam::GetEventSpecieName(specie)))); + if(h1) { + if( h1->Integral() > 1 ) { + // no entres -> fatal + //if( h1->GetEntries() == 0) {raqQualFlag = AliQAv1::kFATAL;} + h1->SetStats(0); + + + // clean up the text, stat, lines, ... + if( h1->GetListOfFunctions() ) h1->GetListOfFunctions()->Clear(); + + for ( Int_t iddl = 1 ; iddl <= 14; iddl++) + { + if( h1->GetBinContent(iddl) < fHmpQaThr_DataSizeLowerThreshold || h1->GetBinContent(iddl) > fHmpQaThr_DataSizeUpperThreshold ) badDdlCnt++; + } + //___ check if one or more DDLs are excluded + + + badDdlCnt -= fHmpQaThr_NumberOfExcludedDDL; + + + + //___ check how many are bad + if ( badDdlCnt == 0 ) + { + hmpQaFlags[0] = AliQAv1::kINFO; + text1.Clear(); + text1.AddText(Form("OK (%d)",fIsOnlineThr)); + text1.SetFillColor(kGreen); + h1->GetListOfFunctions()->Add((TPaveText*)text1.Clone()); + lineDdlDataSizeMin->SetLineColor(kGreen); + lineDdlDataSizeMax->SetLineColor(kGreen); + h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMin->Clone()); + h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMax->Clone()); + } + else if ( badDdlCnt == 1 ) + { + hmpQaFlags[0] = AliQAv1::kWARNING; + text1.Clear(); + text1.AddText(Form("WARNING CHECK TWIKI (%d)",fIsOnlineThr)); + text1.SetFillColor(kOrange); + h1->GetListOfFunctions()->Add((TPaveText*)text1.Clone()); + lineDdlDataSizeMin->SetLineColor(kOrange); + lineDdlDataSizeMax->SetLineColor(kOrange); + h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMin->Clone()); + h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMax->Clone()); + } + else if ( badDdlCnt >= 2 ) + { + hmpQaFlags[0] = AliQAv1::kERROR; + text1.Clear(); + text1.AddText(Form("ERROR CALL ONCALL (%d)",fIsOnlineThr)); + text1.SetFillColor(kRed); + h1->GetListOfFunctions()->Add((TPaveText*)text1.Clone()); + lineDdlDataSizeMin->SetLineColor(kRed); + lineDdlDataSizeMax->SetLineColor(kRed); + h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMin->Clone()); + h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMax->Clone()); + } + else + { + hmpQaFlags[0] = AliQAv1::kFATAL; + text1.Clear(); + text1.AddText(Form("FATAL CALL ONCALL (%d)",fIsOnlineThr)); + text1.SetFillColor(kRed); + h1->GetListOfFunctions()->Add((TPaveText*)text1.Clone()); + lineDdlDataSizeMin->SetLineColor(kRed); + lineDdlDataSizeMax->SetLineColor(kRed); + h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMin->Clone()); + h1->GetListOfFunctions()->Add((TLine*)lineDdlDataSizeMax->Clone()); + } + } + }//the histo is filled + }//___hHmpDdlDataSize + + + + if( list->FindObject(Form("%s_fHmpPadOcc",AliRecoParam::GetEventSpecieName(specie)) )) + { + + + TH1* h1 = dynamic_cast( list->FindObject(Form("%s_fHmpPadOcc",AliRecoParam::GetEventSpecieName(specie)))); + if(h1) { + if( h1->Integral() > 1 ) { + // no entres -> fatal + //if( h1->GetEntries() == 0) {raqQualFlag = AliQAv1::kFATAL;} + h1->SetStats(0); + // clean up the text, stat, lines, ... + if( h1->GetListOfFunctions() ) h1->GetListOfFunctions()->Clear(); + + for ( Int_t iddl = 1 ; iddl <= 14; iddl++) + { + if( h1->GetBinContent(iddl) < fHmpQaThr_PadOccupancyLowerThreshold || h1->GetBinContent(iddl) > fHmpQaThr_PadOccupancyUpperThreshold ) badOccCnt++; + } + + badOccCnt -= fHmpQaThr_NumberOfExcludedDDL; + + //___ check how many are bad + if ( badOccCnt == 0 ) + { + hmpQaFlags[1] = AliQAv1::kINFO; + text.Clear(); + text.AddText(Form("OK (%d)",fIsOnlineThr)); + text.SetFillColor(kGreen); + h1->GetListOfFunctions()->Add((TPaveText*)text.Clone()); + linePadOccupMin->SetLineColor(kGreen); + linePadOccupMax->SetLineColor(kGreen); + h1->GetListOfFunctions()->Add((TLine*)linePadOccupMin->Clone()); + h1->GetListOfFunctions()->Add((TLine*)linePadOccupMax->Clone()); + } + else if ( badOccCnt == 1 ) + { + hmpQaFlags[1] = AliQAv1::kWARNING; + text.Clear(); + text.AddText(Form("WARNING CHECK TWIKI (%d)",fIsOnlineThr)); + text.SetFillColor(kOrange); + h1->GetListOfFunctions()->Add((TPaveText*)text.Clone()); + linePadOccupMin->SetLineColor(kGreen); + linePadOccupMax->SetLineColor(kGreen); + h1->GetListOfFunctions()->Add((TLine*)linePadOccupMin->Clone()); + h1->GetListOfFunctions()->Add((TLine*)linePadOccupMax->Clone()); + } + else if ( badOccCnt == 2 ) + { + hmpQaFlags[1] = AliQAv1::kERROR; + text.Clear(); + text.AddText(Form("ERROR CALL ONCALL (%d)",fIsOnlineThr)); + text.SetFillColor(kRed); + h1->GetListOfFunctions()->Add((TPaveText*)text.Clone()); + linePadOccupMin->SetLineColor(kGreen); + linePadOccupMax->SetLineColor(kGreen); + h1->GetListOfFunctions()->Add((TLine*)linePadOccupMin->Clone()); + h1->GetListOfFunctions()->Add((TLine*)linePadOccupMax->Clone()); + } + else + { + hmpQaFlags[1] = AliQAv1::kFATAL; + text.Clear(); + text.AddText(Form("FATAL CALL ONCALL (%d)",fIsOnlineThr)); + text.SetFillColor(kRed); + h1->GetListOfFunctions()->Add((TPaveText*)text.Clone()); + linePadOccupMin->SetLineColor(kGreen); + linePadOccupMax->SetLineColor(kGreen); + h1->GetListOfFunctions()->Add((TLine*)linePadOccupMin->Clone()); + h1->GetListOfFunctions()->Add((TLine*)linePadOccupMax->Clone()); + } + } + } + }//___HmpPadOcc + + Int_t sumPadMapChROR[7]={0}; + Int_t sumPadMapChROL[7]={0}; + Int_t bigMapFlag = AliQAv1::kINFO; + Int_t errCntBigMap = 0; + + if( list->FindObject(Form("%s_hHmpBigMap",AliRecoParam::GetEventSpecieName(specie)) )) + { + TH2* h2 = dynamic_cast( list->FindObject(Form("%s_hHmpBigMap",AliRecoParam::GetEventSpecieName(specie)))); + if(h2) { + if( h2->Integral() > 1 ) { + // no entres -> fatal + // if( h2->GetEntries() == 0) {raqQualFlag = AliQAv1::kFATAL;} + h2->SetStats(0); + // clean up the text, stat, lines, ... + if( h2->GetListOfFunctions() ) h2->GetListOfFunctions()->Clear(); + + //calculate missing pad fraction + for(Int_t ich = 0; ich < 7; ich++) + { + for(Int_t iy=1+ich*144;iy<=144+ich*144;iy++) { + for(Int_t ix=1;ix<=80;ix++) if(h2->GetBinContent(ix,iy) > 0) sumPadMapChROL[ich]++; + for(Int_t ix=81;ix<=160;ix++) if(h2->GetBinContent(ix,iy) > 0) sumPadMapChROR[ich]++; + } + }//ch loop + //check the calculated missing pad fraction + for(Int_t ich = 0; ich < 7; ich++) + { + + bigMapFlag = AliQAv1::kINFO; + if( (1-sumPadMapChROL[ich]/1.0/11520) > fHmpQaThr_MissingPadFractionWarningThreshold || + (1-sumPadMapChROR[ich]/1.0/11520) > fHmpQaThr_MissingPadFractionWarningThreshold ) + { + bigMapFlag = AliQAv1::kWARNING; + } + if( (1-sumPadMapChROL[ich]/1.0/11520) > fHmpQaThr_MissingPadFractionErrorThreshold || + (1-sumPadMapChROR[ich]/1.0/11520) > fHmpQaThr_MissingPadFractionErrorThreshold ) { + bigMapFlag = AliQAv1::kERROR; + errCntBigMap++; + } + + }//ch loop + if( errCntBigMap > 0 ) bigMapFlag = AliQAv1::kERROR; + + //update labels + if ( bigMapFlag == AliQAv1::kINFO ) + { + hmpQaFlags[2] = AliQAv1::kINFO; + text.Clear(); + text.AddText(Form("OK (%d)",fIsOnlineThr)); + text.SetFillColor(kGreen); + h2->GetListOfFunctions()->Add((TPaveText*)text.Clone()); + } + else if ( bigMapFlag == AliQAv1::kWARNING ) + { + hmpQaFlags[2] = AliQAv1::kWARNING; + text.Clear(); + text.AddText(Form("WARNING CHECK TWIKI (%d)",fIsOnlineThr)); + text.SetFillColor(kOrange); + h2->GetListOfFunctions()->Add((TPaveText*)text.Clone()); + } + else if ( bigMapFlag == AliQAv1::kERROR ) + { + hmpQaFlags[2] = AliQAv1::kERROR; + text.Clear(); + text.AddText(Form("ERROR CALL ONCALL (%d)",fIsOnlineThr)); + text.SetFillColor(kRed); + h2->GetListOfFunctions()->Add((TPaveText*)text.Clone()); + } + else + { + hmpQaFlags[2] = AliQAv1::kFATAL; + text.Clear(); + text.AddText(Form("FATAL CALL ONCALL (%d)",fIsOnlineThr)); + text.SetFillColor(kRed); + h2->GetListOfFunctions()->Add((TPaveText*)text.Clone()); + } + } + } + }//___HmpBigMap + + + Int_t numSectorsMissing = 0, numSectorsGainLoss = 0; + Double_t hSumQPerSector[42]={0}; + + if( list->FindObject(Form("%s_fHmpHvSectorQ",AliRecoParam::GetEventSpecieName(specie)))) + { + + TH2* h2 = dynamic_cast( list->FindObject(Form("%s_fHmpHvSectorQ",AliRecoParam::GetEventSpecieName(specie)))); + if(h2) { + if(h2->Integral() > 0 ) { + // no entres -> fatal + // if( h2->GetEntries() == 0) {raqQualFlag = AliQAv1::kFATAL;} + h2->SetStats(0); + // clean up the text, stat, lines, ... + if( h2->GetListOfFunctions() ) h2->GetListOfFunctions()->Clear(); + + //___ check sectors + for(Int_t isec = 1 ; isec <= 42; isec++) + { + for(Int_t ibiny=100;ibiny<410;ibiny++) {hSumQPerSector[isec-1] += h2->GetBinContent(ibiny,isec); } + if(hSumQPerSector[isec-1] < 0.001) {numSectorsGainLoss++;} // there is no photon and mip peak, gain loss + if(h2->GetBinContent(1,isec) < 0.01 ) {numSectorsMissing++; } //practically there is no charge , the sector is missing + } + Int_t sectorErrors = numSectorsGainLoss+numSectorsMissing; + + + if ( sectorErrors <= 3) + { + hmpQaFlags[3] = AliQAv1::kINFO; + text.Clear(); + text.AddText(Form("OK (%d)",fIsOnlineThr)); + text.SetFillColor(kGreen); + h2->GetListOfFunctions()->Add((TPaveText*)text.Clone()); + } + else if ( sectorErrors > fHmpQaThr_SectorGainLossWarningThreshold) + { + hmpQaFlags[3] = AliQAv1::kWARNING; + text.Clear(); + text.AddText(Form("WARNING CHECK TWIKI (%d)",fIsOnlineThr)); + if(numSectorsMissing > 0 ) text.AddText(Form("MISSING SECTOR?")); + text.SetFillColor(kOrange); + h2->GetListOfFunctions()->Add((TPaveText*)text.Clone()); + } + else if ( sectorErrors > fHmpQaThr_SectorGainLossErrorThreshold) + { + hmpQaFlags[3] = AliQAv1::kERROR; + text.Clear(); + text.AddText(Form("ERROR CALL ONCALL (%d)",fIsOnlineThr)); + if(numSectorsMissing > 0 ) text.AddText(Form("MISSING SECTOR?")); + text.SetFillColor(kRed); + h2->GetListOfFunctions()->Add((TPaveText*)text.Clone()); + } + else + { + hmpQaFlags[3] = AliQAv1::kFATAL; + text.Clear(); + text.AddText(Form("FATAL CALL ONCALL (%d)",fIsOnlineThr)); + text.SetFillColor(kRed); + h2->GetListOfFunctions()->Add((TPaveText*)text.Clone()); + } + } + } + } + + + //del lines, ... + lineDdlDataSizeMin->Delete(); + lineDdlDataSizeMax->Delete(); + linePadOccupMin->Delete(); + linePadOccupMax->Delete(); + + Double_t dflag = -1; + switch ( TMath::MaxElement(4,hmpQaFlags)) + { + case AliQAv1::kINFO: + dflag = 1.0; + + break; + case AliQAv1::kWARNING: + dflag = 0.75; + + break; + case AliQAv1::kERROR: + dflag = 0.25; + + break; + case AliQAv1::kFATAL: + dflag = -1.0; + + break; + default: + dflag = AliQAv1::kNULLBit; + + break; + } + + return dflag; + + + +} +//___________________________________________________________________________________________________ +void AliHMPIDQAChecker::InitOnlineThresholds() +{ + // + // Init the online thresholds from GRP generated by AMORE + // + + AliCDBManager* man = AliCDBManager::Instance(); + if(!man) { fIsOnlineThr = kFALSE; return; } + + + if(!man->Get("GRP/Calib/QAThresholds")) { fIsOnlineThr = kFALSE; return; } + + AliCDBEntry* entry = man->Get("GRP/Calib/QAThresholds"); + if(!entry) { fIsOnlineThr = kFALSE; return; } + + TObjArray* branch = (TObjArray*) entry->GetObject(); + if(!branch ) { fIsOnlineThr = kFALSE; return; } + + AliQAThresholds* thresholds = (AliQAThresholds*) branch->FindObject("HMP"); + if(!thresholds) { fIsOnlineThr = kFALSE; return; } + else + fIsOnlineThr = kTRUE; + + + Int_t teCnt = 0; + TString parName = "zero"; + while ( thresholds->GetThreshold(teCnt)) + { + if(!((thresholds->GetThreshold(teCnt))->GetName())) return; + + parName = (thresholds->GetThreshold(teCnt))->GetName(); + + if( parName.Contains("HmpNumberOfExcludedDDLthreshold") ) + { + TParameter* myParam = (TParameter*) thresholds->GetThreshold(teCnt); + fHmpQaThr_NumberOfExcludedDDL = myParam->GetVal(); + } + + + if( parName.Contains("HmpDataSizeLowerThreshold") ) + { + TParameter* myParam = (TParameter*) thresholds->GetThreshold(teCnt); + fHmpQaThr_DataSizeLowerThreshold = myParam->GetVal(); + } + + if( parName.Contains("HmpDataSizeUpperThreshold") ) + { + TParameter* myParam = (TParameter*) thresholds->GetThreshold(teCnt); + fHmpQaThr_DataSizeUpperThreshold = myParam->GetVal(); + } + + if( parName.Contains("HmpPadOccupancyLowerThreshold") ) + { + TParameter* myParam = (TParameter*) thresholds->GetThreshold(teCnt); + fHmpQaThr_PadOccupancyLowerThreshold = myParam->GetVal(); + } + + if( parName.Contains("HmpPadOccupancyUpperThreshold") ) + { + TParameter* myParam = (TParameter*) thresholds->GetThreshold(teCnt); + fHmpQaThr_PadOccupancyUpperThreshold = myParam->GetVal(); + } + + if( parName.Contains("HmpSectorGainLossWarningThreshold") ) + { + TParameter* myParam = (TParameter*) thresholds->GetThreshold(teCnt); + fHmpQaThr_SectorGainLossWarningThreshold = myParam->GetVal(); + } + + if( parName.Contains("HmpSectorGainLossErrorThreshold") ) + { + TParameter* myParam = (TParameter*) thresholds->GetThreshold(teCnt); + fHmpQaThr_SectorGainLossErrorThreshold = myParam->GetVal(); + } + + if( parName.Contains("HmpMissingPadFractionWarningThreshold") ) + { + TParameter* myParam = (TParameter*) thresholds->GetThreshold(teCnt); + fHmpQaThr_MissingPadFractionWarningThreshold = myParam->GetVal(); + } + + if( parName.Contains("HmpMissingPadFractionErrorThreshold") ) + { + TParameter* myParam = (TParameter*) thresholds->GetThreshold(teCnt); + fHmpQaThr_MissingPadFractionErrorThreshold = myParam->GetVal(); + } + + teCnt++; + }//while + + + // PrintThresholds(); +} +//___________________________________________________________________________________________________ +void AliHMPIDQAChecker::PrintThresholds() +{ + Printf("--- Printing thresholds ---"); + Printf("--- Default or online: %i ---",fIsOnlineThr); + Printf("--- fHmpQaThr_NumberOfExcludedDDL: %i ---",fHmpQaThr_NumberOfExcludedDDL); + Printf("--- fHmpQaThr_DataSizeLowerThreshold: %i ---",fHmpQaThr_DataSizeLowerThreshold); + Printf("--- fHmpQaThr_DataSizeUpperThreshold: %i ---",fHmpQaThr_DataSizeUpperThreshold); + Printf("--- fHmpQaThr_PadOccupancyLowerThreshold: %f ---",fHmpQaThr_PadOccupancyLowerThreshold); + Printf("--- fHmpQaThr_PadOccupancyUpperThreshold: %f ---",fHmpQaThr_PadOccupancyUpperThreshold); + Printf("--- fHmpQaThr_SectorGainLossWarningThreshold: %i ---",fHmpQaThr_SectorGainLossWarningThreshold); + Printf("--- fHmpQaThr_SectorGainLossErrorThreshold: %i ---",fHmpQaThr_SectorGainLossErrorThreshold); + Printf("--- fHmpQaThr_MissingPadFractionWarningThreshold: %f ---",fHmpQaThr_MissingPadFractionWarningThreshold); + Printf("--- fHmpQaThr_MissingPadFractionErrorThreshold: %f ---",fHmpQaThr_MissingPadFractionErrorThreshold); + Printf("--- Printing thresholds done ---"); + + + + +} +//___________________________________________________________________________________________________ +