GammaCombo  Rev:Unversioneddirectory
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MethodPluginScan Class Reference

#include <MethodPluginScan.h>

Inheritance diagram for MethodPluginScan:
Inheritance graph
[legend]
Collaboration diagram for MethodPluginScan:
Collaboration graph
[legend]

Public Member Functions

int getNtoys ()
 
double getPvalue1d (RooSlimFitResult *plhScan, double chi2minGlobal, ToyTree *t=0, int id=0)
 
 MethodPluginScan (MethodProbScan *s)
 Initialize from a previous Prob scan, setting the profile likelihood. More...
 
 MethodPluginScan (MethodProbScan *s, PDF_Datasets *pdf, OptParser *opt)
 Constructor, mainly to ensure compatibility with MethodDatasetsPluginScan. More...
 
 MethodPluginScan (Combiner *comb)
 Initialize from a Combiner object. More...
 
virtual void readScan1dTrees (int runMin=1, int runMax=1, TString fName="default")
 Read in the TTrees that were produced by scan1d(). More...
 
void readScan2dTrees (int runMin=1, int runMax=1)
 Read in the TTrees that were produced by scan2d(). More...
 
virtual int scan1d (int nRun=1)
 Perform the 1d Plugin scan. More...
 
virtual void scan2d (int nRun=1)
 Perform the 2d Plugin scan. More...
 
void setNtoysPerPoint (int n)
 
void setParevolPLH (MethodProbScan *s)
 Set the parameter evolution over the profile likelihood that was previously computed by a MethodProbScan scanner. More...
 
- Public Member Functions inherited from MethodAbsScan
virtual void calcCLintervals (int CLsType=0)
 Calculate the CL intervals from the CL curve. More...
 
void calcCLintervalsSimple (int CLsType=0)
 
virtual void checkCLs ()
 
void confirmSolutions ()
 Refit all possible solutions with the scan parameter left free to confirm the solutions. More...
 
void doInitialFit (bool force=false)
 Try to find global mininum of the PDF. More...
 
const vector< RooSlimFitResult * > & getAllResults ()
 
OptParsergetArg ()
 
const std::pair< double, double > getBorders (const TGraph &graph, const double confidence_level, bool qubic=false)
 determines the borders of the confidence interval by linear or qubic interpolation. More...
 
const std::pair< double, double > getBorders_CLs (const TGraph &graph, const double confidence_level, bool qubic=false)
 
float getChi2minBkg ()
 
float getChi2minGlobal ()
 
float getCL (double val)
 
CLInterval getCLinterval (int iSol=0, int sigma=1)
 Get the CL interval that includes the best-fit value. More...
 
CLInterval getCLintervalCentral (int sigma=1)
 Get the CL interval that includes the best-fit value. More...
 
CombinergetCombiner () const
 
const vector< RooSlimFitResult * > & getCurveResults ()
 
int getDrawSolution ()
 
bool getFilled ()
 
int getFillStyle ()
 
TH1F * getHchisq ()
 
TH2F * getHchisq2d ()
 
TH1F * getHCL ()
 
TH2F * getHCL2d ()
 
TH1F * getHCLs ()
 
TH2F * getHCLs2d ()
 
TH1F * getHCLsErr1Dn ()
 
TH1F * getHCLsErr1Up ()
 
TH1F * getHCLsErr2Dn ()
 
TH1F * getHCLsErr2Up ()
 
TH1F * getHCLsExp ()
 
TH1F * getHCLsFreq ()
 
int getLineColor ()
 
int getLineStyle ()
 
TString getMethodName () const
 
TString getName () const
 
int getNObservables ()
 
int getNPoints1d ()
 
int getNPoints2dx ()
 
int getNPoints2dy ()
 
const RooArgSet * getObservables ()
 
TString getObsName ()
 
TString getParsName ()
 
RooRealVar * getScanVar1 ()
 
TString getScanVar1Name ()
 
float getScanVar1Solution (int i=0)
 Get value of scan parameter 1 a certain solution. More...
 
RooRealVar * getScanVar2 ()
 
