CMS 3D CMS Logo

CSCSectorReceiverLUT Class Reference

Author:
Lindsey Gray, Slava Valuev, Jason Mumford
More...

#include <L1Trigger/CSCTrackFinder/interface/CSCSectorReceiverLUT.h>

List of all members.

Public Member Functions

 CSCSectorReceiverLUT (const CSCSectorReceiverLUT &)
 CSCSectorReceiverLUT (int endcap, int sector, int subsector, int station, const edm::ParameterSet &pset, bool TMB07)
std::string encodeFileIndex () const
 Helpers.
gbletadat globalEtaME (gbletaadd address) const
gbletadat globalEtaME (unsigned address) const
gbletadat globalEtaME (int phi_bend, int phi_local, int wire_group, int cscid) const
gblphidat globalPhiMB (gblphiadd address) const
gblphidat globalPhiMB (unsigned address) const
gblphidat globalPhiMB (int phi_local, int wire_group, int cscid) const
gblphidat globalPhiME (gblphiadd address) const
gblphidat globalPhiME (unsigned address) const
gblphidat globalPhiME (int phi_local, int wire_group, int cscid) const
lclphidat localPhi (lclphiadd address) const
lclphidat localPhi (unsigned address) const
lclphidat localPhi (int strip, int pattern, int quality, int lr) const
 Geometry Lookup Tables.
CSCSectorReceiverLUToperator= (const CSCSectorReceiverLUT &)
 ~CSCSectorReceiverLUT ()

Private Member Functions

gbletadat calcGlobalEtaME (const gbletaadd &address) const
 Global Eta LUT.
gblphidat calcGlobalPhiMB (const gblphidat &me_gphi_data) const
gblphidat calcGlobalPhiME (const gblphiadd &address) const
 Global Phi LUT.
lclphidat calcLocalPhi (const lclphiadd &address) const
 Local Phi LUT.
void fillLocalPhiLUT ()
double getGlobalEtaValue (const unsigned &cscid, const unsigned &wire_group, const unsigned &phi_local) const
double getGlobalPhiValue (const CSCLayer *thelayer, const unsigned &strip, const unsigned &wire_group) const
void readLUTsFromFile ()
 Arrays for holding read in LUT information.

Private Attributes

int _endcap
int _sector
int _station
int _subsector
bool isBinary
bool isTMB07
bool LUTsFromFile
edm::FileInPath mb_gbl_phi_file
gblphidatmb_global_phi
edm::FileInPath me_gbl_eta_file
edm::FileInPath me_gbl_phi_file
gbletadatme_global_eta
gblphidatme_global_phi
edm::FileInPath me_lcl_phi_file
bool useMiniLUTs

Static Private Attributes

static lclphidatme_lcl_phi = NULL
static bool me_lcl_phi_loaded = false


Detailed Description

Author:
Lindsey Gray, Slava Valuev, Jason Mumford

Provides Look Up Table information for use in the SP Core. Partial port from ORCA.

Definition at line 18 of file CSCSectorReceiverLUT.h.


Constructor & Destructor Documentation

CSCSectorReceiverLUT::CSCSectorReceiverLUT ( int  endcap,
int  sector,
int  subsector,
int  station,
const edm::ParameterSet pset,
bool  TMB07 
)

Definition at line 25 of file CSCSectorReceiverLUT.cc.

References encodeFileIndex(), edm::ParameterSet::getUntrackedParameter(), isBinary, LUTsFromFile, mb_gbl_phi_file, mb_global_phi, me_gbl_eta_file, me_gbl_phi_file, me_global_eta, me_global_phi, me_lcl_phi_file, NULL, readLUTsFromFile(), and useMiniLUTs.

00026                                                                                     :_endcap(endcap),_sector(sector),
00027                                                                            _subsector(subsector),
00028                                                                            _station(station),isTMB07(TMB07)
00029 {
00030   LUTsFromFile = pset.getUntrackedParameter<bool>("ReadLUTs",false);
00031   useMiniLUTs = pset.getUntrackedParameter<bool>("UseMiniLUTs", true);
00032   isBinary = pset.getUntrackedParameter<bool>("Binary",false);
00033 
00034   me_global_eta = NULL;
00035   me_global_phi = NULL;
00036   mb_global_phi = NULL;
00037   if(LUTsFromFile && !useMiniLUTs)
00038     {
00039       me_lcl_phi_file = pset.getUntrackedParameter<edm::FileInPath>("LocalPhiLUT", edm::FileInPath(std::string("L1Trigger/CSCTrackFinder/LUTs/LocalPhiLUT"
00040                                                                                                                + (isBinary ? std::string(".bin") : std::string(".dat")))));
00041       me_gbl_phi_file = pset.getUntrackedParameter<edm::FileInPath>("GlobalPhiLUTME", edm::FileInPath((std::string("L1Trigger/CSCTrackFinder/LUTs/GlobalPhiME")
00042                                                                                                        + encodeFileIndex()
00043                                                                                                        + (isBinary ? std::string(".bin") : std::string(".dat")))));
00044       if(station == 1)
00045         mb_gbl_phi_file = pset.getUntrackedParameter<edm::FileInPath>("GlobalPhiLUTMB", edm::FileInPath((std::string("L1Trigger/CSCTrackFinder/LUTs/GlobalPhiMB")
00046                                                                                                          + encodeFileIndex()
00047                                                                                                          + (isBinary ? std::string(".bin") : std::string(".dat")))));
00048       me_gbl_eta_file = pset.getUntrackedParameter<edm::FileInPath>("GlobalEtaLUTME", edm::FileInPath((std::string("L1Trigger/CSCTrackFinder/LUTs/GlobalEtaME")
00049                                                                                                        + encodeFileIndex()
00050                                                                                                        + (isBinary ? std::string(".bin") : std::string(".dat")))));
00051       readLUTsFromFile();
00052     }
00053 
00054 }

CSCSectorReceiverLUT::CSCSectorReceiverLUT ( const CSCSectorReceiverLUT lut  ) 

Definition at line 56 of file CSCSectorReceiverLUT.cc.

References CSCBitWidths::kGlobalEtaAddressWidth, CSCBitWidths::kGlobalPhiAddressWidth, mb_global_phi, me_global_eta, me_global_phi, and NULL.

00056                                                                          :_endcap(lut._endcap),
00057                                                                             _sector(lut._sector),
00058                                                                             _subsector(lut._subsector),
00059                                                                             _station(lut._station),
00060                                                                             me_lcl_phi_file(lut.me_lcl_phi_file),
00061                                                                             me_gbl_phi_file(lut.me_gbl_phi_file),
00062                                                                             mb_gbl_phi_file(lut.mb_gbl_phi_file),
00063                                                                             me_gbl_eta_file(lut.me_gbl_eta_file),
00064                                                                             LUTsFromFile(lut.LUTsFromFile),
00065                                                                             isBinary(lut.isBinary)
00066 {
00067   if(lut.mb_global_phi)
00068     {
00069       mb_global_phi = new gblphidat[1<<CSCBitWidths::kGlobalPhiAddressWidth];
00070       memcpy(mb_global_phi, lut.mb_global_phi, (1<<CSCBitWidths::kGlobalPhiAddressWidth)*sizeof(gblphidat));
00071     }
00072   else mb_global_phi = NULL;
00073   if(lut.me_global_phi)
00074     {
00075       me_global_phi = new gblphidat[1<<CSCBitWidths::kGlobalPhiAddressWidth];
00076       memcpy(me_global_phi, lut.me_global_phi, (1<<CSCBitWidths::kGlobalPhiAddressWidth)*sizeof(gblphidat));
00077     }
00078   else me_global_phi = NULL;
00079   if(lut.me_global_eta)
00080     {
00081       me_global_eta = new gbletadat[1<<CSCBitWidths::kGlobalEtaAddressWidth];
00082       memcpy(me_global_eta, lut.me_global_eta, (1<<CSCBitWidths::kGlobalEtaAddressWidth)*sizeof(gbletadat));
00083     }
00084   else me_global_eta = NULL;
00085 }

CSCSectorReceiverLUT::~CSCSectorReceiverLUT (  ) 

Definition at line 126 of file CSCSectorReceiverLUT.cc.

