31 constexpr
int max_rpc_bx = 2;
32 constexpr
int min_rpc_bx = -2;
43 rpc_hit(
int pbx,
int pstation,
int psector,
int pwheel,
RPCDetId pdet,
int pstrip,
int proll,
int player)
58 BxToHit() : m_hits{} {}
60 static bool outOfRange(
int iBX) {
return (iBX > max_rpc_bx
or iBX < min_rpc_bx); }
62 int&
operator[](
int iBX) {
return m_hits[iBX - min_rpc_bx]; }
64 size_t size()
const {
return m_hits.size(); }
72 std::vector<L1MuDTChambPhDigi> l1ttma_out;
73 std::vector<L1MuDTChambPhDigi> l1ttma_hits_out;
75 std::vector<rpc_hit> vrpc_hit_layer1, vrpc_hit_layer2, vrpc_hit_st3, vrpc_hit_st4;
80 for (
auto digi = (*chamber).second.first; digi != (*chamber).second.second; ++digi) {
83 if (BxToHit::outOfRange(digi->bx()))
85 if (detid.
layer() == 1)
86 vrpc_hit_layer1.emplace_back(digi->bx(),
95 vrpc_hit_st3.emplace_back(digi->bx(),
103 if (detid.
layer() == 2)
104 vrpc_hit_layer2.emplace_back(digi->bx(),
113 vrpc_hit_st4.emplace_back(digi->bx(),
124 vector<int> vcluster_size;
128 std::map<RPCHitCleaner::detId_Ext, int>
hits;
129 int cluster_size = 0;
132 int strip_n1 = -10000;
136 for (
auto digi = (*chamber).second.first; digi != (*chamber).second.second; ++digi) {
137 if (fabs(digi->bx()) > 3)
141 if (
abs(digi->strip() - strip_n1) != 1 || digi->bx() != bx_n1) {
143 vcluster_size.push_back(cluster_size);
154 strip_n1 = digi->strip();
158 vcluster_size.push_back(cluster_size);
160 for (
int wh = -2; wh <= 2; wh++) {
162 for (
int st = 1; st <= 4; st++) {
164 std::vector<int> delta_phib;
165 bool found_hits =
false;
166 std::vector<int> rpc2dt_phi, rpc2dt_phib;
169 for (
unsigned int l1 = 0; l1 < vrpc_hit_layer1.size(); l1++) {
172 int phi1 =
radialAngle(vrpc_hit_layer1[l1].detid, rpcGeometry, vrpc_hit_layer1[l1].
strip);
173 if (vcluster_size[
id] == 2 && itr1 == 0) {
177 if (vcluster_size[
id] == 2 && itr1 == 1) {
179 phi1 = phi1 + (
radialAngle(vrpc_hit_layer1[l1 - 1].detid, rpcGeometry, vrpc_hit_layer1[l1 - 1].
strip));
183 for (
unsigned int l2 = 0; l2 < vrpc_hit_layer2.size(); l2++) {
184 if (vrpc_hit_layer1[l1].
station != st || vrpc_hit_layer2[l2].
station != st)
186 if (vrpc_hit_layer1[l1].sector !=
sec || vrpc_hit_layer2[l2].sector !=
sec)
188 if (vrpc_hit_layer1[l1].
wheel != wh || vrpc_hit_layer2[l2].
wheel != wh)
190 if (vrpc_hit_layer1[l1].
bx != vrpc_hit_layer2[l2].
bx)
195 if (vcluster_size[
id] == 2 && itr2 == 0) {
201 int phi2 =
radialAngle(vrpc_hit_layer2[l2].detid, rpcGeometry, vrpc_hit_layer2[l2].
strip);
202 if (vcluster_size[
id] == 2 && itr2 == 1) {
204 phi2 = phi2 + (
radialAngle(vrpc_hit_layer2[l2 - 1].detid, rpcGeometry, vrpc_hit_layer2[l2 - 1].
strip));
207 int average = ((phi1 + phi2) / 2) << 2;
215 if (vcluster_size[
id] == 2 && itr2 == 1) {
216 int phi1_n1 =
radialAngle(vrpc_hit_layer1[l1 - 1].detid, rpcGeometry, vrpc_hit_layer1[l1 - 1].
strip);
217 int phi2_n1 =
radialAngle(vrpc_hit_layer2[l2 - 1].detid, rpcGeometry, vrpc_hit_layer2[l2 - 1].
strip);
226 rpc2dt_phib.push_back(phi_b);
228 delta_phib.push_back(
abs(phi_b));
230 rpcbx = vrpc_hit_layer1[l1].bx;
235 int min_index =
std::distance(delta_phib.begin(), std::min_element(delta_phib.begin(), delta_phib.end())) + 0;
237 l1ttma_out.emplace_back(rpcbx, wh,
sec - 1, st, rpc2dt_phi[min_index], rpc2dt_phib[min_index], 3, 0, 0, 2);
242 for (
unsigned int l1 = 0; l1 < vrpc_hit_layer1.size(); l1++) {
243 if (vrpc_hit_layer1[l1].
station != st || st > 2 || vrpc_hit_layer1[l1].sector !=
sec ||
244 vrpc_hit_layer1[l1].
wheel != wh)
249 if (vcluster_size[
id] == 2 && itr1 == 0) {
253 int phi2 =
radialAngle(vrpc_hit_layer1[l1].detid, rpcGeometry, vrpc_hit_layer1[l1].
strip);
255 if (vcluster_size[
id] == 2 && itr1 == 1) {
257 phi2 = phi2 + (
radialAngle(vrpc_hit_layer1[l1 - 1].detid, rpcGeometry, vrpc_hit_layer1[l1 - 1].
strip) << 2);
261 l1ttma_hits_out.emplace_back(
262 vrpc_hit_layer1[l1].
bx, wh,
sec - 1, st, phi2, 0, 3,
hit[vrpc_hit_layer1[l1].
bx], 0, 2);
263 hit[vrpc_hit_layer1[l1].bx]++;
266 for (
unsigned int l2 = 0; l2 < vrpc_hit_layer2.size(); l2++) {
267 if (vrpc_hit_layer2[l2].
station != st || st > 2 || vrpc_hit_layer2[l2].sector !=
sec ||
268 vrpc_hit_layer2[l2].
wheel != wh)
273 if (vcluster_size[
id] == 2 && itr1 == 0) {
277 int phi2 =
radialAngle(vrpc_hit_layer2[l2].detid, rpcGeometry, vrpc_hit_layer2[l2].
strip);
279 if (vcluster_size[
id] == 2 && itr1 == 1) {
281 phi2 = phi2 + (
radialAngle(vrpc_hit_layer2[l2 - 1].detid, rpcGeometry, vrpc_hit_layer2[l2 - 1].
strip) << 2);
284 l1ttma_hits_out.emplace_back(
285 vrpc_hit_layer2[l2].
bx, wh,
sec - 1, st, phi2, 0, 3,
hit[vrpc_hit_layer2[l2].
bx], 0, 2);
286 hit[vrpc_hit_layer2[l2].bx]++;
290 for (
unsigned int l1 = 0; l1 < vrpc_hit_st3.size(); l1++) {
291 if (st != 3 || vrpc_hit_st3[l1].
station != 3 || vrpc_hit_st3[l1].
wheel != wh ||
292 vrpc_hit_st3[l1].sector !=
sec)
297 if (vcluster_size[
id] == 2 && itr1 == 0) {
301 int phi2 =
radialAngle(vrpc_hit_st3[l1].detid, rpcGeometry, vrpc_hit_st3[l1].
strip);
303 if (vcluster_size[
id] == 2 && itr1 == 1) {
305 phi2 = phi2 + (
radialAngle(vrpc_hit_st3[l1 - 1].detid, rpcGeometry, vrpc_hit_st3[l1 - 1].
strip) << 2);
308 l1ttma_hits_out.emplace_back(
309 vrpc_hit_st3[l1].
bx, wh,
sec - 1, st, phi2, 0, 3,
hit[vrpc_hit_st3[l1].
bx], 0, 2);
310 hit[vrpc_hit_st3[l1].bx]++;
314 for (
unsigned int l1 = 0; l1 < vrpc_hit_st4.size(); l1++) {
315 if (st != 4 || vrpc_hit_st4[l1].
station != 4 || vrpc_hit_st4[l1].
wheel != wh ||
316 vrpc_hit_st4[l1].sector !=
sec)
321 if (vcluster_size[
id] == 2 && itr1 == 0) {
325 int phi2 =
radialAngle(vrpc_hit_st4[l1].detid, rpcGeometry, vrpc_hit_st4[l1].
strip);
327 if (vcluster_size[
id] == 2 && itr1 == 1) {
329 phi2 = phi2 + (
radialAngle(vrpc_hit_st4[l1 - 1].detid, rpcGeometry, vrpc_hit_st4[l1 - 1].
strip) << 2);
332 l1ttma_hits_out.emplace_back(
333 vrpc_hit_st4[l1].
bx, wh,
sec - 1, st, phi2, 0, 3,
hit[vrpc_hit_st4[l1].
bx], 0, 2);
334 hit[vrpc_hit_st4[l1].bx]++;
356 double globalphi = stripPosition.
phi();
357 int sector = (roll->
id()).sector();
376 float phip1cm = p1cmPRG.
phi();
377 float phim1cm = m1cmPRG.
phi();
378 int direction = (phip1cm - phim1cm) /
abs(phip1cm - phim1cm);
386 int atanv = (
int)(atan((xout - xin) / 34.6) * 512);
389 int rvalue = atanv -
phi / 8;
395 double R[2][2] = {{410.0, 444.8}, {492.7, 527.3}};