28 _subsector(subsector),
29 _station(station),isTMB07(TMB07)
59 _subsector(lut._subsector),
60 _station(lut._station),
61 me_lcl_phi_file(lut.me_lcl_phi_file),
62 me_gbl_phi_file(lut.me_gbl_phi_file),
63 mb_gbl_phi_file(lut.mb_gbl_phi_file),
64 me_gbl_eta_file(lut.me_gbl_eta_file),
65 LUTsFromFile(lut.LUTsFromFile),
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
210 theadd.strip = strip;
211 theadd.clct_pattern = pattern & 0x7;
212 theadd.pattern_type = (pattern & 0x8) >> 3;
213 theadd.quality = quality;
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);
720 double float_eta =
getGlobalEtaValue(address.cscid, address.wire_group, address.phi_local);
721 unsigned int_eta = 0;
722 unsigned bend_global = 0;
724 const unsigned me12EtaCut = 56;
729 <<
"CSCSectorReceiverLUT warning: float_eta = " << float_eta
732 <<
" chamber " << address.cscid <<
" wire group " << address.wire_group;
735 <<
"+++ Value of CSC ID, " << float_eta
747 float_eta = float_eta/etaPerBin;
748 int_eta =
static_cast<unsigned>(float_eta);
762 if (ring == 1 && int_eta < me12EtaCut) {int_eta = me12EtaCut;}
763 else if (ring == 2 && int_eta >= me12EtaCut) {int_eta = me12EtaCut-1;}
765 result.global_eta = int_eta;
767 result.global_bend = bend_global;
777 theadd.phi_bend = tphi_bend;
779 theadd.wire_group = twire_group;
780 theadd.cscid = tcscid;
816 else if (
_station == 2) fileName +=
"2";
817 else if (
_station == 3) fileName +=
"3";
818 else if (
_station == 4) fileName +=
"4";
820 if (
_endcap == 1) fileName +=
"1";
821 else fileName +=
"2";
823 if (
_sector == 1) fileName +=
"1";
824 else if (
_sector == 2) fileName +=
"2";
825 else if (
_sector == 3) fileName +=
"3";
826 else if (
_sector == 4) fileName +=
"4";
827 else if (
_sector == 5) fileName +=
"5";
828 else if (
_sector == 6) fileName +=
"6";
840 std::ifstream LocalPhiLUT;
846 LocalPhiLUT.open(
fName.c_str(),std::ios::binary);
848 int length = LocalPhiLUT.tellg();
851 LocalPhiLUT.seekg(0,std::ios::beg);
852 LocalPhiLUT.read(reinterpret_cast<char*>(
me_lcl_phi),length);
861 LocalPhiLUT.open(
fName.c_str());
863 unsigned short temp = 0;
877 std::ifstream GlobalPhiLUT;
883 GlobalPhiLUT.open(fName.c_str(),std::ios::binary);
885 int length = GlobalPhiLUT.tellg();
888 GlobalPhiLUT.seekg(0,std::ios::beg);
889 GlobalPhiLUT.read(reinterpret_cast<char*>(
me_global_phi),length);
892 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
893 GlobalPhiLUT.close();
897 GlobalPhiLUT.open( fName.c_str());
898 unsigned short temp = 0;
902 GlobalPhiLUT >>
temp;
905 GlobalPhiLUT.close();
913 std::ifstream GlobalPhiLUT;
919 GlobalPhiLUT.open( fName.c_str(),std::ios::binary);
921 int length = GlobalPhiLUT.tellg();
924 GlobalPhiLUT.seekg(0,std::ios::beg);
925 GlobalPhiLUT.read(reinterpret_cast<char*>(
mb_global_phi),length);
928 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
929 GlobalPhiLUT.close();
933 GlobalPhiLUT.open(fName.c_str());
934 unsigned short temp = 0;
938 GlobalPhiLUT >>
temp;
941 GlobalPhiLUT.close();
949 std::ifstream GlobalEtaLUT;
955 GlobalEtaLUT.open(fName.c_str(),std::ios::binary);
957 int length = GlobalEtaLUT.tellg();
960 GlobalEtaLUT.seekg(0,std::ios::beg);
961 GlobalEtaLUT.read(reinterpret_cast<char*>(
me_global_eta),length);
964 edm::LogError(
"CSCSectorReceiverLUT") <<
"File "<< fName <<
" is incorrect size!";
965 GlobalEtaLUT.close();
969 GlobalEtaLUT.open(fName.c_str());
970 unsigned short temp = 0;
974 GlobalEtaLUT >>
temp;
977 GlobalEtaLUT.close();
virtual char const * what() const
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
LocalPoint stripWireGroupIntersection(int strip, int wireGroup) const
T getUntrackedParameter(std::string const &, T const &) const
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
gbletadat calcGlobalEtaME(const gbletaadd &address) const
Global Eta LUT.
std::string encodeFileIndex() const
Helpers.
gbletadat globalEtaME(int phi_bend, int phi_local, int wire_group, int cscid) const
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)
static global_phi_data calcGlobalPhiMEMini(unsigned short endcap, unsigned short sector, unsigned short station, unsigned short subsector, unsigned theadd)
gblphidat globalPhiMB(int phi_local, int wire_group, int cscid) const
double getGlobalPhiValue(const CSCLayer *thelayer, const unsigned &strip, const unsigned &wire_group) const
static const double SECTOR1_CENT_RAD
double getGlobalEtaValue(const unsigned &cscid, const unsigned &wire_group, const unsigned &phi_local) const
static CSCTriggerGeomManager * get()
lclphidat localPhi(int strip, int pattern, int quality, int lr) const
Geometry Lookup Tables.
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
GlobalPoint centerOfWireGroup(int wireGroup) const
double delta_phi(double ph11, double phi2)
GlobalPoint centerOfStrip(int strip) const
static double get2007Position(int pattern)
static lclphidat calcLocalPhiMini(unsigned theadd)
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]
gblphidat calcGlobalPhiME(const gblphiadd &address) const
Global Phi LUT.
class global_eta_address gbletaadd
static const double SECTOR_RAD
lclphidat calcLocalPhi(const lclphiadd &address) const
Local Phi LUT.
static int minTriggerCscId()
std::string fullPath() const
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 CSCLayerGeometry * geometry() const
gblphidat calcGlobalPhiMB(const gblphidat &me_gphi_data) const
gblphidat globalPhiME(int phi_local, int wire_group, int cscid) const