CMS 3D CMS Logo

Public Member Functions | Private Attributes

sistrip::ExcludedFEDListProducer Class Reference

#include <ExcludedFEDListProducer.h>

Inheritance diagram for sistrip::ExcludedFEDListProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 ExcludedFEDListProducer (const edm::ParameterSet &pset)
 constructor
void produce (edm::Event &event, const edm::EventSetup &es) override
 ~ExcludedFEDListProducer ()
 default constructor

Private Attributes

const SiStripFedCablingcabling_
uint32_t cacheId_
DetIdCollection detids_
edm::InputTag productLabel_
unsigned int runNumber_

Detailed Description

Definition at line 24 of file ExcludedFEDListProducer.h.


Constructor & Destructor Documentation

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

constructor

Definition at line 23 of file ExcludedFEDListProducer.cc.

                                                                                :
    runNumber_(0),
    productLabel_(pset.getParameter<edm::InputTag>("ProductLabel")),
    cabling_(0),
    cacheId_(0)
  {
    produces<DetIdCollection>();
  }
sistrip::ExcludedFEDListProducer::~ExcludedFEDListProducer ( )

default constructor

Definition at line 32 of file ExcludedFEDListProducer.cc.

  {
  }

Member Function Documentation

void sistrip::ExcludedFEDListProducer::beginRun ( const edm::Run run,
const edm::EventSetup es 
) [override, virtual]

Reimplemented from edm::EDProducer.

Definition at line 37 of file ExcludedFEDListProducer.cc.

References trackerHits::c, cabling_, cacheId_, edm::EventSetup::get(), and edm::ESHandle< T >::product().

  {
    uint32_t cacheId = es.get<SiStripFedCablingRcd>().cacheIdentifier();
    
    if ( cacheId_ != cacheId ) {
      
      edm::ESHandle<SiStripFedCabling> c;
      es.get<SiStripFedCablingRcd>().get( c );
      cabling_ = c.product();
    }
  }
void sistrip::ExcludedFEDListProducer::produce ( edm::Event event,
const edm::EventSetup es 
) [override, virtual]

Implements edm::EDProducer.

Definition at line 49 of file ExcludedFEDListProducer.cc.

References cabling_, SiStripFedCabling::connections(), detids_, SiStripFedCabling::feds(), LaserDQM_cfg::input, sistrip::invalid32_, productLabel_, edm::EDCollection< T >::push_back(), edm::EDCollection< T >::reserve(), edm::Event::run(), runNumber_, FEDRawData::size(), edm::EDCollection< T >::size(), and edm::EDCollection< T >::swap().

  {
    if( runNumber_ != event.run() ) {
    
      runNumber_ = event.run();

      DetIdCollection emptyDetIdCollection;
      detids_.swap(emptyDetIdCollection);
      // Reserve space in bad module list
      detids_.reserve(100);
    
      edm::Handle<FEDRawDataCollection> buffers;
      event.getByLabel( productLabel_, buffers ); 
 
      // Retrieve FED ids from cabling map and iterate through 
      std::vector<uint16_t>::const_iterator ifed = cabling_->feds().begin();
      for ( ; ifed != cabling_->feds().end(); ifed++ ) {
      
        // ignore trigger FED
        // if ( *ifed == triggerFedId_ ) { continue; }
        
        // Retrieve FED raw data for given FED 
        const FEDRawData& input = buffers->FEDData( static_cast<int>(*ifed) );
        // The FEDData contains a vector<unsigned char>. Check the size of this vector:
        
        if( input.size() == 0 ) {
          // std::cout << "Input size == 0 for FED number " << static_cast<int>(*ifed) << std::endl;
          // get the cabling connections for this FED
          const std::vector<FedChannelConnection>& conns = cabling_->connections(*ifed);
          // Mark FED modules as bad
          detids_.reserve(detids_.size()+conns.size());
          std::vector<FedChannelConnection>::const_iterator iconn = conns.begin();
          for ( ; iconn != conns.end(); ++iconn ) {
            if ( !iconn->detId() || iconn->detId() == sistrip::invalid32_ ) continue;
            detids_.push_back(iconn->detId()); //@@ Possible multiple entries
          }
        }
      }
    }

    std::auto_ptr< DetIdCollection > detids( new DetIdCollection(detids_) );

    // for( unsigned int it = 0; it < detids->size(); ++it ) {
    //   std::cout << "detId = " << (*detids)[it]() << std::endl;
    // }

    event.put(detids);
  }

Member Data Documentation

Definition at line 37 of file ExcludedFEDListProducer.h.

Referenced by beginRun(), and produce().

Definition at line 38 of file ExcludedFEDListProducer.h.

Referenced by beginRun().

Definition at line 39 of file ExcludedFEDListProducer.h.

Referenced by produce().

Definition at line 36 of file ExcludedFEDListProducer.h.

Referenced by produce().

Definition at line 35 of file ExcludedFEDListProducer.h.

Referenced by produce().