00001 #include "EventFilter/EcalRawToDigi/interface/EcalRawToRecHitLazyUnpacker.h" 00002 00003 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00004 00005 EcalRawToRecHitLazyUnpacker::EcalRawToRecHitLazyUnpacker(const EcalRegionCabling & cable, 00006 const EcalUnpackerWorker & 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::getEcalFEDIds().second-FEDNumbering::getEcalFEDIds().first+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