]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Correction suggested by Valgrind (Yves)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 30 Apr 2010 15:42:52 +0000 (15:42 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 30 Apr 2010 15:42:52 +0000 (15:42 +0000)
ACORDE/AliACORDEQAChecker.cxx
ACORDE/AliACORDEQAChecker.h
HMPID/AliHMPIDQAChecker.cxx
HMPID/AliHMPIDQAChecker.h
STEER/AliQACheckerBase.cxx
STEER/AliQACheckerBase.h
STEER/AliQAv1.cxx

index e59093618ac475093a906443e0c3d8e38e058dd2..01e2bf268f9d2f8e244042c2145fd42f88321891 100755 (executable)
 ClassImp(AliACORDEQAChecker)
 
 //____________________________________________________________________________
-Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/)
+void AliACORDEQAChecker::Check(Double_t * test, AliQAv1::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 ;  
+    test[specie] = 0.0 ; 
 }
 //____________________________________________________________________________
-Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/)
+void AliACORDEQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t /*index*/, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/)
 {
-
 // Close version to the final one for the ACORDE QA Checker
-
-  Double_t * test = new Double_t[AliRecoParam::kNSpecies]  ; 
-  Double_t * acoTest = new Double_t[AliRecoParam::kNSpecies] ;
   
 // Loop over the run species (for specie!= cosmic by now we set QA to INFO) 
   
   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
   {
        if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ; 
-       if (list[specie]->GetEntries() == 0) acoTest[specie] = 1.; // Nothing to check
+       if (list[specie]->GetEntries() == 0) test[specie] = 1.; // Nothing to check
        else 
        {
                TIter next(list[specie]) ; 
@@ -85,7 +79,7 @@ Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray **
                                        TH1 * href = NULL;
                                        if (fRefSubDir) href = static_cast<TH1*>(fRefSubDir->Get(hdata->GetName()));
                                        else if (fRefOCDBSubDir[specie]) href = static_cast<TH1*>(fRefOCDBSubDir[specie]->FindObject(hdata->GetName()));
-                                       acoTest[specie] = CheckAcordeRefHits(href,hdata);
+                                       test[specie] = CheckAcordeRefHits(href,hdata);
                                }else if (hdataName.Contains("ACORDEBitPattern"))
                                // Here we use an inner QA Checher without the QAref data
                                {
@@ -99,10 +93,10 @@ Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray **
                                                }
                                        }
                                        Double_t simpleFlag = 1.-flagAcoQA/60.;
-                                       if ( (simpleFlag >= 0.90) && (simpleFlag <= 1.0) ) acoTest[specie] = 0.75; // INFO
-                                       if ( (simpleFlag >= 0.70) && (simpleFlag < 0.90) ) acoTest[specie] = 0.50; // WARNING
-                                       if ( (simpleFlag >= 0.25) && (simpleFlag < 0.70) ) acoTest[specie] = 0.25; // ERROR
-                                       if ( (simpleFlag >= 0.0) && (simpleFlag < 0.25) )  acoTest[specie] = -1.0; // FATAL
+                                       if ( (simpleFlag >= 0.90) && (simpleFlag <= 1.0) ) test[specie] = 0.75; // INFO
+                                       if ( (simpleFlag >= 0.70) && (simpleFlag < 0.90) ) test[specie] = 0.50; // WARNING
+                                       if ( (simpleFlag >= 0.25) && (simpleFlag < 0.70) ) test[specie] = 0.25; // ERROR
+                                       if ( (simpleFlag >= 0.0) && (simpleFlag < 0.25) )  test[specie] = -1.0; // FATAL
                                }       
                                // Setting Warning message for possible Empty Events with the ACORDE-Trigger
                                        
@@ -113,23 +107,21 @@ Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray **
                                
                }
        }
-       if ( (specie == AliRecoParam::kHighMult) || (specie == AliRecoParam::kLowMult) || (specie == AliRecoParam::kCalib) ) acoTest[specie] = 0.75;
-       test[specie] = acoTest[specie]; // Assign of the acoTest to the test for final QAChecker value  
+    if ( (specie == AliRecoParam::kHighMult) || (specie == AliRecoParam::kLowMult) || (specie == AliRecoParam::kCalib) ) test[specie] = 0.75;
   }
-       return test ; 
 }
 //____________________________________________________________________________
 Double_t AliACORDEQAChecker::CheckAcordeRefHits(const TH1 * href, const TH1 * hdata) const
 {
-       Double_t acoTest = 0.;
+       Double_t test = 0.;
        Int_t flag=0;
        for (Int_t i=0;i<60;i++)
        {
                if (TMath::Abs(href->GetBinContent(i)-hdata->GetBinContent(i))>10) flag++;
        }
-       if ((flag>50)&&(flag<=60)) acoTest = -1.;
-       if ((flag>30)&&(flag<=50)) acoTest = 0.25;
-       if ((flag>10)&&(flag<=30)) acoTest = 0.5;
-       if ((flag>0)&&(flag<=10)) acoTest = 0.75;
-       return acoTest;
+       if ((flag>50)&&(flag<=60)) test = -1.;
+       if ((flag>30)&&(flag<=50)) test = 0.25;
+       if ((flag>10)&&(flag<=30)) test = 0.5;
+       if ((flag>0)&&(flag<=10)) test = 0.75;
+       return test;
 }
