40 if (
payload.size() != 8) { errors += 1;
41 edm::LogError(
"L1T|EMTF") <<
"Payload size in 'SP Output Data Record' is different than expected"; }
44 for (
unsigned int i = 0;
i < 8;
i++) {
46 edm::LogError(
"L1T|EMTF") <<
"Payload[" << i <<
"] has more than 16 bits in 'SP Output Data Record'"; }
59 if (
GetHexBits(SP1a, 15, 15) != 1) { errors += 1;
60 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in SP1a are incorrect"; }
61 if (
GetHexBits(SP1b, 15, 15) != 0) { errors += 1;
62 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in SP1b are incorrect"; }
63 if (
GetHexBits(SP1c, 15, 15) != 1) { errors += 1;
64 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in SP1c are incorrect"; }
65 if (
GetHexBits(SP1d, 15, 15) != 0) { errors += 1;
66 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in SP1d are incorrect"; }
67 if (
GetHexBits(SP2a, 15, 15) != 0) { errors += 1;
68 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in SP2a are incorrect"; }
69 if (
GetHexBits(SP2b, 15, 15) != 1) { errors += 1;
70 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in SP2b are incorrect"; }
71 if (
GetHexBits(SP2c, 15, 15) != 1) { errors += 1;
72 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in SP2c are incorrect"; }
73 if (
GetHexBits(SP2d, 15, 15) != 0) { errors += 1;
74 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in SP2d are incorrect"; }
83 int new_sector = _sector;
85 if (_csc_ID < 0) {
int arr[] = {_csc_ID, -99, -99, -99}; std::vector<int> vec(arr, arr+4);
return vec; }
86 else if (_csc_ID == 0) {
int arr[] = { -1, -1, -1, -1}; std::vector<int> vec(arr, arr+4);
return vec; }
87 else if (_csc_ID <= 9) {
int arr[] = {_csc_ID, new_sector, _subsector+1, 0}; std::vector<int> vec(arr, arr+4);
return vec; }
88 else new_sector = (_sector != 1) ? _sector-1 : 6;
90 if (_csc_ID == 10) {
int arr[] = {3, new_sector, 2, 1}; std::vector<int> vec(arr, arr+4);
return vec; }
91 else if (_csc_ID == 11) {
int arr[] = {6, new_sector, 2, 1}; std::vector<int> vec(arr, arr+4);
return vec; }
92 else if (_csc_ID == 12) {
int arr[] = {9, new_sector, 2, 1}; std::vector<int> vec(arr, arr+4);
return vec; }
93 else {
int arr[] = {_csc_ID, -99, -99, -99}; std::vector<int> vec(arr, arr+4);
return vec; }
95 else if (_station == 2 || _station == 3 || _station == 4) {
96 if (_csc_ID < 0) {
int arr[] = {_csc_ID, -99, -99, -99}; std::vector<int> vec(arr, arr+4);
return vec; }
97 else if (_csc_ID == 0) {
int arr[] = { -1, -1, -1, -1}; std::vector<int> vec(arr, arr+4);
return vec; }
98 else if (_csc_ID <= 9) {
int arr[] = {_csc_ID, new_sector, -1, 0}; std::vector<int> vec(arr, arr+4);
return vec; }
99 else new_sector = (_sector != 1) ? _sector-1 : 6;
101 if (_csc_ID == 10) {
int arr[] = {3, new_sector, -1, 1}; std::vector<int> vec(arr, arr+4);
return vec; }
102 else if (_csc_ID == 11) {
int arr[] = {9, new_sector, -1, 1}; std::vector<int> vec(arr, arr+4);
return vec; }
103 else {
int arr[] = {_csc_ID, -99, -99, -99}; std::vector<int> vec(arr, arr+4);
return vec; }
105 else {
int arr[] = {-99, -99, -99, -99}; std::vector<int> vec(arr, arr+4);
return vec; }
136 int iOut = res->size() - 1;
137 std::vector<int> conv_vals_SP;
138 std::vector<int> conv_vals_pT_LUT;
191 ImportSP( Track_, SP_, (res->at(iOut)).PtrEventHeader()->Endcap(), (res->at(iOut)).PtrEventHeader()->Sector() );
194 if ( !(res->at(iOut)).PtrSPCollection()->empty() )
195 if ( SP_.
TBIN() == (res->at(iOut)).PtrSPCollection()->at( (res->at(iOut)).PtrSPCollection()->size() - 1 ).TBIN() )
196 Track_.
set_track_num( (res->at(iOut)).PtrSPCollection()->size() );
212 int EMTF_kBX = ((res->at(iOut)).PtrEventHeader()->L1A_BXN() % 2048) - 25 + Track_.
BX();
213 if (EMTF_kBX < 0) EMTF_kBX += 2048;
223 int nDelay[3] = {0, 0, 0};
231 if (nDelay[2] >= 2) trk_delay = 2;
232 else if (nDelay[2] + nDelay[1] >= 2) trk_delay = 1;
233 else if (nDelay[2] + nDelay[1] + nDelay[0] >= 2) trk_delay = 0;
240 std::array<int, 4> St_hits{{0, 0, 0, 0}};
242 for (
auto const &
Hit : *res_hit) {
244 if ( Track_.
Mode() == 1 )
continue;
245 if (
Hit.Endcap() != Track_.
Endcap() )
continue;
249 else if (
Hit.Station() == 2 ) hit_delay = SP_.
ME2_delay();
250 else if (
Hit.Station() == 3 ) hit_delay = SP_.
ME3_delay();
251 else if (
Hit.Station() == 4 ) hit_delay = SP_.
ME4_delay();
254 if (
Hit.BX() + 3 + hit_delay != SP_.
TBIN() + trk_delay )
continue;
259 if (
Hit.Station() == 1 &&
260 Hit.Sector() == conv_vals_SP.at(1) &&
261 Hit.Neighbor() == conv_vals_SP.at(3) &&
264 if (
Hit.Is_CSC() == 1 &&
265 (
Hit.CSC_ID() != conv_vals_SP.at(0) ||
266 Hit.Subsector() != conv_vals_SP.at(2) ) )
continue;
268 int RPC_subsector = ((
Hit.Subsector() - 1) / 3) + 1;
269 int RPC_CSC_ID = ((
Hit.Subsector() - 1) % 3) + 4;
271 if (
Hit.Is_RPC() == 1 &&
272 ( RPC_CSC_ID != conv_vals_SP.at(0) ||
273 RPC_subsector != conv_vals_SP.at(2) ) )
continue;
275 if (St_hits.at(0) == 0 ) {
281 conv_vals_SP.at(3), 1) );
290 if (
Hit.Station() == 2 &&
291 Hit.Sector() == conv_vals_SP.at(1) &&
292 Hit.Neighbor() == conv_vals_SP.at(3) &&
295 if (
Hit.Is_CSC() == 1 &&
296 Hit.CSC_ID() != conv_vals_SP.at(0) )
continue;
298 if (
Hit.Is_RPC() == 1 &&
299 Hit.Subsector() + 3 != conv_vals_SP.at(0) )
continue;
301 if (St_hits.at(1) == 0 ) {
307 conv_vals_SP.at(3), 2) );
316 if (
Hit.Station() == 3 &&
317 Hit.Sector() == conv_vals_SP.at(1) &&
318 Hit.Neighbor() == conv_vals_SP.at(3) &&
321 if (
Hit.Is_CSC() == 1 &&
322 Hit.CSC_ID() != conv_vals_SP.at(0) )
continue;
324 if (
Hit.Is_RPC() == 1 &&
325 Hit.Subsector() + 3 != conv_vals_SP.at(0) )
continue;
327 if (St_hits.at(2) == 0 ) {
333 conv_vals_SP.at(3), 3) );
342 if (
Hit.Station() == 4 &&
343 Hit.Sector() == conv_vals_SP.at(1) &&
344 Hit.Neighbor() == conv_vals_SP.at(3) &&
347 if (
Hit.Is_CSC() == 1 &&
348 Hit.CSC_ID() != conv_vals_SP.at(0) )
continue;
350 if (
Hit.Is_RPC() == 1 &&
351 Hit.Subsector() + 3 != conv_vals_SP.at(0) )
continue;
353 if (St_hits.at(3) == 0 ) {
359 conv_vals_SP.at(3), 4) );
368 if (Track_.
Mode() == 1) {
371 int chamber_min = ((Track_.
GMT_phi() - 17) / 16) + Track_.
Sector()*6 - 3;
372 int chamber_max = ((Track_.
GMT_phi() + 1) / 16) + Track_.
Sector()*6 - 3;
373 for (
int iChamb = chamber_max; iChamb >= chamber_min; iChamb--) {
374 int chamber = (iChamb < 37 ? iChamb : (iChamb % 36));
376 for (
auto const &
Hit : *res_hit) {
378 if (
Hit.BX() != Track_.
BX() )
continue;
380 if (
Hit.Is_CSC() != 1 )
continue;
381 if (
Hit.Station() != 1 )
continue;
382 if ( (
Hit.Ring() % 3 ) != 1 )
continue;
383 if (
Hit.Neighbor() == 1 )
continue;
386 bool hit_already_used =
false;
387 for (
auto const & Trk : *res_track) {
388 if ( Trk.Sector_idx() != Track_.
Sector_idx() )
continue;
389 if ( Trk.NumHits() < 1 )
continue;
391 if ( Trk.Hits().at(0).Station() == 1 &&
392 Trk.Hits().at(0).Chamber() == chamber &&
393 Trk.Hits().at(0).BX() ==
Hit.BX() &&
394 Trk.Hits().at(0).Ring() ==
Hit.Ring() &&
395 Trk.Hits().at(0).Strip() ==
Hit.Strip() &&
396 Trk.Hits().at(0).Wire() ==
Hit.Wire() ) {
397 hit_already_used =
true;
402 if (!hit_already_used) {
407 if (Track_.
NumHits() > 0)
break;
478 (res->at(iOut)).push_SP(SP_);
480 res_track->push_back( Track_ );
void set_me3_stub_num(int bits)
void setHwPhi(int bits)
Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits)
void set_me2_stub_num(int bits)
const std::vector< uint32_t > & payload() const
void set_me3_CSC_ID(int bits)
virtual int checkFormat(const Block &block)
int calc_uGMT_chamber(int csc_ID, int subsector, int neighbor, int station)
void set_me2_CSC_ID(int bits)
void set_me1_stub_num(int bits)
void set_pt_GMT(int bits)
void set_me4_delay(int bits)
void set_phi_GMT(int bits)
int TwosCompl(int nBits, int bits)
void set_me1_delay(int bits)
int ME1_subsector() const
void set_me2_delay(int bits)
void setTFIdentifiers(int processor, tftype trackFinder)
Set the processor ID, track-finder type. From these two, the link is set.
std::vector< EMTFHit > EMTFHitCollection
std::vector< EMTFDaqOut > EMTFDaqOutCollection
void setTrackSubAddress(bmtfAddress subAddress, int value)
Set a part of the muon candidates track address; specialised for BMTF.
void set_track_num(int bits)
void set_eta_GMT(int bits)
void setHwQual(int bits)
Set compressed quality code as transmitted by hardware (4 bits)
void setHwPt(int bits)
Set compressed pT as transmitted by hardware LSB = 0.5 (9 bits)
void set_me4_CSC_ID(int bits)
void setHwEta(int bits)
Set compressed eta as transmitted by hardware LSB = 0.010875 (9 bits)
void set_me4_stub_num(int bits)
bool unpack(const Block &block, UnpackerCollections *coll) override
void set_me3_delay(int bits)
void setBXRange(int bxFirst, int bxLast)
void set_pt_LUT_addr(unsigned long bits)
void ImportSP(EMTFTrack &_track, const l1t::emtf::SP _SP, const int _endcap, const int _evt_sector)
void push_Hit(const EMTFHit &hit)
#define DEFINE_L1T_UNPACKER(type)
void set_me1_CSC_ID(int bits)
void setHwSignValid(int bits)
Set whether charge measurement is valid (0 for high pT muons)
std::vector< int > convert_SP_location(int _csc_ID, int _sector, int _subsector, int _station)
std::vector< EMTFTrack > EMTFTrackCollection
uint16_t GetHexBits(uint16_t word, uint16_t lowBit, uint16_t highBit)
void set_me1_subsector(int bits)
void set_quality_GMT(int bits)
void push_back(int bx, T object)
void set_phi_full(int bits)
void setHwSign(int bits)
Set charge sign bit (charge = (-1)^(sign))