]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSQASSDChecker.cxx
Fix for coverity (Annalisa De Caro).
[u/mrichter/AliRoot.git] / ITS / AliITSQASSDChecker.cxx
index 8b25f8f9e0b5b370ebf62a82983c249cac3fa945..acb358c921f4168cd0424a046b2873491305187a 100644 (file)
 // --- ROOT system ---
 #include "TH1.h"
 #include "TString.h"
-#include "Riostream.h"
+#include "TCanvas.h"
+#include "TStyle.h"
+#include "TPad.h"
+//#include "Riostream.h"
 
 // --- AliRoot header files ---
 #include "AliITSQASSDChecker.h"
+#include "AliITSQADataMakerRec.h"
 #include "AliLog.h"
 
 ClassImp(AliITSQASSDChecker)
@@ -41,7 +45,7 @@ AliITSQASSDChecker& AliITSQASSDChecker::operator = (const AliITSQASSDChecker& qa
 }
 
 void AliITSQASSDChecker::CheckRaws(TH1* histo) {  
-
+  // checker for RAWS
   Double_t minSSDDataSize = 0;
   Double_t maxSSDDataSize = 200;
   Double_t minDDLDataSize = 0;
@@ -87,12 +91,12 @@ void AliITSQASSDChecker::CheckRaws(TH1* histo) {
       AliWarning("Data size per LDC histogram is empty");
     }    
     else {
-      AliInfo(Form("Data size per LDC histogram has %i entries",histo->GetEntries()));
+      AliInfo(Form("Data size per LDC histogram has %f entries",histo->GetEntries()));
       for(Int_t i = 170; i < 178; i++) {
         if(histo->GetBinContent(histo->FindBin(i))==0) {
           AliWarning(Form("Data size / LDC histogram: bin for LDC %i is empty",i));
         }
-        else if(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)));
+       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)));
       }
     }
   }
@@ -145,6 +149,7 @@ void AliITSQASSDChecker::CheckRaws(TH1* histo) {
     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()));
   }
 
+  /* Lines below commented out because nothing was checked with them since the AliWarning was commented (F. Prino, June 18 2014)
   if (histname.Contains("SSDAverageOccupancy")) {
  
     const char* side = "";
@@ -170,17 +175,89 @@ void AliITSQASSDChecker::CheckRaws(TH1* histo) {
       }//module loop
     }//ladder loop
   }
-
+  */
 }
 
-void AliITSQASSDChecker::CheckRecPoints(TH1* /*histo*/) {  
 
+//__________________________________________________________________
+Bool_t  AliITSQASSDChecker::MakeSSDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode) {
+  //create the image for raws and recpoints. In the other case, the default methodof CheckerBase class will be used  //
+  gStyle->SetPalette(1,0);
+  Bool_t rval=kFALSE;
+  fImage=(TCanvas**)AliQAChecker::Instance()->GetDetQAChecker(0)->GetImage();
+
+  if(task == AliQAv1::kRAWS) 
+    rval = MakeSSDRawsImage(list, task,mode);
+  else rval=kFALSE;
+  
+  return rval;
+}
 
