std::cout<<"Front data station: "<<station<<" sector: "<<sector<<" subSector: "<<subSector<<" tbin: "<<tbin<<" cscId: "<<cscId<<" fpga: "<<fpga<<" LCT_qual="<<lct->getQuality()<<" LCT_strip="<<lct->getStrip()<<" LCT_wire="<<lct->getKeyWG()<<std::endl;
Implements edm::one::EDProducerBase.
Definition at line 106 of file CSCTFPacker.cc.
References activeSectors, CSCSPRecord::af_bits, CSCSP_MEblock::aligment_fifo_empty, CSCSP_MEblock::aligment_fifo_full, CSCSP_MEblock::bc0_, CSCSP_MBblock::bc0_, CSCSP_SPblock::bc0_, CSCSP_MEblock::bx0_, CSCSPRecord::bx_bits, CSCSP_MBblock::bxn0_, CSCSP_SPblock::bxn0_, CSCSP_MBblock::bxn1_, CSCSP_MBblock::cal_, central_lct_bx, central_sp_bx, CSCSP_SPblock::charge_, CSCSP_MEblock::clct_pattern_id, CSCSP_MEblock::clct_pattern_number, evf::compute_crc(), filterCSVwithJSON::copy, caHitNtupletGeneratorKernels::counters, CSCSP_MEblock::csc_id, CSCCDC_Tok, CSCTC_Tok, data, CSCSP_SPblock::deltaPhi12_, CSCSP_SPblock::deltaPhi23_, dt, MillePedeFileConverter_cfg::e, CSCSP_MEblock::err_prop_cnt, CSCSP_SPblock::eta_, l1t_dqm_sourceclient-live_cfg::fedRawData, file, CSCSP_MBblock::flag_, CSCSP_SPblock::front_rear, CSCSP_SPblock::halo_, RecoTauValidation_cfi::header, CSCSP_MBblock::id_, CSCSP_SPblock::id_, edm::HandleBase::isValid(), L1CSCTr_Tok, edm::InputTag::label(), CSCSP_MEblock::left_right, CSCSP_MEblock::link_id, CSCSP_MBblock::mb_bxn_, CSCSP_SPblock::mb_id, CSCSP_SPblock::mb_tbin, mbProducer, CSCSP_SPblock::me1_id, CSCSP_SPblock::me1_tbin, CSCSP_SPblock::me2_id, CSCSP_SPblock::me2_tbin, CSCSP_SPblock::me3_id, CSCSP_SPblock::me3_tbin, CSCSP_SPblock::me4_id, CSCSP_SPblock::me4_tbin, CSCSP_MEblock::me_bxn, FEDNumbering::MINCSCTFFEDID, CSCSPRecord::mode1, CSCSPRecord::mode2, CSCSPRecord::mode3, eostools::move(), CSCSP_MEblock::mpc_id, CSCSP_SPblock::ms_id, nTBINs, CSCSP_SPblock::phi_, CSCSP_MBblock::phi_, CSCSP_MBblock::phi_bend_, edm::Handle< T >::product(), putBufferToEvent, CSCSP_MBblock::quality_, CSCSP_MEblock::quality_, CSCSP_MEblock::receiver_status_dv1, CSCSP_MEblock::receiver_status_dv2, CSCSP_MEblock::receiver_status_er1, CSCSP_MEblock::receiver_status_er2, CSCSP_SPblock::se, CSCSPRecord::se_bits, nano_mu_digi_cff::sector, FEDHeader::set(), FEDTrailer::set(), CSCSP_SPblock::sign_, CSCSPRecord::sm_bits, CSCSPRecord::spare_1, relativeConstraints::station, swapME1strips, trackProducer, pwdgSkimBPark_cfi::tracks, CSCSPTrailer::trailer_mark_1, CSCSPTrailer::trailer_mark_10, CSCSPTrailer::trailer_mark_2, CSCSPTrailer::trailer_mark_3, CSCSPTrailer::trailer_mark_4, CSCSPTrailer::trailer_mark_5, CSCSPTrailer::trailer_mark_6, CSCSPTrailer::trailer_mark_7, CSCSPTrailer::trailer_mark_8, CSCSPTrailer::trailer_mark_9, CSCTriggerNumbering::triggerSubSectorFromLabels(), CSCSP_MEblock::valid_pattern, CSCSPRecord::vp_bits, CSCSPRecord::vq_a, CSCSPRecord::vq_b, CSCSP_MEblock::wire_group_id, testProducerWithPsetDescEmpty_cfi::x1, and zeroSuppression.
111 bzero(&meDataRecord,
sizeof(meDataRecord));
113 bzero(&meDataHeader,
sizeof(meDataHeader));
121 int station = (*csc).first.station() - 1;
122 int cscId = (*csc).first.triggerCscId() - 1;
123 int sector = (*csc).first.triggerSector() - 1 + ((*csc).first.endcap() == 1 ? 0 : 6);
126 if (tbin > 6 || tbin < 0) {
127 edm::LogError(
"CSCTFPacker|produce") <<
" LCT's BX=" << tbin <<
" is out of 0-6 window";
130 int fpga = (subSector ? subSector - 1 :
station + 1);
134 if (sector < 0 || sector > 11 || station < 0 || station > 3 || cscId < 0 || cscId > 8 || lctId < 0 || lctId > 1) {
135 edm::LogInfo(
"CSCTFPacker: CSC digi are out of range: ")
136 <<
"sector=" <<
sector <<
", station=" <<
station <<
", cscId=" << cscId <<
", lctId=" << lctId;
141 meDataRecord[
sector][tbin][fpga][cscId][lctId].
quality_ = lct->getQuality();
145 (
swapME1strips && cscId < 3 &&
station == 0 && (*csc).first.endcap() == 2 && lct->getStrip() < 65
146 ? 65 - lct->getStrip()
148 meDataRecord[
sector][tbin][fpga][cscId][lctId].
csc_id = (*csc).first.triggerCscId();
150 meDataRecord[
sector][tbin][fpga][cscId][lctId].
bx0_ = 0;
151 meDataRecord[
sector][tbin][fpga][cscId][lctId].
bc0_ = 0;
153 meDataRecord[
sector][tbin][fpga][cscId][lctId].
me_bxn = 0;
158 meDataRecord[
sector][tbin][fpga][cscId][lctId].
link_id = lct->getMPCLink();
159 meDataRecord[
sector][tbin][fpga][cscId][lctId].
mpc_id = 0;
165 if (lct->isValid()) {
166 switch ((meDataHeader[
sector][tbin].vp_bits >> (fpga * 3)) & 0x7) {
177 edm::LogInfo(
"CSCTFPacker: more than 3 LCTs from a single MPC in one BX!!!");
195 bzero(&mbDataRecord,
sizeof(mbDataRecord));
200 std::vector<csctf::TrackStub> stubs = barrelStubs.
product()->get();
201 for (std::vector<csctf::TrackStub>::const_iterator
dt = stubs.begin();
dt != stubs.end();
dt++) {
202 int sector =
dt->sector() - 1 + (
dt->endcap() == 1 ? 0 : 6);
203 int subSector =
dt->subsector() - 1;
205 if (tbin < 0 || tbin > 6 || sector < 0 || sector > 11 || subSector < 0 || subSector > 11) {
206 edm::LogInfo(
"CSCTFPacker: CSC DT digi are out of range: ")
207 <<
" sector=" <<
sector <<
" subSector=" << subSector <<
" tbin=" << tbin;
212 mbDataRecord[
sector][subSector][tbin].
flag_ =
dt->getStrip();
213 mbDataRecord[
sector][subSector][tbin].
cal_ =
dt->getKeyWG();
214 mbDataRecord[
sector][subSector][tbin].
phi_ =
dt->phiPacked();
215 mbDataRecord[
sector][subSector][tbin].
bxn1_ = (
dt->getBX0() >> 1) & 0
x1;
216 mbDataRecord[
sector][subSector][tbin].
bxn0_ =
dt->getBX0() & 0x1;
217 mbDataRecord[
sector][subSector][tbin].
bc0_ =
dt->getPattern();
230 mbDataRecord[
sector][subSector][tbin].
id_ =
dt->getMPCLink();
236 bzero(&spDataRecord,
sizeof(spDataRecord));
238 bzero(&nTrk,
sizeof(nTrk));
244 for (L1CSCTrackCollection::const_iterator trk =
tracks->begin(); trk !=
tracks->end(); trk++) {
245 int sector = 6 * (trk->first.endcap() - 1) + trk->first.sector() - 1;
248 if (tbin > 6 || tbin < 0) {
249 edm::LogError(
"CSCTFPacker|analyze") <<
" Track's BX=" << tbin <<
" is out of 0-6 window";
252 if (sector < 0 || sector > 11) {
253 edm::LogError(
"CSCTFPacker|analyze") <<
" Track's sector=" <<
sector <<
" is out of range";
256 spDataRecord[
sector][tbin][nTrk[
sector][tbin]].
phi_ = trk->first.localPhi();
257 spDataRecord[
sector][tbin][nTrk[
sector][tbin]].
sign_ = (trk->first.ptLUTAddress() >> 20) & 0
x1;
260 spDataRecord[
sector][tbin][nTrk[
sector][tbin]].
eta_ = trk->first.eta_packed();
262 spDataRecord[
sector][tbin][nTrk[
sector][tbin]].
halo_ = trk->first.finehalo_packed();
283 if (trk->first.mb1ID()) {
284 int subSector = (trk->first.mb1ID() - 1) % 2;
286 if (subSector < 0 || subSector > 1 || MBtbin < 0 || MBtbin > 7 || !mbDataRecord[
sector][subSector][MBtbin].id_)
292 switch (nTrk[
sector][tbin]) {
294 meDataHeader[
sector][tbin].
mode1 = (trk->first.ptLUTAddress() >> 16) & 0xF;
297 meDataHeader[
sector][tbin].
mode2 = (trk->first.ptLUTAddress() >> 16) & 0xF;
300 meDataHeader[
sector][tbin].
mode3 = (trk->first.ptLUTAddress() >> 16) & 0xF;
303 edm::LogInfo(
"More than 3 tracks from one SP in the BX");
313 header.header_mark_1 = 0x9;
314 header.header_mark_2 = 0x9;
315 header.header_mark_3 = 0x9;
316 header.header_mark_4 = 0x9;
318 header.header_mark_5 = 0xA;
319 header.header_mark_6 = 0xA;
320 header.header_mark_7 = 0xA;
321 header.header_mark_8 = 0xA;
333 bzero(&trailer,
sizeof(trailer));
346 unsigned short spDDUrecord[700 * 12], *
pos = spDDUrecord;
347 bzero(&spDDUrecord,
sizeof(spDDUrecord));
348 int eventNumber =
e.id().event();
351 *
pos++ = 0xFFFF & eventNumber;
352 *
pos++ = 0x5000 | (eventNumber >> 16);
371 for (
int tbin = 0; tbin <
nTBINs; tbin++) {
372 memcpy(
pos, &meDataHeader[
sector][tbin], 16);
374 for (
int fpga = 0; fpga < 5; fpga++) {
376 for (
int link = 0; link < 3; link++) {
377 for (
int cscId = 0; cscId < 9; cscId++)
378 for (
int lctId = 0; lctId < 2; lctId++)
380 if (meDataRecord[
sector][tbin][fpga][cscId][lctId].valid_pattern &&
381 meDataRecord[
sector][tbin][fpga][cscId][lctId].link_id == link + 1) {
382 memcpy(
pos, &meDataRecord[
sector][tbin][fpga][cscId][lctId], 8);
388 pos += 4 * (3 - nLCTs);
390 for (
int subSector = 0; subSector < 2; subSector++)
392 (subSector == 1 && meDataHeader[
sector][tbin].
vq_b)) {
393 memcpy(
pos, &mbDataRecord[
sector][subSector][tbin], 8);
396 for (
int trk = 0; trk < 3; trk++) {
398 memcpy(
pos, &spDataRecord[
sector][tbin][trk], 8);
403 memcpy(
pos, &trailer, 16);
421 auto data = std::make_unique<FEDRawDataCollection>();
423 fedRawData.resize((
pos - spDDUrecord) *
sizeof(
unsigned short));
437 fwrite(spDDUrecord, 2,
pos - spDDUrecord,
file);
unsigned aligment_fifo_empty
T const * product() const
unsigned clct_pattern_number
unsigned aligment_fifo_full
Log< level::Error, false > LogError
edm::EDGetTokenT< CSCTriggerContainer< csctf::TrackStub > > CSCTC_Tok
TupleMultiplicity< TrackerTraits > const HitToTuple< TrackerTraits > const cms::cuda::AtomicPairCounter GPUCACellT< TrackerTraits > const *__restrict__ uint32_t const *__restrict__ CellNeighborsVector< TrackerTraits > const CellTracksVector< TrackerTraits > const OuterHitOfCell< TrackerTraits > const int32_t uint32_t Counters * counters
unsigned receiver_status_dv2
edm::InputTag trackProducer
unsigned receiver_status_dv1
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
unsigned receiver_status_er2
unsigned receiver_status_er1
Log< level::Info, false > LogInfo
unsigned short activeSectors
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator
static int triggerSubSectorFromLabels(int station, int chamber)
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > CSCCDC_Tok
char data[epos_bytes_allocation]
unsigned int valid_pattern
edm::EDGetTokenT< L1CSCTrackCollection > L1CSCTr_Tok