CMS 3D CMS Logo

SiPixelDigiToRaw Class Reference

#include <EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiToRaw.h>

Inheritance diagram for SiPixelDigiToRaw:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginJob (const edm::EventSetup &)
 initialisation. Retrieves cabling map from EventSetup.
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

edm::ParameterSet config_
unsigned long eventCounter_
SiPixelFedCablingMapfedCablingMap_


Detailed Description

Definition at line 14 of file SiPixelDigiToRaw.h.


Constructor & Destructor Documentation

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

ctor

Definition at line 20 of file SiPixelDigiToRaw.cc.

References edm::ParameterSet::getUntrackedParameter(), and label.

00020                                                                 :
00021   eventCounter_(0),
00022   fedCablingMap_(0),
00023   config_(pset)
00024 //  src_( pset.getParameter<edm::InputTag>( "src" ) )
00025 {
00026 
00027   // Define EDProduct type
00028   string label = pset.getUntrackedParameter<string>("ProductLabel","sourceXXL");
00029   produces<FEDRawDataCollection>();
00030 
00031 }

SiPixelDigiToRaw::~SiPixelDigiToRaw (  )  [virtual]

dtor

Definition at line 34 of file SiPixelDigiToRaw.cc.

00034                                     {
00035 }


Member Function Documentation

void SiPixelDigiToRaw::beginJob ( const edm::EventSetup setup  )  [virtual]

initialisation. Retrieves cabling map from EventSetup.

Reimplemented from edm::EDProducer.

Definition at line 38 of file SiPixelDigiToRaw.cc.

00039 {
00040 }

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

dummy end of job

Reimplemented from edm::EDProducer.

Definition at line 27 of file SiPixelDigiToRaw.h.

00027 {}

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 config_, GenMuonPlsPt100GeV_cfg::cout, debug, reco_application_tbsim_simpleTBanalysis_cfg::digiCollection, lat::endl(), eventCounter_, edm::EventSetup::get(), edm::Event::getByLabel(), edm::ParameterSet::getUntrackedParameter(), edm::Event::id(), edm::MessageDrop::instance(), it, label, LogDebug, edm::ESHandle< T >::product(), edm::Event::put(), FEDRawData::size(), and size.

00045 {
00046   using namespace sipixelobjects;
00047 
00048   eventCounter_++;
00049   edm::LogInfo("SiPixelDigiToRaw") << "[SiPixelDigiToRaw::produce] "
00050                         << "event number: "
00051                         << eventCounter_;
00052 
00053   edm::Handle< edm::DetSetVector<PixelDigi> > digiCollection;
00054   static string label = config_.getUntrackedParameter<string>("InputLabel","source");
00055   static string instance = config_.getUntrackedParameter<string>("InputInstance","");
00056   ev.getByLabel( label, instance, digiCollection);
00057 
00058   PixelDataFormatter::Digis digis;
00059   typedef vector< edm::DetSet<PixelDigi> >::const_iterator DI;
00060 
00061   static int allDigiCounter = 0;  
00062   static int allWordCounter = 0;
00063          int digiCounter = 0; 
00064   for (DI di=digiCollection->begin(); di != digiCollection->end(); di++) {
00065     digiCounter += (di->data).size(); 
00066     digis[ di->id] = di->data;
00067 //    digis.push_back(*di);
00068   }
00069   allDigiCounter += digiCounter;
00070 
00071   edm::ESHandle<SiPixelFedCablingMap> map;
00072   es.get<SiPixelFedCablingMapRcd>().get( map );
00073 
00074   static bool debug = edm::MessageDrop::instance()->debugEnabled;
00075   if (debug) cout << map->version() << endl;
00076   
00077   PixelDataFormatter formatter(map.product());
00078 
00079   // create product (raw data)
00080   std::auto_ptr<FEDRawDataCollection> buffers( new FEDRawDataCollection );
00081 
00082   const vector<const PixelFEDCabling *>  cabling = map->fedList();
00083 
00084   typedef vector<const PixelFEDCabling *>::const_iterator FI;
00085   for (FI it = cabling.begin(); it != cabling.end(); it++) {
00086     LogDebug("SiPixelDigiToRaw")<<" PRODUCE DATA FOR FED_id: " << (**it).id();
00087     FEDRawData * rawData = formatter.formatData( ev.id().event(),(**it).id(), digis);
00088     FEDRawData& fedRawData = buffers->FEDData( (**it).id() ); 
00089     fedRawData = *rawData;
00090     LogDebug("SiPixelDigiToRaw")<<"size of data in fedRawData: "<<fedRawData.size();
00091     delete rawData;
00092   }
00093   allWordCounter += formatter.nWords();
00094   if (debug) cout << "Words/Digis this ev: "<<digiCounter<<"(fm:"<<formatter.nDigis()<<")/"
00095         <<formatter.nWords()
00096        <<"  all: "<< allDigiCounter <<"/"<<allWordCounter<<endl;
00097 
00098   
00099   ev.put( buffers );
00100   
00101 }


Member Data Documentation

edm::ParameterSet SiPixelDigiToRaw::config_ [private]

Definition at line 37 of file SiPixelDigiToRaw.h.

Referenced by produce().

unsigned long SiPixelDigiToRaw::eventCounter_ [private]

Definition at line 34 of file SiPixelDigiToRaw.h.

Referenced by produce().

SiPixelFedCablingMap* SiPixelDigiToRaw::fedCablingMap_ [private]

Definition at line 35 of file SiPixelDigiToRaw.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:31:55 2009 for CMSSW by  doxygen 1.5.4