CMS 3D CMS Logo

Public Member Functions

hcaltb::HcalTBTriggerDataUnpacker Class Reference

#include <HcalTBTriggerDataUnpacker.h>

List of all members.

Public Member Functions

 HcalTBTriggerDataUnpacker (void)
void unpack (const FEDRawData &raw, HcalTBTriggerData &htbtd)

Detailed Description

Definition at line 9 of file HcalTBTriggerDataUnpacker.h.


Constructor & Destructor Documentation

hcaltb::HcalTBTriggerDataUnpacker::HcalTBTriggerDataUnpacker ( void  ) [inline]

Definition at line 11 of file HcalTBTriggerDataUnpacker.h.

{ }

Member Function Documentation

void hcaltb::HcalTBTriggerDataUnpacker::unpack ( const FEDRawData raw,
HcalTBTriggerData htbtd 
)

Definition at line 57 of file HcalTBTriggerDataUnpacker.cc.

References StandardTrgMsgBlkStruct::algo_bits_0, StandardTrgMsgBlkStruct::algo_bits_1, StandardTrgMsgBlkStruct::algo_bits_2, StandardTrgMsgBlkStruct::algo_bits_3, oldTriggerDataFormat::bunchNumber, ExpressReco_HICollisions_FallBack::cerr, FEDRawData::data(), StandardTrgMsgBlkStruct::eventNumber, StandardTrgMsgBlkStruct::flags_daq_ttype, StandardTrgMsgBlkStruct::gps_1234, StandardTrgMsgBlkStruct::gps_5678, StandardTrgMsgBlkStruct::orbitNumber, oldTriggerDataFormat::orbitNumber, oldTriggerDataFormat::runNumber, newExtendedTrgMsgBlkStruct::runNumber, newExtendedTrgMsgBlkStruct::runNumberSequenceId, oldTriggerDataFormat::runNumberSequenceId, HcalTBTriggerData::setExtendedData(), HcalTBTriggerData::setStandardData(), FEDRawData::size(), oldTriggerDataFormat::spillNumber, newExtendedTrgMsgBlkStruct::spillNumber, newExtendedTrgMsgBlkStruct::stdBlock, StandardTrgMsgBlkStruct::tech_bits, oldTriggerDataFormat::triggerNumber, newExtendedTrgMsgBlkStruct::triggerTime_base, oldTriggerDataFormat::triggerTime_base, newExtendedTrgMsgBlkStruct::triggerTime_usec, oldTriggerDataFormat::triggerTime_usec, oldTriggerDataFormat::triggerWord, and newExtendedTrgMsgBlkStruct::triggerWord.

Referenced by HcalTBObjectUnpacker::produce().

                                                                                        {

    // Use the size to determine which format we have received:
    //
    if (raw.size() == 80) { // "old" test beam trigger format

      const oldTriggerDataFormat *oldtrgblk = (const oldTriggerDataFormat *)(raw.data());
      htbtd.setStandardData(oldtrgblk->orbitNumber,
                            oldtrgblk->triggerNumber,
                            oldtrgblk->bunchNumber,
                            0,          // flags_daq_ttype
                            0, 0, 0, 0, // algo_bits_3->0
                            0,          // tech_bits
                            0, 0        // gps_1234, gps_5678
                            );

      htbtd.setExtendedData(oldtrgblk->triggerWord,
                            oldtrgblk->triggerTime_usec,
                            oldtrgblk->triggerTime_base,
                            oldtrgblk->spillNumber,
                            oldtrgblk->runNumber,
                            oldtrgblk->runNumberSequenceId);
    }
    else {

      const newExtendedTrgMsgBlk *newtrgblk;

      if (raw.size() == 96)  // "new" test beam trigger format,
                                   // 64-bit header
        newtrgblk = (const newExtendedTrgMsgBlk *)(raw.data()+8);

      else if (raw.size() == 104) // "new" test beam trigger format,
                                        // 128-bit header
        newtrgblk = (const newExtendedTrgMsgBlk *)(raw.data()+16);
      else {
        cerr << "HcalTBtdUnpacker.unpack: data of unknown size ";
        cerr << raw.size() << endl;
        return;
      }

      // get bunch number from the header
      //
      const uint32_t *cdflow = (const uint32_t *)raw.data();
      int bunch_id = (*cdflow)>>20;

      htbtd.setStandardData(newtrgblk->stdBlock.orbitNumber,
                            newtrgblk->stdBlock.eventNumber,
                            bunch_id,
                            newtrgblk->stdBlock.flags_daq_ttype,
                            newtrgblk->stdBlock.algo_bits_3,
                            newtrgblk->stdBlock.algo_bits_2,
                            newtrgblk->stdBlock.algo_bits_1,
                            newtrgblk->stdBlock.algo_bits_0,
                            newtrgblk->stdBlock.tech_bits,
                            newtrgblk->stdBlock.gps_1234,
                            newtrgblk->stdBlock.gps_5678);

      htbtd.setExtendedData(newtrgblk->triggerWord,
                            newtrgblk->triggerTime_usec,
                            newtrgblk->triggerTime_base,
                            newtrgblk->spillNumber,
                            newtrgblk->runNumber,
                            newtrgblk->runNumberSequenceId);
    }

  }