9class 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; }
70HtmlSummary *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];
88HtmlObjTable::~HtmlObjTable()
97void HtmlObjTable::Build()
101 fHtml =
"<table width=100% border=1 cellspacing=0 cellpadding=0 bgcolor=f0f0f0> ",
104 if (fExpand && (fNFields > 0) && (fNValues > 0)) {
113void 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>";
134void HtmlObjTable::BuildLabels()
139 fHtml +=
"<tr bgcolor=c0c0ff>";
140 fHtml +=
"<th> </th>";
141 for (i=0;i<fNFields;i++) {
150void HtmlObjTable::BuildTable()
154 for (
int i = 0; i < fNValues; i++) {
156 fHtml +=
"<tr bgcolor=e0e0ff>";
158 fHtml +=
"<tr bgcolor=ffffff>";
161 name.ReplaceAll(
" ",
"_");
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]);
182HtmlSummary::HtmlSummary(
const char *title) : fNTables(0), fTitle(title)
190HtmlSummary::~HtmlSummary()
198HtmlObjTable *HtmlSummary::AddTable(
const char *
name,
Int_t nfields,
Int_t nvals,
205 HtmlObjTable *table =
new HtmlObjTable(
name, nfields, nvals,
exp);
210 fObjTables->
Add(table);
215void HtmlSummary::Clear(
Option_t *option)
219 if (option && option[0] ==
'D')
220 fObjTables->
Delete(option);
222 fObjTables->
Clear(option);
231 delete fObjTables; fObjTables = 0;
236void HtmlSummary::Build()
241 for (
int i=0;i<fNTables;i++) {
242 GetTable(i)->Build();
243 fHtml += GetTable(i)->Html();
249void 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>";
263void 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>";
278void 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");
315 for (j=
tracks->BeginChildren(); j!=
tracks->EndChildren(); ++j) {
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());
#define ClassDef(name, id)
R__EXTERN TEveManager * gEve
char * Form(const char *fmt,...)
Array of floats (32 bits per element).
void SetAt(Double_t v, Int_t i)
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Base class for event management and navigation.
TEveEventManager * GetCurrentEvent() const
TEvePointSet is a render-element holding a collection of 3D points with optional per-point TRef and a...
A list of tracks supporting change of common attributes and selection based on track parameters.
Visual representation of a track.
virtual void Clear(Option_t *="")
Erase all HTML from this widget and clear the screen.
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...
virtual void Layout()
layout view
Mother of all ROOT objects.
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.
void AddFirst(TObject *obj)
Insert object at beginning of collection.
void Delete(Option_t *option="")
Remove all objects from the collection AND delete all heap based objects.
virtual void Add(TObject *obj)
void ToLower()
Change string to lower-case.
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
TString & Remove(Ssiz_t pos)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static constexpr double ps