File indexing completed on 2024-04-06 12:19:29
0001 #include "L1Trigger/CSCTrackFinder/interface/CSCTFDTReceiver.h"
0002 #include "L1Trigger/DTTrackFinder/interface/L1MuDTTFConfig.h"
0003 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigTraco.h"
0004 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0005 #include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h"
0006 #include "DataFormats/L1CSCTrackFinder/interface/CSCBitWidths.h"
0007 #include "DataFormats/CSCDigi/interface/CSCConstants.h"
0008 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
0009
0010 #include "L1Trigger/CSCTrackFinder/src/CSCTFDTReceiverLUT.h"
0011
0012 CSCTriggerContainer<csctf::TrackStub> CSCTFDTReceiver::process(const L1MuDTChambPhContainer* dttrig) {
0013 dtstubs.clear();
0014 if (!dttrig)
0015 return dtstubs;
0016
0017 const int dt_minBX = L1MuDTTFConfig::getBxMinGlobally();
0018 const int dt_maxBX = L1MuDTTFConfig::getBxMaxGlobally();
0019
0020 const int dt_toffs = 0;
0021
0022
0023 for (int bx = dt_minBX + dt_toffs; bx <= dt_maxBX + dt_toffs; ++bx)
0024 for (int e = CSCDetId::minEndcapId(); e <= CSCDetId::maxEndcapId(); ++e)
0025 for (int s = CSCTriggerNumbering::minTriggerSectorId(); s <= CSCTriggerNumbering::maxTriggerSectorId(); ++s) {
0026 int wheel = (e == 1) ? 2 : -2;
0027 int sector = 2 * s - 1;
0028 int csc_bx = bx + CSCConstants::LCT_CENTRAL_BX;
0029
0030
0031
0032 for (int is = sector; is <= sector + 1; ++is) {
0033 int iss = (is == 12) ? 0 : is;
0034 const L1MuDTChambPhDigi* dtts[2];
0035
0036 for (int stub = 0; stub < 2; ++stub) {
0037 dtts[stub] = (stub == 0) ? dttrig->chPhiSegm1(wheel, 1, iss, bx) : dttrig->chPhiSegm2(wheel, 1, iss, bx);
0038 if (dtts[stub]) {
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064 int phi = dtts[stub]->phi();
0065
0066 if (phi < 0)
0067 phi += 4096;
0068
0069 if (phi > 4096) {
0070 std::cout << "AAAAAAAAAAGH TOO BIG PHI:" << phi << std::endl;
0071 continue;
0072 }
0073 if (phi < 0) {
0074 std::cout << "AAAAAAAAH NEG PHI" << phi << std::endl;
0075 continue;
0076 }
0077
0078 phi = CSCTFDTReceiverLUT::lut[phi];
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089 phi = (phi > 0) ? phi : 0;
0090 phi = (phi < (1 << (CSCBitWidths::kGlobalPhiDataBitWidth)))
0091 ? phi
0092 : (1 << (CSCBitWidths::kGlobalPhiDataBitWidth)) - 1;
0093
0094
0095 int phib = ((dtts[stub]->phiB() & 0x3FF) >> 5) & 0x1F;
0096 int qual = dtts[stub]->code();
0097
0098
0099 qual = (qual + 1) % 8;
0100
0101 CSCCorrelatedLCTDigi dtinfo(stub + 1, 1, qual, 0, stub, 0, phib, csc_bx + stub, 1 + (is + 1) % 2);
0102 DTChamberId dtid(wheel, 1, iss + 1);
0103 csctf::TrackStub tsCSC(dtinfo, dtid, phi, 0);
0104
0105 dtstubs.push_back(tsCSC);
0106 }
0107 }
0108 }
0109 }
0110
0111 return dtstubs;
0112 }