]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliCorrQADataMakerRec.cxx
Bug fix. Removed delete statement
[u/mrichter/AliRoot.git] / STEER / AliCorrQADataMakerRec.cxx
index 776b2eeab8e360e113be5ca21e6b2ad8fa2dcd9c..575fa1ca3032273d7a669b5fff2f42b505461960 100644 (file)
@@ -30,6 +30,7 @@
 #include <TH2F.h> 
 #include <TNtupleD.h>
 #include <TParameter.h>
+#include <TMath.h> 
 
 // --- Standard library ---
 
@@ -42,12 +43,14 @@ ClassImp(AliCorrQADataMakerRec)
            
 //____________________________________________________________________________ 
 AliCorrQADataMakerRec::AliCorrQADataMakerRec(AliQADataMaker ** qadm ) : 
-  AliQADataMakerRec("Corr", "Corr Quality Assurance Data Maker"),
+AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kCORR), "Corr Quality Assurance Data Maker"),
   fMaxRawVar(0),  
   fqadm(qadm)
 {
   // ctor
-
+  fCorrNt = new TNtupleD *[AliRecoParam::kNSpecies] ; 
+  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
+    fCorrNt[specie] = NULL ; 
 }
 
 //____________________________________________________________________________ 
@@ -64,19 +67,32 @@ AliCorrQADataMakerRec::AliCorrQADataMakerRec(const AliCorrQADataMakerRec& qadm)
 //__________________________________________________________________
 AliCorrQADataMakerRec& AliCorrQADataMakerRec::operator = (const AliCorrQADataMakerRec& qadm )
 {
-  // Equal operator.
+  // assign operator.
   this->~AliCorrQADataMakerRec();
   new(this) AliCorrQADataMakerRec(qadm);
   return *this;
 }
+   
+//____________________________________________________________________________ 
+AliCorrQADataMakerRec::~AliCorrQADataMakerRec()  
+{
+  // dtor only destroy the ntuple 
+  if ( fCorrNt ) {
+    for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+      if ( fCorrNt[specie] != NULL ) 
+        delete fCorrNt[specie] ; 
+    }
+               delete[] fCorrNt ; 
+       }  
+}
+  
 //____________________________________________________________________________ 
-void AliCorrQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * /*list*/)
+void AliCorrQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** /*list*/)
 {
   //Detector specific actions at end of cycle
   // do the QA checking
-  if (task == AliQA::kRAWS) {
-     AliQAChecker::Instance()->Run(AliQA::kCORR, task, fObject) ; 
+  if (task == AliQAv1::kRAWS) {
+     AliQAChecker::Instance()->Run(AliQAv1::kCORR, task, fCorrNt) ; 
   }
 }
 
@@ -100,12 +116,12 @@ void AliCorrQADataMakerRec::InitRecPoints()
 void AliCorrQADataMakerRec::InitRaws()
 {
   // createa ntuple taking all the parameters declared by detectors
-  if (fObject) 
+  if (fCorrNt) 
     return ; 
   delete fRawsQAList ; // not needed for the time being 
   fRawsQAList = NULL ; 
   TString varlist("") ;
-  for ( Int_t detIndex = 0 ; detIndex < AliQA::kNDET ; detIndex++ ) {
+  for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++ ) {
     AliQADataMaker * qadm = fqadm[detIndex] ; 
     if ( ! qadm ) 
       continue ;
@@ -113,7 +129,7 @@ void AliCorrQADataMakerRec::InitRaws()
     if (list) {
       TIter next(list) ; 
       TParameter<double> * p ; 
-      while ( (p = dynamic_cast<TParameter<double>*>(next()) ) ) {
+      while ( (p = static_cast<TParameter<double>*>(next()) ) ) {
         varlist.Append(p->GetName()) ; 
         varlist.Append(":") ; 
         fMaxRawVar++ ; 
@@ -124,7 +140,10 @@ void AliCorrQADataMakerRec::InitRaws()
   if (fMaxRawVar == 0) { 
     AliWarning("NTUPLE not created") ; 
   } else {
-    fObject = new TNtupleD(AliQA::GetQACorrName(), "Raws data correlation among detectors", varlist.Data()) ;  
+    for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+      char * name = Form("%s_%s", AliQAv1::GetQACorrName(), AliRecoParam::GetEventSpecieName(specie)) ; 
+      fCorrNt[specie] = new TNtupleD(name, "Raws data correlation among detectors", varlist.Data()) ;  
+    }
   }  
 }
 
@@ -145,18 +164,18 @@ void AliCorrQADataMakerRec::MakeRaws(AliRawReader *)
     const Int_t kSize = fMaxRawVar ; 
     Double_t  *varvalue = new Double_t[kSize] ;
     Int_t index = 0 ;
-    for ( Int_t detIndex = 0 ; detIndex < AliQA::kNDET ; detIndex++ ) {
+    for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++ ) {
       AliQADataMaker * qadm = fqadm[detIndex] ; 
       if ( ! qadm ) 
         continue ;
       TList * list = qadm->GetParameterList() ; 
       TIter next(list) ; 
       TParameter<double> * p ; 
-      while ( (p = dynamic_cast<TParameter<double>*>(next()) ) ) {
+      while ( (p = static_cast<TParameter<double>*>(next()) ) ) {
         varvalue[index++] = p->GetVal() ; 
       }
     }
-    (dynamic_cast<TNtupleD*>(fObject))->Fill(varvalue);
+    (static_cast<TNtupleD*>(fCorrNt[(Int_t)TMath::Log2(fEventSpecie)]))->Fill(varvalue);
     delete [] varvalue;
   }
 }