Page MenuHomeHEPForge

No OneTemporary

diff --git a/examples/ProgOpts/CMakeLists.txt b/examples/ProgOpts/CMakeLists.txt
index f4e81b6..24de35c 100644
--- a/examples/ProgOpts/CMakeLists.txt
+++ b/examples/ProgOpts/CMakeLists.txt
@@ -1,7 +1,7 @@
find_package(Boost REQUIRED COMPONENTS program_options)
add_library(ProgramOptions STATIC Test_Dpipi_ProgOpts.cc Test_Dpipi_ProgOpts.hh Command.hh)
target_include_directories(ProgramOptions PUBLIC ${CMAKE_CURRENT_LIST_DIR})
-target_link_libraries(ProgramOptions PUBLIC Laura++ Boost::program_options)
+target_link_libraries(ProgramOptions PUBLIC Laura++ Boost::boost Boost::program_options)
diff --git a/examples/ProgOpts/Test_Dpipi_ProgOpts.cc b/examples/ProgOpts/Test_Dpipi_ProgOpts.cc
index 2658cdb..8ff58f1 100644
--- a/examples/ProgOpts/Test_Dpipi_ProgOpts.cc
+++ b/examples/ProgOpts/Test_Dpipi_ProgOpts.cc
@@ -1,154 +1,164 @@
#include <iostream>
+#include <string>
#include "boost/program_options.hpp"
+#include "boost/tokenizer.hpp"
#include "Test_Dpipi_ProgOpts.hh"
namespace po = boost::program_options;
void validate( boost::any& v, const std::vector<std::string>& values, Command* /*target_type*/, int)
{
// Make sure no previous assignment to 'v' has been made
po::validators::check_first_occurrence(v);
// Extract the first string from 'values'. If there is more than
// one string, it's an error, and exception will be thrown.
const std::string& s { po::validators::get_single_string(values) };
if ( s == "gen" ) {
v = boost::any( Command::Generate );
} else if ( s == "fit" ) {
v = boost::any( Command::Fit );
} else if ( s == "simfit" ) {
v = boost::any( Command::SimFit );
} else {
throw po::validation_error(po::validation_error::invalid_option_value, "command", s, 3);
}
}
void validate( boost::any& v, const std::vector<std::string>& values, LauTimeDepFitModel::CPEigenvalue* /*target_type*/, int)
{
// Make sure no previous assignment to 'v' has been made
po::validators::check_first_occurrence(v);
// Extract the first string from 'values'. If there is more than
// one string, it's an error, and exception will be thrown.
const std::string& s { po::validators::get_single_string(values) };
if ( s == "QFS" ) {
v = boost::any( LauTimeDepFitModel::CPEigenvalue::QFS );
} else if ( s == "CPEven" ) {
v = boost::any( LauTimeDepFitModel::CPEigenvalue::CPEven );
} else if ( s == "CPOdd" ) {
v = boost::any( LauTimeDepFitModel::CPEigenvalue::CPOdd );
} else {
throw po::validation_error(po::validation_error::invalid_option_value);
}
}
namespace LauDecayTime {
void validate( boost::any& v, const std::vector<std::string>& values, EfficiencyMethod* /*target_type*/, int)
{
// Make sure no previous assignment to 'v' has been made
po::validators::check_first_occurrence(v);
// Extract the first string from 'values'. If there is more than
// one string, it's an error, and exception will be thrown.
const std::string& s { po::validators::get_single_string(values) };
if ( s == "uniform" || s == "flat" ) {
v = boost::any( EfficiencyMethod::Uniform );
} else if ( s == "binned" || s == "hist" ) {
v = boost::any( EfficiencyMethod::Binned );
} else if ( s == "spline" ) {
v = boost::any( EfficiencyMethod::Spline );
} else {
throw po::validation_error(po::validation_error::invalid_option_value);
}
}
};
TestDpipi_ProgramSettings::TestDpipi_ProgramSettings(const int argc, const char ** argv)
{
po::options_description main_desc{"Main options"};
main_desc.add_options()
("command", po::value<Command>(&command)->required(), "main command: gen, fit, or simfit")
;
po::positional_options_description p;
p.add("command", 1);
po::options_description common_desc{"Common options"};
common_desc.add_options()
("help", "produce help message")
("dtype", po::value<LauTimeDepFitModel::CPEigenvalue>(&dType)->default_value(LauTimeDepFitModel::CPEigenvalue::QFS,"QFS"), "type of D decay: QFS, CPOdd, or CPEven")
("dta-model", po::value<LauDecayTime::EfficiencyMethod>(&timeEffModel)->default_value(LauDecayTime::EfficiencyMethod::Uniform,"uniform"), "decay-time acceptance model: uniform/flat, binned/hist, spline")
("dtr", po::value<Bool_t>(&timeResolution)->default_value(kTRUE), "enable/disable decay-time resolution")
("dtr-perevent", po::value<Bool_t>(&perEventTimeErr)->default_value(kFALSE), "enable/disable use of per-event decay-time error (requires decay-time resolution to be enabled to take effect)")
("seed", po::value<UInt_t>(&RNGseed)->default_value(0), "set the seed for the RNG; if not set, the time is used to generate a seed")
("dir", po::value<std::string>(&directory)->default_value("","<none>"), "set the directory used to find the nTuples within the root file. Defaults to no directory")
+ ("bkgndList", po::value<std::string>(&bkgndListStr)->default_value("comb,Bd2DKpi,Bs2DKpi,Lb2Dppi"), "the comma-separated list of background components to include")
("fitBackInput", po::value<std::string>(&fitBackInput)->default_value("","fit0_ToyMC_QFS_expts0-0_expt0.root"), "set the file used as input to the fit: only used if fitBack is also selected")
;
po::options_description gen_desc{"Generation options"};
gen_desc.add_options()
("firstExptGen", po::value<UInt_t>(&firstExptGen)->default_value(0), "first experiment to generate")
("nExptGen", po::value<UInt_t>(&nExptGen)->default_value(1), "number of experiments to generate")
;
po::options_description fit_desc{"Fitting options"};
fit_desc.add_options()
("firstExpt", po::value<UInt_t>(&firstExptFit)->default_value(0), "first experiment to fit")
("nExpt", po::value<UInt_t>(&nExptFit)->default_value(1), "number of experiments to fit")
("iFit", po::value<UInt_t>(&iFit)->default_value(0), "fit ID - used to distinguish multiple fits to a given dataset (used to disentangle multiple minima)")
("fixTau", po::value<Bool_t>(&fixLifetime)->default_value(kTRUE), "enable/disable floating of B lifetime parameter")
("fixDm", po::value<Bool_t>(&fixDeltaM)->default_value(kTRUE), "enable/disable floating of B mixing frequency parameter")
("fixPhiMix", po::value<Bool_t>(&fixPhiMix)->default_value(kFALSE), "enable/disable floating of B mixing phase parameter(s)")
("fixSplineKnots", po::value<Bool_t>(&fixSplineKnots)->default_value(kFALSE), "enable/disable floating of the decay-time-acceptance spline")
("useSinCos", po::value<Bool_t>(&useSinCos)->default_value(kTRUE), "enable/disable using sine and cosine of B mixing phase as the floating parameters rather than the phase itself")
("useAveDeltaCalibVals", po::value<Bool_t>(&useAveDeltaCalibVals)->default_value(kTRUE), "enable/disable fitting calib values as their average +/- delta values rather than having separate values for B and Bbar")
("addTaggers", po::value<Bool_t>(&addTaggers)->default_value(kTRUE), "add/omit taggers")
("floatCalibPars", po::value<Bool_t>(&floatCalibPars)->default_value(kTRUE), "enable/disable floating of the FT calibration parameters")
("floatYields", po::value<Bool_t>(&floatYields)->default_value(kFALSE), "enable/disable floating of the yields of each component - if enabled/disabled implies inclusion/exclusion of non-DP PDFs in/from the likelihood")
("fitBack", po::value<Bool_t>(&fitBack)->default_value(kFALSE), "enable/disable refitting some generated data from a model")
- ("sigOnly", po::value<Bool_t>(&sigOnly)->default_value(kFALSE), "enable/disable setting the background yields to 0")
;
po::options_description simfit_desc{"Simultaneous fitting options"};
simfit_desc.add_options()
("port", po::value<UInt_t>(&port)->default_value(0), "port number on which sim fit coordinator is listening")
;
po::options_description all_desc;
all_desc.add(main_desc).add(common_desc).add(gen_desc).add(fit_desc).add(simfit_desc);
po::variables_map vm;
try {
po::store(po::command_line_parser(argc, argv).
options(all_desc).
positional(p).
run(),
vm);
po::notify(vm);
}
catch ( boost::wrapexcept<po::required_option>& e ) {
std::cout << argv[0] << " requires a command, one of 'gen', 'fit', or 'simfit'\n"
<< "Append --help to those commands to see help on the related options" << std::endl;
parsedOK = kFALSE;
return;
}
catch ( po::validation_error& e ) {
std::cerr << e.what() << std::endl;
parsedOK = kFALSE;
return;
}
if ( vm.count("help") ) {
po::options_description help_desc;
help_desc.add(common_desc).add(gen_desc).add(fit_desc).add(simfit_desc);
std::cout << help_desc << std::endl;
helpRequested = kTRUE;
return;
}
+
+ if ( ! bkgndListStr.empty() ) {
+ const boost::char_separator<char> sep{","};
+ const boost::tokenizer<boost::char_separator<char>> tokens{bkgndListStr, sep};
+ for (const auto& t : tokens) {
+ bkgndList.insert( t );
+ }
+ }
}
diff --git a/examples/ProgOpts/Test_Dpipi_ProgOpts.hh b/examples/ProgOpts/Test_Dpipi_ProgOpts.hh
index 21227df..3641c4a 100644
--- a/examples/ProgOpts/Test_Dpipi_ProgOpts.hh
+++ b/examples/ProgOpts/Test_Dpipi_ProgOpts.hh
@@ -1,48 +1,52 @@
#ifndef TEST_DPIPI_PROGOPTS
#define TEST_DPIPI_PROGOPTS
#include "Rtypes.h"
#include "LauDecayTime.hh"
#include "LauTimeDepFitModel.hh"
#include "Command.hh"
+
+#include <set>
#include <string>
struct TestDpipi_ProgramSettings {
TestDpipi_ProgramSettings(const int argc, const char ** argv);
Bool_t parsedOK{kTRUE};
Bool_t helpRequested{kFALSE};
Command command{Command::Generate};
LauTimeDepFitModel::CPEigenvalue dType{LauTimeDepFitModel::CPEigenvalue::QFS};
LauDecayTime::EfficiencyMethod timeEffModel{LauDecayTime::EfficiencyMethod::Uniform};
UInt_t firstExptGen{0};
UInt_t nExptGen{1};
UInt_t firstExptFit{0};
UInt_t nExptFit{1};
UInt_t iFit{0};
UInt_t port{0};
UInt_t RNGseed{0};
Bool_t timeResolution{kTRUE};
Bool_t perEventTimeErr{kFALSE};
Bool_t fixLifetime{kTRUE};
Bool_t fixDeltaM{kTRUE};
Bool_t fixPhiMix{kFALSE};
Bool_t fixSplineKnots{kFALSE};
Bool_t useSinCos{kTRUE};
Bool_t useAveDeltaCalibVals{kTRUE};
Bool_t addTaggers{kTRUE};
Bool_t floatCalibPars{kTRUE};
Bool_t floatYields{kFALSE};
+ Bool_t fitBack{kFALSE};
+ std::string bkgndListStr{""};
std::string directory{""};
std::string fitBackInput{""};
- Bool_t fitBack{kFALSE};
- Bool_t sigOnly{kFALSE};
+
+ std::set<std::string> bkgndList;
};
#endif

File Metadata

Mime Type
text/x-diff
Expires
Sat, Dec 21, 3:41 PM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4023326
Default Alt Text
(10 KB)

Event Timeline