Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:45

0001 // @(#)root/physics:$Id$
0002 // Author: Adrian Bevan  2001
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * Copyright (C) 2001, Liverpool University.                             *
0007  * All rights reserved.                                                  *
0008  *                                                                       *
0009  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0010  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0011  *************************************************************************/
0012 
0013 #ifndef ROOT_TFeldmanCousins
0014 #define ROOT_TFeldmanCousins
0015 
0016 ////////////////////////////////////////////////////////////////////////////
0017 // TFeldmanCousins
0018 //
0019 // class to calculate the CL upper limit using
0020 // the Feldman-Cousins method as described in PRD V57 #7, p3873-3889
0021 //
0022 // The default confidence interval calvculated using this method is 90%
0023 // This is set either by having a default the constructor, or using the
0024 // appropriate fraction when instantiating an object of this class (e.g. 0.9)
0025 //
0026 // The simple extension to a gaussian resolution function bounded at zero
0027 // has not been addressed as yet -> `time is of the essence' as they write
0028 // on the wall of the maze in that classic game ...
0029 //
0030 //    VARIABLES THAT CAN BE ALTERED
0031 //    -----------------------------
0032 // => depending on your desired precision: The initial values of fMuMin,
0033 // fMuMax, fMuStep and fNMax are those used in the PRD:
0034 //   fMuMin = 0.0
0035 //   fMuMax = 50.0
0036 //   fMuStep= 0.005
0037 // but there is total flexibility in changing this should you desire.
0038 //
0039 // Author: Adrian Bevan, Liverpool University
0040 //
0041 // Copyright Liverpool University 2001       bevan@slac.stanford.edu
0042 ///////////////////////////////////////////////////////////////////////////
0043 
0044 #include "TObject.h"
0045 #include "TString.h"
0046 
0047 class TFeldmanCousins : public TObject {
0048 protected:
0049    Double_t fCL;         // confidence level as a fraction [e.g. 90% = 0.9]
0050    Double_t fUpperLimit; // the calculated upper limit
0051    Double_t fLowerLimit; // the calculated lower limit
0052    Double_t fNobserved;  // input number of observed events
0053    Double_t fNbackground;// input number of background events
0054    Double_t fMuMin;      // minimum value of signal to use in calculating the tables
0055    Double_t fMuMax;      // maximum value of signal to use in calculating the tables
0056    Double_t fMuStep;     // the step in signal to use when generating tables
0057    Int_t    fNMuStep;    // = (int)(fMuStep)
0058    Int_t    fNMax;       // = (int)(fMuMax)
0059    Int_t    fQUICK;      // take a short cut to speed up the process of generating a
0060                         // lut.  This scans from Nobserved-Nbackground-fMuMin upwards
0061                         // assuming that UL > Nobserved-Nbackground.
0062 
0063    ////////////////////////////////////////////////
0064    // calculate the poissonian probability for   //
0065    // a mean of mu+B events with a variance of N //
0066    ////////////////////////////////////////////////
0067    Double_t Prob(Int_t N, Double_t mu, Double_t B);
0068 
0069    ////////////////////////////////////////////////
0070    // calculate the probability table and see if //
0071    // fNObserved is in the 100.0 * fCL %         //
0072    // interval                                   //
0073    ////////////////////////////////////////////////
0074    Int_t FindLimitsFromTable(Double_t mu);
0075 
0076 public:
0077    TFeldmanCousins(Double_t newCL=0.9, TString options = "");
0078    ~TFeldmanCousins() override;
0079 
0080    ////////////////////////////////////////////////
0081    // calculate the upper limit given Nobserved  //
0082    // and Nbackground events                     //
0083    // the variables fUpperLimit and fLowerLimit  //
0084    // are set before returning the upper limit   //
0085    ////////////////////////////////////////////////
0086    Double_t CalculateUpperLimit(Double_t Nobserved, Double_t Nbackground);
0087    Double_t CalculateLowerLimit(Double_t Nobserved, Double_t Nbackground);
0088 
0089    inline Double_t GetUpperLimit(void)  const { return fUpperLimit;  }
0090    inline Double_t GetLowerLimit(void)  const { return fLowerLimit;  }
0091    inline Double_t GetNobserved(void)   const { return fNobserved;   }
0092    inline Double_t GetNbackground(void) const { return fNbackground; }
0093    inline Double_t GetCL(void)          const { return fCL;          }
0094 
0095    inline Double_t GetMuMin(void)       const { return fMuMin;  }
0096    inline Double_t GetMuMax(void)       const { return fMuMax;  }
0097    inline Double_t GetMuStep(void)      const { return fMuStep; }
0098    inline Double_t GetNMax(void)        const { return fNMax;   }
0099 
0100    inline void     SetNobserved(Double_t NObs)         { fNobserved   = NObs;  }
0101    inline void     SetNbackground(Double_t Nbg)        { fNbackground = Nbg;   }
0102    inline void     SetCL(Double_t newCL)               { fCL          = newCL; }
0103 
0104    inline void     SetMuMin(Double_t  newMin    = 0.0)   { fMuMin = newMin;  }
0105    void            SetMuMax(Double_t  newMax    = 50.0);
0106    void            SetMuStep(Double_t newMuStep = 0.005);
0107 
0108    ClassDefOverride(TFeldmanCousins,1) //calculate the CL upper limit using the Feldman-Cousins method
0109 };
0110 
0111 #endif
0112 
0113 
0114 
0115 
0116 
0117