CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

hcaltb::HcalTBSlowDataUnpacker::HcalTBSlowDataUnpacker ( void  )
inline

Definition at line 33 of file HcalTBSlowDataUnpacker.h.

33 { }

Member Function Documentation

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().

76  {
77 
78  map<string,double> sd_dblmap;
79  map<string,string> sd_strmap;
80 
81  unpackMaps(raw,sd_strmap,sd_dblmap);
82 
83  // Now fill the input objects:
84  htbrd.setRunData(sd_strmap["RunType"].c_str(),
85  sd_strmap["Beam.Mode"].c_str(),
86  sd_dblmap["Beam.Energy"]);
87 
88  htbep.setHFtableCoords(sd_dblmap["HFTable.X"],
89  sd_dblmap["HFTable.Y"],
90  sd_dblmap["HFTable.V"]);
91 
92  htbep.setHBHEtableCoords(sd_dblmap["Table.Eta"],
93  sd_dblmap["Table.Phi"]);
94  }
void setRunData(const char *run_type, const char *beam_mode, double beam_energy_gev)
void setHBHEtableCoords(double eta, double phi)
void unpackMaps(const FEDRawData &raw, std::map< std::string, std::string > &strings, std::map< std::string, double > &numerics) const
void setHFtableCoords(double x, double y, double v)
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(), edm::hlt::Exception, i, xdaqSlowDataFormat::key_length, xdaqSlowDataFormat::n_doubles, xdaqSlowDataFormat::n_strings, sd, FEDRawData::size(), xdaqSlowDataFormat::start_of_data, and xdaqSlowDataFormat::string_value_length.

28  {
29 
30  if (raw.size()<3*8) {
31  throw cms::Exception("Missing Data") << "No data in the slow data block";
32  }
33 
34  const struct xdaqSlowDataFormat *sd =
35  (const struct xdaqSlowDataFormat *)(raw.data());
36 
37 #ifdef DEBUG
38  cout << "#doubles = " << sd->n_doubles << endl;;
39  cout << "#strings = " << sd->n_strings << endl;
40  cout << "key_length = " << sd->key_length << endl;
41  cout << "string_value_length = " << sd->string_value_length << endl;
42 #endif
43 
44  // List of doubles:
45 
46  const char *keyptr = &sd->start_of_data;
47  const double *valptr =
48  (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  }
int i
Definition: DBlmapReader.cc:9
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
double sd
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

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

Definition at line 42 of file HcalTBSlowDataUnpacker.h.

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

Definition at line 41 of file HcalTBSlowDataUnpacker.h.