Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:25

0001 #include <DataFormats/L1CSCTrackFinder/interface/TrackStub.h>
0002 #include <DataFormats/L1CSCTrackFinder/interface/CSCBitWidths.h>
0003 #include <DataFormats/MuonDetId/interface/CSCTriggerNumbering.h>
0004 #include <DataFormats/MuonDetId/interface/DTChamberId.h>
0005 #include <DataFormats/MuonDetId/interface/CSCDetId.h>
0006 #include <DataFormats/MuonDetId/interface/MuonSubdetId.h>
0007 
0008 namespace csctf {
0009 
0010   const double TrackStub::thePhiBinning = CSCTFConstants::SECTOR_RAD / (1 << CSCBitWidths::kGlobalPhiDataBitWidth);
0011   const double TrackStub::theEtaBinning = (CSCTFConstants::maxEta - CSCTFConstants::minEta) / (CSCTFConstants::etaBins);
0012 
0013   TrackStub::TrackStub(const CSCCorrelatedLCTDigi& aDigi, const DetId& aDetId)
0014       : CSCCorrelatedLCTDigi(aDigi), theDetId_(aDetId.rawId()), thePhi_(0), theEta_(0), link_(0) {}
0015 
0016   TrackStub::TrackStub(const CSCCorrelatedLCTDigi& aDigi, const DetId& aDetId, const unsigned& phi, const unsigned& eta)
0017       : CSCCorrelatedLCTDigi(aDigi), theDetId_(aDetId.rawId()), thePhi_(phi), theEta_(eta), link_(0) {}
0018 
0019   unsigned TrackStub::endcap() const {
0020     int e = 0;
0021 
0022     switch (DetId(theDetId_).subdetId()) {
0023       case (MuonSubdetId::DT):
0024         e = (DTChamberId(theDetId_).wheel() > 0) ? 1 : 2;
0025         break;
0026       case (MuonSubdetId::CSC):
0027         e = CSCDetId(theDetId_).endcap();
0028         break;
0029       default:
0030         break;
0031     }
0032 
0033     return e;
0034   }
0035 
0036   unsigned TrackStub::station() const {
0037     int s = 0;
0038 
0039     switch (DetId(theDetId_).subdetId()) {
0040       case (MuonSubdetId::DT):
0041         s = DTChamberId(theDetId_).station() + 4;
0042         break;
0043       case (MuonSubdetId::CSC):
0044         s = CSCDetId(theDetId_).station();
0045         break;
0046       default:
0047         break;
0048     }
0049 
0050     return s;
0051   }
0052 
0053   unsigned TrackStub::sector() const {
0054     int se = 0, temps = 0;
0055 
0056     switch (DetId(theDetId_).subdetId()) {
0057       case (MuonSubdetId::DT): {
0058         temps = DTChamberId(theDetId_).sector();
0059         const unsigned int dt2csc[12] = {6, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6};
0060         se = dt2csc[temps - 1];
0061       } break;
0062       case (MuonSubdetId::CSC):
0063         se = CSCTriggerNumbering::triggerSectorFromLabels(CSCDetId(theDetId_));
0064         break;
0065       default:
0066         break;
0067     }
0068 
0069     return se;
0070   }
0071 
0072   unsigned TrackStub::subsector() const {
0073     int ss = 0;
0074 
0075     switch (DetId(theDetId_).subdetId()) {
0076       case (MuonSubdetId::DT): {
0077         ss = DTChamberId(theDetId_).sector();
0078         const unsigned int dt2csc_[12] = {2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1};
0079         ss = dt2csc_[ss - 1];
0080       } break;
0081       case (MuonSubdetId::CSC):
0082         ss = CSCTriggerNumbering::triggerSubSectorFromLabels(CSCDetId(theDetId_));
0083         break;
0084       default:
0085         break;
0086     }
0087 
0088     return ss;
0089   }
0090 
0091   unsigned TrackStub::cscid() const {
0092     if (DetId(theDetId_).subdetId() == MuonSubdetId::CSC)
0093       return CSCTriggerNumbering::triggerCscIdFromLabels(CSCDetId(theDetId_));
0094 
0095     return 0;  // DT chambers obviously don't have a csc id :-D
0096   }
0097 
0098   unsigned TrackStub::cscidSeparateME1a() const {
0099     if (DetId(theDetId_).subdetId() != MuonSubdetId::CSC)
0100       return 0;
0101     CSCDetId id(theDetId_);
0102     unsigned normal_cscid = CSCTriggerNumbering::triggerCscIdFromLabels(id);
0103     if (id.station() == 1 && id.ring() == 4)
0104       return normal_cscid + 9;  // 10,11,12 for ME1a
0105     return normal_cscid;
0106   }
0107 
0108   bool TrackStub::operator<(const TrackStub& rhs) const {
0109     return (rhs.isValid() && ((!(isValid())) || (getQuality() < rhs.getQuality()) ||
0110                               (getQuality() == rhs.getQuality() && cscid() < rhs.cscid()) ||
0111                               (getQuality() == rhs.getQuality() && cscid() == rhs.cscid() && (getTrknmb() == 2))));
0112   }
0113 
0114   bool TrackStub::operator>(const TrackStub& rhs) const {
0115     return (isValid() && ((!(rhs.isValid())) || (getQuality() > rhs.getQuality()) ||
0116                           (getQuality() == rhs.getQuality() && cscid() > rhs.cscid()) ||
0117                           (getQuality() == rhs.getQuality() && cscid() == rhs.cscid() && (getTrknmb() == 1))));
0118   }
0119 
0120 }  // namespace csctf