Go to the documentation of this file.00001 #include "RecoTBCalo/HcalTBObjectUnpacker/interface/HcalTBSourcePositionDataUnpacker.h"
00002 #include "FWCore/Utilities/interface/Exception.h"
00003 #include <iostream>
00004 #include <string>
00005 #include <map>
00006
00007 using namespace std;
00008
00010 struct xdaqSourcePositionDriverData {
00011 int message_counter;
00012 int timestamp1_sec;
00013 int timestamp1_usec;
00014 int status;
00015 int index_counter;
00016 int reel_counter;
00017 int motor_current;
00018 int speed;
00019 int timestamp2_sec;
00020 int timestamp2_usec;
00021 };
00022
00023 struct xdaqSourcePositionDataFormat {
00024 int cdfHeader[4];
00025 int maxDrivers;
00026 unsigned int globalStatus;
00027 xdaqSourcePositionDriverData driverInfo[4];
00028 unsigned int word1_low;
00029 unsigned int word1_high;
00030 };
00031
00032 namespace hcaltb {
00033
00034 void HcalTBSourcePositionDataUnpacker::unpack(const FEDRawData& raw,
00035 HcalSourcePositionData& hspd) const {
00036
00037 const struct xdaqSourcePositionDataFormat* sp =
00038 (const struct xdaqSourcePositionDataFormat*)(raw.data());
00039
00040 if (raw.size()<sizeof(xdaqSourcePositionDataFormat)) {
00041 throw cms::Exception("DataFormatError","Fragment too small");
00042 }
00043
00044
00045 hspd.set(sp->driverInfo[0].message_counter,
00046 sp->driverInfo[0].timestamp1_sec,
00047 sp->driverInfo[0].timestamp1_usec,
00048 sp->driverInfo[0].timestamp2_sec,
00049 sp->driverInfo[0].timestamp2_usec,
00050 sp->driverInfo[0].status,
00051 sp->driverInfo[0].index_counter,
00052 sp->driverInfo[0].reel_counter,
00053 sp->driverInfo[0].motor_current,
00054 sp->driverInfo[0].speed,
00055 -1,
00056 -1,
00057 -1);
00058
00059 return;
00060 }
00061 }
00062