DDLRotationByAxis handles RotationByAxis elements. More...
#include <DDLRotationByAxis.h>
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 |
DDLRotationByAxis handles RotationByAxis elements.
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.
DDLRotationByAxis::DDLRotationByAxis | ( | DDLElementRegistry * | myreg | ) |
DDLRotationByAxis::~DDLRotationByAxis | ( | void | ) | [virtual] |
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; }
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().