![]() |
![]() |
00001 00008 #include <DataFormats/FEDRawData/interface/FEDTrailer.h> 00009 #include "fed_trailer.h" 00010 00011 FEDTrailer::FEDTrailer(const unsigned char* trailer) : 00012 theTrailer(reinterpret_cast<const fedt_t*>(trailer)) {} 00013 00014 00015 FEDTrailer::~FEDTrailer(){} 00016 00017 00018 00019 int FEDTrailer::lenght(){ 00020 return (theTrailer->eventsize & FED_EVSZ_MASK) >> FED_EVSZ_SHIFT; 00021 } 00022 00023 00024 int FEDTrailer::crc(){ 00025 return ((theTrailer->conscheck & FED_CRCS_MASK) >> FED_CRCS_SHIFT); 00026 } 00027 00028 00029 int FEDTrailer::evtStatus(){ 00030 return ((theTrailer->conscheck & FED_STAT_MASK) >> FED_STAT_SHIFT); 00031 } 00032 00033 00034 int FEDTrailer::ttsBits(){ 00035 return ((theTrailer->conscheck & FED_TTSI_MASK) >> FED_TTSI_SHIFT); 00036 } 00037 00038 00039 bool FEDTrailer::moreTrailers(){ 00040 return ((theTrailer->conscheck & FED_MORE_TRAILERS)!=0); 00041 } 00042 00043 00044 void FEDTrailer::set(unsigned char* trailer, 00045 int evt_lgth, 00046 int crc, 00047 int evt_stat, 00048 int tts, 00049 bool T){ 00050 // FIXME: should check that input ranges are OK!!! 00051 fedt_t* t = reinterpret_cast<fedt_t*>(trailer); 00052 00053 t->eventsize = 00054 FED_TCTRLID | 00055 evt_lgth << FED_EVSZ_SHIFT; 00056 00057 t->conscheck = 00058 crc << FED_CRCS_SHIFT | 00059 evt_stat << FED_STAT_SHIFT | 00060 tts << FED_TTSI_SHIFT; 00061 00062 if (T) t->conscheck |= FED_MORE_TRAILERS; 00063 } 00064 00065 00066 bool FEDTrailer::check(){ 00067 // ...may report with finer detail 00068 bool result = true; 00069 result &= ((theTrailer->eventsize & FED_TCTRLID_MASK) == FED_TCTRLID); 00070 00071 return result; 00072 }