40 cout <<
"DT Local DAQ online spy. Connected to IP " << connectionParameters.c_str()
41 <<
". Waiting for the data to be flushed" << endl;
47 produces<FEDRawDataCollection>();
63 const uint32_t* rawDTData32 =
reinterpret_cast<const uint32_t*
>(rawDTData);
68 vector<uint64_t> eventData;
71 int wordCountCheck = 0;
73 bool headerTag =
false;
78 while (!
isTrailer(word, dataTag, wordCount)) {
87 if (wordCountCheck > 0 && !headerTag &&
debug)
88 cout <<
"[DTSpyReader]: WARNING: header still not found!!" << endl;
98 eventData.push_back(word);
120 fedRawData.
resize(eventDataSize);
122 copy(reinterpret_cast<unsigned char*>(&eventData[0]),
123 reinterpret_cast<unsigned char*>(&eventData[0]) + eventDataSize,
135 std::unique_ptr<FEDRawDataCollection> bare_product(fedcoll);
142 uint32_t msBits_tmp = newWorld->
msBits;
144 newWorld->
lsBits = msBits_tmp;
148 uint32_t unpackedData[2] = {0, 0};
150 unpackedData[0] |= dmaData[3] & 0x3ffff;
151 unpackedData[0] |= (dmaData[2] << 18) & 0xfffc0000;
152 unpackedData[1] |= (dmaData[2] >> 14) & 0x0f;
153 unpackedData[1] |= (dmaData[1] << 4) & 0x3ffff0;
154 unpackedData[1] |= (dmaData[0] << 22) & 0xffc00000;
156 isData = (dmaData[0] >> 10) & 0x01;
169 FEDHeader candidate(reinterpret_cast<const unsigned char*>(&word));
170 if (candidate.
check()) {
181 FEDTrailer candidate(reinterpret_cast<const unsigned char*>(&word));
182 if (candidate.
check()) {
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void produce(edm::Event &, edm::EventSetup const &) override
~DTSpyReader() override
Destructor.
bool check() const
Check that the trailer is OK.
static const int dduWordLength
void Connect(const char *hostaddr, int port)
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
edm::EventNumber_t eventNumber
const char * getEventPointer()
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
DTSpyReader(const edm::ParameterSet &pset)
Constructor.
void resize(size_t newsize)
void swap(uint64_t &word)
swapping the lsBits with the msBits
virtual int fillRawData(edm::Event &e, FEDRawDataCollection *&data)
Generate and fill FED raw data for a full event.
unsigned long long uint64_t
void setlastPointer(char *data)
char data[epos_bytes_allocation]
edm::RunNumber_t runNumber
bool isTrailer(uint64_t word, bool dataTag, unsigned int wordCount)
check for a 64 bits word to be a DDU trailer
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
bool isHeader(uint64_t word, bool dataTag)
check for a 64 bits word to be a DDU header
uint64_t dmaUnpack(const uint32_t *dmaData, bool &isData)
pre-unpack the data if read via DMA