From 2789f67c2b8adda5334ffd352f7e767e65977aa4 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Fri, 8 Oct 2021 13:56:26 -0500 Subject: [PATCH 01/18] uGT emulator for hadronic shower triggers --- .../L1TGlobal/interface/GlobalObject.h | 1 + DataFormats/L1TGlobal/src/GlobalObject.cc | 5 + .../L1TMuon/interface/RegionalMuonShower.h | 10 +- DataFormats/L1TMuon/src/RegionalMuonShower.cc | 22 +- DataFormats/L1TMuon/src/classes_def.xml | 3 +- DataFormats/L1Trigger/interface/MuonShower.h | 56 ++++-- DataFormats/L1Trigger/src/MuonShower.cc | 24 ++- DataFormats/L1Trigger/src/classes_def.xml | 3 +- L1Trigger/L1TGlobal/interface/GlobalBoard.h | 13 ++ .../L1TGlobal/interface/GlobalDefinitions.h | 3 +- .../L1TGlobal/interface/MuonShowerCondition.h | 81 ++++++++ .../L1TGlobal/interface/MuonShowerTemplate.h | 74 +++++++ L1Trigger/L1TGlobal/interface/TriggerMenu.h | 10 + .../plugins/BXVectorInputProducer.cc | 54 +++++ .../L1TGlobal/plugins/L1TGlobalProducer.cc | 41 +++- .../L1TGlobal/plugins/L1TGlobalProducer.h | 6 + .../L1TGlobal/plugins/TriggerMenuParser.cc | 101 +++++++++- .../L1TGlobal/plugins/TriggerMenuParser.h | 17 +- .../L1TGlobal/python/simGtStage2Digis_cfi.py | 44 ++-- .../L1TGlobal/src/AlgorithmEvaluation.cc | 12 +- L1Trigger/L1TGlobal/src/GlobalBoard.cc | 86 +++++++- L1Trigger/L1TGlobal/src/GlobalCondition.cc | 11 + .../L1TGlobal/src/MuonShowerCondition.cc | 188 ++++++++++++++++++ L1Trigger/L1TGlobal/src/MuonShowerTemplate.cc | 81 ++++++++ L1Trigger/L1TGlobal/src/TriggerMenu.cc | 24 +++ L1Trigger/L1TGlobal/src/classes.h | 1 + L1Trigger/L1TGlobal/src/classes_def.xml | 12 +- .../L1TMuon/plugins/L1TMuonShowerProducer.cc | 14 +- .../interface/SectorProcessorShower.h | 5 + .../plugins/L1TMuonEndCapShowerProducer.cc | 2 + .../src/SectorProcessorShower.cc | 17 +- 31 files changed, 935 insertions(+), 86 deletions(-) create mode 100644 L1Trigger/L1TGlobal/interface/MuonShowerCondition.h create mode 100644 L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h create mode 100644 L1Trigger/L1TGlobal/src/MuonShowerCondition.cc create mode 100644 L1Trigger/L1TGlobal/src/MuonShowerTemplate.cc diff --git a/DataFormats/L1TGlobal/interface/GlobalObject.h b/DataFormats/L1TGlobal/interface/GlobalObject.h index 8156c367ffbbd..7a930329ad066 100644 --- a/DataFormats/L1TGlobal/interface/GlobalObject.h +++ b/DataFormats/L1TGlobal/interface/GlobalObject.h @@ -15,6 +15,7 @@ namespace l1t { /// ObjNull catch all errors enum GlobalObject { gtMu, + gtMuShower, gtEG, gtJet, gtTau, diff --git a/DataFormats/L1TGlobal/src/GlobalObject.cc b/DataFormats/L1TGlobal/src/GlobalObject.cc index 0d1803c353b60..00341eaf49746 100644 --- a/DataFormats/L1TGlobal/src/GlobalObject.cc +++ b/DataFormats/L1TGlobal/src/GlobalObject.cc @@ -25,6 +25,7 @@ using namespace l1t; l1t::GlobalObject l1TGtObjectStringToEnum(const std::string& label) { static const l1t::L1TGtObjectStringToEnum l1TGtObjectStringToEnumMap[] = {{"Mu", gtMu}, + {"MuShower", gtMuShower}, {"EG", gtEG}, {"Tau", gtTau}, {"Jet", gtJet}, @@ -87,6 +88,10 @@ std::string l1t::l1TGtObjectEnumToString(const GlobalObject& gtObject) { gtObjectString = "Mu"; } break; + case gtMuShower: { + gtObjectString = "MuShower"; + } break; + case gtEG: { gtObjectString = "EG"; } break; diff --git a/DataFormats/L1TMuon/interface/RegionalMuonShower.h b/DataFormats/L1TMuon/interface/RegionalMuonShower.h index a81ccd95e5057..27902212332bc 100644 --- a/DataFormats/L1TMuon/interface/RegionalMuonShower.h +++ b/DataFormats/L1TMuon/interface/RegionalMuonShower.h @@ -18,12 +18,16 @@ namespace l1t { RegionalMuonShower(bool oneNominalInTime = false, bool oneNominalOutOfTime = false, bool twoLooseInTime = false, - bool twoLooseOutOfTime = false); + bool twoLooseOutOfTime = false, + bool twoTightInTime = false, + bool twoTightOutOfTime = false); ~RegionalMuonShower(); void setOneNominalInTime(const bool bit) { isOneNominalInTime_ = bit; } void setOneNominalOutOfTime(const bool bit) { isOneNominalOutOfTime_ = bit; } + void setOneTightInTime(const bool bit) { isOneTightInTime_ = bit; } + void setOneTightOutOfTime(const bool bit) { isOneTightOutOfTime_ = bit; } void setTwoLooseOutOfTime(const bool bit) { isTwoLooseOutOfTime_ = bit; } void setTwoLooseInTime(const bool bit) { isTwoLooseInTime_ = bit; } @@ -34,6 +38,8 @@ namespace l1t { bool isValid() const; bool isOneNominalInTime() const { return isOneNominalInTime_; } bool isOneNominalOutOfTime() const { return isOneNominalOutOfTime_; } + bool isOneTightInTime() const { return isOneTightInTime_; } + bool isOneTightOutOfTime() const { return isOneTightOutOfTime_; } bool isTwoLooseInTime() const { return isTwoLooseInTime_; } bool isTwoLooseOutOfTime() const { return isTwoLooseOutOfTime_; } @@ -50,6 +56,8 @@ namespace l1t { // in time and out-of-time qualities. only 2 bits each. bool isOneNominalInTime_; bool isOneNominalOutOfTime_; + bool isOneTightInTime_; + bool isOneTightOutOfTime_; bool isTwoLooseInTime_; bool isTwoLooseOutOfTime_; int endcap_; // +/-1. For ME+ and ME-. diff --git a/DataFormats/L1TMuon/src/RegionalMuonShower.cc b/DataFormats/L1TMuon/src/RegionalMuonShower.cc index fb03609dac59c..70d16abd71821 100644 --- a/DataFormats/L1TMuon/src/RegionalMuonShower.cc +++ b/DataFormats/L1TMuon/src/RegionalMuonShower.cc @@ -3,11 +3,16 @@ l1t::RegionalMuonShower::RegionalMuonShower(bool oneNominalInTime, bool oneNominalOutOfTime, bool twoLooseInTime, - bool twoLooseOutOfTime) + bool twoLooseOutOfTime, + bool oneTightInTime, + bool oneTightOutOfTime + ) : isOneNominalInTime_(oneNominalInTime), isOneNominalOutOfTime_(oneNominalOutOfTime), - isTwoLooseInTime_(twoLooseInTime), - isTwoLooseOutOfTime_(twoLooseOutOfTime), + isOneTightInTime_(oneTightInTime), + isOneTightOutOfTime_(oneTightOutOfTime), + isTwoLooseInTime_(twoLooseInTime), + isTwoLooseOutOfTime_(twoLooseOutOfTime), endcap_(0), sector_(0), link_(0) {} @@ -15,10 +20,15 @@ l1t::RegionalMuonShower::RegionalMuonShower(bool oneNominalInTime, l1t::RegionalMuonShower::~RegionalMuonShower() {} bool l1t::RegionalMuonShower::isValid() const { - return isOneNominalInTime_ or isTwoLooseInTime_ or isOneNominalOutOfTime_ or isTwoLooseOutOfTime_; + return (isOneNominalInTime_ or isTwoLooseInTime_ or isOneTightInTime_ + or isOneNominalOutOfTime_ or isTwoLooseOutOfTime_ or isOneTightOutOfTime_); } bool l1t::RegionalMuonShower::operator==(const l1t::RegionalMuonShower& rhs) const { - return (isTwoLooseInTime_ == rhs.isTwoLooseInTime() and isOneNominalInTime_ == rhs.isOneNominalInTime() and - isTwoLooseOutOfTime_ == rhs.isTwoLooseOutOfTime() and isOneNominalOutOfTime_ == rhs.isOneNominalOutOfTime()); + return (isTwoLooseInTime_ == rhs.isTwoLooseInTime() and + isOneNominalInTime_ == rhs.isOneNominalInTime() and + isOneNominalInTime_ == rhs.isOneNominalInTime() and + isTwoLooseOutOfTime_ == rhs.isTwoLooseOutOfTime() and + isOneTightOutOfTime_ == rhs.isOneTightOutOfTime() and + isOneTightOutOfTime_ == rhs.isOneTightOutOfTime()); } diff --git a/DataFormats/L1TMuon/src/classes_def.xml b/DataFormats/L1TMuon/src/classes_def.xml index 5f8365cead888..d045b4388ab55 100644 --- a/DataFormats/L1TMuon/src/classes_def.xml +++ b/DataFormats/L1TMuon/src/classes_def.xml @@ -13,7 +13,8 @@ - + + diff --git a/DataFormats/L1Trigger/interface/MuonShower.h b/DataFormats/L1Trigger/interface/MuonShower.h index a5684377f224d..e22507330d76b 100644 --- a/DataFormats/L1Trigger/interface/MuonShower.h +++ b/DataFormats/L1Trigger/interface/MuonShower.h @@ -30,20 +30,50 @@ namespace l1t { MuonShower(bool oneNominalInTime = false, bool oneNominalOutOfTime = false, bool twoLooseInTime = false, - bool twoLooseOutOfTime = false); + bool twoLooseOutOfTime = false, + bool oneTightInTime = false, + bool oneTightOutOfTime = false); ~MuonShower() override; - void setOneNominalInTime(const bool bit) { isOneNominalInTime_ = bit; } - void setOneNominalOutOfTime(const bool bit) { isOneNominalOutOfTime_ = bit; } - void setTwoLooseInTime(const bool bit) { isTwoLooseInTime_ = bit; } - void setTwoLooseOutOfTime(const bool bit) { isTwoLooseOutOfTime_ = bit; } + /* + In CMSSW we consider 3 valid cases: + - 1 nominal shower (baseline trigger for physics at Run-3) + - 2 loose showers (to extend the physics reach) + - 1 tight shower (backup trigger) + In the uGT and UTM library, the hadronic shower trigger data is split + over 4 bits: 2 for in-time trigger data, 2 for out-of-time trigger data + - mus0, mus1 for in-time + - musOutOfTime0, musOutOfTime1 for out-of-time + + The mapping for Run-3 is as follows: + - 1 nominal shower -> 0b01 + - 2 loose showers -> 0b10 + - 1 tight shower -> 0b11 + This is done separately for the in-time and out-of-time trigger data + */ + + void setMus0(const bool bit) {mus0_ = bit;} + void setMus1(const bool bit) {mus1_ = bit;} + void setMusOutOfTime0(const bool bit) {musOutOfTime0_ = bit;} + void setMusOutOfTime1(const bool bit) {musOutOfTime1_ = bit;} + + bool mus0() const {return mus0_;} + bool mus1() const {return mus1_;} + bool musOutOfTime0() const {return musOutOfTime0_;} + bool musOutOfTime1() const {return musOutOfTime1_;} + + // at least one bit must be valid bool isValid() const; - bool isOneNominalInTime() const { return isOneNominalInTime_; } - bool isOneNominalOutOfTime() const { return isOneNominalOutOfTime_; } - bool isTwoLooseInTime() const { return isTwoLooseInTime_; } - bool isTwoLooseOutOfTime() const { return isTwoLooseOutOfTime_; } + + // useful members for trigger performance studies + bool isOneNominalInTime() const {return mus0_;} + bool isOneNominalOutOfTime() const {return musOutOfTime0_;} + bool isTwoLooseInTime() const {return mus1_;} + bool isTwoLooseOutOfTime() const {return musOutOfTime1_;} + bool isOneTightInTime() const {return mus0_ and mus1_;} + bool isOneTightOutOfTime() const {return musOutOfTime0_ and musOutOfTime1_;} virtual bool operator==(const l1t::MuonShower& rhs) const; virtual inline bool operator!=(const l1t::MuonShower& rhs) const { return !(operator==(rhs)); }; @@ -51,10 +81,10 @@ namespace l1t { private: // Run-3 definitions as provided in DN-20-033 // in time and out-of-time qualities. only 2 bits each. - bool isOneNominalInTime_; - bool isOneNominalOutOfTime_; - bool isTwoLooseInTime_; - bool isTwoLooseOutOfTime_; + bool mus0_; + bool mus1_; + bool musOutOfTime0_; + bool musOutOfTime1_; }; } // namespace l1t diff --git a/DataFormats/L1Trigger/src/MuonShower.cc b/DataFormats/L1Trigger/src/MuonShower.cc index dec1dc893a54e..47661fddb536b 100644 --- a/DataFormats/L1Trigger/src/MuonShower.cc +++ b/DataFormats/L1Trigger/src/MuonShower.cc @@ -1,19 +1,25 @@ #include "DataFormats/L1Trigger/interface/MuonShower.h" -l1t::MuonShower::MuonShower(bool oneNominalInTime, bool oneNominalOutOfTime, bool twoLooseInTime, bool twoLooseOutOfTime) - : L1Candidate(math::PtEtaPhiMLorentzVector{0., 0., 0., 0.}, 0., 0., 0., 0, 0), - isOneNominalInTime_(oneNominalInTime), - isOneNominalOutOfTime_(oneNominalOutOfTime), - isTwoLooseInTime_(twoLooseInTime), - isTwoLooseOutOfTime_(twoLooseOutOfTime) {} +l1t::MuonShower::MuonShower(bool oneNominalInTime, bool oneNominalOutOfTime, bool twoLooseInTime, bool twoLooseOutOfTime, bool oneTightInTime, bool oneTightOutOfTime) + : L1Candidate(math::PtEtaPhiMLorentzVector{0., 0., 0., 0.}, 0., 0., 0., 0, 0), + // in this object it makes more sense to the different shower types to + // the 4 bits, so that the object easily interfaces with the uGT emulator + mus0_(oneNominalInTime or oneTightInTime), + mus1_(twoLooseInTime or oneTightInTime), + musOutOfTime0_(oneNominalOutOfTime or oneTightOutOfTime), + musOutOfTime1_(twoLooseOutOfTime or oneTightOutOfTime) +{ +} l1t::MuonShower::~MuonShower() {} bool l1t::MuonShower::isValid() const { - return isOneNominalInTime_ or isTwoLooseInTime_ or isOneNominalOutOfTime_ or isTwoLooseOutOfTime_; + return mus0_ or mus1_ or musOutOfTime0_ or musOutOfTime1_; } bool l1t::MuonShower::operator==(const l1t::MuonShower& rhs) const { - return (isTwoLooseInTime_ == rhs.isTwoLooseInTime() and isOneNominalInTime_ == rhs.isOneNominalInTime() and - isTwoLooseOutOfTime_ == rhs.isTwoLooseOutOfTime() and isOneNominalOutOfTime_ == rhs.isOneNominalOutOfTime()); + return (mus0_ == rhs.mus0() and + mus1_ == rhs.mus1() and + musOutOfTime0_ == rhs.musOutOfTime0() and + musOutOfTime1_ == rhs.musOutOfTime1()); } diff --git a/DataFormats/L1Trigger/src/classes_def.xml b/DataFormats/L1Trigger/src/classes_def.xml index 0bd493b85b81b..b639135a3e1f6 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -103,7 +103,8 @@ - + + diff --git a/L1Trigger/L1TGlobal/interface/GlobalBoard.h b/L1Trigger/L1TGlobal/interface/GlobalBoard.h index 90d2089ee5774..cd49c041f3f59 100644 --- a/L1Trigger/L1TGlobal/interface/GlobalBoard.h +++ b/L1Trigger/L1TGlobal/interface/GlobalBoard.h @@ -25,6 +25,7 @@ // Trigger Objects #include "DataFormats/L1Trigger/interface/EGamma.h" #include "DataFormats/L1Trigger/interface/Muon.h" +#include "DataFormats/L1Trigger/interface/MuonShower.h" #include "DataFormats/L1Trigger/interface/Tau.h" #include "DataFormats/L1Trigger/interface/Jet.h" #include "DataFormats/L1Trigger/interface/EtSum.h" @@ -77,11 +78,17 @@ namespace l1t { const bool receiveMu, const int nrL1Mu); + void receiveMuonShowerObjectData(edm::Event&, + const edm::EDGetTokenT>&, + const bool receiveMuShower, + const int nrL1MuShower); + void receiveExternalData(edm::Event&, const edm::EDGetTokenT>&, const bool receiveExt); /// initialize the class (mainly reserve) void init(const int numberPhysTriggers, const int nrL1Mu, + const int nrL1MuShower, const int nrL1EG, const int nrL1Tau, const int nrL1Jet, @@ -97,6 +104,7 @@ namespace l1t { std::unique_ptr& gtObjectMapRecord, //GTO const unsigned int numberPhysTriggers, const int nrL1Mu, + const int nrL1MuShower, const int nrL1EG, const int nrL1Tau, const int nrL1Jet); @@ -122,6 +130,7 @@ namespace l1t { /// clear uGT void reset(); void resetMu(); + void resetMuonShower(); void resetCalo(); void resetExternal(); @@ -137,6 +146,9 @@ namespace l1t { /// return global muon trigger candidate inline const BXVector* getCandL1Mu() const { return m_candL1Mu; } + /// return global muon trigger candidate + inline const BXVector* getCandL1MuShower() const { return m_candL1MuShower; } + /// pointer to EG data list inline const BXVector* getCandL1EG() const { return m_candL1EG; } @@ -203,6 +215,7 @@ namespace l1t { private: BXVector* m_candL1Mu; + BXVector* m_candL1MuShower; BXVector* m_candL1EG; BXVector* m_candL1Tau; BXVector* m_candL1Jet; diff --git a/L1Trigger/L1TGlobal/interface/GlobalDefinitions.h b/L1Trigger/L1TGlobal/interface/GlobalDefinitions.h index 16b13af902d7b..fd6323da6408f 100644 --- a/L1Trigger/L1TGlobal/interface/GlobalDefinitions.h +++ b/L1Trigger/L1TGlobal/interface/GlobalDefinitions.h @@ -98,7 +98,8 @@ namespace l1t { CondCorrelation, CondExternal, CondCorrelationWithOverlapRemoval, - CondCorrelationThreeBody + CondCorrelationThreeBody, + CondMuonShower, }; struct GtConditionCategoryStringToEnum { diff --git a/L1Trigger/L1TGlobal/interface/MuonShowerCondition.h b/L1Trigger/L1TGlobal/interface/MuonShowerCondition.h new file mode 100644 index 0000000000000..03a2f232de338 --- /dev/null +++ b/L1Trigger/L1TGlobal/interface/MuonShowerCondition.h @@ -0,0 +1,81 @@ +#ifndef L1Trigger_L1TGlobal_MuonShowerCondition_h +#define L1Trigger_L1TGlobal_MuonShowerCondition_h + +/** + * \class MuonShowerCondition + * + * Description: evaluation of a CondMuonShower condition. + */ + +// system include files +#include +#include + +// user include files +// base classes +#include "L1Trigger/L1TGlobal/interface/ConditionEvaluation.h" + +#include "DataFormats/L1Trigger/interface/MuonShower.h" + +// forward declarations +class GlobalCondition; +class MuonShowerTemplate; + +namespace l1t { + + class GlobalBoard; + + // class declaration + class MuonShowerCondition : public ConditionEvaluation { + public: + /// constructors + /// default + MuonShowerCondition(); + + /// from base template condition (from event setup usually) + MuonShowerCondition(const GlobalCondition*, const GlobalBoard*, const int nrL1MuShower); + + // copy constructor + MuonShowerCondition(const MuonShowerCondition&); + + // destructor + ~MuonShowerCondition() override; + + // assign operator + MuonShowerCondition& operator=(const MuonShowerCondition&); + + /// the core function to check if the condition matches + const bool evaluateCondition(const int bxEval) const override; + + /// print condition + void print(std::ostream& myCout) const override; + + /// get / set the pointer to a Condition + inline const MuonShowerTemplate* gtMuonShowerTemplate() const { return m_gtMuonShowerTemplate; } + + void setGtMuonShowerTemplate(const MuonShowerTemplate*); + + /// get / set the pointer to GTL + inline const GlobalBoard* gtGTL() const { return m_gtGTL; } + + void setGtGTL(const GlobalBoard*); + + private: + /// copy function for copy constructor and operator= + void copy(const MuonShowerCondition& cp); + + /// load muon candidates + const l1t::MuonShower* getCandidate(const int bx, const int indexCand) const; + + /// function to check a single object if it matches a condition + const bool checkObjectParameter(const int iCondition, const l1t::MuonShower& cand, const unsigned int index) const; + + /// pointer to a MuonShowerTemplate + const MuonShowerTemplate* m_gtMuonShowerTemplate; + + /// pointer to GTL, to be able to get the trigger objects + const GlobalBoard* m_gtGTL; + }; + +} // namespace l1t +#endif diff --git a/L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h b/L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h new file mode 100644 index 0000000000000..fbaacc6ffa2c7 --- /dev/null +++ b/L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h @@ -0,0 +1,74 @@ +#ifndef L1Trigger_L1TGlobal_MuonShowerTemplate_h +#define L1Trigger_L1TGlobal_MuonShowerTemplate_h + +/** + * \class MuonShowerTemplate + * + * + * Description: L1 Global Trigger muon shower template. + * + * \author: Sven Dildick (Rice University) + * + */ + +// system include files +#include +#include + +// user include files + +// base class +#include "L1Trigger/L1TGlobal/interface/GlobalCondition.h" + +// forward declarations + +// class declaration +class MuonShowerTemplate : public GlobalCondition { +public: + // constructor + MuonShowerTemplate(); + + // constructor + MuonShowerTemplate(const std::string&); + + // constructor + MuonShowerTemplate(const std::string&, const l1t::GtConditionType&); + + // copy constructor + MuonShowerTemplate(const MuonShowerTemplate&); + + // destructor + ~MuonShowerTemplate() override; + + // assign operator + MuonShowerTemplate& operator=(const MuonShowerTemplate&); + + // typedef for a single object template + struct ObjectParameter { + bool MuonShower0; + bool MuonShower1; + bool MuonShowerOutOfTime0; + bool MuonShowerOutOfTime1; + }; + +public: + inline const std::vector* objectParameter() const { return &m_objectParameter; } + + /// set functions + void setConditionParameter(const std::vector& objParameter); + + /// print the condition + void print(std::ostream& myCout) const override; + + /// output stream operator + friend std::ostream& operator<<(std::ostream&, const MuonShowerTemplate&); + +private: + /// copy function for copy constructor and operator= + void copy(const MuonShowerTemplate& cp); + + /// variables containing the parameters + std::vector m_objectParameter; +}; + +#endif diff --git a/L1Trigger/L1TGlobal/interface/TriggerMenu.h b/L1Trigger/L1TGlobal/interface/TriggerMenu.h index 6ab26ec8d79b4..2a02bb0220c6f 100644 --- a/L1Trigger/L1TGlobal/interface/TriggerMenu.h +++ b/L1Trigger/L1TGlobal/interface/TriggerMenu.h @@ -32,6 +32,7 @@ #include "L1Trigger/L1TGlobal/interface/GlobalScales.h" #include "L1Trigger/L1TGlobal/interface/MuonTemplate.h" +#include "L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h" #include "L1Trigger/L1TGlobal/interface/CaloTemplate.h" #include "L1Trigger/L1TGlobal/interface/EnergySumTemplate.h" #include "L1Trigger/L1TGlobal/interface/ExternalTemplate.h" @@ -53,6 +54,7 @@ class TriggerMenu { TriggerMenu(const std::string&, const unsigned int numberConditionChips, const std::vector >&, + const std::vector >&, const std::vector >&, const std::vector >&, const std::vector >&, @@ -109,6 +111,13 @@ class TriggerMenu { void setVecMuonTemplate(const std::vector >&); + // + inline const std::vector >& vecMuonShowerTemplate() const { + return m_vecMuonShowerTemplate; + } + + void setVecMuonShowerTemplate(const std::vector >&); + // inline const std::vector >& vecCaloTemplate() const { return m_vecCaloTemplate; } @@ -218,6 +227,7 @@ class TriggerMenu { /// vectors containing the conditions /// explicit, due to persistency... std::vector > m_vecMuonTemplate; + std::vector > m_vecMuonShowerTemplate; std::vector > m_vecCaloTemplate; std::vector > m_vecEnergySumTemplate; diff --git a/L1Trigger/L1TGlobal/plugins/BXVectorInputProducer.cc b/L1Trigger/L1TGlobal/plugins/BXVectorInputProducer.cc index 231be47fd5c19..b3ae33d16c0ea 100644 --- a/L1Trigger/L1TGlobal/plugins/BXVectorInputProducer.cc +++ b/L1Trigger/L1TGlobal/plugins/BXVectorInputProducer.cc @@ -31,6 +31,7 @@ #include "DataFormats/L1Trigger/interface/EGamma.h" #include "DataFormats/L1Trigger/interface/Muon.h" +#include "DataFormats/L1Trigger/interface/MuonShower.h" #include "DataFormats/L1Trigger/interface/Tau.h" #include "DataFormats/L1Trigger/interface/Jet.h" #include "DataFormats/L1Trigger/interface/EtSum.h" @@ -84,6 +85,7 @@ namespace l1t { int bxLast_; unsigned int maxNumMuCands_; + unsigned int maxNumMuShowerCands_; unsigned int maxNumJetCands_; unsigned int maxNumEGCands_; unsigned int maxNumTauCands_; @@ -101,6 +103,7 @@ namespace l1t { // Tokens for inputs from other parts of the L1 system edm::EDGetToken egToken; edm::EDGetToken muToken; + edm::EDGetToken muShowerToken; edm::EDGetToken tauToken; edm::EDGetToken jetToken; edm::EDGetToken etsumToken; @@ -112,6 +115,11 @@ namespace l1t { std::vector muonVec_bx0; std::vector muonVec_bxp1; + std::vector muonShowerVec_bxm2; + std::vector muonShowerVec_bxm1; + std::vector muonShowerVec_bx0; + std::vector muonShowerVec_bxp1; + std::vector egammaVec_bxm2; std::vector egammaVec_bxm1; std::vector egammaVec_bx0; @@ -139,6 +147,7 @@ namespace l1t { BXVectorInputProducer::BXVectorInputProducer(const ParameterSet& iConfig) { egToken = consumes>(iConfig.getParameter("egInputTag")); muToken = consumes>(iConfig.getParameter("muInputTag")); + muShowerToken = consumes>(iConfig.getParameter("muShowerInputTag")); tauToken = consumes>(iConfig.getParameter("tauInputTag")); jetToken = consumes>(iConfig.getParameter("jetInputTag")); etsumToken = consumes>(iConfig.getParameter("etsumInputTag")); @@ -146,6 +155,7 @@ namespace l1t { // register what you produce produces>(); produces>(); + produces>(); produces>(); produces>(); produces>(); @@ -155,6 +165,7 @@ namespace l1t { bxLast_ = iConfig.getParameter("bxLast"); maxNumMuCands_ = iConfig.getParameter("maxMuCand"); + maxNumMuShowerCands_ = iConfig.getParameter("maxMuShowerCand"); maxNumJetCands_ = iConfig.getParameter("maxJetCand"); maxNumEGCands_ = iConfig.getParameter("maxEGCand"); maxNumTauCands_ = iConfig.getParameter("maxTauCand"); @@ -186,6 +197,7 @@ namespace l1t { // Setup vectors std::vector muonVec; + std::vector muonShowerVec; std::vector egammaVec; std::vector tauVec; std::vector jetVec; @@ -198,6 +210,7 @@ namespace l1t { //outputs std::unique_ptr egammas(new l1t::EGammaBxCollection(0, bxFirst, bxLast)); std::unique_ptr muons(new l1t::MuonBxCollection(0, bxFirst, bxLast)); + std::unique_ptr muonShowers(new l1t::MuonShowerBxCollection(0, bxFirst, bxLast)); std::unique_ptr taus(new l1t::TauBxCollection(0, bxFirst, bxLast)); std::unique_ptr jets(new l1t::JetBxCollection(0, bxFirst, bxLast)); std::unique_ptr etsums(new l1t::EtSumBxCollection(0, bxFirst, bxLast)); @@ -233,6 +246,20 @@ namespace l1t { LogTrace("l1t|Global") << ">>> input Mu collection not found!" << std::endl; } + // Make sure that you can get input Muon Showers + Handle> inputMuonShowers; + if (iEvent.getByToken(muToken, inputMuonShowers)) { + for (std::vector::const_iterator mu = inputMuonShowers->begin(bx); + mu != inputMuonShowers->end(bx); + ++mu) { + if (mu->isValid() && muonShowerVec.size() < maxNumMuCands_) { + muonShowerVec.push_back((*mu)); + } + } + } else { + LogTrace("l1t|Global") << ">>> input Mu collection not found!" << std::endl; + } + // Make sure that you can get input Tau Handle> inputTaus; if (iEvent.getByToken(tauToken, inputTaus)) { @@ -294,6 +321,28 @@ namespace l1t { muonVec.clear(); } + // Fill MuonShowers + for (int iMuShower = 0; iMuShower < int(muonShowerVec_bxm2.size()); iMuShower++) { + muonShowers->push_back(-2, muonShowerVec_bxm2[iMuShower]); + } + for (int iMuShower = 0; iMuShower < int(muonShowerVec_bxm1.size()); iMuShower++) { + muonShowers->push_back(-1, muonShowerVec_bxm1[iMuShower]); + } + for (int iMuShower = 0; iMuShower < int(muonShowerVec_bx0.size()); iMuShower++) { + muonShowers->push_back(0, muonShowerVec_bx0[iMuShower]); + } + for (int iMuShower = 0; iMuShower < int(muonShowerVec_bxp1.size()); iMuShower++) { + muonShowers->push_back(1, muonShowerVec_bxp1[iMuShower]); + } + if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) { + for (int iMuShower = 0; iMuShower < int(muonShowerVec.size()); iMuShower++) { + muonShowers->push_back(2, muonShowerVec[iMuShower]); + } + } else { + // this event is part of empty trailer...clear out data + muonShowerVec.clear(); + } + // Fill Egammas for (int iEG = 0; iEG < int(egammaVec_bxm2.size()); iEG++) { egammas->push_back(-2, egammaVec_bxm2[iEG]); @@ -384,30 +433,35 @@ namespace l1t { iEvent.put(std::move(egammas)); iEvent.put(std::move(muons)); + iEvent.put(std::move(muonShowers)); iEvent.put(std::move(taus)); iEvent.put(std::move(jets)); iEvent.put(std::move(etsums)); // Now shift the bx data by one to prepare for next event. muonVec_bxm2 = muonVec_bxm1; + muonShowerVec_bxm2 = muonShowerVec_bxm1; egammaVec_bxm2 = egammaVec_bxm1; tauVec_bxm2 = tauVec_bxm1; jetVec_bxm2 = jetVec_bxm1; etsumVec_bxm2 = etsumVec_bxm1; muonVec_bxm1 = muonVec_bx0; + muonShowerVec_bxm1 = muonShowerVec_bx0; egammaVec_bxm1 = egammaVec_bx0; tauVec_bxm1 = tauVec_bx0; jetVec_bxm1 = jetVec_bx0; etsumVec_bxm1 = etsumVec_bx0; muonVec_bx0 = muonVec_bxp1; + muonShowerVec_bx0 = muonShowerVec_bxp1; egammaVec_bx0 = egammaVec_bxp1; tauVec_bx0 = tauVec_bxp1; jetVec_bx0 = jetVec_bxp1; etsumVec_bx0 = etsumVec_bxp1; muonVec_bxp1 = muonVec; + muonShowerVec_bxp1 = muonShowerVec; egammaVec_bxp1 = egammaVec; tauVec_bxp1 = tauVec; jetVec_bxp1 = jetVec; diff --git a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc index 34e6a526ea58d..7c1b3c80350b5 100644 --- a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc +++ b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc @@ -39,6 +39,8 @@ void L1TGlobalProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip // These parameters are part of the L1T/HLT interface, avoid changing if possible:: desc.add("MuonInputTag", edm::InputTag("")) ->setComment("InputTag for Global Muon Trigger (required parameter: default value is invalid)"); + desc.add("MuonShowerInputTag", edm::InputTag("")) + ->setComment("InputTag for Global Muon Shower Trigger (required parameter: default value is invalid)"); desc.add("EGammaInputTag", edm::InputTag("")) ->setComment("InputTag for Calo Trigger EGamma (required parameter: default value is invalid)"); desc.add("TauInputTag", edm::InputTag("")) @@ -47,6 +49,7 @@ void L1TGlobalProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip ->setComment("InputTag for Calo Trigger Jet (required parameter: default value is invalid)"); desc.add("EtSumInputTag", edm::InputTag("")) ->setComment("InputTag for Calo Trigger EtSum (required parameter: default value is invalid)"); + desc.add("ExtInputTag", edm::InputTag("")) ->setComment("InputTag for external conditions (not required, but recommend to specify explicitly in config)"); desc.add("AlgoBlkInputTag", edm::InputTag("hltGtStage2Digis")) @@ -63,6 +66,10 @@ void L1TGlobalProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip "true when used by the HLT to produce the object map"); desc.add("AlgorithmTriggersUnmasked", false) ->setComment("not required, but recommend to specify explicitly in config"); + + // switch for muon showers in Run-3 + desc.add("useMuonShowers", false); + // These parameters have well defined default values and are not currently // part of the L1T/HLT interface. They can be cleaned up or updated at will: desc.add("ProduceL1GtDaqRecord", true); @@ -76,13 +83,15 @@ void L1TGlobalProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.addUntracked("PrintL1Menu", false); desc.add("TriggerMenuLuminosity", "startup"); desc.add("PrescaleCSVFile", "prescale_L1TGlobal.csv"); - descriptions.add("L1TGlobalProducer", desc); + + descriptions.add("simGtStage2DigisDef", desc); } // constructors L1TGlobalProducer::L1TGlobalProducer(const edm::ParameterSet& parSet) : m_muInputTag(parSet.getParameter("MuonInputTag")), + m_muShowerInputTag(parSet.getParameter("MuonShowerInputTag")), m_egInputTag(parSet.getParameter("EGammaInputTag")), m_tauInputTag(parSet.getParameter("TauInputTag")), m_jetInputTag(parSet.getParameter("JetInputTag")), @@ -108,12 +117,15 @@ L1TGlobalProducer::L1TGlobalProducer(const edm::ParameterSet& parSet) m_isDebugEnabled(edm::isDebugEnabled()), m_getPrescaleColumnFromData(parSet.getParameter("GetPrescaleColumnFromData")), m_requireMenuToMatchAlgoBlkInput(parSet.getParameter("RequireMenuToMatchAlgoBlkInput")), - m_algoblkInputTag(parSet.getParameter("AlgoBlkInputTag")) { + m_algoblkInputTag(parSet.getParameter("AlgoBlkInputTag")), + m_useMuonShowers(parSet.getParameter("useMuonShowers")) { m_egInputToken = consumes>(m_egInputTag); m_tauInputToken = consumes>(m_tauInputTag); m_jetInputToken = consumes>(m_jetInputTag); m_sumInputToken = consumes>(m_sumInputTag); m_muInputToken = consumes>(m_muInputTag); + if (m_useMuonShowers) + m_muShowerInputToken = consumes>(m_muShowerInputTag); m_extInputToken = consumes>(m_extInputTag); m_l1GtStableParToken = esConsumes(); m_l1GtMenuToken = esConsumes(); @@ -197,6 +209,7 @@ L1TGlobalProducer::L1TGlobalProducer(const edm::ParameterSet& parSet) m_numberDaqPartitions = 0; m_nrL1Mu = 0; + m_nrL1MuShower = 0; m_nrL1EG = 0; m_nrL1Tau = 0; @@ -259,6 +272,12 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet // number of objects of each type m_nrL1Mu = data->numberL1Mu(); + // There should be at most 1 muon shower object per BX + // This object contains information for the in-time + // showers and out-of-time showers + if (m_useMuonShowers) + m_nrL1MuShower = 1; + // EG m_nrL1EG = data->numberL1EG(); @@ -274,8 +293,14 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet int maxL1DataBxInEvent = (m_L1DataBxInEvent + 1) / 2 - 1; // Initialize Board - m_uGtBrd->init( - m_numberPhysTriggers, m_nrL1Mu, m_nrL1EG, m_nrL1Tau, m_nrL1Jet, minL1DataBxInEvent, maxL1DataBxInEvent); + m_uGtBrd->init(m_numberPhysTriggers, + m_nrL1Mu, + m_nrL1MuShower, + m_nrL1EG, + m_nrL1Tau, + m_nrL1Jet, + minL1DataBxInEvent, + maxL1DataBxInEvent); // m_l1GtParCacheID = l1GtParCacheID; @@ -330,6 +355,7 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet m_l1GtMenu = std::make_unique(gtParser.gtTriggerMenuName(), data->numberChips(), gtParser.vecMuonTemplate(), + gtParser.vecMuonShowerTemplate(), gtParser.vecCaloTemplate(), gtParser.vecEnergySumTemplate(), gtParser.vecExternalTemplate(), @@ -377,7 +403,7 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet m_l1GtBMCacheID = l1GtBMCacheID; } - + // TODO need changes in CondFormats to cache the maps const std::vector& boardMaps = m_l1GtBM->gtBoardMaps(); @@ -471,6 +497,7 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet // bool receiveMu = true; + bool receiveMuShower = false; bool receiveEG = true; bool receiveTau = true; bool receiveJet = true; @@ -574,6 +601,9 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet m_uGtBrd->receiveMuonObjectData(iEvent, m_muInputToken, receiveMu, m_nrL1Mu); + if (m_useMuonShowers) + m_uGtBrd->receiveMuonShowerObjectData(iEvent, m_muShowerInputToken, receiveMuShower, m_nrL1MuShower); + m_uGtBrd->receiveExternalData(iEvent, m_extInputToken, receiveExt); // loop over BxInEvent @@ -590,6 +620,7 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet gtObjectMapRecord, m_numberPhysTriggers, m_nrL1Mu, + m_nrL1MuShower, m_nrL1EG, m_nrL1Tau, m_nrL1Jet); diff --git a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h index b8e58777dba81..c8127a1f6b7fd 100644 --- a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h +++ b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h @@ -68,6 +68,7 @@ class L1TGlobalProducer : public edm::stream::EDProducer<> { // number of objects of each type int m_nrL1Mu; + int m_nrL1MuShower; int m_nrL1EG; int m_nrL1Tau; @@ -119,7 +120,9 @@ class L1TGlobalProducer : public edm::stream::EDProducer<> { /// input tag for muon collection from GMT edm::InputTag m_muInputTag; + edm::InputTag m_muShowerInputTag; edm::EDGetTokenT> m_muInputToken; + edm::EDGetTokenT> m_muShowerInputToken; /// input tag for calorimeter collections from GCT edm::InputTag m_egInputTag; @@ -185,6 +188,9 @@ class L1TGlobalProducer : public edm::stream::EDProducer<> { edm::ESGetToken m_l1GtStableParToken; edm::ESGetToken m_l1GtMenuToken; edm::ESGetToken m_l1GtPrescaleVetosToken; + + // switch to load muon showers in the global board + bool m_useMuonShowers; }; #endif /*L1TGlobalProducer_h*/ diff --git a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc index d7a33924800e4..4d0e36fbcb2be 100644 --- a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc +++ b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc @@ -14,9 +14,9 @@ * - correlations with overlap object removal * - displaced muons by R.Cavanaugh * - * \new features: Elisa Fontanesi - * - extended for three-body correlation conditions - * + * \new features: Elisa Fontanesi + * - extended for three-body correlation conditions + * * $Date$ * $Revision$ * @@ -111,6 +111,11 @@ void l1t::TriggerMenuParser::setVecMuonTemplate(const std::vector >& vecMuonShowerTempl) { + m_vecMuonShowerTemplate = vecMuonShowerTempl; +} + void l1t::TriggerMenuParser::setVecCaloTemplate(const std::vector >& vecCaloTempl) { m_vecCaloTemplate = vecCaloTempl; } @@ -202,6 +207,7 @@ void l1t::TriggerMenuParser::parseCondFormats(const L1TUtmTriggerMenu* utmMenu) m_conditionMap.resize(m_numberConditionChips); m_vecMuonTemplate.resize(m_numberConditionChips); + m_vecMuonShowerTemplate.resize(m_numberConditionChips); m_vecCaloTemplate.resize(m_numberConditionChips); m_vecEnergySumTemplate.resize(m_numberConditionChips); m_vecExternalTemplate.resize(m_numberConditionChips); @@ -300,6 +306,12 @@ void l1t::TriggerMenuParser::parseCondFormats(const L1TUtmTriggerMenu* utmMenu) condition.getType() == esConditionType::QuadMuon) { parseMuon(condition, chipNr, false); + } else if (condition.getType() == esConditionType::MuonShower0 || + condition.getType() == esConditionType::MuonShower1 || + condition.getType() == esConditionType::MuonShowerOutOfTime0 || + condition.getType() == esConditionType::MuonShowerOutOfTime1) { + parseMuonShower(condition, chipNr, false); + //parse Correlation Conditions } else if (condition.getType() == esConditionType::MuonMuonCorrelation || condition.getType() == esConditionType::MuonEsumCorrelation || @@ -1519,6 +1531,89 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const tmeventsetup::esObject* corrMu, return true; } +/** + * parseMuonShower Parse a muonShower condition and insert an entry to the conditions map + * + * @param node The corresponding node. + * @param name The name of the condition. + * @param chipNr The number of the chip this condition is located. + * + * @return "true" if succeeded, "false" if an error occurred. + * + */ + +bool l1t::TriggerMenuParser::parseMuonShower(tmeventsetup::esCondition condMu, + unsigned int chipNr, + const bool corrFlag) { + using namespace tmeventsetup; + + // get condition, particle name (must be muon) and type name + std::string condition = "muonShower"; + std::string particle = "muonShower"; //l1t2string( condMu.objectType() ); + std::string type = l1t2string(condMu.getType()); + std::string name = l1t2string(condMu.getName()); + // the number of muon shower objects is always 1 + int nrObj = 1; + + // condition type is always 1 particle, thus Type1s + GtConditionType cType = l1t::Type1s; + + // edm::LogWarning("TriggerMenuParser") << "\n ****************************************** " + // << "\n parseMuonShower " + // << "\n condition = " << condition << "\n particle = " << particle + // << "\n type = " << type << "\n name = " << name << std::endl; + + // temporary storage of the parameters + std::vector objParameter(nrObj); + + if (int(condMu.getObjects().size()) != nrObj) { + edm::LogError("TriggerMenuParser") << " condMu objects: nrObj = " << nrObj + << "condMu.getObjects().size() = " << condMu.getObjects().size() << std::endl; + return false; + } + + // Get the muon shower object + esObject object = condMu.getObjects().at(0); + int relativeBx = object.getBxOffset(); + + if (condMu.getType() == esConditionType::MuonShower0) { + objParameter[0].MuonShower0 = true; + } else if (condMu.getType() == esConditionType::MuonShower1) { + objParameter[0].MuonShower1 = true; + } else if (condMu.getType() == esConditionType::MuonShowerOutOfTime0) { + objParameter[0].MuonShowerOutOfTime0 = true; + } else if (condMu.getType() == esConditionType::MuonShowerOutOfTime1) { + objParameter[0].MuonShowerOutOfTime1 = true; + } + + // object types - all muons + std::vector objType(nrObj, gtMuShower); + + // now create a new CondMuonition + MuonShowerTemplate muonShowerCond(name); + muonShowerCond.setCondType(cType); + muonShowerCond.setObjectType(objType); + muonShowerCond.setCondChipNr(chipNr); + muonShowerCond.setCondRelativeBx(relativeBx); + + muonShowerCond.setConditionParameter(objParameter); + + if (edm::isDebugEnabled()) { + std::ostringstream myCoutStream; + muonShowerCond.print(myCoutStream); + } + + // insert condition into the map and into muon template vector + if (!insertConditionIntoMap(muonShowerCond, chipNr)) { + edm::LogError("TriggerMenuParser") << " Error: duplicate condition (" << name << ")" << std::endl; + return false; + } else { + (m_vecMuonShowerTemplate[chipNr]).push_back(muonShowerCond); + } + + return true; +} + /** * parseCalo Parse a calo condition and insert an entry to the conditions map * diff --git a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h index 85111e1a0f4bd..dffd73347978a 100644 --- a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h +++ b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h @@ -17,9 +17,9 @@ * - correlations with overlap object removal * \author R. Cavanaugh * - displaced muons - * \author Elisa Fontanesi - * - extended for three-body correlation conditions - * + * \author Elisa Fontanesi + * - extended for three-body correlation conditions + * * * $Date$ * $Revision$ @@ -33,6 +33,7 @@ #include "L1Trigger/L1TGlobal/interface/TriggerMenuFwd.h" #include "L1Trigger/L1TGlobal/interface/MuonTemplate.h" +#include "L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h" #include "L1Trigger/L1TGlobal/interface/CaloTemplate.h" #include "L1Trigger/L1TGlobal/interface/EnergySumTemplate.h" #include "L1Trigger/L1TGlobal/interface/CorrelationTemplate.h" @@ -124,6 +125,12 @@ namespace l1t { inline const std::vector >& vecMuonTemplate() const { return m_vecMuonTemplate; } void setVecMuonTemplate(const std::vector >&); + // + inline const std::vector >& vecMuonShowerTemplate() const { + return m_vecMuonShowerTemplate; + } + void setVecMuonShowerTemplate(const std::vector >&); + // inline const std::vector >& vecCaloTemplate() const { return m_vecCaloTemplate; } @@ -266,6 +273,9 @@ namespace l1t { bool parseMuonCorr(const tmeventsetup::esObject* condMu, unsigned int chipNr = 0); + /// parse a muon shower condition + bool parseMuonShower(tmeventsetup::esCondition condMu, unsigned int chipNr = 0, const bool corrFlag = false); + /// parse a calorimeter condition /* bool parseCalo(XERCES_CPP_NAMESPACE::DOMNode* node, */ /* const std::string& name, unsigned int chipNr = 0, */ @@ -383,6 +393,7 @@ namespace l1t { /// vectors containing the conditions /// explicit, due to persistency... std::vector > m_vecMuonTemplate; + std::vector > m_vecMuonShowerTemplate; std::vector > m_vecCaloTemplate; std::vector > m_vecEnergySumTemplate; std::vector > m_vecExternalTemplate; diff --git a/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py b/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py index 19e7f2b8998bd..e5075fc562568 100644 --- a/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py +++ b/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py @@ -4,32 +4,22 @@ # All changes must be explicitly discussed with the L1T offline coordinator. # import FWCore.ParameterSet.Config as cms - -# cfi uGT emulator - -simGtStage2Digis = cms.EDProducer("L1TGlobalProducer", - MuonInputTag = cms.InputTag("simGmtStage2Digis"), - ExtInputTag = cms.InputTag("simGtExtFakeStage2Digis"), - EGammaInputTag = cms.InputTag("simCaloStage2Digis"), - TauInputTag = cms.InputTag("simCaloStage2Digis"), - JetInputTag = cms.InputTag("simCaloStage2Digis"), - EtSumInputTag = cms.InputTag("simCaloStage2Digis"), - AlgorithmTriggersUnmasked = cms.bool(True), - AlgorithmTriggersUnprescaled = cms.bool(True), - GetPrescaleColumnFromData = cms.bool(False), - RequireMenuToMatchAlgoBlkInput = cms.bool(False), - AlgoBlkInputTag = cms.InputTag("gtStage2Digis") - # deprecated in Mike's version of producer: - #ProduceL1GtDaqRecord = cms.bool(True), - #GmtInputTag = cms.InputTag("gtInput"), - #extInputTag = cms.InputTag("gtInput"), - #caloInputTag = cms.InputTag("gtInput"), - #AlternativeNrBxBoardDaq = cms.uint32(0), - #WritePsbL1GtDaqRecord = cms.bool(True), - #TriggerMenuLuminosity = cms.string('startup'), - #PrescaleCSVFile = cms.string('prescale_L1TGlobal.csv'), - #PrescaleSet = cms.uint32(1), - #BstLengthBytes = cms.int32(-1), - #Verbosity = cms.untracked.int32(0) +from L1Trigger.L1TGlobal.simGtStage2DigisDef_cfi import simGtStage2DigisDef +simGtStage2Digis = simGtStage2DigisDef.clone( + MuonInputTag = "simGmtStage2Digis", + MuonShowerInputTag = "simGmtShowerDigis", + EGammaInputTag = "simCaloStage2Digis", + TauInputTag = "simCaloStage2Digis", + JetInputTag = "simCaloStage2Digis", + EtSumInputTag = "simCaloStage2Digis", + ExtInputTag = "simGtExtFakeStage2Digis", + AlgoBlkInputTag = "gtStage2Digis", + AlgorithmTriggersUnmasked = True, + AlgorithmTriggersUnprescaled = True, + GetPrescaleColumnFromData = False, + RequireMenuToMatchAlgoBlkInput = False, ) +from Configuration.Eras.Modifier_run3_common_cff import run3_common +run3_common.toModify(simGtStage2Digis, + useMuonShowers = False) diff --git a/L1Trigger/L1TGlobal/src/AlgorithmEvaluation.cc b/L1Trigger/L1TGlobal/src/AlgorithmEvaluation.cc index 1ce0458b7e7c2..45ff98c719a58 100644 --- a/L1Trigger/L1TGlobal/src/AlgorithmEvaluation.cc +++ b/L1Trigger/L1TGlobal/src/AlgorithmEvaluation.cc @@ -1,14 +1,14 @@ /** * \class AlgorithmEvaluation - * - * + * + * * Description: Evaluation of a L1 Global Trigger algorithm. - * + * * Implementation: * - * - * \author: Vasile Mihai Ghete - HEPHY Vienna - * + * + * \author: Vasile Mihai Ghete - HEPHY Vienna + * * */ diff --git a/L1Trigger/L1TGlobal/src/GlobalBoard.cc b/L1Trigger/L1TGlobal/src/GlobalBoard.cc index eff9a910d533e..4cec9b2178483 100644 --- a/L1Trigger/L1TGlobal/src/GlobalBoard.cc +++ b/L1Trigger/L1TGlobal/src/GlobalBoard.cc @@ -27,6 +27,7 @@ #include "L1Trigger/L1TGlobal/interface/GlobalAlgorithm.h" #include "L1Trigger/L1TGlobal/interface/MuonTemplate.h" +#include "L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h" #include "L1Trigger/L1TGlobal/interface/CaloTemplate.h" #include "L1Trigger/L1TGlobal/interface/EnergySumTemplate.h" #include "L1Trigger/L1TGlobal/interface/ExternalTemplate.h" @@ -42,6 +43,7 @@ // Conditions for uGt #include "L1Trigger/L1TGlobal/interface/MuCondition.h" +#include "L1Trigger/L1TGlobal/interface/MuonShowerCondition.h" #include "L1Trigger/L1TGlobal/interface/CaloCondition.h" #include "L1Trigger/L1TGlobal/interface/EnergySumCondition.h" #include "L1Trigger/L1TGlobal/interface/ExternalCondition.h" @@ -60,6 +62,7 @@ // constructor l1t::GlobalBoard::GlobalBoard() : m_candL1Mu(new BXVector), + m_candL1MuShower(new BXVector), m_candL1EG(new BXVector), m_candL1Tau(new BXVector), m_candL1Jet(new BXVector), @@ -91,6 +94,7 @@ l1t::GlobalBoard::GlobalBoard() l1t::GlobalBoard::~GlobalBoard() { //reset(); //why would we need a reset? delete m_candL1Mu; + delete m_candL1MuShower; delete m_candL1EG; delete m_candL1Tau; delete m_candL1Jet; @@ -107,6 +111,7 @@ void l1t::GlobalBoard::setBxLast(int bx) { m_bxLast_ = bx; } void l1t::GlobalBoard::init(const int numberPhysTriggers, const int nrL1Mu, + const int nrL1MuShower, const int nrL1EG, const int nrL1Tau, const int nrL1Jet, @@ -116,6 +121,7 @@ void l1t::GlobalBoard::init(const int numberPhysTriggers, setBxLast(bxLast); m_candL1Mu->setBXRange(m_bxFirst_, m_bxLast_); + m_candL1MuShower->setBXRange(m_bxFirst_, m_bxLast_); m_candL1EG->setBXRange(m_bxFirst_, m_bxLast_); m_candL1Tau->setBXRange(m_bxFirst_, m_bxLast_); m_candL1Jet->setBXRange(m_bxFirst_, m_bxLast_); @@ -293,19 +299,19 @@ void l1t::GlobalBoard::receiveCaloObjectData(edm::Event& iEvent, //(*m_candETM).push_back(i,&(*etsum)); LogDebug("L1TGlobal") << "ETM: Pt " << etsum->hwPt() << " Phi " << etsum->hwPhi() << std::endl; } - break; + break; case l1t::EtSum::EtSumType::kMissingHt: { //(*m_candHTM).push_back(i,&(*etsum)); LogDebug("L1TGlobal") << "HTM: Pt " << etsum->hwPt() << " Phi " << etsum->hwPhi() << std::endl; } - break; + break; case l1t::EtSum::EtSumType::kTotalEt: { //(*m_candETT).push_back(i,&(*etsum)); LogDebug("L1TGlobal") << "ETT: Pt " << etsum->hwPt() << std::endl; } - break; + break; case l1t::EtSum::EtSumType::kTotalHt: { //(*m_candHTT).push_back(i,&(*etsum)); @@ -384,6 +390,54 @@ void l1t::GlobalBoard::receiveMuonObjectData(edm::Event& iEvent, } //end if ReveiveMuon data } +// receive muon shower data from Global Muon Trigger +void l1t::GlobalBoard::receiveMuonShowerObjectData(edm::Event& iEvent, + const edm::EDGetTokenT>& muShowerInputToken, + const bool receiveMuShower, + const int nrL1MuShower) { + // get data from Global Muon Trigger + if (receiveMuShower) { + edm::Handle> muonData; + iEvent.getByToken(muShowerInputToken, muonData); + + if (!muonData.isValid()) { + if (m_verbosity) { + edm::LogWarning("L1TGlobal") << "\nWarning: BXVector with input tag " + << "\nrequested in configuration, but not found in the event.\n" + << std::endl; + } + } else { + //Loop over Muon Showers in this bx + int nObj = 0; + for (auto mu = muonData->begin(0); mu != muonData->end(0); ++mu) { + if (nObj < nrL1MuShower) { + /* Important here to split up the single object into 4 separate MuonShower + bits for the global board. This is because the UTM library considers those bits separate as well + */ + l1t::MuonShower mus0; + l1t::MuonShower mus1; + l1t::MuonShower musOutOfTime0; + l1t::MuonShower musOutOfTime1; + + mus0.setMus0(mu->mus0()); + mus1.setMus1(mu->mus1()); + musOutOfTime0.setMusOutOfTime0(mu->musOutOfTime0()); + musOutOfTime1.setMusOutOfTime1(mu->musOutOfTime1()); + + (*m_candL1MuShower).push_back(0, &mus0); + (*m_candL1MuShower).push_back(0, &mus1); + (*m_candL1MuShower).push_back(0, &musOutOfTime0); + (*m_candL1MuShower).push_back(0, &musOutOfTime1); + } else { + edm::LogWarning("L1TGlobal") << " Too many Muon Showers (" << nObj + << ") for uGT Configuration maxMuShower =" << nrL1MuShower << std::endl; + } + nObj++; + } //end loop over muon showers in bx + } //end if over valid muon shower data + } //end if ReveiveMuonShower data +} + // receive data from Global External Conditions void l1t::GlobalBoard::receiveExternalData(edm::Event& iEvent, const edm::EDGetTokenT>& extInputToken, @@ -435,6 +489,7 @@ void l1t::GlobalBoard::runGTL(edm::Event& iEvent, std::unique_ptr& gtObjectMapRecord, const unsigned int numberPhysTriggers, const int nrL1Mu, + const int nrL1MuShower, const int nrL1EG, const int nrL1Tau, const int nrL1Jet) { @@ -505,6 +560,24 @@ void l1t::GlobalBoard::runGTL(edm::Event& iEvent, } //delete muCondition; + } break; + case CondMuonShower: { + MuonShowerCondition* muShowerCondition = new MuonShowerCondition(itCond->second, this, nrL1MuShower); + + muShowerCondition->setVerbosity(m_verbosity); + + muShowerCondition->evaluateConditionStoreResult(iBxInEvent); + + cMapResults[itCond->first] = muShowerCondition; + + if (m_verbosity && m_isDebugEnabled) { + std::ostringstream myCout; + muShowerCondition->print(myCout); + + edm::LogWarning("L1TGlobal") << "MuonShowerCondition " << myCout.str() << std::endl; + } + //delete muShowerCondition; + } break; case CondCalo: { // BLW Not sure w hat to do with this for now @@ -1039,6 +1112,7 @@ void l1t::GlobalBoard::fillAlgRecord(int iBxInEvent, // clear GTL void l1t::GlobalBoard::reset() { resetMu(); + resetMuonShower(); resetCalo(); resetExternal(); @@ -1054,6 +1128,12 @@ void l1t::GlobalBoard::resetMu() { m_candL1Mu->setBXRange(m_bxFirst_, m_bxLast_); } +// clear muon shower +void l1t::GlobalBoard::resetMuonShower() { + m_candL1MuShower->clear(); + m_candL1MuShower->setBXRange(m_bxFirst_, m_bxLast_); +} + // clear calo void l1t::GlobalBoard::resetCalo() { m_candL1EG->clear(); diff --git a/L1Trigger/L1TGlobal/src/GlobalCondition.cc b/L1Trigger/L1TGlobal/src/GlobalCondition.cc index 05b28bdde1549..3bb8aa22c58aa 100644 --- a/L1Trigger/L1TGlobal/src/GlobalCondition.cc +++ b/L1Trigger/L1TGlobal/src/GlobalCondition.cc @@ -179,6 +179,12 @@ void GlobalCondition::print(std::ostream& myCout) const { << "l1t::CondMuon" << std::endl; } + break; + case l1t::CondMuonShower: { + myCout << " Condition category: " + << "l1t::CondMuonShower" << std::endl; + } + break; case l1t::CondCalo: { myCout << " Condition category: " @@ -431,6 +437,11 @@ void GlobalCondition::print(std::ostream& myCout) const { myCout << " Mu "; } + break; + case l1t::gtMuShower: { + myCout << " MuShower "; + } + break; case l1t::gtEG: { myCout << " EG "; diff --git a/L1Trigger/L1TGlobal/src/MuonShowerCondition.cc b/L1Trigger/L1TGlobal/src/MuonShowerCondition.cc new file mode 100644 index 0000000000000..a3bf27dc82ad2 --- /dev/null +++ b/L1Trigger/L1TGlobal/src/MuonShowerCondition.cc @@ -0,0 +1,188 @@ +// this class header +#include "L1Trigger/L1TGlobal/interface/MuonShowerCondition.h" + +// system include files +#include +#include + +#include +#include +#include + +// user include files +// base classes +#include "L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h" +#include "L1Trigger/L1TGlobal/interface/ConditionEvaluation.h" + +#include "DataFormats/L1Trigger/interface/MuonShower.h" + +#include "L1Trigger/L1TGlobal/interface/GlobalBoard.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/MessageLogger/interface/MessageDrop.h" + +// constructors +// default +l1t::MuonShowerCondition::MuonShowerCondition() : ConditionEvaluation() { + // empty +} + +// from base template condition (from event setup usually) +l1t::MuonShowerCondition::MuonShowerCondition(const GlobalCondition* muonShowerTemplate, + const GlobalBoard* ptrGTL, + const int nrL1MuShower) + : ConditionEvaluation(), + m_gtMuonShowerTemplate(static_cast(muonShowerTemplate)), + m_gtGTL(ptrGTL) { + m_condMaxNumberObjects = nrL1MuShower; +} + +// copy constructor +void l1t::MuonShowerCondition::copy(const l1t::MuonShowerCondition& cp) { + m_gtMuonShowerTemplate = cp.gtMuonShowerTemplate(); + m_gtGTL = cp.gtGTL(); + + m_condMaxNumberObjects = cp.condMaxNumberObjects(); + m_condLastResult = cp.condLastResult(); + m_combinationsInCond = cp.getCombinationsInCond(); + + m_verbosity = cp.m_verbosity; +} + +l1t::MuonShowerCondition::MuonShowerCondition(const l1t::MuonShowerCondition& cp) : ConditionEvaluation() { copy(cp); } + +// destructor +l1t::MuonShowerCondition::~MuonShowerCondition() { + // empty +} + +// equal operator +l1t::MuonShowerCondition& l1t::MuonShowerCondition::operator=(const l1t::MuonShowerCondition& cp) { + copy(cp); + return *this; +} + +// methods +void l1t::MuonShowerCondition::setGtMuonShowerTemplate(const MuonShowerTemplate* muonTempl) { + m_gtMuonShowerTemplate = muonTempl; +} + +/// set the pointer to GTL +void l1t::MuonShowerCondition::setGtGTL(const GlobalBoard* ptrGTL) { m_gtGTL = ptrGTL; } + +// try all object permutations and check spatial correlations, if required +const bool l1t::MuonShowerCondition::evaluateCondition(const int bxEval) const { + // number of trigger objects in the condition + int nObjInCond = m_gtMuonShowerTemplate->nrObjects(); + + // the candidates + const BXVector* candVec = m_gtGTL->getCandL1MuShower(); + + // Look at objects in bx = bx + relativeBx + int useBx = bxEval + m_gtMuonShowerTemplate->condRelativeBx(); + + // Fail condition if attempting to get Bx outside of range + if ((useBx < candVec->getFirstBX()) || (useBx > candVec->getLastBX())) { + return false; + } + + // store the indices of the shower objects + // from the combination evaluated in the condition + SingleCombInCond objectsInComb; + objectsInComb.reserve(nObjInCond); + + // clear the m_combinationsInCond vector + (combinationsInCond()).clear(); + + // clear the indices in the combination + objectsInComb.clear(); + + // If no candidates, no use looking any further. + int numberObjects = candVec->size(useBx); + if (numberObjects < 1) { + return false; + } + + std::vector index(numberObjects); + + for (int i = 0; i < numberObjects; ++i) { + index[i] = i; + } + + bool condResult = false; + + // index is always zero, as they are global quantities (there is only one object) + int indexObj = 0; + + objectsInComb.push_back(indexObj); + (combinationsInCond()).push_back(objectsInComb); + + // if we get here all checks were successfull for this combination + // set the general result for evaluateCondition to "true" + + condResult = true; + return condResult; +} + +// load muon candidates +const l1t::MuonShower* l1t::MuonShowerCondition::getCandidate(const int bx, const int indexCand) const { + return (m_gtGTL->getCandL1MuShower())->at(bx, indexCand); //BLW Change for BXVector +} + +/** + * checkObjectParameter - Compare a single particle with a numbered condition. + * + * @param iCondition The number of the condition. + * @param cand The candidate to compare. + * + * @return The result of the comparison (false if a condition does not exist). + */ + +const bool l1t::MuonShowerCondition::checkObjectParameter(const int iCondition, + const l1t::MuonShower& cand, + const unsigned int index) const { + // number of objects in condition + int nObjInCond = m_gtMuonShowerTemplate->nrObjects(); + + if (iCondition >= nObjInCond || iCondition < 0) { + return false; + } + + const MuonShowerTemplate::ObjectParameter objPar = (*(m_gtMuonShowerTemplate->objectParameter()))[iCondition]; + + LogDebug("L1TGlobal") << "\n MuonShowerTemplate::ObjectParameter : " << std::hex << "\n\t MuonShower0 = 0x " + << objPar.MuonShower0 << "\n\t MuonShower1 = 0x " << objPar.MuonShower1 + << "\n\t MuonShowerOutOfTime0 = 0x " << objPar.MuonShowerOutOfTime0 + << "\n\t MuonShowerOutOfTime1 = 0x " << objPar.MuonShowerOutOfTime1 << std::endl; + + LogDebug("L1TGlobal") << "\n l1t::MuonShower : " + << "\n\t MuonShower0 = 0x " << cand.mus0() << "\n\t MuonShower1 = 0x " << cand.mus1() + << "\n\t MuonShowerOutOfTime0 = 0x " << cand.musOutOfTime0() + << "\n\t MuonShowerOutOfTime1 = 0x " << cand.musOutOfTime1() << std::dec << std::endl; + + // check oneNominalInTime + if (cand.mus0() != objPar.MuonShower0) { + LogDebug("L1TGlobal") << "\t\t MuonShower failed MuonShower0 requirement" << std::endl; + return false; + } + if (cand.mus1() != objPar.MuonShower1) { + LogDebug("L1TGlobal") << "\t\t MuonShower failed MuonShower1 requirement" << std::endl; + return false; + } + if (cand.musOutOfTime0() != objPar.MuonShowerOutOfTime0) { + LogDebug("L1TGlobal") << "\t\t MuonShower failed MuonShowerOutOfTime0 requirement" << std::endl; + return false; + } + if (cand.musOutOfTime1() != objPar.MuonShowerOutOfTime1) { + LogDebug("L1TGlobal") << "\t\t MuonShower failed MuonShowerOutOfTime1 requirement" << std::endl; + return false; + } + + return true; +} + +void l1t::MuonShowerCondition::print(std::ostream& myCout) const { + m_gtMuonShowerTemplate->print(myCout); + + ConditionEvaluation::print(myCout); +} diff --git a/L1Trigger/L1TGlobal/src/MuonShowerTemplate.cc b/L1Trigger/L1TGlobal/src/MuonShowerTemplate.cc new file mode 100644 index 0000000000000..11c323d81e0ee --- /dev/null +++ b/L1Trigger/L1TGlobal/src/MuonShowerTemplate.cc @@ -0,0 +1,81 @@ +// this class header +#include "L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h" + +// system include files +#include +#include + +MuonShowerTemplate::MuonShowerTemplate() : GlobalCondition() { m_condCategory = l1t::CondMuonShower; } + +MuonShowerTemplate::MuonShowerTemplate(const std::string& cName) : GlobalCondition(cName) { + m_condCategory = l1t::CondMuonShower; +} + +MuonShowerTemplate::MuonShowerTemplate(const std::string& cName, const l1t::GtConditionType& cType) + : GlobalCondition(cName, l1t::CondMuonShower, cType) { + int nObjects = nrObjects(); + + if (nObjects > 0) { + m_objectParameter.reserve(nObjects); + + m_objectType.reserve(nObjects); + m_objectType.assign(nObjects, l1t::gtMuShower); + } +} + +// copy constructor +MuonShowerTemplate::MuonShowerTemplate(const MuonShowerTemplate& cp) : GlobalCondition(cp.m_condName) { copy(cp); } + +// destructor +MuonShowerTemplate::~MuonShowerTemplate() { + // empty now +} + +// assign operator +MuonShowerTemplate& MuonShowerTemplate::operator=(const MuonShowerTemplate& cp) { + copy(cp); + return *this; +} + +// setConditionParameter - set the parameters of the condition +void MuonShowerTemplate::setConditionParameter(const std::vector& objParameter) { + m_objectParameter = objParameter; +} + +void MuonShowerTemplate::print(std::ostream& myCout) const { + myCout << "\n MuonShowerTemplate print..." << std::endl; + + GlobalCondition::print(myCout); + + int nObjects = nrObjects(); + + for (int i = 0; i < nObjects; i++) { + myCout << std::endl; + myCout << " Template for object " << i << " [ hex ]" << std::endl; + myCout << " MuonShower0 = " << std::hex << m_objectParameter[i].MuonShower0 << std::endl; + myCout << " MuonShower1 = " << std::hex << m_objectParameter[i].MuonShower1 << std::endl; + myCout << " MuonShowerOutOfTime0 = " << std::hex << m_objectParameter[i].MuonShowerOutOfTime0 << std::endl; + myCout << " MuonShowerOutOfTime1 = " << std::hex << m_objectParameter[i].MuonShowerOutOfTime1 << std::endl; + } + + // reset to decimal output + myCout << std::dec << std::endl; +} + +void MuonShowerTemplate::copy(const MuonShowerTemplate& cp) { + m_condName = cp.condName(); + m_condCategory = cp.condCategory(); + m_condType = cp.condType(); + m_objectType = cp.objectType(); + m_condGEq = cp.condGEq(); + m_condChipNr = cp.condChipNr(); + m_condRelativeBx = cp.condRelativeBx(); + + m_objectParameter = *(cp.objectParameter()); +} + +// output stream operator +std::ostream& operator<<(std::ostream& os, const MuonShowerTemplate& result) { + result.print(os); + return os; +} diff --git a/L1Trigger/L1TGlobal/src/TriggerMenu.cc b/L1Trigger/L1TGlobal/src/TriggerMenu.cc index 74e6d5ff7eff2..bb2cac90174a6 100644 --- a/L1Trigger/L1TGlobal/src/TriggerMenu.cc +++ b/L1Trigger/L1TGlobal/src/TriggerMenu.cc @@ -41,6 +41,7 @@ TriggerMenu::TriggerMenu( const std::string& triggerMenuNameVal, const unsigned int numberConditionChips, const std::vector >& vecMuonTemplateVal, + const std::vector >& vecMuonShowerTemplateVal, const std::vector >& vecCaloTemplateVal, const std::vector >& vecEnergySumTemplateVal, const std::vector >& vecExternalTemplateVal, @@ -57,6 +58,7 @@ TriggerMenu::TriggerMenu( m_triggerMenuImplementation(0x0), m_scaleDbKey("NULL"), m_vecMuonTemplate(vecMuonTemplateVal), + m_vecMuonShowerTemplate(vecMuonShowerTemplateVal), m_vecCaloTemplate(vecCaloTemplateVal), m_vecEnergySumTemplate(vecEnergySumTemplateVal), m_vecExternalTemplate(vecExternalTemplateVal), @@ -81,6 +83,7 @@ TriggerMenu::TriggerMenu(const TriggerMenu& rhs) { // copy physics conditions m_vecMuonTemplate = rhs.m_vecMuonTemplate; + m_vecMuonShowerTemplate = rhs.m_vecMuonShowerTemplate; m_vecCaloTemplate = rhs.m_vecCaloTemplate; m_vecEnergySumTemplate = rhs.m_vecEnergySumTemplate; m_vecExternalTemplate = rhs.m_vecExternalTemplate; @@ -128,6 +131,7 @@ TriggerMenu& TriggerMenu::operator=(const TriggerMenu& rhs) { m_triggerMenuUUID = rhs.m_triggerMenuUUID; m_vecMuonTemplate = rhs.m_vecMuonTemplate; + m_vecMuonShowerTemplate = rhs.m_vecMuonShowerTemplate; m_vecCaloTemplate = rhs.m_vecCaloTemplate; m_vecEnergySumTemplate = rhs.m_vecEnergySumTemplate; m_vecExternalTemplate = rhs.m_vecExternalTemplate; @@ -189,6 +193,26 @@ void TriggerMenu::buildGtConditionMap() { } } + // + size_t vecMuonShowerSize = m_vecMuonShowerTemplate.size(); + if (condMapSize < vecMuonShowerSize) { + m_conditionMap.resize(vecMuonShowerSize); + condMapSize = m_conditionMap.size(); + } + + chipNr = -1; + + for (std::vector >::iterator itCondOnChip = m_vecMuonShowerTemplate.begin(); + itCondOnChip != m_vecMuonShowerTemplate.end(); + itCondOnChip++) { + chipNr++; + + for (std::vector::iterator itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); + itCond++) { + (m_conditionMap.at(chipNr))[itCond->condName()] = &(*itCond); + } + } + // size_t vecCaloSize = m_vecCaloTemplate.size(); if (condMapSize < vecCaloSize) { diff --git a/L1Trigger/L1TGlobal/src/classes.h b/L1Trigger/L1TGlobal/src/classes.h index 6a935d541760f..b8e6e6237c40a 100644 --- a/L1Trigger/L1TGlobal/src/classes.h +++ b/L1Trigger/L1TGlobal/src/classes.h @@ -8,5 +8,6 @@ namespace L1Trigger_L1TGlobal { std::vector dummy3; std::vector dummy4; std::vector dummy5; + std::vector dummy6; }; } // namespace L1Trigger_L1TGlobal diff --git a/L1Trigger/L1TGlobal/src/classes_def.xml b/L1Trigger/L1TGlobal/src/classes_def.xml index 39b771b22d5ae..9b34135ffdfab 100644 --- a/L1Trigger/L1TGlobal/src/classes_def.xml +++ b/L1Trigger/L1TGlobal/src/classes_def.xml @@ -31,17 +31,25 @@ + - + + - + + + + + + + diff --git a/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc b/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc index 0f853b4af3209..e4d227dc45cc8 100644 --- a/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc +++ b/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc @@ -63,6 +63,8 @@ void L1TMuonShowerProducer::produce(edm::Event& iEvent, const edm::EventSetup& i bool isOneNominalOutOfTime = false; bool isTwoLooseInTime = false; bool isTwoLooseOutOfTime = false; + bool isOneTightInTime = false; + bool isOneTightOutOfTime = false; for (size_t i = 0; i < emtfShowers->size(0); ++i) { auto shower = emtfShowers->at(0, i); if (shower.isValid()) { @@ -76,13 +78,20 @@ void L1TMuonShowerProducer::produce(edm::Event& iEvent, const edm::EventSetup& i isTwoLooseInTime = true; if (shower.isTwoLooseOutOfTime()) isTwoLooseOutOfTime = true; + // tight + if (shower.isOneTightInTime()) + isOneTightInTime = true; + if (shower.isOneTightOutOfTime()) + isOneTightOutOfTime = true; } } // Check for at least one nominal shower - const bool acceptCondition(isOneNominalInTime or isOneNominalOutOfTime or isTwoLooseInTime or isTwoLooseOutOfTime); + const bool acceptCondition(isOneNominalInTime or isOneNominalOutOfTime or + isTwoLooseInTime or isTwoLooseOutOfTime or + isOneNominalInTime or isOneNominalOutOfTime); if (acceptCondition) { - MuonShower outShower(isOneNominalInTime, isOneNominalOutOfTime, isTwoLooseInTime, isTwoLooseOutOfTime); + MuonShower outShower(isOneNominalInTime, isOneNominalOutOfTime, isTwoLooseInTime, isTwoLooseOutOfTime, isOneTightInTime, isOneTightOutOfTime); outShowers->push_back(0, outShower); } iEvent.put(std::move(outShowers)); @@ -94,6 +103,7 @@ void L1TMuonShowerProducer::fillDescriptions(edm::ConfigurationDescriptions& des desc.add("showerInput", edm::InputTag("simEmtfShowers", "EMTF")); desc.add("bxMin", 0); desc.add("bxMax", 0); + desc.add("minTightShowers", 1); desc.add("minNominalShowers", 1); desc.add("minTwoLooseShowers", 0); descriptions.add("simGmtShowerDigisDef", desc); diff --git a/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h b/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h index b5c76daedf305..6098ab4495b2a 100644 --- a/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h +++ b/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h @@ -32,8 +32,13 @@ class SectorProcessorShower { bool is_in_sector_csc(int tp_endcap, int tp_sector) const; int verbose_, endcap_, sector_; + // backup trigger + bool enableOneTightShower_; + // nominal trigger for physics bool enableOneNominalShower_; + // trigger to extend the physics reach bool enableTwoLooseShowers_; + unsigned nTightShowers_; unsigned nNominalShowers_; unsigned nLooseShowers_; }; diff --git a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc index 63f987a3e8d1b..34da46362f83f 100644 --- a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc +++ b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc @@ -41,10 +41,12 @@ void L1TMuonEndCapShowerProducer::produce(edm::Event& iEvent, const edm::EventSe void L1TMuonEndCapShowerProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; // these are different shower selections that can be enabled + desc.add("enableOneTightShowers", true); desc.add("enableOneNominalShowers", true); desc.add("enableTwoLooseShowers", false); desc.add("nLooseShowers", 2); desc.add("nNominalShowers", 1); + desc.add("nTightShowers", 1); desc.add("CSCShowerInput", edm::InputTag("simCscTriggerPrimitiveDigis")); descriptions.add("simEmtfShowersDef", desc); descriptions.setComment("This is the generic cfi file for the EMTF shower producer"); diff --git a/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc index 12995249f03bc..4223dd1e0c87b 100644 --- a/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc +++ b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc @@ -10,8 +10,10 @@ void SectorProcessorShower::configure(const edm::ParameterSet& pset, int endcap, enableTwoLooseShowers_ = pset.getParameter("enableTwoLooseShowers"); enableOneNominalShower_ = pset.getParameter("enableOneNominalShowers"); + enableOneNominalShower_ = pset.getParameter("enableOneNominalShowers"); nLooseShowers_ = pset.getParameter("nLooseShowers"); nNominalShowers_ = pset.getParameter("nNominalShowers"); + nNominalShowers_ = pset.getParameter("nNominalShowers"); } void SectorProcessorShower::process(const CSCShowerDigiCollection& in_showers, @@ -47,25 +49,34 @@ void SectorProcessorShower::process(const CSCShowerDigiCollection& in_showers, selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isLooseInTime(); })); const unsigned nNominalInTime(std::count_if( selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isNominalInTime(); })); + const unsigned nTightInTime(std::count_if( + selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isTightInTime(); })); const unsigned nLooseOutOfTime(std::count_if( selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isLooseOutOfTime(); })); const unsigned nNominalOutOfTime(std::count_if( selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isNominalOutOfTime(); })); + const unsigned nTightOutOfTime(std::count_if( + selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isTightOutOfTime(); })); const bool hasTwoLooseInTime(nLooseInTime >= nLooseShowers_); const bool hasOneNominalInTime(nNominalInTime >= nNominalShowers_); + const bool hasOneTightInTime(nTightInTime >= nTightShowers_); const bool hasTwoLooseOutOfTime(nLooseOutOfTime >= nLooseShowers_); const bool hasOneNominalOutOfTime(nNominalOutOfTime >= nNominalShowers_); + const bool hasOneTightOutOfTime(nTightOutOfTime >= nTightShowers_); const bool acceptLoose(enableTwoLooseShowers_ and (hasTwoLooseInTime or hasTwoLooseOutOfTime)); const bool acceptNominal(enableOneNominalShower_ and (hasOneNominalInTime or hasOneNominalOutOfTime)); + const bool acceptTight(enableOneTightShower_ and (hasOneTightInTime or hasOneTightOutOfTime)); + // trigger condition - const bool accept(acceptLoose or acceptNominal); + const bool accept(acceptLoose or acceptNominal or acceptTight); if (accept) { // shower output - l1t::RegionalMuonShower out_shower( - hasOneNominalInTime, hasOneNominalOutOfTime, hasTwoLooseInTime, hasTwoLooseOutOfTime); + l1t::RegionalMuonShower out_shower(hasOneNominalInTime, hasOneNominalOutOfTime, + hasTwoLooseInTime, hasTwoLooseOutOfTime, + hasOneTightInTime, hasOneTightOutOfTime); out_shower.setEndcap(endcap_); out_shower.setSector(sector_); out_showers.push_back(0, out_shower); From ace04be845210d825ee7f779602c914028abb2b4 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Fri, 8 Oct 2021 15:13:07 -0500 Subject: [PATCH 02/18] Code format --- DataFormats/L1TMuon/src/RegionalMuonShower.cc | 24 ++++++-------- DataFormats/L1Trigger/interface/MuonShower.h | 28 ++++++++--------- DataFormats/L1Trigger/src/MuonShower.cc | 31 +++++++++---------- .../L1TMuon/plugins/L1TMuonShowerProducer.cc | 10 ++++-- .../src/SectorProcessorShower.cc | 9 ++++-- 5 files changed, 52 insertions(+), 50 deletions(-) diff --git a/DataFormats/L1TMuon/src/RegionalMuonShower.cc b/DataFormats/L1TMuon/src/RegionalMuonShower.cc index 70d16abd71821..eb050a035735c 100644 --- a/DataFormats/L1TMuon/src/RegionalMuonShower.cc +++ b/DataFormats/L1TMuon/src/RegionalMuonShower.cc @@ -5,14 +5,13 @@ l1t::RegionalMuonShower::RegionalMuonShower(bool oneNominalInTime, bool twoLooseInTime, bool twoLooseOutOfTime, bool oneTightInTime, - bool oneTightOutOfTime - ) + bool oneTightOutOfTime) : isOneNominalInTime_(oneNominalInTime), isOneNominalOutOfTime_(oneNominalOutOfTime), - isOneTightInTime_(oneTightInTime), - isOneTightOutOfTime_(oneTightOutOfTime), - isTwoLooseInTime_(twoLooseInTime), - isTwoLooseOutOfTime_(twoLooseOutOfTime), + isOneTightInTime_(oneTightInTime), + isOneTightOutOfTime_(oneTightOutOfTime), + isTwoLooseInTime_(twoLooseInTime), + isTwoLooseOutOfTime_(twoLooseOutOfTime), endcap_(0), sector_(0), link_(0) {} @@ -20,15 +19,12 @@ l1t::RegionalMuonShower::RegionalMuonShower(bool oneNominalInTime, l1t::RegionalMuonShower::~RegionalMuonShower() {} bool l1t::RegionalMuonShower::isValid() const { - return (isOneNominalInTime_ or isTwoLooseInTime_ or isOneTightInTime_ - or isOneNominalOutOfTime_ or isTwoLooseOutOfTime_ or isOneTightOutOfTime_); + return (isOneNominalInTime_ or isTwoLooseInTime_ or isOneTightInTime_ or isOneNominalOutOfTime_ or + isTwoLooseOutOfTime_ or isOneTightOutOfTime_); } bool l1t::RegionalMuonShower::operator==(const l1t::RegionalMuonShower& rhs) const { - return (isTwoLooseInTime_ == rhs.isTwoLooseInTime() and - isOneNominalInTime_ == rhs.isOneNominalInTime() and - isOneNominalInTime_ == rhs.isOneNominalInTime() and - isTwoLooseOutOfTime_ == rhs.isTwoLooseOutOfTime() and - isOneTightOutOfTime_ == rhs.isOneTightOutOfTime() and - isOneTightOutOfTime_ == rhs.isOneTightOutOfTime()); + return (isTwoLooseInTime_ == rhs.isTwoLooseInTime() and isOneNominalInTime_ == rhs.isOneNominalInTime() and + isOneNominalInTime_ == rhs.isOneNominalInTime() and isTwoLooseOutOfTime_ == rhs.isTwoLooseOutOfTime() and + isOneTightOutOfTime_ == rhs.isOneTightOutOfTime() and isOneTightOutOfTime_ == rhs.isOneTightOutOfTime()); } diff --git a/DataFormats/L1Trigger/interface/MuonShower.h b/DataFormats/L1Trigger/interface/MuonShower.h index e22507330d76b..3ea30f7a8dd53 100644 --- a/DataFormats/L1Trigger/interface/MuonShower.h +++ b/DataFormats/L1Trigger/interface/MuonShower.h @@ -54,26 +54,26 @@ namespace l1t { This is done separately for the in-time and out-of-time trigger data */ - void setMus0(const bool bit) {mus0_ = bit;} - void setMus1(const bool bit) {mus1_ = bit;} - void setMusOutOfTime0(const bool bit) {musOutOfTime0_ = bit;} - void setMusOutOfTime1(const bool bit) {musOutOfTime1_ = bit;} + void setMus0(const bool bit) { mus0_ = bit; } + void setMus1(const bool bit) { mus1_ = bit; } + void setMusOutOfTime0(const bool bit) { musOutOfTime0_ = bit; } + void setMusOutOfTime1(const bool bit) { musOutOfTime1_ = bit; } - bool mus0() const {return mus0_;} - bool mus1() const {return mus1_;} - bool musOutOfTime0() const {return musOutOfTime0_;} - bool musOutOfTime1() const {return musOutOfTime1_;} + bool mus0() const { return mus0_; } + bool mus1() const { return mus1_; } + bool musOutOfTime0() const { return musOutOfTime0_; } + bool musOutOfTime1() const { return musOutOfTime1_; } // at least one bit must be valid bool isValid() const; // useful members for trigger performance studies - bool isOneNominalInTime() const {return mus0_;} - bool isOneNominalOutOfTime() const {return musOutOfTime0_;} - bool isTwoLooseInTime() const {return mus1_;} - bool isTwoLooseOutOfTime() const {return musOutOfTime1_;} - bool isOneTightInTime() const {return mus0_ and mus1_;} - bool isOneTightOutOfTime() const {return musOutOfTime0_ and musOutOfTime1_;} + bool isOneNominalInTime() const { return mus0_; } + bool isOneNominalOutOfTime() const { return musOutOfTime0_; } + bool isTwoLooseInTime() const { return mus1_; } + bool isTwoLooseOutOfTime() const { return musOutOfTime1_; } + bool isOneTightInTime() const { return mus0_ and mus1_; } + bool isOneTightOutOfTime() const { return musOutOfTime0_ and musOutOfTime1_; } virtual bool operator==(const l1t::MuonShower& rhs) const; virtual inline bool operator!=(const l1t::MuonShower& rhs) const { return !(operator==(rhs)); }; diff --git a/DataFormats/L1Trigger/src/MuonShower.cc b/DataFormats/L1Trigger/src/MuonShower.cc index 47661fddb536b..d4b8b3d5f9eca 100644 --- a/DataFormats/L1Trigger/src/MuonShower.cc +++ b/DataFormats/L1Trigger/src/MuonShower.cc @@ -1,25 +1,24 @@ #include "DataFormats/L1Trigger/interface/MuonShower.h" -l1t::MuonShower::MuonShower(bool oneNominalInTime, bool oneNominalOutOfTime, bool twoLooseInTime, bool twoLooseOutOfTime, bool oneTightInTime, bool oneTightOutOfTime) - : L1Candidate(math::PtEtaPhiMLorentzVector{0., 0., 0., 0.}, 0., 0., 0., 0, 0), - // in this object it makes more sense to the different shower types to - // the 4 bits, so that the object easily interfaces with the uGT emulator - mus0_(oneNominalInTime or oneTightInTime), - mus1_(twoLooseInTime or oneTightInTime), - musOutOfTime0_(oneNominalOutOfTime or oneTightOutOfTime), - musOutOfTime1_(twoLooseOutOfTime or oneTightOutOfTime) -{ -} +l1t::MuonShower::MuonShower(bool oneNominalInTime, + bool oneNominalOutOfTime, + bool twoLooseInTime, + bool twoLooseOutOfTime, + bool oneTightInTime, + bool oneTightOutOfTime) + : L1Candidate(math::PtEtaPhiMLorentzVector{0., 0., 0., 0.}, 0., 0., 0., 0, 0), + // in this object it makes more sense to the different shower types to + // the 4 bits, so that the object easily interfaces with the uGT emulator + mus0_(oneNominalInTime or oneTightInTime), + mus1_(twoLooseInTime or oneTightInTime), + musOutOfTime0_(oneNominalOutOfTime or oneTightOutOfTime), + musOutOfTime1_(twoLooseOutOfTime or oneTightOutOfTime) {} l1t::MuonShower::~MuonShower() {} -bool l1t::MuonShower::isValid() const { - return mus0_ or mus1_ or musOutOfTime0_ or musOutOfTime1_; -} +bool l1t::MuonShower::isValid() const { return mus0_ or mus1_ or musOutOfTime0_ or musOutOfTime1_; } bool l1t::MuonShower::operator==(const l1t::MuonShower& rhs) const { - return (mus0_ == rhs.mus0() and - mus1_ == rhs.mus1() and - musOutOfTime0_ == rhs.musOutOfTime0() and + return (mus0_ == rhs.mus0() and mus1_ == rhs.mus1() and musOutOfTime0_ == rhs.musOutOfTime0() and musOutOfTime1_ == rhs.musOutOfTime1()); } diff --git a/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc b/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc index e4d227dc45cc8..0a5628b382f1a 100644 --- a/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc +++ b/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc @@ -87,11 +87,15 @@ void L1TMuonShowerProducer::produce(edm::Event& iEvent, const edm::EventSetup& i } // Check for at least one nominal shower - const bool acceptCondition(isOneNominalInTime or isOneNominalOutOfTime or - isTwoLooseInTime or isTwoLooseOutOfTime or + const bool acceptCondition(isOneNominalInTime or isOneNominalOutOfTime or isTwoLooseInTime or isTwoLooseOutOfTime or isOneNominalInTime or isOneNominalOutOfTime); if (acceptCondition) { - MuonShower outShower(isOneNominalInTime, isOneNominalOutOfTime, isTwoLooseInTime, isTwoLooseOutOfTime, isOneTightInTime, isOneTightOutOfTime); + MuonShower outShower(isOneNominalInTime, + isOneNominalOutOfTime, + isTwoLooseInTime, + isTwoLooseOutOfTime, + isOneTightInTime, + isOneTightOutOfTime); outShowers->push_back(0, outShower); } iEvent.put(std::move(outShowers)); diff --git a/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc index 4223dd1e0c87b..628b0a62f67ff 100644 --- a/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc +++ b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc @@ -74,9 +74,12 @@ void SectorProcessorShower::process(const CSCShowerDigiCollection& in_showers, if (accept) { // shower output - l1t::RegionalMuonShower out_shower(hasOneNominalInTime, hasOneNominalOutOfTime, - hasTwoLooseInTime, hasTwoLooseOutOfTime, - hasOneTightInTime, hasOneTightOutOfTime); + l1t::RegionalMuonShower out_shower(hasOneNominalInTime, + hasOneNominalOutOfTime, + hasTwoLooseInTime, + hasTwoLooseOutOfTime, + hasOneTightInTime, + hasOneTightOutOfTime); out_shower.setEndcap(endcap_); out_shower.setSector(sector_); out_showers.push_back(0, out_shower); From 5c8012dbb037c1d24ceab146c7caf204a7a29956 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Fri, 8 Oct 2021 21:00:23 -0500 Subject: [PATCH 03/18] Add AND option --- .../CSCTriggerPrimitives/python/params/showerParams.py | 6 +++++- L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py b/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py index 8903fbf5c5deb..cddf970ca4f89 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py +++ b/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py @@ -9,7 +9,11 @@ ## loose -> 'loose anode or loose cathode' ## nominal -> 'nominal anode or nominal cathode' ## tight -> 'tight anode or tight cathode' - source = cms.uint32(0), + ## 3: cathode and anode showers + ## loose -> 'loose anode and loose cathode' + ## nominal -> 'nominal anode and nominal cathode' + ## tight -> 'tight anode and tight cathode' + source = cms.uint32(3), ## settings for cathode showers (counting CSCComparatorDigi) cathodeShower = cms.PSet( diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc index 67a7548908179..8a3b58ab235c6 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc @@ -572,6 +572,10 @@ void CSCMotherboard::encodeHighMultiplicityBits() { inTimeHMT_ = anodeInTime | cathodeInTime; outTimeHMT_ = anodeOutTime | cathodeOutTime; break; + case 3: + inTimeHMT_ = anodeInTime & cathodeInTime; + outTimeHMT_ = anodeOutTime & cathodeOutTime; + break; default: inTimeHMT_ = cathodeInTime; outTimeHMT_ = cathodeOutTime; From a913e0e23eacb4c02746dfb4fc7ff6d934f608ee Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 20 Oct 2021 23:31:05 +0200 Subject: [PATCH 04/18] Minor fixes --- DataFormats/L1TMuon/interface/RegionalMuonShower.h | 4 ++-- L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc | 2 +- L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h | 6 +++--- .../L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc | 2 +- L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc | 1 + 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/DataFormats/L1TMuon/interface/RegionalMuonShower.h b/DataFormats/L1TMuon/interface/RegionalMuonShower.h index 27902212332bc..230dc49d12664 100644 --- a/DataFormats/L1TMuon/interface/RegionalMuonShower.h +++ b/DataFormats/L1TMuon/interface/RegionalMuonShower.h @@ -19,8 +19,8 @@ namespace l1t { bool oneNominalOutOfTime = false, bool twoLooseInTime = false, bool twoLooseOutOfTime = false, - bool twoTightInTime = false, - bool twoTightOutOfTime = false); + bool oneTightInTime = false, + bool oneTightOutOfTime = false); ~RegionalMuonShower(); diff --git a/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc b/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc index 0a5628b382f1a..8865688a9846b 100644 --- a/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc +++ b/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc @@ -107,8 +107,8 @@ void L1TMuonShowerProducer::fillDescriptions(edm::ConfigurationDescriptions& des desc.add("showerInput", edm::InputTag("simEmtfShowers", "EMTF")); desc.add("bxMin", 0); desc.add("bxMax", 0); - desc.add("minTightShowers", 1); desc.add("minNominalShowers", 1); + desc.add("minTightShowers", 1); desc.add("minTwoLooseShowers", 0); descriptions.add("simGmtShowerDigisDef", desc); } diff --git a/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h b/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h index 6098ab4495b2a..f48f93ef154e0 100644 --- a/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h +++ b/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h @@ -32,14 +32,14 @@ class SectorProcessorShower { bool is_in_sector_csc(int tp_endcap, int tp_sector) const; int verbose_, endcap_, sector_; - // backup trigger - bool enableOneTightShower_; // nominal trigger for physics bool enableOneNominalShower_; + // backup trigger + bool enableOneTightShower_; // trigger to extend the physics reach bool enableTwoLooseShowers_; - unsigned nTightShowers_; unsigned nNominalShowers_; + unsigned nTightShowers_; unsigned nLooseShowers_; }; diff --git a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc index 34da46362f83f..62e63e5a87f5e 100644 --- a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc +++ b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc @@ -41,8 +41,8 @@ void L1TMuonEndCapShowerProducer::produce(edm::Event& iEvent, const edm::EventSe void L1TMuonEndCapShowerProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; // these are different shower selections that can be enabled - desc.add("enableOneTightShowers", true); desc.add("enableOneNominalShowers", true); + desc.add("enableOneTightShowers", true); desc.add("enableTwoLooseShowers", false); desc.add("nLooseShowers", 2); desc.add("nNominalShowers", 1); diff --git a/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc index 628b0a62f67ff..3328d7b2e7d6d 100644 --- a/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc +++ b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc @@ -61,6 +61,7 @@ void SectorProcessorShower::process(const CSCShowerDigiCollection& in_showers, const bool hasTwoLooseInTime(nLooseInTime >= nLooseShowers_); const bool hasOneNominalInTime(nNominalInTime >= nNominalShowers_); const bool hasOneTightInTime(nTightInTime >= nTightShowers_); + const bool hasTwoLooseOutOfTime(nLooseOutOfTime >= nLooseShowers_); const bool hasOneNominalOutOfTime(nNominalOutOfTime >= nNominalShowers_); const bool hasOneTightOutOfTime(nTightOutOfTime >= nTightShowers_); From a632adcc8bc830efffda2f95e6adf79994d5c463 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 20 Oct 2021 23:55:20 +0200 Subject: [PATCH 05/18] Update bit mapping --- DataFormats/L1Trigger/interface/MuonShower.h | 25 +++++++++++--------- DataFormats/L1Trigger/src/MuonShower.cc | 8 +++---- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/DataFormats/L1Trigger/interface/MuonShower.h b/DataFormats/L1Trigger/interface/MuonShower.h index 3ea30f7a8dd53..15125d77bc548 100644 --- a/DataFormats/L1Trigger/interface/MuonShower.h +++ b/DataFormats/L1Trigger/interface/MuonShower.h @@ -39,19 +39,19 @@ namespace l1t { /* In CMSSW we consider 3 valid cases: - 1 nominal shower (baseline trigger for physics at Run-3) - - 2 loose showers (to extend the physics reach) - 1 tight shower (backup trigger) + - 2 loose showers (to extend the physics reach) In the uGT and UTM library, the hadronic shower trigger data is split over 4 bits: 2 for in-time trigger data, 2 for out-of-time trigger data - mus0, mus1 for in-time - musOutOfTime0, musOutOfTime1 for out-of-time - The mapping for Run-3 is as follows: - - 1 nominal shower -> 0b01 - - 2 loose showers -> 0b10 - - 1 tight shower -> 0b11 - This is done separately for the in-time and out-of-time trigger data + The mapping for Run-3 startup is as follows: + - 1 nominal shower -> 0b01 (mus0) + - 1 tight shower -> 0b10 (mus1) + + The 2 loose showers case would be mapped onto musOutOfTime0 and musOutOfTime1 later during Run-3 */ void setMus0(const bool bit) { mus0_ = bit; } @@ -68,12 +68,15 @@ namespace l1t { bool isValid() const; // useful members for trigger performance studies + // needed at startup Run-3 bool isOneNominalInTime() const { return mus0_; } - bool isOneNominalOutOfTime() const { return musOutOfTime0_; } - bool isTwoLooseInTime() const { return mus1_; } - bool isTwoLooseOutOfTime() const { return musOutOfTime1_; } - bool isOneTightInTime() const { return mus0_ and mus1_; } - bool isOneTightOutOfTime() const { return musOutOfTime0_ and musOutOfTime1_; } + bool isOneTightInTime() const { return mus1_; } + // to be developed during Run-3 + bool isTwoLooseInTime() const { return false; } + // these options require more study + bool isOneNominalOutOfTime() const { return false; } + bool isTwoLooseOutOfTime() const { return false; } + bool isOneTightOutOfTime() const { return false; } virtual bool operator==(const l1t::MuonShower& rhs) const; virtual inline bool operator!=(const l1t::MuonShower& rhs) const { return !(operator==(rhs)); }; diff --git a/DataFormats/L1Trigger/src/MuonShower.cc b/DataFormats/L1Trigger/src/MuonShower.cc index d4b8b3d5f9eca..123363221b79e 100644 --- a/DataFormats/L1Trigger/src/MuonShower.cc +++ b/DataFormats/L1Trigger/src/MuonShower.cc @@ -9,10 +9,10 @@ l1t::MuonShower::MuonShower(bool oneNominalInTime, : L1Candidate(math::PtEtaPhiMLorentzVector{0., 0., 0., 0.}, 0., 0., 0., 0, 0), // in this object it makes more sense to the different shower types to // the 4 bits, so that the object easily interfaces with the uGT emulator - mus0_(oneNominalInTime or oneTightInTime), - mus1_(twoLooseInTime or oneTightInTime), - musOutOfTime0_(oneNominalOutOfTime or oneTightOutOfTime), - musOutOfTime1_(twoLooseOutOfTime or oneTightOutOfTime) {} + mus0_(oneNominalInTime), + mus1_(oneTightInTime), + musOutOfTime0_(false), + musOutOfTime1_(false) {} l1t::MuonShower::~MuonShower() {} From 860d0316fe0743b0cf96bc94a7f2cb297048f8f9 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 20 Oct 2021 20:04:36 -0500 Subject: [PATCH 06/18] Add commits by Nik Menendez --- .../interface/CSCAnodeLCTProcessor.h | 1 + .../interface/CSCCathodeLCTProcessor.h | 1 + .../python/params/showerParams.py | 38 ++++++++++--------- .../src/CSCAnodeLCTProcessor.cc | 26 +++++++++++++ .../src/CSCCathodeLCTProcessor.cc | 26 ++++++++++++- .../src/SectorProcessorShower.cc | 4 +- 6 files changed, 76 insertions(+), 20 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h index 699171e1ef331..aa1f26807b8fd 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h @@ -136,6 +136,7 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { unsigned showerMaxInTBin_; unsigned showerMinOutTBin_; unsigned showerMaxOutTBin_; + unsigned minLayersCentralTBin_; /** Configuration parameters. */ unsigned int fifo_tbins, fifo_pretrig, drift_delay; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h index 5607f048e4427..cdc318e0a43bb 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h @@ -190,6 +190,7 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { unsigned showerMaxInTBin_; unsigned showerMinOutTBin_; unsigned showerMaxOutTBin_; + unsigned minLayersCentralTBin_; /** Configuration parameters. */ unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode. diff --git a/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py b/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py index cddf970ca4f89..a45b9fb6e1137 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py +++ b/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py @@ -25,53 +25,55 @@ # ME1/1 100, 100, 100, # ME1/2 - 54, 55, 61, + 19, 38, 42, # ME1/3 - 20, 20, 30, + 8, 11, 15, # ME2/1 - 35, 35, 35, + 17, 33, 35, # ME2/2 - 29, 29, 35, + 10, 20, 24, # ME3/1 - 35, 35, 40, + 15, 31, 33, # ME3/2 - 24, 25, 30, + 9, 18, 22, # ME4/1 - 36, 40, 40, + 17, 34, 36, # ME4/2 - 26, 30, 30 + 11, 22, 26 ), showerMinInTBin = cms.uint32(6), showerMaxInTBin = cms.uint32(8), showerMinOutTBin = cms.uint32(2), showerMaxOutTBin = cms.uint32(5), + minLayersCentralTBin = cms.uint32(5), ), ## settings for anode showers (counting CSCWireDigi) anodeShower = cms.PSet( ## {loose, nominal, tight} thresholds for hit counters showerThresholds = cms.vuint32( # ME1/1 - 104, 105, 107, + 140, 140, 140, # ME1/2 - 92, 100, 102, + 20, 41, 45, # ME1/3 - 32, 33, 48, + 8, 12, 16, # ME2/1 - 133, 134, 136, + 28, 56, 58, # ME2/2 - 83, 84, 86, + 9, 18, 22, # ME3/1 - 130, 131, 133, + 26, 55, 57, # ME3/2 - 74, 80, 87, + 8, 16, 20, # ME4/1 - 127, 128, 130, + 31, 62, 64, # ME4/2 - 88, 89, 94 + 13, 27, 31 ), showerMinInTBin = cms.uint32(8), - showerMaxInTBin = cms.uint32(10), + showerMaxInTBin = cms.uint32(8), showerMinOutTBin = cms.uint32(4), showerMaxOutTBin = cms.uint32(7), + minLayersCentralTBin = cms.uint32(5), ) ) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index 4c978fbbeecf4..408fcb7dc9419 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -88,6 +88,7 @@ CSCAnodeLCTProcessor::CSCAnodeLCTProcessor(unsigned endcap, showerMaxInTBin_ = shower.getParameter("showerMaxInTBin"); showerMinOutTBin_ = shower.getParameter("showerMinOutTBin"); showerMaxOutTBin_ = shower.getParameter("showerMaxOutTBin"); + minLayersCentralTBin_ = shower.getParameter("minLayersCentralTBin"); } void CSCAnodeLCTProcessor::loadPatternMask() { @@ -1341,6 +1342,31 @@ void CSCAnodeLCTProcessor::encodeHighMultiplicityBits( inTimeHMT_ = 0; outTimeHMT_ = 0; + auto layerTime = [=](unsigned time) { return time == CSCConstants::LCT_CENTRAL_BX; }; + + // Calculate layers with hits + unsigned nLayersWithHits = 0; + for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { + bool atLeastOneWGHit = false; + for (int i_wire = 0; i_wire < CSCConstants::MAX_NUM_WIREGROUPS; i_wire++) { + if (!wires[i_layer][i_wire].empty()) { + auto times = wires[i_layer][i_wire]; + int nLayerTime = std::count_if(times.begin(), times.end(), layerTime); + if (nLayerTime > 0) { + atLeastOneWGHit = true; + break; + } + } + } + if (atLeastOneWGHit) { + nLayersWithHits++; + } + } + + // do nothing if there are not enough layers with hits + if (nLayersWithHits < minLayersCentralTBin_) + return; + // functions for in-time and out-of-time auto inTime = [=](unsigned time) { return time >= showerMinInTBin_ and time <= showerMaxInTBin_; }; auto outTime = [=](unsigned time) { return time >= showerMinOutTBin_ and time <= showerMaxOutTBin_; }; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc index 76475348ce879..0379834f89838 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc @@ -99,7 +99,7 @@ CSCCathodeLCTProcessor::CSCCathodeLCTProcessor(unsigned endcap, showerMaxInTBin_ = shower.getParameter("showerMaxInTBin"); showerMinOutTBin_ = shower.getParameter("showerMinOutTBin"); showerMaxOutTBin_ = shower.getParameter("showerMaxOutTBin"); - + minLayersCentralTBin_ = shower.getParameter("minLayersCentralTBin"); thePreTriggerDigis.clear(); // quality control of stubs @@ -1176,6 +1176,30 @@ void CSCCathodeLCTProcessor::encodeHighMultiplicityBits( inTimeHMT_ = 0; outTimeHMT_ = 0; + auto layerTime = [=](unsigned time) { return time == CSCConstants::CLCT_CENTRAL_BX; }; + // Calculate layers with hits + unsigned nLayersWithHits = 0; + for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { + bool atLeastOneWGHit = false; + for (int i_hstrip = 0; i_hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; i_hstrip++) { + if (!halfstrip[i_layer][i_hstrip].empty()) { + auto times = halfstrip[i_layer][i_hstrip]; + int nLayerTime = std::count_if(times.begin(), times.end(), layerTime); + if (nLayerTime > 0) { + atLeastOneWGHit = true; + break; + } + } + } + if (atLeastOneWGHit) { + nLayersWithHits++; + } + } + + // do nothing if there are not enough layers with hits + if (nLayersWithHits < minLayersCentralTBin_) + return; + // functions for in-time and out-of-time auto inTime = [=](unsigned time) { return time >= showerMinInTBin_ and time <= showerMaxInTBin_; }; auto outTime = [=](unsigned time) { return time >= showerMinOutTBin_ and time <= showerMaxOutTBin_; }; diff --git a/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc index 3328d7b2e7d6d..3c78a7b577cbb 100644 --- a/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc +++ b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc @@ -81,7 +81,9 @@ void SectorProcessorShower::process(const CSCShowerDigiCollection& in_showers, hasTwoLooseOutOfTime, hasOneTightInTime, hasOneTightOutOfTime); - out_shower.setEndcap(endcap_); + // convert [1,2] to [1, -1] + const int endcap(endcap_ == 1 ? 1 : -1); + out_shower.setEndcap(endcap); out_shower.setSector(sector_); out_showers.push_back(0, out_shower); } From d604052e3b7f0c133d22c4350994576ebf901ed4 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Thu, 21 Oct 2021 04:58:53 +0200 Subject: [PATCH 07/18] Add showers to l1t ntuples --- .../interface/L1AnalysisL1Upgrade.h | 2 + .../interface/L1AnalysisL1UpgradeDataFormat.h | 10 ++ .../L1AnalysisL1UpgradeTfMuonShower.h | 23 +++++ ...1AnalysisL1UpgradeTfMuonShowerDataFormat.h | 25 +++++ .../L1UpgradeTfMuonShowerTreeProducer.cc | 96 +++++++++++++++++++ .../plugins/L1UpgradeTreeProducer.cc | 13 ++- .../L1TNtuples/src/L1AnalysisL1Upgrade.cc | 15 +++ .../src/L1AnalysisL1UpgradeTfMuonShower.cc | 21 ++++ L1Trigger/L1TNtuples/src/classes.h | 1 + L1Trigger/L1TNtuples/src/classes_def.xml | 1 + 10 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShower.h create mode 100644 L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h create mode 100644 L1Trigger/L1TNtuples/plugins/L1UpgradeTfMuonShowerTreeProducer.cc create mode 100644 L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1Upgrade.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1Upgrade.h index 21fdfba49510c..882c6727f5d38 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1Upgrade.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1Upgrade.h @@ -12,6 +12,7 @@ #include "DataFormats/L1Trigger/interface/Tau.h" #include "DataFormats/L1Trigger/interface/Jet.h" #include "DataFormats/L1Trigger/interface/Muon.h" +#include "DataFormats/L1Trigger/interface/MuonShower.h" #include "DataFormats/L1Trigger/interface/EtSum.h" #include "L1AnalysisL1UpgradeDataFormat.h" @@ -30,6 +31,7 @@ namespace L1Analysis { void SetJet(const edm::Handle jet, unsigned maxL1Upgrade); void SetSum(const edm::Handle sums, unsigned maxL1Upgrade); void SetMuon(const edm::Handle muon, unsigned maxL1Upgrade); + void SetMuonShower(const edm::Handle muonShower, unsigned maxL1Upgrade); L1AnalysisL1UpgradeDataFormat* getData() { return &l1upgrade_; } private: diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h index 82168330c0e31..af33f6642a1da 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h @@ -125,6 +125,11 @@ namespace L1Analysis { muonTfMuonIdx.clear(); muonBx.clear(); + nMuonShowers = 0; + muonShowerOneNominal.clear(); + muonShowerOneTight.clear(); + muonShowerTwoLoose.clear(); + nSums = 0; sumType.clear(); sumEt.clear(); @@ -211,6 +216,11 @@ namespace L1Analysis { std::vector muonTfMuonIdx; std::vector muonBx; + unsigned short int nMuonShowers; + std::vector muonShowerOneNominal; + std::vector muonShowerOneTight; + std::vector muonShowerTwoLoose; + unsigned short int nSums; std::vector sumType; std::vector sumEt; diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShower.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShower.h new file mode 100644 index 0000000000000..b641a1ead3cf5 --- /dev/null +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShower.h @@ -0,0 +1,23 @@ +#ifndef __L1Analysis_L1AnalysisL1UpgradeTfMuonShower_H__ +#define __L1Analysis_L1AnalysisL1UpgradeTfMuonShower_H__ + +#include "DataFormats/L1TMuon/interface/RegionalMuonShower.h" + +#include "L1AnalysisL1UpgradeTfMuonShowerDataFormat.h" +namespace L1Analysis { + class L1AnalysisL1UpgradeTfMuonShower { + public: + enum { TEST = 0 }; + L1AnalysisL1UpgradeTfMuonShower(); + ~L1AnalysisL1UpgradeTfMuonShower(); + void Reset() { + l1upgradetfmuonshower_.Reset(); + } + void SetTfMuonShower(const l1t::RegionalMuonShowerBxCollection& muon, unsigned maxL1UpgradeTfMuonShower); + L1AnalysisL1UpgradeTfMuonShowerDataFormat* getData() { return &l1upgradetfmuonshower_; } + + private: + L1AnalysisL1UpgradeTfMuonShowerDataFormat l1upgradetfmuonshower_; + }; +} // namespace L1Analysis +#endif diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h new file mode 100644 index 0000000000000..04796c6c1c512 --- /dev/null +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h @@ -0,0 +1,25 @@ +#ifndef __L1Analysis_L1AnalysisL1UpgradeTfMuonShowerDataFormat_H__ +#define __L1Analysis_L1AnalysisL1UpgradeTfMuonShowerDataFormat_H__ + +#include +#include + +namespace L1Analysis { + struct L1AnalysisL1UpgradeTfMuonShowerDataFormat { + L1AnalysisL1UpgradeTfMuonShowerDataFormat() { Reset(); }; + ~L1AnalysisL1UpgradeTfMuonShowerDataFormat(){}; + + void Reset() { + nTfMuonShowers = 0; + tfMuonShowerOneNominal.clear(); + tfMuonShowerOneTight.clear(); + tfMuonShowerTwoLoose.clear(); + } + + unsigned short int nTfMuonShowers; + std::vector tfMuonShowerOneNominal; + std::vector tfMuonShowerOneTight; + std::vector tfMuonShowerTwoLoose; + }; +} // namespace L1Analysis +#endif diff --git a/L1Trigger/L1TNtuples/plugins/L1UpgradeTfMuonShowerTreeProducer.cc b/L1Trigger/L1TNtuples/plugins/L1UpgradeTfMuonShowerTreeProducer.cc new file mode 100644 index 0000000000000..bc9484571138b --- /dev/null +++ b/L1Trigger/L1TNtuples/plugins/L1UpgradeTfMuonShowerTreeProducer.cc @@ -0,0 +1,96 @@ +// system include files +#include + +// framework +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/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" + +// data formats +#include "DataFormats/L1TMuon/interface/RegionalMuonShower.h" + +// ROOT output stuff +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "TTree.h" + +#include "L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShower.h" + +// +// class declaration +// + +class L1UpgradeTfMuonShowerTreeProducer : public edm::EDAnalyzer { +public: + explicit L1UpgradeTfMuonShowerTreeProducer(const edm::ParameterSet&); + ~L1UpgradeTfMuonShowerTreeProducer() override; + +private: + void beginJob(void) override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + +public: + L1Analysis::L1AnalysisL1UpgradeTfMuonShower l1UpgradeEmtf; + L1Analysis::L1AnalysisL1UpgradeTfMuonShowerDataFormat* l1UpgradeEmtfData; + +private: + unsigned maxL1UpgradeTfMuonShower_; + + // output file + edm::Service fs_; + + // tree + TTree* tree_; + + // EDM input tags + edm::EDGetTokenT emtfMuonShowerToken_; +}; + +L1UpgradeTfMuonShowerTreeProducer::L1UpgradeTfMuonShowerTreeProducer(const edm::ParameterSet& iConfig) { + emtfMuonShowerToken_ = + consumes(iConfig.getUntrackedParameter("emtfMuonShowerToken")); + + maxL1UpgradeTfMuonShower_ = iConfig.getParameter("maxL1UpgradeTfMuonShower"); + + l1UpgradeEmtfData = l1UpgradeEmtf.getData(); + + // set up output + tree_ = fs_->make("L1UpgradeTfMuonShowerTree", "L1UpgradeTfMuonShowerTree"); + tree_->Branch("L1UpgradeEmtfMuonShower", "L1Analysis::L1AnalysisL1UpgradeTfMuonShowerDataFormat", &l1UpgradeEmtfData, 32000, 3); +} + +L1UpgradeTfMuonShowerTreeProducer::~L1UpgradeTfMuonShowerTreeProducer() {} + +// +// member functions +// + +// ------------ method called to for each event ------------ +void L1UpgradeTfMuonShowerTreeProducer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + l1UpgradeEmtf.Reset(); + + edm::Handle emtfMuonShower; + + iEvent.getByToken(emtfMuonShowerToken_, emtfMuonShower); + + if (emtfMuonShower.isValid()) { + l1UpgradeEmtf.SetTfMuonShower(*emtfMuonShower, maxL1UpgradeTfMuonShower_); + } else { + edm::LogWarning("MissingProduct") << "L1Upgrade EMTF muons not found. Branch will not be filled" << std::endl; + } + + tree_->Fill(); +} + +// ------------ method called once each job just before starting event loop ------------ +void L1UpgradeTfMuonShowerTreeProducer::beginJob(void) {} + +// ------------ method called once each job just after ending the event loop ------------ +void L1UpgradeTfMuonShowerTreeProducer::endJob() {} + +//define this as a plug-in +DEFINE_FWK_MODULE(L1UpgradeTfMuonShowerTreeProducer); diff --git a/L1Trigger/L1TNtuples/plugins/L1UpgradeTreeProducer.cc b/L1Trigger/L1TNtuples/plugins/L1UpgradeTreeProducer.cc index 32add86552bc7..e30a0c27723c4 100644 --- a/L1Trigger/L1TNtuples/plugins/L1UpgradeTreeProducer.cc +++ b/L1Trigger/L1TNtuples/plugins/L1UpgradeTreeProducer.cc @@ -8,7 +8,7 @@ Description: Produce L1 Extra tree Implementation: - + */ // // Original Author: @@ -33,6 +33,7 @@ Description: Produce L1 Extra tree #include "DataFormats/L1Trigger/interface/Tau.h" #include "DataFormats/L1Trigger/interface/Jet.h" #include "DataFormats/L1Trigger/interface/Muon.h" +#include "DataFormats/L1Trigger/interface/MuonShower.h" #include "DataFormats/L1Trigger/interface/EtSum.h" // ROOT output stuff @@ -75,6 +76,7 @@ class L1UpgradeTreeProducer : public edm::EDAnalyzer { edm::EDGetTokenT jetToken_; edm::EDGetTokenT sumToken_; edm::EDGetTokenT muonToken_; + edm::EDGetTokenT muonShowerToken_; }; L1UpgradeTreeProducer::L1UpgradeTreeProducer(const edm::ParameterSet& iConfig) { @@ -83,6 +85,7 @@ L1UpgradeTreeProducer::L1UpgradeTreeProducer(const edm::ParameterSet& iConfig) { jetToken_ = consumes(iConfig.getUntrackedParameter("jetToken")); sumToken_ = consumes(iConfig.getUntrackedParameter("sumToken")); muonToken_ = consumes(iConfig.getUntrackedParameter("muonToken")); + muonShowerToken_ = consumes(iConfig.getUntrackedParameter("muonShowerToken")); const auto& taus = iConfig.getUntrackedParameter>("tauTokens"); for (const auto& tau : taus) { @@ -116,11 +119,13 @@ void L1UpgradeTreeProducer::analyze(const edm::Event& iEvent, const edm::EventSe edm::Handle jet; edm::Handle sums; edm::Handle muon; + edm::Handle muonShower; iEvent.getByToken(egToken_, eg); iEvent.getByToken(jetToken_, jet); iEvent.getByToken(sumToken_, sums); iEvent.getByToken(muonToken_, muon); + iEvent.getByToken(muonShowerToken_, muonShower); if (eg.isValid()) { l1Upgrade->SetEm(eg, maxL1Upgrade_); @@ -145,6 +150,12 @@ void L1UpgradeTreeProducer::analyze(const edm::Event& iEvent, const edm::EventSe edm::LogWarning("MissingProduct") << "L1Upgrade Muons not found. Branch will not be filled" << std::endl; } + if (muonShower.isValid()) { + l1Upgrade->SetMuonShower(muonShower, maxL1Upgrade_); + } else { + edm::LogWarning("MissingProduct") << "L1Upgrade Muon Showers not found. Branch will not be filled" << std::endl; + } + for (auto& tautoken : tauTokens_) { edm::Handle tau; iEvent.getByToken(tautoken, tau); diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc index e037ce0e76339..7fdac626d1aea 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc @@ -121,6 +121,21 @@ void L1Analysis::L1AnalysisL1Upgrade::SetMuon(const edm::Handle muonShower, unsigned maxL1Upgrade) { + for (int ibx = muonShower->getFirstBX(); ibx <= muonShower->getLastBX(); ++ibx) { + for (l1t::MuonShowerBxCollection::const_iterator it = muonShower->begin(ibx); + it != muonShower->end(ibx) && l1upgrade_.nMuonShowers < maxL1Upgrade; + it++) { + if (it->isValid()) { + l1upgrade_.muonShowerOneNominal.push_back(it->isOneNominalInTime()); + l1upgrade_.muonShowerOneTight.push_back(it->isOneTightInTime()); + l1upgrade_.muonShowerTwoLoose.push_back(it->isTwoLooseInTime()); + l1upgrade_.nMuonShowers++; + } + } + } +} + void L1Analysis::L1AnalysisL1Upgrade::SetSum(const edm::Handle sums, unsigned maxL1Upgrade) { for (int ibx = sums->getFirstBX(); ibx <= sums->getLastBX(); ++ibx) { for (l1t::EtSumBxCollection::const_iterator it = sums->begin(ibx); diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc new file mode 100644 index 0000000000000..af989ea03a474 --- /dev/null +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc @@ -0,0 +1,21 @@ +#include "L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShower.h" +#include +L1Analysis::L1AnalysisL1UpgradeTfMuonShower::L1AnalysisL1UpgradeTfMuonShower() {} + +L1Analysis::L1AnalysisL1UpgradeTfMuonShower::~L1AnalysisL1UpgradeTfMuonShower() {} + +void L1Analysis::L1AnalysisL1UpgradeTfMuonShower::SetTfMuonShower(const l1t::RegionalMuonShowerBxCollection& muonShower, + unsigned maxL1UpgradeTfMuonShower) { + for (int ibx = muonShower.getFirstBX(); ibx <= muonShower.getLastBX(); ++ibx) { + for (auto it = muonShower.begin(ibx); + it != muonShower.end(ibx) && l1upgradetfmuonshower_.nTfMuonShowers < maxL1UpgradeTfMuonShower; + ++it) { + if (it->isValid()) { + l1upgradetfmuonshower_.tfMuonShowerOneNominal.push_back(it->isOneNominalInTime()); + l1upgradetfmuonshower_.tfMuonShowerOneTight.push_back(it->isOneTightInTime()); + l1upgradetfmuonshower_.tfMuonShowerTwoLoose.push_back(it->isTwoLooseInTime()); + l1upgradetfmuonshower_.nTfMuonShowers++; + } + } + } +} diff --git a/L1Trigger/L1TNtuples/src/classes.h b/L1Trigger/L1TNtuples/src/classes.h index b1c776e5472b3..220da7a47b3f9 100644 --- a/L1Trigger/L1TNtuples/src/classes.h +++ b/L1Trigger/L1TNtuples/src/classes.h @@ -20,6 +20,7 @@ #include "L1Trigger/L1TNtuples/interface/L1AnalysisL1MenuDataFormat.h" #include "L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h" #include "L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h" +#include "L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h" #include "L1Trigger/L1TNtuples/interface/L1AnalysisL1CaloTowerDataFormat.h" #include "L1Trigger/L1TNtuples/interface/L1AnalysisL1CaloClusterDataFormat.h" #include "L1Trigger/L1TNtuples/interface/L1AnalysisBMTFInputsDataFormat.h" diff --git a/L1Trigger/L1TNtuples/src/classes_def.xml b/L1Trigger/L1TNtuples/src/classes_def.xml index 14cc04a2f5c59..2fd7d7bafa97f 100644 --- a/L1Trigger/L1TNtuples/src/classes_def.xml +++ b/L1Trigger/L1TNtuples/src/classes_def.xml @@ -21,6 +21,7 @@ + From 50a22a79b128e950b978c29eda5ac42950b8c7e8 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Thu, 21 Oct 2021 05:28:47 +0200 Subject: [PATCH 08/18] Add configurations --- .../python/l1UpgradeTfMuonShowerTree_cfi.py | 12 ++++++++++++ L1Trigger/L1TNtuples/python/l1UpgradeTree_cfi.py | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py diff --git a/L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py b/L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py new file mode 100644 index 0000000000000..b9b8d9484fe5b --- /dev/null +++ b/L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py @@ -0,0 +1,12 @@ +import FWCore.ParameterSet.Config as cms + +l1UpgradeTfMuonShowerTree = cms.EDAnalyzer( + "L1UpgradeTfMuonTreeProducer", + emtfMuonShowerToken = cms.untracked.InputTag("simEmtfShowers","EMTF"), + maxL1UpgradeTfMuonShower = cms.uint32(12), +) + +from Configuration.Eras.Modifier_stage1L1Trigger_cff import stage1L1Trigger +stage1L1Trigger.toModify( l1UpgradeTfMuonTree, + emtfMuonShowerToken = "none", +) diff --git a/L1Trigger/L1TNtuples/python/l1UpgradeTree_cfi.py b/L1Trigger/L1TNtuples/python/l1UpgradeTree_cfi.py index fe27c58e77711..78108c9acd771 100644 --- a/L1Trigger/L1TNtuples/python/l1UpgradeTree_cfi.py +++ b/L1Trigger/L1TNtuples/python/l1UpgradeTree_cfi.py @@ -6,6 +6,7 @@ tauTokens = cms.untracked.VInputTag(cms.InputTag("caloStage2Digis","Tau")), jetToken = cms.untracked.InputTag("caloStage2Digis","Jet"), muonToken = cms.untracked.InputTag("gmtStage2Digis","Muon"), + muonShowerToken = cms.untracked.InputTag("simGmtShowerDigis"), muonLegacyToken = cms.untracked.InputTag("muonLegacyInStage2FormatDigis","legacyMuon"), sumToken = cms.untracked.InputTag("caloStage2Digis","EtSum"), maxL1Upgrade = cms.uint32(60) @@ -17,6 +18,6 @@ tauTokens = cms.untracked.VInputTag("caloStage1FinalDigis:rlxTaus"), jetToken = "caloStage1FinalDigis", muonToken = "muonLegacyInStage2FormatDigis", + muonShowerToken = "", sumToken = "caloStage1FinalDigis", ) - From 529581f28f831e14da1339dd0c55254853041a11 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Fri, 22 Oct 2021 21:50:27 +0200 Subject: [PATCH 09/18] Add Bx for menu tools --- L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h | 2 ++ .../interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h | 2 ++ L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc | 1 + 3 files changed, 5 insertions(+) diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h index af33f6642a1da..7f01488b42283 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h @@ -126,6 +126,7 @@ namespace L1Analysis { muonBx.clear(); nMuonShowers = 0; + muonShowerBx.clear(); muonShowerOneNominal.clear(); muonShowerOneTight.clear(); muonShowerTwoLoose.clear(); @@ -217,6 +218,7 @@ namespace L1Analysis { std::vector muonBx; unsigned short int nMuonShowers; + std::vector muonShowerBx; std::vector muonShowerOneNominal; std::vector muonShowerOneTight; std::vector muonShowerTwoLoose; diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h index 04796c6c1c512..222b8a5084b7d 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h @@ -11,12 +11,14 @@ namespace L1Analysis { void Reset() { nTfMuonShowers = 0; + tfMuonShowerBx.clear(); tfMuonShowerOneNominal.clear(); tfMuonShowerOneTight.clear(); tfMuonShowerTwoLoose.clear(); } unsigned short int nTfMuonShowers; + std::vector tfMuonShowerBx; std::vector tfMuonShowerOneNominal; std::vector tfMuonShowerOneTight; std::vector tfMuonShowerTwoLoose; diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc index 7fdac626d1aea..856889ed46dee 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc @@ -127,6 +127,7 @@ void L1Analysis::L1AnalysisL1Upgrade::SetMuonShower(const edm::Handleend(ibx) && l1upgrade_.nMuonShowers < maxL1Upgrade; it++) { if (it->isValid()) { + l1upgrade_.muonShowerBx.push_back(ibx); l1upgrade_.muonShowerOneNominal.push_back(it->isOneNominalInTime()); l1upgrade_.muonShowerOneTight.push_back(it->isOneTightInTime()); l1upgrade_.muonShowerTwoLoose.push_back(it->isTwoLooseInTime()); From f44c73535a8cb35e67b031d187bada4a556b8a1a Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Tue, 26 Oct 2021 16:30:44 +0200 Subject: [PATCH 10/18] Put shower types behind an enum --- .../interface/L1AnalysisL1UpgradeDataFormat.h | 15 +++++++++------ .../interface/L1AnalysisL1UpgradeTfMuonShower.h | 2 +- .../L1AnalysisL1UpgradeTfMuonShowerDataFormat.h | 17 +++++++++++------ L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc | 13 ++++++++++--- .../src/L1AnalysisL1UpgradeTfMuonShower.cc | 14 +++++++++++--- 5 files changed, 42 insertions(+), 19 deletions(-) diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h index 7f01488b42283..369166a80e9b5 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h @@ -43,6 +43,13 @@ namespace L1Analysis { kAsymHtHF }; + enum MuonShowerType { + kInvalid, + kOneNominal, + kOneTight, + kTwoLoose + }; + struct L1AnalysisL1UpgradeDataFormat { L1AnalysisL1UpgradeDataFormat() { Reset(); }; ~L1AnalysisL1UpgradeDataFormat(){}; @@ -127,9 +134,7 @@ namespace L1Analysis { nMuonShowers = 0; muonShowerBx.clear(); - muonShowerOneNominal.clear(); - muonShowerOneTight.clear(); - muonShowerTwoLoose.clear(); + muonShowerType.clear(); nSums = 0; sumType.clear(); @@ -219,9 +224,7 @@ namespace L1Analysis { unsigned short int nMuonShowers; std::vector muonShowerBx; - std::vector muonShowerOneNominal; - std::vector muonShowerOneTight; - std::vector muonShowerTwoLoose; + std::vector muonShowerType; unsigned short int nSums; std::vector sumType; diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShower.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShower.h index b641a1ead3cf5..5f04e64a86909 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShower.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShower.h @@ -3,7 +3,7 @@ #include "DataFormats/L1TMuon/interface/RegionalMuonShower.h" -#include "L1AnalysisL1UpgradeTfMuonShowerDataFormat.h" +#include "L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h" namespace L1Analysis { class L1AnalysisL1UpgradeTfMuonShower { public: diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h index 222b8a5084b7d..ea54dcde15b23 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h @@ -5,23 +5,28 @@ #include namespace L1Analysis { + struct L1AnalysisL1UpgradeTfMuonShowerDataFormat { + + enum TfMuonShowerType { + kInvalid, + kOneNominal, + kOneTight, + kTwoLoose + }; + L1AnalysisL1UpgradeTfMuonShowerDataFormat() { Reset(); }; ~L1AnalysisL1UpgradeTfMuonShowerDataFormat(){}; void Reset() { nTfMuonShowers = 0; tfMuonShowerBx.clear(); - tfMuonShowerOneNominal.clear(); - tfMuonShowerOneTight.clear(); - tfMuonShowerTwoLoose.clear(); + tfMuonShowerType.clear(); } unsigned short int nTfMuonShowers; std::vector tfMuonShowerBx; - std::vector tfMuonShowerOneNominal; - std::vector tfMuonShowerOneTight; - std::vector tfMuonShowerTwoLoose; + std::vector tfMuonShowerType; }; } // namespace L1Analysis #endif diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc index 856889ed46dee..570181c4236fc 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc @@ -128,9 +128,16 @@ void L1Analysis::L1AnalysisL1Upgrade::SetMuonShower(const edm::HandleisValid()) { l1upgrade_.muonShowerBx.push_back(ibx); - l1upgrade_.muonShowerOneNominal.push_back(it->isOneNominalInTime()); - l1upgrade_.muonShowerOneTight.push_back(it->isOneTightInTime()); - l1upgrade_.muonShowerTwoLoose.push_back(it->isTwoLooseInTime()); + int type; + if (it->isOneNominalInTime()) + type = kOneNominal; + else if (it->isOneTightInTime()) + type = kOneTight; + else if (it->isTwoLooseInTime()) + type = kTwoLoose; + else + type = kInvalid; + l1upgrade_.muonShowerType.push_back(type); l1upgrade_.nMuonShowers++; } } diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc index af989ea03a474..736bd1cf1044a 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc @@ -11,9 +11,17 @@ void L1Analysis::L1AnalysisL1UpgradeTfMuonShower::SetTfMuonShower(const l1t::Reg it != muonShower.end(ibx) && l1upgradetfmuonshower_.nTfMuonShowers < maxL1UpgradeTfMuonShower; ++it) { if (it->isValid()) { - l1upgradetfmuonshower_.tfMuonShowerOneNominal.push_back(it->isOneNominalInTime()); - l1upgradetfmuonshower_.tfMuonShowerOneTight.push_back(it->isOneTightInTime()); - l1upgradetfmuonshower_.tfMuonShowerTwoLoose.push_back(it->isTwoLooseInTime()); + l1upgradetfmuonshower_.tfMuonShowerBx.push_back(ibx); + int type; + if (it->isOneNominalInTime()) + type = L1AnalysisL1UpgradeTfMuonShowerDataFormat::kOneNominal; + else if (it->isOneTightInTime()) + type = L1AnalysisL1UpgradeTfMuonShowerDataFormat::kOneTight; + else if (it->isTwoLooseInTime()) + type = L1AnalysisL1UpgradeTfMuonShowerDataFormat::kTwoLoose; + else + type = L1AnalysisL1UpgradeTfMuonShowerDataFormat::kInvalid; + l1upgradetfmuonshower_.tfMuonShowerType.push_back(type); l1upgradetfmuonshower_.nTfMuonShowers++; } } From a66a81c15a8748c8f170bf751d1ded23263255bb Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Thu, 28 Oct 2021 19:59:01 -0500 Subject: [PATCH 11/18] bugfixes --- DataFormats/L1TMuon/src/RegionalMuonShower.cc | 6 ++-- .../src/CSCAnodeLCTProcessor.cc | 14 ++++----- .../src/CSCCathodeLCTProcessor.cc | 13 ++++----- .../src/CSCMotherboard.cc | 10 +------ .../L1TMuon/plugins/L1TMuonShowerProducer.cc | 29 +++++-------------- .../src/SectorProcessorShower.cc | 27 ++++------------- 6 files changed, 26 insertions(+), 73 deletions(-) diff --git a/DataFormats/L1TMuon/src/RegionalMuonShower.cc b/DataFormats/L1TMuon/src/RegionalMuonShower.cc index eb050a035735c..ce73da8584331 100644 --- a/DataFormats/L1TMuon/src/RegionalMuonShower.cc +++ b/DataFormats/L1TMuon/src/RegionalMuonShower.cc @@ -19,12 +19,10 @@ l1t::RegionalMuonShower::RegionalMuonShower(bool oneNominalInTime, l1t::RegionalMuonShower::~RegionalMuonShower() {} bool l1t::RegionalMuonShower::isValid() const { - return (isOneNominalInTime_ or isTwoLooseInTime_ or isOneTightInTime_ or isOneNominalOutOfTime_ or - isTwoLooseOutOfTime_ or isOneTightOutOfTime_); + return (isOneNominalInTime_ or isTwoLooseInTime_ or isOneTightInTime_); } bool l1t::RegionalMuonShower::operator==(const l1t::RegionalMuonShower& rhs) const { return (isTwoLooseInTime_ == rhs.isTwoLooseInTime() and isOneNominalInTime_ == rhs.isOneNominalInTime() and - isOneNominalInTime_ == rhs.isOneNominalInTime() and isTwoLooseOutOfTime_ == rhs.isTwoLooseOutOfTime() and - isOneTightOutOfTime_ == rhs.isOneTightOutOfTime() and isOneTightOutOfTime_ == rhs.isOneTightOutOfTime()); + isOneTightInTime_ == rhs.isOneTightInTime()); } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index 408fcb7dc9419..05166b8607aa9 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -180,7 +180,6 @@ void CSCAnodeLCTProcessor::clear() { } lct_list.clear(); inTimeHMT_ = 0; - outTimeHMT_ = 0; } void CSCAnodeLCTProcessor::clear(const int wire, const int pattern) { @@ -1340,7 +1339,6 @@ void CSCAnodeLCTProcessor::setWireContainer(CSCALCTDigi& alct, CSCALCTDigi::Wire void CSCAnodeLCTProcessor::encodeHighMultiplicityBits( const std::vector wires[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) { inTimeHMT_ = 0; - outTimeHMT_ = 0; auto layerTime = [=](unsigned time) { return time == CSCConstants::LCT_CENTRAL_BX; }; @@ -1349,36 +1347,37 @@ void CSCAnodeLCTProcessor::encodeHighMultiplicityBits( for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { bool atLeastOneWGHit = false; for (int i_wire = 0; i_wire < CSCConstants::MAX_NUM_WIREGROUPS; i_wire++) { + // there is at least one wiregroup... if (!wires[i_layer][i_wire].empty()) { auto times = wires[i_layer][i_wire]; int nLayerTime = std::count_if(times.begin(), times.end(), layerTime); + // ...for which at least one time bin was on for the central BX if (nLayerTime > 0) { atLeastOneWGHit = true; break; } } } + // add this layer to the number of layers hit if (atLeastOneWGHit) { nLayersWithHits++; } } + // require at least nLayersWithHits for the central time bin // do nothing if there are not enough layers with hits if (nLayersWithHits < minLayersCentralTBin_) return; // functions for in-time and out-of-time auto inTime = [=](unsigned time) { return time >= showerMinInTBin_ and time <= showerMaxInTBin_; }; - auto outTime = [=](unsigned time) { return time >= showerMinOutTBin_ and time <= showerMaxOutTBin_; }; // count the wires in-time and out-time unsigned hitsInTime = 0; - unsigned hitsOutTime = 0; for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { for (int i_wire = 0; i_wire < CSCConstants::MAX_NUM_WIREGROUPS; i_wire++) { auto times = wires[i_layer][i_wire]; hitsInTime += std::count_if(times.begin(), times.end(), inTime); - hitsOutTime += std::count_if(times.begin(), times.end(), outTime); } } @@ -1395,11 +1394,8 @@ void CSCAnodeLCTProcessor::encodeHighMultiplicityBits( if (hitsInTime >= station_thresholds[i]) { inTimeHMT_ = i + 1; } - if (hitsOutTime >= station_thresholds[i]) { - outTimeHMT_ = i + 1; - } } // create a new object - shower_ = CSCShowerDigi(inTimeHMT_, outTimeHMT_, theTrigChamber); + shower_ = CSCShowerDigi(inTimeHMT_, false, theTrigChamber); } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc index 0379834f89838..63175d7d524dd 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc @@ -178,7 +178,6 @@ void CSCCathodeLCTProcessor::clear() { secondCLCT[bx].clear(); } inTimeHMT_ = 0; - outTimeHMT_ = 0; } std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiCollection* compdc) { @@ -1174,7 +1173,6 @@ CSCCLCTDigi CSCCathodeLCTProcessor::getSecondCLCT(int bx) const { void CSCCathodeLCTProcessor::encodeHighMultiplicityBits( const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) { inTimeHMT_ = 0; - outTimeHMT_ = 0; auto layerTime = [=](unsigned time) { return time == CSCConstants::CLCT_CENTRAL_BX; }; // Calculate layers with hits @@ -1182,27 +1180,30 @@ void CSCCathodeLCTProcessor::encodeHighMultiplicityBits( for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { bool atLeastOneWGHit = false; for (int i_hstrip = 0; i_hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; i_hstrip++) { + // there is at least one halfstrip... if (!halfstrip[i_layer][i_hstrip].empty()) { auto times = halfstrip[i_layer][i_hstrip]; int nLayerTime = std::count_if(times.begin(), times.end(), layerTime); + // ...for which at least one time bin was on for the central BX if (nLayerTime > 0) { atLeastOneWGHit = true; break; } } } + // add this layer to the number of layers hit if (atLeastOneWGHit) { nLayersWithHits++; } } + // require at least nLayersWithHits for the central time bin // do nothing if there are not enough layers with hits if (nLayersWithHits < minLayersCentralTBin_) return; // functions for in-time and out-of-time auto inTime = [=](unsigned time) { return time >= showerMinInTBin_ and time <= showerMaxInTBin_; }; - auto outTime = [=](unsigned time) { return time >= showerMinOutTBin_ and time <= showerMaxOutTBin_; }; // count the half-strips in-time and out-time unsigned hitsInTime = 0; @@ -1211,7 +1212,6 @@ void CSCCathodeLCTProcessor::encodeHighMultiplicityBits( for (int i_hstrip = 0; i_hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; i_hstrip++) { auto times = halfstrip[i_layer][i_hstrip]; hitsInTime += std::count_if(times.begin(), times.end(), inTime); - hitsOutTime += std::count_if(times.begin(), times.end(), outTime); } } @@ -1228,12 +1228,9 @@ void CSCCathodeLCTProcessor::encodeHighMultiplicityBits( if (hitsInTime >= station_thresholds[i]) { inTimeHMT_ = i + 1; } - if (hitsOutTime >= station_thresholds[i]) { - outTimeHMT_ = i + 1; - } } // no shower object is created here. that is done at a later stage - // in the motherboar, where potentially the trigger decisions from + // in the motherboard, where the trigger decisions from // anode hit counters and cathode hit counters are combined } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc index 8a3b58ab235c6..7821e8cea4525 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc @@ -550,38 +550,30 @@ void CSCMotherboard::encodeHighMultiplicityBits() { // get the high multiplicity // for anode this reflects what is already in the anode CSCShowerDigi object unsigned cathodeInTime = clctProc->getInTimeHMT(); - unsigned cathodeOutTime = clctProc->getOutTimeHMT(); unsigned anodeInTime = alctProc->getInTimeHMT(); - unsigned anodeOutTime = alctProc->getOutTimeHMT(); // assign the bits unsigned inTimeHMT_; - unsigned outTimeHMT_; // set the value according to source switch (showerSource_) { case 0: inTimeHMT_ = cathodeInTime; - outTimeHMT_ = cathodeOutTime; break; case 1: inTimeHMT_ = anodeInTime; - outTimeHMT_ = anodeOutTime; break; case 2: inTimeHMT_ = anodeInTime | cathodeInTime; - outTimeHMT_ = anodeOutTime | cathodeOutTime; break; case 3: inTimeHMT_ = anodeInTime & cathodeInTime; - outTimeHMT_ = anodeOutTime & cathodeOutTime; break; default: inTimeHMT_ = cathodeInTime; - outTimeHMT_ = cathodeOutTime; break; }; // create a new object - shower_ = CSCShowerDigi(inTimeHMT_, outTimeHMT_, theTrigChamber); + shower_ = CSCShowerDigi(inTimeHMT_, false, theTrigChamber); } diff --git a/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc b/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc index 8865688a9846b..4aacf4d31d299 100644 --- a/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc +++ b/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc @@ -56,46 +56,34 @@ void L1TMuonShowerProducer::produce(edm::Event& iEvent, const edm::EventSetup& i /* Check each sector for a valid EMTF shower. A valid EMTF shower - can either be in-time or out-of-time. The minimal implementation - only considers the "at least 1-nominal shower" case. + for startup Run-3 can either be "one nominal shower" or "one tight shower". + The case "two loose showers" is under consideration but needs more study. + Showers that arrive out-of-time are also under consideration, but are not + going be to enabled at startup Run-3. So all showers should be in-time. */ bool isOneNominalInTime = false; - bool isOneNominalOutOfTime = false; bool isTwoLooseInTime = false; - bool isTwoLooseOutOfTime = false; bool isOneTightInTime = false; - bool isOneTightOutOfTime = false; for (size_t i = 0; i < emtfShowers->size(0); ++i) { auto shower = emtfShowers->at(0, i); if (shower.isValid()) { // nominal if (shower.isOneNominalInTime()) isOneNominalInTime = true; - if (shower.isOneNominalOutOfTime()) - isOneNominalOutOfTime = true; // two loose if (shower.isTwoLooseInTime()) isTwoLooseInTime = true; - if (shower.isTwoLooseOutOfTime()) - isTwoLooseOutOfTime = true; // tight if (shower.isOneTightInTime()) isOneTightInTime = true; - if (shower.isOneTightOutOfTime()) - isOneTightOutOfTime = true; } } // Check for at least one nominal shower - const bool acceptCondition(isOneNominalInTime or isOneNominalOutOfTime or isTwoLooseInTime or isTwoLooseOutOfTime or - isOneNominalInTime or isOneNominalOutOfTime); + const bool acceptCondition(isOneNominalInTime or isTwoLooseInTime or isOneTightInTime); + if (acceptCondition) { - MuonShower outShower(isOneNominalInTime, - isOneNominalOutOfTime, - isTwoLooseInTime, - isTwoLooseOutOfTime, - isOneTightInTime, - isOneTightOutOfTime); + MuonShower outShower(isOneNominalInTime, false, isTwoLooseInTime, false, isOneTightInTime, false); outShowers->push_back(0, outShower); } iEvent.put(std::move(outShowers)); @@ -107,9 +95,6 @@ void L1TMuonShowerProducer::fillDescriptions(edm::ConfigurationDescriptions& des desc.add("showerInput", edm::InputTag("simEmtfShowers", "EMTF")); desc.add("bxMin", 0); desc.add("bxMax", 0); - desc.add("minNominalShowers", 1); - desc.add("minTightShowers", 1); - desc.add("minTwoLooseShowers", 0); descriptions.add("simGmtShowerDigisDef", desc); } diff --git a/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc index 3c78a7b577cbb..1a2cc925cd066 100644 --- a/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc +++ b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc @@ -10,10 +10,10 @@ void SectorProcessorShower::configure(const edm::ParameterSet& pset, int endcap, enableTwoLooseShowers_ = pset.getParameter("enableTwoLooseShowers"); enableOneNominalShower_ = pset.getParameter("enableOneNominalShowers"); - enableOneNominalShower_ = pset.getParameter("enableOneNominalShowers"); + enableOneTightShower_ = pset.getParameter("enableOneTightShowers"); nLooseShowers_ = pset.getParameter("nLooseShowers"); nNominalShowers_ = pset.getParameter("nNominalShowers"); - nNominalShowers_ = pset.getParameter("nNominalShowers"); + nTightShowers_ = pset.getParameter("nTightShowers"); } void SectorProcessorShower::process(const CSCShowerDigiCollection& in_showers, @@ -51,36 +51,21 @@ void SectorProcessorShower::process(const CSCShowerDigiCollection& in_showers, selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isNominalInTime(); })); const unsigned nTightInTime(std::count_if( selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isTightInTime(); })); - const unsigned nLooseOutOfTime(std::count_if( - selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isLooseOutOfTime(); })); - const unsigned nNominalOutOfTime(std::count_if( - selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isNominalOutOfTime(); })); - const unsigned nTightOutOfTime(std::count_if( - selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isTightOutOfTime(); })); const bool hasTwoLooseInTime(nLooseInTime >= nLooseShowers_); const bool hasOneNominalInTime(nNominalInTime >= nNominalShowers_); const bool hasOneTightInTime(nTightInTime >= nTightShowers_); - const bool hasTwoLooseOutOfTime(nLooseOutOfTime >= nLooseShowers_); - const bool hasOneNominalOutOfTime(nNominalOutOfTime >= nNominalShowers_); - const bool hasOneTightOutOfTime(nTightOutOfTime >= nTightShowers_); - - const bool acceptLoose(enableTwoLooseShowers_ and (hasTwoLooseInTime or hasTwoLooseOutOfTime)); - const bool acceptNominal(enableOneNominalShower_ and (hasOneNominalInTime or hasOneNominalOutOfTime)); - const bool acceptTight(enableOneTightShower_ and (hasOneTightInTime or hasOneTightOutOfTime)); + const bool acceptLoose(enableTwoLooseShowers_ and hasTwoLooseInTime); + const bool acceptNominal(enableOneNominalShower_ and hasOneNominalInTime); + const bool acceptTight(enableOneTightShower_ and hasOneTightInTime); // trigger condition const bool accept(acceptLoose or acceptNominal or acceptTight); if (accept) { // shower output - l1t::RegionalMuonShower out_shower(hasOneNominalInTime, - hasOneNominalOutOfTime, - hasTwoLooseInTime, - hasTwoLooseOutOfTime, - hasOneTightInTime, - hasOneTightOutOfTime); + l1t::RegionalMuonShower out_shower(hasOneNominalInTime, false, hasTwoLooseInTime, false, hasOneTightInTime, false); // convert [1,2] to [1, -1] const int endcap(endcap_ == 1 ? 1 : -1); out_shower.setEndcap(endcap); From 7bc7bbb8999f4b93075d704ed45474d31a664d99 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 3 Nov 2021 10:58:05 -0500 Subject: [PATCH 12/18] add showers to configuration --- L1Trigger/L1TNtuples/python/L1NtupleEMU_cff.py | 1 + 1 file changed, 1 insertion(+) diff --git a/L1Trigger/L1TNtuples/python/L1NtupleEMU_cff.py b/L1Trigger/L1TNtuples/python/L1NtupleEMU_cff.py index 91adaa1b0b6ab..e307e3b5331a5 100644 --- a/L1Trigger/L1TNtuples/python/L1NtupleEMU_cff.py +++ b/L1Trigger/L1TNtuples/python/L1NtupleEMU_cff.py @@ -3,6 +3,7 @@ from L1Trigger.L1TNtuples.l1CaloTowerTree_cfi import * from L1Trigger.L1TNtuples.l1UpgradeTfMuonTree_cfi import * +from L1Trigger.L1TNtuples.l1UpgradeTfMuonShowerTree_cfi import * from L1Trigger.L1TNtuples.l1UpgradeTree_cfi import * from L1Trigger.L1TNtuples.l1EventTree_cfi import * from L1Trigger.L1TNtuples.l1uGTTree_cfi import * From 0c28186ccbea239e7d82c00558be04394d1ecc8e Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 3 Nov 2021 10:59:18 -0500 Subject: [PATCH 13/18] add showers to configuration --- L1Trigger/L1TNtuples/python/L1NtupleRAW_cff.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/L1Trigger/L1TNtuples/python/L1NtupleRAW_cff.py b/L1Trigger/L1TNtuples/python/L1NtupleRAW_cff.py index a9767de62b269..0645ef37fcd36 100644 --- a/L1Trigger/L1TNtuples/python/L1NtupleRAW_cff.py +++ b/L1Trigger/L1TNtuples/python/L1NtupleRAW_cff.py @@ -4,26 +4,28 @@ from L1Trigger.L1TNtuples.l1ExtraTree_cfi import * from L1Trigger.L1TNtuples.l1CaloTowerTree_cfi import * from L1Trigger.L1TNtuples.l1UpgradeTfMuonTree_cfi import * +from L1Trigger.L1TNtuples.l1UpgradeTfMuonShowerTree_cfi import * from L1Trigger.L1TNtuples.l1UpgradeTree_cfi import * from L1Trigger.L1TNtuples.l1uGTTree_cfi import * from L1Trigger.L1TNtuples.l1HOTree_cfi import * # we don't have omtfDigis yet, use unpacked input payloads of GMT -l1UpgradeTfMuonTree.omtfMuonToken = cms.untracked.InputTag("gmtStage2Digis","OMTF") +l1UpgradeTfMuonTree.omtfMuonToken = cms.untracked.InputTag("gmtStage2Digis","OMTF") # we don't have emtfDigis yet, use unpacked input payloads of GMT -l1UpgradeTfMuonTree.emtfMuonToken = cms.untracked.InputTag("gmtStage2Digis","EMTF") +l1UpgradeTfMuonTree.emtfMuonToken = cms.untracked.InputTag("gmtStage2Digis","EMTF") L1NtupleRAW = cms.Sequence( l1EventTree #+l1ExtraTree +l1CaloTowerTree +l1UpgradeTfMuonTree + +l1UpgradeTfMuonShowerTree +l1UpgradeTree +l1uGTTree +l1HOTree ) -# do not have l1t::CaloTowerBxCollection in Stage1 +# do not have l1t::CaloTowerBxCollection in Stage1 from Configuration.Eras.Modifier_stage1L1Trigger_cff import stage1L1Trigger _stage1_L1NTupleRAW = L1NtupleRAW.copyAndExclude([l1CaloTowerTree,l1UpgradeTfMuonTree]) stage1L1Trigger.toReplaceWith(L1NtupleRAW,_stage1_L1NTupleRAW) From 21bce9e01217e6121926b050a23196d31502d3a4 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 3 Nov 2021 11:07:44 -0500 Subject: [PATCH 14/18] update --- L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h | 2 +- .../interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h index 369166a80e9b5..9ca58cc8920b6 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h @@ -44,7 +44,7 @@ namespace L1Analysis { }; enum MuonShowerType { - kInvalid, + kInvalid = 0, kOneNominal, kOneTight, kTwoLoose diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h index ea54dcde15b23..25d296bc1a0a5 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h @@ -9,7 +9,7 @@ namespace L1Analysis { struct L1AnalysisL1UpgradeTfMuonShowerDataFormat { enum TfMuonShowerType { - kInvalid, + kInvalid = 0, kOneNominal, kOneTight, kTwoLoose From 0ad5cc8887667d4dba14e27da3b05455d5d4d4ef Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 3 Nov 2021 18:58:02 -0500 Subject: [PATCH 15/18] bugfix --- L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py b/L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py index b9b8d9484fe5b..42f53759d33f3 100644 --- a/L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py +++ b/L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py @@ -7,6 +7,6 @@ ) from Configuration.Eras.Modifier_stage1L1Trigger_cff import stage1L1Trigger -stage1L1Trigger.toModify( l1UpgradeTfMuonTree, +stage1L1Trigger.toModify( l1UpgradeTfMuonShowerTree, emtfMuonShowerToken = "none", ) From 9b8ef63e59ff3b19ce87d6861b4b273f7702a947 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 3 Nov 2021 21:33:07 -0500 Subject: [PATCH 16/18] bugfix --- L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py b/L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py index b9b8d9484fe5b..b5e7806c46498 100644 --- a/L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py +++ b/L1Trigger/L1TNtuples/python/l1UpgradeTfMuonShowerTree_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms l1UpgradeTfMuonShowerTree = cms.EDAnalyzer( - "L1UpgradeTfMuonTreeProducer", + "L1UpgradeTfMuonShowerTreeProducer", emtfMuonShowerToken = cms.untracked.InputTag("simEmtfShowers","EMTF"), maxL1UpgradeTfMuonShower = cms.uint32(12), ) From aefeb23b98ee49bac5adedf61a9739f47d022fe4 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Thu, 4 Nov 2021 12:03:24 -0500 Subject: [PATCH 17/18] remove enums. put everything in vectors --- .../interface/L1AnalysisL1UpgradeDataFormat.h | 15 ++++++--------- ...1AnalysisL1UpgradeTfMuonShowerDataFormat.h | 19 ++++++++++--------- .../L1TNtuples/src/L1AnalysisL1Upgrade.cc | 13 +++---------- .../src/L1AnalysisL1UpgradeTfMuonShower.cc | 15 +++++---------- 4 files changed, 24 insertions(+), 38 deletions(-) diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h index 9ca58cc8920b6..7f01488b42283 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h @@ -43,13 +43,6 @@ namespace L1Analysis { kAsymHtHF }; - enum MuonShowerType { - kInvalid = 0, - kOneNominal, - kOneTight, - kTwoLoose - }; - struct L1AnalysisL1UpgradeDataFormat { L1AnalysisL1UpgradeDataFormat() { Reset(); }; ~L1AnalysisL1UpgradeDataFormat(){}; @@ -134,7 +127,9 @@ namespace L1Analysis { nMuonShowers = 0; muonShowerBx.clear(); - muonShowerType.clear(); + muonShowerOneNominal.clear(); + muonShowerOneTight.clear(); + muonShowerTwoLoose.clear(); nSums = 0; sumType.clear(); @@ -224,7 +219,9 @@ namespace L1Analysis { unsigned short int nMuonShowers; std::vector muonShowerBx; - std::vector muonShowerType; + std::vector muonShowerOneNominal; + std::vector muonShowerOneTight; + std::vector muonShowerTwoLoose; unsigned short int nSums; std::vector sumType; diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h index 25d296bc1a0a5..b129049d828eb 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonShowerDataFormat.h @@ -8,25 +8,26 @@ namespace L1Analysis { struct L1AnalysisL1UpgradeTfMuonShowerDataFormat { - enum TfMuonShowerType { - kInvalid = 0, - kOneNominal, - kOneTight, - kTwoLoose - }; - L1AnalysisL1UpgradeTfMuonShowerDataFormat() { Reset(); }; ~L1AnalysisL1UpgradeTfMuonShowerDataFormat(){}; void Reset() { nTfMuonShowers = 0; tfMuonShowerBx.clear(); - tfMuonShowerType.clear(); + tfMuonShowerOneNominal.clear(); + tfMuonShowerOneTight.clear(); + tfMuonShowerTwoLoose.clear(); + tfMuonShowerEndcap.clear(); + tfMuonShowerSector.clear(); } unsigned short int nTfMuonShowers; std::vector tfMuonShowerBx; - std::vector tfMuonShowerType; + std::vector tfMuonShowerOneNominal; + std::vector tfMuonShowerOneTight; + std::vector tfMuonShowerTwoLoose; + std::vector tfMuonShowerEndcap; + std::vector tfMuonShowerSector; }; } // namespace L1Analysis #endif diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc index 570181c4236fc..856889ed46dee 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc @@ -128,16 +128,9 @@ void L1Analysis::L1AnalysisL1Upgrade::SetMuonShower(const edm::HandleisValid()) { l1upgrade_.muonShowerBx.push_back(ibx); - int type; - if (it->isOneNominalInTime()) - type = kOneNominal; - else if (it->isOneTightInTime()) - type = kOneTight; - else if (it->isTwoLooseInTime()) - type = kTwoLoose; - else - type = kInvalid; - l1upgrade_.muonShowerType.push_back(type); + l1upgrade_.muonShowerOneNominal.push_back(it->isOneNominalInTime()); + l1upgrade_.muonShowerOneTight.push_back(it->isOneTightInTime()); + l1upgrade_.muonShowerTwoLoose.push_back(it->isTwoLooseInTime()); l1upgrade_.nMuonShowers++; } } diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc index 736bd1cf1044a..9c9e4e6c5d5dc 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc @@ -12,16 +12,11 @@ void L1Analysis::L1AnalysisL1UpgradeTfMuonShower::SetTfMuonShower(const l1t::Reg ++it) { if (it->isValid()) { l1upgradetfmuonshower_.tfMuonShowerBx.push_back(ibx); - int type; - if (it->isOneNominalInTime()) - type = L1AnalysisL1UpgradeTfMuonShowerDataFormat::kOneNominal; - else if (it->isOneTightInTime()) - type = L1AnalysisL1UpgradeTfMuonShowerDataFormat::kOneTight; - else if (it->isTwoLooseInTime()) - type = L1AnalysisL1UpgradeTfMuonShowerDataFormat::kTwoLoose; - else - type = L1AnalysisL1UpgradeTfMuonShowerDataFormat::kInvalid; - l1upgradetfmuonshower_.tfMuonShowerType.push_back(type); + l1upgradetfmuonshower_.tfMuonShowerEndcap.push_back(it->endcap()); + l1upgradetfmuonshower_.tfMuonShowerSector.push_back(it->sector()); + l1upgradetfmuonshower_.tfMuonShowerOneNominal.push_back(it->isOneNominalInTime()); + l1upgradetfmuonshower_.tfMuonShowerOneTight.push_back(it->isOneTightInTime()); + l1upgradetfmuonshower_.tfMuonShowerTwoLoose.push_back(it->isTwoLooseInTime()); l1upgradetfmuonshower_.nTfMuonShowers++; } } From 8c8998dc86d181e0af935754ed943cf030009e83 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Thu, 11 Nov 2021 12:50:25 -0600 Subject: [PATCH 18/18] Enable muon shower trigger in configuration --- L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py b/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py index e5075fc562568..0880d2b295d3f 100644 --- a/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py +++ b/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py @@ -22,4 +22,4 @@ from Configuration.Eras.Modifier_run3_common_cff import run3_common run3_common.toModify(simGtStage2Digis, - useMuonShowers = False) + useMuonShowers = cms.bool(True))