Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

EMTF muon shower unpacker update (backport of PR41993) #1146

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions DataFormats/L1TMuon/interface/EMTF/ME.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ namespace l1t {
eighth_strip(-99),
slope(-99),
run3_pattern(-99),
// Run 3 HMT data
hmv(-99),
hmt_inTime(-99),
hmt_outOfTime(-99),
// Run 3 muon shower data
musv(-99),
mus_inTime(-99),
mus_outOfTime(-99),
// metadata
stub_num(-99),
format_errors(0),
Expand Down Expand Up @@ -76,10 +76,10 @@ namespace l1t {
void set_eighth_strip(int bits) { eighth_strip = bits; }
void set_slope(int bits) { slope = bits; }
void set_run3_pattern(int bits) { run3_pattern = bits; }
// Run 3 HMT
void set_hmv(int bits) { hmv = bits; }
void set_hmt_inTime(int bits) { hmt_inTime = bits; }
void set_hmt_outOfTime(int bits) { hmt_outOfTime = bits; }
// Run 3 muon shower
void set_musv(int bits) { musv = bits; }
void set_mus_inTime(int bits) { mus_inTime = bits; }
void set_mus_outOfTime(int bits) { mus_outOfTime = bits; }
// meta data
void set_stub_num(int bits) { stub_num = bits; }
void add_format_error() { format_errors += 1; }
Expand Down Expand Up @@ -111,10 +111,10 @@ namespace l1t {
int Eighth_strip() const { return eighth_strip; }
int Slope() const { return slope; }
int Run3_pattern() const { return run3_pattern; }
// Run 3 HMT
int HMV() const { return hmv; }
int HMT_inTime() const { return hmt_inTime; }
int HMT_outOfTime() const { return hmt_outOfTime; }
// Run 3 muon shower
int MUSV() const { return musv; }
int MUS_inTime() const { return mus_inTime; }
int MUS_outOfTime() const { return mus_outOfTime; }
// metadata
int Stub_num() const { return stub_num; }
int Format_errors() const { return format_errors; }
Expand Down Expand Up @@ -147,10 +147,10 @@ namespace l1t {
int eighth_strip;
int slope;
int run3_pattern;
// Run 3 HMT
int hmv;
int hmt_inTime;
int hmt_outOfTime;
// Run 3 muon shower
int musv;
int mus_inTime;
int mus_outOfTime;
// metadata
int stub_num;
int format_errors;
Expand Down
8 changes: 4 additions & 4 deletions DataFormats/L1TMuon/interface/EMTF/SP.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace l1t {
quality_GMT(-99),
phi_GMT(-99),
bx(-99),
hmt(-99),
mus(-99),
mode(-99),
eta_GMT(-99),
pt_GMT(-99),
Expand Down Expand Up @@ -60,7 +60,7 @@ namespace l1t {
void set_quality_GMT(int bits) { quality_GMT = bits; }
void set_phi_GMT(int bits) { phi_GMT = bits; }
void set_bx(int bits) { bx = bits; }
void set_hmt(int bits) { hmt = bits; }
void set_mus(int bits) { mus = bits; }
void set_mode(int bits) { mode = bits; }
void set_eta_GMT(int bits) { eta_GMT = bits; }
void set_pt_GMT(int bits) { pt_GMT = bits; }
Expand Down Expand Up @@ -118,7 +118,7 @@ namespace l1t {
unsigned long Pt_LUT_addr() const { return pt_LUT_addr; }
int Format_errors() const { return format_errors; }
uint64_t Dataword() const { return dataword; }
int HMT() const { return hmt; }
int MUS() const { return mus; }

private:
int hl;
Expand All @@ -131,7 +131,7 @@ namespace l1t {
int quality_GMT;
int phi_GMT;
int bx;
int hmt;
int mus;
int mode;
int eta_GMT;
int pt_GMT;
Expand Down
79 changes: 47 additions & 32 deletions DataFormats/L1TMuon/interface/EMTFHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "DataFormats/MuonDetId/interface/ME0DetId.h"
#include "DataFormats/MuonDetId/interface/DTChamberId.h"
#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h"
#include "DataFormats/CSCDigi/interface/CSCShowerDigi.h"
#include "DataFormats/GEMDigi/interface/GEMPadDigiCluster.h"
#include "DataFormats/L1TMuon/interface/CPPFDigi.h"
#include "DataFormats/L1TMuon/interface/L1TMuonSubsystems.h"
Expand Down Expand Up @@ -49,10 +50,13 @@ namespace l1t {
strip(-99),
strip_hi(-99),
strip_low(-99),
strip_quart(-99), // Run 3
strip_eighth(-99), // Run 3
strip_quart_bit(-99), // Run 3
strip_eighth_bit(-99), // Run 3
strip_quart(-99), // Run 3
strip_eighth(-99), // Run 3
strip_quart_bit(-99), // Run 3
strip_eighth_bit(-99), // Run 3
muon_shower_valid(-99), // Run 3 muon shower
muon_shower_inTime(-99), // Run 3 muon shower
muon_shower_outOfTime(-99), // Run 3 muon shower
track_num(-99),
quality(-99),
pattern(-99),
Expand Down Expand Up @@ -95,6 +99,8 @@ namespace l1t {

// void ImportCSCCorrelatedLCTDigi (const CSCCorrelatedLCTDigi& _digi);
CSCCorrelatedLCTDigi CreateCSCCorrelatedLCTDigi(const bool isRun3) const;
// Run 3 muon shower
CSCShowerDigi CreateCSCShowerDigi() const;
// void ImportRPCDigi (const RPCDigi& _digi);
// RPCDigi CreateRPCDigi() const;
// void ImportCPPFDigi (const CPPFDigi& _digi);
Expand Down Expand Up @@ -154,10 +160,13 @@ namespace l1t {
void set_strip(int bits) { strip = bits; }
void set_strip_hi(int bits) { strip_hi = bits; }
void set_strip_low(int bits) { strip_low = bits; }
void set_strip_quart(int bits) { strip_quart = bits; } // Run 3
void set_strip_eighth(int bits) { strip_eighth = bits; } // Run 3
void set_strip_quart_bit(int bits) { strip_quart_bit = bits; } // Run 3
void set_strip_eighth_bit(int bits) { strip_eighth_bit = bits; } // Run 3
void set_strip_quart(int bits) { strip_quart = bits; } // Run 3
void set_strip_eighth(int bits) { strip_eighth = bits; } // Run 3
void set_strip_quart_bit(int bits) { strip_quart_bit = bits; } // Run 3
void set_strip_eighth_bit(int bits) { strip_eighth_bit = bits; } // Run 3
void set_muon_shower_valid(int bits) { muon_shower_valid = bits; } // Run 3 muon shower
void set_muon_shower_inTime(int bits) { muon_shower_inTime = bits; } // Run 3 muon shower
void set_muon_shower_outOfTime(int bits) { muon_shower_outOfTime = bits; } // Run 3 muon shower
void set_track_num(int bits) { track_num = bits; }
void set_quality(int bits) { quality = bits; }
void set_pattern(int bits) { pattern = bits; }
Expand Down Expand Up @@ -222,10 +231,13 @@ namespace l1t {
int Strip() const { return strip; }
int Strip_hi() const { return strip_hi; }
int Strip_low() const { return strip_low; }
int Strip_quart() const { return strip_quart; } // Run 3
int Strip_eighth() const { return strip_eighth; } // Run 3
int Strip_quart_bit() const { return strip_quart_bit; } // Run 3
int Strip_eighth_bit() const { return strip_eighth_bit; } // Run 3
int Strip_quart() const { return strip_quart; } // Run 3
int Strip_eighth() const { return strip_eighth; } // Run 3
int Strip_quart_bit() const { return strip_quart_bit; } // Run 3
int Strip_eighth_bit() const { return strip_eighth_bit; } // Run 3
int Muon_shower_valid() const { return muon_shower_valid; } // Run 3 muon shower
int Muon_shower_inTime() const { return muon_shower_inTime; } // Run 3 muon shower
int Muon_shower_outOfTime() const { return muon_shower_outOfTime; } // Run 3 muon shower
int Track_num() const { return track_num; }
int Quality() const { return quality; }
int Pattern() const { return pattern; }
Expand Down Expand Up @@ -313,26 +325,29 @@ namespace l1t {
int roll; ///< 1 - 3. For RPCs only, sub-division of ring. (Range? - AWB 02.03.17)
int neighbor; ///< 0 or 1. Filled in EMTFBlock(ME|GEM|RPC).cc
int mpc_link; ///< 1 - 3. Filled in EMTFHit.cc from CSCCorrelatedLCTDigi
int pc_sector; ///< 1 - 6. EMTF sector that received the LCT, even those sent from neighbor sectors.
int pc_station; ///< 0 - 5. 0 for ME1 subsector 1, 5 for neighbor hits.
int pc_chamber; ///< 0 - 8.
int pc_segment; ///< 0 - 3.
int wire; ///< 0 - 111 For CSCs only.
int strip; ///< 0 - 158 For CSCs only.
int strip_hi; ///< ? - ?. For RPCs only, highest strip in a cluster. (Range? - AWB 02.03.17)
int strip_low; ///< ? - ?. For RPCs only, lowest strip in a cluster. (Range? - AWB 02.03.17)
int strip_quart; ///< Run 3 CSC parameters
int strip_eighth; ///< Run 3 CSC parameters
int strip_quart_bit; ///< Run 3 CSC parameters
int strip_eighth_bit; ///< Run 3 CSC parameters
int track_num; ///< ? - ?. For CSCs only. (Range? - AWB 02.03.17)
int quality; ///< 0 - 15. For CSCs only.
int pattern; ///< 0 - 10. For CSCs only.
int pattern_run3; ///< Run 3 For CSC only.
int bend; ///< 0 or 1. For CSCs only.
int slope; ///< Run 3 For CSC only.
int valid; ///< 0 or 1. For CSCs only (for now; could use to flag failing clusters? - AWB 02.03.17)
int sync_err; ///< 0 or 1. For CSCs only.
int pc_sector; ///< 1 - 6. EMTF sector that received the LCT, even those sent from neighbor sectors.
int pc_station; ///< 0 - 5. 0 for ME1 subsector 1, 5 for neighbor hits.
int pc_chamber; ///< 0 - 8.
int pc_segment; ///< 0 - 3.
int wire; ///< 0 - 111 For CSCs only.
int strip; ///< 0 - 158 For CSCs only.
int strip_hi; ///< ? - ?. For RPCs only, highest strip in a cluster. (Range? - AWB 02.03.17)
int strip_low; ///< ? - ?. For RPCs only, lowest strip in a cluster. (Range? - AWB 02.03.17)
int strip_quart; ///< Run 3 CSC parameters
int strip_eighth; ///< Run 3 CSC parameters
int strip_quart_bit; ///< Run 3 CSC parameters
int strip_eighth_bit; ///< Run 3 CSC parameters
int muon_shower_valid; ///< Run 3 muon shower
int muon_shower_inTime; ///< Run 3 muon shower
int muon_shower_outOfTime; ///< Run 3 muon shower
int track_num; ///< ? - ?. For CSCs only. (Range? - AWB 02.03.17)
int quality; ///< 0 - 15. For CSCs only.
int pattern; ///< 0 - 10. For CSCs only.
int pattern_run3; ///< Run 3 For CSC only.
int bend; ///< 0 or 1. For CSCs only.
int slope; ///< Run 3 For CSC only.
int valid; ///< 0 or 1. For CSCs only (for now; could use to flag failing clusters? - AWB 02.03.17)
int sync_err; ///< 0 or 1. For CSCs only.
// GEM specific
int layer; ///< 0 - 1. For GEMs only, superchamber detector layer (1 or 2).
// END GEM specific
Expand Down
10 changes: 10 additions & 0 deletions DataFormats/L1TMuon/src/EMTFHit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ namespace l1t {
// trknmb and bx0 are unused in the EMTF emulator code. mpclink = 0 (after bx) indicates unsorted.
}

CSCShowerDigi EMTFHit::CreateCSCShowerDigi() const {
CSCShowerDigi shower = CSCShowerDigi(muon_shower_inTime == -99 ? 0 : muon_shower_inTime,
muon_shower_outOfTime == -99 ? 0 : muon_shower_outOfTime,
csc_ID,
bx + CSCConstants::LCT_CENTRAL_BX,
CSCShowerDigi::ShowerType::kEMTFShower);

return shower;
}

// // Not yet implemented - AWB 15.03.17
// RPCDigi EMTFHit::CreateRPCDigi() const {
// return RPCDigi( (strip_hi + strip_lo) / 2, bx + CSCConstants::LCT_CENTRAL_BX );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,18 +283,18 @@ namespace l1t {
ME_.set_clct_pattern(GetHexBits(MEd, 8, 11));
}

// Frame 1 has HMT related information
// Frame 1 has muon shower related information
if (ME_.Frame() == 1) {
// Run 3 pattern is unused for now. Needs to be combined with rest of the word in Frame 0 - EY 04.07.22
ME_.set_run3_pattern(GetHexBits(MEa, 0, 0));

// HMT[1] is in MEa, but HMT[0] is in MEb. These encode in time showers - EY 04.07.22
ME_.set_hmt_inTime(GetHexBits(MEb, 13, 13, MEa, 1, 1));
// MUS[1] is in MEa, but MUS[0] is in MEb. These encode in time showers - EY 04.07.22
ME_.set_mus_inTime(GetHexBits(MEb, 13, 13, MEa, 1, 1));

// HMT[3:2] encodes out-of-time showers which are not used for now
ME_.set_hmt_outOfTime(GetHexBits(MEa, 2, 3));
// MUS[3:2] encodes out-of-time showers which are not used for now
ME_.set_mus_outOfTime(GetHexBits(MEa, 2, 3));

ME_.set_hmv(GetHexBits(MEd, 7, 7));
ME_.set_musv(GetHexBits(MEd, 7, 7));
} else {
ME_.set_run3_pattern(GetHexBits(MEa, 0, 3));

Expand All @@ -307,13 +307,6 @@ namespace l1t {
// Fill the EMTFHit
ImportME(Hit_, ME_, (res->at(iOut)).PtrEventHeader()->Endcap(), (res->at(iOut)).PtrEventHeader()->Sector());

// Fill the CSCShowerDigi
CSCShowerDigi Shower_(ME_.HMT_inTime() == -99 ? 0 : ME_.HMT_inTime(),
ME_.HMT_outOfTime() == -99 ? 0 : ME_.HMT_outOfTime(),
Hit_.CSC_DetId(),
Hit_.BX(),
CSCShowerDigi::ShowerType::kEMTFShower);

// Set the stub number for this hit
// Each chamber can send up to 2 stubs per BX
ME_.set_stub_num(0);
Expand Down Expand Up @@ -353,14 +346,18 @@ namespace l1t {
<< Hit_.Chamber() << ", strip " << Hit_.Strip() << ", wire " << Hit_.Wire()
<< std::endl;

// Set the hit as invalid if quality == 0 (indicates muon shower)
if (Hit_.Quality() == 0)
Hit_.set_valid(0);

(res->at(iOut)).push_ME(ME_);
if (!exact_duplicate && Hit_.Valid() == 1)
res_hit->push_back(Hit_);
if (!exact_duplicate && !neighbor_duplicate &&
Hit_.Valid() == 1) // Don't write duplicate LCTs from adjacent sectors
res_LCT->insertDigi(Hit_.CSC_DetId(), Hit_.CreateCSCCorrelatedLCTDigi(isRun3));
if (ME_.HMV() == 1) { // Only write when HMT valid bit is set to 1
res_shower->insertDigi(Hit_.CSC_DetId(), Shower_);
if (Hit_.Muon_shower_valid() == 1) { // Only write when muon shower valid bit is set to 1
res_shower->insertDigi(Hit_.CSC_DetId(), Hit_.CreateCSCShowerDigi());
}
// Finished with unpacking one ME Data Record
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,14 @@ namespace l1t {

// FW version is computed as (Year - 2000)*2^9 + Month*2^5 + Day (see Block.cc and EMTFBlockTrailers.cc)
bool useNNBits_ = getAlgoVersion() >= 11098; // FW versions >= 26.10.2021
bool useHMTBits_ = getAlgoVersion() >= 11306; // FW versions >= 10.01.2022
bool useMUSBits_ = getAlgoVersion() >= 11306; // FW versions >= 10.01.2022
bool reducedDAQWindow =
(getAlgoVersion() >=
11656); // Firmware from 08.12.22 which is used as a flag for new reduced readout window - EY 01.03.23

static constexpr int nominalShower_ = 1;
static constexpr int tightShower_ = 3;
static constexpr int looseShower_ = 1;
static constexpr int nominalShower_ = 2;
static constexpr int tightShower_ = 4;

// Check Format of Payload
l1t::emtf::SP SP_;
Expand Down Expand Up @@ -235,15 +236,15 @@ namespace l1t {
SP_.set_phi_GMT(TwosCompl(8, GetHexBits(SP1b, 0, 7)));
SP_.set_quality_GMT(GetHexBits(SP1b, 8, 11));
SP_.set_bc0(GetHexBits(SP1b, 12, 12));
SP_.set_se(GetHexBits(SP1b, 13, 13));
SP_.set_vc(GetHexBits(SP1b, 14, 14));

SP_.set_eta_GMT(TwosCompl(9, GetHexBits(SP1c, 0, 8)));
SP_.set_mode(GetHexBits(SP1c, 9, 12));

if (useHMTBits_) {
SP_.set_hmt(GetHexBits(SP1c, 13, 14));
if (useMUSBits_) {
SP_.set_mus(GetHexBits(SP1b, 13, 13, SP1c, 13, 14));
} else {
SP_.set_se(GetHexBits(SP1b, 13, 13));
SP_.set_bx(GetHexBits(SP1c, 13, 14));
}

Expand Down Expand Up @@ -314,10 +315,11 @@ namespace l1t {
// Track_.set_GMT(mu_);

// Set Regional Muon Showers
if (useHMTBits_) {
if (useMUSBits_) {
muShower_.setTFIdentifiers(Track_.Sector() - 1, (Track_.Endcap() == 1) ? emtf_pos : emtf_neg);
muShower_.setOneNominalInTime(SP_.HMT() == nominalShower_ ? true : false);
muShower_.setOneTightInTime(SP_.HMT() == tightShower_ ? true : false);
muShower_.setOneLooseInTime(SP_.MUS() >= looseShower_ ? true : false);
muShower_.setOneNominalInTime(SP_.MUS() >= nominalShower_ ? true : false);
muShower_.setOneTightInTime(SP_.MUS() >= tightShower_ ? true : false);
}

///////////////////////
Expand Down Expand Up @@ -599,9 +601,11 @@ namespace l1t {

res_track->push_back(Track_);

// TBIN_num can range from 0 through 7, i.e. BX = -3 through +4. - AWB 04.04.16
res_cand->setBXRange(-3, 4);
res_cand->push_back(SP_.TBIN() - 3, mu_);
if (Track_.Mode() != 0) { // Mode == 0 means no track was found (only muon shower)
// TBIN_num can range from 0 through 7, i.e. BX = -3 through +4. - AWB 04.04.16
res_cand->setBXRange(-3, 4);
res_cand->push_back(SP_.TBIN() - 3, mu_);
}

res_shower->setBXRange(-3, 4);
res_shower->push_back(SP_.TBIN() - 3, muShower_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ namespace l1t {
_hit.set_slope(_ME.Slope());
_hit.set_pattern_run3(_ME.Run3_pattern());

// Run 3 muon shower
_hit.set_muon_shower_inTime(_ME.MUS_inTime());
_hit.set_muon_shower_outOfTime(_ME.MUS_outOfTime());
_hit.set_muon_shower_valid(_ME.MUSV());

_hit.set_ring(L1TMuonEndCap::calc_ring(_hit.Station(), _hit.CSC_ID(), _hit.Strip()));
_hit.set_chamber(
L1TMuonEndCap::calc_chamber(_hit.Station(), _hit.Sector(), _hit.Subsector(), _hit.Ring(), _hit.CSC_ID()));
Expand Down