Skip to content

Commit

Permalink
Merge branch 'rand-start-pts-v2' of github.com:kmohrman/HiggsAnalysis…
Browse files Browse the repository at this point in the history
…-CombinedLimit into kmohrman-rand-start-pts
  • Loading branch information
Nick Wardle committed Jan 25, 2024
2 parents 800a90e + 25db367 commit 887f56d
Show file tree
Hide file tree
Showing 6 changed files with 430 additions and 148 deletions.
2 changes: 2 additions & 0 deletions docs/part3/nonstandard.md
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,9 @@ In case you see an excess somewhere in your analysis, you can evaluate the look-
To calculate the look-elsewhere effect for a single parameter (in this case the mass of the resonance), you can follow the instructions below. Note that these instructions assume you have a workspace that is parametric in your resonance mass $m$, otherwise you need to fit each background toy with separate workspaces. We will assume the local significance for your excess is $\sigma$.

* Generate background-only toys `combine ws.root -M GenerateOnly --toysFrequentist -m 16.5 -t 100 --saveToys --expectSignal=0`. The output will be something like `higgsCombineTest.GenerateOnly.mH16.5.123456.root`.

* For each toy, calculate the significance for a predefined range (e.g $m\in [10,35]$ GeV) in steps suitable to the resolution (e.g. 1 GeV). For `toy_1` the procedure would be: `for i in $(seq 10 35); do combine ws.root -M Significance --redefineSignalPOI r --freezeParameters MH --setParameter MH=$i -n $i -D higgsCombineTest.GenerateOnly.mH16.5.123456.root:toys/toy_1`. Calculate the maximum significance over all of these mass points - call this $\sigma_{max}$.

* Count how many toys have a maximum significance larger than the local one for your observed excess. This fraction of toys with $\sigma_{max}>\sigma$ is the global p-value.

You can find more tutorials on the LEE [here](https://indico.cern.ch/event/456547/contributions/1126036/attachments/1188691/1724680/20151117_comb_tutorial_Lee.pdf)
10 changes: 10 additions & 0 deletions interface/MultiDimFit.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class MultiDimFit : public FitterAlgoBase {
}
virtual void applyOptions(const boost::program_options::variables_map &vm) ;

friend class RandStartPt;

protected:
virtual bool runSpecific(RooWorkspace *w, RooStats::ModelConfig *mc_s, RooStats::ModelConfig *mc_b, RooAbsData &data, double &limit, double &limitErr, const double *hint);

Expand Down Expand Up @@ -67,6 +69,10 @@ class MultiDimFit : public FitterAlgoBase {
static std::string robustHesseLoad_;
static std::string robustHesseSave_;

static int pointsRandProf_;
static std::string setParameterRandomInitialValueRanges_;
static int randPointsSeed_;

static std::string saveSpecifiedFuncs_;
static std::string saveSpecifiedNuis_;
static std::string saveSpecifiedIndex_;
Expand All @@ -83,6 +89,7 @@ class MultiDimFit : public FitterAlgoBase {
static std::vector<float> specifiedVals_;
static RooArgList specifiedList_;
static bool saveInactivePOI_;
static bool skipDefaultStart_;
// initialize variables
void initOnce(RooWorkspace *w, RooStats::ModelConfig *mc_s) ;

Expand All @@ -95,6 +102,9 @@ class MultiDimFit : public FitterAlgoBase {
void doStitch2D(RooWorkspace *w, RooAbsReal &nll) ;
void doImpact(RooFitResult &res, RooAbsReal &nll) ;

std::map<std::string, std::vector<float>> getRangesDictFromInString(std::string) ;


// utilities
/// for each RooRealVar, set a range 'box' from the PL profiling all other parameters
void doBox(RooAbsReal &nll, double cl, const char *name="box", bool commitPoints=true) ;
Expand Down
45 changes: 45 additions & 0 deletions interface/RandStartPt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#ifndef HiggsAnalysis_CombinedLimit_RandStartPt_h
#define HiggsAnalaysis_CombinedLimit_RandStartPt_h

#include "HiggsAnalysis/CombinedLimit/interface/CascadeMinimizer.h"
#include "HiggsAnalysis/CombinedLimit/interface/MultiDimFit.h"

#include <vector>
#include <string>
#include "RooRealVar.h"
#include "RooAbsReal.h"
#include "RooArgSet.h"
#include "RooCategory.h"

class RandStartPt {
private:
RooAbsReal& nll_;
std::vector<RooRealVar* > &specifiedvars_;
std::vector<float> &specifiedvals_;
bool skipdefaultstart_;
std::string parameterRandInitialValranges_;
int numrandpts_;
int verbosity_;
bool fastscan_;
bool hasmaxdeltaNLLforprof_;
float maxdeltaNLLforprof_;
std::vector<std::string> &specifiednuis_;
std::vector<std::string> &specifiedfuncnames_;
std::vector<RooAbsReal*> &specifiedfunc_;
std::vector<float> &specifiedfuncvals_;
std::vector<std::string> &specifiedcatnames_;
std::vector<RooCategory*> &specifiedcat_;
std::vector<int> &specifiedcatvals_;
unsigned int nOtherFloatingPOI_;
public:
RandStartPt(RooAbsReal& nll, std::vector<RooRealVar* > &specifiedvars, std::vector<float> &specifiedvals, bool skipdefaultstart, std::string parameterRandInitialValranges, int numrandpts, int verbose, bool fastscan, bool hasmaxdeltaNLLforprof, float maxdeltaNLLforprof, std::vector<std::string> &specifiednuis, std::vector<std::string> &specifiedfuncnames, std::vector<RooAbsReal*> &specifiedfunc, std::vector<float> &specifiedfuncvals, std::vector<std::string> &specifiedcatnames, std::vector<RooCategory*> &specifiedcat, std::vector<int> &specifiedcatvals, unsigned int nOtherFloatingPOI);
std::map<std::string, std::vector<float>> getRangesDictFromInString(std::string params_ranges_string_in);
std::vector<std::vector<float>> vectorOfPointsToTry ();
void commitBestNLLVal(unsigned int idx, float &nllVal, double &probVal);
void setProfPOIvalues(unsigned int startptIdx, std::vector<std::vector<float>> &nested_vector_of_wc_vals);
void setValSpecifiedObjs();
void doRandomStartPt1DGridScan(double &xval, unsigned int poiSize, std::vector<float> &poival, std::vector<RooRealVar* > &poivars, std::unique_ptr <RooArgSet> &param, RooArgSet &snap, float &deltaNLL, double &nll_init, CascadeMinimizer &minimObj);
void doRandomStartPt2DGridScan(double &xval, double &yval, unsigned int poiSize, std::vector<float> &poival, std::vector<RooRealVar* > &poivars, std::unique_ptr <RooArgSet> &param, RooArgSet &snap, float &deltaNLL, double &nll_init, MultiDimFit::GridType gridType, double deltaX, double deltaY, CascadeMinimizer &minimObj);

};
#endif
Loading

0 comments on commit 887f56d

Please sign in to comment.