CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DataFormats/L1CSCTrackFinder/src/TrackStub.cc

Go to the documentation of this file.
00001 #include <DataFormats/L1CSCTrackFinder/interface/TrackStub.h>
00002 #include <DataFormats/L1CSCTrackFinder/interface/CSCBitWidths.h>
00003 #include <DataFormats/MuonDetId/interface/CSCTriggerNumbering.h>
00004 #include <DataFormats/MuonDetId/interface/DTChamberId.h>
00005 #include <DataFormats/MuonDetId/interface/CSCDetId.h>
00006 #include <DataFormats/MuonDetId/interface/MuonSubdetId.h>
00007 
00008 namespace csctf
00009 {
00010 
00011   const double TrackStub::thePhiBinning = CSCTFConstants::SECTOR_RAD/(1<<CSCBitWidths::kGlobalPhiDataBitWidth);
00012   const double TrackStub::theEtaBinning = (CSCTFConstants::maxEta - CSCTFConstants::minEta)/(CSCTFConstants::etaBins);
00013 
00014   TrackStub::TrackStub(const CSCCorrelatedLCTDigi& aDigi,
00015                        const DetId& aDetId): CSCCorrelatedLCTDigi(aDigi),
00016                                              theDetId_(aDetId.rawId()),
00017                                              thePhi_(0),
00018                                              theEta_(0),
00019                                              link_(0)
00020   {}
00021 
00022   TrackStub::TrackStub(const CSCCorrelatedLCTDigi& aDigi,
00023                        const DetId& aDetId,
00024                        const unsigned& phi, const unsigned& eta): CSCCorrelatedLCTDigi(aDigi),
00025                                                                   theDetId_(aDetId.rawId()),
00026                                                                   thePhi_(phi),
00027                                                                   theEta_(eta),
00028                                                                   link_(0)
00029   {}
00030 
00031 
00032 
00033   TrackStub::TrackStub(const TrackStub& aTrackStub): CSCCorrelatedLCTDigi(aTrackStub),
00034                                                      theDetId_(aTrackStub.theDetId_),
00035                                                      thePhi_(aTrackStub.thePhi_),
00036                                                      theEta_(aTrackStub.theEta_),
00037                                                      link_(aTrackStub.link_)
00038   {}
00039 
00040   unsigned TrackStub::endcap() const
00041   {
00042     int e = 0;
00043 
00044     switch(DetId(theDetId_).subdetId())
00045       {
00046       case (MuonSubdetId::DT):
00047         e = (DTChamberId(theDetId_).wheel() > 0) ? 1 : 2;
00048         break;
00049       case (MuonSubdetId::CSC):
00050         e = CSCDetId(theDetId_).endcap();
00051         break;
00052       default:
00053         break;
00054       }
00055 
00056     return e;
00057   }
00058 
00059   unsigned TrackStub::station() const
00060   {
00061     int s = 0;
00062 
00063     switch(DetId(theDetId_).subdetId())
00064       {
00065       case (MuonSubdetId::DT):
00066         s = DTChamberId(theDetId_).station() + 4;
00067         break;
00068       case (MuonSubdetId::CSC):
00069         s = CSCDetId(theDetId_).station();
00070         break;
00071       default:
00072         break;
00073       }
00074 
00075     return s;
00076   }
00077 
00078   unsigned TrackStub::sector() const
00079   {
00080     int se = 0, temps = 0;
00081 
00082     switch(DetId(theDetId_).subdetId())
00083       {
00084       case (MuonSubdetId::DT): {
00085         temps = DTChamberId(theDetId_).sector();
00086         const unsigned int dt2csc[12] = {6,1,1,2,2,3,3,4,4,5,5,6};
00087         se = dt2csc[temps-1]; }
00088         break;
00089       case (MuonSubdetId::CSC):
00090         se = CSCTriggerNumbering::triggerSectorFromLabels(CSCDetId(theDetId_));
00091         break;
00092       default:
00093         break;
00094       }
00095 
00096     return se;
00097   }
00098 
00099   unsigned TrackStub::subsector() const
00100   {
00101     int ss = 0;
00102 
00103     switch(DetId(theDetId_).subdetId())
00104       {
00105       case (MuonSubdetId::DT): {
00106         ss = DTChamberId(theDetId_).sector();
00107         const unsigned int dt2csc_[12] = {2,1,2,1,2,1,2,1,2,1,2,1};
00108         ss = dt2csc_[ss-1]; }
00109         break;
00110       case (MuonSubdetId::CSC):
00111         ss = CSCTriggerNumbering::triggerSubSectorFromLabels(CSCDetId(theDetId_));
00112         break;
00113       default:
00114         break;
00115       }
00116 
00117     return ss;
00118   }
00119 
00120   unsigned TrackStub::cscid() const
00121   {
00122     if(DetId(theDetId_).subdetId() == MuonSubdetId::CSC)
00123       return CSCTriggerNumbering::triggerCscIdFromLabels(CSCDetId(theDetId_));
00124 
00125     return 0; // DT chambers obviously don't have a csc id :-D
00126   }
00127 
00128   unsigned TrackStub::cscidSeparateME1a() const
00129   {
00130     if(DetId(theDetId_).subdetId() != MuonSubdetId::CSC) return 0;
00131     CSCDetId id(theDetId_);
00132     unsigned normal_cscid = CSCTriggerNumbering::triggerCscIdFromLabels(id);
00133     if (id.station()==1 && id.ring()==4) return normal_cscid + 9; // 10,11,12 for ME1a
00134     return normal_cscid;
00135   }
00136 
00137   bool TrackStub::operator<(const TrackStub& rhs) const
00138   {
00139     return ( rhs.isValid() && ( (!(isValid())) || (getQuality() < rhs.getQuality()) ||
00140                                 (getQuality() == rhs.getQuality() && cscid() < rhs.cscid()) ||
00141                               (getQuality() == rhs.getQuality() && cscid() == rhs.cscid() &&
00142                                (getTrknmb() == 2)) ) );
00143   }
00144 
00145   bool TrackStub::operator>(const TrackStub& rhs) const
00146   {
00147     return ( isValid() && ( (!(rhs.isValid())) || (getQuality() > rhs.getQuality()) ||
00148                             (getQuality() == rhs.getQuality() && cscid() > rhs.cscid()) ||
00149                             (getQuality() == rhs.getQuality() && cscid() == rhs.cscid() &&
00150                              (getTrknmb() == 1)) ) );
00151   }
00152 
00153 }