CMS 3D CMS Logo

RPCNumberingScheme.cc
Go to the documentation of this file.
6 
7 //#define LOCAL_DEBUG
8 
9 RPCNumberingScheme::RPCNumberingScheme(const MuonGeometryConstants& muonConstants) { initMe(muonConstants); }
10 
12  int theLevelPart = muonConstants.getValue("level");
13  theRegionLevel = muonConstants.getValue("mr_region") / theLevelPart;
14  theBWheelLevel = muonConstants.getValue("mr_bwheel") / theLevelPart;
15  theBStationLevel = muonConstants.getValue("mr_bstation") / theLevelPart;
16  theBPlaneLevel = muonConstants.getValue("mr_bplane") / theLevelPart;
17  theBChamberLevel = muonConstants.getValue("mr_bchamber") / theLevelPart;
18  theEPlaneLevel = muonConstants.getValue("mr_eplane") / theLevelPart;
19  theESectorLevel = muonConstants.getValue("mr_esector") / theLevelPart;
20  theERollLevel = muonConstants.getValue("mr_eroll") / theLevelPart;
21 #ifdef LOCAL_DEBUG
22  edm::LogVerbatim("RPCNumberingScheme") << "RPCNumberingScheme::theRegionLevel " << theRegionLevel
23  << "\ntheBWheelLevel " << theBWheelLevel << "\ntheBStationLevel "
24  << theBStationLevel << "\ntheBPlaneLevel " << theBPlaneLevel
25  << "\ntheBChamberLevel " << theBChamberLevel << "\ntheEPlaneLevel "
26  << theEPlaneLevel << "\ntheESectorLevel " << theESectorLevel
27  << "\ntheERollLevel " << theERollLevel;
28 #endif
29 }
30 
32 #ifdef LOCAL_DEBUG
33  edm::LogVerbatim("RPCNumberingScheme") << "RPCNumbering " << num.getLevels();
34  for (int level = 1; level <= num.getLevels(); level++) {
35  edm::LogVerbatim("RPCNumberingScheme") << level << " " << num.getSuperNo(level) << " " << num.getBaseNo(level);
36  }
37 #endif
38 
39  const int barrel = num.getSuperNo(theRegionLevel);
40  bool barrel_muon = (barrel == 1);
41  int maxLevel;
42  if (barrel_muon) {
43  maxLevel = theBChamberLevel;
44  } else {
45  maxLevel = theERollLevel;
46  }
47 
48  if (num.getLevels() != maxLevel) {
49  edm::LogWarning("RPCNumberingScheme")
50  << "RPCNumberingScheme::BNToUN: BaseNumber has " << num.getLevels() << " levels, need " << maxLevel;
51  return 0;
52  }
53 
54  int plane_id = 0;
55  int sector_id = 0;
56  int copy_id = 0;
57  int roll_id = 0;
58  int eta_id = 0;
59  int rr12_id = 0;
60  bool forward = false;
61 
62  int sector_copy = 0;
63 
64  //decode significant rpc levels
65 
66  for (int level = 1; level <= maxLevel; level++) {
67  //decode
68  if (level == theRegionLevel) {
69  if (barrel_muon) {
70  roll_id = 0;
71  } else {
72  copy_id = 1;
73  }
74  }
75  if (barrel_muon) {
76  if (level == theBWheelLevel) {
77  const int copyno = num.getBaseNo(level);
78  eta_id = 4 + copyno; //copyno= [0,4]
79  } else if (level == theBStationLevel) {
80  //- const int station_tag = num.getSuperNo(level);
81  const int copyno = num.getBaseNo(level);
82 
83  sector_id = copyno + 1;
84  if (sector_id == 13) {
85  sector_id = 4;
86  sector_copy = 1;
87  } else if (sector_id == 14) {
88  sector_id = 10;
89  sector_copy = 1;
90  }
91  // mltiply by 3 to merge with endcaps
92  sector_id *= 3;
93 
94  } else if (level == theBPlaneLevel) {
95  const int plane_tag = num.getSuperNo(level);
96  // const int copyno = num.getBaseNo(level);
97  if (plane_tag == 1) {
98  plane_id = 1;
99  } else if (plane_tag == 2) {
100  plane_id = 5;
101  } else if (plane_tag == 3) {
102  // if(copyno == 1) {
103  //if(eta_id == 4 || eta_id == 8) {
104  // plane_id=6;
105 
106  plane_id = 2;
107  // }
108 
109  // std::cout<<" KONTROLA w RPCNumberingScheme: eta_id: "<<eta_id<<", plane_tag: "<<plane_tag<<", plane_id: "<<plane_id<<std::endl;
110  } else if (plane_tag == 4) {
111  // if(copyno == 1) {
112  // if(eta_id == 4 || eta_id == 8) {
113  // plane_id=2;
114  //} else {
115  plane_id = 6;
116  //}
117  // std::cout<<" KONTROLA w RPCNumberingScheme: eta_id: "<<eta_id<<", plane_tag: "<<plane_tag<<", plane_id: "<<plane_id<<std::endl;
118  } else if (plane_tag == 5) {
119  plane_id = 3;
120  } else {
121  plane_id = 4;
122  }
123 
124  } else if (level == theBChamberLevel) {
125  const int copyno = num.getBaseNo(level);
126  if ((plane_id == 4) && (sector_id == 4 * 3)) {
127  copy_id = sector_copy * 2 + copyno + 1;
128  } else if ((plane_id == 4) && (sector_id == 10 * 3)) {
129  copy_id = sector_copy + 1;
130  } else {
131  copy_id = copyno + 1;
132  }
133  const int rollno = num.getSuperNo(level);
134  roll_id = rollno;
135  }
136 
137  } else {
138  if (level == theRegionLevel) {
139  const int copyno = num.getBaseNo(level);
140  forward = (copyno == 0);
141  } else if (level == theEPlaneLevel) {
142  const int plane_tag = num.getSuperNo(level);
143  const int rr12_tag = num.getBaseNo(level);
144  plane_id = plane_tag;
145  rr12_id = rr12_tag;
146  } else if (level == theESectorLevel) {
147  const int copyno = num.getBaseNo(level);
148  sector_id = copyno + 1;
149  if (rr12_id == 1) {
150  sector_id = sector_id * 2 - 1;
151  } else if (rr12_id == 2) {
152  sector_id = sector_id * 2;
153  }
154  } else if (level == theERollLevel) {
155  const int copyno = num.getBaseNo(level);
156  const int eta_tag = num.getSuperNo(level);
157 
158  if ((eta_tag == 1) || (eta_tag == 4) || (eta_tag == 7) || (eta_tag == 8)) {
159  eta_id = 1;
160  } else if ((eta_tag == 2) || (eta_tag == 5)) {
161  eta_id = 2;
162  } else if ((eta_tag == 3) || (eta_tag == 6)) {
163  eta_id = 3;
164  }
165 
166  if (forward)
167  eta_id = 12 - eta_id;
168 
169  // increase sector id for 20 degree chambers
170 
171  if ((eta_tag == 4) || (eta_tag == 7) || (eta_tag == 8)) {
172  sector_id *= 2;
173  }
174 
175  roll_id = copyno + 1;
176  }
177  }
178  }
179 
180  // collect all info
181 
182  int trIndex = (eta_id * 10000 + plane_id * 1000 + sector_id * 10 + copy_id) * 10 + roll_id;
183 
184 #ifdef LOCAL_DEBUG
185  if (barrel_muon) {
186  edm::LogVerbatim("RPCNumberingScheme") << "RPCNumberingScheme (barrel): ";
187  } else {
188  if (forward) {
189  edm::LogVerbatim("RPCNumberingScheme") << "RPCNumberingScheme (forward): ";
190  } else {
191  edm::LogVerbatim("RPCNumberingScheme") << "RPCNumberingScheme (backward): ";
192  }
193  }
194  edm::LogVerbatim("RPCNumberingScheme") << " roll " << roll_id << " copy " << copy_id << " sector " << sector_id
195  << " plane " << plane_id << " eta " << eta_id << " rr12 " << rr12_id;
196 #endif
197 
198  // Build the actual numbering
199  RPCDetId id;
200  id.buildfromTrIndex(trIndex);
201 
202 #ifdef LOCAL_DEBUG
203  edm::LogVerbatim("RPCNumberingScheme") << "RPCNumberingScheme:: DetId " << id;
204 #endif
205 
206  return id.rawId();
207 }
personalPlayback.level
level
Definition: personalPlayback.py:22
MuonGeometryConstants
Definition: MuonGeometryConstants.h:20
RPCNumberingScheme::RPCNumberingScheme
RPCNumberingScheme(const MuonGeometryConstants &muonConstants)
Definition: RPCNumberingScheme.cc:9
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
MessageLogger.h
RPCNumberingScheme::theBStationLevel
int theBStationLevel
Definition: RPCNumberingScheme.h:31
MuonGeometryConstants.h
RPCDetId
Definition: RPCDetId.h:16
RPCNumberingScheme::theRegionLevel
int theRegionLevel
Definition: RPCNumberingScheme.h:29
RPCNumberingScheme::theESectorLevel
int theESectorLevel
Definition: RPCNumberingScheme.h:35
RPCNumberingScheme::initMe
void initMe(const MuonGeometryConstants &muonConstants)
Definition: RPCNumberingScheme.cc:11
RPCNumberingScheme::theBWheelLevel
int theBWheelLevel
Definition: RPCNumberingScheme.h:30
RPCNumberingScheme.h
RPCNumberingScheme::theBPlaneLevel
int theBPlaneLevel
Definition: RPCNumberingScheme.h:32
RPCNumberingScheme::theEPlaneLevel
int theEPlaneLevel
Definition: RPCNumberingScheme.h:34
RPCDetId.h
edm::LogWarning
Definition: MessageLogger.h:141
MuonBaseNumber.h
RPCNumberingScheme::theBChamberLevel
int theBChamberLevel
Definition: RPCNumberingScheme.h:33
RPCNumberingScheme::theERollLevel
int theERollLevel
Definition: RPCNumberingScheme.h:36
edm::LogVerbatim
Definition: MessageLogger.h:297
MuonGeometryConstants::getValue
int getValue(const std::string &name) const
Definition: MuonGeometryConstants.cc:8
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
MuonBaseNumber
Definition: MuonBaseNumber.h:21
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
RPCNumberingScheme::baseNumberToUnitNumber
int baseNumberToUnitNumber(const MuonBaseNumber &) override
Definition: RPCNumberingScheme.cc:31