CMS 3D CMS Logo

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>

List of all members.

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.

{ }

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

                                                                             {
    
    map<string,double> sd_dblmap;
    map<string,string> sd_strmap;
    
    unpackMaps(raw,sd_strmap,sd_dblmap);
    
    // 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"]);
  }
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, i, xdaqSlowDataFormat::key_length, xdaqSlowDataFormat::n_doubles, xdaqSlowDataFormat::n_strings, sd, FEDRawData::size(), xdaqSlowDataFormat::start_of_data, and xdaqSlowDataFormat::string_value_length.

                                                                                                                                                  {
    
    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());
    
#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
      numerics[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
      strings[keyptr] = strptr;
      keyptr += sd->key_length;
      strptr += sd->string_value_length;
    }
  }

Member Data Documentation

Definition at line 42 of file HcalTBSlowDataUnpacker.h.

Definition at line 41 of file HcalTBSlowDataUnpacker.h.