diff --git a/DataFormats/HLTReco/src/classes_def.xml b/DataFormats/HLTReco/src/classes_def.xml index ae2e7dd188a94..4d35592dc998c 100644 --- a/DataFormats/HLTReco/src/classes_def.xml +++ b/DataFormats/HLTReco/src/classes_def.xml @@ -37,32 +37,27 @@ - + - + + - - - - - - - - + + - + diff --git a/DataFormats/HcalIsolatedTrack/src/classes_def.xml b/DataFormats/HcalIsolatedTrack/src/classes_def.xml index d304711d65c60..223b57b525480 100644 --- a/DataFormats/HcalIsolatedTrack/src/classes_def.xml +++ b/DataFormats/HcalIsolatedTrack/src/classes_def.xml @@ -3,7 +3,7 @@ - + diff --git a/DataFormats/L1TCalorimeter/interface/CaloCluster.h b/DataFormats/L1TCalorimeter/interface/CaloCluster.h index 88a9f5c9f6944..734c5129aa6b0 100644 --- a/DataFormats/L1TCalorimeter/interface/CaloCluster.h +++ b/DataFormats/L1TCalorimeter/interface/CaloCluster.h @@ -5,76 +5,77 @@ #include "DataFormats/L1Trigger/interface/BXVector.h" namespace l1t { + namespace io_v1 { + class CaloCluster : public L1Candidate { + public: + enum ClusterFlag { + INCLUDE_SEED = 0, + INCLUDE_NW = 1, + INCLUDE_N = 2, + INCLUDE_NE = 3, + INCLUDE_E = 4, + INCLUDE_SE = 5, + INCLUDE_S = 6, + INCLUDE_SW = 7, + INCLUDE_W = 8, + INCLUDE_NN = 9, + INCLUDE_SS = 10, + TRIM_LEFT = 11, + IS_SECONDARY = 12, + MERGE_UPDOWN = 13, // 0=up, 1=down + MERGE_LEFTRIGHT = 14 // 0=left, 1=right + }; - class CaloCluster : public L1Candidate { - public: - enum ClusterFlag { - INCLUDE_SEED = 0, - INCLUDE_NW = 1, - INCLUDE_N = 2, - INCLUDE_NE = 3, - INCLUDE_E = 4, - INCLUDE_SE = 5, - INCLUDE_S = 6, - INCLUDE_SW = 7, - INCLUDE_W = 8, - INCLUDE_NN = 9, - INCLUDE_SS = 10, - TRIM_LEFT = 11, - IS_SECONDARY = 12, - MERGE_UPDOWN = 13, // 0=up, 1=down - MERGE_LEFTRIGHT = 14 // 0=left, 1=right - }; - - public: - CaloCluster() {} - CaloCluster(const LorentzVector p4, int pt = 0, int eta = 0, int phi = 0); + public: + CaloCluster() {} + CaloCluster(const LorentzVector p4, int pt = 0, int eta = 0, int phi = 0); - ~CaloCluster() override; + ~CaloCluster() override; - void setClusterFlag(ClusterFlag flag, bool val = true); - void setHwPtEm(int pt); - void setHwPtHad(int pt); - void setHwSeedPt(int pt); - void setFgEta(int fgEta); - void setFgPhi(int fgPhi); - void setHOverE(int hOverE); - void setFgECAL(int fgECAL); + void setClusterFlag(ClusterFlag flag, bool val = true); + void setHwPtEm(int pt); + void setHwPtHad(int pt); + void setHwSeedPt(int pt); + void setFgEta(int fgEta); + void setFgPhi(int fgPhi); + void setHOverE(int hOverE); + void setFgECAL(int fgECAL); - bool checkClusterFlag(ClusterFlag flag) const; - bool isValid() const; - int hwPtEm() const; - int hwPtHad() const; - int hwSeedPt() const; - int fgEta() const; - int fgPhi() const; - int hOverE() const; - int fgECAL() const; - int clusterFlags() const { return m_clusterFlags; } + bool checkClusterFlag(ClusterFlag flag) const; + bool isValid() const; + int hwPtEm() const; + int hwPtHad() const; + int hwSeedPt() const; + int fgEta() const; + int fgPhi() const; + int hOverE() const; + int fgECAL() const; + int clusterFlags() const { return m_clusterFlags; } - bool operator<(const CaloCluster& cl) const; - bool operator>(const CaloCluster& cl) const { return cl < *this; }; - bool operator<=(const CaloCluster& cl) const { return !(cl > *this); }; - bool operator>=(const CaloCluster& cl) const { return !(cl < *this); }; + bool operator<(const CaloCluster& cl) const; + bool operator>(const CaloCluster& cl) const { return cl < *this; }; + bool operator<=(const CaloCluster& cl) const { return !(cl > *this); }; + bool operator>=(const CaloCluster& cl) const { return !(cl < *this); }; - private: - // Summary of clustering outcomes - int m_clusterFlags{0}; // see ClusterFlag bits (15 bits, will evolve) + private: + // Summary of clustering outcomes + int m_clusterFlags{0}; // see ClusterFlag bits (15 bits, will evolve) - // Energies - int m_hwPtEm{0}; - int m_hwPtHad{0}; - int m_hwSeedPt{0}; + // Energies + int m_hwPtEm{0}; + int m_hwPtHad{0}; + int m_hwSeedPt{0}; - // fine grained position - int m_fgEta{0}; // 2 bits (to be defined in agreement with GT inputs) - int m_fgPhi{0}; // 2 bits (to be defined in agreement with GT inputs) - - // identification variables - int m_hOverE{0}; // 8 bits (between 0 and 1 -> resolution=1/256=0.39%). Number of bits is not definitive - int m_fgECAL{0}; // FG bit of the seed tower - }; + // fine grained position + int m_fgEta{0}; // 2 bits (to be defined in agreement with GT inputs) + int m_fgPhi{0}; // 2 bits (to be defined in agreement with GT inputs) + // identification variables + int m_hOverE{0}; // 8 bits (between 0 and 1 -> resolution=1/256=0.39%). Number of bits is not definitive + int m_fgECAL{0}; // FG bit of the seed tower + }; + } // namespace io_v1 + using CaloCluster = io_v1::CaloCluster; typedef BXVector CaloClusterBxCollection; } // namespace l1t diff --git a/DataFormats/L1TCalorimeter/interface/CaloTower.h b/DataFormats/L1TCalorimeter/interface/CaloTower.h index b932b35e22acf..258d647b12a99 100644 --- a/DataFormats/L1TCalorimeter/interface/CaloTower.h +++ b/DataFormats/L1TCalorimeter/interface/CaloTower.h @@ -6,49 +6,51 @@ namespace l1t { - class CaloTower; - typedef BXVector CaloTowerBxCollection; - - class CaloTower : public L1Candidate { - public: - CaloTower() : etEm_(0.), etHad_(0.), hwEtEm_(0), hwEtHad_(0), hwEtRatio_(0) {} - - CaloTower(const LorentzVector& p4, - double etEm = 0., - double etHad = 0., - int pt = 0, - int eta = 0, - int phi = 0, - int qual = 0, - int hwEtEm = 0, - int hwEtHad = 0, - int hwEtRatio = 0); - - ~CaloTower() override; - - void setEtEm(double et); - void setEtHad(double et); - - void setHwEtEm(int et); - void setHwEtHad(int et); - void setHwEtRatio(int ratio); - - double etEm() const; - double etHad() const; - - int hwEtEm() const; - int hwEtHad() const; - int hwEtRatio() const; - - private: - // additional hardware quantities - double etEm_; - double etHad_; - - int hwEtEm_; - int hwEtHad_; - int hwEtRatio_; - }; + namespace io_v1 { + class CaloTower : public L1Candidate { + public: + CaloTower() : etEm_(0.), etHad_(0.), hwEtEm_(0), hwEtHad_(0), hwEtRatio_(0) {} + + CaloTower(const LorentzVector& p4, + double etEm = 0., + double etHad = 0., + int pt = 0, + int eta = 0, + int phi = 0, + int qual = 0, + int hwEtEm = 0, + int hwEtHad = 0, + int hwEtRatio = 0); + + ~CaloTower() override; + + void setEtEm(double et); + void setEtHad(double et); + + void setHwEtEm(int et); + void setHwEtHad(int et); + void setHwEtRatio(int ratio); + + double etEm() const; + double etHad() const; + + int hwEtEm() const; + int hwEtHad() const; + int hwEtRatio() const; + + private: + // additional hardware quantities + double etEm_; + double etHad_; + + int hwEtEm_; + int hwEtHad_; + int hwEtRatio_; + }; + } // namespace io_v1 + using CaloTower = io_v1::CaloTower; + + using CaloTowerBxCollection = BXVector; } // namespace l1t diff --git a/DataFormats/L1TCalorimeter/src/classes_def.xml b/DataFormats/L1TCalorimeter/src/classes_def.xml index ca48fe424fd0d..d960b67741cc5 100644 --- a/DataFormats/L1TCalorimeter/src/classes_def.xml +++ b/DataFormats/L1TCalorimeter/src/classes_def.xml @@ -9,13 +9,17 @@ - - + + + + - - + + + + diff --git a/DataFormats/L1TCalorimeterPhase2/src/classes_def.xml b/DataFormats/L1TCalorimeterPhase2/src/classes_def.xml index 7e82060cd986b..7e2ccb76cc9b0 100644 --- a/DataFormats/L1TCalorimeterPhase2/src/classes_def.xml +++ b/DataFormats/L1TCalorimeterPhase2/src/classes_def.xml @@ -5,7 +5,7 @@ - + @@ -13,14 +13,14 @@ - + - + @@ -35,7 +35,7 @@ - + @@ -71,7 +71,7 @@ - + diff --git a/DataFormats/L1TCorrelator/interface/TkElectron.h b/DataFormats/L1TCorrelator/interface/TkElectron.h index 29a1df62b023b..d0b370d763002 100644 --- a/DataFormats/L1TCorrelator/interface/TkElectron.h +++ b/DataFormats/L1TCorrelator/interface/TkElectron.h @@ -19,44 +19,46 @@ #include namespace l1t { + namespace io_v1 { + class TkElectron : public TkEm { + public: + typedef TTTrack L1TTTrackType; + typedef std::vector L1TTTrackCollection; - class TkElectron : public TkEm { - public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollection; + TkElectron(); - TkElectron(); + TkElectron(const LorentzVector& p4, + const edm::Ptr& egCaloPtr, + const edm::Ptr& trkPtr, + float tkisol = -999.); - TkElectron(const LorentzVector& p4, - const edm::Ptr& egCaloPtr, - const edm::Ptr& trkPtr, - float tkisol = -999.); + TkElectron(const LorentzVector& p4, float tkisol = -999.); - TkElectron(const LorentzVector& p4, float tkisol = -999.); + // ---------- const member functions --------------------- - // ---------- const member functions --------------------- + const edm::Ptr& trkPtr() const { return trkPtr_; } - const edm::Ptr& trkPtr() const { return trkPtr_; } + float trkzVtx() const { return trkzVtx_; } + float idScore() const { return idScore_; } + // ---------- member functions --------------------------- - float trkzVtx() const { return trkzVtx_; } - float idScore() const { return idScore_; } - // ---------- member functions --------------------------- + void setTrkPtr(const edm::Ptr& tkPtr) { trkPtr_ = tkPtr; } + void setTrkzVtx(float TrkzVtx) { trkzVtx_ = TrkzVtx; } + void setIdScore(float score) { idScore_ = score; } - void setTrkPtr(const edm::Ptr& tkPtr) { trkPtr_ = tkPtr; } - void setTrkzVtx(float TrkzVtx) { trkzVtx_ = TrkzVtx; } - void setIdScore(float score) { idScore_ = score; } - - l1gt::Electron hwObj() const { - if (encoding() != HWEncoding::GT) { - throw cms::Exception("RuntimeError") << "TkElectron::hwObj : encoding is not in GT format!" << std::endl; + l1gt::Electron hwObj() const { + if (encoding() != HWEncoding::GT) { + throw cms::Exception("RuntimeError") << "TkElectron::hwObj : encoding is not in GT format!" << std::endl; + } + return l1gt::Electron::unpack_ap(egBinaryWord()); } - return l1gt::Electron::unpack_ap(egBinaryWord()); - } - - private: - edm::Ptr trkPtr_; - float trkzVtx_; - float idScore_; - }; + + private: + edm::Ptr trkPtr_; + float trkzVtx_; + float idScore_; + }; + } // namespace io_v1 + using TkElectron = io_v1::TkElectron; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkElectronFwd.h b/DataFormats/L1TCorrelator/interface/TkElectronFwd.h index afef20cfa5da5..53ce87783c290 100644 --- a/DataFormats/L1TCorrelator/interface/TkElectronFwd.h +++ b/DataFormats/L1TCorrelator/interface/TkElectronFwd.h @@ -13,7 +13,10 @@ #include "DataFormats/L1Trigger/interface/RegionalOutput.h" namespace l1t { - class TkElectron; + namespace io_v1 { + class TkElectron; + } + using TkElectron = io_v1::TkElectron; typedef std::vector TkElectronCollection; diff --git a/DataFormats/L1TCorrelator/interface/TkEm.h b/DataFormats/L1TCorrelator/interface/TkEm.h index 051a324a8e082..aff9bb1ae4a26 100644 --- a/DataFormats/L1TCorrelator/interface/TkEm.h +++ b/DataFormats/L1TCorrelator/interface/TkEm.h @@ -19,73 +19,75 @@ #include namespace l1t { + namespace io_v1 { + class TkEm : public L1Candidate { + public: + TkEm(); - class TkEm : public L1Candidate { - public: - TkEm(); + TkEm(const LorentzVector& p4, float tkisol = -999., float tkisolPV = -999); - TkEm(const LorentzVector& p4, float tkisol = -999., float tkisolPV = -999); + TkEm(const LorentzVector& p4, const edm::Ptr& egCaloPtr, float tkisol = -999., float tkisolPV = -999); - TkEm(const LorentzVector& p4, const edm::Ptr& egCaloPtr, float tkisol = -999., float tkisolPV = -999); + enum class HWEncoding { None, CT, GT }; - enum class HWEncoding { None, CT, GT }; + // ---------- const member functions --------------------- - // ---------- const member functions --------------------- + const edm::Ptr& egCaloPtr() const { return egCaloPtr_; } - const edm::Ptr& egCaloPtr() const { return egCaloPtr_; } + float trkIsol() const { return trkIsol_; } // not constrained to the PV, just track ptSum + float trkIsolPV() const { return trkIsolPV_; } // constrained to the PV by DZ + float pfIsol() const { return pfIsol_; } // not constrained to the PV, just track ptSum + float pfIsolPV() const { return pfIsolPV_; } // constrained to the PV by DZ + float puppiIsol() const { return puppiIsol_; } // not constrained to the PV, just track ptSum + float puppiIsolPV() const { return puppiIsolPV_; } // constrained to the PV by DZ - float trkIsol() const { return trkIsol_; } // not constrained to the PV, just track ptSum - float trkIsolPV() const { return trkIsolPV_; } // constrained to the PV by DZ - float pfIsol() const { return pfIsol_; } // not constrained to the PV, just track ptSum - float pfIsolPV() const { return pfIsolPV_; } // constrained to the PV by DZ - float puppiIsol() const { return puppiIsol_; } // not constrained to the PV, just track ptSum - float puppiIsolPV() const { return puppiIsolPV_; } // constrained to the PV by DZ + // ---------- member functions --------------------------- - // ---------- member functions --------------------------- + void setTrkIsol(float TrkIsol) { trkIsol_ = TrkIsol; } + void setTrkIsolPV(float TrkIsolPV) { trkIsolPV_ = TrkIsolPV; } + void setPFIsol(float pfIsol) { pfIsol_ = pfIsol; } + void setPFIsolPV(float pfIsolPV) { pfIsolPV_ = pfIsolPV; } + void setPuppiIsol(float puppiIsol) { puppiIsol_ = puppiIsol; } + void setPuppiIsolPV(float puppiIsolPV) { puppiIsolPV_ = puppiIsolPV; } + void setEgCaloPtr(const edm::Ptr& egPtr) { egCaloPtr_ = egPtr; } - void setTrkIsol(float TrkIsol) { trkIsol_ = TrkIsol; } - void setTrkIsolPV(float TrkIsolPV) { trkIsolPV_ = TrkIsolPV; } - void setPFIsol(float pfIsol) { pfIsol_ = pfIsol; } - void setPFIsolPV(float pfIsolPV) { pfIsolPV_ = pfIsolPV; } - void setPuppiIsol(float puppiIsol) { puppiIsol_ = puppiIsol; } - void setPuppiIsolPV(float puppiIsolPV) { puppiIsolPV_ = puppiIsolPV; } - void setEgCaloPtr(const edm::Ptr& egPtr) { egCaloPtr_ = egPtr; } + template + void setEgBinaryWord(ap_uint word, HWEncoding encoding) { + egBinaryWord0_ = word; + egBinaryWord1_ = (word >> 32); + egBinaryWord2_ = (word >> 64); + encoding_ = encoding; + } - template - void setEgBinaryWord(ap_uint word, HWEncoding encoding) { - egBinaryWord0_ = word; - egBinaryWord1_ = (word >> 32); - egBinaryWord2_ = (word >> 64); - encoding_ = encoding; - } + l1gt::Photon hwObj() const { + if (encoding() != HWEncoding::GT) { + throw cms::Exception("RuntimeError") << "TkEm::hwObj : encoding is not in GT format!" << std::endl; + } + return l1gt::Photon::unpack_ap(egBinaryWord()); + } - l1gt::Photon hwObj() const { - if (encoding() != HWEncoding::GT) { - throw cms::Exception("RuntimeError") << "TkEm::hwObj : encoding is not in GT format!" << std::endl; + template + ap_uint egBinaryWord() const { + return ap_uint(egBinaryWord0_) | (ap_uint(egBinaryWord1_) << 32) | (ap_uint(egBinaryWord2_) << 64); } - return l1gt::Photon::unpack_ap(egBinaryWord()); - } - - template - ap_uint egBinaryWord() const { - return ap_uint(egBinaryWord0_) | (ap_uint(egBinaryWord1_) << 32) | (ap_uint(egBinaryWord2_) << 64); - } - - HWEncoding encoding() const { return encoding_; } - - private: - edm::Ptr egCaloPtr_; - float trkIsol_; - float trkIsolPV_; - float pfIsol_; - float pfIsolPV_; - float puppiIsol_; - float puppiIsolPV_; - uint32_t egBinaryWord0_; - uint32_t egBinaryWord1_; - uint32_t egBinaryWord2_; - HWEncoding encoding_; - }; + + HWEncoding encoding() const { return encoding_; } + + private: + edm::Ptr egCaloPtr_; + float trkIsol_; + float trkIsolPV_; + float pfIsol_; + float pfIsolPV_; + float puppiIsol_; + float puppiIsolPV_; + uint32_t egBinaryWord0_; + uint32_t egBinaryWord1_; + uint32_t egBinaryWord2_; + HWEncoding encoding_; + }; + } // namespace io_v1 + using TkEm = io_v1::TkEm; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkEmFwd.h b/DataFormats/L1TCorrelator/interface/TkEmFwd.h index 8a190eec390ff..8e3e2b932068e 100644 --- a/DataFormats/L1TCorrelator/interface/TkEmFwd.h +++ b/DataFormats/L1TCorrelator/interface/TkEmFwd.h @@ -14,7 +14,10 @@ namespace l1t { - class TkEm; + namespace io_v1 { + class TkEm; + } + using TkEm = io_v1::TkEm; typedef std::vector TkEmCollection; diff --git a/DataFormats/L1TCorrelator/interface/TkEtMiss.h b/DataFormats/L1TCorrelator/interface/TkEtMiss.h index 8fdcd13246938..b7454fcafdcfc 100644 --- a/DataFormats/L1TCorrelator/interface/TkEtMiss.h +++ b/DataFormats/L1TCorrelator/interface/TkEtMiss.h @@ -6,60 +6,63 @@ #include "DataFormats/L1Trigger/interface/VertexWord.h" namespace l1t { - class TkEtMiss : public L1Candidate { - public: - enum EtMissType { kMET, kMHT, kNumTypes }; - TkEtMiss(); - TkEtMiss(const LorentzVector& p4, - EtMissType type, - const double& etTotal, - const double& etMissPU, - const double& etTotalPU, - const edm::Ref& aVtxRef = edm::Ref(), - int bx = 0); + namespace io_v1 { + class TkEtMiss : public L1Candidate { + public: + enum EtMissType { kMET, kMHT, kNumTypes }; + TkEtMiss(); + TkEtMiss(const LorentzVector& p4, + EtMissType type, + const double& etTotal, + const double& etMissPU, + const double& etTotalPU, + const edm::Ref& aVtxRef = edm::Ref(), + int bx = 0); - TkEtMiss(const LorentzVector& p4, - EtMissType type, - const double& etTotal, - const double& etMissPU, - const double& etTotalPU, - int bx = 0); + TkEtMiss(const LorentzVector& p4, + EtMissType type, + const double& etTotal, + const double& etMissPU, + const double& etTotalPU, + int bx = 0); - TkEtMiss(const LorentzVector& p4, EtMissType type, const double& EtPhi, const int& NumTracks, int bx = 0); + TkEtMiss(const LorentzVector& p4, EtMissType type, const double& EtPhi, const int& NumTracks, int bx = 0); - // ---------- const member functions --------------------- - EtMissType type() const { return type_; } // kMET or kMHT - // For type = kMET, this is |MET|; for type = kMHT, this is |MHT| - double etMiss() const { return et(); } - // For type = kMET, this is total ET; for type = kMHT, this is total HT - double etTotal() const { return etTot_; } - // EtMiss and EtTot from PU vertices - double etMissPU() const { return etMissPU_; } - double etTotalPU() const { return etTotalPU_; } - int bx() const { return bx_; } - const edm::Ref& vtxRef() const { return vtxRef_; } + // ---------- const member functions --------------------- + EtMissType type() const { return type_; } // kMET or kMHT + // For type = kMET, this is |MET|; for type = kMHT, this is |MHT| + double etMiss() const { return et(); } + // For type = kMET, this is total ET; for type = kMHT, this is total HT + double etTotal() const { return etTot_; } + // EtMiss and EtTot from PU vertices + double etMissPU() const { return etMissPU_; } + double etTotalPU() const { return etTotalPU_; } + int bx() const { return bx_; } + const edm::Ref& vtxRef() const { return vtxRef_; } - double etPhi() const { return etPhi_; } - int etQual() const { return etQual_; } + double etPhi() const { return etPhi_; } + int etQual() const { return etQual_; } - // ---------- member functions --------------------------- - void setEtTotal(const double& etTotal) { etTot_ = etTotal; } - void setBx(int bx) { bx_ = bx; } + // ---------- member functions --------------------------- + void setEtTotal(const double& etTotal) { etTot_ = etTotal; } + void setBx(int bx) { bx_ = bx; } - private: - // ---------- member data -------------------------------- - EtMissType type_; - double etTot_; - double etMissPU_; - double etTotalPU_; - edm::Ref vtxRef_; + private: + // ---------- member data -------------------------------- + EtMissType type_; + double etTot_; + double etMissPU_; + double etTotalPU_; + edm::Ref vtxRef_; - double etMiss_; - double etPhi_; - int etQual_; + double etMiss_; + double etPhi_; + int etQual_; - int bx_; - }; + int bx_; + }; + } // namespace io_v1 + using TkEtMiss = io_v1::TkEtMiss; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkEtMissFwd.h b/DataFormats/L1TCorrelator/interface/TkEtMissFwd.h index d70874b0222b2..5c9c772ed5465 100644 --- a/DataFormats/L1TCorrelator/interface/TkEtMissFwd.h +++ b/DataFormats/L1TCorrelator/interface/TkEtMissFwd.h @@ -7,7 +7,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace l1t { - class TkEtMiss; + namespace io_v1 { + class TkEtMiss; + } + using TkEtMiss = io_v1::TkEtMiss; typedef std::vector TkEtMissCollection; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkHTMiss.h b/DataFormats/L1TCorrelator/interface/TkHTMiss.h index 174511c34aa09..f4b60812642f7 100644 --- a/DataFormats/L1TCorrelator/interface/TkHTMiss.h +++ b/DataFormats/L1TCorrelator/interface/TkHTMiss.h @@ -12,47 +12,50 @@ #include "DataFormats/L1TCorrelator/interface/TkJetFwd.h" namespace l1t { - class TkHTMiss : public L1Candidate { - public: - TkHTMiss(); - TkHTMiss(const LorentzVector& p4, - double EtTotal, - const edm::RefProd& jetCollRef = edm::RefProd(), - const edm::Ref& aVtxRef = edm::Ref(), - int bx = 0); - - // ---------- const member functions --------------------- - double EtMiss() const { // HTM (missing HT) - return et(); - } - double etTotal() const { return etTot_; } - // HTM and HT from PU vertices - double etMissPU() const { return etMissPU_; } - double etTotalPU() const { return etTotalPU_; } - int bx() const { return bx_; } - float vtx() const { return zvtx_; } - const edm::RefProd& jetCollectionRef() const { return jetCollectionRef_; } - const edm::Ref& vtxRef() const { return vtxRef_; } - - // ---------- member functions --------------------------- - void setEtTotal(double EtTotal) { etTot_ = EtTotal; } - void setEtTotalPU(double EtTotalPU) { etTotalPU_ = EtTotalPU; } - void setEtMissPU(double EtMissPU) { etMissPU_ = EtMissPU; } - void setVtx(const float& zvtx) { zvtx_ = zvtx; } - void setBx(int bx) { bx_ = bx; } - - private: - // ---------- member data -------------------------------- - float zvtx_; // zvtx used to constrain the jets - double etTot_; // HT - double etMissPU_; // HTM form jets that don't come from zvtx - double etTotalPU_; // HT from jets that don't come from zvtx - - edm::RefProd jetCollectionRef_; - edm::Ref vtxRef_; - - int bx_; - }; + namespace io_v1 { + class TkHTMiss : public L1Candidate { + public: + TkHTMiss(); + TkHTMiss(const LorentzVector& p4, + double EtTotal, + const edm::RefProd& jetCollRef = edm::RefProd(), + const edm::Ref& aVtxRef = edm::Ref(), + int bx = 0); + + // ---------- const member functions --------------------- + double EtMiss() const { // HTM (missing HT) + return et(); + } + double etTotal() const { return etTot_; } + // HTM and HT from PU vertices + double etMissPU() const { return etMissPU_; } + double etTotalPU() const { return etTotalPU_; } + int bx() const { return bx_; } + float vtx() const { return zvtx_; } + const edm::RefProd& jetCollectionRef() const { return jetCollectionRef_; } + const edm::Ref& vtxRef() const { return vtxRef_; } + + // ---------- member functions --------------------------- + void setEtTotal(double EtTotal) { etTot_ = EtTotal; } + void setEtTotalPU(double EtTotalPU) { etTotalPU_ = EtTotalPU; } + void setEtMissPU(double EtMissPU) { etMissPU_ = EtMissPU; } + void setVtx(const float& zvtx) { zvtx_ = zvtx; } + void setBx(int bx) { bx_ = bx; } + + private: + // ---------- member data -------------------------------- + float zvtx_; // zvtx used to constrain the jets + double etTot_; // HT + double etMissPU_; // HTM form jets that don't come from zvtx + double etTotalPU_; // HT from jets that don't come from zvtx + + edm::RefProd jetCollectionRef_; + edm::Ref vtxRef_; + + int bx_; + }; + } // namespace io_v1 + using TkHTMiss = io_v1::TkHTMiss; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkHTMissFwd.h b/DataFormats/L1TCorrelator/interface/TkHTMissFwd.h index 6be4314fe7858..6fe2b146a8e71 100644 --- a/DataFormats/L1TCorrelator/interface/TkHTMissFwd.h +++ b/DataFormats/L1TCorrelator/interface/TkHTMissFwd.h @@ -7,7 +7,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace l1t { - class TkHTMiss; + namespace io_v1 { + class TkHTMiss; + } + using TkHTMiss = io_v1::TkHTMiss; typedef std::vector TkHTMissCollection; } // namespace l1t diff --git a/DataFormats/L1TCorrelator/interface/TkJet.h b/DataFormats/L1TCorrelator/interface/TkJet.h index 82f983d23f168..401ac20591e46 100644 --- a/DataFormats/L1TCorrelator/interface/TkJet.h +++ b/DataFormats/L1TCorrelator/interface/TkJet.h @@ -14,52 +14,54 @@ #include "DataFormats/L1TrackTrigger/interface/TTTypes.h" namespace l1t { + namespace io_v1 { + class TkJet : public L1Candidate { + public: + typedef TTTrack L1TTTrackType; + typedef std::vector L1TTTrackCollection; - class TkJet : public L1Candidate { - public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollection; + TkJet(); - TkJet(); + TkJet(const LorentzVector& p4, + const edm::Ref& jetRef, + const std::vector >& trkPtrs, + float jetvtx = -999.); + TkJet(const LorentzVector& p4, + const std::vector >& trkPtrs, + float jetvtx = -999., + unsigned int ntracks = 0, + unsigned int tighttracks = 0, + unsigned int displacedtracks = 0, + unsigned int tightdisplacedtracks = 0, + bool displacedTag = false); - TkJet(const LorentzVector& p4, - const edm::Ref& jetRef, - const std::vector >& trkPtrs, - float jetvtx = -999.); - TkJet(const LorentzVector& p4, - const std::vector >& trkPtrs, - float jetvtx = -999., - unsigned int ntracks = 0, - unsigned int tighttracks = 0, - unsigned int displacedtracks = 0, - unsigned int tightdisplacedtracks = 0, - bool displacedTag = false); + // ---------- const member functions --------------------- - // ---------- const member functions --------------------- + const edm::Ref& jetRef() const { return jetRef_; } - const edm::Ref& jetRef() const { return jetRef_; } + const std::vector >& trkPtrs() const { return trkPtrs_; } - const std::vector >& trkPtrs() const { return trkPtrs_; } + float jetVtx() const { return JetVtx_; } + unsigned int ntracks() const { return ntracks_; } + unsigned int nTighttracks() const { return tighttracks_; } + unsigned int nDisptracks() const { return displacedtracks_; } + unsigned int nTightDisptracks() const { return tightdisplacedtracks_; } + bool isDisplaced() const { return displacedTag_; } - float jetVtx() const { return JetVtx_; } - unsigned int ntracks() const { return ntracks_; } - unsigned int nTighttracks() const { return tighttracks_; } - unsigned int nDisptracks() const { return displacedtracks_; } - unsigned int nTightDisptracks() const { return tightdisplacedtracks_; } - bool isDisplaced() const { return displacedTag_; } + // ---------- member functions --------------------------- + void setJetVtx(float JetVtx) { JetVtx_ = JetVtx; } - // ---------- member functions --------------------------- - void setJetVtx(float JetVtx) { JetVtx_ = JetVtx; } + int bx() const; - int bx() const; - - private: - edm::Ref jetRef_; - std::vector > trkPtrs_; - float JetVtx_; - unsigned int ntracks_, tighttracks_, displacedtracks_, tightdisplacedtracks_; - bool displacedTag_; - }; + private: + edm::Ref jetRef_; + std::vector > trkPtrs_; + float JetVtx_; + unsigned int ntracks_, tighttracks_, displacedtracks_, tightdisplacedtracks_; + bool displacedTag_; + }; + } // namespace io_v1 + using TkJet = io_v1::TkJet; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkJetFwd.h b/DataFormats/L1TCorrelator/interface/TkJetFwd.h index 5696712a4141e..da9690e20af1c 100644 --- a/DataFormats/L1TCorrelator/interface/TkJetFwd.h +++ b/DataFormats/L1TCorrelator/interface/TkJetFwd.h @@ -12,8 +12,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace l1t { - - class TkJet; + namespace io_v1 { + class TkJet; + } + using TkJet = io_v1::TkJet; typedef edm::RefProd TkJetRefProd; diff --git a/DataFormats/L1TCorrelator/interface/TkTriplet.h b/DataFormats/L1TCorrelator/interface/TkTriplet.h index 2c2cc599432b6..f4c635b40fe30 100644 --- a/DataFormats/L1TCorrelator/interface/TkTriplet.h +++ b/DataFormats/L1TCorrelator/interface/TkTriplet.h @@ -15,41 +15,43 @@ #include namespace l1t { - - class TkTriplet : public L1Candidate { - public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollection; - - 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, - std::vector> trkPtrList); - - ~TkTriplet() override {} - - int getTripletCharge() const { return charge_; } - double getPairMassMax() const { return pair_mass_max_; } - double getPairMassMin() const { return pair_mass_min_; } - double getPairDzMax() const { return pair_dz_max_; } - double getPairDzMin() const { return pair_dz_min_; } - const edm::Ptr& trkPtr(size_t i) const { return trkPtrList_.at(i); } - int bx() const; - - private: - int charge_; - double pair_mass_max_; - double pair_mass_min_; - double pair_dz_max_; - double pair_dz_min_; - std::vector> trkPtrList_; - }; + namespace io_v1 { + class TkTriplet : public L1Candidate { + public: + typedef TTTrack L1TTTrackType; + typedef std::vector L1TTTrackCollection; + + 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, + std::vector> trkPtrList); + + ~TkTriplet() override {} + + int getTripletCharge() const { return charge_; } + double getPairMassMax() const { return pair_mass_max_; } + double getPairMassMin() const { return pair_mass_min_; } + double getPairDzMax() const { return pair_dz_max_; } + double getPairDzMin() const { return pair_dz_min_; } + const edm::Ptr& trkPtr(size_t i) const { return trkPtrList_.at(i); } + int bx() const; + + private: + int charge_; + double pair_mass_max_; + double pair_mass_min_; + double pair_dz_max_; + double pair_dz_min_; + std::vector> trkPtrList_; + }; + } // namespace io_v1 + using TkTriplet = io_v1::TkTriplet; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkTripletFwd.h b/DataFormats/L1TCorrelator/interface/TkTripletFwd.h index 0132fc2b66765..2af78354ca3a3 100644 --- a/DataFormats/L1TCorrelator/interface/TkTripletFwd.h +++ b/DataFormats/L1TCorrelator/interface/TkTripletFwd.h @@ -15,7 +15,10 @@ namespace l1t { - class TkTriplet; + namespace io_v1 { + class TkTriplet; + } + using TkTriplet = io_v1::TkTriplet; typedef edm::RefProd TkTripletRefProd; diff --git a/DataFormats/L1TCorrelator/src/classes_def.xml b/DataFormats/L1TCorrelator/src/classes_def.xml index 30ab39372a30b..6f5b865066d4c 100644 --- a/DataFormats/L1TCorrelator/src/classes_def.xml +++ b/DataFormats/L1TCorrelator/src/classes_def.xml @@ -1,113 +1,111 @@ - - + + - - - + + + - - + + - - - - + + + + - + - + - + - - + + - - - - + + + + - - + + - - - - + + + + - - + + - - - - + + + + - - + + - - - + + + - - + - - + - + - + - + diff --git a/DataFormats/L1THGCal/interface/HGCalCluster.h b/DataFormats/L1THGCal/interface/HGCalCluster.h index 2c132916bf024..b4b813b38c1c9 100644 --- a/DataFormats/L1THGCal/interface/HGCalCluster.h +++ b/DataFormats/L1THGCal/interface/HGCalCluster.h @@ -8,22 +8,24 @@ namespace l1t { - class HGCalCluster : public HGCalClusterT { - public: - HGCalCluster() {} - HGCalCluster(const LorentzVector p4, int pt = 0, int eta = 0, int phi = 0); + namespace io_v1 { + class HGCalCluster : public HGCalClusterT { + public: + HGCalCluster() {} + HGCalCluster(const LorentzVector p4, int pt = 0, int eta = 0, int phi = 0); - HGCalCluster(const edm::Ptr &tc); + HGCalCluster(const edm::Ptr& tc); - ~HGCalCluster() override; + ~HGCalCluster() override; - void setModule(uint32_t module) { module_ = module; } - uint32_t module() const { return module_; } - - private: - uint32_t module_; - }; + void setModule(uint32_t module) { module_ = module; } + uint32_t module() const { return module_; } + private: + uint32_t module_; + }; + } // namespace io_v1 + using HGCalCluster = io_v1::HGCalCluster; typedef BXVector HGCalClusterBxCollection; } // namespace l1t diff --git a/DataFormats/L1THGCal/interface/HGCalMulticluster.h b/DataFormats/L1THGCal/interface/HGCalMulticluster.h index d0d58a6d1021d..dc0275f5b5da3 100644 --- a/DataFormats/L1THGCal/interface/HGCalMulticluster.h +++ b/DataFormats/L1THGCal/interface/HGCalMulticluster.h @@ -9,89 +9,92 @@ #include namespace l1t { + namespace io_v1 { + class HGCalMulticluster : public HGCalClusterT { + public: + HGCalMulticluster() : hOverEValid_(false) {} + HGCalMulticluster(const LorentzVector p4, int pt = 0, int eta = 0, int phi = 0); + + HGCalMulticluster(const edm::Ptr& tc, float fraction = 1); + + ~HGCalMulticluster() override; + + float hOverE() const { + // --- this below would be faster when reading old objects, as HoE will only be computed once, + // --- but it may not be allowed by CMS rules because of the const_cast + // --- and could potentially cause a data race + // if (!hOverEValid_) (const_cast(this))->saveHOverE(); + // --- this below is safe in any case + return hOverEValid_ ? hOverE_ : l1t::HGCalClusterT::hOverE(); + } - class HGCalMulticluster : public HGCalClusterT { - public: - HGCalMulticluster() : hOverEValid_(false) {} - HGCalMulticluster(const LorentzVector p4, int pt = 0, int eta = 0, int phi = 0); - - HGCalMulticluster(const edm::Ptr& tc, float fraction = 1); - - ~HGCalMulticluster() override; - - float hOverE() const { - // --- this below would be faster when reading old objects, as HoE will only be computed once, - // --- but it may not be allowed by CMS rules because of the const_cast - // --- and could potentially cause a data race - // if (!hOverEValid_) (const_cast(this))->saveHOverE(); - // --- this below is safe in any case - return hOverEValid_ ? hOverE_ : l1t::HGCalClusterT::hOverE(); - } - - void saveHOverE() { - hOverE_ = l1t::HGCalClusterT::hOverE(); - hOverEValid_ = true; - } - - enum EnergyInterpretation { EM = 0 }; - - void saveEnergyInterpretation(const HGCalMulticluster::EnergyInterpretation eInt, double energy); + void saveHOverE() { + hOverE_ = l1t::HGCalClusterT::hOverE(); + hOverEValid_ = true; + } - double iEnergy(const HGCalMulticluster::EnergyInterpretation eInt) const { - return energy() * interpretationFraction(eInt); - } + enum EnergyInterpretation { EM = 0 }; - double iPt(const HGCalMulticluster::EnergyInterpretation eInt) const { return pt() * interpretationFraction(eInt); } + void saveEnergyInterpretation(const HGCalMulticluster::EnergyInterpretation eInt, double energy); - math::XYZTLorentzVector iP4(const HGCalMulticluster::EnergyInterpretation eInt) const { - return p4() * interpretationFraction(eInt); - } + double iEnergy(const HGCalMulticluster::EnergyInterpretation eInt) const { + return energy() * interpretationFraction(eInt); + } - math::PtEtaPhiMLorentzVector iPolarP4(const HGCalMulticluster::EnergyInterpretation eInt) const { - return math::PtEtaPhiMLorentzVector(pt() * interpretationFraction(eInt), eta(), phi(), 0.); - } + double iPt(const HGCalMulticluster::EnergyInterpretation eInt) const { + return pt() * interpretationFraction(eInt); + } - private: - template - struct KeyGetter { - const typename Iter::value_type::first_type& operator()(const typename Iter::value_type& p) const { - return p.first; + math::XYZTLorentzVector iP4(const HGCalMulticluster::EnergyInterpretation eInt) const { + return p4() * interpretationFraction(eInt); } - }; - template - boost::transform_iterator, Iter> key_iterator(Iter itr) const { - return boost::make_transform_iterator, Iter>(itr, KeyGetter()); - } + math::PtEtaPhiMLorentzVector iPolarP4(const HGCalMulticluster::EnergyInterpretation eInt) const { + return math::PtEtaPhiMLorentzVector(pt() * interpretationFraction(eInt), eta(), phi(), 0.); + } - public: - typedef boost::transform_iterator::const_iterator>, - std::map::const_iterator> - EnergyInterpretation_const_iterator; + private: + template + struct KeyGetter { + const typename Iter::value_type::first_type& operator()(const typename Iter::value_type& p) const { + return p.first; + } + }; + + template + boost::transform_iterator, Iter> key_iterator(Iter itr) const { + return boost::make_transform_iterator, Iter>(itr, KeyGetter()); + } - std::pair energyInterpretations() const { - return std::make_pair(key_iterator(energyInterpretationFractions_.cbegin()), - key_iterator(energyInterpretationFractions_.cend())); - } + public: + typedef boost::transform_iterator::const_iterator>, + std::map::const_iterator> + EnergyInterpretation_const_iterator; - EnergyInterpretation_const_iterator interpretations_begin() const { - return key_iterator(energyInterpretationFractions_.cbegin()); - } + std::pair energyInterpretations() const { + return std::make_pair(key_iterator(energyInterpretationFractions_.cbegin()), + key_iterator(energyInterpretationFractions_.cend())); + } - EnergyInterpretation_const_iterator interpretations_end() const { - return key_iterator(energyInterpretationFractions_.cend()); - } + EnergyInterpretation_const_iterator interpretations_begin() const { + return key_iterator(energyInterpretationFractions_.cbegin()); + } - size_type interpretations_size() const { return energyInterpretationFractions_.size(); } + EnergyInterpretation_const_iterator interpretations_end() const { + return key_iterator(energyInterpretationFractions_.cend()); + } - private: - double interpretationFraction(const HGCalMulticluster::EnergyInterpretation eInt) const; + size_type interpretations_size() const { return energyInterpretationFractions_.size(); } - float hOverE_; - bool hOverEValid_; - std::map energyInterpretationFractions_; - }; + private: + double interpretationFraction(const HGCalMulticluster::EnergyInterpretation eInt) const; + float hOverE_; + bool hOverEValid_; + std::map energyInterpretationFractions_; + }; + } // namespace io_v1 + using HGCalMulticluster = io_v1::HGCalMulticluster; typedef BXVector HGCalMulticlusterBxCollection; } // namespace l1t diff --git a/DataFormats/L1THGCal/interface/HGCalTower.h b/DataFormats/L1THGCal/interface/HGCalTower.h index 74c392ee0ee07..5e4c3634cc36a 100644 --- a/DataFormats/L1THGCal/interface/HGCalTower.h +++ b/DataFormats/L1THGCal/interface/HGCalTower.h @@ -6,61 +6,60 @@ #include "DataFormats/L1THGCal/interface/HGCalTowerID.h" namespace l1t { - - class HGCalTower; + namespace io_v1 { + class HGCalTower : public L1Candidate { + public: + HGCalTower() : etEm_(0.), etHad_(0.), id_(0), hwEtEm_(0), hwEtHad_(0), hwEtRatio_(0) {} + + HGCalTower(double etEm, + double etHad, + double eta, + double phi, + uint32_t id, + int hwpt = 0, + int hweta = 0, + int hwphi = 0, + int qual = 0, + int hwEtEm = 0, + int hwEtHad = 0, + int hwEtRatio = 0); + + ~HGCalTower() override; + + void addEtEm(double et); + void addEtHad(double et); + + double etEm() const { return etEm_; }; + double etHad() const { return etHad_; }; + + const HGCalTower& operator+=(const HGCalTower& tower); + + HGCalTowerID id() const { return id_; } + short zside() const { return id_.zside(); } + + void setHwEtEm(int et) { hwEtEm_ = et; } + void setHwEtHad(int et) { hwEtHad_ = et; } + void setHwEtRatio(int ratio) { hwEtRatio_ = ratio; } + + int hwEtEm() const { return hwEtEm_; } + int hwEtHad() const { return hwEtHad_; } + int hwEtRatio() const { return hwEtRatio_; } + + private: + void addEt(double et); + + // additional hardware quantities + double etEm_; + double etHad_; + HGCalTowerID id_; + + int hwEtEm_; + int hwEtHad_; + int hwEtRatio_; + }; + } // namespace io_v1 + using HGCalTower = io_v1::HGCalTower; typedef BXVector HGCalTowerBxCollection; - - class HGCalTower : public L1Candidate { - public: - HGCalTower() : etEm_(0.), etHad_(0.), id_(0), hwEtEm_(0), hwEtHad_(0), hwEtRatio_(0) {} - - HGCalTower(double etEm, - double etHad, - double eta, - double phi, - uint32_t id, - int hwpt = 0, - int hweta = 0, - int hwphi = 0, - int qual = 0, - int hwEtEm = 0, - int hwEtHad = 0, - int hwEtRatio = 0); - - ~HGCalTower() override; - - void addEtEm(double et); - void addEtHad(double et); - - double etEm() const { return etEm_; }; - double etHad() const { return etHad_; }; - - const HGCalTower& operator+=(const HGCalTower& tower); - - HGCalTowerID id() const { return id_; } - short zside() const { return id_.zside(); } - - void setHwEtEm(int et) { hwEtEm_ = et; } - void setHwEtHad(int et) { hwEtHad_ = et; } - void setHwEtRatio(int ratio) { hwEtRatio_ = ratio; } - - int hwEtEm() const { return hwEtEm_; } - int hwEtHad() const { return hwEtHad_; } - int hwEtRatio() const { return hwEtRatio_; } - - private: - void addEt(double et); - - // additional hardware quantities - double etEm_; - double etHad_; - HGCalTowerID id_; - - int hwEtEm_; - int hwEtHad_; - int hwEtRatio_; - }; - } // namespace l1t #endif diff --git a/DataFormats/L1THGCal/interface/HGCalTowerMap.h b/DataFormats/L1THGCal/interface/HGCalTowerMap.h index d670ea2f29be0..2289cf501c097 100644 --- a/DataFormats/L1THGCal/interface/HGCalTowerMap.h +++ b/DataFormats/L1THGCal/interface/HGCalTowerMap.h @@ -8,30 +8,31 @@ namespace l1t { - class HGCalTowerMap; struct HGCalTowerCoord; - typedef BXVector HGCalTowerMapBxCollection; - - class HGCalTowerMap { - public: - HGCalTowerMap() : layer_(0) {} + namespace io_v1 { + class HGCalTowerMap { + public: + HGCalTowerMap() : layer_(0) {} - HGCalTowerMap(const std::vector& tower_ids, const int layer); + HGCalTowerMap(const std::vector& tower_ids, const int layer); - int layer() const { return layer_; } + int layer() const { return layer_; } - const HGCalTowerMap& operator+=(const HGCalTowerMap& map); + const HGCalTowerMap& operator+=(const HGCalTowerMap& map); - bool addEt(const std::unordered_map& towerIDandShares, float etEm, float etHad); + bool addEt(const std::unordered_map& towerIDandShares, float etEm, float etHad); - unsigned nTowers() const { return towerMap_.size(); } - const std::unordered_map& towers() const { return towerMap_; } + unsigned nTowers() const { return towerMap_.size(); } + const std::unordered_map& towers() const { return towerMap_; } - private: - std::unordered_map towerMap_; - unsigned layer_; - }; + private: + std::unordered_map towerMap_; + unsigned layer_; + }; + } // namespace io_v1 + using HGCalTowerMap = io_v1::HGCalTowerMap; + typedef BXVector HGCalTowerMapBxCollection; } // namespace l1t #endif diff --git a/DataFormats/L1THGCal/interface/HGCalTriggerCell.h b/DataFormats/L1THGCal/interface/HGCalTriggerCell.h index b65fb11316047..a7ee9e32d281c 100644 --- a/DataFormats/L1THGCal/interface/HGCalTriggerCell.h +++ b/DataFormats/L1THGCal/interface/HGCalTriggerCell.h @@ -7,46 +7,46 @@ #include "DataFormats/DetId/interface/DetId.h" namespace l1t { + namespace io_v1 { + class HGCalTriggerCell : public L1Candidate { + public: + HGCalTriggerCell() {} - class HGCalTriggerCell; - typedef BXVector HGCalTriggerCellBxCollection; - - class HGCalTriggerCell : public L1Candidate { - public: - HGCalTriggerCell() {} + HGCalTriggerCell(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, uint32_t detid = 0); - HGCalTriggerCell(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, uint32_t detid = 0); + ~HGCalTriggerCell() override; - ~HGCalTriggerCell() override; + void setDetId(uint32_t detid) { detid_ = DetId(detid); } + void setPosition(const GlobalPoint& position) { position_ = position; } - void setDetId(uint32_t detid) { detid_ = DetId(detid); } - void setPosition(const GlobalPoint& position) { position_ = position; } + uint32_t detId() const { return detid_.rawId(); } + const GlobalPoint& position() const { return position_; } - uint32_t detId() const { return detid_.rawId(); } - const GlobalPoint& position() const { return position_; } + int subdetId() const { return detid_.subdetId(); } - int subdetId() const { return detid_.subdetId(); } + void setMipPt(double value) { mipPt_ = value; } + double mipPt() const { return mipPt_; } - void setMipPt(double value) { mipPt_ = value; } - double mipPt() const { return mipPt_; } + void setUncompressedCharge(uint32_t value) { uncompressedCharge_ = value; } + uint32_t uncompressedCharge() const { return uncompressedCharge_; } - void setUncompressedCharge(uint32_t value) { uncompressedCharge_ = value; } - uint32_t uncompressedCharge() const { return uncompressedCharge_; } + void setCompressedCharge(uint32_t value) { compressedCharge_ = value; } + uint32_t compressedCharge() const { return compressedCharge_; } - void setCompressedCharge(uint32_t value) { compressedCharge_ = value; } - uint32_t compressedCharge() const { return compressedCharge_; } + void setPt(double pT); - void setPt(double pT); + private: + DetId detid_; + GlobalPoint position_; - private: - DetId detid_; - GlobalPoint position_; + double mipPt_{0.}; - double mipPt_{0.}; - - uint32_t uncompressedCharge_{0}; - uint32_t compressedCharge_{0}; - }; + uint32_t uncompressedCharge_{0}; + uint32_t compressedCharge_{0}; + }; + } // namespace io_v1 + using HGCalTriggerCell = io_v1::HGCalTriggerCell; + typedef BXVector HGCalTriggerCellBxCollection; } // namespace l1t diff --git a/DataFormats/L1THGCal/src/classes_def.xml b/DataFormats/L1THGCal/src/classes_def.xml index cb370fe7f7025..6bb8390f5bf74 100644 --- a/DataFormats/L1THGCal/src/classes_def.xml +++ b/DataFormats/L1THGCal/src/classes_def.xml @@ -14,47 +14,47 @@ - - - + + + - + - + - + - + - - + + - + - + - - + + - + - - + + - + - + @@ -66,33 +66,33 @@ - - + + - - + + - + - - + + - - - - + + + + - - - - + + + + - + diff --git a/DataFormats/L1TMuon/interface/EMTFHit.h b/DataFormats/L1TMuon/interface/EMTFHit.h index 00a12df3f8643..74d8559c6a71d 100644 --- a/DataFormats/L1TMuon/interface/EMTFHit.h +++ b/DataFormats/L1TMuon/interface/EMTFHit.h @@ -23,231 +23,232 @@ namespace l1t { namespace l1tmu = L1TMuon; - class EMTFHit { - public: - EMTFHit() - : rawDetId(0), - subsystem(-99), - endcap(-99), - station(-99), - ring(-99), - sector(-99), - sector_RPC(-99), - sector_idx(-99), - subsector(-99), - subsector_RPC(-99), - chamber(-99), - csc_ID(-99), - csc_nID(-99), - roll(-99), - neighbor(-99), - mpc_link(-99), - pc_sector(-99), - pc_station(-99), - pc_chamber(-99), - pc_segment(-99), - wire(-99), - strip(-99), - strip_hi(-99), - strip_low(-99), - strip_quart(-99), // Run 3 - strip_eighth(-99), // Run 3 - strip_quart_bit(-99), // Run 3 - strip_eighth_bit(-99), // Run 3 - muon_shower_valid(-99), // Run 3 muon shower - muon_shower_inTime(-99), // Run 3 muon shower - muon_shower_outOfTime(-99), // Run 3 muon shower - track_num(-99), - quality(-99), - pattern(-99), - pattern_run3(-99), // Run 3 - bend(-99), - slope(-99), // Run 3 - valid(-99), - sync_err(-99), - layer(-99), // TODO: verify inclusion for GEM, or better to generalize this class... - JS 06.07.20 - bc0(-99), - bx(-99), - stub_num(-99), - phi_fp(-99), - theta_fp(-99), - zone_hit(-99), - zone_code(-99), - fs_segment(-99), - fs_zone_code(-99), - bt_station(-99), - bt_segment(-99), - phi_loc(-99), - phi_glob(-999), - theta(-99), - eta(-99), - time(-99), - phi_sim(-999), - theta_sim(-99), - eta_sim(-99), - rho_sim(-99), - z_sim(-99), - alct_quality(-99), - clct_quality(-99) {} + namespace io_v1 { + class EMTFHit { + public: + EMTFHit() + : rawDetId(0), + subsystem(-99), + endcap(-99), + station(-99), + ring(-99), + sector(-99), + sector_RPC(-99), + sector_idx(-99), + subsector(-99), + subsector_RPC(-99), + chamber(-99), + csc_ID(-99), + csc_nID(-99), + roll(-99), + neighbor(-99), + mpc_link(-99), + pc_sector(-99), + pc_station(-99), + pc_chamber(-99), + pc_segment(-99), + wire(-99), + strip(-99), + strip_hi(-99), + strip_low(-99), + strip_quart(-99), // Run 3 + strip_eighth(-99), // Run 3 + strip_quart_bit(-99), // Run 3 + strip_eighth_bit(-99), // Run 3 + muon_shower_valid(-99), // Run 3 muon shower + muon_shower_inTime(-99), // Run 3 muon shower + muon_shower_outOfTime(-99), // Run 3 muon shower + track_num(-99), + quality(-99), + pattern(-99), + pattern_run3(-99), // Run 3 + bend(-99), + slope(-99), // Run 3 + valid(-99), + sync_err(-99), + layer(-99), // TODO: verify inclusion for GEM, or better to generalize this class... - JS 06.07.20 + bc0(-99), + bx(-99), + stub_num(-99), + phi_fp(-99), + theta_fp(-99), + zone_hit(-99), + zone_code(-99), + fs_segment(-99), + fs_zone_code(-99), + bt_station(-99), + bt_segment(-99), + phi_loc(-99), + phi_glob(-999), + theta(-99), + eta(-99), + time(-99), + phi_sim(-999), + theta_sim(-99), + eta_sim(-99), + rho_sim(-99), + z_sim(-99), + alct_quality(-99), + clct_quality(-99) {} - virtual ~EMTFHit() {} + virtual ~EMTFHit() {} - CSCDetId CreateCSCDetId() const; - RPCDetId CreateRPCDetId() const; - GEMDetId CreateGEMDetId() const; - ME0DetId CreateME0DetId() const; + CSCDetId CreateCSCDetId() const; + RPCDetId CreateRPCDetId() const; + GEMDetId CreateGEMDetId() const; + ME0DetId CreateME0DetId() const; - // void ImportCSCCorrelatedLCTDigi (const CSCCorrelatedLCTDigi& _digi); - CSCCorrelatedLCTDigi CreateCSCCorrelatedLCTDigi(const bool isRun3) const; - // Run 3 muon shower - CSCShowerDigi CreateCSCShowerDigi() const; - // void ImportRPCDigi (const RPCDigi& _digi); - // RPCDigi CreateRPCDigi() const; - // void ImportCPPFDigi (const CPPFDigi& _digi); - CPPFDigi CreateCPPFDigi() const; - // void ImportGEMPadDigiCluster (const GEMPadDigiCluster& _digi); // TODO: implement placeholder when others are implemented - GEMPadDigiCluster CreateGEMPadDigiCluster() const; + // void ImportCSCCorrelatedLCTDigi (const CSCCorrelatedLCTDigi& _digi); + CSCCorrelatedLCTDigi CreateCSCCorrelatedLCTDigi(const bool isRun3) const; + // Run 3 muon shower + CSCShowerDigi CreateCSCShowerDigi() const; + // void ImportRPCDigi (const RPCDigi& _digi); + // RPCDigi CreateRPCDigi() const; + // void ImportCPPFDigi (const CPPFDigi& _digi); + CPPFDigi CreateCPPFDigi() const; + // void ImportGEMPadDigiCluster (const GEMPadDigiCluster& _digi); // TODO: implement placeholder when others are implemented + GEMPadDigiCluster CreateGEMPadDigiCluster() const; - // void PrintSimulatorHeader() const; - // void PrintForSimulator() const; + // void PrintSimulatorHeader() const; + // void PrintForSimulator() const; - //void SetCSCDetId (const CSCDetId& id) { csc_DetId = id; } - //void SetRPCDetId (const RPCDetId& id) { rpc_DetId = id; } - //void SetGEMDetId (const GEMDetId& id) { gem_DetId = id; } - //void SetCSCLCTDigi (const CSCCorrelatedLCTDigi& digi) { csc_LCTDigi = digi; } - //void SetRPCDigi (const RPCDigi& digi) { rpc_Digi = digi; } - //void SetCPPFDigi (const CPPFDigi& digi) { cppf_Digi = digi; } - //void SetGEMPadDigiCluster (const GEMPadDigiCluster& digi) { gem_PadClusterDigi = digi; } - void SetCSCDetId(const CSCDetId& id) { rawDetId = id.rawId(); } - void SetRPCDetId(const RPCDetId& id) { rawDetId = id.rawId(); } - void SetGEMDetId(const GEMDetId& id) { rawDetId = id.rawId(); } - void SetME0DetId(const ME0DetId& id) { rawDetId = id.rawId(); } - void SetDTDetId(const DTChamberId& id) { rawDetId = id.rawId(); } + //void SetCSCDetId (const CSCDetId& id) { csc_DetId = id; } + //void SetRPCDetId (const RPCDetId& id) { rpc_DetId = id; } + //void SetGEMDetId (const GEMDetId& id) { gem_DetId = id; } + //void SetCSCLCTDigi (const CSCCorrelatedLCTDigi& digi) { csc_LCTDigi = digi; } + //void SetRPCDigi (const RPCDigi& digi) { rpc_Digi = digi; } + //void SetCPPFDigi (const CPPFDigi& digi) { cppf_Digi = digi; } + //void SetGEMPadDigiCluster (const GEMPadDigiCluster& digi) { gem_PadClusterDigi = digi; } + void SetCSCDetId(const CSCDetId& id) { rawDetId = id.rawId(); } + void SetRPCDetId(const RPCDetId& id) { rawDetId = id.rawId(); } + void SetGEMDetId(const GEMDetId& id) { rawDetId = id.rawId(); } + void SetME0DetId(const ME0DetId& id) { rawDetId = id.rawId(); } + void SetDTDetId(const DTChamberId& id) { rawDetId = id.rawId(); } - //CSCDetId CSC_DetId () const { return csc_DetId; } - //RPCDetId RPC_DetId () const { return rpc_DetId; } - //GEMDetId GEM_DetId () const { return gem_DetId; } - //CSCCorrelatedLCTDigi CSC_LCTDigi () const { return csc_LCTDigi; } - //RPCDigi RPC_Digi () const { return rpc_Digi; } - //CPPFDigi CPPF_Digi () const { return cppf_Digi; } - //GEMPadDigiCluster GEM_PadClusterDigi () const { return gem_PadClusterDigi; } - CSCDetId CSC_DetId() const { return CSCDetId(rawDetId); } - RPCDetId RPC_DetId() const { return RPCDetId(rawDetId); } - GEMDetId GEM_DetId() const { return GEMDetId(rawDetId); } - ME0DetId ME0_DetId() const { return ME0DetId(rawDetId); } - DTChamberId DT_DetId() const { return DTChamberId(rawDetId); } + //CSCDetId CSC_DetId () const { return csc_DetId; } + //RPCDetId RPC_DetId () const { return rpc_DetId; } + //GEMDetId GEM_DetId () const { return gem_DetId; } + //CSCCorrelatedLCTDigi CSC_LCTDigi () const { return csc_LCTDigi; } + //RPCDigi RPC_Digi () const { return rpc_Digi; } + //CPPFDigi CPPF_Digi () const { return cppf_Digi; } + //GEMPadDigiCluster GEM_PadClusterDigi () const { return gem_PadClusterDigi; } + CSCDetId CSC_DetId() const { return CSCDetId(rawDetId); } + RPCDetId RPC_DetId() const { return RPCDetId(rawDetId); } + GEMDetId GEM_DetId() const { return GEMDetId(rawDetId); } + ME0DetId ME0_DetId() const { return ME0DetId(rawDetId); } + DTChamberId DT_DetId() const { return DTChamberId(rawDetId); } - void set_subsystem(int bits) { subsystem = bits; } - void set_endcap(int bits) { endcap = bits; } - void set_station(int bits) { station = bits; } - void set_ring(int bits) { ring = bits; } - void set_sector(int bits) { sector = bits; } - void set_sector_RPC(int bits) { sector_RPC = bits; } - void set_sector_idx(int bits) { sector_idx = bits; } - void set_subsector(int bits) { subsector = bits; } - void set_subsector_RPC(int bits) { subsector_RPC = bits; } - void set_chamber(int bits) { chamber = bits; } - void set_csc_ID(int bits) { csc_ID = bits; } - void set_csc_nID(int bits) { csc_nID = bits; } - void set_roll(int bits) { roll = bits; } - void set_neighbor(int bits) { neighbor = bits; } - void set_mpc_link(int bits) { mpc_link = bits; } - void set_pc_sector(int bits) { pc_sector = bits; } - void set_pc_station(int bits) { pc_station = bits; } - void set_pc_chamber(int bits) { pc_chamber = bits; } - void set_pc_segment(int bits) { pc_segment = bits; } - void set_wire(int bits) { wire = bits; } - void set_strip(int bits) { strip = bits; } - void set_strip_hi(int bits) { strip_hi = bits; } - void set_strip_low(int bits) { strip_low = bits; } - void set_strip_quart(int bits) { strip_quart = bits; } // Run 3 - void set_strip_eighth(int bits) { strip_eighth = bits; } // Run 3 - void set_strip_quart_bit(int bits) { strip_quart_bit = bits; } // Run 3 - void set_strip_eighth_bit(int bits) { strip_eighth_bit = bits; } // Run 3 - void set_muon_shower_valid(int bits) { muon_shower_valid = bits; } // Run 3 muon shower - void set_muon_shower_inTime(int bits) { muon_shower_inTime = bits; } // Run 3 muon shower - void set_muon_shower_outOfTime(int bits) { muon_shower_outOfTime = bits; } // Run 3 muon shower - void set_track_num(int bits) { track_num = bits; } - void set_quality(int bits) { quality = bits; } - void set_pattern(int bits) { pattern = bits; } - void set_pattern_run3(int bits) { pattern_run3 = bits; } // Run 3 - void set_bend(int bits) { bend = bits; } - void set_slope(int bits) { slope = bits; } // Run 3 - void set_valid(int bits) { valid = bits; } - void set_sync_err(int bits) { sync_err = bits; } - // GEM specific aliases - void set_pad(int bits) { set_strip(bits); } - void set_pad_hi(int bits) { set_strip_hi(bits); } - void set_pad_low(int bits) { set_strip_low(bits); } - void set_partition(int bits) { set_roll(bits); } - void set_layer(int bits) { layer = bits; } - void set_cluster_size(int bits) { set_quality(bits); } - void set_cluster_id(int bits) { set_track_num(bits); } - // END GEM specific - void set_bc0(int bits) { bc0 = bits; } - void set_bx(int bits) { bx = bits; } - void set_stub_num(int bits) { stub_num = bits; } - void set_phi_fp(int bits) { phi_fp = bits; } - void set_theta_fp(int bits) { theta_fp = bits; } - void set_zone_hit(int bits) { zone_hit = bits; } - void set_zone_code(int bits) { zone_code = bits; } - void set_fs_segment(int bits) { fs_segment = bits; } - void set_fs_zone_code(int bits) { fs_zone_code = bits; } - void set_bt_station(int bits) { bt_station = bits; } - void set_bt_segment(int bits) { bt_segment = bits; } - void set_phi_loc(float val) { phi_loc = val; } - void set_phi_glob(float val) { phi_glob = val; } - void set_theta(float val) { theta = val; } - void set_eta(float val) { eta = val; } - void set_time(float val) { time = val; } - void set_phi_sim(float val) { phi_sim = val; } - void set_theta_sim(float val) { theta_sim = val; } - void set_eta_sim(float val) { eta_sim = val; } - void set_rho_sim(float val) { rho_sim = val; } - void set_z_sim(float val) { z_sim = val; } - void set_alct_quality(int bits) { alct_quality = bits; } - void set_clct_quality(int bits) { clct_quality = bits; } + void set_subsystem(int bits) { subsystem = bits; } + void set_endcap(int bits) { endcap = bits; } + void set_station(int bits) { station = bits; } + void set_ring(int bits) { ring = bits; } + void set_sector(int bits) { sector = bits; } + void set_sector_RPC(int bits) { sector_RPC = bits; } + void set_sector_idx(int bits) { sector_idx = bits; } + void set_subsector(int bits) { subsector = bits; } + void set_subsector_RPC(int bits) { subsector_RPC = bits; } + void set_chamber(int bits) { chamber = bits; } + void set_csc_ID(int bits) { csc_ID = bits; } + void set_csc_nID(int bits) { csc_nID = bits; } + void set_roll(int bits) { roll = bits; } + void set_neighbor(int bits) { neighbor = bits; } + void set_mpc_link(int bits) { mpc_link = bits; } + void set_pc_sector(int bits) { pc_sector = bits; } + void set_pc_station(int bits) { pc_station = bits; } + void set_pc_chamber(int bits) { pc_chamber = bits; } + void set_pc_segment(int bits) { pc_segment = bits; } + void set_wire(int bits) { wire = bits; } + void set_strip(int bits) { strip = bits; } + void set_strip_hi(int bits) { strip_hi = bits; } + void set_strip_low(int bits) { strip_low = bits; } + void set_strip_quart(int bits) { strip_quart = bits; } // Run 3 + void set_strip_eighth(int bits) { strip_eighth = bits; } // Run 3 + void set_strip_quart_bit(int bits) { strip_quart_bit = bits; } // Run 3 + void set_strip_eighth_bit(int bits) { strip_eighth_bit = bits; } // Run 3 + void set_muon_shower_valid(int bits) { muon_shower_valid = bits; } // Run 3 muon shower + void set_muon_shower_inTime(int bits) { muon_shower_inTime = bits; } // Run 3 muon shower + void set_muon_shower_outOfTime(int bits) { muon_shower_outOfTime = bits; } // Run 3 muon shower + void set_track_num(int bits) { track_num = bits; } + void set_quality(int bits) { quality = bits; } + void set_pattern(int bits) { pattern = bits; } + void set_pattern_run3(int bits) { pattern_run3 = bits; } // Run 3 + void set_bend(int bits) { bend = bits; } + void set_slope(int bits) { slope = bits; } // Run 3 + void set_valid(int bits) { valid = bits; } + void set_sync_err(int bits) { sync_err = bits; } + // GEM specific aliases + void set_pad(int bits) { set_strip(bits); } + void set_pad_hi(int bits) { set_strip_hi(bits); } + void set_pad_low(int bits) { set_strip_low(bits); } + void set_partition(int bits) { set_roll(bits); } + void set_layer(int bits) { layer = bits; } + void set_cluster_size(int bits) { set_quality(bits); } + void set_cluster_id(int bits) { set_track_num(bits); } + // END GEM specific + void set_bc0(int bits) { bc0 = bits; } + void set_bx(int bits) { bx = bits; } + void set_stub_num(int bits) { stub_num = bits; } + void set_phi_fp(int bits) { phi_fp = bits; } + void set_theta_fp(int bits) { theta_fp = bits; } + void set_zone_hit(int bits) { zone_hit = bits; } + void set_zone_code(int bits) { zone_code = bits; } + void set_fs_segment(int bits) { fs_segment = bits; } + void set_fs_zone_code(int bits) { fs_zone_code = bits; } + void set_bt_station(int bits) { bt_station = bits; } + void set_bt_segment(int bits) { bt_segment = bits; } + void set_phi_loc(float val) { phi_loc = val; } + void set_phi_glob(float val) { phi_glob = val; } + void set_theta(float val) { theta = val; } + void set_eta(float val) { eta = val; } + void set_time(float val) { time = val; } + void set_phi_sim(float val) { phi_sim = val; } + void set_theta_sim(float val) { theta_sim = val; } + void set_eta_sim(float val) { eta_sim = val; } + void set_rho_sim(float val) { rho_sim = val; } + void set_z_sim(float val) { z_sim = val; } + void set_alct_quality(int bits) { alct_quality = bits; } + void set_clct_quality(int bits) { clct_quality = bits; } - int Subsystem() const { return subsystem; } - int Endcap() const { return endcap; } - int Station() const { return station; } - int Ring() const { return ring; } - int Sector() const { return sector; } - int Sector_RPC() const { return sector_RPC; } - int Sector_idx() const { return sector_idx; } - int Subsector() const { return subsector; } - int Subsector_RPC() const { return subsector_RPC; } - int Chamber() const { return chamber; } - int CSC_ID() const { return csc_ID; } - int CSC_nID() const { return csc_nID; } - int Roll() const { return roll; } - int Neighbor() const { return neighbor; } - int MPC_link() const { return mpc_link; } - int PC_sector() const { return pc_sector; } - int PC_station() const { return pc_station; } - int PC_chamber() const { return pc_chamber; } - int PC_segment() const { return pc_segment; } - int Wire() const { return wire; } - int Strip() const { return strip; } - int Strip_hi() const { return strip_hi; } - int Strip_low() const { return strip_low; } - int Strip_quart() const { return strip_quart; } // Run 3 - int Strip_eighth() const { return strip_eighth; } // Run 3 - int Strip_quart_bit() const { return strip_quart_bit; } // Run 3 - int Strip_eighth_bit() const { return strip_eighth_bit; } // Run 3 - int Muon_shower_valid() const { return muon_shower_valid; } // Run 3 muon shower - int Muon_shower_inTime() const { return muon_shower_inTime; } // Run 3 muon shower - int Muon_shower_outOfTime() const { return muon_shower_outOfTime; } // Run 3 muon shower - int Track_num() const { return track_num; } - int Quality() const { return quality; } - int Pattern() const { return pattern; } - int Pattern_run3() const { return pattern_run3; } // Run 3 - int Bend() const { return bend; } - int Slope() const { return slope; } // Run 3 - int Valid() const { return valid; } - int Sync_err() const { return sync_err; } - // GEM specific aliases for member variables that don't match GEM nomenclature - /* + int Subsystem() const { return subsystem; } + int Endcap() const { return endcap; } + int Station() const { return station; } + int Ring() const { return ring; } + int Sector() const { return sector; } + int Sector_RPC() const { return sector_RPC; } + int Sector_idx() const { return sector_idx; } + int Subsector() const { return subsector; } + int Subsector_RPC() const { return subsector_RPC; } + int Chamber() const { return chamber; } + int CSC_ID() const { return csc_ID; } + int CSC_nID() const { return csc_nID; } + int Roll() const { return roll; } + int Neighbor() const { return neighbor; } + int MPC_link() const { return mpc_link; } + int PC_sector() const { return pc_sector; } + int PC_station() const { return pc_station; } + int PC_chamber() const { return pc_chamber; } + int PC_segment() const { return pc_segment; } + int Wire() const { return wire; } + int Strip() const { return strip; } + int Strip_hi() const { return strip_hi; } + int Strip_low() const { return strip_low; } + int Strip_quart() const { return strip_quart; } // Run 3 + int Strip_eighth() const { return strip_eighth; } // Run 3 + int Strip_quart_bit() const { return strip_quart_bit; } // Run 3 + int Strip_eighth_bit() const { return strip_eighth_bit; } // Run 3 + int Muon_shower_valid() const { return muon_shower_valid; } // Run 3 muon shower + int Muon_shower_inTime() const { return muon_shower_inTime; } // Run 3 muon shower + int Muon_shower_outOfTime() const { return muon_shower_outOfTime; } // Run 3 muon shower + int Track_num() const { return track_num; } + int Quality() const { return quality; } + int Pattern() const { return pattern; } + int Pattern_run3() const { return pattern_run3; } // Run 3 + int Bend() const { return bend; } + int Slope() const { return slope; } // Run 3 + int Valid() const { return valid; } + int Sync_err() const { return sync_err; } + // GEM specific aliases for member variables that don't match GEM nomenclature + /* * Each GEM pad is the OR of two neighbouring strips in phi. * For GE1/1 (10 degree chambers) this results in a total of 192 pads per eta partition * 128 strips per phi sector @@ -256,127 +257,128 @@ namespace l1t { * 128 strips per phi sector * 6 phi sectors per eta partition */ - /// Repurpose "strip" as GEM pad for GEM sourced hits - int Pad() const { return Strip(); } - /// Repurpose "strip" as GEM pad for GEM sourced hits - int Pad_hi() const { return Strip_hi(); } - /// Repurpose "strip" as GEM pad for GEM sourced hits - int Pad_low() const { return Strip_low(); } - /// "roll" corresponds to the GEM eta partition - int Partition() const { return Roll(); } - int Layer() const { return layer; } - /// Repurpose "quality" as the GEM cluster_size (number of pads in the cluster) - int ClusterSize() const { return Quality(); } - /// Repurpose "track_num" as the GEM cluster_id - int ClusterID() const { return Track_num(); } - // END GEM specific - int BC0() const { return bc0; } - int BX() const { return bx; } - int Stub_num() const { return stub_num; } - int Phi_fp() const { return phi_fp; } - int Theta_fp() const { return theta_fp; } - int Zone_hit() const { return zone_hit; } - int Zone_code() const { return zone_code; } - int FS_segment() const { return fs_segment; } - int FS_zone_code() const { return fs_zone_code; } - int BT_station() const { return bt_station; } - int BT_segment() const { return bt_segment; } - float Phi_loc() const { return phi_loc; } - float Phi_glob() const { return phi_glob; } - float Theta() const { return theta; } - float Eta() const { return eta; } - float Time() const { return time; } - float Phi_sim() const { return phi_sim; } - float Theta_sim() const { return theta_sim; } - float Eta_sim() const { return eta_sim; } - float Rho_sim() const { return rho_sim; } - float Z_sim() const { return z_sim; } - int ALCT_quality() const { return alct_quality; } - int CLCT_quality() const { return clct_quality; } + /// Repurpose "strip" as GEM pad for GEM sourced hits + int Pad() const { return Strip(); } + /// Repurpose "strip" as GEM pad for GEM sourced hits + int Pad_hi() const { return Strip_hi(); } + /// Repurpose "strip" as GEM pad for GEM sourced hits + int Pad_low() const { return Strip_low(); } + /// "roll" corresponds to the GEM eta partition + int Partition() const { return Roll(); } + int Layer() const { return layer; } + /// Repurpose "quality" as the GEM cluster_size (number of pads in the cluster) + int ClusterSize() const { return Quality(); } + /// Repurpose "track_num" as the GEM cluster_id + int ClusterID() const { return Track_num(); } + // END GEM specific + int BC0() const { return bc0; } + int BX() const { return bx; } + int Stub_num() const { return stub_num; } + int Phi_fp() const { return phi_fp; } + int Theta_fp() const { return theta_fp; } + int Zone_hit() const { return zone_hit; } + int Zone_code() const { return zone_code; } + int FS_segment() const { return fs_segment; } + int FS_zone_code() const { return fs_zone_code; } + int BT_station() const { return bt_station; } + int BT_segment() const { return bt_segment; } + float Phi_loc() const { return phi_loc; } + float Phi_glob() const { return phi_glob; } + float Theta() const { return theta; } + float Eta() const { return eta; } + float Time() const { return time; } + float Phi_sim() const { return phi_sim; } + float Theta_sim() const { return theta_sim; } + float Eta_sim() const { return eta_sim; } + float Rho_sim() const { return rho_sim; } + float Z_sim() const { return z_sim; } + int ALCT_quality() const { return alct_quality; } + int CLCT_quality() const { return clct_quality; } - bool Is_DT() const { return subsystem == l1tmu::kDT; } - bool Is_CSC() const { return subsystem == l1tmu::kCSC; } - bool Is_RPC() const { return subsystem == l1tmu::kRPC; } - bool Is_GEM() const { return subsystem == l1tmu::kGEM; } - bool Is_ME0() const { return subsystem == l1tmu::kME0; } + bool Is_DT() const { return subsystem == l1tmu::kDT; } + bool Is_CSC() const { return subsystem == l1tmu::kCSC; } + bool Is_RPC() const { return subsystem == l1tmu::kRPC; } + bool Is_GEM() const { return subsystem == l1tmu::kGEM; } + bool Is_ME0() const { return subsystem == l1tmu::kME0; } - private: - //CSCDetId csc_DetId; - //RPCDetId rpc_DetId; - //GEMDetId gem_DetId; - //CSCCorrelatedLCTDigi csc_LCTDigi; - //RPCDigi rpc_Digi; - //CPPFDigi cppf_Digi; - //GEMPadDigiCluster gem_PadClusterDigi; + private: + //CSCDetId csc_DetId; + //RPCDetId rpc_DetId; + //GEMDetId gem_DetId; + //CSCCorrelatedLCTDigi csc_LCTDigi; + //RPCDigi rpc_Digi; + //CPPFDigi cppf_Digi; + //GEMPadDigiCluster gem_PadClusterDigi; - uint32_t rawDetId; ///< raw CMSSW DetId - int subsystem; ///< 0 - 4. 0 for DT, 1 for CSC, 2 for RPC, 3 for GEM, 4 for ME0 - int endcap; ///< +/-1. For ME+ and ME-. - int station; ///< 1 - 4. - int ring; ///< 1 - 4. ME1/1a is denoted as "Ring 4". Should check dependence on input CSCDetId convention. - AWB 02.03.17 - int sector; ///< 1 - 6. CSC / GEM / EMTF sector convention: sector 1 starts at 15 degrees - int sector_RPC; ///< 1 - 6. RPC sector convention (in CMSSW): sector 1 starts at -5 degrees - int sector_idx; ///< 0 - 11. 0 - 5 for ME+, 6 - 11 for ME-. For neighbor hits, set by EMTF sector that received it. - int subsector; ///< 0 - 6. In CSCs, 1 or 2 for ME1, 0 for ME2/3/4. - int subsector_RPC; ///< 0 - 6. RPC sector convention (in CMSSW): subsector 3 is the first chamber in the EMTF sector. - int chamber; ///< 1 - 36. Chamber 1 starts at -5 degrees. - int csc_ID; ///< 1 - 9. For CSCs only. - int csc_nID; ///< 1 - 15. For CSCs only. Neighbors 10 - 15, 12 not filled. - int roll; ///< 1 - 3. For RPCs only, sub-division of ring. (Range? - AWB 02.03.17) - int neighbor; ///< 0 or 1. Filled in EMTFBlock(ME|GEM|RPC).cc - int mpc_link; ///< 1 - 3. Filled in EMTFHit.cc from CSCCorrelatedLCTDigi - int pc_sector; ///< 1 - 6. EMTF sector that received the LCT, even those sent from neighbor sectors. - int pc_station; ///< 0 - 5. 0 for ME1 subsector 1, 5 for neighbor hits. - int pc_chamber; ///< 0 - 8. - int pc_segment; ///< 0 - 3. - int wire; ///< 0 - 111 For CSCs only. - int strip; ///< 0 - 158 For CSCs only. - int strip_hi; ///< ? - ?. For RPCs only, highest strip in a cluster. (Range? - AWB 02.03.17) - int strip_low; ///< ? - ?. For RPCs only, lowest strip in a cluster. (Range? - AWB 02.03.17) - int strip_quart; ///< Run 3 CSC parameters - int strip_eighth; ///< Run 3 CSC parameters - int strip_quart_bit; ///< Run 3 CSC parameters - int strip_eighth_bit; ///< Run 3 CSC parameters - int muon_shower_valid; ///< Run 3 muon shower - int muon_shower_inTime; ///< Run 3 muon shower - int muon_shower_outOfTime; ///< Run 3 muon shower - int track_num; ///< ? - ?. For CSCs only. (Range? - AWB 02.03.17) - int quality; ///< 0 - 15. For CSCs only. - int pattern; ///< 0 - 10. For CSCs only. - int pattern_run3; ///< Run 3 For CSC only. - int bend; ///< 0 or 1. For CSCs only. - int slope; ///< Run 3 For CSC only. - int valid; ///< 0 or 1. For CSCs only (for now; could use to flag failing clusters? - AWB 02.03.17) - int sync_err; ///< 0 or 1. For CSCs only. - // GEM specific - int layer; ///< 0 - 1. For GEMs only, superchamber detector layer (1 or 2). - // END GEM specific - int bc0; ///< 0 or 1. Only from unpacked data? - AWB 02.03.17 - int bx; ///< -3 - +3. - int stub_num; ///< 0 or 1. Only from unpacked data? - AWB 02.03.17 - int phi_fp; ///< 0 - 4920 - int theta_fp; ///< 0 - 127 - int zone_hit; ///< 4 - 156 (Range? - AWB 02.03.17) - int zone_code; ///< 0 - 12. (Range? - AWB 02.03.17) - int fs_segment; ///< 0 - 13. (Range? - AWB 02.03.17) - int fs_zone_code; ///< 1 - 14. (Range? - AWB 02.03.17) - int bt_station; ///< 0 - 4. - int bt_segment; ///< 0 - 25. (Range? - AWB 02.03.17) - float phi_loc; ///< -20 - 60 (Range? - AWB 02.03.17) - float phi_glob; ///< +/-180. - float theta; ///< 0 - 90. - float eta; ///< +/-2.5. - float time; ///< ? - ?. RPC time information (ns) - float phi_sim; ///< +/-180. - float theta_sim; ///< 0 - 90. - float eta_sim; ///< +/-2.5. - float rho_sim; ///< ? - ?. - float z_sim; ///< ? - ?. - int alct_quality; ///< 1 - 3. For emulated CSC LCTs only, maps to number of ALCT layers (4 - 6). - int clct_quality; ///< 4 - 6. For emulated CSC LCTs only, maps to number of CLCT layers (4 - 6). - - }; // End of class EMTFHit + uint32_t rawDetId; ///< raw CMSSW DetId + int subsystem; ///< 0 - 4. 0 for DT, 1 for CSC, 2 for RPC, 3 for GEM, 4 for ME0 + int endcap; ///< +/-1. For ME+ and ME-. + int station; ///< 1 - 4. + int ring; ///< 1 - 4. ME1/1a is denoted as "Ring 4". Should check dependence on input CSCDetId convention. - AWB 02.03.17 + int sector; ///< 1 - 6. CSC / GEM / EMTF sector convention: sector 1 starts at 15 degrees + int sector_RPC; ///< 1 - 6. RPC sector convention (in CMSSW): sector 1 starts at -5 degrees + int sector_idx; ///< 0 - 11. 0 - 5 for ME+, 6 - 11 for ME-. For neighbor hits, set by EMTF sector that received it. + int subsector; ///< 0 - 6. In CSCs, 1 or 2 for ME1, 0 for ME2/3/4. + int subsector_RPC; ///< 0 - 6. RPC sector convention (in CMSSW): subsector 3 is the first chamber in the EMTF sector. + int chamber; ///< 1 - 36. Chamber 1 starts at -5 degrees. + int csc_ID; ///< 1 - 9. For CSCs only. + int csc_nID; ///< 1 - 15. For CSCs only. Neighbors 10 - 15, 12 not filled. + int roll; ///< 1 - 3. For RPCs only, sub-division of ring. (Range? - AWB 02.03.17) + int neighbor; ///< 0 or 1. Filled in EMTFBlock(ME|GEM|RPC).cc + int mpc_link; ///< 1 - 3. Filled in EMTFHit.cc from CSCCorrelatedLCTDigi + int pc_sector; ///< 1 - 6. EMTF sector that received the LCT, even those sent from neighbor sectors. + int pc_station; ///< 0 - 5. 0 for ME1 subsector 1, 5 for neighbor hits. + int pc_chamber; ///< 0 - 8. + int pc_segment; ///< 0 - 3. + int wire; ///< 0 - 111 For CSCs only. + int strip; ///< 0 - 158 For CSCs only. + int strip_hi; ///< ? - ?. For RPCs only, highest strip in a cluster. (Range? - AWB 02.03.17) + int strip_low; ///< ? - ?. For RPCs only, lowest strip in a cluster. (Range? - AWB 02.03.17) + int strip_quart; ///< Run 3 CSC parameters + int strip_eighth; ///< Run 3 CSC parameters + int strip_quart_bit; ///< Run 3 CSC parameters + int strip_eighth_bit; ///< Run 3 CSC parameters + int muon_shower_valid; ///< Run 3 muon shower + int muon_shower_inTime; ///< Run 3 muon shower + int muon_shower_outOfTime; ///< Run 3 muon shower + int track_num; ///< ? - ?. For CSCs only. (Range? - AWB 02.03.17) + int quality; ///< 0 - 15. For CSCs only. + int pattern; ///< 0 - 10. For CSCs only. + int pattern_run3; ///< Run 3 For CSC only. + int bend; ///< 0 or 1. For CSCs only. + int slope; ///< Run 3 For CSC only. + int valid; ///< 0 or 1. For CSCs only (for now; could use to flag failing clusters? - AWB 02.03.17) + int sync_err; ///< 0 or 1. For CSCs only. + // GEM specific + int layer; ///< 0 - 1. For GEMs only, superchamber detector layer (1 or 2). + // END GEM specific + int bc0; ///< 0 or 1. Only from unpacked data? - AWB 02.03.17 + int bx; ///< -3 - +3. + int stub_num; ///< 0 or 1. Only from unpacked data? - AWB 02.03.17 + int phi_fp; ///< 0 - 4920 + int theta_fp; ///< 0 - 127 + int zone_hit; ///< 4 - 156 (Range? - AWB 02.03.17) + int zone_code; ///< 0 - 12. (Range? - AWB 02.03.17) + int fs_segment; ///< 0 - 13. (Range? - AWB 02.03.17) + int fs_zone_code; ///< 1 - 14. (Range? - AWB 02.03.17) + int bt_station; ///< 0 - 4. + int bt_segment; ///< 0 - 25. (Range? - AWB 02.03.17) + float phi_loc; ///< -20 - 60 (Range? - AWB 02.03.17) + float phi_glob; ///< +/-180. + float theta; ///< 0 - 90. + float eta; ///< +/-2.5. + float time; ///< ? - ?. RPC time information (ns) + float phi_sim; ///< +/-180. + float theta_sim; ///< 0 - 90. + float eta_sim; ///< +/-2.5. + float rho_sim; ///< ? - ?. + float z_sim; ///< ? - ?. + int alct_quality; ///< 1 - 3. For emulated CSC LCTs only, maps to number of ALCT layers (4 - 6). + int clct_quality; ///< 4 - 6. For emulated CSC LCTs only, maps to number of CLCT layers (4 - 6). + }; // End of class EMTFHit + } // namespace io_v1 + using EMTFHit = io_v1::EMTFHit; // Define a vector of EMTFHit typedef std::vector EMTFHitCollection; diff --git a/DataFormats/L1TMuon/interface/EMTFTrack.h b/DataFormats/L1TMuon/interface/EMTFTrack.h index d96c4fcc41275..9756b1f117818 100644 --- a/DataFormats/L1TMuon/interface/EMTFTrack.h +++ b/DataFormats/L1TMuon/interface/EMTFTrack.h @@ -41,212 +41,214 @@ namespace l1t { uint16_t bt_si[5]; // ^ }; - class EMTFTrack { - public: - EMTFTrack() - : _PtLUT(), - endcap(-99), - sector(-99), - sector_idx(-99), - mode(-99), - mode_CSC(0), - mode_RPC(0), - mode_GEM(0), - mode_neighbor(0), - mode_inv(-99), - rank(-99), - winner(-99), - charge(-99), - bx(-99), - first_bx(-99), - second_bx(-99), - pt(-99), - pt_XML(-99), - pt_dxy(-99), - dxy(-99), - zone(-99), - ph_num(-99), - ph_q(-99), - theta_fp(-99), - theta(-99), - eta(-99), - phi_fp(-99), - phi_loc(-99), - phi_glob(-999), - gmt_pt(-99), - gmt_pt_dxy(-99), - gmt_dxy(-99), - gmt_phi(-999), - gmt_eta(-999), - gmt_quality(-99), - gmt_charge(-99), - gmt_charge_valid(-99), - track_num(-99), - numHits(-99) {} - - virtual ~EMTFTrack() {} - - void ImportSP(const emtf::SP _SP, int _sector); - // void ImportPtLUT( int _mode, unsigned long _address ); - - void clear_Hits() { - _Hits.clear(); - numHits = 0; - mode_CSC = 0; - mode_RPC = 0; - mode_GEM = 0; - mode_neighbor = 0; - } - - void push_Hit(const EMTFHit& hit) { - _Hits.push_back(hit); - numHits = _Hits.size(); - if (hit.Is_CSC()) - mode_CSC |= (1 << (4 - hit.Station())); - if (hit.Is_RPC()) - mode_RPC |= (1 << (4 - hit.Station())); - if (hit.Is_GEM()) - mode_GEM |= (1 << (4 - hit.Station())); - if (hit.Neighbor()) - mode_neighbor |= (1 << (4 - hit.Station())); - } - - void set_Hits(const EMTFHitCollection& hits) { - clear_Hits(); - for (const auto& hit : hits) - push_Hit(hit); - } - - void clear_HitIdx() { _HitIdx.clear(); } - void push_HitIdx(unsigned int bits) { _HitIdx.push_back(bits); } - void set_HitIdx(const std::vector& bits) { _HitIdx = bits; } - - int NumHits() const { return numHits; } - EMTFHitCollection Hits() const { return _Hits; } - std::vector HitIdx() const { return _HitIdx; } - - void set_PtLUT(EMTFPtLUT bits) { _PtLUT = bits; } - EMTFPtLUT PtLUT() const { return _PtLUT; } - - void set_endcap(int bits) { endcap = bits; } - void set_sector(int bits) { sector = bits; } - void set_sector_idx(int bits) { sector_idx = bits; } - void set_mode(int bits) { mode = bits; } - void set_mode_inv(int bits) { mode_inv = bits; } - void set_rank(int bits) { rank = bits; } - void set_winner(int bits) { winner = bits; } - void set_charge(int bits) { charge = bits; } - void set_bx(int bits) { bx = bits; } - void set_first_bx(int bits) { first_bx = bits; } - void set_second_bx(int bits) { second_bx = bits; } - void set_pt(float val) { pt = val; } - void set_pt_XML(float val) { pt_XML = val; } - void set_pt_dxy(float val) { pt_dxy = val; } - void set_dxy(float val) { dxy = val; } - void set_zone(int bits) { zone = bits; } - void set_ph_num(int bits) { ph_num = bits; } - void set_ph_q(int bits) { ph_q = bits; } - void set_theta_fp(int bits) { theta_fp = bits; } - void set_theta(float val) { theta = val; } - void set_eta(float val) { eta = val; } - void set_phi_fp(int bits) { phi_fp = bits; } - void set_phi_loc(float val) { phi_loc = val; } - void set_phi_glob(float val) { phi_glob = val; } - void set_gmt_pt(int bits) { gmt_pt = bits; } - void set_gmt_pt_dxy(int bits) { gmt_pt_dxy = bits; } - void set_gmt_dxy(int bits) { gmt_dxy = bits; } - void set_gmt_phi(int bits) { gmt_phi = bits; } - void set_gmt_eta(int bits) { gmt_eta = bits; } - void set_gmt_quality(int bits) { gmt_quality = bits; } - void set_gmt_charge(int bits) { gmt_charge = bits; } - void set_gmt_charge_valid(int bits) { gmt_charge_valid = bits; } - void set_track_num(int bits) { track_num = bits; } - - int Endcap() const { return endcap; } - int Sector() const { return sector; } - int Sector_idx() const { return sector_idx; } - int Mode() const { return mode; } - int Mode_CSC() const { return mode_CSC; } - int Mode_RPC() const { return mode_RPC; } - int Mode_GEM() const { return mode_GEM; } - int Mode_neighbor() const { return mode_neighbor; } - int Mode_inv() const { return mode_inv; } - int Rank() const { return rank; } - int Winner() const { return winner; } - int Charge() const { return charge; } - int BX() const { return bx; } - int First_BX() const { return first_bx; } - int Second_BX() const { return second_bx; } - float Pt() const { return pt; } - float Pt_XML() const { return pt_XML; } - float Pt_dxy() const { return pt_dxy; } - float Dxy() const { return dxy; } - int Zone() const { return zone; } - int Ph_num() const { return ph_num; } - int Ph_q() const { return ph_q; } - int Theta_fp() const { return theta_fp; } - float Theta() const { return theta; } - float Eta() const { return eta; } - int Phi_fp() const { return phi_fp; } - float Phi_loc() const { return phi_loc; } - float Phi_glob() const { return phi_glob; } - int GMT_pt() const { return gmt_pt; } - int GMT_pt_dxy() const { return gmt_pt_dxy; } - int GMT_dxy() const { return gmt_dxy; } - int GMT_phi() const { return gmt_phi; } - int GMT_eta() const { return gmt_eta; } - int GMT_quality() const { return gmt_quality; } - int GMT_charge() const { return gmt_charge; } - int GMT_charge_valid() const { return gmt_charge_valid; } - int Track_num() const { return track_num; } - - private: - EMTFHitCollection _Hits; - std::vector _HitIdx; - - EMTFPtLUT _PtLUT; - - int endcap; // +/-1. For ME+ and ME-. - int sector; // 1 - 6. - int sector_idx; // 0 - 11. 0 - 5 for ME+, 6 - 11 for ME-. - int mode; // 0 - 15. - int mode_CSC; // 0 - 15, CSC-only - int mode_RPC; // 0 - 15, RPC-only - int mode_GEM; // 0 - 15, GEM-only // TODO: verify if needed when including GEM, also start the good habit of documenting these - int mode_neighbor; // 0 - 15, only neighbor hits - int mode_inv; // 15 - 0. - int rank; // 0 - 127 (Range? - AWB 03.03.17) - int winner; // 0 - 2. (Range? - AWB 03.03.17) - int charge; // +/-1. For physical charge (reversed from GMT convention) - int bx; // -3 - +3. - int first_bx; // -3 - +3. - int second_bx; // -3 - +3. - float pt; // 0 - 255 - float pt_XML; // 0 - 999 - float pt_dxy; // 0 - 127 - float dxy; // 0 - 3 - int zone; // 0 - 3. - int ph_num; - int ph_q; - int theta_fp; // 0 - 127 - float theta; // 0 - 90. - float eta; // +/-2.5. - int phi_fp; // 0 - 4920 - float phi_loc; // -22 - 60 (Range? - AWB 03.03.17) - float phi_glob; // +/-180. - int gmt_pt; - int gmt_pt_dxy; - int gmt_dxy; - int gmt_phi; - int gmt_eta; - int gmt_quality; - int gmt_charge; - int gmt_charge_valid; - int track_num; // 0 - ??. (Range? - AWB 03.03.17) - int numHits; // 1 - 4. - - }; // End of class EMTFTrack + namespace io_v1 { + class EMTFTrack { + public: + EMTFTrack() + : _PtLUT(), + endcap(-99), + sector(-99), + sector_idx(-99), + mode(-99), + mode_CSC(0), + mode_RPC(0), + mode_GEM(0), + mode_neighbor(0), + mode_inv(-99), + rank(-99), + winner(-99), + charge(-99), + bx(-99), + first_bx(-99), + second_bx(-99), + pt(-99), + pt_XML(-99), + pt_dxy(-99), + dxy(-99), + zone(-99), + ph_num(-99), + ph_q(-99), + theta_fp(-99), + theta(-99), + eta(-99), + phi_fp(-99), + phi_loc(-99), + phi_glob(-999), + gmt_pt(-99), + gmt_pt_dxy(-99), + gmt_dxy(-99), + gmt_phi(-999), + gmt_eta(-999), + gmt_quality(-99), + gmt_charge(-99), + gmt_charge_valid(-99), + track_num(-99), + numHits(-99) {} + virtual ~EMTFTrack() {} + + void ImportSP(const emtf::SP _SP, int _sector); + // void ImportPtLUT( int _mode, unsigned long _address ); + + void clear_Hits() { + _Hits.clear(); + numHits = 0; + mode_CSC = 0; + mode_RPC = 0; + mode_GEM = 0; + mode_neighbor = 0; + } + + void push_Hit(const EMTFHit& hit) { + _Hits.push_back(hit); + numHits = _Hits.size(); + if (hit.Is_CSC()) + mode_CSC |= (1 << (4 - hit.Station())); + if (hit.Is_RPC()) + mode_RPC |= (1 << (4 - hit.Station())); + if (hit.Is_GEM()) + mode_GEM |= (1 << (4 - hit.Station())); + if (hit.Neighbor()) + mode_neighbor |= (1 << (4 - hit.Station())); + } + + void set_Hits(const EMTFHitCollection& hits) { + clear_Hits(); + for (const auto& hit : hits) + push_Hit(hit); + } + + void clear_HitIdx() { _HitIdx.clear(); } + void push_HitIdx(unsigned int bits) { _HitIdx.push_back(bits); } + void set_HitIdx(const std::vector& bits) { _HitIdx = bits; } + + int NumHits() const { return numHits; } + EMTFHitCollection Hits() const { return _Hits; } + std::vector HitIdx() const { return _HitIdx; } + + void set_PtLUT(EMTFPtLUT bits) { _PtLUT = bits; } + EMTFPtLUT PtLUT() const { return _PtLUT; } + + void set_endcap(int bits) { endcap = bits; } + void set_sector(int bits) { sector = bits; } + void set_sector_idx(int bits) { sector_idx = bits; } + void set_mode(int bits) { mode = bits; } + void set_mode_inv(int bits) { mode_inv = bits; } + void set_rank(int bits) { rank = bits; } + void set_winner(int bits) { winner = bits; } + void set_charge(int bits) { charge = bits; } + void set_bx(int bits) { bx = bits; } + void set_first_bx(int bits) { first_bx = bits; } + void set_second_bx(int bits) { second_bx = bits; } + void set_pt(float val) { pt = val; } + void set_pt_XML(float val) { pt_XML = val; } + void set_pt_dxy(float val) { pt_dxy = val; } + void set_dxy(float val) { dxy = val; } + void set_zone(int bits) { zone = bits; } + void set_ph_num(int bits) { ph_num = bits; } + void set_ph_q(int bits) { ph_q = bits; } + void set_theta_fp(int bits) { theta_fp = bits; } + void set_theta(float val) { theta = val; } + void set_eta(float val) { eta = val; } + void set_phi_fp(int bits) { phi_fp = bits; } + void set_phi_loc(float val) { phi_loc = val; } + void set_phi_glob(float val) { phi_glob = val; } + void set_gmt_pt(int bits) { gmt_pt = bits; } + void set_gmt_pt_dxy(int bits) { gmt_pt_dxy = bits; } + void set_gmt_dxy(int bits) { gmt_dxy = bits; } + void set_gmt_phi(int bits) { gmt_phi = bits; } + void set_gmt_eta(int bits) { gmt_eta = bits; } + void set_gmt_quality(int bits) { gmt_quality = bits; } + void set_gmt_charge(int bits) { gmt_charge = bits; } + void set_gmt_charge_valid(int bits) { gmt_charge_valid = bits; } + void set_track_num(int bits) { track_num = bits; } + + int Endcap() const { return endcap; } + int Sector() const { return sector; } + int Sector_idx() const { return sector_idx; } + int Mode() const { return mode; } + int Mode_CSC() const { return mode_CSC; } + int Mode_RPC() const { return mode_RPC; } + int Mode_GEM() const { return mode_GEM; } + int Mode_neighbor() const { return mode_neighbor; } + int Mode_inv() const { return mode_inv; } + int Rank() const { return rank; } + int Winner() const { return winner; } + int Charge() const { return charge; } + int BX() const { return bx; } + int First_BX() const { return first_bx; } + int Second_BX() const { return second_bx; } + float Pt() const { return pt; } + float Pt_XML() const { return pt_XML; } + float Pt_dxy() const { return pt_dxy; } + float Dxy() const { return dxy; } + int Zone() const { return zone; } + int Ph_num() const { return ph_num; } + int Ph_q() const { return ph_q; } + int Theta_fp() const { return theta_fp; } + float Theta() const { return theta; } + float Eta() const { return eta; } + int Phi_fp() const { return phi_fp; } + float Phi_loc() const { return phi_loc; } + float Phi_glob() const { return phi_glob; } + int GMT_pt() const { return gmt_pt; } + int GMT_pt_dxy() const { return gmt_pt_dxy; } + int GMT_dxy() const { return gmt_dxy; } + int GMT_phi() const { return gmt_phi; } + int GMT_eta() const { return gmt_eta; } + int GMT_quality() const { return gmt_quality; } + int GMT_charge() const { return gmt_charge; } + int GMT_charge_valid() const { return gmt_charge_valid; } + int Track_num() const { return track_num; } + + private: + EMTFHitCollection _Hits; + std::vector _HitIdx; + + EMTFPtLUT _PtLUT; + + int endcap; // +/-1. For ME+ and ME-. + int sector; // 1 - 6. + int sector_idx; // 0 - 11. 0 - 5 for ME+, 6 - 11 for ME-. + int mode; // 0 - 15. + int mode_CSC; // 0 - 15, CSC-only + int mode_RPC; // 0 - 15, RPC-only + int mode_GEM; // 0 - 15, GEM-only // TODO: verify if needed when including GEM, also start the good habit of documenting these + int mode_neighbor; // 0 - 15, only neighbor hits + int mode_inv; // 15 - 0. + int rank; // 0 - 127 (Range? - AWB 03.03.17) + int winner; // 0 - 2. (Range? - AWB 03.03.17) + int charge; // +/-1. For physical charge (reversed from GMT convention) + int bx; // -3 - +3. + int first_bx; // -3 - +3. + int second_bx; // -3 - +3. + float pt; // 0 - 255 + float pt_XML; // 0 - 999 + float pt_dxy; // 0 - 127 + float dxy; // 0 - 3 + int zone; // 0 - 3. + int ph_num; + int ph_q; + int theta_fp; // 0 - 127 + float theta; // 0 - 90. + float eta; // +/-2.5. + int phi_fp; // 0 - 4920 + float phi_loc; // -22 - 60 (Range? - AWB 03.03.17) + float phi_glob; // +/-180. + int gmt_pt; + int gmt_pt_dxy; + int gmt_dxy; + int gmt_phi; + int gmt_eta; + int gmt_quality; + int gmt_charge; + int gmt_charge_valid; + int track_num; // 0 - ??. (Range? - AWB 03.03.17) + int numHits; // 1 - 4. + + }; // End of class EMTFTrack + } // namespace io_v1 + using EMTFTrack = io_v1::EMTFTrack; // Define a vector of EMTFTrack typedef std::vector EMTFTrackCollection; diff --git a/DataFormats/L1TMuon/interface/RegionalMuonCand.h b/DataFormats/L1TMuon/interface/RegionalMuonCand.h index 8aa26b1eee5b7..0446ea7feb9d8 100644 --- a/DataFormats/L1TMuon/interface/RegionalMuonCand.h +++ b/DataFormats/L1TMuon/interface/RegionalMuonCand.h @@ -5,224 +5,225 @@ #include namespace l1t { - class RegionalMuonCand { - public: - /// Enum to identify the individual parts of the BMTF track address - /// Update kNumBmtfSubAddr if you add additional enums - enum bmtfAddress { - kWheelSide = 0, - kWheelNum = 1, - kStat1 = 2, - kStat2 = 3, - kStat3 = 4, - kStat4 = 5, - kSegSelStat1 = 6, - kSegSelStat2 = 7, - kSegSelStat3 = 8, - kSegSelStat4 = 9, - kNumBmtfSubAddr = 10 - }; - /// Enum to identify the individual parts of the OMTF track address - /// Update kNumOmtfSubAddr if you add additional enums - enum omtfAddress { kLayers = 0, kZero = 1, kWeight = 2, kNumOmtfSubAddr = 3 }; - /// Enum to identify the individual parts of the EMTF track address - /// Update kNumEmtfSubAddr if you add additional enums - enum emtfAddress { - kME1Seg = 0, - kME1Ch = 1, - kME2Seg = 2, - kME2Ch = 3, - kME3Seg = 4, - kME3Ch = 5, - kME4Seg = 6, - kME4Ch = 7, - kTrkNum = 8, - kBX = 9, - kNumEmtfSubAddr = 10 - }; + namespace io_v1 { + class RegionalMuonCand { + public: + /// Enum to identify the individual parts of the BMTF track address + /// Update kNumBmtfSubAddr if you add additional enums + enum bmtfAddress { + kWheelSide = 0, + kWheelNum = 1, + kStat1 = 2, + kStat2 = 3, + kStat3 = 4, + kStat4 = 5, + kSegSelStat1 = 6, + kSegSelStat2 = 7, + kSegSelStat3 = 8, + kSegSelStat4 = 9, + kNumBmtfSubAddr = 10 + }; + /// Enum to identify the individual parts of the OMTF track address + /// Update kNumOmtfSubAddr if you add additional enums + enum omtfAddress { kLayers = 0, kZero = 1, kWeight = 2, kNumOmtfSubAddr = 3 }; + /// Enum to identify the individual parts of the EMTF track address + /// Update kNumEmtfSubAddr if you add additional enums + enum emtfAddress { + kME1Seg = 0, + kME1Ch = 1, + kME2Seg = 2, + kME2Ch = 3, + kME3Seg = 4, + kME3Ch = 5, + kME4Seg = 6, + kME4Ch = 7, + kTrkNum = 8, + kBX = 9, + kNumEmtfSubAddr = 10 + }; - explicit RegionalMuonCand(uint64_t dataword); + explicit RegionalMuonCand(uint64_t dataword); - RegionalMuonCand() - : m_hwPt(0), - m_hwPtUnconstrained(0), - m_hwDXY(0), - m_hwPhi(0), - m_hwEta(0), - m_hwHF(false), - m_hwSign(0), - m_hwSignValid(0), - m_hwQuality(0), - m_dataword(0) { - setTFIdentifiers(0, bmtf); - }; + RegionalMuonCand() + : m_hwPt(0), + m_hwPtUnconstrained(0), + m_hwDXY(0), + m_hwPhi(0), + m_hwEta(0), + m_hwHF(false), + m_hwSign(0), + m_hwSignValid(0), + m_hwQuality(0), + m_dataword(0) { + setTFIdentifiers(0, bmtf); + }; - RegionalMuonCand(int pt, int phi, int eta, int sign, int signvalid, int quality, int processor, tftype trackFinder) - : m_hwPt(pt), - m_hwPtUnconstrained(0), - m_hwDXY(0), - m_hwPhi(phi), - m_hwEta(eta), - m_hwHF(false), - m_hwSign(sign), - m_hwSignValid(signvalid), - m_hwQuality(quality), - m_dataword(0) { - setTFIdentifiers(processor, trackFinder); - // set default track addresses - if (trackFinder == tftype::bmtf) { - m_trackAddress = {{kWheelSide, 0}, - {kWheelNum, 0}, - {kStat1, 0}, - {kStat2, 0}, - {kStat3, 0}, - {kStat4, 0}, - {kSegSelStat1, 0}, - {kSegSelStat2, 0}, - {kSegSelStat3, 0}, - {kSegSelStat4, 0}}; - } else if (trackFinder == tftype::omtf_pos || trackFinder == tftype::omtf_neg) { - m_trackAddress = {{kLayers, 0}, {kZero, 0}, {kWeight, 0}}; - } else if (trackFinder == tftype::emtf_pos || trackFinder == tftype::emtf_neg) { - m_trackAddress = {{kME1Seg, 0}, - {kME1Ch, 0}, - {kME2Seg, 0}, - {kME2Ch, 0}, - {kME3Seg, 0}, - {kME3Ch, 0}, - {kME4Seg, 0}, - {kME4Ch, 0}, - {kTrkNum, 0}, - {kBX, 0}}; - } - }; + RegionalMuonCand(int pt, int phi, int eta, int sign, int signvalid, int quality, int processor, tftype trackFinder) + : m_hwPt(pt), + m_hwPtUnconstrained(0), + m_hwDXY(0), + m_hwPhi(phi), + m_hwEta(eta), + m_hwHF(false), + m_hwSign(sign), + m_hwSignValid(signvalid), + m_hwQuality(quality), + m_dataword(0) { + setTFIdentifiers(processor, trackFinder); + // set default track addresses + if (trackFinder == tftype::bmtf) { + m_trackAddress = {{kWheelSide, 0}, + {kWheelNum, 0}, + {kStat1, 0}, + {kStat2, 0}, + {kStat3, 0}, + {kStat4, 0}, + {kSegSelStat1, 0}, + {kSegSelStat2, 0}, + {kSegSelStat3, 0}, + {kSegSelStat4, 0}}; + } else if (trackFinder == tftype::omtf_pos || trackFinder == tftype::omtf_neg) { + m_trackAddress = {{kLayers, 0}, {kZero, 0}, {kWeight, 0}}; + } else if (trackFinder == tftype::emtf_pos || trackFinder == tftype::emtf_neg) { + m_trackAddress = {{kME1Seg, 0}, + {kME1Ch, 0}, + {kME2Seg, 0}, + {kME2Ch, 0}, + {kME3Seg, 0}, + {kME3Ch, 0}, + {kME4Seg, 0}, + {kME4Ch, 0}, + {kTrkNum, 0}, + {kBX, 0}}; + } + }; - RegionalMuonCand(int pt, - int phi, - int eta, - int sign, - int signvalid, - int quality, - int processor, - tftype trackFinder, - std::map trackAddress) - : m_hwPt(pt), - m_hwPtUnconstrained(0), - m_hwDXY(0), - m_hwPhi(phi), - m_hwEta(eta), - m_hwHF(false), - m_hwSign(sign), - m_hwSignValid(signvalid), - m_hwQuality(quality), - m_trackAddress(trackAddress), - m_dataword(0) { - setTFIdentifiers(processor, trackFinder); - }; - - virtual ~RegionalMuonCand() {} + RegionalMuonCand(int pt, + int phi, + int eta, + int sign, + int signvalid, + int quality, + int processor, + tftype trackFinder, + std::map trackAddress) + : m_hwPt(pt), + m_hwPtUnconstrained(0), + m_hwDXY(0), + m_hwPhi(phi), + m_hwEta(eta), + m_hwHF(false), + m_hwSign(sign), + m_hwSignValid(signvalid), + m_hwQuality(quality), + m_trackAddress(trackAddress), + m_dataword(0) { + setTFIdentifiers(processor, trackFinder); + }; - /// Set compressed pT as transmitted by hardware LSB = 0.5 (9 bits) - void setHwPt(int bits) { m_hwPt = bits; }; - /// Set compressed second displaced pT as transmitted by hardware LSB = 1.0 (8 bits) - void setHwPtUnconstrained(int bits) { m_hwPtUnconstrained = bits; }; - /// Set compressed impact parameter with respect to beamspot (4 bits) - void setHwDXY(int bits) { m_hwDXY = bits; }; - /// Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits) - void setHwPhi(int bits) { m_hwPhi = bits; }; - /// Set compressed eta as transmitted by hardware LSB = 0.010875 (9 bits) - void setHwEta(int bits) { m_hwEta = bits; }; - /// Set charge sign bit (charge = (-1)^(sign)) - void setHwSign(int bits) { m_hwSign = bits; }; - /// Set whether charge measurement is valid (0 for high pT muons) - void setHwSignValid(int bits) { m_hwSignValid = bits; }; - /// Set compressed quality code as transmitted by hardware (4 bits) - void setHwQual(int bits) { m_hwQuality = bits; }; - /// Set HF (halo / fine eta) bit (EMTF: halo -> 1; BMTF: fine eta -> 1) - void setHwHF(bool bit) { m_hwHF = bit; }; - /// Set the processor ID, track-finder type. From these two, the link is set - void setTFIdentifiers(int processor, tftype trackFinder); - // this is left to still be compatible with OMTF - void setLink(int link) { m_link = link; }; - // Set the muon index on the link (i.e., 0, 1, or 2) - void setMuIdx(int muIdx) { m_muIdx = muIdx; }; - // Set the 64 bit word from two 32 words. bits 0-31->lsbs, bits 32-63->msbs - void setDataword(uint32_t msbs, uint32_t lsbs) { m_dataword = (((uint64_t)msbs) << 32) + lsbs; }; - // Set the 64 bit word coming from HW directly - void setDataword(uint64_t bits) { m_dataword = bits; }; - /// Set a part of the muon candidates track address; specialised for BMTF - void setTrackSubAddress(bmtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; } - /// Set a part of the muon candidates track address; specialised for OMTF - void setTrackSubAddress(omtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; } - /// Set a part of the muon candidates track address; specialised for EMTF - void setTrackSubAddress(emtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; } - /// Set the whole track address - void setTrackAddress(const std::map& address) { m_trackAddress = address; } + virtual ~RegionalMuonCand() {} - /// Get compressed pT (returned int * 0.5 = pT (GeV)) - const int hwPt() const { return m_hwPt; }; - /// Get second compressed pT (returned int * 1.0 = pT (GeV)) - const int hwPtUnconstrained() const { return m_hwPtUnconstrained; }; - /// Get compressed impact parameter (4 bits) - const int hwDXY() const { return m_hwDXY; }; - /// Get compressed local phi (returned int * 2*pi/576 = local phi in rad) - const int hwPhi() const { return m_hwPhi; }; - /// Get compressed eta (returned int * 0.010875 = eta) - const int hwEta() const { return m_hwEta; }; - /// Get charge sign bit (charge = (-1)^(sign)) - const int hwSign() const { return m_hwSign; }; - /// Get charge sign valid bit (0 - not valid (high pT muon); 1 - valid) - const int hwSignValid() const { return m_hwSignValid; }; - /// Get quality code - const int hwQual() const { return m_hwQuality; }; - /// Get link on which the MicroGMT receives the candidate - const int link() const { return m_link; }; - /// Get muon index (i.e., 0, 1, or 2) - const int muIdx() const { return m_muIdx; }; - /// Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF) - const int processor() const { return m_processor; }; - /// Get track-finder which found the muon (bmtf, emtf_pos/emtf_neg or omtf_pos/omtf_neg) - const tftype trackFinderType() const { return m_trackFinder; }; - /// Get HF (halo / fine eta) bit (EMTF: halo -> 1; BMTF: fine eta -> 1) - const int hwHF() const { return m_hwHF; }; - /// Get 64 bit data word - const uint64_t dataword() const { return m_dataword; }; - /// Get 32 MSBs of data word - const uint32_t dataword32Msb() const { return (uint32_t)((m_dataword >> 32) & 0xFFFFFFFF); }; - /// Get 32 LSBs of data word - const uint32_t dataword32Lsb() const { return (uint32_t)(m_dataword & 0xFFFFFFFF); }; - /// Get the track address (identifies track primitives used for reconstruction) - const std::map& trackAddress() const { return m_trackAddress; } - /// Get part of track address (identifies track primitives used for reconstruction) - int trackSubAddress(bmtfAddress subAddress) const { return m_trackAddress.at(subAddress); } - /// Get part of track address (identifies track primitives used for reconstruction) - int trackSubAddress(omtfAddress subAddress) const { return m_trackAddress.at(subAddress); } - /// Get part of track address (identifies track primitives used for reconstruction) - int trackSubAddress(emtfAddress subAddress) const { return m_trackAddress.at(subAddress); } + /// Set compressed pT as transmitted by hardware LSB = 0.5 (9 bits) + void setHwPt(int bits) { m_hwPt = bits; }; + /// Set compressed second displaced pT as transmitted by hardware LSB = 1.0 (8 bits) + void setHwPtUnconstrained(int bits) { m_hwPtUnconstrained = bits; }; + /// Set compressed impact parameter with respect to beamspot (4 bits) + void setHwDXY(int bits) { m_hwDXY = bits; }; + /// Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits) + void setHwPhi(int bits) { m_hwPhi = bits; }; + /// Set compressed eta as transmitted by hardware LSB = 0.010875 (9 bits) + void setHwEta(int bits) { m_hwEta = bits; }; + /// Set charge sign bit (charge = (-1)^(sign)) + void setHwSign(int bits) { m_hwSign = bits; }; + /// Set whether charge measurement is valid (0 for high pT muons) + void setHwSignValid(int bits) { m_hwSignValid = bits; }; + /// Set compressed quality code as transmitted by hardware (4 bits) + void setHwQual(int bits) { m_hwQuality = bits; }; + /// Set HF (halo / fine eta) bit (EMTF: halo -> 1; BMTF: fine eta -> 1) + void setHwHF(bool bit) { m_hwHF = bit; }; + /// Set the processor ID, track-finder type. From these two, the link is set + void setTFIdentifiers(int processor, tftype trackFinder); + // this is left to still be compatible with OMTF + void setLink(int link) { m_link = link; }; + // Set the muon index on the link (i.e., 0, 1, or 2) + void setMuIdx(int muIdx) { m_muIdx = muIdx; }; + // Set the 64 bit word from two 32 words. bits 0-31->lsbs, bits 32-63->msbs + void setDataword(uint32_t msbs, uint32_t lsbs) { m_dataword = (((uint64_t)msbs) << 32) + lsbs; }; + // Set the 64 bit word coming from HW directly + void setDataword(uint64_t bits) { m_dataword = bits; }; + /// Set a part of the muon candidates track address; specialised for BMTF + void setTrackSubAddress(bmtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; } + /// Set a part of the muon candidates track address; specialised for OMTF + void setTrackSubAddress(omtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; } + /// Set a part of the muon candidates track address; specialised for EMTF + void setTrackSubAddress(emtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; } + /// Set the whole track address + void setTrackAddress(const std::map& address) { m_trackAddress = address; } - bool operator==(const RegionalMuonCand& rhs) const; - inline bool operator!=(const RegionalMuonCand& rhs) const { return !(operator==(rhs)); }; + /// Get compressed pT (returned int * 0.5 = pT (GeV)) + const int hwPt() const { return m_hwPt; }; + /// Get second compressed pT (returned int * 1.0 = pT (GeV)) + const int hwPtUnconstrained() const { return m_hwPtUnconstrained; }; + /// Get compressed impact parameter (4 bits) + const int hwDXY() const { return m_hwDXY; }; + /// Get compressed local phi (returned int * 2*pi/576 = local phi in rad) + const int hwPhi() const { return m_hwPhi; }; + /// Get compressed eta (returned int * 0.010875 = eta) + const int hwEta() const { return m_hwEta; }; + /// Get charge sign bit (charge = (-1)^(sign)) + const int hwSign() const { return m_hwSign; }; + /// Get charge sign valid bit (0 - not valid (high pT muon); 1 - valid) + const int hwSignValid() const { return m_hwSignValid; }; + /// Get quality code + const int hwQual() const { return m_hwQuality; }; + /// Get link on which the MicroGMT receives the candidate + const int link() const { return m_link; }; + /// Get muon index (i.e., 0, 1, or 2) + const int muIdx() const { return m_muIdx; }; + /// Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF) + const int processor() const { return m_processor; }; + /// Get track-finder which found the muon (bmtf, emtf_pos/emtf_neg or omtf_pos/omtf_neg) + const tftype trackFinderType() const { return m_trackFinder; }; + /// Get HF (halo / fine eta) bit (EMTF: halo -> 1; BMTF: fine eta -> 1) + const int hwHF() const { return m_hwHF; }; + /// Get 64 bit data word + const uint64_t dataword() const { return m_dataword; }; + /// Get 32 MSBs of data word + const uint32_t dataword32Msb() const { return (uint32_t)((m_dataword >> 32) & 0xFFFFFFFF); }; + /// Get 32 LSBs of data word + const uint32_t dataword32Lsb() const { return (uint32_t)(m_dataword & 0xFFFFFFFF); }; + /// Get the track address (identifies track primitives used for reconstruction) + const std::map& trackAddress() const { return m_trackAddress; } + /// Get part of track address (identifies track primitives used for reconstruction) + int trackSubAddress(bmtfAddress subAddress) const { return m_trackAddress.at(subAddress); } + /// Get part of track address (identifies track primitives used for reconstruction) + int trackSubAddress(omtfAddress subAddress) const { return m_trackAddress.at(subAddress); } + /// Get part of track address (identifies track primitives used for reconstruction) + int trackSubAddress(emtfAddress subAddress) const { return m_trackAddress.at(subAddress); } - private: - int m_hwPt; - int m_hwPtUnconstrained; - int m_hwDXY; - int m_hwPhi; - int m_hwEta; - bool m_hwHF; - int m_hwSign; - int m_hwSignValid; - int m_hwQuality; - int m_link; - int m_processor; - tftype m_trackFinder; - std::map m_trackAddress; + bool operator==(const RegionalMuonCand& rhs) const; + inline bool operator!=(const RegionalMuonCand& rhs) const { return !(operator==(rhs)); }; - /// This is the 64 bit word as transmitted in HW - uint64_t m_dataword; - int m_muIdx{-1}; - }; + private: + int m_hwPt; + int m_hwPtUnconstrained; + int m_hwDXY; + int m_hwPhi; + int m_hwEta; + bool m_hwHF; + int m_hwSign; + int m_hwSignValid; + int m_hwQuality; + int m_link; + int m_processor; + tftype m_trackFinder; + std::map m_trackAddress; + /// This is the 64 bit word as transmitted in HW + uint64_t m_dataword; + int m_muIdx{-1}; + }; + } // namespace io_v1 } // namespace l1t #endif /* define __l1t_regional_muon_candidate_h__ */ diff --git a/DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h b/DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h index a6198ee065625..6dcf6b3dab018 100644 --- a/DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h +++ b/DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h @@ -6,7 +6,10 @@ namespace l1t { enum tftype { bmtf, omtf_neg, omtf_pos, emtf_neg, emtf_pos }; - class RegionalMuonCand; + namespace io_v1 { + class RegionalMuonCand; + } + using RegionalMuonCand = io_v1::RegionalMuonCand; typedef BXVector RegionalMuonCandBxCollection; typedef ObjectRef RegionalMuonCandRef; diff --git a/DataFormats/L1TMuon/interface/RegionalMuonShower.h b/DataFormats/L1TMuon/interface/RegionalMuonShower.h index 9759c82c8eceb..d2bfe151941ab 100644 --- a/DataFormats/L1TMuon/interface/RegionalMuonShower.h +++ b/DataFormats/L1TMuon/interface/RegionalMuonShower.h @@ -8,70 +8,69 @@ #include "RegionalMuonCandFwd.h" // For tftype. namespace l1t { + namespace io_v1 { + class RegionalMuonShower { + public: + RegionalMuonShower(bool oneNominalInTime = false, + bool oneNominalOutOfTime = false, + bool twoLooseInTime = false, + bool twoLooseOutOfTime = false, + bool oneLooseInTime = false, + bool oneTightInTime = false, + bool oneTightOutOfTime = false); - class RegionalMuonShower; - typedef BXVector RegionalMuonShowerBxCollection; - typedef ObjectRefBxCollection RegionalMuonShowerRefBxCollection; - typedef ObjectRefPair RegionalMuonShowerRefPair; - typedef ObjectRefPairBxCollection RegionalMuonShowerRefPairBxCollection; - - class RegionalMuonShower { - public: - RegionalMuonShower(bool oneNominalInTime = false, - bool oneNominalOutOfTime = false, - bool twoLooseInTime = false, - bool twoLooseOutOfTime = false, - bool oneLooseInTime = false, - bool oneTightInTime = false, - bool oneTightOutOfTime = false); - - ~RegionalMuonShower(); + ~RegionalMuonShower(); - void setOneNominalInTime(const bool bit) { isOneNominalInTime_ = bit; } - void setOneNominalOutOfTime(const bool bit) { isOneNominalOutOfTime_ = bit; } - void setOneTightInTime(const bool bit) { isOneTightInTime_ = bit; } - void setOneTightOutOfTime(const bool bit) { isOneTightOutOfTime_ = bit; } - void setTwoLooseOutOfTime(const bool bit) { isTwoLooseOutOfTime_ = bit; } - void setTwoLooseInTime(const bool bit) { isTwoLooseInTime_ = bit; } - void setOneLooseInTime(const bool bit) { isOneLooseInTime_ = bit; } + void setOneNominalInTime(const bool bit) { isOneNominalInTime_ = bit; } + void setOneNominalOutOfTime(const bool bit) { isOneNominalOutOfTime_ = bit; } + void setOneTightInTime(const bool bit) { isOneTightInTime_ = bit; } + void setOneTightOutOfTime(const bool bit) { isOneTightOutOfTime_ = bit; } + void setTwoLooseOutOfTime(const bool bit) { isTwoLooseOutOfTime_ = bit; } + void setTwoLooseInTime(const bool bit) { isTwoLooseInTime_ = bit; } + void setOneLooseInTime(const bool bit) { isOneLooseInTime_ = bit; } - /// Set the processor ID, track-finder type. From these two, the link is set - void setTFIdentifiers(int processor, tftype trackFinder); + /// Set the processor ID, track-finder type. From these two, the link is set + void setTFIdentifiers(int processor, tftype trackFinder); - bool isValid() const; - bool isOneNominalInTime() const { return isOneNominalInTime_; } - bool isOneNominalOutOfTime() const { return isOneNominalOutOfTime_; } - bool isOneTightInTime() const { return isOneTightInTime_; } - bool isOneTightOutOfTime() const { return isOneTightOutOfTime_; } - bool isTwoLooseInTime() const { return isTwoLooseInTime_; } - bool isTwoLooseOutOfTime() const { return isTwoLooseOutOfTime_; } - bool isOneLooseInTime() const { return isOneLooseInTime_; } + bool isValid() const; + bool isOneNominalInTime() const { return isOneNominalInTime_; } + bool isOneNominalOutOfTime() const { return isOneNominalOutOfTime_; } + bool isOneTightInTime() const { return isOneTightInTime_; } + bool isOneTightOutOfTime() const { return isOneTightOutOfTime_; } + bool isTwoLooseInTime() const { return isTwoLooseInTime_; } + bool isTwoLooseOutOfTime() const { return isTwoLooseOutOfTime_; } + bool isOneLooseInTime() const { return isOneLooseInTime_; } - /// Get link on which the MicroGMT receives the candidate - const int link() const { return link_; }; - /// Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF) - const int processor() const { return processor_; }; - /// Get track-finder which found the muon (bmtf, emtf_pos/emtf_neg or omtf_pos/omtf_neg) - const tftype trackFinderType() const { return trackFinder_; }; + /// Get link on which the MicroGMT receives the candidate + const int link() const { return link_; }; + /// Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF) + const int processor() const { return processor_; }; + /// Get track-finder which found the muon (bmtf, emtf_pos/emtf_neg or omtf_pos/omtf_neg) + const tftype trackFinderType() const { return trackFinder_; }; - bool operator==(const l1t::RegionalMuonShower& rhs) const; - inline bool operator!=(const l1t::RegionalMuonShower& rhs) const { return !(operator==(rhs)); }; - - private: - // Run-3 definitions as provided in DN-20-033 - // in time and out-of-time qualities. only 2 bits each. - bool isOneNominalInTime_; - bool isOneNominalOutOfTime_; - bool isOneTightInTime_; - bool isOneTightOutOfTime_; - bool isTwoLooseInTime_; - bool isTwoLooseOutOfTime_; - bool isOneLooseInTime_; - int link_; - int processor_; - tftype trackFinder_; - }; + bool operator==(const l1t::io_v1::RegionalMuonShower& rhs) const; + inline bool operator!=(const l1t::io_v1::RegionalMuonShower& rhs) const { return !(operator==(rhs)); }; + private: + // Run-3 definitions as provided in DN-20-033 + // in time and out-of-time qualities. only 2 bits each. + bool isOneNominalInTime_; + bool isOneNominalOutOfTime_; + bool isOneTightInTime_; + bool isOneTightOutOfTime_; + bool isTwoLooseInTime_; + bool isTwoLooseOutOfTime_; + bool isOneLooseInTime_; + int link_; + int processor_; + tftype trackFinder_; + }; + } // namespace io_v1 + using RegionalMuonShower = io_v1::RegionalMuonShower; + typedef BXVector RegionalMuonShowerBxCollection; + typedef ObjectRefBxCollection RegionalMuonShowerRefBxCollection; + typedef ObjectRefPair RegionalMuonShowerRefPair; + typedef ObjectRefPairBxCollection RegionalMuonShowerRefPairBxCollection; } // namespace l1t #endif diff --git a/DataFormats/L1TMuon/src/classes_def.xml b/DataFormats/L1TMuon/src/classes_def.xml index f6be6aa508147..482faaea41a2e 100644 --- a/DataFormats/L1TMuon/src/classes_def.xml +++ b/DataFormats/L1TMuon/src/classes_def.xml @@ -1,26 +1,18 @@ - - - - + + - - - - + - - - - - + + - + @@ -48,15 +40,20 @@ - + + + - + + + + @@ -83,13 +80,8 @@ - - - - - - - + + diff --git a/DataFormats/L1TMuonPhase2/interface/MuonStub.h b/DataFormats/L1TMuonPhase2/interface/MuonStub.h index 70902648a96b0..60c1045a16690 100644 --- a/DataFormats/L1TMuonPhase2/interface/MuonStub.h +++ b/DataFormats/L1TMuonPhase2/interface/MuonStub.h @@ -36,130 +36,130 @@ // --------------------- namespace l1t { + namespace io_v1 { + class MuonStub { + public: + /// default constructor + MuonStub(); + + /// constructor + MuonStub(int etaRegion, + int phiRegion, + int depthRegion, + uint tfLayer, + int coord1, + int coord2, + int id, + int bx, + int quality, + int eta1 = 0, + int eta2 = 0, + int etaQuality = -1, + int type = 0); + ~MuonStub(); + /// return wheel + inline int etaRegion() const { return etaRegion_; } + /// return sector + inline int phiRegion() const { return phiRegion_; } + /// return station + inline int depthRegion() const { return depthRegion_; } + /// return track finder layer + inline uint tfLayer() const { return tfLayer_; } + /// return phi + inline int coord1() const { return coord1_; } + /// return phib + inline int coord2() const { return coord2_; } + /// return quality code + inline int quality() const { return quality_; } + /// return tag (second TS tag) + inline int id() const { return id_; } + inline int index() const { return id_; } + /// return address + inline int address() const { + int addr = id_ | (phiRegion_ << 2); + if (etaRegion_ >= 0) { + return addr | (etaRegion_ << 8); + } else { + int twos_comp = ((-etaRegion_) ^ 0xf) + 1; + return addr | (twos_comp << 8); + } + } + + inline int kmtf_address() const { + int addr = id_ | (phiRegion_ << 2); + if (etaRegion_ >= 0) { + return addr | (etaRegion_ << 6); + } else { + int twos_comp = ((-etaRegion_) ^ 0x7) + 1; + return addr | (twos_comp << 6); + } + } - class MuonStub; + /// return bunch crossing + inline int bxNum() const { return bxNum_; } + + /// return eta + inline int eta1() const { return eta1_; } + inline int eta2() const { return eta2_; } + /// return first eta quality + inline int etaQuality() const { return etaQuality_; } + //return type + inline int type() const { return type_; } + + inline bool isBarrel() const { return (type_ == 1); } + inline bool isEndcap() const { return (type_ == 0); } + + inline double offline_coord1() const { return offline_coord1_; } + inline double offline_coord2() const { return offline_coord2_; } + inline double offline_eta1() const { return offline_eta1_; } + inline double offline_eta2() const { return offline_eta2_; } + + void setOfflineQuantities(double coord1, double coord2, double eta1, double eta2) { + offline_coord1_ = coord1; + offline_coord2_ = coord2; + offline_eta1_ = eta1; + offline_eta2_ = eta2; + } + void setEta(int eta1, int eta2, int etaQ) { + eta1_ = eta1; + eta2_ = eta2; + etaQuality_ = etaQ; + } + void setID(int id) { id_ = id; } + /// equal operator + bool operator==(const MuonStub&) const; + /// unequal operator + bool operator!=(const MuonStub&) const; + + void print() const; + + private: + int etaRegion_; //In the barrel this is wheel. In the endcap it is 6-ring + int phiRegion_; //In the barrel it is sector. In the endcap it is chamber + int depthRegion_; //Station + uint tfLayer_; //TF Layer + int coord1_; // global position angle in units of 30 degrees/2048 + int coord2_; // bending angle only in barrel for now + int id_; // stub id in case of more stubs per chamber + int quality_; // + int bxNum_; // bunch crossing identifier + int eta1_; // eta coordinate - in units of 3.0/512. + int eta2_; // eta coordinate - in units of 3.0/512. + int etaQuality_; // quality of the eta information + int type_; //Type: 0 TwinMux or DT, 1 RPC Barrel, 2 CSC, 3 RPC endcap + /////////members that are not hardware but used for offline studies/////////////////////////////// + double offline_coord1_; //offline coordinate 1 + double offline_coord2_; //offline coordinate two + double offline_eta1_; //offline eta1 + double offline_eta2_; //offline eta2 + }; + + } // namespace io_v1 + using MuonStub = io_v1::MuonStub; typedef std::vector MuonStubCollection; typedef edm::Ref MuonStubRef; typedef std::vector > MuonStubRefVector; - class MuonStub { - public: - /// default constructor - MuonStub(); - - /// constructor - MuonStub(int etaRegion, - int phiRegion, - int depthRegion, - uint tfLayer, - int coord1, - int coord2, - int id, - int bx, - int quality, - int eta1 = 0, - int eta2 = 0, - int etaQuality = -1, - int type = 0); - ~MuonStub(); - /// return wheel - inline int etaRegion() const { return etaRegion_; } - /// return sector - inline int phiRegion() const { return phiRegion_; } - /// return station - inline int depthRegion() const { return depthRegion_; } - /// return track finder layer - inline uint tfLayer() const { return tfLayer_; } - /// return phi - inline int coord1() const { return coord1_; } - /// return phib - inline int coord2() const { return coord2_; } - /// return quality code - inline int quality() const { return quality_; } - /// return tag (second TS tag) - inline int id() const { return id_; } - inline int index() const { return id_; } - /// return address - inline int address() const { - int addr = id_ | (phiRegion_ << 2); - if (etaRegion_ >= 0) { - return addr | (etaRegion_ << 8); - } else { - int twos_comp = ((-etaRegion_) ^ 0xf) + 1; - return addr | (twos_comp << 8); - } - } - - inline int kmtf_address() const { - int addr = id_ | (phiRegion_ << 2); - if (etaRegion_ >= 0) { - return addr | (etaRegion_ << 6); - } else { - int twos_comp = ((-etaRegion_) ^ 0x7) + 1; - return addr | (twos_comp << 6); - } - } - - /// return bunch crossing - inline int bxNum() const { return bxNum_; } - - /// return eta - inline int eta1() const { return eta1_; } - inline int eta2() const { return eta2_; } - /// return first eta quality - inline int etaQuality() const { return etaQuality_; } - //return type - inline int type() const { return type_; } - - inline bool isBarrel() const { return (type_ == 1); } - inline bool isEndcap() const { return (type_ == 0); } - - inline double offline_coord1() const { return offline_coord1_; } - inline double offline_coord2() const { return offline_coord2_; } - inline double offline_eta1() const { return offline_eta1_; } - inline double offline_eta2() const { return offline_eta2_; } - - void setOfflineQuantities(double coord1, double coord2, double eta1, double eta2) { - offline_coord1_ = coord1; - offline_coord2_ = coord2; - offline_eta1_ = eta1; - offline_eta2_ = eta2; - } - void setEta(int eta1, int eta2, int etaQ) { - eta1_ = eta1; - eta2_ = eta2; - etaQuality_ = etaQ; - } - - void setID(int id) { id_ = id; } - /// equal operator - bool operator==(const MuonStub&) const; - /// unequal operator - bool operator!=(const MuonStub&) const; - - void print() const; - - private: - int etaRegion_; //In the barrel this is wheel. In the endcap it is 6-ring - int phiRegion_; //In the barrel it is sector. In the endcap it is chamber - int depthRegion_; //Station - uint tfLayer_; //TF Layer - int coord1_; // global position angle in units of 30 degrees/2048 - int coord2_; // bending angle only in barrel for now - int id_; // stub id in case of more stubs per chamber - int quality_; // - int bxNum_; // bunch crossing identifier - int eta1_; // eta coordinate - in units of 3.0/512. - int eta2_; // eta coordinate - in units of 3.0/512. - int etaQuality_; // quality of the eta information - int type_; //Type: 0 TwinMux or DT, 1 RPC Barrel, 2 CSC, 3 RPC endcap - /////////members that are not hardware but used for offline studies/////////////////////////////// - double offline_coord1_; //offline coordinate 1 - double offline_coord2_; //offline coordinate two - double offline_eta1_; //offline eta1 - double offline_eta2_; //offline eta2 - }; - } // namespace l1t #endif diff --git a/DataFormats/L1TMuonPhase2/interface/SAMuon.h b/DataFormats/L1TMuonPhase2/interface/SAMuon.h index 31c53af75d299..73b6c618d2f42 100644 --- a/DataFormats/L1TMuonPhase2/interface/SAMuon.h +++ b/DataFormats/L1TMuonPhase2/interface/SAMuon.h @@ -11,81 +11,80 @@ #include "DataFormats/L1TMuonPhase2/interface/MuonStub.h" namespace l1t { - - class SAMuon; - + namespace io_v1 { + class SAMuon : public L1Candidate { + public: + SAMuon(); + + SAMuon(const l1t::Muon& mu, bool charge, uint pt, int eta, int phi, int z0, int d0, uint quality); + + ~SAMuon() override; + + const bool hwCharge() const { return hwCharge_; } + const int hwZ0() const { return hwZ0_; } + const int hwD0() const { return hwD0_; } + const uint hwBeta() const { return hwBeta_; } + void setBeta(uint beta) { hwBeta_ = beta; } + void setTF(tftype tf) { tf_ = tf; } + unsigned int trackID() const { return trackID_; } + + void setTrackID(unsigned int ID) { trackID_ = ID; } + + const tftype tfType() const { return tf_; } + // 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 apQualFlags() 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(); } + const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); } + const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); } + const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); } + const int phCharge() const { return pow(-1, hwCharge()); } + + const uint64_t word() const { return word_; } + void setWord(uint64_t word) { word_ = word; } + void print() const; + + bool operator<(const SAMuon& other) const { + if (hwPt() == other.hwPt()) + return (hwEta() < other.hwEta()); + else + return (hwPt() < other.hwPt()); + } + bool operator>(const SAMuon& other) const { + if (hwPt() == other.hwPt()) + return (hwEta() > other.hwEta()); + else + return (hwPt() > other.hwPt()); + } + + void addStub(const MuonStubRef& stub) { stubs_.push_back(stub); } + void setStubs(const MuonStubRefVector& stubs) { stubs_ = stubs; } + const MuonStubRefVector stubs() const { return stubs_; } + + private: + bool hwCharge_; + int hwZ0_; + int hwD0_; + uint hwBeta_; + uint64_t word_; + MuonStubRefVector stubs_; + unsigned int trackID_; + tftype tf_; + }; + } // namespace io_v1 + using SAMuon = io_v1::SAMuon; typedef std::vector SAMuonCollection; typedef edm::Ref SAMuonRef; typedef std::vector > SAMuonRefVector; - - class SAMuon : public L1Candidate { - public: - SAMuon(); - - SAMuon(const l1t::Muon& mu, bool charge, uint pt, int eta, int phi, int z0, int d0, uint quality); - - ~SAMuon() override; - - const bool hwCharge() const { return hwCharge_; } - const int hwZ0() const { return hwZ0_; } - const int hwD0() const { return hwD0_; } - const uint hwBeta() const { return hwBeta_; } - void setBeta(uint beta) { hwBeta_ = beta; } - void setTF(tftype tf) { tf_ = tf; } - unsigned int trackID() const { return trackID_; } - - void setTrackID(unsigned int ID) { trackID_ = ID; } - - const tftype tfType() const { return tf_; } - // 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 apQualFlags() 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(); } - const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); } - const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); } - const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); } - const int phCharge() const { return pow(-1, hwCharge()); } - - const uint64_t word() const { return word_; } - void setWord(uint64_t word) { word_ = word; } - void print() const; - - bool operator<(const SAMuon& other) const { - if (hwPt() == other.hwPt()) - return (hwEta() < other.hwEta()); - else - return (hwPt() < other.hwPt()); - } - bool operator>(const SAMuon& other) const { - if (hwPt() == other.hwPt()) - return (hwEta() > other.hwEta()); - else - return (hwPt() > other.hwPt()); - } - - void addStub(const MuonStubRef& stub) { stubs_.push_back(stub); } - void setStubs(const MuonStubRefVector& stubs) { stubs_ = stubs; } - const MuonStubRefVector stubs() const { return stubs_; } - - private: - bool hwCharge_; - int hwZ0_; - int hwD0_; - uint hwBeta_; - uint64_t word_; - MuonStubRefVector stubs_; - unsigned int trackID_; - tftype tf_; - }; } // namespace l1t #endif diff --git a/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h b/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h index 8946a8195afb2..215766cfd274a 100644 --- a/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h +++ b/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h @@ -13,88 +13,88 @@ #include "DataFormats/L1TMuonPhase2/interface/Constants.h" namespace l1t { + namespace io_v1 { + class TrackerMuon : public L1Candidate { + public: + typedef TTTrack L1TTTrackType; + typedef std::vector L1TTTrackCollection; - class TrackerMuon; + TrackerMuon(); - typedef std::vector TrackerMuonCollection; - typedef edm::Ref TrackerMuonRef; - typedef std::vector > TrackerMuonRefVector; - - class TrackerMuon : public L1Candidate { - public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollection; + TrackerMuon( + const edm::Ptr& trk, bool charge, uint pt, int eta, int phi, int z0, int d0, uint quality); - TrackerMuon(); + ~TrackerMuon() override; - TrackerMuon( - const edm::Ptr& trk, bool charge, uint pt, int eta, int phi, int z0, int d0, uint quality); + const edm::Ptr& trkPtr() const { return trkPtr_; } + const SAMuonRefVector muonRef() const { return muRef_; } - ~TrackerMuon() override; + const bool hwCharge() const { return hwCharge_; } + const int hwZ0() const { return hwZ0_; } + const int hwD0() const { return hwD0_; } + const int hwIsoSum() const { return hwIsoSum_; } + const int hwIsoSumAp() const { return hwIsoSumAp_; } + const uint hwBeta() const { return hwBeta_; } + void setBeta(uint beta) { hwBeta_ = beta; } + void setMuonRef(const l1t::SAMuonRefVector& p) { muRef_ = p; } + void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; } + void setHwIsoSumAp(int isoSum) { hwIsoSumAp_ = isoSum; } - const edm::Ptr& trkPtr() const { return trkPtr_; } - const SAMuonRefVector muonRef() const { return muRef_; } + // 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 apQualFlags() const { return Phase2L1GMT::qual_gt_t(hwQual()); }; + const Phase2L1GMT::iso_gt_t apIso() const { return Phase2L1GMT::iso_gt_t(hwIsoSumAp()); }; + const Phase2L1GMT::beta_gt_t apBeta() const { return Phase2L1GMT::beta_gt_t(hwBeta()); }; - const bool hwCharge() const { return hwCharge_; } - const int hwZ0() const { return hwZ0_; } - const int hwD0() const { return hwD0_; } - const int hwIsoSum() const { return hwIsoSum_; } - const int hwIsoSumAp() const { return hwIsoSumAp_; } - const uint hwBeta() const { return hwBeta_; } - void setBeta(uint beta) { hwBeta_ = beta; } - void setMuonRef(const l1t::SAMuonRefVector& p) { muRef_ = p; } - void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; } - void setHwIsoSumAp(int isoSum) { hwIsoSumAp_ = isoSum; } + // For HLT + const double phZ0() const { return Phase2L1GMT::LSBGTz0 * hwZ0(); } + const double phD0() const { return Phase2L1GMT::LSBGTd0 * hwD0(); } + const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); } + const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); } + const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); } + const double phIso() const { return Phase2L1GMT::LSBGTiso * hwIsoSumAp(); } + const int phCharge() const { return pow(-1, hwCharge()); } + const uint numberOfMatches() const { return numberOfMatches_; } + const uint numberOfStations() const { return stubs_.size(); } + const std::array word() const { return word_; } + void setWord(std::array word) { word_ = word; } + void print() const; + const MuonStubRefVector stubs() const { return stubs_; } + void addStub(const MuonStubRef& stub) { stubs_.push_back(stub); } + void setNumberOfMatches(uint matches) { numberOfMatches_ = matches; } + bool operator<(const TrackerMuon& other) const { return (hwPt() < other.hwPt()); } + bool operator>(const TrackerMuon& other) const { return (hwPt() > other.hwPt()); } - // 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 apQualFlags() const { return Phase2L1GMT::qual_gt_t(hwQual()); }; - const Phase2L1GMT::iso_gt_t apIso() const { return Phase2L1GMT::iso_gt_t(hwIsoSumAp()); }; - 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(); } - const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); } - const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); } - const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); } - const double phIso() const { return Phase2L1GMT::LSBGTiso * hwIsoSumAp(); } - const int phCharge() const { return pow(-1, hwCharge()); } - const uint numberOfMatches() const { return numberOfMatches_; } - const uint numberOfStations() const { return stubs_.size(); } - const std::array word() const { return word_; } - void setWord(std::array word) { word_ = word; } - void print() const; - const MuonStubRefVector stubs() const { return stubs_; } - void addStub(const MuonStubRef& stub) { stubs_.push_back(stub); } - void setNumberOfMatches(uint matches) { numberOfMatches_ = matches; } - bool operator<(const TrackerMuon& other) const { return (hwPt() < other.hwPt()); } - bool operator>(const TrackerMuon& other) const { return (hwPt() > other.hwPt()); } + private: + // used for the Naive producer + edm::Ptr trkPtr_; + bool hwCharge_; + int hwZ0_; + int hwD0_; + uint hwBeta_; + // The tracker muon is encoded in 96 bits as a 2-element array of uint64_t + std::array word_ = {{0, 0}}; + //Store the eneryg sum for isolation + int hwIsoSum_; + //Store the eneryg sum for isolation with ap_type + int hwIsoSumAp_; + uint numberOfMatches_; + uint numberOfStations_; + SAMuonRefVector muRef_; + MuonStubRefVector stubs_; + }; + } // namespace io_v1 + using TrackerMuon = io_v1::TrackerMuon; + typedef std::vector TrackerMuonCollection; + typedef edm::Ref TrackerMuonRef; + typedef std::vector > TrackerMuonRefVector; - private: - // used for the Naive producer - edm::Ptr trkPtr_; - bool hwCharge_; - int hwZ0_; - int hwD0_; - uint hwBeta_; - // The tracker muon is encoded in 96 bits as a 2-element array of uint64_t - std::array word_ = {{0, 0}}; - //Store the eneryg sum for isolation - int hwIsoSum_; - //Store the eneryg sum for isolation with ap_type - int hwIsoSumAp_; - uint numberOfMatches_; - uint numberOfStations_; - SAMuonRefVector muRef_; - MuonStubRefVector stubs_; - }; } // namespace l1t #endif diff --git a/DataFormats/L1TMuonPhase2/src/classes_def.xml b/DataFormats/L1TMuonPhase2/src/classes_def.xml index d5fc2af4de331..a31740aed46f9 100644 --- a/DataFormats/L1TMuonPhase2/src/classes_def.xml +++ b/DataFormats/L1TMuonPhase2/src/classes_def.xml @@ -1,29 +1,29 @@ - - + + - - + + - - + + - - + + - - + + - - + + - + diff --git a/DataFormats/L1TParticleFlow/interface/PFCandidate.h b/DataFormats/L1TParticleFlow/interface/PFCandidate.h index ff6e026acdfa3..63c2a6b1d6fa7 100644 --- a/DataFormats/L1TParticleFlow/interface/PFCandidate.h +++ b/DataFormats/L1TParticleFlow/interface/PFCandidate.h @@ -7,81 +7,82 @@ #include "DataFormats/L1Trigger/interface/RegionalOutput.h" namespace l1t { - - class PFCandidate : public L1Candidate { - public: - typedef l1t::SAMuonRef MuonRef; - typedef edm::Ptr L1CandPtr; - enum ParticleType { ChargedHadron = 0, Electron = 1, NeutralHadron = 2, Photon = 3, Muon = 4 }; - - PFCandidate() {} - PFCandidate(ParticleType kind, - int charge, - const LorentzVector& p, - float puppiWeight = -1, - int hwpt = 0, - int hweta = 0, - int hwphi = 0) - : PFCandidate(kind, charge, PolarLorentzVector(p), puppiWeight, hwpt, hweta, hwphi) {} - PFCandidate(ParticleType kind, - int charge, - const PolarLorentzVector& p, - float puppiWeight = -1, - int hwpt = 0, - int hweta = 0, - int hwphi = 0); - - ParticleType id() const { return ParticleType(hwQual()); } - - const PFTrackRef& pfTrack() const { return trackRef_; } - void setPFTrack(const PFTrackRef& ref) { trackRef_ = ref; } - - const L1CandPtr& caloPtr() const { return caloPtr_; } - void setCaloPtr(const L1CandPtr& ptr) { caloPtr_ = ptr; } - - const MuonRef& muon() const { return muonRef_; } - void setMuon(const MuonRef& ref) { muonRef_ = ref; } - - /// PUPPI weight (-1 if not available) - float puppiWeight() const { return puppiWeight_; } - - 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_; } - uint16_t hwTkQuality() const { return hwTkQuality_; } - uint16_t hwPuppiWeight() const { return hwPuppiWeight_; } - uint16_t hwEmID() const { return hwEmID_; } - uint64_t encodedPuppi64() const { return encodedPuppi64_; } - - void setHwZ0(int16_t hwZ0) { hwZ0_ = hwZ0; } - void setHwDxy(int16_t hwDxy) { hwDxy_ = hwDxy; } - void setHwTkQuality(uint16_t hwTkQuality) { hwTkQuality_ = hwTkQuality; } - void setHwPuppiWeight(uint16_t hwPuppiWeight) { hwPuppiWeight_ = hwPuppiWeight; } - void setHwEmID(uint16_t hwEmID) { hwEmID_ = hwEmID; } - void setEncodedPuppi64(uint64_t encodedPuppi64) { encodedPuppi64_ = encodedPuppi64; } - - private: - L1CandPtr caloPtr_; - PFTrackRef trackRef_; - MuonRef muonRef_; - float dxy_, puppiWeight_, caloEta_, caloPhi_; - - int16_t hwZ0_, hwDxy_; - uint16_t hwTkQuality_, hwPuppiWeight_, hwEmID_; - uint64_t encodedPuppi64_; - - void setPdgIdFromParticleType(int charge, ParticleType kind); - }; - + namespace io_v1 { + class PFCandidate : public L1Candidate { + public: + typedef l1t::SAMuonRef MuonRef; + typedef edm::Ptr L1CandPtr; + enum ParticleType { ChargedHadron = 0, Electron = 1, NeutralHadron = 2, Photon = 3, Muon = 4 }; + + PFCandidate() {} + PFCandidate(ParticleType kind, + int charge, + const LorentzVector& p, + float puppiWeight = -1, + int hwpt = 0, + int hweta = 0, + int hwphi = 0) + : PFCandidate(kind, charge, PolarLorentzVector(p), puppiWeight, hwpt, hweta, hwphi) {} + PFCandidate(ParticleType kind, + int charge, + const PolarLorentzVector& p, + float puppiWeight = -1, + int hwpt = 0, + int hweta = 0, + int hwphi = 0); + + ParticleType id() const { return ParticleType(hwQual()); } + + const PFTrackRef& pfTrack() const { return trackRef_; } + void setPFTrack(const PFTrackRef& ref) { trackRef_ = ref; } + + const L1CandPtr& caloPtr() const { return caloPtr_; } + void setCaloPtr(const L1CandPtr& ptr) { caloPtr_ = ptr; } + + const MuonRef& muon() const { return muonRef_; } + void setMuon(const MuonRef& ref) { muonRef_ = ref; } + + /// PUPPI weight (-1 if not available) + float puppiWeight() const { return puppiWeight_; } + + 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_; } + uint16_t hwTkQuality() const { return hwTkQuality_; } + uint16_t hwPuppiWeight() const { return hwPuppiWeight_; } + uint16_t hwEmID() const { return hwEmID_; } + uint64_t encodedPuppi64() const { return encodedPuppi64_; } + + void setHwZ0(int16_t hwZ0) { hwZ0_ = hwZ0; } + void setHwDxy(int16_t hwDxy) { hwDxy_ = hwDxy; } + void setHwTkQuality(uint16_t hwTkQuality) { hwTkQuality_ = hwTkQuality; } + void setHwPuppiWeight(uint16_t hwPuppiWeight) { hwPuppiWeight_ = hwPuppiWeight; } + void setHwEmID(uint16_t hwEmID) { hwEmID_ = hwEmID; } + void setEncodedPuppi64(uint64_t encodedPuppi64) { encodedPuppi64_ = encodedPuppi64; } + + private: + L1CandPtr caloPtr_; + PFTrackRef trackRef_; + MuonRef muonRef_; + float dxy_, puppiWeight_, caloEta_, caloPhi_; + + int16_t hwZ0_, hwDxy_; + uint16_t hwTkQuality_, hwPuppiWeight_, hwEmID_; + uint64_t encodedPuppi64_; + + void setPdgIdFromParticleType(int charge, ParticleType kind); + }; + } // namespace io_v1 + using PFCandidate = io_v1::PFCandidate; typedef std::vector PFCandidateCollection; typedef edm::Ref PFCandidateRef; typedef edm::RefVector PFCandidateRefVector; diff --git a/DataFormats/L1TParticleFlow/interface/PFCluster.h b/DataFormats/L1TParticleFlow/interface/PFCluster.h index 6d2dd6713ef29..dccc202c8d7b3 100644 --- a/DataFormats/L1TParticleFlow/interface/PFCluster.h +++ b/DataFormats/L1TParticleFlow/interface/PFCluster.h @@ -9,105 +9,111 @@ #include namespace l1t { + namespace io_v1 { + class PFCluster : public L1Candidate { + public: + /// constituent information. note that this is not going to be available in the hardware! + typedef std::pair, float> ConstituentAndFraction; + typedef std::vector ConstituentsAndFractions; + + PFCluster() {} + PFCluster(float pt, + float eta, + float phi, + float hOverE = 0, + bool isEM = false, + float ptError = 0, + int hwpt = 0, + int hweta = 0, + int hwphi = 0) + : L1Candidate(PolarLorentzVector(pt, eta, phi, 0), hwpt, hweta, hwphi, /*hwQuality=*/isEM ? 1 : 0), + hOverE_(hOverE), + ptError_(ptError), + encoding_(HWEncoding::None), + digiDataW0_(0), + digiDataW1_(0) { + setPdgId(isEM ? 22 : 130); // photon : non-photon(K0) + } + PFCluster(const LorentzVector& p4, + float hOverE, + bool isEM, + float ptError = 0, + int hwpt = 0, + int hweta = 0, + int hwphi = 0) + : L1Candidate(p4, hwpt, hweta, hwphi, /*hwQuality=*/isEM ? 1 : 0), hOverE_(hOverE), ptError_(ptError) { + setPdgId(isEM ? 22 : 130); // photon : non-photon(K0) + } + + enum class HWEncoding { None = 0, Had = 1, Em = 2 }; + + float hOverE() const { return hOverE_; } + void setHOverE(float hOverE) { hOverE_ = hOverE; } + + // NOTE: this might not be consistent with the value stored in the HW digi + float emEt() const { + if (hOverE_ == -1) + return 0; + return pt() / (1 + hOverE_); + } + + // change the pt. H/E also recalculated to keep emEt constant + void calibratePt(float newpt, float preserveEmEt = true); - class PFCluster : public L1Candidate { - public: - /// constituent information. note that this is not going to be available in the hardware! - typedef std::pair, float> ConstituentAndFraction; - typedef std::vector ConstituentsAndFractions; - - PFCluster() {} - PFCluster(float pt, - float eta, - float phi, - float hOverE = 0, - bool isEM = false, - float ptError = 0, - int hwpt = 0, - int hweta = 0, - int hwphi = 0) - : L1Candidate(PolarLorentzVector(pt, eta, phi, 0), hwpt, hweta, hwphi, /*hwQuality=*/isEM ? 1 : 0), - hOverE_(hOverE), - ptError_(ptError), - encoding_(HWEncoding::None), - digiDataW0_(0), - digiDataW1_(0) { - setPdgId(isEM ? 22 : 130); // photon : non-photon(K0) - } - PFCluster( - const LorentzVector& p4, float hOverE, bool isEM, float ptError = 0, int hwpt = 0, int hweta = 0, int hwphi = 0) - : L1Candidate(p4, hwpt, hweta, hwphi, /*hwQuality=*/isEM ? 1 : 0), hOverE_(hOverE), ptError_(ptError) { - setPdgId(isEM ? 22 : 130); // photon : non-photon(K0) - } - - enum class HWEncoding { None = 0, Had = 1, Em = 2 }; - - float hOverE() const { return hOverE_; } - void setHOverE(float hOverE) { hOverE_ = hOverE; } - - // NOTE: this might not be consistent with the value stored in the HW digi - float emEt() const { - if (hOverE_ == -1) - return 0; - return pt() / (1 + hOverE_); - } - - // change the pt. H/E also recalculated to keep emEt constant - void calibratePt(float newpt, float preserveEmEt = true); - - /// constituent information. note that this is not going to be available in the hardware! - const ConstituentsAndFractions& constituentsAndFractions() const { return constituents_; } - /// adds a candidate to this cluster; note that this only records the information, it's up to you to also set the 4-vector appropriately - void addConstituent(const edm::Ptr& cand, float fraction = 1.0) { - constituents_.emplace_back(cand, fraction); - } - - float ptError() const { return ptError_; } - void setPtError(float ptError) { ptError_ = ptError; } - - bool isEM() const { return hwQual(); } - void setIsEM(bool isEM) { setHwQual(isEM); } - unsigned int hwEmID() const { return hwQual(); } - - std::variant caloDigiObj() const { - switch (encoding_) { - case HWEncoding::Had: - return l1ct::HadCaloObj::unpack(binaryWord()); - case HWEncoding::Em: - return l1ct::EmCaloObj::unpack(binaryWord()); - default: - throw std::runtime_error("No encoding for this cluster"); + /// constituent information. note that this is not going to be available in the hardware! + const ConstituentsAndFractions& constituentsAndFractions() const { return constituents_; } + /// adds a candidate to this cluster; note that this only records the information, it's up to you to also set the 4-vector appropriately + void addConstituent(const edm::Ptr& cand, float fraction = 1.0) { + constituents_.emplace_back(cand, fraction); } - } - void setCaloDigi(const l1ct::HadCaloObj& obj) { setBinaryWord(obj.pack(), HWEncoding::Had); } + float ptError() const { return ptError_; } + void setPtError(float ptError) { ptError_ = ptError; } + + bool isEM() const { return hwQual(); } + void setIsEM(bool isEM) { setHwQual(isEM); } + unsigned int hwEmID() const { return hwQual(); } + + std::variant caloDigiObj() const { + switch (encoding_) { + case HWEncoding::Had: + return l1ct::HadCaloObj::unpack(binaryWord()); + case HWEncoding::Em: + return l1ct::EmCaloObj::unpack(binaryWord()); + default: + throw std::runtime_error("No encoding for this cluster"); + } + } - void setCaloDigi(const l1ct::EmCaloObj& obj) { setBinaryWord(obj.pack(), HWEncoding::Em); } + void setCaloDigi(const l1ct::HadCaloObj& obj) { setBinaryWord(obj.pack(), HWEncoding::Had); } - HWEncoding encoding() const { return encoding_; } + void setCaloDigi(const l1ct::EmCaloObj& obj) { setBinaryWord(obj.pack(), HWEncoding::Em); } - private: - float hOverE_, ptError_; + HWEncoding encoding() const { return encoding_; } - ConstituentsAndFractions constituents_; + private: + float hOverE_, ptError_; - template - void setBinaryWord(ap_uint word, HWEncoding encoding) { - digiDataW0_ = word; - digiDataW1_ = (word >> 64); - encoding_ = encoding; - } + ConstituentsAndFractions constituents_; - template - ap_uint binaryWord() const { - return ap_uint(digiDataW0_) | (ap_uint(digiDataW1_) << 64); - } + template + void setBinaryWord(ap_uint word, HWEncoding encoding) { + digiDataW0_ = word; + digiDataW1_ = (word >> 64); + encoding_ = encoding; + } - HWEncoding encoding_; - uint64_t digiDataW0_; - uint64_t digiDataW1_; - }; + template + ap_uint binaryWord() const { + return ap_uint(digiDataW0_) | (ap_uint(digiDataW1_) << 64); + } + HWEncoding encoding_; + uint64_t digiDataW0_; + uint64_t digiDataW1_; + }; + } // namespace io_v1 + using PFCluster = io_v1::PFCluster; typedef std::vector PFClusterCollection; typedef edm::Ref PFClusterRef; } // namespace l1t diff --git a/DataFormats/L1TParticleFlow/interface/PFClusterFwd.h b/DataFormats/L1TParticleFlow/interface/PFClusterFwd.h index 5bb7f7503318d..ce3e8edb48e7d 100644 --- a/DataFormats/L1TParticleFlow/interface/PFClusterFwd.h +++ b/DataFormats/L1TParticleFlow/interface/PFClusterFwd.h @@ -2,6 +2,9 @@ #define DataFormats_L1TParticleFlow_PFClusterFwd_h namespace l1t { - class PFCluster; -} + namespace io_v1 { + class PFCluster; + } + using PFCluster = io_v1::PFCluster; +} // namespace l1t #endif diff --git a/DataFormats/L1TParticleFlow/interface/PFJet.h b/DataFormats/L1TParticleFlow/interface/PFJet.h index e02d0e3727d36..49bca04f89ba5 100644 --- a/DataFormats/L1TParticleFlow/interface/PFJet.h +++ b/DataFormats/L1TParticleFlow/interface/PFJet.h @@ -8,88 +8,90 @@ #include "DataFormats/Common/interface/Ptr.h" namespace l1t { + namespace io_v1 { + class PFJet : public L1Candidate { + public: + /// constituent information. note that this is not going to be available in the hardware! + typedef std::vector> Constituents; + + PFJet() {} + PFJet(float pt, float eta, float phi, float mass, int hwpt = 0, int hweta = 0, int hwphi = 0) + : L1Candidate(PolarLorentzVector(pt, eta, phi, mass), hwpt, hweta, hwphi, /*hwQuality=*/0), rawPt_(pt) {} + + PFJet(const LorentzVector& p4, int hwpt = 0, int hweta = 0, int hwphi = 0) + : L1Candidate(p4, hwpt, hweta, hwphi, /*hwQuality=*/0), rawPt_(p4.Pt()) {} + + // change the pt (but doesn't change the raw pt) + void calibratePt(float newpt); + + // return the raw pT() + float rawPt() const { return rawPt_; } + + /// constituent information. note that this is not going to be available in the hardware! + const Constituents& constituents() const { return constituents_; } + /// adds a candidate to this cluster; note that this only records the information, it's up to you to also set the 4-vector appropriately + void addConstituent(const edm::Ptr& cand) { constituents_.emplace_back(cand); } + + // add jet tag prediction results + void addTagScores(std::vector scores, std::vector classes, float ptcorrection) { + tagScores_ = scores; + tagClasses_ = classes; + ptCorrection_ = ptcorrection; + } - class PFJet : public L1Candidate { - public: - /// constituent information. note that this is not going to be available in the hardware! - typedef std::vector> Constituents; - - PFJet() {} - PFJet(float pt, float eta, float phi, float mass, int hwpt = 0, int hweta = 0, int hwphi = 0) - : L1Candidate(PolarLorentzVector(pt, eta, phi, mass), hwpt, hweta, hwphi, /*hwQuality=*/0), rawPt_(pt) {} - - PFJet(const LorentzVector& p4, int hwpt = 0, int hweta = 0, int hwphi = 0) - : L1Candidate(p4, hwpt, hweta, hwphi, /*hwQuality=*/0), rawPt_(p4.Pt()) {} - - // change the pt (but doesn't change the raw pt) - void calibratePt(float newpt); + std::vector getTagScores() const { return tagScores_; } + std::vector getTagClasses() const { return tagClasses_; } - // return the raw pT() - float rawPt() const { return rawPt_; } + float getTagScore(l1ct::JetTagClass tagClass) const { + // get the tag score for a specific tagClass + auto it = std::find(tagClasses_.begin(), tagClasses_.end(), tagClass); + if (it != tagClasses_.end()) { + return tagScores_[std::distance(tagClasses_.begin(), it)]; + } + return -1.0f; // Return an invalid/default score if tagClass is not found + } - /// constituent information. note that this is not going to be available in the hardware! - const Constituents& constituents() const { return constituents_; } - /// adds a candidate to this cluster; note that this only records the information, it's up to you to also set the 4-vector appropriately - void addConstituent(const edm::Ptr& cand) { constituents_.emplace_back(cand); } + float getTagScore(const std::string& tagClassStr) const { + // get the tag score for a specific tagClass + l1ct::JetTagClass tagClass(tagClassStr); + return getTagScore(tagClass); + } - // add jet tag prediction results - void addTagScores(std::vector scores, std::vector classes, float ptcorrection) { - tagScores_ = scores; - tagClasses_ = classes; - ptCorrection_ = ptcorrection; - } + float getPtCorrection() const { return ptCorrection_; } - std::vector getTagScores() const { return tagScores_; } - std::vector getTagClasses() const { return tagClasses_; } + // candidate interface + size_t numberOfDaughters() const override { return constituents_.size(); } + const reco::Candidate* daughter(size_type i) const override { return constituents_[i].get(); } + using reco::LeafCandidate::daughter; // avoid hiding the base + edm::Ptr daughterPtr(size_type i) const { return constituents_[i]; } - float getTagScore(l1ct::JetTagClass tagClass) const { - // get the tag score for a specific tagClass - auto it = std::find(tagClasses_.begin(), tagClasses_.end(), tagClass); - if (it != tagClasses_.end()) { - return tagScores_[std::distance(tagClasses_.begin(), it)]; + // Get and set the encodedJet_ bits. The Jet is encoded in 128 bits as a 2-element array of uint64_t + // We store encodings both for Correlator internal usage and for Global Trigger + enum class HWEncoding { CT, GT, GTWide }; + typedef std::array PackedJet; + const PackedJet& encodedJet(const HWEncoding encoding = HWEncoding::GT) const { + return encodedJet_[static_cast(encoding)]; + } + void setEncodedJet(const HWEncoding encoding, const PackedJet jet) { + encodedJet_[static_cast(encoding)] = jet; } - return -1.0f; // Return an invalid/default score if tagClass is not found - } - - float getTagScore(const std::string& tagClassStr) const { - // get the tag score for a specific tagClass - l1ct::JetTagClass tagClass(tagClassStr); - return getTagScore(tagClass); - } - - float getPtCorrection() const { return ptCorrection_; } - - // candidate interface - size_t numberOfDaughters() const override { return constituents_.size(); } - const reco::Candidate* daughter(size_type i) const override { return constituents_[i].get(); } - using reco::LeafCandidate::daughter; // avoid hiding the base - edm::Ptr daughterPtr(size_type i) const { return constituents_[i]; } - - // Get and set the encodedJet_ bits. The Jet is encoded in 128 bits as a 2-element array of uint64_t - // We store encodings both for Correlator internal usage and for Global Trigger - enum class HWEncoding { CT, GT, GTWide }; - typedef std::array PackedJet; - const PackedJet& encodedJet(const HWEncoding encoding = HWEncoding::GT) const { - return encodedJet_[static_cast(encoding)]; - } - void setEncodedJet(const HWEncoding encoding, const PackedJet jet) { - encodedJet_[static_cast(encoding)] = jet; - } - - // Accessors to HW objects with ap_* types from encoded words - const PackedJet& getHWJetGT() const { return encodedJet(HWEncoding::GT); } - const PackedJet& getHWJetGTWide() const { return encodedJet(HWEncoding::GTWide); } - const PackedJet& getHWJetCT() const { return encodedJet(HWEncoding::CT); } - - private: - float rawPt_; - Constituents constituents_; - std::vector tagClasses_; - std::vector tagScores_; - float ptCorrection_; - std::array encodedJet_ = {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}; - }; + // Accessors to HW objects with ap_* types from encoded words + const PackedJet& getHWJetGT() const { return encodedJet(HWEncoding::GT); } + const PackedJet& getHWJetGTWide() const { return encodedJet(HWEncoding::GTWide); } + const PackedJet& getHWJetCT() const { return encodedJet(HWEncoding::CT); } + + private: + float rawPt_; + Constituents constituents_; + std::vector tagClasses_; + std::vector tagScores_; + float ptCorrection_; + std::array encodedJet_ = {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}; + }; + + } // namespace io_v1 + using PFJet = io_v1::PFJet; typedef std::vector PFJetCollection; typedef edm::Ref PFJetRef; typedef edm::RefVector PFJetRefVector; diff --git a/DataFormats/L1TParticleFlow/interface/PFTau.h b/DataFormats/L1TParticleFlow/interface/PFTau.h index 0a2fb9a3fe489..938ef22f6fd14 100644 --- a/DataFormats/L1TParticleFlow/interface/PFTau.h +++ b/DataFormats/L1TParticleFlow/interface/PFTau.h @@ -23,70 +23,72 @@ namespace l1t { static constexpr double PFTAU_NN_PT_CUTOFF = 100.0; - class PFTau : public L1Candidate { - public: - PFTau() {} - enum { unidentified = 0, oneprong = 1, oneprongpi0 = 2, threeprong = 3 }; - PFTau(const LorentzVector& p, - float iVector[80], - float iso = -1, - float fulliso = -1, - int id = 0, - int hwpt = 0, - int hweta = 0, - int hwphi = 0) - : PFTau(PolarLorentzVector(p), iVector, iso, id, hwpt, hweta, hwphi) {} - PFTau(const PolarLorentzVector& p, - float iVector[80], - float iso = -1, - float fulliso = -1, - int id = 0, - int hwpt = 0, - int hweta = 0, - int hwphi = 0); - float chargedIso() const { return iso_; } - float fullIso() const { return fullIso_; } - int id() const { return id_; } - - void setZ0(float z0) { setVertex(reco::Particle::Point(0, 0, z0)); } - void setDxy(float dxy) { dxy_ = dxy; } - - float z0() const { return vz(); } - float dxy() const { return dxy_; } - const float* NNValues() const { return NNValues_; } - - bool passMass() const { return (mass() < 2 + pt() / PTSCALING_MASSCUT); } - bool passLooseNN() const { return iso_ > PFTAU_NN_LOOSE_CUT; } - bool passLooseNNMass() const { - if (!passMass()) - return false; - return passLooseNN(); - } - bool passLoosePF() const { return fullIso_ < PFTAU_PF_LOOSE_CUT; } - bool passTightNN() const { return iso_ > PFTAU_NN_TIGHT_CUT; } - bool passTightNNMass() const { - if (!passMass()) - return false; - return passTightNN(); - } - bool passTightPF() const { return fullIso_ < PFTAU_PF_TIGHT_CUT; } - - //Tau encoding for GT - void set_encodedTau(l1gt::PackedTau encodedTau) { encodedTau_ = encodedTau; } - l1gt::PackedTau encodedTau() const { return encodedTau_; } //Can be unpacked using l1gt::Tau::unpack() - - //Return the l1gt Tau object from the encoded objects - l1gt::Tau getHWTauGT() const { return l1gt::Tau::unpack(encodedTau_); } - - private: - float NNValues_[80]; // Values for each of the 80 NN inputs - float iso_; - float fullIso_; - int id_; - float dxy_; - l1gt::PackedTau encodedTau_; - }; - + namespace io_v1 { + class PFTau : public L1Candidate { + public: + PFTau() {} + enum { unidentified = 0, oneprong = 1, oneprongpi0 = 2, threeprong = 3 }; + PFTau(const LorentzVector& p, + float iVector[80], + float iso = -1, + float fulliso = -1, + int id = 0, + int hwpt = 0, + int hweta = 0, + int hwphi = 0) + : PFTau(PolarLorentzVector(p), iVector, iso, id, hwpt, hweta, hwphi) {} + PFTau(const PolarLorentzVector& p, + float iVector[80], + float iso = -1, + float fulliso = -1, + int id = 0, + int hwpt = 0, + int hweta = 0, + int hwphi = 0); + float chargedIso() const { return iso_; } + float fullIso() const { return fullIso_; } + int id() const { return id_; } + + void setZ0(float z0) { setVertex(reco::Particle::Point(0, 0, z0)); } + void setDxy(float dxy) { dxy_ = dxy; } + + float z0() const { return vz(); } + float dxy() const { return dxy_; } + const float* NNValues() const { return NNValues_; } + + bool passMass() const { return (mass() < 2 + pt() / PTSCALING_MASSCUT); } + bool passLooseNN() const { return iso_ > PFTAU_NN_LOOSE_CUT; } + bool passLooseNNMass() const { + if (!passMass()) + return false; + return passLooseNN(); + } + bool passLoosePF() const { return fullIso_ < PFTAU_PF_LOOSE_CUT; } + bool passTightNN() const { return iso_ > PFTAU_NN_TIGHT_CUT; } + bool passTightNNMass() const { + if (!passMass()) + return false; + return passTightNN(); + } + bool passTightPF() const { return fullIso_ < PFTAU_PF_TIGHT_CUT; } + + //Tau encoding for GT + void set_encodedTau(l1gt::PackedTau encodedTau) { encodedTau_ = encodedTau; } + l1gt::PackedTau encodedTau() const { return encodedTau_; } //Can be unpacked using l1gt::Tau::unpack() + + //Return the l1gt Tau object from the encoded objects + l1gt::Tau getHWTauGT() const { return l1gt::Tau::unpack(encodedTau_); } + + private: + float NNValues_[80]; // Values for each of the 80 NN inputs + float iso_; + float fullIso_; + int id_; + float dxy_; + l1gt::PackedTau encodedTau_; + }; + } // namespace io_v1 + using PFTau = io_v1::PFTau; typedef std::vector PFTauCollection; typedef edm::Ref PFTauRef; diff --git a/DataFormats/L1TParticleFlow/interface/PFTrack.h b/DataFormats/L1TParticleFlow/interface/PFTrack.h index 50cb946063d6e..f4edef175349f 100644 --- a/DataFormats/L1TParticleFlow/interface/PFTrack.h +++ b/DataFormats/L1TParticleFlow/interface/PFTrack.h @@ -8,84 +8,85 @@ #include "DataFormats/Common/interface/Ref.h" namespace l1t { + namespace io_v1 { + class PFTrack : public L1Candidate { + public: + typedef TTTrack L1TTTrackType; + typedef edm::Ref> TrackRef; - class PFTrack : public L1Candidate { - public: - typedef TTTrack L1TTTrackType; - typedef edm::Ref> TrackRef; + PFTrack() {} + PFTrack(int charge, + const reco::Particle::LorentzVector& p4, + const reco::Particle::Point& vtx, + const TrackRef& tkPtr, + int nPar, + float caloEta, + float caloPhi, + float trkPtError = -1, + float caloPtError = -1, + int quality = 1, + bool isMuon = false, + int hwpt = 0, + int hweta = 0, + int hwphi = 0) + : L1Candidate(p4, hwpt, hweta, hwphi, quality), + trackRef_(tkPtr), + caloEta_(caloEta), + caloPhi_(caloPhi), + trkPtError_(trkPtError), + caloPtError_(caloPtError), + isMuon_(isMuon), + nPar_(nPar), + trackWord_(*tkPtr) { + setCharge(charge); + setVertex(vtx); + } - PFTrack() {} - PFTrack(int charge, - const reco::Particle::LorentzVector& p4, - const reco::Particle::Point& vtx, - const TrackRef& tkPtr, - int nPar, - float caloEta, - float caloPhi, - float trkPtError = -1, - float caloPtError = -1, - int quality = 1, - bool isMuon = false, - int hwpt = 0, - int hweta = 0, - int hwphi = 0) - : L1Candidate(p4, hwpt, hweta, hwphi, quality), - trackRef_(tkPtr), - caloEta_(caloEta), - caloPhi_(caloPhi), - trkPtError_(trkPtError), - caloPtError_(caloPtError), - isMuon_(isMuon), - nPar_(nPar), - trackWord_(*tkPtr) { - setCharge(charge); - setVertex(vtx); - } + const TrackRef& track() const { return trackRef_; } + void setTrack(const TrackRef& ref) { trackRef_ = ref; } - const TrackRef& track() const { return trackRef_; } - void setTrack(const TrackRef& ref) { trackRef_ = ref; } + /// eta coordinate propagated at the calorimeter surface used for track-cluster matching + float caloEta() const { return caloEta_; } + /// phi coordinate propagated at the calorimeter surface used for track-cluster matching + float caloPhi() const { return caloPhi_; } + void setCaloEtaPhi(float eta, float phi) { + caloEta_ = eta; + caloPhi_ = phi; + } - /// eta coordinate propagated at the calorimeter surface used for track-cluster matching - float caloEta() const { return caloEta_; } - /// phi coordinate propagated at the calorimeter surface used for track-cluster matching - float caloPhi() const { return caloPhi_; } - void setCaloEtaPhi(float eta, float phi) { - caloEta_ = eta; - caloPhi_ = phi; - } + /// uncertainty on track pt + float trkPtError() const { return trkPtError_; } + void setTrkPtError(float ptErr) { trkPtError_ = ptErr; } - /// uncertainty on track pt - float trkPtError() const { return trkPtError_; } - void setTrkPtError(float ptErr) { trkPtError_ = ptErr; } + /// uncertainty on calorimetric response for a hadron with pt equal to this track's pt + float caloPtError() const { return caloPtError_; } + void setCaloPtError(float ptErr) { caloPtError_ = ptErr; } - /// uncertainty on calorimetric response for a hadron with pt equal to this track's pt - float caloPtError() const { return caloPtError_; } - void setCaloPtError(float ptErr) { caloPtError_ = ptErr; } + bool isMuon() const override { return isMuon_; } + void setIsMuon(bool isMuon) { isMuon_ = isMuon; } - bool isMuon() const override { return isMuon_; } - void setIsMuon(bool isMuon) { isMuon_ = isMuon; } + int quality() const { return hwQual(); } + void setQuality(int quality) { setHwQual(quality); } - int quality() const { return hwQual(); } - void setQuality(int quality) { setHwQual(quality); } + unsigned int nPar() const { return nPar_; } + unsigned int nStubs() const { return track()->getStubRefs().size(); } + float normalizedChi2() const { return track()->chi2Red(); } + float chi2() const { return track()->chi2(); } - unsigned int nPar() const { return nPar_; } - unsigned int nStubs() const { return track()->getStubRefs().size(); } - float normalizedChi2() const { return track()->chi2Red(); } - float chi2() const { return track()->chi2(); } - - const TTTrack_TrackWord& trackWord() const { return trackWord_; } - TTTrack_TrackWord& trackWord() { return trackWord_; } - - private: - TrackRef trackRef_; - float caloEta_, caloPhi_; - float trkPtError_; - float caloPtError_; - bool isMuon_; - unsigned int nPar_; - TTTrack_TrackWord trackWord_; - }; + const TTTrack_TrackWord& trackWord() const { return trackWord_; } + TTTrack_TrackWord& trackWord() { return trackWord_; } + private: + TrackRef trackRef_; + float caloEta_, caloPhi_; + float trkPtError_; + float caloPtError_; + bool isMuon_; + unsigned int nPar_; + TTTrack_TrackWord trackWord_; + }; + } // namespace io_v1 + using PFTrack = io_v1::PFTrack; typedef std::vector PFTrackCollection; typedef edm::Ref PFTrackRef; typedef edm::RefVector PFTrackRefVector; diff --git a/DataFormats/L1TParticleFlow/interface/PFTrackFwd.h b/DataFormats/L1TParticleFlow/interface/PFTrackFwd.h index 6043dbfafff91..49eb68927e63a 100644 --- a/DataFormats/L1TParticleFlow/interface/PFTrackFwd.h +++ b/DataFormats/L1TParticleFlow/interface/PFTrackFwd.h @@ -2,6 +2,9 @@ #define DataFormats_L1TParticleFlow_PFTrackFwd_h namespace l1t { - class PFTrack; -} + namespace io_v1 { + class PFTrack; + } + using PFTrack = io_v1::PFTrack; +} // namespace l1t #endif diff --git a/DataFormats/L1TParticleFlow/interface/layer1_emulator.h b/DataFormats/L1TParticleFlow/interface/layer1_emulator.h index 8a263a05f63ec..9441836b08946 100644 --- a/DataFormats/L1TParticleFlow/interface/layer1_emulator.h +++ b/DataFormats/L1TParticleFlow/interface/layer1_emulator.h @@ -9,19 +9,23 @@ #include "DataFormats/L1TParticleFlow/interface/egamma.h" #include "DataFormats/L1TParticleFlow/interface/emulator_io.h" #include "DataFormats/L1TParticleFlow/interface/PFTrackFwd.h" +#include "DataFormats/L1Trigger/interface/L1CandidateFwd.h" namespace l1t { - class PFCandidate; - class L1Candidate; - class SAMuon; + namespace io_v1 { + class PFCandidate; + class SAMuon; + } // namespace io_v1 + using PFCandidate = io_v1::PFCandidate; + using SAMuon = io_v1::SAMuon; } // namespace l1t namespace l1ct { struct HadCaloObjEmu : public HadCaloObj { - const l1t::L1Candidate *src = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::L1Candidate* src = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { HadCaloObj::clear(); src = nullptr; @@ -29,9 +33,9 @@ namespace l1ct { }; struct EmCaloObjEmu : public EmCaloObj { - const l1t::L1Candidate *src = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::L1Candidate* src = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { EmCaloObj::clear(); src = nullptr; @@ -41,9 +45,9 @@ namespace l1ct { struct TkObjEmu : public TkObj { uint16_t hwChi2; float simPt, simCaloEta, simCaloPhi, simVtxEta, simVtxPhi, simZ0, simD0; - const l1t::PFTrack *src = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::PFTrack* src = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { TkObj::clear(); src = nullptr; @@ -59,9 +63,9 @@ namespace l1ct { }; struct MuObjEmu : public MuObj { - const l1t::SAMuon *src = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::SAMuon* src = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { MuObj::clear(); src = nullptr; @@ -69,12 +73,12 @@ namespace l1ct { }; struct PFChargedObjEmu : public PFChargedObj { - const l1t::L1Candidate *srcCluster = nullptr; - const l1t::PFTrack *srcTrack = nullptr; - const l1t::SAMuon *srcMu = nullptr; - const l1t::PFCandidate *srcCand = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::L1Candidate* srcCluster = nullptr; + const l1t::PFTrack* srcTrack = nullptr; + const l1t::SAMuon* srcMu = nullptr; + const l1t::PFCandidate* srcCand = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { PFChargedObj::clear(); srcCluster = nullptr; @@ -85,10 +89,10 @@ namespace l1ct { }; struct PFNeutralObjEmu : public PFNeutralObj { - const l1t::L1Candidate *srcCluster = nullptr; - const l1t::PFCandidate *srcCand = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::L1Candidate* srcCluster = nullptr; + const l1t::PFCandidate* srcCand = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { PFNeutralObj::clear(); srcCluster = nullptr; @@ -107,17 +111,17 @@ namespace l1ct { float localEta(float globalEta) const; float localPhi(float globalPhi) const; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; }; struct PuppiObjEmu : public PuppiObj { - const l1t::L1Candidate *srcCluster = nullptr; - const l1t::PFTrack *srcTrack = nullptr; - const l1t::SAMuon *srcMu = nullptr; - const l1t::PFCandidate *srcCand = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::L1Candidate* srcCluster = nullptr; + const l1t::PFTrack* srcTrack = nullptr; + const l1t::SAMuon* srcMu = nullptr; + const l1t::PFCandidate* srcCand = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { PuppiObj::clear(); srcCluster = nullptr; @@ -125,21 +129,21 @@ namespace l1ct { srcMu = nullptr; srcCand = nullptr; } - inline void fill(const PFRegionEmu ®ion, const PFChargedObjEmu &src) { + inline void fill(const PFRegionEmu& region, const PFChargedObjEmu& src) { PuppiObj::fill(region, src); srcCluster = src.srcCluster; srcTrack = src.srcTrack; srcMu = src.srcMu; srcCand = src.srcCand; } - inline void fill(const PFRegionEmu ®ion, const PFNeutralObjEmu &src, pt_t puppiPt, puppiWgt_t puppiWgt) { + inline void fill(const PFRegionEmu& region, const PFNeutralObjEmu& src, pt_t puppiPt, puppiWgt_t puppiWgt) { PuppiObj::fill(region, src, puppiPt, puppiWgt); srcCluster = src.srcCluster; srcTrack = nullptr; srcMu = nullptr; srcCand = src.srcCand; } - inline void fill(const PFRegionEmu ®ion, const HadCaloObjEmu &src, pt_t puppiPt, puppiWgt_t puppiWgt) { + inline void fill(const PFRegionEmu& region, const HadCaloObjEmu& src, pt_t puppiPt, puppiWgt_t puppiWgt) { PuppiObj::fill(region, src, puppiPt, puppiWgt); srcCluster = src.src; srcTrack = nullptr; @@ -149,7 +153,7 @@ namespace l1ct { }; struct EGObjEmu : public EGIsoObj { - const l1t::L1Candidate *srcCluster = nullptr; + const l1t::L1Candidate* srcCluster = nullptr; void clear() { srcCluster = nullptr; EGIsoObj::clear(); @@ -157,13 +161,13 @@ namespace l1ct { }; struct EGIsoObjEmu : public EGIsoObj { - const l1t::L1Candidate *srcCluster; + const l1t::L1Candidate* srcCluster; // NOTE: we use an index to the persistable RefPtr when we reshuffle collections // this way we avoid complex object in the object interface which needs to be used in standalone programs int src_idx; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { EGIsoObj::clear(); srcCluster = nullptr; @@ -193,14 +197,14 @@ namespace l1ct { }; struct EGIsoEleObjEmu : public EGIsoEleObj { - const l1t::L1Candidate *srcCluster = nullptr; - const l1t::PFTrack *srcTrack = nullptr; + const l1t::L1Candidate* srcCluster = nullptr; + const l1t::PFTrack* srcTrack = nullptr; // NOTE: we use an index to the persistable RefPtr when we reshuffle collections // this way we avoid complex object in the object interface which needs to be used in standalone programs int src_idx; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { EGIsoEleObj::clear(); srcCluster = nullptr; @@ -228,8 +232,8 @@ namespace l1ct { }; struct PVObjEmu : public PVObj { - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; }; template @@ -242,8 +246,8 @@ namespace l1ct { // convenience forwarding of some methods typedef typename std::vector::const_iterator const_iterator; typedef typename std::vector::iterator iterator; - inline const T &operator[](unsigned int i) const { return obj[i]; } - inline T &operator[](unsigned int i) { return obj[i]; } + inline const T& operator[](unsigned int i) const { return obj[i]; } + inline T& operator[](unsigned int i) { return obj[i]; } inline const_iterator begin() const { return obj.begin(); } inline iterator begin() { return obj.begin(); } inline const_iterator end() const { return obj.end(); } @@ -261,8 +265,8 @@ namespace l1ct { std::vector>> gctEm; // the 36 EM clusters from the GCT // (The trigger towers that follow the clusters are not included in the above data) - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear(); }; @@ -272,8 +276,8 @@ namespace l1ct { std::vector> track; DetectorSector muon; // muons are global - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear(); }; @@ -287,8 +291,8 @@ namespace l1ct { PFInputRegion() {} PFInputRegion(float etamin, float etamax, float phicenter, float phiwidth, float etaextra, float phiextra) : region(etamin, etamax, phicenter, phiwidth, etaextra, phiextra) {} - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear(); }; @@ -302,8 +306,8 @@ namespace l1ct { std::vector egphoton; std::vector egelectron; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear(); // for multiplicities @@ -321,7 +325,7 @@ namespace l1ct { egisoeleType = 9, nObjTypes = 10 }; - static constexpr const char *objTypeName[nObjTypes] = { + static constexpr const char* objTypeName[nObjTypes] = { "", "Charged", "Neutral", "Electron", "Muon", "ChargedHadron", "NeutralHadron", "Photon", "EGIso", "EGIsoEle"}; unsigned int nObj(ObjType type, bool puppi) const; }; @@ -334,8 +338,8 @@ namespace l1ct { std::vector egphoton; std::vector egelectron; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear(); }; @@ -353,8 +357,8 @@ namespace l1ct { Event() : run(0), lumi(0), event(0) {} - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear(); void init(uint32_t run, uint32_t lumi, uint64_t event); inline l1ct::PVObjEmu pv(unsigned int ipv = 0) const { @@ -374,7 +378,7 @@ namespace l1ct { }; template - void toFirmware(const std::vector &in, unsigned int NMAX, T2 out[/*NMAX*/]) { + void toFirmware(const std::vector& in, unsigned int NMAX, T2 out[/*NMAX*/]) { unsigned int n = std::min(in.size(), NMAX); for (unsigned int i = 0; i < n; ++i) out[i] = in[i]; diff --git a/DataFormats/L1TParticleFlow/src/classes_def.xml b/DataFormats/L1TParticleFlow/src/classes_def.xml index 86bcf76ea0296..c67da0a435acc 100644 --- a/DataFormats/L1TParticleFlow/src/classes_def.xml +++ b/DataFormats/L1TParticleFlow/src/classes_def.xml @@ -1,16 +1,16 @@ - - + + - - - + + + @@ -18,8 +18,8 @@ - - + + @@ -29,17 +29,17 @@ - - + + - + - - + + @@ -48,7 +48,7 @@ - + diff --git a/DataFormats/L1Trigger/interface/EGamma.h b/DataFormats/L1Trigger/interface/EGamma.h index a94949770e485..164bb1a3cf811 100644 --- a/DataFormats/L1Trigger/interface/EGamma.h +++ b/DataFormats/L1Trigger/interface/EGamma.h @@ -7,64 +7,65 @@ namespace l1t { - class EGamma; - typedef BXVector EGammaBxCollection; - typedef edm::Ref EGammaRef; - typedef edm::RefVector EGammaRefVector; - typedef std::vector EGammaVectorRef; - - typedef ObjectRefBxCollection EGammaRefBxCollection; - typedef ObjectRefPair EGammaRefPair; - typedef ObjectRefPairBxCollection EGammaRefPairBxCollection; + namespace io_v1 { + class EGamma : public L1Candidate { + public: + EGamma() { clear_extended(); } - class EGamma : public L1Candidate { - public: - EGamma() { clear_extended(); } + // ctor from base allowed, but note that extended variables will be set to zero: + EGamma(const L1Candidate& rhs) : L1Candidate(rhs) { clear_extended(); } - // ctor from base allowed, but note that extended variables will be set to zero: - EGamma(const L1Candidate& rhs) : L1Candidate(rhs) { clear_extended(); } + EGamma(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); - EGamma(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); + EGamma(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); - EGamma(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); + ~EGamma() override; - ~EGamma() override; + void setTowerIEta(short int ieta); // ieta of seed tower + void setTowerIPhi(short int iphi); // iphi of seed tower + void setRawEt(short int pt); // raw (uncalibrated) cluster sum + void setIsoEt(short int iso); // raw isolation sum - cluster sum + void setFootprintEt(short int fp); // raw footprint + void setNTT(short int ntt); // n towers above threshold + void setShape(short int s); // cluster shape variable + void setTowerHoE(short int HoE); // H/E as computed in Layer-1 - void setTowerIEta(short int ieta); // ieta of seed tower - void setTowerIPhi(short int iphi); // iphi of seed tower - void setRawEt(short int pt); // raw (uncalibrated) cluster sum - void setIsoEt(short int iso); // raw isolation sum - cluster sum - void setFootprintEt(short int fp); // raw footprint - void setNTT(short int ntt); // n towers above threshold - void setShape(short int s); // cluster shape variable - void setTowerHoE(short int HoE); // H/E as computed in Layer-1 + short int towerIEta() const; + short int towerIPhi() const; + short int rawEt() const; + short int isoEt() const; + short int footprintEt() const; + short int nTT() const; + short int shape() const; + short int towerHoE() const; - short int towerIEta() const; - short int towerIPhi() const; - short int rawEt() const; - short int isoEt() const; - short int footprintEt() const; - short int nTT() const; - short int shape() const; - short int towerHoE() const; + bool operator==(const l1t::io_v1::EGamma& rhs) const; + inline bool operator!=(const l1t::io_v1::EGamma& rhs) const { return !(operator==(rhs)); }; - bool operator==(const l1t::EGamma& rhs) const; - inline bool operator!=(const l1t::EGamma& rhs) const { return !(operator==(rhs)); }; + private: + using L1Candidate::operator==; + using L1Candidate::operator!=; + // additional hardware quantities common to L1 global EG + void clear_extended(); + short int towerIEta_; + short int towerIPhi_; + short int rawEt_; + short int isoEt_; + short int footprintEt_; + short int nTT_; + short int shape_; + short int towerHoE_; + }; + } // namespace io_v1 + using EGamma = io_v1::EGamma; + typedef BXVector EGammaBxCollection; + typedef edm::Ref EGammaRef; + typedef edm::RefVector EGammaRefVector; + typedef std::vector EGammaVectorRef; - private: - using L1Candidate::operator==; - using L1Candidate::operator!=; - // additional hardware quantities common to L1 global EG - void clear_extended(); - short int towerIEta_; - short int towerIPhi_; - short int rawEt_; - short int isoEt_; - short int footprintEt_; - short int nTT_; - short int shape_; - short int towerHoE_; - }; + typedef ObjectRefBxCollection EGammaRefBxCollection; + typedef ObjectRefPair EGammaRefPair; + typedef ObjectRefPairBxCollection EGammaRefPairBxCollection; } // namespace l1t diff --git a/DataFormats/L1Trigger/interface/EtSum.h b/DataFormats/L1Trigger/interface/EtSum.h index ed359c85826a7..7eb1a9f329443 100644 --- a/DataFormats/L1Trigger/interface/EtSum.h +++ b/DataFormats/L1Trigger/interface/EtSum.h @@ -7,7 +7,69 @@ namespace l1t { - class EtSum; + namespace io_v1 { + class EtSum : public L1Candidate { + public: + enum EtSumType { + kTotalEt, + kTotalHt, + kMissingEt, + kMissingHt, + kTotalEtx, + kTotalEty, + kTotalHtx, + kTotalHty, + kMissingEtHF, + kTotalEtxHF, + kTotalEtyHF, + kMinBiasHFP0, + kMinBiasHFM0, + kMinBiasHFP1, + kMinBiasHFM1, + kTotalEtHF, + kTotalEtEm, + kTotalHtHF, + kTotalHtxHF, + kTotalHtyHF, + kMissingHtHF, + kTowerCount, + kCentrality, + kAsymEt, + kAsymHt, + kAsymEtHF, + kAsymHtHF, + kZDCP, + kZDCM, + kUninitialized + }; + + EtSum() : type_{kUninitialized} {} + explicit EtSum(EtSumType type) : type_{type} {} + + EtSum(const LorentzVector& p4, EtSumType type, int pt = 0, int eta = 0, int phi = 0, int qual = 0); + + EtSum(const PolarLorentzVector& p4, EtSumType type, int pt = 0, int eta = 0, int phi = 0, int qual = 0); + + ~EtSum() override; + + void setType(EtSumType type); + + EtSumType getType() const; + + bool operator==(const l1t::io_v1::EtSum& rhs) const; + inline bool operator!=(const l1t::io_v1::EtSum& rhs) const { return !(operator==(rhs)); }; + + private: + using L1Candidate::operator==; + using L1Candidate::operator!=; + // type of EtSum + EtSumType type_; + + // additional hardware quantities common to L1 global EtSum + // there are currently none + }; + } // namespace io_v1 + using EtSum = io_v1::EtSum; typedef BXVector EtSumBxCollection; typedef edm::Ref EtSumRef; typedef edm::RefVector EtSumRefVector; @@ -22,67 +84,6 @@ namespace l1t { typedef ObjectRefPair EtSumRefPair; typedef ObjectRefPairBxCollection EtSumRefPairBxCollection; - class EtSum : public L1Candidate { - public: - enum EtSumType { - kTotalEt, - kTotalHt, - kMissingEt, - kMissingHt, - kTotalEtx, - kTotalEty, - kTotalHtx, - kTotalHty, - kMissingEtHF, - kTotalEtxHF, - kTotalEtyHF, - kMinBiasHFP0, - kMinBiasHFM0, - kMinBiasHFP1, - kMinBiasHFM1, - kTotalEtHF, - kTotalEtEm, - kTotalHtHF, - kTotalHtxHF, - kTotalHtyHF, - kMissingHtHF, - kTowerCount, - kCentrality, - kAsymEt, - kAsymHt, - kAsymEtHF, - kAsymHtHF, - kZDCP, - kZDCM, - kUninitialized - }; - - EtSum() : type_{kUninitialized} {} - explicit EtSum(EtSumType type) : type_{type} {} - - EtSum(const LorentzVector& p4, EtSumType type, int pt = 0, int eta = 0, int phi = 0, int qual = 0); - - EtSum(const PolarLorentzVector& p4, EtSumType type, int pt = 0, int eta = 0, int phi = 0, int qual = 0); - - ~EtSum() override; - - void setType(EtSumType type); - - EtSumType getType() const; - - bool operator==(const l1t::EtSum& rhs) const; - inline bool operator!=(const l1t::EtSum& rhs) const { return !(operator==(rhs)); }; - - private: - using L1Candidate::operator==; - using L1Candidate::operator!=; - // type of EtSum - EtSumType type_; - - // additional hardware quantities common to L1 global EtSum - // there are currently none - }; - } // namespace l1t #endif diff --git a/DataFormats/L1Trigger/interface/Jet.h b/DataFormats/L1Trigger/interface/Jet.h index 855f5ea118e0e..aa22ef1588956 100644 --- a/DataFormats/L1Trigger/interface/Jet.h +++ b/DataFormats/L1Trigger/interface/Jet.h @@ -6,8 +6,47 @@ #include "DataFormats/L1Trigger/interface/L1TObjComparison.h" namespace l1t { - - class Jet; + namespace io_v1 { + class Jet : public L1Candidate { + public: + Jet() { clear_extended(); } + Jet(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0); + Jet(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0); + + ~Jet() override; + + void setTowerIEta(short int ieta); // ieta of seed tower + void setTowerIPhi(short int iphi); // iphi of seed tower + void setRawEt(short int et); // raw (uncalibrated) cluster sum + void setSeedEt(short int et); + void setPUEt(short int et); + void setPUDonutEt(unsigned int i, short int et); + + short int towerIEta() const; + short int towerIPhi() const; + short int rawEt() const; + short int seedEt() const; + short int puEt() const; + short int puDonutEt(int i) const; + + bool operator==(const l1t::io_v1::Jet& rhs) const; + inline bool operator!=(const l1t::io_v1::Jet& rhs) const { return !(operator==(rhs)); }; + + private: + using L1Candidate::operator==; + using L1Candidate::operator!=; + // additional hardware quantities common to L1 global jet + void clear_extended(); + short int towerIEta_; + short int towerIPhi_; + short int rawEt_; + short int seedEt_; + short int puEt_; + short int puDonutEt_[4]; + }; + + } // namespace io_v1 + using Jet = io_v1::Jet; typedef BXVector JetBxCollection; typedef edm::Ref JetRef; typedef edm::RefVector JetRefVector; @@ -17,44 +56,6 @@ namespace l1t { typedef ObjectRefPair JetRefPair; typedef ObjectRefPairBxCollection JetRefPairBxCollection; - class Jet : public L1Candidate { - public: - Jet() { clear_extended(); } - Jet(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0); - Jet(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0); - - ~Jet() override; - - void setTowerIEta(short int ieta); // ieta of seed tower - void setTowerIPhi(short int iphi); // iphi of seed tower - void setRawEt(short int et); // raw (uncalibrated) cluster sum - void setSeedEt(short int et); - void setPUEt(short int et); - void setPUDonutEt(unsigned int i, short int et); - - short int towerIEta() const; - short int towerIPhi() const; - short int rawEt() const; - short int seedEt() const; - short int puEt() const; - short int puDonutEt(int i) const; - - bool operator==(const l1t::Jet& rhs) const; - inline bool operator!=(const l1t::Jet& rhs) const { return !(operator==(rhs)); }; - - private: - using L1Candidate::operator==; - using L1Candidate::operator!=; - // additional hardware quantities common to L1 global jet - void clear_extended(); - short int towerIEta_; - short int towerIPhi_; - short int rawEt_; - short int seedEt_; - short int puEt_; - short int puDonutEt_[4]; - }; - } // namespace l1t #endif diff --git a/DataFormats/L1Trigger/interface/L1Candidate.h b/DataFormats/L1Trigger/interface/L1Candidate.h index 27aeb4688f830..fdb98890742bb 100644 --- a/DataFormats/L1Trigger/interface/L1Candidate.h +++ b/DataFormats/L1Trigger/interface/L1Candidate.h @@ -5,51 +5,51 @@ #include "DataFormats/L1Trigger/interface/BXVector.h" namespace l1t { - class L1Candidate; + namespace io_v1 { + // All L1 data formats which encode physically meaningful quantities inherit from Candidate + class L1Candidate : public reco::LeafCandidate { + public: + L1Candidate(); + + // construct from *both* physical and integer values + L1Candidate(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); + + L1Candidate(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); + + ~L1Candidate() override; + + // methods to set integer values + // in general, these should not be needed + void setHwPt(int pt) { hwPt_ = pt; } + void setHwEta(int eta) { hwEta_ = eta; } + void setHwPhi(int phi) { hwPhi_ = phi; } + void setHwQual(int qual) { hwQual_ = qual; } + void setHwIso(int iso) { hwIso_ = iso; } + + // methods to retrieve integer values + int hwPt() const { return hwPt_; } + int hwEta() const { return hwEta_; } + int hwPhi() const { return hwPhi_; } + int hwQual() const { return hwQual_; } + int hwIso() const { return hwIso_; } + + virtual bool operator==(const l1t::io_v1::L1Candidate& rhs) const; + virtual inline bool operator!=(const l1t::io_v1::L1Candidate& rhs) const { return !(operator==(rhs)); }; + + private: + // integer "hardware" values + int hwPt_; + int hwEta_; + int hwPhi_; + int hwQual_; + int hwIso_; + }; + } // namespace io_v1 + using L1Candidate = io_v1::L1Candidate; typedef BXVector L1CandidateBxCollection; typedef edm::Ref L1CandidateRef; typedef edm::RefVector L1CandidateRefVector; typedef std::vector L1CandidateVectorRef; - - // All L1 data formats which encode physically meaningful quantities inherit from Candidate - class L1Candidate : public reco::LeafCandidate { - public: - L1Candidate(); - - // construct from *both* physical and integer values - L1Candidate(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); - - L1Candidate(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); - - ~L1Candidate() override; - - // methods to set integer values - // in general, these should not be needed - void setHwPt(int pt) { hwPt_ = pt; } - void setHwEta(int eta) { hwEta_ = eta; } - void setHwPhi(int phi) { hwPhi_ = phi; } - void setHwQual(int qual) { hwQual_ = qual; } - void setHwIso(int iso) { hwIso_ = iso; } - - // methods to retrieve integer values - int hwPt() const { return hwPt_; } - int hwEta() const { return hwEta_; } - int hwPhi() const { return hwPhi_; } - int hwQual() const { return hwQual_; } - int hwIso() const { return hwIso_; } - - virtual bool operator==(const l1t::L1Candidate& rhs) const; - virtual inline bool operator!=(const l1t::L1Candidate& rhs) const { return !(operator==(rhs)); }; - - private: - // integer "hardware" values - int hwPt_; - int hwEta_; - int hwPhi_; - int hwQual_; - int hwIso_; - }; - }; // namespace l1t #endif diff --git a/DataFormats/L1Trigger/interface/L1CandidateFwd.h b/DataFormats/L1Trigger/interface/L1CandidateFwd.h new file mode 100644 index 0000000000000..d060cad54c367 --- /dev/null +++ b/DataFormats/L1Trigger/interface/L1CandidateFwd.h @@ -0,0 +1,10 @@ +#ifndef DataFormats_L1Trigger_L1CandidateFwd_h +#define DataFormats_L1Trigger_L1CandidateFwd_h + +namespace l1t { + namespace io_v1 { + class L1Candidate; + } + using L1Candidate = io_v1::L1Candidate; +} // namespace l1t +#endif diff --git a/DataFormats/L1Trigger/interface/Muon.h b/DataFormats/L1Trigger/interface/Muon.h index 148325be95648..a5e52cfc22432 100644 --- a/DataFormats/L1Trigger/interface/Muon.h +++ b/DataFormats/L1Trigger/interface/Muon.h @@ -7,8 +7,135 @@ #include "DataFormats/L1Trigger/interface/L1TObjComparison.h" namespace l1t { - - class Muon; + namespace io_v1 { + class Muon : public L1Candidate { + public: + Muon(); + + Muon(const LorentzVector& p4, + int pt = 0, + int eta = 0, + int phi = 0, + int qual = 0, + int charge = 0, + int chargeValid = 0, + int iso = 0, + int tfMuonIndex = -1, + int tag = 0, + bool debug = false, + int isoSum = 0, + int dPhi = 0, + int dEta = 0, + int rank = 0, + int hwEtaAtVtx = 0, + int hwPhiAtVtx = 0, + double etaAtVtx = 0., + double phiAtVtx = 0., + int hwPtUnconstrained = 0, + double ptUnconstrained = 0., + int dXY = 0); + + Muon(const PolarLorentzVector& p4, + int pt = 0, + int eta = 0, + int phi = 0, + int qual = 0, + int charge = 0, + int chargeValid = 0, + int iso = 0, + int tfMuonIndex = -1, + int tag = 0, + bool debug = false, + int isoSum = 0, + int dPhi = 0, + int dEta = 0, + int rank = 0, + int hwEtaAtVtx = 0, + int hwPhiAtVtx = 0, + double etaAtVtx = 0., + double phiAtVtx = 0., + int hwPtUnconstrained = 0, + double ptUnconstrained = 0., + int dXY = 0); + + ~Muon() override; + + // set values + inline void setHwCharge(int charge) { hwCharge_ = charge; }; + inline void setHwChargeValid(int valid) { hwChargeValid_ = valid; }; + inline void setTfMuonIndex(int index) { tfMuonIndex_ = index; }; + inline void setHwTag(int tag) { hwTag_ = tag; }; + + inline void setHwEtaAtVtx(int hwEtaAtVtx) { hwEtaAtVtx_ = hwEtaAtVtx; }; + inline void setHwPhiAtVtx(int hwPhiAtVtx) { hwPhiAtVtx_ = hwPhiAtVtx; }; + inline void setEtaAtVtx(double etaAtVtx) { etaAtVtx_ = etaAtVtx; }; + inline void setPhiAtVtx(double phiAtVtx) { phiAtVtx_ = phiAtVtx; }; + + inline void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; }; + inline void setHwDPhiExtra(int dPhi) { hwDPhiExtra_ = dPhi; }; + inline void setHwDEtaExtra(int dEta) { hwDEtaExtra_ = dEta; }; + inline void setHwRank(int rank) { hwRank_ = rank; }; + + inline void setHwPtUnconstrained(int hwPtUnconstrained) { hwPtUnconstrained_ = hwPtUnconstrained; }; + inline void setPtUnconstrained(double ptUnconstrained) { ptUnconstrained_ = ptUnconstrained; }; + inline void setHwDXY(int hwDXY) { hwDXY_ = hwDXY; }; + + inline void setDebug(bool debug) { debug_ = debug; }; + + // methods to retrieve values + inline int hwCharge() const { return hwCharge_; }; + inline int hwChargeValid() const { return hwChargeValid_; }; + inline int tfMuonIndex() const { return tfMuonIndex_; }; + inline int hwTag() const { return hwTag_; }; + + inline int hwEtaAtVtx() const { return hwEtaAtVtx_; }; + inline int hwPhiAtVtx() const { return hwPhiAtVtx_; }; + inline double etaAtVtx() const { return etaAtVtx_; }; + inline double phiAtVtx() const { return phiAtVtx_; }; + + inline int hwIsoSum() const { return hwIsoSum_; }; + inline int hwDPhiExtra() const { return hwDPhiExtra_; }; + inline int hwDEtaExtra() const { return hwDEtaExtra_; }; + inline int hwRank() const { return hwRank_; }; + + inline int hwPtUnconstrained() const { return hwPtUnconstrained_; }; + inline double ptUnconstrained() const { return ptUnconstrained_; }; + inline int hwDXY() const { return hwDXY_; }; + + inline bool debug() const { return debug_; }; + + bool operator==(const l1t::io_v1::Muon& rhs) const; + inline bool operator!=(const l1t::io_v1::Muon& rhs) const { return !(operator==(rhs)); }; + + private: + using L1Candidate::operator==; + using L1Candidate::operator!=; + // additional hardware quantities common to L1 global jet + int hwCharge_; + int hwChargeValid_; + int tfMuonIndex_; + int hwTag_; + + // additional hardware quantities only available if debug flag is set + bool debug_; + int hwIsoSum_; + int hwDPhiExtra_; + int hwDEtaExtra_; + int hwRank_; + + // muon coordinates at the vertex + int hwEtaAtVtx_; + int hwPhiAtVtx_; + double etaAtVtx_; + double phiAtVtx_; + + // displacement information + int hwPtUnconstrained_; + double ptUnconstrained_; + int hwDXY_; + }; + } // namespace io_v1 + using Muon = io_v1::Muon; typedef BXVector MuonBxCollection; typedef edm::Ref MuonRef; typedef edm::RefVector MuonRefVector; @@ -18,133 +145,6 @@ namespace l1t { typedef ObjectRefPair MuonRefPair; typedef ObjectRefPairBxCollection MuonRefPairBxCollection; - class Muon : public L1Candidate { - public: - Muon(); - - Muon(const LorentzVector& p4, - int pt = 0, - int eta = 0, - int phi = 0, - int qual = 0, - int charge = 0, - int chargeValid = 0, - int iso = 0, - int tfMuonIndex = -1, - int tag = 0, - bool debug = false, - int isoSum = 0, - int dPhi = 0, - int dEta = 0, - int rank = 0, - int hwEtaAtVtx = 0, - int hwPhiAtVtx = 0, - double etaAtVtx = 0., - double phiAtVtx = 0., - int hwPtUnconstrained = 0, - double ptUnconstrained = 0., - int dXY = 0); - - Muon(const PolarLorentzVector& p4, - int pt = 0, - int eta = 0, - int phi = 0, - int qual = 0, - int charge = 0, - int chargeValid = 0, - int iso = 0, - int tfMuonIndex = -1, - int tag = 0, - bool debug = false, - int isoSum = 0, - int dPhi = 0, - int dEta = 0, - int rank = 0, - int hwEtaAtVtx = 0, - int hwPhiAtVtx = 0, - double etaAtVtx = 0., - double phiAtVtx = 0., - int hwPtUnconstrained = 0, - double ptUnconstrained = 0., - int dXY = 0); - - ~Muon() override; - - // set values - inline void setHwCharge(int charge) { hwCharge_ = charge; }; - inline void setHwChargeValid(int valid) { hwChargeValid_ = valid; }; - inline void setTfMuonIndex(int index) { tfMuonIndex_ = index; }; - inline void setHwTag(int tag) { hwTag_ = tag; }; - - inline void setHwEtaAtVtx(int hwEtaAtVtx) { hwEtaAtVtx_ = hwEtaAtVtx; }; - inline void setHwPhiAtVtx(int hwPhiAtVtx) { hwPhiAtVtx_ = hwPhiAtVtx; }; - inline void setEtaAtVtx(double etaAtVtx) { etaAtVtx_ = etaAtVtx; }; - inline void setPhiAtVtx(double phiAtVtx) { phiAtVtx_ = phiAtVtx; }; - - inline void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; }; - inline void setHwDPhiExtra(int dPhi) { hwDPhiExtra_ = dPhi; }; - inline void setHwDEtaExtra(int dEta) { hwDEtaExtra_ = dEta; }; - inline void setHwRank(int rank) { hwRank_ = rank; }; - - inline void setHwPtUnconstrained(int hwPtUnconstrained) { hwPtUnconstrained_ = hwPtUnconstrained; }; - inline void setPtUnconstrained(double ptUnconstrained) { ptUnconstrained_ = ptUnconstrained; }; - inline void setHwDXY(int hwDXY) { hwDXY_ = hwDXY; }; - - inline void setDebug(bool debug) { debug_ = debug; }; - - // methods to retrieve values - inline int hwCharge() const { return hwCharge_; }; - inline int hwChargeValid() const { return hwChargeValid_; }; - inline int tfMuonIndex() const { return tfMuonIndex_; }; - inline int hwTag() const { return hwTag_; }; - - inline int hwEtaAtVtx() const { return hwEtaAtVtx_; }; - inline int hwPhiAtVtx() const { return hwPhiAtVtx_; }; - inline double etaAtVtx() const { return etaAtVtx_; }; - inline double phiAtVtx() const { return phiAtVtx_; }; - - inline int hwIsoSum() const { return hwIsoSum_; }; - inline int hwDPhiExtra() const { return hwDPhiExtra_; }; - inline int hwDEtaExtra() const { return hwDEtaExtra_; }; - inline int hwRank() const { return hwRank_; }; - - inline int hwPtUnconstrained() const { return hwPtUnconstrained_; }; - inline double ptUnconstrained() const { return ptUnconstrained_; }; - inline int hwDXY() const { return hwDXY_; }; - - inline bool debug() const { return debug_; }; - - bool operator==(const l1t::Muon& rhs) const; - inline bool operator!=(const l1t::Muon& rhs) const { return !(operator==(rhs)); }; - - private: - using L1Candidate::operator==; - using L1Candidate::operator!=; - // additional hardware quantities common to L1 global jet - int hwCharge_; - int hwChargeValid_; - int tfMuonIndex_; - int hwTag_; - - // additional hardware quantities only available if debug flag is set - bool debug_; - int hwIsoSum_; - int hwDPhiExtra_; - int hwDEtaExtra_; - int hwRank_; - - // muon coordinates at the vertex - int hwEtaAtVtx_; - int hwPhiAtVtx_; - double etaAtVtx_; - double phiAtVtx_; - - // displacement information - int hwPtUnconstrained_; - double ptUnconstrained_; - int hwDXY_; - }; - } // namespace l1t #endif diff --git a/DataFormats/L1Trigger/interface/MuonShower.h b/DataFormats/L1Trigger/interface/MuonShower.h index cb3fd7a7c6b09..2541ec1f960e9 100644 --- a/DataFormats/L1Trigger/interface/MuonShower.h +++ b/DataFormats/L1Trigger/interface/MuonShower.h @@ -14,30 +14,20 @@ #include "DataFormats/L1Trigger/interface/L1TObjComparison.h" namespace l1t { - - class MuonShower; - typedef BXVector MuonShowerBxCollection; - typedef edm::Ref MuonShowerRef; - typedef edm::RefVector MuonShowerRefVector; - typedef std::vector MuonShowerVectorRef; - - typedef ObjectRefBxCollection MuonShowerRefBxCollection; - typedef ObjectRefPair MuonShowerRefPair; - typedef ObjectRefPairBxCollection MuonShowerRefPairBxCollection; - - class MuonShower : public L1Candidate { - public: - MuonShower(bool oneNominalInTime = false, - bool oneNominalOutOfTime = false, - bool twoLooseInTime = false, - bool twoLooseOutOfTime = false, - bool oneTightInTime = false, - bool oneTightOutOfTime = false, - bool twoLooseDiffSectorsIntime = false); - - ~MuonShower() override; - - /* + namespace io_v1 { + class MuonShower : public L1Candidate { + public: + MuonShower(bool oneNominalInTime = false, + bool oneNominalOutOfTime = false, + bool twoLooseInTime = false, + bool twoLooseOutOfTime = false, + bool oneTightInTime = false, + bool oneTightOutOfTime = false, + bool twoLooseDiffSectorsIntime = false); + + ~MuonShower() override; + + /* * We currently have three valid cases: * - 1 nominal shower (baseline trigger for physics at Run-3) * - 1 tight shower (backup trigger) @@ -57,42 +47,52 @@ namespace l1t { * - 2 loose showers in differnt sectors -> mus2 */ - void setOneNominalInTime(const bool bit) { oneNominalInTime_ = bit; } - void setOneTightInTime(const bool bit) { oneTightInTime_ = bit; } - void setTwoLooseDiffSectorsInTime(const bool bit) { twoLooseDiffSectorsInTime_ = bit; } - void setMusOutOfTime0(const bool bit) { musOutOfTime0_ = bit; } - void setMusOutOfTime1(const bool bit) { musOutOfTime1_ = bit; } - - bool isOneNominalInTime() const { return oneNominalInTime_; } - bool isOneTightInTime() const { return oneTightInTime_; } - bool isTwoLooseDiffSectorsInTime() const { return twoLooseDiffSectorsInTime_; } - bool musOutOfTime0() const { return musOutOfTime0_; } - bool musOutOfTime1() const { return musOutOfTime1_; } - - // at least one bit must be valid - bool isValid() const; - - // to be developed during Run-3 - bool isTwoLooseInTime() const { return false; } - // these options require more study - bool isOneNominalOutOfTime() const { return false; } - bool isTwoLooseOutOfTime() const { return false; } - bool isOneTightOutOfTime() const { return false; } - - bool operator==(const l1t::MuonShower& rhs) const; - inline bool operator!=(const l1t::MuonShower& rhs) const { return !(operator==(rhs)); }; + void setOneNominalInTime(const bool bit) { oneNominalInTime_ = bit; } + void setOneTightInTime(const bool bit) { oneTightInTime_ = bit; } + void setTwoLooseDiffSectorsInTime(const bool bit) { twoLooseDiffSectorsInTime_ = bit; } + void setMusOutOfTime0(const bool bit) { musOutOfTime0_ = bit; } + void setMusOutOfTime1(const bool bit) { musOutOfTime1_ = bit; } + + bool isOneNominalInTime() const { return oneNominalInTime_; } + bool isOneTightInTime() const { return oneTightInTime_; } + bool isTwoLooseDiffSectorsInTime() const { return twoLooseDiffSectorsInTime_; } + bool musOutOfTime0() const { return musOutOfTime0_; } + bool musOutOfTime1() const { return musOutOfTime1_; } + + // at least one bit must be valid + bool isValid() const; + + // to be developed during Run-3 + bool isTwoLooseInTime() const { return false; } + // these options require more study + bool isOneNominalOutOfTime() const { return false; } + bool isTwoLooseOutOfTime() const { return false; } + bool isOneTightOutOfTime() const { return false; } + + bool operator==(const l1t::io_v1::MuonShower& rhs) const; + inline bool operator!=(const l1t::io_v1::MuonShower& rhs) const { return !(operator==(rhs)); }; + + private: + using L1Candidate::operator==; + using L1Candidate::operator!=; + // Run-3 definitions as provided in DN-20-033 + // in time and out-of-time qualities. only 2 bits each. + bool oneNominalInTime_; + bool oneTightInTime_; + bool twoLooseDiffSectorsInTime_; + bool musOutOfTime0_; + bool musOutOfTime1_; + }; + } // namespace io_v1 + using MuonShower = io_v1::MuonShower; + typedef BXVector MuonShowerBxCollection; + typedef edm::Ref MuonShowerRef; + typedef edm::RefVector MuonShowerRefVector; + typedef std::vector MuonShowerVectorRef; - private: - using L1Candidate::operator==; - using L1Candidate::operator!=; - // Run-3 definitions as provided in DN-20-033 - // in time and out-of-time qualities. only 2 bits each. - bool oneNominalInTime_; - bool oneTightInTime_; - bool twoLooseDiffSectorsInTime_; - bool musOutOfTime0_; - bool musOutOfTime1_; - }; + typedef ObjectRefBxCollection MuonShowerRefBxCollection; + typedef ObjectRefPair MuonShowerRefPair; + typedef ObjectRefPairBxCollection MuonShowerRefPairBxCollection; } // namespace l1t diff --git a/DataFormats/L1Trigger/interface/P2GTAlgoBlock.h b/DataFormats/L1Trigger/interface/P2GTAlgoBlock.h index 87c73fee53320..504f05723a20b 100644 --- a/DataFormats/L1Trigger/interface/P2GTAlgoBlock.h +++ b/DataFormats/L1Trigger/interface/P2GTAlgoBlock.h @@ -7,54 +7,54 @@ #include namespace l1t { - - class P2GTAlgoBlock; + namespace io_v1 { + class P2GTAlgoBlock { + public: + P2GTAlgoBlock() + : decisionBeforeBxMaskAndPrescale_(false), + decisionBeforePrescale_(false), + decisionFinal_(false), + decisionFinalPreview_(false), + isVeto_(false), + triggerTypes_(0), + trigObjects_() {} + + P2GTAlgoBlock(bool decisionBeforeBxMaskAndPrescale, + bool decisionBeforePrescale, + bool decisionFinal, + bool decisionFinalPreview, + bool isVeto, + int triggerTypes, + P2GTCandidateVectorRef trigObjects) + : decisionBeforeBxMaskAndPrescale_(decisionBeforeBxMaskAndPrescale), + decisionBeforePrescale_(decisionBeforePrescale), + decisionFinal_(decisionFinal), + decisionFinalPreview_(decisionFinalPreview), + isVeto_(isVeto), + triggerTypes_(triggerTypes), + trigObjects_(std::move(trigObjects)) {} + + bool decisionBeforeBxMaskAndPrescale() const { return decisionBeforeBxMaskAndPrescale_; } + bool decisionBeforePrescale() const { return decisionBeforePrescale_; } + bool decisionFinal() const { return decisionFinal_; } + bool decisionFinalPreview() const { return decisionFinalPreview_; } + bool isVeto() const { return isVeto_; } + int triggerTypes() const { return triggerTypes_; } + const P2GTCandidateVectorRef& trigObjects() const { return trigObjects_; } + + private: + const bool decisionBeforeBxMaskAndPrescale_; + const bool decisionBeforePrescale_; + const bool decisionFinal_; + const bool decisionFinalPreview_; + const bool isVeto_; + const int triggerTypes_; + const P2GTCandidateVectorRef trigObjects_; + }; + } // namespace io_v1 + using P2GTAlgoBlock = io_v1::P2GTAlgoBlock; typedef std::map P2GTAlgoBlockMap; - class P2GTAlgoBlock { - public: - P2GTAlgoBlock() - : decisionBeforeBxMaskAndPrescale_(false), - decisionBeforePrescale_(false), - decisionFinal_(false), - decisionFinalPreview_(false), - isVeto_(false), - triggerTypes_(0), - trigObjects_() {} - - P2GTAlgoBlock(bool decisionBeforeBxMaskAndPrescale, - bool decisionBeforePrescale, - bool decisionFinal, - bool decisionFinalPreview, - bool isVeto, - int triggerTypes, - P2GTCandidateVectorRef trigObjects) - : decisionBeforeBxMaskAndPrescale_(decisionBeforeBxMaskAndPrescale), - decisionBeforePrescale_(decisionBeforePrescale), - decisionFinal_(decisionFinal), - decisionFinalPreview_(decisionFinalPreview), - isVeto_(isVeto), - triggerTypes_(triggerTypes), - trigObjects_(std::move(trigObjects)) {} - - bool decisionBeforeBxMaskAndPrescale() const { return decisionBeforeBxMaskAndPrescale_; } - bool decisionBeforePrescale() const { return decisionBeforePrescale_; } - bool decisionFinal() const { return decisionFinal_; } - bool decisionFinalPreview() const { return decisionFinalPreview_; } - bool isVeto() const { return isVeto_; } - int triggerTypes() const { return triggerTypes_; } - const P2GTCandidateVectorRef& trigObjects() const { return trigObjects_; } - - private: - const bool decisionBeforeBxMaskAndPrescale_; - const bool decisionBeforePrescale_; - const bool decisionFinal_; - const bool decisionFinalPreview_; - const bool isVeto_; - const int triggerTypes_; - const P2GTCandidateVectorRef trigObjects_; - }; - } // namespace l1t #endif // DataFormats_L1Trigger_P2GTAlgoBlock_h diff --git a/DataFormats/L1Trigger/interface/P2GTCandidate.h b/DataFormats/L1Trigger/interface/P2GTCandidate.h index a9c9e15420f33..bb5c1fdcc8514 100644 --- a/DataFormats/L1Trigger/interface/P2GTCandidate.h +++ b/DataFormats/L1Trigger/interface/P2GTCandidate.h @@ -13,345 +13,346 @@ namespace l1t { class L1GTProducer; - class P2GTCandidate; - typedef std::vector P2GTCandidateCollection; - typedef edm::Ref P2GTCandidateRef; - typedef edm::RefVector P2GTCandidateRefVector; - typedef std::vector P2GTCandidateVectorRef; + namespace io_v1 { + class P2GTCandidate : public reco::LeafCandidate { + public: + using Base = reco::LeafCandidate; + + using Base::Base; + + friend class l1t::L1GTProducer; + + typedef ap_uint<16> hwPT_t; + typedef ap_int<13> hwPhi_t; + typedef ap_int<14> hwEta_t; + typedef ap_int<18> hwZ0_t; + typedef ap_uint<11> hwIsolationPT_t; + typedef ap_uint<6> hwQualityFlags_t; + typedef ap_uint<10> hwQualityScore_t; + typedef ap_uint<1> hwCharge_t; + typedef ap_int<12> hwD0_t; + typedef ap_uint<4> hwBeta_t; + typedef ap_uint<10> hwMass_t; + typedef ap_uint<16> hwIndex_t; + typedef ap_uint<10> hwSeed_pT_t; + typedef ap_int<10> hwSeed_z0_t; + typedef ap_uint<16> hwScalarSumPT_t; + typedef ap_uint<5> hwNumber_of_tracks_t; + typedef ap_uint<4> hwNumber_of_displaced_tracks_t; + typedef ap_uint<12> hwSum_pT_pv_t; + typedef ap_uint<2> hwType_t; + typedef ap_uint<8> hwNumber_of_tracks_in_pv_t; + typedef ap_uint<10> hwNumber_of_tracks_not_in_pv_t; + + // Similar to std::optional but avoids inheritance for ROOT file embedding + template + struct Optional { + Optional() : value_(0), set_(false) {} + Optional(T value) : value_(value), set_(true) {} + + operator T() const { return value_; } + operator bool() const { return set_; } + + bool operator==(bool rhs) const { return set_ == rhs; } + bool operator!=(bool rhs) const { return set_ != rhs; } + + private: + T value_; + bool set_; + }; + + enum ObjectType { + Undefined, + GCTNonIsoEg, + GCTIsoEg, + GCTJets, + GCTTaus, + GCTHtSum, + GCTEtSum, + GMTSaPromptMuons, + GMTSaDisplacedMuons, + GMTTkMuons, + GMTTopo, + GTTPromptJets, + GTTDisplacedJets, + GTTPhiCandidates, + GTTRhoCandidates, + GTTBsCandidates, + GTTHadronicTaus, + GTTPromptTracks, + GTTDisplacedTracks, + GTTPrimaryVert, + GTTPromptHtSum, + GTTDisplacedHtSum, + GTTEtSum, + CL2JetsSC4, + CL2JetsSC8, + CL2Taus, + CL2Electrons, + CL2Photons, + CL2HtSum, + CL2EtSum + }; + + void setHwPT(hwPT_t hwPT) { hwPT_ = hwPT.to_int(); } + void setHwPhi(hwPhi_t hwPhi) { hwPhi_ = hwPhi.to_int(); } + void setHwEta(hwEta_t hwEta) { hwEta_ = hwEta.to_int(); } + void setHwZ0(hwZ0_t hwZ0) { hwZ0_ = hwZ0.to_int(); } + void setHwIsolationPT(hwIsolationPT_t hwIso) { hwIsolationPT_ = hwIso.to_int(); } + void setHwQualityFlags(hwQualityFlags_t hwQualityFlags) { hwQualityFlags_ = hwQualityFlags.to_int(); } + void setHwQualityScore(hwQualityScore_t hwQualityScore) { hwQualityScore_ = hwQualityScore.to_int(); } + void setHwCharge(hwCharge_t hwCharge) { hwCharge_ = hwCharge.to_int(); } + void setHwD0(hwD0_t hwD0) { hwD0_ = hwD0.to_int(); } + void setHwBeta(hwBeta_t hwBeta) { hwBeta_ = hwBeta.to_int(); } + void setHwMass(hwMass_t hwMass) { hwMass_ = hwMass.to_int(); } + void setHwIndex(hwIndex_t hwIndex) { hwIndex_ = hwIndex.to_int(); } + void setHwSeed_pT(hwSeed_pT_t hwSeed_pT) { hwSeed_pT_ = hwSeed_pT.to_int(); } + void setHwSeed_z0(hwSeed_z0_t hwSeed_z0) { hwSeed_z0_ = hwSeed_z0.to_int(); } + void setHwScalarSumPT(hwScalarSumPT_t hwScalarSumPT) { hwScalarSumPT_ = hwScalarSumPT.to_int(); } + void setHwNumber_of_tracks(hwNumber_of_tracks_t hwNumber_of_tracks) { + hwNumber_of_tracks_ = hwNumber_of_tracks.to_int(); + } - class P2GTCandidate : public reco::LeafCandidate { - public: - using Base = reco::LeafCandidate; - - using Base::Base; - - friend class L1GTProducer; - - typedef ap_uint<16> hwPT_t; - typedef ap_int<13> hwPhi_t; - typedef ap_int<14> hwEta_t; - typedef ap_int<18> hwZ0_t; - typedef ap_uint<11> hwIsolationPT_t; - typedef ap_uint<6> hwQualityFlags_t; - typedef ap_uint<10> hwQualityScore_t; - typedef ap_uint<1> hwCharge_t; - typedef ap_int<12> hwD0_t; - typedef ap_uint<4> hwBeta_t; - typedef ap_uint<10> hwMass_t; - typedef ap_uint<16> hwIndex_t; - typedef ap_uint<10> hwSeed_pT_t; - typedef ap_int<10> hwSeed_z0_t; - typedef ap_uint<16> hwScalarSumPT_t; - typedef ap_uint<5> hwNumber_of_tracks_t; - typedef ap_uint<4> hwNumber_of_displaced_tracks_t; - typedef ap_uint<12> hwSum_pT_pv_t; - typedef ap_uint<2> hwType_t; - typedef ap_uint<8> hwNumber_of_tracks_in_pv_t; - typedef ap_uint<10> hwNumber_of_tracks_not_in_pv_t; - - // Similar to std::optional but avoids inheritance for ROOT file embedding - template - struct Optional { - Optional() : value_(0), set_(false) {} - Optional(T value) : value_(value), set_(true) {} - - operator T() const { return value_; } - operator bool() const { return set_; } - - bool operator==(bool rhs) const { return set_ == rhs; } - bool operator!=(bool rhs) const { return set_ != rhs; } + void setHwNumber_of_displaced_tracks(hwNumber_of_displaced_tracks_t hwNumber_of_displaced_tracks) { + hwNumber_of_displaced_tracks_ = hwNumber_of_displaced_tracks.to_int(); + } - private: - T value_; - bool set_; - }; + void setHwSum_pT_pv(hwSum_pT_pv_t hwSum_pT_pv) { hwSum_pT_pv_ = hwSum_pT_pv.to_int(); } + void setHwType(hwType_t hwType) { hwType_ = hwType.to_int(); } + void setHwNumber_of_tracks_in_pv(hwNumber_of_tracks_in_pv_t hwNumber_of_tracks_in_pv) { + hwNumber_of_tracks_in_pv_ = hwNumber_of_tracks_in_pv.to_int(); + } + void setHwNumber_of_tracks_not_in_pv(hwNumber_of_tracks_not_in_pv_t hwNumber_of_tracks_not_in_pv) { + hwNumber_of_tracks_not_in_pv_ = hwNumber_of_tracks_not_in_pv.to_int(); + } - enum ObjectType { - Undefined, - GCTNonIsoEg, - GCTIsoEg, - GCTJets, - GCTTaus, - GCTHtSum, - GCTEtSum, - GMTSaPromptMuons, - GMTSaDisplacedMuons, - GMTTkMuons, - GMTTopo, - GTTPromptJets, - GTTDisplacedJets, - GTTPhiCandidates, - GTTRhoCandidates, - GTTBsCandidates, - GTTHadronicTaus, - GTTPromptTracks, - GTTDisplacedTracks, - GTTPrimaryVert, - GTTPromptHtSum, - GTTDisplacedHtSum, - GTTEtSum, - CL2JetsSC4, - CL2JetsSC8, - CL2Taus, - CL2Electrons, - CL2Photons, - CL2HtSum, - CL2EtSum - }; + hwPT_t hwPT() const { + if (!hwPT_) { + throw std::invalid_argument("Object doesn't have pT"); + } + return static_cast(hwPT_); + } - void setHwPT(hwPT_t hwPT) { hwPT_ = hwPT.to_int(); } - void setHwPhi(hwPhi_t hwPhi) { hwPhi_ = hwPhi.to_int(); } - void setHwEta(hwEta_t hwEta) { hwEta_ = hwEta.to_int(); } - void setHwZ0(hwZ0_t hwZ0) { hwZ0_ = hwZ0.to_int(); } - void setHwIsolationPT(hwIsolationPT_t hwIso) { hwIsolationPT_ = hwIso.to_int(); } - void setHwQualityFlags(hwQualityFlags_t hwQualityFlags) { hwQualityFlags_ = hwQualityFlags.to_int(); } - void setHwQualityScore(hwQualityScore_t hwQualityScore) { hwQualityScore_ = hwQualityScore.to_int(); } - void setHwCharge(hwCharge_t hwCharge) { hwCharge_ = hwCharge.to_int(); } - void setHwD0(hwD0_t hwD0) { hwD0_ = hwD0.to_int(); } - void setHwBeta(hwBeta_t hwBeta) { hwBeta_ = hwBeta.to_int(); } - void setHwMass(hwMass_t hwMass) { hwMass_ = hwMass.to_int(); } - void setHwIndex(hwIndex_t hwIndex) { hwIndex_ = hwIndex.to_int(); } - void setHwSeed_pT(hwSeed_pT_t hwSeed_pT) { hwSeed_pT_ = hwSeed_pT.to_int(); } - void setHwSeed_z0(hwSeed_z0_t hwSeed_z0) { hwSeed_z0_ = hwSeed_z0.to_int(); } - void setHwScalarSumPT(hwScalarSumPT_t hwScalarSumPT) { hwScalarSumPT_ = hwScalarSumPT.to_int(); } - void setHwNumber_of_tracks(hwNumber_of_tracks_t hwNumber_of_tracks) { - hwNumber_of_tracks_ = hwNumber_of_tracks.to_int(); - } - - void setHwNumber_of_displaced_tracks(hwNumber_of_displaced_tracks_t hwNumber_of_displaced_tracks) { - hwNumber_of_displaced_tracks_ = hwNumber_of_displaced_tracks.to_int(); - } - - void setHwSum_pT_pv(hwSum_pT_pv_t hwSum_pT_pv) { hwSum_pT_pv_ = hwSum_pT_pv.to_int(); } - void setHwType(hwType_t hwType) { hwType_ = hwType.to_int(); } - void setHwNumber_of_tracks_in_pv(hwNumber_of_tracks_in_pv_t hwNumber_of_tracks_in_pv) { - hwNumber_of_tracks_in_pv_ = hwNumber_of_tracks_in_pv.to_int(); - } - void setHwNumber_of_tracks_not_in_pv(hwNumber_of_tracks_not_in_pv_t hwNumber_of_tracks_not_in_pv) { - hwNumber_of_tracks_not_in_pv_ = hwNumber_of_tracks_not_in_pv.to_int(); - } - - hwPT_t hwPT() const { - if (!hwPT_) { - throw std::invalid_argument("Object doesn't have pT"); + hwPhi_t hwPhi() const { + if (!hwPhi_) { + throw std::invalid_argument("Object doesn't have phi"); + } + return static_cast(hwPhi_); } - return static_cast(hwPT_); - } - hwPhi_t hwPhi() const { - if (!hwPhi_) { - throw std::invalid_argument("Object doesn't have phi"); + hwEta_t hwEta() const { + if (!hwEta_) { + throw std::invalid_argument("Object doesn't have eta"); + } + return static_cast(hwEta_); } - return static_cast(hwPhi_); - } - hwEta_t hwEta() const { - if (!hwEta_) { - throw std::invalid_argument("Object doesn't have eta"); + hwZ0_t hwZ0() const { + if (!hwZ0_) { + throw std::invalid_argument("Object doesn't have z0"); + } + return static_cast(hwZ0_); } - return static_cast(hwEta_); - } - hwZ0_t hwZ0() const { - if (!hwZ0_) { - throw std::invalid_argument("Object doesn't have z0"); + hwIsolationPT_t hwIsolationPT() const { + if (!hwIsolationPT_) { + throw std::invalid_argument("Object doesn't have isolationPT"); + } + return static_cast(hwIsolationPT_); } - return static_cast(hwZ0_); - } - hwIsolationPT_t hwIsolationPT() const { - if (!hwIsolationPT_) { - throw std::invalid_argument("Object doesn't have isolationPT"); + hwQualityFlags_t hwQualityFlags() const { + if (!hwQualityFlags_) { + throw std::invalid_argument("Object doesn't have qualityFlags"); + } + return static_cast(hwQualityFlags_); } - return static_cast(hwIsolationPT_); - } - hwQualityFlags_t hwQualityFlags() const { - if (!hwQualityFlags_) { - throw std::invalid_argument("Object doesn't have qualityFlags"); + hwQualityScore_t hwQualityScore() const { + if (!hwQualityScore_) { + throw std::invalid_argument("Object doesn't have qualityScore"); + } + return static_cast(hwQualityScore_); } - return static_cast(hwQualityFlags_); - } - hwQualityScore_t hwQualityScore() const { - if (!hwQualityScore_) { - throw std::invalid_argument("Object doesn't have qualityScore"); + hwCharge_t hwCharge() const { + if (!hwCharge_) { + throw std::invalid_argument("Object doesn't have charge"); + } + return static_cast(hwCharge_); } - return static_cast(hwQualityScore_); - } - hwCharge_t hwCharge() const { - if (!hwCharge_) { - throw std::invalid_argument("Object doesn't have charge"); + hwD0_t hwD0() const { + if (!hwD0_) { + throw std::invalid_argument("Object doesn't have d0"); + } + return static_cast(hwD0_); } - return static_cast(hwCharge_); - } - hwD0_t hwD0() const { - if (!hwD0_) { - throw std::invalid_argument("Object doesn't have d0"); + hwBeta_t hwBeta() const { + if (!hwBeta_) { + throw std::invalid_argument("Object doesn't have beta"); + } + return static_cast(hwBeta_); } - return static_cast(hwD0_); - } - hwBeta_t hwBeta() const { - if (!hwBeta_) { - throw std::invalid_argument("Object doesn't have beta"); + hwMass_t hwMass() const { + if (!hwMass_) { + throw std::invalid_argument("Object doesn't have mass"); + } + return static_cast(hwMass_); } - return static_cast(hwBeta_); - } - hwMass_t hwMass() const { - if (!hwMass_) { - throw std::invalid_argument("Object doesn't have mass"); + hwIndex_t hwIndex() const { + if (!hwIndex_) { + throw std::invalid_argument("Object doesn't have index"); + } + return static_cast(hwIndex_); } - return static_cast(hwMass_); - } - hwIndex_t hwIndex() const { - if (!hwIndex_) { - throw std::invalid_argument("Object doesn't have index"); + hwSeed_pT_t hwSeed_pT() const { + if (!hwSeed_pT_) { + throw std::invalid_argument("Object doesn't have seed_pT"); + } + return static_cast(hwSeed_pT_); } - return static_cast(hwIndex_); - } - hwSeed_pT_t hwSeed_pT() const { - if (!hwSeed_pT_) { - throw std::invalid_argument("Object doesn't have seed_pT"); + hwSeed_z0_t hwSeed_z0() const { + if (!hwSeed_z0_) { + throw std::invalid_argument("Object doesn't have seed_z0"); + } + return static_cast(hwSeed_z0_); } - return static_cast(hwSeed_pT_); - } - hwSeed_z0_t hwSeed_z0() const { - if (!hwSeed_z0_) { - throw std::invalid_argument("Object doesn't have seed_z0"); + hwScalarSumPT_t hwScalarSumPT() const { + if (!hwScalarSumPT_) { + throw std::invalid_argument("Object doesn't have scalarSumPT"); + } + return static_cast(hwScalarSumPT_); } - return static_cast(hwSeed_z0_); - } - hwScalarSumPT_t hwScalarSumPT() const { - if (!hwScalarSumPT_) { - throw std::invalid_argument("Object doesn't have scalarSumPT"); + hwNumber_of_tracks_t hwNumber_of_tracks() const { + if (!hwNumber_of_tracks_) { + throw std::invalid_argument("Object doesn't have number_of_tracks"); + } + return static_cast(hwNumber_of_tracks_); } - return static_cast(hwScalarSumPT_); - } - hwNumber_of_tracks_t hwNumber_of_tracks() const { - if (!hwNumber_of_tracks_) { - throw std::invalid_argument("Object doesn't have number_of_tracks"); + hwNumber_of_displaced_tracks_t hwNumber_of_displaced_tracks() const { + if (!hwNumber_of_displaced_tracks_) { + throw std::invalid_argument("Object doesn't have hwNumber_of_displaced_tracks"); + } + return static_cast(hwNumber_of_displaced_tracks_); } - return static_cast(hwNumber_of_tracks_); - } - hwNumber_of_displaced_tracks_t hwNumber_of_displaced_tracks() const { - if (!hwNumber_of_displaced_tracks_) { - throw std::invalid_argument("Object doesn't have hwNumber_of_displaced_tracks"); + hwSum_pT_pv_t hwSum_pT_pv() const { + if (!hwSum_pT_pv_) { + throw std::invalid_argument("Object doesn't have sum_pT_pv"); + } + return static_cast(hwSum_pT_pv_); } - return static_cast(hwNumber_of_displaced_tracks_); - } - hwSum_pT_pv_t hwSum_pT_pv() const { - if (!hwSum_pT_pv_) { - throw std::invalid_argument("Object doesn't have sum_pT_pv"); + hwType_t hwType() const { + if (!hwType_) { + throw std::invalid_argument("Object doesn't have type"); + } + return static_cast(hwType_); } - return static_cast(hwSum_pT_pv_); - } - hwType_t hwType() const { - if (!hwType_) { - throw std::invalid_argument("Object doesn't have type"); + hwNumber_of_tracks_in_pv_t hwNumber_of_tracks_in_pv() const { + if (!hwNumber_of_tracks_in_pv_) { + throw std::invalid_argument("Object doesn't have number_of_tracks_in_pv"); + } + return static_cast(hwNumber_of_tracks_in_pv_); } - return static_cast(hwType_); - } - hwNumber_of_tracks_in_pv_t hwNumber_of_tracks_in_pv() const { - if (!hwNumber_of_tracks_in_pv_) { - throw std::invalid_argument("Object doesn't have number_of_tracks_in_pv"); + hwNumber_of_tracks_not_in_pv_t hwNumber_of_tracks_not_in_pv() const { + if (!hwNumber_of_tracks_not_in_pv_) { + throw std::invalid_argument("Object doesn't have hwNumber_of_tracks_not_in_pv"); + } + return static_cast(hwNumber_of_tracks_not_in_pv_); } - return static_cast(hwNumber_of_tracks_in_pv_); - } - hwNumber_of_tracks_not_in_pv_t hwNumber_of_tracks_not_in_pv() const { - if (!hwNumber_of_tracks_not_in_pv_) { - throw std::invalid_argument("Object doesn't have hwNumber_of_tracks_not_in_pv"); + ObjectType objectType() const { return objectType_; } + + // Nano SimpleCandidateFlatTableProducer accessor functions + int hwPT_toInt() const { return hwPT().to_int(); } + int hwPhi_toInt() const { return hwPhi().to_int(); } + int hwEta_toInt() const { return hwEta().to_int(); } + int hwZ0_toInt() const { return hwZ0().to_int(); } + int hwIsolationPT_toInt() const { return hwIsolationPT().to_int(); } + int hwQualityFlags_toInt() const { return hwQualityFlags().to_int(); } + int hwQualityScore_toInt() const { return hwQualityScore().to_int(); } + int hwCharge_toInt() const { return hwCharge().to_int(); } + int hwD0_toInt() const { return hwD0().to_int(); } + int hwBeta_toInt() const { return hwBeta().to_int(); } + int hwMass_toInt() const { return hwMass().to_int(); } + int hwIndex_toInt() const { return hwIndex().to_int(); } + int hwSeed_pT_toInt() const { return hwSeed_pT().to_int(); } + int hwSeed_z0_toInt() const { return hwSeed_z0().to_int(); } + int hwScalarSumPT_toInt() const { return hwScalarSumPT().to_int(); } + int hwNumber_of_tracks_toInt() const { return hwNumber_of_tracks().to_int(); } + int hwNumber_of_displaced_tracks_toInt() const { return hwNumber_of_displaced_tracks().to_int(); } + int hwSum_pT_pv_toInt() const { return hwSum_pT_pv().to_int(); } + int hwType_toInt() const { return hwType().to_int(); } + int hwNumber_of_tracks_in_pv_toInt() const { return hwNumber_of_tracks_in_pv().to_int(); } + int hwNumber_of_tracks_not_in_pv_toInt() const { return hwNumber_of_tracks_not_in_pv().to_int(); } + + bool operator==(const P2GTCandidate& rhs) const; + bool operator!=(const P2GTCandidate& rhs) const; + + bool isElectron() const override { return objectType_ == CL2Electrons; }; + + bool isMuon() const override { + return objectType_ == GMTSaPromptMuons || objectType_ == GMTSaDisplacedMuons || objectType_ == GMTTkMuons; + }; + + bool isStandAloneMuon() const override { + return objectType_ == GMTSaPromptMuons || objectType_ == GMTSaDisplacedMuons; + }; + + bool isTrackerMuon() const override { return objectType_ == GMTTkMuons; } + + bool isPhoton() const override { return objectType_ == CL2Photons; } + + bool isJet() const override { + return objectType_ == GCTJets || objectType_ == GTTPromptJets || objectType_ == GTTDisplacedJets || + objectType_ == CL2JetsSC4 || objectType_ == CL2JetsSC8; } - return static_cast(hwNumber_of_tracks_not_in_pv_); - } - - ObjectType objectType() const { return objectType_; } - - // Nano SimpleCandidateFlatTableProducer accessor functions - int hwPT_toInt() const { return hwPT().to_int(); } - int hwPhi_toInt() const { return hwPhi().to_int(); } - int hwEta_toInt() const { return hwEta().to_int(); } - int hwZ0_toInt() const { return hwZ0().to_int(); } - int hwIsolationPT_toInt() const { return hwIsolationPT().to_int(); } - int hwQualityFlags_toInt() const { return hwQualityFlags().to_int(); } - int hwQualityScore_toInt() const { return hwQualityScore().to_int(); } - int hwCharge_toInt() const { return hwCharge().to_int(); } - int hwD0_toInt() const { return hwD0().to_int(); } - int hwBeta_toInt() const { return hwBeta().to_int(); } - int hwMass_toInt() const { return hwMass().to_int(); } - int hwIndex_toInt() const { return hwIndex().to_int(); } - int hwSeed_pT_toInt() const { return hwSeed_pT().to_int(); } - int hwSeed_z0_toInt() const { return hwSeed_z0().to_int(); } - int hwScalarSumPT_toInt() const { return hwScalarSumPT().to_int(); } - int hwNumber_of_tracks_toInt() const { return hwNumber_of_tracks().to_int(); } - int hwNumber_of_displaced_tracks_toInt() const { return hwNumber_of_displaced_tracks().to_int(); } - int hwSum_pT_pv_toInt() const { return hwSum_pT_pv().to_int(); } - int hwType_toInt() const { return hwType().to_int(); } - int hwNumber_of_tracks_in_pv_toInt() const { return hwNumber_of_tracks_in_pv().to_int(); } - int hwNumber_of_tracks_not_in_pv_toInt() const { return hwNumber_of_tracks_not_in_pv().to_int(); } - - bool operator==(const P2GTCandidate& rhs) const; - bool operator!=(const P2GTCandidate& rhs) const; - - bool isElectron() const override { return objectType_ == CL2Electrons; }; - - bool isMuon() const override { - return objectType_ == GMTSaPromptMuons || objectType_ == GMTSaDisplacedMuons || objectType_ == GMTTkMuons; - }; - bool isStandAloneMuon() const override { - return objectType_ == GMTSaPromptMuons || objectType_ == GMTSaDisplacedMuons; + private: + Optional hwPT_; + Optional hwPhi_; + Optional hwEta_; + Optional hwZ0_; + Optional hwIsolationPT_; + Optional hwQualityFlags_; + Optional hwQualityScore_; + Optional hwCharge_; + Optional hwD0_; + Optional hwBeta_; + Optional hwMass_; + Optional hwIndex_; + Optional hwSeed_pT_; + Optional hwSeed_z0_; + Optional hwScalarSumPT_; + Optional hwNumber_of_tracks_; + Optional hwNumber_of_displaced_tracks_; + + // TODO ? + Optional hwSum_pT_pv_; + Optional hwType_; + Optional hwNumber_of_tracks_in_pv_; + Optional hwNumber_of_tracks_not_in_pv_; + + ObjectType objectType_ = Undefined; }; - - bool isTrackerMuon() const override { return objectType_ == GMTTkMuons; } - - bool isPhoton() const override { return objectType_ == CL2Photons; } - - bool isJet() const override { - return objectType_ == GCTJets || objectType_ == GTTPromptJets || objectType_ == GTTDisplacedJets || - objectType_ == CL2JetsSC4 || objectType_ == CL2JetsSC8; - } - - private: - Optional hwPT_; - Optional hwPhi_; - Optional hwEta_; - Optional hwZ0_; - Optional hwIsolationPT_; - Optional hwQualityFlags_; - Optional hwQualityScore_; - Optional hwCharge_; - Optional hwD0_; - Optional hwBeta_; - Optional hwMass_; - Optional hwIndex_; - Optional hwSeed_pT_; - Optional hwSeed_z0_; - Optional hwScalarSumPT_; - Optional hwNumber_of_tracks_; - Optional hwNumber_of_displaced_tracks_; - - // TODO ? - Optional hwSum_pT_pv_; - Optional hwType_; - Optional hwNumber_of_tracks_in_pv_; - Optional hwNumber_of_tracks_not_in_pv_; - - ObjectType objectType_ = Undefined; - }; + } // namespace io_v1 + using P2GTCandidate = io_v1::P2GTCandidate; + typedef std::vector P2GTCandidateCollection; + typedef edm::Ref P2GTCandidateRef; + typedef edm::RefVector P2GTCandidateRefVector; + typedef std::vector P2GTCandidateVectorRef; }; // namespace l1t diff --git a/DataFormats/L1Trigger/interface/Tau.h b/DataFormats/L1Trigger/interface/Tau.h index 0f87895de4ae4..333c99fdc3674 100644 --- a/DataFormats/L1Trigger/interface/Tau.h +++ b/DataFormats/L1Trigger/interface/Tau.h @@ -6,8 +6,53 @@ #include "DataFormats/L1Trigger/interface/L1TObjComparison.h" namespace l1t { + namespace io_v1 { + class Tau : public L1Candidate { + public: + Tau() { clear_extended(); } - class Tau; + // ctor from base allowed, but note that extended variables will be set to zero: + Tau(const L1Candidate& rhs) : L1Candidate(rhs) { clear_extended(); } + + Tau(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); + Tau(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); + + ~Tau() override; + + void setTowerIEta(short int ieta); // ieta of seed tower + void setTowerIPhi(short int iphi); // iphi of seed tower + void setRawEt(short int et); // raw (uncalibrated) cluster sum + void setIsoEt(short int et); // raw isolation sum - cluster sum + void setNTT(short int ntt); // n towers above threshold + void setHasEM(bool hasEM); + void setIsMerged(bool isMerged); + + short int towerIEta() const; + short int towerIPhi() const; + short int rawEt() const; + short int isoEt() const; + short int nTT() const; + bool hasEM() const; + bool isMerged() const; + + bool operator==(const l1t::io_v1::Tau& rhs) const; + inline bool operator!=(const l1t::io_v1::Tau& rhs) const { return !(operator==(rhs)); }; + + private: + using L1Candidate::operator==; + using L1Candidate::operator!=; + // additional hardware quantities common to L1 global tau + void clear_extended(); + short int towerIEta_; + short int towerIPhi_; + short int rawEt_; + short int isoEt_; + short int nTT_; + bool hasEM_; + bool isMerged_; + }; + } // namespace io_v1 + using Tau = io_v1::Tau; typedef BXVector TauBxCollection; typedef edm::Ref TauRef; typedef edm::RefVector TauRefVector; @@ -16,52 +61,6 @@ namespace l1t { typedef ObjectRefBxCollection TauRefBxCollection; typedef ObjectRefPair TauRefPair; typedef ObjectRefPairBxCollection TauRefPairBxCollection; - - class Tau : public L1Candidate { - public: - Tau() { clear_extended(); } - - // ctor from base allowed, but note that extended variables will be set to zero: - Tau(const L1Candidate& rhs) : L1Candidate(rhs) { clear_extended(); } - - Tau(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); - Tau(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); - - ~Tau() override; - - void setTowerIEta(short int ieta); // ieta of seed tower - void setTowerIPhi(short int iphi); // iphi of seed tower - void setRawEt(short int et); // raw (uncalibrated) cluster sum - void setIsoEt(short int et); // raw isolation sum - cluster sum - void setNTT(short int ntt); // n towers above threshold - void setHasEM(bool hasEM); - void setIsMerged(bool isMerged); - - short int towerIEta() const; - short int towerIPhi() const; - short int rawEt() const; - short int isoEt() const; - short int nTT() const; - bool hasEM() const; - bool isMerged() const; - - bool operator==(const l1t::Tau& rhs) const; - inline bool operator!=(const l1t::Tau& rhs) const { return !(operator==(rhs)); }; - - private: - using L1Candidate::operator==; - using L1Candidate::operator!=; - // additional hardware quantities common to L1 global tau - void clear_extended(); - short int towerIEta_; - short int towerIPhi_; - short int rawEt_; - short int isoEt_; - short int nTT_; - bool hasEM_; - bool isMerged_; - }; - } // namespace l1t #endif diff --git a/DataFormats/L1Trigger/interface/TkJetWord.h b/DataFormats/L1Trigger/interface/TkJetWord.h index 25a6f87528071..5a908dcc88e19 100644 --- a/DataFormats/L1Trigger/interface/TkJetWord.h +++ b/DataFormats/L1Trigger/interface/TkJetWord.h @@ -15,179 +15,180 @@ #include "DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h" namespace l1t { + namespace io_v1 { + class TkJetWord { + public: + // ----------constants, enums and typedefs --------- + static constexpr double MAX_Z0 = 30.; + static constexpr double MAX_ETA = 8.; + + enum TkJetBitWidths { + kPtSize = 16, + kPtMagSize = 11, + kGlbEtaSize = 14, + kGlbPhiSize = 13, + kZ0Size = 10, + kNtSize = 5, + kXtSize = 4, + kDispFlagSize = 1, + kUnassignedSize = 65, + kTkJetWordSize = + kPtSize + kGlbEtaSize + kGlbPhiSize + kZ0Size + kNtSize + kXtSize + kDispFlagSize + kUnassignedSize, + }; + + enum TkJetBitLocations { + kPtLSB = 0, + kPtMSB = kPtLSB + TkJetBitWidths::kPtSize - 1, + kGlbPhiLSB = kPtMSB + 1, + kGlbPhiMSB = kGlbPhiLSB + TkJetBitWidths::kGlbPhiSize - 1, + kGlbEtaLSB = kGlbPhiMSB + 1, + kGlbEtaMSB = kGlbEtaLSB + TkJetBitWidths::kGlbEtaSize - 1, + kZ0LSB = kGlbEtaMSB + 1, + kZ0MSB = kZ0LSB + TkJetBitWidths::kZ0Size - 1, + kNtLSB = kZ0MSB + 1, + kNtMSB = kNtLSB + TkJetBitWidths::kNtSize - 1, + kXtLSB = kNtMSB + 1, + kXtMSB = kXtLSB + TkJetBitWidths::kXtSize - 1, + kDispFlagLSB = kXtMSB + 1, + kDispFlagMSB = kDispFlagLSB + TkJetBitWidths::kDispFlagSize - 1, + kUnassignedLSB = kDispFlagMSB + 1, + kUnassignedMSB = kUnassignedLSB + TkJetBitWidths::kUnassignedSize - 1, + }; + + typedef ap_ufixed pt_t; + typedef ap_int glbeta_t; + typedef ap_int glbphi_t; + typedef ap_int z0_t; // 40cm / 0.1 + typedef ap_uint nt_t; //number of tracks + typedef ap_uint nx_t; //number of tracks with xbit = 1 + typedef ap_uint dispflag_t; + typedef ap_uint tkjetunassigned_t; // Unassigned bits + typedef std::bitset tkjetword_bs_t; + typedef ap_uint tkjetword_t; + + public: + // ----------Constructors -------------------------- + TkJetWord() {} + TkJetWord(pt_t pt, + glbeta_t eta, + glbphi_t phi, + z0_t z0, + nt_t nt, + nx_t nx, + dispflag_t dispflag, + tkjetunassigned_t unassigned); + + ~TkJetWord() {} + + // ----------copy constructor ---------------------- + TkJetWord(const TkJetWord& word) { tkJetWord_ = word.tkJetWord_; } + + // ----------operators ----------------------------- + TkJetWord& operator=(const TkJetWord& word) { + tkJetWord_ = word.tkJetWord_; + return *this; + } - class TkJetWord { - public: - // ----------constants, enums and typedefs --------- - static constexpr double MAX_Z0 = 30.; - static constexpr double MAX_ETA = 8.; - - enum TkJetBitWidths { - kPtSize = 16, - kPtMagSize = 11, - kGlbEtaSize = 14, - kGlbPhiSize = 13, - kZ0Size = 10, - kNtSize = 5, - kXtSize = 4, - kDispFlagSize = 1, - kUnassignedSize = 65, - kTkJetWordSize = - kPtSize + kGlbEtaSize + kGlbPhiSize + kZ0Size + kNtSize + kXtSize + kDispFlagSize + kUnassignedSize, - }; - - enum TkJetBitLocations { - kPtLSB = 0, - kPtMSB = kPtLSB + TkJetBitWidths::kPtSize - 1, - kGlbPhiLSB = kPtMSB + 1, - kGlbPhiMSB = kGlbPhiLSB + TkJetBitWidths::kGlbPhiSize - 1, - kGlbEtaLSB = kGlbPhiMSB + 1, - kGlbEtaMSB = kGlbEtaLSB + TkJetBitWidths::kGlbEtaSize - 1, - kZ0LSB = kGlbEtaMSB + 1, - kZ0MSB = kZ0LSB + TkJetBitWidths::kZ0Size - 1, - kNtLSB = kZ0MSB + 1, - kNtMSB = kNtLSB + TkJetBitWidths::kNtSize - 1, - kXtLSB = kNtMSB + 1, - kXtMSB = kXtLSB + TkJetBitWidths::kXtSize - 1, - kDispFlagLSB = kXtMSB + 1, - kDispFlagMSB = kDispFlagLSB + TkJetBitWidths::kDispFlagSize - 1, - kUnassignedLSB = kDispFlagMSB + 1, - kUnassignedMSB = kUnassignedLSB + TkJetBitWidths::kUnassignedSize - 1, - }; - - typedef ap_ufixed pt_t; - typedef ap_int glbeta_t; - typedef ap_int glbphi_t; - typedef ap_int z0_t; // 40cm / 0.1 - typedef ap_uint nt_t; //number of tracks - typedef ap_uint nx_t; //number of tracks with xbit = 1 - typedef ap_uint dispflag_t; - typedef ap_uint tkjetunassigned_t; // Unassigned bits - typedef std::bitset tkjetword_bs_t; - typedef ap_uint tkjetword_t; - - public: - // ----------Constructors -------------------------- - TkJetWord() {} - TkJetWord(pt_t pt, - glbeta_t eta, - glbphi_t phi, - z0_t z0, - nt_t nt, - nx_t nx, - dispflag_t dispflag, - tkjetunassigned_t unassigned); - - ~TkJetWord() {} - - // ----------copy constructor ---------------------- - TkJetWord(const TkJetWord& word) { tkJetWord_ = word.tkJetWord_; } - - // ----------operators ----------------------------- - TkJetWord& operator=(const TkJetWord& word) { - tkJetWord_ = word.tkJetWord_; - return *this; - } - - // ----------member functions (getters) ------------ - // These functions return arbitarary precision words (lists of bits) for each quantity - pt_t ptWord() const { - pt_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kPtMSB, TkJetBitLocations::kPtLSB); - return ret; - } - glbeta_t glbEtaWord() const { - glbeta_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kGlbEtaMSB, TkJetBitLocations::kGlbEtaLSB); - return ret; - } - glbphi_t glbPhiWord() const { - glbphi_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kGlbPhiMSB, TkJetBitLocations::kGlbPhiLSB); - return ret; - } - z0_t z0Word() const { - z0_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kZ0MSB, TkJetBitLocations::kZ0LSB); - return ret; - } - nt_t ntWord() const { - nt_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kNtMSB, TkJetBitLocations::kNtLSB); - return ret; - } - nx_t xtWord() const { - nx_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kXtMSB, TkJetBitLocations::kXtLSB); - return ret; - } - dispflag_t dispFlagWord() const { - dispflag_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kDispFlagMSB, TkJetBitLocations::kDispFlagLSB); - return ret; - } - - tkjetunassigned_t unassignedWord() const { - return tkJetWord()(TkJetBitLocations::kUnassignedMSB, TkJetBitLocations::kUnassignedLSB); - } - tkjetword_t tkJetWord() const { return tkjetword_t(tkJetWord_.to_string().c_str(), 2); } - - // These functions return the packed bits in integer format for each quantity - // Signed quantities have the sign enconded in the left-most bit. - unsigned int ptBits() const { return ptWord().range().to_uint(); } - unsigned int glbEtaBits() const { return glbEtaWord().to_uint(); } - unsigned int glbPhiBits() const { return glbPhiWord().to_uint(); } - unsigned int z0Bits() const { return z0Word().range().to_uint(); } - unsigned int ntBits() const { return ntWord().to_uint(); } - unsigned int xtBits() const { return xtWord().to_uint(); } - unsigned int dispFlagBits() const { return dispFlagWord().to_uint(); } - unsigned int unassignedBits() const { return unassignedWord().to_uint(); } - - // These functions return the unpacked and converted values - // These functions return real numbers converted from the digitized quantities by unpacking the 64-bit vertex word - float pt() const { return ptWord().to_float(); } - float glbeta() const { - return unpackSignedValue( - glbEtaWord(), TkJetBitWidths::kGlbEtaSize, (MAX_ETA) / (1 << TkJetBitWidths::kGlbEtaSize)); - } - float glbphi() const { - return unpackSignedValue( - glbPhiWord(), TkJetBitWidths::kGlbPhiSize, (2. * std::abs(M_PI)) / (1 << TkJetBitWidths::kGlbPhiSize)); - } - float z0() const { - return unpackSignedValue(z0Word(), TkJetBitWidths::kZ0Size, MAX_Z0 / (1 << TkJetBitWidths::kZ0Size)); - } - int nt() const { return (ap_ufixed(ntWord())).to_int(); } - int xt() const { return (ap_ufixed(xtWord())).to_int(); } - int dispflag() const { return (ap_ufixed(dispFlagWord())).to_int(); } - unsigned int unassigned() const { return unassignedWord().to_uint(); } - - // ----------member functions (setters) ------------ - void setTkJetWord(pt_t pt, - glbeta_t eta, - glbphi_t phi, - z0_t z0, - nt_t nt, - nx_t nx, - dispflag_t dispflag, - tkjetunassigned_t unassigned); - - private: - // ----------private member functions -------------- - double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const { - int isign = 1; - unsigned int digitized_maximum = (1 << nBits) - 1; - if (bits & (1 << (nBits - 1))) { // check the sign - isign = -1; - bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + // ----------member functions (getters) ------------ + // These functions return arbitarary precision words (lists of bits) for each quantity + pt_t ptWord() const { + pt_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kPtMSB, TkJetBitLocations::kPtLSB); + return ret; + } + glbeta_t glbEtaWord() const { + glbeta_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kGlbEtaMSB, TkJetBitLocations::kGlbEtaLSB); + return ret; + } + glbphi_t glbPhiWord() const { + glbphi_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kGlbPhiMSB, TkJetBitLocations::kGlbPhiLSB); + return ret; + } + z0_t z0Word() const { + z0_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kZ0MSB, TkJetBitLocations::kZ0LSB); + return ret; + } + nt_t ntWord() const { + nt_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kNtMSB, TkJetBitLocations::kNtLSB); + return ret; + } + nx_t xtWord() const { + nx_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kXtMSB, TkJetBitLocations::kXtLSB); + return ret; + } + dispflag_t dispFlagWord() const { + dispflag_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kDispFlagMSB, TkJetBitLocations::kDispFlagLSB); + return ret; } - return (double(bits & digitized_maximum) + 0.5) * lsb * isign; - } - // ----------member data --------------------------- - tkjetword_bs_t tkJetWord_; - }; + tkjetunassigned_t unassignedWord() const { + return tkJetWord()(TkJetBitLocations::kUnassignedMSB, TkJetBitLocations::kUnassignedLSB); + } + tkjetword_t tkJetWord() const { return tkjetword_t(tkJetWord_.to_string().c_str(), 2); } + + // These functions return the packed bits in integer format for each quantity + // Signed quantities have the sign enconded in the left-most bit. + unsigned int ptBits() const { return ptWord().range().to_uint(); } + unsigned int glbEtaBits() const { return glbEtaWord().to_uint(); } + unsigned int glbPhiBits() const { return glbPhiWord().to_uint(); } + unsigned int z0Bits() const { return z0Word().range().to_uint(); } + unsigned int ntBits() const { return ntWord().to_uint(); } + unsigned int xtBits() const { return xtWord().to_uint(); } + unsigned int dispFlagBits() const { return dispFlagWord().to_uint(); } + unsigned int unassignedBits() const { return unassignedWord().to_uint(); } + + // These functions return the unpacked and converted values + // These functions return real numbers converted from the digitized quantities by unpacking the 64-bit vertex word + float pt() const { return ptWord().to_float(); } + float glbeta() const { + return unpackSignedValue( + glbEtaWord(), TkJetBitWidths::kGlbEtaSize, (MAX_ETA) / (1 << TkJetBitWidths::kGlbEtaSize)); + } + float glbphi() const { + return unpackSignedValue( + glbPhiWord(), TkJetBitWidths::kGlbPhiSize, (2. * std::abs(M_PI)) / (1 << TkJetBitWidths::kGlbPhiSize)); + } + float z0() const { + return unpackSignedValue(z0Word(), TkJetBitWidths::kZ0Size, MAX_Z0 / (1 << TkJetBitWidths::kZ0Size)); + } + int nt() const { return (ap_ufixed(ntWord())).to_int(); } + int xt() const { return (ap_ufixed(xtWord())).to_int(); } + int dispflag() const { return (ap_ufixed(dispFlagWord())).to_int(); } + unsigned int unassigned() const { return unassignedWord().to_uint(); } + + // ----------member functions (setters) ------------ + void setTkJetWord(pt_t pt, + glbeta_t eta, + glbphi_t phi, + z0_t z0, + nt_t nt, + nx_t nx, + dispflag_t dispflag, + tkjetunassigned_t unassigned); + + private: + // ----------private member functions -------------- + double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const { + int isign = 1; + unsigned int digitized_maximum = (1 << nBits) - 1; + if (bits & (1 << (nBits - 1))) { // check the sign + isign = -1; + bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + } + return (double(bits & digitized_maximum) + 0.5) * lsb * isign; + } + // ----------member data --------------------------- + tkjetword_bs_t tkJetWord_; + }; + } // namespace io_v1 + using TkJetWord = io_v1::TkJetWord; typedef std::vector TkJetWordCollection; } // namespace l1t diff --git a/DataFormats/L1Trigger/interface/TkTripletWord.h b/DataFormats/L1Trigger/interface/TkTripletWord.h index 42afd72cacceb..69f8aecb7894f 100644 --- a/DataFormats/L1Trigger/interface/TkTripletWord.h +++ b/DataFormats/L1Trigger/interface/TkTripletWord.h @@ -13,246 +13,247 @@ #include "DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h" namespace l1t { + namespace io_v1 { + class TkTripletWord { + public: + // ----------constants, enums and typedefs --------- + static constexpr double MAX_MASS = 1000.; + static constexpr double MAX_ETA = 8.; + static constexpr double MAX_CHARGE = 3.; + static constexpr double MAX_Z0 = 25.; - class TkTripletWord { - public: - // ----------constants, enums and typedefs --------- - static constexpr double MAX_MASS = 1000.; - static constexpr double MAX_ETA = 8.; - static constexpr double MAX_CHARGE = 3.; - static constexpr double MAX_Z0 = 25.; + 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 + kPtMagSize = 11, + kGlbEtaSize = 14, // Width of the triplet eta + kGlbPhiSize = 13, // Width of the triplet phi + kMassSize = 16, // Width of the triplet mass + kChargeSize = 3, // Width of the triplet charge + kDiTrackMinMassSize = 16, // Width of the mass of min mass pair + kDiTrackMaxMassSize = 16, // Width of the mass of max mass pair + 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, + }; - 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 - kPtMagSize = 11, - kGlbEtaSize = 14, // Width of the triplet eta - kGlbPhiSize = 13, // Width of the triplet phi - kMassSize = 16, // Width of the triplet mass - kChargeSize = 3, // Width of the triplet charge - kDiTrackMinMassSize = 16, // Width of the mass of min mass pair - kDiTrackMaxMassSize = 16, // Width of the mass of max mass pair - 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, - }; - - enum TkTripletBitLocations { - // The location of the least significant bit (LSB) and most significant bit (MSB) in the triplet word for different fields - kValidLSB = 0, - kValidMSB = kValidLSB + TkTripletBitWidths::kValidSize - 1, - kPtLSB = kValidMSB + 1, - kPtMSB = kPtLSB + TkTripletBitWidths::kPtSize - 1, - kGlbPhiLSB = kPtMSB + 1, - kGlbPhiMSB = kGlbPhiLSB + TkTripletBitWidths::kGlbPhiSize - 1, - kGlbEtaLSB = kGlbPhiMSB + 1, - kGlbEtaMSB = kGlbEtaLSB + TkTripletBitWidths::kGlbEtaSize - 1, - kMassLSB = kGlbEtaMSB + 1, - kMassMSB = kMassLSB + TkTripletBitWidths::kMassSize - 1, - kChargeLSB = kMassMSB + 1, - kChargeMSB = kChargeLSB + TkTripletBitWidths::kChargeSize - 1, - kDiTrackMinMassLSB = kChargeMSB + 1, - kDiTrackMinMassMSB = kDiTrackMinMassLSB + TkTripletBitWidths::kDiTrackMinMassSize - 1, - kDiTrackMaxMassLSB = kDiTrackMinMassMSB + 1, - kDiTrackMaxMassMSB = kDiTrackMaxMassLSB + TkTripletBitWidths::kDiTrackMaxMassSize - 1, - kDiTrackMinZ0LSB = kDiTrackMaxMassMSB + 1, - kDiTrackMinZ0MSB = kDiTrackMinZ0LSB + TkTripletBitWidths::kDiTrackMinZ0Size - 1, - kDiTrackMaxZ0LSB = kDiTrackMinZ0MSB + 1, - kDiTrackMaxZ0MSB = kDiTrackMaxZ0LSB + TkTripletBitWidths::kDiTrackMaxZ0Size - 1, - kUnassignedLSB = kDiTrackMaxZ0MSB + 1, - kUnassignedMSB = kUnassignedLSB + TkTripletBitWidths::kUnassignedSize - 1, - }; + enum TkTripletBitLocations { + // The location of the least significant bit (LSB) and most significant bit (MSB) in the triplet word for different fields + kValidLSB = 0, + kValidMSB = kValidLSB + TkTripletBitWidths::kValidSize - 1, + kPtLSB = kValidMSB + 1, + kPtMSB = kPtLSB + TkTripletBitWidths::kPtSize - 1, + kGlbPhiLSB = kPtMSB + 1, + kGlbPhiMSB = kGlbPhiLSB + TkTripletBitWidths::kGlbPhiSize - 1, + kGlbEtaLSB = kGlbPhiMSB + 1, + kGlbEtaMSB = kGlbEtaLSB + TkTripletBitWidths::kGlbEtaSize - 1, + kMassLSB = kGlbEtaMSB + 1, + kMassMSB = kMassLSB + TkTripletBitWidths::kMassSize - 1, + kChargeLSB = kMassMSB + 1, + kChargeMSB = kChargeLSB + TkTripletBitWidths::kChargeSize - 1, + kDiTrackMinMassLSB = kChargeMSB + 1, + kDiTrackMinMassMSB = kDiTrackMinMassLSB + TkTripletBitWidths::kDiTrackMinMassSize - 1, + kDiTrackMaxMassLSB = kDiTrackMinMassMSB + 1, + kDiTrackMaxMassMSB = kDiTrackMaxMassLSB + TkTripletBitWidths::kDiTrackMaxMassSize - 1, + kDiTrackMinZ0LSB = kDiTrackMaxMassMSB + 1, + kDiTrackMinZ0MSB = kDiTrackMinZ0LSB + TkTripletBitWidths::kDiTrackMinZ0Size - 1, + kDiTrackMaxZ0LSB = kDiTrackMinZ0MSB + 1, + kDiTrackMaxZ0MSB = kDiTrackMaxZ0LSB + TkTripletBitWidths::kDiTrackMaxZ0Size - 1, + kUnassignedLSB = kDiTrackMaxZ0MSB + 1, + kUnassignedMSB = kUnassignedLSB + TkTripletBitWidths::kUnassignedSize - 1, + }; - // vertex parameters types - typedef ap_uint valid_t; //valid - typedef ap_ufixed pt_t; //triplet pt - typedef ap_int glbeta_t; //triplet eta - typedef ap_int glbphi_t; //triplet phi - typedef ap_int mass_t; //triplet mass - typedef ap_int charge_t; //triplet Q - typedef ap_int ditrack_minmass_t; //pair min mass - typedef ap_int ditrack_maxmass_t; //pair max mass - typedef ap_int ditrack_minz0_t; //pair dz min - typedef ap_int ditrack_maxz0_t; //pair dz max - typedef ap_uint unassigned_t; - typedef std::bitset tktripletword_bs_t; - typedef ap_uint tktripletword_t; + // vertex parameters types + typedef ap_uint valid_t; //valid + typedef ap_ufixed pt_t; //triplet pt + typedef ap_int glbeta_t; //triplet eta + typedef ap_int glbphi_t; //triplet phi + typedef ap_int mass_t; //triplet mass + typedef ap_int charge_t; //triplet Q + typedef ap_int ditrack_minmass_t; //pair min mass + typedef ap_int ditrack_maxmass_t; //pair max mass + typedef ap_int ditrack_minz0_t; //pair dz min + typedef ap_int ditrack_maxz0_t; //pair dz max + typedef ap_uint unassigned_t; + typedef std::bitset tktripletword_bs_t; + typedef ap_uint 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); + 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); - ~TkTripletWord() {} + ~TkTripletWord() {} - // ----------copy constructor ---------------------- - TkTripletWord(const TkTripletWord& word) { tkTripletWord_ = word.tkTripletWord_; } + // ----------copy constructor ---------------------- + TkTripletWord(const TkTripletWord& word) { tkTripletWord_ = word.tkTripletWord_; } - // ----------operators ----------------------------- - TkTripletWord& operator=(const TkTripletWord& word) { - tkTripletWord_ = word.tkTripletWord_; - return *this; - } + // ----------operators ----------------------------- + TkTripletWord& operator=(const TkTripletWord& word) { + tkTripletWord_ = word.tkTripletWord_; + return *this; + } - // ----------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); - } - pt_t ptWord() const { - pt_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kPtMSB, TkTripletBitLocations::kPtLSB); - return ret; - } - glbeta_t glbEtaWord() const { - glbeta_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kGlbEtaMSB, TkTripletBitLocations::kGlbEtaLSB); - return ret; - } - glbphi_t glbPhiWord() const { - glbphi_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kGlbPhiMSB, TkTripletBitLocations::kGlbPhiLSB); - return ret; - } - mass_t massWord() const { - mass_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kMassMSB, TkTripletBitLocations::kMassLSB); - return ret; - } - charge_t chargeWord() const { - charge_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kChargeMSB, TkTripletBitLocations::kChargeLSB); - return ret; - } + // ----------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); + } + pt_t ptWord() const { + pt_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kPtMSB, TkTripletBitLocations::kPtLSB); + return ret; + } + glbeta_t glbEtaWord() const { + glbeta_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kGlbEtaMSB, TkTripletBitLocations::kGlbEtaLSB); + return ret; + } + glbphi_t glbPhiWord() const { + glbphi_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kGlbPhiMSB, TkTripletBitLocations::kGlbPhiLSB); + return ret; + } + mass_t massWord() const { + mass_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kMassMSB, TkTripletBitLocations::kMassLSB); + return ret; + } + charge_t chargeWord() const { + charge_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kChargeMSB, TkTripletBitLocations::kChargeLSB); + return ret; + } - ditrack_minmass_t ditrackMinMassWord() const { - ditrack_minmass_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMinMassMSB, TkTripletBitLocations::kDiTrackMinMassLSB); - return ret; - } - ditrack_maxmass_t ditrackMaxMassWord() const { - ditrack_maxmass_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMaxMassMSB, TkTripletBitLocations::kDiTrackMaxMassLSB); - return ret; - } - ditrack_minz0_t ditrackMinZ0Word() const { - ditrack_minz0_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMinZ0MSB, TkTripletBitLocations::kDiTrackMinZ0LSB); - return ret; - } - ditrack_maxz0_t ditrackMaxZ0Word() const { - ditrack_maxz0_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMaxZ0MSB, TkTripletBitLocations::kDiTrackMaxZ0LSB); - return ret; - } - unassigned_t unassignedWord() const { - return tkTripletWord()(TkTripletBitLocations::kUnassignedMSB, TkTripletBitLocations::kUnassignedLSB); - } - tktripletword_t tkTripletWord() const { return tktripletword_t(tkTripletWord_.to_string().c_str(), 2); } + ditrack_minmass_t ditrackMinMassWord() const { + ditrack_minmass_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMinMassMSB, TkTripletBitLocations::kDiTrackMinMassLSB); + return ret; + } + ditrack_maxmass_t ditrackMaxMassWord() const { + ditrack_maxmass_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMaxMassMSB, TkTripletBitLocations::kDiTrackMaxMassLSB); + return ret; + } + ditrack_minz0_t ditrackMinZ0Word() const { + ditrack_minz0_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMinZ0MSB, TkTripletBitLocations::kDiTrackMinZ0LSB); + return ret; + } + ditrack_maxz0_t ditrackMaxZ0Word() const { + ditrack_maxz0_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMaxZ0MSB, TkTripletBitLocations::kDiTrackMaxZ0LSB); + return ret; + } + unassigned_t unassignedWord() const { + return tkTripletWord()(TkTripletBitLocations::kUnassignedMSB, TkTripletBitLocations::kUnassignedLSB); + } + tktripletword_t tkTripletWord() const { return tktripletword_t(tkTripletWord_.to_string().c_str(), 2); } - // These functions return the packed bits in integer format for each quantity - // Signed quantities have the sign enconded in the left-most bit. - unsigned int validBits() const { return validWord().to_uint(); } - unsigned int ptBits() const { return ptWord().to_uint(); } - unsigned int glbEtaBits() const { return glbEtaWord().to_uint(); } - unsigned int glbPhiBits() const { return glbPhiWord().to_uint(); } - unsigned int massBits() const { return massWord().to_uint(); } - unsigned int chargeBits() const { return chargeWord().to_uint(); } - unsigned int ditrackMinMassBits() const { return ditrackMinMassWord().to_uint(); } - unsigned int ditrackMaxMassBits() const { return ditrackMaxMassWord().to_uint(); } - unsigned int ditrackMinZ0Bits() const { return ditrackMinZ0Word().to_uint(); } - unsigned int ditrackMaxZ0Bits() const { return ditrackMaxZ0Word().to_uint(); } - unsigned int unassignedBits() const { return unassignedWord().to_uint(); } + // These functions return the packed bits in integer format for each quantity + // Signed quantities have the sign enconded in the left-most bit. + unsigned int validBits() const { return validWord().to_uint(); } + unsigned int ptBits() const { return ptWord().to_uint(); } + unsigned int glbEtaBits() const { return glbEtaWord().to_uint(); } + unsigned int glbPhiBits() const { return glbPhiWord().to_uint(); } + unsigned int massBits() const { return massWord().to_uint(); } + unsigned int chargeBits() const { return chargeWord().to_uint(); } + unsigned int ditrackMinMassBits() const { return ditrackMinMassWord().to_uint(); } + unsigned int ditrackMaxMassBits() const { return ditrackMaxMassWord().to_uint(); } + unsigned int ditrackMinZ0Bits() const { return ditrackMinZ0Word().to_uint(); } + unsigned int ditrackMaxZ0Bits() const { return ditrackMaxZ0Word().to_uint(); } + unsigned int unassignedBits() const { return unassignedWord().to_uint(); } - // These functions return the unpacked and converted values - // These functions return real numbers converted from the digitized quantities by unpacking the 64-bit vertex word - bool valid() const { return validWord().to_bool(); } - float pt() const { return ptWord().to_float(); } - float glbeta() const { - return unpackSignedValue( - glbEtaWord(), TkTripletBitWidths::kGlbEtaSize, (MAX_ETA) / (1 << TkTripletBitWidths::kGlbEtaSize)); - } - float glbphi() const { - 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)); - } - 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(); } + // These functions return the unpacked and converted values + // These functions return real numbers converted from the digitized quantities by unpacking the 64-bit vertex word + bool valid() const { return validWord().to_bool(); } + float pt() const { return ptWord().to_float(); } + float glbeta() const { + return unpackSignedValue( + glbEtaWord(), TkTripletBitWidths::kGlbEtaSize, (MAX_ETA) / (1 << TkTripletBitWidths::kGlbEtaSize)); + } + float glbphi() const { + 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)); + } + 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) ------------ - void setTkTripletWord(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, - ditrack_maxz0_t ditrack_maxz0, - unassigned_t unassigned); + // ----------member functions (setters) ------------ + void setTkTripletWord(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, + ditrack_maxz0_t ditrack_maxz0, + unassigned_t unassigned); - template - inline void packIntoWord(unsigned int& currentOffset, unsigned int wordChunkSize, packVarType& packVar); + template + 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 { - int isign = 1; - unsigned int digitized_maximum = (1 << nBits) - 1; - if (bits & (1 << (nBits - 1))) { // check the sign - isign = -1; - bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + private: + // ----------private member functions -------------- + double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const { + int isign = 1; + unsigned int digitized_maximum = (1 << nBits) - 1; + if (bits & (1 << (nBits - 1))) { // check the sign + isign = -1; + bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + } + return (double(bits & digitized_maximum) + 0.5) * lsb * isign; } - return (double(bits & digitized_maximum) + 0.5) * lsb * isign; - } - - // ----------member data --------------------------- - tktripletword_bs_t tkTripletWord_; - }; + // ----------member data --------------------------- + tktripletword_bs_t tkTripletWord_; + }; + } // namespace io_v1 + using TkTripletWord = io_v1::TkTripletWord; typedef std::vector TkTripletWordCollection; } // namespace l1t diff --git a/DataFormats/L1Trigger/interface/Vertex.h b/DataFormats/L1Trigger/interface/Vertex.h index d26e1a02ac4aa..3b53906a18c5a 100644 --- a/DataFormats/L1Trigger/interface/Vertex.h +++ b/DataFormats/L1Trigger/interface/Vertex.h @@ -8,26 +8,27 @@ #include "DataFormats/L1TrackTrigger/interface/TTTypes.h" namespace l1t { - - class Vertex { - public: - typedef TTTrack Track_t; - - Vertex() : pt_(0.0), z0_(0.0) {} - Vertex(float pt, float z0, const std::vector>& tracks) : pt_(pt), z0_(z0), tracks_(tracks) {} - ~Vertex() {} - - float pt() const { return pt_; } - float z0() const { return z0_; } - - const std::vector>& tracks() const { return tracks_; } - - private: - float pt_; - float z0_; - std::vector> tracks_; - }; - + namespace io_v1 { + class Vertex { + public: + typedef TTTrack Track_t; + + Vertex() : pt_(0.0), z0_(0.0) {} + Vertex(float pt, float z0, const std::vector>& tracks) : pt_(pt), z0_(z0), tracks_(tracks) {} + ~Vertex() {} + + float pt() const { return pt_; } + float z0() const { return z0_; } + + const std::vector>& tracks() const { return tracks_; } + + private: + float pt_; + float z0_; + std::vector> tracks_; + }; + } // namespace io_v1 + using Vertex = io_v1::Vertex; typedef std::vector VertexCollection; } // namespace l1t diff --git a/DataFormats/L1Trigger/interface/VertexWord.h b/DataFormats/L1Trigger/interface/VertexWord.h index 21ed4091824d3..3b434e59b9691 100644 --- a/DataFormats/L1Trigger/interface/VertexWord.h +++ b/DataFormats/L1Trigger/interface/VertexWord.h @@ -22,178 +22,181 @@ #include namespace l1t { - - class VertexWord { - public: - // ----------constants, enums and typedefs --------- - enum VertexBitWidths { - // The sizes of the vertex word components and total word size - kValidSize = 1, // Width of the valid bit - kZ0Size = 15, // Width of z-position - kZ0MagSize = 6, // Width of z-position magnitude (signed) - kNTrackInPVSize = 8, // Width of the multiplicity in the PV (unsigned) - kSumPtSize = 12, // Width of pT - kSumPtMagSize = 10, // Width of pT magnitude (unsigned) - kQualitySize = 3, // Width of the quality field - kNTrackOutPVSize = 10, // Width of the multiplicity outside the PV (unsigned) - kUnassignedSize = 15, // Width of the unassigned bits - - kVertexWordSize = kValidSize + kZ0Size + kNTrackInPVSize + kSumPtSize + kQualitySize + kNTrackOutPVSize + - kUnassignedSize, // Width of the vertex word in bits - }; - - enum VertexBitLocations { - // The location of the least significant bit (LSB) and most significant bit (MSB) in the vertex word for different fields - kValidLSB = 0, - kValidMSB = kValidLSB + VertexBitWidths::kValidSize - 1, - kZ0LSB = kValidMSB + 1, - kZ0MSB = kZ0LSB + VertexBitWidths::kZ0Size - 1, - kNTrackInPVLSB = kZ0MSB + 1, - kNTrackInPVMSB = kNTrackInPVLSB + VertexBitWidths::kNTrackInPVSize - 1, - kSumPtLSB = kNTrackInPVMSB + 1, - kSumPtMSB = kSumPtLSB + VertexBitWidths::kSumPtSize - 1, - kQualityLSB = kSumPtMSB + 1, - kQualityMSB = kQualityLSB + VertexBitWidths::kQualitySize - 1, - kNTrackOutPVLSB = kQualityMSB + 1, - kNTrackOutPVMSB = kNTrackOutPVLSB + VertexBitWidths::kNTrackOutPVSize - 1, - kUnassignedLSB = kNTrackOutPVMSB + 1, - kUnassignedMSB = kUnassignedLSB + VertexBitWidths::kUnassignedSize - 1 - }; - - // vertex parameters types - typedef ap_uint vtxvalid_t; // Vertex validity - typedef ap_fixed vtxz0_t; // Vertex z0 - typedef ap_ufixed - vtxmultiplicity_t; // NTracks in vertex - typedef ap_ufixed - vtxsumpt_t; // Vertex Sum pT - typedef ap_uint vtxquality_t; // Vertex quality - typedef ap_ufixed - vtxinversemult_t; // NTracks outside vertex - typedef ap_uint vtxunassigned_t; // Unassigned bits - - // vertex word types - typedef std::bitset vtxword_bs_t; // Entire track word; - typedef ap_uint vtxword_t; // Entire vertex word; - - // reference types - typedef edm::Ref VertexRef; // Reference to a persistent l1t::Vertex - - public: - // ----------Constructors -------------------------- - VertexWord() {} - VertexWord(unsigned int valid, - double z0, - unsigned int multiplicity, - double pt, - unsigned int quality, - unsigned int inverseMultiplicity, - unsigned int unassigned); - VertexWord(unsigned int valid, - unsigned int z0, - unsigned int multiplicity, - unsigned int pt, - unsigned int quality, - unsigned int inverseMultiplicity, - unsigned int unassigned); - VertexWord(vtxvalid_t valid, - vtxz0_t z0, - vtxmultiplicity_t multiplicity, - vtxsumpt_t pt, - vtxquality_t quality, - vtxinversemult_t inverseMultiplicity, - vtxunassigned_t unassigned); - - ~VertexWord() {} - - // ----------copy constructor ---------------------- - VertexWord(const VertexWord& word) { vertexWord_ = word.vertexWord_; } - - // ----------operators ----------------------------- - VertexWord& operator=(const VertexWord& word) { - vertexWord_ = word.vertexWord_; - return *this; - } - - // ----------member functions (getters) ------------ - // These functions return arbitarary precision words (lists of bits) for each quantity - vtxvalid_t validWord() const { return vertexWord()(VertexBitLocations::kValidMSB, VertexBitLocations::kValidLSB); } - vtxz0_t z0Word() const { - vtxz0_t ret; - ret.V = vertexWord()(VertexBitLocations::kZ0MSB, VertexBitLocations::kZ0LSB); - return ret; - } - vtxmultiplicity_t multiplicityWord() const { - return vertexWord()(VertexBitLocations::kNTrackInPVMSB, VertexBitLocations::kNTrackInPVLSB); - } - vtxsumpt_t ptWord() const { - vtxsumpt_t ret; - ret.V = vertexWord()(VertexBitLocations::kSumPtMSB, VertexBitLocations::kSumPtLSB); - return ret; - } - vtxquality_t qualityWord() const { - return vertexWord()(VertexBitLocations::kQualityMSB, VertexBitLocations::kQualityLSB); - } - vtxinversemult_t inverseMultiplicityWord() const { - return vertexWord()(VertexBitLocations::kNTrackOutPVMSB, VertexBitLocations::kNTrackOutPVLSB); - } - vtxunassigned_t unassignedWord() const { - return vertexWord()(VertexBitLocations::kUnassignedMSB, VertexBitLocations::kUnassignedLSB); - } - vtxword_t vertexWord() const { return vtxword_t(vertexWord_.to_string().c_str(), 2); } - - // These functions return the packed bits in integer format for each quantity - // Signed quantities have the sign enconded in the left-most bit. - unsigned int validBits() const { return validWord().to_uint(); } - unsigned int z0Bits() const { return z0Word().range().to_uint(); } - unsigned int multiplicityBits() const { return multiplicityWord().to_uint(); } - unsigned int ptBits() const { return ptWord().range().to_uint(); } - unsigned int qualityBits() const { return qualityWord().to_uint(); } - unsigned int inverseMultiplicityBits() const { return inverseMultiplicityWord().to_uint(); } - unsigned int unassignedBits() const { return unassignedWord().to_uint(); } - - // These functions return the unpacked and converted values - // These functions return real numbers converted from the digitized quantities by unpacking the 64-bit vertex word - bool valid() const { return validWord().to_bool(); } - double z0() const { return z0Word().to_double(); } - unsigned int multiplicity() const { return multiplicityWord().to_uint(); } - double pt() const { return ptWord().to_double(); } - unsigned int quality() const { return qualityWord().to_uint(); } - unsigned int inverseMultiplicity() const { return inverseMultiplicityWord().to_uint(); } - unsigned int unassigned() const { return unassignedWord().to_uint(); } - - // return reference to floating point vertex - VertexRef vertexRef() const { return vertexRef_; } - - // ----------member functions (setters) ------------ - void setVertexWord(vtxvalid_t valid, - vtxz0_t z0, - vtxmultiplicity_t multiplicity, - vtxsumpt_t pt, - vtxquality_t quality, - vtxinversemult_t inverseMultiplicity, - vtxunassigned_t unassigned); - - // set reference to floating point vertex - void setVertexRef(const VertexRef& ref) { vertexRef_ = ref; } - - private: - // ----------private member functions -------------- - double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const { - int isign = 1; - unsigned int digitized_maximum = (1 << nBits) - 1; - if (bits & (1 << (nBits - 1))) { // check the sign - isign = -1; - bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + namespace io_v1 { + class VertexWord { + public: + // ----------constants, enums and typedefs --------- + enum VertexBitWidths { + // The sizes of the vertex word components and total word size + kValidSize = 1, // Width of the valid bit + kZ0Size = 15, // Width of z-position + kZ0MagSize = 6, // Width of z-position magnitude (signed) + kNTrackInPVSize = 8, // Width of the multiplicity in the PV (unsigned) + kSumPtSize = 12, // Width of pT + kSumPtMagSize = 10, // Width of pT magnitude (unsigned) + kQualitySize = 3, // Width of the quality field + kNTrackOutPVSize = 10, // Width of the multiplicity outside the PV (unsigned) + kUnassignedSize = 15, // Width of the unassigned bits + + kVertexWordSize = kValidSize + kZ0Size + kNTrackInPVSize + kSumPtSize + kQualitySize + kNTrackOutPVSize + + kUnassignedSize, // Width of the vertex word in bits + }; + + enum VertexBitLocations { + // The location of the least significant bit (LSB) and most significant bit (MSB) in the vertex word for different fields + kValidLSB = 0, + kValidMSB = kValidLSB + VertexBitWidths::kValidSize - 1, + kZ0LSB = kValidMSB + 1, + kZ0MSB = kZ0LSB + VertexBitWidths::kZ0Size - 1, + kNTrackInPVLSB = kZ0MSB + 1, + kNTrackInPVMSB = kNTrackInPVLSB + VertexBitWidths::kNTrackInPVSize - 1, + kSumPtLSB = kNTrackInPVMSB + 1, + kSumPtMSB = kSumPtLSB + VertexBitWidths::kSumPtSize - 1, + kQualityLSB = kSumPtMSB + 1, + kQualityMSB = kQualityLSB + VertexBitWidths::kQualitySize - 1, + kNTrackOutPVLSB = kQualityMSB + 1, + kNTrackOutPVMSB = kNTrackOutPVLSB + VertexBitWidths::kNTrackOutPVSize - 1, + kUnassignedLSB = kNTrackOutPVMSB + 1, + kUnassignedMSB = kUnassignedLSB + VertexBitWidths::kUnassignedSize - 1 + }; + + // vertex parameters types + typedef ap_uint vtxvalid_t; // Vertex validity + typedef ap_fixed vtxz0_t; // Vertex z0 + typedef ap_ufixed + vtxmultiplicity_t; // NTracks in vertex + typedef ap_ufixed + vtxsumpt_t; // Vertex Sum pT + typedef ap_uint vtxquality_t; // Vertex quality + typedef ap_ufixed + vtxinversemult_t; // NTracks outside vertex + typedef ap_uint vtxunassigned_t; // Unassigned bits + + // vertex word types + typedef std::bitset vtxword_bs_t; // Entire track word; + typedef ap_uint vtxword_t; // Entire vertex word; + + // reference types + typedef edm::Ref VertexRef; // Reference to a persistent l1t::Vertex + + public: + // ----------Constructors -------------------------- + VertexWord() {} + VertexWord(unsigned int valid, + double z0, + unsigned int multiplicity, + double pt, + unsigned int quality, + unsigned int inverseMultiplicity, + unsigned int unassigned); + VertexWord(unsigned int valid, + unsigned int z0, + unsigned int multiplicity, + unsigned int pt, + unsigned int quality, + unsigned int inverseMultiplicity, + unsigned int unassigned); + VertexWord(vtxvalid_t valid, + vtxz0_t z0, + vtxmultiplicity_t multiplicity, + vtxsumpt_t pt, + vtxquality_t quality, + vtxinversemult_t inverseMultiplicity, + vtxunassigned_t unassigned); + + ~VertexWord() {} + + // ----------copy constructor ---------------------- + VertexWord(const VertexWord& word) { vertexWord_ = word.vertexWord_; } + + // ----------operators ----------------------------- + VertexWord& operator=(const VertexWord& word) { + vertexWord_ = word.vertexWord_; + return *this; } - return (double(bits & digitized_maximum) + 0.5) * lsb * isign; - } - // ----------member data --------------------------- - vtxword_bs_t vertexWord_; - VertexRef vertexRef_; - }; + // ----------member functions (getters) ------------ + // These functions return arbitarary precision words (lists of bits) for each quantity + vtxvalid_t validWord() const { + return vertexWord()(VertexBitLocations::kValidMSB, VertexBitLocations::kValidLSB); + } + vtxz0_t z0Word() const { + vtxz0_t ret; + ret.V = vertexWord()(VertexBitLocations::kZ0MSB, VertexBitLocations::kZ0LSB); + return ret; + } + vtxmultiplicity_t multiplicityWord() const { + return vertexWord()(VertexBitLocations::kNTrackInPVMSB, VertexBitLocations::kNTrackInPVLSB); + } + vtxsumpt_t ptWord() const { + vtxsumpt_t ret; + ret.V = vertexWord()(VertexBitLocations::kSumPtMSB, VertexBitLocations::kSumPtLSB); + return ret; + } + vtxquality_t qualityWord() const { + return vertexWord()(VertexBitLocations::kQualityMSB, VertexBitLocations::kQualityLSB); + } + vtxinversemult_t inverseMultiplicityWord() const { + return vertexWord()(VertexBitLocations::kNTrackOutPVMSB, VertexBitLocations::kNTrackOutPVLSB); + } + vtxunassigned_t unassignedWord() const { + return vertexWord()(VertexBitLocations::kUnassignedMSB, VertexBitLocations::kUnassignedLSB); + } + vtxword_t vertexWord() const { return vtxword_t(vertexWord_.to_string().c_str(), 2); } + + // These functions return the packed bits in integer format for each quantity + // Signed quantities have the sign enconded in the left-most bit. + unsigned int validBits() const { return validWord().to_uint(); } + unsigned int z0Bits() const { return z0Word().range().to_uint(); } + unsigned int multiplicityBits() const { return multiplicityWord().to_uint(); } + unsigned int ptBits() const { return ptWord().range().to_uint(); } + unsigned int qualityBits() const { return qualityWord().to_uint(); } + unsigned int inverseMultiplicityBits() const { return inverseMultiplicityWord().to_uint(); } + unsigned int unassignedBits() const { return unassignedWord().to_uint(); } + + // These functions return the unpacked and converted values + // These functions return real numbers converted from the digitized quantities by unpacking the 64-bit vertex word + bool valid() const { return validWord().to_bool(); } + double z0() const { return z0Word().to_double(); } + unsigned int multiplicity() const { return multiplicityWord().to_uint(); } + double pt() const { return ptWord().to_double(); } + unsigned int quality() const { return qualityWord().to_uint(); } + unsigned int inverseMultiplicity() const { return inverseMultiplicityWord().to_uint(); } + unsigned int unassigned() const { return unassignedWord().to_uint(); } + + // return reference to floating point vertex + VertexRef vertexRef() const { return vertexRef_; } + + // ----------member functions (setters) ------------ + void setVertexWord(vtxvalid_t valid, + vtxz0_t z0, + vtxmultiplicity_t multiplicity, + vtxsumpt_t pt, + vtxquality_t quality, + vtxinversemult_t inverseMultiplicity, + vtxunassigned_t unassigned); + + // set reference to floating point vertex + void setVertexRef(const VertexRef& ref) { vertexRef_ = ref; } + + private: + // ----------private member functions -------------- + double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const { + int isign = 1; + unsigned int digitized_maximum = (1 << nBits) - 1; + if (bits & (1 << (nBits - 1))) { // check the sign + isign = -1; + bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + } + return (double(bits & digitized_maximum) + 0.5) * lsb * isign; + } + // ----------member data --------------------------- + vtxword_bs_t vertexWord_; + VertexRef vertexRef_; + }; + } // namespace io_v1 + using VertexWord = io_v1::VertexWord; typedef std::vector VertexWordCollection; typedef edm::Ref VertexWordRef; } // namespace l1t diff --git a/DataFormats/L1Trigger/src/classes_def.xml b/DataFormats/L1Trigger/src/classes_def.xml index 9550524686c48..dfa94d445f109 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -1,10 +1,10 @@ - - + + - + @@ -13,9 +13,9 @@ - - - + + + @@ -26,20 +26,20 @@ - - + + - + - - + + - + @@ -47,19 +47,17 @@ - - - - + + - - + + - - + + - + @@ -68,12 +66,12 @@ - - + + - - + + @@ -88,11 +86,11 @@ - - + + - + @@ -101,12 +99,12 @@ - - + + - + - + @@ -115,12 +113,12 @@ - - + + - + - + @@ -130,7 +128,7 @@ - + @@ -276,21 +274,20 @@ - + - - - + + - - + + - - + + - - - + + + @@ -300,12 +297,11 @@ - - - + + - - + + diff --git a/DataFormats/MuonSeed/src/classes_def.xml b/DataFormats/MuonSeed/src/classes_def.xml index 570796981c13e..8540d89ca8dac 100644 --- a/DataFormats/MuonSeed/src/classes_def.xml +++ b/DataFormats/MuonSeed/src/classes_def.xml @@ -1,9 +1,6 @@ - - - - - + + @@ -29,7 +26,7 @@ - + diff --git a/L1Trigger/L1TCalorimeter/interface/AccumulatingSort.h b/L1Trigger/L1TCalorimeter/interface/AccumulatingSort.h index 24e7369582b20..47c3efd9c6b92 100644 --- a/L1Trigger/L1TCalorimeter/interface/AccumulatingSort.h +++ b/L1Trigger/L1TCalorimeter/interface/AccumulatingSort.h @@ -2,7 +2,7 @@ #include #include -template +template class AccumulatingSort { private: std::vector > mSortArrays; @@ -13,16 +13,16 @@ class AccumulatingSort { aTail.clear(); bool lAccInserted(false); - - for (typename std::list::const_iterator lIt(aInput.begin()); lIt != aInput.end(); ++lIt) { + const Greater g; + for (auto const& l : aInput) { if (!lAccInserted and - !(*lIt > - aAcc)) // Accumulator greater than or equal to new entry and not previously inserted -> Reinsert accumulator + !g(l, + aAcc)) // Accumulator greater than or equal to new entry and not previously inserted -> Reinsert accumulator { aTail.push_back(aAcc); lAccInserted = true; } - aTail.push_back(*lIt); + aTail.push_back(l); } aAcc = *aTail.begin(); diff --git a/L1Trigger/L1TCalorimeter/interface/BitonicSort.h b/L1Trigger/L1TCalorimeter/interface/BitonicSort.h index 6be16c8792786..ac662599ccbe5 100644 --- a/L1Trigger/L1TCalorimeter/interface/BitonicSort.h +++ b/L1Trigger/L1TCalorimeter/interface/BitonicSort.h @@ -7,58 +7,51 @@ enum sort_direction { up, down }; // DECLARE! -template -void BitonicSort(sort_direction aDir, - typename std::vector::iterator& aDataStart, - typename std::vector::iterator& aDataEnd); -template -void BitonicMerge(sort_direction aDir, - typename std::vector::iterator& aDataStart, - typename std::vector::iterator& aDataEnd); +template +void BitonicSort(sort_direction aDir, Itr aDataStart, Itr aDataEnd); +template +void BitonicMerge(sort_direction aDir, Itr aDataStart, Itr aDataEnd); //DEFINE! //SORT -template -void BitonicSort(sort_direction aDir, - typename std::vector::iterator& aDataStart, - typename std::vector::iterator& aDataEnd) { +template +void BitonicSort(sort_direction aDir, Itr aDataStart, Itr aDataEnd) { uint32_t lSize(aDataEnd - aDataStart); if (lSize > 1) { - typename std::vector::iterator lMidpoint(aDataStart + (lSize >> 1)); + Itr lMidpoint(aDataStart + (lSize >> 1)); if (aDir == down) { - BitonicSort(up, aDataStart, lMidpoint); - BitonicSort(down, lMidpoint, aDataEnd); + BitonicSort(up, aDataStart, lMidpoint); + BitonicSort(down, lMidpoint, aDataEnd); } else { - BitonicSort(down, aDataStart, lMidpoint); - BitonicSort(up, lMidpoint, aDataEnd); + BitonicSort(down, aDataStart, lMidpoint); + BitonicSort(up, lMidpoint, aDataEnd); } - BitonicMerge(aDir, aDataStart, aDataEnd); + BitonicMerge(aDir, aDataStart, aDataEnd); } } //MERGE -template -void BitonicMerge(sort_direction aDir, - typename std::vector::iterator& aDataStart, - typename std::vector::iterator& aDataEnd) { +template +void BitonicMerge(sort_direction aDir, Itr aDataStart, Itr aDataEnd) { uint32_t lSize(aDataEnd - aDataStart); if (lSize > 1) { uint32_t lPower2(1); while (lPower2 < lSize) lPower2 <<= 1; - typename std::vector::iterator lMidpoint(aDataStart + (lPower2 >> 1)); - typename std::vector::iterator lFirst(aDataStart); - typename std::vector::iterator lSecond(lMidpoint); + Itr lMidpoint(aDataStart + (lPower2 >> 1)); + Itr lFirst(aDataStart); + Itr lSecond(lMidpoint); + const Greater g; for (; lSecond != aDataEnd; ++lFirst, ++lSecond) { - if (((*lFirst) > (*lSecond)) == (aDir == up)) { + if (g((*lFirst), (*lSecond)) == (aDir == up)) { std::swap(*lFirst, *lSecond); } } - BitonicMerge(aDir, aDataStart, lMidpoint); - BitonicMerge(aDir, lMidpoint, aDataEnd); + BitonicMerge(aDir, aDataStart, lMidpoint); + BitonicMerge(aDir, lMidpoint, aDataEnd); } } diff --git a/L1Trigger/L1TCalorimeter/plugins/L1TStage2CaloLayer2Comp.cc b/L1Trigger/L1TCalorimeter/plugins/L1TStage2CaloLayer2Comp.cc index d1e2cd410a80e..ee08d1b4e1f05 100644 --- a/L1Trigger/L1TCalorimeter/plugins/L1TStage2CaloLayer2Comp.cc +++ b/L1Trigger/L1TCalorimeter/plugins/L1TStage2CaloLayer2Comp.cc @@ -37,11 +37,12 @@ #include "L1Trigger/L1TCalorimeter/interface/BitonicSort.h" #include "DataFormats/Math/interface/LorentzVector.h" -namespace l1t { - bool operator>(const l1t::Jet &a, l1t::Jet &b) { return a.hwPt() > b.hwPt(); } - bool operator>(const l1t::EGamma &a, l1t::EGamma &b) { return a.hwPt() > b.hwPt(); } - bool operator>(const l1t::Tau &a, l1t::Tau &b) { return a.hwPt() > b.hwPt(); } -} // namespace l1t +namespace { + template + struct Greater { + constexpr bool operator()(const T &a, const T &b) const noexcept { return a.hwPt() > b.hwPt(); } + }; +} // namespace /** * Short class description. @@ -669,8 +670,8 @@ bool L1TStage2CaloLayer2Comp::compareSums(const edm::Handle *jets) { math::PtEtaPhiMLorentzVector emptyP4; l1t::Jet tempJet(emptyP4, 0, 0, 0, 0); - std::vector > jetEtaPos(41, std::vector(18, tempJet)); - std::vector > jetEtaNeg(41, std::vector(18, tempJet)); + std::vector> jetEtaPos(41, std::vector(18, tempJet)); + std::vector> jetEtaNeg(41, std::vector(18, tempJet)); for (unsigned int iJet = 0; iJet < jets->size(); iJet++) { if (jets->at(iJet).hwEta() > 0) @@ -679,8 +680,8 @@ void L1TStage2CaloLayer2Comp::accuSort(std::vector *jets) { jetEtaNeg.at(-(jets->at(iJet).hwEta() + 1)).at((jets->at(iJet).hwPhi() - 1) / 4) = jets->at(iJet); } - AccumulatingSort etaPosSorter(7); - AccumulatingSort etaNegSorter(7); + AccumulatingSort> etaPosSorter(7); + AccumulatingSort> etaNegSorter(7); std::vector accumEtaPos; std::vector accumEtaNeg; @@ -689,13 +690,13 @@ void L1TStage2CaloLayer2Comp::accuSort(std::vector *jets) { std::vector::iterator start_, end_; start_ = jetEtaPos.at(ieta).begin(); end_ = jetEtaPos.at(ieta).end(); - BitonicSort(down, start_, end_); + BitonicSort>(down, start_, end_); etaPosSorter.Merge(jetEtaPos.at(ieta), accumEtaPos); // eta - start_ = jetEtaNeg.at(ieta).begin(); end_ = jetEtaNeg.at(ieta).end(); - BitonicSort(down, start_, end_); + BitonicSort>(down, start_, end_); etaNegSorter.Merge(jetEtaNeg.at(ieta), accumEtaNeg); } @@ -729,8 +730,8 @@ void L1TStage2CaloLayer2Comp::accuSort(std::vector *jets) { void L1TStage2CaloLayer2Comp::accuSort(std::vector *egs) { math::PtEtaPhiMLorentzVector emptyP4; l1t::EGamma tempEGamma(emptyP4, 0, 0, 0, 0); - std::vector > jetEtaPos(41, std::vector(18, tempEGamma)); - std::vector > jetEtaNeg(41, std::vector(18, tempEGamma)); + std::vector> jetEtaPos(41, std::vector(18, tempEGamma)); + std::vector> jetEtaNeg(41, std::vector(18, tempEGamma)); for (unsigned int iEGamma = 0; iEGamma < egs->size(); iEGamma++) { if (egs->at(iEGamma).hwEta() > 0) @@ -739,8 +740,8 @@ void L1TStage2CaloLayer2Comp::accuSort(std::vector *egs) { jetEtaNeg.at(-(egs->at(iEGamma).hwEta() + 1)).at((egs->at(iEGamma).hwPhi() - 1) / 4) = egs->at(iEGamma); } - AccumulatingSort etaPosSorter(7); - AccumulatingSort etaNegSorter(7); + AccumulatingSort> etaPosSorter(7); + AccumulatingSort> etaNegSorter(7); std::vector accumEtaPos; std::vector accumEtaNeg; @@ -749,13 +750,13 @@ void L1TStage2CaloLayer2Comp::accuSort(std::vector *egs) { std::vector::iterator start_, end_; start_ = jetEtaPos.at(ieta).begin(); end_ = jetEtaPos.at(ieta).end(); - BitonicSort(down, start_, end_); + BitonicSort>(down, start_, end_); etaPosSorter.Merge(jetEtaPos.at(ieta), accumEtaPos); // eta - start_ = jetEtaNeg.at(ieta).begin(); end_ = jetEtaNeg.at(ieta).end(); - BitonicSort(down, start_, end_); + BitonicSort>(down, start_, end_); etaNegSorter.Merge(jetEtaNeg.at(ieta), accumEtaNeg); } @@ -789,8 +790,8 @@ void L1TStage2CaloLayer2Comp::accuSort(std::vector *egs) { void L1TStage2CaloLayer2Comp::accuSort(std::vector *taus) { math::PtEtaPhiMLorentzVector emptyP4; l1t::Tau tempTau(emptyP4, 0, 0, 0, 0); - std::vector > jetEtaPos(41, std::vector(18, tempTau)); - std::vector > jetEtaNeg(41, std::vector(18, tempTau)); + std::vector> jetEtaPos(41, std::vector(18, tempTau)); + std::vector> jetEtaNeg(41, std::vector(18, tempTau)); for (unsigned int iTau = 0; iTau < taus->size(); iTau++) { if (taus->at(iTau).hwEta() > 0) @@ -799,8 +800,8 @@ void L1TStage2CaloLayer2Comp::accuSort(std::vector *taus) { jetEtaNeg.at(-(taus->at(iTau).hwEta() + 1)).at((taus->at(iTau).hwPhi() - 1) / 4) = taus->at(iTau); } - AccumulatingSort etaPosSorter(7); - AccumulatingSort etaNegSorter(7); + AccumulatingSort> etaPosSorter(7); + AccumulatingSort> etaNegSorter(7); std::vector accumEtaPos; std::vector accumEtaNeg; @@ -809,13 +810,13 @@ void L1TStage2CaloLayer2Comp::accuSort(std::vector *taus) { std::vector::iterator start_, end_; start_ = jetEtaPos.at(ieta).begin(); end_ = jetEtaPos.at(ieta).end(); - BitonicSort(down, start_, end_); + BitonicSort>(down, start_, end_); etaPosSorter.Merge(jetEtaPos.at(ieta), accumEtaPos); // eta - start_ = jetEtaNeg.at(ieta).begin(); end_ = jetEtaNeg.at(ieta).end(); - BitonicSort(down, start_, end_); + BitonicSort>(down, start_, end_); etaNegSorter.Merge(jetEtaNeg.at(ieta), accumEtaNeg); } diff --git a/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2DemuxEGAlgoFirmwareImp1.cc b/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2DemuxEGAlgoFirmwareImp1.cc index e1c2aeb33be24..a83a75e6f4eae 100644 --- a/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2DemuxEGAlgoFirmwareImp1.cc +++ b/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2DemuxEGAlgoFirmwareImp1.cc @@ -14,20 +14,22 @@ #include #include "L1Trigger/L1TCalorimeter/interface/BitonicSort.h" -namespace l1t { - inline bool operator>(l1t::EGamma& a, l1t::EGamma& b) { - if (a.pt() == b.pt()) { - if (a.hwPhi() == b.hwPhi()) { - return a.hwEta() > b.hwEta(); +namespace { + struct Greater { + inline bool operator()(l1t::EGamma& a, l1t::EGamma& b) const { + if (a.pt() == b.pt()) { + if (a.hwPhi() == b.hwPhi()) { + return a.hwEta() > b.hwEta(); + } else { + return a.hwPhi() > b.hwPhi(); + } + } else { - return a.hwPhi() > b.hwPhi(); + return a.pt() > b.pt(); } - - } else { - return a.pt() > b.pt(); } - } -} // namespace l1t + }; +} // namespace l1t::Stage2Layer2DemuxEGAlgoFirmwareImp1::Stage2Layer2DemuxEGAlgoFirmwareImp1(CaloParamsHelper const* params) : params_(params) {} @@ -97,5 +99,5 @@ void l1t::Stage2Layer2DemuxEGAlgoFirmwareImp1::processEvent(const std::vector::iterator start_ = outputEGammas.begin(); std::vector::iterator end_ = outputEGammas.end(); - BitonicSort(down, start_, end_); + BitonicSort(down, start_, end_); } diff --git a/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2DemuxJetAlgoFirmwareImp1.cc b/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2DemuxJetAlgoFirmwareImp1.cc index b80227268c9b2..14e2ecfb11fbb 100644 --- a/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2DemuxJetAlgoFirmwareImp1.cc +++ b/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2DemuxJetAlgoFirmwareImp1.cc @@ -14,13 +14,17 @@ #include #include -inline bool operator>(l1t::Jet& a, l1t::Jet& b) { - if (a.hwPt() > b.hwPt()) { - return true; - } else { - return false; - } -} +namespace { + struct Greater { + inline bool operator()(l1t::Jet& a, l1t::Jet& b) const noexcept { + if (a.hwPt() > b.hwPt()) { + return true; + } else { + return false; + } + } + }; +} // namespace #include "L1Trigger/L1TCalorimeter/interface/BitonicSort.h" @@ -38,7 +42,7 @@ void l1t::Stage2Layer2DemuxJetAlgoFirmwareImp1::processEvent(const std::vector(down, start, end); + BitonicSort(down, start, end); // convert eta to GT coordinates for (auto& jet : outputJets) { diff --git a/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2DemuxTauAlgoFirmwareImp1.cc b/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2DemuxTauAlgoFirmwareImp1.cc index feabf53d0c8d8..33e72a5a884e1 100644 --- a/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2DemuxTauAlgoFirmwareImp1.cc +++ b/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2DemuxTauAlgoFirmwareImp1.cc @@ -14,20 +14,22 @@ #include #include "L1Trigger/L1TCalorimeter/interface/BitonicSort.h" -namespace l1t { - inline bool operator>(l1t::Tau& a, l1t::Tau& b) { - if (a.pt() == b.pt()) { - if (a.hwPhi() == b.hwPhi()) { - return a.hwEta() > b.hwEta(); +namespace { + struct Greater { + inline bool operator()(l1t::Tau& a, l1t::Tau& b) const noexcept { + if (a.pt() == b.pt()) { + if (a.hwPhi() == b.hwPhi()) { + return a.hwEta() > b.hwEta(); + } else { + return a.hwPhi() > b.hwPhi(); + } + } else { - return a.hwPhi() > b.hwPhi(); + return a.pt() > b.pt(); } - - } else { - return a.pt() > b.pt(); } - } -} // namespace l1t + }; +} // namespace l1t::Stage2Layer2DemuxTauAlgoFirmwareImp1::Stage2Layer2DemuxTauAlgoFirmwareImp1(CaloParamsHelper const* params) : params_(params) {} @@ -97,5 +99,5 @@ void l1t::Stage2Layer2DemuxTauAlgoFirmwareImp1::processEvent(const std::vector::iterator start_ = outputTaus.begin(); std::vector::iterator end_ = outputTaus.end(); - BitonicSort(down, start_, end_); + BitonicSort(down, start_, end_); } diff --git a/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2EGammaAlgorithmFirmwareImp1.cc b/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2EGammaAlgorithmFirmwareImp1.cc index ee2188f650042..cd95345ff7c51 100644 --- a/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2EGammaAlgorithmFirmwareImp1.cc +++ b/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2EGammaAlgorithmFirmwareImp1.cc @@ -13,9 +13,11 @@ #include "L1Trigger/L1TCalorimeter/interface/BitonicSort.h" #include "L1Trigger/L1TCalorimeter/interface/AccumulatingSort.h" -namespace l1t { - bool operator>(const l1t::EGamma& a, const l1t::EGamma& b) { return a.pt() > b.pt(); } -} // namespace l1t +namespace { + struct Greater { + bool operator()(const l1t::EGamma& a, const l1t::EGamma& b) const noexcept { return a.pt() > b.pt(); } + }; +} // namespace /*****************************************************************/ l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::Stage2Layer2EGammaAlgorithmFirmwareImp1(CaloParamsHelper const* params) @@ -272,8 +274,8 @@ void l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent(const std::vecto egEtaNeg.at(-(egammas_raw.at(iEG).hwEta() + 1)).at((72 - egammas_raw.at(iEG).hwPhi()) / 4) = egammas_raw.at(iEG); } - AccumulatingSort etaPosSorter(6); - AccumulatingSort etaNegSorter(6); + AccumulatingSort etaPosSorter(6); + AccumulatingSort etaNegSorter(6); std::vector accumEtaPos; std::vector accumEtaNeg; @@ -282,13 +284,13 @@ void l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent(const std::vecto std::vector::iterator start_, end_; start_ = egEtaPos.at(ieta).begin(); end_ = egEtaPos.at(ieta).end(); - BitonicSort(down, start_, end_); + BitonicSort(down, start_, end_); etaPosSorter.Merge(egEtaPos.at(ieta), accumEtaPos); // eta - start_ = egEtaNeg.at(ieta).begin(); end_ = egEtaNeg.at(ieta).end(); - BitonicSort(down, start_, end_); + BitonicSort(down, start_, end_); etaNegSorter.Merge(egEtaNeg.at(ieta), accumEtaNeg); } diff --git a/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2JetAlgorithmFirmwareImp1.cc b/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2JetAlgorithmFirmwareImp1.cc index f181b45c9bbf4..2cdb48f8d6ec3 100644 --- a/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2JetAlgorithmFirmwareImp1.cc +++ b/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2JetAlgorithmFirmwareImp1.cc @@ -18,9 +18,11 @@ #include #include -namespace l1t { - bool operator>(const l1t::Jet& a, const l1t::Jet& b) { return a.hwPt() > b.hwPt(); } -} // namespace l1t +namespace { + struct Greater { + bool operator()(const l1t::Jet& a, const l1t::Jet& b) const noexcept { return a.hwPt() > b.hwPt(); } + }; +} // namespace // jet mask, needs to be configurable at some point // just a square for now @@ -264,7 +266,7 @@ void l1t::Stage2Layer2JetAlgorithmFirmwareImp1::create(const std::vector(down, start_, end_); + BitonicSort(down, start_, end_); if (jetsRing.size() > 6) jetsRing.resize(6); @@ -289,8 +291,8 @@ void l1t::Stage2Layer2JetAlgorithmFirmwareImp1::accuSort(std::vector& jetEtaNeg.at(-(jets.at(iJet).hwEta() + 1)).at((72 - jets.at(iJet).hwPhi()) / 4) = jets.at(iJet); } - AccumulatingSort etaPosSorter(7); - AccumulatingSort etaNegSorter(7); + AccumulatingSort etaPosSorter(7); + AccumulatingSort etaNegSorter(7); std::vector accumEtaPos; std::vector accumEtaNeg; @@ -299,13 +301,13 @@ void l1t::Stage2Layer2JetAlgorithmFirmwareImp1::accuSort(std::vector& std::vector::iterator start_, end_; start_ = jetEtaPos.at(ieta).begin(); end_ = jetEtaPos.at(ieta).end(); - BitonicSort(down, start_, end_); + BitonicSort(down, start_, end_); etaPosSorter.Merge(jetEtaPos.at(ieta), accumEtaPos); // eta - start_ = jetEtaNeg.at(ieta).begin(); end_ = jetEtaNeg.at(ieta).end(); - BitonicSort(down, start_, end_); + BitonicSort(down, start_, end_); etaNegSorter.Merge(jetEtaNeg.at(ieta), accumEtaNeg); } diff --git a/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2TauAlgorithmFirmwareImp1.cc b/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2TauAlgorithmFirmwareImp1.cc index 9fd19692120f6..3f1bd56bb7fbe 100644 --- a/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2TauAlgorithmFirmwareImp1.cc +++ b/L1Trigger/L1TCalorimeter/src/firmware/Stage2Layer2TauAlgorithmFirmwareImp1.cc @@ -11,9 +11,11 @@ #include "L1Trigger/L1TCalorimeter/interface/BitonicSort.h" #include "L1Trigger/L1TCalorimeter/interface/AccumulatingSort.h" -namespace l1t { - bool operator>(const l1t::Tau& a, const l1t::Tau& b) { return a.pt() > b.pt(); } -} // namespace l1t +namespace { + struct Greater { + bool operator()(const l1t::Tau& a, const l1t::Tau& b) const noexcept { return a.pt() > b.pt(); } + }; +} // namespace l1t::Stage2Layer2TauAlgorithmFirmwareImp1::Stage2Layer2TauAlgorithmFirmwareImp1(CaloParamsHelper const* params) : params_(params) { @@ -435,8 +437,8 @@ void l1t::Stage2Layer2TauAlgorithmFirmwareImp1::dosorting(std::vector& tauEtaNeg.at(-(taus.at(iTau).hwEta() + 1)).at((72 - taus.at(iTau).hwPhi()) / 4) = taus.at(iTau); } - AccumulatingSort etaPosSorter(6); - AccumulatingSort etaNegSorter(6); + AccumulatingSort etaPosSorter(6); + AccumulatingSort etaNegSorter(6); std::vector accumEtaPos; std::vector accumEtaNeg; @@ -445,13 +447,13 @@ void l1t::Stage2Layer2TauAlgorithmFirmwareImp1::dosorting(std::vector& std::vector::iterator start_, end_; start_ = tauEtaPos.at(ieta).begin(); end_ = tauEtaPos.at(ieta).end(); - BitonicSort(down, start_, end_); + BitonicSort(down, start_, end_); etaPosSorter.Merge(tauEtaPos.at(ieta), accumEtaPos); // eta - start_ = tauEtaNeg.at(ieta).begin(); end_ = tauEtaNeg.at(ieta).end(); - BitonicSort(down, start_, end_); + BitonicSort(down, start_, end_); etaNegSorter.Merge(tauEtaNeg.at(ieta), accumEtaNeg); } diff --git a/L1Trigger/L1TCalorimeter/test/BuildFile.xml b/L1Trigger/L1TCalorimeter/test/BuildFile.xml new file mode 100644 index 0000000000000..c1485708f319d --- /dev/null +++ b/L1Trigger/L1TCalorimeter/test/BuildFile.xml @@ -0,0 +1,3 @@ + + + diff --git a/L1Trigger/L1TCalorimeter/test/test_catch2_accumulatingsort.cc b/L1Trigger/L1TCalorimeter/test/test_catch2_accumulatingsort.cc new file mode 100644 index 0000000000000..6159553aa9bf4 --- /dev/null +++ b/L1Trigger/L1TCalorimeter/test/test_catch2_accumulatingsort.cc @@ -0,0 +1,98 @@ +#include "L1Trigger/L1TCalorimeter/interface/AccumulatingSort.h" + +#include "catch2/catch_all.hpp" + +TEST_CASE("AccumulatingSort", "[AccumulatingSort]") { + SECTION("empty out") { + SECTION("ascending") { + std::vector v = {1, 2, 3, 4, 5, 6, 7, 8, 9}; + std::vector out; + const std::vector answer = {1, 2, 3}; + AccumulatingSort> s(3); + s.Merge(v, out); + CHECK(answer == out); + } + SECTION("descending") { + std::vector v = {9, 8, 7, 6, 5, 4, 3, 2, 1}; + std::vector out; + AccumulatingSort> s(3); + s.Merge(v, out); + const std::vector answer = {9, 8, 7}; + CHECK(answer == out); + } + SECTION("random") { + std::vector v = {7, 3, 9, 4, 6, 5, 1, 2, 8}; + std::vector out; + AccumulatingSort> s(3); + s.Merge(v, out); + const std::vector answer = {7, 3, 9}; + CHECK(answer == out); + } + SECTION("duplicates ascending") { + std::vector v = {1, 2, 2, 2, 3, 4, 5, 6, 7, 8, 9}; + std::vector out; + const std::vector answer = {1, 2, 2}; + AccumulatingSort> s(3); + s.Merge(v, out); + CHECK(answer == out); + } + SECTION("duplicates descending") { + std::vector v = {9, 8, 8, 8, 7, 6, 5, 4, 3, 2, 1}; + std::vector out; + AccumulatingSort> s(3); + s.Merge(v, out); + const std::vector answer = {9, 8, 8}; + CHECK(answer == out); + } + SECTION("mixed") { + std::vector v = {3, 4, 5, 1, 2, 0, 8, 9}; + std::vector out; + AccumulatingSort> s(6); + s.Merge(v, out); + const std::vector answer = {3, 4, 5, 1, 2, 0}; + CHECK(answer == out); + } + } + SECTION("out with entries") { + SECTION("out larger") { + std::vector v = {1, 2, 3, 4, 5, 6, 7, 8, 9}; + std::vector out = {10, 11, 12, 13}; + AccumulatingSort> s(out.size()); + s.Merge(v, out); + const std::vector answer = {10, 11, 12, 13}; + CHECK(answer == out); + } + SECTION("in larger") { + std::vector v = {1, 2, 3, 4, 5, 6, 7, 8, 9}; + std::vector out = {-10, -11, -12, -13}; + AccumulatingSort> s(out.size()); + s.Merge(v, out); + const std::vector answer = {1, 2, 3, 4}; + CHECK(answer == out); + } + SECTION("mixture") { + std::vector v = {1, 4, 8, 9, 12}; + std::vector out = {0, 5, 6, 10}; + AccumulatingSort> s(out.size()); + s.Merge(v, out); + const std::vector answer = {1, 5, 6, 10}; + CHECK(answer == out); + } + SECTION("interleaved") { + std::vector v = {1, 3, 5, 7, 9}; + std::vector out = {2, 4, 6, 8}; + AccumulatingSort> s(out.size()); + s.Merge(v, out); + const std::vector answer = {2, 4, 6, 8}; + CHECK(answer == out); + } + SECTION("interleaved") { + std::vector v = {2, 4, 6, 8, 10}; + std::vector out = {1, 2, 3, 4}; + AccumulatingSort> s(out.size()); + s.Merge(v, out); + const std::vector answer = {2, 4, 6, 8}; + CHECK(answer == out); + } + } +} diff --git a/L1Trigger/L1TCalorimeter/test/test_catch2_bitonicsort.cc b/L1Trigger/L1TCalorimeter/test/test_catch2_bitonicsort.cc new file mode 100644 index 0000000000000..1025c80cc435c --- /dev/null +++ b/L1Trigger/L1TCalorimeter/test/test_catch2_bitonicsort.cc @@ -0,0 +1,22 @@ +#include "L1Trigger/L1TCalorimeter/interface/BitonicSort.h" + +#include "catch2/catch_all.hpp" + +#include + +TEST_CASE("BitonicSort", "[BitonicSort]") { + std::vector v = {6, 4, 8, 1, 12}; + + SECTION("up") { + std::vector answer = v; + std::sort(answer.begin(), answer.end(), std::less<>()); + BitonicSort>(up, v.begin(), v.end()); + CHECK(v == answer); + } + SECTION("down") { + std::vector answer = v; + std::sort(answer.begin(), answer.end(), std::greater<>()); + BitonicSort>(down, v.begin(), v.end()); + CHECK(v == answer); + } +} diff --git a/L1Trigger/L1TGlobal/interface/AXOL1TLCondition.h b/L1Trigger/L1TGlobal/interface/AXOL1TLCondition.h index e43929711be62..6359213c501e9 100644 --- a/L1Trigger/L1TGlobal/interface/AXOL1TLCondition.h +++ b/L1Trigger/L1TGlobal/interface/AXOL1TLCondition.h @@ -22,7 +22,6 @@ class AXOL1TLTemplate; namespace l1t { - class L1Candidate; class GlobalBoard; // class declaration diff --git a/L1Trigger/L1TGlobal/interface/CaloCondition.h b/L1Trigger/L1TGlobal/interface/CaloCondition.h index c3fba388fc180..e8d1c0a8229b7 100644 --- a/L1Trigger/L1TGlobal/interface/CaloCondition.h +++ b/L1Trigger/L1TGlobal/interface/CaloCondition.h @@ -23,6 +23,7 @@ // user include files // base classes #include "L1Trigger/L1TGlobal/interface/ConditionEvaluation.h" +#include "DataFormats/L1Trigger/interface/L1CandidateFwd.h" // forward declarations class GlobalCondition; @@ -30,8 +31,6 @@ class CaloTemplate; namespace l1t { - class L1Candidate; - class GlobalBoard; // class declaration diff --git a/L1Trigger/L1TGlobal/interface/CorrCondition.h b/L1Trigger/L1TGlobal/interface/CorrCondition.h index 75a83f46b7c82..9ed630e08d675 100644 --- a/L1Trigger/L1TGlobal/interface/CorrCondition.h +++ b/L1Trigger/L1TGlobal/interface/CorrCondition.h @@ -23,6 +23,7 @@ // base classes #include "L1Trigger/L1TGlobal/interface/ConditionEvaluation.h" #include "L1Trigger/L1TGlobal/interface/GlobalScales.h" +#include "DataFormats/L1Trigger/interface/L1CandidateFwd.h" // forward declarations class GlobalCondition; @@ -30,8 +31,6 @@ class CorrelationTemplate; namespace l1t { - class L1Candidate; - class GlobalBoard; // class declaration diff --git a/L1Trigger/L1TGlobal/interface/CorrThreeBodyCondition.h b/L1Trigger/L1TGlobal/interface/CorrThreeBodyCondition.h index 8ac868b3ac051..4ed335400d106 100644 --- a/L1Trigger/L1TGlobal/interface/CorrThreeBodyCondition.h +++ b/L1Trigger/L1TGlobal/interface/CorrThreeBodyCondition.h @@ -23,6 +23,7 @@ // base classes #include "L1Trigger/L1TGlobal/interface/ConditionEvaluation.h" #include "L1Trigger/L1TGlobal/interface/GlobalScales.h" +#include "DataFormats/L1Trigger/interface/L1CandidateFwd.h" // forward declarations class GlobalCondition; @@ -30,8 +31,6 @@ class CorrelationThreeBodyTemplate; namespace l1t { - class L1Candidate; - class GlobalBoard; // class declaration diff --git a/L1Trigger/L1TGlobal/interface/CorrWithOverlapRemovalCondition.h b/L1Trigger/L1TGlobal/interface/CorrWithOverlapRemovalCondition.h index 1afec26030647..fdb76ae570346 100644 --- a/L1Trigger/L1TGlobal/interface/CorrWithOverlapRemovalCondition.h +++ b/L1Trigger/L1TGlobal/interface/CorrWithOverlapRemovalCondition.h @@ -24,6 +24,7 @@ // base classes #include "L1Trigger/L1TGlobal/interface/ConditionEvaluation.h" #include "L1Trigger/L1TGlobal/interface/GlobalScales.h" +#include "DataFormats/L1Trigger/interface/L1CandidateFwd.h" // forward declarations class GlobalCondition; @@ -31,8 +32,6 @@ class CorrelationWithOverlapRemovalTemplate; namespace l1t { - class L1Candidate; - class GlobalBoard; // class declaration diff --git a/L1Trigger/L1TGlobal/interface/EnergySumCondition.h b/L1Trigger/L1TGlobal/interface/EnergySumCondition.h index 7fd8726083399..60bafeadbc151 100644 --- a/L1Trigger/L1TGlobal/interface/EnergySumCondition.h +++ b/L1Trigger/L1TGlobal/interface/EnergySumCondition.h @@ -22,6 +22,7 @@ // user include files // base classes #include "L1Trigger/L1TGlobal/interface/ConditionEvaluation.h" +#include "DataFormats/L1Trigger/interface/L1CandidateFwd.h" // forward declarations class GlobalCondition; @@ -29,8 +30,6 @@ class EnergySumTemplate; namespace l1t { - class L1Candidate; - class GlobalBoard; // class declaration diff --git a/L1Trigger/L1TGlobal/interface/EnergySumZdcCondition.h b/L1Trigger/L1TGlobal/interface/EnergySumZdcCondition.h index c9945e2fe2ebd..56dcae89737b1 100644 --- a/L1Trigger/L1TGlobal/interface/EnergySumZdcCondition.h +++ b/L1Trigger/L1TGlobal/interface/EnergySumZdcCondition.h @@ -22,6 +22,7 @@ // user include files // base classes #include "L1Trigger/L1TGlobal/interface/ConditionEvaluation.h" +#include "DataFormats/L1Trigger/interface/L1CandidateFwd.h" // forward declarations class GlobalCondition; @@ -29,8 +30,6 @@ class EnergySumZdcTemplate; namespace l1t { - class L1Candidate; - class GlobalBoard; // class declaration diff --git a/L1Trigger/L1TGlobal/interface/ExternalCondition.h b/L1Trigger/L1TGlobal/interface/ExternalCondition.h index 0c8837c4210ea..01c5a4a1a8100 100644 --- a/L1Trigger/L1TGlobal/interface/ExternalCondition.h +++ b/L1Trigger/L1TGlobal/interface/ExternalCondition.h @@ -22,6 +22,7 @@ // user include files // base classes #include "L1Trigger/L1TGlobal/interface/ConditionEvaluation.h" +#include "DataFormats/L1Trigger/interface/L1CandidateFwd.h" // forward declarations class GlobalCondition; @@ -29,8 +30,6 @@ class ExternalTemplate; namespace l1t { - class L1Candidate; - class GlobalBoard; // class declaration diff --git a/L1Trigger/L1TGlobal/interface/TOPOCondition.h b/L1Trigger/L1TGlobal/interface/TOPOCondition.h index 24685b3e72f3c..9afdae66fe554 100644 --- a/L1Trigger/L1TGlobal/interface/TOPOCondition.h +++ b/L1Trigger/L1TGlobal/interface/TOPOCondition.h @@ -22,7 +22,6 @@ class TOPOTemplate; namespace l1t { - class L1Candidate; class GlobalBoard; // class declaration diff --git a/L1Trigger/L1THGCalUtilities/src/classes_def.xml b/L1Trigger/L1THGCalUtilities/src/classes_def.xml index 640166291ef6f..04f0d5b0d486e 100644 --- a/L1Trigger/L1THGCalUtilities/src/classes_def.xml +++ b/L1Trigger/L1THGCalUtilities/src/classes_def.xml @@ -1,8 +1,8 @@ - - - + + + - + diff --git a/L1Trigger/Phase2L1ParticleFlow/interface/corrector.h b/L1Trigger/Phase2L1ParticleFlow/interface/corrector.h index def388736fc7b..907d2b149ba24 100644 --- a/L1Trigger/Phase2L1ParticleFlow/interface/corrector.h +++ b/L1Trigger/Phase2L1ParticleFlow/interface/corrector.h @@ -21,59 +21,59 @@ namespace l1tpf { emulate_(false), debug_(false), emulationMode_(l1tpf::corrector::EmulationMode::CorrectedPt) {} - corrector(const std::string &iFile, + corrector(const std::string& iFile, float emfMax = -1, bool debug = false, bool emulate = false, l1tpf::corrector::EmulationMode emulationMode = l1tpf::corrector::EmulationMode::CorrectedPt); - corrector(const std::string &iFile, - const std::string &directory, + corrector(const std::string& iFile, + const std::string& directory, float emfMax = -1, bool debug = false, bool emulate = false, l1tpf::corrector::EmulationMode emulationMode = l1tpf::corrector::EmulationMode::CorrectedPt); - corrector(TDirectory *src, + corrector(TDirectory* src, float emfMax = -1, bool debug = false, bool emulate = false, l1tpf::corrector::EmulationMode emulationMode = l1tpf::corrector::EmulationMode::CorrectedPt); // create an empty corrector (you'll need to fill the graphs later) - corrector(const TH1 *index, float emfMax = -1); + corrector(const TH1* index, float emfMax = -1); ~corrector(); // no copy, but can move - corrector(const corrector &corr) = delete; - corrector &operator=(const corrector &corr) = delete; - corrector(corrector &&corr); - corrector &operator=(corrector &&corr); + corrector(const corrector& corr) = delete; + corrector& operator=(const corrector& corr) = delete; + corrector(corrector&& corr); + corrector& operator=(corrector&& corr); float correctedPt(float et, float emEt, float eta) const; float correctedPt(float et, float eta) const { return correctedPt(et, 0, eta); } - void correctPt(l1t::PFCluster &cluster, float preserveEmEt = true) const; + void correctPt(l1t::PFCluster& cluster, float preserveEmEt = true) const; bool valid() const { return (index_.get() != nullptr); } // set the graph (note: it is cloned, and the corrector owns the clone) - void setGraph(const TGraph &graph, int ieta, int iemf = 0); + void setGraph(const TGraph& graph, int ieta, int iemf = 0); bool is2d() const { return is2d_; } unsigned int neta() const { return neta_; } unsigned int nemf() const { return nemf_; } // access the index histogram - const TH1 &getIndex() const { return *index_; } + const TH1& getIndex() const { return *index_; } // access the graphs (owned by the corrector, may be null) - TGraph *getGraph(int ieta, int iemf = 0) { return corrections_[ieta * nemf_ + iemf]; } - const TGraph *getGraph(int ieta, int iemf = 0) const { return corrections_[ieta * nemf_ + iemf]; } + TGraph* getGraph(int ieta, int iemf = 0) { return corrections_[ieta * nemf_ + iemf]; } + const TGraph* getGraph(int ieta, int iemf = 0) const { return corrections_[ieta * nemf_ + iemf]; } // store the corrector - void writeToFile(const std::string &filename, const std::string &directory) const; + void writeToFile(const std::string& filename, const std::string& directory) const; // store the corrector - void writeToFile(TDirectory *dest) const; + void writeToFile(TDirectory* dest) const; private: std::unique_ptr index_; - std::vector corrections_; - std::vector correctionsEmulated_; + std::vector corrections_; + std::vector correctionsEmulated_; bool is2d_; unsigned int neta_, nemf_; float emfMax_; @@ -81,10 +81,10 @@ namespace l1tpf { bool debug_; l1tpf::corrector::EmulationMode emulationMode_; - void init_(const std::string &iFile, const std::string &directory, bool debug, bool emulate); - void init_(TDirectory *src, bool debug); - void initGraphs_(TDirectory *src, bool debug); - void initEmulation_(TDirectory *src, bool debug); + void init_(const std::string& iFile, const std::string& directory, bool debug, bool emulate); + void init_(TDirectory* src, bool debug); + void initGraphs_(TDirectory* src, bool debug); + void initEmulation_(TDirectory* src, bool debug); }; } // namespace l1tpf #endif