39 if (
payload.size() != 4) { errors += 1;
40 edm::LogError(
"L1T|EMTF") <<
"Payload size in 'ME Data Record' is different than expected"; }
43 for (
unsigned int i = 0;
i < 4;
i++) {
45 edm::LogError(
"L1T|EMTF") <<
"Payload[" << i <<
"] has more than 16 bits in 'ME Data Record'"; }
54 if (
GetHexBits(MEa, 15, 15) != 1) { errors += 1;
55 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in MEa are incorrect"; }
56 if (
GetHexBits(MEb, 15, 15) != 1) { errors += 1;
57 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in MEb are incorrect"; }
58 if (
GetHexBits(MEc, 15, 15) != 0) { errors += 1;
59 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in MEc are incorrect"; }
60 if (
GetHexBits(MEd, 15, 15) != 0) { errors += 1;
61 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in MEd are incorrect"; }
68 std::vector<int>
convert_ME_location(
int _station,
int _csc_ID,
int _sector,
bool _csc_ID_shift =
false) {
69 int new_sector = _sector;
70 int new_csc_ID = _csc_ID;
71 if (_csc_ID_shift) new_csc_ID += 1;
72 if (_station == 0) {
int arr[] = { 1, new_csc_ID, new_sector, 1, 0}; std::vector<int> vec(arr, arr+5);
return vec; }
73 else if (_station == 1) {
int arr[] = { 1, new_csc_ID, new_sector, 2, 0}; std::vector<int> vec(arr, arr+5);
return vec; }
74 else if (_station <= 4) {
int arr[] = {_station, new_csc_ID, new_sector, -1, 0}; std::vector<int> vec(arr, arr+5);
return vec; }
75 else if (_station == 5) new_sector = (_sector != 1) ? _sector-1 : 6;
76 else {
int arr[] = {_station, _csc_ID, _sector, -99, -99}; std::vector<int> vec(arr, arr+5);
return vec; }
79 if (new_csc_ID == 1) {
int arr[] = {1, 3, new_sector, 2, 1}; std::vector<int> vec(arr, arr+5);
return vec; }
80 else if (new_csc_ID == 2) {
int arr[] = {1, 6, new_sector, 2, 1}; std::vector<int> vec(arr, arr+5);
return vec; }
81 else if (new_csc_ID == 3) {
int arr[] = {1, 9, new_sector, 2, 1}; std::vector<int> vec(arr, arr+5);
return vec; }
82 else if (new_csc_ID == 4) {
int arr[] = {2, 3, new_sector, -1, 1}; std::vector<int> vec(arr, arr+5);
return vec; }
83 else if (new_csc_ID == 5) {
int arr[] = {2, 9, new_sector, -1, 1}; std::vector<int> vec(arr, arr+5);
return vec; }
84 else if (new_csc_ID == 6) {
int arr[] = {3, 3, new_sector, -1, 1}; std::vector<int> vec(arr, arr+5);
return vec; }
85 else if (new_csc_ID == 7) {
int arr[] = {3, 9, new_sector, -1, 1}; std::vector<int> vec(arr, arr+5);
return vec; }
86 else if (new_csc_ID == 8) {
int arr[] = {4, 3, new_sector, -1, 1}; std::vector<int> vec(arr, arr+5);
return vec; }
87 else if (new_csc_ID == 9) {
int arr[] = {4, 9, new_sector, -1, 1}; std::vector<int> vec(arr, arr+5);
return vec; }
88 else {
int arr[] = {_station, _csc_ID, _sector, -99, -99}; std::vector<int> vec(arr, arr+5);
return vec; }
115 int iOut = res->size() - 1;
166 <<
", outside proper [1, 4] range" << std::endl;
168 <<
", outside proper [1, 9] range" << std::endl;
170 <<
", outside proper [1, 6] range" << std::endl;
173 ImportME( Hit_, ME_, (res->at(iOut)).PtrEventHeader()->Endcap(), (res->at(iOut)).PtrEventHeader()->Sector() );
181 bool exact_duplicate =
false;
182 bool neighbor_duplicate =
false;
183 for (
auto const & iHit : *res_hit) {
185 if ( iHit.Is_CSC() == 1 &&
186 Hit_.
BX() == iHit.BX() &&
187 Hit_.
Endcap() == iHit.Endcap() &&
188 Hit_.
Station() == iHit.Station() &&
189 Hit_.
Chamber() == iHit.Chamber() &&
190 (Hit_.
Ring() % 3) == (iHit.Ring() % 3) ) {
192 if ( Hit_.
Ring() == iHit.Ring() &&
193 Hit_.
Strip() == iHit.Strip() &&
194 Hit_.
Wire() == iHit.Wire() ) {
195 exact_duplicate = (Hit_.
Neighbor() == iHit.Neighbor());
196 neighbor_duplicate = (Hit_.
Neighbor() != iHit.Neighbor());
198 else if ( Hit_.
Neighbor() == iHit.Neighbor() ) {
205 if (exact_duplicate)
edm::LogWarning(
"L1T|EMTF") <<
"EMTF unpacked duplicate LCTs: BX " << Hit_.
BX()
206 <<
", endcap " << Hit_.
Endcap() <<
", station " << Hit_.
Station()
207 <<
", sector " << Hit_.
Sector() <<
", neighbor " << Hit_.
Neighbor()
208 <<
", ring " << Hit_.
Ring() <<
", chamber " << Hit_.
Chamber()
209 <<
", strip " << Hit_.
Strip() <<
", wire " << Hit_.
Wire() << std::endl;
211 (res->at(iOut)).push_ME(ME_);
212 if (!exact_duplicate)
213 res_hit->push_back(Hit_);
214 if (!exact_duplicate && !neighbor_duplicate)
void set_neighbor(int bits)
const std::vector< uint32_t > & payload() const
unsigned int getAlgoVersion()
void ImportME(EMTFHit &_hit, const l1t::emtf::ME _ME, const int _endcap, const int _evt_sector)
void set_stub_num(int bits)
void set_station(int bits)
std::vector< int > convert_ME_location(int _station, int _csc_ID, int _sector, bool _csc_ID_shift=false)
virtual int checkFormat(const Block &block)
bool unpack(const Block &block, UnpackerCollections *coll) override
void set_stub_num(int bits)
void set_csc_ID(int bits)
void set_quality(int bits)
std::vector< EMTFHit > EMTFHitCollection
std::vector< EMTFDaqOut > EMTFDaqOutCollection
void set_csc_ID(int bits)
CSCDetId CSC_DetId() const
CSCCorrelatedLCTDigi CreateCSCCorrelatedLCTDigi() const
void set_sector(int bits)
void set_station(int bits)
#define DEFINE_L1T_UNPACKER(type)
void set_me_bxn(int bits)
uint16_t GetHexBits(uint16_t word, uint16_t lowBit, uint16_t highBit)
void set_clct_pattern(int bits)
void set_subsector(int bits)