41 edm::LogError(
"L1T|EMTF") <<
"Payload size in 'ME Data Record' is different than expected";
45 for (
unsigned int i = 0;
i < 4;
i++) {
48 edm::LogError(
"L1T|EMTF") <<
"Payload[" <<
i <<
"] has more than 16 bits in 'ME Data Record'";
60 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in MEa are incorrect";
64 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in MEb are incorrect";
68 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in MEc are incorrect";
72 edm::LogError(
"L1T|EMTF") <<
"Format identifier bits in MEd are incorrect";
79 std::vector<int>
convert_ME_location(
int _station,
int _csc_ID,
int _sector,
bool _csc_ID_shift =
false) {
80 int new_sector = _sector;
81 int new_csc_ID = _csc_ID;
85 int arr[] = {1, new_csc_ID, new_sector, 1, 0};
86 std::vector<int> vec(arr, arr + 5);
88 }
else if (_station == 1) {
89 int arr[] = {1, new_csc_ID, new_sector, 2, 0};
90 std::vector<int> vec(arr, arr + 5);
92 }
else if (_station <= 4) {
93 int arr[] = {_station, new_csc_ID, new_sector, -1, 0};
94 std::vector<int> vec(arr, arr + 5);
96 }
else if (_station == 5) {
97 new_sector = (_sector != 1) ? _sector - 1 : 6;
99 int arr[] = {_station, _csc_ID, _sector, -99, -99};
100 std::vector<int> vec(arr, arr + 5);
105 if (new_csc_ID == 1) {
106 int arr[] = {1, 3, new_sector, 2, 1};
107 std::vector<int> vec(arr, arr + 5);
109 }
else if (new_csc_ID == 2) {
110 int arr[] = {1, 6, new_sector, 2, 1};
111 std::vector<int> vec(arr, arr + 5);
113 }
else if (new_csc_ID == 3) {
114 int arr[] = {1, 9, new_sector, 2, 1};
115 std::vector<int> vec(arr, arr + 5);
117 }
else if (new_csc_ID == 4) {
118 int arr[] = {2, 3, new_sector, -1, 1};
119 std::vector<int> vec(arr, arr + 5);
121 }
else if (new_csc_ID == 5) {
122 int arr[] = {2, 9, new_sector, -1, 1};
123 std::vector<int> vec(arr, arr + 5);
125 }
else if (new_csc_ID == 6) {
126 int arr[] = {3, 3, new_sector, -1, 1};
127 std::vector<int> vec(arr, arr + 5);
129 }
else if (new_csc_ID == 7) {
130 int arr[] = {3, 9, new_sector, -1, 1};
131 std::vector<int> vec(arr, arr + 5);
133 }
else if (new_csc_ID == 8) {
134 int arr[] = {4, 3, new_sector, -1, 1};
135 std::vector<int> vec(arr, arr + 5);
137 }
else if (new_csc_ID == 9) {
138 int arr[] = {4, 9, new_sector, -1, 1};
139 std::vector<int> vec(arr, arr + 5);
142 int arr[] = {_station, _csc_ID, _sector, -99, -99};
143 std::vector<int> vec(arr, arr + 5);
171 int iOut =
res->size() - 1;
214 std::vector<int> conv_vals =
225 <<
", outside proper [1, 4] range" << std::endl;
228 <<
", outside proper [1, 9] range" << std::endl;
231 <<
", outside proper [1, 6] range" << std::endl;
234 ImportME(Hit_, ME_, (
res->at(iOut)).PtrEventHeader()->Endcap(), (
res->at(iOut)).PtrEventHeader()->Sector());
241 bool exact_duplicate =
false;
242 bool neighbor_duplicate =
false;
243 for (
auto const& iHit : *res_hit) {
244 if (iHit.Is_CSC() == 1 && Hit_.
BX() == iHit.BX() && Hit_.
Endcap() == iHit.Endcap() &&
245 Hit_.
Station() == iHit.Station() && Hit_.
Chamber() == iHit.Chamber() &&
246 (Hit_.
Ring() % 3) == (iHit.Ring() % 3)) {
248 if (Hit_.
Ring() == iHit.Ring() && Hit_.
Strip() == iHit.Strip() && Hit_.
Wire() == iHit.Wire()) {
249 exact_duplicate = (Hit_.
Neighbor() == iHit.Neighbor());
250 neighbor_duplicate = (Hit_.
Neighbor() != iHit.Neighbor());
251 }
else if (Hit_.
Neighbor() == iHit.Neighbor()) {
259 edm::LogWarning(
"L1T|EMTF") <<
"EMTF unpacked duplicate LCTs: BX " << Hit_.
BX() <<
", endcap " 261 <<
", neighbor " << Hit_.
Neighbor() <<
", ring " << Hit_.
Ring() <<
", chamber " 265 (
res->at(iOut)).push_ME(ME_);
266 if (!exact_duplicate)
267 res_hit->push_back(Hit_);
268 if (!exact_duplicate && !neighbor_duplicate)
void set_neighbor(int bits)
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)
Log< level::Error, false > LogError
std::vector< int > convert_ME_location(int _station, int _csc_ID, int _sector, bool _csc_ID_shift=false)
CSCCorrelatedLCTDigi CreateCSCCorrelatedLCTDigi() const
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)
void set_sector(int bits)
CSCDetId CSC_DetId() const
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)
Log< level::Warning, false > LogWarning
void set_clct_pattern(int bits)
void set_subsector(int bits)