Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:39:23

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