File indexing completed on 2023-03-17 13:03:00
0001
0002
0003
0004
0005
0006 #include "Geometry/GEMGeometry/interface/ME0Geometry.h"
0007 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0008
0009 ME0Geometry::ME0Geometry() {}
0010 ME0Geometry::~ME0Geometry() {}
0011
0012 const ME0Geometry::DetTypeContainer& ME0Geometry::detTypes() const { return theEtaPartitionTypes; }
0013
0014 const ME0Geometry::DetContainer& ME0Geometry::detUnits() const { return theEtaPartitions; }
0015
0016 const ME0Geometry::DetContainer& ME0Geometry::dets() const { return theDets; }
0017
0018 const ME0Geometry::DetIdContainer& ME0Geometry::detUnitIds() const { return theEtaPartitionIds; }
0019
0020 const ME0Geometry::DetIdContainer& ME0Geometry::detIds() const { return theDetIds; }
0021
0022 const GeomDet* ME0Geometry::idToDetUnit(DetId id) const { return dynamic_cast<const GeomDet*>(idToDet(id)); }
0023
0024 const GeomDet* ME0Geometry::idToDet(DetId id) const {
0025 mapIdToDet::const_iterator i = theMap.find(id);
0026 return (i != theMap.end()) ? i->second : nullptr;
0027 }
0028
0029 const std::vector<ME0Chamber const*>& ME0Geometry::chambers() const { return allChambers; }
0030
0031 const std::vector<ME0Layer const*>& ME0Geometry::layers() const { return allLayers; }
0032
0033 const std::vector<ME0EtaPartition const*>& ME0Geometry::etaPartitions() const { return allEtaPartitions; }
0034
0035 const ME0EtaPartition* ME0Geometry::etaPartition(ME0DetId id) const {
0036 return dynamic_cast<const ME0EtaPartition*>(idToDetUnit(id));
0037 }
0038
0039 const ME0Layer* ME0Geometry::layer(ME0DetId id) const {
0040 return dynamic_cast<const ME0Layer*>(idToDetUnit(id.layerId()));
0041 }
0042
0043 const ME0Chamber* ME0Geometry::chamber(ME0DetId id) const {
0044 return dynamic_cast<const ME0Chamber*>(idToDetUnit(id.chamberId()));
0045 }
0046
0047 void ME0Geometry::add(ME0EtaPartition* etaPartition) {
0048 allEtaPartitions.emplace_back(etaPartition);
0049 theEtaPartitions.emplace_back(etaPartition);
0050 theEtaPartitionIds.emplace_back(etaPartition->geographicalId());
0051 theDets.emplace_back(etaPartition);
0052 theDetIds.emplace_back(etaPartition->geographicalId());
0053 theEtaPartitionTypes.emplace_back(&etaPartition->type());
0054 theMap.insert(std::pair<DetId, GeomDet*>(etaPartition->geographicalId(), etaPartition));
0055 }
0056
0057 void ME0Geometry::add(ME0Layer* layer) {
0058 allLayers.emplace_back(layer);
0059
0060
0061 theDets.emplace_back(layer);
0062 theDetIds.emplace_back(layer->geographicalId());
0063 theEtaPartitionTypes.emplace_back(&layer->type());
0064 theMap.insert(std::pair<DetId, GeomDet*>(layer->geographicalId(), layer));
0065 }
0066
0067 void ME0Geometry::add(ME0Chamber* chamber) {
0068 allChambers.emplace_back(chamber);
0069 theDets.emplace_back(chamber);
0070 theDetIds.emplace_back(chamber->geographicalId());
0071 theMap.insert(std::pair<DetId, GeomDet*>(chamber->geographicalId(), chamber));
0072 }