CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

sistrip::RawToDigiModule Class Reference

#include <SiStripRawToDigiModule.h>

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

List of all members.

Public Member Functions

virtual void beginRun (edm::Run &, const edm::EventSetup &)
virtual void produce (edm::Event &, const edm::EventSetup &)
 RawToDigiModule (const edm::ParameterSet &)
 ~RawToDigiModule ()

Private Member Functions

void updateCabling (const edm::EventSetup &)

Private Attributes

const SiStripFedCablingcabling_
uint32_t cacheId_
bool doFullCorruptBufferChecks_
bool extractCm_
edm::InputTag productLabel_
RawToDigiUnpackerrawToDigi_

Detailed Description

Definition at line 25 of file SiStripRawToDigiModule.h.


Constructor & Destructor Documentation

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

Definition at line 20 of file SiStripRawToDigiModule.cc.

References doFullCorruptBufferChecks_, extractCm_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), edm::isDebugEnabled(), LogTrace, and rawToDigi_.

                                                                :
    rawToDigi_(0),
    productLabel_(pset.getParameter<edm::InputTag>("ProductLabel")),
    cabling_(0),
    cacheId_(0),
    extractCm_(false),
    doFullCorruptBufferChecks_(false)
  {
    if ( edm::isDebugEnabled() ) {
      LogTrace("SiStripRawToDigi")
        << "[sistrip::RawToDigiModule::" << __func__ << "]"
        << " Constructing object...";
    }
    
    int16_t appended_bytes = pset.getParameter<int>("AppendedBytes");
    int16_t trigger_fed_id = pset.getParameter<int>("TriggerFedId");
    bool use_daq_register = pset.getParameter<bool>("UseDaqRegister");
    bool using_fed_key = pset.getParameter<bool>("UseFedKey");
    bool unpack_bad_channels = pset.getParameter<bool>("UnpackBadChannels");
    bool mark_missing_feds = pset.getParameter<bool>("MarkModulesOnMissingFeds");

    int16_t fed_buffer_dump_freq = pset.getUntrackedParameter<int>("FedBufferDumpFreq",0);
    int16_t fed_event_dump_freq = pset.getUntrackedParameter<int>("FedEventDumpFreq",0);
    bool quiet = pset.getUntrackedParameter<bool>("Quiet",true);
    extractCm_ = pset.getParameter<bool>("UnpackCommonModeValues");
    doFullCorruptBufferChecks_ = pset.getParameter<bool>("DoAllCorruptBufferChecks");
    uint32_t errorThreshold = pset.getParameter<unsigned int>("ErrorThreshold");

    rawToDigi_ = new sistrip::RawToDigiUnpacker( appended_bytes, fed_buffer_dump_freq, fed_event_dump_freq, trigger_fed_id, using_fed_key, unpack_bad_channels, mark_missing_feds, errorThreshold);
    rawToDigi_->quiet(quiet);
    rawToDigi_->useDaqRegister( use_daq_register ); 
    rawToDigi_->extractCm(extractCm_);
    rawToDigi_->doFullCorruptBufferChecks(doFullCorruptBufferChecks_);
  
    produces< SiStripEventSummary >();
    produces< edm::DetSetVector<SiStripRawDigi> >("ScopeMode");
    produces< edm::DetSetVector<SiStripRawDigi> >("VirginRaw");
    produces< edm::DetSetVector<SiStripRawDigi> >("ProcessedRaw");
    produces< edm::DetSetVector<SiStripDigi> >("ZeroSuppressed");
    produces<DetIdCollection>();
    if ( extractCm_ ) produces< edm::DetSetVector<SiStripRawDigi> >("CommonMode");
  
  }
sistrip::RawToDigiModule::~RawToDigiModule ( )

Definition at line 64 of file SiStripRawToDigiModule.cc.

References cabling_, edm::isDebugEnabled(), LogTrace, and rawToDigi_.

                                    {
    if ( rawToDigi_ ) { delete rawToDigi_; }
    if ( cabling_ ) { cabling_ = 0; }
    if ( edm::isDebugEnabled() ) {
      LogTrace("SiStripRawToDigi")
        << "[sistrip::RawToDigiModule::" << __func__ << "]"
        << " Destructing object...";
    }
  }

Member Function Documentation

