30 #include "interface/shared/fed_header.h"
31 #include "interface/shared/fed_trailer.h"
34 namespace errorstreamsource{
78 : ExternalInputSource(pset,desc)
82 produces<FEDRawDataCollection>();
102 uint32_t lumiNumber(1);
103 uint32_t evtNumber(0);
105 status =
fin_.read((
char*)&runNumber,
sizeof(uint32_t));
106 if (runNumber < 32) {
108 status =
fin_.read((
char*)&runNumber,
sizeof(uint32_t));
111 status =
fin_.read((
char*)&lumiNumber,
sizeof(uint32_t));
113 status =
fin_.read((
char*)&evtNumber,
sizeof(uint32_t));
118 status =
fin_.read((
char*)&runNumber,
sizeof(uint32_t));
119 if (runNumber < 32) {
121 status =
fin_.read((
char*)&runNumber,
sizeof(uint32_t));
124 status =
fin_.read((
char*)&lumiNumber,
sizeof(uint32_t));
126 status =
fin_.read((
char*)&evtNumber,
sizeof(uint32_t));
127 if (!status) {
fin_.close();
return; }
130 runNumber = (runNumber==0) ? 1 : runNumber;
140 unsigned int totalEventSize = 0;
141 if (!
fin_.is_open())
return false;
145 uint32_t fedSize[1024];
146 fin_.read((
char*)fedSize,1024*
sizeof(uint32_t));
147 for (
unsigned int i=0;
i<1024;
i++) {
148 totalEventSize += fedSize[
i];
153 char *
event =
new char[totalEventSize];
155 while(totalEventSize>0) {
158 unsigned int fedsize = FED_EVSZ_EXTRACT(fedt->
eventsize);
160 totalEventSize -= (fedsize - 8);
162 unsigned int soid = FED_SOID_EXTRACT(fedh->
sourceid);
167 time = (time << 32) + gpsl;
172 memcpy(fedData.
data(),
event+totalEventSize,fedsize);
185 size_t pos = fileName.find(
':');
186 if (pos!=string::npos) {
187 string prefix = fileName.substr(0,pos);
188 if (prefix!=
"file")
return false;
193 fin_.open(fileName.substr(pos).c_str(),
ios::in|ios::binary);
194 return fin_.is_open();
bool produce(edm::Event &e)
unsigned int getgpshigh(const unsigned char *)
void setRunAndEventInfo()
std::vector< std::string >::const_iterator itFileName_
bool openFile(const std::string &fileName)
virtual ~ErrorStreamSource()
void evm_board_setformat(size_t size)
ErrorStreamSource(edm::ParameterSet const &pset, edm::InputSourceDescription const &desc)
void resize(size_t newsize)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
void beginLuminosityBlock(edm::LuminosityBlock &lb)
void endLuminosityBlock(edm::LuminosityBlock &lb)
unsigned long long TimeValue_t
void beginRun(edm::Run &r)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
constexpr unsigned int gtpEvmId_
unsigned int getgpslow(const unsigned char *)