References mb_global_phi, me_global_eta, me_global_phi, me_lcl_phi, me_lcl_phi_loaded, and NULL.

00127 {
00128   if(me_lcl_phi_loaded)
00129     {
00130       delete me_lcl_phi;
00131       me_lcl_phi = NULL;
00132       me_lcl_phi_loaded = false;
00133     }
00134   if(me_global_eta)
00135     {
00136       delete me_global_eta;
00137       me_global_eta = NULL;
00138     }
00139   if(me_global_phi)
00140     {
00141       delete me_global_phi;
00142       me_global_phi = NULL;
00143     }
00144   if(mb_global_phi)
00145     {
00146       delete mb_global_phi;
00147       mb_global_phi = NULL;
00148     }
00149 }


Member Function Documentation

gbletadat CSCSectorReceiverLUT::calcGlobalEtaME ( const gbletaadd address  )  const [private]

Global Eta LUT.

Definition at line 711 of file CSCSectorReceiverLUT.cc.

References _sector, _station, CSCTFConstants::etaBins, Exception, getGlobalEtaValue(), CSCTFConstants::maxEta, CSCTriggerNumbering::maxTriggerCscId(), CSCTFConstants::minEta, CSCTriggerNumbering::minTriggerCscId(), HLT_VtxMuL3::result, and CSCTriggerNumbering::ringFromTriggerLabels().

Referenced by globalEtaME().

00712 {
00713   gbletadat result;
00714   double float_eta = getGlobalEtaValue(address.cscid, address.wire_group, address.phi_local);
00715   unsigned int_eta = 0;
00716   unsigned bend_global = 0; // not filled yet... will change when it is.
00717   const double etaPerBin = (CSCTFConstants::maxEta - CSCTFConstants::minEta)/CSCTFConstants::etaBins;
00718   const unsigned me12EtaCut = 56;
00719 
00720   if ((float_eta < CSCTFConstants::minEta) || (float_eta >= CSCTFConstants::maxEta))
00721     {
00722       edm::LogWarning("CSCSectorReceiverLUT:OutOfBounds")
00723         << "CSCSectorReceiverLUT warning: float_eta = " << float_eta
00724         << " minEta = " << CSCTFConstants::minEta << " maxEta = " << CSCTFConstants::maxEta
00725         << "   station " << _station << " sector " << _sector
00726         << " chamber "   << address.cscid << " wire group " << address.wire_group;
00727 
00728       throw cms::Exception("CSCSectorReceiverLUT")
00729         << "+++ Value of CSC ID, " << float_eta
00730         << ", is out of bounds [" << CSCTFConstants::minEta << "-"
00731         << CSCTFConstants::maxEta << ") +++\n";
00732 
00733       //if (float_eta < CSCTFConstants::minEta)
00734       //result.global_eta = 0;
00735       //else if (float_eta >= CSCTFConstants::maxEta)
00736       //result.global_eta = CSCTFConstants::etaBins - 1;
00737     }
00738   else
00739     {
00740       float_eta -= CSCTFConstants::minEta;
00741       float_eta = float_eta/etaPerBin;
00742       int_eta = static_cast<unsigned>(float_eta);
00743       /* Commented until I find out its use.
00744       // Fine-tune eta boundary between DT and CSC.
00745       if ((intEta == L1MuCSCSetup::CscEtaStart() && (L1MuCSCSetup::CscEtaStartCorr() > 0.) ) ||
00746           (intEta == L1MuCSCSetup::CscEtaStart() - 1 && (L1MuCSCSetup::CscEtaStartCorr() < 0.) ) ) {
00747         bitEta = (thisEta-minEta-L1MuCSCSetup::CscEtaStartCorr())/EtaPerBin;
00748         intEta = static_cast<int>(bitEta);
00749       }
00750       */
00751       if (_station == 1 && address.cscid >= static_cast<unsigned>(CSCTriggerNumbering::minTriggerCscId())
00752           && address.cscid <= static_cast<unsigned>(CSCTriggerNumbering::maxTriggerCscId()) )
00753         {
00754           unsigned ring = CSCTriggerNumbering::ringFromTriggerLabels(_station, address.cscid);
00755 
00756           if      (ring == 1 && int_eta <  me12EtaCut) {int_eta = me12EtaCut;}
00757           else if (ring == 2 && int_eta >= me12EtaCut) {int_eta = me12EtaCut-1;}
00758         }
00759       result.global_eta = int_eta;
00760     }
00761   result.global_bend = bend_global;
00762 
00763   return result;
00764 }

gblphidat CSCSectorReceiverLUT::calcGlobalPhiMB ( const gblphidat me_gphi_data  )  const [private]

Definition at line 538 of file CSCSectorReceiverLUT.cc.

References _subsector, and global_phi_data::global_phi.

Referenced by globalPhiMB().

00539 {
00540   gblphidat dtlut;
00541 
00542   // The following method was ripped from D. Holmes' LUT conversion program
00543 
00544   int GlobalPhiMin = (_subsector == 1) ? 0x42 : 0x800;
00545   int GlobalPhiMax = (_subsector == 1) ? 0x7ff : 0xfbd;
00546   double GlobalPhiShift = (GlobalPhiMin + (GlobalPhiMax - GlobalPhiMin)/2.0);
00547 
00548   double dt_out = static_cast<double>(csclut.global_phi) - GlobalPhiShift;
00549 
00550   dt_out = (dt_out/1981)*2155;
00551 
00552   if(dt_out >= 0) // msb != 1
00553     {
00554       dtlut.global_phi = 0x7ff&static_cast<unsigned>(dt_out);
00555     }
00556   else
00557     {
00558       dtlut.global_phi = static_cast<unsigned>(-dt_out);
00559       dtlut.global_phi = ~dtlut.global_phi;
00560       dtlut.global_phi |= 0x800;
00561     }
00562 
00563   return dtlut;
00564 }

gblphidat CSCSectorReceiverLUT::calcGlobalPhiME ( const gblphiadd address  )  const [private]

Global Phi LUT.

Definition at line 272 of file CSCSectorReceiverLUT.cc.

References _endcap, _sector, _station, _subsector, CSCTriggerGeomManager::chamber(), kinem::delta_phi(), e, Exception, CSCLayer::geometry(), CSCTriggerGeometry::get(), getGlobalPhiValue(), isTMB07, CSCConstants::KEY_CLCT_LAYER, CSCConstants::KEY_CLCT_LAYER_PRE_TMB07, CSCBitWidths::kGlobalPhiDataBitWidth, CSCBitWidths::kLocalPhiDataBitWidth, CSCChamber::layer(), LogDebug, CSCConstants::MAX_NUM_STRIPS, CSCTriggerNumbering::maxTriggerCscId(), CSCTriggerNumbering::minTriggerCscId(), NULL, CSCLayerGeometry::numberOfStrips(), HLT_VtxMuL3::result, CSCTFConstants::SECTOR1_CENT_RAD, CSCTFConstants::SECTOR_DEG, CSCTFConstants::SECTOR_RAD, strip(), and cms::Exception::what().

Referenced by globalPhiME().

