Correct formula for the error on significance
authorprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 23 May 2012 15:55:27 +0000 (15:55 +0000)
committerprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 23 May 2012 15:55:27 +0000 (15:55 +0000)
PWGHF/vertexingHF/AliHFMassFitter.cxx
PWGHF/vertexingHF/AliVertexingHFUtils.cxx
PWGHF/vertexingHF/AliVertexingHFUtils.h

index bb5cc42..bf2eadd 100644 (file)
@@ -40,7 +40,7 @@
 #include <TDatabasePDG.h>
 
 #include "AliHFMassFitter.h"
-
+#include "AliVertexingHFUtils.h"
 
 
 ClassImp(AliHFMassFitter)
@@ -2012,9 +2012,7 @@ void AliHFMassFitter::Significance(Double_t min, Double_t max, Double_t &signifi
     return;
   }
 
-  significance =  signal/TMath::Sqrt(signal+background);
-
-  errsignificance = TMath::Sqrt(significance*significance/(signal+background)/(signal+background)*(1/4.*errsignal*errsignal+errbackground*errbackground)+significance*significance/signal/signal*errsignal*errsignal);
+  AliVertexingHFUtils::ComputeSignificance(signal,errsignal,background,errbackground,significance,errsignificance);
   
   return;
 }
index 62cb618..dc4bec2 100644 (file)
@@ -64,6 +64,24 @@ AliVertexingHFUtils::AliVertexingHFUtils(Int_t k):
 
 
 //______________________________________________________________________
+void AliVertexingHFUtils::ComputeSignificance(Double_t signal, Double_t  errsignal, Double_t  background, Double_t  errbackground, Double_t &significance,Double_t &errsignificance){
+  // calculate significance from S, B and errors
+
+
+  Double_t errSigSq=errsignal*errsignal;
+  Double_t errBkgSq=errbackground*errbackground;
+  Double_t sigPlusBkg=signal+background;
+  if(sigPlusBkg>0. && signal>0.){
+    significance =  signal/TMath::Sqrt(signal+background);
+    errsignificance = significance*TMath::Sqrt((errSigSq+errBkgSq)/(4.*sigPlusBkg*sigPlusBkg)+(background/sigPlusBkg)*errSigSq/signal/signal);
+  }else{
+    significance=0.;
+    errsignificance=0.;
+  }
+  return;
+
+}
+//______________________________________________________________________
 Double_t AliVertexingHFUtils::Pol(Double_t x, Int_t k){
   // compute chi from polynomial approximation
   Double_t c[5];
index 9cbe8b7..015e200 100644 (file)
@@ -18,6 +18,7 @@
 
 class AliAODMCParticle;
 class AliAODMCHeader;
+class AliAODEvent;
 class TProfile;
 class TClonesArray;
 class TH1F;
@@ -30,6 +31,9 @@ class AliVertexingHFUtils : public TObject{
   AliVertexingHFUtils(Int_t k);
   virtual ~AliVertexingHFUtils() {};
 
+  // Significance calculator
+  static void ComputeSignificance(Double_t signal, Double_t  errsignal, Double_t  background, Double_t  errbackground, Double_t &significance,Double_t &errsignificance);
+
   // Functions for Event plane resolution
   void SetK(Int_t k){fK=k;}
   void SetSubEvResol(Double_t res){fSubRes=res;}