Logo ROOT  
Reference Guide
TFeldmanCousins.h
Go to the documentation of this file.
1// @(#)root/physics:$Id$
2// Author: Adrian Bevan 2001
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * Copyright (C) 2001, Liverpool University. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13#ifndef ROOT_TFeldmanCousins
14#define ROOT_TFeldmanCousins
15
16////////////////////////////////////////////////////////////////////////////
17// TFeldmanCousins
18//
19// class to calculate the CL upper limit using
20// the Feldman-Cousins method as described in PRD V57 #7, p3873-3889
21//
22// The default confidence interval calvculated using this method is 90%
23// This is set either by having a default the constructor, or using the
24// appropriate fraction when instantiating an object of this class (e.g. 0.9)
25//
26// The simple extension to a gaussian resolution function bounded at zero
27// has not been addressed as yet -> `time is of the essence' as they write
28// on the wall of the maze in that classic game ...
29//
30// VARIABLES THAT CAN BE ALTERED
31// -----------------------------
32// => depending on your desired precision: The intial values of fMuMin,
33// fMuMax, fMuStep and fNMax are those used in the PRD:
34// fMuMin = 0.0
35// fMuMax = 50.0
36// fMuStep= 0.005
37// but there is total flexibility in changing this should you desire.
38//
39// Author: Adrian Bevan, Liverpool University
40//
41// Copyright Liverpool University 2001 bevan@slac.stanford.edu
42///////////////////////////////////////////////////////////////////////////
43
44#include "TObject.h"
45#include "TString.h"
46
47class TFeldmanCousins : public TObject {
48protected:
49 Double_t fCL; // confidence level as a fraction [e.g. 90% = 0.9]
50 Double_t fUpperLimit; // the calculated upper limit
51 Double_t fLowerLimit; // the calculated lower limit
52 Double_t fNobserved; // input number of observed events
53 Double_t fNbackground;// input number of background events
54 Double_t fMuMin; // minimum value of signal to use in calculating the tables
55 Double_t fMuMax; // maximum value of signal to use in calculating the tables
56 Double_t fMuStep; // the step in signal to use when generating tables
57 Int_t fNMuStep; // = (int)(fMuStep)
58 Int_t fNMax; // = (int)(fMuMax)
59 Int_t fQUICK; // take a short cut to speed up the process of generating a
60 // lut. This scans from Nobserved-Nbackground-fMuMin upwards
61 // assuming that UL > Nobserved-Nbackground.
62
63 ////////////////////////////////////////////////
64 // calculate the poissonian probability for //
65 // a mean of mu+B events with a variance of N //
66 ////////////////////////////////////////////////
68
69 ////////////////////////////////////////////////
70 // calculate the probability table and see if //
71 // fNObserved is in the 100.0 * fCL % //
72 // interval //
73 ////////////////////////////////////////////////
75
76public:
77 TFeldmanCousins(Double_t newCL=0.9, TString options = "");
78 virtual ~TFeldmanCousins();
79
80 ////////////////////////////////////////////////
81 // calculate the upper limit given Nobserved //
82 // and Nbackground events //
83 // the variables fUpperLimit and fLowerLimit //
84 // are set before returning the upper limit //
85 ////////////////////////////////////////////////
86 Double_t CalculateUpperLimit(Double_t Nobserved, Double_t Nbackground);
87 Double_t CalculateLowerLimit(Double_t Nobserved, Double_t Nbackground);
88
89 inline Double_t GetUpperLimit(void) const { return fUpperLimit; }
90 inline Double_t GetLowerLimit(void) const { return fLowerLimit; }
91 inline Double_t GetNobserved(void) const { return fNobserved; }
92 inline Double_t GetNbackground(void) const { return fNbackground; }
93 inline Double_t GetCL(void) const { return fCL; }
94
95 inline Double_t GetMuMin(void) const { return fMuMin; }
96 inline Double_t GetMuMax(void) const { return fMuMax; }
97 inline Double_t GetMuStep(void) const { return fMuStep; }
98 inline Double_t GetNMax(void) const { return fNMax; }
99
100 inline void SetNobserved(Double_t NObs) { fNobserved = NObs; }
101 inline void SetNbackground(Double_t Nbg) { fNbackground = Nbg; }
102 inline void SetCL(Double_t newCL) { fCL = newCL; }
103
104 inline void SetMuMin(Double_t newMin = 0.0) { fMuMin = newMin; }
105 void SetMuMax(Double_t newMax = 50.0);
106 void SetMuStep(Double_t newMuStep = 0.005);
107
108 ClassDef(TFeldmanCousins,1) //calculate the CL upper limit using the Feldman-Cousins method
109};
110
111#endif
112
113
114
115
116
117
double Double_t
Definition: RtypesCore.h:57
#define ClassDef(name, id)
Definition: Rtypes.h:322
#define N
Class to calculate the CL upper limit using the Feldman-Cousins method as described in PRD V57 #7,...
void SetMuMin(Double_t newMin=0.0)
Double_t fUpperLimit
void SetNobserved(Double_t NObs)
void SetNbackground(Double_t Nbg)
Double_t fNbackground
Double_t CalculateLowerLimit(Double_t Nobserved, Double_t Nbackground)
given Nobserved and Nbackground, try different values of mu that give lower limits that are consisten...
Double_t GetNbackground(void) const
Double_t Prob(Int_t N, Double_t mu, Double_t B)
Calculate the poissonian probability for a mean of mu+B events with a variance of N.
void SetCL(Double_t newCL)
Double_t GetNobserved(void) const
Int_t FindLimitsFromTable(Double_t mu)
calculate the probability table for a given mu for n = 0, NMAX and return 1 if the number of observed...
void SetMuStep(Double_t newMuStep=0.005)
Set the step in signal to use when generating tables.
Double_t GetCL(void) const
Double_t GetNMax(void) const
Double_t GetMuMax(void) const
Double_t fLowerLimit
void SetMuMax(Double_t newMax=50.0)
Set maximum value of signal to use in calculating the tables.
Double_t CalculateUpperLimit(Double_t Nobserved, Double_t Nbackground)
given Nobserved and Nbackground, try different values of mu that give upper limits that are consisten...
TFeldmanCousins(Double_t newCL=0.9, TString options="")
Constructor.
Double_t GetLowerLimit(void) const
virtual ~TFeldmanCousins()
Double_t GetMuMin(void) const
Double_t GetUpperLimit(void) const
Double_t GetMuStep(void) const
Mother of all ROOT objects.
Definition: TObject.h:37
Basic string class.
Definition: TString.h:131
static double B[]