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

#include <MethodDatasetsPluginScan.h>

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

Public Member Functions

void addFile (TString name)
 
void drawDebugPlots (int runMin, int runMax, TString fileNameBaseIn="default")
 
float getParValAtIndex (int index, TString parName)
 Gets values of certain parameters as they were at the given scanpoint-index after the constrained fit to data. More...
 
MethodDatasetsProbScangetProfileLH ()
 
virtual void initScan ()
 
void loadParameterLimits ()
 load Parameter limits by default the "free" limit is loaded, can be changed to "phys" by command line argument More...
 
 MethodDatasetsPluginScan (MethodProbScan *probScan, PDF_Datasets *PDF, OptParser *opt)
 The default constructor for the dataset plugin scan. More...
 
void performBootstrapTest (int nSamples=1000, const TString &ext="")
 Assumption: root file is given to the scanner which only has toy at a specific scanpoint, not necessary! More...
 
virtual void print ()
 Print settings member of MethodDatasetsPluginScan. More...
 
void printDebug (const RooFitResult &r)
 
TChain * readFiles (int runMin, int runMax, int &nFilesRead, int &nFilesMissing, TString fileNameBaseIn="default")
 Compute the p-value at a certain point in parameter space using the plugin method. More...
 
virtual void readScan1dTrees (int runMin, int runMax, TString fileNameBaseIn="default")
 readScan1dTrees implements inherited method More...
 
virtual int scan1d (int nRun=1)
 Perform the 1d Plugin scan. More...
 
void setInputFile (TString name)
 
- Public Member Functions inherited from MethodPluginScan
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...
 
void readScan2dTrees (int runMin=1, int runMax=1)
 Read in the TTrees that were produced by scan2d(). 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 ()
 
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...
 
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 ()
 

Public Attributes

std::vector< double > bootstrapPVals
 
TChain * chain
 
RooFitResult * dataFreeFitResult
 
bool drawPlots
 
bool explicitInputFile
 
std::vector< TString > inputFiles
 
PDF_Datasetspdf
 
- 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...
 

Protected Member Functions

RooSlimFitResultgetParevolPoint (float scanpoint)
 
void setParevolPointByIndex (int index)
 Load the param. More...
 
- Protected Member Functions inherited from MethodPluginScan
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...
 

Private Member Functions

void checkExtProfileLH ()
 This checks if the TTree which originated from a previous prob scan for compatibility with the current scan: Did it use the same number of scan points, did it use the same scan range? If everything is fine, keeps a pointer to the tree in this->probScanTree. More...
 
double getPValueTTestStatistic (double test_statistic_value)
 
RooFitResult * loadAndFit (PDF_Datasets *pdf)
 Prepare environment for toy fit. More...
 
void makeControlPlots (std::map< int, std::vector< double > > bVals, std::map< int, std::vector< double > > sbVals)
 
void setAndPrintFitStatusConstrainedToys (const ToyTree &ToyTree)
 
void setAndPrintFitStatusFreeToys (const ToyTree &ToyTree)
 

Additional Inherited Members

- Protected Attributes inherited from MethodPluginScan
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
 

Detailed Description

Definition at line 20 of file MethodDatasetsPluginScan.h.

Constructor & Destructor Documentation

§ MethodDatasetsPluginScan()

MethodDatasetsPluginScan::MethodDatasetsPluginScan ( MethodProbScan probScan,
PDF_Datasets PDF,
OptParser opt 
)

The default constructor for the dataset plugin scan.

Definition at line 29 of file MethodDatasetsPluginScan.cpp.

Member Function Documentation

§ addFile()

void MethodDatasetsPluginScan::addFile ( TString  name)
inline

Definition at line 36 of file MethodDatasetsPluginScan.h.

§ checkExtProfileLH()

void MethodDatasetsPluginScan::checkExtProfileLH ( )
private

This checks if the TTree which originated from a previous prob scan for compatibility with the current scan: Did it use the same number of scan points, did it use the same scan range? If everything is fine, keeps a pointer to the tree in this->probScanTree.

Definition at line 160 of file MethodDatasetsPluginScan.cpp.

§ drawDebugPlots()

void MethodDatasetsPluginScan::drawDebugPlots ( int  runMin,
int  runMax,
TString  fileNameBaseIn = "default" 
)

Definition at line 1139 of file MethodDatasetsPluginScan.cpp.

§ getParevolPoint()

RooSlimFitResult * MethodDatasetsPluginScan::getParevolPoint ( float  scanpoint)
protected

Definition at line 1277 of file MethodDatasetsPluginScan.cpp.

§ getParValAtIndex()

float MethodDatasetsPluginScan::getParValAtIndex ( int  index,
TString  parName 
)

Gets values of certain parameters as they were at the given scanpoint-index after the constrained fit to data.

Definition at line 80 of file MethodDatasetsPluginScan.cpp.

§ getProfileLH()

MethodDatasetsProbScan* MethodDatasetsPluginScan::getProfileLH ( )
inline

Definition at line 26 of file MethodDatasetsPluginScan.h.

§ getPValueTTestStatistic()

double MethodDatasetsPluginScan::getPValueTTestStatistic ( double  test_statistic_value)
private

Definition at line 619 of file MethodDatasetsPluginScan.cpp.

