Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added GCTTaus to GCTJet code #1

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1dd5b1f
Merged l1t-phase2-v55 from repository cms-l1t-offline with cms-merge-…
Mar 20, 2023
a9b5a0d
Add ap_data type for GT interface
Mar 20, 2023
50aab00
Add back removed data version
aloeliger Apr 6, 2023
41cefa1
Merge pull request #1 from aloeliger/GT_ap
zhenbinwu Apr 6, 2023
bf2ba36
Merge pull request #1079 from zhenbinwu/GT_ap
aloeliger Apr 7, 2023
a73d340
Merged l1t-phase2-v57 from repository cms-l1t-offline with cms-merge-…
May 3, 2023
dd69dd4
implement fw-based Phase2 EG standalone barrel
skkwan Mar 29, 2023
79b2cf2
fix: build-bot comments
skkwan Mar 30, 2023
91d0890
fix: remove unnecessary cmsRun config files from PR
skkwan Mar 30, 2023
8b03cc6
fix: fix scram b code-checks
skkwan Mar 30, 2023
12c3a81
fix: fix scram b code-format
skkwan Mar 30, 2023
31cfa7a
fix: add hls to BuildFile
skkwan Mar 30, 2023
79b019c
fix: fix incomplete header and build files
skkwan Mar 31, 2023
defedf5
adding Phase-2 Calo PF cluster emulator
pallabidas Apr 3, 2023
7b0bd7f
removed commented code
pallabidas Apr 4, 2023
4de1b9a
first attempt at Phase-2 L1 calo jets emulator
pallabidas Apr 14, 2023
999528b
use Et-weighted jet position
pallabidas Apr 14, 2023
b262e76
First version of GCTTaus added to GCTJet code.
Aug 8, 2023
91ac661
Update GCTJet code with Pallabi's update to include HF region as well
Aug 8, 2023
7f3f3cc
Fixed bug in Phase1L1CaloJetEmulator.h not zeroing tauEt correctly if…
Aug 8, 2023
fcf20ec
Changed tau shape back to 1x3. Also added Pallabi's jet stitching at …
Sep 13, 2023
abb6880
Fixed tau shape back to 1x3.
Sep 13, 2023
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
63 changes: 63 additions & 0 deletions DataFormats/L1TCalorimeterPhase2/interface/CaloPFCluster.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#ifndef DataFormats_L1TCalorimeterPhase2_CaloPFCluster_h
#define DataFormats_L1TCalorimeterPhase2_CaloPFCluster_h

#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include "DataFormats/L1Trigger/interface/L1Candidate.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

namespace l1tp2 {

class CaloPFCluster : public l1t::L1Candidate {
public:
CaloPFCluster()
: l1t::L1Candidate(),
clusterEt_(0.),
clusterIEta_(-99),
clusterIPhi_(-99),
clusterEta_(-99.),
clusterPhi_(-99.){};

CaloPFCluster(const PolarLorentzVector& p4,
float clusterEt,
int clusterIEta,
int clusterIPhi,
float clusterEta,
float clusterPhi)
: l1t::L1Candidate(p4),
clusterEt_(clusterEt),
clusterIEta_(clusterIEta),
clusterIPhi_(clusterIPhi),
clusterEta_(clusterEta),
clusterPhi_(clusterPhi){};

inline float clusterEt() const { return clusterEt_; };
inline int clusterIEta() const { return clusterIEta_; };
inline int clusterIPhi() const { return clusterIPhi_; };
inline float clusterEta() const { return clusterEta_; };
inline float clusterPhi() const { return clusterPhi_; };
void setClusterEt(float clusterEtIn) { clusterEt_ = clusterEtIn; };
void setClusterIEta(int clusterIEtaIn) { clusterIEta_ = clusterIEtaIn; };
void setClusterIPhi(int clusterIPhiIn) { clusterIPhi_ = clusterIPhiIn; };
void setClusterEta(float clusterEtaIn) { clusterEta_ = clusterEtaIn; };
void setClusterPhi(float clusterPhiIn) { clusterPhi_ = clusterPhiIn; };

private:
// ET
float clusterEt_;
// GCT ieta
int clusterIEta_;
// GCT iphi
int clusterIPhi_;
// Tower (real) eta
float clusterEta_;
// Tower (real) phi
float clusterPhi_;
};

// Concrete collection of output objects (with extra tuning information)
typedef std::vector<l1tp2::CaloPFCluster> CaloPFClusterCollection;
} // namespace l1tp2
#endif
101 changes: 101 additions & 0 deletions DataFormats/L1TCalorimeterPhase2/interface/Phase2L1CaloJet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#ifndef DataFormats_L1TCalorimeterPhase2_Phase2L1CaloJet_h
#define DataFormats_L1TCalorimeterPhase2_Phase2L1CaloJet_h