TString getScanVar2Name ()
 
float getScanVar2Solution (int i=0)
 Get value of scan parameter 2 a certain solution (only meaningful for 2d scan). More...
 
float getScanVarSolution (int iVar, int iSol)
 Get value of scan parameter at a certain solution. More...
 
RooSlimFitResultgetSolution (int i=0)
 Return a solution corresponding to a minimum of the profile likelihoood. More...
 
vector< RooSlimFitResult * > getSolutions ()
 
int getTextColor ()
 
const RooArgSet * getTheory ()
 
TString getTitle ()
 
RooWorkspace * getWorkspace ()
 
virtual void initScan ()
 
void loadParameters (RooSlimFitResult *r)
 Load the values given by an (external) fit result. More...
 
virtual bool loadScanner (TString fName="")
 Save a scanner from plots/scanner. More...
 
bool loadSolution (int i=0)
 Load the values at a specific minimum into the workspace. More...
 
 MethodAbsScan ()
 
 MethodAbsScan (Combiner *c)
 
 MethodAbsScan (OptParser *opt)
 
void plot1d (TString var)
 Make a 1d plot of the NLL in var. More...
 
void plot2d (TString varx, TString vary)
 Make a 2d plot of the PDF in varx and vary. More...
 
void plotOn (OneMinusClPlotAbs *plot, int CLsType=0)
 
void plotPulls (int nSolution=0)
 Make a pull plot of observables corresponding to the given solution. More...
 
virtual void print ()
 
void printCLintervals (int CLsType)
 Print CL intervals. More...
 
void printLocalMinima ()
 Print local minima solutions. More...
 
void saveLocalMinima (TString fName="")
 Save local minima solutions. More...
 
void saveScanner (TString fName="")
 Save this scanner to a root file placed into plots/scanner. More...
 
virtual int scan1d ()
 
virtual int scan2d ()
 
void setChi2minGlobal (double x)
 Set the global minimum manually. More...
 
void setDrawSolution (int code=0)
 
void setFilled (bool filled)
 
void setFillStyle (int c)
 
void setHchisq (TH1F *h)
 
void setHCL (TH1F *h)
 
void setLineColor (int c)
 
void setLineStyle (int c)
 
void setNPoints1d (int n)
 
void setNPoints2dx (int n)
 
void setNPoints2dy (int n)
 
void setPValueCorrector (PValueCorrection *pvalCor)
 
void setScanVar1 (TString var)
 
void setScanVar2 (TString var)
 
void setSolutions (vector< RooSlimFitResult *> s)
 Helper function to copy over solutions from another scanner. More...
 
void setTextColor (int c)
 
void setTitle (TString s)
 
void setVerbose (bool yesNo=true)
 
void setXscanRange (float min, float max)
 
void setYscanRange (float min, float max)
 
 ~MethodAbsScan ()
 

Protected Member Functions

TH1F * analyseToys (ToyTree *t, int id=-1)
 Analyse toys that were written either by a scan or a by getPvalue(). More...
 
void computePvalue1d (RooSlimFitResult *plhScan, double chi2minGlobal, ToyTree *t, int id, Fitter *f, ProgressBar *pb)
 Compute the p-value at a certain point in parameter space using the plugin method. More...
 
RooDataSet * generateToys (int nToys)
 Generate toys. More...
 
RooSlimFitResultgetParevolPoint (float scanpoint)
 Helper function for scan1d(). More...
 
double importance (double pvalue)
 Importance sampling for low p-values: Returns a value between 0.05 and 1 which can be used to scale down the number of toys to be generated at each scan step. More...
 
- Protected Member Functions inherited from MethodAbsScan
void sortSolutions ()
 Sort solutions in order of increasing chi2. More...
 

Protected Attributes

int nToys
 number of toys to be generated at each scan point More...
 
MethodProbScanparevolPLH
 external scanner defining the parameter evolution: set to profileLH unless for the Hybrid Plugin More...
 
MethodProbScanprofileLH
 external scanner holding the profile likelihood: DeltaChi2 of the scan PDF on data More...
 