void sistrip::RawToDigiModule::beginRun ( edm::Run run,
const edm::EventSetup setup 
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 74 of file SiStripRawToDigiModule.cc.

References updateCabling().

                                                                          {
    updateCabling( setup );
  }  
void sistrip::RawToDigiModule::produce ( edm::Event event,
const edm::EventSetup setup 
) [virtual]

Retrieves cabling map from EventSetup and FEDRawDataCollection from Event, creates a DetSetVector of SiStrip(Raw)Digis, uses the SiStripRawToDigiUnpacker class to fill the DetSetVector, and attaches the container to the Event.

Implements edm::EDProducer.

Definition at line 84 of file SiStripRawToDigiModule.cc.

References cabling_, sistrip::RawToDigiUnpacker::createDigis(), edm::EventID::event(), extractCm_, edm::EventBase::id(), productLabel_, rawToDigi_, summarizeEdmComparisonLogfiles::summary, sistrip::RawToDigiUnpacker::triggerFed(), and updateCabling().

                                                                             {
  
    updateCabling( setup );
  
    // Retrieve FED raw data (by label, which is "source" by default)
    edm::Handle<FEDRawDataCollection> buffers;
    event.getByLabel( productLabel_, buffers ); 

    // Populate SiStripEventSummary object with "trigger FED" info
    std::auto_ptr<SiStripEventSummary> summary( new SiStripEventSummary() );
    rawToDigi_->triggerFed( *buffers, *summary, event.id().event() ); 

    // Create containers for digis
    edm::DetSetVector<SiStripRawDigi>* sm = new edm::DetSetVector<SiStripRawDigi>();
    edm::DetSetVector<SiStripRawDigi>* vr = new edm::DetSetVector<SiStripRawDigi>();
    edm::DetSetVector<SiStripRawDigi>* pr = new edm::DetSetVector<SiStripRawDigi>();
    edm::DetSetVector<SiStripDigi>* zs = new edm::DetSetVector<SiStripDigi>();
    DetIdCollection* ids = new DetIdCollection();
    edm::DetSetVector<SiStripRawDigi>* cm = new edm::DetSetVector<SiStripRawDigi>();
  
    // Create digis
    if ( rawToDigi_ ) { rawToDigi_->createDigis( *cabling_,*buffers,*summary,*sm,*vr,*pr,*zs,*ids,*cm ); }
  
    // Create auto_ptr's of digi products
    std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > sm_dsv(sm);
    std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > vr_dsv(vr);
    std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > pr_dsv(pr);
    std::auto_ptr< edm::DetSetVector<SiStripDigi> > zs_dsv(zs);
    std::auto_ptr< DetIdCollection > det_ids(ids);
    std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > cm_dsv(cm);
  
    // Add to event
    event.put( summary );
    event.put( sm_dsv, "ScopeMode" );
    event.put( vr_dsv, "VirginRaw" );
    event.put( pr_dsv, "ProcessedRaw" );
    event.put( zs_dsv, "ZeroSuppressed" );
    event.put( det_ids );
    if ( extractCm_ ) event.put( cm_dsv, "CommonMode" );
  
  }
void sistrip::RawToDigiModule::updateCabling ( const edm::EventSetup setup) [private]

Definition at line 126 of file SiStripRawToDigiModule.cc.

References trackerHits::c, cabling_, cacheId_, edm::EventSetup::get(), edm::isDebugEnabled(), LogTrace, edm::ESHandle< T >::product(), SiStripFedCabling::summary(), and SiStripFedCabling::terse().

Referenced by beginRun(), and produce().

                                                                  {

    uint32_t cache_id = setup.get<SiStripFedCablingRcd>().cacheIdentifier();

    if ( cacheId_ != cache_id ) {
    
      edm::ESHandle<SiStripFedCabling> c;
      setup.get<SiStripFedCablingRcd>().get( c );
      cabling_ = c.product();
    
      if ( edm::isDebugEnabled() ) {
        if ( !cacheId_ ) {
          std::stringstream ss;
          ss << "[sistrip::RawToDigiModule::" << __func__ << "]"
             << " Updating cabling for first time..." << std::endl
             << " Terse print out of FED cabling:" << std::endl;
          cabling_->terse(ss);
          LogTrace("SiStripRawToDigi") << ss.str();
        }
      }
    
      if ( edm::isDebugEnabled() ) {
        std::stringstream sss;
        sss << "[sistrip::RawToDigiModule::" << __func__ << "]"
            << " Summary of FED cabling:" << std::endl;
        cabling_->summary(sss);
        LogTrace("SiStripRawToDigi") << sss.str();
      }
      cacheId_ = cache_id;
    }
  }

Member Data Documentation

Definition at line 41 of file SiStripRawToDigiModule.h.

Referenced by produce(), updateCabling(), and ~RawToDigiModule().

Definition at line 42 of file SiStripRawToDigiModule.h.

Referenced by updateCabling().

Definition at line 44 of file SiStripRawToDigiModule.h.

Referenced by RawToDigiModule().

Definition at line 43 of file SiStripRawToDigiModule.h.

Referenced by produce(), and RawToDigiModule().

Definition at line 40 of file SiStripRawToDigiModule.h.

Referenced by produce().

Definition at line 39 of file SiStripRawToDigiModule.h.

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