CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes
hcaltb::HcalTBSlowDataUnpacker Class Reference

Unpacks "SlowData" packages used for SiPM calibration and other purposes in HCAL Local DAQ. More...

#include <HcalTBSlowDataUnpacker.h>

Public Member Functions

 HcalTBSlowDataUnpacker (void)
 
void unpack (const FEDRawData &raw, HcalTBRunData &htbrd, HcalTBEventPosition &htbep) const
 
void unpackMaps (const FEDRawData &raw, std::map< std::string, std::string > &strings, std::map< std::string, double > &numerics) const
 

Static Public Attributes

static const int SIPM_CAL_FED_ID = 11
 
static const int STANDARD_FED_ID = 3
 

Detailed Description

Unpacks "SlowData" packages used for SiPM calibration and other purposes in HCAL Local DAQ.

To use this code in an analysis module, you need only:

analyze(const edm::Event& iEvent, const edm::EventSetup&) {

edm::Handle<edm::FEDRawDataCollection> rawraw;
iEvent.getByType(rawraw);
hcaltb::HcalTBSlowDataUnpacker sdp; std::map<std::string,std::string> strings; std::map<std::string,double> numerics; if regular slow data sdp.unpackMaps(rawraw->FEDData(hcaltb::HcalTBSlowDataUnpacker::STANDARD_FED_ID),strings,numerics); if SiPM Cal slow data (different 'FED') sdp.unpackMaps(rawraw->FEDData(hcaltb::HcalTBSlowDataUnpacker::SIPM_CAL_FED_ID),strings,numerics);

Definition at line 31 of file HcalTBSlowDataUnpacker.h.

Constructor & Destructor Documentation

◆ HcalTBSlowDataUnpacker()

hcaltb::HcalTBSlowDataUnpacker::HcalTBSlowDataUnpacker ( void  )
inline

Definition at line 33 of file HcalTBSlowDataUnpacker.h.

33 {}

Member Function Documentation

◆ unpack()

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

Definition at line 74 of file HcalTBSlowDataUnpacker.cc.

References HcalTBEventPosition::setHBHEtableCoords(), HcalTBEventPosition::setHFtableCoords(), and HcalTBRunData::setRunData().

Referenced by HcalTBObjectUnpacker::produce().

74  {
75  map<string, double> sd_dblmap;
76  map<string, string> sd_strmap;
77 
78  unpackMaps(raw, sd_strmap, sd_dblmap);
79 
80  // Now fill the input objects:
81  htbrd.setRunData(sd_strmap["RunType"].c_str(), sd_strmap["Beam.Mode"].c_str(), sd_dblmap["Beam.Energy"]);
82 
83  htbep.setHFtableCoords(sd_dblmap["HFTable.X"], sd_dblmap["HFTable.Y"], sd_dblmap["HFTable.V"]);
84 
85  htbep.setHBHEtableCoords(sd_dblmap["Table.Eta"], sd_dblmap["Table.Phi"]);
86  }
void unpackMaps(const FEDRawData &raw, std::map< std::string, std::string > &strings, std::map< std::string, double > &numerics) const
void setRunData(const char *run_type, const char *beam_mode, double beam_energy_gev)
Definition: HcalTBRunData.cc:7
void setHBHEtableCoords(double eta, double phi)
void setHFtableCoords(double x, double y, double v)

◆ unpackMaps()

void hcaltb::HcalTBSlowDataUnpacker::unpackMaps ( const FEDRawData raw,
std::map< std::string, std::string > &  strings,
std::map< std::string, double > &  numerics 
) const

Definition at line 28 of file HcalTBSlowDataUnpacker.cc.

References gather_cfg::cout, FEDRawData::data(), Exception, mps_fire::i, xdaqSlowDataFormat::key_length, xdaqSlowDataFormat::n_doubles, xdaqSlowDataFormat::n_strings, FEDRawData::size(), xdaqSlowDataFormat::start_of_data, xdaqSlowDataFormat::string_value_length, and makeListRunsInFiles::strings.

30  {
31  if (raw.size() < 3 * 8) {
32  throw cms::Exception("Missing Data") << "No data in the slow data block";
33  }
34 
35  const struct xdaqSlowDataFormat *sd = (const struct xdaqSlowDataFormat *)(raw.data());
36 
37 #ifdef DEBUG
38  cout << "#doubles = " << sd->n_doubles << endl;
39  ;
40  cout << "#strings = " << sd->n_strings << endl;
41  cout << "key_length = " << sd->key_length << endl;
42  cout << "string_value_length = " << sd->string_value_length << endl;
43 #endif
44 
45  // List of doubles:
46 
47  const char *keyptr = &sd->start_of_data;
48  const double *valptr = (const double *)(&sd->start_of_data + sd->n_doubles * sd->key_length);
49 
50  for (int i = 0; i < sd->n_doubles; i++) {
51 #ifdef DEBUG
52  cout << keyptr << " = " << *valptr << endl;
53 #endif
54  numerics[keyptr] = *valptr;
55  keyptr += sd->key_length;
56  valptr++;
57  }
58 
59  // List of strings:
60 
61  keyptr = (const char *)valptr;
62  const char *strptr = (keyptr + sd->n_strings * sd->key_length);
63 
64  for (int i = 0; i < sd->n_strings; i++) {
65 #ifdef DEBUG
66  cout << keyptr << " = " << strptr << endl;
67 #endif
68  strings[keyptr] = strptr;
69  keyptr += sd->key_length;
70  strptr += sd->string_value_length;
71  }
72  }
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24

Member Data Documentation

◆ SIPM_CAL_FED_ID

const int hcaltb::HcalTBSlowDataUnpacker::SIPM_CAL_FED_ID = 11
static

Definition at line 42 of file HcalTBSlowDataUnpacker.h.

◆ STANDARD_FED_ID

const int hcaltb::HcalTBSlowDataUnpacker::STANDARD_FED_ID = 3
static

Definition at line 41 of file HcalTBSlowDataUnpacker.h.