]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSOnlineSPDfoAnalyzer.cxx
Fix for coverity (Annalisa De Caro).
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineSPDfoAnalyzer.cxx
index 3bb42c7c5b9bb82f8b11cbf0f1ef46d1371ee7f0..e02afd1a0319e99423dc5ef539347d74c732f250 100644 (file)
@@ -43,6 +43,8 @@
 #include "AliITSOnlineSPDfoAnalyzer.h"
 #include "AliLog.h"
 
+using std::ifstream;
+
 AliITSOnlineSPDfoAnalyzer::AliITSOnlineSPDfoAnalyzer(const TString fileName, Bool_t readFromGridFile) :
   fFileName(0),
   fNdims(0),
@@ -79,7 +81,7 @@ AliITSOnlineSPDfoAnalyzer::AliITSOnlineSPDfoAnalyzer(const AliITSOnlineSPDfoAnal
   //
   
   for(Int_t iqual =0; iqual<3; iqual++) fGeneralThresholds[iqual] =foan.fGeneralThresholds[iqual];
-  for (UInt_t chipNr=0; chipNr<11; chipNr++) {
+  for (UInt_t chipNr=0; chipNr<10; chipNr++) {
     for (UInt_t hs=0; hs<6; hs++) {
       for(Int_t i=0; i<kNqualityFlags;i++) fNh[i][hs][chipNr]=NULL;
     }
@@ -95,7 +97,7 @@ AliITSOnlineSPDfoAnalyzer::~AliITSOnlineSPDfoAnalyzer()
   // 
   
   for (UInt_t hs=0; hs<6; hs++) {
-    for (UInt_t chipNr=0; chipNr<11; chipNr++) {
+    for (UInt_t chipNr=0; chipNr<10; chipNr++) {
       for(Int_t i=0; i<kNqualityFlags ; i++ ) if(fNh[i][hs][chipNr]!=NULL) delete fNh[i][hs][chipNr];          
     }
   }
@@ -107,7 +109,7 @@ AliITSOnlineSPDfoAnalyzer& AliITSOnlineSPDfoAnalyzer::operator=(const AliITSOnli
   // assignment operator, only copies the filename and params (not the processed data)
   if (this!=&foan) {
     for (UInt_t hs=0; hs<6; hs++) {
-      for (UInt_t chipNr=0; chipNr<11; chipNr++) {
+      for (UInt_t chipNr=0; chipNr<10; chipNr++) {
        for(Int_t i=0; i<kNqualityFlags ; i++ ) if(fNh[i][hs][chipNr]!=NULL) delete fNh[i][hs][chipNr];
       }
     }
@@ -258,7 +260,6 @@ void AliITSOnlineSPDfoAnalyzer::Process()
   } 
   
   TKey *key;
-  Double_t *dacvalues;
   TIter iter((fFOHandler->GetFile())->GetListOfKeys());  
   while ((key = (TKey*)(iter.Next()))) {
     TString classname = key->GetClassName();
@@ -270,7 +271,7 @@ void AliITSOnlineSPDfoAnalyzer::Process()
       break; 
     }
     
-    dacvalues = fFOHandler->GetDACvaluesD(key->GetName(), GetFOHandler()->GetFOscanInfo()->GetNumDACindex());
+    Double_t *dacvalues = fFOHandler->GetDACvaluesD(key->GetName(), GetFOHandler()->GetFOscanInfo()->GetNumDACindex());
     
     for(Int_t i=0; i< array->GetSize(); i++){
       AliITSOnlineSPDfoChip *chip = (AliITSOnlineSPDfoChip *)array->At(i); 
@@ -283,6 +284,8 @@ void AliITSOnlineSPDfoAnalyzer::Process()
       if(!fNh[quality][hs][chipid]) BuildTHnSparse(hs,chipid);
       fNh[quality][hs][chipid]->Fill(dacvalues);       
     } 
+
+    if(dacvalues) delete [] dacvalues;
   } 
 }
 //---------------------------------------------
@@ -366,10 +369,13 @@ void AliITSOnlineSPDfoAnalyzer::GetCanvases(const THnSparse *hn,Int_t hs, Int_t
       TH2D *h2=0x0;       
       if(idim == 0) {
         h1 = hn->Projection(k-1);
-        if(!h1) printf("no histogram!!...\n\n\n");
+        if(!h1) {
+         printf("no histogram!!...\n\n\n");
+        } else {
         h1->SetXTitle(Form("DAC %i  ( %s )",k-1,dacname[k-1].Data()));
         h1->SetYTitle("entries (eff within thresholds)");
         h1->Draw();
+        }
       } 
       
       if(idim==1) {      
@@ -400,6 +406,7 @@ TArrayI AliITSOnlineSPDfoAnalyzer::ChooseDACValues(Int_t hs, Int_t chip) const
   // is taken.
   
   TH1D *tmp[5];
+  for(Int_t jj=0;jj<5;jj++)tmp[jj]=NULL;
   if(fNdims > 5) printf("AliITSOnlineSPDfoAnalyzer::ChooseDACValues -> N. of dimensions are more than expected! Break! \n");
   TArrayI dacs(fNdims+1);
   
@@ -441,7 +448,7 @@ Bool_t AliITSOnlineSPDfoAnalyzer::IsExisting(TArrayI dacs,Int_t hs, Int_t chip)
   for(Int_t i=0; i<size; i++) entry[i] = dacs.At(i);
   Int_t checkbin = fNh[dacs.At(dacs.GetSize()-1)][hs][chip]->GetBin(entry,kFALSE); // kFALSE does not allocate another bin
   if(checkbin > -1) isOk = kTRUE;
-  delete entry;
+  delete [] entry;
   return isOk; 
 }
 //-----------------------------------------------------------
@@ -490,10 +497,10 @@ TArrayI AliITSOnlineSPDfoAnalyzer::GetCentralDACS(Int_t qualityflag, Int_t hs, I
   dacs.AddAt(qualityflag,fNdims);
   
   
-  delete mean;
-  delete goodbins;
-  delete bins;
-  delete val;
+  delete [] mean;
+  delete [] goodbins;
+  delete [] bins;
+  delete [] val;
   return dacs;
 }
 //-------------------------------------------------------