CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
PrimitiveConversion Class Reference

#include <PrimitiveConversion.h>

Public Member Functions

void configure (const GeometryTranslator *tp_geom, const SectorProcessorLUT *pc_lut, int verbose, int endcap, int sector, int bx, int bxShiftCSC, int bxShiftRPC, int bxShiftGEM, int bxShiftME0, const std::vector< int > &zoneBoundaries, int zoneOverlap, bool duplicateTheta, bool fixZonePhi, bool useNewZones, bool fixME11Edges, bool bugME11Dupes, bool useRun3CCLUT_OTMB, bool useRun3CCLUT_TMB)
 
void convert_csc (int pc_sector, int pc_station, int pc_chamber, int pc_segment, const TriggerPrimitive &muon_primitive, EMTFHit &conv_hit) const
 
void convert_csc_details (EMTFHit &conv_hit) const
 
void convert_dt (int pc_sector, int pc_station, int pc_chamber, int pc_segment, const TriggerPrimitive &muon_primitive, EMTFHit &conv_hit) const
 
void convert_gem (int pc_sector, int pc_station, int pc_chamber, int pc_segment, const TriggerPrimitive &muon_primitive, EMTFHit &conv_hit) const
 
void convert_me0 (int pc_sector, int pc_station, int pc_chamber, int pc_segment, const TriggerPrimitive &muon_primitive, EMTFHit &conv_hit) const
 
void convert_other_details (EMTFHit &conv_hit) const
 
void convert_rpc (int pc_sector, int pc_station, int pc_chamber, int pc_segment, const TriggerPrimitive &muon_primitive, EMTFHit &conv_hit) const
 
void convert_rpc_details (EMTFHit &conv_hit, bool isCPPF) const
 
int get_bt_segment (const EMTFHit &conv_hit, int fw_station, int fw_cscid, int pc_segment) const
 
int get_bt_station (const EMTFHit &conv_hit, int fw_station, int fw_cscid, int pc_segment) const
 
int get_fs_segment (const EMTFHit &conv_hit, int fw_station, int fw_cscid, int pc_segment) const
 
int get_fs_zone_code (const EMTFHit &conv_hit) const
 
int get_phzvl (const EMTFHit &conv_hit, int zone_code) const
 
int get_zone_code (const EMTFHit &conv_hit, int th) const
 
bool is_valid_for_run2 (const EMTFHit &conv_hit) const
 
const SectorProcessorLUTpc_lut () const
 
void process (const std::map< int, TriggerPrimitiveCollection > &selected_prim_map, EMTFHitCollection &conv_hits) const
 

Private Attributes

bool bugME11Dupes_
 
int bx_
 
int bxShiftCSC_
 
int bxShiftGEM_
 
int bxShiftME0_
 
int bxShiftRPC_
 
bool duplicateTheta_
 
int endcap_
 
bool fixME11Edges_
 
bool fixZonePhi_
 
const SectorProcessorLUTpc_lut_
 
int sector_
 
const GeometryTranslatortp_geom_
 
bool useNewZones_
 
bool useRun3CCLUT_OTMB_
 
bool useRun3CCLUT_TMB_
 
int verbose_
 
std::vector< int > zoneBoundaries_
 
int zoneOverlap_
 

Detailed Description

Definition at line 8 of file PrimitiveConversion.h.

Member Function Documentation

void PrimitiveConversion::configure ( const GeometryTranslator tp_geom,
const SectorProcessorLUT pc_lut,
int  verbose,
int  endcap,
int  sector,
int  bx,
int  bxShiftCSC,
int  bxShiftRPC,
int  bxShiftGEM,
int  bxShiftME0,
const std::vector< int > &  zoneBoundaries,
int  zoneOverlap,
bool  duplicateTheta,
bool  fixZonePhi,
bool  useNewZones,
bool  fixME11Edges,
bool  bugME11Dupes,
bool  useRun3CCLUT_OTMB,
bool  useRun3CCLUT_TMB 
)

Definition at line 7 of file PrimitiveConversion.cc.

References bugME11Dupes_, makePileupJSON::bx, bx_, bxShiftCSC_, bxShiftGEM_, bxShiftME0_, bxShiftRPC_, duplicateTheta_, emtf_assert, Reference_intrackfit_cff::endcap, endcap_, fixME11Edges_, fixZonePhi_, pc_lut(), pc_lut_, sector_, tp_geom_, useNewZones_, useRun3CCLUT_OTMB_, useRun3CCLUT_TMB_, verbose, verbose_, zoneBoundaries_, and zoneOverlap_.

Referenced by SectorProcessor::process_single_bx().

25  {
26  emtf_assert(tp_geom != nullptr);
27  emtf_assert(pc_lut != nullptr);
28 
29  tp_geom_ = tp_geom;
30  pc_lut_ = pc_lut;
31 
32  verbose_ = verbose;
33  endcap_ = endcap; // 1 for ME+, 2 for ME-
34  sector_ = sector;
35  bx_ = bx;
36 
37  bxShiftCSC_ = bxShiftCSC;
38  bxShiftRPC_ = bxShiftRPC;
39  bxShiftGEM_ = bxShiftGEM;
40  bxShiftME0_ = bxShiftME0;
41 
42  zoneBoundaries_ = zoneBoundaries;
43  zoneOverlap_ = zoneOverlap;
44  duplicateTheta_ = duplicateTheta;
45  fixZonePhi_ = fixZonePhi;
46  useNewZones_ = useNewZones;
47  fixME11Edges_ = fixME11Edges;
48  bugME11Dupes_ = bugME11Dupes;
49 
50  // Run 3 CCLUT algorithm
51  useRun3CCLUT_OTMB_ = useRun3CCLUT_OTMB;
52  useRun3CCLUT_TMB_ = useRun3CCLUT_TMB;
53 }
const SectorProcessorLUT * pc_lut_
static constexpr int verbose
const SectorProcessorLUT & pc_lut() const
std::vector< int > zoneBoundaries_
#define emtf_assert(expr)
Definition: DebugTools.h:18
const GeometryTranslator * tp_geom_
void PrimitiveConversion::convert_csc ( int  pc_sector,
int  pc_station,
int  pc_chamber,
int  pc_segment,
const TriggerPrimitive muon_primitive,
EMTFHit conv_hit 
) const

Definition at line 95 of file PrimitiveConversion.cc.

