]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSQAChecker.cxx
technial fix to suppress the warning
[u/mrichter/AliRoot.git] / ITS / AliITSQAChecker.cxx
index f8cfad6d3894164e6d18e0ca206edb6c7a55d894..457659953b9abaf1aec8f04f00712f260a90365f 100644 (file)
@@ -1,4 +1,4 @@
-/**************************************************************************
+ /**************************************************************************
  * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
  * Author: The ALICE Off-line Project.                                    *
 // --- ROOT system ---
 #include "TH1.h"
 #include <Riostream.h>
+#include "TStyle.h"
 
 // --- AliRoot header files ---
 #include "AliITSQAChecker.h"
 #include "AliITSQASPDChecker.h"
 #include "AliITSQASDDChecker.h"
 #include "AliITSQASSDChecker.h"
+#include "AliITSQADataMakerRec.h"
 
 ClassImp(AliITSQAChecker)
 
@@ -68,43 +70,22 @@ fSSDChecker(0)  // SSD Checker
 }
 
 //____________________________________________________________________________
-AliITSQAChecker::AliITSQAChecker(const AliITSQAChecker& qac):
-AliQACheckerBase(qac.GetName(), qac.GetTitle()), 
-fkOnline(qac.fkOnline), 
-fDet(qac.fDet), 
-fLDC(qac.fLDC), 
-fSPDOffset(qac.fSPDOffset), 
-fSDDOffset(qac.fSDDOffset), 
-fSSDOffset(qac.fSSDOffset), 
-fSPDHisto(qac.fSPDHisto),
-fSDDHisto(qac.fSDDHisto),
-fSSDHisto(qac.fSSDHisto),
-fSPDChecker(qac.fSPDChecker), 
-fSDDChecker(qac.fSDDChecker), 
-fSSDChecker(qac.fSSDChecker)
-{
-  // copy constructor
-  AliError("Copy should not be used with this class\n");
-}
-//____________________________________________________________________________
-AliITSQAChecker& AliITSQAChecker::operator=(const AliITSQAChecker& qac){
-  // assignment operator
-  this->~AliITSQAChecker();
-  new(this)AliITSQAChecker(qac);
-  return *this;
-}
+AliITSQAChecker::~AliITSQAChecker(){
+  // destructor
+  if(fSPDChecker)delete fSPDChecker;
+  if(fSDDChecker)delete fSDDChecker;
+  if(fSSDChecker)delete fSSDChecker;
 
+}
 //____________________________________________________________________________
-Double_t * AliITSQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, AliDetectorRecoParam * /*recoParam*/)
+void AliITSQAChecker::Check(Double_t * rv, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * recoParam)
 {
 
 
-  // Super-basic check on the QA histograms on the input list:
-  // look whether they are empty!
-  //for the ITS subdetectorQA (Raws Digits Hits RecPoints SDigits) return the worst (= lowest) value of the three result
+  // basic checks on the QA histograms on the input list
+  //for the ITS subdetectorQA (Raws Digits Hits RecPoints SDigits) return the worst value of the three result
   if(index == AliQAv1::kESD){
-
-    Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ; 
+    
     for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
       rv[specie] = 0.0 ; 
       if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) 
@@ -123,7 +104,7 @@ Double_t * AliITSQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, A
         rv[specie] = 0.; // nothing to check
       }
       else {
-       Double_t *stepbit=new Double_t[AliQAv1::kNBIT];
+       Double_t stepbit[AliQAv1::kNBIT];
        Double_t histonumb= list[specie]->GetEntries();
        CreateStepForBit(histonumb,stepbit); 
         TIter next1(list[specie]);
@@ -132,16 +113,17 @@ Double_t * AliITSQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, A
         Bool_t skipped[6]={kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE};
         // look for layers that we wanted to skip
         while ( (hdata = dynamic_cast<TH1 *>(next1())) ) {
-          if(!hdata) continue;
-          TString hname = hdata->GetName();
-          if(!hname.Contains("hESDSkippedLayers")) continue;
-          for(Int_t k=1; k<7; k++) {
-            if(hdata->GetBinContent(k)>0) { 
-              nskipped++; 
-              skipped[k-1]=kTRUE; 
-            } 
-          } 
-        }
+          if(hdata){
+           TString hname = hdata->GetName();
+           if(!hname.Contains("hESDSkippedLayers")) continue;
+           for(Int_t k=1; k<7; k++) {
+             if(hdata->GetBinContent(k)>0) { 
+               nskipped++; 
+               skipped[k-1]=kTRUE; 
+             } 
+           } 
+         }
+       }
         TIter next(list[specie]);
         while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
           if(hdata){
@@ -160,11 +142,11 @@ Double_t * AliITSQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, A
                 if(skipped[k-1]) continue;
                 if(hdata->GetBinContent(k)<0.5*(entries/6.)){
                   cluMapSA = kFALSE;
-                  AliDebug(AliQAv1::GetQADebugLevel(), Form("SA tracks have few points on layer %d - look at histogram hESDClustersSA",k));
+                  AliDebug(AliQAv1::GetQADebugLevel(),Form("SA tracks have few points on layer %d - look at histogram hESDClustersSA",k));
                 }
               }  
