00001 #include "EventFilter/EcalRawToDigi/plugins/EcalRawToRecHitFacility.h" 00002 00003 EcalRawToRecHitFacility::EcalRawToRecHitFacility(const edm::ParameterSet& iConfig) 00004 { 00005 sourceTag_=iConfig.getParameter<edm::InputTag>("sourceTag"); 00006 workerName_=iConfig.getParameter<std::string>("workerName"); 00007 00008 //the lazy getter 00009 produces<EcalRecHitLazyGetter>(); 00010 00011 LogDebug("EcalRawToRecHit|Facility")<<"{ctor} ready to read raw data from: "<<sourceTag_ 00012 <<"\n using unpacker worker: "<<workerName_ 00013 <<"\n producing a lazy getter."; 00014 } 00015 00016 EcalRawToRecHitFacility::~EcalRawToRecHitFacility() 00017 { 00018 } 00019 00020 00021 // 00022 // member functions 00023 // 00024 00025 // ------------ method called to produce the data ------------ 00026 void 00027 EcalRawToRecHitFacility::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) 00028 { 00029 // MyWatcher watcher("Facility"); 00030 // LogDebug("EcalRawToRecHit|Facility")<<watcher.lap(); 00031 //std::cout << watcher.lap() << std::endl; 00032 // get raw data 00033 edm::Handle<FEDRawDataCollection> buffers; 00034 iEvent.getByLabel(sourceTag_, buffers); 00035 LogDebug("EcalRawToRecHit|Facility")<<"raw data from: "<<sourceTag_<<" retrieved." ; 00036 // << watcher.lap(); 00037 00038 // retreive cabling 00039 edm::ESHandle<EcalRegionCabling> cabling; 00040 iSetup.get<EcalRegionCablingRecord>().get(cabling); 00041 LogDebug("EcalRawToRecHit|Facility")<<"cabling retrieved." ; 00042 // << watcher.lap(); 00043 00044 //retreive worker 00045 edm::ESHandle<EcalUnpackerWorkerBase> worker; 00046 iSetup.get<EcalUnpackerWorkerRecord>().get(workerName_, worker); 00047 LogDebug("EcalRawToRecHit|Facility")<<"worker retrieved." ; 00048 // << watcher.lap(); 00049 //need to set the event because the worker will be accessing data from the event 00050 worker->set(iSetup); 00051 LogDebug("EcalRawToRecHit|Facility")<<"worker set." ; 00052 // << watcher.lap(); 00053 worker->update(iEvent); 00054 LogDebug("EcalRawToRecHit|Facility")<<"worker updated." ; 00055 // << watcher.lap(); 00056 00057 //construct a lazy unpacker 00058 boost::shared_ptr<EcalRawToRecHitLazyUnpacker> unpacker(new EcalRawToRecHitLazyUnpacker(*cabling, *worker, *buffers)); 00059 LogDebug("EcalRawToRecHit|Facility")<<"lazy unpacker created."; 00060 // << watcher.lap(); 00061 00062 //store the lazy getter 00063 //should change EcalRegionCabling::maxElementIndex() to something depending on the worker itself to be able to have Ecal and Es worker separately 00064 // std::auto_ptr<EcalRecHitLazyGetter> collection(new EcalRecHitLazyGetter(EcalRegionCabling::maxElementIndex(),unpacker)); 00065 std::auto_ptr<EcalRecHitLazyGetter> collection(new EcalRecHitLazyGetter(worker->maxElementIndex(),unpacker)); 00066 LogDebug("EcalRawToRecHit|Facility")<<"lazy getter created."; 00067 // << watcher.lap(); 00068 00069 edm::OrphanHandle<EcalRecHitLazyGetter> lgetter = iEvent.put(collection); 00070 LogDebug("EcalRawToRecHit|Facility")<<"lazy getter put in the event."; 00071 // << watcher.lap(); 00072 } 00073 00074 // ------------ method called once each job just before starting event loop ------------ 00075 void 00076 EcalRawToRecHitFacility::beginRun(edm::Run &iRun, const edm::EventSetup& iSetup) 00077 { 00078 //put this here to access the worker before anything starts. 00079 //there is no mis-use of the beginJob. This does not impact the rest of the processing. 00080 // MyWatcher watcher("Facility"); 00081 // LogDebug("EcalRawToRecHit|Facility")<<watcher.lap(); 00082 00083 edm::ESHandle<EcalUnpackerWorkerBase> worker; 00084 iSetup.get<EcalUnpackerWorkerRecord>().get(workerName_, worker); 00085 00086 } 00087 00088 // ------------ method called once each job just after ending the event loop ------------ 00089 void 00090 EcalRawToRecHitFacility::endRun( const edm::Run & iRun ) { 00091 }