References bxShiftCSC_, CSCDetId::chamber(), convert_csc_details(), l1t::EMTFHit::CreateCSCDetId(), L1TMuon::TriggerPrimitive::detId(), emtf_assert, CSCDetId::endcap(), endcap_, PV3DBase< T, PVType, FrameType >::eta(), L1TMuon::TriggerPrimitive::getCSCData(), L1TMuon::GeometryTranslator::getGlobalPoint(), runTauDisplay::gp, L1TMuon::kCSC, or, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), emtf::rad_to_deg(), CSCDetId::ring(), sector_, l1t::EMTFHit::set_alct_quality(), l1t::EMTFHit::set_bend(), l1t::EMTFHit::set_bx(), l1t::EMTFHit::set_chamber(), l1t::EMTFHit::set_clct_quality(), l1t::EMTFHit::set_csc_ID(), l1t::EMTFHit::set_csc_nID(), l1t::EMTFHit::set_endcap(), l1t::EMTFHit::set_eta_sim(), l1t::EMTFHit::set_neighbor(), l1t::EMTFHit::set_pattern(), l1t::EMTFHit::set_pattern_run3(), l1t::EMTFHit::set_pc_chamber(), l1t::EMTFHit::set_pc_sector(), l1t::EMTFHit::set_pc_segment(), l1t::EMTFHit::set_pc_station(), l1t::EMTFHit::set_phi_sim(), l1t::EMTFHit::set_quality(), l1t::EMTFHit::set_rho_sim(), l1t::EMTFHit::set_ring(), l1t::EMTFHit::set_sector(), l1t::EMTFHit::set_sector_idx(), l1t::EMTFHit::set_slope(), l1t::EMTFHit::set_station(), l1t::EMTFHit::set_strip(), l1t::EMTFHit::set_strip_eighth(), l1t::EMTFHit::set_strip_eighth_bit(), l1t::EMTFHit::set_strip_quart(), l1t::EMTFHit::set_strip_quart_bit(), l1t::EMTFHit::set_subsector(), l1t::EMTFHit::set_subsystem(), l1t::EMTFHit::set_sync_err(), l1t::EMTFHit::set_theta_sim(), l1t::EMTFHit::set_time(), l1t::EMTFHit::set_track_num(), l1t::EMTFHit::set_valid(), l1t::EMTFHit::set_wire(), l1t::EMTFHit::set_z_sim(), l1t::EMTFHit::SetCSCDetId(), CSCDetId::station(), PV3DBase< T, PVType, FrameType >::theta(), tp_geom_, CSCDetId::triggerSector(), useRun3CCLUT_OTMB_, useRun3CCLUT_TMB_, Geom::Phi< T1, Range >::value(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by process().

100  {
101  const CSCDetId& tp_detId = muon_primitive.detId<CSCDetId>();
102  const CSCData& tp_data = muon_primitive.getCSCData();
103 
104  int tp_endcap = tp_detId.endcap();
105  int tp_sector = tp_detId.triggerSector();
106  int tp_station = tp_detId.station();
107  int tp_ring = tp_detId.ring();
108  int tp_chamber = tp_detId.chamber();
109 
110  int tp_bx = tp_data.bx;
111  int tp_csc_ID = tp_data.cscID;
112 
113  // station 1 --> subsector 1 or 2
114  // station 2,3,4 --> subsector 0
115  int tp_subsector = (tp_station != 1) ? 0 : ((tp_chamber % 6 > 2) ? 1 : 2);
116 
117  const bool is_neighbor = (pc_station == 5);
118 
119  int csc_nID = tp_csc_ID; // modify csc_ID if coming from neighbor sector
120  if (is_neighbor) {
121  // station 1 has 3 neighbor chambers: 13,14,15 in rings 1,2,3
122  // (where are chambers 10,11,12 in station 1? they were used to label ME1/1a, but not anymore)
123  // station 2,3,4 have 2 neighbor chambers: 10,11 in rings 1,2
124  csc_nID = (pc_chamber < 3) ? (pc_chamber + 12) : (((pc_chamber - 1) % 2) + 9);
125  csc_nID += 1;
126 
127  if (tp_station == 1) { // neighbor ME1
128  emtf_assert(tp_subsector == 2);
129  }
130  }
131 
132  // Calculate Pattern
133  unsigned pattern = tp_data.pattern;
134  const auto& detid(conv_hit.CreateCSCDetId());
135  const bool isOTMB(detid.isME11() or detid.isME21() or detid.isME31() or detid.isME41());
136  const bool isTMB((detid.isME12() or detid.isME22() or detid.isME32() or detid.isME42()) or (detid.isME13()));
137 
138  // check if CCLUT is on for this CSC TP
139  const bool useRun3CCLUT((useRun3CCLUT_OTMB_ and isOTMB) or (useRun3CCLUT_TMB_ and isTMB));
140  if (useRun3CCLUT) {
141  // convert slope to Run-2 pattern for CSC TPs coming from MEX/1 chambers
142  // where the CCLUT algorithm is enabled
143  const unsigned slopeList[32] = {10, 10, 10, 8, 8, 8, 6, 6, 6, 4, 4, 4, 2, 2, 2, 2,
144  10, 10, 10, 9, 9, 9, 7, 7, 7, 5, 5, 5, 3, 3, 3, 3};
145 
146  // this LUT follows the same convention as in CSCPatternBank.cc
147  unsigned slope_and_sign(tp_data.slope);
148  if (tp_data.bend == 0) {
149  slope_and_sign += 16;
150  }
151  unsigned run2_converted_PID = slopeList[slope_and_sign];
152  pattern = run2_converted_PID;
153  }
154 
155  // Set properties
156  conv_hit.SetCSCDetId(tp_detId);
157 
158  conv_hit.set_bx(tp_bx + bxShiftCSC_);
159  conv_hit.set_subsystem(L1TMuon::kCSC);
160  conv_hit.set_endcap((tp_endcap == 2) ? -1 : tp_endcap);
161  conv_hit.set_station(tp_station);
162  conv_hit.set_ring(tp_ring);
163  //conv_hit.set_roll ( tp_roll );
164  conv_hit.set_chamber(tp_chamber);
165  conv_hit.set_sector(tp_sector);
166  conv_hit.set_subsector(tp_subsector);
167  conv_hit.set_csc_ID(tp_csc_ID);
168  conv_hit.set_csc_nID(csc_nID);
169  conv_hit.set_track_num(tp_data.trknmb);
170  conv_hit.set_sync_err(tp_data.syncErr);
171  //conv_hit.set_sector_RPC ( tp_sector );
172  //conv_hit.set_subsector_RPC ( tp_subsector );
173 
174  conv_hit.set_pc_sector(pc_sector);
175  conv_hit.set_pc_station(pc_station);
176  conv_hit.set_pc_chamber(pc_chamber);
177  conv_hit.set_pc_segment(pc_segment);
178 
179  conv_hit.set_valid(tp_data.valid);
180  conv_hit.set_strip(tp_data.strip);
181  //conv_hit.set_strip_low ( tp_data.strip_low );
182  //conv_hit.set_strip_hi ( tp_data.strip_hi );
183  conv_hit.set_wire(tp_data.keywire);
184  conv_hit.set_quality(tp_data.quality);
185  conv_hit.set_pattern(pattern);
186  conv_hit.set_bend(tp_data.bend);
187  conv_hit.set_time(0.); // No fine resolution timing
188  conv_hit.set_alct_quality(tp_data.alct_quality);
189  conv_hit.set_clct_quality(tp_data.clct_quality);
190  // Run-3
191  conv_hit.set_strip_quart(tp_data.strip_quart);
192  conv_hit.set_strip_eighth(tp_data.strip_eighth);
193  conv_hit.set_strip_quart_bit(tp_data.strip_quart_bit);
194  conv_hit.set_strip_eighth_bit(tp_data.strip_eighth_bit);
195  conv_hit.set_pattern_run3(tp_data.pattern_run3);
196  conv_hit.set_slope(tp_data.slope);
197 
198  conv_hit.set_neighbor(is_neighbor);
199  conv_hit.set_sector_idx((endcap_ == 1) ? sector_ - 1 : sector_ + 5);
200 
201  convert_csc_details(conv_hit);
202 
203  // Add coordinates from fullsim
204  {
205  const GlobalPoint& gp = tp_geom_->getGlobalPoint(muon_primitive);
206  double glob_phi = emtf::rad_to_deg(gp.phi().value());
207  double glob_theta = emtf::rad_to_deg(gp.theta());
208  double glob_eta = gp.eta();
209  double glob_rho = gp.perp();
210  double glob_z = gp.z();
211 
212  conv_hit.set_phi_sim(glob_phi);
213  conv_hit.set_theta_sim(glob_theta);
214  conv_hit.set_eta_sim(glob_eta);
215  conv_hit.set_rho_sim(glob_rho);
216  conv_hit.set_z_sim(glob_z);
217  }
218 }
int chamber() const
Definition: CSCDetId.h:62
void set_theta_sim(float val)
Definition: EMTFHit.h:195
void set_neighbor(int bits)
Definition: EMTFHit.h:147
void set_rho_sim(float val)
Definition: EMTFHit.h:197
void set_csc_nID(int bits)
Definition: EMTFHit.h:145
void set_pc_station(int bits)
Definition: EMTFHit.h:150
void set_phi_sim(float val)
Definition: EMTFHit.h:194
T perp() const
Definition: PV3DBase.h:69
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
void set_station(int bits)
Definition: EMTFHit.h:136
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
void set_eta_sim(float val)
Definition: EMTFHit.h:196
void set_sector_idx(int bits)
Definition: EMTFHit.h:140
T1 value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:75
void set_strip_eighth(int bits)
Definition: EMTFHit.h:158
void set_sync_err(int bits)
Definition: EMTFHit.h:168
void set_endcap(int bits)
Definition: EMTFHit.h:135
void set_ring(int bits)
Definition: EMTFHit.h:137
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
int endcap() const
Definition: CSCDetId.h:85
void set_strip_quart_bit(int bits)
Definition: EMTFHit.h:159
void set_strip_eighth_bit(int bits)
Definition: EMTFHit.h:160
void set_slope(int bits)
Definition: EMTFHit.h:166
void set_pattern(int bits)
Definition: EMTFHit.h:163
T z() const
Definition: PV3DBase.h:61
void set_csc_ID(int bits)
Definition: EMTFHit.h:144
void set_pc_chamber(int bits)
Definition: EMTFHit.h:151
void set_wire(int bits)
Definition: EMTFHit.h:153
void set_pattern_run3(int bits)
Definition: EMTFHit.h:164
void convert_csc_details(EMTFHit &conv_hit) const
CSCDetId CreateCSCDetId() const
Definition: EMTFHit.cc:6
void set_time(float val)
Definition: EMTFHit.h:193
void set_pc_segment(int bits)
Definition: EMTFHit.h:152
void SetCSCDetId(const CSCDetId &id)
Definition: EMTFHit.h:115
int ring() const
Definition: CSCDetId.h:68
void set_sector(int bits)
Definition: EMTFHit.h:138
void set_valid(int bits)
Definition: EMTFHit.h:167
void set_z_sim(float val)
Definition: EMTFHit.h:198
#define emtf_assert(expr)
Definition: DebugTools.h:18
void set_strip(int bits)
Definition: EMTFHit.h:154
int triggerSector() const
Definition: CSCDetId.cc:3
void set_subsystem(int bits)
Definition: EMTFHit.h:134
T eta() const
Definition: PV3DBase.h:73
void set_track_num(int bits)
Definition: EMTFHit.h:161
void set_bx(int bits)
Definition: EMTFHit.h:179
int station() const
Definition: CSCDetId.h:79
double rad_to_deg(double rad)
Definition: TrackTools.h:73
void set_strip_quart(int bits)
Definition: EMTFHit.h:157
void set_clct_quality(int bits)
Definition: EMTFHit.h:200
void set_quality(int bits)
Definition: EMTFHit.h:162
void set_chamber(int bits)
Definition: EMTFHit.h:143
void set_subsector(int bits)
Definition: EMTFHit.h:141
void set_bend(int bits)
Definition: EMTFHit.h:165
void set_alct_quality(int bits)
Definition: EMTFHit.h:199
const GeometryTranslator * tp_geom_
void set_pc_sector(int bits)
Definition: EMTFHit.h:149
GlobalPoint getGlobalPoint(const TriggerPrimitive &) const
void PrimitiveConversion::convert_csc_details ( EMTFHit conv_hit) const

Definition at line 220 of file PrimitiveConversion.cc.

References bugME11Dupes_, emtf::calc_eta_from_theta_deg(), emtf::calc_phi_glob_deg(), emtf::calc_phi_loc_deg(), emtf::calc_theta_deg_from_int(), gather_cfg::cout, l1t::EMTFHit::CreateCSCDetId(), l1t::EMTFHit::CSC_nID(), emtf_assert, l1t::EMTFHit::Endcap(), endcap_, fixME11Edges_, fixZonePhi_, get_bt_segment(), get_bt_station(), get_fs_segment(), get_fs_zone_code(), SectorProcessorLUT::get_ph_disp(), SectorProcessorLUT::get_ph_init(), SectorProcessorLUT::get_ph_init_hard(), SectorProcessorLUT::get_ph_patt_corr(), SectorProcessorLUT::get_ph_patt_corr_sign(), SectorProcessorLUT::get_ph_zone_offset(), SectorProcessorLUT::get_th_corr_lut(), SectorProcessorLUT::get_th_disp(), SectorProcessorLUT::get_th_init(), SectorProcessorLUT::get_th_lut(), get_zone_code(), l1t::EMTFHit::Neighbor(), or, l1t::EMTFHit::Pattern(), l1t::EMTFHit::PC_chamber(), pc_lut(), l1t::EMTFHit::PC_sector(), l1t::EMTFHit::PC_segment(), l1t::EMTFHit::PC_station(), l1t::EMTFHit::Phi_loc(), l1t::EMTFHit::Ring(), sector_, l1t::EMTFHit::set_bt_segment(), l1t::EMTFHit::set_bt_station(), l1t::EMTFHit::set_eta(), l1t::EMTFHit::set_fs_segment(), l1t::EMTFHit::set_fs_zone_code(), l1t::EMTFHit::set_phi_fp(), l1t::EMTFHit::set_phi_glob(), l1t::EMTFHit::set_phi_loc(), l1t::EMTFHit::set_theta(), l1t::EMTFHit::set_theta_fp(), l1t::EMTFHit::set_zone_code(), l1t::EMTFHit::set_zone_hit(), l1t::EMTFHit::Station(), l1t::EMTFHit::Strip(), l1t::EMTFHit::Strip_eighth_bit(), l1t::EMTFHit::Strip_quart_bit(), l1t::EMTFHit::Subsector(), l1t::EMTFHit::Theta(), useRun3CCLUT_OTMB_, useRun3CCLUT_TMB_, verbose_, and l1t::EMTFHit::Wire().

Referenced by convert_csc().

220  {
221  const bool is_neighbor = conv_hit.Neighbor();
222 
223  // Defined as in firmware
224  // endcap : 0-1 for ME+,ME-
225  // sector : 0-5
226  // station: 0-4 for st1 sub1 or st1 sub2 from neighbor, st1 sub2, st2, st3, st4
227  // cscid : 0-14 (excluding 11), including neighbors
228  const int fw_endcap = (endcap_ - 1);
229  const int fw_sector = (sector_ - 1);
230  const int fw_station =
231  (conv_hit.Station() == 1) ? (is_neighbor ? 0 : (conv_hit.Subsector() - 1)) : conv_hit.Station();
232  const int fw_cscid = (conv_hit.CSC_nID() - 1);
233  const int fw_strip = conv_hit.Strip(); // it is half-strip, despite the name
234  const int fw_wire = conv_hit.Wire(); // it is wiregroup, despite the name
235 
236  // Primitive converter unit
237  // station: 0-5 for st1 sub1, st1 sub2, st2, st3, st4, neigh all st*
238  // chamber: 0-8
239  const int pc_station = conv_hit.PC_station();
240  const int pc_chamber = conv_hit.PC_chamber();
241  const int pc_segment = conv_hit.PC_segment();
242 
243  const bool is_me11a = (conv_hit.Station() == 1 && conv_hit.Ring() == 4);
244  const bool is_me11b = (conv_hit.Station() == 1 && conv_hit.Ring() == 1);
245  const bool is_me13 = (conv_hit.Station() == 1 && conv_hit.Ring() == 3);
246 
247  // Is this chamber mounted in reverse direction?
248  // (i.e., phi vs. strip number is reversed)
249  bool ph_reverse = false;
250  if ((fw_endcap == 0 && fw_station >= 3) || (fw_endcap == 1 && fw_station < 3)) // ME+3, ME+4, ME-1, ME-2
251  ph_reverse = true;
252 
253  // Chamber coverage if phi_reverse = true
254  int ph_coverage = 0; // Offset for coordinate conversion
255  if (ph_reverse) {
256  if (fw_station <= 1 && ((fw_cscid >= 6 && fw_cscid <= 8) || fw_cscid == 14)) // ME1/3
257  ph_coverage = 15;
258  else if (fw_station >= 2 && (fw_cscid <= 2 || fw_cscid == 9)) // ME2,3,4/1
259  ph_coverage = 40;
260  else // all others
261  ph_coverage = 20;
262  }
263 
264  // Is this 10-deg or 20-deg chamber?
265  bool is_10degree = false;
266  if ((fw_station <= 1) || // ME1
267  (fw_station >= 2 && ((fw_cscid >= 3 && fw_cscid <= 8) || fw_cscid == 10)) // ME2,3,4/2
268  ) {
269  is_10degree = true;
270  }
271 
272  // LUT index
273  // There are 54 CSC chambers including the neighbors in a sector, but 61 LUT indices
274  // This comes from dividing the 6 chambers + 1 neighbor in ME1/1 into ME1/1a and ME1/1b
275  int pc_lut_id = pc_chamber;
276  if (pc_station == 0) { // ME1 sub 1: 0 - 11
277  pc_lut_id = is_me11a ? pc_lut_id + 9 : pc_lut_id;
278  } else if (pc_station == 1) { // ME1 sub 2: 16 - 27
279  pc_lut_id += 16;
280  pc_lut_id = is_me11a ? pc_lut_id + 9 : pc_lut_id;
281  } else if (pc_station == 2) { // ME2: 28 - 36
282  pc_lut_id += 28;
283  } else if (pc_station == 3) { // ME3: 39 - 47
284  pc_lut_id += 39;
285  } else if (pc_station == 4) { // ME4 : 50 - 58
286  pc_lut_id += 50;
287  } else if (pc_station == 5 && pc_chamber < 3) { // neighbor ME1: 12 - 15
288  pc_lut_id = is_me11a ? pc_lut_id + 15 : pc_lut_id + 12;
289  } else if (pc_station == 5 && pc_chamber < 5) { // neighbor ME2: 37 - 38
290  pc_lut_id += 28 + 9 - 3;
291  } else if (pc_station == 5 && pc_chamber < 7) { // neighbor ME3: 48 - 49
292  pc_lut_id += 39 + 9 - 5;
293  } else if (pc_station == 5 && pc_chamber < 9) { // neighbor ME4: 59 - 60
294  pc_lut_id += 50 + 9 - 7;
295  }
296  emtf_assert(pc_lut_id < 61);
297 
298  if (verbose_ > 1) { // debug
299  std::cout << "pc_station: " << pc_station << " pc_chamber: " << pc_chamber << " fw_station: " << fw_station
300  << " fw_cscid: " << fw_cscid << " lut_id: " << pc_lut_id
301  << " ph_init: " << pc_lut().get_ph_init(fw_endcap, fw_sector, pc_lut_id)
302  << " ph_disp: " << pc_lut().get_ph_disp(fw_endcap, fw_sector, pc_lut_id)
303  << " th_init: " << pc_lut().get_th_init(fw_endcap, fw_sector, pc_lut_id)
304  << " th_disp: " << pc_lut().get_th_disp(fw_endcap, fw_sector, pc_lut_id)
305  << " ph_init_hard: " << pc_lut().get_ph_init_hard(fw_station, fw_cscid) << std::endl;
306  }
307 
308  // ___________________________________________________________________________
309  // phi conversion
310 
311  // Convert half-strip into 1/8-strip
312  int eighth_strip = 0;
313 
314  // Apply phi correction from CLCT pattern number (from src/SectorProcessorLUT.cc)
315  int clct_pat_corr = pc_lut().get_ph_patt_corr(conv_hit.Pattern());
316  int clct_pat_corr_sign = (pc_lut().get_ph_patt_corr_sign(conv_hit.Pattern()) == 0) ? 1 : -1;
317 
318  // At strip number 0, protect against negative correction
319  bool bugStrip0BeforeFW48200 = false;
320  if (bugStrip0BeforeFW48200 == false && fw_strip == 0 && clct_pat_corr_sign == -1)
321  clct_pat_corr = 0;
322 
323  // check if the CCLUT algorithm is on in this chamber
324  const auto& detid(conv_hit.CreateCSCDetId());
325  const bool isOTMB(detid.isME11() or detid.isME21() or detid.isME31() or detid.isME41());
326  const bool isTMB((detid.isME12() or detid.isME22() or detid.isME32() or detid.isME42()) or (detid.isME13()));
327 
328  const bool useRun3CCLUT((useRun3CCLUT_OTMB_ and isOTMB) or (useRun3CCLUT_TMB_ and isTMB));
329 
330  if (is_10degree) {
331  eighth_strip = fw_strip << 2; // full precision, uses only 2 bits of pattern correction
332  if (useRun3CCLUT) {
333  eighth_strip += (conv_hit.Strip_quart_bit() << 1 | conv_hit.Strip_eighth_bit() << 0); // Run 3 CCLUT variables
334  } else {
335  eighth_strip += clct_pat_corr_sign * (clct_pat_corr >> 1);
336  }
337  } else {
338  eighth_strip = fw_strip << 3; // multiply by 2, uses all 3 bits of pattern correction
339  if (useRun3CCLUT) {
340  eighth_strip += (conv_hit.Strip_quart_bit() << 2 | conv_hit.Strip_eighth_bit() << 1); // Run 3 CCLUT variables
341  } else {
342  eighth_strip += clct_pat_corr_sign * (clct_pat_corr >> 0);
343  }
344  }
345  emtf_assert(bugStrip0BeforeFW48200 == true || eighth_strip >= 0);
346 
347  // Multiplicative factor for eighth_strip
348  // +----------------------------+-------------+------------------+
349  // | Chamber type | Strip angle | Mult factor |
350  // | | (deg) | |
351  // +----------------------------+-------------+------------------+
352  // | ME1/2, ME2/2, ME3/2, ME4/2 | 0.1333 | 1/2 (remove LSB) |
353  // | ME2/1, ME3/1, ME4/1 | 0.2666 | 1 (no op) |
354  // | ME1/1a | 0.2222 | 0.8335 |
355  // | ME1/1b | 0.1695 | 0.636 |
356  // | ME1/3 | 0.1233 | 0.4625 |
357  // +----------------------------+-------------+------------------+
358 
359  int factor = 1024;
360  if (is_me11a)
361  factor = 1707; // ME1/1a
362  else if (is_me11b)
363  factor = 1301; // ME1/1b
364  else if (is_me13)
365  factor = 947; // ME1/3
366 
367  // ph_tmp is full-precision phi, but local to chamber (counted from strip 0)
368  // full phi precision: ( 1/60) deg (1/8-strip)
369  // zone phi precision: (32/60) deg (4-strip, 32 times coarser than full phi precision)
370  int ph_tmp = (eighth_strip * factor) >> 10;
371  int ph_tmp_sign = (ph_reverse == 0) ? 1 : -1;
372 
373  int fph = pc_lut().get_ph_init(fw_endcap, fw_sector, pc_lut_id);
374  fph = fph + ph_tmp_sign * ph_tmp;
375 
376  int ph_hit = pc_lut().get_ph_disp(fw_endcap, fw_sector, pc_lut_id);
377  ph_hit = (ph_hit >> 1) + ph_tmp_sign * (ph_tmp >> 5) + ph_coverage;
378 
379  // Full phi +16 to put the rounded value into the middle of error range
380  // Divide full phi by 32, subtract chamber start
381  int ph_hit_fixed = -1 * pc_lut().get_ph_init_hard(fw_station, fw_cscid);
382  ph_hit_fixed = ph_hit_fixed + ((fph + (1 << 4)) >> 5);
383 
384  if (fixZonePhi_)
385  ph_hit = ph_hit_fixed;
386 
387  // Zone phi
388  int zone_hit = pc_lut().get_ph_zone_offset(pc_station, pc_chamber);
389  zone_hit += ph_hit;
390 
391  int zone_hit_fixed = pc_lut().get_ph_init_hard(fw_station, fw_cscid);
392  zone_hit_fixed += ph_hit_fixed;
393  // Since ph_hit_fixed = ((fph + (1<<4)) >> 5) - pc_lut().get_ph_init_hard(), the following is equivalent:
394  //zone_hit_fixed = ((fph + (1<<4)) >> 5);
395 
396  if (fixZonePhi_)
397  zone_hit = zone_hit_fixed;
398 
399  emtf_assert(0 <= fph && fph < 5000);
400  emtf_assert(0 <= zone_hit && zone_hit < 192);
401 
402  // ___________________________________________________________________________
403  // theta conversion
404 
405  // th_tmp is theta local to chamber
406  int pc_wire_id = (fw_wire & 0x7f); // 7-bit
407  int th_tmp = pc_lut().get_th_lut(fw_endcap, fw_sector, pc_lut_id, pc_wire_id);
408 
409  // For ME1/1 with tilted wires, add theta correction as a function of (wire,strip) index
410  if (!fixME11Edges_ && (is_me11a || is_me11b)) {
411  int pc_wire_strip_id =
412  (((fw_wire >> 4) & 0x3) << 5) | ((eighth_strip >> 4) & 0x1f); // 2-bit from wire, 5-bit from 2-strip
413 
414  // Only affect runs before FW changeset 47114 is applied
415  // e.g. Run 281707 and earlier
416  if (bugME11Dupes_) {
417  bool bugME11DupesBeforeFW47114 = false;
418  if (bugME11DupesBeforeFW47114) {
419  if (pc_segment == 1) {
420  pc_wire_strip_id = (((fw_wire >> 4) & 0x3) << 5) | (0); // 2-bit from wire, 5-bit from 2-strip
421  }
422  }
423  }
424 
425  int th_corr = pc_lut().get_th_corr_lut(fw_endcap, fw_sector, pc_lut_id, pc_wire_strip_id);
426  int th_corr_sign = (ph_reverse == 0) ? 1 : -1;
427 
428  th_tmp = th_tmp + th_corr_sign * th_corr;
429 
430  // Check that correction did not make invalid value outside chamber coverage
431  const int th_negative = 50;
432  const int th_coverage = 45;
433  if (th_tmp > th_negative || th_tmp < 0 || fw_wire == 0)
434  th_tmp = 0; // limit at the bottom
435  if (th_tmp > th_coverage)
436  th_tmp = th_coverage; // limit at the top
437 
438  } else if (fixME11Edges_ && (is_me11a || is_me11b)) {
439  int pc_wire_strip_id =
440  (((fw_wire >> 4) & 0x3) << 5) | ((eighth_strip >> 4) & 0x1f); // 2-bit from wire, 5-bit from 2-strip
441  if (is_me11a)
442  pc_wire_strip_id = (((fw_wire >> 4) & 0x3) << 5) | ((((eighth_strip * 341) >> 8) >> 4) &
443  0x1f); // correct for ME1/1a strip number (341/256 =~ 1.333)
444  int th_corr = pc_lut().get_th_corr_lut(fw_endcap, fw_sector, pc_lut_id, pc_wire_strip_id);
445 
446  th_tmp = th_tmp + th_corr;
447 
448  // Check that correction did not make invalid value outside chamber coverage
449  const int th_coverage = 46; // max coverage for front chamber is 47, max coverage for rear chamber is 45
450  if (fw_wire == 0)
451  th_tmp = 0; // limit at the bottom
452  if (th_tmp > th_coverage)
453  th_tmp = th_coverage; // limit at the top
454  }
455 
456  // theta precision: (36.5/128) deg
457  // theta starts at 8.5 deg: {1, 127} <--> {8.785, 44.715}
458  int th = pc_lut().get_th_init(fw_endcap, fw_sector, pc_lut_id);
459  th = th + th_tmp;
460 
461  emtf_assert(0 <= th && th < 128);
462  th = (th == 0) ? 1 : th; // protect against invalid value
463 
464  // ___________________________________________________________________________
465  // Zone codes and other segment IDs
466 
467  //int zone_hit = ((fph + (1<<4)) >> 5);
468  int zone_code = get_zone_code(conv_hit, th);
469  //int phzvl = get_phzvl(conv_hit, zone_code);
470 
471  int fs_zone_code = get_fs_zone_code(conv_hit);
472  int fs_segment = get_fs_segment(conv_hit, fw_station, fw_cscid, pc_segment);
473 
474  int bt_station = get_bt_station(conv_hit, fw_station, fw_cscid, pc_segment);
475  int bt_segment = get_bt_segment(conv_hit, fw_station, fw_cscid, pc_segment);
476 
477  // ___________________________________________________________________________
478  // Output
479 
480  conv_hit.set_phi_fp(fph); // Full-precision integer phi
481  conv_hit.set_theta_fp(th); // Full-precision integer theta
482  //conv_hit.set_phzvl ( phzvl ); // Local zone word: (1*low) + (2*mid) + (4*low) - used in FW debugging
483  //conv_hit.set_ph_hit ( ph_hit ); // Intermediate quantity in phi calculation - used in FW debugging
484  conv_hit.set_zone_hit(zone_hit); // Phi value for building patterns (0.53333 deg precision)
485  conv_hit.set_zone_code(zone_code); // Full zone word: 1*(zone 0) + 2*(zone 1) + 4*(zone 2) + 8*(zone 3)
486 
487  conv_hit.set_fs_segment(fs_segment); // Segment number used in primitive matching
488  conv_hit.set_fs_zone_code(fs_zone_code); // Zone word used in primitive matching
489 
490  conv_hit.set_bt_station(bt_station);
491  conv_hit.set_bt_segment(bt_segment);
492 
493  conv_hit.set_phi_loc(emtf::calc_phi_loc_deg(fph));
494  conv_hit.set_phi_glob(emtf::calc_phi_glob_deg(conv_hit.Phi_loc(), conv_hit.PC_sector()));
496  conv_hit.set_eta(emtf::calc_eta_from_theta_deg(conv_hit.Theta(), conv_hit.Endcap()));
497 }
int Strip_quart_bit() const
Definition: EMTFHit.h:227
void set_phi_glob(float val)
Definition: EMTFHit.h:190
int get_bt_station(const EMTFHit &conv_hit, int fw_station, int fw_cscid, int pc_segment) const
float Phi_loc() const
Definition: EMTFHit.h:272
int Strip() const
Definition: EMTFHit.h:222
int get_zone_code(const EMTFHit &conv_hit, int th) const
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
int CSC_nID() const
Definition: EMTFHit.h:213
void set_theta(float val)
Definition: EMTFHit.h:191
float Theta() const
Definition: EMTFHit.h:274
void set_bt_station(int bits)
Definition: EMTFHit.h:187
double calc_phi_loc_deg(int bits)
Definition: TrackTools.h:176
uint32_t get_ph_patt_corr_sign(int pattern) const
int get_bt_segment(const EMTFHit &conv_hit, int fw_station, int fw_cscid, int pc_segment) const
void set_theta_fp(int bits)
Definition: EMTFHit.h:182
int PC_sector() const
Definition: EMTFHit.h:217
int Wire() const
Definition: EMTFHit.h:221
uint32_t get_th_init(int fw_endcap, int fw_sector, int pc_lut_id) const
int Subsector() const
Definition: EMTFHit.h:209
int PC_station() const
Definition: EMTFHit.h:218
int get_fs_segment(const EMTFHit &conv_hit, int fw_station, int fw_cscid, int pc_segment) const
double calc_theta_deg_from_int(int theta_int)
Definition: TrackTools.h:128
void set_bt_segment(int bits)
Definition: EMTFHit.h:188
int PC_segment() const
Definition: EMTFHit.h:220
CSCDetId CreateCSCDetId() const
Definition: EMTFHit.cc:6
int Ring() const
Definition: EMTFHit.h:205
double calc_phi_glob_deg(double loc, int sector)
Definition: TrackTools.h:166
const SectorProcessorLUT & pc_lut() const
void set_phi_loc(float val)
Definition: EMTFHit.h:189
uint32_t get_th_disp(int fw_endcap, int fw_sector, int pc_lut_id) const
int PC_chamber() const
Definition: EMTFHit.h:219
uint32_t get_ph_disp(int fw_endcap, int fw_sector, int pc_lut_id) const
void set_fs_segment(int bits)
Definition: EMTFHit.h:185
int Station() const
Definition: EMTFHit.h:204
#define emtf_assert(expr)
Definition: DebugTools.h:18
double calc_eta_from_theta_deg(double theta_deg, int endcap)
Definition: TrackTools.h:113
uint32_t get_ph_zone_offset(int pc_station, int pc_chamber) const
int Strip_eighth_bit() const
Definition: EMTFHit.h:228
void set_zone_code(int bits)
Definition: EMTFHit.h:184
uint32_t get_ph_patt_corr(int pattern) const
int Pattern() const
Definition: EMTFHit.h:231
void set_zone_hit(int bits)
Definition: EMTFHit.h:183
int Endcap() const
Definition: EMTFHit.h:203
uint32_t get_th_lut(int fw_endcap, int fw_sector, int pc_lut_id, int pc_wire_id) const
tuple cout
Definition: gather_cfg.py:144
int get_fs_zone_code(const EMTFHit &conv_hit) const
uint32_t get_ph_init_hard(int fw_station, int fw_cscid) const
void set_fs_zone_code(int bits)
Definition: EMTFHit.h:186
uint32_t get_ph_init(int fw_endcap, int fw_sector, int pc_lut_id) const
int Neighbor() const
Definition: EMTFHit.h:215
uint32_t get_th_corr_lut(int fw_endcap, int fw_sector, int pc_lut_id, int pc_wire_strip_id) const
void set_phi_fp(int bits)
Definition: EMTFHit.h:181
void set_eta(float val)
Definition: EMTFHit.h:192
void PrimitiveConversion::convert_dt ( int  pc_sector,
int  pc_station,
int  pc_chamber,
int  pc_segment,
const TriggerPrimitive muon_primitive,
EMTFHit conv_hit 
) const

Definition at line 1049 of file PrimitiveConversion.cc.

References emtf::calc_phi_loc_deg_from_glob(), emtf::calc_phi_loc_int(), emtf::calc_theta_int(), convert_other_details(), L1TMuon::TriggerPrimitive::detId(), emtf_assert, l1t::EMTFHit::Endcap(), endcap_, PV3DBase< T, PVType, FrameType >::eta(), emtf::get_trigger_csc_ID(), emtf::get_trigger_sector(), L1TMuon::TriggerPrimitive::getDTData(), L1TMuon::GeometryTranslator::getGlobalPoint(), runTauDisplay::gp, L1TMuon::kDT, l1t::EMTFHit::PC_sector(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), emtf::rad_to_deg(), DTChamberId::sector(), sector_, l1t::EMTFHit::set_bend(), l1t::EMTFHit::set_bx(), l1t::EMTFHit::set_chamber(), l1t::EMTFHit::set_csc_ID(), l1t::EMTFHit::set_csc_nID(), l1t::EMTFHit::set_endcap(), l1t::EMTFHit::set_eta_sim(), l1t::EMTFHit::set_neighbor(), l1t::EMTFHit::set_pattern(), l1t::EMTFHit::set_pc_chamber(), l1t::EMTFHit::set_pc_sector(), l1t::EMTFHit::set_pc_segment(), l1t::EMTFHit::set_pc_station(), l1t::EMTFHit::set_phi_fp(), l1t::EMTFHit::set_phi_sim(), l1t::EMTFHit::set_quality(), l1t::EMTFHit::set_rho_sim(), l1t::EMTFHit::set_ring(), l1t::EMTFHit::set_roll(), l1t::EMTFHit::set_sector(), l1t::EMTFHit::set_sector_idx(), l1t::EMTFHit::set_station(), l1t::EMTFHit::set_strip(), l1t::EMTFHit::set_subsector(), l1t::EMTFHit::set_subsystem(), l1t::EMTFHit::set_sync_err(), l1t::EMTFHit::set_theta_fp(), l1t::EMTFHit::set_theta_sim(), l1t::EMTFHit::set_time(), l1t::EMTFHit::set_track_num(), l1t::EMTFHit::set_valid(), l1t::EMTFHit::set_wire(), l1t::EMTFHit::set_z_sim(), l1t::EMTFHit::SetDTDetId(), DTChamberId::station(), PV3DBase< T, PVType, FrameType >::theta(), tp_geom_, Geom::Phi< T1, Range >::value(), DTChamberId::wheel(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by process().

1054  {
1055  const DTChamberId& tp_detId = muon_primitive.detId<DTChamberId>();
1056  const DTData& tp_data = muon_primitive.getDTData();
1057 
1058  int tp_wheel = tp_detId.wheel();
1059  int tp_station = tp_detId.station();
1060  int tp_sector = tp_detId.sector(); // sectors are 1-12, starting at phi=0 and increasing with phi
1061 
1062  // In station 4, where the top and bottom setcors are made of two chambers,
1063  // two additional sector numbers are used, 13 (after sector 4, top)
1064  // and 14 (after sector 10, bottom).
1065  if (tp_station == 4) {
1066  if (tp_sector == 13)
1067  tp_sector = 4;
1068  else if (tp_sector == 14)
1069  tp_sector = 10;
1070  }
1071 
1072  int tp_bx = tp_data.bx;
1073  int tp_phi = tp_data.radialAngle;
1074  int tp_phiB = tp_data.bendingAngle;
1075 
1076  // Mimic 10 deg CSC chamber. I use tp_station = 2, tp_ring = 2
1077  // when calling get_trigger_sector() and get_trigger_csc_ID()
1078  int tp_chamber =
1079  tp_sector * 3 - 1; // DT chambers are 30 deg. Multiply sector number by 3 to mimic 10 deg CSC chamber number
1080  int tp_endcap = (tp_wheel > 0) ? +1 : ((tp_wheel < 0) ? 2 : 0);
1081  int csc_tp_sector = emtf::get_trigger_sector(2, 2, tp_chamber);
1082  int tp_csc_ID = emtf::get_trigger_csc_ID(2, 2, tp_chamber);
1083  int tp_subsector = 0;
1084 
1085  const bool is_neighbor = (pc_chamber >= 8);
1086 
1087  int csc_nID = tp_csc_ID; // modify csc_ID if coming from neighbor sector
1088  if (is_neighbor) {
1089  // station 1 has 3 neighbor chambers: 13,14,15 in rings 1,2,3
1090  // (where are chambers 10,11,12 in station 1? they were used to label ME1/1a, but not anymore)
1091  // station 2,3,4 have 2 neighbor chambers: 10,11 in rings 1,2
1092  csc_nID = 10;
1093  }
1094 
1095  // Set properties
1096  conv_hit.SetDTDetId(tp_detId);
1097 
1098  conv_hit.set_bx(tp_bx);
1099  conv_hit.set_subsystem(L1TMuon::kDT);
1100  conv_hit.set_endcap((tp_endcap == 2) ? -1 : tp_endcap);
1101  conv_hit.set_station(tp_station);
1102  conv_hit.set_ring(1); // set to ring 1?
1103  conv_hit.set_roll(tp_wheel); // used as wheel
1104  conv_hit.set_chamber(tp_chamber);
1105  conv_hit.set_sector(csc_tp_sector);
1106  conv_hit.set_subsector(tp_subsector);
1107  conv_hit.set_csc_ID(tp_csc_ID);
1108  conv_hit.set_csc_nID(csc_nID);
1109  conv_hit.set_track_num(tp_data.segment_number);
1110  conv_hit.set_sync_err(tp_data.RpcBit); // hacked to store rpc bit
1111  //conv_hit.set_sector_RPC ( tp_sector );
1112  //conv_hit.set_subsector_RPC ( tp_subsector );
1113 
1114  conv_hit.set_pc_sector(pc_sector);
1115  conv_hit.set_pc_station(pc_station);
1116  conv_hit.set_pc_chamber(pc_chamber);
1117  conv_hit.set_pc_segment(pc_segment);
1118 
1119  conv_hit.set_valid(true);
1120  conv_hit.set_strip(tp_phi);
1121  //conv_hit.set_strip_low ( tp_data.strip_low );
1122  //conv_hit.set_strip_hi ( tp_data.strip_hi );
1123  conv_hit.set_wire(tp_data.theta_bti_group);
1124  conv_hit.set_quality(tp_data.qualityCode);
1125  conv_hit.set_pattern(0); // arbitrary
1126  conv_hit.set_bend(tp_phiB);
1127  conv_hit.set_time(0.); // No fine resolution timing
1128  //conv_hit.set_alct_quality ( tp_data.alct_quality );
1129  //conv_hit.set_clct_quality ( tp_data.clct_quality );
1130 
1131  conv_hit.set_neighbor(is_neighbor);
1132  conv_hit.set_sector_idx((endcap_ == 1) ? sector_ - 1 : sector_ + 5);
1133 
1134  // Get coordinates from fullsim since LUTs do not exist yet
1135  bool use_fullsim_coords = true;
1136  if (use_fullsim_coords) {
1137  const GlobalPoint& gp = tp_geom_->getGlobalPoint(muon_primitive);
1138  double glob_phi = emtf::rad_to_deg(gp.phi().value());
1139  double glob_theta = emtf::rad_to_deg(gp.theta());
1140  double glob_eta = gp.eta();
1141  double glob_rho = gp.perp();
1142  double glob_z = gp.z();
1143 
1144  // Use the CSC precision (unconfirmed!)
1145  int fph = emtf::calc_phi_loc_int(glob_phi, conv_hit.PC_sector());
1146  int th = emtf::calc_theta_int(glob_theta, conv_hit.Endcap());
1147 
1148  bool fix_dt_phi_edge = true;
1149  if (fix_dt_phi_edge) {
1150  // The DT chamber edges are not always aligned at 0,30,60,etc. The local
1151  // phi 0 is set to the CSC chamber edge minus 22 deg. But it is possible
1152  // for the DT neighbor chamber to go as far as the CSC chamber edge minus
1153  // 32 deg.
1154  double loc = emtf::calc_phi_loc_deg_from_glob(glob_phi, conv_hit.PC_sector());
1155  if ((loc + 22.) < 0. && (loc + 32.) > 0.)
1156  fph = 0;
1157  else if ((loc + 360. + 22.) < 0. && (loc + 360. + 32.) > 0.)
1158  fph = 0;
1159  }
1160 
1161  emtf_assert(0 <= fph && fph < 5400);
1162  emtf_assert(0 <= th && th < 180); // Note: eta = 0.73 -> theta_int = 150
1163  th = (th == 0) ? 1 : th; // protect against invalid value
1164 
1165  // _________________________________________________________________________
1166  // Output
1167 
1168  conv_hit.set_phi_sim(glob_phi);
1169  conv_hit.set_theta_sim(glob_theta);
1170  conv_hit.set_eta_sim(glob_eta);
1171  conv_hit.set_rho_sim(glob_rho);
1172  conv_hit.set_z_sim(glob_z);
1173 
1174  conv_hit.set_phi_fp(fph); // Full-precision integer phi
1175  conv_hit.set_theta_fp(th); // Full-precision integer theta
1176  }
1177 
1178  convert_other_details(conv_hit);
1179 }
void set_theta_sim(float val)
Definition: EMTFHit.h:195
void set_neighbor(int bits)
Definition: EMTFHit.h:147
void set_rho_sim(float val)
Definition: EMTFHit.h:197
void set_csc_nID(int bits)
Definition: EMTFHit.h:145
void set_pc_station(int bits)
Definition: EMTFHit.h:150
void set_phi_sim(float val)
Definition: EMTFHit.h:194
T perp() const
Definition: PV3DBase.h:69
int get_trigger_sector(int ring, int station, int chamber)
Definition: TrackTools.cc:85
void set_station(int bits)
Definition: EMTFHit.h:136
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
void set_eta_sim(float val)
Definition: EMTFHit.h:196
void set_sector_idx(int bits)
Definition: EMTFHit.h:140
T1 value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:75
int calc_phi_loc_int(double glob, int sector)
Definition: TrackTools.h:201
double calc_phi_loc_deg_from_glob(double glob, int sector)
Definition: TrackTools.h:195
void set_sync_err(int bits)
Definition: EMTFHit.h:168
void set_theta_fp(int bits)
Definition: EMTFHit.h:182
void set_endcap(int bits)
Definition: EMTFHit.h:135
void set_ring(int bits)
Definition: EMTFHit.h:137
int PC_sector() const
Definition: EMTFHit.h:217
int get_trigger_csc_ID(int ring, int station, int chamber)
Definition: TrackTools.cc:100
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
void set_pattern(int bits)
Definition: EMTFHit.h:163
T z() const
Definition: PV3DBase.h:61
void set_csc_ID(int bits)
Definition: EMTFHit.h:144
void set_pc_chamber(int bits)
Definition: EMTFHit.h:151
void set_wire(int bits)
Definition: EMTFHit.h:153
void SetDTDetId(const DTChamberId &id)
Definition: EMTFHit.h:119
void set_time(float val)
Definition: EMTFHit.h:193
int calc_theta_int(double theta, int endcap)
Definition: TrackTools.h:143
void set_pc_segment(int bits)
Definition: EMTFHit.h:152
void set_sector(int bits)
Definition: EMTFHit.h:138
void set_valid(int bits)
Definition: EMTFHit.h:167
void set_z_sim(float val)
Definition: EMTFHit.h:198
#define emtf_assert(expr)
Definition: DebugTools.h:18
void set_strip(int bits)
Definition: EMTFHit.h:154
void set_subsystem(int bits)
Definition: EMTFHit.h:134
T eta() const
Definition: PV3DBase.h:73
void set_track_num(int bits)
Definition: EMTFHit.h:161
void convert_other_details(EMTFHit &conv_hit) const
int sector() const
Definition: DTChamberId.h:49
void set_bx(int bits)
Definition: EMTFHit.h:179
int Endcap() const
Definition: EMTFHit.h:203
double rad_to_deg(double rad)
Definition: TrackTools.h:73
int station() const
Return the station number.
Definition: DTChamberId.h:42
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
void set_quality(int bits)
Definition: EMTFHit.h:162
void set_chamber(int bits)
Definition: EMTFHit.h:143
void set_subsector(int bits)
Definition: EMTFHit.h:141
void set_bend(int bits)
Definition: EMTFHit.h:165
const GeometryTranslator * tp_geom_
void set_phi_fp(int bits)
Definition: EMTFHit.h:181
void set_roll(int bits)
Definition: EMTFHit.h:146
void set_pc_sector(int bits)
Definition: EMTFHit.h:149
GlobalPoint getGlobalPoint(const TriggerPrimitive &) const
void PrimitiveConversion::convert_gem ( int  pc_sector,
int  pc_station,
int  pc_chamber,
int  pc_segment,
const TriggerPrimitive muon_primitive,
EMTFHit conv_hit 
) const

Definition at line 752 of file PrimitiveConversion.cc.

References bxShiftGEM_, emtf::calc_phi_loc_int(), emtf::calc_theta_int(), GEMDetId::chamber(), convert_other_details(), L1TMuon::TriggerPrimitive::detId(), emtf_assert, l1t::EMTFHit::Endcap(), endcap_, PV3DBase< T, PVType, FrameType >::eta(), emtf::get_trigger_csc_ID(), emtf::get_trigger_sector(), L1TMuon::TriggerPrimitive::getGEMData(), L1TMuon::GeometryTranslator::getGlobalPoint(), runTauDisplay::gp, L1TMuon::kGEM, l1t::EMTFHit::PC_sector(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), emtf::rad_to_deg(), GEMDetId::region(), GEMDetId::ring(), GEMDetId::roll(), sector_, l1t::EMTFHit::set_bx(), l1t::EMTFHit::set_chamber(), l1t::EMTFHit::set_csc_ID(), l1t::EMTFHit::set_csc_nID(), l1t::EMTFHit::set_endcap(), l1t::EMTFHit::set_eta_sim(), l1t::EMTFHit::set_neighbor(), l1t::EMTFHit::set_pattern(), l1t::EMTFHit::set_pc_chamber(), l1t::EMTFHit::set_pc_sector(), l1t::EMTFHit::set_pc_segment(), l1t::EMTFHit::set_pc_station(), l1t::EMTFHit::set_phi_fp(), l1t::EMTFHit::set_phi_sim(), l1t::EMTFHit::set_quality(), l1t::EMTFHit::set_rho_sim(), l1t::EMTFHit::set_ring(), l1t::EMTFHit::set_roll(), l1t::EMTFHit::set_sector(), l1t::EMTFHit::set_sector_idx(), l1t::EMTFHit::set_station(), l1t::EMTFHit::set_strip(), l1t::EMTFHit::set_strip_hi(), l1t::EMTFHit::set_strip_low(), l1t::EMTFHit::set_subsector(), l1t::EMTFHit::set_subsystem(), l1t::EMTFHit::set_theta_fp(), l1t::EMTFHit::set_theta_sim(), l1t::EMTFHit::set_time(), l1t::EMTFHit::set_valid(), l1t::EMTFHit::set_z_sim(), l1t::EMTFHit::SetGEMDetId(), GEMDetId::station(), PV3DBase< T, PVType, FrameType >::theta(), tp_geom_, Geom::Phi< T1, Range >::value(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by process().

757  {
758  const GEMDetId& tp_detId = muon_primitive.detId<GEMDetId>();
759  const GEMData& tp_data = muon_primitive.getGEMData();
760 
761  int tp_region = tp_detId.region(); // 0 for Barrel, +/-1 for +/- Endcap
762  int tp_endcap = (tp_region == -1) ? 2 : tp_region;
763  int tp_station = tp_detId.station();
764  int tp_ring = tp_detId.ring();
765  int tp_roll = tp_detId.roll();
766  //int tp_layer = tp_detId.layer();
767  int tp_chamber = tp_detId.chamber();
768 
769  int tp_bx = tp_data.bx;
770  int tp_pad = ((tp_data.pad_low + tp_data.pad_hi) / 2);
771 
772  int tp_sector = emtf::get_trigger_sector(tp_ring, tp_station, tp_chamber);
773  int tp_csc_ID = emtf::get_trigger_csc_ID(tp_ring, tp_station, tp_chamber);
774 
775  // station 1 --> subsector 1 or 2
776  // station 2,3,4 --> subsector 0
777  int tp_subsector = (tp_station != 1) ? 0 : ((tp_chamber % 6 > 2) ? 1 : 2);
778 
779  const bool is_neighbor = (pc_chamber == 12 || pc_chamber == 13);
780 
781  int csc_nID = tp_csc_ID; // modify csc_ID if coming from neighbor sector
782  if (is_neighbor) {
783  // station 1 has 3 neighbor chambers: 13,14,15 in rings 1,2,3
784  // (where are chambers 10,11,12 in station 1? they were used to label ME1/1a, but not anymore)
785  // station 2,3,4 have 2 neighbor chambers: 10,11 in rings 1,2
786  if (tp_station == 1) {
787  csc_nID = 13;
788  } else {
789  csc_nID = 10;
790  }
791  }
792 
793  // Use cluster width as 'quality'
794  int tp_quality = (tp_data.pad_hi - tp_data.pad_low + 1);
795 
796  // Set properties
797  conv_hit.SetGEMDetId(tp_detId);
798 
799  conv_hit.set_bx(tp_bx + bxShiftGEM_);
800  conv_hit.set_subsystem(L1TMuon::kGEM);
801  conv_hit.set_endcap((tp_endcap == 2) ? -1 : tp_endcap);
802  conv_hit.set_station(tp_station);
803  conv_hit.set_ring(tp_ring);
804  conv_hit.set_roll(tp_roll);
805  conv_hit.set_chamber(tp_chamber);
806  conv_hit.set_sector(tp_sector);
807  conv_hit.set_subsector(tp_subsector);
808  conv_hit.set_csc_ID(tp_csc_ID);
809  conv_hit.set_csc_nID(csc_nID);
810  //conv_hit.set_track_num ( tp_data.trknmb );
811  //conv_hit.set_sync_err ( tp_data.syncErr );
812  //conv_hit.set_sector_RPC ( tp_sector );
813  //conv_hit.set_subsector_RPC ( tp_subsector );
814 
815  conv_hit.set_pc_sector(pc_sector);
816  conv_hit.set_pc_station(pc_station);
817  conv_hit.set_pc_chamber(pc_chamber);
818  conv_hit.set_pc_segment(pc_segment);
819 
820  conv_hit.set_valid(true);
821  conv_hit.set_strip(tp_pad);
822  conv_hit.set_strip_low(tp_data.pad_low);
823  conv_hit.set_strip_hi(tp_data.pad_hi);
824  //conv_hit.set_wire ( tp_data.keywire );
825  conv_hit.set_quality(tp_quality);
826  conv_hit.set_pattern(0); // arbitrary
827  //conv_hit.set_bend ( tp_data.bend );
828  conv_hit.set_time(0.); // No fine resolution timing
829  //conv_hit.set_alct_quality ( tp_data.alct_quality );
830  //conv_hit.set_clct_quality ( tp_data.clct_quality );
831 
832  conv_hit.set_neighbor(is_neighbor);
833  conv_hit.set_sector_idx((endcap_ == 1) ? sector_ - 1 : sector_ + 5);
834 
835  // Get coordinates from fullsim since LUTs do not exist yet
836  bool use_fullsim_coords = true;
837  if (use_fullsim_coords) {
838  const GlobalPoint& gp = tp_geom_->getGlobalPoint(muon_primitive);
839  double glob_phi = emtf::rad_to_deg(gp.phi().value());
840  double glob_theta = emtf::rad_to_deg(gp.theta());
841  double glob_eta = gp.eta();
842  double glob_rho = gp.perp();
843  double glob_z = gp.z();
844 
845  // Use the CSC precision (unconfirmed!)
846  int fph = emtf::calc_phi_loc_int(glob_phi, conv_hit.PC_sector());
847  int th = emtf::calc_theta_int(glob_theta, conv_hit.Endcap());
848 
849  emtf_assert(0 <= fph && fph < 5000);
850  emtf_assert(0 <= th && th < 128);
851  th = (th == 0) ? 1 : th; // protect against invalid value
852 
853  // _________________________________________________________________________
854  // Output
855 
856  conv_hit.set_phi_sim(glob_phi);
857  conv_hit.set_theta_sim(glob_theta);
858  conv_hit.set_eta_sim(glob_eta);
859  conv_hit.set_rho_sim(glob_rho);
860  conv_hit.set_z_sim(glob_z);
861 
862  conv_hit.set_phi_fp(fph); // Full-precision integer phi
863  conv_hit.set_theta_fp(th); // Full-precision integer theta
864  }
865 
866  convert_other_details(conv_hit);
867 }
void set_theta_sim(float val)
Definition: EMTFHit.h:195
void set_neighbor(int bits)
Definition: EMTFHit.h:147
void set_rho_sim(float val)
Definition: EMTFHit.h:197
void set_csc_nID(int bits)
Definition: EMTFHit.h:145
void set_pc_station(int bits)
Definition: EMTFHit.h:150
void set_phi_sim(float val)
Definition: EMTFHit.h:194
T perp() const
Definition: PV3DBase.h:69
int get_trigger_sector(int ring, int station, int chamber)
Definition: TrackTools.cc:85
constexpr int roll() const
Definition: GEMDetId.h:194
void set_station(int bits)
Definition: EMTFHit.h:136
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
void set_eta_sim(float val)
Definition: EMTFHit.h:196
void set_sector_idx(int bits)
Definition: EMTFHit.h:140
T1 value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:75
int calc_phi_loc_int(double glob, int sector)
Definition: TrackTools.h:201
void set_theta_fp(int bits)
Definition: EMTFHit.h:182
void set_endcap(int bits)
Definition: EMTFHit.h:135
void set_ring(int bits)
Definition: EMTFHit.h:137
int PC_sector() const
Definition: EMTFHit.h:217
int get_trigger_csc_ID(int ring, int station, int chamber)
Definition: TrackTools.cc:100
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
void set_strip_low(int bits)
Definition: EMTFHit.h:156
void set_pattern(int bits)
Definition: EMTFHit.h:163
constexpr int region() const
Definition: GEMDetId.h:171
T z() const
Definition: PV3DBase.h:61
void set_csc_ID(int bits)
Definition: EMTFHit.h:144
void set_pc_chamber(int bits)
Definition: EMTFHit.h:151
void set_strip_hi(int bits)
Definition: EMTFHit.h:155
void set_time(float val)
Definition: EMTFHit.h:193
int calc_theta_int(double theta, int endcap)
Definition: TrackTools.h:143
void set_pc_segment(int bits)
Definition: EMTFHit.h:152
void set_sector(int bits)
Definition: EMTFHit.h:138
constexpr int chamber() const
Definition: GEMDetId.h:183
void set_valid(int bits)
Definition: EMTFHit.h:167
constexpr int ring() const
Definition: GEMDetId.h:176
void set_z_sim(float val)
Definition: EMTFHit.h:198
#define emtf_assert(expr)
Definition: DebugTools.h:18
constexpr int station() const
Definition: GEMDetId.h:179
void set_strip(int bits)
Definition: EMTFHit.h:154
void set_subsystem(int bits)
Definition: EMTFHit.h:134
T eta() const
Definition: PV3DBase.h:73
void convert_other_details(EMTFHit &conv_hit) const
void SetGEMDetId(const GEMDetId &id)
Definition: EMTFHit.h:117
void set_bx(int bits)
Definition: EMTFHit.h:179
int Endcap() const
Definition: EMTFHit.h:203
double rad_to_deg(double rad)
Definition: TrackTools.h:73
void set_quality(int bits)
Definition: EMTFHit.h:162
void set_chamber(int bits)
Definition: EMTFHit.h:143
void set_subsector(int bits)
Definition: EMTFHit.h:141
const GeometryTranslator * tp_geom_
void set_phi_fp(int bits)
Definition: EMTFHit.h:181
void set_roll(int bits)
Definition: EMTFHit.h:146
void set_pc_sector(int bits)
Definition: EMTFHit.h:149
GlobalPoint getGlobalPoint(const TriggerPrimitive &) const
void PrimitiveConversion::convert_me0 ( int  pc_sector,
int  pc_station,
int  pc_chamber,
int  pc_segment,
const TriggerPrimitive muon_primitive,
EMTFHit conv_hit 
) const

Definition at line 929 of file PrimitiveConversion.cc.

References bxShiftME0_, emtf::calc_phi_loc_int(), emtf::calc_theta_int(), ME0DetId::chamber(), convert_other_details(), L1TMuon::TriggerPrimitive::detId(), emtf_assert, l1t::EMTFHit::Endcap(), endcap_, PV3DBase< T, PVType, FrameType >::eta(), emtf::get_trigger_csc_ID(), emtf::get_trigger_sector(), L1TMuon::GeometryTranslator::getGlobalPoint(), L1TMuon::TriggerPrimitive::getME0Data(), runTauDisplay::gp, L1TMuon::kME0, l1t::EMTFHit::PC_sector(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), emtf::rad_to_deg(), ME0DetId::region(), sector_, l1t::EMTFHit::set_bend(), l1t::EMTFHit::set_bx(), l1t::EMTFHit::set_chamber(), l1t::EMTFHit::set_csc_ID(), l1t::EMTFHit::set_csc_nID(), l1t::EMTFHit::set_endcap(), l1t::EMTFHit::set_eta_sim(), l1t::EMTFHit::set_neighbor(), l1t::EMTFHit::set_pattern(), l1t::EMTFHit::set_pc_chamber(), l1t::EMTFHit::set_pc_sector(), l1t::EMTFHit::set_pc_segment(), l1t::EMTFHit::set_pc_station(), l1t::EMTFHit::set_phi_fp(), l1t::EMTFHit::set_phi_sim(), l1t::EMTFHit::set_quality(), l1t::EMTFHit::set_rho_sim(), l1t::EMTFHit::set_ring(), l1t::EMTFHit::set_roll(), l1t::EMTFHit::set_sector(), l1t::EMTFHit::set_sector_idx(), l1t::EMTFHit::set_station(), l1t::EMTFHit::set_strip(), l1t::EMTFHit::set_subsector(), l1t::EMTFHit::set_subsystem(), l1t::EMTFHit::set_theta_fp(), l1t::EMTFHit::set_theta_sim(), l1t::EMTFHit::set_time(), l1t::EMTFHit::set_valid(), l1t::EMTFHit::set_z_sim(), l1t::EMTFHit::SetME0DetId(), ME0DetId::station(), PV3DBase< T, PVType, FrameType >::theta(), tp_geom_, Geom::Phi< T1, Range >::value(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by process().

934  {
935  const ME0DetId& tp_detId = muon_primitive.detId<ME0DetId>();
936  const ME0Data& tp_data = muon_primitive.getME0Data();
937 
938  int tp_region = tp_detId.region(); // 0 for Barrel, +/-1 for +/- Endcap
939  int tp_endcap = (tp_region == -1) ? 2 : tp_region;
940  int tp_station = tp_detId.station();
941  int tp_ring = 1; // tp_detId.ring() does not exist
942  //int tp_roll = tp_detId.roll();
943  //int tp_layer = tp_detId.layer();
944  int tp_chamber = tp_detId.chamber();
945 
946  int tp_bx = tp_data.bx;
947  int tp_pad = tp_data.phiposition;
948  int tp_partition = tp_data.partition;
949 
950  // The ME0 geometry is similar to ME2/1, so I use tp_station = 2, tp_ring = 1
951  // when calling get_trigger_sector() and get_trigger_csc_ID()
952  int tp_sector = emtf::get_trigger_sector(1, 2, tp_chamber);
953  int tp_csc_ID = emtf::get_trigger_csc_ID(1, 2, tp_chamber);
954  int tp_subsector = 0;
955 
956  const bool is_neighbor = (pc_chamber == 14);
957 
958  int csc_nID = tp_csc_ID; // modify csc_ID if coming from neighbor sector
959  if (is_neighbor) {
960  // station 1 has 3 neighbor chambers: 13,14,15 in rings 1,2,3
961  // (where are chambers 10,11,12 in station 1? they were used to label ME1/1a, but not anymore)
962  // station 2,3,4 have 2 neighbor chambers: 10,11 in rings 1,2
963  csc_nID = 10;
964  }
965 
966  // Set properties
967  conv_hit.SetME0DetId(tp_detId);
968 
969  conv_hit.set_bx(tp_bx + bxShiftME0_);
970  conv_hit.set_subsystem(L1TMuon::kME0);
971  conv_hit.set_endcap((tp_endcap == 2) ? -1 : tp_endcap);
972  conv_hit.set_station(tp_station);
973  conv_hit.set_ring(tp_ring);
974  conv_hit.set_roll(tp_partition);
975  conv_hit.set_chamber(tp_chamber);
976  conv_hit.set_sector(tp_sector);
977  conv_hit.set_subsector(tp_subsector);
978  conv_hit.set_csc_ID(tp_csc_ID);
979  conv_hit.set_csc_nID(csc_nID);
980  //conv_hit.set_track_num ( tp_data.trknmb );
981  //conv_hit.set_sync_err ( tp_data.syncErr );
982  //conv_hit.set_sector_RPC ( tp_sector );
983  //conv_hit.set_subsector_RPC ( tp_subsector );
984 
985  conv_hit.set_pc_sector(pc_sector);
986  conv_hit.set_pc_station(pc_station);
987  conv_hit.set_pc_chamber(pc_chamber);
988  conv_hit.set_pc_segment(pc_segment);
989 
990  conv_hit.set_valid(true);
991  conv_hit.set_strip(tp_pad);
992  //conv_hit.set_strip_low ( tp_strip );
993  //conv_hit.set_strip_hi ( tp_strip );
994  //conv_hit.set_wire ( tp_data.keywire );
995  conv_hit.set_quality(tp_data.quality);
996  conv_hit.set_pattern(0); // arbitrary
997  conv_hit.set_bend(tp_data.deltaphi * (tp_data.bend == 0 ? 1 : -1));
998  conv_hit.set_time(0.); // No fine resolution timing
999  //conv_hit.set_alct_quality ( tp_data.alct_quality );
1000  //conv_hit.set_clct_quality ( tp_data.clct_quality );
1001 
1002  conv_hit.set_neighbor(is_neighbor);
1003  conv_hit.set_sector_idx((endcap_ == 1) ? sector_ - 1 : sector_ + 5);
1004 
1005  // Get coordinates from fullsim since LUTs do not exist yet
1006  bool use_fullsim_coords = true;
1007  if (use_fullsim_coords) {
1008  const GlobalPoint& gp = tp_geom_->getGlobalPoint(muon_primitive);
1009  double glob_phi = emtf::rad_to_deg(gp.phi().value());
1010  double glob_theta = emtf::rad_to_deg(gp.theta());
1011  double glob_eta = gp.eta();
1012  double glob_rho = gp.perp();
1013  double glob_z = gp.z();
1014 
1015  // Use the CSC precision (unconfirmed!)
1016  int fph = emtf::calc_phi_loc_int(glob_phi, conv_hit.PC_sector());
1017  int th = emtf::calc_theta_int(glob_theta, conv_hit.Endcap());
1018 
1019  bool fix_me0_theta_edge = true;
1020  if (fix_me0_theta_edge) {
1021  // The ME0 extends to eta of 2.8 or theta of 7.0 deg. But integer theta
1022  // only starts at theta of 8.5 deg.
1023  if (th < 0)
1024  th = 0;
1025  }
1026 
1027  emtf_assert(0 <= fph && fph < 5000);
1028  emtf_assert(0 <= th && th < 128);
1029  th = (th == 0) ? 1 : th; // protect against invalid value
1030 
1031  // _________________________________________________________________________
1032  // Output
1033 
1034  conv_hit.set_phi_sim(glob_phi);
1035  conv_hit.set_theta_sim(glob_theta);
1036  conv_hit.set_eta_sim(glob_eta);
1037  conv_hit.set_rho_sim(glob_rho);
1038  conv_hit.set_z_sim(glob_z);
1039 
1040  conv_hit.set_phi_fp(fph); // Full-precision integer phi
1041  conv_hit.set_theta_fp(th); // Full-precision integer theta
1042  }
1043 
1044  convert_other_details(conv_hit);
1045 }
void set_theta_sim(float val)
Definition: EMTFHit.h:195
void set_neighbor(int bits)
Definition: EMTFHit.h:147
void set_rho_sim(float val)
Definition: EMTFHit.h:197
void set_csc_nID(int bits)
Definition: EMTFHit.h:145
void set_pc_station(int bits)
Definition: EMTFHit.h:150
void set_phi_sim(float val)
Definition: EMTFHit.h:194
T perp() const
Definition: PV3DBase.h:69
int get_trigger_sector(int ring, int station, int chamber)
Definition: TrackTools.cc:85
void set_station(int bits)
Definition: EMTFHit.h:136
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
void set_eta_sim(float val)
Definition: EMTFHit.h:196
void set_sector_idx(int bits)
Definition: EMTFHit.h:140
T1 value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:75
int calc_phi_loc_int(double glob, int sector)
Definition: TrackTools.h:201
void SetME0DetId(const ME0DetId &id)
Definition: EMTFHit.h:118
int station() const
Definition: ME0DetId.h:58
void set_theta_fp(int bits)
Definition: EMTFHit.h:182
void set_endcap(int bits)
Definition: EMTFHit.h:135
void set_ring(int bits)
Definition: EMTFHit.h:137
int PC_sector() const
Definition: EMTFHit.h:217
int get_trigger_csc_ID(int ring, int station, int chamber)
Definition: TrackTools.cc:100
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:41
void set_pattern(int bits)
Definition: EMTFHit.h:163
T z() const
Definition: PV3DBase.h:61
void set_csc_ID(int bits)
Definition: EMTFHit.h:144
void set_pc_chamber(int bits)
Definition: EMTFHit.h:151
void set_time(float val)
Definition: EMTFHit.h:193
int calc_theta_int(double theta, int endcap)
Definition: TrackTools.h:143
void set_pc_segment(int bits)
Definition: EMTFHit.h:152
void set_sector(int bits)
Definition: EMTFHit.h:138
void set_valid(int bits)
Definition: EMTFHit.h:167
void set_z_sim(float val)
Definition: EMTFHit.h:198
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: ME0DetId.h:38
#define emtf_assert(expr)
Definition: DebugTools.h:18
void set_strip(int bits)
Definition: EMTFHit.h:154
void set_subsystem(int bits)
Definition: EMTFHit.h:134
T eta() const
Definition: PV3DBase.h:73
void convert_other_details(EMTFHit &conv_hit) const
void set_bx(int bits)
Definition: EMTFHit.h:179
int Endcap() const
Definition: EMTFHit.h:203
double rad_to_deg(double rad)
Definition: TrackTools.h:73
void set_quality(int bits)
Definition: EMTFHit.h:162
void set_chamber(int bits)
Definition: EMTFHit.h:143
void set_subsector(int bits)
Definition: EMTFHit.h:141
void set_bend(int bits)
Definition: EMTFHit.h:165
const GeometryTranslator * tp_geom_
void set_phi_fp(int bits)
Definition: EMTFHit.h:181
void set_roll(int bits)
Definition: EMTFHit.h:146
void set_pc_sector(int bits)
Definition: EMTFHit.h:149
GlobalPoint getGlobalPoint(const TriggerPrimitive &) const
void PrimitiveConversion::convert_other_details ( EMTFHit conv_hit) const

Definition at line 869 of file PrimitiveConversion.cc.

References emtf::calc_eta_from_theta_deg(), emtf::calc_phi_glob_deg(), emtf::calc_phi_loc_deg(), emtf::calc_theta_deg_from_int(), gather_cfg::cout, l1t::EMTFHit::CSC_nID(), l1t::EMTFHit::Endcap(), get_bt_segment(), get_bt_station(), get_fs_segment(), get_fs_zone_code(), get_zone_code(), l1t::EMTFHit::Neighbor(), l1t::EMTFHit::PC_chamber(), l1t::EMTFHit::PC_sector(), l1t::EMTFHit::PC_segment(), l1t::EMTFHit::PC_station(), l1t::EMTFHit::Phi_fp(), l1t::EMTFHit::Phi_loc(), l1t::EMTFHit::Ring(), l1t::EMTFHit::Sector(), l1t::EMTFHit::set_bt_segment(), l1t::EMTFHit::set_bt_station(), l1t::EMTFHit::set_eta(), l1t::EMTFHit::set_fs_segment(), l1t::EMTFHit::set_fs_zone_code(), l1t::EMTFHit::set_phi_fp(), l1t::EMTFHit::set_phi_glob(), l1t::EMTFHit::set_phi_loc(), l1t::EMTFHit::set_theta(), l1t::EMTFHit::set_theta_fp(), l1t::EMTFHit::set_zone_code(), l1t::EMTFHit::set_zone_hit(), l1t::EMTFHit::Station(), l1t::EMTFHit::Subsector(), l1t::EMTFHit::Theta(), l1t::EMTFHit::Theta_fp(), and verbose_.

Referenced by convert_dt(), convert_gem(), and convert_me0().

869  {
870  const bool is_neighbor = conv_hit.Neighbor();
871 
872  const int pc_station = conv_hit.PC_station();
873  const int pc_chamber = conv_hit.PC_chamber();
874  const int pc_segment = conv_hit.PC_segment();
875 
876  //const int fw_endcap = (endcap_-1);
877  //const int fw_sector = (sector_-1);
878  const int fw_station =
879  (conv_hit.Station() == 1) ? (is_neighbor ? 0 : (conv_hit.Subsector() - 1)) : conv_hit.Station();
880  const int fw_cscid = (conv_hit.CSC_nID() - 1);
881 
882  int fph = conv_hit.Phi_fp();
883  int th = conv_hit.Theta_fp();
884 
885  if (verbose_ > 1) { // debug
886  std::cout << "GEM hit pc_station: " << pc_station << " pc_chamber: " << pc_chamber << " fw_station: " << fw_station
887  << " fw_cscid: " << fw_cscid << " tp_station: " << conv_hit.Station() << " tp_ring: " << conv_hit.Ring()
888  << " tp_sector: " << conv_hit.Sector() << " tp_subsector: " << conv_hit.Subsector() << " fph: " << fph
889  << " th: " << th << std::endl;
890  }
891 
892  // ___________________________________________________________________________
893  // Zone codes and other segment IDs
894 
895  int zone_hit = ((fph + (1 << 4)) >> 5);
896  int zone_code = get_zone_code(conv_hit, th);
897  //int phzvl = get_phzvl(conv_hit, zone_code);
898 
899  int fs_zone_code = get_fs_zone_code(conv_hit);
900  int fs_segment = get_fs_segment(conv_hit, fw_station, fw_cscid, pc_segment);
901 
902  int bt_station = get_bt_station(conv_hit, fw_station, fw_cscid, pc_segment);
903  int bt_segment = get_bt_segment(conv_hit, fw_station, fw_cscid, pc_segment);
904 
905  // ___________________________________________________________________________
906  // Output
907 
908  conv_hit.set_phi_fp(fph); // Full-precision integer phi
909  conv_hit.set_theta_fp(th); // Full-precision integer theta
910  //conv_hit.set_phzvl ( phzvl ); // Local zone word: (1*low) + (2*mid) + (4*low) - used in FW debugging
911  //conv_hit.set_ph_hit ( ph_hit ); // Intermediate quantity in phi calculation - used in FW debugging
912  conv_hit.set_zone_hit(zone_hit); // Phi value for building patterns (0.53333 deg precision)
913  conv_hit.set_zone_code(zone_code); // Full zone word: 1*(zone 0) + 2*(zone 1) + 4*(zone 2) + 8*(zone 3)
914 
915  conv_hit.set_fs_segment(fs_segment); // Segment number used in primitive matching
916  conv_hit.set_fs_zone_code(fs_zone_code); // Zone word used in primitive matching
917 
918  conv_hit.set_bt_station(bt_station);
919  conv_hit.set_bt_segment(bt_segment);
920 
921  conv_hit.set_phi_loc(emtf::calc_phi_loc_deg(fph));
922  conv_hit.set_phi_glob(emtf::calc_phi_glob_deg(conv_hit.Phi_loc(), conv_hit.PC_sector()));
924  conv_hit.set_eta(emtf::calc_eta_from_theta_deg(conv_hit.Theta(), conv_hit.Endcap()));
925 }
void set_phi_glob(float val)
Definition: EMTFHit.h:190
int get_bt_station(const EMTFHit &conv_hit, int fw_station, int fw_cscid, int pc_segment) const
float Phi_loc() const
Definition: EMTFHit.h:272
int get_zone_code(const EMTFHit &conv_hit, int th) const
int CSC_nID() const
Definition: EMTFHit.h:213
int Phi_fp() const
Definition: EMTFHit.h:264
void set_theta(float val)
Definition: EMTFHit.h:191
float Theta() const
Definition: EMTFHit.h:274
void set_bt_station(int bits)
Definition: EMTFHit.h:187
double calc_phi_loc_deg(int bits)
Definition: TrackTools.h:176
int get_bt_segment(const EMTFHit &conv_hit, int fw_station, int fw_cscid, int pc_segment) const
void set_theta_fp(int bits)
Definition: EMTFHit.h:182
int PC_sector() const
Definition: EMTFHit.h:217
int Subsector() const
Definition: EMTFHit.h:209
int PC_station() const
Definition: EMTFHit.h:218
int get_fs_segment(const EMTFHit &conv_hit, int fw_station, int fw_cscid, int pc_segment) const
int Sector() const
Definition: EMTFHit.h:206
double calc_theta_deg_from_int(int theta_int)
Definition: TrackTools.h:128
void set_bt_segment(int bits)
Definition: EMTFHit.h:188
int PC_segment() const
Definition: EMTFHit.h:220
int Ring() const
Definition: EMTFHit.h:205
double calc_phi_glob_deg(double loc, int sector)
Definition: TrackTools.h:166
void set_phi_loc(float val)
Definition: EMTFHit.h:189
int PC_chamber() const
Definition: EMTFHit.h:219
void set_fs_segment(int bits)
Definition: EMTFHit.h:185
int Station() const
Definition: EMTFHit.h:204
double calc_eta_from_theta_deg(double theta_deg, int endcap)
Definition: TrackTools.h:113
void set_zone_code(int bits)
Definition: EMTFHit.h:184
void set_zone_hit(int bits)
Definition: EMTFHit.h:183
int Endcap() const
Definition: EMTFHit.h:203
tuple cout
Definition: gather_cfg.py:144
int get_fs_zone_code(const EMTFHit &conv_hit) const
void set_fs_zone_code(int bits)
Definition: EMTFHit.h:186
int Theta_fp() const
Definition: EMTFHit.h:265
int Neighbor() const
Definition: EMTFHit.h:215
void set_phi_fp(int bits)
Definition: EMTFHit.h:181
void set_eta(float val)
Definition: EMTFHit.h:192
void PrimitiveConversion::convert_rpc ( int  pc_sector,
int  pc_station,
int  pc_chamber,
int  pc_segment,
const TriggerPrimitive muon_primitive,
EMTFHit conv_hit 
) const

Definition at line 501 of file PrimitiveConversion.cc.

References bxShiftRPC_, emtf::calc_phi_loc_int(), emtf::calc_phi_loc_int_rpc(), emtf::calc_theta_int(), emtf::calc_theta_int_rpc(), convert_rpc_details(), L1TMuon::TriggerPrimitive::detId(), emtf_assert, l1t::EMTFHit::Endcap(), endcap_, PV3DBase< T, PVType, FrameType >::eta(), emtf::get_trigger_csc_ID(), L1TMuon::GeometryTranslator::getGlobalPoint(), L1TMuon::TriggerPrimitive::getRPCData(), L1TMuon::GeometryTranslator::getRPCGeometry(), runTauDisplay::gp, L1TMuon::kRPC, l1t::EMTFHit::PC_sector(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), emtf::rad_to_deg(), RPCDetId::region(), RPCDetId::ring(), RPCGeometry::roll(), RPCDetId::roll(), RPCDetId::sector(), sector_, l1t::EMTFHit::set_bx(), l1t::EMTFHit::set_chamber(), l1t::EMTFHit::set_csc_ID(), l1t::EMTFHit::set_csc_nID(), l1t::EMTFHit::set_endcap(), l1t::EMTFHit::set_eta_sim(), l1t::EMTFHit::set_neighbor(), l1t::EMTFHit::set_pattern(), l1t::EMTFHit::set_pc_chamber(), l1t::EMTFHit::set_pc_sector(), l1t::EMTFHit::set_pc_segment(), l1t::EMTFHit::set_pc_station(), l1t::EMTFHit::set_phi_fp(), l1t::EMTFHit::set_phi_sim(), l1t::EMTFHit::set_quality(), l1t::EMTFHit::set_rho_sim(), l1t::EMTFHit::set_ring(), l1t::EMTFHit::set_roll(), l1t::EMTFHit::set_sector(), l1t::EMTFHit::set_sector_idx(), l1t::EMTFHit::set_sector_RPC(), l1t::EMTFHit::set_station(), l1t::EMTFHit::set_strip(), l1t::EMTFHit::set_strip_hi(), l1t::EMTFHit::set_strip_low(), l1t::EMTFHit::set_subsector(), l1t::EMTFHit::set_subsector_RPC(), l1t::EMTFHit::set_subsystem(), l1t::EMTFHit::set_theta_fp(), l1t::EMTFHit::set_theta_sim(), l1t::EMTFHit::set_time(), l1t::EMTFHit::set_valid(), l1t::EMTFHit::set_z_sim(), l1t::EMTFHit::SetRPCDetId(), RPCDetId::station(), RPCDetId::subsector(), GeomDet::surface(), PV3DBase< T, PVType, FrameType >::theta(), Surface::toGlobal(), tp_geom_, Geom::Phi< T1, Range >::value(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by process().

506  {
507  const RPCDetId& tp_detId = muon_primitive.detId<RPCDetId>();
508  const RPCData& tp_data = muon_primitive.getRPCData();
509 
510  int tp_region = tp_detId.region(); // 0 for Barrel, +/-1 for +/- Endcap
511  int tp_endcap = (tp_region == -1) ? 2 : tp_region;
512  int tp_sector = tp_detId.sector(); // 1 - 6 (60 degrees in phi, sector 1 begins at -5 deg)
513  int tp_subsector = tp_detId.subsector(); // 1 - 6 (10 degrees in phi; staggered in z)
514  int tp_station = tp_detId.station(); // 1 - 4
515  int tp_ring = tp_detId.ring(); // 2 - 3 (increasing theta)
516  int tp_roll = tp_detId.roll(); // 1 - 3 (decreasing theta; aka A - C; space between rolls is 9 - 15 in theta_fp)
517  //int tp_layer = tp_detId.layer(); // Always 1 in the Endcap, 1 or 2 in the Barrel
518 
519  int tp_bx = tp_data.bx;
520  int tp_strip = ((tp_data.strip_low + tp_data.strip_hi) / 2); // in full-strip unit
521 
522  const bool is_neighbor = (pc_station == 5);
523 
524  // CSC-like sector, subsector and chamber numbers
525  int csc_tp_chamber = (tp_sector - 1) * 6 + tp_subsector;
526  int csc_tp_sector = (tp_subsector > 2) ? tp_sector : ((tp_sector + 4) % 6) + 1; // Rotate by 20 deg
527  int csc_tp_subsector = (tp_station != 1) ? 0 : ((csc_tp_chamber % 6 > 2) ? 1 : 2);
528 
529  const bool is_irpc = (tp_station == 3 || tp_station == 4) && (tp_ring == 1);
530  if (is_irpc) {
531  csc_tp_chamber = (tp_sector - 1) * 3 + tp_subsector;
532  csc_tp_sector = (tp_subsector > 1) ? tp_sector : ((tp_sector + 4) % 6) + 1; // Rotate by 20 deg
533  csc_tp_subsector = (tp_station != 1) ? 0 : ((csc_tp_chamber % 6 > 2) ? 1 : 2);
534  }
535  int tp_csc_ID = emtf::get_trigger_csc_ID(tp_ring, tp_station, csc_tp_chamber);
536 
537  int csc_nID = tp_csc_ID; // modify csc_ID if coming from neighbor sector
538  if (is_neighbor) {
539  // station 1 has 3 neighbor chambers: 13,14,15 in rings 1,2,3
540  // (where are chambers 10,11,12 in station 1? they were used to label ME1/1a, but not anymore)
541  // station 2,3,4 have 2 neighbor chambers: 10,11 in rings 1,2
542  csc_nID = (pc_chamber < 3) ? (pc_chamber + 12) : (((pc_chamber - 1) % 2) + 9);
543  csc_nID += 1;
544  }
545 
546  // Use cluster width as 'quality'
547  int tp_quality = (tp_data.strip_hi - tp_data.strip_low + 1);
548  if (!is_irpc) {
549  tp_quality *= 3; // old RPC strip pitch is 1.5 times the new iRPC
550  tp_quality /= 2;
551  }
552 
553  // Set properties
554  conv_hit.SetRPCDetId(tp_detId);
555 
556  conv_hit.set_bx(tp_bx + bxShiftRPC_);
557  conv_hit.set_subsystem(L1TMuon::kRPC);
558  conv_hit.set_endcap((tp_endcap == 2) ? -1 : tp_endcap);
559  conv_hit.set_station(tp_station);
560  conv_hit.set_ring(tp_ring);
561  conv_hit.set_roll(tp_roll);
562  conv_hit.set_chamber(csc_tp_chamber);
563  conv_hit.set_sector(csc_tp_sector);
564  conv_hit.set_subsector(csc_tp_subsector);
565  conv_hit.set_csc_ID(tp_csc_ID);
566  conv_hit.set_csc_nID(csc_nID);
567  //conv_hit.set_track_num ( tp_data.trknmb );
568  //conv_hit.set_sync_err ( tp_data.syncErr );
569  conv_hit.set_sector_RPC(tp_sector); // In RPC convention in CMSSW (RPCDetId.h), sector 1 starts at -5 deg
570  conv_hit.set_subsector_RPC(tp_subsector);
571 
572  conv_hit.set_pc_sector(pc_sector);
573  conv_hit.set_pc_station(pc_station);
574  conv_hit.set_pc_chamber(pc_chamber);
575  conv_hit.set_pc_segment(pc_segment);
576 
577  conv_hit.set_valid(tp_data.valid);
578  conv_hit.set_strip(tp_strip);
579  conv_hit.set_strip_low(tp_data.strip_low);
580  conv_hit.set_strip_hi(tp_data.strip_hi);
581  //conv_hit.set_wire ( tp_data.keywire );
582  conv_hit.set_quality(tp_quality);
583  conv_hit.set_pattern(0); // In firmware, this marks RPC stub
584  //conv_hit.set_bend ( tp_data.bend );
585  conv_hit.set_time(tp_data.time);
586  //conv_hit.set_alct_quality ( tp_data.alct_quality );
587  //conv_hit.set_clct_quality ( tp_data.clct_quality );
588 
589  conv_hit.set_neighbor(is_neighbor);
590  conv_hit.set_sector_idx((endcap_ == 1) ? sector_ - 1 : sector_ + 5);
591 
592  // Get coordinates from fullsim
593  bool use_fullsim_coords = true;
594 
595  if (tp_data.isCPPF) { // CPPF digis from EMTF unpacker or CPPF emulator
596  conv_hit.set_phi_fp(tp_data.phi_int * 4); // Full-precision integer phi
597  conv_hit.set_theta_fp(tp_data.theta_int * 4); // Full-precision integer theta
598  } else if (use_fullsim_coords) {
599  const GlobalPoint& gp = tp_geom_->getGlobalPoint(muon_primitive);
600  double glob_phi = emtf::rad_to_deg(gp.phi().value());
601  double glob_theta = emtf::rad_to_deg(gp.theta());
602  double glob_eta = gp.eta();
603  double glob_rho = gp.perp();
604  double glob_z = gp.z();
605 
606  // Use RPC-specific convention in docs/CPPF-EMTF-format_2016_11_01.docx
607  // Phi precision is 1/15 degrees (11 bits), 4x larger than CSC precision of 1/60 degrees (13 bits)
608  // Theta precision is 36.5/32 degrees (5 bits), 4x larger than CSC precision of 36.5/128 degrees (7 bits)
609  //
610  // NOTE: fph and th are recalculated using CPPF LUTs in the convert_rpc_details() function,
611  // this part is still kept because it is needed for Phase 2 iRPC hits.
612  //
613  int fph = emtf::calc_phi_loc_int_rpc(glob_phi, conv_hit.PC_sector());
614  int th = emtf::calc_theta_int_rpc(glob_theta, conv_hit.Endcap());
615 
616  //emtf_assert(0 <= fph && fph < 1024);
617  emtf_assert(0 <= fph && fph < 1250);
618  emtf_assert(0 <= th && th < 32);
619  emtf_assert(th != 0b11111); // RPC hit valid when data is not all ones
620  fph <<= 2; // upgrade to full CSC precision by adding 2 zeros
621  th <<= 2; // upgrade to full CSC precision by adding 2 zeros
622  th = (th == 0) ? 1 : th; // protect against invalid value
623 
624  if (is_irpc) {
625  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(tp_geom_->getRPCGeometry().roll(tp_detId));
626  emtf_assert(roll != nullptr); // failed to get RPC roll
627  const GlobalPoint& new_gp = roll->surface().toGlobal(LocalPoint(tp_data.x, tp_data.y, 0));
628  glob_phi = emtf::rad_to_deg(gp.phi().value()); // using 'gp' instead of 'new_gp' for phi
629  glob_theta = emtf::rad_to_deg(new_gp.theta());
630  glob_eta = new_gp.eta();
631  glob_rho = new_gp.perp();
632  glob_z = new_gp.z();
633 
634  fph = emtf::calc_phi_loc_int(glob_phi, conv_hit.PC_sector());
635  th = emtf::calc_theta_int(glob_theta, conv_hit.Endcap());
636 
637  emtf_assert(0 <= fph && fph < 5000);
638  emtf_assert(0 <= th && th < 128);
639  th = (th == 0) ? 1 : th; // protect against invalid value
640  }
641 
642  // _________________________________________________________________________
643  // Output
644 
645  conv_hit.set_phi_sim(glob_phi);
646  conv_hit.set_theta_sim(glob_theta);
647  conv_hit.set_eta_sim(glob_eta);
648  conv_hit.set_rho_sim(glob_rho);
649  conv_hit.set_z_sim(glob_z);
650 
651  conv_hit.set_phi_fp(fph); // Full-precision integer phi
652  conv_hit.set_theta_fp(th); // Full-precision integer theta
653  }
654 
655  convert_rpc_details(conv_hit, tp_data.isCPPF);
656 }
void set_subsector_RPC(int bits)
Definition: EMTFHit.h:142
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
void set_theta_sim(float val)
Definition: EMTFHit.h:195
void set_neighbor(int bits)
Definition: EMTFHit.h:147
void set_rho_sim(float val)
Definition: EMTFHit.h:197
void set_csc_nID(int bits)
Definition: EMTFHit.h:145
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
void set_pc_station(int bits)
Definition: EMTFHit.h:150
void set_phi_sim(float val)
Definition: EMTFHit.h:194
T perp() const
Definition: PV3DBase.h:69
const RPCGeometry & getRPCGeometry() const
void convert_rpc_details(EMTFHit &conv_hit, bool isCPPF) const
void set_station(int bits)
Definition: EMTFHit.h:136
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
void set_eta_sim(float val)
Definition: EMTFHit.h:196
void set_sector_idx(int bits)
Definition: EMTFHit.h:140
T1 value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:75
int calc_phi_loc_int(double glob, int sector)
Definition: TrackTools.h:201
void set_theta_fp(int bits)
Definition: EMTFHit.h:182
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
void set_endcap(int bits)
Definition: EMTFHit.h:135
void set_ring(int bits)
Definition: EMTFHit.h:137
int calc_theta_int_rpc(double theta, int endcap)
Definition: TrackTools.h:150
int PC_sector() const
Definition: EMTFHit.h:217
int get_trigger_csc_ID(int ring, int station, int chamber)
Definition: TrackTools.cc:100
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
void SetRPCDetId(const RPCDetId &id)
Definition: EMTFHit.h:116
void set_strip_low(int bits)
Definition: EMTFHit.h:156
int roll() const
Definition: RPCDetId.h:92
int ring() const
Definition: RPCDetId.h:59
void set_pattern(int bits)
Definition: EMTFHit.h:163
T z() const
Definition: PV3DBase.h:61
void set_csc_ID(int bits)
Definition: EMTFHit.h:144
void set_pc_chamber(int bits)
Definition: EMTFHit.h:151
void set_strip_hi(int bits)
Definition: EMTFHit.h:155
int calc_phi_loc_int_rpc(double glob, int sector)
Definition: TrackTools.h:209
void set_time(float val)
Definition: EMTFHit.h:193
int calc_theta_int(double theta, int endcap)
Definition: TrackTools.h:143
void set_pc_segment(int bits)
Definition: EMTFHit.h:152
void set_sector_RPC(int bits)
Definition: EMTFHit.h:139
void set_sector(int bits)
Definition: EMTFHit.h:138
void set_valid(int bits)
Definition: EMTFHit.h:167
void set_z_sim(float val)
Definition: EMTFHit.h:198
#define emtf_assert(expr)
Definition: DebugTools.h:18
void set_strip(int bits)
Definition: EMTFHit.h:154
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:81
void set_subsystem(int bits)
Definition: EMTFHit.h:134
T eta() const
Definition: PV3DBase.h:73
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
void set_bx(int bits)
Definition: EMTFHit.h:179
int Endcap() const
Definition: EMTFHit.h:203
double rad_to_deg(double rad)
Definition: TrackTools.h:73
void set_quality(int bits)
Definition: EMTFHit.h:162
void set_chamber(int bits)
Definition: EMTFHit.h:143
void set_subsector(int bits)
Definition: EMTFHit.h:141
const GeometryTranslator * tp_geom_
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
void set_phi_fp(int bits)
Definition: EMTFHit.h:181
void set_roll(int bits)
Definition: EMTFHit.h:146
void set_pc_sector(int bits)
Definition: EMTFHit.h:149
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
int station() const
Definition: RPCDetId.h:78
GlobalPoint getGlobalPoint(const TriggerPrimitive &) const
void PrimitiveConversion::convert_rpc_details ( EMTFHit conv_hit,
bool  isCPPF 
) const

Definition at line 658 of file PrimitiveConversion.cc.

References emtf::calc_eta_from_theta_deg(), emtf::calc_phi_glob_deg(), emtf::calc_phi_loc_deg(), emtf::calc_theta_deg_from_int(), gather_cfg::cout, l1t::EMTFHit::CSC_nID(), emtf_assert, l1t::EMTFHit::Endcap(), get_bt_segment(), get_bt_station(), SectorProcessorLUT::get_cppf_ph_lut(), SectorProcessorLUT::get_cppf_th_lut(), get_fs_segment(), get_fs_zone_code(), get_zone_code(), l1t::EMTFHit::Neighbor(), l1t::EMTFHit::PC_chamber(), pc_lut(), l1t::EMTFHit::PC_sector(), l1t::EMTFHit::PC_segment(), l1t::EMTFHit::PC_station(), l1t::EMTFHit::Phi_fp(), l1t::EMTFHit::Phi_loc(), l1t::EMTFHit::Ring(), l1t::EMTFHit::Roll(), l1t::EMTFHit::Sector_RPC(), l1t::EMTFHit::set_bt_segment(), l1t::EMTFHit::set_bt_station(), l1t::EMTFHit::set_eta(), l1t::EMTFHit::set_fs_segment(), l1t::EMTFHit::set_fs_zone_code(), l1t::EMTFHit::set_phi_fp(), l1t::EMTFHit::set_phi_glob(), l1t::EMTFHit::set_phi_loc(), l1t::EMTFHit::set_theta(), l1t::EMTFHit::set_theta_fp(), l1t::EMTFHit::set_zone_code(), l1t::EMTFHit::set_zone_hit(), l1t::EMTFHit::Station(), l1t::EMTFHit::Strip_hi(), l1t::EMTFHit::Strip_low(), l1t::EMTFHit::Subsector_RPC(), l1t::EMTFHit::Theta(), l1t::EMTFHit::Theta_fp(), and verbose_.

Referenced by convert_rpc().

658  {
659  const bool is_neighbor = conv_hit.Neighbor();
660 
661  const int pc_station = conv_hit.PC_station();
662  const int pc_chamber = conv_hit.PC_chamber();
663  const int pc_segment = conv_hit.PC_segment();
664 
665  //const int fw_endcap = (endcap_-1);
666  //const int fw_sector = (sector_-1);
667  const int fw_station = (conv_hit.Station() == 1) ? (is_neighbor ? 0 : pc_station) : conv_hit.Station();
668  const int fw_cscid = (conv_hit.CSC_nID() - 1);
669 
670  int fph = conv_hit.Phi_fp();
671  int th = conv_hit.Theta_fp();
672 
673  // Do coordinate conversion using the CPPF LUTs. Not needed if the received digis are CPPF digis.
674  bool use_cppf_lut = !isCPPF;
675 
676  if (use_cppf_lut) {
677  int halfstrip = (conv_hit.Strip_low() + conv_hit.Strip_hi() - 1);
678  emtf_assert(1 <= halfstrip && halfstrip <= 64);
679 
680  int fph2 = pc_lut().get_cppf_ph_lut(conv_hit.Endcap(),
681  conv_hit.Sector_RPC(),
682  conv_hit.Station(),
683  conv_hit.Ring(),
684  conv_hit.Subsector_RPC(),
685  conv_hit.Roll(),
686  halfstrip,
687  is_neighbor);
688  int th2 = pc_lut().get_cppf_th_lut(conv_hit.Endcap(),
689  conv_hit.Sector_RPC(),
690  conv_hit.Station(),
691  conv_hit.Ring(),
692  conv_hit.Subsector_RPC(),
693  conv_hit.Roll());
694  //emtf_assert(abs((fph>>2) - fph2) <= 4); // arbitrary tolerance
695  //emtf_assert(abs((th>>2) - th2) <= 1); // arbitrary tolerance
696  fph = fph2;
697  th = th2;
698 
699  //emtf_assert(0 <= fph && fph < 1024);
700  emtf_assert(0 <= fph && fph < 1250);
701  emtf_assert(0 <= th && th < 32);
702  emtf_assert(th != 0b11111); // RPC hit valid when data is not all ones
703  fph <<= 2; // upgrade to full CSC precision by adding 2 zeros
704  th <<= 2; // upgrade to full CSC precision by adding 2 zeros
705  th = (th == 0) ? 1 : th; // protect against invalid value
706  }
707 
708  if (verbose_ > 1) { // debug
709  std::cout << "RPC hit pc_station: " << pc_station << " pc_chamber: " << pc_chamber << " fw_station: " << fw_station
710  << " fw_cscid: " << fw_cscid << " tp_station: " << conv_hit.Station() << " tp_ring: " << conv_hit.Ring()
711  << " tp_sector: " << conv_hit.Sector_RPC() << " tp_subsector: " << conv_hit.Subsector_RPC()
712  << " fph: " << fph << " th: " << th << std::endl;
713  }
714 
715  // ___________________________________________________________________________
716  // Zone codes and other segment IDs
717 
718  int zone_hit = ((fph + (1 << 4)) >> 5);
719  int zone_code = get_zone_code(conv_hit, th);
720  //int phzvl = get_phzvl(conv_hit, zone_code);
721 
722  int fs_zone_code = get_fs_zone_code(conv_hit);
723  int fs_segment = get_fs_segment(conv_hit, fw_station, fw_cscid, pc_segment);
724 
725  int bt_station = get_bt_station(conv_hit, fw_station, fw_cscid, pc_segment);
726  int bt_segment = get_bt_segment(conv_hit, fw_station, fw_cscid, pc_segment);
727 
728  // ___________________________________________________________________________
729  // Output
730 
731  conv_hit.set_phi_fp(fph); // Full-precision integer phi
732  conv_hit.set_theta_fp(th); // Full-precision integer theta
733  //conv_hit.set_phzvl ( phzvl ); // Local zone word: (1*low) + (2*mid) + (4*low) - used in FW debugging
734  //conv_hit.set_ph_hit ( ph_hit ); // Intermediate quantity in phi calculation - used in FW debugging
735  conv_hit.set_zone_hit(zone_hit); // Phi value for building patterns (0.53333 deg precision)
736  conv_hit.set_zone_code(zone_code); // Full zone word: 1*(zone 0) + 2*(zone 1) + 4*(zone 2) + 8*(zone 3)
737 
738  conv_hit.set_fs_segment(fs_segment); // Segment number used in primitive matching
739  conv_hit.set_fs_zone_code(fs_zone_code); // Zone word used in primitive matching
740 
741  conv_hit.set_bt_station(bt_station);
742  conv_hit.set_bt_segment(bt_segment);
743 
744  conv_hit.set_phi_loc(emtf::calc_phi_loc_deg(fph));
745  conv_hit.set_phi_glob(emtf::calc_phi_glob_deg(conv_hit.Phi_loc(), conv_hit.PC_sector()));
747  conv_hit.set_eta(emtf::calc_eta_from_theta_deg(conv_hit.Theta(), conv_hit.Endcap()));
748 }
void set_phi_glob(float val)
Definition: EMTFHit.h:190
int Strip_hi() const
Definition: EMTFHit.h:223
int get_bt_station(const EMTFHit &conv_hit, int fw_station, int fw_cscid, int pc_segment) const
float Phi_loc() const
Definition: EMTFHit.h:272
int get_zone_code(const EMTFHit &conv_hit, int th) const
int CSC_nID() const
Definition: EMTFHit.h:213
int Phi_fp() const
Definition: EMTFHit.h:264
void set_theta(float val)
Definition: EMTFHit.h:191
float Theta() const
Definition: EMTFHit.h:274
void set_bt_station(int bits)
Definition: EMTFHit.h:187
double calc_phi_loc_deg(int bits)
Definition: TrackTools.h:176
int Roll() const
Definition: EMTFHit.h:214
int get_bt_segment(const EMTFHit &conv_hit, int fw_station, int fw_cscid, int pc_segment) const
void set_theta_fp(int bits)
Definition: EMTFHit.h:182
int PC_sector() const
Definition: EMTFHit.h:217
int PC_station() const
Definition: EMTFHit.h:218
int get_fs_segment(const EMTFHit &conv_hit, int fw_station, int fw_cscid, int pc_segment) const
double calc_theta_deg_from_int(int theta_int)
Definition: TrackTools.h:128
int Strip_low() const
Definition: EMTFHit.h:224
void set_bt_segment(int bits)
Definition: EMTFHit.h:188
int PC_segment() const
Definition: EMTFHit.h:220
uint32_t get_cppf_th_lut(int rpc_region, int rpc_sector, int rpc_station, int rpc_ring, int rpc_subsector, int rpc_roll) const
int Subsector_RPC() const
Definition: EMTFHit.h:210
int Ring() const
Definition: EMTFHit.h:205
double calc_phi_glob_deg(double loc, int sector)
Definition: TrackTools.h:166
const SectorProcessorLUT & pc_lut() const
void set_phi_loc(float val)
Definition: EMTFHit.h:189
int Sector_RPC() const
Definition: EMTFHit.h:207
int PC_chamber() const
Definition: EMTFHit.h:219
void set_fs_segment(int bits)
Definition: EMTFHit.h:185
int Station() const
Definition: EMTFHit.h:204
#define emtf_assert(expr)
Definition: DebugTools.h:18
double calc_eta_from_theta_deg(double theta_deg, int endcap)
Definition: TrackTools.h:113
void set_zone_code(int bits)
Definition: EMTFHit.h:184
void set_zone_hit(int bits)
Definition: EMTFHit.h:183
int Endcap() const
Definition: EMTFHit.h:203
tuple cout
Definition: gather_cfg.py:144
int get_fs_zone_code(const EMTFHit &conv_hit) const
void set_fs_zone_code(int bits)
Definition: EMTFHit.h:186
int Theta_fp() const
Definition: EMTFHit.h:265
int Neighbor() const
Definition: EMTFHit.h:215
uint32_t get_cppf_ph_lut(int rpc_region, int rpc_sector, int rpc_station, int rpc_ring, int rpc_subsector, int rpc_roll, int halfstrip, bool is_neighbor) const
void set_phi_fp(int bits)
Definition: EMTFHit.h:181
void set_eta(float val)
Definition: EMTFHit.h:192
int PrimitiveConversion::get_bt_segment ( const EMTFHit conv_hit,
int  fw_station,
int  fw_cscid,
int  pc_segment 
) const

Definition at line 1292 of file PrimitiveConversion.cc.

References emtf_assert.

Referenced by convert_csc_details(), convert_other_details(), and convert_rpc_details().

1292  {
1293  // For later use in angle calculation and best track selection
1294  // (in the firmware, this happens in the best_tracks module)
1295  int bt_history = 0; // history id: not set here, to be set in primitive matching
1296  int bt_chamber = -1; // chamber id
1297  int bt_segment = pc_segment % 2; // segment id
1298 
1299  // For ME1
1300  // j = 0 is No valid LCT
1301  // j = 1 .. 9 are native sector chambers
1302  // j = 10 .. 12 are neighbor sector chambers
1303  // For ME2,3,4
1304  // j = 0 is No valid LCT
1305  // j = 1 .. 9 are native sector chambers
1306  // j = 10 .. 11 are neighbor sector chambers
1307  bt_chamber = fw_cscid + 1;
1308  if (fw_station == 0 && bt_chamber >= 13) // ME1 neighbor chambers 13,14,15 -> 10,11,12
1309  bt_chamber -= 3;
1310 
1311  emtf_assert(bt_history == 0 && (0 <= bt_chamber && bt_chamber < 13) && (0 <= bt_segment && bt_segment < 2));
1312  // bt_segment is a 7-bit word, HHCCCCS, encoding the segment number S in the chamber (1 or 2),
1313  // the chamber number CCCC ("j" above: uniquely identifies chamber within station and ring),
1314  // and the history HH (0 for current BX, 1 for previous BX, 2 for BX before that)
1315  bt_segment = ((bt_history & 0x3) << 5) | ((bt_chamber & 0xf) << 1) | (bt_segment & 0x1);
1316  return bt_segment;
1317 }
#define emtf_assert(expr)
Definition: DebugTools.h:18
int PrimitiveConversion::get_bt_station ( const EMTFHit conv_hit,
int  fw_station,
int  fw_cscid,
int  pc_segment 
) const

Definition at line 1287 of file PrimitiveConversion.cc.

Referenced by convert_csc_details(), convert_other_details(), and convert_rpc_details().

1287  {
1288  int bt_station = fw_station;
1289  return bt_station;
1290 }
int PrimitiveConversion::get_fs_segment ( const EMTFHit conv_hit,
int  fw_station,
int  fw_cscid,
int  pc_segment 
) const

Definition at line 1256 of file PrimitiveConversion.cc.

References emtf_assert, dqmiodumpmetadata::n, l1t::EMTFHit::Neighbor(), and l1t::EMTFHit::Ring().

Referenced by convert_csc_details(), convert_other_details(), and convert_rpc_details().

1256  {
1257  // For later use in primitive matching
1258  // (in the firmware, this happens in the find_segment module)
1259  int fs_history = 0; // history id: not set here, to be set in primitive matching
1260  int fs_chamber = -1; // chamber id
1261  int fs_segment = pc_segment % 2; // segment id
1262 
1263  // For ME1
1264  // j = 0 is neighbor sector chamber
1265  // j = 1,2,3 are native subsector 1 chambers
1266  // j = 4,5,6 are native subsector 2 chambers
1267  // For ME2,3,4:
1268  // j = 0 is neighbor sector chamber
1269  // j = 1,2,3,4,5,6 are native sector chambers
1270  const bool is_neighbor = conv_hit.Neighbor();
1271  if (fw_station <= 1) { // ME1
1272  int n = fw_cscid % 3;
1273  fs_chamber = is_neighbor ? 0 : ((fw_station == 0) ? 1 + n : 4 + n);
1274  } else { // ME2,3,4
1275  int n = (conv_hit.Ring() == 1) ? fw_cscid : (fw_cscid - 3);
1276  fs_chamber = is_neighbor ? 0 : 1 + n;
1277  }
1278 
1279  emtf_assert(fs_history == 0 && (0 <= fs_chamber && fs_chamber < 7) && (0 <= fs_segment && fs_segment < 2));
1280  // fs_segment is a 6-bit word, HHCCCS, encoding the segment number S in the chamber (1 or 2),
1281  // the chamber number CCC ("j" above: uniquely identifies chamber within station and ring),
1282  // and the history HH (0 for current BX, 1 for previous BX, 2 for BX before that)
1283  fs_segment = ((fs_history & 0x3) << 4) | ((fs_chamber & 0x7) << 1) | (fs_segment & 0x1);
1284  return fs_segment;
1285 }
int Ring() const
Definition: EMTFHit.h:205
#define emtf_assert(expr)
Definition: DebugTools.h:18
int Neighbor() const
Definition: EMTFHit.h:215
int PrimitiveConversion::get_fs_zone_code ( const EMTFHit conv_hit) const

Definition at line 1232 of file PrimitiveConversion.cc.

References emtf_assert, l1t::EMTFHit::Ring(), l1t::EMTFHit::Station(), and useNewZones_.

Referenced by convert_csc_details(), convert_other_details(), convert_rpc_details(), and get_zone_code().

1232  {
1233  static const unsigned int zone_code_table[4][3] = {
1234  // map (station,ring) to zone_code
1235  {0b0011, 0b0100, 0b1000}, // st1 r1: [z0,z1], r2: [z2], r3: [z3]
1236  {0b0011, 0b1100, 0b1100}, // st2 r1: [z0,z1], r2: [z2,z3], r3 = r2
1237  {0b0001, 0b1110, 0b1110}, // st3 r1: [z0], r2: [z1,z2,z3], r3 = r2
1238  {0b0001, 0b0110, 0b0110} // st4 r1: [z0], r2: [z1,z2], r3 = r2
1239  };
1240 
1241  static const unsigned int zone_code_table_new[4][3] = {
1242  // map (station,ring) to zone_code
1243  {0b0011, 0b0110, 0b1000}, // st1 r1: [z0,z1], r2: [z1,z2], r3: [z3]
1244  {0b0011, 0b1110, 0b1110}, // st2 r1: [z0,z1], r2: [z1,z2,z3], r3 = r2
1245  {0b0011, 0b1110, 0b1110}, // st3 r1: [z0,z1], r2: [z1,z2,z3], r3 = r2
1246  {0b0001, 0b0110, 0b0110} // st4 r1: [z0], r2: [z1,z2], r3 = r2
1247  };
1248 
1249  unsigned int istation = (conv_hit.Station() - 1);
1250  unsigned int iring = (conv_hit.Ring() == 4) ? 0 : (conv_hit.Ring() - 1);
1251  emtf_assert(istation < 4 && iring < 3);
1252  unsigned int zone_code = useNewZones_ ? zone_code_table_new[istation][iring] : zone_code_table[istation][iring];
1253  return zone_code;
1254 }
int Ring() const
Definition: EMTFHit.h:205
int Station() const
Definition: EMTFHit.h:204
#define emtf_assert(expr)
Definition: DebugTools.h:18
int PrimitiveConversion::get_phzvl ( const EMTFHit conv_hit,
int  zone_code 
) const

Definition at line 1213 of file PrimitiveConversion.cc.

References l1t::EMTFHit::Ring(), and l1t::EMTFHit::Station().

1213  {
1214  // For backward compatibility, no longer needed (only explicitly used in FW)
1215  // phzvl: each chamber overlaps with at most 3 zones, so this "local" zone word says
1216  // which of the possible zones contain the hit: 1 for lower, 2 for middle, 4 for upper
1217  int phzvl = 0;
1218  if (conv_hit.Ring() == 1 || conv_hit.Ring() == 4) {
1219  phzvl = (zone_code >> 0);
1220  } else if (conv_hit.Ring() == 2) {
1221  if (conv_hit.Station() == 3 || conv_hit.Station() == 4) {
1222  phzvl = (zone_code >> 1);
1223  } else if (conv_hit.Station() == 1 || conv_hit.Station() == 2) {
1224  phzvl = (zone_code >> 2);
1225  }
1226  } else if (conv_hit.Ring() == 3) {
1227  phzvl = (zone_code >> 3);
1228  }
1229  return phzvl;
1230 }
int Ring() const
Definition: EMTFHit.h:205
int Station() const
Definition: EMTFHit.h:204
int PrimitiveConversion::get_zone_code ( const EMTFHit conv_hit,
int  th 
) const

Definition at line 1183 of file PrimitiveConversion.cc.

References emtf_assert, get_fs_zone_code(), L1TMuon::kCSC, emtf::NUM_ZONES, l1t::EMTFHit::Ring(), l1t::EMTFHit::Station(), l1t::EMTFHit::Subsystem(), zoneBoundaries_, and zoneOverlap_.

Referenced by convert_csc_details(), convert_other_details(), and convert_rpc_details().

1183  {
1184  // ph zone boundaries for chambers that cover more than one zone
1185  // bnd1 is the lower boundary, bnd2 the upper boundary
1186  int zone_code = 0;
1187 
1188  bool is_csc = (conv_hit.Subsystem() == L1TMuon::kCSC);
1189  bool is_me13 = (is_csc && conv_hit.Station() == 1 && conv_hit.Ring() == 3);
1190 
1191  if (th >= 127)
1192  th = 127;
1193 
1194  for (int izone = 0; izone < emtf::NUM_ZONES; ++izone) {
1195  int zone_code_tmp = get_fs_zone_code(conv_hit);
1196  if (zone_code_tmp & (1 << izone)) {
1197  bool no_use_bnd1 =
1198  ((izone == 0) || ((zone_code_tmp & (1 << (izone - 1))) == 0) || is_me13); // first possible zone for this hit
1199  bool no_use_bnd2 = (((zone_code_tmp & (1 << (izone + 1))) == 0) || is_me13); // last possible zone for this hit
1200 
1201  int ph_zone_bnd1 = no_use_bnd1 ? zoneBoundaries_.at(0) : zoneBoundaries_.at(izone);
1202  int ph_zone_bnd2 = no_use_bnd2 ? zoneBoundaries_.at(emtf::NUM_ZONES) : zoneBoundaries_.at(izone + 1);
1203 
1204  if ((th > (ph_zone_bnd1 - zoneOverlap_)) && (th <= (ph_zone_bnd2 + zoneOverlap_))) {
1205  zone_code |= (1 << izone);
1206  }
1207  }
1208  }
1209  emtf_assert(zone_code > 0);
1210  return zone_code;
1211 }
int Subsystem() const
Definition: EMTFHit.h:202
constexpr int NUM_ZONES
Definition: Common.h:54
int Ring() const
Definition: EMTFHit.h:205
std::vector< int > zoneBoundaries_
int Station() const
Definition: EMTFHit.h:204
#define emtf_assert(expr)
Definition: DebugTools.h:18
int get_fs_zone_code(const EMTFHit &conv_hit) const
bool PrimitiveConversion::is_valid_for_run2 ( const EMTFHit conv_hit) const

Definition at line 1319 of file PrimitiveConversion.cc.

References l1t::EMTFHit::Is_CSC(), l1t::EMTFHit::Is_RPC(), l1t::EMTFHit::Ring(), and l1t::EMTFHit::Station().

1319  {
1320  bool is_csc = conv_hit.Is_CSC();
1321  bool is_rpc = conv_hit.Is_RPC();
1322  bool is_irpc = conv_hit.Is_RPC() && ((conv_hit.Station() == 3 || conv_hit.Station() == 4) && (conv_hit.Ring() == 1));
1323  bool is_omtf = conv_hit.Is_RPC() && ((conv_hit.Station() == 1 || conv_hit.Station() == 2) &&
1324  (conv_hit.Ring() == 3)); // RPC in the overlap region
1325  return (is_csc || (is_rpc && !is_irpc && !is_omtf));
1326 }
bool Is_CSC() const
Definition: EMTFHit.h:286
bool Is_RPC() const
Definition: EMTFHit.h:287
int Ring() const
Definition: EMTFHit.h:205
int Station() const
Definition: EMTFHit.h:204
const SectorProcessorLUT& PrimitiveConversion::pc_lut ( ) const
inline

Definition at line 32 of file PrimitiveConversion.h.

References pc_lut_.

Referenced by configure(), convert_csc_details(), and convert_rpc_details().

32 { return *pc_lut_; }
const SectorProcessorLUT * pc_lut_
void PrimitiveConversion::process ( const std::map< int, TriggerPrimitiveCollection > &  selected_prim_map,
EMTFHitCollection conv_hits 
) const

Definition at line 55 of file PrimitiveConversion.cc.

References convert_csc(), convert_dt(), convert_gem(), convert_me0(), convert_rpc(), emtf_assert, L1TMuon::kCSC, L1TMuon::kDT, L1TMuon::kGEM, L1TMuon::kME0, L1TMuon::kRPC, and sector_.

Referenced by SectorProcessor::process_single_bx().

56  {
57  std::map<int, TriggerPrimitiveCollection>::const_iterator map_tp_it = selected_prim_map.begin();
58  std::map<int, TriggerPrimitiveCollection>::const_iterator map_tp_end = selected_prim_map.end();
59 
60  for (; map_tp_it != map_tp_end; ++map_tp_it) {
61  // Unique chamber ID in FW, {0, 53} as defined in get_index_csc in src/PrimitiveSelection.cc
62  int selected = map_tp_it->first;
63  // "Primitive Conversion" sector/station/chamber ID scheme used in FW
64  int pc_sector = sector_;
65  int pc_station = selected / 9; // {0, 5} = {ME1 sub 1, ME1 sub 2, ME2, ME3, ME4, neighbor}
66  int pc_chamber = selected % 9; // Equals CSC ID - 1 for all except neighbor chambers
67  int pc_segment = 0; // Counts hits in a single chamber
68 
69  TriggerPrimitiveCollection::const_iterator tp_it = map_tp_it->second.begin();
70  TriggerPrimitiveCollection::const_iterator tp_end = map_tp_it->second.end();
71 
72  for (; tp_it != tp_end; ++tp_it) {
73  EMTFHit conv_hit;
74  if (tp_it->subsystem() == L1TMuon::kCSC) {
75  convert_csc(pc_sector, pc_station, pc_chamber, pc_segment, *tp_it, conv_hit);
76  } else if (tp_it->subsystem() == L1TMuon::kRPC) {
77  convert_rpc(pc_sector, pc_station, pc_chamber, pc_segment, *tp_it, conv_hit);
78  } else if (tp_it->subsystem() == L1TMuon::kGEM) {
79  convert_gem(pc_sector, 0, selected, pc_segment, *tp_it, conv_hit); // pc_station and pc_chamber are meaningless
80  } else if (tp_it->subsystem() == L1TMuon::kME0) {
81  convert_me0(pc_sector, 0, selected, pc_segment, *tp_it, conv_hit); // pc_station and pc_chamber are meaningless
82  } else if (tp_it->subsystem() == L1TMuon::kDT) {
83  convert_dt(pc_sector, 0, selected, pc_segment, *tp_it, conv_hit); // pc_station and pc_chamber are meaningless
84  } else {
85  emtf_assert(false && "Incorrect subsystem type");
86  }
87  conv_hits.push_back(conv_hit);
88  pc_segment += 1;
89  }
90  }
91 }
void convert_gem(int pc_sector, int pc_station, int pc_chamber, int pc_segment, const TriggerPrimitive &muon_primitive, EMTFHit &conv_hit) const
void convert_rpc(int pc_sector, int pc_station, int pc_chamber, int pc_segment, const TriggerPrimitive &muon_primitive, EMTFHit &conv_hit) const
void convert_dt(int pc_sector, int pc_station, int pc_chamber, int pc_segment, const TriggerPrimitive &muon_primitive, EMTFHit &conv_hit) const
#define emtf_assert(expr)
Definition: DebugTools.h:18
void convert_me0(int pc_sector, int pc_station, int pc_chamber, int pc_segment, const TriggerPrimitive &muon_primitive, EMTFHit &conv_hit) const
void convert_csc(int pc_sector, int pc_station, int pc_chamber, int pc_segment, const TriggerPrimitive &muon_primitive, EMTFHit &conv_hit) const

Member Data Documentation

bool PrimitiveConversion::bugME11Dupes_
private

Definition at line 107 of file PrimitiveConversion.h.

Referenced by configure(), and convert_csc_details().

int PrimitiveConversion::bx_
private

Definition at line 100 of file PrimitiveConversion.h.

Referenced by configure().

int PrimitiveConversion::bxShiftCSC_
private

Definition at line 102 of file PrimitiveConversion.h.

Referenced by configure(), and convert_csc().

int PrimitiveConversion::bxShiftGEM_
private

Definition at line 102 of file PrimitiveConversion.h.

Referenced by configure(), and convert_gem().

int PrimitiveConversion::bxShiftME0_
private

Definition at line 102 of file PrimitiveConversion.h.

Referenced by configure(), and convert_me0().

int PrimitiveConversion::bxShiftRPC_
private

Definition at line 102 of file PrimitiveConversion.h.

Referenced by configure(), and convert_rpc().

bool PrimitiveConversion::duplicateTheta_
private

Definition at line 106 of file PrimitiveConversion.h.

Referenced by configure().

int PrimitiveConversion::endcap_
private
bool PrimitiveConversion::fixME11Edges_
private

Definition at line 106 of file PrimitiveConversion.h.

Referenced by configure(), and convert_csc_details().

bool PrimitiveConversion::fixZonePhi_
private

Definition at line 106 of file PrimitiveConversion.h.

Referenced by configure(), and convert_csc_details().

const SectorProcessorLUT* PrimitiveConversion::pc_lut_
private

Definition at line 98 of file PrimitiveConversion.h.

Referenced by configure(), and pc_lut().

int PrimitiveConversion::sector_
private
const GeometryTranslator* PrimitiveConversion::tp_geom_
private
bool PrimitiveConversion::useNewZones_
private

Definition at line 106 of file PrimitiveConversion.h.

Referenced by configure(), and get_fs_zone_code().

bool PrimitiveConversion::useRun3CCLUT_OTMB_
private

Definition at line 109 of file PrimitiveConversion.h.

Referenced by configure(), convert_csc(), and convert_csc_details().

bool PrimitiveConversion::useRun3CCLUT_TMB_
private

Definition at line 110 of file PrimitiveConversion.h.

Referenced by configure(), convert_csc(), and convert_csc_details().

int PrimitiveConversion::verbose_
private
std::vector<int> PrimitiveConversion::zoneBoundaries_
private

Definition at line 104 of file PrimitiveConversion.h.

Referenced by configure(), and get_zone_code().

int PrimitiveConversion::zoneOverlap_
private

Definition at line 105 of file PrimitiveConversion.h.

Referenced by configure(), and get_zone_code().