CMS 3D CMS Logo

hcaltb::HcalTBSlowDataUnpacker Class Reference

#include <RecoTBCalo/HcalTBObjectUnpacker/interface/HcalTBSlowDataUnpacker.h>

List of all members.

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.

00012 { }


Member Function Documentation

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

Definition at line 28 of file HcalTBSlowDataUnpacker.cc.

References GenMuonPlsPt100GeV_cfg::cout, FEDRawData::data(), lat::endl(), 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().

00030                                                                      {
00031 
00032   if (raw.size()<3*8) {
00033     throw cms::Exception("Missing Data") << "No data in the slow data block";
00034   }
00035 
00036     const struct xdaqSlowDataFormat *sd =
00037       (const struct xdaqSlowDataFormat *)(raw.data());
00038 
00039     map<string,double> sd_dblmap;
00040     map<string,string> sd_strmap;
00041 
00042 #ifdef DEBUG
00043     cout << "#doubles = "   << sd->n_doubles << endl;;
00044     cout << "#strings = "   << sd->n_strings << endl;
00045     cout << "key_length = " << sd->key_length << endl;
00046     cout << "string_value_length = " << sd->string_value_length << endl;
00047 #endif
00048 
00049     // List of doubles:
00050 
00051     const char   *keyptr = &sd->start_of_data;
00052     const double *valptr =
00053       (const double *)(&sd->start_of_data + sd->n_doubles*sd->key_length);
00054 
00055     for (int i=0; i<sd->n_doubles; i++) {
00056 #ifdef DEBUG
00057       cout << keyptr << " = " << *valptr << endl;
00058 #endif
00059       sd_dblmap[keyptr] = *valptr;
00060       keyptr += sd->key_length;
00061       valptr++;
00062     }
00063 
00064     // List of strings:
00065 
00066     keyptr = (const char *)valptr;
00067     const char *strptr = (keyptr + sd->n_strings*sd->key_length);
00068 
00069     for (int i=0; i<sd->n_strings; i++) {
00070 #ifdef DEBUG
00071       cout << keyptr << " = " << strptr << endl;
00072 #endif
00073       sd_strmap[keyptr] = strptr;
00074       keyptr += sd->key_length;
00075       strptr += sd->string_value_length;
00076     }
00077 
00078     // Now fill the input objects:
00079     htbrd.setRunData(sd_strmap["RunType"].c_str(),
00080                      sd_strmap["Beam.Mode"].c_str(),
00081                      sd_dblmap["Beam.Energy"]);
00082 
00083     htbep.setHFtableCoords(sd_dblmap["HFTable.X"],
00084                            sd_dblmap["HFTable.Y"],
00085                            sd_dblmap["HFTable.V"]);
00086 
00087     htbep.setHBHEtableCoords(sd_dblmap["Table.Eta"],
00088                              sd_dblmap["Table.Phi"]);
00089   }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:47:25 2009 for CMSSW by  doxygen 1.5.4