Fixes for FMD DAs
authorcholm <Christian.Holm.Christensen@cern.ch>
Sat, 14 Feb 2015 08:14:38 +0000 (09:14 +0100)
committercholm <Christian.Holm.Christensen@cern.ch>
Sat, 14 Feb 2015 08:14:38 +0000 (09:14 +0100)
FMD/DA/FMDGainda.cxx
FMD/FMDutil/AliFMDGainDA.cxx
FMD/FMDutil/AliFMDPedestalDA.cxx

index a404d6a..8fae0eb 100644 (file)
@@ -14,7 +14,9 @@
 #include <AliFMDGainDA.h>
 #include <AliFMDParameters.h>
 #include "FMDUtilda.h"
+#include <TROOT.h>
 #include <iostream>
+#include <unistd.h>
 
 int main(int argc, char **argv) 
 {
@@ -44,6 +46,12 @@ int main(int argc, char **argv)
   PostSummaries(gainDA, "gain", r.RunNumber());
 
   std::cout << "End of FMD-Gain, return " << ret << std::endl;
+
+  gROOT->SetMustClean(false);
+
+  std::cout << "Now calling _Exit(" << ret << ") to finish NOW!" << std::endl;
+  _exit(ret);
+
   return ret;
 }
 //
index dadb3bc..da07042 100644 (file)
@@ -40,6 +40,7 @@
 #include <TGraphErrors.h>
 #include <TDatime.h>
 #include <TH2.h>
+#include <TROOT.h>
 
 //_____________________________________________________________________
 ClassImp(AliFMDGainDA)
@@ -297,20 +298,24 @@ void AliFMDGainDA::Analyse(UShort_t det,
                      det, ring , sec, strip));
     return;
   }
-  TF1 fitFunc("fitFunc","pol1",-10,280); 
-  fitFunc.SetParameters(100,3);
-  grChannel->Fit("fitFunc","Q0","",0,fHighPulse);
+  TF1* fitFunc = new TF1("fitFunc","pol1",-10,280); 
+  fitFunc->SetParameters(100,3);
+  grChannel->Fit(fitFunc,"Q0","",0,fHighPulse);
+  if (grChannel->GetListOfFunctions())
+    grChannel->GetListOfFunctions()->Remove(fitFunc);
+  gROOT->GetListOfFunctions()->Remove(fitFunc);
+
      
   Float_t gain    = -1;
   Float_t error   = -1; 
   Float_t chi2ndf = -1;
-  if((fitFunc.GetParameter(1)) == (fitFunc.GetParameter(1))) {
-    gain    = fitFunc.GetParameter(1);
-    error   = fitFunc.GetParError(1);
-    if(fitFunc.GetNDF())
-      chi2ndf = fitFunc.GetChisquare() / fitFunc.GetNDF();
+  if((fitFunc->GetParameter(1)) == (fitFunc->GetParameter(1))) {
+    gain    = fitFunc->GetParameter(1);
+    error   = fitFunc->GetParError(1);
+    if(fitFunc->GetNDF())
+      chi2ndf = fitFunc->GetChisquare() / fitFunc->GetNDF();
   }
-  
+
   fOutputFile << det                         << ','
              << ring                        << ','
              << sec                         << ','
@@ -322,8 +327,8 @@ void AliFMDGainDA::Analyse(UShort_t det,
   //due to RCU trouble, first strips on VAs are excluded
   // if(strip%128 != 0) {
     
-  fSummaryGains.SetBinContent(fCurrentSummaryStrip,fitFunc.GetParameter(1));
-  fSummaryGains.SetBinError(fCurrentSummaryStrip,fitFunc.GetParError(1));
+  fSummaryGains.SetBinContent(fCurrentSummaryStrip,fitFunc->GetParameter(1));
+  fSummaryGains.SetBinError(fCurrentSummaryStrip,fitFunc->GetParError(1));
   
   fCurrentSummaryStrip++;
 
@@ -354,9 +359,10 @@ void AliFMDGainDA::Analyse(UShort_t det,
     // }
   if(fSaveHistograms) {
     TH1F* summary = GetSectorSummary(det, ring, sec);
-    summary->SetBinContent(strip+1, fitFunc.GetParameter(1));
-    summary->SetBinError(strip+1, fitFunc.GetParError(1));
+    summary->SetBinContent(strip+1, fitFunc->GetParameter(1));
+    summary->SetBinError(strip+1, fitFunc->GetParError(1));
   }  
+  delete fitFunc;
 }
 
 //_____________________________________________________________________
index 9420df7..4e1afc3 100644 (file)
@@ -43,6 +43,7 @@
 #include <TSystem.h>
 #include <TDatime.h>
 #include <TH2.h>
+#include <TROOT.h>
 
 //_____________________________________________________________________
 ClassImp(AliFMDPedestalDA)
@@ -271,7 +272,8 @@ void AliFMDPedestalDA::Analyse(UShort_t det,
     fitFunc->SetParameters(100,100,1);
     hChannel->Fit(fitFunc,"Q0","",10,200);
     hChannel->GetListOfFunctions()->Remove(fitFunc);
-    
+    gROOT->GetListOfFunctions()->Remove(fitFunc);
+
     Float_t mean = hChannel->GetMean();
     Float_t rms  = hChannel->GetRMS();