index 55fadb7dfeec3d016d7b5b6abb38500dbf789aa8..5e3351dd27caaca93bc11ccda5268b558f177b91 100755 (executable)
@@ -30,8 +30,8 @@ class AliACORDEQAChecker: public AliQACheckerBase {
 public:
   AliACORDEQAChecker() : AliQACheckerBase("ACORDE","ACORDE Quality Assurance Data Checker") {;}          // constructor
   virtual ~AliACORDEQAChecker() {;} // destructor
-  virtual Double_t * Check(AliQAv1::ALITASK_t /*index*/) ;
-  virtual Double_t * Check(AliQAv1::ALITASK_t /*index*/, TObjArray ** list, const AliDetectorRecoParam * /* recoParam*/) ;
+  virtual void Check(Double_t *, AliQAv1::ALITASK_t /*index*/) ;
+  virtual void Check(Double_t *, AliQAv1::ALITASK_t /*index*/, TObjArray ** list, const AliDetectorRecoParam * /* recoParam*/) ;
 
   Double_t CheckAcordeRefHits(const TH1 * href, const TH1 * hdata) const;
 
index 2486562946df0d4606c58d89a452535a4dd0c4ae..e8691088c7d86e6460d5b097d2bc03884254f5ef 100644 (file)
@@ -76,34 +76,19 @@ fQARefRec(NULL)
 }
 
 //_________________________________________________________________
-AliHMPIDQAChecker& AliHMPIDQAChecker::operator=(const AliHMPIDQAChecker& qac) 
-{
-  //
-  // Assignment operator
-  //
-  if (this!=&qac) {
-    AliQACheckerBase::operator=(qac) ;
-    fNoReference = qac.fNoReference  ;
-    fQARefRec    = qac.fQARefRec     ;    
-  }
-  return *this;
-}   
-//_______________________________________________________________________________________________
 AliHMPIDQAChecker::~AliHMPIDQAChecker() 
 {
   fQARefRec->Delete() ; 
   delete fQARefRec ; 
 }
 //_________________________________________________________________
-Double_t * AliHMPIDQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) 
+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] ; 
   if(fNoReference)  
-  return check;
 
   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
     check[specie] = 1.0;
@@ -124,8 +109,6 @@ Double_t * AliHMPIDQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list,
     //default check response. It will be changed when reasonable checks will be considered
     else check[specie] = 0.7 ; // /-> Corresponds to kINFO see AliQACheckerBase::Run 
   } // species loop
-
-  return check;
 }
 //_________________________________________________________________
 Double_t AliHMPIDQAChecker::CheckEntries(TObjArray * list) const
index 9b1fb36a83f7dafcf29646b663e0abea6ede30bc..4bad211ba4b317a5df44f5c50b8ded40004c10aa 100644 (file)
@@ -26,12 +26,11 @@ class TObjArray ;
 class AliHMPIDQAChecker: public AliQACheckerBase {
 
 public:
-  AliHMPIDQAChecker() ;           // ctor
-  AliHMPIDQAChecker(const AliHMPIDQAChecker& qac) ; // cpy ctor 
-  AliHMPIDQAChecker &operator=(const AliHMPIDQAChecker& qac);   //assignment operator
+  AliHMPIDQAChecker() ;          // ctor
+  AliHMPIDQAChecker(const AliHMPIDQAChecker& qac) ; // cpy ctor   
   virtual ~AliHMPIDQAChecker() ; // dtor
   
-  virtual Double_t * Check(AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * recoParam) ;
+  virtual void Check(Double_t * test, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * recoParam) ;
   
   Double_t CheckEntries(TObjArray * list) const ;
   Double_t CheckRec(TObjArray *listrec, TObjArray *listref) const ;
index 01de1150a90bc92bd40eeff8b472d9ecfbdd8419..910932fc754cdf17c9d4f09981163c7373f07a4e 100644 (file)
@@ -149,7 +149,7 @@ AliQACheckerBase::~AliQACheckerBase()
 }
 
 //____________________________________________________________________________
