CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/DetectorDescription/Parser/src/DDLTubs.cc

Go to the documentation of this file.
00001 /***************************************************************************
00002                           DDLTubs.cpp  -  description
00003                              -------------------
00004     begin                : Mon Oct 29 2001
00005     email                : case@ucdhep.ucdavis.edu
00006  ***************************************************************************/
00007 
00008 /***************************************************************************
00009  *                                                                         *
00010  *           DDDParser sub-component of DDD                                *
00011  *                                                                         *
00012  ***************************************************************************/
00013 
00014 #include "DetectorDescription/Parser/src/DDLTubs.h"
00015 #include "DetectorDescription/Core/interface/DDName.h"
00016 #include "DetectorDescription/Core/interface/DDSolid.h"
00017 #include "DetectorDescription/Base/interface/DDdebug.h"
00018 
00019 #include "DetectorDescription/ExprAlgo/interface/ExprEvalSingleton.h"
00020 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00021 
00022 DDLTubs::DDLTubs( DDLElementRegistry* myreg )
00023   : DDLSolid( myreg )
00024 {}
00025 
00026 DDLTubs::~DDLTubs( void )
00027 {}
00028 
00029 // Upon encountering the end of a Tubs element, call DDCore.
00030 void
00031 DDLTubs::processElement( const std::string& name, const std::string& nmspace, DDCompactView& cpv )
00032 {
00033   DCOUT_V('P', "DDLTubs::processElement started");
00034 
00035   ExprEvalInterface & ev = ExprEvalSingleton::instance();
00036   DDXMLAttribute atts = getAttributeSet();
00037   bool cutInside(false);
00038 
00039   if (atts.find("cutInside") != atts.end()) {
00040     cutInside = (atts.find("cutInside")->second == "true") ? true : false;
00041   }
00042 
00043   if (name == "Tubs")
00044   {
00045     DDSolid myTubs = DDSolidFactory::tubs( getDDName(nmspace),
00046                                            ev.eval(nmspace, atts.find("dz")->second),
00047                                            ev.eval(nmspace, atts.find("rMin")->second),
00048                                            ev.eval(nmspace, atts.find("rMax")->second),
00049                                            ev.eval(nmspace, atts.find("startPhi")->second),
00050                                            ev.eval(nmspace, atts.find("deltaPhi")->second));
00051   }
00052   else if (name == "Tube")
00053   {
00054     DDSolid myTubs = DDSolidFactory::tubs( getDDName(nmspace),
00055                                            ev.eval(nmspace, atts.find("dz")->second),
00056                                            ev.eval(nmspace, atts.find("rMin")->second),
00057                                            ev.eval(nmspace, atts.find("rMax")->second),
00058                                            0,
00059                                            360*deg );
00060   }
00061   else if (name == "TruncTubs")
00062   {      
00063     DDSolid myTT = DDSolidFactory::truncTubs( getDDName(nmspace),
00064                                               ev.eval(nmspace, atts.find("zHalf")->second),
00065                                               ev.eval(nmspace, atts.find("rMin")->second),
00066                                               ev.eval(nmspace, atts.find("rMax")->second),
00067                                               ev.eval(nmspace, atts.find("startPhi")->second), //0. // startPhi
00068                                               ev.eval(nmspace, atts.find("deltaPhi")->second),
00069                                               ev.eval(nmspace, atts.find("cutAtStart")->second),
00070                                               ev.eval(nmspace, atts.find("cutAtDelta")->second),
00071                                               cutInside ); // cutInside
00072   }
00073   else
00074   {
00075     std::string msg = "\nDDLTubs::processElement could not process element.";
00076     throwError(msg);
00077   }
00078   DDLSolid::setReference(nmspace, cpv);
00079 
00080   DCOUT_V('P', "DDLTubs::processElement completed");
00081 
00082 }