00001 // @(#)root/roostats:$Id: NumEventsTestStat.h 38087 2011-02-16 10:49:52Z moneta $ 00002 // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke 00003 /************************************************************************* 00004 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * 00005 * All rights reserved. * 00006 * * 00007 * For the licensing terms see $ROOTSYS/LICENSE. * 00008 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00009 *************************************************************************/ 00010 00011 #ifndef ROOSTATS_NumEventsTestStat 00012 #define ROOSTATS_NumEventsTestStat 00013 00014 //_________________________________________________ 00015 /* 00016 BEGIN_HTML 00017 <p> 00018 NumEventsTestStat is a simple implementation of the TestStatistic interface used for simple number counting. 00019 It should probably support simple cuts as well. 00020 </p> 00021 END_HTML 00022 */ 00023 // 00024 00025 #ifndef ROOT_Rtypes 00026 #include "Rtypes.h" 00027 #endif 00028 00029 #include <vector> 00030 00031 //#include "RooStats/DistributionCreator.h" 00032 #include "RooStats/SamplingDistribution.h" 00033 #include "RooStats/TestStatistic.h" 00034 00035 #include "RooRealVar.h" 00036 00037 namespace RooStats { 00038 00039 class NumEventsTestStat : public TestStatistic{ 00040 00041 public: 00042 NumEventsTestStat() : fPdf(0) { } 00043 NumEventsTestStat(RooAbsPdf& pdf) { 00044 fPdf = &pdf; 00045 } 00046 virtual ~NumEventsTestStat() { 00047 // delete fRand; 00048 // delete fTestStatistic; 00049 } 00050 00051 // Main interface to evaluate the test statistic on a dataset 00052 virtual Double_t Evaluate(RooAbsData& data, RooArgSet& /*paramsOfInterest*/) { 00053 if(!&data) { 00054 cout << "problem with data" << endl; 00055 return 0 ; 00056 } else { 00057 00058 RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL) ; 00059 return data.numEntries(); 00060 } 00061 } 00062 00063 // Get the TestStatistic 00064 virtual const RooAbsArg* GetTestStatistic() const {return fPdf;} 00065 00066 virtual const TString GetVarName() const {return "Number of events";} 00067 00068 00069 private: 00070 RooAbsPdf* fPdf; 00071 00072 protected: 00073 ClassDef(NumEventsTestStat,1) 00074 }; 00075 00076 } 00077 00078 00079 #endif