11 #include <mva/interface/Options.h>
12 #include <boost/property_tree/ptree.hpp>
23 po::options_description description(
"General options");
24 description.add_options()
25 (
"help",
"print this message")
26 (
"datafiles", po::value<std::vector<std::string>>(&
m_datafiles)->required()->multitoken(),
27 "ROOT files containing the training dataset")
28 (
"treename", po::value<std::string>(&
m_treename),
"Name of tree in ROOT datafile")
29 (
"identifier", po::value<std::string>(&
m_identifier)->required(),
"Identifier of the outputted weightfile")
30 (
"variables", po::value<std::vector<std::string>>(&
m_variables)->required()->multitoken(),
31 "feature variables used in the training")
32 (
"spectators", po::value<std::vector<std::string>>(&
m_spectators)->multitoken(),
33 "spectator variables used in the training")
35 "target variable used to distinguish between signal and background, isSignal is used as default.")
36 (
"signal_class", po::value<int>(&
m_signal_class),
"integer which identifies signal events")
37 (
"weight_variable", po::value<std::string>(&
m_weight_variable),
"weight variable used to weight each event")
38 (
"max_events", po::value<unsigned int>(&
m_max_events),
"maximum number of events to process, 0 means all")
39 (
"method", po::value<std::string>(&
m_method)->required(),
40 "MVA Method [FastBDT|TMVAClassification|TMVARegression|Python|FANN|]");
46 m_method = pt.get<std::string>(
"method");
54 unsigned int numberOfFiles = pt.get<
unsigned int>(
"number_data_files", 0);
56 for (
unsigned int i = 0; i < numberOfFiles; ++i) {
57 m_datafiles[i] = pt.get<std::string>(std::string(
"datafile") + std::to_string(i));
60 unsigned int numberOfSpectators = pt.get<
unsigned int>(
"number_spectator_variables", 0u);
62 for (
unsigned int i = 0; i < numberOfSpectators; ++i) {
63 m_spectators[i] = pt.get<std::string>(std::string(
"spectator") + std::to_string(i));
66 auto numberOfFeatures = pt.get<
unsigned int>(
"number_feature_variables");
68 for (
unsigned int i = 0; i < numberOfFeatures; ++i) {
69 m_variables[i] = pt.get<std::string>(std::string(
"variable") + std::to_string(i));
83 pt.put(
"number_feature_variables",
m_variables.size());
84 for (
unsigned int i = 0; i <
m_variables.size(); ++i) {
85 pt.put(std::string(
"variable") + std::to_string(i),
m_variables[i]);
88 pt.put(
"number_spectator_variables",
m_spectators.size());
90 pt.put(std::string(
"spectator") + std::to_string(i),
m_spectators[i]);
94 for (
unsigned int i = 0; i <
m_datafiles.size(); ++i) {
95 pt.put(std::string(
"datafile") + std::to_string(i),
m_datafiles[i]);
101 po::options_description description(
"Meta options");
102 description.add_options()
103 (
"use_splot", po::value<bool>(&
m_use_splot),
"whether to do an splot training")
104 (
"splot_variable", po::value<std::string>(&
m_splot_variable),
"Variable used as discriminating variable in sPlot training")
105 (
"splot_mc_files", po::value<std::vector<std::string>>(&
m_splot_mc_files)->multitoken(),
106 "Monte carlo files containing the discriminant variable with the mc truth")
107 (
"splot_combined", po::value<bool>(&
m_splot_combined),
"Combine sPlot training with PDF classifier for discriminating variable")
108 (
"splot_boosted", po::value<bool>(&
m_splot_boosted),
"Use boosted sPlot training (aPlot)")
110 (
"sideband_mc_files", po::value<std::vector<std::string>>(&
m_sideband_mc_files)->multitoken(),
111 "Monte carlo files used to estimate the number of events in the different regions. (Must contain the same signal / background distribution as is expected in data)")
113 "Variable defining the signal region (1) background region (2) negative signal region (3) or unused (otherwise) for the sideband substraction")
114 (
"use_reweighting", po::value<bool>(&
m_use_reweighting),
"whether to do a reweighting pre training")
116 "Variable defining for which events the reweighting should be used (1) or not used (0). If empty the reweighting is applied to all events")
118 "Identifier used to save the reweighting expert.")
120 "Monte carlo files for the reweighting pretraining (Must contain the same luminosity as the given data files)")
122 "Data files for the reweighting pretraining (Must contain the same luminosity as the given MC files)");
133 unsigned int splot_number_of_mc_files = pt.get<
unsigned int>(
"splot_number_of_mc_files", 0);
135 for (
unsigned int i = 0; i < splot_number_of_mc_files; ++i) {
136 m_splot_mc_files[i] = pt.get<std::string>(std::string(
"splot_mc_file") + std::to_string(i));
142 unsigned int sideband_number_of_mc_files = pt.get<
unsigned int>(
"sideband_number_of_mc_files", 0);
144 for (
unsigned int i = 0; i < sideband_number_of_mc_files; ++i) {
145 m_sideband_mc_files[i] = pt.get<std::string>(std::string(
"sideband_mc_file") + std::to_string(i));
152 unsigned int reweighting_number_of_mc_files = pt.get<
unsigned int>(
"reweighting_number_of_mc_files", 0);
154 for (
unsigned int i = 0; i < reweighting_number_of_mc_files; ++i) {
158 unsigned int reweighting_number_of_data_files = pt.get<
unsigned int>(
"reweighting_number_of_data_files", 0);
160 for (
unsigned int i = 0; i < reweighting_number_of_data_files; ++i) {
175 pt.put(std::string(
"splot_mc_file") + std::to_string(i),
m_splot_mc_files[i]);