00273 {
00274   gblphidat result(0);
00275   CSCTriggerGeomManager* thegeom = CSCTriggerGeometry::get();
00276   CSCChamber* thechamber = NULL;
00277   CSCLayer* thelayer = NULL;
00278   CSCLayerGeometry* layergeom = NULL;
00279   int cscid = address.cscid;
00280   unsigned wire_group = address.wire_group;
00281   unsigned local_phi = address.phi_local;
00282   const double sectorOffset = (CSCTFConstants::SECTOR1_CENT_RAD-CSCTFConstants::SECTOR_RAD/2.) + (_sector-1)*M_PI/3.;
00283 
00284   //Number of global phi units per radian.
00285   static int maxPhiG = 1<<CSCBitWidths::kGlobalPhiDataBitWidth;
00286   double binPhiG = static_cast<double>(maxPhiG)/CSCTFConstants::SECTOR_RAD;
00287 
00288   // We will use these to convert the local phi into radians.
00289   static unsigned int maxPhiL = 1<<CSCBitWidths::kLocalPhiDataBitWidth;
00290   const double binPhiL = static_cast<double>(maxPhiL)/(2.*CSCConstants::MAX_NUM_STRIPS);
00291 
00292   if(cscid < CSCTriggerNumbering::minTriggerCscId())
00293     {
00294       edm::LogWarning("CSCSectorReceiverLUT|getGlobalPhiValue")
00295         << " warning: cscId " << cscid << " is out of bounds ["
00296         << CSCTriggerNumbering::maxTriggerCscId() << "-"
00297         << CSCTriggerNumbering::maxTriggerCscId() << "]\n";
00298       throw cms::Exception("CSCSectorReceiverLUT")
00299         << "+++ Value of CSC ID, " << cscid
00300         << ", is out of bounds [" << CSCTriggerNumbering::minTriggerCscId() << "-"
00301         << CSCTriggerNumbering::maxTriggerCscId() << "] +++\n";
00302     }
00303 
00304   if(cscid > CSCTriggerNumbering::maxTriggerCscId())
00305     {
00306       edm::LogWarning("CSCSectorReceiverLUT|getGlobalPhiValue")
00307         << " warning: cscId " << cscid << " is out of bounds ["
00308         << CSCTriggerNumbering::maxTriggerCscId() << "-"
00309         << CSCTriggerNumbering::maxTriggerCscId() << "]\n";
00310       throw cms::Exception("CSCSectorReceiverLUT")
00311         << "+++ Value of CSC ID, " << cscid
00312         << ", is out of bounds [" << CSCTriggerNumbering::minTriggerCscId() << "-"
00313         << CSCTriggerNumbering::maxTriggerCscId() << "] +++\n";
00314     }
00315 
00316   if(wire_group >= 1<<5)
00317     {
00318       edm::LogWarning("CSCSectorReceiverLUT|getGlobalPhiValue")
00319         << "warning: wire_group" << wire_group
00320         << " is out of bounds (1-" << ((1<<5)-1) << "]\n";
00321       throw cms::Exception("CSCSectorReceiverLUT")
00322         << "+++ Value of wire_group, " << wire_group
00323         << ", is out of bounds (1-" << ((1<<5)-1) << "] +++\n";
00324     }
00325 
00326   if(local_phi >= maxPhiL)
00327     {
00328       edm::LogWarning("CSCSectorReceiverLUT|getGlobalPhiValue")
00329         << "warning: local_phi" << local_phi
00330         << " is out of bounds [0-" << maxPhiL << ")\n";
00331       throw cms::Exception("CSCSectorReceiverLUT")
00332         << "+++ Value of local_phi, " << local_phi
00333         << ", is out of bounds [0-, " << maxPhiL << ") +++\n";
00334     }
00335 
00336   try
00337     {
00338       thechamber = thegeom->chamber(_endcap,_station,_sector,_subsector,cscid);
00339       if(thechamber)
00340         {
00341           if(isTMB07)
00342             {
00343               layergeom = const_cast<CSCLayerGeometry*>(thechamber->layer(CSCConstants::KEY_CLCT_LAYER)->geometry());
00344               thelayer = const_cast<CSCLayer*>(thechamber->layer(CSCConstants::KEY_CLCT_LAYER));
00345             }
00346           else
00347             {
00348               layergeom = const_cast<CSCLayerGeometry*>(thechamber->layer(CSCConstants::KEY_CLCT_LAYER_PRE_TMB07)->geometry());
00349               thelayer = const_cast<CSCLayer*>(thechamber->layer(CSCConstants::KEY_CLCT_LAYER_PRE_TMB07));
00350             }
00351           const int nStrips = layergeom->numberOfStrips();
00352           // PhiL is the strip number converted into some units between 0 and
00353           // 1023.  When we did the conversion in fillLocalPhiTable(), we did
00354           // not know for which chamber we do it (and, therefore, how many strips
00355           // it has), and always used the maximum possible number of strips
00356           // per chamber, MAX_NUM_STRIPS=80.  Now, since we know the chamber id
00357           // and how many strips the chamber has, we can re-adjust the scale.
00358           //const double scale = static_cast<double>(CSCConstants::MAX_NUM_STRIPS)/nStrips;
00359 
00360           int strip = 0, halfstrip = 0;
00361 
00362           halfstrip = static_cast<int>(local_phi/binPhiL);
00363           strip     = halfstrip/2;
00364 
00365           // Find the phi width of the chamber and the position of its "left"
00366           // (lower phi) edge (both in radians).
00367           // Phi positions of the centers of the first and of the last strips
00368           // in the chamber.
00369           const double phi_f = getGlobalPhiValue(thelayer, 1, wire_group);
00370           const double phi_l = getGlobalPhiValue(thelayer, nStrips, wire_group);
00371           // Phi widths of the half-strips at both ends of the chamber;
00372           // surprisingly, they are not the same.
00373           const double hsWidth_f = fabs(getGlobalPhiValue(thelayer, 2, wire_group) - phi_f)/2.;
00374           const double hsWidth_l = fabs(phi_l - getGlobalPhiValue(thelayer, nStrips - 1, wire_group))/2.;
00375 
00376           // The "natural" match between the strips and phi values -- when
00377           // a larger strip number corresponds to a larger phi value, i.e. strips
00378           // are counted clockwise if we look at them from the inside of the
00379           // detector -- is reversed for some stations.  At the moment, these
00380           // are stations 3 and 4 of the 1st endcap, and stations 1 and 2 of
00381           // the 2nd endcap.  Instead of using
00382           // if ((theEndcap == 1 && theStation <= 2) ||
00383           // (theEndcap == 2 && theStation >= 3)),
00384           // we get the order from the phi values of the first and the last strip
00385           // in a chamber, just in case the counting scheme changes in the future.
00386           // Once we know how the strips are counted, we can go from the middle
00387           // of the strips to their outer edges.
00388           bool   clockwiseOrder;
00389           double leftEdge, rightEdge;
00390           if (fabs(phi_f - phi_l) < M_PI)
00391             {
00392               if (phi_f < phi_l) clockwiseOrder = true;
00393               else clockwiseOrder = false;
00394             }
00395           else
00396             { // the chamber crosses the phi = pi boundary
00397               if (phi_f < phi_l) clockwiseOrder = false;
00398               else clockwiseOrder = true;
00399             }
00400           if (clockwiseOrder)
00401             {
00402               leftEdge  = phi_f - hsWidth_f;
00403               rightEdge = phi_l + hsWidth_l;
00404             }
00405           else
00406             {
00407               leftEdge  = phi_l - hsWidth_l;
00408               rightEdge = phi_f + hsWidth_f;
00409             }
00410           if (fabs(phi_f - phi_l) >= M_PI) {rightEdge += 2.*M_PI;}
00411           //double chamberWidth = (rightEdge - leftEdge);
00412 
00413           // Chamber offset, relative to the edge of the sector.
00414           //double chamberOffset = leftEdge - sectorOffset;
00415           //if (chamberOffset < -M_PI) chamberOffset += 2*M_PI;
00416 
00417           double temp_phi = 0.0, strip_phi = 0.0, delta_phi = 0.0;
00418           double distFromHalfStripCenter = 0.0, halfstripWidth = 0.0;
00419 
00420           if (strip < nStrips)
00421             {
00422               // Approximate distance from the center of the half-strip to the center
00423               // of this phil bin, in units of half-strip width.
00424               distFromHalfStripCenter = (local_phi+0.5)/binPhiL - halfstrip - 0.5;
00425               // Half-strip width (in rad), calculated as the half-distance between
00426               // the adjacent strips.  Since in the current ORCA implementation
00427               // the half-strip width changes from strip to strip, base the choice
00428               // of the adjacent strip on the half-strip number.
00429               if ((halfstrip%2 == 0 && halfstrip != 0) || halfstrip == 2*nStrips-1) {
00430                 halfstripWidth =
00431                   fabs(getGlobalPhiValue(thelayer, strip+1, wire_group) - getGlobalPhiValue(thelayer, strip, wire_group)) / 2.;
00432               }
00433               else
00434                 {
00435                   halfstripWidth =
00436                     fabs(getGlobalPhiValue(thelayer, strip+1, wire_group) - getGlobalPhiValue(thelayer, strip+2, wire_group)) / 2.;
00437                 }
00438               // Correction for the strips crossing the 180 degree boundary.
00439               if (halfstripWidth > M_PI/2.) halfstripWidth = M_PI - halfstripWidth;
00440               // Phi at the center of the strip.
00441               strip_phi = getGlobalPhiValue(thelayer, strip+1, wire_group);
00442               // Distance between the center of the strip and the phil position.
00443               delta_phi = halfstripWidth*(((halfstrip%2)-0.5)+distFromHalfStripCenter);
00444               if (clockwiseOrder)
00445                 temp_phi = strip_phi+ delta_phi;
00446               else
00447                 temp_phi = strip_phi- delta_phi;
00448             }
00449           else
00450             {
00451               // PhiL values that do not have corresponding strips (the chamber
00452               // has less than 80 strips assumed in fillLocalPhi).  It does not
00453               // really matter what we do with these values; at the moment, just
00454               // set them to the phis of the edges of the chamber.
00455               if (clockwiseOrder) temp_phi = rightEdge;
00456               else temp_phi = leftEdge;
00457             }
00458 
00459           // Finally, subtract the sector offset and convert to the scale of
00460           // the global phi.
00461 
00462           temp_phi -= sectorOffset;
00463 
00464           if (temp_phi < 0.) temp_phi += 2.*M_PI;
00465 
00466           temp_phi *= binPhiG;
00467 
00468           if (temp_phi < 0.)
00469             {
00470               result.global_phi = 0;
00471             }
00472           else if (temp_phi >= maxPhiG)
00473             {
00474               result.global_phi = maxPhiG - 1;
00475             }
00476           else
00477             {
00478              result.global_phi = static_cast<unsigned short>(temp_phi);
00479             }
00480 
00481           LogDebug("CSCSectorReceiverLUT")
00482             << "local_phi = " << local_phi
00483             << " halfstrip = " << halfstrip << " strip = " << strip
00484             << " distFromHalfStripCenter = " << distFromHalfStripCenter
00485             << " halfstripWidth = " << halfstripWidth
00486             << " strip phi = " << strip_phi/(M_PI/180.)
00487             << " temp_phi = " << temp_phi*CSCTFConstants::SECTOR_DEG/maxPhiG
00488             << " global_phi = "    << result.global_phi
00489             << " " << result.global_phi*CSCTFConstants::SECTOR_DEG/maxPhiG;
00490 
00491         }
00492     }
00493   catch(edm::Exception& e)
00494     {
00495       edm::LogError("CSCSectorReceiverLUT|getGlobalPhiValue") << e.what();
00496     }
00497 
00498   return result;
00499 }

