19 : ProducerSourceFromFiles(pset,desc,
true),
20 verifyAdler32_(pset.getUntrackedParameter<bool> (
"verifyAdler32",
true)),
21 useL1EventID_(pset.getUntrackedParameter<bool> (
"useL1EventID",
false))
25 produces<FEDRawDataCollection>();
31 if (
fin_.peek() == EOF ) {
42 const uint32_t headerSize[4]={0,2*
sizeof(
uint32),(4+1024)*
sizeof(uint32_t),7*
sizeof(uint32_t)};
48 *((uint32_t*)(&
buffer_[0]))=detectedFRDversion_;
49 fin_.read(&
buffer_[0] +
sizeof(uint32_t),headerSize[detectedFRDversion_]-
sizeof(uint32_t));
55 fin_.read(&
buffer_[0],headerSize[detectedFRDversion_]);
61 id =
edm::EventID(frdEventMsg->run(), frdEventMsg->lumi(), frdEventMsg->event());
63 const uint32_t totalSize = frdEventMsg->size();
64 if ( totalSize >
buffer_.size() ) {
68 fin_.read(&
buffer_[0]+headerSize[detectedFRDversion_],totalSize-headerSize[detectedFRDversion_]);
78 uint32_t adler = adler32(0
L,Z_NULL,0);
79 adler = adler32(adler,(Bytef*)frdEventMsg->payload(),frdEventMsg->eventSize());
81 if ( adler != frdEventMsg->adler32() ) {
83 "Found a wrong Adler32 checksum: expected 0x" << std::hex << frdEventMsg->adler32() <<
84 " but calculated 0x" << adler;
90 uint32_t eventSize = frdEventMsg->eventSize();
91 char*
event = (
char*)frdEventMsg->payload();
92 bool foundTCDSFED=
false;
93 bool foundGTPFED=
false;
96 while (eventSize > 0) {
97 eventSize -=
sizeof(
fedt_t);
100 eventSize -= (fedSize -
sizeof(
fedh_t));
119 if (GTPEvmBoardSense)
140 memcpy(fedData.
data(),
event + eventSize, fedSize);
142 assert(eventSize == 0);
155 std::cout <<
" open file.. " << fileName << std::endl;
158 size_t pos = fileName.find(
':');
159 if (pos!=std::string::npos) {
161 if (prefix!=
"file")
return false;
167 return fin_.is_open();
unsigned int detectedFRDversion_
unsigned int getgpshigh(const unsigned char *)
bool gtpe_board_sense(const unsigned char *p)
unsigned int get(const unsigned char *, bool)
std::vector< char > buffer_
virtual void produce(edm::Event &e)
std::auto_ptr< FEDRawDataCollection > rawData_
std::vector< std::string > const & fileNames() const
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_
bool evm_board_sense(const unsigned char *p, size_t size)
unsigned long long uint64_t
const bool verifyAdler32_
virtual bool setRunAndEventInfo(edm::EventID &id, edm::TimeValue_t &theTime, edm::EventAuxiliary::ExperimentType &eType)
EventNumber_t event() const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
unsigned int gtpe_get(const unsigned char *)
volatile std::atomic< bool > shutdown_flag false
unsigned int getgpslow(const unsigned char *)
FRDStreamSource(edm::ParameterSet const &pset, edm::InputSourceDescription const &desc)