17 const std::vector<int>& zoneBoundaries,
51 std::map<int, TriggerPrimitiveCollection>::const_iterator map_tp_it = selected_prim_map.begin();
52 std::map<int, TriggerPrimitiveCollection>::const_iterator map_tp_end = selected_prim_map.end();
54 for (; map_tp_it != map_tp_end; ++map_tp_it) {
56 int selected = map_tp_it->first;
59 int pc_station = selected / 9;
60 int pc_chamber = selected % 9;
63 TriggerPrimitiveCollection::const_iterator tp_it = map_tp_it->second.begin();
64 TriggerPrimitiveCollection::const_iterator tp_end = map_tp_it->second.end();
66 for (; tp_it != tp_end; ++tp_it) {
69 convert_csc(pc_sector, pc_station, pc_chamber, pc_segment, *tp_it, conv_hit);
71 convert_rpc(pc_sector, pc_station, pc_chamber, pc_segment, *tp_it, conv_hit);
73 convert_gem(pc_sector, 0, selected, pc_segment, *tp_it, conv_hit);
75 convert_me0(pc_sector, 0, selected, pc_segment, *tp_it, conv_hit);
77 convert_dt(pc_sector, 0, selected, pc_segment, *tp_it, conv_hit);
81 conv_hits.push_back(conv_hit);
98 int tp_endcap = tp_detId.
endcap();
100 int tp_station = tp_detId.
station();
101 int tp_ring = tp_detId.
ring();
102 int tp_chamber = tp_detId.
chamber();
104 int tp_bx = tp_data.bx;
105 int tp_csc_ID = tp_data.cscID;
109 int tp_subsector = (tp_station != 1) ? 0 : ((tp_chamber % 6 > 2) ? 1 : 2);
111 const bool is_neighbor = (pc_station == 5);
113 int csc_nID = tp_csc_ID;
118 csc_nID = (pc_chamber < 3) ? (pc_chamber + 12) : (((pc_chamber - 1) % 2) + 9);
121 if (tp_station == 1) {
131 conv_hit.
set_endcap((tp_endcap == 2) ? -1 : tp_endcap);
172 double glob_eta =
gp.eta();
173 double glob_rho =
gp.perp();
174 double glob_z =
gp.z();
185 const bool is_neighbor = conv_hit.
Neighbor();
192 const int fw_endcap = (
endcap_ - 1);
193 const int fw_sector = (
sector_ - 1);
194 const int fw_station =
196 const int fw_cscid = (conv_hit.
CSC_nID() - 1);
197 const int fw_strip = conv_hit.
Strip();
198 const int fw_wire = conv_hit.
Wire();
207 const bool is_me11a = (conv_hit.
Station() == 1 && conv_hit.
Ring() == 4);
208 const bool is_me11b = (conv_hit.
Station() == 1 && conv_hit.
Ring() == 1);
209 const bool is_me13 = (conv_hit.
Station() == 1 && conv_hit.
Ring() == 3);
213 bool ph_reverse =
false;
214 if ((fw_endcap == 0 && fw_station >= 3) || (fw_endcap == 1 && fw_station < 3))
220 if (fw_station <= 1 && ((fw_cscid >= 6 && fw_cscid <= 8) || fw_cscid == 14))
222 else if (fw_station >= 2 && (fw_cscid <= 2 || fw_cscid == 9))
229 bool is_10degree =
false;
230 if ((fw_station <= 1) ||
231 (fw_station >= 2 && ((fw_cscid >= 3 && fw_cscid <= 8) || fw_cscid == 10))
239 int pc_lut_id = pc_chamber;
240 if (pc_station == 0) {
241 pc_lut_id = is_me11a ? pc_lut_id + 9 : pc_lut_id;
242 }
else if (pc_station == 1) {
244 pc_lut_id = is_me11a ? pc_lut_id + 9 : pc_lut_id;
245 }
else if (pc_station == 2) {
247 }
else if (pc_station == 3) {
249 }
else if (pc_station == 4) {
251 }
else if (pc_station == 5 && pc_chamber < 3) {
252 pc_lut_id = is_me11a ? pc_lut_id + 15 : pc_lut_id + 12;
253 }
else if (pc_station == 5 && pc_chamber < 5) {
254 pc_lut_id += 28 + 9 - 3;
255 }
else if (pc_station == 5 && pc_chamber < 7) {
256 pc_lut_id += 39 + 9 - 5;
257 }
else if (pc_station == 5 && pc_chamber < 9) {
258 pc_lut_id += 50 + 9 - 7;
263 std::cout <<
"pc_station: " << pc_station <<
" pc_chamber: " << pc_chamber <<
" fw_station: " << fw_station
264 <<
" fw_cscid: " << fw_cscid <<
" lut_id: " << pc_lut_id
276 int eighth_strip = 0;
283 bool bugStrip0BeforeFW48200 =
false;
284 if (bugStrip0BeforeFW48200 ==
false && fw_strip == 0 && clct_pat_corr_sign == -1)
288 eighth_strip = fw_strip << 2;
289 eighth_strip += clct_pat_corr_sign * (clct_pat_corr >> 1);
291 eighth_strip = fw_strip << 3;
292 eighth_strip += clct_pat_corr_sign * (clct_pat_corr >> 0);
294 emtf_assert(bugStrip0BeforeFW48200 ==
true || eighth_strip >= 0);
319 int ph_tmp = (eighth_strip *
factor) >> 10;
320 int ph_tmp_sign = (ph_reverse == 0) ? 1 : -1;
323 fph = fph + ph_tmp_sign * ph_tmp;
326 ph_hit = (ph_hit >> 1) + ph_tmp_sign * (ph_tmp >> 5) + ph_coverage;
331 ph_hit_fixed = ph_hit_fixed + ((fph + (1 << 4)) >> 5);
334 ph_hit = ph_hit_fixed;
341 zone_hit_fixed += ph_hit_fixed;
346 zone_hit = zone_hit_fixed;
355 int pc_wire_id = (fw_wire & 0x7f);
356 int th_tmp =
pc_lut().
get_th_lut(fw_endcap, fw_sector, pc_lut_id, pc_wire_id);
360 int pc_wire_strip_id =
361 (((fw_wire >> 4) & 0x3) << 5) | ((eighth_strip >> 4) & 0x1f);
366 bool bugME11DupesBeforeFW47114 =
false;
367 if (bugME11DupesBeforeFW47114) {
368 if (pc_segment == 1) {
369 pc_wire_strip_id = (((fw_wire >> 4) & 0x3) << 5) | (0);
375 int th_corr_sign = (ph_reverse == 0) ? 1 : -1;
377 th_tmp = th_tmp + th_corr_sign * th_corr;
380 const int th_negative = 50;
381 const int th_coverage = 45;
382 if (th_tmp > th_negative || th_tmp < 0 || fw_wire == 0)
384 if (th_tmp > th_coverage)
385 th_tmp = th_coverage;
388 int pc_wire_strip_id =
389 (((fw_wire >> 4) & 0x3) << 5) | ((eighth_strip >> 4) & 0x1f);
391 pc_wire_strip_id = (((fw_wire >> 4) & 0x3) << 5) | ((((eighth_strip * 341) >> 8) >> 4) &
395 th_tmp = th_tmp + th_corr;
398 const int th_coverage = 46;
401 if (th_tmp > th_coverage)
402 th_tmp = th_coverage;
411 th = (th == 0) ? 1 : th;
421 int fs_segment =
get_fs_segment(conv_hit, fw_station, fw_cscid, pc_segment);
423 int bt_station =
get_bt_station(conv_hit, fw_station, fw_cscid, pc_segment);
424 int bt_segment =
get_bt_segment(conv_hit, fw_station, fw_cscid, pc_segment);
459 int tp_region = tp_detId.
region();
460 int tp_endcap = (tp_region == -1) ? 2 : tp_region;
461 int tp_sector = tp_detId.
sector();
463 int tp_station = tp_detId.
station();
464 int tp_ring = tp_detId.
ring();
465 int tp_roll = tp_detId.
roll();
468 int tp_bx = tp_data.bx;
469 int tp_strip = ((tp_data.strip_low + tp_data.strip_hi) / 2);
471 const bool is_neighbor = (pc_station == 5);
474 int csc_tp_chamber = (tp_sector - 1) * 6 + tp_subsector;
475 int csc_tp_sector = (tp_subsector > 2) ? tp_sector : ((tp_sector + 4) % 6) + 1;
476 int csc_tp_subsector = (tp_station != 1) ? 0 : ((csc_tp_chamber % 6 > 2) ? 1 : 2);
478 const bool is_irpc = (tp_station == 3 || tp_station == 4) && (tp_ring == 1);
480 csc_tp_chamber = (tp_sector - 1) * 3 + tp_subsector;
481 csc_tp_sector = (tp_subsector > 1) ? tp_sector : ((tp_sector + 4) % 6) + 1;
482 csc_tp_subsector = (tp_station != 1) ? 0 : ((csc_tp_chamber % 6 > 2) ? 1 : 2);
486 int csc_nID = tp_csc_ID;
491 csc_nID = (pc_chamber < 3) ? (pc_chamber + 12) : (((pc_chamber - 1) % 2) + 9);
496 int tp_quality = (tp_data.strip_hi - tp_data.strip_low + 1);
507 conv_hit.
set_endcap((tp_endcap == 2) ? -1 : tp_endcap);
542 bool use_fullsim_coords =
true;
544 if (tp_data.isCPPF) {
547 }
else if (use_fullsim_coords) {
551 double glob_eta =
gp.eta();
552 double glob_rho =
gp.perp();
553 double glob_z =
gp.z();
571 th = (th == 0) ? 1 : th;
579 glob_eta = new_gp.
eta();
580 glob_rho = new_gp.
perp();
588 th = (th == 0) ? 1 : th;
608 const bool is_neighbor = conv_hit.
Neighbor();
616 const int fw_station = (conv_hit.
Station() == 1) ? (is_neighbor ? 0 : pc_station) : conv_hit.
Station();
617 const int fw_cscid = (conv_hit.
CSC_nID() - 1);
619 int fph = conv_hit.
Phi_fp();
623 bool use_cppf_lut = !isCPPF;
654 th = (th == 0) ? 1 : th;
658 std::cout <<
"RPC hit pc_station: " << pc_station <<
" pc_chamber: " << pc_chamber <<
" fw_station: " << fw_station
659 <<
" fw_cscid: " << fw_cscid <<
" tp_station: " << conv_hit.
Station() <<
" tp_ring: " << conv_hit.
Ring()
661 <<
" fph: " << fph <<
" th: " << th << std::endl;
667 int zone_hit = ((fph + (1 << 4)) >> 5);
672 int fs_segment =
get_fs_segment(conv_hit, fw_station, fw_cscid, pc_segment);
674 int bt_station =
get_bt_station(conv_hit, fw_station, fw_cscid, pc_segment);
675 int bt_segment =
get_bt_segment(conv_hit, fw_station, fw_cscid, pc_segment);
710 int tp_region = tp_detId.
region();
711 int tp_endcap = (tp_region == -1) ? 2 : tp_region;
712 int tp_station = tp_detId.
station();
713 int tp_ring = tp_detId.
ring();
714 int tp_roll = tp_detId.
roll();
716 int tp_chamber = tp_detId.
chamber();
718 int tp_bx = tp_data.bx;
719 int tp_pad = ((tp_data.pad_low + tp_data.pad_hi) / 2);
726 int tp_subsector = (tp_station != 1) ? 0 : ((tp_chamber % 6 > 2) ? 1 : 2);
728 const bool is_neighbor = (pc_chamber == 12 || pc_chamber == 13);
730 int csc_nID = tp_csc_ID;
735 if (tp_station == 1) {
743 int tp_quality = (tp_data.pad_hi - tp_data.pad_low + 1);
750 conv_hit.
set_endcap((tp_endcap == 2) ? -1 : tp_endcap);
785 bool use_fullsim_coords =
true;
786 if (use_fullsim_coords) {
790 double glob_eta =
gp.eta();
791 double glob_rho =
gp.perp();
792 double glob_z =
gp.z();
800 th = (th == 0) ? 1 : th;
819 const bool is_neighbor = conv_hit.
Neighbor();
827 const int fw_station =
829 const int fw_cscid = (conv_hit.
CSC_nID() - 1);
831 int fph = conv_hit.
Phi_fp();
835 std::cout <<
"GEM hit pc_station: " << pc_station <<
" pc_chamber: " << pc_chamber <<
" fw_station: " << fw_station
836 <<
" fw_cscid: " << fw_cscid <<
" tp_station: " << conv_hit.
Station() <<
" tp_ring: " << conv_hit.
Ring()
837 <<
" tp_sector: " << conv_hit.
Sector() <<
" tp_subsector: " << conv_hit.
Subsector() <<
" fph: " << fph
838 <<
" th: " << th << std::endl;
844 int zone_hit = ((fph + (1 << 4)) >> 5);
849 int fs_segment =
get_fs_segment(conv_hit, fw_station, fw_cscid, pc_segment);
851 int bt_station =
get_bt_station(conv_hit, fw_station, fw_cscid, pc_segment);
852 int bt_segment =
get_bt_segment(conv_hit, fw_station, fw_cscid, pc_segment);
887 int tp_region = tp_detId.
region();
888 int tp_endcap = (tp_region == -1) ? 2 : tp_region;
889 int tp_station = tp_detId.
station();
893 int tp_chamber = tp_detId.
chamber();
895 int tp_bx = tp_data.bx;
896 int tp_pad = tp_data.phiposition;
897 int tp_partition = tp_data.partition;
903 int tp_subsector = 0;
905 const bool is_neighbor = (pc_chamber == 14);
907 int csc_nID = tp_csc_ID;
920 conv_hit.
set_endcap((tp_endcap == 2) ? -1 : tp_endcap);
946 conv_hit.
set_bend(tp_data.deltaphi * (tp_data.bend == 0 ? 1 : -1));
955 bool use_fullsim_coords =
true;
956 if (use_fullsim_coords) {
960 double glob_eta =
gp.eta();
961 double glob_rho =
gp.perp();
962 double glob_z =
gp.z();
968 bool fix_me0_theta_edge =
true;
969 if (fix_me0_theta_edge) {
978 th = (th == 0) ? 1 : th;
1007 int tp_wheel = tp_detId.
wheel();
1008 int tp_station = tp_detId.
station();
1009 int tp_sector = tp_detId.
sector();
1014 if (tp_station == 4) {
1015 if (tp_sector == 13)
1017 else if (tp_sector == 14)
1021 int tp_bx = tp_data.bx;
1022 int tp_phi = tp_data.radialAngle;
1023 int tp_phiB = tp_data.bendingAngle;
1029 int tp_endcap = (tp_wheel > 0) ? +1 : ((tp_wheel < 0) ? 2 : 0);
1032 int tp_subsector = 0;
1034 const bool is_neighbor = (pc_chamber >= 8);
1036 int csc_nID = tp_csc_ID;
1049 conv_hit.
set_endcap((tp_endcap == 2) ? -1 : tp_endcap);
1072 conv_hit.
set_wire(tp_data.theta_bti_group);
1084 bool use_fullsim_coords =
true;
1085 if (use_fullsim_coords) {
1089 double glob_eta =
gp.eta();
1090 double glob_rho =
gp.perp();
1091 double glob_z =
gp.z();
1097 bool fix_dt_phi_edge =
true;
1098 if (fix_dt_phi_edge) {
1104 if ((loc + 22.) < 0. && (loc + 32.) > 0.)
1106 else if ((loc + 360. + 22.) < 0. && (loc + 360. + 32.) > 0.)
1112 th = (th == 0) ? 1 : th;
1138 bool is_me13 = (is_csc && conv_hit.
Station() == 1 && conv_hit.
Ring() == 3);
1145 if (zone_code_tmp & (1 << izone)) {
1147 ((izone == 0) || ((zone_code_tmp & (1 << (izone - 1))) == 0) || is_me13);
1148 bool no_use_bnd2 = (((zone_code_tmp & (1 << (izone + 1))) == 0) || is_me13);
1154 zone_code |= (1 << izone);
1167 if (conv_hit.
Ring() == 1 || conv_hit.
Ring() == 4) {
1168 phzvl = (zone_code >> 0);
1169 }
else if (conv_hit.
Ring() == 2) {
1171 phzvl = (zone_code >> 1);
1173 phzvl = (zone_code >> 2);
1175 }
else if (conv_hit.
Ring() == 3) {
1176 phzvl = (zone_code >> 3);
1182 static const unsigned int zone_code_table[4][3] = {
1184 {0b0011, 0b0100, 0b1000},
1185 {0b0011, 0b1100, 0b1100},
1186 {0b0001, 0b1110, 0b1110},
1187 {0b0001, 0b0110, 0b0110}
1190 static const unsigned int zone_code_table_new[4][3] = {
1192 {0b0011, 0b0110, 0b1000},
1193 {0b0011, 0b1110, 0b1110},
1194 {0b0011, 0b1110, 0b1110},
1195 {0b0001, 0b0110, 0b0110}
1198 unsigned int istation = (conv_hit.
Station() - 1);
1199 unsigned int iring = (conv_hit.
Ring() == 4) ? 0 : (conv_hit.
Ring() - 1);
1201 unsigned int zone_code =
useNewZones_ ? zone_code_table_new[istation][iring] : zone_code_table[istation][iring];
1209 int fs_chamber = -1;
1210 int fs_segment = pc_segment % 2;
1219 const bool is_neighbor = conv_hit.
Neighbor();
1220 if (fw_station <= 1) {
1221 int n = fw_cscid % 3;
1222 fs_chamber = is_neighbor ? 0 : ((fw_station == 0) ? 1 +
n : 4 +
n);
1224 int n = (conv_hit.
Ring() == 1) ? fw_cscid : (fw_cscid - 3);
1225 fs_chamber = is_neighbor ? 0 : 1 +
n;
1228 emtf_assert(fs_history == 0 && (0 <= fs_chamber && fs_chamber < 7) && (0 <= fs_segment && fs_segment < 2));
1232 fs_segment = ((fs_history & 0x3) << 4) | ((fs_chamber & 0x7) << 1) | (fs_segment & 0x1);
1237 int bt_station = fw_station;
1245 int bt_chamber = -1;
1246 int bt_segment = pc_segment % 2;
1256 bt_chamber = fw_cscid + 1;
1257 if (fw_station == 0 && bt_chamber >= 13)
1260 emtf_assert(bt_history == 0 && (0 <= bt_chamber && bt_chamber < 13) && (0 <= bt_segment && bt_segment < 2));
1264 bt_segment = ((bt_history & 0x3) << 5) | ((bt_chamber & 0xf) << 1) | (bt_segment & 0x1);
1269 bool is_csc = conv_hit.
Is_CSC();
1270 bool is_rpc = conv_hit.
Is_RPC();
1271 bool is_irpc = conv_hit.
Is_RPC() && ((conv_hit.
Station() == 3 || conv_hit.
Station() == 4) && (conv_hit.
Ring() == 1));
1273 (conv_hit.
Ring() == 3));
1274 return (is_csc || (is_rpc && !is_irpc && !is_omtf));