41 : dataLabel_(pset.getParameter<
edm::
InputTag>(
"InputLabel")),
42 doSynchro_(pset.getParameter<
bool>(
"doSynchro")),
45 produces<RPCDigiCollection>();
46 produces<RPCRawDataCounts>();
48 produces<RPCRawSynchro::ProdItem>();
57 desc.
add<
bool>(
"doSynchro",
true);
58 descriptions.
add(
"rpcUnpackingModule", desc);
63 LogTrace(
"") <<
"record has CHANGED!!, (re)initialise readout map!";
82 auto producedRPCDigis = std::make_unique<RPCDigiCollection>();
83 auto producedRawDataCounts = std::make_unique<RPCRawDataCounts>();
84 std::unique_ptr<RPCRawSynchro::ProdItem> producedRawSynchoCounts;
86 producedRawSynchoCounts = std::make_unique<RPCRawSynchro::ProdItem>();
94 unsigned int nWords = rawData.
size() /
sizeof(
Word64);
103 bool moreHeaders =
true;
104 while (moreHeaders) {
106 FEDHeader fedHeader(reinterpret_cast<const unsigned char*>(header));
107 if (!fedHeader.
check()) {
108 producedRawDataCounts->addReadoutError(
fedId,
ReadoutError(ReadoutError::HeaderCheckFail));
110 LogTrace(
"") <<
" ** PROBLEM **, header.check() failed, break";
114 producedRawDataCounts->addReadoutError(
fedId,
ReadoutError(ReadoutError::InconsitentFedId));
116 LogTrace(
"") <<
" ** PROBLEM **, fedHeader.sourceID() != fedId" 117 <<
"fedId = " <<
fedId <<
" sourceID=" << fedHeader.
sourceID();
119 triggerBX = fedHeader.
bxID();
123 str <<
" header: " << *
reinterpret_cast<const bitset<64>*
>(
header) << endl;
124 str <<
" header triggerType: " << fedHeader.
triggerType() << endl;
125 str <<
" header lvl1ID: " << fedHeader.
lvl1ID() << endl;
126 str <<
" header bxID: " << fedHeader.
bxID() << endl;
127 str <<
" header sourceID: " << fedHeader.
sourceID() << endl;
128 str <<
" header version: " << fedHeader.
version() << endl;
136 const Word64* trailer =
reinterpret_cast<const Word64*
>(rawData.
data()) + (nWords - 1);
138 bool moreTrailers =
true;
139 while (moreTrailers) {
141 FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer));
142 if (!fedTrailer.
check()) {
143 producedRawDataCounts->addReadoutError(
fedId,
ReadoutError(ReadoutError::TrailerCheckFail));
145 LogTrace(
"") <<
" ** PROBLEM **, trailer.check() failed, break";
149 producedRawDataCounts->addReadoutError(
fedId,
ReadoutError(ReadoutError::InconsistentDataSize));
151 LogTrace(
"") <<
" ** PROBLEM **, fedTrailer.fragmentLength()!= nWords, break";
157 str <<
" trailer: " << *
reinterpret_cast<const bitset<64>*
>(trailer) << endl;
158 str <<
" trailer lenght: " << fedTrailer.
fragmentLength() << endl;
159 str <<
" trailer crc: " << fedTrailer.
crc() << endl;
160 str <<
" trailer evtStatus: " << fedTrailer.
evtStatus() << endl;
161 str <<
" trailer ttsBits: " << fedTrailer.
ttsBits() << endl;
172 str <<
" data: " << *
reinterpret_cast<const bitset<64>*
>(
word) << endl;
180 for (
int iRecord = 1; iRecord <= 4; iRecord++) {
185 std::ostringstream
str;
186 str <<
"record: " << record.
print() <<
" hex: " << hex << *pRecord <<
dec;
189 str <<
" --> dccId: " <<
fedId <<
" rmb: " <<
event.recordSLD().rmb()
190 <<
" lnk: " <<
event.recordSLD().tbLinkInputNumber() <<
" lb: " <<
event.recordCD().lbInLink()
191 <<
" part: " <<
event.recordCD().partitionNumber() <<
" data: " <<
event.recordCD().partitionData()
192 <<
" eod: " <<
event.recordCD().eod();
196 producedRawDataCounts->addDccRecord(
fedId, record);
200 event, producedRPCDigis.get(), producedRawDataCounts.get(), producedRawSynchoCounts.get());
207 LogTrace(
"") <<
" RPCUnpackingModule - There was unpacking PROBLEM in this event" << endl;
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
RPCReadOutMappingWithFastSearch theReadoutMappingSearch
bool getByToken(EDGetToken token, Handle< PROD > &result) const
static MessageDrop * instance()
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 init(const RPCReadOutMapping *arm)
takes ownership of map
S & print(S &os, JobReport::InputFile const &f)
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.
RPCUnpackingModule(const edm::ParameterSet &pset)
Constructor.
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
const std::string & version() const
version as string
void produce(edm::Event &ev, const edm::EventSetup &es) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
const RPCReadOutMapping * theCabling
~RPCUnpackingModule() override
Destructor.
uint8_t ttsBits() const
Current value of the Trigger Throttling System bits.
unsigned long long uint64_t
void beginRun(const edm::Run &run, const edm::EventSetup &es) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
uint8_t evtStatus() const
Event fragment status information.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool check(const edm::EventSetup &iSetup)
edm::EDGetTokenT< FEDRawDataCollection > fedToken_
std::string print() const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
RPCReadOutMapping const * convert() const
DataRecordType type() const
unsigned long eventCounter_
edm::ESWatcher< RPCEMapRcd > theRecordWatcher