Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:29:44

0001 // @(#)root/roostats:$Id$
0002 
0003 /*************************************************************************
0004  * Project: RooStats                                                     *
0005  * Package: RooFit/RooStats                                              *
0006  * Authors:                                                              *
0007  *   Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke       *
0008  *************************************************************************
0009  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers.               *
0010  * All rights reserved.                                                  *
0011  *                                                                       *
0012  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0013  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0014  *************************************************************************/
0015 
0016 #ifndef ROOSTATS_HybridPlot
0017 #define ROOSTATS_HybridPlot
0018 
0019 #include <vector>
0020 #include <iostream>
0021 
0022 #include "TNamed.h"
0023 
0024 // these  should be maybe forward declared
0025 // by moving implementations in source file
0026 
0027 #include "TH1.h"
0028 
0029 class TLine;
0030 class TLegend;
0031 class TH1;
0032 class TVirtualPad;
0033 
0034 namespace RooStats {
0035 
0036    class HybridPlot : public TNamed {
0037 
0038    public:
0039 
0040       /// Constructor
0041       HybridPlot(const char* name,
0042                  const char* title,
0043                  const std::vector<double> & sb_values,
0044                  const std::vector<double> & b_values,
0045                  double testStat_data,
0046                  int n_bins,
0047                  bool verbosity=true);
0048 
0049       /// Destructor
0050       ~HybridPlot() override;
0051 
0052       /// Draw on current pad
0053       void Draw (const char* options="") override;
0054 
0055       /// All the objects are written to rootfile
0056       void DumpToFile (const char* RootFileName, const char* options);
0057 
0058       /// Get B histo mean
0059       double GetBmean(){return fB_histo->GetMean();};
0060 
0061       /// Get B histo RMS
0062       double GetBrms(){return fB_histo->GetRMS();};
0063 
0064       /// Get B histo
0065       TH1F * GetBhisto(){return fB_histo;}
0066 
0067       /// Get B histo center
0068       double GetBCenter(double n_sigmas=1, bool display=false)
0069       {return GetHistoCenter(fB_histo,n_sigmas,display);};
0070 
0071       /// Get B histo integration extremes to obtain the requested area fraction
0072       /// call delete [] res to release memory
0073       double* GetBIntExtremes(double frac)
0074       {return GetHistoPvals(fB_histo,frac);};
0075 
0076       /// Get SB histo mean
0077       double GetSBmean(){return fSb_histo->GetMean();};
0078 
0079       /// Get SB histo center
0080       double GetSBCenter(double n_sigmas=1, bool display=false)
0081       {return GetHistoCenter(fSb_histo,n_sigmas,display);};
0082 
0083       /// Get SB histo RMS
0084       double GetSBrms(){return fSb_histo->GetRMS();};
0085 
0086       /// Get SB histo integration extremes to obtain the requested area fraction
0087       /// call delete [] res to release memory
0088       double* GetSBIntExtremes(double frac)
0089       {return GetHistoPvals(fSb_histo,frac);};
0090 
0091       /// Get B histo
0092       TH1F* GetSBhisto(){return fSb_histo;}
0093 
0094        /// Get the pad (or canvas) where it has been drawn
0095       TVirtualPad * GetCanvas() { return fPad; }
0096 
0097       /// Write an image on disk
0098       void DumpToImage (const char* filename);
0099 
0100 
0101       /// Get the center of the histo
0102       double GetHistoCenter(TH1* histo, double n_rms=1,bool display_result=false);
0103 
0104       /// Get the "effective sigmas" of the histo, call delete [] res to release memory
0105       double* GetHistoPvals (TH1* histo, double percentage);
0106 
0107       /// Get the median of an histogram
0108       double GetMedian(TH1* histo);
0109 
0110    private:
0111 
0112       TH1F* fSb_histo;            ///< The sb Histo
0113       TH1F* fSb_histo_shaded;     ///< The sb Histo shaded
0114       TH1F* fB_histo;             ///< The b Histo
0115       TH1F* fB_histo_shaded;      ///< The b Histo shaded
0116       TLine* fData_testStat_line; ///< The line for the data value of the test statistic
0117       TLegend* fLegend;           ///< The legend of the plot
0118       TVirtualPad * fPad;         ///< The pad where it has been drawn
0119       bool fVerbose;              ///< verbosity flag
0120 
0121       ClassDefOverride(HybridPlot,0)   // Provides the plots for an HybridResult
0122    };
0123 }
0124 
0125 #endif