CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTDDUUnpacker Class Reference

#include <DTDDUUnpacker.h>

Inheritance diagram for DTDDUUnpacker:
DTUnpacker

Public Member Functions

 DTDDUUnpacker (const edm::ParameterSet &ps)
 Constructor. More...
 
const DTDDUDatagetDDUControlData () const
 
const std::vector< DTROS25Data > & getROSsControlData () const
 
void interpretRawData (const unsigned int *index, int datasize, int dduID, edm::ESHandle< DTReadOutMapping > &mapping, std::unique_ptr< DTDigiCollection > &product, std::unique_ptr< DTLocalTriggerCollection > &product2, uint16_t rosList=0) override
 
 ~DTDDUUnpacker () override
 Destructor. More...
 
- Public Member Functions inherited from DTUnpacker
 DTUnpacker ()
 Constructor. More...
 
virtual ~DTUnpacker ()
 Destructor. More...
 

Private Attributes

DTDDUData controlData
 
const edm::ParameterSet dduPSet
 
bool debug
 
bool localDAQ
 if data are read locally, status words are swapped More...
 
bool performDataIntegrityMonitor
 perform DQM for DDU More...
 
DTROS25Unpackerros25Unpacker
 

Detailed Description

The unpacker for DTs' FED.

Author
M. Zanetti INFN Padova FRC 060906

Definition at line 17 of file DTDDUUnpacker.h.

Constructor & Destructor Documentation

◆ DTDDUUnpacker()

DTDDUUnpacker::DTDDUUnpacker ( const edm::ParameterSet ps)

Constructor.

Definition at line 19 of file DTDDUUnpacker.cc.

19  : dduPSet(ps) {
20  // the ROS unpacker
22 
23  // parameters
24  localDAQ = dduPSet.getUntrackedParameter<bool>("localDAQ", false);
25  debug = dduPSet.getUntrackedParameter<bool>("debug", false);
26 }

References dduPSet, debug, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), localDAQ, and ros25Unpacker.

◆ ~DTDDUUnpacker()

DTDDUUnpacker::~DTDDUUnpacker ( )
override

Destructor.

Definition at line 28 of file DTDDUUnpacker.cc.

28 { delete ros25Unpacker; }

References ros25Unpacker.

Member Function Documentation

◆ getDDUControlData()

const DTDDUData& DTDDUUnpacker::getDDUControlData ( ) const
inline

Definition at line 36 of file DTDDUUnpacker.h.

36 { return controlData; }

References controlData.

◆ getROSsControlData()

const std::vector<DTROS25Data>& DTDDUUnpacker::getROSsControlData ( ) const
inline

Definition at line 34 of file DTDDUUnpacker.h.

34 { return ros25Unpacker->getROSsControlData(); }

References DTROS25Unpacker::getROSsControlData(), and ros25Unpacker.

◆ interpretRawData()

void DTDDUUnpacker::interpretRawData ( const unsigned int *  index,
int  datasize,
int  dduID,
edm::ESHandle< DTReadOutMapping > &  mapping,
std::unique_ptr< DTDigiCollection > &  product,
std::unique_ptr< DTLocalTriggerCollection > &  product2,
uint16_t  rosList = 0 
)
overridevirtual

Unpacking method. index is the pointer to the beginning of the buffer. datasize is the size of the buffer in bytes

Implements DTUnpacker.

Definition at line 30 of file DTDDUUnpacker.cc.