-            }
-
+            }//end clustermapsa 
+           
             else if(hname.Contains("hESDClusterMapMI") && entries>0.){
               // Check if there are layers with anomalously low 
               // contributing points to MI reconstructed tracks
@@ -175,11 +157,11 @@ Double_t * AliITSQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, A
                 if(skipped[k-1]) continue;
                 if(hdata->GetBinContent(k)<0.5*(entries/6.)){
                   cluMapMI = kFALSE;
-                  AliDebug(AliQAv1::GetQADebugLevel(), Form("MI tracks have few points on layer %d - look at histogram hESDClustersMI",k));
+                  AliDebug(AliQAv1::GetQADebugLevel(),Form("MI tracks have few points on layer %d - look at histogram hESDClustersMI",k));
                 }
               }  
-            }
-
+            }//end clustermapmi
+           
             else if(hname.Contains("hESDClustersMI") && entries>0.){
               // Check if 6 clusters MI tracks are the majority
               AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
@@ -188,11 +170,11 @@ Double_t * AliITSQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, A
               for(Int_t k=2; k<7-nskipped; k++){
                 if(hdata->GetBinContent(k)>maxlaytracks){
                   cluMI = kFALSE;
-                  AliDebug(AliQAv1::GetQADebugLevel(), Form("MI Tracks with %d clusters are more than tracks with %d clusters. Look at histogram hESDClustersMI",k-1,6-nskipped));
+                  AliDebug(AliQAv1::GetQADebugLevel(),Form("MI Tracks with %d clusters are more than tracks with %d clusters. Look at histogram hESDClustersMI",k-1,6-nskipped));
                 }
               }
-            }
-
+            }//end clustersmi
+           
             else if(hname.Contains("hESDClustersSA") && entries>0.){
               // Check if 6 clusters SA tracks are the majority
               AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
@@ -204,55 +186,54 @@ Double_t * AliITSQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, A
                   AliDebug(AliQAv1::GetQADebugLevel(), Form("SA Tracks with %d clusters are more than tracks with %d clusters. Look at histogram hESDClustersSA",k-1,6-nskipped));
                 }
               }
-            }
-
+            }//end clusterssa
+           
             else if(hname.Contains("hSPDVertexZ") && entries>0.){
               // Check if average Z vertex coordinate is -5 < z < 5 cm
               AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
               verSPDZ = kTRUE;
               if(hdata->GetMean()<-5. && hdata->GetMean()>5.){
                 verSPDZ = kFALSE;
-                AliDebug(AliQAv1::GetQADebugLevel(), Form("Average z vertex coordinate is at z= %10.4g cm",hdata->GetMean()));
+                AliDebug(AliQAv1::GetQADebugLevel(),Form("Average z vertex coordinate is at z= %10.4g cm",hdata->GetMean()));
               }
-            }
-          }
-
-          else{
-            AliError("ESD Checker - invalid data type");
-          }
-         
-          rv[specie] = 0.;
-          if(tested>0){
-            if(tested == empty){
-              rv[specie] = 0.1;
-              AliWarning("All ESD histograms are empty");
-            }
-            else {
-              rv[specie] = 0.1+0.4*(static_cast<Double_t>(tested-empty)/static_cast<Double_t>(tested));
-              if(cluMapSA)rv[specie]+=0.1;
-              if(cluMapMI)rv[specie]+=0.1;
-              if(cluMI)rv[specie]+=0.1;
-              if(cluSA)rv[specie]+=0.1;
-              if(verSPDZ)rv[specie]+=0.1;
-            }
-          }
-        }
-      }  
-      AliDebug(AliQAv1::GetQADebugLevel(), Form("ESD - Tested %d histograms, Return value %f \n",tested,rv[specie]));
+            }//end spdvertexz
+           
+           else{ AliError("ESD Checker - invalid data type");}//end else
+           
+           rv[specie] = 0.;
+           if(tested>0){
+             if(tested == empty){
+               rv[specie] = 2500.; // set to error
+               AliWarning(Form("All ESD histograms are empty - specie=%d",specie));
+             }
+             else {
+               rv[specie] = 2500.-1500.*(static_cast<Double_t>(tested-empty)/static_cast<Double_t>(tested)); // INFO if all histos are filled
+               if(cluMapSA)rv[specie]-=200.;
+               if(cluMapMI)rv[specie]-=200.;
+               if(cluMI)rv[specie]-=200.;
+               if(cluSA)rv[specie]-=200.;
+               if(verSPDZ)rv[specie]-=199.;  // down to 1 if everything is OK
+             }
+           }//end tested
+         }//end hdata
+       }//end while
+       //     AliDebug(AliQAv1::GetQADebugLevel(), Form("ESD - Tested %d histograms, Return value %f \n",tested,rv[specie]));
+       AliInfo(Form("ESD - Tested %d histograms, Return value %f \n",tested,rv[specie]));
+      }
     }
