#include <HcalTBSlowDataUnpacker.h>
Public Member Functions | |
HcalTBSlowDataUnpacker (void) | |
void | unpack (const FEDRawData &raw, HcalTBRunData &htbrd, HcalTBEventPosition &htbep) |
Definition at line 10 of file HcalTBSlowDataUnpacker.h.
hcaltb::HcalTBSlowDataUnpacker::HcalTBSlowDataUnpacker | ( | void | ) | [inline] |
Definition at line 12 of file HcalTBSlowDataUnpacker.h.
{ }
void hcaltb::HcalTBSlowDataUnpacker::unpack | ( | const FEDRawData & | raw, |
HcalTBRunData & | htbrd, | ||
HcalTBEventPosition & | htbep | ||
) |
Definition at line 28 of file HcalTBSlowDataUnpacker.cc.
References gather_cfg::cout, FEDRawData::data(), Exception, i, xdaqSlowDataFormat::key_length, xdaqSlowDataFormat::n_doubles, xdaqSlowDataFormat::n_strings, HcalTBEventPosition::setHBHEtableCoords(), HcalTBEventPosition::setHFtableCoords(), HcalTBRunData::setRunData(), FEDRawData::size(), xdaqSlowDataFormat::start_of_data, and xdaqSlowDataFormat::string_value_length.
Referenced by HcalTBObjectUnpacker::produce().
{ if (raw.size()<3*8) { throw cms::Exception("Missing Data") << "No data in the slow data block"; } const struct xdaqSlowDataFormat *sd = (const struct xdaqSlowDataFormat *)(raw.data()); map<string,double> sd_dblmap; map<string,string> sd_strmap; #ifdef DEBUG cout << "#doubles = " << sd->n_doubles << endl;; cout << "#strings = " << sd->n_strings << endl; cout << "key_length = " << sd->key_length << endl; cout << "string_value_length = " << sd->string_value_length << endl; #endif // List of doubles: const char *keyptr = &sd->start_of_data; const double *valptr = (const double *)(&sd->start_of_data + sd->n_doubles*sd->key_length); for (int i=0; i<sd->n_doubles; i++) { #ifdef DEBUG cout << keyptr << " = " << *valptr << endl; #endif sd_dblmap[keyptr] = *valptr; keyptr += sd->key_length; valptr++; } // List of strings: keyptr = (const char *)valptr; const char *strptr = (keyptr + sd->n_strings*sd->key_length); for (int i=0; i<sd->n_strings; i++) { #ifdef DEBUG cout << keyptr << " = " << strptr << endl; #endif sd_strmap[keyptr] = strptr; keyptr += sd->key_length; strptr += sd->string_value_length; } // Now fill the input objects: htbrd.setRunData(sd_strmap["RunType"].c_str(), sd_strmap["Beam.Mode"].c_str(), sd_dblmap["Beam.Energy"]); htbep.setHFtableCoords(sd_dblmap["HFTable.X"], sd_dblmap["HFTable.Y"], sd_dblmap["HFTable.V"]); htbep.setHBHEtableCoords(sd_dblmap["Table.Eta"], sd_dblmap["Table.Phi"]); }