lclphidat CSCSectorReceiverLUT::calcLocalPhi ( const lclphiadd address  )  const [private]

Local Phi LUT.

Local Phi Bend is always zero. Until we start using it.

Definition at line 151 of file CSCSectorReceiverLUT.cc.

References _endcap, _station, data, Exception, CSCPatternLUT::get2007Position(), CSCPatternLUT::getPosition(), isTMB07, CSCBitWidths::kLocalPhiDataBitWidth, LogDebug, and CSCConstants::MAX_NUM_STRIPS.

Referenced by localPhi().

00152 {
00153   lclphidat data;
00154 
00155   static int maxPhiL = 1<<CSCBitWidths::kLocalPhiDataBitWidth;
00156   double binPhiL = static_cast<double>(maxPhiL)/(2.*CSCConstants::MAX_NUM_STRIPS);
00157 
00158   memset(&data,0,sizeof(lclphidat));
00159 
00160   double patternOffset;
00161 
00162   if(isTMB07) patternOffset = CSCPatternLUT::get2007Position((theadd.pattern_type<<3) + theadd.clct_pattern);
00163   else patternOffset = CSCPatternLUT::getPosition(theadd.clct_pattern);
00164 
00165   // The phiL value stored is for the center of the half-/di-strip.
00166   if(theadd.strip < 2*CSCConstants::MAX_NUM_STRIPS)
00167     if(theadd.pattern_type == 1 || isTMB07) // if halfstrip (Note: no distrips in TMB 2007 patterns)
00168       data.phi_local = static_cast<unsigned>((0.5 + theadd.strip + patternOffset)*binPhiL);
00169     else // if distrip
00170       data.phi_local = static_cast<unsigned>((2 + theadd.strip + 4.*patternOffset)*binPhiL);
00171   else {
00172     throw cms::Exception("CSCSectorReceiverLUT")
00173       << "+++ Value of strip, " << theadd.strip
00174       << ", exceeds max allowed, " << 2*CSCConstants::MAX_NUM_STRIPS-1
00175       << " +++\n";
00176   }
00177 
00178   if (data.phi_local >= maxPhiL) {
00179     throw cms::Exception("CSCSectorReceiverLUT")
00180       << "+++ Value of phi_local, " << data.phi_local
00181       << ", exceeds max allowed, " << maxPhiL-1 << " +++\n";
00182   }
00183 
00184   LogDebug("CSCSectorReceiver")
00185     << "endcap = " << _endcap << " station = " << _station
00186     << " maxPhiL = " << maxPhiL << " binPhiL = " << binPhiL;
00187   LogDebug("CSCSectorReceiver")
00188     << "strip # " << theadd.strip << " hs/ds = " << theadd.pattern_type
00189     << " pattern = " << theadd.clct_pattern << " offset = " << patternOffset
00190     << " phi_local = " << data.phi_local;
00191 
00193   data.phi_bend_local = 0;
00194 
00195   return data; //return LUT result
00196 }

std::string CSCSectorReceiverLUT::encodeFileIndex (  )  const

Helpers.

Definition at line 804 of file CSCSectorReceiverLUT.cc.

References _endcap, _sector, _station, _subsector, and aod_PYTHIA_cfg::fileName.

Referenced by CSCSectorReceiverLUT().

00804                                                       {
00805   std::string fileName = "";
00806   if (_station == 1) {
00807     if (_subsector == 1) fileName += "1a";
00808     if (_subsector == 2) fileName += "1b";
00809   }
00810   else if (_station == 2) fileName += "2";
00811   else if (_station == 3) fileName += "3";
00812   else if (_station == 4) fileName += "4";
00813   fileName += "End";
00814   if (_endcap == 1) fileName += "1";
00815   else                fileName += "2";
00816   fileName += "Sec";
00817   if      (_sector == 1) fileName += "1";
00818   else if (_sector == 2) fileName += "2";
00819   else if (_sector == 3) fileName += "3";
00820   else if (_sector == 4) fileName += "4";
00821   else if (_sector == 5) fileName += "5";
00822   else if (_sector == 6) fileName += "6";
00823   fileName += "LUT";
00824   return fileName;
00825 }

void CSCSectorReceiverLUT::fillLocalPhiLUT (  )  [private]

Definition at line 199 of file CSCSectorReceiverLUT.cc.

00200 {
00201   // read data in from a file... Add this later.
00202 }

double CSCSectorReceiverLUT::getGlobalEtaValue ( const unsigned &  cscid,
const unsigned &  wire_group,
const unsigned &  phi_local 
) const [private]

Calculate Eta correction

Definition at line 605 of file CSCSectorReceiverLUT.cc.

References _endcap, _sector, _station, _subsector, CSCLayer::centerOfWireGroup(), CSCTriggerGeomManager::chamber(), e, PV3DBase< T, PVType, FrameType >::eta(), CSCLayer::geometry(), CSCTriggerGeometry::get(), CSCConstants::KEY_ALCT_LAYER, CSCChamber::layer(), LogDebug, CSCConstants::MAX_NUM_STRIPS, CSCTriggerNumbering::maxTriggerCscId(), CSCTriggerNumbering::minTriggerCscId(), NULL, CSCLayerGeometry::numberOfStrips(), CSCLayerGeometry::numberOfWireGroups(), HLT_VtxMuL3::result, CSCTriggerNumbering::ringFromTriggerLabels(), CSCLayerGeometry::stripWireGroupIntersection(), GeomDet::surface(), Surface::toGlobal(), and cms::Exception::what().

Referenced by calcGlobalEtaME().