+//_______________________________________________________________________
+Bool_t AliITSQASSDChecker::MakeSSDRawsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode ) {
+  // MakeSSDRawsImage: raw data QA plots
+  for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
+    //printf("-------------------------> %i \n", esIndex);
+    if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) continue;
+    else {
+      const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ; 
+      if ( !fImage[esIndex] ) fImage[esIndex] = new TCanvas(title, title,1280,980) ;
+       
+      fImage[esIndex]->Clear() ; 
+      fImage[esIndex]->SetTitle(title) ; 
+      fImage[esIndex]->cd();
+      //TPaveText someText(0.015, 0.015, 0.98, 0.98);
+      //someText.AddText(title);
+      //someText.Draw(); 
+      fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
+      fImage[esIndex]->Clear() ; 
+      Int_t nx =2; //TMath::Nint(TMath::Sqrt(nImages));
+      Int_t ny =2; // nx  ; 
+       
+      fImage[esIndex]->Divide(nx, ny) ; 
+      TIter nexthist(list[esIndex]) ; 
+      TH1* hist = NULL ;
+      Int_t npad = 1 ; 
+      fImage[esIndex]->cd(npad); 
+      fImage[esIndex]->cd(npad)->SetBorderMode(0) ;
+      while ( (hist=static_cast<TH1*>(nexthist())) ) {
+       //gPad=fImage[esIndex]->cd(npad)->GetPad(npad);
+       TString cln(hist->ClassName()) ; 
+       if ( ! cln.Contains("TH") ) continue ;
+       
+       if(hist->TestBit(AliQAv1::GetImageBit())) {
+         //Printf("Histo name: %s - Class: %s",hist->GetName(),hist->ClassName());
+         hist->GetXaxis()->SetTitleSize(0.02);
+         hist->GetYaxis()->SetTitleSize(0.02);
+         hist->GetXaxis()->SetLabelSize(0.02);
+         hist->GetYaxis()->SetLabelSize(0.02);
+         if(cln.Contains("TH2")) {
+           gPad->SetRightMargin(0.15);
+           gPad->SetLeftMargin(0.05);
+           hist->SetStats(0);
+           hist->SetOption("colz") ;
+           //hist->GetListOfFunctions()->FindObject("palette")->SetLabelSize(0.025);
+           //gPad->Update();
+         }
+         hist->DrawCopy() ; 
+         fImage[esIndex]->cd(++npad) ; 
+         fImage[esIndex]->cd(npad)->SetBorderMode(0) ; 
+       }
+      }
+      fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; 
+    }
+  }
+  
+  return kTRUE;
 }
 
 //__________________________________________________________________
-Double_t AliITSQASSDChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray * list) {  
+Double_t AliITSQASSDChecker::Check(AliQAv1::ALITASK_t /*index*/, const TObjArray * list, const AliDetectorRecoParam * /*recoParam*/) { 
+  // main checker method 
   AliDebug(AliQAv1::GetQADebugLevel(),Form("AliITSQASSDChecker called with offset: %d\n", fSubDetOffset));
+
+  AliInfo(Form("AliITSQASSDChecker called with offset: %d\n", fSubDetOffset) );
   //cout<<"(AliITSQASSDChecker::Check): List name "<<list->GetName()<<endl;
   Double_t test = 0.0  ;
   Int_t count = 0 ;
@@ -220,7 +297,7 @@ Double_t AliITSQASSDChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray * lis
       }
     }
     if (count != 0) {
-      if (test==0) {
+      if (AliITSQADataMakerRec::AreEqual(test,0.)) {
         AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
         test = 0.5;  //upper limit value to set kWARNING flag for a task
       }
@@ -241,7 +318,31 @@ Double_t AliITSQASSDChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray * lis
 }
 
 //__________________________________________________________________
-void AliITSQASSDChecker::SetTaskOffset(Int_t TaskOffset)
-{
+void AliITSQASSDChecker::SetTaskOffset(Int_t TaskOffset){
+  // defines offset for SSD
   fSubDetOffset = TaskOffset;
 }
+
+//__________________________________________________________________
+void AliITSQASSDChecker::SetStepBit(const Double_t *steprange) {
+  // defines step range
+  fStepBitSSD = new Double_t[AliQAv1::kNBIT];
+  for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
+    {
+      fStepBitSSD[bit]=steprange[bit];
+    }
+}
+
+//__________________________________________________________________
+void  AliITSQASSDChecker::SetSSDLimits(const Float_t *lowvalue, const Float_t * highvalue){
+  // defines 
+  fLowSSDValue = new Float_t[AliQAv1::kNBIT];
+  fHighSSDValue= new Float_t[AliQAv1::kNBIT];
+
+  for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
+    {
+      fLowSSDValue[bit]=lowvalue[bit];
+      fHighSSDValue[bit]= highvalue[bit];
+    }
+
+}