Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-16 02:42:43

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 = 10;
0032   const int BITSSTUBETA = 8;
0033   const int BITSSTUBID = 12;
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 = 6;
0049   const int BITSPROPSIGMACOORD_B = 6;
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 BITSSAQUAL = 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 BITSGTQUAL = 6;
0066   const int BITSGTQUALSC = 7;
0067   const int BITSGTISO = 6;
0068   const int BITSGTBETA = 4;
0069 
0070   // Bitwidth for Tau->3mu object
0071   const int BITSTMPT = 8;
0072   const int BITSTMPHI = 8;
0073   const int BITSTMETA = 8;
0074   const int BITSTMMASS2 = 8;
0075   const int BITSTMTYPE = 6;
0076   const int BITSTMIDX = 4;
0077   const int BITSTMQUAL = 4;
0078 
0079   const float maxCurv_ = 0.00855;  // 2 GeV pT Rinv is in cm
0080   const float maxPhi_ = 1.026;     // relative to the center of the sector
0081   const float maxTanl_ = 8.0;
0082   const float maxZ0_ = 25.6;
0083   const float maxD0_ = 15.36;
0084   // Updated barrelLimit according to Karol, https://indico.cern.ch/event/1113802/#1-phase2-gmt-performance-and-i
0085   const int barrelLimit0_ = 1.4 / 0.00076699039 / 8;
0086   const int barrelLimit1_ = 1.1 / 0.00076699039 / 8;
0087   const int barrelLimit2_ = 0.95 / 0.00076699039 / 8;
0088   const int barrelLimit3_ = 0.95 / 0.00076699039 / 8;
0089   const int barrelLimit4_ = 0;
0090 
0091   // LSB
0092   const float LSBpt = 0.03125;
0093   const float LSBphi = 2. * M_PI / pow(2, BITSPHI);
0094   const float LSBeta = 2. * M_PI / pow(2, BITSETA);
0095   const float LSBGTiso = 0.25;  // 0.25GeV, LSBphi * 8
0096   const float LSBGTz0 = 0.05;   // 0.5mm, in sync with GTT and Correlator
0097   const float LSBGTd0 = 0.03;   // from GT interface doc
0098   const float LSBSAz0 = 1.6;    // 0.05 * 32 cm, with range +- 25.6
0099   const float LSBSAd0 = 3.84;   // 0.03 * 128 cm, with range +- 245.76
0100 
0101   typedef ap_uint<64> wordtype;
0102   typedef ap_uint<1> valid_gt_t;             //valid
0103   typedef ap_uint<1> q_gt_t;                 //charge
0104   typedef ap_uint<BITSGTPT> pt_gt_t;         //pt        of tracker muon
0105   typedef ap_int<BITSGTPHI> phi_gt_t;        //phi       of tracker muon
0106   typedef ap_int<BITSGTETA> eta_gt_t;        //eta       of tracker muon
0107   typedef ap_int<BITSGTZ0> z0_gt_t;          //z0        of tracker muon
0108   typedef ap_int<BITSGTD0> d0_gt_t;          //d0        of tracker muon
0109   typedef ap_uint<BITSGTISO> iso_gt_t;       //isolation of tracker muon
0110   typedef ap_uint<BITSGTBETA> beta_gt_t;     //beta      of tracker muon
0111   typedef ap_uint<BITSGTQUAL> qual_gt_t;     //quality   of tracker muon
0112   typedef ap_int<BITSGTQUALSC> qualsc_gt_t;  //quality score of tracker muon (qual/q)
0113 
0114   //Standalone muon datatype
0115   typedef ap_uint<1> valid_sa_t;          //valid
0116   typedef ap_uint<BITSGTPT> pt_sa_t;      //pt      of standalone muon
0117   typedef ap_int<BITSGTPHI> phi_sa_t;     //phi     of standalone muon
0118   typedef ap_int<BITSGTETA> eta_sa_t;     //eta     of standalone muon
0119   typedef ap_int<BITSSAZ0> z0_sa_t;       //z0      of standalone muon
0120   typedef ap_int<BITSSAD0> d0_sa_t;       //d0      of standalone muon
0121   typedef ap_uint<1> q_sa_t;              //charge  of standalone muon
0122   typedef ap_uint<BITSSAQUAL> qual_sa_t;  //quality of standalone muon
0123 
0124   inline uint64_t twos_complement(long long int v, uint bits) {
0125     uint64_t mask = (1 << bits) - 1;
0126     if (v >= 0)
0127       return v & mask;
0128     else
0129       return (~(-v) + 1) & mask;
0130   }
0131 
0132   template <class T>
0133   inline int wordconcat(T& word, int bstart, long int input, int bitsize) {
0134     int bend = bstart + bitsize - 1;
0135     word.range(bend, bstart) = twos_complement(input, bitsize);
0136     return bend + 1;
0137   }
0138 
0139 }  // namespace Phase2L1GMT
0140 #endif