CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RPCNameHelper.cc
Go to the documentation of this file.
2 #include <fmt/format.h>
3 
4 const std::array<std::string, 3> RPCNameHelper::regionNames = {{"Endcap-", "Barrel", "Endcap+"}};
5 
6 std::string RPCNameHelper::name(const RPCDetId& detId, const bool useRoll) {
7  return useRoll ? rollName(detId) : chamberName(detId);
8 }
9 
11  std::string chName = chamberName(detId);
12  const int region = detId.region();
13  const int roll = detId.roll();
14 
15  if (region == 0) {
16  if (roll == 1)
17  chName += "_Backward";
18  else if (roll == 3)
19  chName += "_Forward";
20  else
21  chName += "_Middle";
22  } else {
23  if (roll == 1)
24  chName += "_A";
25  else if (roll == 2)
26  chName += "_B";
27  else if (roll == 3)
28  chName += "_C";
29  else if (roll == 4)
30  chName += "_D";
31  else if (roll == 5)
32  chName += "_E";
33  }
34 
35  return chName;
36 }
37 
39  const int region = detId.region();
40  const int sector = detId.sector();
41  if (region != 0) {
42  // Endcap
43  const int disk = detId.region() * detId.station();
44  const int ring = detId.ring();
45  const int nsub = (ring == 1 and detId.station() > 1) ? 3 : 6;
46  const int segment = detId.subsector() + (detId.sector() - 1) * nsub;
47 
48  return fmt::format("RE{:+2d}_R{}_CH{:02d}", disk, ring, segment);
49  } else {
50  // Barrel
51  const int wheel = detId.ring();
52  const int station = detId.station();
53  const int layer = detId.layer();
54  const int subsector = detId.subsector();
55 
56  std::string roll;
57  if (station <= 2) {
58  roll = (layer == 1) ? "in" : "out";
59  } else if (station == 3) {
60  roll = (subsector == 1) ? "-" : "+";
61  } else { // station == 4
62  if (sector == 4) {
63  const static std::array<std::string, 4> ssarr = {{"--", "-", "+", "++"}};
64  roll = ssarr[subsector - 1];
65  } else if (sector != 9 && sector != 11) {
66  roll = (subsector == 1) ? "-" : "+";
67  }
68  }
69 
70  return fmt::format("W{:+2d}_RB{:d}{}_S{:02d}", wheel, station, roll, sector);
71  }
72 
73  return "";
74 }
75 
77  if (region < -1 or region > 1)
78  return "";
79  return regionNames[region + 1];
80 }
static const std::array< std::string, 3 > regionNames
Definition: RPCNameHelper.h:14
const int nsub
static std::string rollName(const RPCDetId &detId)
constexpr std::array< uint8_t, layerIndexSize > layer
int roll() const
Definition: RPCDetId.h:92
int ring() const
Definition: RPCDetId.h:59
static std::string regionName(const int region)
static std::string name(const RPCDetId &detId, const bool useRoll)
Definition: RPCNameHelper.cc:6
int layer() const
Definition: RPCDetId.h:85
static std::string chamberName(const RPCDetId &detId)
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:81
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
Definition: RPCDetId.h:88
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
int station() const
Definition: RPCDetId.h:78