New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow controls unit transformations #151
Slow controls unit transformations #151
Conversation
…ormula in otsdaq/FECore/FEVInterface.cc.
…olsChannel.cc and otsdaq/FECore/FESlowControlsChannel.hh.
…q/FECore/FEVInterface.cc.
otsdaq/FECore/FEVInterface.cc
Outdated
try { | ||
transformation = groupLinkChild.second.getNode("Transformation").getValue<std::string>(); | ||
} catch (...) { | ||
__FE_COUT__ << "Slow controls 'Transformation' setting found." << __E__; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be "setting not found" instead of "setting found"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting that, it's fixed now.
…nger than a bare 'x'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - thanks!
__FE_COUT__ << "Transformation formula = " <<channel->transformation_ << __E__; | ||
|
||
TFormula transformationFormula("transformationFormula", (channel->transformation_).c_str()); | ||
double transformedVal = transformationFormula.Eval(val); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a good idea to check for NaN here, instead of just reporting the value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an isnan
check for transformedVal
, which throws a COUT_ERR
if it fails.
…nt/slowControlsUnitTransforms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me - thanks!
Implemented unit conversions for slow controls parameters using
ROOT
(TFormula
). The transformation formula is defined inFESlowControlsTable
, and the transformation is applied inFEVInterface.cc
-- just before the value is sent to the metrics manager.I have used this to read transformed values back through both
Graphite/Grafana
andEPICS
.Note: due to the way that ROOT interprets formulas as strings, the variable in the transformation formula must be an
"x"
, e.g."2*x+1"
. I have set"x"
to be the default formula in the table.