Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random start points option for profiled POIs #713

Merged
merged 41 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
45fc551
Add ability to try rand start pts for prof POIs
kmohrman Dec 3, 2021
3326195
Option for specifying number of random start points
kmohrman Dec 3, 2021
cf60fa4
If using pointsRandProf_, turn on saveInactivePOI_
kmohrman Dec 3, 2021
4c10a7c
Update nonstandard.md
nucleosynthesis May 31, 2022
018fe0e
Update nonstandard.md
nucleosynthesis May 31, 2022
eff8006
Update commonstatsmethods.md
nucleosynthesis Jun 10, 2022
032dc17
Update index.md
nucleosynthesis Jun 10, 2022
6ed9c9a
Update commonstatsmethods.md
nucleosynthesis Jun 14, 2022
8feba2d
Do not save nll if fit fails, also add ability to pass ranges for ran…
kmohrman Jul 5, 2022
2f19e02
Add option for skipping default start point
kmohrman Jul 5, 2022
e1f2b66
Save each point if best nll so far to avoid rerunning fit at end
kmohrman Jul 6, 2022
3177041
Pass rand seed for rand start points
kmohrman Jul 6, 2022
2c1e05b
Small cleanups
kmohrman Jul 8, 2022
4657a55
Update systematicsAnalyzer.py
nucleosynthesis Jul 21, 2022
a22bb47
Include ATLAS ref for Impacts
nucleosynthesis Nov 15, 2022
a17df94
Update commonstatsmethods.md
nucleosynthesis Nov 28, 2022
42c3c82
Update commonstatsmethods.md
nucleosynthesis Nov 28, 2022
1889f09
Update index.md
nucleosynthesis Dec 7, 2022
56c4471
Update runningthetool.md
nucleosynthesis Dec 7, 2022
1491724
Update runningthetool.md
nucleosynthesis Dec 7, 2022
ce5c9d2
Update runningthetool.md
nucleosynthesis Dec 13, 2022
b34142c
Update commonstatsmethods.md
nucleosynthesis Dec 22, 2022
abb232a
Allow ChannelCompatibilityCheck to skip channels with no signal templ…
Dominic-Stafford Jan 5, 2023
8cfc616
Merge pull request #805 from Dominic-Stafford/102x
ajgilbert Jan 12, 2023
0963769
random starting point implementation for 2d grid scan
abasnet97 Mar 3, 2023
58bbff0
Add ability to try rand start pts for prof POIs
kmohrman Dec 3, 2021
0af5422
Option for specifying number of random start points
kmohrman Dec 3, 2021
09ad136
If using pointsRandProf_, turn on saveInactivePOI_
kmohrman Dec 3, 2021
3360d4c
Do not save nll if fit fails, also add ability to pass ranges for ran…
kmohrman Jul 5, 2022
709c637
Add option for skipping default start point
kmohrman Jul 5, 2022
8e7e17d
Save each point if best nll so far to avoid rerunning fit at end
kmohrman Jul 6, 2022
e2fda6e
Pass rand seed for rand start points
kmohrman Jul 6, 2022
c0fcac9
Small cleanups
kmohrman Jul 8, 2022
2c31c72
random starting point implementation for 2d grid scan
abasnet97 Mar 3, 2023
b6b0125
Merge branch 'rand-start-pts-v2' of github.com:kmohrman/HiggsAnalysis…
abasnet97 Mar 5, 2023
1f7b676
created a separate class for random starting point implementation
abasnet97 Apr 10, 2023
98c9983
fixed merge conflicts
abasnet97 Jun 9, 2023
0e06eb3
Making changes to be able to compile with CMSSW_11_X plus some other …
abasnet97 Jan 2, 2024
1932f09
resolved merge conflicts after merging changes from main
abasnet97 Jan 8, 2024
2561169
edited behavior of random starting point range to not override POI ra…
abasnet97 Jan 24, 2024
25db367
Update MultiDimFit.cc
nucleosynthesis Jan 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading