CMS 3D CMS Logo

TrackTools.cc
Go to the documentation of this file.
2 
3 namespace emtf {
4 
5  int calc_ring(int station, int csc_ID, int strip) {
6  if (station > 1) {
7  if (csc_ID < 4)
8  return 1;
9  else if (csc_ID < 10)
10  return 2;
11  else
12  return -999;
13  } else if (station == 1) {
14  if (csc_ID < 4 && strip > 127)
15  return 4;
16  else if (csc_ID < 4 && strip >= 0)
17  return 1;
18  else if (csc_ID > 3 && csc_ID < 7)
19  return 2;
20  else if (csc_ID > 6 && csc_ID < 10)
21  return 3;
22  else
23  return -999;
24  } else
25  return -999;
26  }
27 
28  int calc_chamber(int station, int sector, int subsector, int ring, int csc_ID) {
29  int chamber = -999;
30  if (station == 1) {
31  chamber = ((sector - 1) * 6) + csc_ID + 2; // Chamber offset of 2: First chamber in sector 1 is chamber 3
32  if (ring == 2)
33  chamber -= 3;
34  if (ring == 3)
35  chamber -= 6;
36  if (subsector == 2)
37  chamber += 3;
38  if (chamber > 36)
39  chamber -= 36;
40  } else if (ring == 1) {
41  chamber = ((sector - 1) * 3) + csc_ID + 1; // Chamber offset of 1: First chamber in sector 1 is chamber 2
42  if (chamber > 18)
43  chamber -= 18;
44  } else if (ring == 2) {
45  chamber = ((sector - 1) * 6) + csc_ID - 3 + 2; // Chamber offset of 2: First chamber in sector 1 is chamber 3
46  if (chamber > 36)
47  chamber -= 36;
48  }
49  return chamber;
50  }
51 
52  // Calculates special chamber ID for track address sent to uGMT, using CSC_ID, subsector, neighbor, and station
53  int calc_uGMT_chamber(int csc_ID, int subsector, int neighbor, int station) {
54  if (station == 1) {
55  if (csc_ID == 3 && neighbor == 1 && subsector == 2)
56  return 1;
57  else if (csc_ID == 6 && neighbor == 1 && subsector == 2)
58  return 2;
59  else if (csc_ID == 9 && neighbor == 1 && subsector == 2)
60  return 3;
61  else if (csc_ID == 3 && neighbor == 0 && subsector == 2)
62  return 4;
63  else if (csc_ID == 6 && neighbor == 0 && subsector == 2)
64  return 5;
65  else if (csc_ID == 9 && neighbor == 0 && subsector == 2)
66  return 6;
67  else
68  return 0;
69  } else {
70  if (csc_ID == 3 && neighbor == 1)
71  return 1;
72  else if (csc_ID == 9 && neighbor == 1)
73  return 2;
74  else if (csc_ID == 3 && neighbor == 0)
75  return 3;
76  else if (csc_ID == 9 && neighbor == 0)
77  return 4;
78  else
79  return 0;
80  }
81  }
82 
83  // Use CSC trigger sector definitions
84  // Copied from DataFormats/MuonDetId/src/CSCDetId.cc
85  int get_trigger_sector(int ring, int station, int chamber) {
86  int result = 0;
87  if (station > 1 && ring > 1) {
88  result = ((static_cast<unsigned>(chamber - 3) & 0x7f) / 6) + 1; // ch 3-8->1, 9-14->2, ... 1,2 -> 6
89  } else if (station == 1) {
90  result = ((static_cast<unsigned>(chamber - 3) & 0x7f) / 6) + 1; // ch 3-8->1, 9-14->2, ... 1,2 -> 6
91  } else {
92  result = ((static_cast<unsigned>(chamber - 2) & 0x1f) / 3) + 1; // ch 2-4-> 1, 5-7->2, ...
93  }
94  return (result <= 6) ? result
95  : 6; // max sector is 6, some calculations give a value greater than six but this is expected.
96  }
97 
98  // Use CSC trigger "CSC ID" definitions
99  // Copied from DataFormats/MuonDetId/src/CSCDetId.cc
100  int get_trigger_csc_ID(int ring, int station, int chamber) {
101  int result = 0;
102  if (station == 1) {
103  result = (chamber) % 3 + 1; // 1,2,3
104  switch (ring) {
105  case 1:
106  break;
107  case 2:
108  result += 3; // 4,5,6
109  break;
110  case 3:
111  result += 6; // 7,8,9
112  break;
113  case 4: // ME0
114  result = (chamber + 1) % 3 + 1; // 1,2,3
115  break;
116  }
117  } else {
118  if (ring == 1) {
119  result = (chamber + 1) % 3 + 1; // 1,2,3
120  } else {
121  result = (chamber + 3) % 6 + 4; // 4,5,6,7,8,9
122  }
123  }
124  return result;
125  }
126 
127  // Number of halfstrips and wiregroups
128  // +----------------------------+------------+------------+
129  // | Chamber type | Num of | Num of |
130  // | | halfstrips | wiregroups |
131  // +----------------------------+------------+------------+
132  // | ME1/1a | 96 | 48 |
133  // | ME1/1b | 128 | 48 |
134  // | ME1/2 | 160 | 64 |
135  // | ME1/3 | 128 | 32 |
136  // | ME2/1 | 160 | 112 |
137  // | ME3/1, ME4/1 | 160 | 96 |
138  // | ME2/2, ME3/2, ME4/2 | 160 | 64 |
139  // +----------------------------+------------+------------+
140 
141  std::pair<int, int> get_csc_max_strip_and_wire(int station, int ring) {
142  int max_strip = 0; // halfstrip
143  int max_wire = 0; // wiregroup
144  if (station == 1 && ring == 4) { // ME1/1a
145  max_strip = 96;
146  max_wire = 48;
147  } else if (station == 1 && ring == 1) { // ME1/1b
148  max_strip = 128;
149  max_wire = 48;
150  } else if (station == 1 && ring == 2) { // ME1/2
151  max_strip = 160;
152  max_wire = 64;
153  } else if (station == 1 && ring == 3) { // ME1/3
154  max_strip = 128;
155  max_wire = 32;
156  } else if (station == 2 && ring == 1) { // ME2/1
157  max_strip = 160;
158  max_wire = 112;
159  } else if (station >= 3 && ring == 1) { // ME3/1, ME4/1
160  max_strip = 160;
161  max_wire = 96;
162  } else if (station >= 2 && ring == 2) { // ME2/2, ME3/2, ME4/2
163  max_strip = 160;
164  max_wire = 64;
165  }
166  return std::make_pair(max_strip, max_wire);
167  }
168 
169  std::pair<int, int> get_csc_max_pattern_and_quality(int station, int ring) {
170  int max_pattern = 11;
171  int max_quality = 16;
172  return std::make_pair(max_pattern, max_quality);
173  }
174 
175  int get_csc_max_slope(int station, int ring, bool useRun3CCLUT_OTMB, bool useRun3CCLUT_TMB) {
176  int max_slope = 65536; // Uninitialized slope can be 65536. This is expected when CCLUT is not running
177  if (useRun3CCLUT_OTMB and (ring == 1 or ring == 4))
178  max_slope = 16;
179  if (useRun3CCLUT_TMB and (ring == 2 or ring == 3))
180  max_slope = 16;
181  return max_slope;
182  }
183 
184 } // namespace emtf
int calc_chamber(int station, int sector, int subsector, int ring, int csc_ID)
Definition: TrackTools.cc:28
int get_trigger_sector(int ring, int station, int chamber)
Definition: TrackTools.cc:85
int calc_uGMT_chamber(int csc_ID, int subsector, int neighbor, int station)
Definition: TrackTools.cc:53
Definition: Event.h:15
std::pair< int, int > get_csc_max_pattern_and_quality(int station, int ring)
Definition: TrackTools.cc:169
int get_trigger_csc_ID(int ring, int station, int chamber)
Definition: TrackTools.cc:100
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
int get_csc_max_slope(int station, int ring, bool useRun3CCLUT_OTMB, bool useRun3CCLUT_TMB)
Definition: TrackTools.cc:175
int calc_ring(int station, int csc_ID, int strip)
Definition: TrackTools.cc:5
std::pair< int, int > get_csc_max_strip_and_wire(int station, int ring)
Definition: TrackTools.cc:141