#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include "DataFormats/L1Trigger/interface/L1Candidate.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

namespace l1tp2 {

class Phase2L1CaloJet : public l1t::L1Candidate {
public:
Phase2L1CaloJet()
: l1t::L1Candidate(),
jetEt_(0.),
tauEt_(0.),
jetIEta_(-99),
jetIPhi_(-99),
jetEta_(-99.),
jetPhi_(-99.),
towerEt_(0.),
towerIEta_(-99),
towerIPhi_(-99),
towerEta_(-99.),
towerPhi_(-99.){};

Phase2L1CaloJet(const PolarLorentzVector& p4,
float jetEt,
float tauEt,
int jetIEta,
int jetIPhi,
float jetEta,
float jetPhi,
float towerEt,
int towerIEta,
int towerIPhi,
float towerEta,
float towerPhi)
: l1t::L1Candidate(p4),
jetEt_(jetEt),
tauEt_(tauEt),
jetIEta_(jetIEta),
jetIPhi_(jetIPhi),
jetEta_(jetEta),
jetPhi_(jetPhi),
towerEt_(towerEt),
towerIEta_(towerIEta),
towerIPhi_(towerIPhi),
towerEta_(towerEta),
towerPhi_(towerPhi){};

inline float jetEt() const { return jetEt_; };
inline float tauEt() const { return tauEt_; };
inline int jetIEta() const { return jetIEta_; };
inline int jetIPhi() const { return jetIPhi_; };
inline float jetEta() const { return jetEta_; };
inline float jetPhi() const { return jetPhi_; };
inline float towerEt() const { return towerEt_; };
inline int towerIEta() const { return towerIEta_; };
inline int towerIPhi() const { return towerIPhi_; };
inline float towerEta() const { return towerEta_; };
inline float towerPhi() const { return towerPhi_; };

void setJetEt(float jetEtIn) { jetEt_ = jetEtIn; };
void setTauEt(float tauEtIn) { tauEt_ = tauEtIn; };
void setJetIEta(int jetIEtaIn) { jetIEta_ = jetIEtaIn; };
void setJetIPhi(int jetIPhiIn) { jetIPhi_ = jetIPhiIn; };
void setJetEta(float jetEtaIn) { jetEta_ = jetEtaIn; };
void setJetPhi(float jetPhiIn) { jetPhi_ = jetPhiIn; };
void setTowerEt(float towerEtIn) { towerEt_ = towerEtIn; };
void setTowerIEta(int towerIEtaIn) { towerIEta_ = towerIEtaIn; };
void setTowerIPhi(int towerIPhiIn) { towerIPhi_ = towerIPhiIn; };
void setTowerEta(float towerEtaIn) { towerEta_ = towerEtaIn; };
void setTowerPhi(float towerPhiIn) { towerPhi_ = towerPhiIn; };

private:
// ET
float jetEt_;
// Tau ET
float tauEt_;
// GCT ieta
int jetIEta_;
// GCT iphi
int jetIPhi_;
// Tower (real) eta
float jetEta_;
// Tower (real) phi
float jetPhi_;
float towerEt_;
int towerIEta_;
int towerIPhi_;
float towerEta_;
float towerPhi_;
};

// Concrete collection of output objects (with extra tuning information)
typedef std::vector<l1tp2::Phase2L1CaloJet> Phase2L1CaloJetCollection;
} // namespace l1tp2
#endif
2 changes: 2 additions & 0 deletions DataFormats/L1TCalorimeterPhase2/src/classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
#include "DataFormats/L1TCalorimeterPhase2/interface/CaloCrystalCluster.h"
#include "DataFormats/L1TCalorimeterPhase2/interface/CaloTower.h"
#include "DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h"
#include "DataFormats/L1TCalorimeterPhase2/interface/CaloPFCluster.h"
#include "DataFormats/L1TCalorimeterPhase2/interface/Phase2L1CaloJet.h"
14 changes: 14 additions & 0 deletions DataFormats/L1TCalorimeterPhase2/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,19 @@
<class name="l1tp2::CaloJetsCollection" />
<class name="edm::Wrapper<l1tp2::CaloJetsCollection>" />

