Skip to content

Commit

Permalink
track triplet update
Browse files Browse the repository at this point in the history
  • Loading branch information
gkaratha committed Feb 16, 2024
1 parent 914442a commit 1ec926f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 46 deletions.
3 changes: 3 additions & 0 deletions DataFormats/L1Trigger/interface/TkTripletWord.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ namespace l1t {
ditrack_maxz0_t ditrack_maxz0,
unassigned_t unassigned);

template<class packVarType>
inline void packIntoWord(unsigned int& currentOffset, unsigned int wordChunkSize, packVarType& packVar);

private:
// ----------private member functions --------------
double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const {
Expand Down
63 changes: 19 additions & 44 deletions DataFormats/L1Trigger/src/TkTripletWord.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ namespace l1t {
valid, pt, eta, phi, mass, charge, ditrack_minmass, ditrack_maxmass, ditrack_minz0, ditrack_maxz0, unassigned);
}

template<class packVarType>
inline void TkTripletWord::packIntoWord(unsigned int& currentOffset, unsigned int wordChunkSize, packVarType& packVar){
for (unsigned int b = currentOffset; b < (currentOffset + wordChunkSize); ++b) {
tkTripletWord_.set(b, packVar[b-currentOffset]);
}
currentOffset += wordChunkSize;
}

void TkTripletWord::setTkTripletWord(valid_t valid,
pt_t pt,
glbeta_t eta,
Expand All @@ -32,49 +40,16 @@ namespace l1t {
unassigned_t unassigned) {
// pack the TkTriplet word
unsigned int offset = 0;
for (unsigned int b = offset; b < (offset + TkTripletBitWidths::kValidSize); b++) {
tkTripletWord_.set(b, valid[b - offset]);
}
offset += TkTripletBitWidths::kValidSize;
for (unsigned int b = offset; b < (offset + TkTripletBitWidths::kPtSize); b++) {
tkTripletWord_.set(b, pt[b - offset]);
}
offset += TkTripletBitWidths::kPtSize;
for (unsigned int b = offset; b < (offset + TkTripletBitWidths::kGlbPhiSize); b++) {
tkTripletWord_.set(b, phi[b - offset]);
}
offset += TkTripletBitWidths::kGlbPhiSize;
for (unsigned int b = offset; b < (offset + TkTripletBitWidths::kGlbEtaSize); b++) {
tkTripletWord_.set(b, eta[b - offset]);
}
offset += TkTripletBitWidths::kGlbEtaSize;
for (unsigned int b = offset; b < (offset + TkTripletBitWidths::kMassSize); b++) {
tkTripletWord_.set(b, mass[b - offset]);
}
offset += TkTripletBitWidths::kMassSize;
for (unsigned int b = offset; b < (offset + TkTripletBitWidths::kChargeSize); b++) {
tkTripletWord_.set(b, charge[b - offset]);
}
offset += TkTripletBitWidths::kChargeSize;
for (unsigned int b = offset; b < (offset + TkTripletBitWidths::kDiTrackMinMassSize); b++) {
tkTripletWord_.set(b, ditrack_minmass[b - offset]);
}
offset += TkTripletBitWidths::kDiTrackMinMassSize;
for (unsigned int b = offset; b < (offset + TkTripletBitWidths::kDiTrackMaxMassSize); b++) {
tkTripletWord_.set(b, ditrack_maxmass[b - offset]);
}
offset += TkTripletBitWidths::kDiTrackMaxMassSize;
for (unsigned int b = offset; b < (offset + TkTripletBitWidths::kDiTrackMinZ0Size); b++) {
tkTripletWord_.set(b, ditrack_minz0[b - offset]);
}
offset += TkTripletBitWidths::kDiTrackMinZ0Size;
for (unsigned int b = offset; b < (offset + TkTripletBitWidths::kDiTrackMaxZ0Size); b++) {
tkTripletWord_.set(b, ditrack_maxz0[b - offset]);
}
offset += TkTripletBitWidths::kDiTrackMaxZ0Size;
for (unsigned int b = offset; b < (offset + TkTripletBitWidths::kUnassignedSize); b++) {
tkTripletWord_.set(b, unassigned[b - offset]);
}
}
packIntoWord(offset, TkTripletBitWidths::kValidSize, valid);
packIntoWord(offset, TkTripletBitWidths::kPtSize, pt);
packIntoWord(offset, TkTripletBitWidths::kGlbPhiSize, phi);
packIntoWord(offset, TkTripletBitWidths::kGlbEtaSize, eta);
packIntoWord(offset, TkTripletBitWidths::kMassSize, mass);
packIntoWord(offset, TkTripletBitWidths::kChargeSize, charge);
packIntoWord(offset, TkTripletBitWidths::kDiTrackMinMassSize, ditrack_minmass);
packIntoWord(offset, TkTripletBitWidths::kDiTrackMaxMassSize, ditrack_maxmass);
packIntoWord(offset, TkTripletBitWidths::kDiTrackMinZ0Size, ditrack_minz0);
packIntoWord(offset, TkTripletBitWidths::kDiTrackMaxZ0Size, ditrack_maxz0);
}

} //namespace l1t
4 changes: 3 additions & 1 deletion DataFormats/L1Trigger/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
<class name="l1t::JetVectorRef"/>
<class name="edm::Wrapper<l1t::JetVectorRef>"/>

<class name="l1t::TkTripletWord" ClassVersion="3">
<class name="l1t::TkTripletWord" ClassVersion="5">
<version ClassVersion="5" checksum="3276366430"/>
<version ClassVersion="4" checksum="1974562134"/>
<version ClassVersion="3" checksum="3276366430"/>
</class>
<class name="std::vector<l1t::TkTripletWord>"/>
Expand Down
3 changes: 2 additions & 1 deletion L1Trigger/L1TTrackMatch/plugins/L1TrackUnpacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
#include <cstdlib>
#include <string>
#include <cstdlib>
//#include "DataFormats/L1Trigger/interface/TkJetWord.h"
#include "DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h"
#include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"



namespace l1trackunpacker {
//For precision studies
const unsigned int PT_INTPART_BITS{9};
Expand Down

0 comments on commit 1ec926f

Please sign in to comment.