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 March 2020 emulator update #29262

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
21 changes: 14 additions & 7 deletions DQM/L1TMonitor/src/L1TStage2EMTF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,9 @@ void L1TStage2EMTF::analyze(const edm::Event& e, const edm::EventSetup& c) {
const std::map<std::pair<int, int>, int> histIndexRPC = {
{{4, 3}, 0}, {{4, 2}, 1}, {{3, 3}, 2}, {{3, 2}, 3}, {{2, 2}, 4}, {{1, 2}, 5}};

// Reverse 'rotate by 2' for RPC subsector
auto get_subsector_rpc_cppf = [](int subsector_rpc) { return ((subsector_rpc + 3) % 6) + 1; };

for (auto Hit = HitCollection->begin(); Hit != HitCollection->end(); ++Hit) {
int endcap = Hit->Endcap();
int sector = Hit->Sector();
Expand Down Expand Up @@ -650,7 +653,8 @@ void L1TStage2EMTF::analyze(const edm::Event& e, const edm::EventSetup& c) {
rpcHitTheta[hist_index]->Fill(Hit->Theta_fp() / 4);
rpcChamberPhi[hist_index]->Fill(chamber, Hit->Phi_fp() / 4);
rpcChamberTheta[hist_index]->Fill(chamber, Hit->Theta_fp() / 4);
rpcHitOccupancy->Fill((Hit->Sector_RPC() - 1) * 7 + Hit->Subsector(), hist_index + 0.5);
rpcHitOccupancy->Fill((Hit->Sector_RPC() - 1) * 7 + get_subsector_rpc_cppf(Hit->Subsector_RPC()),
hist_index + 0.5);
} else if (Hit->Neighbor() == true) {
rpcHitOccupancy->Fill((Hit->Sector_RPC() - 1) * 7 + 7, hist_index + 0.5);
}
Expand Down Expand Up @@ -742,7 +746,7 @@ void L1TStage2EMTF::analyze(const edm::Event& e, const edm::EventSetup& c) {
int ring = TrkHit.Ring();
int station = TrkHit.Station();
int sector = TrkHit.Sector();
int subsector = TrkHit.Subsector();
//int subsector = TrkHit.Subsector();
//int cscid_offset = (sector - 1) * 9;//no longer needed after new time plots (maybe useful for future plots)
int neighbor = TrkHit.Neighbor();
int endcap = TrkHit.Endcap();
Expand Down Expand Up @@ -790,9 +794,10 @@ void L1TStage2EMTF::analyze(const edm::Event& e, const edm::EventSetup& c) {
if (Hit->Endcap() > 0)
hist_index = 11 - hist_index;
rpcHitTimingInTrack->Fill(Hit->BX(), hist_index + 0.5);
rpcHitTiming[histIndexBX.at(Hit->BX())]->Fill((Hit->Sector_RPC() - 1) * 7 + Hit->Subsector(),
hist_index + 0.5);
rpcHitTimingTot->Fill((Hit->Sector_RPC() - 1) * 7 + Hit->Subsector(), hist_index + 0.5);
rpcHitTiming[histIndexBX.at(Hit->BX())]->Fill(
(Hit->Sector_RPC() - 1) * 7 + get_subsector_rpc_cppf(Hit->Subsector_RPC()), hist_index + 0.5);
rpcHitTimingTot->Fill((Hit->Sector_RPC() - 1) * 7 + get_subsector_rpc_cppf(Hit->Subsector_RPC()),
hist_index + 0.5);
} // End loop: for (auto Hit = HitCollection->begin(); Hit != HitCollection->end(); ++Hit)
} // End conditional: if (trackHitBX == 0 && ring == 2)
} // End conditional: if (TrkHit.Is_CSC() == true)
Expand All @@ -807,8 +812,10 @@ void L1TStage2EMTF::analyze(const edm::Event& e, const edm::EventSetup& c) {
hist_index = 11 - hist_index;

rpcHitTimingInTrack->Fill(trackHitBX, hist_index + 0.5);
rpcHitTiming[histIndexBX.at(trackHitBX)]->Fill((TrkHit.Sector_RPC() - 1) * 7 + subsector, hist_index + 0.5);
rpcHitTimingTot->Fill((TrkHit.Sector_RPC() - 1) * 7 + subsector, hist_index + 0.5);
rpcHitTiming[histIndexBX.at(trackHitBX)]->Fill(
(TrkHit.Sector_RPC() - 1) * 7 + get_subsector_rpc_cppf(TrkHit.Subsector_RPC()), hist_index + 0.5);
rpcHitTimingTot->Fill((TrkHit.Sector_RPC() - 1) * 7 + get_subsector_rpc_cppf(TrkHit.Subsector_RPC()),
hist_index + 0.5);
} // End conditional: if (TrkHit.Is_RPC() == true && neighbor == false)
if (TrkHit.Is_RPC() == true && neighbor == true) {
hist_index = histIndexRPC.at({station, ring});
Expand Down
58 changes: 24 additions & 34 deletions DataFormats/L1TMuon/interface/EMTFHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
#include "DataFormats/MuonDetId/interface/GEMDetId.h"
#include "DataFormats/MuonDetId/interface/ME0DetId.h"
#include "DataFormats/MuonDetId/interface/DTChamberId.h"
#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h"
#include "DataFormats/RPCDigi/interface/RPCDigi.h"
#include "DataFormats/GEMDigi/interface/GEMPadDigi.h"
#include "DataFormats/GEMDigi/interface/ME0PadDigi.h"
//#include "DataFormats/RPCDigi/interface/RPCDigi.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete commented-out code

//#include "DataFormats/GEMDigi/interface/GEMPadDigi.h"
//#include "DataFormats/GEMDigi/interface/ME0PadDigi.h"
#include "DataFormats/L1TMuon/interface/CPPFDigi.h"
#include "DataFormats/L1TMuon/interface/EMTF/ME.h"

Expand All @@ -25,6 +26,7 @@ namespace l1t {
public:
EMTFHit()
: rawDetId(0),
subsystem(-99),
endcap(-99),
station(-99),
ring(-99),
Expand Down Expand Up @@ -58,8 +60,6 @@ namespace l1t {
stub_num(-99),
phi_fp(-99),
theta_fp(-99),
phzvl(-99),
ph_hit(-99),
zone_hit(-99),
zone_code(-99),
fs_segment(-99),
Expand All @@ -77,20 +77,17 @@ namespace l1t {
rho_sim(-99),
z_sim(-99),
alct_quality(-99),
clct_quality(-99),
is_CSC(-99),
is_RPC(-99),
is_GEM(-99),
subsystem(-99){};
clct_quality(-99){};

virtual ~EMTFHit(){};

// void ImportCSCDetId (const CSCDetId& _detId);
CSCDetId CreateCSCDetId() const;
// void ImportRPCDetId (const RPCDetId& _detId);
// void ImportGEMDetId (const GEMDetId& _detId);
RPCDetId CreateRPCDetId() const;
// void ImportGEMDetId (const GEMDetId& _detId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete commented-out code

// GEMDetId CreateGEMDetId() const;

// void ImportCSCCorrelatedLCTDigi (const CSCCorrelatedLCTDigi& _digi);
CSCCorrelatedLCTDigi CreateCSCCorrelatedLCTDigi() const;
// void ImportRPCDigi (const RPCDigi& _digi);
Expand All @@ -114,6 +111,7 @@ namespace l1t {
void SetRPCDetId(const RPCDetId& id) { rawDetId = id.rawId(); }
void SetGEMDetId(const GEMDetId& id) { rawDetId = id.rawId(); }
void SetME0DetId(const ME0DetId& id) { rawDetId = id.rawId(); }
void SetDTDetId(const DTChamberId& id) { rawDetId = id.rawId(); }

//CSCDetId CSC_DetId () const { return csc_DetId; }
//RPCDetId RPC_DetId () const { return rpc_DetId; }
Expand All @@ -126,7 +124,9 @@ namespace l1t {
RPCDetId RPC_DetId() const { return RPCDetId(rawDetId); }
GEMDetId GEM_DetId() const { return GEMDetId(rawDetId); }
ME0DetId ME0_DetId() const { return ME0DetId(rawDetId); }
DTChamberId DT_DetId() const { return DTChamberId(rawDetId); }

void set_subsystem(int bits) { subsystem = bits; }
void set_endcap(int bits) { endcap = bits; }
void set_station(int bits) { station = bits; }
void set_ring(int bits) { ring = bits; }
Expand Down Expand Up @@ -160,8 +160,6 @@ namespace l1t {
void set_stub_num(int bits) { stub_num = bits; }
void set_phi_fp(int bits) { phi_fp = bits; }
void set_theta_fp(int bits) { theta_fp = bits; }
void set_phzvl(int bits) { phzvl = bits; }
void set_ph_hit(int bits) { ph_hit = bits; }
void set_zone_hit(int bits) { zone_hit = bits; }
void set_zone_code(int bits) { zone_code = bits; }
void set_fs_segment(int bits) { fs_segment = bits; }
Expand All @@ -180,11 +178,8 @@ namespace l1t {
void set_z_sim(float val) { z_sim = val; }
void set_alct_quality(int bits) { alct_quality = bits; }
void set_clct_quality(int bits) { clct_quality = bits; }
void set_is_CSC(int bits) { is_CSC = bits; }
void set_is_RPC(int bits) { is_RPC = bits; }
void set_is_GEM(int bits) { is_GEM = bits; }
void set_subsystem(int bits) { subsystem = bits; }

int Subsystem() const { return subsystem; }
int Endcap() const { return endcap; }
int Station() const { return station; }
int Ring() const { return ring; }
Expand Down Expand Up @@ -218,8 +213,6 @@ namespace l1t {
int Stub_num() const { return stub_num; }
int Phi_fp() const { return phi_fp; }
int Theta_fp() const { return theta_fp; }
int Phzvl() const { return phzvl; }
int Ph_hit() const { return ph_hit; }
int Zone_hit() const { return zone_hit; }
int Zone_code() const { return zone_code; }
int FS_segment() const { return fs_segment; }
Expand All @@ -238,10 +231,13 @@ namespace l1t {
float Z_sim() const { return z_sim; }
int ALCT_quality() const { return alct_quality; }
int CLCT_quality() const { return clct_quality; }
int Is_CSC() const { return is_CSC; }
int Is_RPC() const { return is_RPC; }
int Is_GEM() const { return is_GEM; }
int Subsystem() const { return subsystem; }

// See L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h
bool Is_DT() const { return subsystem == 0; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a good case for an enum

bool Is_CSC() const { return subsystem == 1; }
bool Is_RPC() const { return subsystem == 2; }
bool Is_GEM() const { return subsystem == 3; }
bool Is_ME0() const { return subsystem == 4; }

private:
//CSCDetId csc_DetId;
Expand All @@ -253,14 +249,14 @@ namespace l1t {
//GEMPadDigi gem_PadDigi;

uint32_t rawDetId; // raw CMSSW DetId

int endcap; // +/-1. For ME+ and ME-.
int station; // 1 - 4.
int subsystem; // 0 - 4. 0 for DT, 1 for CSC, 2 for RPC, 3 for GEM, 4 for ME0
int endcap; // +/-1. For ME+ and ME-.
int station; // 1 - 4.
int ring; // 1 - 4. ME1/1a is denoted as "Ring 4". Should check dependence on input CSCDetId convention. - AWB 02.03.17
int sector; // 1 - 6. CSC / EMTF sector convention: sector 1 starts at 15 degrees
int sector_RPC; // 1 - 6. RPC sector convention (in CMSSW): sector 1 starts at -5 degrees
int sector_idx; // 0 - 11. 0 - 5 for ME+, 6 - 11 for ME-. For neighbor hits, set by EMTF sector that received it.
int subsector; // 0 - 6. In CSCs, 1 or 2 for ME1, 0 for ME2/3/4. In RPCs, 1 - 6, where 1 is first chamber in EMTF sector.
int subsector; // 0 - 6. In CSCs, 1 or 2 for ME1, 0 for ME2/3/4.
int subsector_RPC; // 0 - 6. RPC sector convention (in CMSSW): subsector 3 is the first chamber in the EMTF sector.
int chamber; // 1 - 36. Chamber 1 starts at -5 degrees.
int csc_ID; // 1 - 9. For CSCs only.
Expand All @@ -287,8 +283,6 @@ namespace l1t {
int stub_num; // 0 or 1. Only from unpacked data? - AWB 02.03.17
int phi_fp; // 0 - 4920
int theta_fp; // 0 - 127
int phzvl; // 0 - 6.
int ph_hit; // 2 - 43. (Range? - AWB 02.03.17)
int zone_hit; // 4 - 156 (Range? - AWB 02.03.17)
int zone_code; // 0 - 12. (Range? - AWB 02.03.17)
int fs_segment; // 0 - 13. (Range? - AWB 02.03.17)
Expand All @@ -299,18 +293,14 @@ namespace l1t {
float phi_glob; // +/-180.
float theta; // 0 - 90.
float eta; // +/-2.5.
float time; // ? - ?. RPC time information
float time; // ? - ?. RPC time information (ns)
float phi_sim; // +/-180.
float theta_sim; // 0 - 90.
float eta_sim; // +/-2.5.
float rho_sim; // ? - ?.
float z_sim; // ? - ?.
int alct_quality; // 1 - 3. For emulated CSC LCTs only, maps to number of ALCT layers (4 - 6).
int clct_quality; // 4 - 6. For emulated CSC LCTs only, maps to number of CLCT layers (4 - 6).
int is_CSC; // 0 or 1.
int is_RPC; // 0 or 1.
int is_GEM; // 0 or 1.
int subsystem; // 1 or ?. 1 for CSC, 2 for RPC, 3 for GEM

}; // End of class EMTFHit

Expand Down
12 changes: 6 additions & 6 deletions DataFormats/L1TMuon/interface/EMTFTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ namespace l1t {
EMTFHitCollection Hits() const { return _Hits; }
std::vector<unsigned int> HitIdx() const { return _HitIdx; }

void set_Road(const EMTFRoad& bits) { _Road = bits; }
void set_RoadIdx(unsigned int bits) { _RoadIdx = bits; }
EMTFRoad Road() const { return _Road; }
unsigned int RoadIdx() const { return _RoadIdx; }
//void set_Road(const EMTFRoad& bits) { _Road = bits; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete commented-out code

//void set_RoadIdx(unsigned int bits) { _RoadIdx = bits; }
//EMTFRoad Road() const { return _Road; }
//unsigned int RoadIdx() const { return _RoadIdx; }

void set_PtLUT(EMTFPtLUT bits) { _PtLUT = bits; }
EMTFPtLUT PtLUT() const { return _PtLUT; }
Expand Down Expand Up @@ -182,8 +182,8 @@ namespace l1t {
EMTFHitCollection _Hits;
std::vector<unsigned int> _HitIdx;

EMTFRoad _Road;
unsigned int _RoadIdx;
//EMTFRoad _Road;
//unsigned int _RoadIdx;

EMTFPtLUT _PtLUT;

Expand Down
2 changes: 1 addition & 1 deletion DataFormats/L1TMuon/src/EMTFHit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace l1t {
}

CPPFDigi EMTFHit::CreateCPPFDigi() const {
if (is_RPC != 1)
if (!Is_RPC())
return CPPFDigi();

int board_ = 1 + ((chamber % 36) / 9); // RPC chamber to CPPF board mapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,22 @@ namespace l1t {
RPC_.Word(),
RPC_.Link());

// Rotate by 20 deg to match RPC convention in CMSSW
int _sector_rpc = (_subsector < 5) ? _sector : (_sector % 6) + 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic numbers should be named constants (everywhere)

// Rotate by 2 to match RPC convention in CMSSW (RPCDetId.h)
int _subsector_rpc = ((_subsector + 1) % 6) + 1;
// Define chamber number
int _chamber = (_sector_rpc - 1) * 6 + _subsector_rpc;
// Define CSC-like subsector
int _subsector_csc = (_station != 1) ? 0 : ((_chamber % 6 > 2) ? 1 : 2);

Hit_.set_station(_station);
Hit_.set_ring(_ring);
Hit_.set_sector(_sector);
Hit_.set_subsector(_subsector);
Hit_.set_sector_RPC(_subsector < 5 ? _sector
: (_sector % 6) + 1); // Rotate by 20 deg to match RPC convention in CMSSW
Hit_.set_subsector_RPC(((_subsector + 1) % 6) +
1); // Rotate by 2 to match RPC convention in CMSSW (RPCDetId.h)
Hit_.set_chamber((Hit_.Sector_RPC() - 1) * 6 + Hit_.Subsector_RPC());
Hit_.set_subsector(_subsector_csc);
Hit_.set_sector_RPC(_sector_rpc);
Hit_.set_subsector_RPC(_subsector_rpc);
Hit_.set_chamber(_chamber);
Hit_.set_neighbor(_neighbor);
Hit_.set_pc_segment(_segment);
Hit_.set_fs_segment(_segment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ namespace l1t {
// else if (nDelay[2] + nDelay[1] >= 1) trk_delay = 1;
// else if (nDelay[2] + nDelay[1] + nDelay[0] >= 1) trk_delay = 0;

// Reverse 'rotate by 2' to get CPPF subsector number
auto get_subsector_rpc_cppf = [](int subsector_rpc) { return ((subsector_rpc + 3) % 6) + 1; };

std::array<int, 4> St_hits{{0, 0, 0, 0}}; // Number of matched hits in each station

for (auto const& Hit : *res_hit) {
Expand Down Expand Up @@ -341,8 +344,9 @@ namespace l1t {
if (Hit.Is_CSC() == 1 && (Hit.CSC_ID() != conv_vals_SP.at(0) || Hit.Subsector() != conv_vals_SP.at(2)))
continue;

int RPC_subsector = ((Hit.Subsector() - 1) / 3) + 1; // Map RPC subsector to equivalent CSC subsector
int RPC_CSC_ID = ((Hit.Subsector() - 1) % 3) + 4; // Map RPC subsector and ring to equivalent CSC ID
int tmp_subsector = get_subsector_rpc_cppf(Hit.Subsector_RPC());
int RPC_subsector = ((tmp_subsector - 1) / 3) + 1; // Map RPC subsector to equivalent CSC subsector
int RPC_CSC_ID = ((tmp_subsector - 1) % 3) + 4; // Map RPC subsector and ring to equivalent CSC ID

if (Hit.Is_RPC() == 1 && (RPC_CSC_ID != conv_vals_SP.at(0) || RPC_subsector != conv_vals_SP.at(2)))
continue;
Expand All @@ -365,7 +369,8 @@ namespace l1t {
if (Hit.Is_CSC() == 1 && Hit.CSC_ID() != conv_vals_SP.at(0))
continue;

if (Hit.Is_RPC() == 1 && Hit.Subsector() + 3 != conv_vals_SP.at(0))
int tmp_subsector = get_subsector_rpc_cppf(Hit.Subsector_RPC());
if (Hit.Is_RPC() == 1 && tmp_subsector + 3 != conv_vals_SP.at(0))
continue;

if (St_hits.at(1) == 0) {
Expand All @@ -386,7 +391,8 @@ namespace l1t {
if (Hit.Is_CSC() == 1 && Hit.CSC_ID() != conv_vals_SP.at(0))
continue;

if (Hit.Is_RPC() == 1 && Hit.Subsector() + 3 != conv_vals_SP.at(0))
int tmp_subsector = get_subsector_rpc_cppf(Hit.Subsector_RPC());
if (Hit.Is_RPC() == 1 && tmp_subsector + 3 != conv_vals_SP.at(0))
continue;

if (St_hits.at(2) == 0) {
Expand All @@ -407,7 +413,8 @@ namespace l1t {
if (Hit.Is_CSC() == 1 && Hit.CSC_ID() != conv_vals_SP.at(0))
continue;

if (Hit.Is_RPC() == 1 && Hit.Subsector() + 3 != conv_vals_SP.at(0))
int tmp_subsector = get_subsector_rpc_cppf(Hit.Subsector_RPC());
if (Hit.Is_RPC() == 1 && tmp_subsector + 3 != conv_vals_SP.at(0))
continue;

if (St_hits.at(3) == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ namespace l1t {
_hit.set_sync_err(_ME.SE());
_hit.set_bx(_ME.TBIN() - 3);
_hit.set_bc0(_ME.BC0());
_hit.set_is_CSC(true);
_hit.set_is_RPC(false);
_hit.set_subsystem(1);
_hit.set_subsystem(1); // 1 for CSC
// _hit.set_layer();

_hit.set_ring(L1TMuonEndCap::calc_ring(_hit.Station(), _hit.CSC_ID(), _hit.Strip()));
Expand All @@ -45,9 +43,7 @@ namespace l1t {
_hit.set_bx(_RPC.TBIN() - 3);
_hit.set_valid(_RPC.VP());
_hit.set_bc0(_RPC.BC0());
_hit.set_is_CSC(false);
_hit.set_is_RPC(true);
_hit.set_subsystem(2);
_hit.set_subsystem(2); // 2 for RPC

_hit.SetRPCDetId(_hit.CreateRPCDetId());
// // Not yet implemented - AWB 15.03.17
Expand Down
3 changes: 0 additions & 3 deletions L1Trigger/L1TMuon/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,3 @@

<use name="MagneticField/Engine"/>
<use name="MagneticField/Records"/>

<use name="DataFormats/L1TrackTrigger"/>
<use name="Geometry/TrackerGeometryBuilder"/>
Loading