#include <DetectorDescription/RegressionTest/interface/DDHtmlFormatter.h>
Public Member Functions | |
DDHtmlMaDetails (const string &cat, const string &txt) | |
bool | details (ostream &os, const DDName &) |
ns_type & | names () |
Definition at line 136 of file DDHtmlFormatter.h.
DDHtmlMaDetails::DDHtmlMaDetails | ( | const string & | cat, | |
const string & | txt | |||
) | [inline] |
Implements DDHtmlDetails.
Definition at line 151 of file DDHtmlFormatter.cc.
References DDMaterial::a(), DDHtmlFormatter::br(), DDMaterial::constituent(), DDBase< N, C >::ddname(), DDMaterial::density(), lat::endl(), DDHtmlDetails::f_, false, g, DDHtmlFormatter::h2(), DDHtmlFormatter::h3(), DDHtmlFormatter::header(), i, DDBase< N, C >::isDefined(), it, DDHtmlFormatter::link(), DDHtmlFormatter::lnk(), m, n, DDName::name(), DDMaterial::noOfConstituents(), DDName::ns(), DDHtmlFormatter::p(), s, DDHtmlFormatter::table(), DDHtmlFormatter::tableEnd(), DDHtmlFormatter::td(), DDHtmlFormatter::tr(), DDHtmlFormatter::trEnd(), and DDMaterial::z().
00152 { 00153 typedef DDI::Singleton<map<DDMaterial, set<DDLogicalPart> > > parts_t; 00154 static bool once = false; 00155 if (!once) { 00156 once=true; 00157 DDLogicalPart::iterator<DDLogicalPart> it, ed; 00158 ed.end(); 00159 00160 for (; it != ed; ++it) { 00161 if (it->isDefined().second) 00162 parts_t::instance()[it->material()].insert(*it); 00163 } 00164 } 00165 00166 string s = nm.ns() + " : " + nm.name(); 00167 DDMaterial ma(nm); 00168 os << f_.header(s); 00169 os << f_.h2("Material <b>" + s + "</b>"); 00170 os << f_.br(); 00171 if ( ma.isDefined().second == false ) { 00172 os << "<b>ERROR!<b><br><p>The Material is not defined in namespace " << nm.ns() << "! </p>" << endl; 00173 return false; 00174 } 00175 00176 os << "<p>density = " << ma.density()/g*cm3 << " g/cm3 </p>" << endl; 00177 int co = ma.noOfConstituents(); 00178 if ( co ) { 00179 os << f_.p("Composites by fraction-mass:"); 00180 os << f_.table() 00181 << f_.tr() << f_.td("<b>fm</b>") << f_.td("<b>Material</b>") << f_.td("<b>elementary?</b>") << f_.trEnd(); 00182 for(int i=0; i<co; ++i) { 00183 pair<DDMaterial,double> fm = ma.constituent(i); 00184 string elem = "ERROR"; 00185 DDMaterial m = fm.first; 00186 double frac = fm.second; 00187 00188 if (m.isDefined().second) { 00189 if (m.noOfConstituents()) 00190 elem = "no"; 00191 else 00192 elem = "yes"; 00193 } 00194 os << f_.tr() << "<td>" << frac << "</td>" 00195 << f_.td(f_.lnk("../" + m.ddname().ns() + "/" + m.ddname().name() + ".html", m.ddname(), "_popup")) 00196 << f_.td(elem) << f_.trEnd(); 00197 } 00198 os << f_.tableEnd(); 00199 } 00200 else { // if ( co ) ... 00201 os << f_.p("ElementaryMaterial:"); 00202 os << "<p>z = " << ma.z() << "</p>" << endl; 00203 os << "<p>a = " << ma.a()/g*mole << "g/mole</p>" << endl; 00204 } 00205 00206 00207 const set<DDLogicalPart> & lps = parts_t::instance()[ma]; 00208 set<DDLogicalPart>::const_iterator it(lps.begin()), ed(lps.end()); 00209 if ( it != ed ) { 00210 os << f_.h3("Material used in following LogicalParts:") << endl; 00211 os << "<p>" << endl; 00212 } 00213 for (; it != ed; ++it ) { 00214 const DDName & n = it->ddname(); 00215 os << f_.link("../../lp/" + n.ns() + "/" + n.name() + ".html", n, "_popup" ); 00216 } 00217 os << "</p>" << endl; 00218 return true; 00219 }
ns_type & DDHtmlMaDetails::names | ( | ) | [virtual] |
Implements DDHtmlDetails.
Definition at line 81 of file DDHtmlFormatter.cc.
References findNameSpaces(), lp, and DDHtmlDetails::names_.
00082 { 00083 DDMaterial lp; 00084 findNameSpaces(lp, names_); 00085 return names_; 00086 }