- Protected Attributes inherited from MethodAbsScan
OptParserarg
 command line options More...
 
double chi2minBkg
 chi2 value at global minimum More...
 
double chi2minGlobal
 chi2 value at global minimum More...
 
bool chi2minGlobalFound
 flag to avoid finding minimum twice More...
 
Combinercombiner
 the combination More...
 
bool drawFilled
 choose if Histogram is drawn filled or not More...
 
int drawSolution
 Configure how to draw solutions on the plots. More...
 
int fillStyle
 
RooFitResult * globalMin
 parameter values at a global minimum More...
 
TH1F * hChi2min
 histogram for the chi2min values before Prob() More...
 
TH2F * hChi2min2d
 histogram for the chi2min values before Prob() More...
 
TH1F * hCL
 1-CL curve More...
 
TH2F * hCL2d
 1-CL curve More...
 
TH1F * hCLs
 1-CL curve More...
 
TH2F * hCLs2d
 1-CL curve More...
 
TH1F * hCLsErr1Dn
 1-CL curve More...
 
TH1F * hCLsErr1Up
 1-CL curve More...
 
TH1F * hCLsErr2Dn
 1-CL curve More...
 
TH1F * hCLsErr2Up
 1-CL curve More...
 
TH1F * hCLsExp
 1-CL curve More...
 
TH1F * hCLsFreq
 1-CL curve More...
 
int lineColor
 
int lineStyle
 
bool m_initialized
 true if initScan() was called More...
 
bool m_xrangeset
 true if the x range was set manually (setXscanRange()) More...
 
bool m_yrangeset
 true if the y range was set manually (setYscanRange()) More...
 
TString methodName
 Prob, ... More...
 
TString name
 basename, e.g. ggsz More...
 
int nPoints1d
 number of scan points used by 1d scan More...
 
int nPoints2dx
 number of scan points used by 2d scan, x axis More...
 
int nPoints2dy
 number of scan points used by 2d scan, y axis More...
 
int nWarnings
 number of warnings printed in getScanVarSolution() More...
 
RooDataSet * obsDataset
 save the nominal observables so we can restore them after we have fitted toys More...
 
TString obsName
 dataset name of observables, derived from name More...
 
TString parsName
 set name of physics parameters, derived from name More...
 
TString pdfName
 PDF name in workspace, derived from name. More...
 
PValueCorrectionpvalueCorrector
 
bool pvalueCorrectorSet
 
TRandom3 rndm
 
TString scanVar1
 scan parameter More...
 
TString scanVar2
 second scan parameter if we're scanning 2d More...
 
RooDataSet * startPars
 save the start parameter values before any scan More...
 
int textColor
 color used for plotted central values More...
 
TString thName
 set name of theory parameters, derived from name More...
 
TString title
 nice string for the legends More...
 
TString toysName
 set name of parameters to vary in toys More...
 
bool verbose
 
RooWorkspace * w
 

Additional Inherited Members

- Public Attributes inherited from MethodAbsScan
vector< RooSlimFitResult * > allResults
 All fit results we encounter along the scan. More...
 
vector< CLIntervalclintervals1sigma
 all 1 sigma intervals that were found by calcCLintervals() More...
 
vector< CLIntervalclintervals2sigma
 all 2 sigma intervals that were found by calcCLintervals() More...
 
vector< CLIntervalclintervals3sigma
 all 3 sigma intervals that were found by calcCLintervals() More...
 
vector< RooSlimFitResult * > curveResults
 All fit results of the the points that make it into the 1-CL curve. More...
 
vector< vector< RooSlimFitResult * > > curveResults2d
 All fit results of the the points that make it into the 1-CL curve. More...
 
vector< RooSlimFitResult * > solutions
 Local minima filled by saveSolutions() and saveSolutions2d(). More...
 

Detailed Description

Definition at line 60 of file MethodPluginScan.h.

Constructor & Destructor Documentation

§ MethodPluginScan() [1/3]

MethodPluginScan::MethodPluginScan ( MethodProbScan s)

