25 return (
T(0) < val) - (val <
T(0));
28 std::vector<float> bounds = {1.24, 1.14353, 1.09844, 1.05168, 1.00313, 0.952728, 0.90037, 0.8};
41 int etaVal2Bit(
float eta) {
return bounds.rend() - std::lower_bound(bounds.rbegin(), bounds.rend(), fabs(eta)); }
43 int etaBit2Code(
unsigned int bit) {
90 int etaVal2Code(
double etaVal) {
92 int bit = etaVal2Bit(fabs(etaVal));
93 int code = etaBit2Code(bit);
97 int etaKeyWG2Code(
const CSCDetId &detId, uint16_t keyWG) {
98 signed int etaCode = 121;
102 else if (keyWG <= 57)
103 etaCode = etaBit2Code(0);
104 else if (keyWG <= 63)
105 etaCode = etaBit2Code(1);
106 }
else if (detId.
station() == 1 && detId.
ring() == 3) {
108 etaCode = etaBit2Code(2);
110 etaCode = etaBit2Code(3);
111 else if (keyWG <= 15)
112 etaCode = etaBit2Code(4);
113 else if (keyWG <= 23)
114 etaCode = etaBit2Code(5);
115 else if (keyWG <= 31)
116 etaCode = etaBit2Code(6);
120 else if (keyWG <= 29)
121 etaCode = etaBit2Code(0);
122 else if (keyWG <= 43)
123 etaCode = etaBit2Code(1);
124 else if (keyWG <= 49)
125 etaCode = etaBit2Code(2);
126 else if (keyWG <= 56)
127 etaCode = etaBit2Code(3);
128 else if (keyWG <= 63)
129 etaCode = etaBit2Code(4);
137 int fixCscOffsetGeom(
int offsetLoc) {
141 const std::vector<int> offCSC = {-154, -133, -17, -4, 4, 17, 133, 146, 154, 167, 283, 296, 304, 317,
142 433, 446, 454, 467, 583, 596, 604, 617, 733, 746, 754, 767, 883, 904};
143 auto gep = std::lower_bound(offCSC.begin(), offCSC.end(), offsetLoc);
144 int fixOff = (gep != offCSC.end()) ? *gep : *(gep - 1);
145 if (gep != offCSC.begin() &&
std::abs(*(gep - 1) - offsetLoc) <
std::abs(fixOff - offsetLoc))
175 int processor = iProcessor + 1;
182 int phiDT = digi.
phi();
184 if (posneg * 2 != wheel)
190 if (processor != 6 && !(sector >= processor * 2 - 1 && sector <= processor * 2 + 1))
192 if (processor == 6 && !(sector >= 11 || sector == 1))
196 int ichamber = sector - 1 - 2 * (processor - 1);
200 int offsetLoc = lround(((ichamber - 1) *
M_PI / 6 +
M_PI / 12.) / hsPhiPitch);
201 double scale = 1. / 4096 / hsPhiPitch;
202 int scale_coeff = lround(scale *
pow(2, 11));
204 int phi = floor(phiDT * scale_coeff /
pow(2, 11)) + offsetLoc;
216 int processor = iProcessor + 1;
225 if (processor != 6) {
226 if (csc.
chamber() < (processor - 1) * 6 + 2)
228 if (csc.
chamber() > (processor - 1) * 6 + 8)
250 double scale = fabs(stripPhiPitch / hsPhiPitch / 2.);
251 if (fabs(scale - 1.) < 0.0002)
253 double phi15deg =
M_PI / 3. * (processor - 1) +
M_PI / 12.;
254 double phiHalfStrip0 = layer->
centerOfStrip(10).
phi() - order * 9 * stripPhiPitch - order * stripPhiPitch / 4.;
255 if (processor == 6 || phiHalfStrip0 < 0)
256 phiHalfStrip0 += 2 *
M_PI;
257 int offsetLoc = lround((phiHalfStrip0 - phi15deg) / hsPhiPitch);
264 int fixOff = fixCscOffsetGeom(offsetLoc);
266 int phi = fixOff + order * scale * halfStrip;
279 const unsigned int &digi1,
280 const unsigned int &digi2)
const {
283 int processor = iProcessor + 1;
289 M_PI / 3. * (processor - 1) +
M_PI / 12.;
300 phi15deg -= 2 *
M_PI;
305 stripPhi1 += 2 *
M_PI;
307 stripPhi2 += 2 *
M_PI;
313 int halfStrip = lround(((stripPhi1 + stripPhi2) / 2. - phi15deg) / hsPhiPitch);
321 const unsigned int &digi)
const {
324 int processor = iProcessor + 1;
330 M_PI / 3. * (processor - 1) +
M_PI / 12.;
338 phi15deg -= 2 *
M_PI;
343 stripPhi += 2 *
M_PI;
349 int halfStrip = lround((stripPhi - phi15deg) / hsPhiPitch);
361 std::unique_ptr<DTChamber> chamb(const_cast<DTChamber *>(
_geodt->
chamber(baseid)));
363 std::unique_ptr<DTTrigGeom> trig_geom(
new DTTrigGeom(chamb.get(),
false));
371 const int NBTI_theta = ((baseid.station() != 4) ? trig_geom->nCell(2) : trig_geom->nCell(3));
391 for (
unsigned int i = 0;
i < 7; ++
i)
392 if (theta_segm->
position(
i) && bti_group < 0)
394 else if (theta_segm->
position(
i) && bti_group > -1)
399 if (bti_group == 511)
401 else if (bti_group == -1 && aDigi.
stNum() == 1)
403 else if (bti_group == -1 && aDigi.
stNum() == 2)
405 else if (bti_group == -1 && aDigi.
stNum() == 3)
407 else if (baseid.station() != 4 && bti_group >= 0) {
409 unsigned bti_actual = bti_group * NBTI_theta / 7 + NBTI_theta / 14 + 1;
411 GlobalPoint theta_gp = trig_geom->CMSPosition(thetaBTI);
412 iEta = etaVal2Code(fabs(theta_gp.
eta()));
437 const uint16_t halfstrip = aDigi.
getStrip();
439 const uint16_t keyWG = aDigi.
getKeyWG();
449 const unsigned halfstrip_offs = unsigned(0.5 + halfstrip + offset);
450 const unsigned strip = halfstrip_offs / 2 + 1;
454 const LocalPoint coarse_lp = layer_geom->stripWireGroupIntersection(strip, keyWG);
455 const GlobalPoint coarse_gp = layer->surface().toGlobal(coarse_lp);
459 const double hs_offset = layer_geom->stripPhiPitch() / 4.0;
464 const double phi_offset = ((halfstrip_offs % 2 ? 1 : -1) * (ccw ? -hs_offset : hs_offset));
472 layer_geom.release();
480 return etaKeyWG2Code(
id, keyWG);
490 std::unique_ptr<const RPCRoll> roll(
_georpc->
roll(
id));
491 const LocalPoint lp = roll->centreOfStrip((
int)strip);
495 return etaVal2Code(gp.
eta());
502 const int nStrips = layer->geometry()->numberOfStrips();
503 const double phi1 = layer->centerOfStrip(1).phi();
504 const double phiN = layer->centerOfStrip(nStrips).phi();
517 for (
unsigned int i = 0;
i < 7; ++
i) {
518 if (theta_segm->
position(
i) && bti_group < 0)
523 else if (theta_segm->
position(
i) && bti_group > -1)
unsigned long long cacheIdentifier() const
LocalPoint centreOfStrip(int strip) const
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
T1 value() const
Explicit access to value in case implicit conversion not OK.
int getGlobalEta(unsigned int rawid, const L1MuDTChambPhDigi &aDigi, const L1MuDTChambThContainer *dtThDigis)
Convert local eta coordinate to global digital microGMT scale.
unsigned long long _geom_cache_id
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
int position(const int i) const
Geom::Theta< T > theta() const
int getProcessorPhi(unsigned int iProcessor, l1t::tftype part, const L1MuDTChambPhDigi &digi) const
float stripPhiPitch() const
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
const CSCChamberSpecs * specs() const
Abs< T >::type abs(const T &t)
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
const int findBTIgroup(const L1MuDTChambPhDigi &aDigi, const L1MuDTChambThContainer *dtThDigis)
Find BTI group.
bool isCSCCounterClockwise(const std::unique_ptr< const CSCLayer > &layer) const
Check orientation of strips in given CSC chamber.
unsigned int nPhiBins
Number of phi bins along 2Pi.
short int zendcap() const
GlobalPoint centerOfStrip(int strip) const
static double get2007Position(int pattern)
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
L1MuDTChambThDigi const * chThetaSegm(int wheel, int stat, int sect, int bx) const
edm::ESHandle< CSCGeometry > _geocsc
void checkAndUpdateGeometry(const edm::EventSetup &, unsigned int)
Update the Geometry with current Event Setup.
edm::ESHandle< RPCGeometry > _georpc
Power< A, B >::type pow(const A &a, const B &b)
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
edm::ESHandle< DTGeometry > _geodt