8#include <display/ObjectInfo.h>
10#include <framework/logging/Logger.h>
11#include <framework/datastore/RelationsObject.h>
12#include <framework/utilities/HTML.h>
14#include <genfit/GFRaveVertex.h>
20#include <TInterpreter.h>
25 std::string callStringMethod(
const TObject* obj,
const char* name)
28 TClass* cl = obj->IsA();
33 TMethod* m = cl->GetMethod(name,
"",
true);
35 if (m->GetReturnTypeName() != std::string(
"string"))
36 B2WARNING(cl->GetName() <<
"::" << name <<
" has return type " << m->GetReturnTypeName() <<
37 " instead of std::string, cannot show info.");
39 gInterpreter->ExecuteWithArgsAndReturn(m, (
void*)obj, 0, 0, &str);
48 B2ERROR(
"ObjectInfo::getName() got null?");
50 return relObj->getName();
52 return callStringMethod(obj,
"getName");
58 B2ERROR(
"ObjectInfo::getInfo() got null?");
60 return relObj->getInfoHTML();
61 }
else if (
auto vertex =
dynamic_cast<const genfit::GFRaveVertex*
>(obj)) {
62 return "<b>V</b>=" +
HTML::getString(ROOT::Math::XYZVector(vertex->getPos())) +
"<br>" +
63 TString::Format(
"pVal=%e", TMath::Prob(vertex->getChi2(), vertex->getNdf()));
65 return callStringMethod(obj,
"getInfoHTML");
71 const TString& name =
getName(obj);
72 if (name.Length() != 0)
83 name = relObj->getArrayName();
84 index = relObj->getArrayIndex();
95 if (pair.second.object == obj) {
96 name = pair.second.name;
102 return std::make_pair(name, index);
108 if (pos.second != -1)
109 return TString::Format(
"%s[%d]", pos.first.c_str(), pos.second);
bool findStoreEntry(const TObject *object, StoreEntry *&entry, int &index)
Find an object in an array in the data store.
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
static DataStore & Instance()
Instance of singleton Store.
Defines interface for accessing relations of objects in StoreArray.
std::string getString(const TMatrixFBase &matrix, int precision=2, bool color=true)
get HTML table representing a matrix.
std::string htmlToPlainText(const std::string &html)
Reformat given HTML string into terminal-friendly plain text.
TString getName(const TObject *obj)
human-readable name (e.g.
TString getIdentifier(const TObject *obj)
Where is this object in the datastore?
std::pair< std::string, int > getDataStorePosition(const TObject *obj)
return entry name & index for arrays, with index = -1 for objects.
TString getInfo(const TObject *obj)
Get object info HTML (e.g.
TString getTitle(const TObject *obj)
Get plain text for TEve object titles (shown on mouse-over).
Abstract base class for different kinds of events.
Wraps a stored array/object, stored under unique (name, durability) key.
std::string name
Name of the entry.