36  {
37  // Definitions
38  const int wordSize_32 = 4;
39  const int wordSize_64 = 8;
40 
41  int numberOf32Words = datasize / wordSize_32;
42 
43  const unsigned char* index8 = reinterpret_cast<const unsigned char*>(index32);
44 
46  /* D D U d a t a */
48 
49  // DDU header
50  FEDHeader dduHeader(index8);
51  if (dduHeader.check()) {
52  if (debug)
53  cout << "[DTDDUUnpacker] FED Header. BXID: " << dduHeader.bxID() << " L1ID: " << dduHeader.lvl1ID() << endl;
54  } else {
55  LogWarning("DTRawToDigi|DTDDUUnpacker")
56  << "[DTDDUUnpacker] WARNING!, this is not a DDU Header, FED ID: " << dduID << endl;
57  }
58 
59  // DDU trailer
60  // [BITS] stop before FED trailer := 8 bytes
61  FEDTrailer dduTrailer(index8 + datasize - 1 * wordSize_64);
62 
63  if (dduTrailer.check()) {
64  if (debug)
65  cout << "[DTDDUUnpacker] FED Trailer. Length of the DT event: " << dduTrailer.fragmentLength() << endl;
66  } else {
67  LogWarning("DTRawToDigi|DTDDUUnpacker")
68  << "[DTDDUUnpacker] WARNING!, this is not a DDU Trailer, FED ID: " << dduID << endl;
69  }
70 
71  // Initialize control data
73  controlData.addDDUHeader(dduHeader);
74  controlData.addDDUTrailer(dduTrailer);
75  // check the CRC set in the FED trailer (FCRC errors)
76  controlData.checkCRCBit(index8 + datasize - 1 * wordSize_64);
77 
78  // Check Status Words
79  vector<DTDDUFirstStatusWord> rosStatusWords;
80  // [BITS] 3 words of 8 bytes + "rosId" bytes
81  // In the case we are reading from DMA, the status word are swapped as the ROS data
82  if (localDAQ) {
83  // DDU channels from 1 to 4
84  for (int rosId = 0; rosId < 4; rosId++) {
85  int wordIndex8 = numberOf32Words * wordSize_32 - 3 * wordSize_64 + wordSize_32 + rosId;
87  }
88  // DDU channels from 5 to 8
89  for (int rosId = 0; rosId < 4; rosId++) {
90  int wordIndex8 = numberOf32Words * wordSize_32 - 3 * wordSize_64 + rosId;
92  }
93  // DDU channels from 9 to 12
94  for (int rosId = 0; rosId < 4; rosId++) {
95  int wordIndex8 = numberOf32Words * wordSize_32 - 2 * wordSize_64 + wordSize_32 + rosId;
97  }
98  } else {
99  for (int rosId = 0; rosId < 12; rosId++) {
100  int wordIndex8 = numberOf32Words * wordSize_32 - 3 * wordSize_64 + rosId;
102  }
103  }
104 
105  int theROSList;
106  // [BITS] 2 words of 8 bytes + 4 bytes (half 64 bit word)
107  // In the case we are reading from DMA, the status word are swapped as the ROS data
108  if (localDAQ) {
109  DTDDUSecondStatusWord dduStatusWord(index32[numberOf32Words - 2 * wordSize_64 / wordSize_32]);
110  controlData.addDDUStatusWord(dduStatusWord);
111  theROSList = dduStatusWord.rosList();
112  } else {
113  DTDDUSecondStatusWord dduStatusWord(index32[numberOf32Words - 2 * wordSize_64 / wordSize_32 + 1]);
114  controlData.addDDUStatusWord(dduStatusWord);
115  theROSList = dduStatusWord.rosList();
116  }
117 
119  /* R O S d a t a */
121 
122  // Set the index to start looping on ROS data
123  // [BITS] one 8 bytes word
124  index32 += (wordSize_64) / wordSize_32;
125 
126  // Set the datasize to look only at ROS data
127  // [BITS] header, trailer, 2 status words
128  datasize -= 4 * wordSize_64;
129 
130  // unpacking the ROS payload
131  ros25Unpacker->interpretRawData(index32, datasize, dduID, mapping, detectorProduct, triggerProduct, theROSList);
132 }