-    return rv ; 
-  }  // end of ESD QA
-  
-  Double_t * retval = new Double_t[AliRecoParam::kNSpecies] ; 
-  //____________________________________________________________________________
+  } // end of ESD QA
+  else{
+    
+    //____________________________________________________________________________
 
-  Double_t spdCheck[AliRecoParam::kNSpecies] ;
-  Double_t sddCheck[AliRecoParam::kNSpecies] ;
-  Double_t ssdCheck[AliRecoParam::kNSpecies] ;
+    Double_t spdCheck[AliRecoParam::kNSpecies] ;
+    Double_t sddCheck[AliRecoParam::kNSpecies] ;
+    Double_t ssdCheck[AliRecoParam::kNSpecies] ;
 
 
 
     for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+      if ( !AliQAv1::Instance()->IsEventSpecieSet(specie)) continue; 
       if ( AliQAv1::Instance()->IsEventSpecieSet(specie) ) {
        Double_t histotot=list[specie]->GetEntries();
        if(histotot!=0)
@@ -260,71 +241,76 @@ Double_t * AliITSQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, A
            spdCheck[specie]=0.;
            sddCheck[specie]=0.;
            ssdCheck[specie]=0.;
-           retval[specie] = 0.0 ;// 
+           rv[specie] = 0.0 ;// 
            //pixel
            if(fDet == 0 || fDet == 1) {
              fSPDChecker->SetTaskOffset(fSPDOffset);
              //printf("spdoffset = %i \n",fSPDOffset );
              Double_t histoSPD=double(GetSPDHisto());
-
-             Double_t *stepSPD=new Double_t[AliQAv1::kNBIT];
-             CreateStepForBit(histoSPD,stepSPD);
-             fSPDChecker->SetStepBit(stepSPD);
-             spdCheck[specie] = fSPDChecker->Check(index, list[specie]);
-             if(spdCheck[specie]>fUpTestValue[AliQAv1::kFATAL]||spdCheck[specie]<0.)
-               {
-                 AliInfo(Form("SPD check result for %s  is out of range (%f)!!! Retval of specie %s is sit to -1\n ",AliQAv1::GetAliTaskName(index),spdCheck[specie],AliRecoParam::GetEventSpecieName(specie)));
-                 spdCheck[specie]=fUpTestValue[AliQAv1::kFATAL];
-               }
-             //if(spdCheck[specie]<0.5)AliInfo(Form("SPD check result  for %s (%s) is < 0.5 .The result is %f ",AliQAv1::GetAliTaskName(index),AliRecoParam::GetEventSpecieName(specie),spdCheck[specie]) );
-             delete []stepSPD;
-             retval[specie]=spdCheck[specie];
-           }
+             if(AliITSQADataMakerRec::AreEqual(histoSPD,0)==kFALSE){
+               Double_t *stepSPD=new Double_t[AliQAv1::kNBIT];
+               CreateStepForBit(histoSPD,stepSPD);
+               fSPDChecker->SetStepBit(stepSPD);
+               spdCheck[specie] = fSPDChecker->Check(index, list[specie], recoParam);
+               if(spdCheck[specie]>fUpTestValue[AliQAv1::kFATAL]||spdCheck[specie]<0.)
+                 {
+                   AliInfo(Form("SPD check result for %s  is out of range (%f)!!! Retval of specie %s is sit to -1\n ",AliQAv1::GetAliTaskName(index),spdCheck[specie],AliRecoParam::GetEventSpecieName(specie)));
+                   spdCheck[specie]=fUpTestValue[AliQAv1::kFATAL];
+                 }
+               delete []stepSPD;
+             }//end check SPD entries
+             else{spdCheck[specie]=fUpTestValue[AliQAv1::kFATAL];}
+             rv[specie]=spdCheck[specie];
+           }//end SPD check
            //drift
            if(fDet == 0 || fDet == 2) {
              fSDDChecker->SetTaskOffset(fSDDOffset);
+             fSDDChecker->SetEventSpecieForCheck(specie);
              Double_t histoSDD=double(GetSDDHisto());
-             Double_t *stepSDD=new Double_t[AliQAv1::kNBIT];
-             CreateStepForBit(histoSDD,stepSDD);
-             fSDDChecker->SetStepBit(stepSDD);
-             sddCheck[specie] = fSDDChecker->Check(index, list[specie]);
-             if(sddCheck[specie]>fUpTestValue[AliQAv1::kFATAL]||sddCheck[specie]<0.)
-               {
-                 AliInfo(Form("SDD check result for %s  is out of range (%f)!!! Retval of specie %s is sit to -1\n ",AliQAv1::GetAliTaskName(index),sddCheck[specie],AliRecoParam::GetEventSpecieName(specie)));
-                 sddCheck[specie]=fUpTestValue[AliQAv1::kFATAL];
-               }
-             //if(sddCheck[specie]<0.5)AliInfo(Form("SDD check result  for %s (%s) is < 0.5 .The result is %f\f ",AliQAv1::GetAliTaskName(index),AliRecoParam::GetEventSpecieName(specie),sddCheck[specie]) );
-             delete []stepSDD;
-             if(sddCheck[specie]>retval[specie])retval[specie]=sddCheck[specie];  
-           }
+             if(AliITSQADataMakerRec::AreEqual(histoSDD,0)==kFALSE){
+               Double_t *stepSDD=new Double_t[AliQAv1::kNBIT];
+               CreateStepForBit(histoSDD,stepSDD);
+               fSDDChecker->SetStepBit(stepSDD);
+               sddCheck[specie] = fSDDChecker->Check(index, list[specie], recoParam);  
+               if(sddCheck[specie]>fUpTestValue[AliQAv1::kFATAL]||sddCheck[specie]<0.)
+                 {
+                   AliInfo(Form("SDD check result for %s  is out of range (%f)!!! Retval of specie %s is sit to -1\n ",AliQAv1::GetAliTaskName(index),sddCheck[specie],AliRecoParam::GetEventSpecieName(specie)));
+                   sddCheck[specie]=fUpTestValue[AliQAv1::kFATAL];
+                 }
+               delete []stepSDD;
+             }//end check SDD entries
+             else{ssdCheck[specie]=fUpTestValue[AliQAv1::kFATAL];}
+             if(sddCheck[specie]>rv[specie])rv[specie]=sddCheck[specie];  
+           }//end SDD
            //strip
            if(fDet == 0 || fDet == 3) {
              fSSDChecker->SetTaskOffset(fSSDOffset);
              Double_t histoSSD=double(GetSSDHisto());
+             if(AliITSQADataMakerRec::AreEqual(histoSSD,0)==kFALSE){
              Double_t *stepSSD=new Double_t[AliQAv1::kNBIT];
              CreateStepForBit(histoSSD,stepSSD);
              fSSDChecker->SetStepBit(stepSSD);
-             ssdCheck[specie] = fSSDChecker->Check(index, list[specie]);
+             ssdCheck[specie] = fSSDChecker->Check(index, list[specie], recoParam);
              if(ssdCheck[specie]>fUpTestValue[AliQAv1::kFATAL]||ssdCheck[specie]<0.)
                {
                  AliInfo(Form("SSD check result for %s is out of range (%f)!!! Retval of specie %s is sit to -1\n ",AliQAv1::GetAliTaskName(index),ssdCheck[specie],AliRecoParam::GetEventSpecieName(specie)));
                  ssdCheck[specie]=fUpTestValue[AliQAv1::kFATAL];
                }
-             //if(ssdCheck[specie]<0.5)AliInfo(Form("SSD check result  for %s (%s) is < 0.5 . The result is %f ",AliQAv1::GetAliTaskName(index),AliRecoParam::GetEventSpecieName(specie),ssdCheck[specie]) );
              delete [] stepSSD;
-             if(ssdCheck[specie]>retval[specie])retval[specie]=ssdCheck[specie];
-           }
+             }//end check SSD entries
+             else{ssdCheck[specie]=fUpTestValue[AliQAv1::kFATAL];}
+             if(ssdCheck[specie]>rv[specie])rv[specie]=ssdCheck[specie];
+           }//end SSD
            
