Skip to content

Commit

Permalink
code format application
Browse files Browse the repository at this point in the history
  • Loading branch information
gkaratha committed Feb 16, 2024
1 parent 76822fa commit 914442a
Show file tree
Hide file tree
Showing 8 changed files with 313 additions and 294 deletions.
20 changes: 11 additions & 9 deletions DataFormats/L1TCorrelator/interface/TkTriplet.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#ifndef DataFormatsL1TCorrelator_TkTriplet_h
#define DataFormatsL1TCorrelator_TkTriplet_h

// Original author: G Karathanasis,
// Original author: G Karathanasis,
// [email protected], CU Boulder
// -*- C++ -*-
// Package: L1Trigger
// Class : TkTriplet
// Description: Class to store the output of track-triplet producer, which used by L1T to create X->3h candidates (like W->3pi).
// Description: Class to store the output of track-triplet producer, which used by L1T to create X->3h candidates (like W->3pi).

#include "DataFormats/L1Trigger/interface/L1Candidate.h"
#include "DataFormats/Common/interface/Ref.h"
Expand All @@ -24,13 +24,16 @@ namespace l1t {
TkTriplet();

TkTriplet(const LorentzVector& p4, int charge);
TkTriplet(const LorentzVector& p4, int charge,
double pair_mass_max, double pair_mass_min,
double pair_dz_max, double pair_dz_min,
TkTriplet(const LorentzVector& p4,
int charge,
double pair_mass_max,
double pair_mass_min,
double pair_dz_max,
double pair_dz_min,
std::vector<edm::Ptr<L1TTTrackType>> trkPtrList);

~TkTriplet() override {};
~TkTriplet() override{};

int getTripletCharge() const;
double getPairMassMax() const;
double getPairMassMin() const;
Expand All @@ -43,10 +46,9 @@ namespace l1t {
int charge_;
double pair_mass_max_;
double pair_mass_min_;
double pair_dz_max_;
double pair_dz_max_;
double pair_dz_min_;
std::vector<edm::Ptr<L1TTTrackType>> trkPtrList_;

};
} // namespace l1t

Expand Down
2 changes: 1 addition & 1 deletion DataFormats/L1TCorrelator/interface/TkTripletFwd.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef DataFormatsL1TCorrelator_TkTripletFwd_h
#define DataFormatsL1TCorrelator_TkTripletFwd_h

// Original author: G Karathanasis,
// Original author: G Karathanasis,
// [email protected], CU Boulder
// -*- C++ -*-
//
Expand Down
53 changes: 17 additions & 36 deletions DataFormats/L1TCorrelator/src/TkTriplet.cc
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
// Original Author: George Karathanasis,
// [email protected], CU Boulder
// [email protected], CU Boulder
// -*- C++ -*-
// Package: L1Trigger
// Class : TkTriplet
// Description: Class to store the output of track-triplet producer, which used by L1T to create X->3h candidates (like W->3pi).
// Description: Class to store the output of track-triplet producer, which used by L1T to create X->3h candidates (like W->3pi).

#include "DataFormats/L1TCorrelator/interface/TkTriplet.h"

using namespace l1t;


TkTriplet::TkTriplet()
: charge_(-99.),
pair_mass_max_(-99),
pair_mass_min_(-99),
pair_dz_max_(-99),
pair_dz_min_(-99) {}

: charge_(-99.), pair_mass_max_(-99), pair_mass_min_(-99), pair_dz_max_(-99), pair_dz_min_(-99) {}

TkTriplet::TkTriplet(const LorentzVector& p4, int charge)
: L1Candidate(p4),
charge_(charge),
pair_mass_max_(-99),
pair_mass_min_(-99),
pair_dz_max_(-99),
pair_dz_min_(-99){}

TkTriplet::TkTriplet(const LorentzVector& p4, int charge,
double pair_mass_max, double pair_mass_min,
double pair_dz_max, double pair_dz_min,
std::vector<edm::Ptr<L1TTTrackType>> trkPtrList )
: L1Candidate(p4), charge_(charge), pair_mass_max_(-99), pair_mass_min_(-99), pair_dz_max_(-99), pair_dz_min_(-99) {}

TkTriplet::TkTriplet(const LorentzVector& p4,
int charge,
double pair_mass_max,
double pair_mass_min,
double pair_dz_max,
double pair_dz_min,
std::vector<edm::Ptr<L1TTTrackType>> trkPtrList)
: L1Candidate(p4),
charge_(charge),
pair_mass_max_(pair_mass_max),
Expand All @@ -38,28 +30,17 @@ TkTriplet::TkTriplet(const LorentzVector& p4, int charge,
pair_dz_min_(pair_dz_min),
trkPtrList_(trkPtrList) {}


int TkTriplet::bx() const {
// in the producer TkJetProducer.cc, we keep only jets with bx = 0
return 0;
}

int TkTriplet::getTripletCharge () const{
return charge_;
}
int TkTriplet::getTripletCharge() const { return charge_; }

double TkTriplet::getPairMassMax () const{
return pair_mass_max_;
}
double TkTriplet::getPairMassMax() const { return pair_mass_max_; }

double TkTriplet::getPairMassMin () const{
return pair_mass_min_;
}
double TkTriplet::getPairMassMin() const { return pair_mass_min_; }

double TkTriplet::getPairDzMax () const{
return pair_dz_max_;
}
double TkTriplet::getPairDzMax() const { return pair_dz_max_; }

double TkTriplet::getPairDzMin () const{
return pair_dz_min_;
}
double TkTriplet::getPairDzMin() const { return pair_dz_min_; }
102 changes: 62 additions & 40 deletions DataFormats/L1Trigger/interface/TkTripletWord.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ namespace l1t {

enum TkTripletBitWidths {
// The sizes of the triplet word components and total word size
kValidSize = 1, // Width of the valid bit
kPtSize = 16, // Width of the triplet pt
kValidSize = 1, // Width of the valid bit
kPtSize = 16, // Width of the triplet pt
kPtMagSize = 11,
kGlbEtaSize = 14, // Width of the triplet eta
kGlbPhiSize = 13, // Width of the triplet phi
Expand All @@ -36,10 +36,9 @@ namespace l1t {
kDiTrackMinZ0Size = 8, // Width of the Dz of min Dz pair
kDiTrackMaxZ0Size = 8, // Width of the Dz of max Dz pair
kUnassignedSize = 17,
kTkTripletWordSize = kValidSize + kPtSize + kGlbEtaSize + kGlbPhiSize +
kMassSize + kChargeSize + kDiTrackMinMassSize +
kDiTrackMaxMassSize + kDiTrackMinZ0Size +
kDiTrackMaxZ0Size + kUnassignedSize,
kTkTripletWordSize = kValidSize + kPtSize + kGlbEtaSize + kGlbPhiSize + kMassSize + kChargeSize +
kDiTrackMinMassSize + kDiTrackMaxMassSize + kDiTrackMinZ0Size + kDiTrackMaxZ0Size +
kUnassignedSize,
};

enum TkTripletBitLocations {
Expand All @@ -56,47 +55,47 @@ namespace l1t {
kMassMSB = kMassLSB + TkTripletBitWidths::kMassSize - 1,
kChargeLSB = kMassMSB + 1,
kChargeMSB = kChargeLSB + TkTripletBitWidths::kChargeSize - 1,
kDiTrackMinMassLSB = kChargeMSB +1,
kDiTrackMinMassLSB = kChargeMSB + 1,
kDiTrackMinMassMSB = kDiTrackMinMassLSB + TkTripletBitWidths::kDiTrackMinMassSize - 1,
kDiTrackMaxMassLSB = kDiTrackMinMassMSB +1,
kDiTrackMaxMassLSB = kDiTrackMinMassMSB + 1,
kDiTrackMaxMassMSB = kDiTrackMaxMassLSB + TkTripletBitWidths::kDiTrackMaxMassSize - 1,
kDiTrackMinZ0LSB = kDiTrackMaxMassMSB +1,
kDiTrackMinZ0LSB = kDiTrackMaxMassMSB + 1,
kDiTrackMinZ0MSB = kDiTrackMinZ0LSB + TkTripletBitWidths::kDiTrackMinZ0Size - 1,
kDiTrackMaxZ0LSB = kDiTrackMinZ0MSB +1,
kDiTrackMaxZ0LSB = kDiTrackMinZ0MSB + 1,
kDiTrackMaxZ0MSB = kDiTrackMaxZ0LSB + TkTripletBitWidths::kDiTrackMaxZ0Size - 1,
kUnassignedLSB = kDiTrackMaxZ0MSB + 1,
kUnassignedMSB = kUnassignedLSB + TkTripletBitWidths::kUnassignedSize - 1,
};

// vertex parameters types
typedef ap_uint<kValidSize> valid_t; //valid
typedef ap_ufixed<kPtSize, kPtMagSize, AP_TRN, AP_SAT> pt_t; //triplet pt
typedef ap_int<kGlbEtaSize> glbeta_t; //triplet eta
typedef ap_int<kGlbPhiSize> glbphi_t; //triplet phi
typedef ap_int<kMassSize> mass_t; //triplet mass
typedef ap_int<kChargeSize> charge_t; //triplet Q
typedef ap_int<kDiTrackMinMassSize> ditrack_minmass_t; //pair min mass
typedef ap_int<kDiTrackMaxMassSize> ditrack_maxmass_t; //pair max mass
typedef ap_int<kDiTrackMinZ0Size> ditrack_minz0_t; //pair dz min
typedef ap_int<kDiTrackMaxZ0Size> ditrack_maxz0_t; //pair dz max
typedef ap_uint<TkTripletBitWidths::kUnassignedSize> unassigned_t;
typedef ap_uint<kValidSize> valid_t; //valid
typedef ap_ufixed<kPtSize, kPtMagSize, AP_TRN, AP_SAT> pt_t; //triplet pt
typedef ap_int<kGlbEtaSize> glbeta_t; //triplet eta
typedef ap_int<kGlbPhiSize> glbphi_t; //triplet phi
typedef ap_int<kMassSize> mass_t; //triplet mass
typedef ap_int<kChargeSize> charge_t; //triplet Q
typedef ap_int<kDiTrackMinMassSize> ditrack_minmass_t; //pair min mass
typedef ap_int<kDiTrackMaxMassSize> ditrack_maxmass_t; //pair max mass
typedef ap_int<kDiTrackMinZ0Size> ditrack_minz0_t; //pair dz min
typedef ap_int<kDiTrackMaxZ0Size> ditrack_maxz0_t; //pair dz max
typedef ap_uint<TkTripletBitWidths::kUnassignedSize> unassigned_t;
typedef std::bitset<TkTripletBitWidths::kTkTripletWordSize> tktripletword_bs_t;
typedef ap_uint<TkTripletBitWidths::kTkTripletWordSize> tktripletword_t;

public:
// ----------Constructors --------------------------
TkTripletWord() {}
TkTripletWord(valid_t valid,
pt_t pt,
glbeta_t eta,
glbphi_t phi,
mass_t mass,
charge_t charge,
ditrack_minmass_t ditrack_minmass,
ditrack_maxmass_t ditrack_maxmass,
ditrack_minz0_t ditrack_minz0_t,
ditrack_maxz0_t ditrack_maxz0_t,
unassigned_t unassigned);
pt_t pt,
glbeta_t eta,
glbphi_t phi,
mass_t mass,
charge_t charge,
ditrack_minmass_t ditrack_minmass,
ditrack_maxmass_t ditrack_maxmass,
ditrack_minz0_t ditrack_minz0_t,
ditrack_maxz0_t ditrack_maxz0_t,
unassigned_t unassigned);

~TkTripletWord() {}

Expand All @@ -111,7 +110,9 @@ namespace l1t {

// ----------member functions (getters) ------------
// These functions return arbitarary precision words (lists of bits) for each quantity
valid_t validWord() const { return tkTripletWord()(TkTripletBitLocations::kValidMSB, TkTripletBitLocations::kValidLSB); }
valid_t validWord() const {
return tkTripletWord()(TkTripletBitLocations::kValidMSB, TkTripletBitLocations::kValidLSB);
}
pt_t ptWord() const {
pt_t ret;
ret.V = tkTripletWord()(TkTripletBitLocations::kPtMSB, TkTripletBitLocations::kPtLSB);
Expand Down Expand Up @@ -186,17 +187,38 @@ namespace l1t {
glbEtaWord(), TkTripletBitWidths::kGlbEtaSize, (MAX_ETA) / (1 << TkTripletBitWidths::kGlbEtaSize));
}
float glbphi() const {
return unpackSignedValue(
glbPhiWord(), TkTripletBitWidths::kGlbPhiSize, (2. * std::abs(M_PI)) / (1 << TkTripletBitWidths::kGlbPhiSize));
return unpackSignedValue(glbPhiWord(),
TkTripletBitWidths::kGlbPhiSize,
(2. * std::abs(M_PI)) / (1 << TkTripletBitWidths::kGlbPhiSize));
}
float mass() const {
return unpackSignedValue(massWord(), TkTripletBitWidths::kMassSize, MAX_MASS / (1 << TkTripletBitWidths::kMassSize));
return unpackSignedValue(
massWord(), TkTripletBitWidths::kMassSize, MAX_MASS / (1 << TkTripletBitWidths::kMassSize));
}
int charge() const {
return unpackSignedValue(
chargeWord(), TkTripletBitWidths::kChargeSize, MAX_CHARGE / (1 << TkTripletBitWidths::kChargeSize));
}
float ditrackMinMass() const {
return unpackSignedValue(ditrackMinMassWord(),
TkTripletBitWidths::kDiTrackMinMassSize,
MAX_MASS / (1 << TkTripletBitWidths::kDiTrackMinMassSize));
}
float ditrackMaxMass() const {
return unpackSignedValue(ditrackMaxMassWord(),
TkTripletBitWidths::kDiTrackMaxMassSize,
MAX_MASS / (1 << TkTripletBitWidths::kDiTrackMaxMassSize));
}
float ditrackMinZ0() const {
return unpackSignedValue(ditrackMinZ0Word(),
TkTripletBitWidths::kDiTrackMinZ0Size,
MAX_Z0 / (1 << TkTripletBitWidths::kDiTrackMinZ0Size));
}
float ditrackMaxZ0() const {
return unpackSignedValue(ditrackMaxZ0Word(),
TkTripletBitWidths::kDiTrackMaxZ0Size,
MAX_Z0 / (1 << TkTripletBitWidths::kDiTrackMaxZ0Size));
}
int charge() const { return unpackSignedValue(chargeWord(), TkTripletBitWidths::kChargeSize, MAX_CHARGE / (1 << TkTripletBitWidths::kChargeSize)); }
float ditrackMinMass() const { return unpackSignedValue(ditrackMinMassWord(), TkTripletBitWidths::kDiTrackMinMassSize, MAX_MASS / (1 << TkTripletBitWidths::kDiTrackMinMassSize)); }
float ditrackMaxMass() const { return unpackSignedValue(ditrackMaxMassWord(), TkTripletBitWidths::kDiTrackMaxMassSize, MAX_MASS / (1 << TkTripletBitWidths::kDiTrackMaxMassSize)); }
float ditrackMinZ0() const { return unpackSignedValue(ditrackMinZ0Word(), TkTripletBitWidths::kDiTrackMinZ0Size, MAX_Z0 / (1 << TkTripletBitWidths::kDiTrackMinZ0Size)); }
float ditrackMaxZ0() const { return unpackSignedValue(ditrackMaxZ0Word(), TkTripletBitWidths::kDiTrackMaxZ0Size, MAX_Z0 / (1 << TkTripletBitWidths::kDiTrackMaxZ0Size));}
unsigned int unassigned() const { return unassignedWord().to_uint(); }

// ----------member functions (setters) ------------
Expand Down
6 changes: 3 additions & 3 deletions DataFormats/L1Trigger/src/TkTripletWord.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ namespace l1t {
ditrack_minz0_t ditrack_minz0,
ditrack_maxz0_t ditrack_maxz0,
unassigned_t unassigned) {
setTkTripletWord(valid, pt, eta, phi, mass, charge,ditrack_minmass, ditrack_maxmass, ditrack_minz0, ditrack_maxz0, unassigned);
setTkTripletWord(
valid, pt, eta, phi, mass, charge, ditrack_minmass, ditrack_maxmass, ditrack_minz0, ditrack_maxz0, unassigned);
}

void TkTripletWord::setTkTripletWord(valid_t valid,
Expand Down Expand Up @@ -66,15 +67,14 @@ namespace l1t {
for (unsigned int b = offset; b < (offset + TkTripletBitWidths::kDiTrackMinZ0Size); b++) {
tkTripletWord_.set(b, ditrack_minz0[b - offset]);
}
offset += TkTripletBitWidths::kDiTrackMinZ0Size;
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]);
}

}

} //namespace l1t
Loading

0 comments on commit 914442a

Please sign in to comment.