84 produces<l1t::RegionalMuonCandBxCollection >(
theOutputTag);
99 desc.
add<
bool>(
"skipRpc",
false);
100 desc.
add<
bool>(
"skipCsc",
false);
101 desc.
add<
bool>(
"skipDt",
false);
102 desc.
add<
bool>(
"skipMuon",
false);
103 desc.
add<
bool>(
"useRpcConnectionFile",
false);
106 descriptions.
add(
"omtfUnpacker",desc);
142 auto producedRPCDigis = std::make_unique<RPCDigiCollection>();
143 auto producedCscLctDigis = std::make_unique<CSCCorrelatedLCTDigiCollection>();
144 auto producedMuonDigis = std::make_unique<l1t::RegionalMuonCandBxCollection>();
145 producedMuonDigis->setBXRange(-3,4);
146 auto producedDTPhDigis = std::make_unique<L1MuDTChambPhContainer>();
147 auto producedDTThDigis = std::make_unique<L1MuDTChambThContainer>();
148 std::vector<L1MuDTChambPhDigi> phi_Container;
149 std::vector<L1MuDTChambThDigi> the_Container;
154 unsigned int nWords = rawData.
size()/
sizeof(
Word64);
156 if (nWords==0)
continue;
162 FEDHeader fedHeader( reinterpret_cast<const unsigned char*>(header));
163 if (!fedHeader.
check()) {
LogTrace(
"") <<
" ** PROBLEM **, header.check() failed, break";
break; }
165 LogTrace(
"") <<
" ** PROBLEM **, fedHeader.sourceID() != fedId" 168 int triggerBX = fedHeader.
bxID();
170 std::ostringstream
str;
171 str <<
" header: "<< *
reinterpret_cast<const std::bitset<64>*
> (
header) << std::endl;
172 str <<
" header triggerType: " << fedHeader.
triggerType()<< std::endl;
173 str <<
" header lvl1ID: " << fedHeader.
lvl1ID() << std::endl;
174 str <<
" header bxID: " << fedHeader.
bxID() << std::endl;
175 str <<
" header sourceID: " << fedHeader.
sourceID() << std::endl;
176 str <<
" header version: " << fedHeader.
version() << std::endl;
177 str <<
" header more : " << fedHeader.
moreHeaders() << std::endl;
178 str <<
" triggerBx "<< triggerBX << std::endl;
185 const Word64* trailer=
reinterpret_cast<const Word64*
>(rawData.
data())+(nWords-1); trailer++;
186 bool moreTrailers =
true;
187 while (moreTrailers) {
189 FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer));
190 if ( !fedTrailer.
check()) {
191 if (debug)
LogTrace(
"") <<
" ** PROBLEM **, trailer.check() failed, break";
195 if (debug)
LogTrace(
"")<<
" ** PROBLEM **, fedTrailer.fragmentLength()!= nWords, break";
200 std::ostringstream
str;
201 str <<
" trailer: "<< *
reinterpret_cast<const std::bitset<64>*
> (trailer) << std::endl;
202 str <<
" trailer lenght: "<<fedTrailer.
fragmentLength()<< std::endl;
203 str <<
" trailer crc: "<<fedTrailer.
crc()<< std::endl;
204 str <<
" trailer evtStatus: "<<fedTrailer.
evtStatus()<< std::endl;
205 str <<
" trailer ttsBits: "<<fedTrailer.
ttsBits()<< std::endl;
214 std::ostringstream
str;
215 for (
const Word64* word = header+1; word != trailer; word++) {
216 str<<
" data: "<<*
reinterpret_cast<const std::bitset<64>*
>(word) << std::endl;
224 const Word64* headerAmc13raw = header+1;
227 std::ostringstream
str;
228 str <<
" headerAMC13: "<< *
reinterpret_cast<const std::bitset<64>*
> (headerAmc13raw) << std::endl;
229 str <<
" amc13 check: "<< headerAmc13.
check() << std::endl;
232 str <<
" amc13 orbit: "<< headerAmc13.
getOrbitNumber() << std::endl;
244 const Word64* trailerAmc13raw = trailer-1;
247 std::ostringstream
str;
248 str <<
" trailerAMC13: "<< *
reinterpret_cast<const std::bitset<64>*
> (trailerAmc13raw) << std::endl;
249 str <<
" crc: "<< trailerAmc13.
getCRC() << std::endl;
250 str <<
" block: "<< trailerAmc13.
getBlock() << std::endl;
251 str <<
" LV1ID: "<< trailerAmc13.
getLV1ID() << std::endl;
252 str <<
" BX: "<< trailerAmc13.
getBX() << std::endl;
261 if (!packetAmc13.
parse( header, header+1, nWords-2, fedHeader.
lvl1ID(), fedHeader.
bxID(),
true,
false)) {
271 unsigned int blockNum=0;
275 std::ostringstream
str;
276 str <<
" ----------- #"<<blockNum++ << std::endl;
277 str <<
" blockheader: "<< std::bitset<64>(bh.
raw()) << std::endl;
278 str <<
" boardID: "<< bh.
getBoardID() << std::endl;
280 str <<
" size: "<< bh.
getSize();
289 std::ostringstream
str;
290 str <<
" AMC header[0]: "<< std::bitset<64>(headerAmc.
raw()[0]) << std::endl;
291 str <<
" AMC header[1]: "<< std::bitset<64>(headerAmc.
raw()[1]) << std::endl;
303 std::ostringstream
str;
304 str <<
" AMC trailer: "<< std::bitset<64>(trailerAmc.raw()) << std::endl;
305 str <<
" getLV1ID: "<< trailerAmc.getLV1ID() << std::endl;
306 str <<
" size: "<< trailerAmc.getSize() << std::endl;
313 const auto & payload64 =
amc.data();
314 const Word64* word = payload64.get();
315 for (
unsigned int iWord= 1; iWord<=
amc.size(); iWord++, word++) {
316 if (iWord<=2 )
continue;
317 if (iWord==
amc.size() )
continue;
319 LogTrace(
"") <<
" payload: " << *
reinterpret_cast<const std::bitset<64>*
>(word);
358 producedDTPhDigis->setContainer(phi_Container);
360 producedDTThDigis->setContainer(the_Container);
367 using namespace omtf;
std::vector< amc::Packet > payload() const
T getParameter(std::string const &) const
void init(const edm::EventSetup &es)
void unpack(unsigned int fed, unsigned int amc, const CscDataWord64 &raw, CSCCorrelatedLCTDigiCollection *prod)
unsigned int getCRC() const
static MessageDrop * instance()
def setup(process, global_tag, zero_tesla=False)
uint16_t crc() const
Cyclic Redundancy Code of the event fragment including header and trailer.
bool check() const
Check that the trailer is OK.
bool moreTrailers() const
void beginRun(const edm::Run &run, const edm::EventSetup &es) override
size_t size() const
Lenght of the data buffer in bytes.
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
void unpack(int triggerBX, unsigned int fed, unsigned int amc, const RpcDataWord64 &raw, RPCDigiCollection *prod)
MuonUnpacker theMuonUnpacker
unsigned int getBX() const
#define DEFINE_FWK_MODULE(type)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
unsigned int getBlock() const
RpcUnpacker theRpcUnpacker
OmtfUnpacker(const edm::ParameterSet &pset)
unsigned int getLV1ID() const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
unsigned long theEventCounter
uint8_t ttsBits() const
Current value of the Trigger Throttling System bits.
edm::EDGetTokenT< FEDRawDataCollection > theFedDataToken
bool parse(const uint64_t *start, const uint64_t *data, unsigned int size, unsigned int lv1, unsigned int bx, bool legacy_mc=false, bool mtf7_mode=false)
uint8_t evtStatus() const
Event fragment status information.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void unpack(unsigned int fed, unsigned int amc, const DtDataWord64 &raw, std::vector< L1MuDTChambPhDigi > &phi_Container, std::vector< L1MuDTChambThDigi > &the_Container)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
std::string fullPath() const
edm::ParameterSet theConfig
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void unpack(unsigned int fed, unsigned int amc, const MuonDataWord64 &raw, l1t::RegionalMuonCandBxCollection *muColl)
void produce(edm::Event &ev, const edm::EventSetup &es) override
CscUnpacker theCscUnpacker