Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
9 changes: 9 additions & 0 deletions bin/combine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
float iMass;
string whichMethod, whichHintMethod;
int runToys;
int pickToy;
int seed;
string toysFile;

Expand Down Expand Up @@ -93,6 +94,7 @@
;
combiner.statOptions().add_options()
("toys,t", po::value<int>(&runToys)->default_value(0), "Number of Toy MC extractions")
("pickToy", po::value<int>(&pickToy)->default_value(0), "Works with --toys option. Pick a specific toy index 1..N to calculate result")
("seed,s", po::value<int>(&seed)->default_value(123456), "Toy MC random seed")
("hintMethod,H", po::value<string>(&whichHintMethod)->default_value(""), "First run this method to provide a hint on the result")
;
Expand Down Expand Up @@ -204,6 +206,13 @@

TString massName = TString::Format("mH%g.", iMass);
TString toyName = ""; if (runToys > 0 || seed != 123456 || vm.count("saveToys")) toyName = TString::Format("%d.", seed);
if (runToys > 0 ){
if ( ( !vm["pickToy"].defaulted() ) && ( pickToy > runToys || pickToy <= 0) ){
std::cerr << "ERROR - set pickToy to values 1 to (N toys) cannot use pickToy=" << pickToy << std::endl;
assert(0);

Check warning on line 212 in bin/combine.cpp

View check run for this annotation

Codecov / codecov/patch

bin/combine.cpp#L211-L212

Added lines #L211 - L212 were not covered by tests
}
}
combiner.setPickToy(pickToy);
if (vm.count("expectedFromGrid") && !vm["expectedFromGrid"].defaulted()) toyName += TString::Format("quant%.3f.", vm["expectedFromGrid"].as<float>());
if (vm.count("expected") && !vm["expected"].defaulted()) toyName += TString::Format("quant%.3f.", vm["expected"].as<float>());

Expand Down
6 changes: 5 additions & 1 deletion interface/Combine.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class RooAbsData;
namespace RooStats { class ModelConfig; }

extern Float_t t_cpu_, t_real_, g_quantileExpected_;
extern bool g_fillTree_;
extern bool g_fillTree_;
extern int pickToy_;
//RooWorkspace *writeToysHere = 0;
extern TDirectory *outputFile;
extern TDirectory *writeToysHere;
Expand Down Expand Up @@ -49,6 +50,9 @@ class Combine {
void applyOptions(const boost::program_options::variables_map &vm) ;

void run(TString hlfFile, const std::string &dataset, double &limit, double &limitErr, int &iToy, TTree *tree, int nToys);

/// Set a specific toy to run method on when using --toysFile / --toys
static void setPickToy(int pickToy);

/// Stop combine from fillint the tree (some algos need control)
static void toggleGlobalFillTree(bool flag=false);
Expand Down
9 changes: 8 additions & 1 deletion src/Combine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ Float_t g_quantileExpected_ = -1.0;
TDirectory *outputFile = 0;
TDirectory *writeToysHere = 0;
TDirectory *readToysFromHere = 0;
int verbose = 1;
int verbose = 1;
int pickToy_ = 0;
bool withSystematics = 1;
bool expectSignalSet_ = false;
bool doSignificance_ = 0;
Expand Down Expand Up @@ -1027,6 +1028,8 @@ void Combine::run(TString hlfFile, const std::string &dataset, double &limit, do

for (iToy = 1; iToy <= nToys; ++iToy) {

if ( (pickToy_ !=0) && (iToy != pickToy_) ) continue;

// Reset ranges --> for likelihood scans
if (setPhysicsModelParameterRangeExpression_ != "") {
utils::setModelParameterRanges( setPhysicsModelParameterRangeExpression_, w->allVars());
Expand Down Expand Up @@ -1148,6 +1151,10 @@ void Combine::toggleGlobalFillTree(bool flag){
g_fillTree_ = flag;
}

void Combine::setPickToy(int pickToy){
pickToy_ = pickToy;
}

void Combine::commitPoint(bool expected, float quantile) {
Float_t saveQuantile = g_quantileExpected_;
g_quantileExpected_ = quantile;
Expand Down
Loading