-Double_t * AliQACheckerBase::Check(AliQAv1::ALITASK_t index, const AliDetectorRecoParam * recoParam) 
+void AliQACheckerBase::Check(Double_t * test, AliQAv1::ALITASK_t index, const AliDetectorRecoParam * recoParam) 
 {
   // Performs a basic checking
   // Compares all the histograms stored in the directory
@@ -182,20 +182,18 @@ Double_t * AliQACheckerBase::Check(AliQAv1::ALITASK_t index, const AliDetectorRe
     }
   }
  
-  Double_t * test = Check(index, list, recoParam) ;
+  Check(test, index, list, recoParam) ;
   
   delete[] list ; 
     
-  return test ;
 }  
 
 //____________________________________________________________________________
-Double_t * AliQACheckerBase::Check(AliQAv1::ALITASK_t task, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) 
+void AliQACheckerBase::Check(Double_t * test, AliQAv1::ALITASK_t task, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) 
 {
   // Performs a basic checking
   // Compares all the histograms in the list
 
-       Double_t * test = new Double_t[AliRecoParam::kNSpecies] ;
        Int_t count[AliRecoParam::kNSpecies]   = { 0 }; 
 
 //  TDirectory * refDir     = NULL ; 
@@ -241,7 +239,6 @@ Double_t * AliQACheckerBase::Check(AliQAv1::ALITASK_t task, TObjArray ** list, c
       }
     }
   }
-  return test ;
 }  
 
 
@@ -330,7 +327,7 @@ void AliQACheckerBase::Run(AliQAv1::ALITASK_t index, AliDetectorRecoParam * reco
        AliDebug(AliQAv1::GetQADebugLevel(), Form("Processing %s", AliQAv1::GetAliTaskName(index))) ; 
   
        Double_t * rv = NULL ;
-  rv = Check(index, recoParam) ;
+  Check(rv, index, recoParam) ;
        SetQA(index, rv) ;      
        
   AliDebug(AliQAv1::GetQADebugLevel(), Form("Test result of %s", AliQAv1::GetAliTaskName(index))) ;
@@ -345,14 +342,13 @@ void AliQACheckerBase::Run(AliQAv1::ALITASK_t index, TObjArray ** list, AliDetec
 { 
        AliDebug(AliQAv1::GetQADebugLevel(), Form("Processing %s", AliQAv1::GetAliTaskName(index))) ; 
   
-       Double_t * rv = NULL ;
-  rv = Check(index, list, recoParam) ;
+       Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
+  Check(rv, index, list, recoParam) ;
        SetQA(index, rv) ;      
        
   AliDebug(AliQAv1::GetQADebugLevel(), Form("Test result of %s", AliQAv1::GetAliTaskName(index))) ;
        
-  if (rv) 
-    delete [] rv ; 
+  delete [] rv ; 
   Finish() ; 
 }
 
@@ -395,7 +391,7 @@ void AliQACheckerBase::MakeImage( TObjArray ** list, AliQAv1::TASKINDEX_t task,
       if ( !fImage[esIndex] ) {
         fImage[esIndex] = new TCanvas(title, title) ;
       }
-      //fImage[esIndex]->Clear() ; 
+      fImage[esIndex]->Clear() ; 
       fImage[esIndex]->SetTitle(title) ; 
       fImage[esIndex]->cd() ; 
       TPaveText someText(0.015, 0.015, 0.98, 0.98) ;
index 6ba138ab7fcbd0e1eab83a465eedb9473595185d..1492a3fbf9e09cac4ad7aa52df11f2fb458b47af 100644 (file)
@@ -40,7 +40,6 @@ public:
   TList *        GetExternParamlist() { return fExternParamList ;}
   TCanvas **     GetImage() { return fImage ; }
   TCanvas *      GetImage(AliRecoParam::EventSpecie_t es) { return fImage[AliRecoParam::AConvert(es)] ; }
-  void           GetRefSubDir(const char * det, const char * task, TDirectory *& dirFile, TObjArray **& dirOCDB) ;
   virtual void   Init(const AliQAv1::DETECTORINDEX_t det)   { AliQAv1::Instance(det) ; }
   virtual void   MakeImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode) ; 
   void           PrintExternParam() ; 
@@ -52,11 +51,12 @@ public:
   void           SetPrintImage(Bool_t opt = kTRUE) { fPrintImage = opt ; }
 
 protected:
-  virtual      Double_t * Check(AliQAv1::ALITASK_t, TObjArray **, const AliDetectorRecoParam * recoParam) ; 
+  virtual void Check(Double_t *rv, AliQAv1::ALITASK_t, TObjArray **, const AliDetectorRecoParam * recoParam) ; 
 
   Double_t     DiffC(const TH1 * href, const TH1 * hin) const ;   
   Double_t     DiffK(const TH1 * href, const TH1 * hin) const ;   
   void         Finish() const ; 
+  void         GetRefSubDir(const char * det, const char * task, TDirectory *& dirFile, TObjArray **& dirOCDB) ;
   virtual void SetQA(AliQAv1::ALITASK_t index, Double_t * value) const ;       
 
   TDirectory  * fDataSubDir     ; //! directory for the current task directory in the current detector directory in the data file
@@ -69,7 +69,7 @@ protected:
   TList       * fExternParamList; //List of external parameters (TParameter<double>)  
 
 private:
-  Double_t * Check(AliQAv1::ALITASK_t index, const AliDetectorRecoParam * recoParam) ;
+  void Check(Double_t * rv, AliQAv1::ALITASK_t index, const AliDetectorRecoParam * recoParam) ;
 
   ClassDef(AliQACheckerBase,3)  // description 
 
index 50229ad86b9dcc97007d66b9476611d844792823..f439b44c342696db790d68ab17d6bddbebf5aa8c 100644 (file)
@@ -288,30 +288,29 @@ Bool_t AliQAv1::CheckRange(AliRecoParam::EventSpecie_t es) const
 const char * AliQAv1::GetAliTaskName(ALITASK_t tsk)
 {
        // returns the char name corresponding to module index
-       TString tskName ;
        switch (tsk) {
                case kNULLTASK:
                        break ; 
                case kRAW:
-                       tskName = "RAW" ;
+                       return "RAW" ;
                        break ;  
                case kSIM:
-                       tskName = "SIM" ;
+                       return "SIM" ;
                        break ;
                case kREC:
-                       tskName = "REC" ;
+                       return "REC" ;
                        break ;
                case kESD:
-                       tskName = "ESD" ;
+                       return "ESD" ;
                        break ;
                case kANA:
-                       tskName = "ANA" ;
+                       return "ANA" ;
                        break ;
                default:
-                       tsk = kNULLTASK ; 
+      return "" ; 
                        break ;
        }
-       return tskName.Data() ;
+  return "" ;
 }
 
 //_______________________________________________________________
@@ -473,12 +472,13 @@ TFile * AliQAv1::GetQADataFile(const char * fileName)
 TFile * AliQAv1::GetQAResultFile() 
 {
   // opens the file to store the  Quality Assurance Data Checker results       
-  if (fgQAResultFile ) 
+  if (fgQAResultFile && fgQAResultFile->IsOpen()
   {
-    if ( fgQAResultFile->IsOpen() ) 
-       fgQAResultFile->Close();
+    fgQAResultFile->Close();
   }
+  delete fgQAResultFile;
+  fgQAResultFile=0x0;
+  
   TString dirName(fgQAResultDirName) ; 
   if ( dirName.Contains(fgkLabLocalFile)) 
     dirName.ReplaceAll(fgkLabLocalFile, "") ;
@@ -492,9 +492,8 @@ TFile * AliQAv1::GetQAResultFile()
     opt = "NEW" ; 
   }
   fgQAResultFile = TFile::Open(fileName, opt) ;   
-  if (!fgQAResultFile ) // something wrong when trying to open the file
-   fgQAResultFile = TFile::Open(fileName, "RECREATE");  
-  return fgQAResultFile ;
+       
+       return fgQAResultFile ;
 }
 
 //_______________________________________________________________
@@ -609,7 +608,7 @@ AliQAv1 * AliQAv1::Instance()
   if ( ! fgQA) {
     TFile * f = GetQAResultFile() ; 
     fgQA = static_cast<AliQAv1 *>(f->Get("QA")) ; 
-    //f->Close() ; 
+    f->Close() ; 
     if ( ! fgQA ) 
       fgQA = new AliQAv1() ;
   }
@@ -896,12 +895,10 @@ void AliQAv1::ShowStatus(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::Event
 void AliQAv1::ShowASCIIStatus(AliRecoParam::EventSpecie_t es, DETECTORINDEX_t det, ALITASK_t tsk, const ULong_t status) const 
 {
        // print the QA status in human readable format
-       TString text; 
-  QABIT_t bit = GetQAStatusBit(es, det, tsk) ; 
+  const QABIT_t bit = GetQAStatusBit(es, det, tsk) ; 
   if ( bit != kNULLBit ) {
-    text = GetBitName(bit) ; 
-    text += " " ; 
-    AliInfoClass(Form("           %8s %8s %4s 0x%4lx, Problem signalled: %8s \n", AliRecoParam::GetEventSpecieName(es), GetDetName(det).Data(), GetAliTaskName(tsk), status, text.Data())) ; 
+          AliInfoClass(Form("           %8s %8s %4s  \n", AliRecoParam::GetEventSpecieName(es), GetDetName(det).Data(), GetAliTaskName(tsk))) ; 
+      //    AliInfoClass(Form("           %8s %8s %4s 0x%4lx, Problem signalled: %8s \n", AliRecoParam::GetEventSpecieName(es), GetDetName(det).Data(), GetAliTaskName(tsk), status, GetBitName(bit))) ; 
   }
 }