Skip to content

Commit

Permalink
Merge pull request #35627 from dinyar/hadronic_shower_unpacker-12_1_X…
Browse files Browse the repository at this point in the history
…-dev

(Un)packers for hadronic showers at the uGMT input and output
  • Loading branch information
cmsbuild authored Dec 9, 2021
2 parents 8edb9a5 + 52fd601 commit a45ef05
Show file tree
Hide file tree
Showing 25 changed files with 461 additions and 149 deletions.
4 changes: 2 additions & 2 deletions DQM/L1TMonitor/src/L1TStage2Shower.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ void L1TStage2Shower::analyze(const edm::Event& e, const edm::EventSetup& c) {
if (not Shower.isValid())
continue;
if (Shower.isOneNominalInTime() or Shower.isTwoLooseInTime() or Shower.isOneTightInTime()) {
int endcap = Shower.endcap();
int sector = Shower.sector();
int endcap = Shower.trackFinderType() == l1t::tftype::emtf_pos ? 1 : -1;
int sector = Shower.processor() + 1;
if (Shower.isOneTightInTime())
emtfShowerTypeOccupancy->Fill(sector, (endcap == 1) ? 7.5 : 0.5);
if (Shower.isTwoLooseInTime())
Expand Down
19 changes: 11 additions & 8 deletions DataFormats/L1TMuon/interface/RegionalMuonShower.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "DataFormats/L1Trigger/interface/BXVector.h"
#include "DataFormats/L1Trigger/interface/L1TObjComparison.h"

#include "RegionalMuonCandFwd.h" // For tftype.

namespace l1t {

class RegionalMuonShower;
Expand All @@ -31,9 +33,8 @@ namespace l1t {
void setTwoLooseOutOfTime(const bool bit) { isTwoLooseOutOfTime_ = bit; }
void setTwoLooseInTime(const bool bit) { isTwoLooseInTime_ = bit; }

void setEndcap(const int endcap) { endcap_ = endcap; }
void setSector(const unsigned sector) { sector_ = sector; }
void setLink(const int link) { link_ = link; };
/// Set the processor ID, track-finder type. From these two, the link is set
void setTFIdentifiers(int processor, tftype trackFinder);

bool isValid() const;
bool isOneNominalInTime() const { return isOneNominalInTime_; }
Expand All @@ -43,10 +44,12 @@ namespace l1t {
bool isTwoLooseInTime() const { return isTwoLooseInTime_; }
bool isTwoLooseOutOfTime() const { return isTwoLooseOutOfTime_; }

int endcap() const { return endcap_; }
int sector() const { return sector_; }
/// Get link on which the MicroGMT receives the candidate
int link() const { return link_; }
const int link() const { return link_; };
/// Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF)
const int processor() const { return processor_; };
/// Get track-finder which found the muon (bmtf, emtf_pos/emtf_neg or omtf_pos/omtf_neg)
const tftype trackFinderType() const { return trackFinder_; };

bool operator==(const l1t::RegionalMuonShower& rhs) const;
inline bool operator!=(const l1t::RegionalMuonShower& rhs) const { return !(operator==(rhs)); };
Expand All @@ -60,9 +63,9 @@ namespace l1t {
bool isOneTightOutOfTime_;
bool isTwoLooseInTime_;
bool isTwoLooseOutOfTime_;
int endcap_; // +/-1. For ME+ and ME-.
unsigned sector_; // 1 - 6.
int link_;
int processor_;
tftype trackFinder_;
};

} // namespace l1t
Expand Down
27 changes: 24 additions & 3 deletions DataFormats/L1TMuon/src/RegionalMuonShower.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,33 @@ l1t::RegionalMuonShower::RegionalMuonShower(bool oneNominalInTime,
isOneTightOutOfTime_(oneTightOutOfTime),
isTwoLooseInTime_(twoLooseInTime),
isTwoLooseOutOfTime_(twoLooseOutOfTime),
endcap_(0),
sector_(0),
link_(0) {}
link_(0),
processor_(0) {}

l1t::RegionalMuonShower::~RegionalMuonShower() {}

void l1t::RegionalMuonShower::setTFIdentifiers(int processor, tftype trackFinder) {
trackFinder_ = trackFinder;
processor_ = processor;

switch (trackFinder_) {
case tftype::emtf_pos:
link_ = processor_ + 36; // range 36...41
break;
case tftype::omtf_pos:
link_ = processor_ + 42; // range 42...47
break;
case tftype::bmtf:
link_ = processor_ + 48; // range 48...59
break;
case tftype::omtf_neg:
link_ = processor_ + 60; // range 60...65
break;
case tftype::emtf_neg:
link_ = processor_ + 66; // range 66...71
}
}

bool l1t::RegionalMuonShower::isValid() const {
return (isOneNominalInTime_ or isTwoLooseInTime_ or isOneTightInTime_);
}
Expand Down
3 changes: 2 additions & 1 deletion DataFormats/L1TMuon/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<class name="l1t::RegionalMuonCandBxCollection"/>
<class name="edm::Wrapper<l1t::RegionalMuonCandBxCollection>"/>

<class name="l1t::RegionalMuonShower" ClassVersion="11">
<class name="l1t::RegionalMuonShower" ClassVersion="12">
<version ClassVersion="12" checksum="1591048325"/>
<version ClassVersion="11" checksum="376206249"/>
<version ClassVersion="10" checksum="3501434665"/>
</class>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "DataFormats/L1Trigger/interface/Jet.h"
#include "DataFormats/L1Trigger/interface/Tau.h"
#include "DataFormats/L1Trigger/interface/Muon.h"
#include "DataFormats/L1Trigger/interface/MuonShower.h"

#include "FWCore/Utilities/interface/EDGetToken.h"
#include "EventFilter/L1TRawToDigi/interface/PackerTokens.h"
Expand All @@ -19,13 +20,15 @@ namespace l1t {
inline const edm::EDGetTokenT<JetBxCollection>& getJetToken() const { return jetToken_; };
inline const edm::EDGetTokenT<TauBxCollection>& getTauToken() const { return tauToken_; };
inline const edm::EDGetTokenT<MuonBxCollection>& getMuonToken() const { return muonToken_; };
inline const edm::EDGetTokenT<MuonShowerBxCollection>& getMuonShowerToken() const { return muonShowerToken_; };

protected:
edm::EDGetTokenT<EGammaBxCollection> egammaToken_;
edm::EDGetTokenT<EtSumBxCollection> etSumToken_;
edm::EDGetTokenT<JetBxCollection> jetToken_;
edm::EDGetTokenT<TauBxCollection> tauToken_;
edm::EDGetTokenT<MuonBxCollection> muonToken_;
edm::EDGetTokenT<MuonShowerBxCollection> muonShowerToken_;
};
} // namespace stage2
} // namespace l1t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ namespace l1t {
event_.put(std::move(regionalMuonCandsOMTF_), "OMTF");
event_.put(std::move(regionalMuonCandsEMTF_), "EMTF");
event_.put(std::move(muons_[0]), "Muon");
for (int i = 1; i < 6; ++i) {
for (size_t i = 1; i < NUM_OUTPUT_COPIES; ++i) {
event_.put(std::move(muons_[i]), "MuonCopy" + std::to_string(i));
}
event_.put(std::move(imdMuonsBMTF_), "imdMuonsBMTF");
event_.put(std::move(imdMuonsEMTFNeg_), "imdMuonsEMTFNeg");
event_.put(std::move(imdMuonsEMTFPos_), "imdMuonsEMTFPos");
event_.put(std::move(imdMuonsOMTFNeg_), "imdMuonsOMTFNeg");
event_.put(std::move(imdMuonsOMTFPos_), "imdMuonsOMTFPos");

event_.put(std::move(regionalMuonShowersEMTF_), "EMTF");
event_.put(std::move(muonShowers_[0]), "MuonShower");
for (size_t i = 1; i < NUM_OUTPUT_COPIES; ++i) {
event_.put(std::move(muonShowers_[i]), "MuonShowerCopy" + std::to_string(i));
}
}
} // namespace stage2
} // namespace l1t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
#include "DataFormats/L1Trigger/interface/Muon.h"

#include "DataFormats/L1TMuon/interface/RegionalMuonShower.h"
#include "DataFormats/L1Trigger/interface/MuonShower.h"

#include "L1TObjectCollections.h"

#include <array>
Expand All @@ -27,10 +30,16 @@ namespace l1t {
imdMuonsEMTFNeg_(std::make_unique<MuonBxCollection>(0, oFirstBx, oLastBx)),
imdMuonsEMTFPos_(std::make_unique<MuonBxCollection>(0, oFirstBx, oLastBx)),
imdMuonsOMTFNeg_(std::make_unique<MuonBxCollection>(0, oFirstBx, oLastBx)),
imdMuonsOMTFPos_(std::make_unique<MuonBxCollection>(0, oFirstBx, oLastBx)) {
imdMuonsOMTFPos_(std::make_unique<MuonBxCollection>(0, oFirstBx, oLastBx)),

regionalMuonShowersEMTF_(std::make_unique<RegionalMuonShowerBxCollection>(0, iFirstBx, iLastBx)),
muonShowers_() {
std::generate(muons_.begin(), muons_.end(), [&oFirstBx, &oLastBx] {
return std::make_unique<MuonBxCollection>(0, oFirstBx, oLastBx);
});
std::generate(muonShowers_.begin(), muonShowers_.end(), [&oFirstBx, &oLastBx] {
return std::make_unique<MuonShowerBxCollection>(0, oFirstBx, oLastBx);
});
};

~GMTCollections() override;
Expand All @@ -45,6 +54,13 @@ namespace l1t {
inline MuonBxCollection* getImdMuonsOMTFNeg() { return imdMuonsOMTFNeg_.get(); };
inline MuonBxCollection* getImdMuonsOMTFPos() { return imdMuonsOMTFPos_.get(); };

inline RegionalMuonShowerBxCollection* getRegionalMuonShowersEMTF() { return regionalMuonShowersEMTF_.get(); };
inline MuonShowerBxCollection* getMuonShowers(const unsigned int copy) override {
return muonShowers_[copy].get();
};

static constexpr size_t NUM_OUTPUT_COPIES{6};

private:
std::unique_ptr<RegionalMuonCandBxCollection> regionalMuonCandsBMTF_;
std::unique_ptr<RegionalMuonCandBxCollection> regionalMuonCandsOMTF_;
Expand All @@ -55,6 +71,9 @@ namespace l1t {
std::unique_ptr<MuonBxCollection> imdMuonsEMTFPos_;
std::unique_ptr<MuonBxCollection> imdMuonsOMTFNeg_;
std::unique_ptr<MuonBxCollection> imdMuonsOMTFPos_;

std::unique_ptr<RegionalMuonShowerBxCollection> regionalMuonShowersEMTF_;
std::array<std::unique_ptr<MuonShowerBxCollection>, 6> muonShowers_;
};
} // namespace stage2
} // namespace l1t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#include "EventFilter/L1TRawToDigi/plugins/PackingSetupFactory.h"
#include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h"

#include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h"
#include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h"
#include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h"
#include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.h"
#include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/IntermediateMuonUnpacker.h"
#include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.h"
#include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/IntermediateMuonUnpacker.h"

#include "GMTSetup.h"

Expand All @@ -36,13 +36,18 @@ namespace l1t {
->setComment("uGMT intermediate muon from neg. OMTF side after first sorting stage");
desc.addOptional<edm::InputTag>("ImdInputLabelOMTFPos")
->setComment("uGMT intermediate muon from pos. OMTF side after first sorting stage");
desc.addOptional<edm::InputTag>("ShowerInputLabel")->setComment("for Run3");
desc.addOptional<edm::InputTag>("EMTFShowerInputLabel")->setComment("for Run3");
}

PackerMap GMTSetup::getPackers(int fed, unsigned int fw) {
PackerMap res;
if (fed == 1402) {
auto gmt_in_packer = static_pointer_cast<l1t::stage2::RegionalMuonGMTPacker>(
PackerFactory::get()->make("stage2::RegionalMuonGMTPacker"));
if (fw >= 0x7000000) {
gmt_in_packer->setUseEmtfShowers();
}
if (fw >= 0x6010000) {
gmt_in_packer->setUseEmtfDisplacementInfo();
}
Expand All @@ -68,14 +73,20 @@ namespace l1t {
prod.produces<RegionalMuonCandBxCollection>("OMTF");
prod.produces<RegionalMuonCandBxCollection>("EMTF");
prod.produces<MuonBxCollection>("Muon");
for (int i = 1; i < 6; ++i) {
for (size_t i = 1; i < GMTCollections::NUM_OUTPUT_COPIES; ++i) {
prod.produces<MuonBxCollection>("MuonCopy" + std::to_string(i));
}
prod.produces<MuonBxCollection>("imdMuonsBMTF");
prod.produces<MuonBxCollection>("imdMuonsEMTFNeg");
prod.produces<MuonBxCollection>("imdMuonsEMTFPos");
prod.produces<MuonBxCollection>("imdMuonsOMTFNeg");
prod.produces<MuonBxCollection>("imdMuonsOMTFPos");

prod.produces<RegionalMuonShowerBxCollection>("EMTF");
prod.produces<MuonShowerBxCollection>("MuonShower");
for (size_t i = 1; i < GMTCollections::NUM_OUTPUT_COPIES; ++i) {
prod.produces<MuonShowerBxCollection>("MuonShowerCopy" + std::to_string(i));
}
}

std::unique_ptr<UnpackerCollections> GMTSetup::getCollections(edm::Event& e) {
Expand All @@ -89,6 +100,9 @@ namespace l1t {
// input muons on links 36-71
auto gmt_in_unp = static_pointer_cast<l1t::stage2::RegionalMuonGMTUnpacker>(
UnpackerFactory::get()->make("stage2::RegionalMuonGMTUnpacker"));
if (fw >= 0x7000000) {
gmt_in_unp->setUseEmtfShowers();
}
if (fw >= 0x6010000) {
gmt_in_unp->setUseEmtfDisplacementInfo();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ namespace l1t {
imdMuonTokenEMTFPos_ = cc.consumes<MuonBxCollection>(imdEmtfPosTag);
imdMuonTokenOMTFNeg_ = cc.consumes<MuonBxCollection>(imdOmtfNegTag);
imdMuonTokenOMTFPos_ = cc.consumes<MuonBxCollection>(imdOmtfPosTag);

auto emtfShowerTag = cfg.getParameter<edm::InputTag>("EMTFShowerInputLabel");
auto showerTag = cfg.getParameter<edm::InputTag>("ShowerInputLabel");

regionalMuonShowerTokenEMTF_ = cc.consumes<RegionalMuonShowerBxCollection>(emtfShowerTag);
muonShowerToken_ = cc.consumes<MuonShowerBxCollection>(showerTag);
}
} // namespace stage2
} // namespace l1t
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define GMTTokens_h

#include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
#include "DataFormats/L1TMuon/interface/RegionalMuonShower.h"
#include "DataFormats/L1Trigger/interface/Muon.h"

#include "CommonTokens.h"
Expand All @@ -27,6 +28,10 @@ namespace l1t {
inline const edm::EDGetTokenT<MuonBxCollection>& getImdMuonTokenOMTFNeg() const { return imdMuonTokenOMTFNeg_; };
inline const edm::EDGetTokenT<MuonBxCollection>& getImdMuonTokenOMTFPos() const { return imdMuonTokenOMTFPos_; };

inline const edm::EDGetTokenT<RegionalMuonShowerBxCollection>& getRegionalMuonShowerTokenEMTF() const {
return regionalMuonShowerTokenEMTF_;
};

private:
edm::EDGetTokenT<RegionalMuonCandBxCollection> regionalMuonCandTokenBMTF_;
edm::EDGetTokenT<RegionalMuonCandBxCollection> regionalMuonCandTokenOMTF_;
Expand All @@ -36,6 +41,8 @@ namespace l1t {
edm::EDGetTokenT<MuonBxCollection> imdMuonTokenEMTFPos_;
edm::EDGetTokenT<MuonBxCollection> imdMuonTokenOMTFNeg_;
edm::EDGetTokenT<MuonBxCollection> imdMuonTokenOMTFPos_;

edm::EDGetTokenT<RegionalMuonShowerBxCollection> regionalMuonShowerTokenEMTF_;
};
} // namespace stage2
} // namespace l1t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "DataFormats/L1Trigger/interface/Jet.h"
#include "DataFormats/L1Trigger/interface/Tau.h"
#include "DataFormats/L1Trigger/interface/Muon.h"
#include "DataFormats/L1Trigger/interface/MuonShower.h"

#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"

Expand All @@ -19,6 +20,7 @@ namespace l1t {
~L1TObjectCollections() override;

virtual MuonBxCollection* getMuons(const unsigned int copy) { return nullptr; }
virtual MuonShowerBxCollection* getMuonShowers(const unsigned int copy) { return nullptr; }
virtual EGammaBxCollection* getEGammas(const unsigned int copy) { return nullptr; } //= 0;
virtual EtSumBxCollection* getEtSums(const unsigned int copy) { return nullptr; }
virtual JetBxCollection* getJets(const unsigned int copy) { return nullptr; }
Expand Down
Loading

0 comments on commit a45ef05

Please sign in to comment.