CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiPixelDigiToRaw Class Reference

#include <SiPixelDigiToRaw.h>

Inheritance diagram for SiPixelDigiToRaw:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void endJob ()
 dummy end of job
virtual void produce (edm::Event &, const edm::EventSetup &)
 get data, convert to raw event, attach again to Event
 SiPixelDigiToRaw (const edm::ParameterSet &)
 ctor
virtual ~SiPixelDigiToRaw ()
 dtor

Private Attributes

int allDigiCounter
int allWordCounter
SiPixelFedCablingTreecablingTree_
edm::ParameterSet config_
bool debug
unsigned long eventCounter
edm::InputTag label
edm::ESWatcher
< SiPixelFedCablingMapRcd
recordWatcher

Detailed Description

Definition at line 17 of file SiPixelDigiToRaw.h.


Constructor & Destructor Documentation

SiPixelDigiToRaw::SiPixelDigiToRaw ( const edm::ParameterSet pset) [explicit]

ctor

Definition at line 20 of file SiPixelDigiToRaw.cc.

References allDigiCounter, allWordCounter, and eventCounter.

                                                                :
  cablingTree_(0),
  config_(pset)
{

  // Define EDProduct type
  produces<FEDRawDataCollection>();

  // start the counters
  eventCounter = 0;
  allDigiCounter = 0;
  allWordCounter = 0;

}
SiPixelDigiToRaw::~SiPixelDigiToRaw ( ) [virtual]

dtor

Definition at line 36 of file SiPixelDigiToRaw.cc.

References cablingTree_.

                                    {
   delete cablingTree_;
}

Member Function Documentation

virtual void SiPixelDigiToRaw::endJob ( void  ) [inline, virtual]

dummy end of job

Reimplemented from edm::EDProducer.

Definition at line 28 of file SiPixelDigiToRaw.h.

{}
void SiPixelDigiToRaw::produce ( edm::Event ev,
const edm::EventSetup es 
) [virtual]

get data, convert to raw event, attach again to Event

Implements edm::EDProducer.

Definition at line 43 of file SiPixelDigiToRaw.cc.

References allDigiCounter, allWordCounter, cablingTree_, edm::ESWatcher< T >::check(), config_, debug, reco_application_2006_simpleTBanalysis_cfg::digiCollection, edm::EventID::event(), eventCounter, SiPixelFedCablingTree::fedList(), PixelDataFormatter::formatData(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), edm::EventBase::id(), edm::MessageDrop::instance(), label, LogDebug, PixelDataFormatter::nDigis(), PixelDataFormatter::nWords(), edm::Event::put(), recordWatcher, findQualityFiles::size, FEDRawData::size(), and SiPixelFedCablingTree::version().

{
  using namespace sipixelobjects;
  eventCounter++;
  edm::LogInfo("SiPixelDigiToRaw") << "[SiPixelDigiToRaw::produce] "
                                   << "event number: " << eventCounter;

  edm::Handle< edm::DetSetVector<PixelDigi> > digiCollection;
  label = config_.getParameter<edm::InputTag>("InputLabel");
  ev.getByLabel( label, digiCollection);

  PixelDataFormatter::Digis digis;
  typedef vector< edm::DetSet<PixelDigi> >::const_iterator DI;

  int digiCounter = 0; 
  for (DI di=digiCollection->begin(); di != digiCollection->end(); di++) {
    digiCounter += (di->data).size(); 
    digis[ di->id] = di->data;
  }
  allDigiCounter += digiCounter;

  if (recordWatcher.check( es )) {
    edm::ESHandle<SiPixelFedCablingMap> cablingMap;
    es.get<SiPixelFedCablingMapRcd>().get( cablingMap );
    if (cablingTree_) delete cablingTree_; cablingTree_= cablingMap->cablingTree();
  }

  debug = edm::MessageDrop::instance()->debugEnabled;
  if (debug) LogDebug("SiPixelDigiToRaw") << cablingTree_->version();
  
  PixelDataFormatter formatter(cablingTree_);

  // create product (raw data)
  std::auto_ptr<FEDRawDataCollection> buffers( new FEDRawDataCollection );

  const vector<const PixelFEDCabling *>  fedList = cablingTree_->fedList();

  typedef vector<const PixelFEDCabling *>::const_iterator FI;
  for (FI it = fedList.begin(); it != fedList.end(); it++) {
    LogDebug("SiPixelDigiToRaw")<<" PRODUCE DATA FOR FED_id: " << (**it).id();
    FEDRawData * rawData = formatter.formatData( ev.id().event(),(**it).id(), digis);
    FEDRawData& fedRawData = buffers->FEDData( (**it).id() ); 
    fedRawData = *rawData;
    LogDebug("SiPixelDigiToRaw")<<"size of data in fedRawData: "<<fedRawData.size();
    delete rawData;
  }
  allWordCounter += formatter.nWords();
  if (debug) LogDebug("SiPixelDigiToRaw") 

        << "Words/Digis this ev: "<<digiCounter<<"(fm:"<<formatter.nDigis()<<")/"
        <<formatter.nWords()
        <<"  all: "<< allDigiCounter <<"/"<<allWordCounter;

  
  ev.put( buffers );
  
}

Member Data Documentation

Definition at line 39 of file SiPixelDigiToRaw.h.

Referenced by produce(), and SiPixelDigiToRaw().

Definition at line 40 of file SiPixelDigiToRaw.h.

Referenced by produce(), and SiPixelDigiToRaw().

Definition at line 35 of file SiPixelDigiToRaw.h.

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

Definition at line 36 of file SiPixelDigiToRaw.h.

Referenced by produce().

bool SiPixelDigiToRaw::debug [private]

Definition at line 42 of file SiPixelDigiToRaw.h.

Referenced by produce().

unsigned long SiPixelDigiToRaw::eventCounter [private]

Definition at line 37 of file SiPixelDigiToRaw.h.

Referenced by produce(), and SiPixelDigiToRaw().

Definition at line 38 of file SiPixelDigiToRaw.h.

Referenced by produce().

Definition at line 41 of file SiPixelDigiToRaw.h.

Referenced by produce().