CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

EcalRawToRecHitLazyUnpacker Class Reference

#include <EcalRawToRecHitLazyUnpacker.h>

Inheritance diagram for EcalRawToRecHitLazyUnpacker:
edm::LazyUnpacker< EcalRecHit >

List of all members.

Public Types

typedef edm::LazyUnpacker
< EcalRecHit
Base
typedef edm::DetSet< EcalRecHitDetSet

Public Member Functions

 EcalRawToRecHitLazyUnpacker (const EcalRegionCabling &cable, const EcalUnpackerWorkerBase &worker, const FEDRawDataCollection &fedcollection)
virtual void fill (const uint32_t &, record_type &)
virtual ~EcalRawToRecHitLazyUnpacker ()

Private Attributes

const EcalRegionCablingcabling_
std::map< uint32_t,
std::auto_ptr
< EcalRecHitCollection > > 
cachedRecHits
const FEDRawDataCollectionraw_
const EcalUnpackerWorkerBaseworker_

Detailed Description

Definition at line 12 of file EcalRawToRecHitLazyUnpacker.h.


Member Typedef Documentation

Definition at line 16 of file EcalRawToRecHitLazyUnpacker.h.

Definition at line 15 of file EcalRawToRecHitLazyUnpacker.h.


Constructor & Destructor Documentation

EcalRawToRecHitLazyUnpacker::EcalRawToRecHitLazyUnpacker ( const EcalRegionCabling cable,
const EcalUnpackerWorkerBase worker,
const FEDRawDataCollection fedcollection 
)

Definition at line 5 of file EcalRawToRecHitLazyUnpacker.cc.

References LogDebug, FEDNumbering::MAXECALFEDID, and FEDNumbering::MINECALFEDID.

                                                                                                   :
  raw_(&fedcollection), cabling_(&cable), worker_(&worker)
{
  LogDebug("EcalRawToRecHit|LazyUnpacker")<<"lazy unpacker created with a max of: "
                                          <<FEDNumbering::MAXECALFEDID-FEDNumbering::MINECALFEDID+1
                                          <<" regions";
}
EcalRawToRecHitLazyUnpacker::~EcalRawToRecHitLazyUnpacker ( ) [virtual]

Definition at line 15 of file EcalRawToRecHitLazyUnpacker.cc.

                                                         {
  //clear the cache to avoid memory leak
}

Member Function Documentation

void EcalRawToRecHitLazyUnpacker::fill ( const uint32_t &  i,
record_type rec 
) [virtual]

Implements edm::LazyUnpacker< EcalRecHit >.

Definition at line 18 of file EcalRawToRecHitLazyUnpacker.cc.

References cachedRecHits, f, i, LogDebug, raw_, EcalUnpackerWorkerBase::work(), and worker_.

                                                                           {
  LogDebug("EcalRawToRecHit|LazyUnpacker")<<"filling for index: "<<i;

  std::map<uint32_t, std::auto_ptr<EcalRecHitCollection> > ::iterator f= cachedRecHits.find(i);
  if (f==cachedRecHits.end()){
    LogDebug("EcalRawToRecHit|LazyUnpacker")<<"needs to be unpacked.";
    //need to unpack

    LogDebug("EcalRawToRecHit|LazyUnpacker")<<"calling the worker to work on that index: "<<i;
    std::auto_ptr< EcalRecHitCollection > rechits = worker_->work(i, *raw_);

    LogDebug("EcalRawToRecHit|LazyUnpacker")<<"inserting: "<<rechits->size() <<" rechit(s) in the record.";
    rec.insert(rec.end(), rechits->begin(), rechits->end());
  }
}

Member Data Documentation

Definition at line 31 of file EcalRawToRecHitLazyUnpacker.h.

std::map<uint32_t, std::auto_ptr<EcalRecHitCollection> > EcalRawToRecHitLazyUnpacker::cachedRecHits [private]

Definition at line 36 of file EcalRawToRecHitLazyUnpacker.h.

Referenced by fill().

Definition at line 29 of file EcalRawToRecHitLazyUnpacker.h.

Referenced by fill().

Definition at line 33 of file EcalRawToRecHitLazyUnpacker.h.

Referenced by fill().