Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:39

0001 // Class to store the 128-bit TkTriplet word for L1 Track Trigger.
0002 // Author: George Krathanasis, CU Boulder (December 2023)
0003 
0004 #include "DataFormats/L1Trigger/interface/TkTripletWord.h"
0005 
0006 namespace l1t {
0007   TkTripletWord::TkTripletWord(valid_t valid,
0008                                pt_t pt,
0009                                glbeta_t eta,
0010                                glbphi_t phi,
0011                                mass_t mass,
0012                                charge_t charge,
0013                                ditrack_minmass_t ditrack_minmass,
0014                                ditrack_maxmass_t ditrack_maxmass,
0015                                ditrack_minz0_t ditrack_minz0,
0016                                ditrack_maxz0_t ditrack_maxz0,
0017                                unassigned_t unassigned) {
0018     setTkTripletWord(
0019         valid, pt, eta, phi, mass, charge, ditrack_minmass, ditrack_maxmass, ditrack_minz0, ditrack_maxz0, unassigned);
0020   }
0021 
0022   template <class packVarType>
0023   inline void TkTripletWord::packIntoWord(unsigned int& currentOffset,
0024                                           unsigned int wordChunkSize,
0025                                           packVarType& packVar) {
0026     for (unsigned int b = currentOffset; b < (currentOffset + wordChunkSize); ++b) {
0027       tkTripletWord_.set(b, packVar[b - currentOffset]);
0028     }
0029     currentOffset += wordChunkSize;
0030   }
0031 
0032   void TkTripletWord::setTkTripletWord(valid_t valid,
0033                                        pt_t pt,
0034                                        glbeta_t eta,
0035                                        glbphi_t phi,
0036                                        mass_t mass,
0037                                        charge_t charge,
0038                                        ditrack_minmass_t ditrack_minmass,
0039                                        ditrack_maxmass_t ditrack_maxmass,
0040                                        ditrack_minz0_t ditrack_minz0,
0041                                        ditrack_maxz0_t ditrack_maxz0,
0042                                        unassigned_t unassigned) {
0043     // pack the TkTriplet word
0044     unsigned int offset = 0;
0045     packIntoWord(offset, TkTripletBitWidths::kValidSize, valid);
0046     packIntoWord(offset, TkTripletBitWidths::kPtSize, pt);
0047     packIntoWord(offset, TkTripletBitWidths::kGlbPhiSize, phi);
0048     packIntoWord(offset, TkTripletBitWidths::kGlbEtaSize, eta);
0049     packIntoWord(offset, TkTripletBitWidths::kMassSize, mass);
0050     packIntoWord(offset, TkTripletBitWidths::kChargeSize, charge);
0051     packIntoWord(offset, TkTripletBitWidths::kDiTrackMinMassSize, ditrack_minmass);
0052     packIntoWord(offset, TkTripletBitWidths::kDiTrackMaxMassSize, ditrack_maxmass);
0053     packIntoWord(offset, TkTripletBitWidths::kDiTrackMinZ0Size, ditrack_minz0);
0054     packIntoWord(offset, TkTripletBitWidths::kDiTrackMaxZ0Size, ditrack_maxz0);
0055   }
0056 
0057 }  //namespace l1t