|
TFile * | getFile (const std::string &file_name, const std::string &option="exist") |
| Get TFile pointer. More...
|
|
TDirectory * | getDirectory (const JRootObjectID &id) |
| Get TDirectory pointer. More...
|
|
TObject * | getObject (const JRootObjectID &id) |
| Get TObject. More...
|
|
bool | isTAttLine (const TObject *object) |
| Get drawing option of TH1. More...
|
|
Double_t | getResult (const TString &text, TObject *object=NULL) |
| Get result of given textual formula. More...
|
|
Double_t | getResult (const std::string &text, TObject *object=NULL) |
| Get result of given textual formula. More...
|
|
int | getParameter (const std::string &text) |
| Get parameter number from text string. More...
|
|
Double_t | getValue (const std::string &text, TObject *object=NULL) |
| Get parameter value from text string. More...
|
|
void | setLogarithm (TAxis *axis) |
| Make axis logarithmic (e.g. More...
|
|
void | convertToPDF (TH1 &h1, const std::string &option="NW", const double factor=1.0) |
| Convert 1D histogram to PDF. More...
|
|
void | convertToPDF (TH2 &h2, const std::string &option="NXYW", const double factor=1.0) |
| Convert 2D histogram to PDF. More...
|
|
void | setLimits (TGraph &g1) |
| Set limits of TGraph. More...
|
|
void | setLimits (TGraph2D &g2) |
| Set limits of TGraph2D. More...
|
|
void | setRange (double &xmin, double &xmax, const bool logx) |
| Set axis range. More...
|
|
void | setAxisLabels (TAxis *axis, const JModuleAddressMap &memo) |
| initialize axis with PMT address labels More...
|
|
Auxiliary applications for use of ROOT and more.
- Author
- mdejong
Double_t JGIZMO::getResult |
( |
const TString & |
text, |
|
|
TObject * |
object = NULL |
|
) |
| |
|
inline |
Get result of given textual formula.
The formula may contain names of member methods of the object pointed to. These methods should have no arguments and the return type Double_t
. Example:
getResult("1.0/GetEntries", TH1*);
- Parameters
-
text | text |
object | pointer to object |
- Returns
- value
Definition at line 212 of file JGizmoToolkit.hh.
214 TString buffer(
text);
216 if (
object != NULL) {
218 TClass* p = TClass::GetClass(object->ClassName());
222 TIterator* iter = p->GetListOfAllPublicMethods()->MakeIterator();
224 for (TMethod* method; (method = (TMethod*) iter->Next()) != NULL; ) {
226 for (Ssiz_t index; (index = buffer.Index(method->GetName())) != -1; ) {
228 const TRegexp fp(
"([^)]*)");
231 Ssiz_t pos = buffer.Index(fp, &len, index);
237 TMethodCall(p, method->GetName(), NULL).Execute(
object, value);
239 len = strlen(method->GetName());
241 }
else if (pos == index + (Ssiz_t) strlen(method->GetName())) {
243 TMethodCall(p, method->GetName(), NULL).Execute(
object, TString(buffer(pos + 1, len - 2)), value);
245 len += strlen(method->GetName());
252 buffer.Replace(index, len, TString::Format(
"%f", value));
258 return TFormula(
"/tmp", buffer.Data()).Eval(0.0);
Double_t JGIZMO::getValue |
( |
const std::string & |
text, |
|
|
TObject * |
object = NULL |
|
) |
| |
|
inline |
Get parameter value from text string.
The formula may contain names of member methods of the object pointed to. These methods should have no arguments and the return type Double_t
. Example:
getValue("p[..] = 2*GetMaximum", TH1*);
- Parameters
-
text | text |
object | pointer to object |
- Returns
- value
Definition at line 318 of file JGizmoToolkit.hh.
320 const char* regexp(
"=.*");
322 TString buffer(
text.c_str());
324 buffer = buffer(TRegexp(regexp));
325 buffer = buffer(1, buffer.Length() - 1);
327 return getResult(std::string(buffer),
object);