28 _subsector(subsector),
29 _station(station),isTMB07(TMB07)
161 double patternOffset;
168 if(theadd.pattern_type == 1 ||
isTMB07)
169 data.phi_local =
static_cast<unsigned>((0.5 + theadd.strip + patternOffset)*binPhiL);
171 data.phi_local =
static_cast<unsigned>((2 + theadd.strip + 4.*patternOffset)*binPhiL);
174 <<
"+++ Value of strip, " << theadd.strip
179 if (data.phi_local >= maxPhiL) {
181 <<
"+++ Value of phi_local, " << data.phi_local
182 <<
", exceeds max allowed, " << maxPhiL-1 <<
" +++\n";
187 <<
" maxPhiL = " << maxPhiL <<
" binPhiL = " << binPhiL;
189 <<
"strip # " << theadd.strip <<
" hs/ds = " << theadd.pattern_type
190 <<
" pattern = " << theadd.clct_pattern <<
" offset = " << patternOffset
191 <<
" phi_local = " << data.phi_local;
194 data.phi_bend_local = 0;
206 const int quality,
const int lr,
const bool gangedME1a)
const 210 theadd.strip =
strip;
211 theadd.clct_pattern = pattern & 0x7;
212 theadd.pattern_type = (pattern & 0x8) >> 3;
217 return localPhi(theadd, gangedME1a );
263 if (result < 0.) result += 2.*
M_PI;
267 LogDebug(
"CSCSectorReceiverLUT|getGlobalPhiValue") << e.
what();
280 int cscid = address.cscid;
281 unsigned wire_group = address.wire_group;
282 unsigned local_phi = address.phi_local;
296 <<
" warning: cscId " << cscid <<
" is out of bounds [" 300 <<
"+++ Value of CSC ID, " << cscid
308 <<
" warning: cscId " << cscid <<
" is out of bounds [" 312 <<
"+++ Value of CSC ID, " << cscid
317 if(wire_group >= 1<<5)
320 <<
"warning: wire_group" << wire_group
321 <<
" is out of bounds (1-" << ((1<<5)-1) <<
"]\n";
323 <<
"+++ Value of wire_group, " << wire_group
324 <<
", is out of bounds (1-" << ((1<<5)-1) <<
"] +++\n";
327 if(local_phi >= maxPhiL)
330 <<
"warning: local_phi" << local_phi
331 <<
" is out of bounds [0-" << maxPhiL <<
")\n";
333 <<
"+++ Value of local_phi, " << local_phi
334 <<
", is out of bounds [0-, " << maxPhiL <<
") +++\n";
361 int strip = 0, halfstrip = 0;
363 halfstrip =
static_cast<int>(local_phi/binPhiL);
374 const double hsWidth_f = fabs(
getGlobalPhiValue(thelayer, 2, wire_group) - phi_f)/2.;
375 const double hsWidth_l = fabs(phi_l -
getGlobalPhiValue(thelayer, nStrips - 1, wire_group))/2.;
390 double leftEdge, rightEdge;
391 if (fabs(phi_f - phi_l) <
M_PI)
393 if (phi_f < phi_l) clockwiseOrder =
true;
394 else clockwiseOrder =
false;
398 if (phi_f < phi_l) clockwiseOrder =
false;
399 else clockwiseOrder =
true;
403 leftEdge = phi_f - hsWidth_f;
404 rightEdge = phi_l + hsWidth_l;
408 leftEdge = phi_l - hsWidth_l;
409 rightEdge = phi_f + hsWidth_f;
411 if (fabs(phi_f - phi_l) >=
M_PI) {rightEdge += 2.*
M_PI;}
418 double temp_phi = 0.0, strip_phi = 0.0,
delta_phi = 0.0;
419 double distFromHalfStripCenter = 0.0, halfstripWidth = 0.0;
425 distFromHalfStripCenter = (local_phi+0.5)/binPhiL - halfstrip - 0.5;
430 if ((halfstrip%2 == 0 && halfstrip != 0) || halfstrip == 2*nStrips-1) {
440 if (halfstripWidth >
M_PI/2.) halfstripWidth =
M_PI - halfstripWidth;
444 delta_phi = halfstripWidth*(((halfstrip%2)-0.5)+distFromHalfStripCenter);
456 if (clockwiseOrder) temp_phi = rightEdge;
457 else temp_phi = leftEdge;
463 temp_phi -= sectorOffset;
465 if (temp_phi < 0.) temp_phi += 2.*
M_PI;
471 result.global_phi = 0;
473 else if (temp_phi >= maxPhiG)
475 result.global_phi = maxPhiG - 1;
479 result.global_phi =
static_cast<unsigned short>(temp_phi);
483 <<
"local_phi = " << local_phi
484 <<
" halfstrip = " << halfstrip <<
" strip = " << strip
485 <<
" distFromHalfStripCenter = " << distFromHalfStripCenter
486 <<
" halfstripWidth = " << halfstripWidth
487 <<
" strip phi = " << strip_phi/(
M_PI/180.)
489 <<
" global_phi = " << result.global_phi
506 theadd.phi_local = phi_local;
507 theadd.wire_group = ((1<<5)-1)&(wire_group >> 2);
508 theadd.cscid = cscid;
545 int GlobalPhiMin = (
_subsector == 1) ? 0x42 : 0x800;
546 int GlobalPhiMax = (
_subsector == 1) ? 0x7ff : 0xfbd;
547 double GlobalPhiShift = (1.0*GlobalPhiMin + (GlobalPhiMax - GlobalPhiMin)/2.0);
549 double dt_out =
static_cast<double>(csclut.global_phi) - GlobalPhiShift;
552 dt_out = (dt_out/1982)*2145;
556 dtlut.global_phi = 0x7ff&
static_cast<unsigned>(dt_out);
560 dtlut.global_phi =
static_cast<unsigned>(-dt_out);
561 dtlut.global_phi = ~dtlut.global_phi;
562 dtlut.global_phi |= 0x800;
573 address.cscid = cscid;
574 address.wire_group = ((1<<5)-1)&(wire_group>>2);
575 address.phi_local = phi_local;
614 unsigned wire_group = thewire_group;
615 int cscid = thecscid;
616 unsigned phi_local = thephi_local;
620 bool me1ir_only =
false;
625 <<
" 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;
650 if (wire_group >= nWireGroups) {
652 <<
"warning: wireGroup " << wire_group
653 <<
" is out of bounds [0-" << nWireGroups <<
")\n";
654 wire_group = nWireGroups - 1;
676 <<
"getGlobalEtaValue warning: number of strips " 678 <<
") is not divisible by numBins " << numBins
680 <<
" subsector " <<
_subsector <<
" cscid " << cscid <<
"\n";
682 unsigned maxStripPrevBin = 0, maxStripThisBin = 0;
683 unsigned correctionStrip;
687 maxStripThisBin = nStripsPerBin * (phi_local+1);
688 if (maxStripThisBin <= nStrips) {
689 correctionStrip = nStripsPerBin/2 * (2*phi_local+1);
696 maxStripPrevBin = nStripsPerBin * phi_local;
697 correctionStrip = (nStrips+maxStripPrevBin)/2;
704 result = gPoint.
eta();
710 LogDebug(
"CSCSectorReceiver|OutofBoundInput") << e.
what();
713 return std::fabs(result);
722 double float_eta =
getGlobalEtaValue(address.cscid, address.wire_group, address.phi_local);
723 unsigned int_eta = 0;
724 unsigned bend_global = 0;
726 const unsigned me12EtaCut = 56;
735 <<
"CSCSectorReceiverLUT warning: float_eta = " << float_eta
738 <<
" chamber " << address.cscid <<
" wire group " << address.wire_group;
741 <<
"+++ Value of CSC ID, " << float_eta
753 float_eta = float_eta/etaPerBin;
754 int_eta =
static_cast<unsigned>(float_eta);
768 if (ring == 1 && int_eta < me12EtaCut) {int_eta = me12EtaCut;}
769 else if (ring == 2 && int_eta >= me12EtaCut) {int_eta = me12EtaCut-1;}
771 result.global_eta = int_eta;
773 result.global_bend = bend_global;
783 theadd.phi_bend = tphi_bend;
785 theadd.wire_group = twire_group;
786 theadd.cscid = tcscid;
822 else if (
_station == 2) fileName +=
"2";
823 else if (
_station == 3) fileName +=
"3";
824 else if (
_station == 4) fileName +=
"4";
826 if (
_endcap == 1) fileName +=
"1";
827 else fileName +=
"2";
829 if (
_sector == 1) fileName +=
"1";
830 else if (
_sector == 2) fileName +=
"2";
831 else if (
_sector == 3) fileName +=
"3";
832 else if (
_sector == 4) fileName +=
"4";
833 else if (
_sector == 5) fileName +=
"5";
834 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;
883 std::ifstream GlobalPhiLUT;
885 edm::LogInfo(
"CSCSectorReceiverLUT") <<
"Loading SR LUT: " << fName;
889 GlobalPhiLUT.open(fName.c_str(),std::ios::binary);
891 int length = GlobalPhiLUT.tellg();
894 GlobalPhiLUT.seekg(0,std::ios::beg);
895 GlobalPhiLUT.read(reinterpret_cast<char*>(
me_global_phi),length);
898 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
899 GlobalPhiLUT.close();
903 GlobalPhiLUT.open( fName.c_str());
904 unsigned short temp = 0;
908 GlobalPhiLUT >>
temp;
911 GlobalPhiLUT.close();
919 std::ifstream GlobalPhiLUT;
921 edm::LogInfo(
"CSCSectorReceiverLUT") <<
"Loading SR LUT: " << fName;
925 GlobalPhiLUT.open( fName.c_str(),std::ios::binary);
927 int length = GlobalPhiLUT.tellg();
930 GlobalPhiLUT.seekg(0,std::ios::beg);
931 GlobalPhiLUT.read(reinterpret_cast<char*>(
mb_global_phi),length);
934 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
935 GlobalPhiLUT.close();
939 GlobalPhiLUT.open(fName.c_str());
940 unsigned short temp = 0;
944 GlobalPhiLUT >>
temp;
947 GlobalPhiLUT.close();
955 std::ifstream GlobalEtaLUT;
957 edm::LogInfo(
"CSCSectorReceiverLUT") <<
"Loading SR LUT: " << fName;
961 GlobalEtaLUT.open(fName.c_str(),std::ios::binary);
963 int length = GlobalEtaLUT.tellg();
966 GlobalEtaLUT.seekg(0,std::ios::beg);
967 GlobalEtaLUT.read(reinterpret_cast<char*>(
me_global_eta),length);
970 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
971 GlobalEtaLUT.close();
975 GlobalEtaLUT.open(fName.c_str());
976 unsigned short temp = 0;
980 GlobalEtaLUT >>
temp;
983 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)
CSCChamber * chamber(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned tcscid) const
Return the CSCChamber for a corresponding endcap/station/sector/subsector/trigger cscid...
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
static CSCTriggerGeomManager * get()
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
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
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
gblphidat calcGlobalPhiMB(const gblphidat &me_gphi_data) const