00606 {
00607   double result = 0.0;
00608   unsigned wire_group = thewire_group;
00609   int cscid = thecscid;
00610   unsigned phi_local = thephi_local;
00611 
00612   // Flag to be set if one wants to apply phi corrections ONLY in ME1/1.
00613   // Turn it into a parameter?
00614   bool me1ir_only = false;
00615 
00616   if(cscid < CSCTriggerNumbering::minTriggerCscId() ||
00617      cscid > CSCTriggerNumbering::maxTriggerCscId()) {
00618        edm::LogWarning("CSCSectorReceiverLUT|getEtaValue")
00619          << " warning: cscId " << cscid
00620          << " is out of bounds [1-" << CSCTriggerNumbering::maxTriggerCscId()
00621          << "]\n";
00622       cscid = CSCTriggerNumbering::maxTriggerCscId();
00623     }
00624 
00625   CSCTriggerGeomManager* thegeom = CSCTriggerGeometry::get();
00626   CSCLayerGeometry* layerGeom = NULL;
00627   const unsigned numBins = 1 << 2; // 4 local phi bins
00628 
00629   if(phi_local > numBins - 1) {
00630       edm::LogWarning("CSCSectorReceiverLUT|getEtaValue")
00631         << "warning: phiL " << phi_local
00632         << " is out of bounds [0-" << numBins - 1 << "]\n";
00633       phi_local = numBins - 1;
00634   }
00635   try
00636     {
00637       const CSCChamber* thechamber = thegeom->chamber(_endcap,_station,_sector,_subsector,cscid);
00638       if(thechamber) {
00639         layerGeom = const_cast<CSCLayerGeometry*>(thechamber->layer(CSCConstants::KEY_ALCT_LAYER)->geometry());
00640         const unsigned nWireGroups = layerGeom->numberOfWireGroups();
00641 
00642         // Check wire group numbers; expect them to be counted from 0, as in
00643         // CorrelatedLCTDigi class.
00644         if (wire_group >= nWireGroups) {
00645            edm::LogWarning("CSCSectorReceiverLUT|getEtaValue")
00646              << "warning: wireGroup " << wire_group
00647             << " is out of bounds [0-" << nWireGroups << ")\n";
00648           wire_group = nWireGroups - 1;
00649         }
00650         // Convert to [1; nWireGroups] range used in geometry methods.
00651         wire_group += 1;
00652 
00653         // If me1ir_only is set, apply phi corrections only in ME1/1.
00654         if (me1ir_only &&
00655             (_station != 1 ||
00656              CSCTriggerNumbering::ringFromTriggerLabels(_station, cscid) != 1))
00657           {
00658             result = thechamber->layer(CSCConstants::KEY_ALCT_LAYER)->centerOfWireGroup(wire_group).eta();
00659           }
00660         else {
00661           const unsigned nStrips = layerGeom->numberOfStrips();
00662           const unsigned nStripsPerBin = CSCConstants::MAX_NUM_STRIPS/numBins;
00667           // Check that no strips will be left out.
00668           if (nStrips%numBins != 0 || CSCConstants::MAX_NUM_STRIPS%numBins != 0)
00669             edm::LogWarning("CSCSectorReceiverLUT")
00670               << "getGlobalEtaValue warning: number of strips "
00671               << nStrips << " (" << CSCConstants::MAX_NUM_STRIPS
00672               << ") is not divisible by numBins " << numBins
00673               << " Station " << _station << " sector " << _sector
00674               << " subsector " << _subsector << " cscid " << cscid << "\n";
00675 
00676           unsigned    maxStripPrevBin = 0, maxStripThisBin = 0;
00677           unsigned    correctionStrip;
00678           LocalPoint  lPoint;
00679           GlobalPoint gPoint;
00680           // Bins phi_local and find the the middle strip for each bin.
00681           maxStripThisBin = nStripsPerBin * (phi_local+1);
00682           if (maxStripThisBin <= nStrips) {
00683             correctionStrip = nStripsPerBin/2 * (2*phi_local+1);
00684           }
00685           else {
00686             // If the actual number of strips in the chamber is smaller than
00687             // the number of strips corresponding to the right edge of this phi
00688             // local bin, we take the middle strip between number of strips
00689             // at the left edge of the bin and the actual number of strips.
00690             maxStripPrevBin = nStripsPerBin * phi_local;
00691             correctionStrip = (nStrips+maxStripPrevBin)/2;
00692           }
00693 
00694           lPoint = layerGeom->stripWireGroupIntersection(correctionStrip, wire_group);
00695           gPoint = thechamber->layer(CSCConstants::KEY_ALCT_LAYER)->surface().toGlobal(lPoint);
00696 
00697           // end calc of eta correction.
00698           result = gPoint.eta();
00699         }
00700       }
00701     }
00702   catch (cms::Exception &e)
00703     {
00704       LogDebug("CSCSectorReceiver|OutofBoundInput") << e.what();
00705     }
00706 
00707   return std::fabs(result);
00708 }

double CSCSectorReceiverLUT::getGlobalPhiValue ( const CSCLayer thelayer,
const unsigned &  strip,
const unsigned &  wire_group 
) const [private]

Definition at line 248 of file CSCSectorReceiverLUT.cc.

References CSCLayer::centerOfStrip(), e, LogDebug, PV3DBase< T, PVType, FrameType >::phi(), HLT_VtxMuL3::result, and cms::Exception::what().

Referenced by calcGlobalPhiME().

00249 {
00250   double result = 0.0;
00251   //CSCLayerGeometry* thegeom;
00252   //LocalPoint lp;
00253   //GlobalPoint gp;
00254 
00255   try
00256     {
00257       //thegeom = const_cast<CSCLayerGeometry*>(thelayer->geometry());
00258       //lp = thegeom->stripWireGroupIntersection(strip, wire_group);
00259       //gp = thelayer->surface().toGlobal(lp);
00260       result = thelayer->centerOfStrip(strip).phi();//gp.phi();
00261 
00262       if (result < 0.) result += 2.*M_PI;
00263     }
00264   catch(edm::Exception& e)
00265     {
00266       LogDebug("CSCSectorReceiverLUT|getGlobalPhiValue") << e.what();
00267     }
00268 
00269   return result;
00270 }

gbletadat CSCSectorReceiverLUT::globalEtaME ( gbletaadd  address  )  const

Definition at line 794 of file CSCSectorReceiverLUT.cc.

References _endcap, _sector, _station, _subsector, calcGlobalEtaME(), CSCSectorReceiverMiniLUT::calcGlobalEtaMEMini(), isTMB07, LUTsFromFile, me_global_eta, HLT_VtxMuL3::result, and useMiniLUTs.

00795 {
00796   gbletadat result;
00797 
00798   if(useMiniLUTs && isTMB07) result = CSCSectorReceiverMiniLUT::calcGlobalEtaMEMini(_endcap, _sector, _station, _subsector, address.toint());
00799   else if(LUTsFromFile) result = me_global_eta[address.toint()];
00800   else result = calcGlobalEtaME(address);
00801   return result;
00802 }

gbletadat CSCSectorReceiverLUT::globalEtaME ( unsigned  address  )  const

Definition at line 783 of file CSCSectorReceiverLUT.cc.

References _endcap, _sector, _station, _subsector, calcGlobalEtaME(), CSCSectorReceiverMiniLUT::calcGlobalEtaMEMini(), isTMB07, LUTsFromFile, me_global_eta, HLT_VtxMuL3::result, and useMiniLUTs.

00784 {
00785   gbletadat result;
00786   gbletaadd theadd(address);
00787 
00788   if(useMiniLUTs && isTMB07) result = CSCSectorReceiverMiniLUT::calcGlobalEtaMEMini(_endcap, _sector, _station, _subsector, address);
00789   else if(LUTsFromFile) result = me_global_eta[address];
00790   else result = calcGlobalEtaME(theadd);
00791   return result;
00792 }

gbletadat CSCSectorReceiverLUT::globalEtaME ( int  phi_bend,
int  phi_local,
int  wire_group,
int  cscid 
) const

Definition at line 766 of file CSCSectorReceiverLUT.cc.