References DTDDUData::addDDUHeader(), DTDDUData::addDDUStatusWord(), DTDDUData::addDDUTrailer(), DTDDUData::addROSStatusWord(), FEDHeader::bxID(), FEDHeader::check(), FEDTrailer::check(), DTDDUData::checkCRCBit(), DTDDUData::clean(), controlData, gather_cfg::cout, debug, FEDTrailer::fragmentLength(), DTROS25Unpacker::interpretRawData(), localDAQ, FEDHeader::lvl1ID(), taus_updatedMVAIds_cff::mapping, ros25Unpacker, and DTDDUSecondStatusWord::rosList().

Member Data Documentation

◆ controlData

DTDDUData DTDDUUnpacker::controlData
private

Definition at line 51 of file DTDDUUnpacker.h.

Referenced by getDDUControlData(), and interpretRawData().

◆ dduPSet

const edm::ParameterSet DTDDUUnpacker::dduPSet
private

Definition at line 39 of file DTDDUUnpacker.h.

Referenced by DTDDUUnpacker().

◆ debug

bool DTDDUUnpacker::debug
private

◆ localDAQ

bool DTDDUUnpacker::localDAQ
private

if data are read locally, status words are swapped

Definition at line 42 of file DTDDUUnpacker.h.

Referenced by DTDDUUnpacker(), and interpretRawData().

◆ performDataIntegrityMonitor

bool DTDDUUnpacker::performDataIntegrityMonitor
private

perform DQM for DDU

Definition at line 45 of file DTDDUUnpacker.h.

◆ ros25Unpacker

DTROS25Unpacker* DTDDUUnpacker::ros25Unpacker
private
DTDDUFirstStatusWord
Definition: DTDDUWords.h:638
DTDDUUnpacker::ros25Unpacker
DTROS25Unpacker * ros25Unpacker
Definition: DTDDUUnpacker.h:49
DTROS25Unpacker
Definition: DTROS25Unpacker.h:18
DTDDUUnpacker::dduPSet
const edm::ParameterSet dduPSet
Definition: DTDDUUnpacker.h:39
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTDDUUnpacker::controlData
DTDDUData controlData
Definition: DTDDUUnpacker.h:51
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DTROS25Unpacker::getROSsControlData
const std::vector< DTROS25Data > & getROSsControlData() const
Definition: DTROS25Unpacker.h:35
DTDDUData::checkCRCBit
void checkCRCBit(const unsigned char *trailer)
Definition: DTControlData.h:120
DTDDUUnpacker::localDAQ
bool localDAQ
if data are read locally, status words are swapped
Definition: DTDDUUnpacker.h:42
edm::LogWarning
Definition: MessageLogger.h:141
edm::ParameterSet
Definition: ParameterSet.h:36
FEDTrailer
Definition: FEDTrailer.h:14
DTDDUData::addDDUStatusWord
void addDDUStatusWord(const DTDDUSecondStatusWord &word)
Definition: DTControlData.h:119
DTDDUUnpacker::debug
bool debug
Definition: DTDDUUnpacker.h:47
DTDDUData::addDDUTrailer
void addDDUTrailer(const FEDTrailer &word)
Definition: DTControlData.h:117
DTDDUData::clean
void clean()
Definition: DTControlData.h:133
DTDDUData::addDDUHeader
void addDDUHeader(const FEDHeader &word)
Setters.
Definition: DTControlData.h:116
DTDDUSecondStatusWord
Definition: DTDDUWords.h:670
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
FEDHeader
Definition: FEDHeader.h:14
DTROS25Unpacker::interpretRawData
void interpretRawData(const unsigned int *index, int datasize, int dduID, edm::ESHandle< DTReadOutMapping > &mapping, std::unique_ptr< DTDigiCollection > &product, std::unique_ptr< DTLocalTriggerCollection > &product2, uint16_t rosList=0) override
Definition: DTROS25Unpacker.cc:41
taus_updatedMVAIds_cff.mapping
mapping
Definition: taus_updatedMVAIds_cff.py:28
DTDDUData::addROSStatusWord
void addROSStatusWord(const DTDDUFirstStatusWord &word)
Definition: DTControlData.h:118