CMS 3D CMS Logo

Public Member Functions | Private Attributes

sistrip::DigiToRawModule Class Reference

A plug-in module that takes StripDigis as input from the Event and creates an EDProduct comprising a FEDRawDataCollection. More...

#include <SiStripDigiToRawModule.h>

Inheritance diagram for sistrip::DigiToRawModule:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginJob ()
 DigiToRawModule (const edm::ParameterSet &)
virtual void endJob ()
virtual void produce (edm::Event &, const edm::EventSetup &)
 ~DigiToRawModule ()

Private Attributes

DigiToRawdigiToRaw_
uint32_t eventCounter_
std::string inputDigiLabel_
std::string inputModuleLabel_
FEDReadoutMode mode_
bool rawdigi_

Detailed Description

A plug-in module that takes StripDigis as input from the Event and creates an EDProduct comprising a FEDRawDataCollection.

Definition at line 22 of file SiStripDigiToRawModule.h.


Constructor & Destructor Documentation

sistrip::DigiToRawModule::DigiToRawModule ( const edm::ParameterSet pset)

Creates instance of DigiToRaw converter, defines EDProduct type.

Definition at line 24 of file SiStripDigiToRawModule.cc.

References DigiToRaw_cff::DigiToRaw, digiToRaw_, edm::ParameterSet::getParameter(), edm::isDebugEnabled(), LogDebug, mode_, rawdigi_, sistrip::READOUT_MODE_INVALID, sistrip::READOUT_MODE_PROC_RAW, sistrip::READOUT_MODE_SCOPE, sistrip::READOUT_MODE_SPY, sistrip::READOUT_MODE_VIRGIN_RAW, sistrip::READOUT_MODE_ZERO_SUPPRESSED, and sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE.

                                                                :
    inputModuleLabel_( pset.getParameter<std::string>( "InputModuleLabel" ) ),
    inputDigiLabel_( pset.getParameter<std::string>( "InputDigiLabel" ) ),
    mode_( fedReadoutModeFromString(pset.getParameter<std::string>( "FedReadoutMode" ))),
    rawdigi_( false ),
    digiToRaw_(0),
    eventCounter_(0)
  {
    if ( edm::isDebugEnabled() ) {
      LogDebug("DigiToRawModule") 
        << "[sistrip::DigiToRawModule::DigiToRawModule]"
        << " Constructing object...";
    }  
    
    switch(mode_) {
    case READOUT_MODE_ZERO_SUPPRESSED_LITE: rawdigi_ = false; break;
    case READOUT_MODE_ZERO_SUPPRESSED:      rawdigi_ = false; break;
    case READOUT_MODE_VIRGIN_RAW:      rawdigi_ = true; break;
    case READOUT_MODE_PROC_RAW:        rawdigi_ = true; break;
    case READOUT_MODE_SCOPE:           rawdigi_ = true; break;
    case READOUT_MODE_INVALID: {
      if( edm::isDebugEnabled()) {
        edm::LogWarning("DigiToRawModule") 
          << "[sistrip::DigiToRawModule::DigiToRawModule]"
          << " UNKNOWN readout mode: " << pset.getParameter<std::string>("FedReadoutMode");
      }} break;
    case READOUT_MODE_SPY: {
      if( edm::isDebugEnabled()) {
        edm::LogWarning("DigiToRawModule") 
          << "[sistrip::DigiToRawModule::DigiToRawModule]"
          << " Digi to raw is not supported for spy channel data";
      }} break;
    }
    if(pset.getParameter<bool>("UseWrongDigiType")) {
      rawdigi_ = !rawdigi_;
      if( edm::isDebugEnabled()) {
        edm::LogWarning("DigiToRawModule") 
          << "[sistrip::DigiToRawModule::DigiToRawModule]"
          << " You are using the wrong type of digis!";
      }
    }

    // Create instance of DigiToRaw formatter
    digiToRaw_ = new DigiToRaw( mode_, pset.getParameter<bool>("UseFedKey") );
  
    produces<FEDRawDataCollection>();

  }
sistrip::DigiToRawModule::~DigiToRawModule ( )

Definition at line 75 of file SiStripDigiToRawModule.cc.

References digiToRaw_, edm::isDebugEnabled(), and LogDebug.

                                    {
    if ( edm::isDebugEnabled() ) {
      LogDebug("DigiToRaw")
        << "[sistrip::DigiToRawModule::~DigiToRawModule]"
        << " Destructing object...";
    }
    if ( digiToRaw_ ) delete digiToRaw_;
  }

Member Function Documentation

virtual void sistrip::DigiToRawModule::beginJob ( void  ) [inline, virtual]

Reimplemented from edm::EDProducer.

Definition at line 29 of file SiStripDigiToRawModule.h.

{}
virtual void sistrip::DigiToRawModule::endJob ( void  ) [inline, virtual]

Reimplemented from edm::EDProducer.

Definition at line 30 of file SiStripDigiToRawModule.h.

{}
void sistrip::DigiToRawModule::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Retrieves cabling map from EventSetup, retrieves a DetSetVector of SiStripDigis from Event, creates a FEDRawDataCollection (EDProduct), uses DigiToRaw converter to fill FEDRawDataCollection, attaches FEDRawDataCollection to Event.

Implements edm::EDProducer.

Definition at line 91 of file SiStripDigiToRawModule.cc.

References sistrip::DigiToRaw::createFedBuffers(), digiToRaw_, eventCounter_, edm::EventSetup::get(), edm::Event::getByLabel(), inputDigiLabel_, inputModuleLabel_, edm::Event::put(), and rawdigi_.

                                                               {

    eventCounter_++; 
  
    std::auto_ptr<FEDRawDataCollection> buffers( new FEDRawDataCollection );

    edm::ESHandle<SiStripFedCabling> cabling;
    iSetup.get<SiStripFedCablingRcd>().get( cabling );

    if( rawdigi_ ) {
      edm::Handle< edm::DetSetVector<SiStripRawDigi> > rawdigis;
      iEvent.getByLabel( inputModuleLabel_, inputDigiLabel_, rawdigis );
      digiToRaw_->createFedBuffers( iEvent, cabling, rawdigis, buffers );
    } else {
      edm::Handle< edm::DetSetVector<SiStripDigi> > digis;
      iEvent.getByLabel( inputModuleLabel_, inputDigiLabel_, digis );
      digiToRaw_->createFedBuffers( iEvent, cabling, digis, buffers );
    }

    iEvent.put( buffers );
  
  }

Member Data Documentation

Definition at line 40 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule(), produce(), and ~DigiToRawModule().

Definition at line 41 of file SiStripDigiToRawModule.h.

Referenced by produce().

Definition at line 37 of file SiStripDigiToRawModule.h.

Referenced by produce().

Definition at line 36 of file SiStripDigiToRawModule.h.

Referenced by produce().

Definition at line 38 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule().

Definition at line 39 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule(), and produce().