References _endcap, _sector, _station, _subsector, calcGlobalEtaME(), CSCSectorReceiverMiniLUT::calcGlobalEtaMEMini(), isTMB07, CSCBitWidths::kLocalPhiDataBitWidth, LUTsFromFile, me_global_eta, global_eta_address::phi_bend, HLT_VtxMuL3::result, and useMiniLUTs.

Referenced by L1TCSCTF::analyze().

00767 {
00768   gbletadat result;
00769   gbletaadd theadd;
00770 
00771   theadd.phi_bend = tphi_bend;
00772   theadd.phi_local = (tphi_local>>(CSCBitWidths::kLocalPhiDataBitWidth - 2)) & 0x3; // want 2 msb of local phi
00773   theadd.wire_group = twire_group;
00774   theadd.cscid = tcscid;
00775 
00776   if(useMiniLUTs && isTMB07) result = CSCSectorReceiverMiniLUT::calcGlobalEtaMEMini(_endcap, _sector, _station, _subsector, theadd.toint());
00777   else if(LUTsFromFile) result = me_global_eta[theadd.toint()];
00778   else result = calcGlobalEtaME(theadd);
00779 
00780   return result;
00781 }

gblphidat CSCSectorReceiverLUT::globalPhiMB ( gblphiadd  address  )  const

Definition at line 594 of file CSCSectorReceiverLUT.cc.

References _endcap, _sector, _subsector, calcGlobalPhiMB(), CSCSectorReceiverMiniLUT::calcGlobalPhiMBMini(), globalPhiME(), isTMB07, LUTsFromFile, mb_global_phi, HLT_VtxMuL3::result, and useMiniLUTs.

00595 {
00596   gblphidat result;
00597 
00598   if(useMiniLUTs && isTMB07) result = CSCSectorReceiverMiniLUT::calcGlobalPhiMBMini(_endcap, _sector, _subsector, address.toint());
00599   else if(LUTsFromFile) result = mb_global_phi[address.toint()];
00600   else result = calcGlobalPhiMB(globalPhiME(address));
00601 
00602   return result;
00603 }

gblphidat CSCSectorReceiverLUT::globalPhiMB ( unsigned  address  )  const

Definition at line 582 of file CSCSectorReceiverLUT.cc.

References _endcap, _sector, _subsector, calcGlobalPhiMB(), CSCSectorReceiverMiniLUT::calcGlobalPhiMBMini(), globalPhiME(), isTMB07, LUTsFromFile, mb_global_phi, HLT_VtxMuL3::result, and useMiniLUTs.

00583 {
00584   gblphidat result;
00585   gblphiadd theadd(address);
00586 
00587   if(useMiniLUTs && isTMB07) result = CSCSectorReceiverMiniLUT::calcGlobalPhiMBMini(_endcap, _sector, _subsector, address);
00588   else if(LUTsFromFile) result = mb_global_phi[theadd.toint()];
00589   else result = calcGlobalPhiMB(globalPhiME(address));
00590 
00591   return result;
00592 }

gblphidat CSCSectorReceiverLUT::globalPhiMB ( int  phi_local,
int  wire_group,
int  cscid 
) const

Definition at line 566 of file CSCSectorReceiverLUT.cc.

References _endcap, _sector, _subsector, calcGlobalPhiMB(), CSCSectorReceiverMiniLUT::calcGlobalPhiMBMini(), globalPhiME(), isTMB07, LUTsFromFile, mb_global_phi, HLT_VtxMuL3::result, and useMiniLUTs.

00567 {
00568   gblphiadd address;
00569   gblphidat result;
00570 
00571   address.cscid = cscid;
00572   address.wire_group = ((1<<5)-1)&(wire_group>>2);
00573   address.phi_local = phi_local;
00574 
00575   if(useMiniLUTs && isTMB07) result = CSCSectorReceiverMiniLUT::calcGlobalPhiMBMini(_endcap, _sector, _subsector, address.toint());
00576   else if(LUTsFromFile) result = mb_global_phi[address.toint()];
00577   else result = calcGlobalPhiMB(globalPhiME(address));
00578 
00579   return result;
00580 }

gblphidat CSCSectorReceiverLUT::globalPhiME ( gblphiadd  address  )  const

Definition at line 527 of file CSCSectorReceiverLUT.cc.

References _endcap, _sector, _station, _subsector, calcGlobalPhiME(), CSCSectorReceiverMiniLUT::calcGlobalPhiMEMini(), isTMB07, LUTsFromFile, me_global_phi, HLT_VtxMuL3::result, and useMiniLUTs.

00528 {
00529   gblphidat result;
00530 
00531   if(useMiniLUTs && isTMB07) result = CSCSectorReceiverMiniLUT::calcGlobalPhiMEMini(_endcap, _sector, _station, _subsector, address.toint());
00532   else if(LUTsFromFile) result = me_global_phi[address.toint()];
00533   else result = calcGlobalPhiME(address);
00534 
00535   return result;
00536 }

gblphidat CSCSectorReceiverLUT::globalPhiME ( unsigned  address  )  const

Definition at line 516 of file CSCSectorReceiverLUT.cc.

References _endcap, _sector, _station, _subsector, calcGlobalPhiME(), CSCSectorReceiverMiniLUT::calcGlobalPhiMEMini(), isTMB07, LUTsFromFile, me_global_phi, HLT_VtxMuL3::result, and useMiniLUTs.

00517 {
00518   gblphidat result;
00519 
00520   if(useMiniLUTs && isTMB07) result = CSCSectorReceiverMiniLUT::calcGlobalPhiMEMini(_endcap, _sector, _station, _subsector, address);
00521   else if(LUTsFromFile) result = me_global_phi[address];
00522   else result = calcGlobalPhiME(gblphiadd(address));
00523 
00524   return result;
00525 }

gblphidat CSCSectorReceiverLUT::globalPhiME ( int  phi_local,
int  wire_group,
int  cscid 
) const

Definition at line 501 of file CSCSectorReceiverLUT.cc.

References _endcap, _sector, _station, _subsector, calcGlobalPhiME(), CSCSectorReceiverMiniLUT::calcGlobalPhiMEMini(), isTMB07, LUTsFromFile, me_global_phi, global_phi_address::phi_local, HLT_VtxMuL3::result, and useMiniLUTs.

Referenced by L1TCSCTF::analyze(), and globalPhiMB().

00502 {
00503   gblphidat result;
00504   gblphiadd theadd;
00505   theadd.phi_local = phi_local;
00506   theadd.wire_group = ((1<<5)-1)&(wire_group >> 2); // want 2-7 of wg
00507   theadd.cscid = cscid;
00508 
00509   if(useMiniLUTs && isTMB07) result = CSCSectorReceiverMiniLUT::calcGlobalPhiMEMini(_endcap, _sector, _station, _subsector, theadd.toint());
00510   else if(LUTsFromFile) result = me_global_phi[theadd.toint()];
00511   else result = calcGlobalPhiME(theadd);
00512 
00513   return result;
00514 }

lclphidat CSCSectorReceiverLUT::localPhi ( lclphiadd  address  )  const

Definition at line 234 of file CSCSectorReceiverLUT.cc.

References calcLocalPhi(), CSCSectorReceiverMiniLUT::calcLocalPhiMini(), isTMB07, LUTsFromFile, me_lcl_phi, HLT_VtxMuL3::result, and useMiniLUTs.

00235 {
00236   lclphidat result;
00237 
00238   if(useMiniLUTs && isTMB07)
00239     {
00240       result = CSCSectorReceiverMiniLUT::calcLocalPhiMini(address.toint()); 
00241     }
00242   else if(LUTsFromFile) result = me_lcl_phi[address.toint()];
00243   else result = calcLocalPhi(address);
00244 
00245   return result;
00246 }

lclphidat CSCSectorReceiverLUT::localPhi ( unsigned  address  )  const

Definition at line 219 of file CSCSectorReceiverLUT.cc.

References calcLocalPhi(), CSCSectorReceiverMiniLUT::calcLocalPhiMini(), isTMB07, LUTsFromFile, me_lcl_phi, HLT_VtxMuL3::result, and useMiniLUTs.

