Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:55:07

0001 #include "DetectorDescription/Parser/src/DDLRotationSequence.h"
0002 #include "DetectorDescription/Core/interface/DDRotationMatrix.h"
0003 #include "DetectorDescription/Core/interface/DDTransform.h"
0004 #include "DetectorDescription/Parser/interface/DDLElementRegistry.h"
0005 #include "DetectorDescription/Parser/src/DDLRotationByAxis.h"
0006 #include "DetectorDescription/Parser/src/DDXMLElement.h"
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 
0009 #include <cstddef>
0010 #include <map>
0011 #include <utility>
0012 
0013 class DDCompactView;
0014 
0015 DDLRotationSequence::DDLRotationSequence(DDLElementRegistry* myreg) : DDLRotationByAxis(myreg) {}
0016 
0017 void DDLRotationSequence::preProcessElement(const std::string& name, const std::string& nmspace, DDCompactView& cpv) {
0018   myRegistry_->getElement("RotationByAxis")->clear();
0019 }
0020 
0021 void DDLRotationSequence::processElement(const std::string& name, const std::string& nmspace, DDCompactView& cpv) {
0022   /** Get the name, axis and angle of each Rotate child and make this the rotation. 
0023    */
0024 
0025   std::shared_ptr<DDLRotationByAxis> myRotations =
0026       std::static_pointer_cast<DDLRotationByAxis>(myRegistry_->getElement("RotationByAxis"));
0027   DDXMLAttribute atts;
0028 
0029   DDRotationMatrix R;
0030   for (size_t i = 0; i < myRotations->size(); ++i) {
0031     atts = myRotations->getAttributeSet(i);
0032     R = myRotations->processOne(R, atts.find("axis")->second, atts.find("angle")->second);
0033   }
0034 
0035   DDRotation rot = DDrot(getDDName(nmspace), std::make_unique<DDRotationMatrix>(R));
0036 
0037   myRotations->clear();
0038   clear();
0039 }