Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-07 02:12:40

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;  // changed since DT tpg now centers around zero //abs(dt_maxBX - dt_minBX);
0021 
0022   // consider all BX
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;  //Delay DT stubs by the central LCT bx.
0029 
0030         // combine two 30 degree DT sectors into a 60 degree CSC
0031         // sector.
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               // IKF: this code has been reformulated ...
0041               // --------------------------------------------------------------
0042               // // Convert stubs to CSC format (signed -> unsigned)
0043               // // phi was 12 bits (signed) for pi radians = 57.3 deg
0044               // // relative to center of 30 degree DT sector
0045               // double tmp = static_cast<const double> (dtts[stub]->phi()) /
0046               //    DTConfigTraco::RESOLPSIR * 180./M_PI + 15.;
0047               // int phi = static_cast<int> (tmp/62. * (1<<(CSCBitWidths::kGlobalPhiDataBitWidth)));
0048               // --------------------------------------------------------------
0049               // IKF  ...and is now this line, actually works a tiny bit better.
0050               // --------------------------------------------------------------
0051               //              float tmp = dtts[stub] -> phi() * 1.0;
0052               //
0053               //              tmp *= 90.0;
0054               //              tmp /= 31.0;
0055               //              //              tmp /= M_PI;
0056               //              tmp /= 3.1416;
0057               //              tmp += 1057.0;
0058               //
0059               //              int phi = static_cast<int> (tmp);
0060 
0061               // --------------------------------------------------------------
0062               // IKF  ...and is now this line, actually works a tiny bit better.
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               // DT chambers may lie outside CSC sector boundary
0083               // Eventually we need to extend CSC phi definition
0084               // --------------------------------------------------------------
0085               // IKF: this is a protection, physically can't happen in data (bus too narrow) -
0086               // - what really happens in data?
0087               // --------------------------------------------------------------
0088 
0089               phi = (phi > 0) ? phi : 0;
0090               phi = (phi < (1 << (CSCBitWidths::kGlobalPhiDataBitWidth)))
0091                         ? phi
0092                         : (1 << (CSCBitWidths::kGlobalPhiDataBitWidth)) - 1;
0093 
0094               // change phib from 10 bits to 5
0095               int phib = ((dtts[stub]->phiB() & 0x3FF) >> 5) & 0x1F;  // 0x3FF=1023, 0x1F=31
0096               int qual = dtts[stub]->code();
0097               // barrel allows quality=0!
0098               /// shift all by one and take mod 8, since DT quality of 7 is a null stub
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 }