20 : ProducerSourceFromFiles(pset,desc,
true),
21 verifyAdler32_(pset.getUntrackedParameter<bool> (
"verifyAdler32",
true)),
22 verifyChecksum_(pset.getUntrackedParameter<bool> (
"verifyChecksum",
true)),
23 useL1EventID_(pset.getUntrackedParameter<bool> (
"useL1EventID",
false))
27 produces<FEDRawDataCollection>();
33 if (
fin_.peek() == EOF ) {
49 *((uint32_t*)(&
buffer_[0]))=detectedFRDversion_;
62 id =
edm::EventID(frdEventMsg->run(), frdEventMsg->lumi(), frdEventMsg->event());
64 const uint32_t totalSize = frdEventMsg->size();
65 if ( totalSize >
buffer_.size() ) {
80 crc =
crc32c(crc,(
const unsigned char*)frdEventMsg->payload(),frdEventMsg->eventSize());
81 if ( crc != frdEventMsg->crc32c() ) {
83 "Found a wrong crc32c checksum: expected 0x" << std::hex << frdEventMsg->crc32c() <<
84 " but calculated 0x" << crc;
89 uint32_t adler = adler32(0
L,Z_NULL,0);
90 adler = adler32(adler,(Bytef*)frdEventMsg->payload(),frdEventMsg->eventSize());
92 if ( adler != frdEventMsg->adler32() ) {
94 "Found a wrong Adler32 checksum: expected 0x" << std::hex << frdEventMsg->adler32() <<
95 " but calculated 0x" << adler;
101 uint32_t eventSize = frdEventMsg->eventSize();
102 char*
event = (
char*)frdEventMsg->payload();
103 bool foundTCDSFED=
false;
104 bool foundGTPFED=
false;
107 while (eventSize > 0) {
109 eventSize -=
sizeof(
fedt_t);
113 eventSize -= (fedSize -
sizeof(
fedt_t));
118 throw cms::Exception(
"FedRawDataInputSource::fillFEDRawDataCollection") <<
"Out of range FED ID : " <<
fedId;
136 if (GTPEvmBoardSense)
157 memcpy(fedData.
data(),
event + eventSize, fedSize);
172 std::cout <<
" open file.. " << fileName << std::endl;
175 size_t pos = fileName.find(
':');
176 if (pos!=std::string::npos) {
178 if (prefix!=
"file")
return false;
184 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)
const uint32 FRDHeaderVersionSize[6]
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)
const bool verifyChecksum_
uint32_t crc32c(uint32_t crc, const unsigned char *buf, size_t len)
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)