00001 00006 #include <Geometry/RPCGeometry/interface/RPCGeometry.h> 00007 #include <Geometry/CommonDetUnit/interface/GeomDetUnit.h> 00008 00009 RPCGeometry::RPCGeometry(){} 00010 00011 00012 RPCGeometry::~RPCGeometry() 00013 { 00014 // delete all the chamber associated to the geometry 00015 //for (std::vector<RPCChamber*>::const_iterator ich = allChambers.begin(); 00016 // ich != allChambers.end(); ++ich){ 00017 // delete (*ich); 00018 //} 00019 } 00020 00021 00022 const RPCGeometry::DetTypeContainer& RPCGeometry::detTypes() const{ 00023 return theRollTypes; 00024 } 00025 00026 00027 const RPCGeometry::DetUnitContainer& RPCGeometry::detUnits() const{ 00028 return theRolls; 00029 } 00030 00031 00032 const RPCGeometry::DetContainer& RPCGeometry::dets() const{ 00033 return theDets; 00034 } 00035 00036 00037 const RPCGeometry::DetIdContainer& RPCGeometry::detUnitIds() const{ 00038 return theRollIds; 00039 } 00040 00041 00042 const RPCGeometry::DetIdContainer& RPCGeometry::detIds() const{ 00043 return theDetIds; 00044 } 00045 00046 00047 const GeomDetUnit* RPCGeometry::idToDetUnit(DetId id) const{ 00048 return dynamic_cast<const GeomDetUnit*>(idToDet(id)); 00049 } 00050 00051 00052 const GeomDet* RPCGeometry::idToDet(DetId id) const{ 00053 mapIdToDet::const_iterator i = theMap.find(id); 00054 return (i != theMap.end()) ? 00055 i->second : 0 ; 00056 } 00057 00058 const std::vector<RPCChamber*>& RPCGeometry::chambers() const { 00059 return allChambers; 00060 } 00061 00062 const std::vector<RPCRoll*>& RPCGeometry::rolls() const{ 00063 return allRolls; 00064 } 00065 00066 const RPCChamber* RPCGeometry::chamber(RPCDetId id) const{ 00067 return dynamic_cast<const RPCChamber*>(idToDet(id.chamberId())); 00068 } 00069 00070 const RPCRoll* RPCGeometry::roll(RPCDetId id) const{ 00071 return dynamic_cast<const RPCRoll*>(idToDetUnit(id)); 00072 } 00073 00074 00075 void 00076 RPCGeometry::add(RPCRoll* roll){ 00077 theDets.push_back(roll); 00078 allRolls.push_back(roll); 00079 theRolls.push_back(roll); 00080 theRollIds.push_back(roll->geographicalId()); 00081 theDetIds.push_back(roll->geographicalId()); 00082 GeomDetType* _t = const_cast<GeomDetType*>(&roll->type()); 00083 theRollTypes.push_back(_t); 00084 theMap.insert(std::pair<DetId,GeomDetUnit*> 00085 (roll->geographicalId(),roll)); 00086 } 00087 00088 void 00089 RPCGeometry::add(RPCChamber* chamber){ 00090 allChambers.push_back(chamber); 00091 theDets.push_back(chamber); 00092 theDetIds.push_back(chamber->geographicalId()); 00093 theMap.insert(std::pair<DetId,GeomDet*> 00094 (chamber->geographicalId(),chamber)); 00095 }