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