LCOV - code coverage report
Current view: top level - ITS/ITSbase - AliITSQASSDChecker.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 7 130 5.4 %
Date: 2016-06-14 17:26:59 Functions: 2 9 22.2 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       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             :  **************************************************************************/
      15             : 
      16             : /* $Id$ */
      17             : 
      18             : // *****************************************
      19             : //  Checks the quality assurance 
      20             : //  by comparing with reference data
      21             : //  P. Cerello Apr 2008
      22             : //  INFN Torino
      23             : 
      24             : // --- ROOT system ---
      25             : #include "TH1.h"
      26             : #include "TString.h"
      27             : #include "TCanvas.h"
      28             : #include "TStyle.h"
      29             : #include "TPad.h"
      30             : //#include "Riostream.h"
      31             : 
      32             : // --- AliRoot header files ---
      33             : #include "AliITSQASSDChecker.h"
      34             : #include "AliITSQADataMakerRec.h"
      35             : #include "AliLog.h"
      36             : 
      37         118 : ClassImp(AliITSQASSDChecker)
      38             : //__________________________________________________________________
      39             : AliITSQASSDChecker& AliITSQASSDChecker::operator = (const AliITSQASSDChecker& qac ) 
      40             : {
      41             :   // Equal operator.
      42           0 :   this->~AliITSQASSDChecker();
      43           0 :   new(this) AliITSQASSDChecker(qac);
      44           0 :   return *this;
      45           0 : }
      46             : 
      47             : void AliITSQASSDChecker::CheckRaws(TH1* histo) {  
      48             :   // checker for RAWS
      49             :   Double_t minSSDDataSize = 0;
      50             :   Double_t maxSSDDataSize = 200;
      51             :   Double_t minDDLDataSize = 0;
      52             :   Double_t maxDDLDataSize = 50;
      53             :   Double_t minLDCDataSize = 0;
      54             :   Double_t maxLDCDataSize = 100;
      55             :   Double_t minMeanDDLDataSize = 0;
      56             :   Double_t maxMeanDDLDataSize = 50;
      57             :   Double_t minMeanLDCDataSize = 0;
      58             :   Double_t maxMeanLDCDataSize = 100;
      59             :   //  Double_t maxOccupancy = 5;
      60             : 
      61           0 :   TString histname = histo->GetName();
      62             : 
      63           0 :   if (histname.EndsWith("SSDEventType")) {
      64           0 :     if (histo->GetEntries()==0) {
      65           0 :       AliWarning("Event type histogram is empty");
      66             :     }
      67           0 :     else if (histo->GetBinContent(histo->FindBin(7))==0) AliWarning("No type 7 (physics) events in EventType");
      68             :   }
      69             : 
      70           0 :   if (histname.EndsWith("SSDDataSize")) {
      71           0 :     if (histo->GetEntries()==0) AliWarning("SSD data size histogram is empty");
      72           0 :     if (histo->GetMean()>maxSSDDataSize||histo->GetMean()<minSSDDataSize) AliWarning(Form("SSD mean data size is %-.2g kB", histo->GetMean()));
      73             :   }
      74             : 
      75           0 :   if (histname.EndsWith("SSDDataSizePerDDL")) {
      76           0 :     if (histo->GetEntries()==0) {
      77           0 :       AliWarning("Data size per DDL histogram is empty");
      78             :     }
      79             :     else {
      80           0 :       for(Int_t i = 512; i < 528; i++) {
      81           0 :         if(histo->GetBinContent(histo->FindBin(i))==0) {
      82           0 :            AliWarning(Form("Data size / DDL histogram: bin for DDL %i is empty",i));
      83             :         }
      84           0 :         else if(histo->GetBinContent(histo->FindBin(i))<minDDLDataSize||histo->GetBinContent(histo->FindBin(i))>maxDDLDataSize) AliWarning(Form("Data size DDL %i is %-.2g kB",i,histo->GetBinContent(histo->FindBin(i))));
      85             :      }
      86             :     }
      87             :   }
      88             : 
      89           0 :   if (histname.EndsWith("SSDDataSizePerLDC")) {
      90           0 :     if (histo->GetEntries()==0) {
      91           0 :       AliWarning("Data size per LDC histogram is empty");
      92             :     }    
      93             :     else {
      94           0 :       AliInfo(Form("Data size per LDC histogram has %f entries",histo->GetEntries()));
      95           0 :       for(Int_t i = 170; i < 178; i++) {
      96           0 :         if(histo->GetBinContent(histo->FindBin(i))==0) {
      97           0 :           AliWarning(Form("Data size / LDC histogram: bin for LDC %i is empty",i));
      98             :         }
      99           0 :         else if(AliITSQADataMakerRec::AreEqual(histo->GetBinContent(histo->FindBin(i)),minLDCDataSize) ||histo->GetBinContent(histo->FindBin(i))>maxLDCDataSize) AliWarning(Form("Data size LDC %i is %-.2g kB",i,histo->GetBinContent(i)));
     100             :       }
     101             :     }
     102             :   }
     103             : 
     104           0 :   if (histname.EndsWith("SSDLDCId")) {
     105           0 :     if (histo->GetEntries()==0) {
     106           0 :       AliWarning("LDC ID histogram is empty");
     107             :     }    
     108             :     else {
     109           0 :       for(Int_t i = 170; i < 177; i++) {
     110           0 :         if(histo->GetBinContent(histo->FindBin(i))==0) {
     111           0 :           AliWarning(Form("LDC ID histogram: No entries for LDC %i",i));
     112             :         }
     113           0 :         else if(histo->GetBinContent(histo->FindBin(i))!=histo->GetBinContent(histo->FindBin(i+1))) {
     114           0 :           AliWarning("LDC Id distribution is not uniform");
     115             :           i=176;
     116           0 :         }
     117             :       }
     118             :     }
     119             :   }
     120             : 
     121           0 :   if (histname.EndsWith("SSDDDLId")) {
     122           0 :     if (histo->GetEntries()==0) {
     123           0 :       AliWarning("DDL ID histogram is empty");
     124             :     }
     125             :     else {
     126           0 :       for(Int_t i = 512; i < 527; i++) {
     127           0 :         if(histo->GetBinContent(histo->FindBin(i))==0) {
     128           0 :           AliWarning(Form("DDL ID histogram: No entries for DDL %i",i));
     129             :         }
     130           0 :         else if(histo->GetBinContent(histo->FindBin(i))!=histo->GetBinContent(histo->FindBin(i+1))) {
     131           0 :           AliWarning("DDL Id distribution is not uniform");
     132             :           i=526;
     133           0 :         }
     134             :       }
     135             :     }
     136             :   }
     137             : 
     138           0 :   if (histname.Contains("SSDDataSizeLDC")) {
     139           0 :     if (histo->GetEntries()==0) {
     140           0 :       AliWarning(Form("LDC %s data size distribution is empty", histname(histname.Length()-3,3).Data()));
     141             :     }
     142           0 :     else if (histo->GetMean()<minMeanLDCDataSize||histo->GetMean()>maxMeanLDCDataSize) AliWarning(Form("Mean data size of LDC %s is %-.2g kB",histname(histname.Length()-3,3).Data(), histo->GetMean()));
     143             :   }
     144             : 
     145           0 :   if (histname.Contains("SSDDataSizeDDL")) {
     146           0 :     if (histo->GetEntries()==0) {
     147           0 :       AliWarning(Form("DDL %s data size distribution is empty", histname(histname.Length()-3,3).Data()));
     148             :     } 
     149           0 :     else if (histo->GetMean()<minMeanDDLDataSize||histo->GetMean()>maxMeanDDLDataSize) AliWarning(Form("Mean data size of DDL %s is %-.2g kB",histname(histname.Length()-3,3).Data(), histo->GetMean()));
     150             :   }
     151             : 
     152             :   /* Lines below commented out because nothing was checked with them since the AliWarning was commented (F. Prino, June 18 2014)
     153             :   if (histname.Contains("SSDAverageOccupancy")) {
     154             :  
     155             :     const char* side = "";
     156             :     int ladder = 0;
     157             :     int layernr = 0;
     158             : 
     159             :     if (histname.EndsWith("5")) layernr = 499;
     160             :     if (histname.EndsWith("6")) layernr = 599;
     161             : 
     162             :     for (Int_t i = 1; i < histo->GetNbinsY() + 1; i++) { //ladder/side loop
     163             :       if(i==3.*int(i/3.)){
     164             :         ladder=int(i/3.)+layernr;
     165             :         side="P side";
     166             :       }
     167             :       else if(i==3.*int(i+1/3.)){
     168             :         ladder=int((i+1)/3.)+layernr;
     169             :         side="N side";
     170             :       }
     171             : 
     172             :       for (Int_t j = 1; j < histo->GetNbinsX() + 1; j++) { //module loop
     173             :         //if(histo->GetBinContent(j,i)>maxOccupancy)
     174             :           // AliWarning(Form("Occupancy ladder %i, module %i, %s is %-.2f %%",ladder,j,side, histo->GetBinContent(j,i)));
     175             :       }//module loop
     176             :     }//ladder loop
     177             :   }
     178             :   */
     179           0 : }
     180             : 
     181             : 
     182             : //__________________________________________________________________
     183             : Bool_t  AliITSQASSDChecker::MakeSSDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode) {
     184             :   //create the image for raws and recpoints. In the other case, the default methodof CheckerBase class will be used  //
     185           0 :   gStyle->SetPalette(1,0);
     186             :   Bool_t rval=kFALSE;
     187           0 :   fImage=(TCanvas**)AliQAChecker::Instance()->GetDetQAChecker(0)->GetImage();
     188             : 
     189           0 :   if(task == AliQAv1::kRAWS) 
     190           0 :     rval = MakeSSDRawsImage(list, task,mode);
     191             :   else rval=kFALSE;
     192             :   
     193           0 :   return rval;
     194             : }
     195             : 
     196             : //_______________________________________________________________________
     197             : Bool_t AliITSQASSDChecker::MakeSSDRawsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode ) {
     198             :   // MakeSSDRawsImage: raw data QA plots
     199           0 :   for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
     200             :     //printf("-------------------------> %i \n", esIndex);
     201           0 :     if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) continue;
     202             :     else {
     203           0 :       const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ; 
     204           0 :       if ( !fImage[esIndex] ) fImage[esIndex] = new TCanvas(title, title,1280,980) ;
     205             :         
     206           0 :       fImage[esIndex]->Clear() ; 
     207           0 :       fImage[esIndex]->SetTitle(title) ; 
     208           0 :       fImage[esIndex]->cd();
     209             :  
     210             :       //TPaveText someText(0.015, 0.015, 0.98, 0.98);
     211             :       //someText.AddText(title);
     212             :       //someText.Draw(); 
     213           0 :       fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
     214           0 :       fImage[esIndex]->Clear() ; 
     215             :       Int_t nx =2; //TMath::Nint(TMath::Sqrt(nImages));
     216             :       Int_t ny =2; // nx  ; 
     217             :         
     218           0 :       fImage[esIndex]->Divide(nx, ny) ; 
     219           0 :       TIter nexthist(list[esIndex]) ; 
     220             :       TH1* hist = NULL ;
     221             :       Int_t npad = 1 ; 
     222           0 :       fImage[esIndex]->cd(npad); 
     223           0 :       fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
     224           0 :       while ( (hist=static_cast<TH1*>(nexthist())) ) {
     225             :         //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
     226           0 :         TString cln(hist->ClassName()) ; 
     227           0 :         if ( ! cln.Contains("TH") ) continue ;
     228             :         
     229           0 :         if(hist->TestBit(AliQAv1::GetImageBit())) {
     230             :           //Printf("Histo name: %s - Class: %s",hist->GetName(),hist->ClassName());
     231           0 :           hist->GetXaxis()->SetTitleSize(0.02);
     232           0 :           hist->GetYaxis()->SetTitleSize(0.02);
     233           0 :           hist->GetXaxis()->SetLabelSize(0.02);
     234           0 :           hist->GetYaxis()->SetLabelSize(0.02);
     235           0 :           if(cln.Contains("TH2")) {
     236           0 :             gPad->SetRightMargin(0.15);
     237           0 :             gPad->SetLeftMargin(0.05);
     238           0 :             hist->SetStats(0);
     239           0 :             hist->SetOption("colz") ;
     240             :             //hist->GetListOfFunctions()->FindObject("palette")->SetLabelSize(0.025);
     241             :             //gPad->Update();
     242             :           }
     243           0 :           hist->DrawCopy() ; 
     244           0 :           fImage[esIndex]->cd(++npad) ; 
     245           0 :           fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
     246             :         }
     247           0 :       }
     248           0 :       fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
     249           0 :     }
     250           0 :   }
     251             :   
     252           0 :   return kTRUE;
     253           0 : }
     254             : 
     255             : //__________________________________________________________________
     256             : Double_t AliITSQASSDChecker::Check(AliQAv1::ALITASK_t /*index*/, const TObjArray * list, const AliDetectorRecoParam * /*recoParam*/) { 
     257             :   // main checker method 
     258           0 :   AliDebug(AliQAv1::GetQADebugLevel(),Form("AliITSQASSDChecker called with offset: %d\n", fSubDetOffset));
     259             : 
     260           0 :   AliInfo(Form("AliITSQASSDChecker called with offset: %d\n", fSubDetOffset) );
     261             :   //cout<<"(AliITSQASSDChecker::Check): List name "<<list->GetName()<<endl;
     262             :   Double_t test = 0.0  ;
     263             :   Int_t count = 0 ;
     264           0 :   TString listname = list->GetName();
     265             : 
     266           0 :   if (list->GetEntries() == 0){
     267             :     test = 1. ; // nothing to check
     268           0 :   }
     269             :   else {
     270             : 
     271           0 :     TIter next(list) ;
     272             :     TH1 * hdata ;
     273             :     count = 0 ;
     274           0 :     while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
     275           0 :       if (hdata) {
     276           0 :         TString histname = hdata->GetName();
     277           0 :         if(!histname.Contains("fHistSSD")) continue;
     278             :         Double_t rv = 0.;
     279           0 :         if(hdata->GetEntries()>0) {
     280             :            rv = 1;
     281             : 
     282             :            //if(histname.Contains("PerDDL")) cout << "(AliITSQASSDChecker::Check) " << histname << " has " << hdata->GetEntries() << " entries. Mean: " << hdata->GetMean() << endl;
     283             :        
     284             :        //    if(hdata->GetMean()>0&&!histname.Contains("_Ladder")) cout << "(AliITSQASSDChecker::Check) " << histname << " not empty! " << hdata->GetEntries() << " entries. Mean: " << hdata->GetMean() << endl;
     285           0 :         }
     286             : 
     287             :     //    if (listname.Contains("Raws")) CheckRaws(hdata);
     288             :    //     if (listname.Contains("RecPoints")) CheckRecPoints(hdata);
     289             : 
     290             :         //AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ;
     291             :         //cout<<hdata->GetName()<<" - "<<rv<<endl;
     292           0 :         count++ ;
     293           0 :         test += rv ;
     294           0 :       }
     295             :       else{
     296           0 :         AliError("Data type cannot be processed") ;
     297             :       }
     298             :     }
     299           0 :     if (count != 0) {
     300           0 :       if (AliITSQADataMakerRec::AreEqual(test,0.)) {
     301           0 :         AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
     302             :         test = 0.5;  //upper limit value to set kWARNING flag for a task
     303           0 :       }
     304             :       else {
     305           0 :         test /= count ;
     306             :       }
     307             :     }
     308           0 :   }
     309             :   
     310             :   //AliDebug(AliQAv1::GetQADebugLevel(), Form("Test Result = %f", test)) ;
     311             :   //cout<<"Test result: "<<test<<endl;
     312             : 
     313             :   return test ;
     314             : 
     315             :   //return 0.;
     316             : 
     317             : 
     318           0 : }
     319             : 
     320             : //__________________________________________________________________
     321             : void AliITSQASSDChecker::SetTaskOffset(Int_t TaskOffset){
     322             :   // defines offset for SSD
     323           0 :   fSubDetOffset = TaskOffset;
     324           0 : }
     325             : 
     326             : //__________________________________________________________________
     327             : void AliITSQASSDChecker::SetStepBit(const Double_t *steprange) {
     328             :   // defines step range
     329           0 :   fStepBitSSD = new Double_t[AliQAv1::kNBIT];
     330           0 :   for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
     331             :     {
     332           0 :       fStepBitSSD[bit]=steprange[bit];
     333             :     }
     334           0 : }
     335             : 
     336             : //__________________________________________________________________
     337             : void  AliITSQASSDChecker::SetSSDLimits(const Float_t *lowvalue, const Float_t * highvalue){
     338             :   // defines 
     339           6 :   fLowSSDValue = new Float_t[AliQAv1::kNBIT];
     340           3 :   fHighSSDValue= new Float_t[AliQAv1::kNBIT];
     341             : 
     342          30 :   for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
     343             :     {
     344          12 :       fLowSSDValue[bit]=lowvalue[bit];
     345          12 :       fHighSSDValue[bit]= highvalue[bit];
     346             :     }
     347             : 
     348           3 : }

Generated by: LCOV version 1.11