2 #include "HGCal/RawToDigi/plugins/HGCalTBTextSource.h"
3 #include "HGCal/Geometry/interface/HGCalTBGeometryParameters.h"
4 #include "HGCal/Geometry/interface/HGCalTBSpillParameters.h"
16 string buffer1 =
"0 0 0x00000000 0x00000000";
17 bool HGCalTBTextSource::readLines()
24 fgets(buffer, 1000, m_file);
25 if(sscanf(buffer,
"STARTING SPILL READ AT TIME (1us): %x RUN: %u",&m_time_tmp,&m_run_tmp) !=2 )
return false;
55 fgets(buffer, 1000, m_file);
56 if (strstr(buffer,
"STARTING"))
continue;
57 if (strstr(buffer,
"Board"))
continue;
73 if(strstr(buffer,
"Event"))
continue;
84 return !m_lines.empty();
87 void HGCalTBTextSource::produce(edm::Event & e)
89 std::auto_ptr<FEDRawDataCollection> bare_product(
new FEDRawDataCollection());
93 std::vector<uint16_t> skiwords;
95 if (m_lines.size() % 2) {
96 skiwords.push_back(0);
97 skiwords.push_back(0);
99 for (std::vector<std::string>::const_iterator i = m_lines.begin(); i != m_lines.end(); i++) {
101 sscanf(i->c_str(),
"%x %x %x %x", &a, &b, &c, &d);
103 skiwords.push_back(uint16_t(c >> 16));
104 skiwords.push_back(uint16_t(d >> 16));
105 skiwords.push_back(uint16_t(c));
106 skiwords.push_back(uint16_t(d));
109 FEDRawData& fed = bare_product->FEDData(m_sourceId);
110 size_t len =
sizeof(uint16_t) * skiwords.size();
113 memcpy(fed.data(), &(skiwords[0]), len);
122 edm::ParameterSetDescription desc;
123 desc.setComment(
"TEST");
124 desc.addUntracked<
int>(
"run", 101);
125 desc.addUntracked<std::vector<std::string> >(
"fileNames");
126 descriptions.add(
"source", desc);
130 #include "FWCore/Framework/interface/InputSourceMacros.h"
unsigned int Events_Per_Spill
unsigned int spillcounter
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int trigcountperspillflag
convert data from txt file to FEDRawData
int Number_Of_SKIROC_Data_Words
DEFINE_FWK_INPUT_SOURCE(HGCalTBTextSource)
int Number_Of_SKIROC_Words