00220 {
00221   lclphidat result;
00222   lclphiadd theadd(address);
00223   
00224   if(useMiniLUTs && isTMB07)
00225     {
00226       result = CSCSectorReceiverMiniLUT::calcLocalPhiMini(address);
00227     }
00228   else if(LUTsFromFile) result = me_lcl_phi[address];
00229   else result = calcLocalPhi(theadd);
00230 
00231   return result;
00232 }

lclphidat CSCSectorReceiverLUT::localPhi ( int  strip,
int  pattern,
int  quality,
int  lr 
) const

Geometry Lookup Tables.

Please note, the pattern used below is the 4 bit pattern. ex) digi->getPattern(), NOT digi->getCLCTPattern()

Definition at line 204 of file CSCSectorReceiverLUT.cc.

References local_phi_address::strip.

Referenced by L1TCSCTF::analyze().

00206 {
00207   lclphiadd theadd;
00208 
00209   theadd.strip = strip;
00210   theadd.clct_pattern = pattern & 0x7;
00211   theadd.pattern_type = (pattern & 0x8) >> 3;
00212   theadd.quality = quality;
00213   theadd.lr = lr;
00214   theadd.spare = 0;
00215 
00216   return localPhi(theadd);
00217 }

CSCSectorReceiverLUT & CSCSectorReceiverLUT::operator= ( const CSCSectorReceiverLUT lut  ) 

Definition at line 87 of file CSCSectorReceiverLUT.cc.

References _endcap, _sector, _station, _subsector, isBinary, CSCBitWidths::kGlobalEtaAddressWidth, CSCBitWidths::kGlobalPhiAddressWidth, LUTsFromFile, mb_gbl_phi_file, mb_global_phi, me_gbl_eta_file, me_gbl_phi_file, me_global_eta, me_global_phi, me_lcl_phi_file, and NULL.

00088 {
00089   if(this != &lut)
00090     {
00091       _endcap = lut._endcap;
00092       _sector = lut._sector;
00093       _subsector = lut._subsector;
00094       _station = lut._station;
00095       me_lcl_phi_file = lut.me_lcl_phi_file;
00096       me_gbl_phi_file = lut.me_gbl_phi_file;
00097       mb_gbl_phi_file = lut.mb_gbl_phi_file;
00098       me_gbl_eta_file = lut.me_gbl_eta_file;
00099       LUTsFromFile = lut.LUTsFromFile;
00100       isBinary = lut.isBinary;
00101 
00102       if(lut.mb_global_phi)
00103         {
00104           mb_global_phi = new gblphidat[1<<CSCBitWidths::kGlobalPhiAddressWidth];
00105           memcpy(mb_global_phi, lut.mb_global_phi, (1<<CSCBitWidths::kGlobalPhiAddressWidth)*sizeof(gblphidat));
00106         }
00107       else mb_global_phi = NULL;
00108 
00109       if(lut.me_global_phi)
00110         {
00111           me_global_phi = new gblphidat[1<<CSCBitWidths::kGlobalPhiAddressWidth];
00112           memcpy(me_global_phi, lut.me_global_phi, (1<<CSCBitWidths::kGlobalPhiAddressWidth)*sizeof(gblphidat));
00113         }
00114       else me_global_phi = NULL;
00115 
00116       if(lut.me_global_eta)
00117         {
00118           me_global_eta = new gbletadat[1<<CSCBitWidths::kGlobalEtaAddressWidth];
00119           memcpy(me_global_eta, lut.me_global_eta, (1<<CSCBitWidths::kGlobalEtaAddressWidth)*sizeof(gbletadat));
00120         }
00121       else me_global_eta = NULL;
00122     }
00123   return *this;
00124 }

void CSCSectorReceiverLUT::readLUTsFromFile (  )  [private]

Arrays for holding read in LUT information.

MB LUT arrays only initialized in ME1

Definition at line 827 of file CSCSectorReceiverLUT.cc.

References _station, end, edm::FileInPath::fullPath(), i, isBinary, CSCBitWidths::kGlobalEtaAddressWidth, CSCBitWidths::kGlobalPhiAddressWidth, CSCBitWidths::kLocalPhiAddressWidth, mb_gbl_phi_file, mb_global_phi, me_gbl_eta_file, me_gbl_phi_file, me_global_eta, me_global_phi, me_lcl_phi, me_lcl_phi_file, me_lcl_phi_loaded, and pyDBSRunClass::temp.

Referenced by CSCSectorReceiverLUT().

00828 {
00829   if(!me_lcl_phi_loaded)
00830     {
00831       me_lcl_phi = new lclphidat[1<<CSCBitWidths::kLocalPhiAddressWidth];
00832       memset(me_lcl_phi, 0, (1<<CSCBitWidths::kLocalPhiAddressWidth)*sizeof(short));
00833       std::string fName(me_lcl_phi_file.fullPath());
00834       std::ifstream LocalPhiLUT;
00835 
00836       edm::LogInfo("CSCSectorReceiverLUT") << "Loading SR LUT: " << fName;
00837 
00838       if(isBinary)
00839         {
00840           LocalPhiLUT.open(fName.c_str(),std::ios::binary);
00841           LocalPhiLUT.seekg(0,std::ios::end);
00842           int length = LocalPhiLUT.tellg();
00843           if(length == (1<<CSCBitWidths::kLocalPhiAddressWidth)*sizeof(short))
00844             {
00845               LocalPhiLUT.seekg(0,std::ios::beg);
00846               LocalPhiLUT.read(reinterpret_cast<char*>(me_lcl_phi),length);
00847               LocalPhiLUT.close();
00848             }
00849           else
00850             edm::LogError("CSCSectorReceiverLUT") << "File "<< fName << " is incorrect size!";
00851           LocalPhiLUT.close();
00852         }
00853       else
00854         {
00855           LocalPhiLUT.open(fName.c_str());
00856           unsigned i = 0;
00857           unsigned short temp = 0;
00858           while(!LocalPhiLUT.eof() && i < 1<<CSCBitWidths::kLocalPhiAddressWidth)
00859             {
00860               LocalPhiLUT >> temp;
00861               me_lcl_phi[i++] = (*reinterpret_cast<lclphidat*>(&temp));
00862             }
00863           LocalPhiLUT.close();
00864         }
00865     }
00866   if(!me_global_phi)
00867     {
00868       me_global_phi = new gblphidat[1<<CSCBitWidths::kGlobalPhiAddressWidth];
00869       memset(me_global_phi, 0, (1<<CSCBitWidths::kGlobalPhiAddressWidth)*sizeof(short));
00870       std::string fName = me_gbl_phi_file.fullPath();
00871       std::ifstream GlobalPhiLUT;
00872 
00873       edm::LogInfo("CSCSectorReceiverLUT") << "Loading SR LUT: " << fName;
00874 
00875       if(isBinary)
00876         {
00877           GlobalPhiLUT.open(fName.c_str(),std::ios::binary);
00878           GlobalPhiLUT.seekg(0,std::ios::end);
00879           int length = GlobalPhiLUT.tellg();
00880           if(length == (1<<CSCBitWidths::kGlobalPhiAddressWidth)*sizeof(short))
00881             {
00882               GlobalPhiLUT.seekg(0,std::ios::beg);
00883               GlobalPhiLUT.read(reinterpret_cast<char*>(me_global_phi),length);
00884             }
00885           else
00886             edm::LogError("CSCSectorReceiverLUT") << "File "<< fName << " is incorrect size!";
00887           GlobalPhiLUT.close();
00888         }
00889       else
00890         {
00891           GlobalPhiLUT.open( fName.c_str());
00892           unsigned short temp = 0;
00893           unsigned i = 0;
00894           while(!GlobalPhiLUT.eof() && i < 1<<CSCBitWidths::kGlobalPhiAddressWidth)
00895             {
00896               GlobalPhiLUT >> temp;
00897               me_global_phi[i++] = (*reinterpret_cast<gblphidat*>(&temp));
00898             }
00899           GlobalPhiLUT.close();
00900         }
00901     }
00902   if(!mb_global_phi && _station == 1) // MB lut only in station one.
00903     {
00904       mb_global_phi = new gblphidat[1<<CSCBitWidths::kGlobalPhiAddressWidth];
00905       memset(mb_global_phi, 0, (1<<CSCBitWidths::kGlobalPhiAddressWidth)*sizeof(short));
00906       std::string fName = mb_gbl_phi_file.fullPath();
00907       std::ifstream GlobalPhiLUT;
00908 
00909       edm::LogInfo("CSCSectorReceiverLUT") << "Loading SR LUT: " << fName;
00910 
00911       if(isBinary)
00912         {
00913           GlobalPhiLUT.open( fName.c_str(),std::ios::binary);
00914           GlobalPhiLUT.seekg(0,std::ios::end);
00915           int length = GlobalPhiLUT.tellg();
00916           if(length == (1<<CSCBitWidths::kGlobalPhiAddressWidth)*sizeof(short))
00917             {
00918               GlobalPhiLUT.seekg(0,std::ios::beg);
00919               GlobalPhiLUT.read(reinterpret_cast<char*>(mb_global_phi),length);
00920             }
00921           else
00922             edm::LogError("CSCSectorReceiverLUT") << "File "<< fName << " is incorrect size!";
00923           GlobalPhiLUT.close();
00924         }
00925       else
00926         {
00927           GlobalPhiLUT.open(fName.c_str());
00928           unsigned short temp = 0;
00929           unsigned i = 0;
00930           while(!GlobalPhiLUT.eof() && i < 1<<CSCBitWidths::kGlobalPhiAddressWidth)
00931             {
00932               GlobalPhiLUT >> temp;
00933               mb_global_phi[i++] = (*reinterpret_cast<gblphidat*>(&temp));
00934             }
00935           GlobalPhiLUT.close();
00936         }
00937     }
00938   if(!me_global_eta)
00939     {
00940       me_global_eta = new gbletadat[1<<CSCBitWidths::kGlobalEtaAddressWidth];
00941       memset(me_global_eta, 0, (1<<CSCBitWidths::kGlobalEtaAddressWidth)*sizeof(short));
00942       std::string fName = me_gbl_eta_file.fullPath();
00943       std::ifstream GlobalEtaLUT;
00944 
00945       edm::LogInfo("CSCSectorReceiverLUT") << "Loading SR LUT: " << fName;
00946 
00947       if(isBinary)
00948         {
00949           GlobalEtaLUT.open(fName.c_str(),std::ios::binary);
00950           GlobalEtaLUT.seekg(0,std::ios::end);
00951           int length = GlobalEtaLUT.tellg();
00952           if(length == (1<<CSCBitWidths::kGlobalEtaAddressWidth)*sizeof(short))
00953             {
00954               GlobalEtaLUT.seekg(0,std::ios::beg);
00955               GlobalEtaLUT.read(reinterpret_cast<char*>(me_global_eta),length);
00956             }
00957           else
00958             edm::LogError("CSCSectorReceiverLUT") << "File "<< fName << " is incorrect size!";
00959           GlobalEtaLUT.close();
00960         }
00961       else
00962         {
00963           GlobalEtaLUT.open(fName.c_str());
00964           unsigned short temp = 0;
00965           unsigned i = 0;
00966           while(!GlobalEtaLUT.eof() && i < 1<<CSCBitWidths::kGlobalEtaAddressWidth)
00967           {
00968             GlobalEtaLUT >> temp;
00969             me_global_eta[i++] = (*reinterpret_cast<gbletadat*>(&temp));
00970           }
00971           GlobalEtaLUT.close();
00972         }
00973     }
00974 }


