40 doSynchro_(
pset.getParameter<
bool>(
"doSynchro")),
44 produces<RPCDigiCollection>();
45 produces<RPCRawDataCounts>();
47 produces<RPCRawSynchro::ProdItem>();
56 desc.add<
bool>(
"doSynchro",
true);
57 descriptions.
add(
"rpcUnpackingModule",
desc);
62 LogTrace(
"") <<
"record has CHANGED!!, (re)initialise readout map!";
80 auto producedRPCDigis = std::make_unique<RPCDigiCollection>();
81 auto producedRawDataCounts = std::make_unique<RPCRawDataCounts>();
82 std::unique_ptr<RPCRawSynchro::ProdItem> producedRawSynchoCounts;
84 producedRawSynchoCounts = std::make_unique<RPCRawSynchro::ProdItem>();
101 bool moreHeaders =
true;
102 while (moreHeaders) {
105 if (!fedHeader.
check()) {
106 producedRawDataCounts->addReadoutError(
fedId,
ReadoutError(ReadoutError::HeaderCheckFail));
108 LogTrace(
"") <<
" ** PROBLEM **, header.check() failed, break";
112 producedRawDataCounts->addReadoutError(
fedId,
ReadoutError(ReadoutError::InconsitentFedId));
114 LogTrace(
"") <<
" ** PROBLEM **, fedHeader.sourceID() != fedId" 115 <<
"fedId = " <<
fedId <<
" sourceID=" << fedHeader.
sourceID();
117 triggerBX = fedHeader.
bxID();
121 str <<
" header: " << *
reinterpret_cast<const bitset<64>*
>(
header) << endl;
122 str <<
" header triggerType: " << fedHeader.
triggerType() << endl;
123 str <<
" header lvl1ID: " << fedHeader.
lvl1ID() << endl;
124 str <<
" header bxID: " << fedHeader.
bxID() << endl;
125 str <<
" header sourceID: " << fedHeader.
sourceID() << endl;
126 str <<
" header version: " << fedHeader.
version() << endl;
136 bool moreTrailers =
true;
137 while (moreTrailers) {
139 FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer));
140 if (!fedTrailer.
check()) {
141 producedRawDataCounts->addReadoutError(
fedId,
ReadoutError(ReadoutError::TrailerCheckFail));
143 LogTrace(
"") <<
" ** PROBLEM **, trailer.check() failed, break";
147 producedRawDataCounts->addReadoutError(
fedId,
ReadoutError(ReadoutError::InconsistentDataSize));
149 LogTrace(
"") <<
" ** PROBLEM **, fedTrailer.fragmentLength()!= nWords, break";
155 str <<
" trailer: " << *
reinterpret_cast<const bitset<64>*
>(trailer) << endl;
157 str <<
" trailer crc: " << fedTrailer.
crc() << endl;
158 str <<
" trailer evtStatus: " << fedTrailer.
evtStatus() << endl;
159 str <<
" trailer ttsBits: " << fedTrailer.
ttsBits() << endl;
170 str <<
" data: " << *
reinterpret_cast<const bitset<64>*
>(
word) << endl;
178 for (
int iRecord = 1; iRecord <= 4; iRecord++) {
183 std::ostringstream
str;
184 str <<
"record: " <<
record.print() <<
" hex: " << hex << *pRecord <<
dec;
186 if (
event.complete()) {
187 str <<
" --> dccId: " <<
fedId <<
" rmb: " <<
event.recordSLD().rmb()
188 <<
" lnk: " <<
event.recordSLD().tbLinkInputNumber() <<
" lb: " <<
event.recordCD().lbInLink()
189 <<
" part: " <<
event.recordCD().partitionNumber() <<
" data: " <<
event.recordCD().partitionData()
190 <<
" eod: " <<
event.recordCD().eod();
194 producedRawDataCounts->addDccRecord(
fedId,
record);
196 if (
event.complete())
198 event, producedRPCDigis.get(), producedRawDataCounts.get(), producedRawSynchoCounts.get());
205 LogTrace(
"") <<
" RPCUnpackingModule - There was unpacking PROBLEM in this event" << endl;
RPCReadOutMappingWithFastSearch theReadoutMappingSearch
uint8_t ttsBits() const
Current value of the Trigger Throttling System bits.
static MessageDrop * instance()
const std::string & version() const
version as string
void init(const RPCReadOutMapping *arm)
takes ownership of map
RPCUnpackingModule(const edm::ParameterSet &pset)
Constructor.
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
RPCReadOutMapping const * convert() const
edm::ESGetToken< RPCEMap, RPCEMapRcd > theReadoutMappingToken
void produce(edm::Event &ev, const edm::EventSetup &es) override
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
uint16_t crc() const
Cyclic Redundancy Code of the event fragment including header and trailer.
const RPCReadOutMapping * theCabling
uint8_t evtStatus() const
Event fragment status information.
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
~RPCUnpackingModule() override
Destructor.
unsigned long long uint64_t
void beginRun(const edm::Run &run, const edm::EventSetup &es) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool check(const edm::EventSetup &iSetup)
edm::EDGetTokenT< FEDRawDataCollection > fedToken_
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
bool check() const
Check that the trailer is OK.
unsigned long eventCounter_
edm::ESWatcher< RPCEMapRcd > theRecordWatcher
bool moreTrailers() const