#include <EventFilter/DTRawToDigi/plugins/DTROS8Unpacker.h>
Public Member Functions | |
DTROS8Unpacker (const edm::ParameterSet &ps) | |
Constructor. | |
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) |
Unpacking method. | |
virtual | ~DTROS8Unpacker () |
Destructor. | |
Private Attributes | |
const edm::ParameterSet | pset |
Definition at line 20 of file DTROS8Unpacker.h.
DTROS8Unpacker::DTROS8Unpacker | ( | const edm::ParameterSet & | ps | ) | [inline] |
virtual DTROS8Unpacker::~DTROS8Unpacker | ( | ) | [inline, virtual] |
void DTROS8Unpacker::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 22 of file DTROS8Unpacker.cc.
References GenMuonPlsPt100GeV_cfg::cout, detId, e1, lat::endl(), edm::ParameterSet::getUntrackedParameter(), i, and pset.
00027 { 00028 00029 00031 const int wordLength = 4; 00032 int numberOfWords = datasize / wordLength; 00033 int robID = 0; 00034 int rosID = 0; 00035 int eventID = 0; 00036 int bunchID = 0; 00037 00038 map<int,int> hitOrder; 00039 00040 // Loop over the ROS8 words 00041 for ( int i = 1; i < numberOfWords; i++ ) { 00042 00043 // The word 00044 uint32_t word = index[i]; 00045 00046 // The word type 00047 int type = ( word >> 28 ) & 0xF; 00048 00049 // Event Header 00050 if ( type == 15 ) { 00051 robID = word & 0x7; 00052 rosID = ( word >> 3 ) & 0xFF; 00053 } 00054 00055 // TDC Header/Trailer 00056 else if ( type <= 3 ) { 00057 eventID = ( word >> 12 ) & 0xFFF; 00058 bunchID = word & 0xFFF; 00059 } 00060 00061 // TDC Measurement 00062 else if ( type >= 4 && type <= 5 ) { 00063 00064 int tdcID = ( word >> 24 ) & 0xF; 00065 int tdcChannel = ( word >> 19 ) & 0x1F; 00066 00067 int channelIndex = robID << 7 | tdcID << 5 | tdcChannel; 00068 hitOrder[channelIndex]++; 00069 00070 int tdcMeasurement = word & 0x7FFFF; 00071 tdcMeasurement >>= 2; 00072 00073 00074 try { 00075 00076 // Check the ddu ID in the mapping been used 00077 dduID = pset.getUntrackedParameter<int>("dduID",730); 00078 00079 // Map the RO channel to the DetId and wire 00080 DTWireId detId; 00081 if ( ! mapping->readOutToGeometry(dduID, rosID, robID, tdcID, tdcChannel,detId)) { 00082 if (pset.getUntrackedParameter<bool>("debugMode",false)) cout<<"[DTROS8Unpacker] "<<detId<<endl; 00083 int wire = detId.wire(); 00084 00085 // Produce the digi 00086 DTDigi digi(wire, tdcMeasurement, hitOrder[channelIndex]-1); 00087 00088 // Commit to the event 00089 product->insertDigi(detId.layerId(),digi); 00090 } 00091 else if (pset.getUntrackedParameter<bool>("debugMode",false)) 00092 cout<<"[DTROS8Unpacker] Missing wire!"<<endl; 00093 } 00094 00095 catch (cms::Exception & e1) { 00096 cout<<"[DTUnpackingModule]: WARNING: Digi not build!"<<endl; 00097 return; 00098 } 00099 } 00100 00101 } 00102 }
const edm::ParameterSet DTROS8Unpacker::pset [private] |