9 class HtmlObjTable :
public TObject 29 virtual ~HtmlObjTable();
31 void SetLabel(
Int_t col,
const char *label) { fLabels[col] = label; }
33 TString Html()
const {
return fHtml; }
54 HtmlSummary(
const char *title);
55 virtual ~HtmlSummary();
57 HtmlObjTable *AddTable(
const char *
name,
Int_t nfields,
Int_t nvals,
59 HtmlObjTable *GetTable(
Int_t at)
const {
return (HtmlObjTable *)fObjTables->
At(at); }
63 TString Html()
const {
return fHtml; }
70 HtmlSummary *fgHtmlSummary = 0;
77 fName(name), fNValues(nvals), fNFields(nfields), fExpand(exp)
81 fValues =
new TArrayF[fNFields];
82 for (
int i=0;i<fNFields;i++)
83 fValues[i].Set(nvals);
84 fLabels =
new TString[fNFields];
88 HtmlObjTable::~HtmlObjTable()
97 void HtmlObjTable::Build()
101 fHtml =
"<table width=100% border=1 cellspacing=0 cellpadding=0 bgcolor=f0f0f0> ",
104 if (fExpand && (fNFields > 0) && (fNValues > 0)) {
113 void HtmlObjTable::BuildTitle()
117 fHtml +=
"<tr><td colspan=";
118 fHtml +=
Form(
"%d>", fNFields+1);
119 fHtml +=
"<table width=100% border=0 cellspacing=2 cellpadding=0 bgcolor=6e6ea0>";
120 fHtml +=
"<tr><td align=left>";
121 fHtml +=
"<font face=Verdana size=3 color=ffffff><b><i>";
123 fHtml +=
"</i></b></font></td>";
125 fHtml +=
"<td align=right> ";
126 fHtml +=
"<font face=Verdana size=3 color=ffffff><b><i>";
127 fHtml +=
Form(
"Size = %d", fNValues);
128 fHtml +=
"</i></b></font></td></tr>";
130 fHtml +=
"</td></tr>";
134 void HtmlObjTable::BuildLabels()
139 fHtml +=
"<tr bgcolor=c0c0ff>";
140 fHtml +=
"<th> </th>";
141 for (i=0;i<fNFields;i++) {
150 void HtmlObjTable::BuildTable()
154 for (
int i = 0; i < fNValues; i++) {
156 fHtml +=
"<tr bgcolor=e0e0ff>";
158 fHtml +=
"<tr bgcolor=ffffff>";
163 fHtml +=
"<td bgcolor=d0d0ff align=\"center\">";
164 fHtml +=
"<input type=\"checkbox\" name=\"";
166 fHtml +=
Form(
"[%d]\">",i);
169 for (
int j = 0; j < fNFields; j++) {
170 fHtml +=
"<td width=";
171 fHtml +=
Form(
"%d%%", 100/fNFields);
172 fHtml +=
" align=\"center\"";
174 fHtml +=
Form(
"%1.4f", fValues[j][i]);
182 HtmlSummary::HtmlSummary(
const char *title) : fNTables(0), fTitle(title)
190 HtmlSummary::~HtmlSummary()
198 HtmlObjTable *HtmlSummary::AddTable(
const char *name,
Int_t nfields,
Int_t nvals,
205 HtmlObjTable *table =
new HtmlObjTable(name, nfields, nvals, exp);
210 fObjTables->
Add(table);
215 void HtmlSummary::Clear(
Option_t *option)
219 if (option && option[0] ==
'D')
220 fObjTables->
Delete(option);
222 fObjTables->
Clear(option);
231 delete fObjTables; fObjTables = 0;
236 void HtmlSummary::Build()
241 for (
int i=0;i<fNTables;i++) {
242 GetTable(i)->Build();
243 fHtml += GetTable(i)->Html();
249 void HtmlSummary::MakeHeader()
253 fHeader =
"<html><head><title>";
255 fHeader +=
"</title></head><body>";
256 fHeader +=
"<center><h2><font color=#2222ee><i>";
258 fHeader +=
"</i></font></h2></center>";
263 void HtmlSummary::MakeFooter()
267 fFooter =
"<br><p><br><center><strong><font size=2 color=#2222ee>";
268 fFooter +=
"Example of using Html widget to display tabular data";
270 fFooter +=
"(c) 2007-2010 Bertrand Bellenot";
271 fFooter +=
"</font></strong></center></body></html>";
278 void update_html_summary()
289 fgHtmlSummary->Clear(
"D");
300 table = fgHtmlSummary->AddTable(ename, 0, nel);
307 table = fgHtmlSummary->AddTable(ename.
Data(), 5,
309 table->SetLabel(0,
"Momentum");
310 table->SetLabel(1,
"P_t");
311 table->SetLabel(2,
"Phi");
312 table->SetLabel(3,
"Theta");
313 table->SetLabel(4,
"Eta");
317 table->SetValue(0, k, p);
319 table->SetValue(1, k, pt);
321 table->SetValue(2, k, phi);
323 table->SetValue(3, k, theta);
325 table->SetValue(4, k, eta);
330 fgHtmlSummary->Build();
332 fgHtml->
ParseText((
char*)fgHtmlSummary->Html().Data());
virtual const char * GetElementName() const
Virtual function for retrieving name of the element.
virtual void Add(TObject *obj)
Base class for event management and navigation.
void Delete(Option_t *option="")
Remove all objects from the collection AND delete all heap based objects.
virtual void Layout()
layout view
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual void Clear(Option_t *="")
Erase all HTML from this widget and clear the screen.
static constexpr double ps
Array of floats (32 bits per element).
void ToLower()
Change string to lower-case.
virtual const char * GetElementName() const
Virtual function for retrieving name of the element.
#define ClassDef(name, id)
A list of tracks supporting change of common attributes and selection based on track parameters...
Ssiz_t First(char c) const
Find first occurrence of a character c.
R__EXTERN TEveManager * gEve
int ParseText(char *text, const char *index=0)
Appends (or insert at the specified position) the given HTML text to the end of any HTML text that ma...
char * Form(const char *fmt,...)
TEvePointSet is a render-element holding a collection of 3D points with optional per-point TRef and a...
void AddFirst(TObject *obj)
Insert object at beginning of collection.
void Reset(Detail::TBranchProxy *x)
Visual representation of a track.
virtual const char * GetElementTitle() const
Virtual function for retrieving title of the render-element.
TString & Remove(Ssiz_t pos)
Int_t NumChildren() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
void SetAt(Double_t v, Int_t i)
Mother of all ROOT objects.
TEveEventManager * GetCurrentEvent() const
void Clear(Option_t *option="")
Remove all objects from the collection.
TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
const char * Data() const