27 _subsector(subsector),
28 _station(station),isTMB07(TMB07)
160 double patternOffset;
167 if(theadd.pattern_type == 1 ||
isTMB07)
168 data.phi_local =
static_cast<unsigned>((0.5 + theadd.strip + patternOffset)*binPhiL);
170 data.phi_local =
static_cast<unsigned>((2 + theadd.strip + 4.*patternOffset)*binPhiL);
173 <<
"+++ Value of strip, " << theadd.strip
178 if (data.phi_local >= maxPhiL) {
180 <<
"+++ Value of phi_local, " << data.phi_local
181 <<
", exceeds max allowed, " << maxPhiL-1 <<
" +++\n";
186 <<
" maxPhiL = " << maxPhiL <<
" binPhiL = " << binPhiL;
188 <<
"strip # " << theadd.strip <<
" hs/ds = " << theadd.pattern_type
189 <<
" pattern = " << theadd.clct_pattern <<
" offset = " << patternOffset
190 <<
" phi_local = " << data.phi_local;
193 data.phi_bend_local = 0;
205 const int quality,
const int lr,
const bool gangedME1a)
const 209 theadd.strip =
strip;
210 theadd.clct_pattern = pattern & 0x7;
211 theadd.pattern_type = (pattern & 0x8) >> 3;
216 return localPhi(theadd, gangedME1a );
262 if (result < 0.) result += 2.*
M_PI;
266 LogDebug(
"CSCSectorReceiverLUT|getGlobalPhiValue") << e.
what();
278 int cscid = address.cscid;
279 unsigned wire_group = address.wire_group;
280 unsigned local_phi = address.phi_local;
294 <<
" warning: cscId " << cscid <<
" is out of bounds [" 298 <<
"+++ Value of CSC ID, " << cscid
306 <<
" warning: cscId " << cscid <<
" is out of bounds [" 310 <<
"+++ Value of CSC ID, " << cscid
315 if(wire_group >= 1<<5)
318 <<
"warning: wire_group" << wire_group
319 <<
" is out of bounds (1-" << ((1<<5)-1) <<
"]\n";
321 <<
"+++ Value of wire_group, " << wire_group
322 <<
", is out of bounds (1-" << ((1<<5)-1) <<
"] +++\n";
325 if(local_phi >= maxPhiL)
328 <<
"warning: local_phi" << local_phi
329 <<
" is out of bounds [0-" << maxPhiL <<
")\n";
331 <<
"+++ Value of local_phi, " << local_phi
332 <<
", is out of bounds [0-, " << maxPhiL <<
") +++\n";
362 int strip = 0, halfstrip = 0;
364 halfstrip =
static_cast<int>(local_phi/binPhiL);
375 const double hsWidth_f = fabs(
getGlobalPhiValue(thelayer, 2, wire_group) - phi_f)/2.;
376 const double hsWidth_l = fabs(phi_l -
getGlobalPhiValue(thelayer, nStrips - 1, wire_group))/2.;
391 double leftEdge, rightEdge;
392 if (fabs(phi_f - phi_l) <
M_PI)
394 if (phi_f < phi_l) clockwiseOrder =
true;
395 else clockwiseOrder =
false;
399 if (phi_f < phi_l) clockwiseOrder =
false;
400 else clockwiseOrder =
true;
404 leftEdge = phi_f - hsWidth_f;
405 rightEdge = phi_l + hsWidth_l;
409 leftEdge = phi_l - hsWidth_l;
410 rightEdge = phi_f + hsWidth_f;
412 if (fabs(phi_f - phi_l) >=
M_PI) {rightEdge += 2.*
M_PI;}
419 double temp_phi = 0.0, strip_phi = 0.0,
delta_phi = 0.0;
420 double distFromHalfStripCenter = 0.0, halfstripWidth = 0.0;
426 distFromHalfStripCenter = (local_phi+0.5)/binPhiL - halfstrip - 0.5;
431 if ((halfstrip%2 == 0 && halfstrip != 0) || halfstrip == 2*nStrips-1) {
441 if (halfstripWidth >
M_PI/2.) halfstripWidth =
M_PI - halfstripWidth;
445 delta_phi = halfstripWidth*(((halfstrip%2)-0.5)+distFromHalfStripCenter);
457 if (clockwiseOrder) temp_phi = rightEdge;
458 else temp_phi = leftEdge;
464 temp_phi -= sectorOffset;
466 if (temp_phi < 0.) temp_phi += 2.*
M_PI;
472 result.global_phi = 0;
474 else if (temp_phi >= maxPhiG)
476 result.global_phi = maxPhiG - 1;
480 result.global_phi =
static_cast<unsigned short>(temp_phi);
484 <<
"local_phi = " << local_phi
485 <<
" halfstrip = " << halfstrip <<
" strip = " << strip
486 <<
" distFromHalfStripCenter = " << distFromHalfStripCenter
487 <<
" halfstripWidth = " << halfstripWidth
488 <<
" strip phi = " << strip_phi/(
M_PI/180.)
490 <<
" global_phi = " << result.global_phi
507 theadd.phi_local = phi_local;
508 theadd.wire_group = ((1<<5)-1)&(wire_group >> 2);
509 theadd.cscid = cscid;
546 int GlobalPhiMin = (
_subsector == 1) ? 0x42 : 0x800;
547 int GlobalPhiMax = (
_subsector == 1) ? 0x7ff : 0xfbd;
548 double GlobalPhiShift = (1.0*GlobalPhiMin + (GlobalPhiMax - GlobalPhiMin)/2.0);
550 double dt_out =
static_cast<double>(csclut.global_phi) - GlobalPhiShift;
553 dt_out = (dt_out/1982)*2145;
557 dtlut.global_phi = 0x7ff&
static_cast<unsigned>(dt_out);
561 dtlut.global_phi =
static_cast<unsigned>(-dt_out);
562 dtlut.global_phi = ~dtlut.global_phi;
563 dtlut.global_phi |= 0x800;
574 address.cscid = cscid;
575 address.wire_group = ((1<<5)-1)&(wire_group>>2);
576 address.phi_local = phi_local;
615 unsigned wire_group = thewire_group;
616 int cscid = thecscid;
617 unsigned phi_local = thephi_local;
621 bool me1ir_only =
false;
626 <<
" warning: cscId " << cscid
633 const unsigned numBins = 1 << 2;
635 if(phi_local > numBins - 1) {
637 <<
"warning: phiL " << phi_local
638 <<
" is out of bounds [0-" << numBins - 1 <<
"]\n";
639 phi_local = numBins - 1;
653 if (wire_group >= nWireGroups) {
655 <<
"warning: wireGroup " << wire_group
656 <<
" is out of bounds [0-" << nWireGroups <<
")\n";
657 wire_group = nWireGroups - 1;
679 <<
"getGlobalEtaValue warning: number of strips " 681 <<
") is not divisible by numBins " << numBins
683 <<
" subsector " <<
_subsector <<
" cscid " << cscid <<
"\n";
685 unsigned maxStripPrevBin = 0, maxStripThisBin = 0;
686 unsigned correctionStrip;
690 maxStripThisBin = nStripsPerBin * (phi_local+1);
691 if (maxStripThisBin <= nStrips) {
692 correctionStrip = nStripsPerBin/2 * (2*phi_local+1);
699 maxStripPrevBin = nStripsPerBin * phi_local;
700 correctionStrip = (nStrips+maxStripPrevBin)/2;
707 result = gPoint.
eta();
713 LogDebug(
"CSCSectorReceiver|OutofBoundInput") << e.
what();
716 return std::fabs(result);
725 double float_eta =
getGlobalEtaValue(address.cscid, address.wire_group, address.phi_local);
726 unsigned int_eta = 0;
727 unsigned bend_global = 0;
729 const unsigned me12EtaCut = 56;
738 <<
"CSCSectorReceiverLUT warning: float_eta = " << float_eta
741 <<
" chamber " << address.cscid <<
" wire group " << address.wire_group;
744 <<
"+++ Value of CSC ID, " << float_eta
756 float_eta = float_eta/etaPerBin;
757 int_eta =
static_cast<unsigned>(float_eta);
771 if (ring == 1 && int_eta < me12EtaCut) {int_eta = me12EtaCut;}
772 else if (ring == 2 && int_eta >= me12EtaCut) {int_eta = me12EtaCut-1;}
774 result.global_eta = int_eta;
776 result.global_bend = bend_global;
786 theadd.phi_bend = tphi_bend;
788 theadd.wire_group = twire_group;
789 theadd.cscid = tcscid;
825 else if (
_station == 2) fileName +=
"2";
826 else if (
_station == 3) fileName +=
"3";
827 else if (
_station == 4) fileName +=
"4";
829 if (
_endcap == 1) fileName +=
"1";
830 else fileName +=
"2";
832 if (
_sector == 1) fileName +=
"1";
833 else if (
_sector == 2) fileName +=
"2";
834 else if (
_sector == 3) fileName +=
"3";
835 else if (
_sector == 4) fileName +=
"4";
836 else if (
_sector == 5) fileName +=
"5";
837 else if (
_sector == 6) fileName +=
"6";
849 std::ifstream LocalPhiLUT;
851 edm::LogInfo(
"CSCSectorReceiverLUT") <<
"Loading SR LUT: " << fName;
855 LocalPhiLUT.open(fName.c_str(),std::ios::binary);
857 int length = LocalPhiLUT.tellg();
860 LocalPhiLUT.seekg(0,std::ios::beg);
861 LocalPhiLUT.read(reinterpret_cast<char*>(
me_lcl_phi),length);
865 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
870 LocalPhiLUT.open(fName.c_str());
872 unsigned short temp = 0;
886 std::ifstream GlobalPhiLUT;
888 edm::LogInfo(
"CSCSectorReceiverLUT") <<
"Loading SR LUT: " << fName;
892 GlobalPhiLUT.open(fName.c_str(),std::ios::binary);
894 int length = GlobalPhiLUT.tellg();
897 GlobalPhiLUT.seekg(0,std::ios::beg);
898 GlobalPhiLUT.read(reinterpret_cast<char*>(
me_global_phi),length);
901 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
902 GlobalPhiLUT.close();
906 GlobalPhiLUT.open( fName.c_str());
907 unsigned short temp = 0;
911 GlobalPhiLUT >>
temp;
914 GlobalPhiLUT.close();
922 std::ifstream GlobalPhiLUT;
924 edm::LogInfo(
"CSCSectorReceiverLUT") <<
"Loading SR LUT: " << fName;
928 GlobalPhiLUT.open( fName.c_str(),std::ios::binary);
930 int length = GlobalPhiLUT.tellg();
933 GlobalPhiLUT.seekg(0,std::ios::beg);
934 GlobalPhiLUT.read(reinterpret_cast<char*>(
mb_global_phi),length);
937 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
938 GlobalPhiLUT.close();
942 GlobalPhiLUT.open(fName.c_str());
943 unsigned short temp = 0;
947 GlobalPhiLUT >>
temp;
950 GlobalPhiLUT.close();
958 std::ifstream GlobalEtaLUT;
960 edm::LogInfo(
"CSCSectorReceiverLUT") <<
"Loading SR LUT: " << fName;
964 GlobalEtaLUT.open(fName.c_str(),std::ios::binary);
966 int length = GlobalEtaLUT.tellg();
969 GlobalEtaLUT.seekg(0,std::ios::beg);
970 GlobalEtaLUT.read(reinterpret_cast<char*>(
me_global_eta),length);
973 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
974 GlobalEtaLUT.close();
978 GlobalEtaLUT.open(fName.c_str());
979 unsigned short temp = 0;
983 GlobalEtaLUT >>
temp;
986 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