CMS 3D CMS Logo

Public Member Functions | Private Attributes

DDLRotationByAxis Class Reference

DDLRotationByAxis handles RotationByAxis elements. More...

#include <DDLRotationByAxis.h>

Inheritance diagram for DDLRotationByAxis:
DDXMLElement DDLRotationSequence

List of all members.

Public Member Functions

 DDLRotationByAxis (DDLElementRegistry *myreg)
 Constructor.
virtual void preProcessElement (const std::string &name, const std::string &nmspace, DDCompactView &cpv)
 Called by loadAttributes AFTER attributes are loaded.
virtual void processElement (const std::string &name, const std::string &nmspace, DDCompactView &cpv)
 Processing the element.
virtual DDRotationMatrix processOne (DDRotationMatrix R, std::string &axis, std::string &angle)
virtual ~DDLRotationByAxis (void)
 Destructor.

Private Attributes

std::string pName
std::string pNameSpace

Detailed Description

DDLRotationByAxis handles RotationByAxis elements.

Author:
Michael Case

DDLRotationByAxis.h - description ------------------- begin: Wed. Nov. 19, 2003 email: case@ucdhep.ucdavis.edu

This is the RotationByAxis element which rotates around an axis.

Definition at line 27 of file DDLRotationByAxis.h.


Constructor & Destructor Documentation

DDLRotationByAxis::DDLRotationByAxis ( DDLElementRegistry myreg)

Constructor.

Definition at line 24 of file DDLRotationByAxis.cc.

  : DDXMLElement( myreg ) 
{}
DDLRotationByAxis::~DDLRotationByAxis ( void  ) [virtual]

Destructor.

Definition at line 28 of file DDLRotationByAxis.cc.

{}

Member Function Documentation

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

Called by loadAttributes AFTER attributes are loaded.

The preProcessElement method can assume that the attributes are loaded and perform any code that is necessary at the start of an element.

This would allow users to call their own code to setup anything necessary for the continued processing of the child elements.

Reimplemented from DDXMLElement.

Reimplemented in DDLRotationSequence.

Definition at line 32 of file DDLRotationByAxis.cc.

References mergeVDriftHistosByStation::name, pName, and pNameSpace.

{
  pNameSpace = nmspace;
  pName = name;
}
void DDLRotationByAxis::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.

Reimplemented in DDLRotationSequence.

Definition at line 39 of file DDLRotationByAxis.cc.

References angle(), DDXMLElement::clear(), DCOUT_V, DDrot(), DDXMLElement::getAttributeSet(), DDXMLElement::getDDName(), DDLElementRegistry::getElement(), DDXMLElement::loadAttributes(), DDXMLElement::myRegistry_, DDName::name(), h::names, DDXMLElement::parent(), pName, processOne(), dttmaxenums::R, makeMuonMisalignmentScenario::rot, and makeHLTPrescaleTable::values.

{
  DCOUT_V('P', "DDLRotationByAxis::processElement started " << name);

  //  std::cout << "my parent is : " << parent() << std::endl;
  DDXMLAttribute atts = getAttributeSet();
  if (parent() != "RotationSequence")
  {
    std::string axis = atts.find("axis")->second;
    std::string angle = atts.find("angle")->second;
      
    DDRotationMatrix R;
    R = processOne(R, axis, angle);

    DDRotationMatrix* ddr = new DDRotationMatrix(R);
    if (atts.find("name") == atts.end())
    {
      //how do we make up a ddname! damn_it!
      //          DDXMLElement * myRealParent = DDLElementRegistry::instance()->getElement(parent());
      DDXMLElement * myRealParent = myRegistry_->getElement(parent());
      DDName pName = myRealParent->getDDName(nmspace);
      std::string tn = pName.name() + std::string("Rotation");
      std::vector<std::string> names;
      names.push_back("name");
      //no need, used already names.push_back("axis");
      //no need, used already names.push_back("angle");

      std::vector<std::string> values;
      values.push_back(tn);
      //no need, used already values.push_back(atts.find("axis")->second);
      //no need, used already values.push_back(atts.find("angle")->second);
      clear();
      loadAttributes(name, names, values, nmspace, cpv);
    }
    DDRotation rot = DDrot(getDDName(nmspace), ddr);
      
    clear();
  }
  else { } //let the parent handle the clearing, etc.

  DCOUT_V('P', "DDLRotationByAxis::processElement completed");
}
DDRotationMatrix DDLRotationByAxis::processOne ( DDRotationMatrix  R,
std::string &  axis,
std::string &  angle 
) [virtual]

Get the name, axis and angle of the RotationByAxis and do it.

Definition at line 83 of file DDLRotationByAxis.cc.

References ExprEvalInterface::eval(), instance, lumiQueryAPI::msg, pName, pNameSpace, dttmaxenums::R, and DDXMLElement::throwError().

Referenced by DDLRotationSequence::processElement(), and processElement().

{
  ExprEvalInterface & ev = ExprEvalSingleton::instance();
  double dAngle = ev.eval(pNameSpace, angle);
  //  CLHEP::HepRotation R;

  if ( axis == "x") {
    R = ROOT::Math::RotationX(dAngle);
  }
  else if ( axis == "y" ) {
    R = ROOT::Math::RotationY(dAngle);      
  }
  else if ( axis =="z" ) {
    R = ROOT::Math::RotationZ(dAngle);
  }
  else {
    std::string msg = "\nDDLRotationByAxis invalid axis... you must not have validated XML sources!  Element is ";
    msg += pName;
    throwError(msg);
  }
  
  return R;
}

Member Data Documentation

std::string DDLRotationByAxis::pName [private]

Definition at line 45 of file DDLRotationByAxis.h.

Referenced by preProcessElement(), processElement(), and processOne().

std::string DDLRotationByAxis::pNameSpace [private]

Definition at line 44 of file DDLRotationByAxis.h.

Referenced by preProcessElement(), and processOne().