44 cout<<
"DT Local DAQ online spy. Connected to IP "<<connectionParameters.c_str()
45 <<
". Waiting for the data to be flushed"<<endl;
66 const uint32_t * rawDTData32 =
reinterpret_cast<const uint32_t*
>(rawDTData);
71 vector<uint64_t> eventData;
uint64_t word = 0;
72 int wordCount = 0;
int wordCountCheck = 0;
74 bool headerTag =
false;
bool dataTag =
true;
78 while ( !
isTrailer(word, dataTag, wordCount) ) {
84 if (
isHeader(word,dataTag)) headerTag=
true;
87 if ( wordCountCheck > 0 && !headerTag &&
debug)
88 cout<<
"[DTSpyReader]: WARNING: header still not found!!"<<endl;
94 if (dataTag)
swap(word);
98 eventData.push_back(word);
119 fedRawData.
resize(eventDataSize);
121 copy(reinterpret_cast<unsigned char*>(&eventData[0]),
122 reinterpret_cast<unsigned char*>(&eventData[0]) + eventDataSize, fedRawData.
data());
135 uint32_t msBits_tmp = newWorld->
msBits;
137 newWorld->
lsBits = msBits_tmp;
143 uint32_t unpackedData[2] = {0, 0};
145 unpackedData[0] |= dmaData[3] & 0x3ffff;
146 unpackedData[0] |= (dmaData[2] << 18 ) & 0xfffc0000;
147 unpackedData[1] |= (dmaData[2] >> 14 ) & 0x0f;
148 unpackedData[1] |= (dmaData[1] << 4 ) & 0x3ffff0;
149 unpackedData[1] |= (dmaData[0] << 22 ) & 0xffc00000;
151 isData = ( dmaData[0] >> 10 ) & 0x01;
165 FEDHeader candidate(reinterpret_cast<const unsigned char*>(&word));
166 if ( candidate.
check() ) {
179 FEDTrailer candidate(reinterpret_cast<const unsigned char*>(&word));
180 if ( candidate.
check() ) {
182 if ( wordCount == candidate.
lenght())
T getUntrackedParameter(std::string const &, T const &) const
static const int dduWordLength
void Connect(const char *hostaddr, int port)
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
bool isTrailer(uint64_t word, bool dataTag, int wordCount)
check for a 64 bits word to be a DDU trailer
virtual ~DTSpyReader()
Destructor.
virtual int fillRawData(edm::EventID &eID, edm::Timestamp &tstamp, FEDRawDataCollection *&data)
Generate and fill FED raw data for a full event.
unsigned long long uint64_t
int lenght()
The length of the event fragment counted in 64-bit words including header and trailer.
void setlastPointer(char *data)
char data[epos_bytes_allocation]
edm::RunNumber_t runNumber
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