Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion DataFormats/L1TCorrelator/interface/TkElectron.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ namespace l1t {

float trkzVtx() const { return trkzVtx_; }
double trackCurvature() const { return trackCurvature_; }

float idScore() const { return idScore_; }
// ---------- member functions ---------------------------

void setTrkzVtx(float TrkzVtx) { trkzVtx_ = TrkzVtx; }
void setTrackCurvature(double trackCurvature) { trackCurvature_ = trackCurvature; }
void setIdScore(float score) { idScore_ = score; }

private:
edm::Ptr<L1TTTrackType> trkPtr_;
float trkzVtx_;
double trackCurvature_;
float idScore_;
};
} // namespace l1t
#endif
3 changes: 2 additions & 1 deletion DataFormats/L1TCorrelator/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
<class name="edm::Wrapper<std::vector<l1t::L1CaloTkTau> >"/>
<class name="edm::Ref<std::vector<l1t::L1CaloTkTau>,l1t::L1CaloTkTau,edm::refhelper::FindUsingAdvance<std::vector<l1t::L1CaloTkTau>,l1t::L1CaloTkTau> >"/>

<class name="l1t::TkElectron" ClassVersion="5">
<class name="l1t::TkElectron" ClassVersion="6">
<version ClassVersion="6" checksum="3899336964"/>
<version ClassVersion="5" checksum="965807884"/>
<version ClassVersion="4" checksum="3922083203"/>
<version ClassVersion="3" checksum="3970647299"/>
Expand Down
6 changes: 5 additions & 1 deletion DataFormats/L1TParticleFlow/interface/PFCandidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@ namespace l1t {

void setZ0(float z0) { setVertex(reco::Particle::Point(0, 0, z0)); }
void setDxy(float dxy) { dxy_ = dxy; }
void setCaloEta(float caloeta) { caloEta_ = caloeta; }
void setCaloPhi(float calophi) { caloPhi_ = calophi; }

float z0() const { return vz(); }
float dxy() const { return dxy_; }
float caloEta() const { return caloEta_; }
float caloPhi() const { return caloPhi_; }

int16_t hwZ0() const { return hwZ0_; }
int16_t hwDxy() const { return hwDxy_; }
Expand All @@ -70,7 +74,7 @@ namespace l1t {
PFClusterRef clusterRef_;
PFTrackRef trackRef_;
MuonRef muonRef_;
float dxy_, puppiWeight_;
float dxy_, puppiWeight_, caloEta_, caloPhi_;

int16_t hwZ0_, hwDxy_;
uint16_t hwTkQuality_, hwPuppiWeight_, hwEmID_;
Expand Down
17 changes: 15 additions & 2 deletions DataFormats/L1TParticleFlow/interface/PFCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ namespace l1t {
float ptError = 0,
int hwpt = 0,
int hweta = 0,
int hwphi = 0)
int hwphi = 0,
float absZBarycenter = 0.,
float sigmaRR = 0.)
: L1Candidate(PolarLorentzVector(pt, eta, phi, 0), hwpt, hweta, hwphi, /*hwQuality=*/isEM ? 1 : 0),
hOverE_(hOverE),
ptError_(ptError) {
ptError_(ptError),
absZBarycenter_(absZBarycenter),
sigmaRR_(sigmaRR) {
setPdgId(isEM ? 22 : 130); // photon : non-photon(K0)
}
PFCluster(
Expand All @@ -37,6 +41,12 @@ namespace l1t {
float hOverE() const { return hOverE_; }
void setHOverE(float hOverE) { hOverE_ = hOverE; }

void setSigmaRR(float sigmaRR) { sigmaRR_ = sigmaRR; }
float absZBarycenter() const { return absZBarycenter_; }

void setAbsZBarycenter(float absZBarycenter) { absZBarycenter_ = absZBarycenter; }
float sigmaRR() const { return sigmaRR_; }

float emEt() const {
if (hOverE_ == -1)
return 0;
Expand Down Expand Up @@ -68,6 +78,9 @@ namespace l1t {

private:
float hOverE_, ptError_, egVsPionMVAOut_, egVsPUMVAOut_;
// HGC dedicated quantities (0ed by default)
float absZBarycenter_, sigmaRR_;

ConstituentsAndFractions constituents_;
};

Expand Down
30 changes: 30 additions & 0 deletions DataFormats/L1TParticleFlow/interface/bit_encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,34 @@ inline void l1pf_pattern_unpack(const ap_uint<NB> data[], T objs[N]) {
}
}

template <unsigned int N, unsigned int OFFS = 0, typename T, int NB>
inline void l1pf_pattern_pack_slim(const T objs[N], ap_uint<NB> data[]) {
#ifdef __SYNTHESIS__
#pragma HLS inline
#pragma HLS inline region recursive
#endif
assert(T::BITWIDTH_SLIM <= NB);
for (unsigned int i = 0; i < N; ++i) {
#ifdef __SYNTHESIS__
#pragma HLS unroll
#endif
data[i + OFFS] = objs[i].pack_slim();
}
}

template <unsigned int N, unsigned int OFFS = 0, typename T, int NB>
inline void l1pf_pattern_unpack_slim(const ap_uint<NB> data[], T objs[N]) {
#ifdef __SYNTHESIS__
#pragma HLS inline
#pragma HLS inline region recursive
Comment on lines +63 to +80
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@perrotta these are firmware defines and pragmas. Are those allowable at the CMSSW level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, this is why they are protected by #ifdef __SYNTHESIS__

#endif
assert(T::BITWIDTH_SLIM <= NB);
for (unsigned int i = 0; i < N; ++i) {
#ifdef __SYNTHESIS__
#pragma HLS unroll
#endif
objs[i] = T::unpack(data[i + OFFS]);
}
}

#endif
17 changes: 17 additions & 0 deletions DataFormats/L1TParticleFlow/interface/datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ namespace l1ct {
typedef ap_uint<10> em2calo_dr_t;
typedef ap_uint<13> tk2calo_dq_t;
typedef ap_uint<4> egquality_t;
typedef ap_uint<3> stub_t;
typedef ap_ufixed<10, 1, AP_TRN, AP_SAT> srrtot_t;
typedef ap_uint<8> meanz_t; // mean - MEANZ_OFFSET(= 320 cm)
typedef ap_ufixed<10, 5, AP_TRN, AP_SAT> hoe_t;
typedef ap_uint<4> redChi2Bin_t;

// FIXME: adjust range 10-11bits -> 1/4 - 1/2TeV is probably more than enough for all reasonable use cases
typedef ap_ufixed<11, 9, AP_TRN, AP_SAT> iso_t;

Expand Down Expand Up @@ -149,6 +155,11 @@ namespace l1ct {
constexpr float Z0_LSB = 0.05;
constexpr float DXY_LSB = 0.05;
constexpr float PUPPIW_LSB = 1.0 / 256;
constexpr float MEANZ_OFFSET = 320.;
constexpr float SRRTOT_LSB = 0.0019531250; // pow(2, -9)
constexpr unsigned int SRRTOT_SCALE = 64; // pow(2, 6)
constexpr float HOE_LSB = 0.031250000; // pow(2, -5)

inline float floatPt(pt_t pt) { return pt.to_float(); }
inline float floatPt(dpt_t pt) { return pt.to_float(); }
inline float floatPt(pt2_t pt2) { return pt2.to_float(); }
Expand All @@ -164,6 +175,9 @@ namespace l1ct {
inline float floatDxy(dxy_t dxy) { return dxy.to_float() * DXY_LSB; }
inline float floatPuppiW(puppiWgt_t puppiw) { return puppiw.to_float() * PUPPIW_LSB; }
inline float floatIso(iso_t iso) { return iso.to_float(); }
inline float floatSrrTot(srrtot_t srrtot) { return srrtot.to_float() / SRRTOT_SCALE; };
inline float floatMeanZ(meanz_t meanz) { return meanz + MEANZ_OFFSET; };
inline float floatHoe(hoe_t hoe) { return hoe.to_float(); };

inline pt_t makePt(int pt) { return ap_ufixed<16, 14>(pt) >> 2; }
inline dpt_t makeDPt(int dpt) { return ap_fixed<18, 16>(dpt) >> 2; }
Expand Down Expand Up @@ -194,6 +208,9 @@ namespace l1ct {
inline iso_t makeIso(float iso) { return iso_t(0.25 * round(iso * 4)); }

inline int makeDR2FromFloatDR(float dr) { return ceil(dr * dr / ETAPHI_LSB / ETAPHI_LSB); }
inline srrtot_t makeSrrTot(float var) { return srrtot_t(SRRTOT_LSB * round(var * SRRTOT_SCALE / SRRTOT_LSB)); };
inline meanz_t makeMeanZ(float var) { return round(var - MEANZ_OFFSET); };
inline hoe_t makeHoe(float var) { return hoe_t(HOE_LSB * round(var / HOE_LSB)); };

inline float maxAbsEta() { return ((1 << (eta_t::width - 1)) - 1) * ETAPHI_LSB; }
inline float maxAbsPhi() { return ((1 << (phi_t::width - 1)) - 1) * ETAPHI_LSB; }
Expand Down
7 changes: 4 additions & 3 deletions DataFormats/L1TParticleFlow/interface/layer1_emulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace l1ct {
};

struct TkObjEmu : public TkObj {
uint16_t hwChi2, hwStubs;
uint16_t hwChi2;
float simPt, simCaloEta, simCaloPhi, simVtxEta, simVtxPhi, simZ0, simD0;
const l1t::PFTrack *src = nullptr;
bool read(std::fstream &from);
Expand All @@ -48,7 +48,6 @@ namespace l1ct {
TkObj::clear();
src = nullptr;
hwChi2 = 0;
hwStubs = 0;
simPt = 0;
simCaloEta = 0;
simCaloPhi = 0;
Expand Down Expand Up @@ -196,13 +195,15 @@ namespace l1ct {
const l1t::PFTrack *srcTrack = nullptr;
// we use an index to the standalone object needed to retrieve a Ref when putting
int sta_idx;
float idScore;
bool read(std::fstream &from);
bool write(std::fstream &to) const;
void clear() {
EGIsoEleObj::clear();
srcCluster = nullptr;
srcTrack = nullptr;
sta_idx = -1;
idScore = -999;
clearIsoVars();
}

Expand Down Expand Up @@ -334,7 +335,7 @@ namespace l1ct {
};

struct Event {
enum { VERSION = 11 };
enum { VERSION = 12 };
uint32_t run, lumi;
uint64_t event;
RawInputs raw;
Expand Down
Loading