Member Data Documentation

int CSCSectorReceiverLUT::_endcap [private]

Definition at line 52 of file CSCSectorReceiverLUT.h.

Referenced by calcGlobalPhiME(), calcLocalPhi(), encodeFileIndex(), getGlobalEtaValue(), globalEtaME(), globalPhiMB(), globalPhiME(), and operator=().

int CSCSectorReceiverLUT::_sector [private]

Definition at line 52 of file CSCSectorReceiverLUT.h.

Referenced by calcGlobalEtaME(), calcGlobalPhiME(), encodeFileIndex(), getGlobalEtaValue(), globalEtaME(), globalPhiMB(), globalPhiME(), and operator=().

int CSCSectorReceiverLUT::_station [private]

Definition at line 52 of file CSCSectorReceiverLUT.h.

Referenced by calcGlobalEtaME(), calcGlobalPhiME(), calcLocalPhi(), encodeFileIndex(), getGlobalEtaValue(), globalEtaME(), globalPhiME(), operator=(), and readLUTsFromFile().

int CSCSectorReceiverLUT::_subsector [private]

Definition at line 52 of file CSCSectorReceiverLUT.h.

Referenced by calcGlobalPhiMB(), calcGlobalPhiME(), encodeFileIndex(), getGlobalEtaValue(), globalEtaME(), globalPhiMB(), globalPhiME(), and operator=().

bool CSCSectorReceiverLUT::isBinary [private]

Definition at line 74 of file CSCSectorReceiverLUT.h.

Referenced by CSCSectorReceiverLUT(), operator=(), and readLUTsFromFile().

bool CSCSectorReceiverLUT::isTMB07 [private]

Definition at line 76 of file CSCSectorReceiverLUT.h.

Referenced by calcGlobalPhiME(), calcLocalPhi(), globalEtaME(), globalPhiMB(), globalPhiME(), and localPhi().

bool CSCSectorReceiverLUT::LUTsFromFile [private]

Definition at line 72 of file CSCSectorReceiverLUT.h.

Referenced by CSCSectorReceiverLUT(), globalEtaME(), globalPhiMB(), globalPhiME(), localPhi(), and operator=().

edm::FileInPath CSCSectorReceiverLUT::mb_gbl_phi_file [private]

Definition at line 70 of file CSCSectorReceiverLUT.h.

Referenced by CSCSectorReceiverLUT(), operator=(), and readLUTsFromFile().

gblphidat * CSCSectorReceiverLUT::mb_global_phi [private]

Definition at line 84 of file CSCSectorReceiverLUT.h.

Referenced by CSCSectorReceiverLUT(), globalPhiMB(), operator=(), readLUTsFromFile(), and ~CSCSectorReceiverLUT().

edm::FileInPath CSCSectorReceiverLUT::me_gbl_eta_file [private]

Definition at line 71 of file CSCSectorReceiverLUT.h.

Referenced by CSCSectorReceiverLUT(), operator=(), and readLUTsFromFile().

edm::FileInPath CSCSectorReceiverLUT::me_gbl_phi_file [private]

Definition at line 69 of file CSCSectorReceiverLUT.h.

Referenced by CSCSectorReceiverLUT(), operator=(), and readLUTsFromFile().

gbletadat* CSCSectorReceiverLUT::me_global_eta [private]

Definition at line 85 of file CSCSectorReceiverLUT.h.

Referenced by CSCSectorReceiverLUT(), globalEtaME(), operator=(), readLUTsFromFile(), and ~CSCSectorReceiverLUT().

gblphidat* CSCSectorReceiverLUT::me_global_phi [private]

Definition at line 84 of file CSCSectorReceiverLUT.h.

Referenced by CSCSectorReceiverLUT(), globalPhiME(), operator=(), readLUTsFromFile(), and ~CSCSectorReceiverLUT().

lclphidat * CSCSectorReceiverLUT::me_lcl_phi = NULL [static, private]

Definition at line 83 of file CSCSectorReceiverLUT.h.

Referenced by localPhi(), readLUTsFromFile(), and ~CSCSectorReceiverLUT().

edm::FileInPath CSCSectorReceiverLUT::me_lcl_phi_file [private]

Definition at line 68 of file CSCSectorReceiverLUT.h.

Referenced by CSCSectorReceiverLUT(), operator=(), and readLUTsFromFile().

bool CSCSectorReceiverLUT::me_lcl_phi_loaded = false [static, private]

Definition at line 82 of file CSCSectorReceiverLUT.h.

Referenced by readLUTsFromFile(), and ~CSCSectorReceiverLUT().

bool CSCSectorReceiverLUT::useMiniLUTs [private]

Definition at line 73 of file CSCSectorReceiverLUT.h.

Referenced by CSCSectorReceiverLUT(), globalEtaME(), globalPhiMB(), globalPhiME(), and localPhi().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:25 2009 for CMSSW by  doxygen 1.5.4