55 bool SendInfoUser(
const char * =
nullptr)
override {
return false; }
60 bool =
false)
override
68 long long millisec =
gSystem->Now();
102using namespace std::string_literals;
118 fWebWindow->SetDefaultPage(
"file:rootui5sys/tree/index.html");
129 fTimer = std::make_unique<RTreeDrawInvokeTimer>(10,
true, *
this);
152 fCfg.fExprCut.clear();
169 const TTree *tree = branch ? branch->
GetTree() :
nullptr;
171 if (!tree || (
fTree != tree))
174 if ((
const_cast<TBranch *
>(branch)->GetListOfBranches()->GetLast() < 0) && (branch->
GetNleaves() == 1)) {
175 std::string brname = branch->
GetName();
191 const TTree *tree = branch ? branch->
GetTree() :
nullptr;
193 if (!tree || (
fTree != tree))
207 if (!
fTree || expr.empty())
224 std::string user_args =
"";
231 if ((
fWebWindow->NumConnections(
true) == 0) || always_start_new_browser)
286 if (arg ==
"GETCFG"s) {
290 }
else if (arg ==
"QUIT_ROOT"s) {
294 }
if (arg.compare(0, 5,
"DRAW:"s) == 0) {
312 std::string res =
name;
314 std::string from =
"/";
315 std::string to =
"\\/";
317 size_t start_pos = 0;
318 while((start_pos = res.find(from, start_pos)) != std::string::npos) {
319 res.replace(start_pos, from.length(), to);
320 start_pos += to.length();
331 if (!branches || (branches->
GetLast() < 0))
334 TIter iter(branches);
336 while (
auto br =
dynamic_cast<TBranch *
>(iter())) {
338 auto leaves = br->GetListOfLeaves();
340 auto subbr = br->GetListOfBranches();
342 std::string brname = br->GetName();
344 TLeaf *leaf0 = (leaves->GetLast() == 0) ?
dynamic_cast<TLeaf *
>(leaves->At(0)) :
nullptr;
350 if ((subbr->GetLast() < 0) && leaf0 && (brname == leaf0->
GetName())) {
353 if (brelem && (brelem->GetStreamerType() < 1 || brelem->GetStreamerType() > 59))
361 while (
auto leaf =
dynamic_cast<TLeaf *
>(liter())) {
363 std::string leaffullname = leaf->GetFullName().Data();
366 if (brelem && brelem->GetStreamerType() ==
TStreamerInfo::kSTL && (leaves->GetLast() == 0) && (leaffullname == brfullname +
"_"))
369 fCfg.fBranches.emplace_back(
FormatItemName(leaffullname), leaf->GetTitle() +
" / "s + leaf->GetTypeName());
382 fCfg.fBranches.clear();
393 fCfg.fLargerStep =
fCfg.fTreeEntries/100;
394 if (
fCfg.fLargerStep < 2)
fCfg.fLargerStep = 2;
408 std::string expr =
fCfg.fExprX;
409 if (!
fCfg.fExprY.empty()) {
413 if (!
fCfg.fExprZ.empty()) {
434 std::string canv_name;
437 if ((expr.find(
'\\') != std::string::npos) || (expr.find(
'#') != std::string::npos)) {
438 auto FixTitle = [](
TNamed *obj) {
440 TString title = obj->GetTitle();
441 title.ReplaceAll(
"\\/",
"/");
442 title.ReplaceAll(
"#",
"\\#");
443 obj->SetTitle(title.Data());
446 while (
auto obj = iter()) {
447 if (expr == obj->GetTitle()) {
448 FixTitle(
dynamic_cast<TNamed *
> (obj));
449 TH1 *hist =
dynamic_cast<TH1 *
> (obj);
460 canv_name =
gPad->GetName();
473 std::string progress =
"100";
481 last = first +
fCfg.fNumber;
484 Double_t p = nevent / ( last - first + 0. ) * 100.;
485 if (p > 100) p = 100;
486 progress = std::to_string(p);
int Int_t
Signed integer 4 bytes (int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
double Double_t
Double 8 bytes.
externTVirtualMonitoringWriter * 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.
friend class RTreeDrawMonitoring
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
static Bool_t FromJSON(T *&obj, const char *json)
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
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
TTimer(const TTimer &)=delete
A TTree represents a columnar dataset.
static constexpr Long64_t kMaxEntries
Used as the max value for any TTree range operation.
TVirtualMonitoringWriter(const TVirtualMonitoringWriter &)=delete