File indexing completed on 2024-04-06 12:05:33
0001 #include "DetectorDescription/Parser/src/DDLTubs.h"
0002 #include "DetectorDescription/Core/interface/DDSolid.h"
0003 #include "DetectorDescription/Core/interface/ClhepEvaluator.h"
0004 #include "DataFormats/Math/interface/GeantUnits.h"
0005 #include "DetectorDescription/Parser/interface/DDLElementRegistry.h"
0006 #include "DetectorDescription/Parser/src/DDLSolid.h"
0007 #include "DetectorDescription/Parser/src/DDXMLElement.h"
0008
0009 #include <map>
0010 #include <utility>
0011
0012 class DDCompactView;
0013
0014 using namespace geant_units::operators;
0015
0016 DDLTubs::DDLTubs(DDLElementRegistry* myreg) : DDLSolid(myreg) {}
0017
0018
0019 void DDLTubs::processElement(const std::string& name, const std::string& nmspace, DDCompactView& cpv) {
0020 ClhepEvaluator& ev = myRegistry_->evaluator();
0021 DDXMLAttribute atts = getAttributeSet();
0022 bool cutInside(false);
0023
0024 if (atts.find("cutInside") != atts.end()) {
0025 cutInside = (atts.find("cutInside")->second == "true") ? true : false;
0026 }
0027
0028 if (name == "Tubs") {
0029 DDSolid myTubs = DDSolidFactory::tubs(getDDName(nmspace),
0030 ev.eval(nmspace, atts.find("dz")->second),
0031 ev.eval(nmspace, atts.find("rMin")->second),
0032 ev.eval(nmspace, atts.find("rMax")->second),
0033 ev.eval(nmspace, atts.find("startPhi")->second),
0034 ev.eval(nmspace, atts.find("deltaPhi")->second));
0035 } else if (name == "Tube") {
0036 DDSolid myTubs = DDSolidFactory::tubs(getDDName(nmspace),
0037 ev.eval(nmspace, atts.find("dz")->second),
0038 ev.eval(nmspace, atts.find("rMin")->second),
0039 ev.eval(nmspace, atts.find("rMax")->second),
0040 0_deg,
0041 360_deg);
0042 } else if (name == "TruncTubs") {
0043 DDSolid myTT = DDSolidFactory::truncTubs(getDDName(nmspace),
0044 ev.eval(nmspace, atts.find("zHalf")->second),
0045 ev.eval(nmspace, atts.find("rMin")->second),
0046 ev.eval(nmspace, atts.find("rMax")->second),
0047 ev.eval(nmspace, atts.find("startPhi")->second),
0048 ev.eval(nmspace, atts.find("deltaPhi")->second),
0049 ev.eval(nmspace, atts.find("cutAtStart")->second),
0050 ev.eval(nmspace, atts.find("cutAtDelta")->second),
0051 cutInside);
0052 } else if (name == "CutTubs") {
0053 DDSolid myTubs = DDSolidFactory::cuttubs(getDDName(nmspace),
0054 ev.eval(nmspace, atts.find("dz")->second),
0055 ev.eval(nmspace, atts.find("rMin")->second),
0056 ev.eval(nmspace, atts.find("rMax")->second),
0057 ev.eval(nmspace, atts.find("startPhi")->second),
0058 ev.eval(nmspace, atts.find("deltaPhi")->second),
0059 ev.eval(nmspace, atts.find("lx")->second),
0060 ev.eval(nmspace, atts.find("ly")->second),
0061 ev.eval(nmspace, atts.find("lz")->second),
0062 ev.eval(nmspace, atts.find("tx")->second),
0063 ev.eval(nmspace, atts.find("ty")->second),
0064 ev.eval(nmspace, atts.find("tz")->second));
0065 } else {
0066 std::string msg = "\nDDLTubs::processElement could not process element.";
0067 throwError(msg);
0068 }
0069 DDLSolid::setReference(nmspace, cpv);
0070 }