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