test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
virtual void interpretRawData (const unsigned int *index, int datasize, int dduID, edm::ESHandle< DTReadOutMapping > &mapping, std::auto_ptr< DTDigiCollection > &product, std::auto_ptr< DTLocalTriggerCollection > &product2, uint16_t rosList=0)
 
virtual ~DTDDUUnpacker ()
 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 ( const edm::ParameterSet ps)

Constructor.

Definition at line 20 of file DTDDUUnpacker.cc.

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

20  : dduPSet(ps) {
21  // the ROS unpacker
23 
24  // parameters
25  localDAQ = dduPSet.getUntrackedParameter<bool>("localDAQ",false);
26  debug = dduPSet.getUntrackedParameter<bool>("debug",false);
27 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DTROS25Unpacker * ros25Unpacker
Definition: DTDDUUnpacker.h:55
bool localDAQ
if data are read locally, status words are swapped
Definition: DTDDUUnpacker.h:48
const edm::ParameterSet dduPSet
Definition: DTDDUUnpacker.h:45
DTDDUUnpacker::~DTDDUUnpacker ( )
virtual

Destructor.

Definition at line 29 of file DTDDUUnpacker.cc.

References ros25Unpacker.

29  {
30  delete ros25Unpacker;
31 }
DTROS25Unpacker * ros25Unpacker
Definition: DTDDUUnpacker.h:55

Member Function Documentation

const DTDDUData& DTDDUUnpacker::getDDUControlData ( ) const
inline

Definition at line 39 of file DTDDUUnpacker.h.

References controlData.

39  {
40  return controlData;
41  }
DTDDUData controlData
Definition: DTDDUUnpacker.h:57
const std::vector<DTROS25Data>& DTDDUUnpacker::getROSsControlData ( ) const
inline

Definition at line 35 of file DTDDUUnpacker.h.

References DTROS25Unpacker::getROSsControlData(), and ros25Unpacker.

35  {
37  }
DTROS25Unpacker * ros25Unpacker
Definition: DTDDUUnpacker.h:55
const std::vector< DTROS25Data > & getROSsControlData() const
void DTDDUUnpacker::interpretRawData ( const unsigned int *  index,
int  datasize,
int  dduID,
edm::ESHandle< DTReadOutMapping > &  mapping,
std::auto_ptr< DTDigiCollection > &  product,
std::auto_ptr< DTLocalTriggerCollection > &  product2,
uint16_t  rosList = 0 
)
virtual

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 34 of file DTDDUUnpacker.cc.

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

39  {
40 
41  // Definitions
42  const int wordSize_32 = 4;
43  const int wordSize_64 = 8;
44 
45  int numberOf32Words = datasize/wordSize_32;
46 
47  const unsigned char* index8 = reinterpret_cast<const unsigned char*>(index32);
48 
49 
51  /* D D U d a t a */
53 
54  // DDU header
55  FEDHeader dduHeader(index8);
56  if (dduHeader.check()) {
57  if(debug) cout << "[DTDDUUnpacker] FED Header. BXID: "<<dduHeader.bxID()
58  << " L1ID: "<<dduHeader.lvl1ID() <<endl;
59  } else {
60  LogWarning("DTRawToDigi|DTDDUUnpacker") << "[DTDDUUnpacker] WARNING!, this is not a DDU Header, FED ID: "
61  << dduID << endl;
62  }
63 
64  // DDU trailer
65  // [BITS] stop before FED trailer := 8 bytes
66  FEDTrailer dduTrailer(index8 + datasize - 1*wordSize_64);
67 
68  if (dduTrailer.check()) {
69  if(debug) cout << "[DTDDUUnpacker] FED Trailer. Lenght of the DT event: "
70  << dduTrailer.lenght() << endl;
71  } else {
72  LogWarning("DTRawToDigi|DTDDUUnpacker") << "[DTDDUUnpacker] WARNING!, this is not a DDU Trailer, FED ID: "
73  << dduID << endl;
74  }
75 
76 
77  // Initialize control data
79  controlData.addDDUHeader(dduHeader);
80  controlData.addDDUTrailer(dduTrailer);
81  // check the CRC set in the FED trailer (FCRC errors)
82  controlData.checkCRCBit(index8 + datasize - 1*wordSize_64);
83 
84  // Check Status Words
85  vector<DTDDUFirstStatusWord> rosStatusWords;
86  // [BITS] 3 words of 8 bytes + "rosId" bytes
87  // In the case we are reading from DMA, the status word are swapped as the ROS data
88  if (localDAQ) {
89  // DDU channels from 1 to 4
90  for (int rosId = 0; rosId < 4; rosId++ ) {
91  int wordIndex8 = numberOf32Words*wordSize_32 - 3*wordSize_64 + wordSize_32 + rosId;
93  }
94  // DDU channels from 5 to 8
95  for (int rosId = 0; rosId < 4; rosId++ ) {
96  int wordIndex8 = numberOf32Words*wordSize_32 - 3*wordSize_64 + rosId;
98  }
99  // DDU channels from 9 to 12
100  for (int rosId = 0; rosId < 4; rosId++ ) {
101  int wordIndex8 = numberOf32Words*wordSize_32 - 2*wordSize_64 + wordSize_32 + rosId;
103  }
104  }
105  else {
106  for (int rosId = 0; rosId < 12; rosId++ ) {
107  int wordIndex8 = numberOf32Words*wordSize_32 - 3*wordSize_64 + rosId;
109  }
110  }
111 
112  int theROSList;
113  // [BITS] 2 words of 8 bytes + 4 bytes (half 64 bit word)
114  // In the case we are reading from DMA, the status word are swapped as the ROS data
115  if (localDAQ) {
116  DTDDUSecondStatusWord dduStatusWord(index32[numberOf32Words - 2*wordSize_64/wordSize_32]);
117  controlData.addDDUStatusWord(dduStatusWord);
118  theROSList = dduStatusWord.rosList();
119  }
120  else {
121  DTDDUSecondStatusWord dduStatusWord(index32[numberOf32Words - 2*wordSize_64/wordSize_32 + 1]);
122  controlData.addDDUStatusWord(dduStatusWord);
123  theROSList = dduStatusWord.rosList();
124  }
125 
126 
128  /* R O S d a t a */
130 
131  // Set the index to start looping on ROS data
132  // [BITS] one 8 bytes word
133  index32 += (wordSize_64)/wordSize_32;
134 
135  // Set the datasize to look only at ROS data
136  // [BITS] header, trailer, 2 status words
137  datasize -= 4*wordSize_64;
138 
139  // unpacking the ROS payload
140  ros25Unpacker->interpretRawData(index32, datasize, dduID, mapping, detectorProduct, triggerProduct, theROSList);
141 
142 }
void addDDUStatusWord(const DTDDUSecondStatusWord &word)
void addROSStatusWord(const DTDDUFirstStatusWord &word)
virtual void interpretRawData(const unsigned int *index, int datasize, int dduID, edm::ESHandle< DTReadOutMapping > &mapping, std::auto_ptr< DTDigiCollection > &product, std::auto_ptr< DTLocalTriggerCollection > &product2, uint16_t rosList=0)
DTROS25Unpacker * ros25Unpacker
Definition: DTDDUUnpacker.h:55
void addDDUHeader(const FEDHeader &word)
Setters.
void addDDUTrailer(const FEDTrailer &word)
bool localDAQ
if data are read locally, status words are swapped
Definition: DTDDUUnpacker.h:48
void checkCRCBit(const unsigned char *trailer)
void clean()
tuple cout
Definition: gather_cfg.py:145
DTDDUData controlData
Definition: DTDDUUnpacker.h:57

Member Data Documentation

DTDDUData DTDDUUnpacker::controlData
private

Definition at line 57 of file DTDDUUnpacker.h.

Referenced by getDDUControlData(), and interpretRawData().

const edm::ParameterSet DTDDUUnpacker::dduPSet
private

Definition at line 45 of file DTDDUUnpacker.h.

Referenced by DTDDUUnpacker().

bool DTDDUUnpacker::debug
private
bool DTDDUUnpacker::localDAQ
private

if data are read locally, status words are swapped

Definition at line 48 of file DTDDUUnpacker.h.

Referenced by DTDDUUnpacker(), and interpretRawData().

bool DTDDUUnpacker::performDataIntegrityMonitor
private

perform DQM for DDU

Definition at line 51 of file DTDDUUnpacker.h.

DTROS25Unpacker* DTDDUUnpacker::ros25Unpacker
private