CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

EcalRawToRecHitFacility Class Reference

#include <EventFilter/EcalRawToDigi/src/EcalRawToRecHitFacility.cc>

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

List of all members.

Public Types

typedef edm::LazyGetter
< EcalRecHit
EcalRecHitLazyGetter
typedef edm::RefGetter
< EcalRecHit
EcalRecHitRefGetter

Public Member Functions

 EcalRawToRecHitFacility (const edm::ParameterSet &)
 ~EcalRawToRecHitFacility ()

Private Member Functions

virtual void beginRun (edm::Run &, const edm::EventSetup &)
virtual void endRun (const edm::Run &)
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

edm::InputTag sourceTag_
std::string workerName_

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 49 of file EcalRawToRecHitFacility.h.


Member Typedef Documentation

Definition at line 54 of file EcalRawToRecHitFacility.h.

Definition at line 55 of file EcalRawToRecHitFacility.h.


Constructor & Destructor Documentation

EcalRawToRecHitFacility::EcalRawToRecHitFacility ( const edm::ParameterSet iConfig) [explicit]

Definition at line 3 of file EcalRawToRecHitFacility.cc.

References edm::ParameterSet::getParameter(), LogDebug, sourceTag_, and workerName_.

{
  sourceTag_=iConfig.getParameter<edm::InputTag>("sourceTag");
  workerName_=iConfig.getParameter<std::string>("workerName");

  //the lazy getter
  produces<EcalRecHitLazyGetter>();

  LogDebug("EcalRawToRecHit|Facility")<<"{ctor} ready to read raw data from: "<<sourceTag_
                                      <<"\n using unpacker worker: "<<workerName_
                                      <<"\n producing a lazy getter.";
}
EcalRawToRecHitFacility::~EcalRawToRecHitFacility ( )

Definition at line 16 of file EcalRawToRecHitFacility.cc.

{
}

Member Function Documentation

void EcalRawToRecHitFacility::beginRun ( edm::Run iRun,
const edm::EventSetup iSetup 
) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 76 of file EcalRawToRecHitFacility.cc.

References edm::EventSetup::get(), and workerName_.

{
  //put this here to access the worker before anything starts.
  //there is no mis-use of the beginJob. This does not impact the rest of the processing.
//  MyWatcher watcher("Facility");
//  LogDebug("EcalRawToRecHit|Facility")<<watcher.lap();

  edm::ESHandle<EcalUnpackerWorkerBase> worker;
  iSetup.get<EcalUnpackerWorkerRecord>().get(workerName_, worker);

}
void EcalRawToRecHitFacility::endRun ( const edm::Run iRun) [private, virtual]

Definition at line 90 of file EcalRawToRecHitFacility.cc.

                                                     {
}
void EcalRawToRecHitFacility::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 27 of file EcalRawToRecHitFacility.cc.

References runEdmFileComparison::collection, edm::EventSetup::get(), edm::Event::getByLabel(), LogDebug, edm::Event::put(), sourceTag_, and workerName_.

{
//  MyWatcher watcher("Facility");
//  LogDebug("EcalRawToRecHit|Facility")<<watcher.lap();
//std::cout <<  watcher.lap() << std::endl;
  // get raw data
  edm::Handle<FEDRawDataCollection> buffers;
  iEvent.getByLabel(sourceTag_, buffers);
  LogDebug("EcalRawToRecHit|Facility")<<"raw data from: "<<sourceTag_<<" retrieved." ;
//                                    << watcher.lap();
  
  // retreive cabling
  edm::ESHandle<EcalRegionCabling> cabling;
  iSetup.get<EcalRegionCablingRecord>().get(cabling);
  LogDebug("EcalRawToRecHit|Facility")<<"cabling retrieved." ;
//                                    << watcher.lap();
    
  //retreive worker
  edm::ESHandle<EcalUnpackerWorkerBase> worker;
  iSetup.get<EcalUnpackerWorkerRecord>().get(workerName_, worker);
  LogDebug("EcalRawToRecHit|Facility")<<"worker retrieved." ;
//                                    << watcher.lap();
  //need to set the event because the worker will be accessing data from the event
  worker->set(iSetup);
  LogDebug("EcalRawToRecHit|Facility")<<"worker set." ;
//                                    << watcher.lap();
  worker->update(iEvent);
  LogDebug("EcalRawToRecHit|Facility")<<"worker updated." ;
//                                    << watcher.lap();
  
  //construct a lazy unpacker
  boost::shared_ptr<EcalRawToRecHitLazyUnpacker> unpacker(new EcalRawToRecHitLazyUnpacker(*cabling, *worker, *buffers));
  LogDebug("EcalRawToRecHit|Facility")<<"lazy unpacker created.";
//                                    << watcher.lap();
  
  //store the lazy getter
  //should change EcalRegionCabling::maxElementIndex() to something depending on the worker itself to be able to have Ecal and Es worker separately
  //  std::auto_ptr<EcalRecHitLazyGetter> collection(new EcalRecHitLazyGetter(EcalRegionCabling::maxElementIndex(),unpacker));
  std::auto_ptr<EcalRecHitLazyGetter> collection(new EcalRecHitLazyGetter(worker->maxElementIndex(),unpacker));
  LogDebug("EcalRawToRecHit|Facility")<<"lazy getter created.";
//                                    << watcher.lap();
  
  edm::OrphanHandle<EcalRecHitLazyGetter> lgetter = iEvent.put(collection);
  LogDebug("EcalRawToRecHit|Facility")<<"lazy getter put in the event.";
//                                    << watcher.lap();
}

Member Data Documentation

Definition at line 63 of file EcalRawToRecHitFacility.h.

Referenced by EcalRawToRecHitFacility(), and produce().

std::string EcalRawToRecHitFacility::workerName_ [private]

Definition at line 66 of file EcalRawToRecHitFacility.h.

Referenced by beginRun(), EcalRawToRecHitFacility(), and produce().