00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "DetectorDescription/Parser/src/DDLTrapezoid.h"
00015
00016 #include "DetectorDescription/Core/interface/DDName.h"
00017 #include "DetectorDescription/Core/interface/DDSolid.h"
00018 #include "DetectorDescription/Base/interface/DDdebug.h"
00019
00020 #include "DetectorDescription/ExprAlgo/interface/ExprEvalSingleton.h"
00021
00022 DDLTrapezoid::DDLTrapezoid( DDLElementRegistry* myreg )
00023 : DDLSolid( myreg )
00024 {}
00025
00026 DDLTrapezoid::~DDLTrapezoid( void )
00027 {}
00028
00029
00030 void
00031 DDLTrapezoid::processElement( const std::string& name, const std::string& nmspace, DDCompactView& cpv )
00032 {
00033 DCOUT_V('P', "DDLTrapezoid::processElement started");
00034
00035 ExprEvalInterface & ev = ExprEvalSingleton::instance();
00036
00037 DDXMLAttribute atts = getAttributeSet();
00038
00039 double phi = 0.0;
00040 double theta = 0.0;
00041 double dy2 = 0.0;
00042
00043 if (atts.find("phi") != atts.end())
00044 phi = ev.eval(nmspace, atts.find("phi")->second);
00045
00046 if (atts.find("theta") != atts.end())
00047 theta = ev.eval(nmspace, atts.find("theta")->second);
00048
00049 if (atts.find("dy2") != atts.end())
00050 dy2 = ev.eval(nmspace, atts.find("dy2")->second);
00051 else if (atts.find("dy1") != atts.end())
00052 dy2 = ev.eval(nmspace, atts.find("dy1")->second);
00053
00054 if (name == "Trapezoid")
00055 {
00056 DDSolid myTrap =
00057 DDSolidFactory::trap( getDDName(nmspace),
00058 ev.eval(nmspace, atts.find("dz")->second),
00059 theta,
00060 phi,
00061 ev.eval(nmspace, atts.find("h1")->second),
00062 ev.eval(nmspace, atts.find("bl1")->second),
00063 ev.eval(nmspace, atts.find("tl1")->second),
00064 ev.eval(nmspace, atts.find("alp1")->second),
00065 ev.eval(nmspace, atts.find("h2")->second),
00066 ev.eval(nmspace, atts.find("bl2")->second),
00067 ev.eval(nmspace, atts.find("tl2")->second),
00068 ev.eval(nmspace, atts.find("alp2")->second));
00069 }
00070 else if (name == "Trd1")
00071 {
00072 DDSolid myTrd1 =
00073 DDSolidFactory::trap( getDDName(nmspace),
00074 ev.eval(nmspace, atts.find("dz")->second),
00075 0,
00076 0,
00077 ev.eval(nmspace, atts.find("dy1")->second),
00078 ev.eval(nmspace, atts.find("dx1")->second),
00079 ev.eval(nmspace, atts.find("dx1")->second),
00080 0,
00081 dy2,
00082 ev.eval(nmspace, atts.find("dx2")->second),
00083 ev.eval(nmspace, atts.find("dx2")->second),
00084 0 );
00085 }
00086 else
00087 {
00088 std::string msg = "\nDDLTrapezoid::processElement failed to process element of name: "
00089 + name
00090 + ". It can only process Trapezoid and Trd1.";
00091 throwError(msg);
00092 }
00093
00094 DDLSolid::setReference( nmspace, cpv );
00095
00096 DCOUT_V('P', "DDLTrapezoid::processElement completed");
00097 }