Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:08:10

0001 /** Implementation of the Model for GEM Geometry
0002  *
0003  *  \author M. Maggi - INFN Bari
0004  */
0005 
0006 #include "Geometry/GEMGeometry/interface/GEMGeometry.h"
0007 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0008 
0009 GEMGeometry::GEMGeometry() {}
0010 
0011 GEMGeometry::~GEMGeometry() {}
0012 
0013 const GEMGeometry::DetTypeContainer& GEMGeometry::detTypes() const { return theEtaPartitionTypes; }
0014 
0015 const GEMGeometry::DetContainer& GEMGeometry::detUnits() const { return theEtaPartitions; }
0016 
0017 const GEMGeometry::DetContainer& GEMGeometry::dets() const { return theDets; }
0018 
0019 const GEMGeometry::DetIdContainer& GEMGeometry::detUnitIds() const { return theEtaPartitionIds; }
0020 
0021 const GEMGeometry::DetIdContainer& GEMGeometry::detIds() const { return theDetIds; }
0022 
0023 const GeomDet* GEMGeometry::idToDetUnit(DetId id) const { return dynamic_cast<const GeomDet*>(idToDet(id)); }
0024 
0025 const GeomDet* GEMGeometry::idToDet(DetId id) const {
0026   mapIdToDet::const_iterator i = theMap.find(GEMDetId(id).rawId());
0027   return (i != theMap.end()) ? i->second : nullptr;
0028 }
0029 
0030 const std::vector<const GEMRegion*>& GEMGeometry::regions() const { return allRegions; }
0031 
0032 const std::vector<const GEMStation*>& GEMGeometry::stations() const { return allStations; }
0033 
0034 const std::vector<const GEMRing*>& GEMGeometry::rings() const { return allRings; }
0035 
0036 const std::vector<const GEMSuperChamber*>& GEMGeometry::superChambers() const { return allSuperChambers; }
0037 
0038 const std::vector<const GEMChamber*>& GEMGeometry::chambers() const { return allChambers; }
0039 
0040 const std::vector<const GEMEtaPartition*>& GEMGeometry::etaPartitions() const { return allEtaPartitions; }
0041 
0042 const GEMRegion* GEMGeometry::region(int re) const {
0043   for (auto region : allRegions) {
0044     if (re != region->region())
0045       continue;
0046     return region;
0047   }
0048   return nullptr;
0049 }
0050 
0051 const GEMStation* GEMGeometry::station(int re, int st) const {
0052   for (auto station : allStations) {
0053     if (re != station->region() || st != station->station())
0054       continue;
0055     return station;
0056   }
0057   return nullptr;
0058 }
0059 
0060 const GEMRing* GEMGeometry::ring(int re, int st, int ri) const {
0061   for (auto ring : allRings) {
0062     if (re != ring->region() || st != ring->station() || ri != ring->ring())
0063       continue;
0064     return ring;
0065   }
0066   return nullptr;
0067 }
0068 
0069 const GEMSuperChamber* GEMGeometry::superChamber(GEMDetId id) const {
0070   return dynamic_cast<const GEMSuperChamber*>(idToDet(id.superChamberId()));
0071 }
0072 
0073 const GEMChamber* GEMGeometry::chamber(GEMDetId id) const {
0074   return dynamic_cast<const GEMChamber*>(idToDet(id.chamberId()));
0075 }
0076 
0077 const GEMEtaPartition* GEMGeometry::etaPartition(GEMDetId id) const {
0078   return dynamic_cast<const GEMEtaPartition*>(idToDetUnit(id));
0079 }
0080 
0081 void GEMGeometry::add(const GEMRegion* region) { allRegions.emplace_back(region); }
0082 
0083 void GEMGeometry::add(const GEMStation* station) { allStations.emplace_back(station); }
0084 
0085 void GEMGeometry::add(const GEMRing* ring) { allRings.emplace_back(ring); }
0086 
0087 void GEMGeometry::add(const GEMSuperChamber* superChamber) {
0088   allSuperChambers.emplace_back(superChamber);
0089   theDets.emplace_back(superChamber);
0090   theDetIds.emplace_back(superChamber->geographicalId());
0091   theMap.insert(std::make_pair((superChamber->geographicalId()).rawId(), superChamber));
0092 }
0093 
0094 void GEMGeometry::add(const GEMEtaPartition* etaPartition) {
0095   theDets.emplace_back(etaPartition);
0096   allEtaPartitions.emplace_back(etaPartition);
0097   theEtaPartitions.emplace_back(etaPartition);
0098   theEtaPartitionIds.emplace_back(etaPartition->geographicalId());
0099   theDetIds.emplace_back(etaPartition->geographicalId());
0100   theEtaPartitionTypes.emplace_back(&etaPartition->type());
0101   theMap.insert(std::make_pair((etaPartition->geographicalId()).rawId(), etaPartition));
0102 }
0103 
0104 void GEMGeometry::add(const GEMChamber* chamber) {
0105   allChambers.emplace_back(chamber);
0106   theDets.emplace_back(chamber);
0107   theDetIds.emplace_back(chamber->geographicalId());
0108   theMap.insert(std::make_pair((chamber->geographicalId()).rawId(), chamber));
0109 }
0110 
0111 bool GEMGeometry::hasME0() const { return station(1, 0) != nullptr and station(-1, 0) != nullptr; }
0112 
0113 bool GEMGeometry::hasGE11() const { return station(1, 1) != nullptr and station(-1, 1) != nullptr; }
0114 
0115 bool GEMGeometry::hasGE21() const { return station(1, 2) != nullptr and station(-1, 2) != nullptr; }