CMS 3D CMS Logo

List of all members | Public Member Functions
DDHtmlMaDetails Class Reference

#include <DDHtmlFormatter.h>

Inheritance diagram for DDHtmlMaDetails:
DDHtmlDetails

Public Member Functions

 DDHtmlMaDetails (const std::string &cat, const std::string &txt)
 
bool details (std::ostream &os, const DDName &) override
 
ns_typenames () override
 
- Public Member Functions inherited from DDHtmlDetails
const std::string & category ()
 
 DDHtmlDetails (const std::string &cat, const std::string &txt)
 
const std::string & text ()
 
virtual ~DDHtmlDetails ()
 

Additional Inherited Members

- Protected Attributes inherited from DDHtmlDetails
std::string cat_
 
DDHtmlFormatter f_
 
ns_type names_
 
std::string txt_
 

Detailed Description

Definition at line 126 of file DDHtmlFormatter.h.

Constructor & Destructor Documentation

DDHtmlMaDetails::DDHtmlMaDetails ( const std::string &  cat,
const std::string &  txt 
)
inline

Definition at line 129 of file DDHtmlFormatter.h.

References names.

129 : DDHtmlDetails(cat,txt) {}
def cat(path)
Definition: eostools.py:401
DDHtmlDetails(const std::string &cat, const std::string &txt)

Member Function Documentation

bool DDHtmlMaDetails::details ( std::ostream &  os,
const DDName  
)
overridevirtual

Implements DDHtmlDetails.

Definition at line 170 of file DDHtmlFormatter.cc.

References DDMaterial::a(), DDHtmlFormatter::br(), DDMaterial::constituent(), geant_units::operators::convertUnitsTo(), DDBase< N, C >::ddname(), DDMaterial::density(), HTMLExport::elem(), DDHtmlDetails::f_, funct::false, DivergingColor::frac, DDName::fullname(), DDHtmlFormatter::h2(), DDHtmlFormatter::h3(), DDHtmlFormatter::header(), mps_fire::i, instance, DDBase< N, C >::isDefined(), DDHtmlFormatter::link(), DDHtmlFormatter::lnk(), funct::m, gen::n, DDName::name(), DDMaterial::noOfConstituents(), DDName::ns(), DDHtmlFormatter::p(), alignCSCRings::s, DDHtmlFormatter::table(), DDHtmlFormatter::tableEnd(), DDHtmlFormatter::td(), DDHtmlFormatter::tr(), DDHtmlFormatter::trEnd(), and DDMaterial::z().

171 {
173  static bool once = false;
174  if (!once) {
175  once=true;
176  DDLogicalPart::iterator<DDLogicalPart> it, ed;
177  ed.end();
178 
179  for (; it != ed; ++it) {
180  if (it->isDefined().second)
181  parts_t::instance()[it->material()].insert(*it);
182  }
183  }
184 
185  string s = nm.ns() + " : " + nm.name();
186  DDMaterial ma(nm);
187  os << f_.header(s);
188  os << f_.h2("Material <b>" + s + "</b>");
189  os << f_.br();
190  if ( ma.isDefined().second == false ) {
191  os << "<b>ERROR!<b><br><p>The Material is not defined in namespace " << nm.ns() << "! </p>" << endl;
192  return false;
193  }
194 
195  os << "<p>density = " << convertUnitsTo(1._g_per_cm3, ma.density()) << " g/cm3 </p>" << endl;
196  int co = ma.noOfConstituents();
197  if ( co ) {
198  os << f_.p("Composites by fraction-mass:");
199  os << f_.table()
200  << f_.tr() << f_.td("<b>fm</b>") << f_.td("<b>Material</b>") << f_.td("<b>elementary?</b>") << f_.trEnd();
201  for(int i=0; i<co; ++i) {
202  pair<DDMaterial,double> fm = ma.constituent(i);
203  string elem = "ERROR";
204  DDMaterial m = fm.first;
205  double frac = fm.second;
206 
207  if (m.isDefined().second) {
208  if (m.noOfConstituents())
209  elem = "no";
210  else
211  elem = "yes";
212  }
213  os << f_.tr() << "<td>" << frac << "</td>"
214  << f_.td(f_.lnk("../" + m.ddname().ns() + "/" + m.ddname().name() + ".html", m.ddname().fullname(), "_popup"))
215  << f_.td(elem) << f_.trEnd();
216  }
217  os << f_.tableEnd();
218  }
219  else { // if ( co ) ...
220  os << f_.p("ElementaryMaterial:");
221  os << "<p>z = " << ma.z() << "</p>" << endl;
222  os << "<p>a = " << convertUnitsTo(1._g_per_mole, ma.a()) << "g/mole</p>" << endl;
223  }
224 
225 
226  const set<DDLogicalPart> & lps = parts_t::instance()[ma];
227  set<DDLogicalPart>::const_iterator it(lps.begin()), ed(lps.end());
228  if ( it != ed ) {
229  os << f_.h3("Material used in following LogicalParts:") << endl;
230  os << "<p>" << endl;
231  }
232  for (; it != ed; ++it ) {
233  const DDName & n = it->ddname();
234  os << f_.link("../../lp/" + n.ns() + "/" + n.name() + ".html", n.fullname(), "_popup" );
235  }
236  os << "</p>" << endl;
237  return true;
238 }
def_type isDefined() const
Definition: DDBase.h:107
constexpr NumType convertUnitsTo(long double desiredUnits, NumType val)
Definition: GeantUnits.h:128
static PFTauRenderPlugin instance
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:43
DDHtmlFormatter br()
DDHtmlFormatter h3(const std::string &content)
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:67
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
DDHtmlFormatter td(const std::string &content)
DDHtmlFormatter f_
DDHtmlFormatter p(const std::string &content)
DDHtmlFormatter h2(const std::string &content)
const std::string fullname() const
Definition: DDName.h:43
DDHtmlFormatter table(int border=0)
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:19
DDHtmlFormatter tableEnd()
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
Definition: DDMaterial.cc:82
DDHtmlFormatter tr()
DDHtmlFormatter header(const std::string &text, const std::string &style="../../style.css")
std::string lnk(const std::string &url, const std::string &text, const std::string &target="_self")
DDHtmlFormatter trEnd()
DDHtmlFormatter link(const std::string &url, const std::string &text, const std::string &target="_self")
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
const N & ddname() const
Definition: DDBase.h:76
ns_type & DDHtmlMaDetails::names ( void  )
overridevirtual

Implements DDHtmlDetails.

Definition at line 101 of file DDHtmlFormatter.cc.

References findNameSpaces(), and DDHtmlDetails::names_.

102 {
103  DDMaterial lp;
104  findNameSpaces(lp, names_);
105  return names_;
106 }
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:43
bool findNameSpaces(T dummy, ns_type &m)