diff --git a/DataFormats/L1Trigger/interface/P2GTAlgoBlock.h b/DataFormats/L1Trigger/interface/P2GTAlgoBlock.h index 0e57ae027c12b..87c73fee53320 100644 --- a/DataFormats/L1Trigger/interface/P2GTAlgoBlock.h +++ b/DataFormats/L1Trigger/interface/P2GTAlgoBlock.h @@ -3,45 +3,55 @@ #include "P2GTCandidate.h" -#include +#include #include -#include namespace l1t { class P2GTAlgoBlock; - typedef std::vector P2GTAlgoBlockCollection; + typedef std::map P2GTAlgoBlockMap; class P2GTAlgoBlock { public: P2GTAlgoBlock() - : algoName_(""), - decisionBeforeBxMaskAndPrescale_(false), + : decisionBeforeBxMaskAndPrescale_(false), decisionBeforePrescale_(false), decisionFinal_(false), + decisionFinalPreview_(false), + isVeto_(false), + triggerTypes_(0), trigObjects_() {} - P2GTAlgoBlock(std::string name, - bool decisionBeforeBxMaskAndPrescale, + + P2GTAlgoBlock(bool decisionBeforeBxMaskAndPrescale, bool decisionBeforePrescale, bool decisionFinal, + bool decisionFinalPreview, + bool isVeto, + int triggerTypes, P2GTCandidateVectorRef trigObjects) - : algoName_(std::move(name)), - decisionBeforeBxMaskAndPrescale_(decisionBeforeBxMaskAndPrescale), + : decisionBeforeBxMaskAndPrescale_(decisionBeforeBxMaskAndPrescale), decisionBeforePrescale_(decisionBeforePrescale), decisionFinal_(decisionFinal), + decisionFinalPreview_(decisionFinalPreview), + isVeto_(isVeto), + triggerTypes_(triggerTypes), trigObjects_(std::move(trigObjects)) {} - const std::string& algoName() const { return algoName_; } 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 std::string algoName_; const bool decisionBeforeBxMaskAndPrescale_; const bool decisionBeforePrescale_; const bool decisionFinal_; + const bool decisionFinalPreview_; + const bool isVeto_; + const int triggerTypes_; const P2GTCandidateVectorRef trigObjects_; }; diff --git a/DataFormats/L1Trigger/interface/P2GTCandidate.h b/DataFormats/L1Trigger/interface/P2GTCandidate.h index 1f385b12816f0..a0d8867f55554 100644 --- a/DataFormats/L1Trigger/interface/P2GTCandidate.h +++ b/DataFormats/L1Trigger/interface/P2GTCandidate.h @@ -31,8 +31,9 @@ namespace l1t { typedef ap_int<13> hwPhi_t; typedef ap_int<14> hwEta_t; typedef ap_int<18> hwZ0_t; - typedef ap_uint<11> hwIso_t; - typedef ap_uint<8> hwQual_t; + typedef ap_uint<11> hwIsolationPT_t; + typedef ap_uint<4> 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; @@ -40,7 +41,7 @@ namespace l1t { typedef ap_uint<16> hwIndex_t; typedef ap_uint<10> hwSeed_pT_t; typedef ap_int<10> hwSeed_z0_t; - typedef ap_uint<16> hwSca_sum_t; + typedef ap_uint<16> hwScalarSumPT_t; typedef ap_uint<5> hwNumber_of_tracks_t; typedef ap_uint<12> hwSum_pT_pv_t; typedef ap_uint<2> hwType_t; @@ -82,11 +83,14 @@ namespace l1t { GTTRhoCandidates, GTTBsCandidates, GTTHadronicTaus, + GTTPromptTracks, + GTTDisplacedTracks, GTTPrimaryVert, GTTPromptHtSum, GTTDisplacedHtSum, GTTEtSum, - CL2Jets, + CL2JetsSC4, + CL2JetsSC8, CL2Taus, CL2Electrons, CL2Photons, @@ -98,8 +102,9 @@ namespace l1t { 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 setHwIso(hwIso_t hwIso) { hwIso_ = hwIso.to_int(); } - void setHwQual(hwQual_t hwQual) { hwQual_ = hwQual.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(); } @@ -107,7 +112,7 @@ namespace l1t { 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 setHwSca_sum(hwSca_sum_t hwSca_sum) { hwSca_sum_ = hwSca_sum.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(); } @@ -149,18 +154,25 @@ namespace l1t { return static_cast(hwZ0_); } - hwIso_t hwIso() const { - if (!hwIso_) { - throw std::invalid_argument("Object doesn't have iso"); + hwIsolationPT_t hwIsolationPT() const { + if (!hwIsolationPT_) { + throw std::invalid_argument("Object doesn't have isolationPT"); } - return static_cast(hwIso_); + return static_cast(hwIsolationPT_); } - hwQual_t hwQual() const { - if (!hwQual_) { - throw std::invalid_argument("Object doesn't have qual"); + hwQualityFlags_t hwQualityFlags() const { + if (!hwQualityFlags_) { + throw std::invalid_argument("Object doesn't have qualityFlags"); } - return static_cast(hwQual_); + return static_cast(hwQualityFlags_); + } + + hwQualityScore_t hwQualityScore() const { + if (!hwQualityScore_) { + throw std::invalid_argument("Object doesn't have qualityScore"); + } + return static_cast(hwQualityScore_); } hwCharge_t hwCharge() const { @@ -212,11 +224,11 @@ namespace l1t { return static_cast(hwSeed_z0_); } - hwSca_sum_t hwSca_sum() const { - if (!hwSca_sum_) { - throw std::invalid_argument("Object doesn't have sca_sum"); + hwScalarSumPT_t hwScalarSumPT() const { + if (!hwScalarSumPT_) { + throw std::invalid_argument("Object doesn't have scalarSumPT"); } - return static_cast(hwSca_sum_); + return static_cast(hwScalarSumPT_); } hwNumber_of_tracks_t hwNumber_of_tracks() const { @@ -261,8 +273,9 @@ namespace l1t { 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 hwIso_toInt() const { return hwIso().to_int(); } - int hwQual_toInt() const { return hwQual().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(); } @@ -270,7 +283,7 @@ namespace l1t { 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 hwSca_sum_toInt() const { return hwSca_sum().to_int(); } + int hwScalarSumPT_toInt() const { return hwScalarSumPT().to_int(); } int hwNumber_of_tracks_toInt() const { return hwNumber_of_tracks().to_int(); } int hwSum_pT_pv_toInt() const { return hwSum_pT_pv().to_int(); } int hwType_toInt() const { return hwType().to_int(); } @@ -296,7 +309,7 @@ namespace l1t { bool isJet() const override { return objectType_ == GCTJets || objectType_ == GTTPromptJets || objectType_ == GTTDisplacedJets || - objectType_ == CL2Jets; + objectType_ == CL2JetsSC4 || objectType_ == CL2JetsSC8; } private: @@ -304,8 +317,9 @@ namespace l1t { Optional hwPhi_; Optional hwEta_; Optional hwZ0_; - Optional hwIso_; - Optional hwQual_; + Optional hwIsolationPT_; + Optional hwQualityFlags_; + Optional hwQualityScore_; Optional hwCharge_; Optional hwD0_; Optional hwBeta_; @@ -313,7 +327,7 @@ namespace l1t { Optional hwIndex_; Optional hwSeed_pT_; Optional hwSeed_z0_; - Optional hwSca_sum_; + Optional hwScalarSumPT_; Optional hwNumber_of_tracks_; // TODO ? diff --git a/DataFormats/L1Trigger/src/P2GTCandidate.cc b/DataFormats/L1Trigger/src/P2GTCandidate.cc index 42513681fcc9f..bdee357c39a3e 100644 --- a/DataFormats/L1Trigger/src/P2GTCandidate.cc +++ b/DataFormats/L1Trigger/src/P2GTCandidate.cc @@ -3,22 +3,15 @@ namespace l1t { bool P2GTCandidate::operator==(const P2GTCandidate& rhs) const { - return hwPT_ == rhs.hwPT_ && hwPhi_ == rhs.hwPhi_ && hwEta_ == rhs.hwEta_ && hwZ0_ == rhs.hwZ0_ && - hwIso_ == rhs.hwIso_ && hwQual_ == rhs.hwQual_ && hwCharge_ == rhs.hwCharge_ && hwD0_ == rhs.hwD0_ && + return objectType_ == rhs.objectType_ && hwPT_ == rhs.hwPT_ && hwPhi_ == rhs.hwPhi_ && hwEta_ == rhs.hwEta_ && + hwZ0_ == rhs.hwZ0_ && hwIsolationPT_ == rhs.hwIsolationPT_ && hwQualityScore_ == rhs.hwQualityScore_ && + hwQualityFlags_ == rhs.hwQualityFlags_ && hwCharge_ == rhs.hwCharge_ && hwD0_ == rhs.hwD0_ && hwBeta_ == rhs.hwBeta_ && hwMass_ == rhs.hwMass_ && hwIndex_ == rhs.hwIndex_ && - hwSeed_pT_ == rhs.hwSeed_pT_ && hwSeed_z0_ == rhs.hwSeed_z0_ && hwSca_sum_ == rhs.hwSca_sum_ && + hwSeed_pT_ == rhs.hwSeed_pT_ && hwSeed_z0_ == rhs.hwSeed_z0_ && hwScalarSumPT_ == rhs.hwScalarSumPT_ && hwNumber_of_tracks_ == rhs.hwNumber_of_tracks_ && hwSum_pT_pv_ == rhs.hwSum_pT_pv_ && hwType_ == rhs.hwType_ && hwNumber_of_tracks_in_pv_ == rhs.hwNumber_of_tracks_in_pv_ && hwNumber_of_tracks_not_in_pv_ == rhs.hwNumber_of_tracks_not_in_pv_; } - bool P2GTCandidate::operator!=(const P2GTCandidate& rhs) const { - return hwPT_ != rhs.hwPT_ && hwPhi_ != rhs.hwPhi_ && hwEta_ != rhs.hwEta_ && hwZ0_ != rhs.hwZ0_ && - hwIso_ != rhs.hwIso_ && hwQual_ != rhs.hwQual_ && hwCharge_ != rhs.hwCharge_ && hwD0_ != rhs.hwD0_ && - hwBeta_ != rhs.hwBeta_ && hwMass_ != rhs.hwMass_ && hwIndex_ != rhs.hwIndex_ && - hwSeed_pT_ != rhs.hwSeed_pT_ && hwSeed_z0_ != rhs.hwSeed_z0_ && hwSca_sum_ != rhs.hwSca_sum_ && - hwNumber_of_tracks_ != rhs.hwNumber_of_tracks_ && hwSum_pT_pv_ != rhs.hwSum_pT_pv_ && - hwType_ != rhs.hwType_ && hwNumber_of_tracks_in_pv_ != rhs.hwNumber_of_tracks_in_pv_ && - hwNumber_of_tracks_not_in_pv_ != rhs.hwNumber_of_tracks_not_in_pv_; - }; + bool P2GTCandidate::operator!=(const P2GTCandidate& rhs) const { return !operator==(rhs); }; } // namespace l1t diff --git a/DataFormats/L1Trigger/src/classes_def.xml b/DataFormats/L1Trigger/src/classes_def.xml index eb57594354729..3b76a6164b287 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -16,8 +16,9 @@ - - + + + @@ -27,9 +28,12 @@ - - - + + + + + + diff --git a/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc b/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc index 7a1acc02db6e4..85574dcfaac3e 100644 --- a/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc +++ b/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc @@ -47,7 +47,7 @@ HLTDoubletDZ::HLTDoubletDZ(const edm::Pa originTag2_(iConfig.getParameter>("originTag2")), electronToken_(edm::EDGetTokenT()), l1GTAlgoBlockTag_(iConfig.template getParameter("l1GTAlgoBlockTag")), - algoBlockToken_(consumes>(l1GTAlgoBlockTag_)), + algoBlockToken_(consumes(l1GTAlgoBlockTag_)), l1GTAlgoName1_(iConfig.template getParameter("l1GTAlgoName1")), l1GTAlgoName2_(iConfig.template getParameter("l1GTAlgoName2")), triggerType1_(iConfig.getParameter("triggerType1")), @@ -394,29 +394,26 @@ bool HLTDoubletDZ::getCollections( std::vector& coll1, std::vector& coll2, trigger::TriggerFilterObjectWithRefs& filterproduct) const { - const std::vector& algos = iEvent.get(algoBlockToken_); - - if (!algos.empty()) { - for (const l1t::P2GTAlgoBlock& algo : algos) { - if (algo.algoName() == l1GTAlgoName1_ && algo.decisionBeforeBxMaskAndPrescale()) { - const l1t::P2GTCandidateVectorRef& objects = algo.trigObjects(); - for (const l1t::P2GTCandidateRef& obj : objects) { - if ((triggerType1_ == trigger::TriggerObjectType::TriggerL1TkMu && obj->isMuon()) || - (triggerType1_ == trigger::TriggerObjectType::TriggerL1TkEle && obj->isElectron()) || - (triggerType1_ == trigger::TriggerObjectType::TriggerL1TkEm && obj->isPhoton())) { - coll1.push_back(obj); - } - } + const l1t::P2GTAlgoBlockMap& algos = iEvent.get(algoBlockToken_); + + if (algos.count(l1GTAlgoName1_) > 0 && algos.at(l1GTAlgoName1_).decisionBeforeBxMaskAndPrescale()) { + const l1t::P2GTCandidateVectorRef& objects = algos.at(l1GTAlgoName1_).trigObjects(); + for (const l1t::P2GTCandidateRef& obj : objects) { + if ((triggerType1_ == trigger::TriggerObjectType::TriggerL1TkMu && obj->isMuon()) || + (triggerType1_ == trigger::TriggerObjectType::TriggerL1TkEle && obj->isElectron()) || + (triggerType1_ == trigger::TriggerObjectType::TriggerL1TkEm && obj->isPhoton())) { + coll1.push_back(obj); } - if (algo.algoName() == l1GTAlgoName2_ && algo.decisionBeforeBxMaskAndPrescale()) { - const l1t::P2GTCandidateVectorRef& objects = algo.trigObjects(); - for (const l1t::P2GTCandidateRef& obj : objects) { - if ((triggerType2_ == trigger::TriggerObjectType::TriggerL1TkMu && obj->isMuon()) || - (triggerType2_ == trigger::TriggerObjectType::TriggerL1TkEle && obj->isElectron()) || - (triggerType2_ == trigger::TriggerObjectType::TriggerL1TkEm && obj->isPhoton())) { - coll2.push_back(obj); - } - } + } + } + + if (algos.count(l1GTAlgoName2_) > 0 && algos.at(l1GTAlgoName2_).decisionBeforeBxMaskAndPrescale()) { + const l1t::P2GTCandidateVectorRef& objects = algos.at(l1GTAlgoName2_).trigObjects(); + for (const l1t::P2GTCandidateRef& obj : objects) { + if ((triggerType2_ == trigger::TriggerObjectType::TriggerL1TkMu && obj->isMuon()) || + (triggerType2_ == trigger::TriggerObjectType::TriggerL1TkEle && obj->isElectron()) || + (triggerType2_ == trigger::TriggerObjectType::TriggerL1TkEm && obj->isPhoton())) { + coll2.push_back(obj); } } } diff --git a/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.h b/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.h index 1dcab21e69fe4..e2e672403a327 100644 --- a/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.h +++ b/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.h @@ -57,7 +57,7 @@ class HLTDoubletDZ : public HLTFilter { const edm::EDGetTokenT inputToken2_; const edm::EDGetTokenT electronToken_; const edm::InputTag l1GTAlgoBlockTag_; - const edm::EDGetTokenT> algoBlockToken_; + const edm::EDGetTokenT algoBlockToken_; const std::string l1GTAlgoName1_; const std::string l1GTAlgoName2_; const int triggerType1_; diff --git a/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.cc b/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.cc index 1a4c07aa01b18..1ef02debe0888 100644 --- a/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.cc +++ b/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.cc @@ -29,7 +29,7 @@ HLTMuonTrkL1TkMuFilter::HLTMuonTrkL1TkMuFilter(const edm::ParameterSet& iConfig) m_candsTag = iConfig.getParameter("inputCandCollection"); m_candsToken = consumes(m_candsTag); m_l1GTAlgoBlockTag = iConfig.getParameter("l1GTAlgoBlockTag"); - m_algoBlockToken = consumes>(m_l1GTAlgoBlockTag); + m_algoBlockToken = consumes(m_l1GTAlgoBlockTag); m_l1GTAlgoNames = iConfig.getParameter>("l1GTAlgoNames"); m_minTrkHits = iConfig.getParameter("minTrkHits"); m_minMuonHits = iConfig.getParameter("minMuonHits"); @@ -76,16 +76,14 @@ bool HLTMuonTrkL1TkMuFilter::hltFilter(edm::Event& iEvent, if (m_l1GTAlgoBlockTag == edm::InputTag("") || m_l1GTAlgoNames.empty()) check_l1match = false; if (check_l1match) { - const std::vector& algos = iEvent.get(m_algoBlockToken); - for (const l1t::P2GTAlgoBlock& algo : algos) { - for (auto& algoName : m_l1GTAlgoNames) { - if (algo.algoName() == algoName && algo.decisionBeforeBxMaskAndPrescale()) { - const l1t::P2GTCandidateVectorRef& objects = algo.trigObjects(); - for (const l1t::P2GTCandidateRef& obj : objects) { - if (obj->objectType() == l1t::P2GTCandidate::ObjectType::GMTTkMuons) { - vl1cands.push_back(obj); - LogDebug("HLTMuonTrkL1TkMuFilter") << "Found P2GTCandidate ObjectType::GMTTkMuons" << std::endl; - } + const l1t::P2GTAlgoBlockMap& algos = iEvent.get(m_algoBlockToken); + for (auto& algoName : m_l1GTAlgoNames) { + if (algos.count(algoName) > 0 && algos.at(algoName).decisionBeforeBxMaskAndPrescale()) { + const l1t::P2GTCandidateVectorRef& objects = algos.at(algoName).trigObjects(); + for (const l1t::P2GTCandidateRef& obj : objects) { + if (obj->objectType() == l1t::P2GTCandidate::ObjectType::GMTTkMuons) { + vl1cands.push_back(obj); + LogDebug("HLTMuonTrkL1TkMuFilter") << "Found P2GTCandidate ObjectType::GMTTkMuons" << std::endl; } } } diff --git a/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.h b/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.h index dcd96c300d7c6..c464dd28c4461 100644 --- a/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.h +++ b/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.h @@ -29,7 +29,7 @@ class HLTMuonTrkL1TkMuFilter : public HLTFilter { edm::InputTag m_candsTag; // input collection of candidates to be referenced edm::EDGetTokenT m_candsToken; // input collection of candidates to be referenced edm::InputTag m_l1GTAlgoBlockTag; - edm::EDGetTokenT> m_algoBlockToken; + edm::EDGetTokenT m_algoBlockToken; std::vector m_l1GTAlgoNames; int m_minTrkHits; int m_minMuonHits; diff --git a/L1Trigger/Configuration/python/Phase2GTMenus/SeedDefinitions/prototypeSeeds.py b/L1Trigger/Configuration/python/Phase2GTMenus/SeedDefinitions/prototypeSeeds.py index 5dc0c060a7eb4..def3cf3098e67 100644 --- a/L1Trigger/Configuration/python/Phase2GTMenus/SeedDefinitions/prototypeSeeds.py +++ b/L1Trigger/Configuration/python/Phase2GTMenus/SeedDefinitions/prototypeSeeds.py @@ -1,4 +1,10 @@ # Concatenate prototype menu seeds somewhere easy to handle +from L1Trigger.Phase2L1GT.l1tGTMenu_lepSeeds_cff import * + from L1Trigger.Phase2L1GT.l1tGTMenu_hadr_metSeeds_cff import * -from L1Trigger.Phase2L1GT.l1tGTMenu_lepSeeds_cff import * \ No newline at end of file +from L1Trigger.Phase2L1GT.l1tGTMenu_crossLepSeeds_cff import * + +from L1Trigger.Phase2L1GT.l1tGTMenu_hadr_crossLepSeeds_cff import * + +from L1Trigger.Phase2L1GT.l1tGTMenu_BTagSeeds_cff import * diff --git a/L1Trigger/Phase2L1GT/README.md b/L1Trigger/Phase2L1GT/README.md new file mode 100644 index 0000000000000..8feb6f1359efa --- /dev/null +++ b/L1Trigger/Phase2L1GT/README.md @@ -0,0 +1,198 @@ +# Menu configuration manual + +## Conditions + +The basic building blocks of a Phase-2 Global Trigger menu are conditions. In order to start writing a menu one should first pull the standard definitions for the conditions into the configuration. These standard definitions contain the scale parameters (c.f. [l1tGTScales.py](python/l1tGTScales.py)) as well as the values for the $\cos$ and $\cosh$ LUT (computed in [l1tGTSingleInOutLUT.py](python/l1tGTSingleInOutLUT.py)). + +```python +from L1Trigger.Phase2L1GT.l1tGTSingleObjectCond_cfi import l1tGTSingleObjectCond +from L1Trigger.Phase2L1GT.l1tGTDoubleObjectCond_cfi import l1tGTDoubleObjectCond +from L1Trigger.Phase2L1GT.l1tGTTripleObjectCond_cfi import l1tGTTripleObjectCond +from L1Trigger.Phase2L1GT.l1tGTQuadObjectCond_cfi import l1tGTQuadObjectCond +``` +One can utilize the standard definitions by invoking the `clone` function and specifying a cut configuration as well as the collection(s) the condition should act on. This is done by setting the corresponding input tag(s) to use, `tag = cms.InputTag("l1tGTProducer", "XXX")`, with `XXX` as the collection name. Available collections are: + +| GCT | GMT | GTT | Correlator Layer 2 | +|:-----|:----------|:-------------|:--------| +| ~~`GCTNonIsoEg`~~ | `GMTSaPromptMuons` | `GTTPromptJets` | `CL2JetsSC4` | +| ~~`GCTIsoEg`~~ | `GMTSaDisplacedMuons` | `GTTDisplacedJets` | `CL2JetsSC8` | +| ~~`GCTJets`~~ | `GMTTkMuons` | ~~`GTTPhiCandidates`~~ | `CL2Taus` | +| ~~`GCTTaus`~~ | ~~`GMTTopo`~~ | ~~`GTTRhoCandidates`~~ | `CL2Electrons` | +| ~~`GCTHtSum`~~ | | ~~`GTTBsCandidates`~~ | `CL2Photons` | +| ~~`GCTEtSum`~~ | | ~~`GTTHadronicTaus`~~ | `CL2HtSum` | +| | | `GTTPrimaryVert` | `CL2EtSum` | +| | | ~~`GTTPromptHtSum`~~ | | +| | | ~~`GTTDisplacedHtSum`~~ | | +| | | ~~`GTTEtSum`~~ | | + +~~`XXX`~~: Not yet available from upstream emulator. + +A condition can have any number of cuts. Cuts omitted from the configuration are regarded as disabled. They can either be applied to single objects of a collection or to topological correlations within one or between multiple collections. In general the configuration follows an ambiguity scheme, as long as there are no ambiguities the configuration should be specified in the top level `PSet`. If there are ambiguities the configuration requires either a `collectionX` sub `PSet` for single object cuts or a `correlXY`/`correlXYZ` sub `PSet` for correlations. For illustration the following shows some examples: + +```python +process.SingleTkMuon22 = l1tGTSingleObjectCond.clone( + # No ambiguities, thus everything in the top level PSet + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + maxAbsEta = cms.double(2.4), + regionsAbsEtaLowerBounds = cms.vdouble(0, 0.83, 1.24), + regionsMinPt = cms.vdouble(20, 20, 20) +) +``` + +```python +process.DoubleTkEle2512 = l1tGTDoubleObjectCond.clone( + # 2 single cuts, thus cuts are ambiguous and require collectionX PSets. + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), + minPt = cms.double(20), + maxAbsEta = cms.double(2.4), + regionsAbsEtaLowerBounds = cms.vdouble(0, 1.479), + regionsQualityFlags = cms.vuint32(0b0010, 0b0000) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), + minPt = cms.double(9), + maxAbsEta = cms.double(2.4), + regionsAbsEtaLowerBounds = cms.vdouble(0, 1.479), + regionsQualityFlags = cms.vuint32(0b0010, 0b0000) + ), + # Correlation can only be between 1 and 2 -> no ambiguities + maxDz = cms.double(1), +) +``` + +```python +process.TripleTkMuon533 = l1tGTTripleObjectCond.clone( + # 3 single cuts, thus cuts are ambiguous and require collectionX PSets. + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minPt = cms.double(5), + maxAbsEta = cms.double(2.4), + minQualityScore = cms.uint32(0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minPt = cms.double(3), + maxAbsEta = cms.double(2.4), + minQualityScore = cms.uint32(0) + ), + collection3 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minPt = cms.double(3), + maxAbsEta = cms.double(2.4), + minQualityScore = cms.uint32(0) + ), + # Correlations are ambiguous (can be {1,2}, {1,3}, or {2,3}), correlXY PSets are thus required. + correl12 = cms.PSet( + maxDz = cms.double(1) + ), +) +``` + +### Single cuts + +Possible cuts on single quantities are: + +| Name | Expression | Datatype | Hardware conversion | +|:-----|:----------:|:-------------:|:--------:| +| `minPt` | $p_T > X$ or $\| \sum \vec p_T \| > X$ | `cms.double` | `floor(X / pT_lsb)` | +| `maxPt` | $p_T < X$ or $\| \sum \vec p_T \| < X$ | `cms.double` | `ceil(X / pT_lsb)` | +| `minEta` | $\eta > X$ | `cms.double` | `floor(X / eta_lsb)` | +| `maxEta` | $\eta < X$ | `cms.double` | `ceil(X / eta_lsb)` | +| `minPhi` | $\phi > X$ | `cms.double` | `floor(X / phi_lsb)` | +| `maxPhi` | $\phi < X$ | `cms.double` | `ceil(X / phi_lsb)` | +| `minZ0` | $z_0 > X$ | `cms.double` | `floor(X / z0_lsb)` | +| `maxZ0` | $z_0 < X$ | `cms.double` | `ceil(X / z0_lsb)` | +| `minScalarSumPt` | $\sum p_T > X$ | `cms.double` | `floor(X / scalarSumPT_lsb)` | +| `maxScalarSumPt` | $\sum p_T < X$ | `cms.double` | `ceil(X / scalarSumPT_lsb)` | +| `minQualityScore` | $\mathrm{qualityScore} > X$ | `cms.uint32` | `X` | +| `maxQualityScore` | $\mathrm{qualityScore} < X$ | `cms.uint32` | `X` | +| `qualityFlags` | $\mathrm{qualityFlags} \wedge X = X$ | `cms.uint32` | `X` | +| `minAbsEta` | $\| \eta \| > X $ | `cms.double` | `floor(X / eta_lsb)` | +| `maxAbsEta` | $\| \eta \| < X $ | `cms.double` | `ceil(X / eta_lsb)` | +| `minIsolationPt` | $\mathrm{isolationPT} > X$ | `cms.double` | `floor(X / isolationPT_lsb)` | +| `maxIsolationPt` | $\mathrm{isolationPT} < X$ | `cms.double` | `ceil(X / isolationPT_lsb)` | +| `minRelIsolationPt` | $\mathrm{isolationPT} > X \cdot p_T$ | `cms.double` | `floor(X * pT_lsb * 2**18 / isolationPT)` | +| `maxRelIsolationPt` | $\mathrm{isolationPT} < X \cdot p_T$ | `cms.double` | `ceil(X * pT_lsb * 2**18 / isolationPT)` | +| `minPrimVertDz`* | $\| z_0 - Z_{0,i} \| > X $ | `cms.double` | `floor(X / z0_lsb)` | +| `maxPrimVertDz`* | $\| z_0 - Z_{0,i} \| < X $ | `cms.double` | `ceil(X / z0_lsb)` | + +\* : To select a $Z_0$ index $i$ from the `GTTPrimaryVert` collection for the comparison use `primVertex = cms.uint32(i)`. This parameter is mandatory when using a `maxPrimVertDz` cut. + +### $\eta$-regional cuts + +Certain cuts can also be specified $\eta$-region dependent, to allow different thresholds in different regions. In order to use this feature, one has to first provide the lower bounds for the regions via `regionsAbsEtaLowerBounds`. This parameter takes an `cms.vdouble`, whose length determines the number of $\eta$-regions. A region then ranges from the specified lower bound (inclusive) up to the next region's lower bound (exclusive). The last region's upper bound is always the maximum allowed $|\eta| = 2\pi$. One can use additional global $\eta$ or $|\eta|$ cuts to exclude large $|\eta|$ values, effectively overriding the last region's upper bound. The following cuts can be specified per each $\eta$-region: + +| Name | Expression | Datatype | Hardware conversion | +|:-----|:----------:|:-------------:|:--------:| +| `regionsMinPt` | $p_T > X$ or $\| \sum \vec p_T \| > X$ | `cms.vdouble` | `floor(X / pT_lsb)` | +| `regionsQualityFlags` | $\mathrm{qualityFlags} \wedge X = X$ | `cms.vuint32` | `X` | +| `regionsMaxRelIsolationPt` | $\mathrm{isolationPT} < X \cdot p_T$ | `cms.vdouble` | `ceil(X * pT_lsb * 2**18 / isolationPT)` | + +Note: The vector parameters for the $\eta$-region cuts must have the same length as the number of $\eta$-regions initially set via `regionsAbsEtaLowerBounds`. + +### Correlational cuts + +Cuts can also be performed on topological correlations. The following 2-body correlational cuts are available: + +| Name | Expression | Datatype | Hardware conversion | +|:-----|:----------:|:-------------:|:--------:| +| `minDEta` | $\|\eta_1 - \eta_2\| > X$ | `cms.double` | `floor(X / eta_lsb)` | +| `maxDEta` | $\|\eta_1 - \eta_2\| < X$ | `cms.double` | `ceil(X / eta_lsb)` | +| `minDPhi` | $\Delta \phi > X$ | `cms.double` | `floor(X / phi_lsb)` | +| `maxDPhi` | $\Delta \phi < X$ | `cms.double` | `ceil(X / phi_lsb)` | +| `minDz` | $\|z_{0,1} - z_{0,2}\| > X$ | `cms.double` | `floor(X / z0_lsb)` | +| `maxDz` | $\|z_{0,1} - z_{0,2}\| < X$ | `cms.double` | `ceil(X / z0_lsb)` | +| `minDR` | $\Delta \phi ^2 + \Delta \eta^2 > X^2$ | `cms.double` | `floor(X**2 / eta_lsb**2)` | +| `maxDR` | $\Delta \phi ^2 + \Delta \eta^2 < X^2$ | `cms.double` | `ceil(X**2 / eta_lsb**2)` | +| `minInvMass` | $p_{T,1} \, p_{T,2} \left[ \cosh(\Delta \eta) - \cos(\Delta \phi) \right] > X^2/2$ | `cms.double` | `floor(X**2 * LUT_Scale / (2 * pT_lsb**2))` | +| `maxInvMass` | $p_{T,1} \, p_{T,2} \left[ \cosh(\Delta \eta) - \cos(\Delta \phi) \right] < X^2/2$ | `cms.double` | `ceil(X**2 * LUT_Scale / (2 * pT_lsb**2))` | +| `minTransMass` | $p_{T,1} \, p_{T,2} \left[1 - \cos(\Delta \phi) \right] > X^2/2$ | `cms.double` | `floor(X**2 * LUT_Scale / (2 * pT_lsb**2))` | +| `maxTransMass` | $p_{T,1} \, p_{T,2} \left[1 - \cos(\Delta \phi) \right] < X^2/2$ | `cms.double` | `ceil(X**2 * LUT_Scale / (2 * pT_lsb**2))` | +| `minCombPt` | $p_{T,1}^2 + p_{T,2}^2 + 2 p_{T,1} \, p_{T,2} \cos(\Delta \phi) > X^2$ | `cms.double` | `floor(X**2 * LUT_Scale / pT_lsb**2)` | +| `maxCombPt` | $p_{T,1}^2 + p_{T,2}^2 + 2 p_{T,1} \, p_{T,2} \cos(\Delta \phi) < X^2$ | `cms.double` | `ceil(X**2 * LUT_Scale / pT_lsb**2)` | +| `minInvMassOverDR` | $m^2/2 > X^2 \cdot \Delta R^2/2$ | `cms.double` | `floor(X**2 * LUT_Scale * 2**19 * eta_lsb**2 / (2 * pT_lsb**2))` | +| `maxInvMassOverDR` | $m^2/2 < X^2 \cdot \Delta R^2/2$ | `cms.double` | `ceil(X**2 * LUT_Scale * 2**19 * eta_lsb**2 / (2 * pT_lsb**2))` | +| `os` | $q_1 \neq q_2$ | `cms.bool` | | +| `ss` | $q_1 = q_2$ | `cms.bool` | | + +Note: $\Delta \eta = |\eta_1 - \eta_2|$, $\Delta \phi$ is the smallest angle between two legs, also taking into account that $\phi$ wraps around i.e. $\phi = \pi = - \pi$. + +The following 3-body correlational cuts are available: + +| Name | Expression | Datatype | Hardware conversion | +|:-----|:----------:|:-------------:|:--------:| +| `minInvMass` | $\frac{m_{1,2}^2}{2} + \frac{m_{1,3}^2}{2} + \frac{m_{2,3}^2}{2} > \frac{X^2}{2}$ | `cms.double` | `floor(X**2 * LUT_Scale / (2 * pT_lsb**2))` | +| `maxInvMass` | $\frac{m_{1,2}^2}{2} + \frac{m_{1,3}^2}{2} + \frac{m_{2,3}^2}{2} < \frac{X^2}{2}$ | `cms.double` | `ceil(X**2 * LUT_Scale / (2 * pT_lsb**2))` | +| `minTransMass` | $\frac{m_{T,1,2}^2}{2} + \frac{m_{T,1,3}^2}{2} + \frac{m_{T,2,3}^2}{2} > \frac{X^2}{2}$ | `cms.double` | `floor(X**2 * LUT_Scale / (2 * pT_lsb**2))` | +| `maxTransMass` | $\frac{m_{T,1,2}^2}{2} + \frac{m_{T,1,3}^2}{2} + \frac{m_{T,2,3}^2}{2} < \frac{X^2}{2}$ | `cms.double` | `ceil(X**2 * LUT_Scale / (2 * pT_lsb**2))` | + +## Algorithms + +Conditions are combined to algorithms via the [`L1GTAlgoBlockProducer`](plugins/L1GTAlgoBlockProducer.cc). To configure this behavior, a `cms.PSet` algorithm configuration should be added to the `algorithms` `cms.VPset`, included via: + +```python +from L1Trigger.Phase2L1GT.l1tGTAlgoBlockProducer_cff import algorithms +``` +A minimal configuration just includes an `expression` of `cms.Path`s. The available configuration parameters are: + +| Name | Datatype | Description | +|:-----|:----------:|:--------------| +| `name` | `cms.string` | A unique algorithm identifier (default: `expression`) | +| `expression` | `cms.string` | `cms.Path` expression (required) | +| `prescale` | `cms.double` | Prescale value: 0 or in [1, $2^{24} - 1$) (default: 1) | +| `prescalePreview` | `cms.double` | Prescale preview value: 0 or in [1, $2^{24} - 1$) (default: 1) | +| `bunchMask` | `cms.vuint32` | Vector of bunch crossing numbers to mask (default: empty) | +| `triggerTypes` | `cms.vint32` | Vector of trigger type numbers assigned to this algorithm (default: 1) | +| `veto` | `cms.bool` | Indicates whether the algorithm is a veto (default: false) | + +Utilizing the examples from the [Conditions section](#conditions) one could define an algorithm as follows: + +```python +from L1Trigger.Phase2L1GT.l1tGTAlgoBlockProducer_cff import algorithms + +process.pSingleTkMuon22 = cms.Path(process.SingleTkMuon22) +process.pDoubleTkEle25_12 = cms.Path(process.DoubleTkEle2512) + +algorithms.append(cms.PSet(expression = cms.string("pSingleTkMuon22 or pDoubleTkEle25_12"))) +``` diff --git a/L1Trigger/Phase2L1GT/interface/L1GTScales.h b/L1Trigger/Phase2L1GT/interface/L1GTScales.h index f70b0dc31493d..cf1a98047109a 100644 --- a/L1Trigger/Phase2L1GT/interface/L1GTScales.h +++ b/L1Trigger/Phase2L1GT/interface/L1GTScales.h @@ -8,20 +8,23 @@ namespace l1t { class L1GTScales { - static constexpr int RELATIVE_ISOLATION_RESOLUTION = 10; // Resolution = 1/2^RELATIVE_ISOLATION_RESOLUTION - public: + static constexpr int RELATIVE_ISOLATION_RESOLUTION = 18; // Resolution = 1/2^RELATIVE_ISOLATION_RESOLUTION + /* INV_MASS_SQR_OVER_2_DR_SQR_RESOLUTION originates from a simple analysis that yielded that the smallest + delta in hardware values of M^2/(2 dR^2) = 2.93326e-06 => log2(2.93326e-06) = -18.38 */ + static constexpr int INV_MASS_SQR_OVER_2_DR_SQR_RESOLUTION = 19; + L1GTScales(double pT_lsb, double phi_lsb, double eta_lsb, double z0_lsb, //double dD_lsb, - double isolation_lsb, + double isolationPT_lsb, double beta_lsb, double mass_lsb, double seed_pT_lsb, double seed_dZ_lsb, - double sca_sum_lsb, + double scalarSumPT_lsb, double sum_pT_pv_lsb, int pos_chg, int neg_chg); @@ -30,50 +33,73 @@ namespace l1t { static void fillPSetDescription(edm::ParameterSetDescription &); - int to_hw_pT(double value) const { return std::round(value / pT_lsb_); }; - int to_hw_phi(double value) const { return std::round(value / phi_lsb_); }; - int to_hw_eta(double value) const { return std::round(value / eta_lsb_); }; - int to_hw_z0(double value) const { return std::round(value / z0_lsb_); }; - // int to_hw_d0(double value) const { return std::round(value / d0_lsb_); }; - int to_hw_isolation(double value) const { - return std::round(pT_lsb_ * value * std::pow(2, isolation_shift_) / isolation_lsb_); + int to_hw_pT_ceil(double value) const { return std::ceil(value / pT_lsb_); }; + int to_hw_phi_ceil(double value) const { return std::ceil(value / phi_lsb_); }; + int to_hw_eta_ceil(double value) const { return std::ceil(value / eta_lsb_); }; + int to_hw_z0_ceil(double value) const { return std::ceil(value / z0_lsb_); }; + // int to_hw_d0(double value) const { return std::ceil(value / d0_lsb_); }; + int to_hw_relative_isolationPT_ceil(double value) const { + return std::ceil(pT_lsb_ * value * std::pow(2, RELATIVE_ISOLATION_RESOLUTION) / isolationPT_lsb_); } - int to_hw_beta(double value) const { return std::round(value / beta_lsb_); }; - int to_hw_mass(double value) const { return std::round(value / mass_lsb_); }; - int to_hw_seed_pT(double value) const { return std::round(value / seed_pT_lsb_); }; - int to_hw_seed_z0(double value) const { return std::round(value / seed_z0_lsb_); }; - int to_hw_sca_sum(double value) const { return std::round(value / sca_sum_lsb_); }; - int to_hw_sum_pT_pv(double value) const { return std::round(value / sum_pT_pv_lsb_); }; + int to_hw_isolationPT_ceil(double value) const { return std::ceil(value / isolationPT_lsb_); } + int to_hw_beta_ceil(double value) const { return std::ceil(value / beta_lsb_); }; + int to_hw_mass_ceil(double value) const { return std::ceil(value / mass_lsb_); }; + int to_hw_seed_pT_ceil(double value) const { return std::ceil(value / seed_pT_lsb_); }; + int to_hw_seed_z0_ceil(double value) const { return std::ceil(value / seed_z0_lsb_); }; + int to_hw_scalarSumPT_ceil(double value) const { return std::ceil(value / scalarSumPT_lsb_); }; + int to_hw_sum_pT_pv_ceil(double value) const { return std::ceil(value / sum_pT_pv_lsb_); }; - int to_hw_dRSquared(double value) const { return std::round(value * value / (eta_lsb_ * eta_lsb_)); } + int to_hw_dRSquared_ceil(double value) const { return std::ceil(value * value / (eta_lsb_ * eta_lsb_)); } double to_hw_InvMassSqrDiv2(double value) const { return value * value / (2 * pT_lsb_ * pT_lsb_); } double to_hw_TransMassSqrDiv2(double value) const { return value * value / (2 * pT_lsb_ * pT_lsb_); } double to_hw_PtSquared(double value) const { return value * value / (pT_lsb_ * pT_lsb_); } + double to_hw_InvMassSqrOver2DR(double value) const { + return value * value * eta_lsb_ * eta_lsb_ * std::pow(2, INV_MASS_SQR_OVER_2_DR_SQR_RESOLUTION) / + (2 * pT_lsb_ * pT_lsb_); + } + + int to_hw_pT_floor(double value) const { return std::floor(value / pT_lsb_); }; + int to_hw_phi_floor(double value) const { return std::floor(value / phi_lsb_); }; + int to_hw_eta_floor(double value) const { return std::floor(value / eta_lsb_); }; + int to_hw_z0_floor(double value) const { return std::floor(value / z0_lsb_); }; + // int to_hw_d0(double value) const { return std::floor(value / d0_lsb_); }; + int to_hw_relative_isolationPT_floor(double value) const { + return std::floor(pT_lsb_ * value * std::pow(2, RELATIVE_ISOLATION_RESOLUTION) / isolationPT_lsb_); + } + int to_hw_isolationPT_floor(double value) const { return std::floor(value / isolationPT_lsb_); } + int to_hw_beta_floor(double value) const { return std::floor(value / beta_lsb_); }; + int to_hw_mass_floor(double value) const { return std::floor(value / mass_lsb_); }; + int to_hw_seed_pT_floor(double value) const { return std::floor(value / seed_pT_lsb_); }; + int to_hw_seed_z0_floor(double value) const { return std::floor(value / seed_z0_lsb_); }; + int to_hw_scalarSumPT_floor(double value) const { return std::floor(value / scalarSumPT_lsb_); }; + int to_hw_sum_pT_pv_floor(double value) const { return std::floor(value / sum_pT_pv_lsb_); }; + + int to_hw_dRSquared_floor(double value) const { return std::floor(value * value / (eta_lsb_ * eta_lsb_)); } double to_pT(int value) const { return value * pT_lsb_; }; double to_phi(int value) const { return value * phi_lsb_; }; double to_eta(int value) const { return value * eta_lsb_; }; double to_z0(int value) const { return value * z0_lsb_; }; - double to_sca_sum(int value) const { return value * sca_sum_lsb_; }; + double to_isolationPT(int value) const { return value * isolationPT_lsb_; } + double to_scalarSumPT(int value) const { return value * scalarSumPT_lsb_; }; int to_chg(int value) const { return value == pos_chg_ ? +1 : value == neg_chg_ ? -1 : 0; } double pT_lsb() const { return pT_lsb_; } double phi_lsb() const { return phi_lsb_; } double eta_lsb() const { return eta_lsb_; } double z0_lsb() const { return z0_lsb_; } - double isolation_lsb() const { return isolation_lsb_; } + double isolationPT_lsb() const { return isolationPT_lsb_; } //const double dD_lsb_; double beta_lsb() const { return beta_lsb_; } double mass_lsb() const { return mass_lsb_; } double seed_pT_lsb() const { return seed_pT_lsb_; } double seed_z0_lsb() const { return seed_z0_lsb_; } - double sca_sum_lsb() const { return sca_sum_lsb_; } + double scalarSumPT_lsb() const { return scalarSumPT_lsb_; } double sum_pT_pv_lsb() const { return sum_pT_pv_lsb_; } int pos_chg() const { return pos_chg_; } int neg_chg() const { return neg_chg_; } - int isolation_shift() const { return isolation_shift_; } private: const double pT_lsb_; @@ -81,13 +107,12 @@ namespace l1t { const double eta_lsb_; const double z0_lsb_; //const double dD_lsb_; - const double isolation_lsb_; - const double isolation_shift_; + const double isolationPT_lsb_; const double beta_lsb_; const double mass_lsb_; const double seed_pT_lsb_; const double seed_z0_lsb_; - const double sca_sum_lsb_; + const double scalarSumPT_lsb_; const double sum_pT_pv_lsb_; const int pos_chg_; const int neg_chg_; diff --git a/L1Trigger/Phase2L1GT/plugins/L1GT3BodyCut.h b/L1Trigger/Phase2L1GT/plugins/L1GT3BodyCut.h new file mode 100644 index 0000000000000..f0f0174d84596 --- /dev/null +++ b/L1Trigger/Phase2L1GT/plugins/L1GT3BodyCut.h @@ -0,0 +1,192 @@ +#ifndef L1Trigger_Phase2L1GT_L1GT3BodyCut_h +#define L1Trigger_Phase2L1GT_L1GT3BodyCut_h + +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/L1Trigger/interface/P2GTCandidate.h" + +#include "L1Trigger/Phase2L1GT/interface/L1GTInvariantMassError.h" + +#include "L1Trigger/Phase2L1GT/interface/L1GTScales.h" + +#include "L1GTSingleInOutLUT.h" +#include "L1GTOptionalParam.h" + +#include +#include + +namespace l1t { + + class L1GT3BodyCut { + public: + L1GT3BodyCut(const edm::ParameterSet& config, + const edm::ParameterSet& lutConfig, + const L1GTScales& scales, + bool inv_mass_checks = false) + : scales_(scales), + coshEtaLUT_(lutConfig.getParameterSet("cosh_eta_lut")), + coshEtaLUT2_(lutConfig.getParameterSet("cosh_eta_lut2")), + cosPhiLUT_(lutConfig.getParameterSet("cos_phi_lut")), + minInvMassSqrDiv2_(getOptionalParam("minInvMass", + config, + [&](double value) { + return std::round(scales.to_hw_InvMassSqrDiv2(value) * + cosPhiLUT_.output_scale()); + })), + maxInvMassSqrDiv2_(getOptionalParam("maxInvMass", + config, + [&](double value) { + return std::round(scales.to_hw_InvMassSqrDiv2(value) * + cosPhiLUT_.output_scale()); + })), + minTransMassSqrDiv2_(getOptionalParam( + "minTransMass", + config, + [&](double value) { + return std::round(scales.to_hw_TransMassSqrDiv2(value) * cosPhiLUT_.output_scale()); + })), + maxTransMassSqrDiv2_(getOptionalParam( + "maxTransMass", + config, + [&](double value) { + return std::round(scales.to_hw_TransMassSqrDiv2(value) * cosPhiLUT_.output_scale()); + })), + scaleNormalShift_(std::round(std::log2(std::ceil(coshEtaLUT_.output_scale() / coshEtaLUT2_.output_scale())))), + invMassResolutionReduceShift_([&]() { + if (minInvMassSqrDiv2_) { + return std::max( + std::ceil(std::log2(minInvMassSqrDiv2_.value() * cosPhiLUT_.output_scale() + 1.0)) - 16, 0); + } else if (maxInvMassSqrDiv2_) { + return std::max(std::ceil(std::log2(maxInvMassSqrDiv2_.value() * cosPhiLUT_.output_scale())) - 16, + 0); + } else { + return 0; + } + }()), + transMassResolutionReduceShift_([&]() { + if (minTransMassSqrDiv2_) { + return std::max( + std::ceil(std::log2(minTransMassSqrDiv2_.value() * cosPhiLUT_.output_scale() + 1.0)) - 16, 0); + } else if (maxTransMassSqrDiv2_) { + return std::max(std::ceil(std::log2(maxTransMassSqrDiv2_.value() * cosPhiLUT_.output_scale())) - 16, + 0); + } else { + return 0; + } + }()), + inv_mass_checks_(inv_mass_checks) {} + + bool checkObjects(const P2GTCandidate& obj1, + const P2GTCandidate& obj2, + const P2GTCandidate& obj3, + InvariantMassErrorCollection& massErrors) const { + bool res = true; + + if (minInvMassSqrDiv2_ || maxInvMassSqrDiv2_) { + int64_t invMassSqrDiv2 = (calc2BodyInvMass(obj1, obj2, massErrors) >> invMassResolutionReduceShift_) + + (calc2BodyInvMass(obj1, obj3, massErrors) >> invMassResolutionReduceShift_) + + (calc2BodyInvMass(obj2, obj3, massErrors) >> invMassResolutionReduceShift_); + + res &= minInvMassSqrDiv2_ ? invMassSqrDiv2 > minInvMassSqrDiv2_.value() >> invMassResolutionReduceShift_ : true; + res &= maxInvMassSqrDiv2_ ? invMassSqrDiv2 < maxInvMassSqrDiv2_.value() >> invMassResolutionReduceShift_ : true; + } + + if (minTransMassSqrDiv2_ || maxTransMassSqrDiv2_) { + int64_t transMassDiv2 = (calc2BodyTransMass(obj1, obj2) >> transMassResolutionReduceShift_) + + (calc2BodyTransMass(obj1, obj3) >> transMassResolutionReduceShift_) + + (calc2BodyTransMass(obj2, obj3) >> transMassResolutionReduceShift_); + + res &= minTransMassSqrDiv2_ ? transMassDiv2 > minTransMassSqrDiv2_.value() >> transMassResolutionReduceShift_ + : true; + res &= maxTransMassSqrDiv2_ ? transMassDiv2 < maxTransMassSqrDiv2_.value() >> transMassResolutionReduceShift_ + : true; + } + + return res; + } + + static void fillPSetDescription(edm::ParameterSetDescription& desc) { + desc.addOptional("minInvMass"); + desc.addOptional("maxInvMass"); + desc.addOptional("minTransMass"); + desc.addOptional("maxTransMass"); + } + + private: + static constexpr int HW_PI = 1 << (P2GTCandidate::hwPhi_t::width - 1); // assumes phi in [-pi, pi) + + int64_t calc2BodyInvMass(const P2GTCandidate& obj1, + const P2GTCandidate& obj2, + InvariantMassErrorCollection& massErrors) const { + uint32_t dEta = (obj1.hwEta() > obj2.hwEta()) ? obj1.hwEta().to_int() - obj2.hwEta().to_int() + : obj2.hwEta().to_int() - obj1.hwEta().to_int(); + int32_t lutCoshDEta = dEta < L1GTSingleInOutLUT::DETA_LUT_SPLIT + ? coshEtaLUT_[dEta] + : coshEtaLUT2_[dEta - L1GTSingleInOutLUT::DETA_LUT_SPLIT]; + + // Ensure dPhi is always the smaller angle, i.e. always between [0, pi] + uint32_t dPhi = HW_PI - abs(abs(obj1.hwPhi().to_int() - obj2.hwPhi().to_int()) - HW_PI); + + // Optimization: (cos(x + pi) = -cos(x), x in [0, pi)) + int32_t lutCosDPhi = dPhi >= HW_PI ? -cosPhiLUT_[dPhi] : cosPhiLUT_[dPhi]; + + int64_t invMassSqrDiv2; + + if (dEta < L1GTSingleInOutLUT::DETA_LUT_SPLIT) { + // dEta [0, 2pi) + invMassSqrDiv2 = obj1.hwPT().to_int64() * obj2.hwPT().to_int64() * (lutCoshDEta - lutCosDPhi); + } else { + // dEta [2pi, 4pi), ignore cos + invMassSqrDiv2 = obj1.hwPT().to_int64() * obj2.hwPT().to_int64() * lutCoshDEta; + } + + if (inv_mass_checks_) { + double precInvMass = + scales_.pT_lsb() * std::sqrt(2 * obj1.hwPT().to_double() * obj2.hwPT().to_double() * + (std::cosh(dEta * scales_.eta_lsb()) - std::cos(dPhi * scales_.phi_lsb()))); + + double lutInvMass = + scales_.pT_lsb() * std::sqrt(2 * static_cast(invMassSqrDiv2) / + (dEta < L1GTSingleInOutLUT::DETA_LUT_SPLIT ? coshEtaLUT_.output_scale() + : coshEtaLUT2_.output_scale())); + + double error = std::abs(precInvMass - lutInvMass); + massErrors.emplace_back(InvariantMassError{error, error / precInvMass, precInvMass}); + } + + // Normalize scales required due to LUT split in dEta with different scale factors. + return dEta < L1GTSingleInOutLUT::DETA_LUT_SPLIT ? invMassSqrDiv2 : invMassSqrDiv2 << scaleNormalShift_; + } + + int64_t calc2BodyTransMass(const P2GTCandidate& obj1, const P2GTCandidate& obj2) const { + // Ensure dPhi is always the smaller angle, i.e. always between [0, pi] + uint32_t dPhi = HW_PI - abs(abs(obj1.hwPhi().to_int() - obj2.hwPhi().to_int()) - HW_PI); + + // Optimization: (cos(x + pi) = -cos(x), x in [0, pi)) + int32_t lutCosDPhi = dPhi >= HW_PI ? -cosPhiLUT_[dPhi] : cosPhiLUT_[dPhi]; + + return obj1.hwPT().to_int64() * obj2.hwPT().to_int64() * + (static_cast(std::round(cosPhiLUT_.output_scale())) - lutCosDPhi); + } + + const L1GTScales& scales_; + + const L1GTSingleInOutLUT coshEtaLUT_; // [0, 2pi) + const L1GTSingleInOutLUT coshEtaLUT2_; // [2pi, 4pi) + const L1GTSingleInOutLUT cosPhiLUT_; + + const std::optional minInvMassSqrDiv2_; + const std::optional maxInvMassSqrDiv2_; + const std::optional minTransMassSqrDiv2_; + const std::optional maxTransMassSqrDiv2_; + + const int scaleNormalShift_; + const int invMassResolutionReduceShift_; + const int transMassResolutionReduceShift_; + + const bool inv_mass_checks_; + }; + +} // namespace l1t + +#endif // L1Trigger_Phase2L1GT_L1GT3BodyCut_h diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTAlgoBlockProducer.cc b/L1Trigger/Phase2L1GT/plugins/L1GTAlgoBlockProducer.cc index 98991980cd140..73294f78fe714 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTAlgoBlockProducer.cc +++ b/L1Trigger/Phase2L1GT/plugins/L1GTAlgoBlockProducer.cc @@ -8,7 +8,7 @@ #include "DataFormats/Common/interface/View.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/one/EDProducer.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Framework/interface/TriggerNamesService.h" @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -311,32 +312,49 @@ namespace pathStatusExpression { using namespace l1t; -class L1GTAlgoBlockProducer : public edm::stream::EDProducer<> { +class L1GTAlgoBlockProducer + : public edm::one::EDProducer>> { public: explicit L1GTAlgoBlockProducer(const edm::ParameterSet&); ~L1GTAlgoBlockProducer() override = default; static void fillDescriptions(edm::ConfigurationDescriptions&); - void beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) override; - private: struct AlgoDefinition { edm::propagate_const> evaluator_; std::vector pathNames_; std::set> filtModules_; + unsigned int prescale_; + unsigned int prescalePreview_; + std::set bunchMask_; + bool isVeto_; + int triggerTypes_; }; + void init(const edm::ProcessHistory&); void produce(edm::Event&, const edm::EventSetup&) override; + std::shared_ptr> globalBeginRun(edm::Run const&, + edm::EventSetup const&) const override; + + void globalEndRun(edm::Run const&, edm::EventSetup const&) {} edm::GetterOfProducts getterOfPassedReferences_; std::map algoDefinitions_; + bool initialized_ = false; + int bunchCrossingEmu_ = 0; }; void L1GTAlgoBlockProducer::fillDescriptions(edm::ConfigurationDescriptions& description) { edm::ParameterSetDescription algoDesc; algoDesc.add("name", ""); algoDesc.add("expression"); + algoDesc.add("prescale", 1); + algoDesc.add("prescalePreview", 1); + algoDesc.add>("bunchMask", {}); + + algoDesc.add>("triggerTypes", {1}); + algoDesc.add("veto", false); edm::ParameterSetDescription desc; desc.addVPSet("algorithms", algoDesc); @@ -385,21 +403,53 @@ L1GTAlgoBlockProducer::L1GTAlgoBlockProducer(const edm::ParameterSet& config) } definition.evaluator_ = shuntingYardAlgorithm.finish(); + double dPrescale = algoConfig.getParameter("prescale"); + if ((dPrescale < 1. || dPrescale >= std::pow(2, 24) / 100 - 1) && dPrescale != 0) { + throw cms::Exception("Configuration") + << "Prescale value error. Expected prescale value between 1 and 2^24/100 - 1 or 0 got " << dPrescale << "." + << std::endl; + } + + definition.prescale_ = std::round(dPrescale * 100); + + double dPrescalePreview = algoConfig.getParameter("prescalePreview"); + if ((dPrescalePreview < 1. || dPrescalePreview >= std::pow(2, 24) / 100 - 1) && dPrescalePreview != 0) { + throw cms::Exception("Configuration") + << "PrescalePreview value error. Expected prescale value between 1 and 2^24/100 - 1 or 0 got " + << dPrescalePreview << "." << std::endl; + } + + definition.prescalePreview_ = std::round(dPrescalePreview * 100); + + std::vector vBunchMask = algoConfig.getParameter>("bunchMask"); + definition.bunchMask_ = + std::set(std::make_move_iterator(vBunchMask.begin()), std::make_move_iterator(vBunchMask.end())); + + definition.isVeto_ = algoConfig.getParameter("veto"); + definition.triggerTypes_ = 0; + const std::vector triggerTypes = algoConfig.getParameter>("triggerTypes"); + for (int type : triggerTypes) { + definition.triggerTypes_ |= type; + } definition.evaluator_->init(iC); - algoDefinitions_.emplace(std::move(name), std::move(definition)); + auto [iter, wasInserted] = algoDefinitions_.emplace(std::move(name), std::move(definition)); + if (!wasInserted) { + throw cms::Exception("Configuration") + << "Algorithm " << iter->first << " already exists. Algorithm names must be unique." << std::endl; + } } callWhenNewProductsRegistered(getterOfPassedReferences_); - produces(); + produces(); } -void L1GTAlgoBlockProducer::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { +void L1GTAlgoBlockProducer::init(const edm::ProcessHistory& pHistory) { const std::string& pName = edm::Service()->getProcessName(); edm::ProcessConfiguration cfg; - iRun.processHistory().getConfigurationForProcess(pName, cfg); + pHistory.getConfigurationForProcess(pName, cfg); const edm::ParameterSet* pset = edm::pset::Registry::instance()->getMapped(cfg.parameterSetID()); @@ -443,20 +493,67 @@ void L1GTAlgoBlockProducer::beginRun(const edm::Run& iRun, const edm::EventSetup } } +std::shared_ptr> L1GTAlgoBlockProducer::globalBeginRun( + edm::Run const&, edm::EventSetup const&) const { + // Reset prescale counters at the beginning of a new run + return std::make_shared>(); +} + void L1GTAlgoBlockProducer::produce(edm::Event& event, const edm::EventSetup& eventSetup) { + if (!initialized_) { + init(event.processHistory()); + initialized_ = true; + } + std::vector> handles; getterOfPassedReferences_.fillHandles(event, handles); - std::unique_ptr algoCollection = std::make_unique(); - algoCollection->reserve(algoDefinitions_.size()); + std::unique_ptr algoCollection = std::make_unique(); + + std::unordered_map& prescaleCounters = *runCache(event.getRun().index()); + + int bunchCrossing = event.isRealData() ? event.bunchCrossing() : bunchCrossingEmu_ + 1; for (const auto& [name, algoDef] : algoDefinitions_) { - bool initial = algoDef.evaluator_->evaluate(event); - // TODO apply prescale and bunch mask + bool decisionBeforeBxAndPrescale = algoDef.evaluator_->evaluate(event); + bool decisionBeforePrescale = decisionBeforeBxAndPrescale && algoDef.bunchMask_.count(bunchCrossing) == 0; + bool decisionFinal = false; + bool decisionFinalPreview = false; + + if (algoDef.prescale_ != 0 && decisionBeforePrescale) { + if (prescaleCounters.count(name) > 0) { + prescaleCounters[name] += 100; + } else { + prescaleCounters[name] = 100; + } + + if (prescaleCounters[name] >= algoDef.prescale_) { + decisionFinal = true; + prescaleCounters[name] -= algoDef.prescale_; + } else { + decisionFinal = false; + } + } + + if (algoDef.prescalePreview_ != 0 && decisionBeforePrescale) { + std::string previewName = name + "_preview"; + if (prescaleCounters.count(previewName) > 0) { + prescaleCounters[previewName] += 100; + } else { + prescaleCounters[previewName] = 100; + } + + if (prescaleCounters[previewName] >= algoDef.prescalePreview_) { + decisionFinalPreview = true; + prescaleCounters[previewName] -= algoDef.prescalePreview_; + } else { + decisionFinalPreview = false; + } + } P2GTCandidateVectorRef trigObjects; - if (initial) { + if (decisionFinal) { for (const auto& handle : handles) { const std::string& module = handle.provenance()->moduleLabel(); const std::string& instance = handle.provenance()->productInstanceName(); @@ -467,10 +564,19 @@ void L1GTAlgoBlockProducer::produce(edm::Event& event, const edm::EventSetup& ev } } - algoCollection->emplace_back(name, initial, initial, initial, std::move(trigObjects)); + algoCollection->emplace(name, + P2GTAlgoBlock(decisionBeforeBxAndPrescale, + decisionBeforePrescale, + decisionFinal, + decisionFinalPreview, + algoDef.isVeto_, + algoDef.triggerTypes_, + std::move(trigObjects))); } event.put(std::move(algoCollection)); + + bunchCrossingEmu_ = (bunchCrossingEmu_ + 1) % 3564; } DEFINE_FWK_MODULE(L1GTAlgoBlockProducer); diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTAlgoBoardWriter.cc b/L1Trigger/Phase2L1GT/plugins/L1GTAlgoBoardWriter.cc new file mode 100644 index 0000000000000..603680e2940ab --- /dev/null +++ b/L1Trigger/Phase2L1GT/plugins/L1GTAlgoBoardWriter.cc @@ -0,0 +1,129 @@ +/** + * AlgoBoardDataWriter for validation with hardware. + **/ + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "L1Trigger/DemonstratorTools/interface/BoardDataWriter.h" +#include "L1Trigger/DemonstratorTools/interface/utilities.h" + +#include "FWCore/Utilities/interface/EDGetToken.h" + +#include "DataFormats/L1Trigger/interface/P2GTAlgoBlock.h" + +#include "ap_int.h" + +#include +#include +#include + +using namespace l1t; + +class L1GTAlgoBoardWriter : public edm::one::EDAnalyzer<> { +public: + explicit L1GTAlgoBoardWriter(const edm::ParameterSet&); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + const std::array channels_; + const std::array algoBitMask_; + const edm::EDGetTokenT algoBlocksToken_; + l1t::demo::BoardDataWriter boardDataWriter_; + + std::map>> linkData_; + std::size_t tmuxCounter_; +}; + +L1GTAlgoBoardWriter::L1GTAlgoBoardWriter(const edm::ParameterSet& config) + : channels_(config.getParameter>("channels")), + algoBitMask_(config.getParameter>("algoBitMask")), + algoBlocksToken_(consumes(config.getParameter("algoBlocksTag"))), + boardDataWriter_( + l1t::demo::parseFileFormat(config.getParameter("patternFormat")), + config.getParameter("outputFilename"), + config.getParameter("outputFileExtension"), + 9, + 2, + config.getParameter("maxLines"), + [](const std::array& channels) { + l1t::demo::BoardDataWriter::ChannelMap_t channelMap; + for (unsigned int channel : channels) { + channelMap.insert({l1t::demo::LinkId{"Algos", channel}, {l1t::demo::ChannelSpec{2, 0, 0}, {channel}}}); + } + return channelMap; + }(channels_)), + linkData_(), + tmuxCounter_(0) {} + +void L1GTAlgoBoardWriter::analyze(const edm::Event& event, const edm::EventSetup& iSetup) { + const P2GTAlgoBlockMap& algoBlocks = event.get(algoBlocksToken_); + + auto algoBlockIt = algoBlocks.begin(); + auto algoMaskIt = algoBitMask_.begin(); + + for (unsigned int channel : channels_) { + if (tmuxCounter_ == 0) { + linkData_[{"Algos", channel}] = std::vector>(18, 0); + } + + for (std::size_t word = 0; word < 9; word++) { + ap_uint<64> mask = algoMaskIt != algoBitMask_.end() ? *algoMaskIt++ : ~static_cast(0); + + for (std::size_t idx = 0; idx < 64 && algoBlockIt != algoBlocks.end(); idx++, algoBlockIt++) { + auto& [algoName, algoBlock] = *algoBlockIt; + linkData_[{"Algos", channel}][word + tmuxCounter_ * 9].set( + idx, algoBlock.decisionBeforeBxMaskAndPrescale() && mask.bit(idx)); + } + } + } + + if (tmuxCounter_ == 1) { + boardDataWriter_.addEvent(l1t::demo::EventData(linkData_)); + } + + tmuxCounter_ = (tmuxCounter_ + 1) % 2; +} + +void L1GTAlgoBoardWriter::endJob() { + if (tmuxCounter_ == 1) { + boardDataWriter_.addEvent(l1t::demo::EventData(linkData_)); + } + + boardDataWriter_.flush(); +} + +void L1GTAlgoBoardWriter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("outputFilename"); + desc.add("outputFileExtension", "txt"); + desc.add("algoBlocksTag"); + desc.add>("channels"); + desc.add>("algoBitMask", + {0xffffffffffffffffull, + 0xffffffffffffffffull, + 0xffffffffffffffffull, + 0xffffffffffffffffull, + 0xffffffffffffffffull, + 0xffffffffffffffffull, + 0xffffffffffffffffull, + 0xffffffffffffffffull, + 0xffffffffffffffffull}); + desc.add("maxLines", 1024); + desc.add("patternFormat", "EMPv2"); + + descriptions.addDefault(desc); +} + +DEFINE_FWK_MODULE(L1GTAlgoBoardWriter); diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTBoardWriter.cc b/L1Trigger/Phase2L1GT/plugins/L1GTBoardWriter.cc deleted file mode 100644 index 9c5d1402fedc4..0000000000000 --- a/L1Trigger/Phase2L1GT/plugins/L1GTBoardWriter.cc +++ /dev/null @@ -1,104 +0,0 @@ -/** - * BoardDataWriter for validation with hardware. Currently only writing the algo bits is implemented. - **/ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "L1Trigger/DemonstratorTools/interface/BoardDataWriter.h" -#include "L1Trigger/DemonstratorTools/interface/utilities.h" - -#include "FWCore/Utilities/interface/EDGetToken.h" - -#include "DataFormats/L1Trigger/interface/P2GTAlgoBlock.h" - -#include "ap_int.h" - -#include -#include -#include - -using namespace l1t; - -class L1GTBoardWriter : public edm::one::EDAnalyzer<> { -public: - explicit L1GTBoardWriter(const edm::ParameterSet&); - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - const std::vector channels_; - const std::vector algoBitMask_; - const edm::EDGetTokenT algoBlocksToken_; - l1t::demo::BoardDataWriter boardDataWriter_; -}; - -L1GTBoardWriter::L1GTBoardWriter(const edm::ParameterSet& config) - : channels_(config.getParameter>("channels")), - algoBitMask_(config.getParameter>("algoBitMask")), - algoBlocksToken_(consumes(config.getParameter("algoBlocksTag"))), - boardDataWriter_( - l1t::demo::parseFileFormat(config.getParameter("patternFormat")), - config.getParameter("outputFilename"), - config.getParameter("outputFileExtension"), - 9, - 1, - config.getParameter("maxLines"), - [](const std::vector& channels) { - l1t::demo::BoardDataWriter::ChannelMap_t channelMap; - for (unsigned int channel : channels) { - channelMap.insert({l1t::demo::LinkId{"Algos", channel}, {l1t::demo::ChannelSpec{1, 0, 0}, {channel}}}); - } - return channelMap; - }(channels_)) {} - -void L1GTBoardWriter::analyze(const edm::Event& event, const edm::EventSetup& iSetup) { - l1t::demo::EventData eventData; - const P2GTAlgoBlockCollection& algoBlocks = event.get(algoBlocksToken_); - - auto algoBlockIt = algoBlocks.begin(); - auto algoMaskIt = algoBitMask_.begin(); - - for (unsigned int channel : channels_) { - std::vector> bits(9, 0); - for (std::size_t word = 0; word < 9; word++) { - ap_uint<64> mask = algoMaskIt != algoBitMask_.end() ? *algoMaskIt++ : ~static_cast(0); - - for (std::size_t idx = 0; idx < 64 && algoBlockIt != algoBlocks.end(); idx++) { - bits[word].set(idx, algoBlockIt->decisionBeforeBxMaskAndPrescale() && mask.bit(idx)); - algoBlockIt++; - } - } - - eventData.add({"Algos", channel}, bits); - } - - boardDataWriter_.addEvent(eventData); -} - -void L1GTBoardWriter::endJob() { boardDataWriter_.flush(); } - -void L1GTBoardWriter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - desc.add("outputFilename"); - desc.add("outputFileExtension", "txt"); - desc.add("algoBlocksTag"); - desc.add>("channels"); - desc.add>("algoBitMask", {}); - desc.add("maxLines", 1024); - desc.add("patternFormat", "EMPv2"); - - descriptions.addDefault(desc); -} - -DEFINE_FWK_MODULE(L1GTBoardWriter); diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTCorrelationalCut.h b/L1Trigger/Phase2L1GT/plugins/L1GTCorrelationalCut.h new file mode 100644 index 0000000000000..a115ea814bf5b --- /dev/null +++ b/L1Trigger/Phase2L1GT/plugins/L1GTCorrelationalCut.h @@ -0,0 +1,356 @@ +#ifndef L1Trigger_Phase2L1GT_L1GTCorrelationalCut_h +#define L1Trigger_Phase2L1GT_L1GTCorrelationalCut_h + +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/L1Trigger/interface/P2GTCandidate.h" + +#include "L1Trigger/Phase2L1GT/interface/L1GTInvariantMassError.h" + +#include "L1Trigger/Phase2L1GT/interface/L1GTScales.h" + +#include "L1GTSingleInOutLUT.h" +#include "L1GTOptionalParam.h" + +#include +#include + +namespace l1t { + + class L1GTCorrelationalCut { + public: + L1GTCorrelationalCut(const edm::ParameterSet& config, + const edm::ParameterSet& lutConfig, + const L1GTScales& scales, + bool enable_sanity_checks = false, + bool inv_mass_checks = false) + : scales_(scales), + coshEtaLUT_(lutConfig.getParameterSet("cosh_eta_lut")), + coshEtaLUT2_(lutConfig.getParameterSet("cosh_eta_lut2")), + cosPhiLUT_(lutConfig.getParameterSet("cos_phi_lut")), + minDEta_(getOptionalParam( + "minDEta", config, [&scales](double value) { return scales.to_hw_eta_floor(value); })), + maxDEta_(getOptionalParam( + "maxDEta", config, [&scales](double value) { return scales.to_hw_eta_ceil(value); })), + minDPhi_(getOptionalParam( + "minDPhi", config, [&scales](double value) { return scales.to_hw_phi_floor(value); })), + maxDPhi_(getOptionalParam( + "maxDPhi", config, [&scales](double value) { return scales.to_hw_phi_ceil(value); })), + minDz_(getOptionalParam( + "minDz", config, [&scales](double value) { return scales.to_hw_z0_floor(value); })), + maxDz_(getOptionalParam( + "maxDz", config, [&scales](double value) { return scales.to_hw_z0_ceil(value); })), + minDRSquared_(getOptionalParam( + "minDR", config, [&scales](double value) { return scales.to_hw_dRSquared_floor(value); })), + maxDRSquared_(getOptionalParam( + "maxDR", config, [&scales](double value) { return scales.to_hw_dRSquared_ceil(value); })), + minInvMassSqrDiv2_scale1_(getOptionalParam( + "minInvMass", + config, + [&](double value) { + return std::floor(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT_.output_scale()); + })), + maxInvMassSqrDiv2_scale1_(getOptionalParam( + "maxInvMass", + config, + [&](double value) { + return std::ceil(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT_.output_scale()); + })), + minInvMassSqrDiv2_scale2_(getOptionalParam( + "minInvMass", + config, + [&](double value) { + return std::floor(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT2_.output_scale()); + })), + maxInvMassSqrDiv2_scale2_(getOptionalParam( + "maxInvMass", + config, + [&](double value) { + return std::ceil(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT2_.output_scale()); + })), + minTransMassSqrDiv2_(getOptionalParam( + "minTransMass", + config, + [&](double value) { + return std::floor(scales.to_hw_TransMassSqrDiv2(value) * cosPhiLUT_.output_scale()); + })), + maxTransMassSqrDiv2_(getOptionalParam( + "maxTransMass", + config, + [&](double value) { + return std::ceil(scales.to_hw_TransMassSqrDiv2(value) * cosPhiLUT_.output_scale()); + })), + minPTSquared_(getOptionalParam( + "minCombPt", + config, + [&](double value) { return std::floor(scales.to_hw_PtSquared(value) * cosPhiLUT_.output_scale()); })), + maxPTSquared_(getOptionalParam( + "maxCombPt", + config, + [&](double value) { return std::ceil(scales.to_hw_PtSquared(value) * cosPhiLUT_.output_scale()); })), + minInvMassSqrOver2DRSqr_scale1_(getOptionalParam( + "minInvMassOverDR", + config, + [&](double value) { + return std::floor(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT_.output_scale()); + })), + maxInvMassSqrOver2DRSqr_scale1_(getOptionalParam( + "maxInvMassOverDR", + config, + [&](double value) { + return std::ceil(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT_.output_scale()); + })), + minInvMassSqrOver2DRSqr_scale2_(getOptionalParam( + "minInvMassOverDR", + config, + [&](double value) { + return std::floor(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT2_.output_scale()); + })), + maxInvMassSqrOver2DRSqr_scale2_(getOptionalParam( + "maxInvMassOverDR", + config, + [&](double value) { + return std::ceil(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT2_.output_scale()); + })), + os_(config.getParameter("os")), + ss_(config.getParameter("ss")), + enable_sanity_checks_(enable_sanity_checks), + inv_mass_checks_(inv_mass_checks) {} + + bool checkObjects(const P2GTCandidate& obj1, + const P2GTCandidate& obj2, + InvariantMassErrorCollection& massErrors) const { + bool res = true; + + std::optional dEta; + + if (minDEta_ || maxDEta_ || minDRSquared_ || maxDRSquared_ || minInvMassSqrDiv2_scale1_ || + maxInvMassSqrDiv2_scale1_ || minInvMassSqrDiv2_scale2_ || maxInvMassSqrDiv2_scale2_ || + minInvMassSqrOver2DRSqr_scale1_ || maxInvMassSqrOver2DRSqr_scale1_ || minInvMassSqrOver2DRSqr_scale2_ || + maxInvMassSqrOver2DRSqr_scale2_) { + dEta = std::abs(obj1.hwEta().to_int() - obj2.hwEta().to_int()); + res &= minDEta_ ? dEta > minDEta_ : true; + res &= maxDEta_ ? dEta < maxDEta_ : true; + } + + constexpr int HW_PI = 1 << (P2GTCandidate::hwPhi_t::width - 1); // assumes phi in [-pi, pi) + + std::optional dPhi; + + if (minDPhi_ || maxDPhi_ || minDRSquared_ || maxDRSquared_ || minInvMassSqrDiv2_scale1_ || + maxInvMassSqrDiv2_scale1_ || minInvMassSqrDiv2_scale2_ || maxInvMassSqrDiv2_scale2_ || minTransMassSqrDiv2_ || + maxTransMassSqrDiv2_ || minPTSquared_ || maxPTSquared_ || minInvMassSqrOver2DRSqr_scale1_ || + maxInvMassSqrOver2DRSqr_scale1_ || minInvMassSqrOver2DRSqr_scale2_ || maxInvMassSqrOver2DRSqr_scale2_) { + // Ensure dPhi is always the smaller angle, i.e. always between [0, pi] + dPhi = HW_PI - std::abs(std::abs(obj1.hwPhi().to_int() - obj2.hwPhi().to_int()) - HW_PI); + } + + res &= minDPhi_ ? dPhi > minDPhi_ : true; + res &= maxDPhi_ ? dPhi < maxDPhi_ : true; + + if (minDz_ || maxDz_) { + uint32_t dZ = abs(obj1.hwZ0() - obj2.hwZ0()); + res &= minDz_ ? dZ > minDz_ : true; + res &= maxDz_ ? dZ < maxDz_ : true; + } + + uint32_t dRSquared = 0; + if (minDRSquared_ || maxDRSquared_ || minInvMassSqrOver2DRSqr_scale1_ || maxInvMassSqrOver2DRSqr_scale1_ || + minInvMassSqrOver2DRSqr_scale2_ || maxInvMassSqrOver2DRSqr_scale2_) { + dRSquared = dEta.value() * dEta.value() + dPhi.value() * dPhi.value(); + res &= minDRSquared_ ? dRSquared > minDRSquared_ : true; + res &= maxDRSquared_ ? dRSquared < maxDRSquared_ : true; + } + + res &= os_ ? obj1.hwCharge() != obj2.hwCharge() : true; + res &= ss_ ? obj1.hwCharge() == obj2.hwCharge() : true; + + int32_t lutCoshDEta = 0; + if (dEta) { + lutCoshDEta = dEta < L1GTSingleInOutLUT::DETA_LUT_SPLIT + ? coshEtaLUT_[dEta.value()] + : coshEtaLUT2_[dEta.value() - L1GTSingleInOutLUT::DETA_LUT_SPLIT]; + } + + // Optimization: (cos(x + pi) = -cos(x), x in [0, pi)) + int32_t lutCosDPhi = 0; + if (dPhi) { + lutCosDPhi = dPhi >= HW_PI ? -cosPhiLUT_[dPhi.value()] : cosPhiLUT_[dPhi.value()]; + } + + if (enable_sanity_checks_ && dEta && dPhi) { + // Check whether the LUT error is smaller or equal than the expected maximum LUT error + double coshEtaLUTMax = + dEta < L1GTSingleInOutLUT::DETA_LUT_SPLIT ? coshEtaLUT_.hwMax_error() : coshEtaLUT2_.hwMax_error(); + double etaLUTScale = + dEta < L1GTSingleInOutLUT::DETA_LUT_SPLIT ? coshEtaLUT_.output_scale() : coshEtaLUT2_.output_scale(); + + if (std::abs(lutCoshDEta - etaLUTScale * std::cosh(dEta.value() * scales_.eta_lsb())) > coshEtaLUTMax) { + edm::LogError("COSH LUT") << "Difference larger than max LUT error: " << coshEtaLUTMax + << ", lut: " << lutCoshDEta + << ", calc: " << etaLUTScale * std::cosh(dEta.value() * scales_.eta_lsb()) + << ", dEta: " << dEta.value() << ", scale: " << etaLUTScale; + } + + if (std::abs(lutCosDPhi - cosPhiLUT_.output_scale() * std::cos(dPhi.value() * scales_.phi_lsb())) > + cosPhiLUT_.hwMax_error()) { + edm::LogError("COS LUT") << "Difference larger than max LUT error: " << cosPhiLUT_.hwMax_error() + << ", lut: " << lutCosDPhi << ", calc: " + << cosPhiLUT_.output_scale() * std::cos(dPhi.value() * scales_.phi_lsb()); + } + } + + int64_t invMassSqrDiv2 = 0; + if (minInvMassSqrDiv2_scale1_ || maxInvMassSqrDiv2_scale1_ || minInvMassSqrDiv2_scale2_ || + maxInvMassSqrDiv2_scale2_ || minInvMassSqrOver2DRSqr_scale1_ || maxInvMassSqrOver2DRSqr_scale1_ || + minInvMassSqrOver2DRSqr_scale2_ || maxInvMassSqrOver2DRSqr_scale2_) { + if (dEta < L1GTSingleInOutLUT::DETA_LUT_SPLIT) { + // dEta [0, 2pi) + invMassSqrDiv2 = obj1.hwPT().to_int64() * obj2.hwPT().to_int64() * (lutCoshDEta - lutCosDPhi); + res &= minInvMassSqrDiv2_scale1_ ? invMassSqrDiv2 > minInvMassSqrDiv2_scale1_ : true; + res &= maxInvMassSqrDiv2_scale1_ ? invMassSqrDiv2 < maxInvMassSqrDiv2_scale1_ : true; + } else { + // dEta [2pi, 4pi), ignore cos + invMassSqrDiv2 = obj1.hwPT().to_int64() * obj2.hwPT().to_int64() * lutCoshDEta; + res &= minInvMassSqrDiv2_scale2_ ? invMassSqrDiv2 > minInvMassSqrDiv2_scale2_ : true; + res &= maxInvMassSqrDiv2_scale2_ ? invMassSqrDiv2 < maxInvMassSqrDiv2_scale2_ : true; + } + + if (inv_mass_checks_) { + double precInvMass = + scales_.pT_lsb() * + std::sqrt(2 * obj1.hwPT().to_double() * obj2.hwPT().to_double() * + (std::cosh(dEta.value() * scales_.eta_lsb()) - std::cos(dPhi.value() * scales_.phi_lsb()))); + + double lutInvMass = + scales_.pT_lsb() * std::sqrt(2 * static_cast(invMassSqrDiv2) / + (dEta < L1GTSingleInOutLUT::DETA_LUT_SPLIT ? coshEtaLUT_.output_scale() + : coshEtaLUT2_.output_scale())); + + double error = std::abs(precInvMass - lutInvMass); + massErrors.emplace_back(InvariantMassError{error, error / precInvMass, precInvMass}); + } + } + + if (minPTSquared_ || maxPTSquared_) { + int64_t pTSquared = obj1.hwPT().to_int64() * obj1.hwPT().to_int64() * + static_cast(std::round(cosPhiLUT_.output_scale())) + + obj2.hwPT().to_int64() * obj2.hwPT().to_int64() * + static_cast(std::round(cosPhiLUT_.output_scale())) + + 2 * obj1.hwPT().to_int64() * obj2.hwPT().to_int64() * lutCosDPhi; + res &= minPTSquared_ ? pTSquared > minPTSquared_.value() : true; + res &= maxPTSquared_ ? pTSquared < maxPTSquared_.value() : true; + } + + if (minTransMassSqrDiv2_ || maxTransMassSqrDiv2_) { + int64_t transMassDiv2 = obj1.hwPT().to_int64() * obj2.hwPT().to_int64() * + (static_cast(std::round(cosPhiLUT_.output_scale())) - lutCosDPhi); + res &= minTransMassSqrDiv2_ ? transMassDiv2 > minTransMassSqrDiv2_.value() : true; + res &= maxTransMassSqrDiv2_ ? transMassDiv2 < maxTransMassSqrDiv2_.value() : true; + } + + if (minInvMassSqrOver2DRSqr_scale1_ || maxInvMassSqrOver2DRSqr_scale1_ || minInvMassSqrOver2DRSqr_scale2_ || + maxInvMassSqrOver2DRSqr_scale2_) { + ap_uint<96> invMassSqrDiv2Shift = ap_uint<96>(invMassSqrDiv2) + << L1GTScales::INV_MASS_SQR_OVER_2_DR_SQR_RESOLUTION; + + if (dEta < L1GTSingleInOutLUT::DETA_LUT_SPLIT) { + res &= minInvMassSqrOver2DRSqr_scale1_ + ? invMassSqrDiv2Shift > minInvMassSqrOver2DRSqr_scale1_.value() * dRSquared + : true; + res &= maxInvMassSqrOver2DRSqr_scale1_ + ? invMassSqrDiv2Shift < maxInvMassSqrOver2DRSqr_scale1_.value() * dRSquared + : true; + } else { + res &= minInvMassSqrOver2DRSqr_scale2_ + ? invMassSqrDiv2Shift > minInvMassSqrOver2DRSqr_scale2_.value() * dRSquared + : true; + res &= maxInvMassSqrOver2DRSqr_scale2_ + ? invMassSqrDiv2Shift < maxInvMassSqrOver2DRSqr_scale2_.value() * dRSquared + : true; + } + } + + return res; + } + + static void fillLUTDescriptions(edm::ParameterSetDescription& desc) { + edm::ParameterSetDescription coshLUTDesc; + L1GTSingleInOutLUT::fillLUTDescriptions(coshLUTDesc); + desc.add("cosh_eta_lut", coshLUTDesc); + + edm::ParameterSetDescription coshLUT2Desc; + L1GTSingleInOutLUT::fillLUTDescriptions(coshLUT2Desc); + desc.add("cosh_eta_lut2", coshLUT2Desc); + + edm::ParameterSetDescription cosLUTDesc; + L1GTSingleInOutLUT::fillLUTDescriptions(cosLUTDesc); + desc.add("cos_phi_lut", cosLUTDesc); + } + + static void fillPSetDescription(edm::ParameterSetDescription& desc) { + desc.addOptional("minDEta"); + desc.addOptional("maxDEta"); + desc.addOptional("minDPhi"); + desc.addOptional("maxDPhi"); + desc.addOptional("minDR"); + desc.addOptional("maxDR"); + desc.addOptional("minDz"); + desc.addOptional("maxDz"); + desc.addOptional("minInvMass"); + desc.addOptional("maxInvMass"); + desc.addOptional("minTransMass"); + desc.addOptional("maxTransMass"); + desc.addOptional("minCombPt"); + desc.addOptional("maxCombPt"); + desc.addOptional("minInvMassOverDR"); + desc.addOptional("maxInvMassOverDR"); + desc.add("os", false); + desc.add("ss", false); + } + + private: + const L1GTScales& scales_; + + const L1GTSingleInOutLUT coshEtaLUT_; // [0, 2pi) + const L1GTSingleInOutLUT coshEtaLUT2_; // [2pi, 4pi) + const L1GTSingleInOutLUT cosPhiLUT_; + + const std::optional minDEta_; + const std::optional maxDEta_; + const std::optional minDPhi_; + const std::optional maxDPhi_; + const std::optional minDz_; + const std::optional maxDz_; + + const std::optional minDRSquared_; + const std::optional maxDRSquared_; + + const std::optional minInvMassSqrDiv2_scale1_; + const std::optional maxInvMassSqrDiv2_scale1_; + + const std::optional minInvMassSqrDiv2_scale2_; + const std::optional maxInvMassSqrDiv2_scale2_; + + const std::optional minTransMassSqrDiv2_; + const std::optional maxTransMassSqrDiv2_; + + const std::optional minPTSquared_; + const std::optional maxPTSquared_; + + const std::optional minInvMassSqrOver2DRSqr_scale1_; + const std::optional maxInvMassSqrOver2DRSqr_scale1_; + + const std::optional minInvMassSqrOver2DRSqr_scale2_; + const std::optional maxInvMassSqrOver2DRSqr_scale2_; + + const bool os_; // Opposite sign + const bool ss_; // Same sign + + const bool enable_sanity_checks_; + const bool inv_mass_checks_; + }; + +} // namespace l1t + +#endif // L1Trigger_Phase2L1GT_L1GTCorrelationalCut_h diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTDeltaCut.h b/L1Trigger/Phase2L1GT/plugins/L1GTDeltaCut.h deleted file mode 100644 index 71a585113cabd..0000000000000 --- a/L1Trigger/Phase2L1GT/plugins/L1GTDeltaCut.h +++ /dev/null @@ -1,268 +0,0 @@ -#ifndef L1Trigger_Phase2L1GT_L1GTDeltaCut_h -#define L1Trigger_Phase2L1GT_L1GTDeltaCut_h - -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/L1Trigger/interface/P2GTCandidate.h" - -#include "L1Trigger/Phase2L1GT/interface/L1GTInvariantMassError.h" - -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "L1Trigger/Phase2L1GT/interface/L1GTScales.h" - -#include "L1GTSingleInOutLUT.h" -#include "L1GTOptionalParam.h" - -#include - -namespace l1t { - - class L1GTDeltaCut { - public: - static constexpr uint32_t DETA_LUT_SPLIT = 1 << 13; // hw 2pi - - L1GTDeltaCut(const edm::ParameterSet& config, - const edm::ParameterSet& lutConfig, - const L1GTScales& scales, - bool enable_sanity_checks = false, - bool inv_mass_checks = false) - : scales_(scales), - coshEtaLUT_(lutConfig.getParameterSet("cosh_eta_lut")), - coshEtaLUT2_(lutConfig.getParameterSet("cosh_eta_lut2")), - cosPhiLUT_(lutConfig.getParameterSet("cos_phi_lut")), - minDEta_(getOptionalParam( - "minDEta", config, [&scales](double value) { return scales.to_hw_eta(value); })), - maxDEta_(getOptionalParam( - "maxDEta", config, [&scales](double value) { return scales.to_hw_eta(value); })), - minDPhi_(getOptionalParam( - "minDPhi", config, [&scales](double value) { return scales.to_hw_phi(value); })), - maxDPhi_(getOptionalParam( - "maxDPhi", config, [&scales](double value) { return scales.to_hw_phi(value); })), - minDz_(getOptionalParam( - "minDz", config, [&scales](double value) { return scales.to_hw_z0(value); })), - maxDz_(getOptionalParam( - "maxDz", config, [&scales](double value) { return scales.to_hw_z0(value); })), - minDRSquared_(getOptionalParam( - "minDR", config, [&scales](double value) { return scales.to_hw_dRSquared(value); })), - maxDRSquared_(getOptionalParam( - "maxDR", config, [&scales](double value) { return scales.to_hw_dRSquared(value); })), - minInvMassSqrDiv2_(getOptionalParam( - "minInvMass", config, [&scales](double value) { return scales.to_hw_InvMassSqrDiv2(value); })), - maxInvMassSqrDiv2_(getOptionalParam( - "maxInvMass", config, [&scales](double value) { return scales.to_hw_InvMassSqrDiv2(value); })), - minTransMassSqrDiv2_(getOptionalParam( - "minTransMass", config, [&scales](double value) { return scales.to_hw_TransMassSqrDiv2(value); })), - maxTransMassSqrDiv2_(getOptionalParam( - "maxTransMass", config, [&scales](double value) { return scales.to_hw_TransMassSqrDiv2(value); })), - minPTSquared_(getOptionalParam( - "minCombPt", config, [&scales](double value) { return scales.to_hw_PtSquared(value); })), - maxPTSquared_(getOptionalParam( - "maxCombPt", config, [&scales](double value) { return scales.to_hw_PtSquared(value); })), - os_(config.getParameter("os")), - ss_(config.getParameter("ss")), - enable_sanity_checks_(enable_sanity_checks), - inv_mass_checks_(inv_mass_checks) {} - - bool checkObjects(const P2GTCandidate& obj1, - const P2GTCandidate& obj2, - InvariantMassErrorCollection& massErrors) const { - bool res = true; - - std::optional dEta; - - if (minDEta_ || maxDEta_ || minDRSquared_ || maxDRSquared_ || minInvMassSqrDiv2_ || maxInvMassSqrDiv2_) { - dEta = (obj1.hwEta() > obj2.hwEta()) ? obj1.hwEta().to_int() - obj2.hwEta().to_int() - : obj2.hwEta().to_int() - obj1.hwEta().to_int(); - res &= minDEta_ ? dEta > minDEta_ : true; - res &= maxDEta_ ? dEta < maxDEta_ : true; - } - - constexpr int HW_PI = 1 << (P2GTCandidate::hwPhi_t::width - 1); // assumes phi in [-pi, pi) - - // Ensure dPhi is always the smaller angle, i.e. always between [0, pi] - std::optional dPhi; - - if (minDPhi_ || maxDPhi_ || minDRSquared_ || maxDRSquared_ || minInvMassSqrDiv2_ || maxInvMassSqrDiv2_ || - minTransMassSqrDiv2_ || maxTransMassSqrDiv2_ || minPTSquared_ || maxPTSquared_) { - dPhi = HW_PI - abs(abs(obj1.hwPhi().to_int() - obj2.hwPhi().to_int()) - HW_PI); - } - - res &= minDPhi_ ? dPhi > minDPhi_ : true; - res &= maxDPhi_ ? dPhi < maxDPhi_ : true; - - if (minDz_ || maxDz_) { - uint32_t dZ = abs(obj1.hwZ0() - obj2.hwZ0()); - res &= minDz_ ? dZ > minDz_ : true; - res &= maxDz_ ? dZ < maxDz_ : true; - } - - if (minDRSquared_ || maxDRSquared_) { - uint32_t dRSquared = dEta.value() * dEta.value() + dPhi.value() * dPhi.value(); - res &= minDRSquared_ ? dRSquared > minDRSquared_ : true; - res &= maxDRSquared_ ? dRSquared < maxDRSquared_ : true; - } - - res &= os_ ? obj1.hwCharge() != obj2.hwCharge() : true; - res &= ss_ ? obj1.hwCharge() == obj2.hwCharge() : true; - - int32_t lutCoshDEta = 0; - if (dEta) { - lutCoshDEta = dEta < DETA_LUT_SPLIT ? coshEtaLUT_[dEta.value()] : coshEtaLUT2_[dEta.value() - DETA_LUT_SPLIT]; - } - - // Optimization: (cos(x + pi) = -cos(x), x in [0, pi)) - int32_t lutCosDPhi = 0; - if (dPhi) { - lutCosDPhi = dPhi >= HW_PI ? -cosPhiLUT_[dPhi.value()] : cosPhiLUT_[dPhi.value()]; - } - - if (enable_sanity_checks_ && dEta && dPhi) { - // Check whether the LUT error is smaller or equal than the expected maximum LUT error - double coshEtaLUTMax = dEta < DETA_LUT_SPLIT ? coshEtaLUT_.hwMax_error() : coshEtaLUT2_.hwMax_error(); - double etaLUTScale = dEta < DETA_LUT_SPLIT ? coshEtaLUT_.output_scale() : coshEtaLUT2_.output_scale(); - - if (std::abs(lutCoshDEta - etaLUTScale * std::cosh(dEta.value() * scales_.eta_lsb())) > coshEtaLUTMax) { - edm::LogError("COSH LUT") << "Difference larger than max LUT error: " << coshEtaLUTMax - << ", lut: " << lutCoshDEta - << ", calc: " << etaLUTScale * std::cosh(dEta.value() * scales_.eta_lsb()) - << ", dEta: " << dEta.value() << ", scale: " << etaLUTScale; - } - - if (std::abs(lutCosDPhi - cosPhiLUT_.output_scale() * std::cos(dPhi.value() * scales_.phi_lsb())) > - cosPhiLUT_.hwMax_error()) { - edm::LogError("COS LUT") << "Difference larger than max LUT error: " << cosPhiLUT_.hwMax_error() - << ", lut: " << lutCosDPhi << ", calc: " - << cosPhiLUT_.output_scale() * std::cos(dPhi.value() * scales_.phi_lsb()); - } - } - - if (minInvMassSqrDiv2_ || maxInvMassSqrDiv2_) { - int64_t invMassSqrDiv2; - if (dEta < DETA_LUT_SPLIT) { - // dEta [0, 2pi) - invMassSqrDiv2 = obj1.hwPT().to_int64() * obj2.hwPT().to_int64() * (lutCoshDEta - lutCosDPhi); - res &= minInvMassSqrDiv2_ - ? invMassSqrDiv2 > std::round(minInvMassSqrDiv2_.value() * coshEtaLUT_.output_scale()) - : true; - res &= maxInvMassSqrDiv2_ - ? invMassSqrDiv2 < std::round(maxInvMassSqrDiv2_.value() * coshEtaLUT_.output_scale()) - : true; - } else { - // dEta [2pi, 4pi), ignore cos - invMassSqrDiv2 = obj1.hwPT().to_int64() * obj2.hwPT().to_int64() * lutCoshDEta; - res &= minInvMassSqrDiv2_ - ? invMassSqrDiv2 > std::round(minInvMassSqrDiv2_.value() * coshEtaLUT2_.output_scale()) - : true; - res &= maxInvMassSqrDiv2_ - ? invMassSqrDiv2 < std::round(maxInvMassSqrDiv2_.value() * coshEtaLUT2_.output_scale()) - : true; - } - - if (inv_mass_checks_) { - double precInvMass = - scales_.pT_lsb() * - std::sqrt(2 * obj1.hwPT().to_double() * obj2.hwPT().to_double() * - (std::cosh(dEta.value() * scales_.eta_lsb()) - std::cos(dPhi.value() * scales_.phi_lsb()))); - - double lutInvMass = scales_.pT_lsb() * std::sqrt(2 * static_cast(invMassSqrDiv2) / - (dEta < DETA_LUT_SPLIT ? coshEtaLUT_.output_scale() - : coshEtaLUT2_.output_scale())); - - double error = std::abs(precInvMass - lutInvMass); - massErrors.emplace_back(InvariantMassError{error, error / precInvMass, precInvMass}); - } - } - - if (minPTSquared_ || maxPTSquared_) { - int64_t pTSquared = obj1.hwPT().to_int64() * obj1.hwPT().to_int64() * - static_cast(std::round(cosPhiLUT_.output_scale())) + - obj2.hwPT().to_int64() * obj2.hwPT().to_int64() * - static_cast(std::round(cosPhiLUT_.output_scale())) + - 2 * obj1.hwPT().to_int64() * obj2.hwPT().to_int64() * lutCosDPhi; - res &= minPTSquared_ ? pTSquared > std::round(minPTSquared_.value() * cosPhiLUT_.output_scale()) : true; - res &= maxPTSquared_ ? pTSquared < std::round(maxPTSquared_.value() * cosPhiLUT_.output_scale()) : true; - } - - if (minTransMassSqrDiv2_ || maxTransMassSqrDiv2_) { - int64_t transMassDiv2 = obj1.hwPT().to_int64() * obj2.hwPT().to_int64() * - (static_cast(coshEtaLUT_.output_scale()) - lutCosDPhi); - res &= minTransMassSqrDiv2_ - ? transMassDiv2 > std::round(minTransMassSqrDiv2_.value() * coshEtaLUT_.output_scale()) - : true; - res &= maxTransMassSqrDiv2_ - ? transMassDiv2 < std::round(maxTransMassSqrDiv2_.value() * coshEtaLUT_.output_scale()) - : true; - } - - return res; - } - - static void fillLUTDescriptions(edm::ParameterSetDescription& desc) { - edm::ParameterSetDescription coshLUTDesc; - L1GTSingleInOutLUT::fillLUTDescriptions(coshLUTDesc); - desc.add("cosh_eta_lut", coshLUTDesc); - - edm::ParameterSetDescription coshLUT2Desc; - L1GTSingleInOutLUT::fillLUTDescriptions(coshLUT2Desc); - desc.add("cosh_eta_lut2", coshLUT2Desc); - - edm::ParameterSetDescription cosLUTDesc; - L1GTSingleInOutLUT::fillLUTDescriptions(cosLUTDesc); - desc.add("cos_phi_lut", cosLUTDesc); - } - - static void fillPSetDescription(edm::ParameterSetDescription& desc) { - desc.addOptional("minDEta"); - desc.addOptional("maxDEta"); - desc.addOptional("minDPhi"); - desc.addOptional("maxDPhi"); - desc.addOptional("minDR"); - desc.addOptional("maxDR"); - desc.addOptional("minDz"); - desc.addOptional("maxDz"); - desc.addOptional("minInvMass"); - desc.addOptional("maxInvMass"); - desc.addOptional("minTransMass"); - desc.addOptional("maxTransMass"); - desc.addOptional("minCombPt"); - desc.addOptional("maxCombPt"); - desc.add("os", false); - desc.add("ss", false); - } - - private: - const L1GTScales& scales_; - - const L1GTSingleInOutLUT coshEtaLUT_; // [0, 2pi) - const L1GTSingleInOutLUT coshEtaLUT2_; // [2pi, 4pi) - const L1GTSingleInOutLUT cosPhiLUT_; - - const std::optional minDEta_; - const std::optional maxDEta_; - const std::optional minDPhi_; - const std::optional maxDPhi_; - const std::optional minDz_; - const std::optional maxDz_; - - const std::optional minDRSquared_; - const std::optional maxDRSquared_; - - const std::optional minInvMassSqrDiv2_; - const std::optional maxInvMassSqrDiv2_; - const std::optional minTransMassSqrDiv2_; - const std::optional maxTransMassSqrDiv2_; - - const std::optional minPTSquared_; - const std::optional maxPTSquared_; - - const bool os_; // Opposite sign - const bool ss_; // Same sign - - const bool enable_sanity_checks_; - const bool inv_mass_checks_; - }; - -} // namespace l1t - -#endif // L1Trigger_Phase2L1GT_L1GTDeltaCut_h diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTDoubleObjectCond.cc b/L1Trigger/Phase2L1GT/plugins/L1GTDoubleObjectCond.cc index 249f991778171..36b1295a07174 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTDoubleObjectCond.cc +++ b/L1Trigger/Phase2L1GT/plugins/L1GTDoubleObjectCond.cc @@ -16,7 +16,7 @@ #include "L1GTOptionalParam.h" #include "L1GTSingleCollectionCut.h" -#include "L1GTDeltaCut.h" +#include "L1GTCorrelationalCut.h" #include "L1GTSingleInOutLUT.h" #include @@ -46,10 +46,11 @@ class L1GTDoubleObjectCond : public edm::global::EDFilter<> { const bool enable_sanity_checks_; const bool inv_mass_checks_; - const L1GTDeltaCut deltaCuts_; + const L1GTCorrelationalCut deltaCuts_; const edm::EDGetTokenT token1_; const edm::EDGetTokenT token2_; + const edm::EDGetTokenT primVertToken_; }; L1GTDoubleObjectCond::L1GTDoubleObjectCond(const edm::ParameterSet& config) @@ -62,7 +63,8 @@ L1GTDoubleObjectCond::L1GTDoubleObjectCond(const edm::ParameterSet& config) token1_(consumes(collection1Cuts_.tag())), token2_(collection1Cuts_.tag() == collection2Cuts_.tag() ? token1_ - : consumes(collection2Cuts_.tag())) { + : consumes(collection2Cuts_.tag())), + primVertToken_(consumes(config.getParameter("primVertTag"))) { produces(collection1Cuts_.tag().instance()); if (!(collection1Cuts_.tag() == collection2Cuts_.tag())) { @@ -85,11 +87,13 @@ void L1GTDoubleObjectCond::fillDescriptions(edm::ConfigurationDescriptions& desc L1GTSingleCollectionCut::fillPSetDescription(collection2Desc); desc.add("collection2", collection2Desc); + desc.add("primVertTag"); + desc.addUntracked("sanity_checks", false); desc.addUntracked("inv_mass_checks", false); - L1GTDeltaCut::fillPSetDescription(desc); - L1GTDeltaCut::fillLUTDescriptions(desc); + L1GTCorrelationalCut::fillPSetDescription(desc); + L1GTCorrelationalCut::fillLUTDescriptions(desc); edm::ParameterSetDescription scalesDesc; L1GTScales::fillPSetDescription(scalesDesc); @@ -101,6 +105,7 @@ void L1GTDoubleObjectCond::fillDescriptions(edm::ConfigurationDescriptions& desc bool L1GTDoubleObjectCond::filter(edm::StreamID, edm::Event& event, const edm::EventSetup& setup) const { edm::Handle col1 = event.getHandle(token1_); edm::Handle col2 = event.getHandle(token2_); + edm::Handle primVertCol = event.getHandle(primVertToken_); bool condition_result = false; @@ -110,15 +115,18 @@ bool L1GTDoubleObjectCond::filter(edm::StreamID, edm::Event& event, const edm::E InvariantMassErrorCollection massErrors; for (std::size_t idx1 = 0; idx1 < col1->size(); ++idx1) { + bool single1Pass = collection1Cuts_.checkObject(col1->at(idx1)); + single1Pass &= collection1Cuts_.checkPrimaryVertices(col1->at(idx1), *primVertCol); + for (std::size_t idx2 = 0; idx2 < col2->size(); ++idx2) { // If we're looking at the same collection then we shouldn't use the same object in one comparison. if (col1.product() == col2.product() && idx1 == idx2) { continue; } - bool pass = true; - pass &= collection1Cuts_.checkObject(col1->at(idx1)); + bool pass = single1Pass; pass &= collection2Cuts_.checkObject(col2->at(idx2)); + pass &= collection2Cuts_.checkPrimaryVertices(col2->at(idx2), *primVertCol); pass &= deltaCuts_.checkObjects(col1->at(idx1), col2->at(idx2), massErrors); condition_result |= pass; diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTEvaluationInterface.h b/L1Trigger/Phase2L1GT/plugins/L1GTEvaluationInterface.h index a79ab9a8de36e..275e0fb87d49e 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTEvaluationInterface.h +++ b/L1Trigger/Phase2L1GT/plugins/L1GTEvaluationInterface.h @@ -28,18 +28,6 @@ namespace l1t { return result; } - template - A l1t_unpack_int(const A& packed, Args&&... args) { - A temp = packed; - ( - [&temp](auto&& arg) { - arg = temp(arg.width - 1, 0); - temp >>= arg.width; - }(std::forward(args)), - ...); - return temp; - } - struct L1TGT_BaseInterface { virtual std::size_t packed_width() const = 0; virtual P2GTCandidate to_GTObject() const = 0; @@ -49,7 +37,6 @@ namespace l1t { template struct L1TGT_Interface : public L1TGT_BaseInterface { virtual ap_uint pack() const = 0; - virtual ap_uint unpack(const ap_uint&) = 0; static constexpr std::size_t WIDTH = N; @@ -70,7 +57,9 @@ namespace l1t { ap_uint pack() const override { return pack_common(); } - ap_uint unpack(const ap_uint& packed) override { return l1t_unpack_int(packed, valid, pT, phi, eta); } + static L1TGT_Common3Vector from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_Common3Vector(1, gtObject.hwPT(), gtObject.hwPhi(), gtObject.hwEta()); + } P2GTCandidate to_GTObject() const override { P2GTCandidate gt_object; @@ -82,29 +71,28 @@ namespace l1t { } }; - template - struct L1TGT_CommonSum : public L1TGT_Interface { + struct L1TGT_CommonSum : public L1TGT_Interface<64> { ap_uint<1> valid; ap_uint<16> pT; ap_int<13> phi; - ap_uint<16> scalar_sum_pT; + ap_uint<16> scalarSumPT; - L1TGT_CommonSum(int valid = 0, int pT = 0, int phi = 0, int scalar_sum_pT = 0) - : valid(valid), pT(pT), phi{phi}, scalar_sum_pT(scalar_sum_pT) {} + L1TGT_CommonSum(int valid = 0, int pT = 0, int phi = 0, int scalarSumPT = 0) + : valid(valid), pT(pT), phi{phi}, scalarSumPT(scalarSumPT) {} - ap_uint<46> pack_common() const { return l1t_pack_int>(valid, pT, phi, scalar_sum_pT); } + ap_uint<46> pack_common() const { return l1t_pack_int>(valid, pT, phi, scalarSumPT); } - ap_uint pack() const override { return pack_common(); } + ap_uint<64> pack() const override { return pack_common(); } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int(packed, valid, pT, phi, scalar_sum_pT); + static L1TGT_CommonSum from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_CommonSum(1, gtObject.hwPT(), gtObject.hwPhi(), gtObject.hwScalarSumPT()); } P2GTCandidate to_GTObject() const override { P2GTCandidate gt_object; gt_object.setHwPT(pT); gt_object.setHwPhi(phi); - gt_object.setHwSca_sum(scalar_sum_pT); + gt_object.setHwScalarSumPT(scalarSumPT); return gt_object; } @@ -134,8 +122,8 @@ namespace l1t { return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), seed_pT); } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int(L1TGT_Common3Vector::unpack(packed), seed_pT); + static L1TGT_GCT_tau6p6 from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_GCT_tau6p6(1, gtObject.hwPT(), gtObject.hwPhi(), gtObject.hwEta(), gtObject.hwSeed_pT()); } P2GTCandidate to_GTObject() const override { @@ -146,7 +134,7 @@ namespace l1t { } }; - struct L1TGT_GCT_Sum2 : public L1TGT_CommonSum<64> { + struct L1TGT_GCT_Sum2 : public L1TGT_CommonSum { using L1TGT_CommonSum::L1TGT_CommonSum; }; @@ -156,26 +144,39 @@ namespace l1t { ap_uint<5> z0; ap_int<7> d0; ap_uint<1> charge; - ap_uint<4> qual; - - L1TGT_GMT_PromptDisplacedMuon( - int valid = 0, int pT = 0, int phi = 0, int eta = 0, int z0 = 0, int d0 = 0, int charge = 0, int qual = 0) - : L1TGT_Common3Vector(valid, pT, phi, eta), z0(z0), d0(d0), charge(charge), qual(qual) {} + ap_uint<4> qualityScore; + + L1TGT_GMT_PromptDisplacedMuon(int valid = 0, + int pT = 0, + int phi = 0, + int eta = 0, + int z0 = 0, + int d0 = 0, + int charge = 0, + int qualityScore = 0) + : L1TGT_Common3Vector(valid, pT, phi, eta), z0(z0), d0(d0), charge(charge), qualityScore(qualityScore) {} ap_uint pack() const override { - return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), z0, d0, charge, qual); + return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), z0, d0, charge, qualityScore); } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int(L1TGT_Common3Vector::unpack(packed), z0, d0, charge, qual); + static L1TGT_GMT_PromptDisplacedMuon from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_GMT_PromptDisplacedMuon(1, + gtObject.hwPT(), + gtObject.hwPhi(), + gtObject.hwEta(), + gtObject.hwZ0() >> 12, + gtObject.hwD0() >> 5, + gtObject.hwCharge(), + gtObject.hwQualityScore()); } P2GTCandidate to_GTObject() const override { P2GTCandidate gt_object(L1TGT_Common3Vector::to_GTObject()); - gt_object.setHwZ0(static_cast(z0) << 5); + gt_object.setHwZ0(static_cast(z0) << 12); gt_object.setHwD0(static_cast(d0) << 5); gt_object.setHwCharge(charge); - gt_object.setHwQual(qual); + gt_object.setHwQualityScore(qualityScore); return gt_object; } @@ -185,8 +186,8 @@ namespace l1t { ap_int<10> z0; ap_int<10> d0; ap_uint<1> charge; - ap_uint<8> qual; - ap_uint<4> iso; + ap_uint<6> qualityFlags; + ap_uint<6> isolationPT; ap_uint<4> beta; L1TGT_GMT_TrackMatchedmuon(int valid = 0, @@ -196,26 +197,42 @@ namespace l1t { int z0 = 0, int d0 = 0, int charge = 0, - int qual = 0, - int iso = 0, + int qualityFlags = 0, + int isolationPT = 0, int beta = 0) - : L1TGT_Common3Vector(valid, pT, phi, eta), z0(z0), d0(d0), charge(charge), qual(qual), iso(iso), beta(beta) {} + : L1TGT_Common3Vector(valid, pT, phi, eta), + z0(z0), + d0(d0), + charge(charge), + qualityFlags(qualityFlags), + isolationPT(isolationPT), + beta(beta) {} ap_uint pack() const override { - return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), z0, d0, charge, qual, iso, beta); + return l1t_pack_int>( + L1TGT_Common3Vector::pack_common(), z0, d0, charge, qualityFlags, isolationPT, beta); } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int(L1TGT_Common3Vector::unpack(packed), z0, d0, charge, qual, iso, beta); + static L1TGT_GMT_TrackMatchedmuon from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_GMT_TrackMatchedmuon(1, + gtObject.hwPT(), + gtObject.hwPhi(), + gtObject.hwEta(), + gtObject.hwZ0() >> 7, + gtObject.hwD0() >> 2, + gtObject.hwCharge(), + gtObject.hwQualityFlags(), + gtObject.hwIsolationPT(), + gtObject.hwBeta()); } P2GTCandidate to_GTObject() const override { P2GTCandidate gt_object(L1TGT_Common3Vector::to_GTObject()); - gt_object.setHwZ0(z0); + gt_object.setHwZ0(static_cast(z0) << 7); gt_object.setHwD0(static_cast(d0) << 2); gt_object.setHwCharge(charge); - gt_object.setHwQual(qual); - gt_object.setHwIso(static_cast(iso) << 7); + gt_object.setHwQualityFlags(static_cast(qualityFlags)); + gt_object.setHwIsolationPT(static_cast(isolationPT)); gt_object.setHwBeta(beta); return gt_object; @@ -228,17 +245,24 @@ namespace l1t { ap_int<8> eta; ap_int<8> phi; ap_uint<8> mass; - ap_uint<6> qual; + ap_uint<6> qualityFlags; // ap_uint<16> /* Index of 3 prongs */; // ap_uint<3> /* Some other quality */; - L1TGT_GMT_TopoObject(int valid = 0, int pT = 0, int phi = 0, int eta = 0, int mass = 0, int qual = 0) - : valid(valid), pT(pT), eta(eta), phi(phi), mass(mass), qual(qual) {} + L1TGT_GMT_TopoObject(int valid = 0, int pT = 0, int phi = 0, int eta = 0, int mass = 0, int qualityFlags = 0) + : valid(valid), pT(pT), eta(eta), phi(phi), mass(mass), qualityFlags(qualityFlags) {} - ap_uint pack() const override { return l1t_pack_int>(valid, pT, eta, phi, mass, qual); } + ap_uint pack() const override { + return l1t_pack_int>(valid, pT, eta, phi, mass, qualityFlags); + } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int(packed, valid, pT, eta, phi, mass, qual); + static L1TGT_GMT_TopoObject from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_GMT_TopoObject(1, + gtObject.hwPT() / 5, + gtObject.hwPhi() >> 5, + gtObject.hwEta() >> 5, + gtObject.hwMass(), + gtObject.hwQualityFlags()); } P2GTCandidate to_GTObject() const override { @@ -247,7 +271,7 @@ namespace l1t { gt_object.setHwPhi(static_cast(phi) << 5); gt_object.setHwEta(static_cast(eta) << 5); gt_object.setHwMass(mass); - gt_object.setHwQual(qual); + gt_object.setHwQualityFlags(qualityFlags); return gt_object; } @@ -267,13 +291,14 @@ namespace l1t { return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), z0, number_of_tracks); } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int>(L1TGT_Common3Vector::unpack(packed), z0, number_of_tracks); + static L1TGT_GTT_PromptJet from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_GTT_PromptJet( + 1, gtObject.hwPT(), gtObject.hwPhi(), gtObject.hwEta(), gtObject.hwZ0() >> 7, gtObject.hwNumber_of_tracks()); } P2GTCandidate to_GTObject() const override { P2GTCandidate gt_object(L1TGT_Common3Vector::to_GTObject()); - gt_object.setHwZ0(z0); + gt_object.setHwZ0(static_cast(z0) << 7); gt_object.setHwNumber_of_tracks(number_of_tracks); return gt_object; @@ -294,14 +319,19 @@ namespace l1t { return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), z0, number_of_tracks, ap_uint<5>(0), d0); } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int>( - L1TGT_Common3Vector::unpack(packed), z0, number_of_tracks, ap_uint<5>(0), d0); + static L1TGT_GTT_DisplacedJet from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_GTT_DisplacedJet(1, + gtObject.hwPT(), + gtObject.hwPhi(), + gtObject.hwEta(), + gtObject.hwZ0() >> 7, + gtObject.hwNumber_of_tracks(), + gtObject.hwD0()); } P2GTCandidate to_GTObject() const override { P2GTCandidate gt_object(L1TGT_Common3Vector::to_GTObject()); - gt_object.setHwZ0(z0); + gt_object.setHwZ0(static_cast(z0) << 7); gt_object.setHwNumber_of_tracks(number_of_tracks); gt_object.setHwD0(d0); @@ -309,7 +339,7 @@ namespace l1t { } }; - struct L1TGT_GTT_Sum : public L1TGT_CommonSum<64> { + struct L1TGT_GTT_Sum : public L1TGT_CommonSum { using L1TGT_CommonSum::L1TGT_CommonSum; }; @@ -333,8 +363,15 @@ namespace l1t { return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), seed_pT, seed_z0, charge, type); } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int(L1TGT_Common3Vector::unpack(packed), seed_pT, seed_z0, charge, type); + static L1TGT_GTT_HadronicTau from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_GTT_HadronicTau(1, + gtObject.hwPT(), + gtObject.hwPhi(), + gtObject.hwEta(), + gtObject.hwSeed_pT(), + gtObject.hwSeed_z0(), + gtObject.hwCharge(), + gtObject.hwType()); } P2GTCandidate to_GTObject() const override { @@ -361,24 +398,36 @@ namespace l1t { return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), z0); } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int(L1TGT_Common3Vector::unpack(packed), z0); + static L1TGT_GTT_LightMeson from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_GTT_LightMeson(1, gtObject.hwPT(), gtObject.hwPhi(), gtObject.hwEta(), gtObject.hwZ0() >> 7); } P2GTCandidate to_GTObject() const override { P2GTCandidate gt_object(L1TGT_Common3Vector::to_GTObject()); - gt_object.setHwZ0(z0); + gt_object.setHwZ0(static_cast(z0) << 7); return gt_object; } }; + struct L1TGT_GTT_Track : public L1TGT_Interface<96> { + //TODO + + L1TGT_GTT_Track(){}; + + ap_uint pack() const override { return ap_uint(0); } + + static L1TGT_GTT_Track from_GTObject(const P2GTCandidate& gtObject) { return L1TGT_GTT_Track(); } + + P2GTCandidate to_GTObject() const override { return P2GTCandidate(); } + }; + struct L1TGT_GTT_PrimaryVert : public L1TGT_Interface<64> { ap_uint<1> valid; ap_int<15> z0; ap_uint<8> number_of_tracks_in_pv; ap_uint<12> sum_pT_pv; - ap_uint<3> qual; + ap_uint<3> qualityScore; ap_uint<10> number_of_tracks_not_in_pv; // ap_uint<15> /* unassigned */; @@ -386,30 +435,35 @@ namespace l1t { int z0 = 0, int number_of_tracks_in_pv = 0, int sum_pT_pv = 0, - int qual = 0, + int qualityScore = 0, int number_of_tracks_not_in_pv = 0) : valid(valid), z0(z0), number_of_tracks_in_pv(number_of_tracks_in_pv), sum_pT_pv(sum_pT_pv), - qual(qual), + qualityScore(qualityScore), number_of_tracks_not_in_pv(number_of_tracks_not_in_pv) {} ap_uint pack() const override { return l1t_pack_int>( - valid, z0 /*, number_of_tracks_in_pv, sum_pT_pv, qual, number_of_tracks_not_in_pv */); // TODO: Maybe later + valid, z0, number_of_tracks_in_pv, sum_pT_pv, qualityScore, number_of_tracks_not_in_pv); } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int(packed, valid, z0, number_of_tracks_in_pv, sum_pT_pv, qual, number_of_tracks_not_in_pv); + static L1TGT_GTT_PrimaryVert from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_GTT_PrimaryVert(1, + gtObject.hwZ0() / 5, + gtObject.hwNumber_of_tracks_in_pv(), + gtObject.hwSum_pT_pv(), + gtObject.hwQualityScore(), + gtObject.hwNumber_of_tracks_not_in_pv()); } P2GTCandidate to_GTObject() const override { P2GTCandidate gt_object; - gt_object.setHwZ0(z0); + gt_object.setHwZ0(static_cast(z0) * 5); gt_object.setHwNumber_of_tracks_in_pv(number_of_tracks_in_pv); gt_object.setHwSum_pT_pv(sum_pT_pv); - gt_object.setHwQual(qual); + gt_object.setHwQualityScore(qualityScore); gt_object.setHwNumber_of_tracks_not_in_pv(number_of_tracks_not_in_pv); return gt_object; @@ -428,19 +482,19 @@ namespace l1t { return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), z0); } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int(L1TGT_Common3Vector::unpack(packed), z0); + static L1TGT_CL2_Jet from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_CL2_Jet(1, gtObject.hwPT(), gtObject.hwPhi(), gtObject.hwEta(), gtObject.hwZ0() >> 7); } P2GTCandidate to_GTObject() const override { P2GTCandidate gt_object(L1TGT_Common3Vector::to_GTObject()); - gt_object.setHwZ0(z0); + gt_object.setHwZ0(static_cast(z0) << 7); return gt_object; } }; - struct L1TGT_CL2_Sum : public L1TGT_CommonSum<64> { + struct L1TGT_CL2_Sum : public L1TGT_CommonSum { using L1TGT_CommonSum::L1TGT_CommonSum; }; @@ -467,8 +521,15 @@ namespace l1t { return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), seed_pT, seed_z0, charge, type); } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int(L1TGT_Common3Vector::unpack(packed), seed_pT, seed_z0, charge, type); + static L1TGT_CL2_Tau from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_CL2_Tau(1, + gtObject.hwPT(), + gtObject.hwPhi(), + gtObject.hwEta(), + gtObject.hwSeed_pT(), + gtObject.hwSeed_z0(), + gtObject.hwCharge(), + gtObject.hwType()); } P2GTCandidate to_GTObject() const override { @@ -483,53 +544,71 @@ namespace l1t { }; struct L1TGT_CL2_Electron : public L1TGT_Common3Vector<96> { - ap_uint<4> qual; - ap_uint<11> iso; + ap_uint<4> qualityFlags; + ap_uint<11> isolationPT; ap_uint<1> charge; ap_int<10> z0; - L1TGT_CL2_Electron( - int valid = 0, int pT = 0, int phi = 0, int eta = 0, int qual = 0, int iso = 0, int charge = 0, int z0 = 0) - : L1TGT_Common3Vector(valid, pT, phi, eta), qual(qual), iso(iso), charge(charge), z0(z0) {} + L1TGT_CL2_Electron(int valid = 0, + int pT = 0, + int phi = 0, + int eta = 0, + int qualityFlags = 0, + int isolationPT = 0, + int charge = 0, + int z0 = 0) + : L1TGT_Common3Vector(valid, pT, phi, eta), + qualityFlags(qualityFlags), + isolationPT(isolationPT), + charge(charge), + z0(z0) {} ap_uint pack() const override { - return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), qual, iso, charge, z0); + return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), qualityFlags, isolationPT, charge, z0); } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int(L1TGT_Common3Vector::unpack(packed), qual, iso, charge, z0); + static L1TGT_CL2_Electron from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_CL2_Electron(1, + gtObject.hwPT(), + gtObject.hwPhi(), + gtObject.hwEta(), + gtObject.hwQualityFlags(), + gtObject.hwIsolationPT(), + gtObject.hwCharge(), + gtObject.hwZ0() >> 7); } P2GTCandidate to_GTObject() const override { P2GTCandidate gt_object(L1TGT_Common3Vector::to_GTObject()); - gt_object.setHwQual(qual); - gt_object.setHwIso(iso); + gt_object.setHwQualityFlags(qualityFlags); + gt_object.setHwIsolationPT(isolationPT); gt_object.setHwCharge(charge); - gt_object.setHwZ0(z0); + gt_object.setHwZ0(static_cast(z0) << 7); return gt_object; } }; struct L1TGT_CL2_Photon : public L1TGT_Common3Vector<96> { - ap_uint<4> qual; - ap_uint<11> iso; + ap_uint<4> qualityFlags; + ap_uint<11> isolationPT; - L1TGT_CL2_Photon(int valid = 0, int pT = 0, int phi = 0, int eta = 0, int qual = 0, int iso = 0) - : L1TGT_Common3Vector(valid, pT, phi, eta), qual(qual), iso(iso) {} + L1TGT_CL2_Photon(int valid = 0, int pT = 0, int phi = 0, int eta = 0, int qualityFlags = 0, int isolationPT = 0) + : L1TGT_Common3Vector(valid, pT, phi, eta), qualityFlags(qualityFlags), isolationPT(isolationPT) {} ap_uint pack() const override { - return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), qual, iso); + return l1t_pack_int>(L1TGT_Common3Vector::pack_common(), qualityFlags, isolationPT); } - ap_uint unpack(const ap_uint& packed) override { - return l1t_unpack_int(L1TGT_Common3Vector::unpack(packed), qual, iso); + static L1TGT_CL2_Photon from_GTObject(const P2GTCandidate& gtObject) { + return L1TGT_CL2_Photon( + 1, gtObject.hwPT(), gtObject.hwPhi(), gtObject.hwEta(), gtObject.hwQualityFlags(), gtObject.hwIsolationPT()); } P2GTCandidate to_GTObject() const override { P2GTCandidate gt_object(L1TGT_Common3Vector::to_GTObject()); - gt_object.setHwQual(qual); - gt_object.setHwIso(iso); + gt_object.setHwQualityFlags(qualityFlags); + gt_object.setHwIsolationPT(isolationPT); return gt_object; } diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTEvaluationProducer.cc b/L1Trigger/Phase2L1GT/plugins/L1GTEvaluationProducer.cc index 723b679014382..53c3ad54beded 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTEvaluationProducer.cc +++ b/L1Trigger/Phase2L1GT/plugins/L1GTEvaluationProducer.cc @@ -129,11 +129,14 @@ L1GTEvaluationProducer::L1GTEvaluationProducer(const edm::ParameterSet &config) produces("GTTRhoCandidates"); produces("GTTBsCandidates"); produces("GTTHadronicTaus"); + produces("GTTPromptTracks"); + produces("GTTDisplacedTracks"); produces("GTTPrimaryVert"); produces("GTTPromptHtSum"); produces("GTTDisplacedHtSum"); produces("GTTEtSum"); - produces("CL2Jets"); + produces("CL2JetsSC4"); + produces("CL2JetsSC8"); produces("CL2Taus"); produces("CL2Electrons"); produces("CL2Photons"); @@ -202,34 +205,41 @@ static std::vector> vpack(const Args &...vobjects) { void L1GTEvaluationProducer::writeInputPatterns( const std::unordered_map>> &inputObjects) { - boardDataWriter_.addEvent(l1t::demo::EventData{ - {{{"GTT", 0}, - vpack(inputObjects.at("GTTPromptJets"), - inputObjects.at("GTTDisplacedJets"), - inputObjects.at("GTTPromptHtSum"), - inputObjects.at("GTTDisplacedHtSum"), - inputObjects.at("GTTEtSum"))}, - {{"GTT", 1}, vpack(inputObjects.at("GTTHadronicTaus"))}, - {{"CL2", 0}, vpack(inputObjects.at("CL2Jets"), inputObjects.at("CL2HtSum"), inputObjects.at("CL2EtSum"))}, - {{"CL2", 1}, vpack(inputObjects.at("CL2Taus"))}, - {{"GCT", 0}, - vpack(inputObjects.at("GCTNonIsoEg"), - inputObjects.at("GCTIsoEg"), - inputObjects.at("GCTJets"), - inputObjects.at("GCTTaus"), - inputObjects.at("GCTHtSum"), - inputObjects.at("GCTEtSum"))}, - {{"GMT", 0}, - vpack(inputObjects.at("GMTSaPromptMuons"), - inputObjects.at("GMTSaDisplacedMuons"), - inputObjects.at("GMTTkMuons"), - inputObjects.at("GMTTopo"))}, - {{"CL2", 2}, vpack(inputObjects.at("CL2Electrons"), inputObjects.at("CL2Photons"))}, - {{"GTT", 2}, - vpack(inputObjects.at("GTTPhiCandidates"), - inputObjects.at("GTTRhoCandidates"), - inputObjects.at("GTTBsCandidates"))}, - {{"GTT", 3}, vpack(inputObjects.at("GTTPrimaryVert"))}}}); + boardDataWriter_.addEvent( + l1t::demo::EventData{{{{"GTT", 0}, + vpack(inputObjects.at("GTTPromptJets"), + inputObjects.at("GTTDisplacedJets"), + inputObjects.at("GTTPromptHtSum"), + inputObjects.at("GTTDisplacedHtSum"), + inputObjects.at("GTTEtSum"))}, + {{"GTT", 1}, vpack(inputObjects.at("GTTHadronicTaus"))}, + {{"CL2", 0}, + vpack(inputObjects.at("CL2JetsSC4"), + inputObjects.at("CL2HtSum"), + inputObjects.at("CL2EtSum"), + inputObjects.at("CL2JetsSC8"))}, + {{"CL2", 1}, vpack(inputObjects.at("CL2Taus"))}, + {{"GCT", 0}, + vpack(inputObjects.at("GCTNonIsoEg"), + inputObjects.at("GCTIsoEg"), + inputObjects.at("GCTJets"), + inputObjects.at("GCTTaus"), + inputObjects.at("GCTEtSum"), + inputObjects.at("GCTHtSum"))}, + {{"GMT", 0}, + vpack(inputObjects.at("GMTSaPromptMuons"), + inputObjects.at("GMTSaDisplacedMuons"), + inputObjects.at("GMTTkMuons"), + inputObjects.at("GMTTopo"))}, + {{"CL2", 2}, vpack(inputObjects.at("CL2Electrons"), inputObjects.at("CL2Photons"))}, + {{"GTT", 2}, + vpack(inputObjects.at("GTTPhiCandidates"), + inputObjects.at("GTTRhoCandidates"), + inputObjects.at("GTTBsCandidates"))}, + {{"GTT", 3}, + vpack(inputObjects.at("GTTPromptTracks"), + inputObjects.at("GTTDisplacedTracks"), + inputObjects.at("GTTPrimaryVert"))}}}); } void L1GTEvaluationProducer::produce(edm::Event &event, const edm::EventSetup &setup) { @@ -265,6 +275,8 @@ void L1GTEvaluationProducer::produce(edm::Event &event, const edm::EventSetup &s std::make_unique(true, nextPt(), nextEta(), nextPhi(), nextValue())); // Global Track Trigger + inputObjects["GTTPromptTracks"].emplace_back(std::make_unique()); + inputObjects["GTTDisplacedTracks"].emplace_back(std::make_unique()); inputObjects["GTTPrimaryVert"].emplace_back( std::make_unique(true, nextPt(), nextEta(), nextPhi(), nextValue(), nextValue())); inputObjects["GTTPromptJets"].emplace_back( @@ -281,7 +293,9 @@ void L1GTEvaluationProducer::produce(edm::Event &event, const edm::EventSetup &s std::make_unique(true, nextPt(), nextEta(), nextPhi(), nextValue())); // Correlator Layer-2 - inputObjects["CL2Jets"].emplace_back( + inputObjects["CL2JetsSC4"].emplace_back( + std::make_unique(true, nextPt(), nextEta(), nextPhi(), nextValue())); + inputObjects["CL2JetsSC8"].emplace_back( std::make_unique(true, nextPt(), nextEta(), nextPhi(), nextValue())); inputObjects["CL2Electrons"].emplace_back(std::make_unique( true, nextPt(), nextEta(), nextPhi(), nextValue(), nextValue(), nextValue(), nextValue())); diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTFinOrBoardWriter.cc b/L1Trigger/Phase2L1GT/plugins/L1GTFinOrBoardWriter.cc new file mode 100644 index 0000000000000..e2b2d3569b7b3 --- /dev/null +++ b/L1Trigger/Phase2L1GT/plugins/L1GTFinOrBoardWriter.cc @@ -0,0 +1,197 @@ +/** + * BoardDataWriter for validation with hardware. Currently only writing the algo bits is implemented. + **/ + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "L1Trigger/DemonstratorTools/interface/BoardDataWriter.h" +#include "L1Trigger/DemonstratorTools/interface/utilities.h" + +#include "FWCore/Utilities/interface/EDGetToken.h" + +#include "DataFormats/L1Trigger/interface/P2GTAlgoBlock.h" + +#include "ap_int.h" + +#include +#include +#include + +using namespace l1t; + +class L1GTFinOrBoardWriter : public edm::one::EDAnalyzer<> { +public: + explicit L1GTFinOrBoardWriter(const edm::ParameterSet&); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + const std::array channelsLow_; + const std::array channelsMid_; + const std::array channelsHigh_; + const unsigned int channelFinOr_; + const edm::EDGetTokenT algoBlocksToken_; + l1t::demo::BoardDataWriter boardDataWriter_; + + std::map>> linkData_; + std::size_t tmuxCounter_; +}; + +L1GTFinOrBoardWriter::L1GTFinOrBoardWriter(const edm::ParameterSet& config) + : channelsLow_(config.getParameter>("channelsLow")), + channelsMid_(config.getParameter>("channelsMid")), + channelsHigh_(config.getParameter>("channelsHigh")), + channelFinOr_(config.getParameter("channelFinOr")), + algoBlocksToken_(consumes(config.getParameter("algoBlocksTag"))), + boardDataWriter_(l1t::demo::parseFileFormat(config.getParameter("patternFormat")), + config.getParameter("outputFilename"), + config.getParameter("outputFileExtension"), + 9, + 2, + config.getParameter("maxLines"), + [&]() { + l1t::demo::BoardDataWriter::ChannelMap_t channelMap; + channelMap.insert({l1t::demo::LinkId{"BeforeBxMaskAndPrescaleLow", channelsLow_[0]}, + {l1t::demo::ChannelSpec{2, 0, 0}, {channelsLow_[0]}}}); + channelMap.insert({l1t::demo::LinkId{"BeforePrescaleLow", channelsLow_[1]}, + {l1t::demo::ChannelSpec{2, 0, 0}, {channelsLow_[1]}}}); + channelMap.insert({l1t::demo::LinkId{"FinalLow", channelsLow_[2]}, + {l1t::demo::ChannelSpec{2, 0, 0}, {channelsLow_[2]}}}); + + channelMap.insert({l1t::demo::LinkId{"BeforeBxMaskAndPrescaleMid", channelsMid_[0]}, + {l1t::demo::ChannelSpec{2, 0, 0}, {channelsMid_[0]}}}); + channelMap.insert({l1t::demo::LinkId{"BeforePrescaleMid", channelsMid_[1]}, + {l1t::demo::ChannelSpec{2, 0, 0}, {channelsMid_[1]}}}); + channelMap.insert({l1t::demo::LinkId{"FinalMid", channelsMid_[2]}, + {l1t::demo::ChannelSpec{2, 0, 0}, {channelsMid_[2]}}}); + + channelMap.insert({l1t::demo::LinkId{"BeforeBxMaskAndPrescaleHigh", channelsHigh_[0]}, + {l1t::demo::ChannelSpec{2, 0, 0}, {channelsHigh_[0]}}}); + channelMap.insert({l1t::demo::LinkId{"BeforePrescaleHigh", channelsHigh_[1]}, + {l1t::demo::ChannelSpec{2, 0, 0}, {channelsHigh_[1]}}}); + channelMap.insert({l1t::demo::LinkId{"FinalHigh", channelsHigh_[2]}, + {l1t::demo::ChannelSpec{2, 0, 0}, {channelsHigh_[2]}}}); + + channelMap.insert({l1t::demo::LinkId{"FinOr", channelFinOr_}, + {l1t::demo::ChannelSpec{2, 0, 0}, {channelFinOr_}}}); + + return channelMap; + }()), + linkData_(), + tmuxCounter_(0) {} + +void L1GTFinOrBoardWriter::analyze(const edm::Event& event, const edm::EventSetup& iSetup) { + const P2GTAlgoBlockMap& algoBlocks = event.get(algoBlocksToken_); + + auto algoBlockIt = algoBlocks.begin(); + + if (tmuxCounter_ == 0) { + linkData_[l1t::demo::LinkId{"BeforeBxMaskAndPrescaleLow", channelsLow_[0]}] = std::vector>(18, 0); + linkData_[l1t::demo::LinkId{"BeforePrescaleLow", channelsLow_[1]}] = std::vector>(18, 0); + linkData_[l1t::demo::LinkId{"FinalLow", channelsLow_[2]}] = std::vector>(18, 0); + linkData_[l1t::demo::LinkId{"BeforeBxMaskAndPrescaleMid", channelsMid_[0]}] = std::vector>(18, 0); + linkData_[l1t::demo::LinkId{"BeforePrescaleMid", channelsMid_[1]}] = std::vector>(18, 0); + linkData_[l1t::demo::LinkId{"FinalMid", channelsMid_[2]}] = std::vector>(18, 0); + linkData_[l1t::demo::LinkId{"BeforeBxMaskAndPrescaleHigh", channelsHigh_[0]}] = std::vector>(18, 0); + linkData_[l1t::demo::LinkId{"BeforePrescaleHigh", channelsHigh_[1]}] = std::vector>(18, 0); + linkData_[l1t::demo::LinkId{"FinalHigh", channelsHigh_[2]}] = std::vector>(18, 0); + linkData_[l1t::demo::LinkId{"FinOr", channelFinOr_}] = std::vector>(18, 0); + } + + for (std::size_t word = 0; word < 9; word++) { + for (std::size_t idx = 0; idx < 64 && algoBlockIt != algoBlocks.end(); idx++, algoBlockIt++) { + auto& [alogName, algoBlock] = *algoBlockIt; + linkData_[l1t::demo::LinkId{"BeforeBxMaskAndPrescaleLow", channelsLow_[0]}][word + tmuxCounter_ * 9].set( + idx, algoBlock.decisionBeforeBxMaskAndPrescale()); + linkData_[l1t::demo::LinkId{"BeforePrescaleLow", channelsLow_[1]}][word + tmuxCounter_ * 9].set( + idx, algoBlock.decisionBeforePrescale()); + linkData_[l1t::demo::LinkId{"FinalLow", channelsLow_[2]}][word + tmuxCounter_ * 9].set(idx, + algoBlock.decisionFinal()); + } + } + + for (std::size_t word = 0; word < 9; word++) { + for (std::size_t idx = 0; idx < 64 && algoBlockIt != algoBlocks.end(); idx++, algoBlockIt++) { + auto& [alogName, algoBlock] = *algoBlockIt; + linkData_[l1t::demo::LinkId{"BeforeBxMaskAndPrescaleMid", channelsMid_[0]}][word + tmuxCounter_ * 9].set( + idx, algoBlock.decisionBeforeBxMaskAndPrescale()); + linkData_[l1t::demo::LinkId{"BeforePrescaleMid", channelsMid_[1]}][word + tmuxCounter_ * 9].set( + idx, algoBlock.decisionBeforePrescale()); + linkData_[l1t::demo::LinkId{"FinalMid", channelsMid_[2]}][word + tmuxCounter_ * 9].set(idx, + algoBlock.decisionFinal()); + } + } + + for (std::size_t word = 0; word < 9; word++) { + for (std::size_t idx = 0; idx < 64 && algoBlockIt != algoBlocks.end(); idx++, algoBlockIt++) { + auto& [algoName, algoBlock] = *algoBlockIt; + linkData_[l1t::demo::LinkId{"BeforeBxMaskAndPrescaleHigh", channelsHigh_[0]}][word + tmuxCounter_ * 9].set( + idx, algoBlock.decisionBeforeBxMaskAndPrescale()); + linkData_[l1t::demo::LinkId{"BeforePrescaleHigh", channelsHigh_[1]}][word + tmuxCounter_ * 9].set( + idx, algoBlock.decisionBeforePrescale()); + linkData_[l1t::demo::LinkId{"FinalHigh", channelsHigh_[2]}][word + tmuxCounter_ * 9].set( + idx, algoBlock.decisionFinal()); + } + } + + bool vetoed = false, vetoedPreview = false; + int finOrByTypes = 0, finOrPreviewByTypes = 0; + for (auto algoBlockIt = algoBlocks.begin(); algoBlockIt != algoBlocks.end(); algoBlockIt++) { + auto& [alogName, algoBlock] = *algoBlockIt; + vetoed |= (algoBlock.isVeto() && algoBlock.decisionFinal()); + vetoedPreview |= (algoBlock.isVeto() && algoBlock.decisionFinalPreview()); + finOrByTypes |= algoBlock.decisionFinal() ? algoBlock.triggerTypes() : 0; + finOrPreviewByTypes |= algoBlock.decisionFinalPreview() ? algoBlock.triggerTypes() : 0; + } + + // Add FinOrTrigger bits per https://gitlab.cern.ch/cms-cactus/phase2/firmware/gt-final-or#output-finor-bits + ap_uint<64> finOrBits(0); + finOrBits(7, 0) = finOrByTypes; + finOrBits(15, 8) = finOrPreviewByTypes; + finOrBits(23, 16) = vetoed ? 0 : finOrByTypes; + finOrBits(31, 24) = vetoedPreview ? 0 : finOrPreviewByTypes; + + linkData_[l1t::demo::LinkId{"FinOr", channelFinOr_}][0 + tmuxCounter_ * 9] = finOrBits; + + if (tmuxCounter_ == 1) { + boardDataWriter_.addEvent(l1t::demo::EventData(linkData_)); + } + + tmuxCounter_ = (tmuxCounter_ + 1) % 2; +} + +void L1GTFinOrBoardWriter::endJob() { + if (tmuxCounter_ == 1) { + boardDataWriter_.addEvent(l1t::demo::EventData(linkData_)); + } + + boardDataWriter_.flush(); +} + +void L1GTFinOrBoardWriter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("outputFilename"); + desc.add("outputFileExtension", "txt"); + desc.add("algoBlocksTag"); + desc.add>("channelsLow"); + desc.add>("channelsMid"); + desc.add>("channelsHigh"); + desc.add("channelFinOr"); + desc.add("maxLines", 1024); + desc.add("patternFormat", "EMPv2"); + + descriptions.addDefault(desc); +} + +DEFINE_FWK_MODULE(L1GTFinOrBoardWriter); diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTNTupleProducer.cc b/L1Trigger/Phase2L1GT/plugins/L1GTNTupleProducer.cc deleted file mode 100644 index 1028b2c64769c..0000000000000 --- a/L1Trigger/Phase2L1GT/plugins/L1GTNTupleProducer.cc +++ /dev/null @@ -1,163 +0,0 @@ -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "TTree.h" - -#include "DataFormats/L1Trigger/interface/P2GTCandidate.h" - -#include -#include -#include -#include - -using namespace l1t; - -class L1GTNTupleProducer : public edm::one::EDAnalyzer<> { -public: - explicit L1GTNTupleProducer(const edm::ParameterSet&); - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - //void beginJob(void) override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - //void endJob() override; - -private: - void fillData(const l1t::P2GTCandidateCollection& collection, const std::string& instanceName); - - const std::string producerName_; - const unsigned maxNTuples_; - - const edm::EDGetTokenT gttPromptJetToken_; - const edm::EDGetTokenT gttDisplacedJetToken_; - const edm::EDGetTokenT gttPrimaryVertexToken_; - - const edm::EDGetTokenT gmtSaPromptMuonToken_; - const edm::EDGetTokenT gmtSaDisplacedMuonToken_; - const edm::EDGetTokenT gmtTkMuonToken_; - - const edm::EDGetTokenT cl2JetToken_; - const edm::EDGetTokenT cl2PhotonToken_; - const edm::EDGetTokenT cl2ElectronToken_; - const edm::EDGetTokenT cl2EtSumToken_; - const edm::EDGetTokenT cl2HtSumToken_; - - const edm::Service fs_; - TTree* tree_; - - std::unordered_map> data_; -}; - -static const std::map> NTUPLE_VARIABLES = { - {"GTTPromptJet", {"Pt", "Eta", "Phi"}}, - {"GTTDisplacedJet", {"Pt", "Eta", "Phi"}}, - {"GTTPrimaryVertex", {"Z0"}}, - {"GMTSaPromptMuon", {"Pt", "Eta", "Phi", "Z0"}}, - {"GMTSaDisplacedMuon", {"Pt", "Eta", "Phi", "Z0"}}, - {"GMTTkMuon", {"Pt", "Eta", "Phi", "Z0"}}, - {"CL2Jet", {"Pt", "Eta", "Phi", "Z0"}}, - {"CL2Photon", {"Pt", "Eta", "Phi"}}, - {"CL2Electron", {"Pt", "Eta", "Phi", "Z0"}}, - {"CL2EtSum", {"Pt", "Phi", "ScaSumPt"}}, - {"CL2HtSum", {"Pt", "Phi", "ScaSumPt"}}}; - -L1GTNTupleProducer::L1GTNTupleProducer(const edm::ParameterSet& config) - : producerName_(config.getParameter("producerName")), - maxNTuples_(config.getParameter("maxNTuples")), - gttPromptJetToken_(consumes(edm::InputTag(producerName_, "GTTPromptJets"))), - gttDisplacedJetToken_(consumes(edm::InputTag(producerName_, "GTTDisplacedJets"))), - gttPrimaryVertexToken_(consumes(edm::InputTag(producerName_, "GTTPrimaryVert"))), - gmtSaPromptMuonToken_(consumes(edm::InputTag(producerName_, "GMTSaPromptMuons"))), - gmtSaDisplacedMuonToken_(consumes(edm::InputTag(producerName_, "GMTSaDisplacedMuons"))), - gmtTkMuonToken_(consumes(edm::InputTag(producerName_, "GMTTkMuons"))), - cl2JetToken_(consumes(edm::InputTag(producerName_, "CL2Jets"))), - cl2PhotonToken_(consumes(edm::InputTag(producerName_, "CL2Photons"))), - cl2ElectronToken_(consumes(edm::InputTag(producerName_, "CL2Electrons"))), - cl2EtSumToken_(consumes(edm::InputTag(producerName_, "CL2EtSum"))), - cl2HtSumToken_(consumes(edm::InputTag(producerName_, "CL2HtSum"))), - tree_(fs_->make("L1PhaseIITree", "L1PhaseIITree")) { - for (const auto& [collec, variables] : NTUPLE_VARIABLES) { - for (const std::string& var : variables) { - std::string name = collec + var; - tree_->Branch(name.c_str(), &data_[name], 8000, 1); - } - } -} - -void L1GTNTupleProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - desc.add("producerName"); - desc.add("maxNTuples"); - - descriptions.addDefault(desc); -} - -void L1GTNTupleProducer::fillData(const l1t::P2GTCandidateCollection& collection, const std::string& instanceName) { - for (const P2GTCandidate& object : collection) { - for (const std::string& var : NTUPLE_VARIABLES.at(instanceName)) { - std::string name = instanceName + var; - if (var == "Pt") - data_.at(name).push_back(object.hwPT()); - else if (var == "Eta") - data_.at(name).push_back(object.hwEta()); - else if (var == "Phi") - data_.at(name).push_back(object.hwPhi()); - else if (var == "Z0") - data_.at(name).push_back(object.hwZ0()); - else if (var == "D0") - data_.at(name).push_back(object.hwD0()); - else if (var == "ScaSumPt") - data_.at(name).push_back(object.hwSca_sum()); - } - } -} - -void L1GTNTupleProducer::analyze(const edm::Event& event, const edm::EventSetup& setup) { - const l1t::P2GTCandidateCollection& gttPromptJets = event.get(gttPromptJetToken_); - fillData(gttPromptJets, "GTTPromptJet"); - - const l1t::P2GTCandidateCollection& gttDisplacedJets = event.get(gttDisplacedJetToken_); - fillData(gttDisplacedJets, "GTTDisplacedJet"); - - const l1t::P2GTCandidateCollection& gttPrimaryVertices = event.get(gttPrimaryVertexToken_); - fillData(gttPrimaryVertices, "GTTPrimaryVertex"); - - const l1t::P2GTCandidateCollection& gmtSaPromptMuons = event.get(gmtSaPromptMuonToken_); - fillData(gmtSaPromptMuons, "GMTSaPromptMuon"); - - const l1t::P2GTCandidateCollection& gmtSaDisplacedMuons = event.get(gmtSaDisplacedMuonToken_); - fillData(gmtSaDisplacedMuons, "GMTSaDisplacedMuon"); - - const l1t::P2GTCandidateCollection& gmtTkMuons = event.get(gmtTkMuonToken_); - fillData(gmtTkMuons, "GMTTkMuon"); - - const l1t::P2GTCandidateCollection& cl2Jets = event.get(cl2JetToken_); - fillData(cl2Jets, "CL2Jet"); - - const l1t::P2GTCandidateCollection& cl2Photons = event.get(cl2PhotonToken_); - fillData(cl2Photons, "CL2Photon"); - - const l1t::P2GTCandidateCollection& cl2Electrons = event.get(cl2ElectronToken_); - fillData(cl2Electrons, "CL2Electron"); - - const l1t::P2GTCandidateCollection& cl2EtSum = event.get(cl2EtSumToken_); - fillData(cl2EtSum, "CL2EtSum"); - - const l1t::P2GTCandidateCollection& cl2HtSum = event.get(cl2HtSumToken_); - fillData(cl2HtSum, "CL2HtSum"); - - tree_->Fill(); - - for (auto& [key, vector] : data_) { - vector.clear(); - } -} - -DEFINE_FWK_MODULE(L1GTNTupleProducer); diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTOutputObjectWriter.cc b/L1Trigger/Phase2L1GT/plugins/L1GTOutputObjectWriter.cc new file mode 100644 index 0000000000000..5195c5fe85823 --- /dev/null +++ b/L1Trigger/Phase2L1GT/plugins/L1GTOutputObjectWriter.cc @@ -0,0 +1,330 @@ +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/allowedValues.h" +#include "DataFormats/Common/interface/Handle.h" + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "DataFormats/Common/interface/View.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" + +#include "L1Trigger/DemonstratorTools/interface/BoardDataWriter.h" +#include "L1Trigger/DemonstratorTools/interface/utilities.h" + +#include "DataFormats/L1Trigger/interface/P2GTCandidate.h" + +#include "L1GTEvaluationInterface.h" + +#include +#include +#include +#include +#include +#include + +#include + +using namespace l1t; + +static constexpr std::array, 27> OUTPUT_CHANNELS_VU9P{ + {{"GTTPromptJets", 2, 6}, + {"GTTDisplacedJets", 6, 10}, + {"GTTPromptHtSum", 10, 11}, + {"GTTDisplacedHtSum", 11, 12}, + {"GTTEtSum", 12, 13}, + {"GTTHadronicTaus", 13, 16}, + {"CL2JetsSC4", 24, 28}, + {"CL2JetsSC8", 28, 32}, + {"CL2Taus", 34, 37}, + {"CL2HtSum", 37, 38}, + {"CL2EtSum", 38, 39}, + {"GCTNonIsoEg", 48, 50}, + {"GCTIsoEg", 50, 52}, + {"GCTJets", 52, 54}, + {"GCTTaus", 54, 56}, + {"GCTHtSum", 56, 57}, + {"GCTEtSum", 57, 58}, + {"GMTSaPromptMuons", 60, 62}, + {"GMTSaDisplacedMuons", 62, 64}, + {"GMTTkMuons", 64, 67}, + {"GMTTopo", 67, 69}, + {"CL2Electrons", 80, 83}, + {"CL2Photons", 83, 86}, + {"GTTPhiCandidates", 104, 107}, + {"GTTRhoCandidates", 107, 110}, + {"GTTBsCandidates", 110, 113}, + {"GTTPrimaryVert", 113, 115}}}; + +static constexpr std::array, 27> OUTPUT_CHANNELS_VU13P{ + {{"GTTPromptJets", 2, 6}, + {"GTTDisplacedJets", 6, 10}, + {"GTTPromptHtSum", 10, 11}, + {"GTTDisplacedHtSum", 11, 12}, + {"GTTEtSum", 12, 13}, + {"GTTHadronicTaus", 13, 16}, + {"GCTNonIsoEg", 26, 28}, + {"GCTIsoEg", 28, 30}, + {"GCTJets", 30, 32}, + {"CL2JetsSC4", 32, 36}, + {"CL2JetsSC8", 36, 40}, + {"CL2Taus", 40, 43}, + {"CL2HtSum", 43, 44}, + {"CL2EtSum", 44, 45}, + {"GMTSaPromptMuons", 68, 70}, + {"GMTSaDisplacedMuons", 70, 72}, + {"GMTTkMuons", 72, 75}, + {"GMTTopo", 75, 77}, + {"CL2Electrons", 80, 83}, + {"CL2Photons", 83, 86}, + {"GCTTaus", 96, 98}, + {"GCTHtSum", 98, 99}, + {"GCTEtSum", 99, 100}, + {"GTTPhiCandidates", 112, 115}, + {"GTTRhoCandidates", 115, 118}, + {"GTTBsCandidates", 118, 121}, + {"GTTPrimaryVert", 121, 123}}}; + +class L1GTOutputObjectWriter : public edm::one::EDAnalyzer<> { +public: + explicit L1GTOutputObjectWriter(const edm::ParameterSet&); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + template + std::vector> fillCollection( + const edm::Event& event, const edm::EDGetTokenT& token) const; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + const edm::EDGetTokenT gctNonIsoEgToken_; + const edm::EDGetTokenT gctIsoEgToken_; + const edm::EDGetTokenT gctJetsToken_; + const edm::EDGetTokenT gctTausToken_; + const edm::EDGetTokenT gctHtSumToken_; + const edm::EDGetTokenT gctEtSumToken_; + const edm::EDGetTokenT gmtSaPromptMuonsToken_; + const edm::EDGetTokenT gmtSaDisplacedMuonsToken_; + const edm::EDGetTokenT gmtTkMuonsToken_; + const edm::EDGetTokenT gmtTopoToken_; + const edm::EDGetTokenT gttPromptJetsToken_; + const edm::EDGetTokenT gttDisplacedJetsToken_; + const edm::EDGetTokenT gttPhiCandidatesToken_; + const edm::EDGetTokenT gttRhoCandidatesToken_; + const edm::EDGetTokenT gttBsCandidatesToken_; + const edm::EDGetTokenT gttHadronicTausToken_; + const edm::EDGetTokenT gttPrimaryVertToken_; + const edm::EDGetTokenT gttPromptHtSumToken_; + const edm::EDGetTokenT gttDisplacedHtSumToken_; + const edm::EDGetTokenT gttEtSumToken_; + const edm::EDGetTokenT cl2JetsSc4Token_; + const edm::EDGetTokenT cl2JetsSc8Token_; + const edm::EDGetTokenT cl2TausToken_; + const edm::EDGetTokenT cl2ElectronsToken_; + const edm::EDGetTokenT cl2PhotonsToken_; + const edm::EDGetTokenT cl2HtSumToken_; + const edm::EDGetTokenT cl2EtSumToken_; + const std::array, 27> outputChannelDef_; + l1t::demo::BoardDataWriter boardDataWriter_; +}; + +L1GTOutputObjectWriter::L1GTOutputObjectWriter(const edm::ParameterSet& config) + : gctNonIsoEgToken_(consumes(config.getParameter("GCTNonIsoEg"))), + gctIsoEgToken_(consumes(config.getParameter("GCTIsoEg"))), + gctJetsToken_(consumes(config.getParameter("GCTJets"))), + gctTausToken_(consumes(config.getParameter("GCTTaus"))), + gctHtSumToken_(consumes(config.getParameter("GCTHtSum"))), + gctEtSumToken_(consumes(config.getParameter("GCTEtSum"))), + gmtSaPromptMuonsToken_(consumes(config.getParameter("GMTSaPromptMuons"))), + gmtSaDisplacedMuonsToken_( + consumes(config.getParameter("GMTSaDisplacedMuons"))), + gmtTkMuonsToken_(consumes(config.getParameter("GMTTkMuons"))), + gmtTopoToken_(consumes(config.getParameter("GMTTopo"))), + gttPromptJetsToken_(consumes(config.getParameter("GTTPromptJets"))), + gttDisplacedJetsToken_(consumes(config.getParameter("GTTDisplacedJets"))), + gttPhiCandidatesToken_(consumes(config.getParameter("GTTPhiCandidates"))), + gttRhoCandidatesToken_(consumes(config.getParameter("GTTRhoCandidates"))), + gttBsCandidatesToken_(consumes(config.getParameter("GTTBsCandidates"))), + gttHadronicTausToken_(consumes(config.getParameter("GTTHadronicTaus"))), + gttPrimaryVertToken_(consumes(config.getParameter("GTTPrimaryVert"))), + gttPromptHtSumToken_(consumes(config.getParameter("GTTPromptHtSum"))), + gttDisplacedHtSumToken_( + consumes(config.getParameter("GTTDisplacedHtSum"))), + gttEtSumToken_(consumes(config.getParameter("GTTEtSum"))), + cl2JetsSc4Token_(consumes(config.getParameter("CL2JetsSC4"))), + cl2JetsSc8Token_(consumes(config.getParameter("CL2JetsSC8"))), + cl2TausToken_(consumes(config.getParameter("CL2Taus"))), + cl2ElectronsToken_(consumes(config.getParameter("CL2Electrons"))), + cl2PhotonsToken_(consumes(config.getParameter("CL2Photons"))), + cl2HtSumToken_(consumes(config.getParameter("CL2HtSum"))), + cl2EtSumToken_(consumes(config.getParameter("CL2EtSum"))), + outputChannelDef_(config.getParameter("platform") == "VU13P" ? OUTPUT_CHANNELS_VU13P + : OUTPUT_CHANNELS_VU9P), + boardDataWriter_(l1t::demo::parseFileFormat(config.getParameter("patternFormat")), + config.getParameter("outputFilename"), + config.getParameter("outputFileExtension"), + 9, + 1, + config.getParameter("maxLines"), + [&]() { + demo::BoardDataWriter::ChannelMap_t channelMap; + for (const auto& [name, start, end] : outputChannelDef_) { + for (std::size_t i = start; i < end; i++) { + channelMap.insert({{name, i - start}, {{1, 0}, {i}}}); + } + } + return channelMap; + }()) {} + +void L1GTOutputObjectWriter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("GCTNonIsoEg"); + desc.add("GCTIsoEg"); + desc.add("GCTJets"); + desc.add("GCTTaus"); + desc.add("GCTHtSum"); + desc.add("GCTEtSum"); + desc.add("GMTSaPromptMuons"); + desc.add("GMTSaDisplacedMuons"); + desc.add("GMTTkMuons"); + desc.add("GMTTopo"); + desc.add("GTTPromptJets"); + desc.add("GTTDisplacedJets"); + desc.add("GTTPhiCandidates"); + desc.add("GTTRhoCandidates"); + desc.add("GTTBsCandidates"); + desc.add("GTTHadronicTaus"); + desc.add("GTTPrimaryVert"); + desc.add("GTTPromptHtSum"); + desc.add("GTTDisplacedHtSum"); + desc.add("GTTEtSum"); + desc.add("CL2JetsSC4"); + desc.add("CL2JetsSC8"); + desc.add("CL2Taus"); + desc.add("CL2Electrons"); + desc.add("CL2Photons"); + desc.add("CL2HtSum"); + desc.add("CL2EtSum"); + + desc.add("maxLines", 1024); + desc.add("outputFilename"); + desc.add("outputFileExtension", "txt"); + desc.add("patternFormat", "EMPv2"); + desc.ifValue(edm::ParameterDescription("platform", "VU9P", true), + edm::allowedValues("VU9P", "VU13P")); + + descriptions.addWithDefaultLabel(desc); +} + +template +std::vector> L1GTOutputObjectWriter::fillCollection( + const edm::Event& event, const edm::EDGetTokenT& token) const { + std::vector> outputCollection; + + for (const P2GTCandidate& object : event.get(token)) { + outputCollection.push_back(std::make_unique(T::from_GTObject(object))); + } + + return outputCollection; +} + +template +static std::vector> vpack(const Args&... vobjects) { + std::vector> vpacked; + + ( + [&vpacked](const std::vector>& objects) { + std::optional> next_packed; + for (const auto& object : objects) { + if (object->packed_width() == 64) { + const l1t::L1TGT_Interface<64>& interface_obj = dynamic_cast&>(*object); + vpacked.emplace_back(interface_obj.pack()); + } else if (object->packed_width() == 96) { + const l1t::L1TGT_Interface<96>& interface_obj = dynamic_cast&>(*object); + ap_uint<96> packed = interface_obj.pack(); + if (next_packed.has_value()) { + vpacked.emplace_back(packed(95, 64) << 32 | next_packed.value()); + next_packed.reset(); + } else { + next_packed = packed(95, 64); + } + + vpacked.emplace_back(packed(63, 0)); + + } else if (object->packed_width() == 128) { + const l1t::L1TGT_Interface<128>& interface_obj = dynamic_cast&>(*object); + ap_uint<128> packed = interface_obj.pack(); + vpacked.emplace_back(packed(63, 0)); + vpacked.emplace_back(packed(127, 64)); + } + } + }(vobjects), + ...); + + return vpacked; +} + +void L1GTOutputObjectWriter::analyze(const edm::Event& event, const edm::EventSetup&) { + std::map>> outputObjects; + + outputObjects.emplace("GCTNonIsoEg", std::move(fillCollection>(event, gctNonIsoEgToken_))); + outputObjects.emplace("GCTIsoEg", std::move(fillCollection>(event, gctIsoEgToken_))); + outputObjects.emplace("GCTJets", std::move(fillCollection>(event, gctJetsToken_))); + outputObjects.emplace("GCTTaus", std::move(fillCollection(event, gctTausToken_))); + outputObjects.emplace("GCTHtSum", std::move(fillCollection(event, gctHtSumToken_))); + outputObjects.emplace("GCTEtSum", std::move(fillCollection(event, gctEtSumToken_))); + outputObjects.emplace("GMTSaPromptMuons", + std::move(fillCollection(event, gmtSaPromptMuonsToken_))); + outputObjects.emplace("GMTSaDisplacedMuons", + std::move(fillCollection(event, gmtSaDisplacedMuonsToken_))); + outputObjects.emplace("GMTTkMuons", std::move(fillCollection(event, gmtTkMuonsToken_))); + outputObjects.emplace("GMTTopo", std::move(fillCollection(event, gmtTopoToken_))); + outputObjects.emplace("GTTPromptJets", std::move(fillCollection(event, gttPromptJetsToken_))); + outputObjects.emplace("GTTDisplacedJets", + std::move(fillCollection(event, gttDisplacedJetsToken_))); + outputObjects.emplace("GTTPhiCandidates", + std::move(fillCollection(event, gttPhiCandidatesToken_))); + outputObjects.emplace("GTTRhoCandidates", + std::move(fillCollection(event, gttRhoCandidatesToken_))); + outputObjects.emplace("GTTBsCandidates", + std::move(fillCollection(event, gttBsCandidatesToken_))); + outputObjects.emplace("GTTHadronicTaus", + std::move(fillCollection(event, gttHadronicTausToken_))); + outputObjects.emplace("GTTPrimaryVert", + std::move(fillCollection(event, gttPrimaryVertToken_))); + outputObjects.emplace("GTTPromptHtSum", std::move(fillCollection(event, gttPromptHtSumToken_))); + outputObjects.emplace("GTTDisplacedHtSum", + std::move(fillCollection(event, gttDisplacedHtSumToken_))); + outputObjects.emplace("GTTEtSum", std::move(fillCollection(event, gttEtSumToken_))); + outputObjects.emplace("CL2JetsSC4", std::move(fillCollection(event, cl2JetsSc4Token_))); + outputObjects.emplace("CL2JetsSC8", std::move(fillCollection(event, cl2JetsSc8Token_))); + outputObjects.emplace("CL2Taus", std::move(fillCollection(event, cl2TausToken_))); + outputObjects.emplace("CL2Electrons", std::move(fillCollection(event, cl2ElectronsToken_))); + outputObjects.emplace("CL2Photons", std::move(fillCollection(event, cl2PhotonsToken_))); + outputObjects.emplace("CL2HtSum", std::move(fillCollection(event, cl2HtSumToken_))); + outputObjects.emplace("CL2EtSum", std::move(fillCollection(event, cl2EtSumToken_))); + + std::map>> eventData; + + for (const auto& [name, start, end] : outputChannelDef_) { + std::vector> data = vpack(outputObjects[name]); + std::size_t numChannels = end - start; + for (std::size_t i = start; i < end; i++) { + for (std::size_t j = i - start; j < data.size(); j += numChannels) { + eventData[{name, i - start}].push_back(data[j]); + } + + while (eventData[{name, i - start}].size() < 9) { + eventData[{name, i - start}].push_back(0); + } + } + } + + boardDataWriter_.addEvent(eventData); +} + +void L1GTOutputObjectWriter::endJob() { boardDataWriter_.flush(); } + +DEFINE_FWK_MODULE(L1GTOutputObjectWriter); diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTProducer.cc b/L1Trigger/Phase2L1GT/plugins/L1GTProducer.cc index ace3cbd53d65d..7cbe80653c063 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTProducer.cc +++ b/L1Trigger/Phase2L1GT/plugins/L1GTProducer.cc @@ -53,7 +53,8 @@ namespace l1t { void produceGMTSaDisplacedMuons(edm::Event &event) const; void produceGMTTkMuons(edm::Event &event) const; - void produceCL2Jets(edm::Event &event) const; + void produceCL2JetsSC4(edm::Event &event) const; + void produceCL2JetsSC8(edm::Event &event) const; void produceCL2Photons(edm::Event &event) const; void produceCL2Electrons(edm::Event &event) const; void produceCL2Taus(edm::Event &event) const; @@ -72,7 +73,8 @@ namespace l1t { const edm::EDGetTokenT gmtSaDisplacedMuonToken_; const edm::EDGetTokenT gmtTkMuonToken_; - const edm::EDGetTokenT cl2JetToken_; + const edm::EDGetTokenT cl2JetSC4Token_; + const edm::EDGetTokenT cl2JetSC8Token_; const edm::EDGetTokenT cl2PhotonToken_; const edm::EDGetTokenT cl2ElectronToken_; const edm::EDGetTokenT cl2TauToken_; @@ -88,7 +90,8 @@ namespace l1t { gmtSaPromptMuonToken_(consumes(config.getParameter("GMTSaPromptMuons"))), gmtSaDisplacedMuonToken_(consumes(config.getParameter("GMTSaDisplacedMuons"))), gmtTkMuonToken_(consumes(config.getParameter("GMTTkMuons"))), - cl2JetToken_(consumes(config.getParameter("CL2Jets"))), + cl2JetSC4Token_(consumes(config.getParameter("CL2JetsSC4"))), + cl2JetSC8Token_(consumes(config.getParameter("CL2JetsSC8"))), cl2PhotonToken_(consumes(config.getParameter("CL2Photons"))), cl2ElectronToken_(consumes(config.getParameter("CL2Electrons"))), cl2TauToken_(consumes(config.getParameter("CL2Taus"))), @@ -102,7 +105,8 @@ namespace l1t { produces("GMTSaDisplacedMuons"); produces("GMTTkMuons"); - produces("CL2Jets"); + produces("CL2JetsSC4"); + produces("CL2JetsSC8"); produces("CL2Photons"); produces("CL2Electrons"); produces("CL2Taus"); @@ -125,7 +129,8 @@ namespace l1t { desc.add("GMTSaDisplacedMuons"); desc.add("GMTTkMuons"); - desc.add("CL2Jets"); + desc.add("CL2JetsSC4"); + desc.add("CL2JetsSC8"); desc.add("CL2Photons"); desc.add("CL2Electrons"); desc.add("CL2Taus"); @@ -144,7 +149,7 @@ namespace l1t { P2GTCandidate gtObj( 0, reco::ParticleState::PolarLorentzVector(), reco::ParticleState::Point(0, 0, scales_.to_z0(hwZ0))); gtObj.hwZ0_ = hwZ0; - gtObj.hwQual_ = obj.qualityWord().V.to_int(); + gtObj.hwQualityScore_ = obj.qualityWord().V.to_int(); gtObj.hwSum_pT_pv_ = obj.multiplicityWord().V.to_int(); gtObj.hwNumber_of_tracks_in_pv_ = obj.multiplicityWord().V.to_int(); gtObj.hwNumber_of_tracks_not_in_pv_ = obj.inverseMultiplicityWord().V.to_int(); @@ -219,7 +224,7 @@ namespace l1t { gtObj.hwPhi_ = obj.apPhi().to_int(); gtObj.hwEta_ = obj.apEta().to_int(); gtObj.hwZ0_ = hwZ0; - gtObj.hwQual_ = obj.apQualFlags().to_int(); + gtObj.hwQualityScore_ = obj.apQualFlags().to_int(); gtObj.hwCharge_ = obj.apCharge().to_int(); gtObj.hwD0_ = obj.apD0().to_int(); gtObj.objectType_ = P2GTCandidate::GMTSaPromptMuons; @@ -245,7 +250,7 @@ namespace l1t { gtObj.hwPhi_ = obj.apPhi().to_int(); gtObj.hwEta_ = obj.apEta().to_int(); gtObj.hwZ0_ = hwZ0; - gtObj.hwQual_ = obj.apQualFlags().to_int(); + gtObj.hwQualityScore_ = obj.apQualFlags().to_int(); gtObj.hwCharge_ = obj.apCharge().to_int(); gtObj.hwD0_ = obj.apD0().to_int(); gtObj.objectType_ = P2GTCandidate::GMTSaDisplacedMuons; @@ -271,8 +276,8 @@ namespace l1t { gtObj.hwPhi_ = obj.apPhi().to_int(); gtObj.hwEta_ = obj.apEta().to_int(); gtObj.hwZ0_ = hwZ0; - gtObj.hwIso_ = obj.apIso().to_int(); - gtObj.hwQual_ = obj.apQualFlags().to_int(); + gtObj.hwIsolationPT_ = obj.apIso().to_int(); + gtObj.hwQualityScore_ = obj.apQualFlags().to_int(); gtObj.hwCharge_ = obj.apCharge().to_int(); gtObj.hwD0_ = obj.apD0().to_int(); gtObj.hwBeta_ = obj.apBeta().to_int(); @@ -283,9 +288,9 @@ namespace l1t { event.put(std::move(outputCollection), "GMTTkMuons"); } - void L1GTProducer::produceCL2Jets(edm::Event &event) const { + void L1GTProducer::produceCL2JetsSC4(edm::Event &event) const { std::unique_ptr outputCollection = std::make_unique(); - const PFJetCollection &collection = event.get(cl2JetToken_); + const PFJetCollection &collection = event.get(cl2JetSC4Token_); for (size_t i = 0; i < collection.size() && i < 12; i++) { l1gt::Jet gtJet = l1gt::Jet::unpack(collection[i].getHWJetGT()); int hwZ0 = gtJet.z0.V.to_int() << 7; @@ -299,11 +304,34 @@ namespace l1t { gtObj.hwPhi_ = gtJet.v3.phi.V.to_int(); gtObj.hwEta_ = gtJet.v3.eta.V.to_int(); gtObj.hwZ0_ = hwZ0; - gtObj.objectType_ = P2GTCandidate::CL2Jets; + gtObj.objectType_ = P2GTCandidate::CL2JetsSC4; outputCollection->push_back(gtObj); } - event.put(std::move(outputCollection), "CL2Jets"); + event.put(std::move(outputCollection), "CL2JetsSC4"); + } + + void L1GTProducer::produceCL2JetsSC8(edm::Event &event) const { + std::unique_ptr outputCollection = std::make_unique(); + const PFJetCollection &collection = event.get(cl2JetSC8Token_); + for (size_t i = 0; i < collection.size() && i < 12; i++) { + l1gt::Jet gtJet = l1gt::Jet::unpack(collection[i].getHWJetGT()); + int hwZ0 = gtJet.z0.V.to_int() << 7; + P2GTCandidate gtObj(0, + reco::ParticleState::PolarLorentzVector(scales_.to_pT(gtJet.v3.pt.V.to_int()), + scales_.to_eta(gtJet.v3.eta.V.to_int()), + scales_.to_phi(gtJet.v3.phi.V.to_int()), + 0), + reco::ParticleState::Point(0, 0, scales_.to_z0(hwZ0))); + gtObj.hwPT_ = gtJet.v3.pt.V.to_int(); + gtObj.hwPhi_ = gtJet.v3.phi.V.to_int(); + gtObj.hwEta_ = gtJet.v3.eta.V.to_int(); + gtObj.hwZ0_ = hwZ0; + gtObj.objectType_ = P2GTCandidate::CL2JetsSC8; + + outputCollection->push_back(gtObj); + } + event.put(std::move(outputCollection), "CL2JetsSC8"); } void L1GTProducer::produceCL2Photons(edm::Event &event) const { @@ -319,8 +347,8 @@ namespace l1t { gtObj.hwPT_ = gtPhoton.v3.pt.V.to_int(); gtObj.hwPhi_ = gtPhoton.v3.phi.V.to_int(); gtObj.hwEta_ = gtPhoton.v3.eta.V.to_int(); - gtObj.hwIso_ = gtPhoton.isolationPT.V.to_int(); - gtObj.hwQual_ = gtPhoton.qualityFlags.V.to_int(); + gtObj.hwIsolationPT_ = gtPhoton.isolationPT.V.to_int(); + gtObj.hwQualityFlags_ = gtPhoton.qualityFlags.V.to_int(); gtObj.objectType_ = P2GTCandidate::CL2Photons; outputCollection->push_back(gtObj); @@ -344,8 +372,8 @@ namespace l1t { gtObj.hwPhi_ = gtElectron.v3.phi.V.to_int(); gtObj.hwEta_ = gtElectron.v3.eta.V.to_int(); gtObj.hwZ0_ = hwZ0; - gtObj.hwIso_ = gtElectron.isolationPT.V.to_int(); - gtObj.hwQual_ = gtElectron.qualityFlags.V.to_int(); + gtObj.hwIsolationPT_ = gtElectron.isolationPT.V.to_int(); + gtObj.hwQualityFlags_ = gtElectron.qualityFlags.V.to_int(); gtObj.hwCharge_ = gtElectron.charge.V.to_int(); gtObj.objectType_ = P2GTCandidate::CL2Electrons; @@ -371,7 +399,7 @@ namespace l1t { gtObj.hwSeed_z0_ = gtTau.seed_z0.V.to_int(); gtObj.hwCharge_ = gtTau.charge.V.to_int(); gtObj.hwType_ = gtTau.type.V.to_int(); - gtObj.hwIso_ = gtTau.quality.V.to_int(); + gtObj.hwQualityScore_ = gtTau.quality.V.to_int(); gtObj.objectType_ = P2GTCandidate::CL2Taus; outputCollection->push_back(gtObj); @@ -391,7 +419,7 @@ namespace l1t { scales_.to_pT(sum.vector_pt.V.to_int()), 0, scales_.to_phi(sum.vector_phi.V.to_int()), 0)); gtObj.hwPT_ = sum.vector_pt.V.to_int(); gtObj.hwPhi_ = sum.vector_phi.V.to_int(); - gtObj.hwSca_sum_ = sum.scalar_pt.V.to_int(); + gtObj.hwScalarSumPT_ = sum.scalar_pt.V.to_int(); gtObj.objectType_ = P2GTCandidate::CL2EtSum; outputCollection->push_back(gtObj); @@ -408,7 +436,7 @@ namespace l1t { 0, reco::ParticleState::PolarLorentzVector(scales_.to_pT(mht.hwPt()), 0, scales_.to_phi(mht.hwPhi()), 0)); gtObj.hwPT_ = mht.hwPt(); gtObj.hwPhi_ = mht.hwPhi(); - gtObj.hwSca_sum_ = ht.hwPt(); + gtObj.hwScalarSumPT_ = ht.hwPt(); gtObj.objectType_ = P2GTCandidate::CL2HtSum; outputCollection->push_back(gtObj); @@ -424,7 +452,8 @@ namespace l1t { produceGMTSaDisplacedMuons(event); produceGMTTkMuons(event); - produceCL2Jets(event); + produceCL2JetsSC4(event); + produceCL2JetsSC8(event); produceCL2Photons(event); produceCL2Electrons(event); produceCL2Taus(event); diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTQuadObjectCond.cc b/L1Trigger/Phase2L1GT/plugins/L1GTQuadObjectCond.cc index 994507dac101b..811a465dd8383 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTQuadObjectCond.cc +++ b/L1Trigger/Phase2L1GT/plugins/L1GTQuadObjectCond.cc @@ -12,7 +12,8 @@ #include "L1Trigger/Phase2L1GT/interface/L1GTScales.h" #include "L1GTSingleCollectionCut.h" -#include "L1GTDeltaCut.h" +#include "L1GTCorrelationalCut.h" +#include "L1GT3BodyCut.h" #include "L1GTSingleInOutLUT.h" #include @@ -44,17 +45,23 @@ class L1GTQuadObjectCond : public edm::global::EDFilter<> { const bool enable_sanity_checks_; const bool inv_mass_checks_; - const L1GTDeltaCut delta12Cuts_; - const L1GTDeltaCut delta13Cuts_; - const L1GTDeltaCut delta23Cuts_; - const L1GTDeltaCut delta14Cuts_; - const L1GTDeltaCut delta24Cuts_; - const L1GTDeltaCut delta34Cuts_; + const L1GTCorrelationalCut correl12Cuts_; + const L1GTCorrelationalCut correl13Cuts_; + const L1GTCorrelationalCut correl23Cuts_; + const L1GTCorrelationalCut correl14Cuts_; + const L1GTCorrelationalCut correl24Cuts_; + const L1GTCorrelationalCut correl34Cuts_; + + const L1GT3BodyCut correl123Cuts_; + const L1GT3BodyCut correl124Cuts_; + const L1GT3BodyCut correl134Cuts_; + const L1GT3BodyCut correl234Cuts_; const edm::EDGetTokenT token1_; const edm::EDGetTokenT token2_; const edm::EDGetTokenT token3_; const edm::EDGetTokenT token4_; + const edm::EDGetTokenT primVertToken_; }; L1GTQuadObjectCond::L1GTQuadObjectCond(const edm::ParameterSet& config) @@ -65,18 +72,22 @@ L1GTQuadObjectCond::L1GTQuadObjectCond(const edm::ParameterSet& config) collection4Cuts_(config.getParameter("collection4"), config, scales_), enable_sanity_checks_(config.getUntrackedParameter("sanity_checks")), inv_mass_checks_(config.getUntrackedParameter("inv_mass_checks")), - delta12Cuts_( - config.getParameter("delta12"), config, scales_, enable_sanity_checks_, inv_mass_checks_), - delta13Cuts_( - config.getParameter("delta13"), config, scales_, enable_sanity_checks_, inv_mass_checks_), - delta23Cuts_( - config.getParameter("delta23"), config, scales_, enable_sanity_checks_, inv_mass_checks_), - delta14Cuts_( - config.getParameter("delta14"), config, scales_, enable_sanity_checks_, inv_mass_checks_), - delta24Cuts_( - config.getParameter("delta24"), config, scales_, enable_sanity_checks_, inv_mass_checks_), - delta34Cuts_( - config.getParameter("delta34"), config, scales_, enable_sanity_checks_, inv_mass_checks_), + correl12Cuts_( + config.getParameter("correl12"), config, scales_, enable_sanity_checks_, inv_mass_checks_), + correl13Cuts_( + config.getParameter("correl13"), config, scales_, enable_sanity_checks_, inv_mass_checks_), + correl23Cuts_( + config.getParameter("correl23"), config, scales_, enable_sanity_checks_, inv_mass_checks_), + correl14Cuts_( + config.getParameter("correl14"), config, scales_, enable_sanity_checks_, inv_mass_checks_), + correl24Cuts_( + config.getParameter("correl24"), config, scales_, enable_sanity_checks_, inv_mass_checks_), + correl34Cuts_( + config.getParameter("correl34"), config, scales_, enable_sanity_checks_, inv_mass_checks_), + correl123Cuts_(config.getParameter("correl123"), config, scales_, inv_mass_checks_), + correl124Cuts_(config.getParameter("correl124"), config, scales_, inv_mass_checks_), + correl134Cuts_(config.getParameter("correl134"), config, scales_, inv_mass_checks_), + correl234Cuts_(config.getParameter("correl234"), config, scales_, inv_mass_checks_), token1_(consumes(collection1Cuts_.tag())), token2_(collection1Cuts_.tag() == collection2Cuts_.tag() ? token1_ @@ -92,7 +103,8 @@ L1GTQuadObjectCond::L1GTQuadObjectCond(const edm::ParameterSet& config) ? token2_ : (collection3Cuts_.tag() == collection4Cuts_.tag() ? token3_ - : consumes(collection4Cuts_.tag())))) { + : consumes(collection4Cuts_.tag())))), + primVertToken_(consumes(config.getParameter("primVertTag"))) { produces(collection1Cuts_.tag().instance()); if (!(collection1Cuts_.tag() == collection2Cuts_.tag())) { @@ -136,34 +148,52 @@ void L1GTQuadObjectCond::fillDescriptions(edm::ConfigurationDescriptions& descri L1GTScales::fillPSetDescription(scalesDesc); desc.add("scales", scalesDesc); + desc.add("primVertTag"); + desc.addUntracked("sanity_checks", false); desc.addUntracked("inv_mass_checks", false); - edm::ParameterSetDescription delta12Desc; - L1GTDeltaCut::fillPSetDescription(delta12Desc); - desc.add("delta12", delta12Desc); + edm::ParameterSetDescription correl12Desc; + L1GTCorrelationalCut::fillPSetDescription(correl12Desc); + desc.add("correl12", correl12Desc); + + edm::ParameterSetDescription correl13Desc; + L1GTCorrelationalCut::fillPSetDescription(correl13Desc); + desc.add("correl13", correl13Desc); + + edm::ParameterSetDescription correl23Desc; + L1GTCorrelationalCut::fillPSetDescription(correl23Desc); + desc.add("correl23", correl23Desc); + + edm::ParameterSetDescription correl14Desc; + L1GTCorrelationalCut::fillPSetDescription(correl14Desc); + desc.add("correl14", correl14Desc); + + edm::ParameterSetDescription correl24Desc; + L1GTCorrelationalCut::fillPSetDescription(correl24Desc); + desc.add("correl24", correl24Desc); - edm::ParameterSetDescription delta13Desc; - L1GTDeltaCut::fillPSetDescription(delta13Desc); - desc.add("delta13", delta13Desc); + edm::ParameterSetDescription correl34Desc; + L1GTCorrelationalCut::fillPSetDescription(correl34Desc); + desc.add("correl34", correl34Desc); - edm::ParameterSetDescription delta23Desc; - L1GTDeltaCut::fillPSetDescription(delta23Desc); - desc.add("delta23", delta23Desc); + edm::ParameterSetDescription correl123Desc; + L1GT3BodyCut::fillPSetDescription(correl123Desc); + desc.add("correl123", correl123Desc); - edm::ParameterSetDescription delta14Desc; - L1GTDeltaCut::fillPSetDescription(delta14Desc); - desc.add("delta14", delta14Desc); + edm::ParameterSetDescription correl124Desc; + L1GT3BodyCut::fillPSetDescription(correl124Desc); + desc.add("correl124", correl124Desc); - edm::ParameterSetDescription delta24Desc; - L1GTDeltaCut::fillPSetDescription(delta24Desc); - desc.add("delta24", delta24Desc); + edm::ParameterSetDescription correl134Desc; + L1GT3BodyCut::fillPSetDescription(correl134Desc); + desc.add("correl134", correl134Desc); - edm::ParameterSetDescription delta34Desc; - L1GTDeltaCut::fillPSetDescription(delta34Desc); - desc.add("delta34", delta34Desc); + edm::ParameterSetDescription correl234Desc; + L1GT3BodyCut::fillPSetDescription(correl234Desc); + desc.add("correl234", correl234Desc); - L1GTDeltaCut::fillLUTDescriptions(desc); + L1GTCorrelationalCut::fillLUTDescriptions(desc); descriptions.addWithDefaultLabel(desc); } @@ -173,6 +203,7 @@ bool L1GTQuadObjectCond::filter(edm::StreamID, edm::Event& event, const edm::Eve edm::Handle col2 = event.getHandle(token2_); edm::Handle col3 = event.getHandle(token3_); edm::Handle col4 = event.getHandle(token4_); + edm::Handle primVertCol = event.getHandle(primVertToken_); bool condition_result = false; @@ -184,8 +215,17 @@ bool L1GTQuadObjectCond::filter(edm::StreamID, edm::Event& event, const edm::Eve InvariantMassErrorCollection massErrors; for (std::size_t idx1 = 0; idx1 < col1->size(); ++idx1) { + bool single1Pass = collection1Cuts_.checkObject(col1->at(idx1)); + single1Pass &= collection1Cuts_.checkPrimaryVertices(col1->at(idx1), *primVertCol); + for (std::size_t idx2 = 0; idx2 < col2->size(); ++idx2) { + bool single2Pass = collection2Cuts_.checkObject(col2->at(idx2)); + single2Pass &= collection2Cuts_.checkPrimaryVertices(col2->at(idx2), *primVertCol); + for (std::size_t idx3 = 0; idx3 < col3->size(); ++idx3) { + bool single3Pass = collection3Cuts_.checkObject(col3->at(idx3)); + single3Pass &= collection3Cuts_.checkPrimaryVertices(col3->at(idx3), *primVertCol); + for (std::size_t idx4 = 0; idx4 < col4->size(); ++idx4) { // If we're looking at the same collection then we shouldn't use the same object in one comparison. if (col1.product() == col2.product() && idx1 == idx2) { @@ -212,17 +252,21 @@ bool L1GTQuadObjectCond::filter(edm::StreamID, edm::Event& event, const edm::Eve continue; } - bool pass = true; - pass &= collection1Cuts_.checkObject(col1->at(idx1)); - pass &= collection2Cuts_.checkObject(col2->at(idx2)); - pass &= collection3Cuts_.checkObject(col3->at(idx3)); + bool pass = single1Pass & single2Pass & single3Pass; + pass &= collection4Cuts_.checkObject(col4->at(idx4)); - pass &= delta12Cuts_.checkObjects(col1->at(idx1), col2->at(idx2), massErrors); - pass &= delta13Cuts_.checkObjects(col1->at(idx1), col3->at(idx3), massErrors); - pass &= delta23Cuts_.checkObjects(col2->at(idx2), col3->at(idx3), massErrors); - pass &= delta14Cuts_.checkObjects(col1->at(idx1), col4->at(idx4), massErrors); - pass &= delta24Cuts_.checkObjects(col2->at(idx2), col4->at(idx4), massErrors); - pass &= delta34Cuts_.checkObjects(col3->at(idx3), col4->at(idx4), massErrors); + pass &= collection4Cuts_.checkPrimaryVertices(col4->at(idx4), *primVertCol); + pass &= correl12Cuts_.checkObjects(col1->at(idx1), col2->at(idx2), massErrors); + pass &= correl13Cuts_.checkObjects(col1->at(idx1), col3->at(idx3), massErrors); + pass &= correl23Cuts_.checkObjects(col2->at(idx2), col3->at(idx3), massErrors); + pass &= correl14Cuts_.checkObjects(col1->at(idx1), col4->at(idx4), massErrors); + pass &= correl24Cuts_.checkObjects(col2->at(idx2), col4->at(idx4), massErrors); + pass &= correl34Cuts_.checkObjects(col3->at(idx3), col4->at(idx4), massErrors); + pass &= correl123Cuts_.checkObjects(col1->at(idx1), col2->at(idx2), col3->at(idx3), massErrors); + pass &= correl124Cuts_.checkObjects(col1->at(idx1), col2->at(idx2), col4->at(idx4), massErrors); + pass &= correl134Cuts_.checkObjects(col1->at(idx1), col3->at(idx3), col4->at(idx4), massErrors); + pass &= correl234Cuts_.checkObjects(col2->at(idx2), col3->at(idx3), col4->at(idx4), massErrors); + condition_result |= pass; if (pass) { diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTSingleCollectionCut.h b/L1Trigger/Phase2L1GT/plugins/L1GTSingleCollectionCut.h index 04663436434c1..a5fedf6e4e18b 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTSingleCollectionCut.h +++ b/L1Trigger/Phase2L1GT/plugins/L1GTSingleCollectionCut.h @@ -3,6 +3,7 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/Exception.h" #include "DataFormats/L1Trigger/interface/P2GTCandidate.h" #include "L1Trigger/Phase2L1GT/interface/L1GTScales.h" @@ -11,6 +12,7 @@ #include #include +#include namespace l1t { @@ -34,65 +36,58 @@ namespace l1t { : scales_(scales), tag_(config.getParameter("tag")), minPt_(getOptionalParam( - "minPt", config, [&scales](double value) { return scales.to_hw_pT(value); })), + "minPt", config, [&scales](double value) { return scales.to_hw_pT_floor(value); })), maxPt_(getOptionalParam( - "maxPt", config, [&scales](double value) { return scales.to_hw_pT(value); })), + "maxPt", config, [&scales](double value) { return scales.to_hw_pT_ceil(value); })), minEta_(getOptionalParam( - "minEta", config, [&scales](double value) { return scales.to_hw_eta(value); })), + "minEta", config, [&scales](double value) { return scales.to_hw_eta_floor(value); })), maxEta_(getOptionalParam( - "maxEta", config, [&scales](double value) { return scales.to_hw_eta(value); })), + "maxEta", config, [&scales](double value) { return scales.to_hw_eta_ceil(value); })), minPhi_(getOptionalParam( - "minPhi", config, [&scales](double value) { return scales.to_hw_phi(value); })), + "minPhi", config, [&scales](double value) { return scales.to_hw_phi_floor(value); })), maxPhi_(getOptionalParam( - "maxPhi", config, [&scales](double value) { return scales.to_hw_phi(value); })), + "maxPhi", config, [&scales](double value) { return scales.to_hw_phi_ceil(value); })), minZ0_(getOptionalParam( - "minZ0", config, [&scales](double value) { return scales.to_hw_z0(value); })), + "minZ0", config, [&scales](double value) { return scales.to_hw_z0_floor(value); })), maxZ0_(getOptionalParam( - "maxZ0", config, [&scales](double value) { return scales.to_hw_z0(value); })), + "maxZ0", config, [&scales](double value) { return scales.to_hw_z0_ceil(value); })), minScalarSumPt_(getOptionalParam( - "minScalarSumPt", config, [&scales](double value) { return scales.to_hw_pT(value); })), + "minScalarSumPt", config, [&scales](double value) { return scales.to_hw_pT_floor(value); })), maxScalarSumPt_(getOptionalParam( - "maxScalarSumPt", config, [&scales](double value) { return scales.to_hw_pT(value); })), - qual_(config.getParameter>("qual")), + "maxScalarSumPt", config, [&scales](double value) { return scales.to_hw_pT_ceil(value); })), + minQualityScore_(getOptionalParam("minQualityScore", config)), + maxQualityScore_(getOptionalParam("maxQualityScore", config)), + qualityFlags_(getOptionalParam("qualityFlags", config)), minAbsEta_(getOptionalParam( - "minAbsEta", config, [&scales](double value) { return scales.to_hw_eta(value); })), + "minAbsEta", config, [&scales](double value) { return scales.to_hw_eta_floor(value); })), maxAbsEta_(getOptionalParam( - "maxAbsEta", config, [&scales](double value) { return scales.to_hw_eta(value); })), - maxIso_(getOptionalParam( - "maxIso", config, [&scales](double value) { return scales.to_hw_isolation(value); })), - minHwIso_(getOptionalParam("minHwIso", config)), + "maxAbsEta", config, [&scales](double value) { return scales.to_hw_eta_ceil(value); })), + minIsolationPt_(getOptionalParam( + "minRelIsolationPt", config, [&scales](double value) { return scales.to_hw_isolationPT_floor(value); })), + maxIsolationPt_(getOptionalParam( + "maxRelIsolationPt", config, [&scales](double value) { return scales.to_hw_isolationPT_ceil(value); })), + minRelIsolationPt_(getOptionalParam( + "minRelIsolationPt", + config, + [&scales](double value) { return scales.to_hw_relative_isolationPT_floor(value); })), + maxRelIsolationPt_(getOptionalParam( + "maxRelIsolationPt", + config, + [&scales](double value) { return scales.to_hw_relative_isolationPT_ceil(value); })), regionsAbsEtaLowerBounds_(getParamVector( - "regionsAbsEtaLowerBounds", config, [&scales](double value) { return scales.to_hw_eta(value); })), + "regionsAbsEtaLowerBounds", config, [&scales](double value) { return scales.to_hw_eta_ceil(value); })), regionsMinPt_(getParamVector( - "regionsMinPt", config, [&scales](double value) { return scales.to_hw_pT(value); })), - regionsMaxIso_(getParamVector( - "regionsMaxIso", config, [&scales](double value) { return scales.to_hw_isolation(value); })), - regionsQual_(config.getParameter>("regionsQual")) {} - - bool checkEtadependentcuts(const P2GTCandidate& obj) const { - bool res = true; - - unsigned int index; - index = atIndex(obj.hwEta()); - res &= regionsMinPt_.empty() ? true : obj.hwPT() > regionsMinPt_[index]; - res &= regionsMaxIso_.empty() - ? true - : obj.hwIso().to_int() << scales_.isolation_shift() < regionsMaxIso_[index] * obj.hwPT().to_int(); - res &= regionsQual_.empty() ? true : (obj.hwQual().to_uint() & regionsQual_[index]) == regionsQual_[index]; - return res; - } - - unsigned int atIndex(int objeta) const { - // Function that checks at which index the eta of the object is - // If object abs(eta) < regionsAbsEtaLowerBounds_[0] the function returns the last index, - // Might be undesired behaviour - for (unsigned int i = 0; i < regionsAbsEtaLowerBounds_.size() - 1; i++) { - if (std::abs(objeta) >= regionsAbsEtaLowerBounds_[i] && std::abs(objeta) < regionsAbsEtaLowerBounds_[i + 1]) { - return i; - } - } - return regionsAbsEtaLowerBounds_.size() - 1; - } + "regionsMinPt", config, [&scales](double value) { return scales.to_hw_pT_floor(value); })), + regionsMaxRelIsolationPt_(getParamVector( + "regionsMaxRelIsolationPt", + config, + [&scales](double value) { return scales.to_hw_relative_isolationPT_ceil(value); })), + regionsQualityFlags_(config.getParameter>("regionsQualityFlags")), + minPrimVertDz_(getOptionalParam( + "minPrimVertDz", config, [&scales](double value) { return scales.to_hw_z0_floor(value); })), + maxPrimVertDz_(getOptionalParam( + "maxPrimVertDz", config, [&scales](double value) { return scales.to_hw_z0_ceil(value); })), + primVertex_(getOptionalParam("primVertex", config)) {} bool checkObject(const P2GTCandidate& obj) const { bool result = true; @@ -112,18 +107,49 @@ namespace l1t { result &= minAbsEta_ ? (abs(obj.hwEta()) > minAbsEta_) : true; result &= maxAbsEta_ ? (abs(obj.hwEta()) < maxAbsEta_) : true; - result &= minScalarSumPt_ ? (obj.hwSca_sum() > minScalarSumPt_) : true; - result &= maxScalarSumPt_ ? (obj.hwSca_sum() < minScalarSumPt_) : true; + result &= minScalarSumPt_ ? (obj.hwScalarSumPT() > minScalarSumPt_) : true; + result &= maxScalarSumPt_ ? (obj.hwScalarSumPT() < maxScalarSumPt_) : true; + + result &= minQualityScore_ ? (obj.hwQualityScore() > minQualityScore_) : true; + result &= maxQualityScore_ ? (obj.hwQualityScore() < maxQualityScore_) : true; + result &= qualityFlags_ ? (obj.hwQualityFlags().to_uint() & qualityFlags_.value()) == qualityFlags_ : true; + + result &= minIsolationPt_ ? (obj.hwIsolationPT() > minIsolationPt_) : true; + result &= maxIsolationPt_ ? (obj.hwIsolationPT() < maxIsolationPt_) : true; - result &= qual_.empty() ? true : std::find(qual_.begin(), qual_.end(), obj.hwQual().to_uint()) != qual_.end(); - result &= - maxIso_ ? obj.hwIso().to_int() << scales_.isolation_shift() < maxIso_.value() * obj.hwPT().to_int() : true; + result &= minRelIsolationPt_ ? obj.hwIsolationPT().to_int64() << L1GTScales::RELATIVE_ISOLATION_RESOLUTION > + static_cast(minRelIsolationPt_.value()) * obj.hwPT().to_int64() + : true; + result &= maxRelIsolationPt_ ? obj.hwIsolationPT().to_int64() << L1GTScales::RELATIVE_ISOLATION_RESOLUTION < + static_cast(maxRelIsolationPt_.value()) * obj.hwPT().to_int64() + : true; - result &= minHwIso_ ? (obj.hwIso() > minHwIso_) : true; - result &= regionsAbsEtaLowerBounds_.empty() ? true : checkEtadependentcuts(obj); + result &= regionsAbsEtaLowerBounds_.empty() ? true : checkEtaDependentCuts(obj); return result; } + bool checkPrimaryVertices(const P2GTCandidate& obj, const P2GTCandidateCollection& primVertCol) const { + if (!minPrimVertDz_ && !maxPrimVertDz_) { + return true; + } else { + if (!primVertex_) { + throw cms::Exception("Configuration") + << "When a min/max primary vertex cut is set the primary vertex to cut\n" + << "on has to be specified with with config parameter \'primVertex\'. "; + } + if (primVertex_ < primVertCol.size()) { + uint32_t dZ = abs(obj.hwZ0() - primVertCol[primVertex_.value()].hwZ0()); + + bool result = true; + result &= minPrimVertDz_ ? dZ > minPrimVertDz_ : true; + result &= maxPrimVertDz_ ? dZ < maxPrimVertDz_ : true; + return result; + } else { + return false; + } + } + } + static void fillPSetDescription(edm::ParameterSetDescription& desc) { desc.add("tag"); desc.addOptional("minPt"); @@ -136,19 +162,56 @@ namespace l1t { desc.addOptional("maxZ0"); desc.addOptional("minScalarSumPt"); desc.addOptional("maxScalarSumPt"); - desc.add>("qual", {}); + desc.addOptional("minQualityScore"); + desc.addOptional("maxQualityScore"); + desc.addOptional("qualityFlags"); + desc.add>("regions", {}); desc.addOptional("minAbsEta"); desc.addOptional("maxAbsEta"); - desc.addOptional("maxIso"); - desc.addOptional("minHwIso"); + desc.addOptional("minIsolationPt"); + desc.addOptional("maxIsolationPt"); + desc.addOptional("minRelIsolationPt"); + desc.addOptional("maxRelIsolationPt"); desc.add>("regionsAbsEtaLowerBounds", {}); desc.add>("regionsMinPt", {}); - desc.add>("regionsMaxIso", {}); - desc.add>("regionsQual", {}); + desc.add>("regionsMaxRelIsolationPt", {}); + desc.add>("regionsQualityFlags", {}); + desc.addOptional("minPrimVertDz"); + desc.addOptional("maxPrimVertDz"); + desc.addOptional("primVertex"); } const edm::InputTag& tag() const { return tag_; } + private: + bool checkEtaDependentCuts(const P2GTCandidate& obj) const { + bool res = true; + + unsigned int index; + index = atIndex(obj.hwEta()); + res &= regionsMinPt_.empty() ? true : obj.hwPT() > regionsMinPt_[index]; + res &= regionsMaxRelIsolationPt_.empty() + ? true + : obj.hwIsolationPT().to_int64() << L1GTScales::RELATIVE_ISOLATION_RESOLUTION < + static_cast(regionsMaxRelIsolationPt_[index]) * obj.hwPT().to_int64(); + res &= regionsQualityFlags_.empty() + ? true + : (obj.hwQualityFlags().to_uint() & regionsQualityFlags_[index]) == regionsQualityFlags_[index]; + return res; + } + + unsigned int atIndex(int objeta) const { + // Function that checks at which index the eta of the object is + // If object abs(eta) < regionsAbsEtaLowerBounds_[0] the function returns the last index, + // Might be undesired behaviour + for (unsigned int i = 0; i < regionsAbsEtaLowerBounds_.size() - 1; i++) { + if (std::abs(objeta) >= regionsAbsEtaLowerBounds_[i] && std::abs(objeta) < regionsAbsEtaLowerBounds_[i + 1]) { + return i; + } + } + return regionsAbsEtaLowerBounds_.size() - 1; + } + private: const L1GTScales scales_; const edm::InputTag tag_; @@ -162,15 +225,22 @@ namespace l1t { const std::optional maxZ0_; const std::optional minScalarSumPt_; const std::optional maxScalarSumPt_; - const std::vector qual_; + const std::optional minQualityScore_; + const std::optional maxQualityScore_; + const std::optional qualityFlags_; const std::optional minAbsEta_; const std::optional maxAbsEta_; - const std::optional maxIso_; - const std::optional minHwIso_; + const std::optional minIsolationPt_; + const std::optional maxIsolationPt_; + const std::optional minRelIsolationPt_; + const std::optional maxRelIsolationPt_; const std::vector regionsAbsEtaLowerBounds_; const std::vector regionsMinPt_; - const std::vector regionsMaxIso_; - const std::vector regionsQual_; + const std::vector regionsMaxRelIsolationPt_; + const std::vector regionsQualityFlags_; + const std::optional minPrimVertDz_; + const std::optional maxPrimVertDz_; + const std::optional primVertex_; }; } // namespace l1t diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTSingleInOutLUT.h b/L1Trigger/Phase2L1GT/plugins/L1GTSingleInOutLUT.h index e972e736f17cb..4533b81f3ba4a 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTSingleInOutLUT.h +++ b/L1Trigger/Phase2L1GT/plugins/L1GTSingleInOutLUT.h @@ -12,6 +12,8 @@ namespace l1t { class L1GTSingleInOutLUT { public: + static constexpr uint32_t DETA_LUT_SPLIT = 1 << 13; // hw 2pi + L1GTSingleInOutLUT(const edm::ParameterSet& lutConfig) : data_(lutConfig.getParameter>("lut")), unused_lsbs_(lutConfig.getParameter("unused_lsbs")), diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTSingleObjectCond.cc b/L1Trigger/Phase2L1GT/plugins/L1GTSingleObjectCond.cc index a89c6af56e65c..ba57e3aa62365 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTSingleObjectCond.cc +++ b/L1Trigger/Phase2L1GT/plugins/L1GTSingleObjectCond.cc @@ -34,12 +34,14 @@ class L1GTSingleObjectCond : public edm::global::EDFilter<> { const L1GTSingleCollectionCut collection; const edm::EDGetTokenT token_; + const edm::EDGetTokenT primVertToken_; }; L1GTSingleObjectCond::L1GTSingleObjectCond(const edm::ParameterSet& config) : scales_(config.getParameter("scales")), collection(config, config, scales_), - token_(consumes(collection.tag())) { + token_(consumes(collection.tag())), + primVertToken_(consumes(config.getParameter("primVertTag"))) { produces(collection.tag().instance()); } @@ -47,6 +49,8 @@ void L1GTSingleObjectCond::fillDescriptions(edm::ConfigurationDescriptions& desc edm::ParameterSetDescription desc; L1GTSingleCollectionCut::fillPSetDescription(desc); + desc.add("primVertTag"); + edm::ParameterSetDescription scalesDesc; L1GTScales::fillPSetDescription(scalesDesc); desc.add("scales", scalesDesc); @@ -56,6 +60,7 @@ void L1GTSingleObjectCond::fillDescriptions(edm::ConfigurationDescriptions& desc bool L1GTSingleObjectCond::filter(edm::StreamID, edm::Event& event, const edm::EventSetup& setup) const { edm::Handle col = event.getHandle(token_); + edm::Handle primVertCol = event.getHandle(primVertToken_); bool condition_result = false; @@ -63,6 +68,8 @@ bool L1GTSingleObjectCond::filter(edm::StreamID, edm::Event& event, const edm::E for (std::size_t idx = 0; idx < col->size(); ++idx) { bool pass{collection.checkObject(col->at(idx))}; + pass &= collection.checkPrimaryVertices(col->at(idx), *primVertCol); + condition_result |= pass; if (pass) { diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTTripleObjectCond.cc b/L1Trigger/Phase2L1GT/plugins/L1GTTripleObjectCond.cc index 1e36748272e42..9e35c7c2545f1 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTTripleObjectCond.cc +++ b/L1Trigger/Phase2L1GT/plugins/L1GTTripleObjectCond.cc @@ -13,7 +13,8 @@ #include "L1Trigger/Phase2L1GT/interface/L1GTScales.h" #include "L1GTSingleCollectionCut.h" -#include "L1GTDeltaCut.h" +#include "L1GTCorrelationalCut.h" +#include "L1GT3BodyCut.h" #include "L1GTSingleInOutLUT.h" #include @@ -41,13 +42,16 @@ class L1GTTripleObjectCond : public edm::global::EDFilter<> { const bool enable_sanity_checks_; const bool inv_mass_checks_; - const L1GTDeltaCut delta12Cuts_; - const L1GTDeltaCut delta13Cuts_; - const L1GTDeltaCut delta23Cuts_; + const L1GTCorrelationalCut correl12Cuts_; + const L1GTCorrelationalCut correl13Cuts_; + const L1GTCorrelationalCut correl23Cuts_; + + const L1GT3BodyCut correl123Cuts_; const edm::EDGetTokenT token1_; const edm::EDGetTokenT token2_; const edm::EDGetTokenT token3_; + const edm::EDGetTokenT primVertToken_; }; L1GTTripleObjectCond::L1GTTripleObjectCond(const edm::ParameterSet& config) @@ -57,12 +61,13 @@ L1GTTripleObjectCond::L1GTTripleObjectCond(const edm::ParameterSet& config) collection3Cuts_(config.getParameter("collection3"), config, scales_), enable_sanity_checks_(config.getUntrackedParameter("sanity_checks")), inv_mass_checks_(config.getUntrackedParameter("inv_mass_checks")), - delta12Cuts_( - config.getParameter("delta12"), config, scales_, enable_sanity_checks_, inv_mass_checks_), - delta13Cuts_( - config.getParameter("delta13"), config, scales_, enable_sanity_checks_, inv_mass_checks_), - delta23Cuts_( - config.getParameter("delta23"), config, scales_, enable_sanity_checks_, inv_mass_checks_), + correl12Cuts_( + config.getParameter("correl12"), config, scales_, enable_sanity_checks_, inv_mass_checks_), + correl13Cuts_( + config.getParameter("correl13"), config, scales_, enable_sanity_checks_, inv_mass_checks_), + correl23Cuts_( + config.getParameter("correl23"), config, scales_, enable_sanity_checks_, inv_mass_checks_), + correl123Cuts_(config, config, scales_, inv_mass_checks_), token1_(consumes(collection1Cuts_.tag())), token2_(collection1Cuts_.tag() == collection2Cuts_.tag() ? token1_ @@ -71,7 +76,8 @@ L1GTTripleObjectCond::L1GTTripleObjectCond(const edm::ParameterSet& config) ? token1_ : (collection2Cuts_.tag() == collection3Cuts_.tag() ? token2_ - : consumes(collection3Cuts_.tag()))) { + : consumes(collection3Cuts_.tag()))), + primVertToken_(consumes(config.getParameter("primVertTag"))) { produces(collection1Cuts_.tag().instance()); if (!(collection1Cuts_.tag() == collection2Cuts_.tag())) { @@ -106,22 +112,26 @@ void L1GTTripleObjectCond::fillDescriptions(edm::ConfigurationDescriptions& desc L1GTScales::fillPSetDescription(scalesDesc); desc.add("scales", scalesDesc); + desc.add("primVertTag"); + desc.addUntracked("sanity_checks", false); desc.addUntracked("inv_mass_checks", false); - edm::ParameterSetDescription delta12Desc; - L1GTDeltaCut::fillPSetDescription(delta12Desc); - desc.add("delta12", delta12Desc); + edm::ParameterSetDescription correl12Desc; + L1GTCorrelationalCut::fillPSetDescription(correl12Desc); + desc.add("correl12", correl12Desc); + + edm::ParameterSetDescription correl13Desc; + L1GTCorrelationalCut::fillPSetDescription(correl13Desc); + desc.add("correl13", correl13Desc); - edm::ParameterSetDescription delta13Desc; - L1GTDeltaCut::fillPSetDescription(delta13Desc); - desc.add("delta13", delta13Desc); + edm::ParameterSetDescription correl23Desc; + L1GTCorrelationalCut::fillPSetDescription(correl23Desc); + desc.add("correl23", correl23Desc); - edm::ParameterSetDescription delta23Desc; - L1GTDeltaCut::fillPSetDescription(delta23Desc); - desc.add("delta23", delta23Desc); + L1GT3BodyCut::fillPSetDescription(desc); - L1GTDeltaCut::fillLUTDescriptions(desc); + L1GTCorrelationalCut::fillLUTDescriptions(desc); descriptions.addWithDefaultLabel(desc); } @@ -130,6 +140,7 @@ bool L1GTTripleObjectCond::filter(edm::StreamID, edm::Event& event, const edm::E edm::Handle col1 = event.getHandle(token1_); edm::Handle col2 = event.getHandle(token2_); edm::Handle col3 = event.getHandle(token3_); + edm::Handle primVertCol = event.getHandle(primVertToken_); bool condition_result = false; @@ -140,7 +151,13 @@ bool L1GTTripleObjectCond::filter(edm::StreamID, edm::Event& event, const edm::E InvariantMassErrorCollection massErrors; for (std::size_t idx1 = 0; idx1 < col1->size(); ++idx1) { + bool single1Pass = collection1Cuts_.checkObject(col1->at(idx1)); + single1Pass &= collection1Cuts_.checkPrimaryVertices(col1->at(idx1), *primVertCol); + for (std::size_t idx2 = 0; idx2 < col2->size(); ++idx2) { + bool single2Pass = collection2Cuts_.checkObject(col2->at(idx2)); + single2Pass &= collection2Cuts_.checkPrimaryVertices(col2->at(idx2), *primVertCol); + for (std::size_t idx3 = 0; idx3 < col3->size(); ++idx3) { // If we're looking at the same collection then we shouldn't use the same object in one comparison. if (col1.product() == col2.product() && idx1 == idx2) { @@ -155,13 +172,14 @@ bool L1GTTripleObjectCond::filter(edm::StreamID, edm::Event& event, const edm::E continue; } - bool pass = true; - pass &= collection1Cuts_.checkObject(col1->at(idx1)); - pass &= collection2Cuts_.checkObject(col2->at(idx2)); + bool pass = single1Pass & single2Pass; + pass &= collection3Cuts_.checkObject(col3->at(idx3)); - pass &= delta12Cuts_.checkObjects(col1->at(idx1), col2->at(idx2), massErrors); - pass &= delta13Cuts_.checkObjects(col1->at(idx1), col3->at(idx3), massErrors); - pass &= delta23Cuts_.checkObjects(col2->at(idx2), col3->at(idx3), massErrors); + pass &= collection3Cuts_.checkPrimaryVertices(col3->at(idx3), *primVertCol); + pass &= correl12Cuts_.checkObjects(col1->at(idx1), col2->at(idx2), massErrors); + pass &= correl13Cuts_.checkObjects(col1->at(idx1), col3->at(idx3), massErrors); + pass &= correl23Cuts_.checkObjects(col2->at(idx2), col3->at(idx3), massErrors); + pass &= correl123Cuts_.checkObjects(col1->at(idx1), col2->at(idx2), col3->at(idx3), massErrors); condition_result |= pass; diff --git a/L1Trigger/Phase2L1GT/python/l1tGTAlgoBlockProducer_cff.py b/L1Trigger/Phase2L1GT/python/l1tGTAlgoBlockProducer_cff.py index df8bbb732ec16..d042a45233179 100644 --- a/L1Trigger/Phase2L1GT/python/l1tGTAlgoBlockProducer_cff.py +++ b/L1Trigger/Phase2L1GT/python/l1tGTAlgoBlockProducer_cff.py @@ -1,6 +1,9 @@ import FWCore.ParameterSet.Config as cms import re + +TYPE_STANDARD_PHYSICS = cms.vint32(1) # TODO + algorithms = cms.VPSet() l1tGTAlgoBlockProducer = cms.EDProducer( diff --git a/L1Trigger/Phase2L1GT/python/l1tGTDoubleObjectCond_cfi.py b/L1Trigger/Phase2L1GT/python/l1tGTDoubleObjectCond_cfi.py index 2179f23b761e3..7cc6e5058f996 100644 --- a/L1Trigger/Phase2L1GT/python/l1tGTDoubleObjectCond_cfi.py +++ b/L1Trigger/Phase2L1GT/python/l1tGTDoubleObjectCond_cfi.py @@ -9,5 +9,6 @@ cosh_eta_lut2=COSH_ETA_LUT_2.config(), cos_phi_lut=COS_PHI_LUT.config(), sanity_checks=cms.untracked.bool(False), - inv_mass_checks=cms.untracked.bool(False) + inv_mass_checks=cms.untracked.bool(False), + primVertTag = cms.InputTag("l1tGTProducer", "GTTPrimaryVert") ) diff --git a/L1Trigger/Phase2L1GT/python/l1tGTMenu_BTagSeeds_cff.py b/L1Trigger/Phase2L1GT/python/l1tGTMenu_BTagSeeds_cff.py new file mode 100644 index 0000000000000..c7daa356e3582 --- /dev/null +++ b/L1Trigger/Phase2L1GT/python/l1tGTMenu_BTagSeeds_cff.py @@ -0,0 +1,154 @@ +import FWCore.ParameterSet.Config as cms + +############################################################ +# L1 Global Trigger Emulation +############################################################ + +# Conditions + +from L1Trigger.Phase2L1GT.l1tGTProducer_cff import l1tGTProducer + +from L1Trigger.Phase2L1GT.l1tGTSingleObjectCond_cfi import l1tGTSingleObjectCond +from L1Trigger.Phase2L1GT.l1tGTDoubleObjectCond_cfi import l1tGTDoubleObjectCond +from L1Trigger.Phase2L1GT.l1tGTTripleObjectCond_cfi import l1tGTTripleObjectCond +from L1Trigger.Phase2L1GT.l1tGTQuadObjectCond_cfi import l1tGTQuadObjectCond + +from L1Trigger.Phase2L1GT.l1tGTAlgoBlockProducer_cff import algorithms + +DoubleTkMuonOSEr1p5Dr1p4 = l1tGTDoubleObjectCond.clone( + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-1.5), + maxEta = cms.double(1.5), + minQualityScore = cms.uint32(0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-1.5), + maxEta = cms.double(1.5), + minQualityScore = cms.uint32(0) + ), + maxDR =cms.double(1.4), + maxDz = cms.double(1), + os = cms.bool(True), +) +pDoubleTkMuon_OS_Er1p5_Dr1p4 = cms.Path(DoubleTkMuonOSEr1p5Dr1p4) +algorithms.append(cms.PSet(expression = cms.string("pDoubleTkMuon_OS_Er1p5_Dr1p4"))) + +DoubleTkMuon44OSDr1p2 = l1tGTDoubleObjectCond.clone( + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(4,4,4), + minQualityScore = cms.uint32(0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(4,4,4), + minQualityScore = cms.uint32(0) + ), + maxDR =cms.double(1.2), + maxDz = cms.double(1), + os = cms.bool(True), +) +pDoubleTkMuon_4_4_OS_Dr1p2 = cms.Path(DoubleTkMuon44OSDr1p2) +algorithms.append(cms.PSet(expression = cms.string("pDoubleTkMuon_4_4_OS_Dr1p2"))) + +DoubleTkMuon4p5OSEr2Mass7to18 = l1tGTDoubleObjectCond.clone( + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.0), + maxEta = cms.double(2.0), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(4,4,4), + minQualityScore = cms.uint32(0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.0), + maxEta = cms.double(2.0), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(4,4,4), + minQualityScore = cms.uint32(0) + ), + minInvMass = cms.double(7), + maxInvMass = cms.double(18), + maxDz = cms.double(1), + os = cms.bool(True), +) +pDoubleTkMuon_4p5_4p5_OS_Er2_Mass7to18 = cms.Path(DoubleTkMuon4p5OSEr2Mass7to18) +algorithms.append(cms.PSet(expression = cms.string("pDoubleTkMuon_4p5_4p5_OS_Er2_Mass7to18"))) + +TripleTkMuon530OSMassMax9 = l1tGTTripleObjectCond.clone( + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minPt = cms.double(5), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + minQualityScore = cms.uint32(0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minPt = cms.double(3), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + minQualityScore = cms.uint32(0) + ), + collection3 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minPt = cms.double(0), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + minQualityScore = cms.uint32(0) + ), + correl12 = cms.PSet( + maxDz = cms.double(1), + os = cms.bool(True), + maxInvMass = cms.double(9), + ), + correl13 = cms.PSet( + maxDz = cms.double(1) + ), +) +TripleTkMuon_5_3_0_DoubleTkMuon_5_3_OS_MassTo9 = cms.Path(TripleTkMuon530OSMassMax9) +algorithms.append(cms.PSet(expression = cms.string("TripleTkMuon_5_3_0_DoubleTkMuon_5_3_OS_MassTo9"))) + +TripleTkMuon53p52p5OSMass5to17 = l1tGTTripleObjectCond.clone( + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minPt = cms.double(5), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + minQualityScore = cms.uint32(0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minPt = cms.double(4), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + minQualityScore = cms.uint32(0) + ), + collection3 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minPt = cms.double(2), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + minQualityScore = cms.uint32(0) + ), + correl12 = cms.PSet( + maxDz = cms.double(1), + ), + correl13 = cms.PSet( + maxDz = cms.double(1), + os = cms.bool(True), + minInvMass = cms.double(5), + maxInvMass = cms.double(17), + ), +) +TripleTkMuon_5_3p5_2p5_OS_Mass5to17 = cms.Path(TripleTkMuon53p52p5OSMass5to17) +algorithms.append(cms.PSet(expression = cms.string("TripleTkMuon_5_3p5_2p5_OS_Mass5to17"))) diff --git a/L1Trigger/Phase2L1GT/python/l1tGTMenu_cff.py b/L1Trigger/Phase2L1GT/python/l1tGTMenu_cff.py index 5838fa557a12f..605246bf488fc 100644 --- a/L1Trigger/Phase2L1GT/python/l1tGTMenu_cff.py +++ b/L1Trigger/Phase2L1GT/python/l1tGTMenu_cff.py @@ -8,3 +8,9 @@ from L1Trigger.Phase2L1GT.l1tGTMenu_hadr_metSeeds_cff import * +from L1Trigger.Phase2L1GT.l1tGTMenu_crossLepSeeds_cff import * + +from L1Trigger.Phase2L1GT.l1tGTMenu_hadr_crossLepSeeds_cff import * + +from L1Trigger.Phase2L1GT.l1tGTMenu_BTagSeeds_cff import * + diff --git a/L1Trigger/Phase2L1GT/python/l1tGTMenu_crossLepSeeds_cff.py b/L1Trigger/Phase2L1GT/python/l1tGTMenu_crossLepSeeds_cff.py new file mode 100644 index 0000000000000..5f84770f3338d --- /dev/null +++ b/L1Trigger/Phase2L1GT/python/l1tGTMenu_crossLepSeeds_cff.py @@ -0,0 +1,198 @@ +import FWCore.ParameterSet.Config as cms + +############################################################ +# L1 Global Trigger Emulation +############################################################ + +# Conditions + +from L1Trigger.Phase2L1GT.l1tGTProducer_cff import l1tGTProducer + +from L1Trigger.Phase2L1GT.l1tGTSingleObjectCond_cfi import l1tGTSingleObjectCond +from L1Trigger.Phase2L1GT.l1tGTDoubleObjectCond_cfi import l1tGTDoubleObjectCond +from L1Trigger.Phase2L1GT.l1tGTTripleObjectCond_cfi import l1tGTTripleObjectCond +from L1Trigger.Phase2L1GT.l1tGTQuadObjectCond_cfi import l1tGTQuadObjectCond + +from L1Trigger.Phase2L1GT.l1tGTAlgoBlockProducer_cff import algorithms + +TkMuonTkIsoEle720 = l1tGTDoubleObjectCond.clone( + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(7,7,7), + minQualityScore = cms.uint32(0), + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), + regionsMinPt=cms.vdouble(16,15), #no qualities in the endcap as online below 25 + regionsMaxRelIsolationPt = cms.vdouble(0.13,0.28) + ), + maxDz = cms.double(1), +) +pTkMuonTkIsoEle7_20 = cms.Path(TkMuonTkIsoEle720) +algorithms.append(cms.PSet(expression = cms.string("pTkMuonTkIsoEle7_20"))) + +TkMuonTkEle723 = l1tGTDoubleObjectCond.clone( + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(7,7,7), + minQualityScore = cms.uint32(0), + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), + regionsQualityFlags=cms.vuint32(0b0010,0b0000), + regionsMinPt=cms.vdouble(19,18), + ), + maxDz = cms.double(1), +) +pTkMuonTkEle7_23 = cms.Path(TkMuonTkEle723) +algorithms.append(cms.PSet(expression = cms.string("pTkMuonTkEle7_23"))) + +TkEleTkMuon1020 = l1tGTDoubleObjectCond.clone( + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), + regionsMinPt=cms.vdouble(7,7), + regionsQualityFlags=cms.vuint32(0b0010,0b0000), + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(18,18,18), + ), + maxDz = cms.double(1), +) +pTkEleTkMuon10_20 = cms.Path(TkEleTkMuon1020) +algorithms.append(cms.PSet(expression = cms.string("pTkEleTkMuon10_20"))) + +TkMuonDoubleTkEle61717 = l1tGTTripleObjectCond.clone( + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(6,6,6), + minQualityScore = cms.uint32(0), + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), + regionsMinPt=cms.vdouble(13,13), + regionsQualityFlags=cms.vuint32(0b0010,0b0000), + ), + collection3 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), + regionsMinPt=cms.vdouble(13,13), + regionsQualityFlags=cms.vuint32(0b0010,0b0000), + ), + correl12 = cms.PSet( + maxDz = cms.double(1) + ), + correl13 = cms.PSet( + maxDz = cms.double(1) + ), +) +pTkMuonDoubleTkEle6_17_17 = cms.Path(TkMuonDoubleTkEle61717) +algorithms.append(cms.PSet(expression = cms.string("pTkMuonDoubleTkEle6_17_17"))) + +DoubleTkMuonTkEle559 = l1tGTTripleObjectCond.clone( + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(5,5,5), + minQualityScore = cms.uint32(0), + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(5,5,5), + minQualityScore = cms.uint32(0), + ), + collection3 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), + regionsMinPt=cms.vdouble(7,6), + regionsQualityFlags=cms.vuint32(0b0010,0b0000), + ), + correl12 = cms.PSet( + maxDz = cms.double(1) + ), + correl13 = cms.PSet( + maxDz = cms.double(1) + ), +) +pDoubleTkMuonTkEle5_5_9 = cms.Path(DoubleTkMuonTkEle559) +algorithms.append(cms.PSet(expression = cms.string("pDoubleTkMuonTkEle5_5_9"))) + +PuppiTauTkMuon4218 = l1tGTDoubleObjectCond.clone( ###NB We need puppivertex here + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.1), + maxEta = cms.double(2.1), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(16,16,16), + maxPrimVertDz = cms.double(1), # in cm + primVertex = cms.uint32(0) # primary vertex index (choose 0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Taus"), + minEta = cms.double(-2.172), + maxEta = cms.double(2.172), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), + regionsMinPt=cms.vdouble(23,14), + minQualityScore = cms.uint32(225), + ), +) +pPuppiTauTkMuon42_18 = cms.Path(PuppiTauTkMuon4218) +algorithms.append(cms.PSet(expression = cms.string("pPuppiTauTkMuon42_18"))) + +PuppiTauTkIsoEle4522 = l1tGTDoubleObjectCond.clone( ###NB We need puppivertex here + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), + minEta = cms.double(-2.1), + maxEta = cms.double(2.1), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), + regionsMinPt=cms.vdouble(18,17), + regionsMaxRelIsolationPt = cms.vdouble(0.13,0.28), + maxPrimVertDz = cms.double(1), # in cm + primVertex = cms.uint32(0) # primary vertex index (choose 0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Taus"), + minEta = cms.double(-2.172), + maxEta = cms.double(2.172), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), + regionsMinPt=cms.vdouble(25,16), + minQualityScore = cms.uint32(225), + ), +) +pPuppiTauTkIsoEle45_22 = cms.Path(PuppiTauTkIsoEle4522) +algorithms.append(cms.PSet(expression = cms.string("pPuppiTauTkIsoEle45_22"))) + + diff --git a/L1Trigger/Phase2L1GT/python/l1tGTMenu_hadr_crossLepSeeds_cff.py b/L1Trigger/Phase2L1GT/python/l1tGTMenu_hadr_crossLepSeeds_cff.py new file mode 100644 index 0000000000000..c553032316a2f --- /dev/null +++ b/L1Trigger/Phase2L1GT/python/l1tGTMenu_hadr_crossLepSeeds_cff.py @@ -0,0 +1,277 @@ +import FWCore.ParameterSet.Config as cms + +############################################################ +# L1 Global Trigger Emulation +############################################################ + +# Conditions + +from L1Trigger.Phase2L1GT.l1tGTProducer_cff import l1tGTProducer + +from L1Trigger.Phase2L1GT.l1tGTSingleObjectCond_cfi import l1tGTSingleObjectCond +from L1Trigger.Phase2L1GT.l1tGTDoubleObjectCond_cfi import l1tGTDoubleObjectCond +from L1Trigger.Phase2L1GT.l1tGTTripleObjectCond_cfi import l1tGTTripleObjectCond +from L1Trigger.Phase2L1GT.l1tGTQuadObjectCond_cfi import l1tGTQuadObjectCond + +from L1Trigger.Phase2L1GT.l1tGTAlgoBlockProducer_cff import algorithms + +TkMuonPuppiHT6320 = l1tGTDoubleObjectCond.clone( #needs z0 with the puppivertex + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(6,6,6), + maxPrimVertDz = cms.double(1), # in cm + primVertex = cms.uint32(0), # primary vertex index (choose 0) + minQualityScore = cms.uint32(0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2HtSum"), + minScalarSumPt = cms.double(251) + ), +) +pTkMuonPuppiHT6_320 = cms.Path(TkMuonPuppiHT6320) +algorithms.append(cms.PSet(expression = cms.string("pTkMuonPuppiHT6_320"))) + + +TkMuTriPuppiJetdRMaxDoubleJetdEtaMax = l1tGTQuadObjectCond.clone( #needs z0 between muon and puppivertex + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(10,10,11), + maxPrimVertDz = cms.double(1), # in cm + primVertex = cms.uint32(0), # primary vertex index (choose 0) + minQualityScore = cms.uint32(0), + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), + regionsMinPt=cms.vdouble(25,25), #safety cut, actually 15 and 16 + ), + collection3 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), + regionsMinPt=cms.vdouble(25,25), #safety cut, actually 15 and 16regionsMinPt=cms.vdouble(25.0,25.0) + ), + collection4 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), + regionsMinPt=cms.vdouble(25,25), #safety cut, actually 15 and 16 + ), + correl12 = cms.PSet( + maxDR = cms.double(0.4), + ), + correl34 = cms.PSet( + maxDEta = cms.double(1.6) + ), + + +) +pTkMuTriPuppiJet_12_40_dRMax_DoubleJet_dEtaMax = cms.Path(TkMuTriPuppiJetdRMaxDoubleJetdEtaMax) + +algorithms.append(cms.PSet(expression=cms.string("pTkMuTriPuppiJet_12_40_dRMax_DoubleJet_dEtaMax"))) + +TkMuPuppiJetPuppiMet = l1tGTTripleObjectCond.clone( #needs z0 between muon and puppivertex + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.1), + maxEta = cms.double(2.1), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(3,3,3), + maxPrimVertDz = cms.double(1), # in cm + primVertex = cms.uint32(0), # primary vertex index (choose 0) + minQualityScore = cms.uint32(0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), + regionsMinPt=cms.vdouble(69,50) + ), + collection3 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2EtSum"), + minPt = cms.double(38) + ), + +) +pTkMuPuppiJetPuppiMet_3_110_120 = cms.Path(TkMuPuppiJetPuppiMet) + +algorithms.append(cms.PSet(expression=cms.string("pTkMuPuppiJetPuppiMet_3_110_120"))) + + +DoubleTkMuPuppiJetPuppiMet = l1tGTQuadObjectCond.clone( #needs z0 between puppivertex and muon + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(3,3,3), + maxPrimVertDz = cms.double(1), # in cm + primVertex = cms.uint32(0), # primary vertex index (choose 0) + minQualityScore = cms.uint32(0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(3,3,3), + maxPrimVertDz = cms.double(1), # in cm + primVertex = cms.uint32(0), # primary vertex index (choose 0) + minQualityScore = cms.uint32(0) + ), + collection3 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), + regionsMinPt=cms.vdouble(30,25) + ), + collection4 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2EtSum"), + minPt = cms.double(45) + ), + +) +pDoubleTkMuPuppiJetPuppiMet_3_3_60_130 = cms.Path(DoubleTkMuPuppiJetPuppiMet) + +algorithms.append(cms.PSet(expression=cms.string("pDoubleTkMuPuppiJetPuppiMet_3_3_60_130"))) + + +DoubleTkMuPuppiHT = l1tGTTripleObjectCond.clone( #needs z0 between puppivertex and muon + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(3,3,3), + maxPrimVertDz = cms.double(1), # in cm + primVertex = cms.uint32(0), # primary vertex index (choose 0) + minQualityScore = cms.uint32(0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), + regionsMinPt=cms.vdouble(3,3,3), + maxPrimVertDz = cms.double(1), # in cm + primVertex = cms.uint32(0), # primary vertex index (choose 0) + minQualityScore = cms.uint32(0) + ), + collection3 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2HtSum"), + minScalarSumPt = cms.double(232) + ), +) +pDoubleTkMuPuppiHT_3_3_300 = cms.Path(DoubleTkMuPuppiHT) + +algorithms.append(cms.PSet(expression=cms.string("pDoubleTkMuPuppiHT_3_3_300"))) + + +DoubleTkElePuppiHT = l1tGTTripleObjectCond.clone( #needs z0 between puppivertex and muon + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), + regionsMinPt=cms.vdouble(6,6), + regionsQualityFlags=cms.vuint32(0b0010,0b0000), + maxPrimVertDz = cms.double(1), # in cm + primVertex = cms.uint32(0), # primary vertex index (choose 0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), + regionsMinPt=cms.vdouble(6,6), + regionsQualityFlags=cms.vuint32(0b0010,0b0000), + maxPrimVertDz = cms.double(1), # in cm + primVertex = cms.uint32(0), # primary vertex index (choose 0) + ), + collection3 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2HtSum"), + minScalarSumPt = cms.double(316) + ), +) +pDoubleTkElePuppiHT_8_8_390 = cms.Path(DoubleTkElePuppiHT) + +algorithms.append(cms.PSet(expression=cms.string("pDoubleTkElePuppiHT_8_8_390"))) + + +TkEleIsoPuppiHT = l1tGTDoubleObjectCond.clone( #missing z0 between electron and puppivertex + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), + minEta = cms.double(-2.1), + maxEta = cms.double(2.1), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), + regionsMinPt=cms.vdouble(21,20), #no qualities as online cut below 25 in the endcap + regionsMaxRelIsolationPt = cms.vdouble(0.13,0.28), + maxPrimVertDz = cms.double(1), # in cm + primVertex = cms.uint32(0), # primary vertex index (choose 0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2HtSum"), + minScalarSumPt = cms.double(131) + ), +) +pTkEleIsoPuppiHT_26_190 = cms.Path(TkEleIsoPuppiHT) +algorithms.append(cms.PSet(expression = cms.string("pTkEleIsoPuppiHT_26_190"))) + + +TkElePuppiJetMinDR = l1tGTDoubleObjectCond.clone( #missing z0 between electron and puppivertex + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), + minEta = cms.double(-2.1), + maxEta = cms.double(2.1), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), + regionsMinPt=cms.vdouble(23,22), + regionsQualityFlags=cms.vuint32(0b0010,0b0000), + maxPrimVertDz = cms.double(1), # in cm + primVertex = cms.uint32(0), # primary vertex index (choose 0) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), + regionsMinPt=cms.vdouble(25,25), #safety cut, actually 15,16 + ), + minDR = cms.double(0.3) +) +pTkElePuppiJet_28_40_MinDR = cms.Path(TkElePuppiJetMinDR) + +algorithms.append(cms.PSet(expression=cms.string("pTkElePuppiJet_28_40_MinDR"))) + + + +NNPuppiTauPuppiMet = l1tGTDoubleObjectCond.clone( + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2Taus"), + minEta = cms.double(-2.172), + maxEta = cms.double(2.172), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), + regionsMinPt=cms.vdouble(30,22), + minQualityScore = cms.uint32(225), + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2EtSum"), + minPt = cms.double(86) + ), + +) +pNNPuppiTauPuppiMet_55_190 = cms.Path(NNPuppiTauPuppiMet) + +algorithms.append(cms.PSet(expression=cms.string("pNNPuppiTauPuppiMet_55_190"))) + diff --git a/L1Trigger/Phase2L1GT/python/l1tGTMenu_hadr_metSeeds_cff.py b/L1Trigger/Phase2L1GT/python/l1tGTMenu_hadr_metSeeds_cff.py index a0b645aba3695..55b6db37206e0 100644 --- a/L1Trigger/Phase2L1GT/python/l1tGTMenu_hadr_metSeeds_cff.py +++ b/L1Trigger/Phase2L1GT/python/l1tGTMenu_hadr_metSeeds_cff.py @@ -18,59 +18,101 @@ ####### JET, MET, HT ########### SinglePuppiJet230 = l1tGTSingleObjectCond.clone( - tag = cms.InputTag("l1tGTProducer", "CL2Jets"), - #minPt = cms.double(164.9), + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), - regionsMinPt=cms.vdouble(160.5,108.3) + regionsMinPt=cms.vdouble(160,108) ) pSinglePuppiJet230 = cms.Path(SinglePuppiJet230) algorithms.append(cms.PSet(expression = cms.string("pSinglePuppiJet230"))) +DoublePuppiJet112112 = l1tGTDoubleObjectCond.clone( + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), + regionsMinPt=cms.vdouble(70,51) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), + minEta = cms.double(-2.4), + maxEta = cms.double(2.4), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), + regionsMinPt=cms.vdouble(70,51) + ), + maxDEta = cms.double(1.6), +) +pDoublePuppiJet112_112 = cms.Path(DoublePuppiJet112112) +algorithms.append(cms.PSet(expression = cms.string("pDoublePuppiJet112_112"))) + +DoublePuppiJet16035Mass620 = l1tGTDoubleObjectCond.clone( + collection1 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), + minEta = cms.double(-5), + maxEta = cms.double(5), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), + regionsMinPt=cms.vdouble(107,74) + ), + collection2 = cms.PSet( + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), + minEta = cms.double(-5), + maxEta = cms.double(5), + regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), + regionsMinPt=cms.vdouble(25,25) #safety cut, in truth 11 and 13 GeV + ), + minInvMass = cms.double(620), +) +pDoublePuppiJet160_35_mass620 = cms.Path(DoublePuppiJet16035Mass620) +algorithms.append(cms.PSet(expression = cms.string("pDoublePuppiJet160_35_mass620"))) + + PuppiHT450 = l1tGTSingleObjectCond.clone( tag = cms.InputTag("l1tGTProducer", "CL2HtSum"), - minScalarSumPt = cms.double(372.9) + minScalarSumPt = cms.double(371) ) pPuppiHT450 = cms.Path(PuppiHT450) algorithms.append(cms.PSet(expression = cms.string("pPuppiHT450"))) +PuppiMHT140 = l1tGTSingleObjectCond.clone( + tag = cms.InputTag("l1tGTProducer", "CL2HtSum"), + minPt = cms.double(133) +) +pPuppiMHT140 = cms.Path(PuppiMHT140) +algorithms.append(cms.PSet(expression = cms.string("pPuppiMHT140"))) PuppiMET200 = l1tGTSingleObjectCond.clone( tag = cms.InputTag("l1tGTProducer", "CL2EtSum"), - minPt = cms.double(93.1) + minPt = cms.double(93) ) pPuppiMET200 = cms.Path(PuppiMET200) algorithms.append(cms.PSet(expression = cms.string("pPuppiMET200"))) QuadJet70554040 = l1tGTQuadObjectCond.clone( collection1 = cms.PSet( - tag = cms.InputTag("l1tGTProducer", "CL2Jets"), - #minPt = cms.double(41.9), + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), - regionsMinPt=cms.vdouble(42.0,32.7) + regionsMinPt=cms.vdouble(38,30) ), collection2 = cms.PSet( - tag = cms.InputTag("l1tGTProducer", "CL2Jets"), - #minPt = cms.double(30.3), + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), - regionsMinPt=cms.vdouble(26.7,25.0) + regionsMinPt=cms.vdouble(27,25.0) ), collection3 = cms.PSet( - tag = cms.InputTag("l1tGTProducer", "CL2Jets"), - #minPt = cms.double(18.8), + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), regionsMinPt=cms.vdouble(25.0,25.0) ), collection4 = cms.PSet( - tag = cms.InputTag("l1tGTProducer", "CL2Jets"), - #minPt = cms.double(18.8), + tag = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), @@ -82,7 +124,7 @@ PuppiHT400 = l1tGTSingleObjectCond.clone( tag = cms.InputTag("l1tGTProducer", "CL2HtSum"), - minScalarSumPt = cms.double(326.9) + minScalarSumPt = cms.double(325) ) pPuppiHT400 = cms.Path(PuppiHT400) diff --git a/L1Trigger/Phase2L1GT/python/l1tGTMenu_lepSeeds_cff.py b/L1Trigger/Phase2L1GT/python/l1tGTMenu_lepSeeds_cff.py index 18f1f1a8658ce..ec7e2cea1c925 100644 --- a/L1Trigger/Phase2L1GT/python/l1tGTMenu_lepSeeds_cff.py +++ b/L1Trigger/Phase2L1GT/python/l1tGTMenu_lepSeeds_cff.py @@ -23,11 +23,10 @@ SingleTkMuon22 = l1tGTSingleObjectCond.clone( tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), - #minPt = cms.double(20.3), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), - regionsMinPt=cms.vdouble(20.0,19.9,20.1) + regionsMinPt=cms.vdouble(20,20,20) ) pSingleTkMuon22 = cms.Path(SingleTkMuon22) algorithms.append(cms.PSet(expression = cms.string("pSingleTkMuon22"))) @@ -35,20 +34,19 @@ DoubleTkMuon157 = l1tGTDoubleObjectCond.clone( collection1 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), - #minPt = cms.double(13.6), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), - regionsMinPt=cms.vdouble(13.4,13.2,13.5) + regionsMinPt=cms.vdouble(13,13,13) ), collection2 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), - #minPt = cms.double(5.9), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), - regionsMinPt=cms.vdouble(7,7,7) + regionsMinPt=cms.vdouble(7,7,7), + minQualityScore = cms.uint32(0) ), maxDz = cms.double(1), ) @@ -61,37 +59,28 @@ minPt = cms.double(5), minEta = cms.double(-2.4), maxEta = cms.double(2.4), - qual = cms.vuint32(0b00000001, 0b00000010, 0b00000011, 0b00000100, 0b00000101, 0b00000110, 0b00000111, 0b00001000, 0b00001001, 0b00001010, 0b00001011, 0b00001100, 0b00001101, 0b00001110, 0b00001111, 0b00010000, 0b00010001, 0b00010010, 0b00010011, 0b00010100, 0b00010101, 0b00010110, 0b00010111, 0b00011000, 0b00011001, 0b00011010, 0b00011011, 0b00011100, 0b00011101, 0b00011110, 0b00011111, 0b00100000, 0b00100001, 0b00100010, 0b00100011, 0b00100100, 0b00100101, 0b00100110, 0b00100111, 0b00101000, 0b00101001, 0b00101010, 0b00101011, 0b00101100, 0b00101101, 0b00101110, 0b00101111, 0b00110000, 0b00110001, 0b00110010, 0b00110011, 0b00110100, 0b00110101, 0b00110110, 0b00110111, 0b00111000, 0b00111001, 0b00111010, 0b00111011, 0b00111100, 0b00111101, 0b00111110, 0b00111111, 0b01000000, 0b01000001, 0b01000010, 0b01000011, 0b01000100, 0b01000101, 0b01000110, 0b01000111, 0b01001000, 0b01001001, 0b01001010, 0b01001011, 0b01001100, 0b01001101, 0b01001110, 0b01001111, 0b01010000, 0b01010001, 0b01010010, 0b01010011, 0b01010100, 0b01010101, 0b01010110, 0b01010111, 0b01011000, 0b01011001, 0b01011010, 0b01011011, 0b01011100, 0b01011101, 0b01011110, 0b01011111, 0b01100000, 0b01100001, 0b01100010, 0b01100011, 0b01100100, 0b01100101, 0b01100110, 0b01100111, 0b01101000, 0b01101001, 0b01101010, 0b01101011, 0b01101100, 0b01101101, 0b01101110, 0b01101111, 0b01110000, 0b01110001, 0b01110010, 0b01110011, 0b01110100, 0b01110101, 0b01110110, 0b01110111, 0b01111000, 0b01111001, 0b01111010, 0b01111011, 0b01111100, 0b01111101, 0b01111110, 0b01111111, 0b10000000, 0b10000001, 0b10000010, 0b10000011, 0b10000100, 0b10000101, 0b10000110, 0b10000111, 0b10001000, 0b10001001, 0b10001010, 0b10001011, 0b10001100, 0b10001101, 0b10001110, 0b10001111, 0b10010000, 0b10010001, 0b10010010, 0b10010011, 0b10010100, 0b10010101, 0b10010110, 0b10010111, 0b10011000, 0b10011001, 0b10011010, 0b10011011, 0b10011100, 0b10011101, 0b10011110, 0b10011111, 0b10100000, 0b10100001, 0b10100010, 0b10100011, 0b10100100, 0b10100101, 0b10100110, 0b10100111, 0b10101000, 0b10101001, 0b10101010, 0b10101011, 0b10101100, 0b10101101, 0b10101110, 0b10101111, 0b10110000, 0b10110001, 0b10110010, 0b10110011, 0b10110100, 0b10110101, 0b10110110, 0b10110111, 0b10111000, 0b10111001, 0b10111010, 0b10111011, 0b10111100, 0b10111101, 0b10111110, 0b10111111, 0b11000000, 0b11000001, 0b11000010, 0b11000011, 0b11000100, 0b11000101, 0b11000110, 0b11000111, 0b11001000, 0b11001001, 0b11001010, 0b11001011, 0b11001100, 0b11001101, 0b11001110, 0b11001111, 0b11010000, 0b11010001, 0b11010010, 0b11010011, 0b11010100, 0b11010101, 0b11010110, 0b11010111, 0b11011000, 0b11011001, 0b11011010, 0b11011011, 0b11011100, 0b11011101, 0b11011110, 0b11011111, 0b11100000, 0b11100001, 0b11100010, 0b11100011, 0b11100100, 0b11100101, 0b11100110, 0b11100111, 0b11101000, 0b11101001, 0b11101010, 0b11101011, 0b11101100, 0b11101101, 0b11101110, 0b11101111, 0b11110000, 0b11110001, 0b11110010, 0b11110011, 0b11110100, 0b11110101, 0b11110110, 0b11110111, 0b11111000, 0b11111001, 0b11111010, 0b11111011, 0b11111100, 0b11111101, 0b11111110, 0b11111111) - #regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), - #regionsMinPt=cms.vdouble(3.9,3.9,4.0) + minQualityScore = cms.uint32(0) ), collection2 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), minPt = cms.double(3), minEta = cms.double(-2.4), maxEta = cms.double(2.4), - qual = cms.vuint32(0b00000001, 0b00000010, 0b00000011, 0b00000100, 0b00000101, 0b00000110, 0b00000111, 0b00001000, 0b00001001, 0b00001010, 0b00001011, 0b00001100, 0b00001101, 0b00001110, 0b00001111, 0b00010000, 0b00010001, 0b00010010, 0b00010011, 0b00010100, 0b00010101, 0b00010110, 0b00010111, 0b00011000, 0b00011001, 0b00011010, 0b00011011, 0b00011100, 0b00011101, 0b00011110, 0b00011111, 0b00100000, 0b00100001, 0b00100010, 0b00100011, 0b00100100, 0b00100101, 0b00100110, 0b00100111, 0b00101000, 0b00101001, 0b00101010, 0b00101011, 0b00101100, 0b00101101, 0b00101110, 0b00101111, 0b00110000, 0b00110001, 0b00110010, 0b00110011, 0b00110100, 0b00110101, 0b00110110, 0b00110111, 0b00111000, 0b00111001, 0b00111010, 0b00111011, 0b00111100, 0b00111101, 0b00111110, 0b00111111, 0b01000000, 0b01000001, 0b01000010, 0b01000011, 0b01000100, 0b01000101, 0b01000110, 0b01000111, 0b01001000, 0b01001001, 0b01001010, 0b01001011, 0b01001100, 0b01001101, 0b01001110, 0b01001111, 0b01010000, 0b01010001, 0b01010010, 0b01010011, 0b01010100, 0b01010101, 0b01010110, 0b01010111, 0b01011000, 0b01011001, 0b01011010, 0b01011011, 0b01011100, 0b01011101, 0b01011110, 0b01011111, 0b01100000, 0b01100001, 0b01100010, 0b01100011, 0b01100100, 0b01100101, 0b01100110, 0b01100111, 0b01101000, 0b01101001, 0b01101010, 0b01101011, 0b01101100, 0b01101101, 0b01101110, 0b01101111, 0b01110000, 0b01110001, 0b01110010, 0b01110011, 0b01110100, 0b01110101, 0b01110110, 0b01110111, 0b01111000, 0b01111001, 0b01111010, 0b01111011, 0b01111100, 0b01111101, 0b01111110, 0b01111111, 0b10000000, 0b10000001, 0b10000010, 0b10000011, 0b10000100, 0b10000101, 0b10000110, 0b10000111, 0b10001000, 0b10001001, 0b10001010, 0b10001011, 0b10001100, 0b10001101, 0b10001110, 0b10001111, 0b10010000, 0b10010001, 0b10010010, 0b10010011, 0b10010100, 0b10010101, 0b10010110, 0b10010111, 0b10011000, 0b10011001, 0b10011010, 0b10011011, 0b10011100, 0b10011101, 0b10011110, 0b10011111, 0b10100000, 0b10100001, 0b10100010, 0b10100011, 0b10100100, 0b10100101, 0b10100110, 0b10100111, 0b10101000, 0b10101001, 0b10101010, 0b10101011, 0b10101100, 0b10101101, 0b10101110, 0b10101111, 0b10110000, 0b10110001, 0b10110010, 0b10110011, 0b10110100, 0b10110101, 0b10110110, 0b10110111, 0b10111000, 0b10111001, 0b10111010, 0b10111011, 0b10111100, 0b10111101, 0b10111110, 0b10111111, 0b11000000, 0b11000001, 0b11000010, 0b11000011, 0b11000100, 0b11000101, 0b11000110, 0b11000111, 0b11001000, 0b11001001, 0b11001010, 0b11001011, 0b11001100, 0b11001101, 0b11001110, 0b11001111, 0b11010000, 0b11010001, 0b11010010, 0b11010011, 0b11010100, 0b11010101, 0b11010110, 0b11010111, 0b11011000, 0b11011001, 0b11011010, 0b11011011, 0b11011100, 0b11011101, 0b11011110, 0b11011111, 0b11100000, 0b11100001, 0b11100010, 0b11100011, 0b11100100, 0b11100101, 0b11100110, 0b11100111, 0b11101000, 0b11101001, 0b11101010, 0b11101011, 0b11101100, 0b11101101, 0b11101110, 0b11101111, 0b11110000, 0b11110001, 0b11110010, 0b11110011, 0b11110100, 0b11110101, 0b11110110, 0b11110111, 0b11111000, 0b11111001, 0b11111010, 0b11111011, 0b11111100, 0b11111101, 0b11111110, 0b11111111) - #regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), - #regionsMinPt=cms.vdouble(2.0,2.0,2.1) + minQualityScore = cms.uint32(0) ), collection3 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "GMTTkMuons"), minPt = cms.double(3), minEta = cms.double(-2.4), maxEta = cms.double(2.4), - qual = cms.vuint32(0b00000001, 0b00000010, 0b00000011, 0b00000100, 0b00000101, 0b00000110, 0b00000111, 0b00001000, 0b00001001, 0b00001010, 0b00001011, 0b00001100, 0b00001101, 0b00001110, 0b00001111, 0b00010000, 0b00010001, 0b00010010, 0b00010011, 0b00010100, 0b00010101, 0b00010110, 0b00010111, 0b00011000, 0b00011001, 0b00011010, 0b00011011, 0b00011100, 0b00011101, 0b00011110, 0b00011111, 0b00100000, 0b00100001, 0b00100010, 0b00100011, 0b00100100, 0b00100101, 0b00100110, 0b00100111, 0b00101000, 0b00101001, 0b00101010, 0b00101011, 0b00101100, 0b00101101, 0b00101110, 0b00101111, 0b00110000, 0b00110001, 0b00110010, 0b00110011, 0b00110100, 0b00110101, 0b00110110, 0b00110111, 0b00111000, 0b00111001, 0b00111010, 0b00111011, 0b00111100, 0b00111101, 0b00111110, 0b00111111, 0b01000000, 0b01000001, 0b01000010, 0b01000011, 0b01000100, 0b01000101, 0b01000110, 0b01000111, 0b01001000, 0b01001001, 0b01001010, 0b01001011, 0b01001100, 0b01001101, 0b01001110, 0b01001111, 0b01010000, 0b01010001, 0b01010010, 0b01010011, 0b01010100, 0b01010101, 0b01010110, 0b01010111, 0b01011000, 0b01011001, 0b01011010, 0b01011011, 0b01011100, 0b01011101, 0b01011110, 0b01011111, 0b01100000, 0b01100001, 0b01100010, 0b01100011, 0b01100100, 0b01100101, 0b01100110, 0b01100111, 0b01101000, 0b01101001, 0b01101010, 0b01101011, 0b01101100, 0b01101101, 0b01101110, 0b01101111, 0b01110000, 0b01110001, 0b01110010, 0b01110011, 0b01110100, 0b01110101, 0b01110110, 0b01110111, 0b01111000, 0b01111001, 0b01111010, 0b01111011, 0b01111100, 0b01111101, 0b01111110, 0b01111111, 0b10000000, 0b10000001, 0b10000010, 0b10000011, 0b10000100, 0b10000101, 0b10000110, 0b10000111, 0b10001000, 0b10001001, 0b10001010, 0b10001011, 0b10001100, 0b10001101, 0b10001110, 0b10001111, 0b10010000, 0b10010001, 0b10010010, 0b10010011, 0b10010100, 0b10010101, 0b10010110, 0b10010111, 0b10011000, 0b10011001, 0b10011010, 0b10011011, 0b10011100, 0b10011101, 0b10011110, 0b10011111, 0b10100000, 0b10100001, 0b10100010, 0b10100011, 0b10100100, 0b10100101, 0b10100110, 0b10100111, 0b10101000, 0b10101001, 0b10101010, 0b10101011, 0b10101100, 0b10101101, 0b10101110, 0b10101111, 0b10110000, 0b10110001, 0b10110010, 0b10110011, 0b10110100, 0b10110101, 0b10110110, 0b10110111, 0b10111000, 0b10111001, 0b10111010, 0b10111011, 0b10111100, 0b10111101, 0b10111110, 0b10111111, 0b11000000, 0b11000001, 0b11000010, 0b11000011, 0b11000100, 0b11000101, 0b11000110, 0b11000111, 0b11001000, 0b11001001, 0b11001010, 0b11001011, 0b11001100, 0b11001101, 0b11001110, 0b11001111, 0b11010000, 0b11010001, 0b11010010, 0b11010011, 0b11010100, 0b11010101, 0b11010110, 0b11010111, 0b11011000, 0b11011001, 0b11011010, 0b11011011, 0b11011100, 0b11011101, 0b11011110, 0b11011111, 0b11100000, 0b11100001, 0b11100010, 0b11100011, 0b11100100, 0b11100101, 0b11100110, 0b11100111, 0b11101000, 0b11101001, 0b11101010, 0b11101011, 0b11101100, 0b11101101, 0b11101110, 0b11101111, 0b11110000, 0b11110001, 0b11110010, 0b11110011, 0b11110100, 0b11110101, 0b11110110, 0b11110111, 0b11111000, 0b11111001, 0b11111010, 0b11111011, 0b11111100, 0b11111101, 0b11111110, 0b11111111) - #regionsAbsEtaLowerBounds=cms.vdouble(0,0.83,1.24), - #regionsMinPt=cms.vdouble(2.0,2.0,2.1) + minQualityScore = cms.uint32(0) ), - delta12 = cms.PSet( + correl12 = cms.PSet( maxDz = cms.double(1) ), - delta13 = cms.PSet( + correl13 = cms.PSet( maxDz = cms.double(1) ), - #delta23 = cms.PSet( - # maxDz = cms.double(1) - #) ) pTripleTkMuon5_3_3 = cms.Path(TripleTkMuon533) algorithms.append(cms.PSet(expression = cms.string("pTripleTkMuon5_3_3"))) @@ -100,13 +89,11 @@ SingleEGEle51 = l1tGTSingleObjectCond.clone( tag = cms.InputTag("l1tGTProducer", "CL2Photons"), - #minPt = cms.double(29.9), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), - regionsMinPt=cms.vdouble(40.7,39.6), - regionsQual=cms.vuint32(0b0010,0b0100), - #qual = cms.vuint32(0b0010) + regionsMinPt=cms.vdouble(41,40), + regionsQualityFlags=cms.vuint32(0b0010,0b0100), ) pSingleEGEle51 = cms.Path(SingleEGEle51) algorithms.append(cms.PSet(expression = cms.string("pSingleEGEle51"))) @@ -114,23 +101,19 @@ DoubleEGEle3724 = l1tGTDoubleObjectCond.clone( collection1 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "CL2Photons"), - #minPt = cms.double(20.6), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), - regionsMinPt=cms.vdouble(28.9,28.4), - regionsQual=cms.vuint32(0b0010,0b0100), - #qual = cms.vuint32(0b0010) + regionsMinPt=cms.vdouble(29,28), + regionsQualityFlags=cms.vuint32(0b0010,0b0100), ), collection2 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "CL2Photons"), - #minPt = cms.double(9.6), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), - regionsMinPt=cms.vdouble(17.9,18.0), - regionsQual=cms.vuint32(0b0010,0b0100), - #qual = cms.vuint32(0b0010) + regionsMinPt=cms.vdouble(18,18), + regionsQualityFlags=cms.vuint32(0b0010,0b0100), ), minDR = cms.double(0.1), ) @@ -140,24 +123,19 @@ IsoTkEleEGEle2212 = l1tGTDoubleObjectCond.clone( collection1 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), - #minPt = cms.double(20.6), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), - regionsMinPt=cms.vdouble(17.8,17.1), - #regionsQual=cms.vuint32(0b0000,0b0010), - regionsMaxIso = cms.vdouble(0.13,0.28) - #qual = cms.vuint32(0b0010) + regionsMinPt=cms.vdouble(18,17), + regionsMaxRelIsolationPt = cms.vdouble(0.13,0.28) ), collection2 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "CL2Photons"), - #minPt = cms.double(9.6), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), - regionsMinPt=cms.vdouble(7.8,8.3), - regionsQual=cms.vuint32(0b0010,0b0100) - #qual = cms.vuint32(0b0010) + regionsMinPt=cms.vdouble(8,8), + regionsQualityFlags=cms.vuint32(0b0010,0b0100) ), minDR = cms.double(0.1), ) @@ -166,126 +144,55 @@ SingleTkEle36 = l1tGTSingleObjectCond.clone( tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), - #minPt = cms.double(29.9), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), - regionsMinPt=cms.vdouble(29.8,28.5), - regionsQual=cms.vuint32(0b0010,0b0010) - #qual = cms.vuint32(0b0010) + regionsMinPt=cms.vdouble(30,29), + regionsQualityFlags=cms.vuint32(0b0010,0b0010) ) pSingleTkEle36 = cms.Path(SingleTkEle36) algorithms.append(cms.PSet(expression = cms.string("pSingleTkEle36"))) SingleIsoTkEle28 = l1tGTSingleObjectCond.clone( tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), - #minPt = cms.double(29.9), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), - regionsMinPt=cms.vdouble(23,22.1), - #regionsQual=cms.vuint32(0b0000,0b0010), - regionsMaxIso = cms.vdouble(0.13,0.28) - #qual = cms.vuint32(0b0010) + regionsMinPt=cms.vdouble(23,22), + regionsMaxRelIsolationPt = cms.vdouble(0.13,0.28) ) pSingleIsoTkEle28 = cms.Path(SingleIsoTkEle28) algorithms.append(cms.PSet(expression = cms.string("pSingleIsoTkEle28"))) -#SingleIsoTkEle28Barrel = l1tGTSingleObjectCond.clone( -# tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), -# minPt = cms.double(23), -# minEta = cms.double(-1.479), -# maxEta = cms.double(1.479), - #maxIso = cms.double(0.13), -#) -#pSingleIsoTkEle28Barrel = cms.Path(SingleIsoTkEle28Barrel) -#algorithms.append(cms.PSet(expression = cms.string("pSingleIsoTkEle28Barrel"))) - -#SingleIsoTkEle28BarrelQual = l1tGTSingleObjectCond.clone( -# tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), -# minPt = cms.double(23), -# minEta = cms.double(-1.479), -# maxEta = cms.double(1.479), -# qual = cms.vuint32(0b0000), - #maxIso = cms.double(0.13), -#) -#pSingleIsoTkEle28BarrelQual = cms.Path(SingleIsoTkEle28BarrelQual) -#algorithms.append(cms.PSet(expression = cms.string("pSingleIsoTkEle28BarrelQual"))) - -#SingleIsoTkEle28Endcap = l1tGTSingleObjectCond.clone( -# tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), -# minPt = cms.double(21.9), -# minEtaAbs = cms.double(1.479), -# maxEtaAbs = cms.double(2.4), -# qual = cms.vuint32(0b0010,0b0011,0b0110,0b1010,0b0111,0b1011,0b1110,0b1111), - #maxIso = cms.double(0.28) -#) -#pSingleIsoTkEle28Endcap = cms.Path(SingleIsoTkEle28Endcap) -#algorithms.append(cms.PSet(expression = cms.string("pSingleIsoTkEle28Endcap"))) - -#algorithms.append(cms.PSet(name=cms.string("pSingleIsoTkEle28OLD"), -# expression=cms.string("pSingleIsoTkEle28Barrel or pSingleIsoTkEle28Endcap"))) - - SingleIsoTkPho36 = l1tGTSingleObjectCond.clone( tag = cms.InputTag("l1tGTProducer", "CL2Photons"), - #minPt = cms.double(30.8), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), - regionsMinPt=cms.vdouble(30.4,29.0), - regionsQual=cms.vuint32(0b0010,0b0100), - regionsMaxIso = cms.vdouble(0.25,0.205) - #qual = cms.vuint32(0b0100), - #maxIso = cms.double(0.205) + regionsMinPt=cms.vdouble(30,29), + regionsQualityFlags=cms.vuint32(0b0010,0b0100), + regionsMaxRelIsolationPt = cms.vdouble(0.25,0.205) ) pSingleIsoTkPho36 = cms.Path(SingleIsoTkPho36) algorithms.append(cms.PSet(expression=cms.string("pSingleIsoTkPho36"))) -#SingleIsoTkPho36Barrel = l1tGTSingleObjectCond.clone( -# tag = cms.InputTag("l1tGTProducer", "CL2Photons"), -# minPt = cms.double(30.8), -# minEta = cms.double(-1.479), -# maxEta = cms.double(1.479), -# qual = cms.vuint32(0b0010), -# maxIso = cms.double(0.25) -#) -#pSingleIsoTkPho36Barrel = cms.Path(SingleIsoTkPho36Barrel) - -#SingleIsoTkPho36Endcap = l1tGTSingleObjectCond.clone( -# tag = cms.InputTag("l1tGTProducer", "CL2Photons"), -# minPt = cms.double(30.8), -# minEtaAbs = cms.double(1.479), -# maxEtaAbs = cms.double(2.4), -# qual = cms.vuint32(0b0100), -# maxIso = cms.double(0.205) -#) -#pSingleIsoTkPho36Endcap = cms.Path(SingleIsoTkPho36Endcap) -# -#algorithms.append(cms.PSet(name=cms.string("pSingleIsoTkPho36"), -# expression=cms.string("pSingleIsoTkPho36Barrel or pSingleIsoTkPho36Endcap"))) - DoubleTkEle2512 = l1tGTDoubleObjectCond.clone( collection1 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), - #minPt = cms.double(20.6), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), - regionsMinPt=cms.vdouble(20.3,19.5), - regionsQual=cms.vuint32(0b0010,0b0000) - #qual = cms.vuint32(0b0010) + regionsMinPt=cms.vdouble(20,20), + regionsQualityFlags=cms.vuint32(0b0010,0b0000) ), collection2 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "CL2Electrons"), - #minPt = cms.double(9.6), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), - regionsMinPt=cms.vdouble(9.1,8.8), - regionsQual=cms.vuint32(0b0010,0b0000) - #qual = cms.vuint32(0b0010) + regionsMinPt=cms.vdouble(9,9), + regionsQualityFlags=cms.vuint32(0b0010,0b0000) ), maxDz = cms.double(1), ) @@ -295,112 +202,42 @@ DoubleIsoTkPho2212 = l1tGTDoubleObjectCond.clone( collection1 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "CL2Photons"), - #minPt = cms.double(20.6), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), - regionsMinPt=cms.vdouble(17.6,15.9), - regionsQual=cms.vuint32(0b0010,0b0100), - regionsMaxIso = cms.vdouble(0.25,0.205) - #qual = cms.vuint32(0b0010) + regionsMinPt=cms.vdouble(18,16), + regionsQualityFlags=cms.vuint32(0b0010,0b0100), + regionsMaxRelIsolationPt = cms.vdouble(0.25,0.205) ), collection2 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "CL2Photons"), - #minPt = cms.double(9.6), minEta = cms.double(-2.4), maxEta = cms.double(2.4), regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), - regionsMinPt=cms.vdouble(8.5,6.0), - regionsQual=cms.vuint32(0b0010,0b0100), - regionsMaxIso = cms.vdouble(0.25,0.205) - #qual = cms.vuint32(0b0010) + regionsMinPt=cms.vdouble(8,7), + regionsQualityFlags=cms.vuint32(0b0010,0b0100), + regionsMaxRelIsolationPt = cms.vdouble(0.25,0.205) ), ) pDoubleIsoTkPho22_12 = cms.Path(DoubleIsoTkPho2212) algorithms.append(cms.PSet(expression = cms.string("pDoubleIsoTkPho22_12"))) - - -#SingleIsoTkPho36 = l1tGTSingleObjectCond.clone( -# tag = cms.InputTag("l1tGTProducer", "CL2Photons"), -# #minPt = cms.double(30.8), -# minEta = cms.double(-2.4), -# maxEta = cms.double(2.4), -# regionsAbsEtaLowerBounds=cms.vdouble(0,1.479), -# regionsMinPt=cms.vdouble(30.8,29.2), -# regionsQual=cms.vuint32(0b0010,0b0100) - #qual = cms.vuint32(0b0100), - #maxIso = cms.double(0.205) -#) -#pSingleIsoTkPho36 = cms.Path(SingleIsoTkPho36) - -#algorithms.append(cms.PSet(expression=cms.string("pSingleIsoTkPho36"))) - - - - - -#SingleIsoTkPho22Barrel = l1tGTSingleObjectCond.clone( -# tag = cms.InputTag("l1tGTProducer", "CL2Photons"), -# minPt = cms.double(17.1), -# minEta = cms.double(-1.479), -# maxEta = cms.double(1.479), -# qual = cms.vuint32(0b0010), -# maxIso = cms.double(0.25) -#) -#pSingleIsoTkPho22Barrel = cms.Path(SingleIsoTkPho22Barrel) - -#SingleIsoTkPho22Endcap = l1tGTSingleObjectCond.clone( -# tag = cms.InputTag("l1tGTProducer", "CL2Photons"), -# minPt = cms.double(17.1), -# minEtaAbs = cms.double(1.479), -# maxEtaAbs = cms.double(2.4), -# qual = cms.vuint32(0b0100), -# maxIso = cms.double(0.205) -#) -#pSingleIsoTkPho22Endcap = cms.Path(SingleIsoTkPho22Endcap) - -#SingleIsoTkPho12Barrel = l1tGTSingleObjectCond.clone( -# tag = cms.InputTag("l1tGTProducer", "CL2Photons"), -# minPt = cms.double(8.8), -# minEta = cms.double(-1.479), -# maxEta = cms.double(1.479), -# qual = cms.vuint32(0b0010), -# maxIso = cms.double(0.25) -#) -#pSingleIsoTkPho12Barrel = cms.Path(SingleIsoTkPho12Barrel) - -#SingleIsoTkPho12EndcapPos = l1tGTSingleObjectCond.clone( -# tag = cms.InputTag("l1tGTProducer", "CL2Photons"), -# minPt = cms.double(8.8), -# minEtaAbs = cms.double(1.479), -# maxEtaAbs = cms.double(2.4), -# qual = cms.vuint32(0b0100), -# maxIso = cms.double(0.205) -#) -#pSingleIsoTkPho12EndcapPos = cms.Path(SingleIsoTkPho12EndcapPos) - -#algorithms.append(cms.PSet(name=cms.string("pDoubleTkIsoPho22_12"), -# expression=cms.string("(pSingleIsoTkPho22Barrel or pSingleIsoTkPho22EndcapPos or pSingleIsoTkPho22EndcapNeg) and (pSingleIsoTkPho12Barrel or pSingleIsoTkPho12EndcapPos or pSingleIsoTkPho12EndcapNeg)"))) - - - DoublePuppiTau5252 = l1tGTDoubleObjectCond.clone( collection1 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "CL2Taus"), minEta = cms.double(-2.172), maxEta = cms.double(2.172), regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), - regionsMinPt=cms.vdouble(28.6,19.6), - minHwIso = cms.int32(286), + regionsMinPt=cms.vdouble(28,20), + minQualityScore = cms.uint32(225), ), collection2 = cms.PSet( tag = cms.InputTag("l1tGTProducer", "CL2Taus"), minEta = cms.double(-2.172), maxEta = cms.double(2.172), regionsAbsEtaLowerBounds=cms.vdouble(0,1.5), - regionsMinPt=cms.vdouble(28.6,19.6), - minHwIso = cms.int32(286), + regionsMinPt=cms.vdouble(28,20), + minQualityScore = cms.uint32(225), ), minDR = cms.double(0.5), ) diff --git a/L1Trigger/Phase2L1GT/python/l1tGTProducer_cff.py b/L1Trigger/Phase2L1GT/python/l1tGTProducer_cff.py index 45f332b07cac5..cd1417d8d3b6d 100644 --- a/L1Trigger/Phase2L1GT/python/l1tGTProducer_cff.py +++ b/L1Trigger/Phase2L1GT/python/l1tGTProducer_cff.py @@ -10,7 +10,8 @@ GMTSaPromptMuons = cms.InputTag("l1tSAMuonsGmt", "prompt"), GMTSaDisplacedMuons = cms.InputTag("l1tSAMuonsGmt", "displaced"), GMTTkMuons = cms.InputTag("l1tTkMuonsGmt"), - CL2Jets = cms.InputTag("l1tSC4PFL1PuppiCorrectedEmulator"), + CL2JetsSC4 = cms.InputTag("l1tSC4PFL1PuppiCorrectedEmulator"), + CL2JetsSC8 = cms.InputTag("l1tSC8PFL1PuppiCorrectedEmulator"), CL2Electrons = cms.InputTag("l1tLayer2EG", "L1CtTkElectron"), CL2Photons = cms.InputTag("l1tLayer2EG", "L1CtTkEm"), CL2Taus = cms.InputTag("l1tNNTauProducerPuppi", "L1PFTausNN"), diff --git a/L1Trigger/Phase2L1GT/python/l1tGTQuadObjectCond_cfi.py b/L1Trigger/Phase2L1GT/python/l1tGTQuadObjectCond_cfi.py index d6a1539634dba..27c3fb2b406e6 100644 --- a/L1Trigger/Phase2L1GT/python/l1tGTQuadObjectCond_cfi.py +++ b/L1Trigger/Phase2L1GT/python/l1tGTQuadObjectCond_cfi.py @@ -9,5 +9,6 @@ cosh_eta_lut2=COSH_ETA_LUT_2.config(), cos_phi_lut=COS_PHI_LUT.config(), sanity_checks=cms.untracked.bool(False), - inv_mass_checks=cms.untracked.bool(False) + inv_mass_checks=cms.untracked.bool(False), + primVertTag = cms.InputTag("l1tGTProducer", "GTTPrimaryVert") ) diff --git a/L1Trigger/Phase2L1GT/python/l1tGTScales.py b/L1Trigger/Phase2L1GT/python/l1tGTScales.py index 350e71ce2476d..04b27392a5842 100644 --- a/L1Trigger/Phase2L1GT/python/l1tGTScales.py +++ b/L1Trigger/Phase2L1GT/python/l1tGTScales.py @@ -8,15 +8,15 @@ eta_lsb=cms.double(math.pi / 2**12), # radiants z0_lsb=cms.double(1/(5*2**9)), # cm # d0_lsb = cms.double(...), TODO input scales far apart - isolation_lsb=cms.double(0.25), # GeV + isolationPT_lsb=cms.double(0.25), # GeV beta_lsb=cms.double(1. / 2**4), # [0, 1] mass_lsb=cms.double(0.25), # GeV^2 seed_pT_lsb=cms.double(0.25), # GeV seed_z0_lsb=cms.double(30. / 2**9), # ? cm - sca_sum_lsb=cms.double(0.03125), # GeV + scalarSumPT_lsb=cms.double(0.03125), # GeV sum_pT_pv_lsb=cms.double(0.25), # GeV - pos_chg=cms.int32(1), - neg_chg=cms.int32(0) + pos_chg=cms.int32(0), + neg_chg=cms.int32(1) ) l1tGTScales = CppScales(*[param.value() for param in scale_parameter.parameters_().values()]) diff --git a/L1Trigger/Phase2L1GT/python/l1tGTSingleInOutLUT.py b/L1Trigger/Phase2L1GT/python/l1tGTSingleInOutLUT.py index 67e97e01991ab..96198996030dd 100644 --- a/L1Trigger/Phase2L1GT/python/l1tGTSingleInOutLUT.py +++ b/L1Trigger/Phase2L1GT/python/l1tGTSingleInOutLUT.py @@ -12,7 +12,7 @@ class SingleInOutLUT: - def __init__(self, width_in, unused_lsbs, lsb, output_scale_factor, operation, start_value=0, label=""): + def __init__(self, width_in, unused_lsbs, lsb, output_scale_factor, operation, start_value=0, label="", width_out_force=0): self.debug_txt = "" input_scale_factor = 2**unused_lsbs * lsb self.unused_lsbs = unused_lsbs @@ -20,12 +20,14 @@ def __init__(self, width_in, unused_lsbs, lsb, output_scale_factor, operation, s signed_output = min([operation(input_scale_factor * (i + 0.5) + start_value) for i in range(2**width_in)]) < 0 - self.width_out = math.ceil(math.log2(output_scale_factor * - max([abs(operation(input_scale_factor * (i + 0.5) + start_value)) for i in range(2**width_in - 1)] + - [abs(operation(input_scale_factor * (2**width_in - 1) + start_value))]))) - - if signed_output: - self.width_out += 1 + if width_out_force == 0: + self.width_out = math.ceil(math.log2(output_scale_factor * + max([abs(operation(input_scale_factor * (i + 0.5) + start_value)) for i in range(2**width_in - 1)] + + [abs(operation(input_scale_factor * (2**width_in - 1) + start_value))]))) + if signed_output: + self.width_out += 1 + else: + self.width_out = width_out_force self.debug_info( "***************************** {} LUT {} *****************************".format(operation.__name__, label)) @@ -38,8 +40,8 @@ def __init__(self, width_in, unused_lsbs, lsb, output_scale_factor, operation, s self.operation = operation self.start_value = start_value self.lut = cms.vint32( - * ([round(output_scale_factor * operation(input_scale_factor * (i + 0.5) + start_value)) for i in range(2**width_in - 1)] - + [round(output_scale_factor * operation(input_scale_factor * (2 ** width_in - 1) + start_value))])) + * ([min(round(output_scale_factor * operation(input_scale_factor * (i + 0.5) + start_value)), 2**self.width_out - 1) for i in range(2**width_in - 1)] + + [min(round(output_scale_factor * operation(input_scale_factor * (2 ** width_in - 1) + start_value)), 2**self.width_out - 1)])) self.print_error() @@ -87,19 +89,25 @@ def print_error(self): ISOLATION_WIDTH = 11 # Since we calculate cosh(dEta) - cos(dPhi); both must be on the same scale the difference should fit into 17 bits for the DSP -optimal_scale_factor = math.floor( +optimal_scale_factor_lower = math.floor( (2**17 - 1) / (math.cosh((2**(COSH_ETA_IN_WIDTH + 2) - 1)*scale_parameter.eta_lsb.value()) + 1)) COS_PHI_LUT = SingleInOutLUT( - COS_PHI_IN_WIDTH, 2, scale_parameter.phi_lsb.value(), optimal_scale_factor, math.cos) + COS_PHI_IN_WIDTH, 2, scale_parameter.phi_lsb.value(), optimal_scale_factor_lower, math.cos) # eta in [0, 2pi) COSH_ETA_LUT = SingleInOutLUT( - COSH_ETA_IN_WIDTH, 2, scale_parameter.eta_lsb.value(), optimal_scale_factor, math.cosh, 0, "[0, 2pi)") + COSH_ETA_IN_WIDTH, 2, scale_parameter.eta_lsb.value(), optimal_scale_factor_lower, math.cosh, 0, "[0, 2pi)") + +optimal_scale_factor_upper = SingleInOutLUT.optimal_scale_factor( + COSH_ETA_IN_WIDTH, 17, 2, scale_parameter.eta_lsb.value(), math.cosh, 2**13 * scale_parameter.eta_lsb.value()) + +# Ensure a bitshift between upper and lower scale factor (makes 3- and 4-body invariant mass calculations easier). +# As a result values for cosh(dEta) with approximately dEta > 12.5 are binned to a lower value. +# However, there is no detector at abs(eta) > 6, so it shouldn't matter. +optimal_scale_factor_upper = optimal_scale_factor_lower / \ + math.pow(2, math.floor(math.log2(optimal_scale_factor_lower / optimal_scale_factor_upper))) # eta in [2pi, 4pi) COSH_ETA_LUT_2 = SingleInOutLUT( - COSH_ETA_IN_WIDTH, 2, scale_parameter.eta_lsb.value(), - SingleInOutLUT.optimal_scale_factor( - COSH_ETA_IN_WIDTH, 17, 2, scale_parameter.eta_lsb.value(), math.cosh, 2**13 * scale_parameter.eta_lsb.value()), - math.cosh, 2**13 * scale_parameter.eta_lsb.value(), "[2pi, 4pi)") + COSH_ETA_IN_WIDTH, 2, scale_parameter.eta_lsb.value(), optimal_scale_factor_upper, math.cosh, 2**13 * scale_parameter.eta_lsb.value(), "[2pi, 4pi)", 17) diff --git a/L1Trigger/Phase2L1GT/python/l1tGTSingleObjectCond_cfi.py b/L1Trigger/Phase2L1GT/python/l1tGTSingleObjectCond_cfi.py index 783e7aafb309f..4e56307edad52 100644 --- a/L1Trigger/Phase2L1GT/python/l1tGTSingleObjectCond_cfi.py +++ b/L1Trigger/Phase2L1GT/python/l1tGTSingleObjectCond_cfi.py @@ -3,5 +3,6 @@ l1tGTSingleObjectCond = cms.EDFilter( "L1GTSingleObjectCond", - scales=scale_parameter + scales=scale_parameter, + primVertTag = cms.InputTag("l1tGTProducer", "GTTPrimaryVert") ) diff --git a/L1Trigger/Phase2L1GT/python/l1tGTTripleObjectCond_cfi.py b/L1Trigger/Phase2L1GT/python/l1tGTTripleObjectCond_cfi.py index 19dce9c0ad63b..7503b0ae395a1 100644 --- a/L1Trigger/Phase2L1GT/python/l1tGTTripleObjectCond_cfi.py +++ b/L1Trigger/Phase2L1GT/python/l1tGTTripleObjectCond_cfi.py @@ -9,5 +9,6 @@ cosh_eta_lut2=COSH_ETA_LUT_2.config(), cos_phi_lut=COS_PHI_LUT.config(), sanity_checks=cms.untracked.bool(False), - inv_mass_checks=cms.untracked.bool(False) + inv_mass_checks=cms.untracked.bool(False), + primVertTag = cms.InputTag("l1tGTProducer", "GTTPrimaryVert") ) diff --git a/L1Trigger/Phase2L1GT/src/L1GTScales.cc b/L1Trigger/Phase2L1GT/src/L1GTScales.cc index 1c9050fa4c083..02fc87fe36517 100644 --- a/L1Trigger/Phase2L1GT/src/L1GTScales.cc +++ b/L1Trigger/Phase2L1GT/src/L1GTScales.cc @@ -10,12 +10,12 @@ namespace l1t { double eta_lsb, double z0_lsb, //double d0_lsb, - double isolation_lsb, + double isolationPT_lsb, double beta_lsb, double mass_lsb, double seed_pT_lsb, double seed_z0_lsb, - double sca_sum_lsb, + double scalarSumPT_lsb, double sum_pT_pv_lsb, int pos_chg, int neg_chg) @@ -24,13 +24,12 @@ namespace l1t { eta_lsb_(eta_lsb), z0_lsb_(z0_lsb), //d0_lsb_(d0_lsb), - isolation_lsb_(isolation_lsb), - isolation_shift_(RELATIVE_ISOLATION_RESOLUTION + std::log2(isolation_lsb_ / pT_lsb_)), + isolationPT_lsb_(isolationPT_lsb), beta_lsb_(beta_lsb), mass_lsb_(mass_lsb), seed_pT_lsb_(seed_pT_lsb), seed_z0_lsb_(seed_z0_lsb), - sca_sum_lsb_(sca_sum_lsb), + scalarSumPT_lsb_(scalarSumPT_lsb), sum_pT_pv_lsb_(sum_pT_pv_lsb), pos_chg_(pos_chg), neg_chg_(neg_chg) {} @@ -41,13 +40,12 @@ namespace l1t { eta_lsb_(config.getParameter("eta_lsb")), z0_lsb_(config.getParameter("z0_lsb")), //d0_lsb_(config.getParameter("d0_lsb")), - isolation_lsb_(config.getParameter("isolation_lsb")), - isolation_shift_(RELATIVE_ISOLATION_RESOLUTION + std::log2(isolation_lsb_ / pT_lsb_)), + isolationPT_lsb_(config.getParameter("isolationPT_lsb")), beta_lsb_(config.getParameter("beta_lsb")), mass_lsb_(config.getParameter("mass_lsb")), seed_pT_lsb_(config.getParameter("seed_pT_lsb")), seed_z0_lsb_(config.getParameter("seed_z0_lsb")), - sca_sum_lsb_(config.getParameter("sca_sum_lsb")), + scalarSumPT_lsb_(config.getParameter("scalarSumPT_lsb")), sum_pT_pv_lsb_(config.getParameter("sum_pT_pv_lsb")), pos_chg_(config.getParameter("pos_chg")), neg_chg_(config.getParameter("neg_chg")) {} @@ -58,12 +56,12 @@ namespace l1t { desc.add("eta_lsb"); desc.add("z0_lsb"); //desc.add("d0_lsb"); - desc.add("isolation_lsb"); + desc.add("isolationPT_lsb"); desc.add("beta_lsb"); desc.add("mass_lsb"); desc.add("seed_pT_lsb"); desc.add("seed_z0_lsb"); - desc.add("sca_sum_lsb"); + desc.add("scalarSumPT_lsb"); desc.add("sum_pT_pv_lsb"); desc.add("pos_chg"); desc.add("neg_chg"); @@ -85,22 +83,34 @@ namespace l1t { double, int, int>()) - .def("to_hw_pT", &L1GTScales::to_hw_pT) - .def("to_hw_phi", &L1GTScales::to_hw_phi) - .def("to_hw_eta", &L1GTScales::to_hw_eta) - .def("to_hw_z0", &L1GTScales::to_hw_z0) - .def("to_hw_isolation", &L1GTScales::to_hw_isolation) - .def("isolation_shift", &L1GTScales::isolation_shift) - .def("to_hw_beta", &L1GTScales::to_hw_beta) - .def("to_hw_mass", &L1GTScales::to_hw_mass) - .def("to_hw_seed_pT", &L1GTScales::to_hw_seed_pT) - .def("to_hw_seed_z0", &L1GTScales::to_hw_seed_z0) - .def("to_hw_sca_sum", &L1GTScales::to_hw_sca_sum) - .def("to_hw_sum_pT_pv", &L1GTScales::to_hw_sum_pT_pv) - .def("to_hw_dRSquared", &L1GTScales::to_hw_dRSquared) + .def("to_hw_pT_ceil", &L1GTScales::to_hw_pT_ceil) + .def("to_hw_phi_ceil", &L1GTScales::to_hw_phi_ceil) + .def("to_hw_eta_ceil", &L1GTScales::to_hw_eta_ceil) + .def("to_hw_z0_ceil", &L1GTScales::to_hw_z0_ceil) + .def("to_hw_relative_isolationPT_ceil", &L1GTScales::to_hw_relative_isolationPT_ceil) + .def("to_hw_beta_ceil", &L1GTScales::to_hw_beta_ceil) + .def("to_hw_mass_ceil", &L1GTScales::to_hw_mass_ceil) + .def("to_hw_seed_pT_ceil", &L1GTScales::to_hw_seed_pT_ceil) + .def("to_hw_seed_z0_ceil", &L1GTScales::to_hw_seed_z0_ceil) + .def("to_hw_scalarSumPT_ceil", &L1GTScales::to_hw_scalarSumPT_ceil) + .def("to_hw_sum_pT_pv_ceil", &L1GTScales::to_hw_sum_pT_pv_ceil) + .def("to_hw_dRSquared_ceil", &L1GTScales::to_hw_dRSquared_ceil) + .def("to_hw_pT_floor", &L1GTScales::to_hw_pT_floor) + .def("to_hw_phi_floor", &L1GTScales::to_hw_phi_floor) + .def("to_hw_eta_floor", &L1GTScales::to_hw_eta_floor) + .def("to_hw_z0_floor", &L1GTScales::to_hw_z0_floor) + .def("to_hw_relative_isolationPT_floor", &L1GTScales::to_hw_relative_isolationPT_floor) + .def("to_hw_beta_floor", &L1GTScales::to_hw_beta_floor) + .def("to_hw_mass_floor", &L1GTScales::to_hw_mass_floor) + .def("to_hw_seed_pT_floor", &L1GTScales::to_hw_seed_pT_floor) + .def("to_hw_seed_z0_floor", &L1GTScales::to_hw_seed_z0_floor) + .def("to_hw_scalarSumPT_floor", &L1GTScales::to_hw_scalarSumPT_floor) + .def("to_hw_sum_pT_pv_floor", &L1GTScales::to_hw_sum_pT_pv_floor) + .def("to_hw_dRSquared_floor", &L1GTScales::to_hw_dRSquared_floor) .def("to_hw_InvMassSqrDiv2", &L1GTScales::to_hw_InvMassSqrDiv2) .def("to_hw_TransMassSqrDiv2", &L1GTScales::to_hw_TransMassSqrDiv2) .def("to_hw_PtSquared", &L1GTScales::to_hw_PtSquared) + .def("to_hw_InvMassSqrOver2DR", &L1GTScales::to_hw_InvMassSqrOver2DR) .def("neg_chg", &L1GTScales::neg_chg) .def("pos_chg", &L1GTScales::pos_chg); } diff --git a/L1Trigger/Phase2L1GT/test/gt_firmware_evaluation.py b/L1Trigger/Phase2L1GT/test/gt_firmware_evaluation.py index 9878d970a4a76..3517d9474909b 100644 --- a/L1Trigger/Phase2L1GT/test/gt_firmware_evaluation.py +++ b/L1Trigger/Phase2L1GT/test/gt_firmware_evaluation.py @@ -9,7 +9,7 @@ # Input source process.source = cms.Source("EmptySource") -process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(72)) +process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(94)) options = VarParsing.VarParsing() options.register ("platform", @@ -408,13 +408,13 @@ process._doublePUPPIJet_112_112_er2p4_dEtaMax1p6 = l1tGTDoubleObjectCond.clone( collection1=cms.PSet( - tag=cms.InputTag("l1tGTProducer", "CL2Jets"), + tag=cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minPt=cms.double(112), minEta=cms.double(-2.4), maxEta=cms.double(2.4), ), collection2=cms.PSet( - tag=cms.InputTag("l1tGTProducer", "CL2Jets"), + tag=cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minPt=cms.double(112), minEta=cms.double(-2.4), maxEta=cms.double(2.4), @@ -563,13 +563,13 @@ process._doublePuppiJet_160_35_er5p0_massMin620 = l1tGTDoubleObjectCond.clone( collection1=cms.PSet( - tag=cms.InputTag("l1tGTProducer", "CL2Jets"), + tag=cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minPt=cms.double(160), minEta=cms.double(-5), maxEta=cms.double(5), ), collection2=cms.PSet( - tag=cms.InputTag("l1tGTProducer", "CL2Jets"), + tag=cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minPt=cms.double(35), minEta=cms.double(-5), maxEta=cms.double(5), @@ -654,15 +654,15 @@ process._triplePuppiJet_70_50_35 = l1tGTTripleObjectCond.clone( collection1=cms.PSet( - tag=cms.InputTag("l1tGTProducer", "CL2Jets"), + tag=cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minPt=cms.double(70) ), collection2=cms.PSet( - tag=cms.InputTag("l1tGTProducer", "CL2Jets"), + tag=cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minPt=cms.double(50) ), collection3=cms.PSet( - tag=cms.InputTag("l1tGTProducer", "CL2Jets"), + tag=cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minPt=cms.double(35) ) ) @@ -681,7 +681,7 @@ maxEta=cms.double(2.4) ), collection3=cms.PSet( - tag=cms.InputTag("l1tGTProducer", "CL2Jets"), + tag=cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minPt=cms.double(25), minEta=cms.double(-2.4), maxEta=cms.double(2.4) @@ -707,10 +707,10 @@ minEta=cms.double(-3.4), maxEta=cms.double(3.4) ), - delta12=cms.PSet( + correl12=cms.PSet( ss=cms.bool(True) ), - delta13=cms.PSet( + correl13=cms.PSet( ss=cms.bool(True) ) ) @@ -740,13 +740,13 @@ minEta=cms.double(-3.4), maxEta=cms.double(3.4) ), - delta12=cms.PSet( + correl12=cms.PSet( ss=cms.bool(True) ), - delta13=cms.PSet( + correl13=cms.PSet( ss=cms.bool(True) ), - delta14=cms.PSet( + correl14=cms.PSet( ss=cms.bool(True) ) ) @@ -767,7 +767,7 @@ maxEta=cms.double(2.4) ), collection3=cms.PSet( - tag=cms.InputTag("l1tGTProducer", "CL2Jets"), + tag=cms.InputTag("l1tGTProducer", "CL2JetsSC4"), minPt=cms.double(25), minEta=cms.double(-2.4), maxEta=cms.double(2.4) @@ -809,14 +809,58 @@ channels = cms.vuint32(32, 33) -process.BoardData = cms.EDAnalyzer("L1GTBoardWriter", +process.BoardData = cms.EDAnalyzer("L1GTAlgoBoardWriter", outputFilename = cms.string("outputPattern"), algoBlocksTag = cms.InputTag("l1tGTAlgoBlockProducer"), maxLines = cms.uint32(1024), channels = channels ) +process.BoardDataObjects = cms.EDAnalyzer("L1GTOutputObjectWriter", + GCTNonIsoEg = cms.InputTag("l1tGTProducer", "GCTNonIsoEg"), + GCTIsoEg = cms.InputTag("l1tGTProducer", "GCTIsoEg"), + GCTJets = cms.InputTag("l1tGTProducer", "GCTJets"), + GCTTaus = cms.InputTag("l1tGTProducer", "GCTTaus"), + GCTHtSum = cms.InputTag("l1tGTProducer", "GCTHtSum"), + GCTEtSum = cms.InputTag("l1tGTProducer", "GCTEtSum"), + GMTSaPromptMuons = cms.InputTag("l1tGTProducer", "GMTSaPromptMuons"), + GMTSaDisplacedMuons = cms.InputTag("l1tGTProducer", "GMTSaDisplacedMuons"), + GMTTkMuons = cms.InputTag("l1tGTProducer", "GMTTkMuons"), + GMTTopo = cms.InputTag("l1tGTProducer", "GMTTopo"), + GTTPromptJets = cms.InputTag("l1tGTProducer", "GTTPromptJets"), + GTTDisplacedJets = cms.InputTag("l1tGTProducer", "GTTDisplacedJets"), + GTTPhiCandidates = cms.InputTag("l1tGTProducer", "GTTPhiCandidates"), + GTTRhoCandidates = cms.InputTag("l1tGTProducer", "GTTRhoCandidates"), + GTTBsCandidates = cms.InputTag("l1tGTProducer", "GTTBsCandidates"), + GTTHadronicTaus = cms.InputTag("l1tGTProducer", "GTTHadronicTaus"), + GTTPrimaryVert = cms.InputTag("l1tGTProducer", "GTTPrimaryVert"), + GTTPromptHtSum = cms.InputTag("l1tGTProducer", "GTTPromptHtSum"), + GTTDisplacedHtSum = cms.InputTag("l1tGTProducer", "GTTDisplacedHtSum"), + GTTEtSum = cms.InputTag("l1tGTProducer", "GTTEtSum"), + CL2JetsSC4 = cms.InputTag("l1tGTProducer", "CL2JetsSC4"), + CL2JetsSC8 = cms.InputTag("l1tGTProducer", "CL2JetsSC8"), + CL2Taus = cms.InputTag("l1tGTProducer", "CL2Taus"), + CL2Electrons = cms.InputTag("l1tGTProducer", "CL2Electrons"), + CL2Photons = cms.InputTag("l1tGTProducer", "CL2Photons"), + CL2HtSum = cms.InputTag("l1tGTProducer", "CL2HtSum"), + CL2EtSum = cms.InputTag("l1tGTProducer", "CL2EtSum"), + outputFilename = cms.string("outputObjectsPattern"), + maxLines = cms.uint32(1024) +) + +process.FinOrBoardData = cms.EDAnalyzer("L1GTFinOrBoardWriter", + outputFilename = cms.string("outputFinOrPattern"), + algoBlocksTag = cms.InputTag("l1tGTAlgoBlockProducer"), + maxLines = cms.uint32(1024), + channelsLow = cms.vuint32(4, 5, 6), + channelsMid = cms.vuint32(40, 41, 42), + channelsHigh = cms.vuint32(52, 53, 54), + channelFinOr = cms.uint32(99) +) + process.l1t_BoardData = cms.EndPath(process.BoardData) +process.l1t_BoardDataObjects = cms.EndPath(process.BoardDataObjects) +process.l1t_FinOrBoardData = cms.EndPath(process.FinOrBoardData) process.output = cms.OutputModule("PoolOutputModule", fileName = cms.untracked.string('file:test_output.root'), diff --git a/L1Trigger/Phase2L1GT/test/menu_analyzer.py b/L1Trigger/Phase2L1GT/test/menu_analyzer.py index 95ee25e84e5f0..d48e809974d9f 100755 --- a/L1Trigger/Phase2L1GT/test/menu_analyzer.py +++ b/L1Trigger/Phase2L1GT/test/menu_analyzer.py @@ -30,7 +30,8 @@ def object_name(object_type): case l1t::P2GTCandidate::GTTPromptHtSum: return "GTTPromptHtSum"; case l1t::P2GTCandidate::GTTDisplacedHtSum: return "GTTDisplacedHtSum"; case l1t::P2GTCandidate::GTTEtSum: return "GTTEtSum"; - case l1t::P2GTCandidate::CL2Jets: return "CL2Jet"; + case l1t::P2GTCandidate::CL2JetsSC4: return "CL2JetSc4"; + case l1t::P2GTCandidate::CL2JetsSC8: return "CL2JetSc8"; case l1t::P2GTCandidate::CL2Taus: return "CL2Tau"; case l1t::P2GTCandidate::CL2Electrons: return "CL2Electron"; case l1t::P2GTCandidate::CL2Photons: return "CL2Photon"; @@ -61,18 +62,18 @@ def object_name(object_type): for idx, event in enumerate(events): print('Event:', idx) - algo_blocks = Handle('l1t::P2GTAlgoBlockCollection') + algo_blocks = Handle('l1t::P2GTAlgoBlockMap') event.getByLabel('l1tGTAlgoBlockProducer', '', args.process, algo_blocks) - for algo_blk in algo_blocks.product(): - print(algo_blk.algoName(), algo_blk.decisionBeforeBxMaskAndPrescale()) + for name, algo_blk in algo_blocks.product(): + print(name, algo_blk.decisionBeforeBxMaskAndPrescale()) for obj in algo_blk.trigObjects(): if object_name(obj.objectType()) in ["CL2Electron", "CL2Photon"]: print(" {}: pt {:3.1f} eta {:3.2f} phi {:3.2f} iso: {:3.2f} relIso: {:3.2f}".format( object_name(obj.objectType()), obj.pt(), obj.eta(), obj.phi(), - obj.hwIso() * scale_parameter.isolation_lsb.value(), - obj.hwIso() * scale_parameter.isolation_lsb.value()/(obj.hwPT() * scale_parameter.pT_lsb.value()))) + obj.hwIso() * scale_parameter.isolationPT_lsb.value(), + obj.hwIso() * scale_parameter.isolationPT_lsb.value()/(obj.hwPT() * scale_parameter.pT_lsb.value()))) elif "Sum" not in object_name(obj.objectType()): print(" {}: pt {:3.1f} eta {:3.2f} phi {:3.2f}".format( object_name(obj.objectType()), obj.pt(), obj.eta(), obj.phi())) diff --git a/L1Trigger/Phase2L1GT/test/test_GT.py b/L1Trigger/Phase2L1GT/test/test_GT.py index 7d6570d2b0edb..9bb06490f63ad 100644 --- a/L1Trigger/Phase2L1GT/test/test_GT.py +++ b/L1Trigger/Phase2L1GT/test/test_GT.py @@ -44,7 +44,6 @@ process.options = cms.untracked.PSet( IgnoreCompletely = cms.untracked.vstring(), Rethrow = cms.untracked.vstring(), - TryToContinue = cms.untracked.vstring(), accelerators = cms.untracked.vstring('*'), allowUnscheduled = cms.obsolete.untracked.bool, canDeleteEarly = cms.untracked.vstring(), diff --git a/PhysicsTools/NanoAOD/plugins/BuildFile.xml b/PhysicsTools/NanoAOD/plugins/BuildFile.xml index 2d06b9ec6bfd6..7016b9380926c 100644 --- a/PhysicsTools/NanoAOD/plugins/BuildFile.xml +++ b/PhysicsTools/NanoAOD/plugins/BuildFile.xml @@ -17,6 +17,7 @@ + diff --git a/PhysicsTools/NanoAOD/plugins/P2GTTriggerResultsConverter.cc b/PhysicsTools/NanoAOD/plugins/P2GTTriggerResultsConverter.cc new file mode 100644 index 0000000000000..15645adadbaa8 --- /dev/null +++ b/PhysicsTools/NanoAOD/plugins/P2GTTriggerResultsConverter.cc @@ -0,0 +1,91 @@ +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/allowedValues.h" + +#include "FWCore/Common/interface/TriggerNames.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/Common/interface/HLTGlobalStatus.h" +#include "DataFormats/Common/interface/HLTPathStatus.h" + +#include "DataFormats/L1Trigger/interface/P2GTAlgoBlock.h" + +#include + +using namespace l1t; + +class P2GTTriggerResultsConverter : public edm::stream::EDProducer<> { +public: + explicit P2GTTriggerResultsConverter(const edm::ParameterSet&); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + enum DecisionType { beforeBxMaskAndPrescale, beforePrescale, final }; + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + void beginRun(const edm::Run&, const edm::EventSetup&) override; + + const edm::EDGetTokenT algoBlockToken_; + const std::string prefix_; + const std::string decisionName_; + const DecisionType decisionEnum_; + + std::vector algoNames_; +}; + +P2GTTriggerResultsConverter::P2GTTriggerResultsConverter(const edm::ParameterSet& params) + : algoBlockToken_(consumes(params.getParameter("src"))), + prefix_(params.getParameter("prefix")), + decisionName_(params.getParameter("decision")), + decisionEnum_(decisionName_ == "beforeBxMaskAndPrescale" ? beforeBxMaskAndPrescale + : decisionName_ == "beforePrescale" ? beforePrescale + : final) { + produces(); +} + +void P2GTTriggerResultsConverter::beginRun(const edm::Run&, const edm::EventSetup&) { algoNames_.clear(); } + +void P2GTTriggerResultsConverter::produce(edm::Event& event, const edm::EventSetup&) { + const P2GTAlgoBlockMap& algoBlockMap = event.get(algoBlockToken_); + + edm::HLTGlobalStatus gtDecisions(algoBlockMap.size()); + + bool fillAlgoNames = false; + + if (algoNames_.size() == 0) { + algoNames_ = std::vector(algoBlockMap.size()); + fillAlgoNames = true; + } + + std::size_t algoIdx = 0; + for (const auto& [algoName, algoBlock] : algoBlockMap) { + bool decision = decisionEnum_ == beforeBxMaskAndPrescale ? algoBlock.decisionBeforeBxMaskAndPrescale() + : decisionEnum_ == beforePrescale ? algoBlock.decisionBeforePrescale() + : algoBlock.decisionFinal(); + + gtDecisions[algoIdx] = edm::HLTPathStatus(decision ? edm::hlt::Pass : edm::hlt::Fail); + if (fillAlgoNames) { + algoNames_[algoIdx] = prefix_ + algoName + "_" + decisionName_; + } + algoIdx++; + } + + event.put(std::make_unique(gtDecisions, algoNames_)); +} + +void P2GTTriggerResultsConverter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("src"); + desc.add("prefix", "L1_"); + desc.ifValue(edm::ParameterDescription("decision", "final", true), + edm::allowedValues("beforeBxMaskAndPrescale", "beforePrescale", "final")); + descriptions.addWithDefaultLabel(desc); +} + +DEFINE_FWK_MODULE(P2GTTriggerResultsConverter);