<class name="l1tp2::CaloPFCluster" ClassVersion="4">
<version ClassVersion="4" checksum="4176166177"/>
</class>
<class name="std::vector<l1tp2::CaloPFCluster>" />
<class name="l1tp2::CaloPFClusterCollection" />
<class name="edm::Wrapper<l1tp2::CaloPFClusterCollection>" />

<class name="l1tp2::Phase2L1CaloJet" ClassVersion="7">
<version ClassVersion="7" checksum="289384850"/>
</class>
<class name="std::vector<l1tp2::Phase2L1CaloJet>" />
<class name="l1tp2::Phase2L1CaloJetCollection" />
<class name="edm::Wrapper<l1tp2::Phase2L1CaloJetCollection>" />

</lcgdict>

44 changes: 44 additions & 0 deletions DataFormats/L1TCalorimeterPhase2/src/classes_def.xml.generated
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!-- *********************************** -->
<!-- Phase-2 Calo data dictionaries -->
<!-- *********************************** -->

<lcgdict>

<class name="l1tp2::CaloCrystalCluster" ClassVersion="3">
<version ClassVersion="3" checksum="811222139"/>
</class>
<class name="std::vector<l1tp2::CaloCrystalCluster>" />
<class name="l1tp2::CaloCrystalClusterCollection" />
<class name="edm::Wrapper<l1tp2::CaloCrystalClusterCollection>" />

<class name="l1tp2::CaloTower" ClassVersion="3">
<version ClassVersion="3" checksum="2608605419"/>
</class>
<class name="std::vector<l1tp2::CaloTower>" />
<class name="l1tp2::CaloTowerCollection" />
<class name="edm::Wrapper<l1tp2::CaloTowerCollection>" />

<class name="l1tp2::CaloJet" ClassVersion="3">
<version ClassVersion="3" checksum="2520028496"/>
</class>
<class name="std::vector<l1tp2::CaloJet>" />
<class name="l1tp2::CaloJetsCollection" />
<class name="edm::Wrapper<l1tp2::CaloJetsCollection>" />

<class name="l1tp2::CaloPFCluster" ClassVersion="4">
<version ClassVersion="4" checksum="4176166177"/>
</class>
<class name="std::vector<l1tp2::CaloPFCluster>" />
<class name="l1tp2::CaloPFClusterCollection" />
<class name="edm::Wrapper<l1tp2::CaloPFClusterCollection>" />

<class name="l1tp2::Phase2L1CaloJet" ClassVersion="7">
<version ClassVersion="7" checksum="289384850"/>
<version ClassVersion="6" checksum="2152918872"/>
</class>
<class name="std::vector<l1tp2::Phase2L1CaloJet>" />
<class name="l1tp2::Phase2L1CaloJetCollection" />
<class name="edm::Wrapper<l1tp2::Phase2L1CaloJetCollection>" />

</lcgdict>