Initialize from a previous Prob scan, setting the profile likelihood.

This should be the default.

Definition at line 14 of file MethodPluginScan.cpp.

§ MethodPluginScan() [2/3]

MethodPluginScan::MethodPluginScan ( MethodProbScan s,
PDF_Datasets pdf,
OptParser opt 
)

Constructor, mainly to ensure compatibility with MethodDatasetsPluginScan.

Definition at line 36 of file MethodPluginScan.cpp.

§ MethodPluginScan() [3/3]

MethodPluginScan::MethodPluginScan ( Combiner comb)

Initialize from a Combiner object.

This is more difficult, as now we have to set the profile likelihood explicitly, and probably some other things... But to just compute a p-value at a certain point (getPvalue1d()) this is fine.

Definition at line 62 of file MethodPluginScan.cpp.

Member Function Documentation

§ analyseToys()

TH1F * MethodPluginScan::analyseToys ( ToyTree t,
int  id = -1 
)
protected

Analyse toys that were written either by a scan or a by getPvalue().

Create a histogram of p-values vs scanoints with as many bins for the scanpoint as found in the ToyTree.

Parameters
tA ToyTree set up for reading (open() was called).
idOnly consider entries that have the id branch set to this value. This is used e.g. by the coverage tests to distinguish the different coverage toys. Default is -1 which uses all entries regardless of their id.
Returns
A new histogram that contains the p-values vs the scanpoint.
Todo:
replace this such that there's always one bin per scan point, but still the range is the scan range.
Todo:
Also, if we use the min/max from the tree, we have the problem that they are not exactly the scan range, so that the axis won't show the lowest and highest number.
Todo:
If the scan range was changed after the toys were generate, we absolutely have to derive the range from the root files - else we'll have bining effects.

< only select entries with given id (unless id==-1)

Definition at line 806 of file MethodPluginScan.cpp.

§ computePvalue1d()

void MethodPluginScan::computePvalue1d ( RooSlimFitResult plhScan,
double  chi2minGlobal,
ToyTree t,
int  id,
Fitter f,
ProgressBar pb 
)
protected

Compute the p-value at a certain point in parameter space using the plugin method.

The precision of the p-value will depend on the number of toys that were generated, more than 100 should be a good start (ntoys command line option).

Parameters
plhScanDefines the point in parameter space (=nuisances) at which the p-value gets computed. That is, it all toys are being generated at this point. It also defines the value of the scan parameter and provides the "scan" chi2 value of "the data".
chi2minGlobalchi2 value at global minimum
tStores all toys and fit results that are being generated. If a ToyTree is provided, entries will be added to the existing tree, and all new entries will have the "id" branch set to the id parameter. If no tree is provided, a new one will be created. This will be saved to disk and deleted from memory afterwards.
idAn arbitrary number identifying this particular run of getPvalue1d(). E.g. in the coverage tests, we need to run many times for different toy data sets that replace the nominal "data". The ToyTree also contains a 'run' branch that holds the run number (=batch job).
fA fitter object. If not given, a new one will be created. It may be useful to use an external fitter so that the fitter object can compute some fit statistics for an entire 1-CL scan.
pbA progress bar object used to print nice progress output.
Returns
the p-value.

Definition at line 264 of file MethodPluginScan.cpp.

§ generateToys()

RooDataSet * MethodPluginScan::generateToys ( int  nToys)
protected

Generate toys.

Parameters
nToys- generate this many toys

Definition at line 139 of file MethodPluginScan.cpp.

§ getNtoys()

int MethodPluginScan::getNtoys ( )
inline

Definition at line 73 of file MethodPluginScan.h.

§ getParevolPoint()

RooSlimFitResult * MethodPluginScan::getParevolPoint ( float  scanpoint)
protected

Helper function for scan1d().

Gets point in parameter space (in form of a RooFitResult) at which the plugin toy should be generated. The point is taken from the externally provided scanner parevolPLH, which is usually just the profile likelihood, but can also be set to the profile likelihood of a different combination. A couple of sanity checks are performed.