§ initScan()

void MethodDatasetsPluginScan::initScan ( )
virtual

Reimplemented from MethodAbsScan.

Definition at line 92 of file MethodDatasetsPluginScan.cpp.

§ loadAndFit()

RooFitResult * MethodDatasetsPluginScan::loadAndFit ( PDF_Datasets pdf)
private

Prepare environment for toy fit.

Parameters
pdfthe pdf that is to be fitted.

Definition at line 201 of file MethodDatasetsPluginScan.cpp.

§ loadParameterLimits()

void MethodDatasetsPluginScan::loadParameterLimits ( )

load Parameter limits by default the "free" limit is loaded, can be changed to "phys" by command line argument

Definition at line 216 of file MethodDatasetsPluginScan.cpp.

§ makeControlPlots()

void MethodDatasetsPluginScan::makeControlPlots ( std::map< int, std::vector< double > >  bVals,
std::map< int, std::vector< double > >  sbVals 
)
private

Definition at line 1438 of file MethodDatasetsPluginScan.cpp.

§ performBootstrapTest()

void MethodDatasetsPluginScan::performBootstrapTest ( int  nSamples = 1000,
const TString &  ext = "" 
)

Assumption: root file is given to the scanner which only has toy at a specific scanpoint, not necessary!

< speeds up the event loop

Definition at line 1169 of file MethodDatasetsPluginScan.cpp.

§ print()

void MethodDatasetsPluginScan::print ( )
virtual

Print settings member of MethodDatasetsPluginScan.

Reimplemented from MethodAbsScan.

Definition at line 228 of file MethodDatasetsPluginScan.cpp.

§ printDebug()

void MethodDatasetsPluginScan::printDebug ( const RooFitResult &  r)

Definition at line 1263 of file MethodDatasetsPluginScan.cpp.

§ readFiles()

TChain * MethodDatasetsPluginScan::readFiles ( int  runMin,
int  runMax,
int &  nFilesRead,
int &  nFilesMissing,
TString  fileNameBaseIn = "default" 
)

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
runMindefines lowest run number of toy jobs to read in
runMaxdefines highest run number of toy jobs to read in

Definition at line 260 of file MethodDatasetsPluginScan.cpp.

§ readScan1dTrees()

void MethodDatasetsPluginScan::readScan1dTrees ( int  runMin,
int  runMax,
TString  fileNameBaseIn = "default" 
)
virtual

readScan1dTrees implements inherited method

Parameters
runMindefines lowest run number of toy jobs to read in
runMaxdefines highest run number of toy jobs to read in
fileNameBaseInoptional, define the directory from which the files are to be read

This is the Plugin version of the method, there is also a version of the method for the prob scan, with _prob suffix.

Todo:
: Like for the normal gammacombo stuff, use a seperate class for the PROB scan! This is MethodDatasetsPLUGINScan.cpp, after all
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.

< for the status bar

Reimplemented from MethodPluginScan.

Definition at line 305 of file MethodDatasetsPluginScan.cpp.

§ scan1d()

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

Perform the 1d Plugin scan.

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

Default is "free", if not changed by cmd-line parameter

Reimplemented from MethodPluginScan.

Definition at line 642 of file MethodDatasetsPluginScan.cpp.

§ setAndPrintFitStatusConstrainedToys()

void MethodDatasetsPluginScan::setAndPrintFitStatusConstrainedToys ( const ToyTree ToyTree)
private

Definition at line 1315 of file MethodDatasetsPluginScan.cpp.

§ setAndPrintFitStatusFreeToys()

void MethodDatasetsPluginScan::setAndPrintFitStatusFreeToys ( const ToyTree ToyTree)
private

Definition at line 1398 of file MethodDatasetsPluginScan.cpp.

§ setInputFile()

void MethodDatasetsPluginScan::setInputFile ( TString  name)
inline

Definition at line 35 of file MethodDatasetsPluginScan.h.

§ setParevolPointByIndex()

void MethodDatasetsPluginScan::setParevolPointByIndex ( int  index)
protected

Load the param.

values from the data-fit at a certain scan point

Definition at line 1286 of file MethodDatasetsPluginScan.cpp.

Member Data Documentation

§ bootstrapPVals

std::vector<double> MethodDatasetsPluginScan::bootstrapPVals

Definition at line 42 of file MethodDatasetsPluginScan.h.

§ chain

TChain* MethodDatasetsPluginScan::chain

Definition at line 43 of file MethodDatasetsPluginScan.h.

§ dataFreeFitResult

RooFitResult* MethodDatasetsPluginScan::dataFreeFitResult

Definition at line 44 of file MethodDatasetsPluginScan.h.

§ drawPlots

bool MethodDatasetsPluginScan::drawPlots

Definition at line 39 of file MethodDatasetsPluginScan.h.

§ explicitInputFile

bool MethodDatasetsPluginScan::explicitInputFile

Definition at line 40 of file MethodDatasetsPluginScan.h.

§ inputFiles

std::vector<TString> MethodDatasetsPluginScan::inputFiles

Definition at line 41 of file MethodDatasetsPluginScan.h.

§ pdf

PDF_Datasets* MethodDatasetsPluginScan::pdf

Definition at line 36 of file MethodDatasetsPluginScan.h.


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