Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-10-19 23:19:08

0001 #ifndef L1TMUONPHASE2_PHASE2GMT_CONSTANTS
0002 #define L1TMUONPHASE2_PHASE2GMT_CONSTANTS
0003 
0004 #include "ap_int.h"
0005 
0006 namespace Phase2L1GMT {
0007 
0008   // INPUT Dataformat
0009   // Track
0010   const int BITSTTCURV = 15;
0011   const int BITSTTCURV2 = 27;
0012   const int BITSTTPHI = 12;
0013   const int BITSTTTANL = 16;
0014   // Not used in the emulator now, but will in future
0015   const int BITSTTZ0 = 12;
0016   const int BITSTTD0 = 13;
0017   const int BITSTTCHI2 = 4;
0018   const int BITSTTBENDCHI2 = 3;
0019   const int BITSTTMASK = 7;
0020   const int BITSTTTRACKMVA = 3;
0021   const int BITSTTOTHERMVA = 6;
0022 
0023   // Bitwidth for common internal variables in GMT
0024   const int BITSPT = 13;
0025   const int BITSPHI = 13;
0026   const int BITSETA = 13;
0027   const int BITSZ0 = 10;
0028   const int BITSD0 = 12;
0029 
0030   //Muon ROI
0031   const int BITSSTUBCOORD = 8;
0032   const int BITSSTUBETA = 8;
0033   const int BITSSTUBID = 9;
0034   const int BITSSTUBPHIQUALITY = 4;
0035   const int BITSSTUBETAQUALITY = 4;
0036   const int BITSSTUBTIME = 8;
0037   const int BITSSTAMUONQUALITY = 6;
0038   const int BITSMUONBX = 4;
0039 
0040   //PreTrackMatherdMuon
0041   const int BITSMATCHQUALITY = 9;
0042   const int BITSMUONBETA = 4;
0043 
0044   //Track Muon Match
0045   const int BITSSIGMAETA = 4;
0046   const int BITSSIGMACOORD = 4;
0047   const int BITSPROPCOORD = 9;
0048   const int BITSPROPSIGMACOORD_A = 5;
0049   const int BITSPROPSIGMACOORD_B = 5;
0050   const int BITSPROPSIGMAETA_A = 5;
0051   const int BITSPROPSIGMAETA_B = 5;
0052 
0053   // OUTPUT Dataformat
0054   // Bitwidth for standalone muons to CL1 and GT
0055   const int BITSSAZ0 = 5;
0056   const int BITSSAD0 = 7;
0057   const int BITSSAQUALITY = 4;
0058 
0059   // Bitwidth for dataformat to GT
0060   const int BITSGTPT = 16;
0061   const int BITSGTPHI = 13;
0062   const int BITSGTETA = 14;
0063   const int BITSGTZ0 = 10;
0064   const int BITSGTD0 = 10;
0065   const int BITSGTQUALITY = 8;
0066   const int BITSGTISO = 4;
0067 
0068   const float maxCurv_ = 0.00855;  // 2 GeV pT Rinv is in cm
0069   const float maxPhi_ = 1.026;     // relative to the center of the sector
0070   const float maxTanl_ = 8.0;
0071   const float maxZ0_ = 30.;
0072   const float maxD0_ = 15.4;
0073   // Updated barrelLimit according to Karol, https://indico.cern.ch/event/1113802/#1-phase2-gmt-performance-and-i
0074   const int barrelLimit0_ = 1.4 / 0.00076699039 / 8;
0075   const int barrelLimit1_ = 1.1 / 0.00076699039 / 8;
0076   const int barrelLimit2_ = 0.95 / 0.00076699039 / 8;
0077   const int barrelLimit3_ = 0.95 / 0.00076699039 / 8;
0078   const int barrelLimit4_ = 0;
0079 
0080   // LSB
0081   const float LSBpt = 0.03125;
0082   const float LSBphi = 2. * M_PI / pow(2, BITSPHI);
0083   const float LSBeta = 2. * M_PI / pow(2, BITSETA);
0084   const float LSBGTz0 = 2. * maxZ0_ / pow(2, BITSZ0);
0085   const float LSBGTd0 = 2. * maxD0_ / pow(2, BITSD0);
0086   const float LSBSAz0 = 1.875;
0087   const float LSBSAd0 = 3.85;
0088 
0089   typedef ap_uint<64> wordtype;
0090 
0091   inline uint64_t twos_complement(long long int v, uint bits) {
0092     uint64_t mask = (1 << bits) - 1;
0093     if (v >= 0)
0094       return v & mask;
0095     else
0096       return (~(-v) + 1) & mask;
0097   }
0098 
0099   template <class T>
0100   inline int wordconcat(T& word, int bstart, long int input, int bitsize) {
0101     int bend = bstart + bitsize - 1;
0102     word.range(bend, bstart) = twos_complement(input, bitsize);
0103     return bend + 1;
0104   }
0105 
0106 }  // namespace Phase2L1GMT
0107 #endif