]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCCalibPulser.cxx
Fix Coverity
[u/mrichter/AliRoot.git] / TPC / AliTPCCalibPulser.cxx
index 79d9b88bb890583f468fb73a2bf9d15f8e1f3aff..099b980c6ff14acb4ab49ea611e756b29a12ced4 100644 (file)
 #include "AliRawReaderRoot.h"
 #include "AliRawReaderDate.h"
 #include "AliTPCRawStream.h"
-#include "AliTPCRawStreamFast.h"
 #include "AliTPCCalROC.h"
 #include "AliTPCCalPad.h"
 #include "AliTPCROC.h"
@@ -782,14 +781,9 @@ TH2S* AliTPCCalibPulser::GetHisto(Int_t sector, TObjArray *arr,
   if ( !force || arr->UncheckedAt(sector) )
     return (TH2S*)arr->UncheckedAt(sector);
   
-    // if we are forced and histogram doesn't yes exist create it
-  Char_t name[255], title[255];
-  
-  sprintf(name,"hCalib%s%.2d",type,sector);
-  sprintf(title,"%s calibration histogram sector %.2d",type,sector);
-  
-    // new histogram with Q calib information. One value for each pad!
-  TH2S* hist = new TH2S(name,title,
+  // if we are forced and histogram doesn't yes exist create it
+  // new histogram with Q calib information. One value for each pad!
+  TH2S* hist = new TH2S(Form("hCalib%s%.2d",type,sector),Form("%s calibration histogram sector %.2d",type,sector),
                         nbinsY, ymin, ymax,
                         fROC->GetNChannels(sector),0,fROC->GetNChannels(sector));
   hist->SetDirectory(0);
@@ -1005,13 +999,14 @@ Bool_t AliTPCCalibPulser::IsEdgePad(Int_t sector, Int_t row, Int_t pad)
   return kFALSE;
 }
 //_____________________________________________________________________
-void AliTPCCalibPulser::Merge(AliTPCCalibPulser *sig)
+void AliTPCCalibPulser::Merge(AliTPCCalibPulser * const sig)
 {
-    //
-    //  Merge reference histograms of sig to the current AliTPCCalibPulser
-    //
-  
-    //merge histograms
+  //
+  //  Merge reference histograms of sig to the current AliTPCCalibPulser
+  //
+
+  MergeBase(sig);
+  //merge histograms
   for (Int_t iSec=0; iSec<72; ++iSec){
     TH2S *hRefQmerge   = sig->GetHistoQ(iSec);
     TH2S *hRefT0merge  = sig->GetHistoT0(iSec);
@@ -1063,6 +1058,32 @@ void AliTPCCalibPulser::Merge(AliTPCCalibPulser *sig)
     sig->fHMeanTimeSector->SetDirectory(dir);
   }
 }
+
+
+//_____________________________________________________________________
+Long64_t AliTPCCalibPulser::Merge(TCollection * const list)
+{
+  //
+  // Merge all objects of this type in list
+  //
+  
+  Long64_t nmerged=1;
+  
+  TIter next(list);
+  AliTPCCalibPulser *ce=0;
+  TObject *o=0;
+  
+  while ( (o=next()) ){
+    ce=dynamic_cast<AliTPCCalibPulser*>(o);
+    if (ce){
+      Merge(ce);
+      ++nmerged;
+    }
+  }
+  
+  return nmerged;
+}
+
 //_____________________________________________________________________
 void AliTPCCalibPulser::Analyse()
 {
@@ -1152,6 +1173,14 @@ void AliTPCCalibPulser::Analyse()
       rocT0->SetValue(iChannel, cogTime0+meanTsec); //offset by mean time of the sector
       rocRMS->SetValue(iChannel, cogRMS);
       rocOut->SetValue(iChannel, cogOut);
+
+      // in case a channel has no data set the value to 0
+      if (TMath::Abs(cogTime0-fXminT0)<1e-10){
+        rocQ->SetValue(iChannel, 0);
+        rocT0->SetValue(iChannel, 0); //offset by mean time of the sector
+        rocRMS->SetValue(iChannel, 0);
+      }
+      
       //debug
       if ( GetStreamLevel() > 2 ){
         TTreeSRedirector *streamer=GetDebugStreamer();