00001 /*************************************************************************** 00002 DDLReflectionSolid.cc - description 00003 ------------------- 00004 begin : Mon Mar 4, 2002 00005 email : case@ucdhep.ucdavis.edu 00006 ***************************************************************************/ 00007 00008 /*************************************************************************** 00009 * * 00010 * DDDParser sub-component of DDD * 00011 * * 00012 ***************************************************************************/ 00013 00014 #include "DetectorDescription/Parser/src/DDLReflectionSolid.h" 00015 #include "DetectorDescription/Parser/src/DDXMLElement.h" 00016 00017 #include "DetectorDescription/Core/interface/DDName.h" 00018 #include "DetectorDescription/Core/interface/DDSolid.h" 00019 #include "DetectorDescription/Base/interface/DDdebug.h" 00020 00021 DDLReflectionSolid::DDLReflectionSolid( DDLElementRegistry* myreg ) 00022 : DDLSolid( myreg ) 00023 {} 00024 00025 DDLReflectionSolid::~DDLReflectionSolid( void ) 00026 {} 00027 00028 // Upon starting a ReflectionSolid element, we need to clear all rSolids. 00029 void 00030 DDLReflectionSolid::preProcessElement( const std::string& name, const std::string& nmspace, DDCompactView& cpv ) 00031 { 00032 myRegistry_->getElement("rSolid")->clear(); 00033 } 00034 00035 // Upon ending a ReflectionSolid element, call DDCore giving the solid name, and dimensions. 00036 void 00037 DDLReflectionSolid::processElement( const std::string& name, const std::string& nmspace, DDCompactView& cpv ) 00038 { 00039 DCOUT_V('P', "DDLReflectionSolid::processElement started"); 00040 00041 // get solid reference: 00042 DDXMLElement* myrSolid = myRegistry_->getElement("rSolid"); 00043 00044 if (myrSolid->size() != 1) 00045 { 00046 std::cout << "WARNING: A ReflectionSolid had more than one rSolid. " 00047 << "The first one was used." << std::endl; 00048 std::cout << "The element to look for is " << getDDName(nmspace) << std::endl; 00049 } 00050 00051 DDSolid solid = DDSolid(myrSolid->getDDName(nmspace)); 00052 DDSolid ddreflsol = DDSolidFactory::reflection(getDDName(nmspace), solid); 00053 00054 DDLSolid::setReference(nmspace, cpv); 00055 00056 DCOUT_V('P', "DDLReflectionSolid::processElement completed"); 00057 }