12 "The \"BINNING\" statement defines adaptive binning parameters."),
13 parameterName_m(
"VELOCITYZ"),
17 "The maximum number of bins used for adaptive binning. "
23 "A bias [0, 1] that tries to steer the bin size to the given variable. "
29 "A value [0, 1] that determines how aggressive the algorithm tries to "
30 "reduce the number of bins. Default: 1.0.",
35 "A value [0, 1] that determines how aggressive the algorithm tries to "
36 "use wider bins. Default: 1.5.",
40 "PARAMETER",
"The bunch attribute used for binning.",
41 {
"VELOCITYZ",
"POSITIONZ",
"PZ",
"GAMMAZ"},
"VELOCITYZ");
45 "If true, merge the initial uniform bins using the adaptive binning algorithm. "
46 "If false, keep the uniform MAXBINS histogram. Default: true.",
51 "The json file name for dumping bin configuration to a file. Default: \"NONE\" (no "
56 "DUMPBINSFREQ",
"The frequency in timesteps of dumping bins to a file. Default: 1.", 1);
60 "The frequency in global timesteps of printing bin statistics to console. "
61 "If 0, printing is disabled. Default: 10.",
67 parameterName_m(parent->parameterName_m),
68 parameterType_m(parent->parameterType_m) {}
78 throw OpalException(
"BinningCmd::find()",
"BinningCmd \"" + name +
"\" not found.");
100 if (!filename.empty() && filename !=
"NONE") {
102 const std::string extension =
".json";
103 if (filename.size() < extension.size()
104 || filename.substr(filename.size() - extension.size()) != extension) {
105 filename += extension;
113 "BinningCmd::update",
114 "DUMPBINSFREQ must be >= 1 when DUMPBINSFILE is set.");
123 throw OpalException(
"BinningCmd::update",
"TABLEPRINTFREQ must be >= 0.");
132 static const std::map<std::string, BinningParameter> stringToParam = {
139 if (it == stringToParam.end()) {
141 "BinningCmd::setParameterType",
149 os <<
"* ************* B I N N I N G ****************************************************** "
163 os <<
"* ********************************************************************************** "
201 "BinningCmd::getDumpBinsFrequency",
202 "DUMPBINSFREQ must be >= 1 if dumping bins to a file.");
210 throw OpalException(
"BinningCmd::getTablePrintFrequency",
"TABLEPRINTFREQ must be >= 0.");
217 return !filename.empty() && filename !=
"NONE";
BinningParameter
The parameter that is used for binning.
double getDesiredWidth() const
void setParameterType()
Recompute the enum-valued parameter from the string attribute.
int getDumpBinsFrequency() const
Get the frequency of dumping bins to a file.
double getBinningAlpha() const
virtual void update()
Update the binning data (internal cache of attributes).
int getTablePrintFrequency() const
bool getAdaptiveBinning() const
BinningParameter getParameterType() const
bool dumpBinsToFile() const
Check if dumping bins to a file is enabled.
virtual void execute()
Execute the BINNING command (currently a thin wrapper around update()).
std::string getParameter()
BinningParameter parameterType_m
virtual BinningCmd * clone(const std::string &name)
Make clone.
static BinningCmd * find(const std::string &name)
Find named BINNING command.
std::string getDumpBinsFileName() const
Get the file name for dumping bins to a file.
std::string parameterName_m
double getBinningBeta() const
Inform & printInfo(Inform &os) const
BinningCmd()
Exemplar constructor.
The base class for all OPAL definitions.
const std::string & getOpalName() const
Return object name.
std::vector< Attribute > itsAttr
The object attributes.
Object * find(const std::string &name)
Find entry.
static OpalData * getInstance()
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
double getReal(const Attribute &attr)
Return real value.
Attribute makePredefinedString(const std::string &name, const std::string &help, const std::initializer_list< std::string > &predefinedStrings)
Make predefined string attribute.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
void setString(Attribute &attr, const std::string &val)
Set string value.
bool getBool(const Attribute &attr)
Return logical value.
std::string getString(const Attribute &attr)
Get string value.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.