44 cout<<
"DT Local DAQ online spy. Connected to IP "<<connectionParameters.c_str()
45 <<
". Waiting for the data to be flushed"<<endl;
51 produces<FEDRawDataCollection>();
72 const uint32_t * rawDTData32 =
reinterpret_cast<const uint32_t*
>(rawDTData);
77 vector<uint64_t> eventData;
uint64_t word = 0;
78 int wordCount = 0;
int wordCountCheck = 0;
80 bool headerTag =
false;
bool dataTag =
true;
84 while ( !
isTrailer(word, dataTag, wordCount) ) {
90 if (
isHeader(word,dataTag)) headerTag=
true;
93 if ( wordCountCheck > 0 && !headerTag &&
debug)
94 cout<<
"[DTSpyReader]: WARNING: header still not found!!"<<endl;
100 if (dataTag)
swap(word);
104 eventData.push_back(word);
125 fedRawData.
resize(eventDataSize);
127 copy(reinterpret_cast<unsigned char*>(&eventData[0]),
128 reinterpret_cast<unsigned char*>(&eventData[0]) + eventDataSize, fedRawData.
data());
141 std::auto_ptr<FEDRawDataCollection> bare_product(fedcoll);
149 uint32_t msBits_tmp = newWorld->
msBits;
151 newWorld->
lsBits = msBits_tmp;
157 uint32_t unpackedData[2] = {0, 0};
159 unpackedData[0] |= dmaData[3] & 0x3ffff;
160 unpackedData[0] |= (dmaData[2] << 18 ) & 0xfffc0000;
161 unpackedData[1] |= (dmaData[2] >> 14 ) & 0x0f;
162 unpackedData[1] |= (dmaData[1] << 4 ) & 0x3ffff0;
163 unpackedData[1] |= (dmaData[0] << 22 ) & 0xffc00000;
165 isData = ( dmaData[0] >> 10 ) & 0x01;
179 FEDHeader candidate(reinterpret_cast<const unsigned char*>(&word));
180 if ( candidate.
check() ) {
193 FEDTrailer candidate(reinterpret_cast<const unsigned char*>(&word));
194 if ( candidate.
check() ) {
196 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)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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::Event &e, FEDRawDataCollection *&data)
Generate and fill FED raw data for a full event.
virtual void produce(edm::Event &, edm::EventSetup const &)
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)
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