]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliQADataMakerRec.cxx
Include cstdlib (gcc 4.3.0)
[u/mrichter/AliRoot.git] / STEER / AliQADataMakerRec.cxx
index f8f598893c3a60feb6c1dafbf5edaeba065abcbe..7baa9ee4ba4612546e4cf354fd54098a5e27cef0 100644 (file)
 
 /* $Id$ */
 
-/*
-  Base Class
-  Produces the data needed to calculate the quality assurance for Reconstruction
-  All data must be mergeable objects.
-  Y. Schutz CERN July 2007
-*/
+//
+//  Base Class
+//  Produces the data needed to calculate the quality assurance for Reconstruction
+//  All data must be mergeable objects.
+//  Y. Schutz CERN July 2007
+//
 
 // --- ROOT system ---
-#include <TSystem.h> 
 #include <TFile.h>
-#include <TList.h> 
 #include <TTree.h>
-#include <TClonesArray.h>
 
 // --- Standard library ---
 
 // --- AliRoot header files ---
 #include "AliLog.h"
 #include "AliQADataMakerRec.h"
-#include "AliQAChecker.h"
 #include "AliESDEvent.h"
 #include "AliRawReader.h"
 
@@ -66,6 +62,27 @@ AliQADataMakerRec::AliQADataMakerRec(const AliQADataMakerRec& qadm) :
        fDetectorDirName = GetName() ; 
 }
 
+//____________________________________________________________________________ 
+AliQADataMakerRec::~AliQADataMakerRec()
+{
+       //dtor: delete the TObjArray and thei content
+       if ( fESDsQAList ) {
+               if ( fESDsQAList->IsOwner() ) 
+                       fESDsQAList->Delete() ;     
+               delete fESDsQAList ;     
+       }
+       if ( fRawsQAList ) {
+               if ( fRawsQAList->IsOwner() ) 
+                       fRawsQAList->Delete() ;
+               delete fRawsQAList ;
+       }
+       if ( fRecPointsQAList ) {
+               if ( fRecPointsQAList->IsOwner() ) 
+                       fRecPointsQAList->Delete() ; 
+               delete fRecPointsQAList ; 
+       }
+}
+
 //__________________________________________________________________
 AliQADataMakerRec& AliQADataMakerRec::operator = (const AliQADataMakerRec& qadm )
 {
@@ -76,7 +93,7 @@ AliQADataMakerRec& AliQADataMakerRec::operator = (const AliQADataMakerRec& qadm
 }
 
 //____________________________________________________________________________
-void AliQADataMakerRec::EndOfCycle(AliQA::TASKINDEX task) 
+void AliQADataMakerRec::EndOfCycle(AliQA::TASKINDEX_t task) 
 {
        // Finishes a cycle of QA data acquistion
        
@@ -88,17 +105,22 @@ void AliQADataMakerRec::EndOfCycle(AliQA::TASKINDEX task)
                list = fRecPointsQAList ; 
        else if ( task == AliQA::kESDS )
                list = fESDsQAList ; 
-       
-       EndOfDetectorCycle(task, list) ; 
-       TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; 
+
+       DefaultEndOfDetectorCycle(task) ;
+       EndOfDetectorCycle(task, list) ;
+       TDirectory * subDir = 0x0 ;
+       if (fDetectorDir) 
+               subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; 
        if ( subDir ) {
                subDir->cd() ; 
-               list->Write() ;
+               if (list) 
+                       list->Write() ;
        }
+       //Finish() ; 
 }
  
 //____________________________________________________________________________
-void AliQADataMakerRec::Exec(AliQA::TASKINDEX task, TObject * data) 
+void AliQADataMakerRec::Exec(AliQA::TASKINDEX_t task, TObject * data) 
 { 
   // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
        
@@ -128,7 +150,7 @@ void AliQADataMakerRec::Exec(AliQA::TASKINDEX task, TObject * data)
 }
 
 //____________________________________________________________________________ 
-TObjArray *  AliQADataMakerRec::Init(AliQA::TASKINDEX task, Int_t run, Int_t cycles)
+TObjArray *  AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, Int_t run, Int_t cycles)
 {
   // general intialisation
        
@@ -139,16 +161,22 @@ TObjArray *  AliQADataMakerRec::Init(AliQA::TASKINDEX task, Int_t run, Int_t cyc
                SetCycle(cycles) ;  
        
        if ( task == AliQA::kRAWS ) {
-               fRawsQAList = new TObjArray(100) ;       
-               InitRaws() ;
+               if (! fRawsQAList ) { 
+                       fRawsQAList = new TObjArray(100) ;       
+                       InitRaws() ;
+               }
                rv = fRawsQAList ;
        } else if ( task == AliQA::kRECPOINTS ) {
-               fRecPointsQAList = new TObjArray(100) ; 
-               InitRecPoints() ;
+               if ( ! fRecPointsQAList ) {
+                       fRecPointsQAList = new TObjArray(100) ; 
+                       InitRecPoints() ;
+               }
                rv = fRecPointsQAList ;
        } else if ( task == AliQA::kESDS ) {
-               fESDsQAList = new TObjArray(100) ; 
-               InitESDs() ;
+               if ( ! fESDsQAList ) {
+                       fESDsQAList = new TObjArray(100) ; 
+                       InitESDs() ;
+               }
                rv = fESDsQAList ;
        }
        
@@ -156,7 +184,7 @@ TObjArray *  AliQADataMakerRec::Init(AliQA::TASKINDEX task, Int_t run, Int_t cyc
 }
 
 //____________________________________________________________________________ 
-void AliQADataMakerRec::Init(AliQA::TASKINDEX task, TObjArray * list, Int_t run, Int_t cycles)
+void AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, TObjArray * list, Int_t run, Int_t cycles)
 {
   // Intialisation by passing the list of QA data booked elsewhere
   
@@ -174,10 +202,9 @@ void AliQADataMakerRec::Init(AliQA::TASKINDEX task, TObjArray * list, Int_t run,
 }
 
 //____________________________________________________________________________
-void AliQADataMakerRec::StartOfCycle(AliQA::TASKINDEX task, const Bool_t sameCycle) 
+void AliQADataMakerRec::StartOfCycle(AliQA::TASKINDEX_t task, const Bool_t sameCycle) 
 { 
   // Finishes a cycle of QA data acquistion
        if ( !sameCycle || fCurrentCycle == -1) {
                ResetCycle() ;
                if (fOutput) 
@@ -204,11 +231,12 @@ void AliQADataMakerRec::StartOfCycle(AliQA::TASKINDEX task, const Bool_t sameCyc
          list = fRecPointsQAList ;
   else if ( task == AliQA::kESDS )  
          list = fESDsQAList ;
-
-       TIter next(list) ;
-       TH1 * h ; 
-       while ( (h = dynamic_cast<TH1 *>(next())) )
-               h->Reset() ;  
+       
+// Should be the choice of detectors
+//     TIter next(list) ;
+//     TH1 * h ; 
+//     while ( (h = dynamic_cast<TH1 *>(next())) )
+//             h->Reset() ;  
 
        StartOfDetectorCycle() ; 
 }