Changes in display/DelphesHtmlSummary.cc [1fa50c2:341014c] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
display/DelphesHtmlSummary.cc
r1fa50c2 r341014c 18 18 19 19 #include "display/DelphesHtmlSummary.h" 20 #include "TGHtml.h"21 20 #include "TEveElement.h" 21 #include "TEveEventManager.h" 22 22 #include "TEveManager.h" 23 #include "TEveEventManager.h"24 23 #include "TEvePointSet.h" 25 24 #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 37 { 38 39 40 41 for (int i=0;i<fNFields;i++)42 43 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 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 BuildLabels(); 65 BuildTable(); 66 } 67 68 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 { 65 BuildLabels(); 66 BuildTable(); 67 } 68 69 fHtml += "</table>"; 69 70 } 70 71 … … 72 73 void DelphesHtmlObjTable::BuildTitle() 73 74 { 74 75 76 77 fHtml += Form("%d>", fNFields+1);78 79 80 81 82 83 84 85 86 87 88 89 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>"; 90 91 } 91 92 … … 93 94 void DelphesHtmlObjTable::BuildLabels() 94 95 { 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>"; 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>"; 106 108 } 107 109 … … 109 111 void DelphesHtmlObjTable::BuildTable() 110 112 { 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); 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]); 126 138 fHtml += "</td>"; 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(); 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(); 146 151 } 147 152 … … 149 154 DelphesHtmlSummary::~DelphesHtmlSummary() 150 155 { 151 152 153 156 // Destructor. 157 158 Reset(); 154 159 } 155 160 156 161 //______________________________________________________________________________ 157 162 DelphesHtmlObjTable *DelphesHtmlSummary::AddTable(const char *name, Int_t nfields, Int_t nvals, 158 159 { 160 161 162 163 164 165 166 if(opt.Contains("first"))167 168 169 170 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 else 174 fObjTables->Add(table); 175 return table; 171 176 } 172 177 … … 174 179 void DelphesHtmlSummary::Clear(Option_t *option) 175 180 { 176 177 178 if(option && option[0] == 'D')179 180 181 182 181 // Clear the table list. 182 183 if(option && option[0] == 'D') 184 fObjTables->Delete(option); 185 else 186 fObjTables->Clear(option); 187 fNTables = 0; 183 188 } 184 189 … … 186 191 void DelphesHtmlSummary::Reset(Option_t *) 187 192 { 188 // Reset (delete) the table list; 189 190 delete fObjTables; fObjTables = 0; 191 fNTables = 0; 193 // Reset (delete) the table list; 194 195 delete fObjTables; 196 fObjTables = 0; 197 fNTables = 0; 192 198 } 193 199 … … 195 201 void DelphesHtmlSummary::Build() 196 202 { 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(); 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(); 205 212 } 206 213 … … 208 215 void DelphesHtmlSummary::MakeHeader() 209 216 { 210 211 212 fHeader= "<html><head><title>";213 214 215 216 217 218 fHtml= fHeader;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; 219 226 } 220 227 … … 222 229 void DelphesHtmlSummary::MakeFooter() 223 230 { 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 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 }
Note:
See TracChangeset
for help on using the changeset viewer.