CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTROS8Unpacker Class Reference

#include <DTROS8Unpacker.h>

Inheritance diagram for DTROS8Unpacker:
DTUnpacker

List of all members.

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)
virtual ~DTROS8Unpacker ()
 Destructor.

Private Attributes

const edm::ParameterSet pset

Detailed Description

The unpacker for DTs' ROS8: final version of Read Out Sector board with 25 channels.

Date:
2007/05/07 16:16:39
Revision:
1.3
Author:
M. Zanetti INFN Padova FRC 140906

Definition at line 20 of file DTROS8Unpacker.h.


Constructor & Destructor Documentation

DTROS8Unpacker::DTROS8Unpacker ( const edm::ParameterSet ps) [inline]

Constructor.

Definition at line 25 of file DTROS8Unpacker.h.

: pset(ps) {}
virtual DTROS8Unpacker::~DTROS8Unpacker ( ) [inline, virtual]

Destructor.

Definition at line 28 of file DTROS8Unpacker.h.

{}

Member Function Documentation

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

CopyAndPaste from P. Ronchese unpacker

Implements DTUnpacker.

Definition at line 22 of file DTROS8Unpacker.cc.

References gather_cfg::cout, and i.

                                                        {
 

  const int wordLength = 4;
  int numberOfWords = datasize / wordLength;
  int robID = 0;
  int rosID = 0;
  int eventID = 0;
  int bunchID = 0;

  map<int,int> hitOrder;

  // Loop over the ROS8 words
  for ( int i = 1; i < numberOfWords; i++ ) {

    // The word
    uint32_t word = index[i];

    // The word type
    int type = ( word >> 28 ) & 0xF;

    // Event Header 
    if ( type == 15 ) {
      robID =   word        & 0x7;
      rosID = ( word >> 3 ) & 0xFF;
    } 

    // TDC Header/Trailer
    else if ( type <= 3 ) {
      eventID = ( word >> 12 ) & 0xFFF;
      bunchID =   word &         0xFFF; 
    }

    // TDC Measurement
    else if ( type >= 4 && type <= 5 ) {
      
      int tdcID = ( word >> 24 ) & 0xF;
      int tdcChannel = ( word >> 19 ) & 0x1F;

      int channelIndex = robID << 7 | tdcID << 5 | tdcChannel;
      hitOrder[channelIndex]++;

      int tdcMeasurement =  word  & 0x7FFFF;
      tdcMeasurement >>= 2;


      try {

        // Check the ddu ID in the mapping been used
        dduID = pset.getUntrackedParameter<int>("dduID",730);

        // Map the RO channel to the DetId and wire
        DTWireId detId; 
        if ( ! mapping->readOutToGeometry(dduID, rosID, robID, tdcID, tdcChannel,detId)) {
          if (pset.getUntrackedParameter<bool>("debugMode",false)) cout<<"[DTROS8Unpacker] "<<detId<<endl;
          int wire = detId.wire();
          
          // Produce the digi
          DTDigi digi(wire, tdcMeasurement, hitOrder[channelIndex]-1);
          
          // Commit to the event
          product->insertDigi(detId.layerId(),digi);
        }
        else if (pset.getUntrackedParameter<bool>("debugMode",false)) 
          cout<<"[DTROS8Unpacker] Missing wire!"<<endl;
      }

      catch (cms::Exception & e1) {
        cout<<"[DTUnpackingModule]: WARNING: Digi not build!"<<endl; 
        return;
      }
    }
    
  }
}

Member Data Documentation

Definition at line 40 of file DTROS8Unpacker.h.