Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 ////////
0002 //
0003 // class to store the 96-bit track word produced by the L1 Track Trigger.  Intended to be inherited by L1 TTTrack.
0004 // packing scheme given below.
0005 //
0006 // author:      Alexx Perloff
0007 // created:     March 17, 2021
0008 //
0009 ///////
0010 
0011 #include "DataFormats/L1Trigger/interface/VertexWord.h"
0012 
0013 namespace l1t {
0014 
0015   VertexWord::VertexWord(unsigned int valid,
0016                          double z0,
0017                          unsigned int multiplicity,
0018                          double pt,
0019                          unsigned int quality,
0020                          unsigned int inverseMultiplicity,
0021                          unsigned int unassigned) {
0022     // convert directly to AP types
0023     vtxvalid_t valid_ap = valid;
0024     vtxz0_t z0_ap = z0;
0025     vtxmultiplicity_t mult_ap = multiplicity;
0026     vtxsumpt_t pt_ap = pt;
0027     vtxquality_t quality_ap = quality;
0028     vtxinversemult_t invmult_ap = inverseMultiplicity;
0029     vtxunassigned_t unassigned_ap = unassigned;
0030 
0031     setVertexWord(valid_ap, z0_ap, mult_ap, pt_ap, quality_ap, invmult_ap, unassigned_ap);
0032   }
0033 
0034   VertexWord::VertexWord(unsigned int valid,
0035                          unsigned int z0,
0036                          unsigned int multiplicity,
0037                          unsigned int pt,
0038                          unsigned int quality,
0039                          unsigned int inverseMultiplicity,
0040                          unsigned int unassigned) {
0041     // convert to AP types
0042     vtxvalid_t valid_ap = valid;
0043     vtxz0_t z0_ap = unpackSignedValue(
0044         z0, VertexBitWidths::kZ0Size, 1.0 / (1 << (VertexBitWidths::kZ0Size - VertexBitWidths::kZ0MagSize)));
0045     vtxmultiplicity_t mult_ap = multiplicity;
0046     vtxsumpt_t pt_ap = unpackSignedValue(
0047         z0, VertexBitWidths::kSumPtSize, 1.0 / (1 << (VertexBitWidths::kSumPtSize - VertexBitWidths::kSumPtMagSize)));
0048     vtxquality_t quality_ap = quality;
0049     vtxinversemult_t invmult_ap = inverseMultiplicity;
0050     vtxunassigned_t unassigned_ap = unassigned;
0051 
0052     setVertexWord(valid_ap, z0_ap, mult_ap, pt_ap, quality_ap, invmult_ap, unassigned_ap);
0053   }
0054 
0055   VertexWord::VertexWord(vtxvalid_t valid,
0056                          vtxz0_t z0,
0057                          vtxmultiplicity_t multiplicity,
0058                          vtxsumpt_t pt,
0059                          vtxquality_t quality,
0060                          vtxinversemult_t inverseMultiplicity,
0061                          vtxunassigned_t unassigned) {
0062     setVertexWord(valid, z0, multiplicity, pt, quality, inverseMultiplicity, unassigned);
0063   }
0064 
0065   void VertexWord::setVertexWord(vtxvalid_t valid,
0066                                  vtxz0_t z0,
0067                                  vtxmultiplicity_t multiplicity,
0068                                  vtxsumpt_t pt,
0069                                  vtxquality_t quality,
0070                                  vtxinversemult_t inverseMultiplicity,
0071                                  vtxunassigned_t unassigned) {
0072     // pack the vertex word
0073     unsigned int offset = 0;
0074     for (unsigned int b = offset; b < (offset + VertexBitWidths::kValidSize); b++) {
0075       vertexWord_.set(b, valid[b - offset]);
0076     }
0077     offset += VertexBitWidths::kValidSize;
0078     for (unsigned int b = offset; b < (offset + VertexBitWidths::kZ0Size); b++) {
0079       vertexWord_.set(b, z0[b - offset]);
0080     }
0081     offset += VertexBitWidths::kZ0Size;
0082 
0083     for (unsigned int b = offset; b < (offset + VertexBitWidths::kNTrackInPVSize); b++) {
0084       vertexWord_.set(b, multiplicity[b - offset]);
0085     }
0086     offset += VertexBitWidths::kNTrackInPVSize;
0087     for (unsigned int b = offset; b < (offset + VertexBitWidths::kSumPtSize); b++) {
0088       vertexWord_.set(b, pt[b - offset]);
0089     }
0090     offset += VertexBitWidths::kSumPtSize;
0091     for (unsigned int b = offset; b < (offset + VertexBitWidths::kQualitySize); b++) {
0092       vertexWord_.set(b, quality[b - offset]);
0093     }
0094     offset += VertexBitWidths::kQualitySize;
0095     for (unsigned int b = offset; b < (offset + VertexBitWidths::kNTrackOutPVSize); b++) {
0096       vertexWord_.set(b, inverseMultiplicity[b - offset]);
0097     }
0098     offset += VertexBitWidths::kNTrackOutPVSize;
0099     for (unsigned int b = offset; b < (offset + VertexBitWidths::kUnassignedSize); b++) {
0100       vertexWord_.set(b, unassigned[b - offset]);
0101     }
0102   }
0103 
0104 }  // namespace l1t