46 changes: 38 additions & 8 deletions DataFormats/L1TMuonPhase2/interface/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,32 @@ namespace Phase2L1GMT {
// Bitwidth for standalone muons to CL1 and GT
const int BITSSAZ0 = 5;
const int BITSSAD0 = 7;
const int BITSSAQUALITY = 4;
const int BITSSAQUAL = 4;

// Bitwidth for dataformat to GT
const int BITSGTPT = 16;
const int BITSGTPHI = 13;
const int BITSGTETA = 14;
const int BITSGTZ0 = 10;
const int BITSGTD0 = 10;
const int BITSGTQUALITY = 8;
const int BITSGTQUAL = 8;
const int BITSGTISO = 4;
const int BITSGTBETA = 4;

// Bitwidth for Tau->3mu object
const int BITSTMPT = 8;
const int BITSTMPHI = 8;
const int BITSTMETA = 8;
const int BITSTMMASS2 = 8;
const int BITSTMTYPE = 6;
const int BITSTMIDX = 4;
const int BITSTMQUAL = 4;

const float maxCurv_ = 0.00855; // 2 GeV pT Rinv is in cm
const float maxPhi_ = 1.026; // relative to the center of the sector
const float maxTanl_ = 8.0;
const float maxZ0_ = 30.;
const float maxD0_ = 15.4;
const float maxZ0_ = 25.6;
const float maxD0_ = 15.36;
// Updated barrelLimit according to Karol, https://indico.cern.ch/event/1113802/#1-phase2-gmt-performance-and-i
const int barrelLimit0_ = 1.4 / 0.00076699039 / 8;
const int barrelLimit1_ = 1.1 / 0.00076699039 / 8;
Expand All @@ -81,12 +91,32 @@ namespace Phase2L1GMT {
const float LSBpt = 0.03125;
const float LSBphi = 2. * M_PI / pow(2, BITSPHI);
const float LSBeta = 2. * M_PI / pow(2, BITSETA);
const float LSBGTz0 = 2. * maxZ0_ / pow(2, BITSZ0);
const float LSBGTd0 = 2. * maxD0_ / pow(2, BITSD0);
const float LSBSAz0 = 1.875;
const float LSBSAd0 = 3.85;
const float LSBGTz0 = 0.05; // 0.5mm, in sync with GTT and Correlator
const float LSBGTd0 = 0.03; // from GT interface doc
const float LSBSAz0 = 1.6; // 0.05 * 32 cm, with range +- 25.6
const float LSBSAd0 = 3.84; // 0.03 * 128 cm, with range +- 245.76

typedef ap_uint<64> wordtype;
typedef ap_uint<1> valid_gt_t; //valid
typedef ap_uint<1> q_gt_t; //charge
typedef ap_uint<BITSGTPT> pt_gt_t; //pt of tracker muon
typedef ap_int<BITSGTPHI> phi_gt_t; //phi of tracker muon
typedef ap_int<BITSGTETA> eta_gt_t; //eta of tracker muon
typedef ap_int<BITSGTZ0> z0_gt_t; //z0 of tracker muon
typedef ap_int<BITSGTD0> d0_gt_t; //d0 of tracker muon
typedef ap_uint<BITSGTISO> iso_gt_t; //isolation of tracker muon
typedef ap_uint<BITSGTBETA> beta_gt_t; //beta of tracker muon
typedef ap_uint<BITSGTQUAL> qual_gt_t; //quality of tracker muon

//Standalone muon datatype
typedef ap_uint<1> valid_sa_t; //valid
typedef ap_uint<BITSGTPT> pt_sa_t; //pt of standalone muon
typedef ap_int<BITSGTPHI> phi_sa_t; //phi of standalone muon
typedef ap_int<BITSGTETA> eta_sa_t; //eta of standalone muon
typedef ap_int<BITSSAZ0> z0_sa_t; //z0 of standalone muon
typedef ap_int<BITSSAD0> d0_sa_t; //d0 of standalone muon
typedef ap_uint<1> q_sa_t; //charge of standalone muon
typedef ap_uint<BITSSAQUAL> qual_sa_t; //quality of standalone muon

inline uint64_t twos_complement(long long int v, uint bits) {
uint64_t mask = (1 << bits) - 1;
Expand Down
10 changes: 10 additions & 0 deletions DataFormats/L1TMuonPhase2/interface/SAMuon.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ namespace l1t {
const uint hwBeta() const { return hwBeta_; }
void setBeta(uint beta) { hwBeta_ = beta; }

// For GT, returning ap_ type
const Phase2L1GMT::valid_sa_t apValid() const { return Phase2L1GMT::valid_sa_t(hwPt() > 0); };
const Phase2L1GMT::pt_sa_t apPt() const { return Phase2L1GMT::pt_sa_t(hwPt()); };
const Phase2L1GMT::phi_sa_t apPhi() const { return Phase2L1GMT::phi_sa_t(hwPhi()); };
const Phase2L1GMT::eta_sa_t apEta() const { return Phase2L1GMT::eta_sa_t(hwEta()); };
const Phase2L1GMT::z0_sa_t apZ0() const { return Phase2L1GMT::z0_sa_t(hwZ0()); };
const Phase2L1GMT::d0_sa_t apD0() const { return Phase2L1GMT::d0_sa_t(hwD0()); };
const Phase2L1GMT::q_sa_t apCharge() const { return Phase2L1GMT::q_sa_t(hwCharge()); };
const Phase2L1GMT::qual_sa_t apQual() const { return Phase2L1GMT::qual_sa_t(hwQual()); };

// For HLT
const double phZ0() const { return Phase2L1GMT::LSBSAz0 * hwZ0(); }
const double phD0() const { return Phase2L1GMT::LSBSAd0 * hwD0(); }
Expand Down
18 changes: 15 additions & 3 deletions DataFormats/L1TMuonPhase2/interface/TrackerMuon.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace l1t {
~TrackerMuon() override;

const edm::Ptr<L1TTTrackType>& trkPtr() const { return trkPtr_; }
const edm::Ref<l1t::RegionalMuonCandBxCollection>& muonRef() const { return muRef_; }
const std::vector<l1t::RegionalMuonCandRef>& muonRef() const { return muRef_; }

const bool hwCharge() const { return hwCharge_; }
const int hwZ0() const { return hwZ0_; }
Expand All @@ -41,10 +41,22 @@ namespace l1t {
const int hwIsoSumAp() const { return hwIsoSumAp_; }
const uint hwBeta() const { return hwBeta_; }
void setBeta(uint beta) { hwBeta_ = beta; }
void setMuonRef(const edm::Ref<l1t::RegionalMuonCandBxCollection>& p) { muRef_ = p; }
void setMuonRef(const std::vector<l1t::RegionalMuonCandRef>& p) { muRef_ = p; }
void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; }
void setHwIsoSumAp(int isoSum) { hwIsoSumAp_ = isoSum; }

// For GT, returning ap_ type
const Phase2L1GMT::valid_gt_t apValid() const { return Phase2L1GMT::valid_gt_t(hwPt() > 0); };
const Phase2L1GMT::pt_gt_t apPt() const { return Phase2L1GMT::pt_gt_t(hwPt()); };
const Phase2L1GMT::phi_gt_t apPhi() const { return Phase2L1GMT::phi_gt_t(hwPhi()); };
const Phase2L1GMT::eta_gt_t apEta() const { return Phase2L1GMT::eta_gt_t(hwEta()); };
const Phase2L1GMT::z0_gt_t apZ0() const { return Phase2L1GMT::z0_gt_t(hwZ0()); };
const Phase2L1GMT::d0_gt_t apD0() const { return Phase2L1GMT::d0_gt_t(hwD0()); };
const Phase2L1GMT::q_gt_t apCharge() const { return Phase2L1GMT::q_gt_t(hwCharge()); };
const Phase2L1GMT::qual_gt_t apQual() const { return Phase2L1GMT::qual_gt_t(hwQual()); };
const Phase2L1GMT::iso_gt_t apIso() const { return Phase2L1GMT::iso_gt_t(hwIso()); };
const Phase2L1GMT::beta_gt_t apBeta() const { return Phase2L1GMT::beta_gt_t(hwBeta()); };

// For HLT
const double phZ0() const { return Phase2L1GMT::LSBGTz0 * hwZ0(); }
const double phD0() const { return Phase2L1GMT::LSBGTd0 * hwD0(); }
Expand Down Expand Up @@ -76,7 +88,7 @@ namespace l1t {
//Store the eneryg sum for isolation with ap_type
int hwIsoSumAp_;

edm::Ref<l1t::RegionalMuonCandBxCollection> muRef_;
std::vector<l1t::RegionalMuonCandRef> muRef_;
MuonStubRefVector stubs_;
};
} // namespace l1t
Expand Down
3 changes: 2 additions & 1 deletion DataFormats/L1TMuonPhase2/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<class name="edm::Wrapper<std::vector<l1t::MuonStub > >"/>
<class name="edm::Ref<l1t::MuonStubCollection>" splitLevel="0"/>

<class name="l1t::TrackerMuon" ClassVersion="3">
<class name="l1t::TrackerMuon" ClassVersion="4">
<version ClassVersion="4" checksum="3437073036"/>
<version ClassVersion="3" checksum="2397458791"/>
</class>
<class name="std::vector<l1t::TrackerMuon>"/>
Expand Down
7 changes: 6 additions & 1 deletion L1Trigger/L1CaloTrigger/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<use name="DataFormats/EcalDetId"/>
<use name="DataFormats/HcalDetId"/>
<use name="DataFormats/L1TCalorimeterPhase2"/>
<use name="FWCore/ParameterSet"/>
<use name="clhep"/>
<use name="clhep"/>
<use name="hls"/>


<export>
<lib name="1"/>
Expand Down
Loading