55 bool SendInfoUser(
const char * =
nullptr)
override {
return false; }
60 bool =
false)
override
102using namespace std::string_literals;
118 fWebWindow->SetDefaultPage(
"file:rootui5sys/tree/index.html");
129 fTimer = std::make_unique<RTreeDrawInvokeTimer>(10,
true, *
this);
168 const TTree *tree = branch ? branch->
GetTree() :
nullptr;
170 if (!tree || (
fTree != tree))
173 if ((
const_cast<TBranch *
>(branch)->GetListOfBranches()->GetLast() < 0) && (branch->
GetNleaves() == 1)) {
174 std::string brname = branch->
GetName();
190 const TTree *tree = branch ? branch->
GetTree() :
nullptr;
192 if (!tree || (
fTree != tree))
206 if (!
fTree || expr.empty())
223 std::string user_args =
"";
230 if ((
fWebWindow->NumConnections(
true) == 0) || always_start_new_browser)
285 if (arg ==
"GETCFG"s) {
289 }
else if (arg ==
"QUIT_ROOT"s) {
293 }
if (arg.compare(0, 5,
"DRAW:"s) == 0) {
297 auto newcfg = TBufferJSON::FromJSON<RConfig>(arg.substr(5));
311 std::string res =
name;
313 std::string from =
"/";
314 std::string to =
"\\/";
316 size_t start_pos = 0;
317 while((start_pos = res.find(from, start_pos)) != std::string::npos) {
318 res.replace(start_pos, from.length(), to);
319 start_pos += to.length();
330 if (!branches || (branches->
GetLast() < 0))
333 TIter iter(branches);
335 while (
auto br =
dynamic_cast<TBranch *
>(iter())) {
337 auto leaves = br->GetListOfLeaves();
339 auto subbr = br->GetListOfBranches();
341 std::string brname = br->GetName();
343 TLeaf *leaf0 = (leaves->GetLast() == 0) ?
dynamic_cast<TLeaf *
>(leaves->At(0)) :
nullptr;
349 if ((subbr->GetLast() < 0) && leaf0 && (brname == leaf0->
GetName())) {
352 if (brelem && (brelem->GetStreamerType() < 1 || brelem->GetStreamerType() > 59))
360 while (
auto leaf =
dynamic_cast<TLeaf *
>(liter())) {
362 std::string leaffullname = leaf->GetFullName().Data();
365 if (brelem && brelem->GetStreamerType() ==
TStreamerInfo::kSTL && (leaves->GetLast() == 0) && (leaffullname == brfullname +
"_"))
433 std::string canv_name;
436 if ((expr.find(
'\\') != std::string::npos) || (expr.find(
'#') != std::string::npos)) {
437 auto FixTitle = [](
TNamed *obj) {
439 TString title = obj->GetTitle();
442 obj->SetTitle(title.
Data());
445 while (
auto obj = iter()) {
446 if (expr == obj->GetTitle()) {
447 FixTitle(
dynamic_cast<TNamed *
> (obj));
448 TH1 *hist =
dynamic_cast<TH1 *
> (obj);
459 canv_name =
gPad->GetName();
472 std::string progress =
"100";
483 Double_t p = nevent / ( last - first + 0. ) * 100.;
484 if (
p > 100)
p = 100;
485 progress = std::to_string(
p);
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char mode
R__EXTERN TSystem * gSystem
R__EXTERN TVirtualMonitoringWriter * gMonitoringWriter
void Timeout() override
timeout handler used to process postponed requests in main ROOT thread
RTreeDrawInvokeTimer(Long_t milliSec, bool mode, RTreeViewer &viewer)
constructor
RTreeDrawMonitoring(Int_t period, RTreeViewer &viewer)
long long fLastProgressSendTm
RTreeDrawMonitoring & operator=(const RTreeDrawMonitoring &)=delete
bool SendFileReadProgress(TFile *) override
RTreeDrawMonitoring(const RTreeDrawMonitoring &)=delete
bool SendInfoUser(const char *=nullptr) override
void SetLogLevel(const char *="WARNING") override
bool SendParameters(TList *, const char *=nullptr) override
bool SendFileOpenProgress(TFile *, TList *, const char *, bool=false) override
bool SendProcessingStatus(const char *, bool=false) override
bool SendProcessingProgress(Double_t nevent, Double_t, bool=false) override
bool SendFileWriteProgress(TFile *) override
void Verbose(bool) override
bool SendInfoDescription(const char *) override
bool SendFileCloseEvent(TFile *) override
bool SendInfoStatus(const char *) override
bool SendInfoTime() override
Web-based ROOT TTree viewer.
std::unique_ptr< RTreeDrawInvokeTimer > fTimer
! timer to invoke tree draw
void Show(const RWebDisplayArgs &args="", bool always_start_new_browser=false)
Show or update viewer in web window If web browser already started - just refresh drawing like "reloa...
void SendProgress(Double_t nevent=0.)
Send progress to the client.
void UpdateConfig()
Update RConfig data.
std::string FormatItemName(const std::string &name)
Format item name used in draw expression.
void InvokeTreeDraw()
Invoke tree drawing.
bool SuggestLeaf(const TLeaf *leaf)
Suggest to use leaf in the gui Normally just assign as last edited expression.
void SetTree(TTree *tree)
assign new TTree to the viewer
std::string GetWindowAddr() const
Return address of web window used for tree viewer.
std::string GetWindowUrl(bool remote)
Return URL of web window used for tree viewer See ROOT::RWebWindow::GetUrl docu for more details.
std::string fLastSendProgress
! last send progress to client
PerformDrawCallback_t fCallback
! callback invoked when tree draw performed
void Update()
Update tree viewer in all web displays.
std::shared_ptr< ROOT::RWebWindow > fWebWindow
! web window
static RTreeViewer * NewViewer(TTree *)
Create new viewer Method used for plugin.
void SendCfg(unsigned connid)
Send data for initialize viewer.
bool SuggestExpression(const std::string &expr)
Suggest to use expression in the gui Normally just assign as last edited expression.
virtual ~RTreeViewer()
destructor
void WebWindowConnect(unsigned connid)
react on new connection
bool GetShowHierarchy() const
Returns default hierarchy browser visibility.
TTree * fTree
! TTree to show
void AddBranches(TObjArray *branches)
Add branches to config.
void WebWindowCallback(unsigned connid, const std::string &arg)
receive data from client
RConfig fCfg
! configuration, exchanged between client and server
RTreeViewer(TTree *tree=nullptr)
constructor
bool SuggestBranch(const TBranch *branch)
Suggest to use branch in the gui Normally just assign as last edited expression.
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
const std::string & GetWidgetKind() const
returns widget kind
static std::shared_ptr< RWebWindow > Create()
Create new RWebWindow Using default RWebWindowsManager.
A Branch for the case of an object.
TString GetFullName() const override
Return the 'full' name of the branch.
A TTree is a list of TBranches.
virtual TString GetFullName() const
Return the 'full' name of the branch.
static TString ToJSON(const T *obj, Int_t compact=0, const char *member_name=nullptr)
@ kSkipTypeInfo
do not store typenames in JSON
@ kNoSpaces
no new lines plus remove all spaces around "," and ":" symbols
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
TH1 is the base class of all histogram classes in ROOT.
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
virtual const char * GetTypeName() const
TBranch * GetBranch() const
virtual TString GetFullName() const
Return the full name (including the parent's branch names) of the leaf.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
Int_t GetLast() const override
Return index of last object in array.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Handles synchronous and a-synchronous timer events.
A TTree represents a columnar dataset.
void Draw(Option_t *opt) override
Default Draw method for all objects.
virtual Long64_t GetEntries() const
virtual TObjArray * GetListOfBranches()
static constexpr Long64_t kMaxEntries
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
std::vector< RBranchInfo > fBranches