139 auto LCTProduct = std::make_unique<CSCCorrelatedLCTDigiCollection>();
140 auto trackProduct = std::make_unique<L1CSCTrackCollection>();
141 auto statusProduct = std::make_unique<L1CSCStatusDigiCollection>();
142 auto dtProduct = std::make_unique<CSCTriggerContainer<csctf::TrackStub>>();
145 const FEDRawData& fedData = rawdata->FEDData(fedid);
146 if (fedData.
size() == 0)
151 if (unpacking_status == 0) {
155 for (std::vector<const CSCSPEvent*>::const_iterator spItr = SPs.begin(); spItr != SPs.end(); spItr++) {
173 for (
unsigned int tbin = 0; tbin < sp->
header().
nTBINs(); tbin++) {
180 for (
unsigned int FPGA = 0; FPGA < 5; FPGA++)
181 for (
unsigned int MPClink = 0; MPClink < 3; ++MPClink) {
182 std::vector<CSCSP_MEblock> lct = sp->
record(tbin).
LCT(FPGA, MPClink);
186 status.
link_status[lct[0].spInput()] |= (1 << lct[0].receiver_status_frame1()) |
187 (1 << lct[0].receiver_status_frame2()) |
188 ((lct[0].aligment_fifo() ? 1 : 0) << 4);
189 status.
mpc_link_id |= (lct[0].link() << 2) | lct[0].mpc();
191 int station = (FPGA ? FPGA : 1);
192 int endcap = 0, sector = 0;
202 int subsector = (FPGA > 1 ? 0 : FPGA + 1);
203 int cscid = lct[0].csc();
208 LCTProduct->insertDigi(
id,
214 endcap == 2 && lct[0].
strip() < 65
215 ? 65 - lct[0].
strip()
219 (lct[0].tbin() + (central_lct_bx - central_sp_bx)),
226 << e.
what() <<
"Not adding digi to collection in event " << sp->
header().
L1A()
227 <<
" (endcap=" << endcap <<
",station=" << station <<
",sector=" << sector
228 <<
",subsector=" << subsector <<
",cscid=" << cscid <<
",spSlot=" << sp->
header().
slot() <<
")";
232 std::vector<CSCSP_MBblock> mbStubs = sp->
record(tbin).
mbStubs();
233 for (std::vector<CSCSP_MBblock>::const_iterator iter = mbStubs.begin(); iter != mbStubs.end(); iter++) {
244 const unsigned int csc2dt[6][2] = {{2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 1}};
245 DTChamberId id((endcap == 1 ? 2 : -2), 1, csc2dt[sector - 1][iter->id() - 1]);
253 tbin + (central_lct_bx - central_sp_bx),
259 dtProduct->push_back(dtStub);
263 unsigned int trkNumber = 0;
264 for (std::vector<CSCSP_SPblock>::const_iterator iter = tracks.begin(); iter != tracks.end();
265 iter++, trkNumber++) {
270 if (track.first.m_sector > 6)
271 track.first.m_sector -= 6;
277 track.first.m_lphi = iter->phi();
278 track.first.m_ptAddress = iter->ptLUTaddress();
279 track.first.m_fr = iter->f_r();
280 track.first.m_ptAddress |= (iter->f_r() << 21);
282 track.first.setStationIds(iter->ME1_id(), iter->ME2_id(), iter->ME3_id(), iter->ME4_id(), iter->MB_id());
283 track.first.setTbins(
284 iter->ME1_tbin(), iter->ME2_tbin(), iter->ME3_tbin(), iter->ME4_tbin(), iter->MB_tbin());
285 track.first.setBx(iter->tbin() - central_sp_bx);
286 track.first.setBits(iter->syncErr(), iter->bx0(), iter->bc0());
288 track.first.setLocalPhi(iter->phi());
289 track.first.setEtaPacked(iter->eta());
290 track.first.setChargePacked(iter->charge());
292 track.first.m_output_link = iter->id();
293 if (track.first.m_output_link) {
296 track.first.setChargeValidPacked(
299 track.first.m_rank = 0;
300 track.first.setChargeValidPacked(0);
302 track.first.setFineHaloPacked(iter->halo());
304 track.first.m_winner = iter->MS_id() & (1 << trkNumber);
306 std::vector<CSCSP_MEblock> lcts = iter->LCTs();
307 for (std::vector<CSCSP_MEblock>::const_iterator lct = lcts.begin(); lct != lcts.end(); lct++) {
308 int station = (lct->spInput() > 6 ? (lct->spInput() - 1) / 3 : 1);
309 int subsector = (lct->spInput() > 6 ? 0 : (lct->spInput() - 1) / 3 + 1);
312 mapping->
detId(track.first.m_endcap, station, track.first.m_sector, subsector, lct->csc(), 0);
313 track.second.insertDigi(
id,
319 track.first.m_endcap == 2 && lct[0].strip() < 65
320 ? 65 - lct[0].strip()
324 (lct->tbin() + (central_lct_bx - central_sp_bx)),
331 << e.
what() <<
"Not adding track digi to collection in event" << sp->
header().
L1A()
332 <<
" (endcap=" << track.first.m_endcap <<
",station=" << station
333 <<
",sector=" << track.first.m_sector <<
",subsector=" << subsector <<
",cscid=" << lct->csc()
338 std::vector<CSCSP_MBblock> mbStubs = iter->dtStub();
339 for (std::vector<CSCSP_MBblock>::const_iterator iter = mbStubs.begin(); iter != mbStubs.end(); iter++) {
341 track.second.insertDigi(
id,
344 iter->quality() + 100,
349 tbin + (central_lct_bx - central_sp_bx),
356 trackProduct->push_back(track);
359 statusProduct->second.push_back(status);
363 <<
" problem of unpacking TF event: 0x" << std::hex << unpacking_status <<
std::dec <<
" code";
366 statusProduct->first = unpacking_status;
unsigned int unpack(const unsigned short *buf, unsigned int length)
std::vector< CSCSP_MBblock > mbStubs(void) const
std::vector< const CSCSPEvent * > SPs_fast(void) const
unsigned int SEs(void) const
std::pair< csc::L1Track, CSCCorrelatedLCTDigiCollection > L1CSCTrack
uint16_t *__restrict__ id
bool getByToken(EDGetToken token, Handle< PROD > &result) const
uint32_t const *__restrict__ Quality * quality
std::vector< CSCSP_MEblock > LCT(unsigned int mpc, unsigned int link) const
unsigned int AFs(void) const
auto const & tracks
cannot be loose
edm::EDGetTokenT< FEDRawDataCollection > Raw_token
unsigned int VPs(void) const
Log< level::Error, false > LogError
unsigned int ptSpy(void) const
size_t size() const
Lenght of the data buffer in bytes.
int orbit_counter(void) const
std::vector< CSCSP_SPblock > tracks(void) const
const CSCSPRecord & record(unsigned int tbin) const
char const * what() const noexceptoverride
int track_counter(void) const
std::vector< int > slot2sector
unsigned int SMs(void) const
unsigned int BXs(void) const
const CSCSPCounters & counters(void) const
unsigned short fmm_status
Log< level::Info, false > LogInfo
CSCTriggerMapping * mapping
const CSCSPHeader & header(void) const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
unsigned short link_status[15]
CSCDetId detId(int endcap, int station, int sector, int subsector, int cscid, int layer=0) const
unsigned short mpc_link_id