File indexing completed on 2023-04-11 02:04:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include "Geometry/MuonNumbering/interface/DTNumberingScheme.h"
0012 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0013 #include "Geometry/MuonNumbering/interface/MuonBaseNumber.h"
0014 #include "Geometry/MuonNumbering/interface/MuonGeometryConstants.h"
0015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0016
0017
0018
0019 DTNumberingScheme::DTNumberingScheme(const MuonGeometryConstants& muonConstants) { initMe(muonConstants); }
0020
0021 void DTNumberingScheme::initMe(const MuonGeometryConstants& muonConstants) {
0022 int theLevelPart = muonConstants.getValue("level");
0023 theRegionLevel = muonConstants.getValue("mb_region") / theLevelPart;
0024 theWheelLevel = muonConstants.getValue("mb_wheel") / theLevelPart;
0025 theStationLevel = muonConstants.getValue("mb_station") / theLevelPart;
0026 theSuperLayerLevel = muonConstants.getValue("mb_superlayer") / theLevelPart;
0027 theLayerLevel = muonConstants.getValue("mb_layer") / theLevelPart;
0028 theWireLevel = muonConstants.getValue("mb_wire") / theLevelPart;
0029 #ifdef EDM_ML_DEBUG
0030 edm::LogVerbatim("MuonGeom") << "Initialize DTNumberingScheme\ntheRegionLevel " << theRegionLevel
0031 << "\ntheWheelLevel " << theWheelLevel << "\ntheStationLevel " << theStationLevel
0032 << "\ntheSuperLayerLevel " << theSuperLayerLevel << "\ntheLayerLevel " << theLayerLevel
0033 << "\ntheWireLevel " << theWireLevel;
0034 #endif
0035 }
0036
0037 int DTNumberingScheme::baseNumberToUnitNumber(const MuonBaseNumber& num) const {
0038 #ifdef EDM_ML_DEBUG
0039 edm::LogVerbatim("MuonGeom") << "DTNumbering " << num.getLevels();
0040 for (int level = 1; level <= num.getLevels(); level++) {
0041 edm::LogVerbatim("MuonGeom") << level << " " << num.getSuperNo(level) << " " << num.getBaseNo(level);
0042 }
0043 #endif
0044 if (num.getLevels() < theStationLevel) {
0045 edm::LogWarning("MuonGeom") << "DTNumberingScheme::BNToUN: BaseNumber has " << num.getLevels() << " levels, need "
0046 << theStationLevel;
0047 return 0;
0048 }
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 return getDetId(num);
0066 }
0067
0068 int DTNumberingScheme::getDetId(const MuonBaseNumber& num) const {
0069 int wire_id = 0;
0070 int layer_id = 0;
0071 int superlayer_id = 0;
0072 int sector_id = 0;
0073 int station_id = 0;
0074 int wheel_id = 0;
0075
0076
0077 decode(num, wire_id, layer_id, superlayer_id, sector_id, station_id, wheel_id);
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092 DTWireId id(wheel_id, station_id, sector_id, superlayer_id, layer_id, wire_id);
0093
0094 #ifdef EDM_ML_DEBUG
0095 edm::LogVerbatim("MuonGeom") << "DTNumberingScheme: " << id;
0096 #endif
0097
0098 return id.rawId();
0099 }
0100
0101 void DTNumberingScheme::decode(const MuonBaseNumber& num,
0102 int& wire_id,
0103 int& layer_id,
0104 int& superlayer_id,
0105 int& sector_id,
0106 int& station_id,
0107 int& wheel_id) const {
0108 for (int level = 1; level <= num.getLevels(); level++) {
0109
0110 if (level == theWheelLevel) {
0111 const int copyno = num.getBaseNo(level);
0112 wheel_id = copyno - 2;
0113
0114 } else if (level == theStationLevel) {
0115 const int station_tag = num.getSuperNo(level);
0116 const int copyno = num.getBaseNo(level);
0117 station_id = station_tag;
0118 sector_id = copyno + 1;
0119
0120 } else if (level == theSuperLayerLevel) {
0121 const int copyno = num.getBaseNo(level);
0122 superlayer_id = copyno + 1;
0123
0124 } else if (level == theLayerLevel) {
0125 const int copyno = num.getBaseNo(level);
0126 layer_id = copyno + 1;
0127
0128 } else if (level == theWireLevel) {
0129 const int copyno = num.getBaseNo(level);
0130 wire_id = copyno + 1;
0131 }
0132 }
0133 }