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 bb5cc4201b3d3c6a2eca685e3f58be1e8d74bb89..bf2eadd4763c6156414ac1bd06fde40c5d0e439c 100644 (file)
@@ -40,7 +40,7 @@
 #include <TDatabasePDG.h>
 
 #include "AliHFMassFitter.h"
 #include <TDatabasePDG.h>
 
 #include "AliHFMassFitter.h"
-
+#include "AliVertexingHFUtils.h"
 
 
 ClassImp(AliHFMassFitter)
 
 
 ClassImp(AliHFMassFitter)
@@ -2012,9 +2012,7 @@ void AliHFMassFitter::Significance(Double_t min, Double_t max, Double_t &signifi
     return;
   }
 
     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;
 }
   
   return;
 }
index 62cb618f36158ea65fcbbedbe16496ce47ba9731..dc4bec2955bf7deb9ad6276863087d00a7cc80b6 100644 (file)
@@ -63,6 +63,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 AliVertexingHFUtils::Pol(Double_t x, Int_t k){
   // compute chi from polynomial approximation
index 9cbe8b79770b074330691ec283a19af1edf0374e..015e2001a027a74823d5a96a103cd05aa1a00a92 100644 (file)
@@ -18,6 +18,7 @@
 
 class AliAODMCParticle;
 class AliAODMCHeader;
 
 class AliAODMCParticle;
 class AliAODMCHeader;
+class AliAODEvent;
 class TProfile;
 class TClonesArray;
 class TH1F;
 class TProfile;
 class TClonesArray;
 class TH1F;
@@ -30,6 +31,9 @@ class AliVertexingHFUtils : public TObject{
   AliVertexingHFUtils(Int_t k);
   virtual ~AliVertexingHFUtils() {};
 
   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;}
   // Functions for Event plane resolution
   void SetK(Int_t k){fK=k;}
   void SetSubEvResol(Double_t res){fSubRes=res;}