27 _subsector(subsector),
28 _station(station),isTMB07(TMB07)
158 double patternOffset;
165 if(theadd.pattern_type == 1 ||
isTMB07)
166 data.phi_local =
static_cast<unsigned>((0.5 + theadd.strip + patternOffset)*binPhiL);
168 data.phi_local =
static_cast<unsigned>((2 + theadd.strip + 4.*patternOffset)*binPhiL);
171 <<
"+++ Value of strip, " << theadd.strip
176 if (data.phi_local >= maxPhiL) {
178 <<
"+++ Value of phi_local, " << data.phi_local
179 <<
", exceeds max allowed, " << maxPhiL-1 <<
" +++\n";
184 <<
" maxPhiL = " << maxPhiL <<
" binPhiL = " << binPhiL;
186 <<
"strip # " << theadd.strip <<
" hs/ds = " << theadd.pattern_type
187 <<
" pattern = " << theadd.clct_pattern <<
" offset = " << patternOffset
188 <<
" phi_local = " << data.phi_local;
191 data.phi_bend_local = 0;
203 const int quality,
const int lr,
const bool gangedME1a)
const 207 theadd.strip =
strip;
208 theadd.clct_pattern = pattern & 0x7;
209 theadd.pattern_type = (pattern & 0x8) >> 3;
214 return localPhi(theadd, gangedME1a );
260 if (result < 0.) result += 2.*
M_PI;
264 LogDebug(
"CSCSectorReceiverLUT|getGlobalPhiValue") << e.
what();
276 int cscid = address.cscid;
277 unsigned wire_group = address.wire_group;
278 unsigned local_phi = address.phi_local;
292 <<
" warning: cscId " << cscid <<
" is out of bounds [" 296 <<
"+++ Value of CSC ID, " << cscid
304 <<
" warning: cscId " << cscid <<
" is out of bounds [" 308 <<
"+++ Value of CSC ID, " << cscid
313 if(wire_group >= 1<<5)
316 <<
"warning: wire_group" << wire_group
317 <<
" is out of bounds (1-" << ((1<<5)-1) <<
"]\n";
319 <<
"+++ Value of wire_group, " << wire_group
320 <<
", is out of bounds (1-" << ((1<<5)-1) <<
"] +++\n";
323 if(local_phi >= maxPhiL)
326 <<
"warning: local_phi" << local_phi
327 <<
" is out of bounds [0-" << maxPhiL <<
")\n";
329 <<
"+++ Value of local_phi, " << local_phi
330 <<
", is out of bounds [0-, " << maxPhiL <<
") +++\n";
360 int strip = 0, halfstrip = 0;
362 halfstrip =
static_cast<int>(local_phi/binPhiL);
373 const double hsWidth_f = fabs(
getGlobalPhiValue(thelayer, 2, wire_group) - phi_f)/2.;
374 const double hsWidth_l = fabs(phi_l -
getGlobalPhiValue(thelayer, nStrips - 1, wire_group))/2.;
389 double leftEdge, rightEdge;
390 if (fabs(phi_f - phi_l) <
M_PI)
392 if (phi_f < phi_l) clockwiseOrder =
true;
393 else clockwiseOrder =
false;
397 if (phi_f < phi_l) clockwiseOrder =
false;
398 else clockwiseOrder =
true;
402 leftEdge = phi_f - hsWidth_f;
403 rightEdge = phi_l + hsWidth_l;
407 leftEdge = phi_l - hsWidth_l;
408 rightEdge = phi_f + hsWidth_f;
410 if (fabs(phi_f - phi_l) >=
M_PI) {rightEdge += 2.*
M_PI;}
417 double temp_phi = 0.0, strip_phi = 0.0,
delta_phi = 0.0;
418 double distFromHalfStripCenter = 0.0, halfstripWidth = 0.0;
424 distFromHalfStripCenter = (local_phi+0.5)/binPhiL - halfstrip - 0.5;
429 if ((halfstrip%2 == 0 && halfstrip != 0) || halfstrip == 2*nStrips-1) {
439 if (halfstripWidth >
M_PI/2.) halfstripWidth =
M_PI - halfstripWidth;
443 delta_phi = halfstripWidth*(((halfstrip%2)-0.5)+distFromHalfStripCenter);
455 if (clockwiseOrder) temp_phi = rightEdge;
456 else temp_phi = leftEdge;
462 temp_phi -= sectorOffset;
464 if (temp_phi < 0.) temp_phi += 2.*
M_PI;
470 result.global_phi = 0;
472 else if (temp_phi >= maxPhiG)
474 result.global_phi = maxPhiG - 1;
478 result.global_phi =
static_cast<unsigned short>(temp_phi);
482 <<
"local_phi = " << local_phi
483 <<
" halfstrip = " << halfstrip <<
" strip = " << strip
484 <<
" distFromHalfStripCenter = " << distFromHalfStripCenter
485 <<
" halfstripWidth = " << halfstripWidth
486 <<
" strip phi = " << strip_phi/(
M_PI/180.)
488 <<
" global_phi = " << result.global_phi
505 theadd.phi_local = phi_local;
506 theadd.wire_group = ((1<<5)-1)&(wire_group >> 2);
507 theadd.cscid = cscid;
544 int GlobalPhiMin = (
_subsector == 1) ? 0x42 : 0x800;
545 int GlobalPhiMax = (
_subsector == 1) ? 0x7ff : 0xfbd;
546 double GlobalPhiShift = (1.0*GlobalPhiMin + (GlobalPhiMax - GlobalPhiMin)/2.0);
548 double dt_out =
static_cast<double>(csclut.global_phi) - GlobalPhiShift;
551 dt_out = (dt_out/1982)*2145;
555 dtlut.global_phi = 0x7ff&
static_cast<unsigned>(dt_out);
559 dtlut.global_phi =
static_cast<unsigned>(-dt_out);
560 dtlut.global_phi = ~dtlut.global_phi;
561 dtlut.global_phi |= 0x800;
572 address.cscid = cscid;
573 address.wire_group = ((1<<5)-1)&(wire_group>>2);
574 address.phi_local = phi_local;
613 unsigned wire_group = thewire_group;
614 int cscid = thecscid;
615 unsigned phi_local = thephi_local;
619 bool me1ir_only =
false;
624 <<
" warning: cscId " << cscid
631 const unsigned numBins = 1 << 2;
633 if(phi_local > numBins - 1) {
635 <<
"warning: phiL " << phi_local
636 <<
" is out of bounds [0-" << numBins - 1 <<
"]\n";
637 phi_local = numBins - 1;
651 if (wire_group >= nWireGroups) {
653 <<
"warning: wireGroup " << wire_group
654 <<
" is out of bounds [0-" << nWireGroups <<
")\n";
655 wire_group = nWireGroups - 1;
677 <<
"getGlobalEtaValue warning: number of strips " 679 <<
") is not divisible by numBins " << numBins
681 <<
" subsector " <<
_subsector <<
" cscid " << cscid <<
"\n";
683 unsigned maxStripPrevBin = 0, maxStripThisBin = 0;
684 unsigned correctionStrip;
688 maxStripThisBin = nStripsPerBin * (phi_local+1);
689 if (maxStripThisBin <= nStrips) {
690 correctionStrip = nStripsPerBin/2 * (2*phi_local+1);
697 maxStripPrevBin = nStripsPerBin * phi_local;
698 correctionStrip = (nStrips+maxStripPrevBin)/2;
705 result = gPoint.
eta();
711 LogDebug(
"CSCSectorReceiver|OutofBoundInput") << e.
what();
714 return std::fabs(result);
723 double float_eta =
getGlobalEtaValue(address.cscid, address.wire_group, address.phi_local);
724 unsigned int_eta = 0;
725 unsigned bend_global = 0;
727 const unsigned me12EtaCut = 56;
736 <<
"CSCSectorReceiverLUT warning: float_eta = " << float_eta
739 <<
" chamber " << address.cscid <<
" wire group " << address.wire_group;
742 <<
"+++ Value of CSC ID, " << float_eta
754 float_eta = float_eta/etaPerBin;
755 int_eta =
static_cast<unsigned>(float_eta);
769 if (ring == 1 && int_eta < me12EtaCut) {int_eta = me12EtaCut;}
770 else if (ring == 2 && int_eta >= me12EtaCut) {int_eta = me12EtaCut-1;}
772 result.global_eta = int_eta;
774 result.global_bend = bend_global;
784 theadd.phi_bend = tphi_bend;
786 theadd.wire_group = twire_group;
787 theadd.cscid = tcscid;
823 else if (
_station == 2) fileName +=
"2";
824 else if (
_station == 3) fileName +=
"3";
825 else if (
_station == 4) fileName +=
"4";
827 if (
_endcap == 1) fileName +=
"1";
828 else fileName +=
"2";
830 if (
_sector == 1) fileName +=
"1";
831 else if (
_sector == 2) fileName +=
"2";
832 else if (
_sector == 3) fileName +=
"3";
833 else if (
_sector == 4) fileName +=
"4";
834 else if (
_sector == 5) fileName +=
"5";
835 else if (
_sector == 6) fileName +=
"6";
846 std::ifstream LocalPhiLUT;
848 edm::LogInfo(
"CSCSectorReceiverLUT") <<
"Loading SR LUT: " << fName;
852 LocalPhiLUT.open(fName.c_str(),std::ios::binary);
854 int length = LocalPhiLUT.tellg();
857 LocalPhiLUT.seekg(0,std::ios::beg);
858 LocalPhiLUT.read(reinterpret_cast<char*>(
me_lcl_phi),length);
862 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
867 LocalPhiLUT.open(fName.c_str());
869 unsigned short temp = 0;
882 std::ifstream GlobalPhiLUT;
884 edm::LogInfo(
"CSCSectorReceiverLUT") <<
"Loading SR LUT: " << fName;
888 GlobalPhiLUT.open(fName.c_str(),std::ios::binary);
890 int length = GlobalPhiLUT.tellg();
893 GlobalPhiLUT.seekg(0,std::ios::beg);
894 GlobalPhiLUT.read(reinterpret_cast<char*>(
me_global_phi),length);
897 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
898 GlobalPhiLUT.close();
902 GlobalPhiLUT.open( fName.c_str());
903 unsigned short temp = 0;
907 GlobalPhiLUT >>
temp;
910 GlobalPhiLUT.close();
917 std::ifstream GlobalPhiLUT;
919 edm::LogInfo(
"CSCSectorReceiverLUT") <<
"Loading SR LUT: " << fName;
923 GlobalPhiLUT.open( fName.c_str(),std::ios::binary);
925 int length = GlobalPhiLUT.tellg();
928 GlobalPhiLUT.seekg(0,std::ios::beg);
929 GlobalPhiLUT.read(reinterpret_cast<char*>(
mb_global_phi),length);
932 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
933 GlobalPhiLUT.close();
937 GlobalPhiLUT.open(fName.c_str());
938 unsigned short temp = 0;
942 GlobalPhiLUT >>
temp;
945 GlobalPhiLUT.close();
952 std::ifstream GlobalEtaLUT;
954 edm::LogInfo(
"CSCSectorReceiverLUT") <<
"Loading SR LUT: " << fName;
958 GlobalEtaLUT.open(fName.c_str(),std::ios::binary);
960 int length = GlobalEtaLUT.tellg();
963 GlobalEtaLUT.seekg(0,std::ios::beg);
964 GlobalEtaLUT.read(reinterpret_cast<char*>(
me_global_eta),length);
967 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
968 GlobalEtaLUT.close();
972 GlobalEtaLUT.open(fName.c_str());
973 unsigned short temp = 0;
977 GlobalEtaLUT >>
temp;
980 GlobalEtaLUT.close();
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
LocalPoint stripWireGroupIntersection(int strip, int wireGroup) const
T getUntrackedParameter(std::string const &, T const &) const
lclphidat localPhi(int strip, int pattern, int quality, int lr, const bool gangedME1a=false) const
Geometry Lookup Tables.
static global_phi_data calcGlobalPhiMEMini(unsigned short endcap, unsigned short sector, unsigned short station, unsigned short subsector, unsigned theadd, const bool gangedME1a)
gblphidat * me_global_phi
static int maxTriggerCscId()
static double getPosition(int pattern)
Geom::Phi< T > phi() const
static const double minEta
int numberOfStrips() const
char const * what() const override
gbletadat calcGlobalEtaME(const gbletaadd &address) const
Global Eta LUT.
std::string encodeFileIndex() const
Helpers.
class global_phi_address gblphiadd
edm::FileInPath mb_gbl_phi_file
const Plane & surface() const
The nominal surface of the GeomDet.
CSCSectorReceiverLUT & operator=(const CSCSectorReceiverLUT &)
int numberOfWireGroups() const
static int ringFromTriggerLabels(int station, int triggerCSCID)
double getGlobalPhiValue(const CSCLayer *thelayer, const unsigned &strip, const unsigned &wire_group) const
static const double SECTOR1_CENT_RAD
gblphidat globalPhiME(int phi_local, int wire_group, int cscid, const bool gangedME1a=false) const
double getGlobalEtaValue(const unsigned &cscid, const unsigned &wire_group, const unsigned &phi_local) const
gblphidat * mb_global_phi
edm::FileInPath me_gbl_phi_file
edm::FileInPath me_lcl_phi_file
CSCSectorReceiverLUT(int endcap, int sector, int subsector, int station, const edm::ParameterSet &pset, bool TMB07)
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
gbletadat * me_global_eta
static const double maxEta
static lclphidat calcLocalPhiMini(unsigned theadd, const bool gangedME1a)
GlobalPoint centerOfWireGroup(int wireGroup) const
gblphidat globalPhiMB(int phi_local, int wire_group, int cscid, const bool gangedME1a=false) const
GlobalPoint centerOfStrip(int strip) const
static double get2007Position(int pattern)
edm::FileInPath me_gbl_eta_file
static const double SECTOR_DEG
static lclphidat * me_lcl_phi
class global_phi_data gblphidat
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
class local_phi_address lclphiadd
class local_phi_data lclphidat
Data Types.
static bool me_lcl_phi_loaded
char data[epos_bytes_allocation]
gbletadat globalEtaME(int phi_bend, int phi_local, int wire_group, int cscid, const bool gangedME1a=false) const
gblphidat calcGlobalPhiME(const gblphiadd &address) const
Global Phi LUT.
class global_eta_address gbletaadd
static const double SECTOR_RAD
std::string fullPath() const
lclphidat calcLocalPhi(const lclphiadd &address) const
Local Phi LUT.
static int minTriggerCscId()
class global_eta_data gbletadat
const CSCGeometry * csc_g
static global_eta_data calcGlobalEtaMEMini(unsigned short endcap, unsigned short sector, unsigned short station, unsigned short subsector, unsigned theadd, const bool gangedME1a)
const CSCLayerGeometry * geometry() const
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
gblphidat calcGlobalPhiMB(const gblphidat &me_gphi_data) const