CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ESUnpackerWorker.cc
Go to the documentation of this file.
2 
4 
5 
7 
8  edm::ParameterSet DCCpset = conf.getParameter<edm::ParameterSet>("DCCDataUnpacker");
9  ESUnpacker_ = new ESUnpacker(DCCpset);
10 
12  std::string componentType = RH.getParameter<std::string>("Type");
13  RHWorker_ = ESRecHitWorkerFactory::get()->create(componentType, RH);
14 
15 }
16 
18  delete ESUnpacker_;
19  delete RHWorker_;
20 }
21 
23 
24 }
25 
26 void ESUnpackerWorker::set(const edm::EventSetup & es) const {
27  RHWorker_->set(es);
28 }
29 
31 
32 }
33 
36  evt=&e;
37 }
38 
39 
40 std::auto_ptr< EcalRecHitCollection > ESUnpackerWorker::work(const uint32_t & index, const FEDRawDataCollection & rawdata)const{
41  MyWatcher watcher("Worker");
42  LogDebug("ESRawToRecHit|Worker")<<"is going to work on index: "<<index
43  <<watcher.lap();
44 
45  int fedIndex = EcalRegionCabling::esFedIndex(index);
46 
47 
48  const FEDRawData & fedData = rawdata.FEDData(fedIndex);
49 
50  //###### get the digi #######
51  ESRawDataCollection productDCC;
52  ESLocalRawDataCollection productKCHIP;
53  ESDigiCollection productdigis;
54 
55  ESUnpacker_->interpretRawData(fedIndex, fedData, productDCC, productKCHIP, productdigis);
56 
57  LogDebug("ESRawToRecHit|Worker")<<"unpacked "<<productdigis.size()<<" digis"
58  <<watcher.lap();
59 
60 
61  //then make rechits
62  ESDigiCollection::const_iterator beginDigiES = productdigis.begin();
63  ESDigiCollection::const_iterator endDigiES = productdigis.end();
64 
65  std::auto_ptr< EcalRecHitCollection > ecalrechits( new EcalRecHitCollection );
66 
67  ecalrechits->reserve(productdigis.size());
68 
69  ESDigiCollection::const_iterator esIt=beginDigiES;
70  for (;esIt!=endDigiES;++esIt){
71  RHWorker_->run( *evt, esIt, *ecalrechits );
72  }
73 
74  LogDebug("ESRawToRecHit|Worker")<<" made : "<<ecalrechits->size()<<" es rechits"
75  <<watcher.lap();
76 
77  return ecalrechits;
78 }
79 
#define LogDebug(id)
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
std::string lap()
Definition: MyWatcher.h:17
void setHandles(const EcalUnpackerWorkerRecord &iRecord)
std::auto_ptr< EcalRecHitCollection > work(const uint32_t &i, const FEDRawDataCollection &) const
virtual void set(const edm::EventSetup &es)=0
void write(edm::Event &e) const
const_iterator begin() const
ESUnpackerWorker(const edm::ParameterSet &conf)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
ESUnpacker * ESUnpacker_
void interpretRawData(int fedId, const FEDRawData &rawData, ESRawDataCollection &dccs, ESLocalRawDataCollection &kchips, ESDigiCollection &digis)
Definition: ESUnpacker.cc:53
tuple conf
Definition: dbtoconf.py:185
void update(const edm::Event &e) const
virtual bool run(const edm::Event &evt, const ESDigiCollection::const_iterator &digi, ESRecHitCollection &result)=0
const_iterator end() const
static int esFedIndex(const uint32_t index)
dictionary rawdata
Definition: lumiPlot.py:393
ESRecHitWorkerBaseClass * RHWorker_
void set(const edm::EventSetup &es) const
T get(const Candidate &c)
Definition: component.h:56