#include <DataFormats/MuonDetId/interface/RPCCompDetId.h>
Public Member Functions | |
std::string | dbname () const |
int | disk () const |
int | layer () const |
bool | operator< (const RPCCompDetId &r) const |
Sort Operator based on the name. | |
int | region () const |
int | ring () const |
RPCCompDetId (int region, int ring, int station, int sector, int layer, int subsector, int type) | |
Construct from fully qualified identifier. | |
RPCCompDetId (uint32_t id) | |
RPCCompDetId (const std::string &dbname, int type) | |
Construct from name stored in DB. | |
RPCCompDetId (DetId id) | |
RPCCompDetId () | |
int | sector () const |
int | station () const |
int | subsector () const |
int | type () const |
int | wheel () const |
Static Public Attributes | |
static const int | allLayerId = minLayerId-1 |
static const int | allRegionId = minRegionId-1 |
static const int | allRingId = minRingBarrelId-1 |
static const int | allSectorId = minSectorId-1 |
static const int | allStationId = minStationId-1 |
static const int | allSubSectorId = minSubSectorId-1 |
static const int | maxLayerId = 2 |
static const int | maxRegionId = 1 |
static const int | maxRingBarrelId = 2 |
static const int | maxRingForwardId = 3 |
static const int | maxSectorBarrelId = 12 |
static const int | maxSectorForwardId = 36 |
static const int | maxSectorId = 36 |
static const int | maxStationId = 4 |
static const int | maxSubSectorId = 2 |
static const int | minLayerId = 1 |
static const int | minRegionId = -1 |
static const int | minRingBarrelId = -2 |
static const int | minRingForwardId = 1 |
static const int | minSectorBarrelId = 1 |
static const int | minSectorForwardId = 1 |
static const int | minSectorId = 1 |
static const int | minStationId = 1 |
static const int | minSubSectorId = 1 |
static const int | RingBarrelOffSet = 3 |
Private Member Functions | |
std::string | gasDBname () const |
void | init () |
void | init (int region, int ring, int station, int sector, int layer, int subsector) |
void | initGas () |
Private Attributes | |
std::string | _dbname |
int | _type |
Static Private Attributes | |
static const unsigned int | LayerMask_ = 0X3 |
static const int | LayerNumBits_ = 2 |
static const int | LayerStartBit_ = SectorStartBit_+SectorNumBits_ |
static const int | RegionMask_ = 0X3 |
static const int | RegionNumBits_ = 2 |
static const int | RegionStartBit_ = 0 |
static const unsigned int | RingMask_ = 0X7 |
static const int | RingNumBits_ = 3 |
static const int | RingStartBit_ = RegionStartBit_+RegionNumBits_ |
static const unsigned int | SectorMask_ = 0X3F |
static const int | SectorNumBits_ = 6 |
static const int | SectorStartBit_ = StationStartBit_+StationNumBits_ |
static const unsigned int | StationMask_ = 0X7 |
static const int | StationNumBits_ = 3 |
static const int | StationStartBit_ = RingStartBit_+RingNumBits_ |
static const unsigned int | SubSectorMask_ = 0X3 |
static const int | SubSectorNumBits_ = 2 |
static const int | SubSectorStartBit_ = LayerStartBit_+LayerNumBits_ |
Description: DetId for composite RPC objects
Definition at line 22 of file RPCCompDetId.h.
RPCCompDetId::RPCCompDetId | ( | ) |
Definition at line 18 of file RPCCompDetId.cc.
:DetId(DetId::Muon, MuonSubdetId::RPC),_dbname(""),_type(0){}
RPCCompDetId::RPCCompDetId | ( | uint32_t | id | ) |
Construct from a packed id. It is required that the Detector part of id is Muon and the SubDet part is RPC, otherwise an exception is thrown.
Definition at line 20 of file RPCCompDetId.cc.
References DetId::det(), Exception, DetId::Muon, MuonSubdetId::RPC, and DetId::subdetId().
:DetId(id),_dbname(""),_type(0) { if (det()!=DetId::Muon || subdetId()!=MuonSubdetId::RPC) { throw cms::Exception("InvalidDetId") << "RPCCompDetId ctor:" << " det: " << det() << " subdet: " << subdetId() << " is not a valid RPC id"; } }
RPCCompDetId::RPCCompDetId | ( | DetId | id | ) |
Definition at line 31 of file RPCCompDetId.cc.
References DetId::det(), Exception, DetId::Muon, MuonSubdetId::RPC, and DetId::subdetId().
:DetId(id),_dbname(""),_type(0) { if (det()!=DetId::Muon || subdetId()!=MuonSubdetId::RPC) { throw cms::Exception("InvalidDetId") << "RPCCompDetId ctor:" << " det: " << det() << " subdet: " << subdetId() << " is not a valid RPC id"; } }
RPCCompDetId::RPCCompDetId | ( | int | region, |
int | ring, | ||
int | station, | ||
int | sector, | ||
int | layer, | ||
int | subsector, | ||
int | type | ||
) |
RPCCompDetId::RPCCompDetId | ( | const std::string & | dbname, |
int | type | ||
) |
Construct from name stored in DB.
Definition at line 54 of file RPCCompDetId.cc.
References init().
: DetId(DetId::Muon, MuonSubdetId::RPC),_dbname(name),_type(type) { this->init(); }
std::string RPCCompDetId::dbname | ( | ) | const |
Definition at line 122 of file RPCCompDetId.cc.
References _dbname, a, gasDBname(), and type().
Referenced by initGas(), and operator<().
int RPCCompDetId::disk | ( | ) | const |
Definition at line 90 of file RPCCompDetId.cc.
References allStationId, region(), and station().
Referenced by gasDBname().
{ int d=allStationId; if (this->region()!=0) d=this->station(); return d; }
std::string RPCCompDetId::gasDBname | ( | ) | const [private] |
Definition at line 275 of file RPCCompDetId.cc.
References abs, disk(), layer(), region(), ring(), sector(), station(), subsector(), and wheel().
Referenced by dbname().
{ std::stringstream os; if(this->region()==0){ // Barrel std::string wsign="P"; if (this->wheel()<0)wsign= "M"; std::string lr=""; if (this->subsector()==1) lr="L"; if (this->subsector()==2) lr="R"; os<<"W"<<wsign<<abs(this->wheel())<<"_S"<<std::setw(2)<<std::setfill('0')<<this->sector()<<"_RB"<<this->station()<<lr; } else { // Endcap std::string esign="P"; if (this->region()<0) esign="M"; os<<"E"<<esign<<this->disk(); if (this->disk()==1){ os<<"_R"<<std::setw(2)<<std::setfill('0')<<this->ring() <<"_C"<<std::setw(2)<<std::setfill('0')<<this->sector() <<"_C"<<std::setw(2)<<std::setfill('0')<<this->sector()+5; }else{ os<<"_R"<<std::setw(2)<<std::setfill('0')<<this->ring() <<"_R"<<std::setw(2)<<std::setfill('0')<<this->ring()+1 <<"_C"<<std::setw(2)<<std::setfill('0')<<this->sector() <<"_C"<<std::setw(2)<<std::setfill('0')<<this->sector()+2; } std::string lay=""; if(this->layer()==1) lay="UP"; else if (this->layer()==2) lay="DW"; os<<"_"<<lay; } return os.str(); }
void RPCCompDetId::init | ( | void | ) | [private] |
Definition at line 179 of file RPCCompDetId.cc.
References initGas(), and type().
Referenced by initGas(), and RPCCompDetId().
void RPCCompDetId::init | ( | int | region, |
int | ring, | ||
int | station, | ||
int | sector, | ||
int | layer, | ||
int | subsector | ||
) | [private] |
Definition at line 133 of file RPCCompDetId.cc.
References allLayerId, allRegionId, allRingId, allSectorId, allStationId, allSubSectorId, Exception, DetId::id_, LayerMask_, LayerStartBit_, maxLayerId, maxRegionId, maxRingBarrelId, maxRingForwardId, maxSectorId, maxStationId, maxSubSectorId, RegionMask_, RegionStartBit_, RingMask_, RingStartBit_, SectorMask_, SectorStartBit_, StationMask_, StationStartBit_, SubSectorMask_, and SubSectorStartBit_.
{ int maxRing=maxRingForwardId; if (!region) { maxRing=maxRingBarrelId; } if ( region < allRegionId || region > maxRegionId || ring < allRingId || ring > maxRing || station < allStationId || station > maxStationId || sector < allSectorId || sector > maxSectorId || layer < allLayerId || layer > maxLayerId || subsector < allSubSectorId || subsector > maxSubSectorId ){ throw cms::Exception("InvalidDetId") << "RPCDetId ctor:" << " Invalid parameters: " << " region "<<region << " ring "<<ring << " station "<<station << " sector "<<sector << " layer "<<layer << " subsector "<<subsector << std::endl; } int regionInBits = region - allRegionId; int ringInBits = ring - allRingId; int stationInBits = station - allStationId; int sectorInBits = sector - allSectorId; int layerInBits = layer - allLayerId; int subSectorInBits = subsector- allSubSectorId; id_ |= ( regionInBits & RegionMask_) << RegionStartBit_ | ( ringInBits & RingMask_) << RingStartBit_ | ( stationInBits & StationMask_) << StationStartBit_ | ( sectorInBits & SectorMask_) << SectorStartBit_ | ( layerInBits & LayerMask_) << LayerStartBit_ | ( subSectorInBits & SubSectorMask_) << SubSectorStartBit_ ; }
void RPCCompDetId::initGas | ( | ) | [private] |
Definition at line 187 of file RPCCompDetId.cc.
References _dbname, allLayerId, allRingId, allSectorId, allStationId, allSubSectorId, dbname(), DetId::det(), Exception, init(), layer(), region(), ring(), sector(), station(), DetId::subdetId(), and subsector().
Referenced by init().
{ std::string buf(this->dbname()); // check if the name contains the dcs namespace if (buf.find(':')!=buf.npos){ buf = buf.substr(buf.find(':')+1,buf.npos); } _dbname=buf; // Check if endcap o barrel int region=0; if(buf.substr(0,1)=="W"){ region=0; }else if(buf.substr(0,2)=="EP"){ region=1; }else if(buf.substr(0,2)=="EM"){ region=-1; }else{ throw cms::Exception("InvalidDBName")<<" RPCCompDetId: "<<this->dbname() <<" is not a valid DB Name for RPCCompDetId" << " det: " << det() << " subdet: " << subdetId(); } int ring=allRingId; int station = allStationId; int sector=allSectorId; int layer=allLayerId; int subsector=allSubSectorId; //Barrel if (region==0) { // Extract the Wheel (named ring) { std::stringstream os; os<<buf.substr(2,1); os>>ring; if (buf.substr(1,1)=="M"){ ring *= -1; } } //Extract the station { std::stringstream os; os<<buf.substr(buf.find("RB")+2,1); os>>station; } //Extract the sector { std::stringstream os; os<<buf.substr(buf.find("S")+1,2); os>>sector; } //Extract subsector of sectors 4 and 10 { if (buf.find("4L")!=buf.npos) subsector=1; if (buf.find("4R")!=buf.npos) subsector=2; } }else{ // Extract the Ring { std::stringstream os; os<<buf.substr(buf.find("_R0")+3,1); os>>ring; } //Extract the disk (named station) { std::stringstream os; os<<buf.substr(2,1); os>>station; } //Extract the sector or chamber { std::stringstream os; os<<buf.substr(buf.find("_C")+2,2); os>>sector; } //Extract layer { if (buf.find("UP")!=buf.npos) layer=1; if (buf.find("DW")!=buf.npos) layer=2; } } this->init(region,ring,station,sector,layer,subsector); }
int RPCCompDetId::layer | ( | ) | const |
Definition at line 105 of file RPCCompDetId.cc.
References allLayerId, DetId::id_, LayerMask_, and LayerStartBit_.
Referenced by gasDBname(), and initGas().
{ return int((id_>>LayerStartBit_) & LayerMask_) + allLayerId; }
bool RPCCompDetId::operator< | ( | const RPCCompDetId & | r | ) | const |
Sort Operator based on the name.
Definition at line 61 of file RPCCompDetId.cc.
References dbname().
int RPCCompDetId::region | ( | ) | const |
Definition at line 66 of file RPCCompDetId.cc.
References allRegionId, DetId::id_, RegionMask_, and RegionStartBit_.
Referenced by disk(), gasDBname(), initGas(), and wheel().
{ return int((id_>>RegionStartBit_) & RegionMask_) + allRegionId; }
int RPCCompDetId::ring | ( | ) | const |
Definition at line 71 of file RPCCompDetId.cc.
References allRingId, DetId::id_, RingMask_, and RingStartBit_.
Referenced by gasDBname(), initGas(), and wheel().
{ return int((id_>>RingStartBit_) & RingMask_) + allRingId; }
int RPCCompDetId::sector | ( | ) | const |
Definition at line 99 of file RPCCompDetId.cc.
References allSectorId, DetId::id_, SectorMask_, and SectorStartBit_.
Referenced by gasDBname(), and initGas().
{ return int((id_>>SectorStartBit_) & SectorMask_) + allSectorId; }
int RPCCompDetId::station | ( | ) | const |
Definition at line 85 of file RPCCompDetId.cc.
References allStationId, DetId::id_, StationMask_, and StationStartBit_.
Referenced by disk(), gasDBname(), and initGas().
{ return int((id_>>StationStartBit_) & StationMask_) + allStationId; }
int RPCCompDetId::subsector | ( | ) | const |
Definition at line 111 of file RPCCompDetId.cc.
References allSubSectorId, DetId::id_, SubSectorMask_, and SubSectorStartBit_.
Referenced by gasDBname(), and initGas().
{ return int((id_>>SubSectorStartBit_) & SubSectorMask_) + allSubSectorId; }
int RPCCompDetId::type | ( | ) | const |
int RPCCompDetId::wheel | ( | ) | const |
std::string RPCCompDetId::_dbname [private] |
Definition at line 130 of file RPCCompDetId.h.
int RPCCompDetId::_type [private] |
Definition at line 131 of file RPCCompDetId.h.
Referenced by type().
const int RPCCompDetId::allLayerId = minLayerId-1 [static] |
Definition at line 85 of file RPCCompDetId.h.
const int RPCCompDetId::allRegionId = minRegionId-1 [static] |
Definition at line 62 of file RPCCompDetId.h.
const int RPCCompDetId::allRingId = minRingBarrelId-1 [static] |
const int RPCCompDetId::allSectorId = minSectorId-1 [static] |
Definition at line 81 of file RPCCompDetId.h.
const int RPCCompDetId::allStationId = minStationId-1 [static] |
const int RPCCompDetId::allSubSectorId = minSubSectorId-1 [static] |
Definition at line 90 of file RPCCompDetId.h.
Referenced by init(), initGas(), and subsector().
const unsigned int RPCCompDetId::LayerMask_ = 0X3 [static, private] |
Definition at line 111 of file RPCCompDetId.h.
const int RPCCompDetId::LayerNumBits_ = 2 [static, private] |
Definition at line 109 of file RPCCompDetId.h.
const int RPCCompDetId::LayerStartBit_ = SectorStartBit_+SectorNumBits_ [static, private] |
Definition at line 110 of file RPCCompDetId.h.
const int RPCCompDetId::maxLayerId = 2 [static] |
Definition at line 84 of file RPCCompDetId.h.
Referenced by init().
const int RPCCompDetId::maxRegionId = 1 [static] |
Definition at line 61 of file RPCCompDetId.h.
Referenced by init().
const int RPCCompDetId::maxRingBarrelId = 2 [static] |
Definition at line 67 of file RPCCompDetId.h.
Referenced by init().
const int RPCCompDetId::maxRingForwardId = 3 [static] |
Definition at line 65 of file RPCCompDetId.h.
Referenced by init().
const int RPCCompDetId::maxSectorBarrelId = 12 [static] |
Definition at line 78 of file RPCCompDetId.h.
const int RPCCompDetId::maxSectorForwardId = 36 [static] |
Definition at line 80 of file RPCCompDetId.h.
const int RPCCompDetId::maxSectorId = 36 [static] |
Definition at line 76 of file RPCCompDetId.h.
Referenced by init().
const int RPCCompDetId::maxStationId = 4 [static] |
Definition at line 72 of file RPCCompDetId.h.
Referenced by init().
const int RPCCompDetId::maxSubSectorId = 2 [static] |
Definition at line 89 of file RPCCompDetId.h.
Referenced by init().
const int RPCCompDetId::minLayerId = 1 [static] |
Definition at line 83 of file RPCCompDetId.h.
const int RPCCompDetId::minRegionId = -1 [static] |
Definition at line 60 of file RPCCompDetId.h.
const int RPCCompDetId::minRingBarrelId = -2 [static] |
Definition at line 66 of file RPCCompDetId.h.
const int RPCCompDetId::minRingForwardId = 1 [static] |
Definition at line 64 of file RPCCompDetId.h.
const int RPCCompDetId::minSectorBarrelId = 1 [static] |
Definition at line 77 of file RPCCompDetId.h.
const int RPCCompDetId::minSectorForwardId = 1 [static] |
Definition at line 79 of file RPCCompDetId.h.
const int RPCCompDetId::minSectorId = 1 [static] |
Definition at line 75 of file RPCCompDetId.h.
const int RPCCompDetId::minStationId = 1 [static] |
Definition at line 71 of file RPCCompDetId.h.
const int RPCCompDetId::minSubSectorId = 1 [static] |
Definition at line 88 of file RPCCompDetId.h.
const int RPCCompDetId::RegionMask_ = 0X3 [static, private] |
Definition at line 95 of file RPCCompDetId.h.
const int RPCCompDetId::RegionNumBits_ = 2 [static, private] |
Definition at line 93 of file RPCCompDetId.h.
const int RPCCompDetId::RegionStartBit_ = 0 [static, private] |
Definition at line 94 of file RPCCompDetId.h.
const int RPCCompDetId::RingBarrelOffSet = 3 [static] |
Definition at line 68 of file RPCCompDetId.h.
const unsigned int RPCCompDetId::RingMask_ = 0X7 [static, private] |
Definition at line 99 of file RPCCompDetId.h.
const int RPCCompDetId::RingNumBits_ = 3 [static, private] |
Definition at line 97 of file RPCCompDetId.h.
const int RPCCompDetId::RingStartBit_ = RegionStartBit_+RegionNumBits_ [static, private] |
Definition at line 98 of file RPCCompDetId.h.
const unsigned int RPCCompDetId::SectorMask_ = 0X3F [static, private] |
Definition at line 107 of file RPCCompDetId.h.
const int RPCCompDetId::SectorNumBits_ = 6 [static, private] |
Definition at line 105 of file RPCCompDetId.h.
const int RPCCompDetId::SectorStartBit_ = StationStartBit_+StationNumBits_ [static, private] |
Definition at line 106 of file RPCCompDetId.h.
const unsigned int RPCCompDetId::StationMask_ = 0X7 [static, private] |
Definition at line 103 of file RPCCompDetId.h.
const int RPCCompDetId::StationNumBits_ = 3 [static, private] |
Definition at line 101 of file RPCCompDetId.h.
const int RPCCompDetId::StationStartBit_ = RingStartBit_+RingNumBits_ [static, private] |
Definition at line 102 of file RPCCompDetId.h.
const unsigned int RPCCompDetId::SubSectorMask_ = 0X3 [static, private] |
Definition at line 115 of file RPCCompDetId.h.
Referenced by init(), and subsector().
const int RPCCompDetId::SubSectorNumBits_ = 2 [static, private] |
Definition at line 113 of file RPCCompDetId.h.
const int RPCCompDetId::SubSectorStartBit_ = LayerStartBit_+LayerNumBits_ [static, private] |
Definition at line 114 of file RPCCompDetId.h.
Referenced by init(), and subsector().