102using namespace std::string_literals;
111 fWebWindow->SetDefaultPage(
"file:rootui5sys/tree/index.html");
122 fTimer = std::make_unique<RTreeDrawInvokeTimer>(10,
kTRUE, *
this);
166 if ((
const_cast<TBranch *
>(branch)->GetListOfBranches()->GetLast() < 0) && (branch->
GetNleaves() == 1)) {
167 std::string brname = branch->
GetName();
199 if (!
fTree || expr.empty())
216 std::string user_args =
"";
223 if ((
fWebWindow->NumConnections(
true) == 0) || always_start_new_browser)
269 if (arg ==
"GETCFG"s) {
273 }
else if (arg ==
"QUIT_ROOT"s) {
277 }
if (arg.compare(0, 5,
"DRAW:"s) == 0) {
281 auto newcfg = TBufferJSON::FromJSON<RConfig>(arg.substr(5));
295 std::string res =
name;
297 std::string from =
"/";
298 std::string to =
"\\/";
300 size_t start_pos = 0;
301 while((start_pos = res.find(from, start_pos)) != std::string::npos) {
302 res.replace(start_pos, from.length(), to);
303 start_pos += to.length();
314 if (!branches || (branches->
GetLast() < 0))
317 TIter iter(branches);
319 while (
auto br =
dynamic_cast<TBranch *
>(iter())) {
321 auto leaves = br->GetListOfLeaves();
323 auto subbr = br->GetListOfBranches();
325 std::string brname = br->GetName();
327 TLeaf *leaf0 = (leaves->GetLast() == 0) ?
dynamic_cast<TLeaf *
>(leaves->At(0)) :
nullptr;
333 if ((subbr->GetLast() < 0) && leaf0 && (brname == leaf0->
GetName())) {
336 if (brelem && (brelem->GetStreamerType() < 1 || brelem->GetStreamerType() > 59))
344 while (
auto leaf =
dynamic_cast<TLeaf *
>(liter())) {
346 std::string leaffullname = leaf->GetFullName().Data();
349 if (brelem && brelem->GetStreamerType() ==
TStreamerInfo::kSTL && (leaves->GetLast() == 0) && (leaffullname == brfullname +
"_"))
417 std::string canv_name;
420 if ((expr.find(
"\\") != std::string::npos) || (expr.find(
"#") != std::string::npos)) {
421 auto FixTitle = [](
TNamed *obj) {
423 TString title = obj->GetTitle();
426 obj->SetTitle(title.
Data());
429 while (
auto obj = iter()) {
430 if (expr == obj->GetTitle()) {
431 FixTitle(
dynamic_cast<TNamed *
> (obj));
432 TH1 *hist =
dynamic_cast<TH1 *
> (obj);
443 canv_name =
gPad->GetName();
456 std::string progress =
"100";
468 if (
p > 100)
p = 100;
469 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_t mode, RTreeViewer &viewer)
constructor
Bool_t SendFileCloseEvent(TFile *) override
Bool_t SendProcessingProgress(Double_t nevent, Double_t, Bool_t=kFALSE) override
Bool_t SendFileOpenProgress(TFile *, TList *, const char *, Bool_t=kFALSE) override
RTreeDrawMonitoring(Int_t period, RTreeViewer &viewer)
long long fLastProgressSendTm
RTreeDrawMonitoring & operator=(const RTreeDrawMonitoring &)=delete
RTreeDrawMonitoring(const RTreeDrawMonitoring &)=delete
Bool_t SendInfoTime() override
void SetLogLevel(const char *="WARNING") override
Bool_t SendFileWriteProgress(TFile *) override
Bool_t SendProcessingStatus(const char *, Bool_t=kFALSE) override
Bool_t SendInfoUser(const char *=nullptr) override
Bool_t SendInfoDescription(const char *) override
Bool_t SendInfoStatus(const char *) override
Bool_t SendFileReadProgress(TFile *) override
void Verbose(Bool_t) override
Bool_t SendParameters(TList *, const char *=nullptr) override
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 URL address of web window used for tree viewer.
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 composed of a header, followed by consecutive data records (TKey instances) with a wel...
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
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
std::vector< RBranchInfo > fBranches