ATLAS Offline Software
EfexTobPacker.cxx
Go to the documentation of this file.
2 
3 #include <iostream>
4 #include <cstdlib>
5 #include <cmath>
6 #include <map>
7 
8 
9 std::vector<FibrePackerBase::myDataWord>
10 EfexTobPacker::getPackedData(const std::vector<myDataWord>& inFrame, myDataWord bcNumber, InputDataFrameType /*frameType*/) const
11 {
12  size_t sz = inFrame.size();
13  std::vector<myDataWord> dataToLoad(FexDefs::num32BitWordsPerFibre(),0);
14  for ( size_t i = 0 ; i < sz ; ++i )
15  dataToLoad.at(i) = inFrame.at(i);
16  dataToLoad.at(6) = 0x1000; // Is an eFEX
17  dataToLoad.at(6) |= (bcNumber&0xf)<<8; // Lowest bits of BCID
18  dataToLoad.at(6) |= crc9full(dataToLoad,224)<<23; // Add CRC, 224 = 32*7 = full frame
19  dataToLoad.at(6) |= K_28_5; // add K-character
20 
21  return dataToLoad;
22 
23 }
24 
25 std::vector<FibrePackerBase::myDataWord>
26 EfexTobPacker::getPackedControl(const std::vector<myDataWord>& /*inFrame*/, myDataWord /*bcNumber*/, InputDataFrameType /*frameType*/) const
27 {
28  std::vector<myDataWord> controlWords(FexDefs::num32BitWordsPerFibre(),0);
29  return controlWords;
30 }
31 
32 bool
33 EfexTobPacker::checkCRC(const std::vector<myDataWord>& encodedData, InputDataFrameType /*frameType*/) const
34 {
35  auto inputData = encodedData;
36  inputData.at(0) = inputData.at(0) & 0xffffff00;
37  // calculate CRC on 224 bits = 7*32 bit words
38  return (crc9full(inputData,224) == 0);
39 }
40 
42 EfexTobPacker::getBcNumber(const std::vector<myDataWord>& encodedData, InputDataFrameType /*frameType*/) const
43 {
44  return ((encodedData.at(6)>>8)&0xf);
45 }
46 
47 std::vector<FibrePackerBase::myDataWord>
48 EfexTobPacker::getUnpackedData(const std::vector<myDataWord>& encodedData, InputDataFrameType /*frameType*/) const
49 {
50  return encodedData;
51 }
52 
FexDefs::num32BitWordsPerFibre
static int num32BitWordsPerFibre()
Definition: FexDefs.h:17
fitman.sz
sz
Definition: fitman.py:527
EfexTobPacker.h
FibrePackerBase::K_28_5
myDataWord K_28_5
Definition: FibrePackerBase.h:30
EfexTobPacker::checkCRC
virtual bool checkCRC(const std::vector< myDataWord > &encodedData, InputDataFrameType frameType) const override
Definition: EfexTobPacker.cxx:33
EfexTobPacker::getUnpackedData
virtual std::vector< myDataWord > getUnpackedData(const std::vector< myDataWord > &encodedData, InputDataFrameType frameType) const override
Definition: EfexTobPacker.cxx:48
FibrePackerBase::crc9full
virtual myDataWord crc9full(const std::vector< myDataWord > &inwords, size_t num_bits) const
Functions calculating CRC over input data.
Definition: FibrePackerBase.cxx:8
EfexTobPacker::getPackedControl
virtual std::vector< myDataWord > getPackedControl(const std::vector< myDataWord > &inFrame, myDataWord bcNumber, InputDataFrameType frameType) const override
Function returning control words.
Definition: EfexTobPacker.cxx:26
lumiFormat.i
int i
Definition: lumiFormat.py:85
FibrePackerBase::InputDataFrameType
InputDataFrameType
type of input data frame
Definition: FibrePackerBase.h:37
FibrePackerBase::myDataWord
uint32_t myDataWord
Definition: FibrePackerBase.h:25
EfexTobPacker::getPackedData
virtual std::vector< myDataWord > getPackedData(const std::vector< myDataWord > &inFrame, myDataWord bcNumber, InputDataFrameType frameType) const override
Function taking SC energies and other stuff and packing them into a data packet.
Definition: EfexTobPacker.cxx:10
EfexTobPacker::getBcNumber
virtual myDataWord getBcNumber(const std::vector< myDataWord > &encodedData, InputDataFrameType frameType) const override
Definition: EfexTobPacker.cxx:42