CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
hcaltb::HcalTBSlowDataUnpacker Class Reference

#include <HcalTBSlowDataUnpacker.h>

Public Member Functions

 HcalTBSlowDataUnpacker (void)
 
void unpack (const FEDRawData &raw, HcalTBRunData &htbrd, HcalTBEventPosition &htbep)
 

Detailed Description

Definition at line 10 of file HcalTBSlowDataUnpacker.h.

Constructor & Destructor Documentation

hcaltb::HcalTBSlowDataUnpacker::HcalTBSlowDataUnpacker ( void  )
inline

Definition at line 12 of file HcalTBSlowDataUnpacker.h.

12 { }

Member Function Documentation

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(), edm::hlt::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().

30  {
31 
32  if (raw.size()<3*8) {
33  throw cms::Exception("Missing Data") << "No data in the slow data block";
34  }
35 
36  const struct xdaqSlowDataFormat *sd =
37  (const struct xdaqSlowDataFormat *)(raw.data());
38 
39  map<string,double> sd_dblmap;
40  map<string,string> sd_strmap;
41 
42 #ifdef DEBUG
43  cout << "#doubles = " << sd->n_doubles << endl;;
44  cout << "#strings = " << sd->n_strings << endl;
45  cout << "key_length = " << sd->key_length << endl;
46  cout << "string_value_length = " << sd->string_value_length << endl;
47 #endif
48 
49  // List of doubles:
50 
51  const char *keyptr = &sd->start_of_data;
52  const double *valptr =
53  (const double *)(&sd->start_of_data + sd->n_doubles*sd->key_length);
54 
55  for (int i=0; i<sd->n_doubles; i++) {
56 #ifdef DEBUG
57  cout << keyptr << " = " << *valptr << endl;
58 #endif
59  sd_dblmap[keyptr] = *valptr;
60  keyptr += sd->key_length;
61  valptr++;
62  }
63 
64  // List of strings:
65 
66  keyptr = (const char *)valptr;
67  const char *strptr = (keyptr + sd->n_strings*sd->key_length);
68 
69  for (int i=0; i<sd->n_strings; i++) {
70 #ifdef DEBUG
71  cout << keyptr << " = " << strptr << endl;
72 #endif
73  sd_strmap[keyptr] = strptr;
74  keyptr += sd->key_length;
75  strptr += sd->string_value_length;
76  }
77 
78  // Now fill the input objects:
79  htbrd.setRunData(sd_strmap["RunType"].c_str(),
80  sd_strmap["Beam.Mode"].c_str(),
81  sd_dblmap["Beam.Energy"]);
82 
83  htbep.setHFtableCoords(sd_dblmap["HFTable.X"],
84  sd_dblmap["HFTable.Y"],
85  sd_dblmap["HFTable.V"]);
86 
87  htbep.setHBHEtableCoords(sd_dblmap["Table.Eta"],
88  sd_dblmap["Table.Phi"]);
89  }
int i
Definition: DBlmapReader.cc:9
void setRunData(const char *run_type, const char *beam_mode, double beam_energy_gev)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
void setHBHEtableCoords(double eta, double phi)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
void setHFtableCoords(double x, double y, double v)
tuple cout
Definition: gather_cfg.py:41