Parameters
scanpoint- value of the scan parameter for which the point should be found

Definition at line 101 of file MethodPluginScan.cpp.

§ getPvalue1d()

double MethodPluginScan::getPvalue1d ( RooSlimFitResult plhScan,
double  chi2minGlobal,
ToyTree t = 0,
int  id = 0 
)

Definition at line 404 of file MethodPluginScan.cpp.

§ importance()

double MethodPluginScan::importance ( double  pvalue)
protected

Importance sampling for low p-values: Returns a value between 0.05 and 1 which can be used to scale down the number of toys to be generated at each scan step.

The function is designed such that it logarithmic p-value plots look nice. Below a certain p-value, 1e-4, it returns 0.

Parameters
pvalueThe expected p-value, e.g. from the profile likelihood
Returns
Fraction between 0.1 and 1

< the minimum fraction we allow

< the p-value for which we don't generate toys anymore.

Definition at line 1181 of file MethodPluginScan.cpp.

§ readScan1dTrees()

void MethodPluginScan::readScan1dTrees ( int  runMin = 1,
int  runMax = 1,
TString  fName = "default" 
)
virtual

Read in the TTrees that were produced by scan1d().

Fills the 1-CL histogram.

Parameters
runMinNumber of first root file to read.
runMaxNumber of lase root file to read.

Reimplemented in MethodDatasetsPluginScan.

Definition at line 958 of file MethodPluginScan.cpp.

§ readScan2dTrees()

void MethodPluginScan::readScan2dTrees ( int  runMin = 1,
int  runMax = 1 
)

Read in the TTrees that were produced by scan2d().

Fills the 1-CL histogram.

Parameters
runMinNumber of first root file to read.
runMaxNumber of lase root file to read.

< only select entries with given id (unless id==-1)

Definition at line 1024 of file MethodPluginScan.cpp.

§ scan1d()

int MethodPluginScan::scan1d ( int  nRun = 1)
virtual

Perform the 1d Plugin scan.

Saves chi2 values in a root tree, together with the full fit result for each toy. If option –lightfiles is given, the tree will only contain the essentials (min Chi2). If a combined PDF for the toy generation is given by setParevolPLH(), this will be used to generate the toys.

Parameters
nRunPart of the root tree file name to facilitate parallel production.

Reimplemented in MethodDatasetsPluginScan, and MethodBergerBoosScan.

Definition at line 456 of file MethodPluginScan.cpp.

§ scan2d()

void MethodPluginScan::scan2d ( int  nRun = 1)
virtual

Perform the 2d Plugin scan.

Saves chi2 values in a root tree, together with the full fit result for each toy.

Parameters
nRunPart of the root tree file name to facilitate parallel production.

Definition at line 543 of file MethodPluginScan.cpp.

§ setNtoysPerPoint()

void MethodPluginScan::setNtoysPerPoint ( int  n)
inline

Definition at line 67 of file MethodPluginScan.h.

§ setParevolPLH()

void MethodPluginScan::setParevolPLH ( MethodProbScan s)

Set the parameter evolution over the profile likelihood that was previously computed by a MethodProbScan scanner.

Usually, the PLH is used that is provided to the constructor. Use this method to use a different evolution for toy generation (Hybrid Plugin).

Todo:
This setting is currently being ignored by the DatasetsPluginScan

Definition at line 84 of file MethodPluginScan.cpp.

Member Data Documentation

§ nToys

int MethodPluginScan::nToys
protected

number of toys to be generated at each scan point

Definition at line 84 of file MethodPluginScan.h.

§ parevolPLH

MethodProbScan* MethodPluginScan::parevolPLH
protected

external scanner defining the parameter evolution: set to profileLH unless for the Hybrid Plugin

Definition at line 86 of file MethodPluginScan.h.

§ profileLH

MethodProbScan* MethodPluginScan::profileLH
protected

external scanner holding the profile likelihood: DeltaChi2 of the scan PDF on data

Definition at line 85 of file MethodPluginScan.h.


The documentation for this class was generated from the following files: