CMS 3D CMS Logo

Public Member Functions

DDLTrapezoid Class Reference

#include <DDLTrapezoid.h>

Inheritance diagram for DDLTrapezoid:
DDLSolid DDXMLElement

List of all members.

Public Member Functions

 DDLTrapezoid (DDLElementRegistry *myreg)
 Constructor.
void processElement (const std::string &name, const std::string &nmspace, DDCompactView &cpv)
 Processing the element.
 ~DDLTrapezoid (void)
 Destructor.

Detailed Description

Author:
Michael Case

DDLTrapezoid.h - description ------------------- begin: Mon Oct 29 2001 email: case@ucdhep.ucdavis.edu

Trapezoid processor processes Trapezoid and Trd1 DDL elements.

Definition at line 23 of file DDLTrapezoid.h.


Constructor & Destructor Documentation

DDLTrapezoid::DDLTrapezoid ( DDLElementRegistry myreg)

Constructor.

Definition at line 22 of file DDLTrapezoid.cc.

  : DDLSolid( myreg )
{}
DDLTrapezoid::~DDLTrapezoid ( void  )

Destructor.

Definition at line 26 of file DDLTrapezoid.cc.

{}

Member Function Documentation

void DDLTrapezoid::processElement ( const std::string &  name,
const std::string &  nmspace,
DDCompactView cpv 
) [virtual]

Processing the element.

The processElement method completes any necessary work to process the XML element.

For example, this can be used to call the DDCore to make the geometry in memory. There is a default for this so that if not declared in the inheriting class, no processing is done.

Reimplemented from DDXMLElement.

Definition at line 31 of file DDLTrapezoid.cc.

References DCOUT_V, ExprEvalInterface::eval(), DDXMLElement::getAttributeSet(), DDXMLElement::getDDName(), DDI::Singleton< I >::instance(), runTheMatrix::msg, phi, DDLSolid::setReference(), theta(), DDXMLElement::throwError(), and DDSolidFactory::trap().

{
  DCOUT_V('P', "DDLTrapezoid::processElement started");

  ExprEvalInterface & ev = ExprEvalSingleton::instance();

  DDXMLAttribute atts = getAttributeSet();

  double phi = 0.0;
  double theta = 0.0;
  double dy2 = 0.0;

  if (atts.find("phi") != atts.end())
    phi = ev.eval(nmspace, atts.find("phi")->second);

  if (atts.find("theta") != atts.end())
    theta = ev.eval(nmspace, atts.find("theta")->second);

  if (atts.find("dy2") != atts.end())
    dy2 = ev.eval(nmspace, atts.find("dy2")->second);
  else if (atts.find("dy1") != atts.end())
    dy2 = ev.eval(nmspace, atts.find("dy1")->second);

  if (name == "Trapezoid")
  {
    DDSolid myTrap = 
      DDSolidFactory::trap( getDDName(nmspace),
                            ev.eval(nmspace, atts.find("dz")->second),
                            theta,
                            phi,
                            ev.eval(nmspace, atts.find("h1")->second),
                            ev.eval(nmspace, atts.find("bl1")->second),
                            ev.eval(nmspace, atts.find("tl1")->second),
                            ev.eval(nmspace, atts.find("alp1")->second),
                            ev.eval(nmspace, atts.find("h2")->second),
                            ev.eval(nmspace, atts.find("bl2")->second),
                            ev.eval(nmspace, atts.find("tl2")->second),
                            ev.eval(nmspace, atts.find("alp2")->second));
  }
  else if (name == "Trd1") 
  {
    DDSolid myTrd1 = 
      DDSolidFactory::trap( getDDName(nmspace),
                            ev.eval(nmspace, atts.find("dz")->second),
                            0,
                            0,
                            ev.eval(nmspace, atts.find("dy1")->second),
                            ev.eval(nmspace, atts.find("dx1")->second),
                            ev.eval(nmspace, atts.find("dx1")->second),
                            0,
                            dy2,
                            ev.eval(nmspace, atts.find("dx2")->second),
                            ev.eval(nmspace, atts.find("dx2")->second),
                            0 );
  }
  else
  {
    std::string msg = "\nDDLTrapezoid::processElement failed to process element of name: " 
                      + name
                      + ".  It can only process Trapezoid and Trd1.";
    throwError(msg);
  }

  DDLSolid::setReference( nmspace, cpv );

  DCOUT_V('P', "DDLTrapezoid::processElement completed");
}