17 : ProducerSourceFromFiles(pset,desc,
true),
18 verifyAdler32_(pset.getUntrackedParameter<bool> (
"verifyAdler32",
true))
22 produces<FEDRawDataCollection>();
28 if (
fin_.peek() == EOF ) {
39 const uint32_t headerSize[4]={0,2*
sizeof(
uint32),(4+1024)*
sizeof(uint32_t),7*
sizeof(uint32_t)};
45 *((uint32_t*)(&
buffer_[0]))=detectedFRDversion_;
46 fin_.read(&
buffer_[0] +
sizeof(uint32_t),headerSize[detectedFRDversion_]-
sizeof(uint32_t));
52 fin_.read(&
buffer_[0],headerSize[detectedFRDversion_]);
57 id =
edm::EventID(frdEventMsg->run(), frdEventMsg->lumi(), frdEventMsg->event());
59 const uint32_t totalSize = frdEventMsg->size();
60 if ( totalSize >
buffer_.size() ) {
64 fin_.read(&
buffer_[0]+headerSize[detectedFRDversion_],totalSize-headerSize[detectedFRDversion_]);
74 uint32_t adler = adler32(0
L,Z_NULL,0);
75 adler = adler32(adler,(Bytef*)frdEventMsg->payload(),frdEventMsg->eventSize());
77 if ( adler != frdEventMsg->adler32() ) {
79 "Found a wrong Adler32 checksum: expected 0x" << std::hex << frdEventMsg->adler32() <<
80 " but calculated 0x" << adler;
86 uint32_t eventSize = frdEventMsg->eventSize();
87 char*
event = (
char*)frdEventMsg->payload();
89 while (eventSize > 0) {
90 eventSize -=
sizeof(
fedt_t);
93 eventSize -= (fedSize -
sizeof(
fedh_t));
104 memcpy(fedData.
data(),
event + eventSize, fedSize);
106 assert(eventSize == 0);
119 std::cout <<
" open file.. " << fileName << std::endl;
122 size_t pos = fileName.find(
':');
123 if (pos!=std::string::npos) {
125 if (prefix!=
"file")
return false;
131 return fin_.is_open();
unsigned int detectedFRDversion_
unsigned int getgpshigh(const unsigned char *)
std::vector< char > buffer_
virtual void produce(edm::Event &e)
std::auto_ptr< FEDRawDataCollection > rawData_
std::vector< std::string > const & fileNames() const
void evm_board_setformat(size_t size)
void resize(size_t newsize)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
#define FED_EVSZ_EXTRACT(a)
bool openFile(const std::string &fileName)
unsigned long long TimeValue_t
std::vector< std::string >::const_iterator itFileName_
unsigned long long uint64_t
const bool verifyAdler32_
EventNumber_t event() const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
unsigned int getgpslow(const unsigned char *)
virtual bool setRunAndEventInfo(edm::EventID &id, edm::TimeValue_t &theTime)
FRDStreamSource(edm::ParameterSet const &pset, edm::InputSourceDescription const &desc)