CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalRawToRecHitFacility.cc
Go to the documentation of this file.
2 
4 {
5  sourceTag_=iConfig.getParameter<edm::InputTag>("sourceTag");
6  workerName_=iConfig.getParameter<std::string>("workerName");
7 
8  //the lazy getter
9  produces<EcalRecHitLazyGetter>();
10 
11  LogDebug("EcalRawToRecHit|Facility")<<"{ctor} ready to read raw data from: "<<sourceTag_
12  <<"\n using unpacker worker: "<<workerName_
13  <<"\n producing a lazy getter.";
14 }
15 
17 {
18 }
19 
20 
21 //
22 // member functions
23 //
24 
25 // ------------ method called to produce the data ------------
26 void
28 {
29 // MyWatcher watcher("Facility");
30 // LogDebug("EcalRawToRecHit|Facility")<<watcher.lap();
31 //std::cout << watcher.lap() << std::endl;
32  // get raw data
34  iEvent.getByLabel(sourceTag_, buffers);
35  LogDebug("EcalRawToRecHit|Facility")<<"raw data from: "<<sourceTag_<<" retrieved." ;
36 // << watcher.lap();
37 
38  // retreive cabling
40  iSetup.get<EcalRegionCablingRecord>().get(cabling);
41  LogDebug("EcalRawToRecHit|Facility")<<"cabling retrieved." ;
42 // << watcher.lap();
43 
44  //retreive worker
46  iSetup.get<EcalUnpackerWorkerRecord>().get(workerName_, worker);
47  LogDebug("EcalRawToRecHit|Facility")<<"worker retrieved." ;
48 // << watcher.lap();
49  //need to set the event because the worker will be accessing data from the event
50  worker->set(iSetup);
51  LogDebug("EcalRawToRecHit|Facility")<<"worker set." ;
52 // << watcher.lap();
53  worker->update(iEvent);
54  LogDebug("EcalRawToRecHit|Facility")<<"worker updated." ;
55 // << watcher.lap();
56 
57  //construct a lazy unpacker
58  boost::shared_ptr<EcalRawToRecHitLazyUnpacker> unpacker(new EcalRawToRecHitLazyUnpacker(*cabling, *worker, *buffers));
59  LogDebug("EcalRawToRecHit|Facility")<<"lazy unpacker created.";
60 // << watcher.lap();
61 
62  //store the lazy getter
63  //should change EcalRegionCabling::maxElementIndex() to something depending on the worker itself to be able to have Ecal and Es worker separately
64  // std::auto_ptr<EcalRecHitLazyGetter> collection(new EcalRecHitLazyGetter(EcalRegionCabling::maxElementIndex(),unpacker));
65  std::auto_ptr<EcalRecHitLazyGetter> collection(new EcalRecHitLazyGetter(worker->maxElementIndex(),unpacker));
66  LogDebug("EcalRawToRecHit|Facility")<<"lazy getter created.";
67 // << watcher.lap();
68 
69  edm::OrphanHandle<EcalRecHitLazyGetter> lgetter = iEvent.put(collection);
70  LogDebug("EcalRawToRecHit|Facility")<<"lazy getter put in the event.";
71 // << watcher.lap();
72 }
73 
74 // ------------ method called once each job just before starting event loop ------------
75 void
77 {
78  //put this here to access the worker before anything starts.
79  //there is no mis-use of the beginJob. This does not impact the rest of the processing.
80 // MyWatcher watcher("Facility");
81 // LogDebug("EcalRawToRecHit|Facility")<<watcher.lap();
82 
84  iSetup.get<EcalUnpackerWorkerRecord>().get(workerName_, worker);
85 
86 }
87 
88 // ------------ method called once each job just after ending the event loop ------------
89 void
91 }
#define LogDebug(id)
T getParameter(std::string const &) const
virtual void endRun(const edm::Run &)
virtual void produce(edm::Event &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
edm::LazyGetter< EcalRecHit > EcalRecHitLazyGetter
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const T & get() const
Definition: EventSetup.h:55
EcalRawToRecHitFacility(const edm::ParameterSet &)
virtual void beginRun(edm::Run &, const edm::EventSetup &)
Definition: Run.h:33