Changeset 19886 for trunk/FACT++


Ignore:
Timestamp:
12/11/19 20:39:31 (5 years ago)
Author:
tbretz
Message:
Added descriptions to command line options, respect verbose=0
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/spectrum.cc

    r19882 r19886  
    130130#endif
    131131         , "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].")
    132         ("out,o",            var<string>(conf.GetName()), "")
     132        ("out,o",            var<string>(conf.GetName()), "Defines the prefix (with path) of the output files.")
    133133        ("dry-run",          po_switch(),   "Only write the queries to the query.log file. Internally overwrites uri with an empty string.")
    134134        ;
     
    136136    po::options_description binnings("Binnings");
    137137    binnings.add_options()
    138         ("theta",            var<Binning>(Binning(90, 0, 90)),   "")
    139         ("theta-bin",        vars<double>(),                     "")
    140         ("esim",             var<Binning>(Binning(15, 2, 5)),    "")
    141         ("esim-bin",         vars<double>(),                     "")
    142         ("eest",             var<Binning>(Binning(15, 2, 5)),    "")
    143         ("eest-bin",         vars<double>(),                     "")
     138        ("theta",     var<Binning>(Binning(90, 0, 90)), "Add equidistant bins in theta (degrees). Syntax: N,lo,hi (Number N of equidistant bins between lo and hi)")
     139        ("theta-bin", vars<double>(),                   "Add a bin-edge to the theta binning (degree)")
     140        ("esim",      var<Binning>(Binning(15, 2, 5)),  "Add equidistant bins in log10 simulated energy. Syntax: N,lo,hi (Number N of equidistant bins between lo and hi)")
     141        ("esim-bin",  vars<double>(),                   "Add a bin-edge to the binnnig in log10 simulated enegry")
     142        ("eest",      var<Binning>(Binning(15, 2, 5)),  "Add equidistant bins in log10 estimated energy. Syntax: N,lo,hi (Number N of equidistant bins between lo and hi)")
     143        ("eest-bin",  vars<double>(),                   "Add a bin-edge to the binning in log10 estimated enegry")
    144144        ;
    145145
    146146    po::options_description queries("Queries");
    147147    queries.add_options()
    148         ("analysis",    var<string>("analysis.sql"),   "")
    149         ("data",        var<string>("data.sql"),       "")
    150         ("simulation",  var<string>("simulation.sql"), "")
     148        ("analysis",    var<string>("analysis.sql"),   "File with the analysis query. A default file is created automatically in the <prefix> directory it does not exist.")
     149        ("data",        var<string>("data.sql"),       "File with the query which creates the data summary. A default file is created automatically in the <prefix> directory it does not exist.")
     150        ("simulation",  var<string>("simulation.sql"), "File with the query which creates the simulation summary. A default file is created automatically in the <prefix> directory it does not exist.")
    151151        ;
    152152
    153153    po::options_description preparation("Preparation");
    154154    preparation.add_options()
    155         ("source-key", var<uint16_t>(5),          "")
    156         ("selector",   vars<string>(),            "")
    157         ("estimator",  var<string>()->required(), "")
    158         ("spectrum",   var<string>()->required(), "")
    159         ("env.*",      var<string>(),             "")
     155        ("source-key", var<uint16_t>(5),          "Source key to be used in file selection.")
     156        ("selector",   vars<string>(),            "WHERE clause to be used in file selection.")
     157        ("estimator",  var<string>()->required(), "Energy estimator to be used.")
     158        ("spectrum",   var<string>()->required(), "Spectral shape for re-weighting of simulated 'Energy'")
     159        ("env.*",      var<string>(),             "Define a variable that is replaced in all queries automatically.")
    160160        ;
    161161
     
    163163    debug.add_options()
    164164        ("print-connection", po_switch(),       "Print database connection information")
    165         ("print-queries",    po_switch(),       "")
     165#ifdef HAVE_HIGHLIGHT
     166        ("print-queries",    po_switch(),       "Print all queries to the console. They are automatically highlighted.")
     167#else
     168        ("print-queries",    po_switch(),       "Print all queries to the console. (For highlighting recompile with 'libsource-highlight-dev' installed)")
     169#endif
    166170        ("verbose,v",        var<uint16_t>(1),  "Verbosity (0: quiet, 1: default, 2: more, 3, ...)")
    167171        ;
     
    567571    Binning binning_eest  = conf.Get<Binning>("eest");
    568572
    569     cout << "B\"theta\": " << binning_theta.str() << endl;
    570     cout << "B\"esim\":  " << binning_esim.str()  << endl;
    571     cout << "B\"eest\":  " << binning_eest.str()  << endl;
     573    cout << '\n';
     574    cout << "Binning 'theta': " << binning_theta.str() << endl;
     575    cout << "Binning 'Esim':  " << binning_esim.str()  << endl;
     576    cout << "Binning 'Eest':  " << binning_eest.str()  << endl;
    572577
    573578    const uint16_t source_key = conf.Get<uint16_t>("source-key");
     
    10281033
    10291034
    1030         const mysqlpp::StoreQueryResult res4 = connection.query("SELECT * FROM ThetaHist").store();
    1031 
    1032         cout << "  Bin   MC Counts     OnTime ZdWeight\n";
    1033         const auto bins = binning_theta.vec();
    1034         for (auto ir=res4.cbegin(); ir!=res4.cend(); ir++)
     1035        if (verbose>0)
    10351036        {
    1036             const mysqlpp::Row &row = *ir;
    1037 
    1038             const uint32_t bin = row[".theta"];
    1039             cout << setw(5) << bins[bin] << ": " << setw(10) << row["CountN"] << " " << setw(10) << row["OnTime"] << " " << setw(10) << row["ZdWeight"] << '\n';
     1037            const mysqlpp::StoreQueryResult res4 = connection.query("SELECT * FROM ThetaHist").store();
     1038
     1039            cout << "  Bin   MC Counts     OnTime ZdWeight\n";
     1040            const auto bins = binning_theta.vec();
     1041            for (auto ir=res4.cbegin(); ir!=res4.cend(); ir++)
     1042            {
     1043                const mysqlpp::Row &row = *ir;
     1044
     1045                const uint32_t bin = row[".theta"];
     1046                cout << setw(5) << bins[bin] << ": " << setw(10) << row["CountN"] << " " << setw(10) << row["OnTime"] << " " << setw(10) << row["ZdWeight"] << '\n';
     1047            }
     1048            cout << endl;
    10401049        }
    1041         cout << endl;
    10421050    }
    10431051
     
    11421150        cout << "Execution time: " << sec5 << "s\n";
    11431151
    1144 
    1145         const mysqlpp::StoreQueryResult res5 = connection.query("SELECT * FROM AnalysisData").store();
    1146 
    1147         cout << "       Bin     Signal   Background   Excess   Significance   Error" << endl;
    1148         for (auto row=res5.cbegin(); row!=res5.cend(); row++)
     1152        if (verbose>0)
    11491153        {
    1150             for (auto it=row->begin(); it!=row->end(); it++)
    1151                 cout << setw(10) << *it << " ";
    1152             cout << '\n';
     1154            const mysqlpp::StoreQueryResult res5 = connection.query("SELECT * FROM AnalysisData").store();
     1155
     1156            cout << "       Bin     Signal   Background   Excess   Significance   Error" << endl;
     1157            for (auto row=res5.cbegin(); row!=res5.cend(); row++)
     1158            {
     1159                for (auto it=row->begin(); it!=row->end(); it++)
     1160                    cout << setw(10) << *it << " ";
     1161                cout << '\n';
     1162            }
     1163            cout << endl;
    11531164        }
    1154         cout << endl;
    11551165    }
    11561166
     
    12981308
    12991309
    1300         const mysqlpp::StoreQueryResult res7 = connection.query("SELECT * FROM SimulatedSpectrum").store();
    1301 
    1302         //cout << "Received rows: " << res7.num_rows() << '\n' << endl;
    1303 
    1304         //       123456789|123456789|123456789|123456789|123456789|123456789|123456789
    1305         cout << "       Bin CountW           CountW2" << endl;
    1306         const auto bins = binning_esim.vec();
    1307         for (auto ir=res7.cbegin(); ir!=res7.cend(); ir++)
     1310        if (verbose>0)
    13081311        {
    1309             const mysqlpp::Row &row = *ir;
    1310 
    1311             const uint32_t bin = row[".energy"];
    1312             cout << setw(5) << bins[bin] << ": " << setw(10) << row["CountW"] << " " << setw(10) << row["CountW2"] << '\n';
     1312            const mysqlpp::StoreQueryResult res7 = connection.query("SELECT * FROM SimulatedSpectrum").store();
     1313
     1314            cout << "       Bin CountW           CountW2" << endl;
     1315            const auto bins = binning_esim.vec();
     1316            for (auto ir=res7.cbegin(); ir!=res7.cend(); ir++)
     1317            {
     1318                const mysqlpp::Row &row = *ir;
     1319
     1320                const uint32_t bin = row[".energy"];
     1321                cout << setw(5) << bins[bin] << ": " << setw(10) << row["CountW"] << " " << setw(10) << row["CountW2"] << '\n';
     1322            }
     1323            cout << endl;
    13131324        }
    1314         cout << endl;
    13151325    }
    13161326
     
    14631473        const mysqlpp::StoreQueryResult res8 = connection.query("SELECT * FROM Spectrum").store();
    14641474
    1465         cout << "  Bin  Flux                   Error" << endl;
    1466         const auto bins = binning_eest.vec();
    1467         for (auto ir=res8.cbegin(); ir!=res8.cend(); ir++)
     1475        if (verbose>0)
    14681476        {
    1469             const mysqlpp::Row &row = *ir;
    1470 
    1471             const uint32_t bin = row[".energy"];
    1472             cout << setw(5) << bins[bin] << ": " << setw(10) << row["Flux"] << " " << setw(10) << row["ErrFlux"] << '\n';
     1477            cout << "  Bin  Flux                   Error" << endl;
     1478            const auto bins = binning_eest.vec();
     1479            for (auto ir=res8.cbegin(); ir!=res8.cend(); ir++)
     1480            {
     1481                const mysqlpp::Row &row = *ir;
     1482
     1483                const uint32_t bin = row[".energy"];
     1484                cout << setw(5) << bins[bin] << ": " << setw(10) << row["Flux"] << " " << setw(10) << row["ErrFlux"] << '\n';
     1485            }
     1486            cout << endl;
    14731487        }
    1474         cout << endl;
    14751488
    14761489        // --------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.