X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EMCAL%2FAliEMCALQAChecker.cxx;h=5ca16afe9d0146b3c1c8b8e100ca5f230791428f;hb=452656d15558dace1996058a954ab3af884d3482;hp=d81ff977e74922bc083bb48fb0ee4e4c35c91364;hpb=8976d7bdb2458eba34e5347c4d723af270537396;p=u%2Fmrichter%2FAliRoot.git diff --git a/EMCAL/AliEMCALQAChecker.cxx b/EMCAL/AliEMCALQAChecker.cxx index d81ff977e74..5ca16afe9d0 100644 --- a/EMCAL/AliEMCALQAChecker.cxx +++ b/EMCAL/AliEMCALQAChecker.cxx @@ -32,10 +32,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include @@ -43,85 +45,84 @@ // --- AliRoot header files --- #include "AliLog.h" +#include "AliCDBManager.h" +#include "AliCDBEntry.h" #include "AliQAv1.h" #include "AliQAChecker.h" +#include "AliQAThresholds.h" #include "AliEMCALQAChecker.h" -#include "AliEMCALQADataMakerRec.h" ClassImp(AliEMCALQAChecker) //__________________________________________________________________ AliEMCALQAChecker::AliEMCALQAChecker() : AliQACheckerBase("EMCAL","EMCAL Quality Assurance Data Maker"), -fLine(new TLine*[fknSM]), -fHref(new TLine*[fknSM]), -fText(NULL) +fTextSM(new TText*[fgknSM]), +fLineCol(new TLine(47.5,-0.5,47.5,119.5)), +fText(new TPaveText(0.2,0.7,0.8,0.9,"NDC")) { - /// ctor - for (Int_t sm = 0 ; sm < fknSM ; sm++){ - fLine[sm] = NULL ; - fHref[sm] = NULL ; - } + // ctor + fLineCol->SetLineColor(1); + fLineCol->SetLineWidth(2); + + fTextSM[0]= new TText(20, 12, "SM A0"); + fTextSM[1]= new TText(20, 36, "SM A1"); + fTextSM[2]= new TText(20, 60, "SM A2"); + fTextSM[3]= new TText(20, 84, "SM A3"); + fTextSM[4]= new TText(20, 108,"SM A4"); + fTextSM[5]= new TText(20, 132,"SM A5"); + + fTextSM[6]= new TText(64, 12, "SM C0"); + fTextSM[7]= new TText(64, 36, "SM C1"); + fTextSM[8]= new TText(64, 60, "SM C2"); + fTextSM[9]= new TText(64, 84, "SM C3"); + fTextSM[10]= new TText(64, 108,"SM C4"); + fTextSM[11]= new TText(64, 132,"SM C5"); + + for(int i = 0; i < 5; i++) { + fLineRow[i] = new TLine(-0.5,23.5+(24*i),95.5,23.5+(24*i)); + fLineRow[i]->SetLineColor(1); + fLineRow[i]->SetLineWidth(2); + } + + for(int i = 0; i < 3; i++) { + fTextL1[i] = new TPaveText(0.2,0.8,0.8,0.9,"NDC"); + } + + } //__________________________________________________________________ AliEMCALQAChecker::~AliEMCALQAChecker() { /// dtor - delete [] fLine ; - delete [] fHref ; - if (fText) - delete fText ; -} - -//__________________________________________________________________ -AliEMCALQAChecker::AliEMCALQAChecker(const AliEMCALQAChecker& qac) : -AliQACheckerBase(qac.GetName(), qac.GetTitle()), -fLine(new TLine*[fknSM]), -fHref(new TLine*[fknSM]), -fText(qac.fText) -{ - /// copy ctor - for (Int_t sm = 0 ; sm < fknSM ; sm++){ - fLine[sm] = qac.fLine[sm] ; - fHref[sm] = qac.fHref[sm] ; - } -} -//__________________________________________________________________ -AliEMCALQAChecker& AliEMCALQAChecker::operator = (const AliEMCALQAChecker &qac) -{ - fText = qac.fText; - - for (Int_t sm = 0 ; sm < fknSM ; sm++){ - fLine[sm] = qac.fLine[sm] ; - fHref[sm] = qac.fHref[sm] ; - } - return *this ; + delete [] fTextSM ; + delete fLineCol ; + for (Int_t i=0; i<5; ++i) delete fLineRow[i] ; + delete fText ; } //______________________________________________________________________________ -Double_t * -AliEMCALQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, AliDetectorRecoParam * /*recoParam*/) +void AliEMCALQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) { /// Check objects in list if ( index == AliQAv1::kRAW ) { - return CheckRaws(list); - printf ("checkers for task %d \n", index) ; + CheckRaws(test, list); + //printf ("checkers for task %d \n", index) ; } if ( index == AliQAv1::kREC) { - return CheckRecPoints(list); + CheckRecPoints(test, list); } if ( index == AliQAv1::kESD ) { - return CheckESD(list); + CheckESD(test, list); } - AliWarning(Form("Checker for task %d not implement for the moment",index)); - return NULL; + //AliWarning(Form("Checker for task %d not implement for the moment",index)); } //______________________________________________________________________________ @@ -153,199 +154,320 @@ AliEMCALQAChecker::MarkHisto(TH1& histo, Double_t value) const //______________________________________________________________________________ -Double_t * -AliEMCALQAChecker::CheckRaws(TObjArray ** list) +void AliEMCALQAChecker::CheckRaws(Double_t * test, TObjArray ** list) { -// Check RAW QA histograms -// We count the times of the response for each tower, the propability for all towers should be the same (average is given value). -// We skip the first few cycles since the statistics is not enough, the average should be always larger than 1 at least. -// By calculating the difference between the counts for each tower and the average, we decide whether we should recalculate -// the average depending the the gaus fitting on the divation distribution. -// During the recalutation of the average, we count how many towers are used for the calculation. -// From the fraction of towers used, we decide whether each SM works fine or not -// From the divation of average, we set the QA flag for the full detetcor as INFO, WARNING, ERROR or FATAL. - -// -- Yaxian Mao, CCNU/CERN/LPSC - - Float_t kThreshold = 80. ; + // Check RAW QA histograms + // -- Yaxian Mao, CCNU/CERN/LPSC + //adding new checking method: 25/04/2010, Yaxian Mao + //Comparing the amplitude from current run to the reference run, if the ratio in the range [0.8, .12], count as a good tower. + //If more than 90% towers are good, EMCAL works fine, otherwise experts should be contacted. + + + // Retrieve the thresholds + Float_t ratioThresh = 0.9; // threshold for calibration ratio = good towers/all towers (default 0.9) + Float_t ThreshG = 0.5; // threshold for L1 Gamma triggers (default 0.5) + Float_t ThreshJ = 0.5; // threshold for L1 Jet triggers (default 0.5) + Int_t badLinkThresh = 1; // threshold for bad links (default 1) + + AliCDBManager* man = AliCDBManager::Instance(); + if(man){ + AliCDBEntry* entry = man->Get("GRP/Calib/QAThresholds"); + if(entry){ + TObjArray* branch = (TObjArray*) entry->GetObject(); + if(branch){ + AliQAThresholds* thresholds = (AliQAThresholds*) branch->FindObject("EMC"); + if(thresholds){ + TParameter* ParamR = (TParameter*) thresholds->GetThreshold(0); + TParameter* ParamG = (TParameter*) thresholds->GetThreshold(1); + TParameter* ParamJ = (TParameter*) thresholds->GetThreshold(2); + TParameter* ParamL = (TParameter*) thresholds->GetThreshold(3); + if(ParamR) + ratioThresh = ParamR->GetVal(); + if(ParamG) + ThreshG = ParamG->GetVal(); + if(ParamJ) + ThreshJ = ParamJ->GetVal(); + if(ParamL) + badLinkThresh = ParamL->GetVal(); + } + } + } + } - Double_t * test = new Double_t[AliRecoParam::kNSpecies] ; + Int_t nTowersPerSM = 24*48; // number of towers in a SuperModule; 24x48 + Double_t nTot = fgknSM * nTowersPerSM ; + TList *lstF = 0; + Int_t calibSpecieId = (Int_t)TMath::Log2( AliRecoParam::kCalib ); for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { - test[specie] = 1.0 ; - if ( !AliQAv1::Instance()->IsEventSpecieSet(specie)) - continue ; - if (list[specie]->GetEntries() == 0) - test[specie] = 0. ; // nothing to check + + test[specie] = 0.0 ; + if ( !AliQAv1::Instance()->IsEventSpecieSet(specie)) continue ; + if (list[specie]->GetEntries() == 0) test[specie] = 0. ; // nothing to check else { - TH1 * hdata = (TH1*)list[specie]->At(kTowerHG) ; - if(hdata->GetEntries()==0) - continue; - Int_t nbin = hdata->GetNbinsX() ; - Int_t nTower = nbin/4 ; // ! number of channels for each SM - if(fText) { - fText->DeleteText() ; - fText->Clear() ; - } - else { - fText = new TPaveText(0.3,0.6,0.7,0.9,"NDC") ; - } - fText->AddText(Form("OK if more than %2.2f %% inside aver-sigma < HG counts < aver+sigma", kThreshold)); - //TPaveText * fText[fknSM] = {0}; - Double_t rv = 0. ; //value to define the flag for the full detector - for(Int_t iSM = 0 ; iSM < fknSM ; iSM++){ //number of SMs loop start - TString projname = Form("proj_%d",iSM); - Double_t aver = 0. ; //average calculated by the input histogram - Double_t recal = 0 ; // recalculate the average if the divation is large - Double_t init = 0. ; // value to decide whether we should recalculate the average - Double_t mean = 0. ; //the divation from the average, from the gaus fitting peak - Double_t width = 0. ; // the sigma of the devation, from the gaus fitting - Int_t flag = 0 ; //counts for channels used for recalculation of average - Double_t ratio = 0. ; //value to decide whether each SM works - TH1F * proj = NULL ; //a temp histogram store the difference from the average for the fitting procedure - - for(Int_t iTower = iSM*nTower ; iTower<(iSM+1)*nTower ; iTower++) //channel loop to calculate the average - aver += hdata->GetBinContent(iTower); - - aver /=nTower; - AliInfo(Form("SM: %d has average = %f\n",iSM, aver)); - Double_t ymin = hdata->GetBinContent(hdata->GetMinimumBin()); - Double_t ymax = hdata->GetBinContent(hdata->GetMaximumBin()); - proj = new TH1F(projname,projname,nbin,-aver,aver); - fLine[iSM] = dynamic_cast(hdata->GetListOfFunctions()->FindObject(fLine[iSM])); - //initialize the lines separate different SM - if (!fLine[iSM]) { - fLine[iSM] = new TLine((iSM+1)*nTower,ymin,(iSM+1)*nTower,ymax); - fLine[iSM]->SetLineColor(1); - fLine[iSM]->SetLineWidth(2); - hdata->GetListOfFunctions()->Add(fLine[iSM]); - list[specie]->AddAt(hdata, kTowerHG) ; - } - else { - fLine[iSM]->SetX1((iSM+1)*nTower) ; - fLine[iSM]->SetY1(ymin) ; - fLine[iSM]->SetX2((iSM+1)*nTower) ; - fLine[iSM]->SetY2(ymax) ; - } - //filling the histogram with the difference and fitting with gaus function to obtain mean and sigma - for(Int_t iTower = iSM*nTower ; iTower<(iSM+1)*nTower ; iTower++){ - proj->Fill(hdata->GetBinContent(iTower)-aver); - } - proj->Fit("gaus","","QNO"); - mean=proj->GetFunction("gaus")->GetParameter(1); // ! mean should be peaked at 0 in principal - width=proj->GetFunction("gaus")->GetParameter(2); - AliInfo(Form("aver = %f, mean = %f, sigma =%f\n",aver,mean, width)); - - if(aver) init=TMath::Abs(mean/aver); //calculate the divation from the average - - //if mean or sigma is too huge or the sigma is too small, the fitting failed - if((aver+mean) < 1. || width/aver >2. || width < 1.e-3) - flag = -1 ; - else { //recalculate the average if the fitting didn't give the initial average - aver+=mean; //average corrected after fitting is fitting works - //if(aver <= 1. ) break ; - // if divation is too large, we conside to recalate the average by excluding channels too far from the average - while(init>0.01 && aver >= 1.){ - if(flag) flag = 0 ; //for each time recalculation, reset flag - for(Int_t iTower = iSM*nTower ; iTower < (iSM+1)*nTower ; iTower++){ - if(hdata->GetBinContent(iTower)>(aver-width) && hdata->GetBinContent(iTower)<(aver+width)){ - flag++ ; - recal += hdata->GetBinContent(iTower); - } - } //end of channels loop - - if(flag == 0 || recal < 1.) { - flag = -1 ; - break ; - } - else { - recal/=flag ; - init=(aver-recal)/(aver+recal) ; //difference between the new average and the pervious one - aver =(aver+recal)/2 ; //recalculate the average by the last two values - } - } //out of while condition - - ratio=100.0*flag/nTower ; //counting how many towers used for average recalculation - AliInfo(Form("SM %d has %2.2f %% chanhel works \n", iSM, ratio)); - } // end of recalculation - - rv+=init ; //define the deviation from the final average - - //define the average line on each SM - fHref[iSM] = dynamic_cast(hdata->GetListOfFunctions()->FindObject(fHref[iSM])); - if(!fHref[iSM]) { - fHref[iSM] = new TLine(iSM*nTower,aver,(iSM+1)*nTower,aver); - hdata->GetListOfFunctions()->Add(fHref[iSM]); - list[specie]->AddAt(hdata, kTowerHG) ; - } - else { - fHref[iSM]->Clear() ; - fHref[iSM]->SetX1(iSM*nTower) ; - fHref[iSM]->SetY1(aver) ; - fHref[iSM]->SetX2((iSM+1)*nTower) ; - fHref[iSM]->SetY2(aver) ; - } - - hdata->Paint() ; - - // if channels used for average recalculation smaller than the threshold, - // then too much noise channels or channels didn't work - if(ratio<= kThreshold && flag >0){ - //fText->SetFillColor(2); - fHref[iSM]->SetLineColor(2); - fHref[iSM]->SetLineWidth(2); - fText->SetFillColor(2); - fText->AddText(Form("SM %d: NOK = %2.0f %% channels OK!!!",iSM,ratio)); - //fText[iSM]->AddText(Form("SM %d NOT OK, only %5.2f %% works!!!",iSM,flag/nTower)); - } - else if (flag == -1 || flag == 0 ) { //fitting failed or recalculation didn't call - fText->SetFillColor(2); - fHref[iSM]->SetLineColor(2); - fHref[iSM]->SetLineWidth(2); - fText->SetFillColor(2); - fText->AddText(Form("SM %d: NOK Fitting failed",iSM,ratio)); - //fText[iSM]->AddText(Form("SM %d has %5.2f %% towers wok normally",iSM,flag/nTower)); - } - else { - fText->SetFillColor(3); - fHref[iSM]->SetLineColor(3); - fHref[iSM]->SetLineWidth(2); - fText->AddText(Form("SM %d: OK = %2.0f %% channels OK",iSM,ratio)); - //fText[iSM]->AddText(Form("SM %d has %5.2f %% towers wok normally",iSM,flag/nTower)); - } - hdata->Paint() ; - //hdata->GetListOfFunctions()->Add(fText[iSM]); - delete proj ; - } // end of SM loop - rv/=fknSM; - hdata->GetListOfFunctions()->Add(fText); - hdata->Paint() ; - if ( rv <=0.1 ) { - AliInfo(Form("The deviation rv = %2.2f is small compared to average, detector works fine",rv)); - test[specie] = 0.05; - } + //get calib histos + TH2F * hdata = (TH2F*)list[specie]->At(k2DRatioAmp) ; + TH1F * ratio = (TH1F*)list[specie]->At(kRatioDist) ; - if ( rv <=0.5 && rv >0.1 ) { - AliWarning(Form("The deviation rv = %2.2f is acceptable from average, the detector works not perfect!",rv)); - test[specie] = 0.3; - } + //get L1 histos + TH2F *hL1GammaPatch = (TH2F*)list[specie]->At(kGL1); + TH2F *hL1JetPatch = (TH2F*)list[specie]->At(kJL1); + TH1I *hFrameR = (TH1I*)list[specie]->At(kSTUTRU); - if ( rv <=0.8 && rv >0.5 ) { - AliError(Form("Got a large deviation of %2.2f from average, some error on the detector !!!",rv)); - test[specie] = 0.7; - } - if ( rv >0.8 ) { - AliError(Form("Got too large deviation of %2.2f from average, detector out of control ???",rv)); - test[specie] = 0.9; - } - - } //end of checking raw - - } //species loop - return test ; + // ======================================================================================= + //calib histo checker first: + if( hdata && ratio ){ + + // first clean lines, text (functions) + lstF = hdata->GetListOfFunctions(); + CleanListOfFunctions(lstF); + lstF = ratio->GetListOfFunctions(); + CleanListOfFunctions(lstF); + + if(hdata->GetEntries()!=0 && ratio->GetEntries()!=0) { + + lstF = hdata->GetListOfFunctions(); + + //adding the lines to distinguish different SMs + lstF->Add(fLineCol->Clone()); + for(Int_t iLine = 0; iLine < 5; iLine++) { + lstF->Add(fLineRow[iLine]->Clone()); + } + //Now adding the text to for each SM + for(Int_t iSM = 0 ; iSM < fgknSM ; iSM++){ //number of SMs loop start + lstF->Add(fTextSM[iSM]->Clone()); + } + + + //now check the ratio histogram + lstF = ratio->GetListOfFunctions(); + + Double_t binContent = 0. ; + Int_t nGoodTower = 0 ; + Double_t rv = 0. ; + for(Int_t ix = 1; ix <= hdata->GetNbinsX(); ix++) { + for(Int_t iy = 1; iy <= hdata->GetNbinsY(); iy++) { + binContent = hdata->GetBinContent(ix, iy) ; + if (binContent < 1.2 && binContent > 0.8) nGoodTower++ ; + } + } + rv = nGoodTower/nTot ; + //printf("%2.2f %% towers out of range [0.8, 1.2]\n", (1-rv)*100); + if(fText){ + lstF->Add(fText->Clone()) ; + fText->Clear() ; + + fText->AddText(Form("%2.2f %% towers out of range [0.8, 1.2]", (1-rv)*100)); + if (rv < ratioThresh) { + test[specie] = ratioThresh; + // 2 lines text info for quality + fText->SetFillColor(2) ; + fText->AddText(Form("EMCAL = NOK, CALL EXPERTS!!!")); + } + else { + test[specie] = 1 - ratioThresh; + fText->SetFillColor(3) ; + fText->AddText(Form("EMCAL = OK, ENJOY...")); + } + }//fText + }//calib histo checking done + }//histograms NOT NULL + + // ======================================================================================== + // now L1 checks: + + if( hL1GammaPatch ){ + + // first clean lines, text (functions) + lstF = hL1GammaPatch->GetListOfFunctions(); + CleanListOfFunctions(lstF); + + if (specie != calibSpecieId) { + //if(hL1GammaPatch->GetEntries() !=0 ) { + if(hL1GammaPatch->GetEntries() > 10) { // need some statistics for hot spot calculation + lstF = hL1GammaPatch->GetListOfFunctions(); + + // Checker for L1GammaPatch + //Double_t dL1GmeanTrig = 1./2961.; + //Double_t dL1GmeanTrigTRU = 1./32.; + //Int_t sigmaG = 100; // deviation from mean value (increased to 100) + //Int_t sigmaGTRU = 5; // deviation from mean value for TRUs + Double_t dL1GEntries = hL1GammaPatch->GetEntries(); + Int_t badL1G[48][64] = {{0}} ; + Int_t badL1GTRU[2][16] = {{0}} ; + Int_t nBadL1G = 0; + Int_t nBadL1GTRU = 0; + Double_t binContentTRU[2][16] = {{0.}}; + for(Int_t ix = 1; ix <= hL1GammaPatch->GetNbinsX(); ix++) { + for(Int_t iy = 1; iy <= hL1GammaPatch->GetNbinsY(); iy++) { + Double_t binContent = hL1GammaPatch->GetBinContent(ix, iy) ; + if (binContent != 0) { + + // fill counter for TRUs + binContentTRU[(Int_t)((ix-1)/24)][(Int_t)((iy-1)/4)] += binContent; + + // OLD METHOD (if a patch triggers > sigmaG * mean value (1/#patch positions total) says "hot spot !") + // if ((double)binContent/(double)dL1GEntries > sigmaG*dL1GmeanTrig) { + // badL1G[ix-1][iy-1] += 1; + // nBadL1G += 1; + // } + + // NEW METHOD (if Rate > Threshold * ( (Number of towers or TRUs * Average rate) - Rate ) --> "hot spot !") + // Thresold = how much does the noisy tower/TRU contribute to the rate + // 1.0 --> Rate of noisy tower/TRU = Rate of all other towers/TRUs + if (binContent/dL1GEntries > ThreshG / ( 1 + ThreshG )) { + badL1G[ix-1][iy-1] += 1; + nBadL1G += 1; + } + } + } + } + + // check TRUs + for(Int_t ix = 1; ix <= 2; ix++) { + for(Int_t iy = 1; iy <= 16; iy++) { + if(binContentTRU[ix-1][iy-1]/dL1GEntries > ThreshG / ( 1 + ThreshG )) { + badL1GTRU[ix-1][iy-1] += 1; + nBadL1GTRU += 1; + } + } + } + + if(fTextL1[0]){ + lstF->Add(fTextL1[0]->Clone()) ; + fTextL1[0]->Clear() ; + + if (nBadL1G == 0 && nBadL1GTRU == 0 ) { + fTextL1[0]->SetFillColor(3) ; + fTextL1[0]->AddText(Form("L1 GAMMA TRIGGER = OK, ENJOY...")); + } + else if (nBadL1G == 0){ + fTextL1[0]->SetFillColor(2) ; + fTextL1[0]->AddText(Form("HOT SPOT IN L1 GAMMA TRIGGER (TRU) = CALL EXPERT!!")); + + } + else{ + fTextL1[0]->SetFillColor(2) ; + fTextL1[0]->AddText(Form("HOT SPOT IN L1 GAMMA TRIGGER = CALL EXPERT!!")); + /* + for(Int_t ix = 1; ix <= hL1GammaPatch->GetNbinsX(); ix++) { + for(Int_t iy = 1; iy <= hL1GammaPatch->GetNbinsY(); iy++) { + if(badL1G[ix-1][iy-1] != 0) printf("L1 Gamma patch with position x = %d, y = %d is out of range\n",ix,iy); + } + } + */ + } + }//fTextL1[0] + }// L1 gamma patch checking done + }// if (specie != calibSpecieId) .. + }//hL1GammaPatch NOT NULL + + if( hL1JetPatch ){ + + lstF = hL1JetPatch->GetListOfFunctions(); + CleanListOfFunctions(lstF); + + if (specie != calibSpecieId) { + + //if(hL1JetPatch->GetEntries() !=0) { + if(hL1JetPatch->GetEntries() > 10) { // need some statistics for hot spot calculation + + lstF = hL1JetPatch->GetListOfFunctions(); + + // Checker for L1JetPatch + //Double_t dL1JmeanTrig = 1/126.; + //Int_t sigmaJ = 5; // deviation from mean value + Double_t dL1JEntries = hL1JetPatch->GetEntries(); + Int_t badL1J[12][16] = {{0}} ; + Int_t nBadL1J = 0; + for(Int_t ix = 1; ix <= hL1JetPatch->GetNbinsX(); ix++) { + for(Int_t iy = 1; iy <= hL1JetPatch->GetNbinsY(); iy++) { + Double_t binContent = hL1JetPatch->GetBinContent(ix, iy) ; + if (binContent != 0) { + + // OLD METHOD (if a patch triggers > sigmaJ * mean value (1/#patch positions total) says "hot spot !") + // if ((double)binContent/(double)dL1JEntries > sigmaJ*dL1JmeanTrig) { + // badL1J[ix-1][iy-1] += 1 ; + // nBadL1J += 1; + // } + + // NEW METHOD (if Rate > Threshold * ( (Number of towers or TRUs * Average rate) - Rate ) --> "hot spot !") + // Threshold: same definitionas for Gamma + if ((double)binContent/(double)dL1JEntries > ThreshJ / ( 1 + ThreshJ )) { + badL1J[ix-1][iy-1] += 1 ; + nBadL1J += 1; + } + } + } + } + + if(fTextL1[1]){ + lstF->Add(fTextL1[1]->Clone()) ; + fTextL1[1]->Clear() ; + + if (nBadL1J == 0) { + fTextL1[1]->SetFillColor(3) ; + fTextL1[1]->AddText(Form("L1 JET TRIGGER = OK, ENJOY...")); + } + else { + fTextL1[1]->SetFillColor(2) ; + fTextL1[1]->AddText(Form("HOT SPOT IN L1 JET TRIGGER = CALL EXPERT!!")); + /* + for(Int_t ix = 1; ix <= hL1JetPatch->GetNbinsX(); ix++) { + for(Int_t iy = 1; iy <= hL1JetPatch->GetNbinsY(); iy++) { + if(badL1J[ix-1][iy-1] != 0) printf("L1 Jet patch with position x = %d, y = %d is out of range\n",(4*ix-4),(4*iy-4)); + } + } + */ + + } + }//fTextL1[1] + } // L1 Jet patch checking done + } // if (specie != calibSpecieId) .. + }// hL1JetPatch NOT NULL + + if(hFrameR){ + + lstF = hFrameR->GetListOfFunctions(); + CleanListOfFunctions(lstF); + + if(hFrameR->GetEntries() !=0) { + lstF = hFrameR->GetListOfFunctions(); + + Int_t badLink[32] = {0}; + Int_t nBadLink = 0; + for(Int_t ix = 1; ix <= hFrameR->GetNbinsX(); ix++) { + Double_t binContent = hFrameR->GetBinContent(ix) ; + if (binContent == 0) { + badLink[ix-1] += 1; + nBadLink += 1; + } + } + if(fTextL1[2]){ + lstF->Add(fTextL1[2]->Clone()) ; + fTextL1[2]->Clear() ; + + if (nBadLink < badLinkThresh) { + fTextL1[2]->SetFillColor(3) ; + fTextL1[2]->AddText(Form("LINK TRU-STU = OK, ENJOY...")); + } + else { + fTextL1[2]->SetFillColor(2) ; + fTextL1[2]->AddText(Form("PROBLEM WITH TRU-STU LINK = CALL EXPERT!!")); + /* + for(Int_t ix = 0; ix <= hFrameR->GetNbinsX(); ix++) { + if(badLink[ix] != 0) printf("STU link with TRU %d is out\n",ix); + } + */ + } + }//fTextL1[2] + } // Checker for link TRU-STU done + }//hFrameR NOT NULL + } // species processed + } // specie } - //______________________________________________________________________________ + void AliEMCALQAChecker::Init(const AliQAv1::DETECTORINDEX_t det) { /// intialises QA and QA checker settings @@ -363,3 +485,22 @@ void AliEMCALQAChecker::Init(const AliQAv1::DETECTORINDEX_t det) SetHiLo(&hiValue[0], &lowValue[0]) ; } +//______________________________________________________________________________ + +void AliEMCALQAChecker::CleanListOfFunctions(TList *list) +{ // clean up + + if (list) { + TObject *stats = list->FindObject("stats"); list->Remove(stats); + TObject *obj; + while ((obj = list->First())) { while(list->Remove(obj)) { } delete obj; } + if (stats) list->Add(stats); + } + else { + AliWarning(Form("Checker : empty list of data functions; returning")); + return; + } + +} + +