CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/EventFilter/EcalRawToDigi/src/EcalRawToRecHitLazyUnpacker.cc

Go to the documentation of this file.
00001 #include "EventFilter/EcalRawToDigi/interface/EcalRawToRecHitLazyUnpacker.h"
00002 
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 
00005 EcalRawToRecHitLazyUnpacker::EcalRawToRecHitLazyUnpacker(const EcalRegionCabling & cable,
00006                                                          const EcalUnpackerWorkerBase & worker,
00007                                                          const FEDRawDataCollection& fedcollection):
00008   raw_(&fedcollection), cabling_(&cable), worker_(&worker)
00009 {
00010   LogDebug("EcalRawToRecHit|LazyUnpacker")<<"lazy unpacker created with a max of: "
00011                                           <<FEDNumbering::MAXECALFEDID-FEDNumbering::MINECALFEDID+1
00012                                           <<" regions";
00013 }
00014 
00015 EcalRawToRecHitLazyUnpacker::~EcalRawToRecHitLazyUnpacker(){
00016   //clear the cache to avoid memory leak
00017 }
00018 void EcalRawToRecHitLazyUnpacker::fill(const uint32_t & i, record_type & rec){
00019   LogDebug("EcalRawToRecHit|LazyUnpacker")<<"filling for index: "<<i;
00020 
00021   std::map<uint32_t, std::auto_ptr<EcalRecHitCollection> > ::iterator f= cachedRecHits.find(i);
00022   if (f==cachedRecHits.end()){
00023     LogDebug("EcalRawToRecHit|LazyUnpacker")<<"needs to be unpacked.";
00024     //need to unpack
00025 
00026     LogDebug("EcalRawToRecHit|LazyUnpacker")<<"calling the worker to work on that index: "<<i;
00027     std::auto_ptr< EcalRecHitCollection > rechits = worker_->work(i, *raw_);
00028 
00029     LogDebug("EcalRawToRecHit|LazyUnpacker")<<"inserting: "<<rechits->size() <<" rechit(s) in the record.";
00030     rec.insert(rec.end(), rechits->begin(), rechits->end());
00031   }
00032 }
00033