-           AliInfo(Form("Check result for %s: \n\t  SPD %f \n\t  SDD %f \n\t  SSD %f \n Check result %f \n ",AliQAv1::GetAliTaskName(index),spdCheck[specie],sddCheck[specie],ssdCheck[specie],retval[specie]));
+           AliInfo(Form("Check result for %s: \n\t  SPD %f \n\t  SDD %f \n\t  SSD %f \n Check result %f \n ",AliQAv1::GetAliTaskName(index),spdCheck[specie],sddCheck[specie],ssdCheck[specie],rv[specie]));
            // here merging part for common ITS QA result
            // 
          }//end entries
       }//end if event specie
     }//end for
-    return retval;  
+  }
 }
 
-
 //____________________________________________________________________________
 void AliITSQAChecker::SetTaskOffset(Int_t SPDOffset, Int_t SDDOffset, Int_t SSDOffset)
 {
@@ -346,6 +332,7 @@ void AliITSQAChecker::SetHisto(Int_t SPDhisto, Int_t SDDhisto, Int_t SSDhisto)
  //____________________________________________________________________________
  void AliITSQAChecker::SetDetTaskOffset(Int_t subdet,Int_t offset)
  {
+   //returns the offset for each task and for each subdetector
    switch(subdet){
    case 1:
      SetSPDTaskOffset(offset);
@@ -366,6 +353,7 @@ void AliITSQAChecker::SetHisto(Int_t SPDhisto, Int_t SDDhisto, Int_t SSDhisto)
  //____________________________________________________________________________
  void AliITSQAChecker::SetDetHisto(Int_t subdet,Int_t histo)
  {
+   //set the number od histograms for the subdetector
    switch(subdet){
    case 1:
      SetSPDHisto(histo);
@@ -387,7 +375,7 @@ void AliITSQAChecker::SetHisto(Int_t SPDhisto, Int_t SDDhisto, Int_t SSDhisto)
 
 void AliITSQAChecker::InitQACheckerLimits()
 {
-  
+  //init the tolerance range for each QA bit 
   AliInfo("Setting of tolerance values\n");
 
   Float_t lowtolerancevalue[AliQAv1::kNBIT];
@@ -420,6 +408,7 @@ void AliITSQAChecker::InitQACheckerLimits()
 
 void AliITSQAChecker::CreateStepForBit(Double_t histonumb,Double_t *steprange)
 {
+  //creation of the step bit for each QA bit 
   for(Int_t bit=0;bit < AliQAv1::kNBIT; bit++)
     {       
       //printf("%i\t %f \t %f \t %f \n",bit, fUpTestValue[bit],fLowTestValue[AliQAv1::kINFO],histonumb);
@@ -433,7 +422,7 @@ void AliITSQAChecker::CreateStepForBit(Double_t histonumb,Double_t *steprange)
 //_____________________________________________________________________________
 void AliITSQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
 {
-
+  //Setting of the QA tolerance values
   AliQAv1 * qa = AliQAv1::Instance(index) ;
 
 
@@ -460,3 +449,49 @@ void AliITSQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
 }
 
 
+//__________________________________________________________________
+void  AliITSQAChecker::MakeImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode)
+{
+  //make a summary image
+  //gStyle->SetPalette(1);
+
+  //Int_t nImages = 0 ;
+  //Int_t imageindex=0;
+  for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
+    if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) ) 
+      continue ;
+    //else imageindex=esIndex;
+
+    TIter next(list[esIndex]) ;  
+    TH1 * hdata = NULL ; 
+    while ( (hdata=static_cast<TH1 *>(next())) ) {
+      TString cln(hdata->ClassName()) ; 
+      if ( ! cln.Contains("TH") )
+        continue ; 
+      if(cln.Contains("TH2")) 
+       {
+         Float_t min=hdata->GetMinimum();
+         Float_t max=hdata->GetMaximum();
+         if(max>min) hdata->SetOption("colz");
+       }
+    }
+    break ; 
+  }
+
+  Bool_t retvalue=kFALSE;
+
+  if(GetSubDet()==0) MakeITSImage(list,task, mode);
+  else if(GetSubDet()==1) 
+    {
+      retvalue=fSPDChecker->MakeSPDImage(list,task, mode) ; 
+      if(retvalue==kFALSE)AliQACheckerBase::MakeImage(list,task, mode);
+    }
+  else if(GetSubDet()==2){ retvalue=fSDDChecker->MakeSDDImage(list,task, mode) ;if(retvalue==kFALSE)AliQACheckerBase::MakeImage(list,task,mode); }
+  else if(GetSubDet()==3) 
+    {
+      retvalue=fSSDChecker->MakeSSDImage(list,task, mode) ;
+      if(retvalue==kFALSE)AliQACheckerBase::MakeImage(list,task, mode); 
+    }
+
+}
+