File indexing completed on 2024-04-06 12:04:47
0001 #include "DataFormats/MuonDetId/interface/GEMDetId.h"
0002 #include "DataFormats/DetId/interface/DetId.h"
0003
0004 #include <iostream>
0005
0006 int testCell() {
0007 int nerr(0);
0008 for (int re = GEMDetId::minRegionId; re <= GEMDetId::maxRegionId; ++re) {
0009 if (re != 0) {
0010 for (int ri = GEMDetId::minRingId; ri <= GEMDetId::maxRingId; ++ri) {
0011 for (int st = GEMDetId::minStationId; st <= GEMDetId::maxStationId; ++st) {
0012 for (int la = GEMDetId::minLayerId; la <= GEMDetId::maxLayerId; ++la) {
0013 for (int ch = 1 + GEMDetId::minChamberId; ch <= GEMDetId::maxChamberId; ++ch) {
0014 for (int ro = GEMDetId::minEtaPartitionId; ro <= GEMDetId::maxEtaPartitionId; ++ro) {
0015 GEMDetId id(re, ri, st, la, ch, ro);
0016 if ((id.region() != re) || (id.ring() != ri) || (id.station() != st) || (id.layer() != la) ||
0017 (id.chamber() != ch) || (id.roll() != ro)) {
0018 ++nerr;
0019 std::cout << id << " should have been (" << re << ", " << ri << ", " << st << ", " << la << ", " << ch
0020 << ", " << ro << ") " << std::hex << id.rawId() << std::dec << " ***** ERROR *****"
0021 << std::endl;
0022 }
0023 }
0024 }
0025 }
0026 }
0027 }
0028 }
0029 }
0030 return nerr;
0031 }
0032
0033 void testFail() {
0034 unsigned int raw1(671189248), raw2(688425248);
0035 GEMDetId id0(-1, 1, 1, 2, 10, 1);
0036 GEMDetId id1(raw1);
0037 GEMDetId id2(raw2);
0038 std::cout << " ID0: " << std::hex << id0.rawId() << std::dec << ":" << id0.rawId() << " " << id0
0039 << "\n ID1: " << std::hex << id1.rawId() << ":" << raw1 << std::dec << ":" << raw1 << " " << id1
0040 << "\n ID2: " << std::hex << id2.rawId() << ":" << raw2 << std::dec << ":" << raw2 << " " << id2
0041 << std::endl;
0042 }
0043
0044 int main() {
0045 testFail();
0046 return testCell();
0047 }