Changes in display/DelphesHtmlSummary.cc [341014c:1fa50c2] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
display/DelphesHtmlSummary.cc
r341014c r1fa50c2 18 18 19 19 #include "display/DelphesHtmlSummary.h" 20 #include "TGHtml.h" 20 21 #include "TEveElement.h" 22 #include "TEveManager.h" 21 23 #include "TEveEventManager.h" 22 #include "TEveManager.h"23 24 #include "TEvePointSet.h" 24 25 #include "TEveTrack.h" 25 #include "TGHtml.h"26 26 27 27 //============================================================================== 28 28 29 29 DelphesHtmlSummary *fgDelphesHtmlSummary = 0; 30 TGHtml *fgHtml= 0;30 TGHtml *fgHtml = 0; 31 31 32 32 //============================================================================== 33 33 34 34 //______________________________________________________________________________ 35 DelphesHtmlObjTable::DelphesHtmlObjTable(const char *name, Int_t nfields, Int_t nvals, Bool_t exp) : 36 fName(name), fNValues(nvals), fNFields(nfields), fExpand(exp)37 { 38 // Constructor.39 40 fValues = new TArrayF[fNFields];41 for(int i = 0; i < fNFields;i++)42 fValues[i].Set(nvals);43 fLabels = new TString[fNFields];35 DelphesHtmlObjTable::DelphesHtmlObjTable(const char *name, Int_t nfields, Int_t nvals, Bool_t exp) : 36 fName(name), fNValues(nvals), fNFields(nfields), fExpand(exp) 37 { 38 // Constructor. 39 40 fValues = new TArrayF[fNFields]; 41 for (int i=0;i<fNFields;i++) 42 fValues[i].Set(nvals); 43 fLabels = new TString[fNFields]; 44 44 } 45 45 … … 47 47 DelphesHtmlObjTable::~DelphesHtmlObjTable() 48 48 { 49 // Destructor.50 51 delete[] fValues;52 delete[] fLabels;49 // Destructor. 50 51 delete [] fValues; 52 delete [] fLabels; 53 53 } 54 54 … … 56 56 void DelphesHtmlObjTable::Build() 57 57 { 58 // Build HTML code. 59 60 fHtml = "<table width=100% border=1 cellspacing=0 cellpadding=0 bgcolor=f0f0f0> ", 61 62 BuildTitle(); 63 if(fExpand && (fNFields > 0) && (fNValues > 0)) 64 { 65 BuildLabels(); 66 BuildTable(); 67 } 68 69 fHtml += "</table>"; 58 // Build HTML code. 59 60 fHtml = "<table width=100% border=1 cellspacing=0 cellpadding=0 bgcolor=f0f0f0> ", 61 62 BuildTitle(); 63 if (fExpand && (fNFields > 0) && (fNValues > 0)) { 64 BuildLabels(); 65 BuildTable(); 66 } 67 68 fHtml += "</table>"; 70 69 } 71 70 … … 73 72 void DelphesHtmlObjTable::BuildTitle() 74 73 { 75 // Build table title.76 77 fHtml += "<tr><td colspan=";78 fHtml += Form("%d>", fNFields +1);79 fHtml += "<table width=100% border=0 cellspacing=2 cellpadding=0 bgcolor=6e6ea0>";80 fHtml += "<tr><td align=left>";81 fHtml += "<font face=Verdana size=3 color=ffffff><b><i>";82 fHtml += fName;83 fHtml += "</i></b></font></td>";84 fHtml += "<td>";85 fHtml += "<td align=right> ";86 fHtml += "<font face=Verdana size=3 color=ffffff><b><i>";87 fHtml += Form("Size = %d", fNValues);88 fHtml += "</i></b></font></td></tr>";89 fHtml += "</table>";90 fHtml += "</td></tr>";74 // Build table title. 75 76 fHtml += "<tr><td colspan="; 77 fHtml += Form("%d>", fNFields+1); 78 fHtml += "<table width=100% border=0 cellspacing=2 cellpadding=0 bgcolor=6e6ea0>"; 79 fHtml += "<tr><td align=left>"; 80 fHtml += "<font face=Verdana size=3 color=ffffff><b><i>"; 81 fHtml += fName; 82 fHtml += "</i></b></font></td>"; 83 fHtml += "<td>"; 84 fHtml += "<td align=right> "; 85 fHtml += "<font face=Verdana size=3 color=ffffff><b><i>"; 86 fHtml += Form("Size = %d", fNValues); 87 fHtml += "</i></b></font></td></tr>"; 88 fHtml += "</table>"; 89 fHtml += "</td></tr>"; 91 90 } 92 91 … … 94 93 void DelphesHtmlObjTable::BuildLabels() 95 94 { 96 // Build table labels. 97 98 Int_t i; 99 fHtml += "<tr bgcolor=c0c0ff>"; 100 fHtml += "<th> </th>"; // for the check boxes 101 for(i = 0; i < fNFields; i++) 102 { 103 fHtml += "<th> "; 104 fHtml += fLabels[i]; 105 fHtml += " </th>"; // for the check boxes 106 } 107 fHtml += "</tr>"; 95 // Build table labels. 96 97 Int_t i; 98 fHtml += "<tr bgcolor=c0c0ff>"; 99 fHtml += "<th> </th>"; // for the check boxes 100 for (i=0;i<fNFields;i++) { 101 fHtml += "<th> "; 102 fHtml += fLabels[i]; 103 fHtml += " </th>"; // for the check boxes 104 } 105 fHtml += "</tr>"; 108 106 } 109 107 … … 111 109 void DelphesHtmlObjTable::BuildTable() 112 110 { 113 // Build part of table with values. 114 115 for(int i = 0; i < fNValues; i++) 116 { 117 if(i % 2) 118 fHtml += "<tr bgcolor=e0e0ff>"; 119 else 120 fHtml += "<tr bgcolor=ffffff>"; 121 122 TString name = fName; 123 name.ReplaceAll(" ", "_"); 124 // checkboxes 125 fHtml += "<td bgcolor=d0d0ff align=\"center\">"; 126 fHtml += "<input type=\"checkbox\" name=\""; 127 fHtml += name; 128 fHtml += Form("[%d]\">", i); 129 fHtml += "</td>"; 130 131 for(int j = 0; j < fNFields; j++) 132 { 133 fHtml += "<td width="; 134 fHtml += Form("%d%%", 100 / fNFields); 135 fHtml += " align=\"center\""; 136 fHtml += ">"; 137 fHtml += Form("%1.4f", fValues[j][i]); 111 // Build part of table with values. 112 113 for (int i = 0; i < fNValues; i++) { 114 if (i%2) 115 fHtml += "<tr bgcolor=e0e0ff>"; 116 else 117 fHtml += "<tr bgcolor=ffffff>"; 118 119 TString name = fName; 120 name.ReplaceAll(" ", "_"); 121 // checkboxes 122 fHtml += "<td bgcolor=d0d0ff align=\"center\">"; 123 fHtml += "<input type=\"checkbox\" name=\""; 124 fHtml += name; 125 fHtml += Form("[%d]\">",i); 138 126 fHtml += "</td>"; 139 } 140 fHtml += "</tr> "; 141 } 142 } 143 144 //______________________________________________________________________________ 145 DelphesHtmlSummary::DelphesHtmlSummary(const char *title) : 146 fNTables(0), fTitle(title) 147 { 148 // Constructor. 149 150 fObjTables = new TOrdCollection(); 127 128 for (int j = 0; j < fNFields; j++) { 129 fHtml += "<td width="; 130 fHtml += Form("%d%%", 100/fNFields); 131 fHtml += " align=\"center\""; 132 fHtml += ">"; 133 fHtml += Form("%1.4f", fValues[j][i]); 134 fHtml += "</td>"; 135 } 136 fHtml += "</tr> "; 137 } 138 } 139 140 //______________________________________________________________________________ 141 DelphesHtmlSummary::DelphesHtmlSummary(const char *title) : fNTables(0), fTitle(title) 142 { 143 // Constructor. 144 145 fObjTables = new TOrdCollection(); 151 146 } 152 147 … … 154 149 DelphesHtmlSummary::~DelphesHtmlSummary() 155 150 { 156 // Destructor.157 158 Reset();151 // Destructor. 152 153 Reset(); 159 154 } 160 155 161 156 //______________________________________________________________________________ 162 157 DelphesHtmlObjTable *DelphesHtmlSummary::AddTable(const char *name, Int_t nfields, Int_t nvals, 163 Bool_t exp, Option_t *option)164 { 165 // Add a new table in our list of tables.166 167 TString opt = option;168 opt.ToLower();169 DelphesHtmlObjTable *table = new DelphesHtmlObjTable(name, nfields, nvals, exp);170 fNTables++;171 if(opt.Contains("first"))172 fObjTables->AddFirst(table);173 else174 fObjTables->Add(table);175 return table;158 Bool_t exp, Option_t *option) 159 { 160 // Add a new table in our list of tables. 161 162 TString opt = option; 163 opt.ToLower(); 164 DelphesHtmlObjTable *table = new DelphesHtmlObjTable(name, nfields, nvals, exp); 165 fNTables++; 166 if (opt.Contains("first")) 167 fObjTables->AddFirst(table); 168 else 169 fObjTables->Add(table); 170 return table; 176 171 } 177 172 … … 179 174 void DelphesHtmlSummary::Clear(Option_t *option) 180 175 { 181 // Clear the table list.182 183 if(option && option[0] == 'D')184 fObjTables->Delete(option);185 else186 fObjTables->Clear(option);187 fNTables = 0;176 // Clear the table list. 177 178 if (option && option[0] == 'D') 179 fObjTables->Delete(option); 180 else 181 fObjTables->Clear(option); 182 fNTables = 0; 188 183 } 189 184 … … 191 186 void DelphesHtmlSummary::Reset(Option_t *) 192 187 { 193 // Reset (delete) the table list; 194 195 delete fObjTables; 196 fObjTables = 0; 197 fNTables = 0; 188 // Reset (delete) the table list; 189 190 delete fObjTables; fObjTables = 0; 191 fNTables = 0; 198 192 } 199 193 … … 201 195 void DelphesHtmlSummary::Build() 202 196 { 203 // Build the summary. 204 205 MakeHeader(); 206 for(int i = 0; i < fNTables; i++) 207 { 208 GetTable(i)->Build(); 209 fHtml += GetTable(i)->Html(); 210 } 211 MakeFooter(); 197 // Build the summary. 198 199 MakeHeader(); 200 for (int i=0;i<fNTables;i++) { 201 GetTable(i)->Build(); 202 fHtml += GetTable(i)->Html(); 203 } 204 MakeFooter(); 212 205 } 213 206 … … 215 208 void DelphesHtmlSummary::MakeHeader() 216 209 { 217 // Make HTML header.218 219 fHeader= "<html><head><title>";220 fHeader += fTitle;221 fHeader += "</title></head><body>";222 fHeader += "<center><h2><font color=#2222ee><i>";223 fHeader += fTitle;224 fHeader += "</i></font></h2></center>";225 fHtml= fHeader;210 // Make HTML header. 211 212 fHeader = "<html><head><title>"; 213 fHeader += fTitle; 214 fHeader += "</title></head><body>"; 215 fHeader += "<center><h2><font color=#2222ee><i>"; 216 fHeader += fTitle; 217 fHeader += "</i></font></h2></center>"; 218 fHtml = fHeader; 226 219 } 227 220 … … 229 222 void DelphesHtmlSummary::MakeFooter() 230 223 { 231 // Make HTML footer. 232 233 fFooter = "<br><p><br><center><strong><font size=2 color=#2222ee>"; 234 fFooter += "Example of using Html widget to display tabular data"; 235 fFooter += "<br>"; 236 fFooter += "(c) 2007-2010 Bertrand Bellenot"; 237 fFooter += "</font></strong></center></body></html>"; 238 fHtml += fFooter; 239 } 224 // Make HTML footer. 225 226 fFooter = "<br><p><br><center><strong><font size=2 color=#2222ee>"; 227 fFooter += "Example of using Html widget to display tabular data"; 228 fFooter += "<br>"; 229 fFooter += "(c) 2007-2010 Bertrand Bellenot"; 230 fFooter += "</font></strong></center></body></html>"; 231 fHtml += fFooter; 232 } 233
Note:
See TracChangeset
for help on using the changeset viewer.