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 
35 }
36 
37 
38 std::auto_ptr< EcalRecHitCollection > ESUnpackerWorker::work(const uint32_t & index, const FEDRawDataCollection & rawdata)const{
39 // MyWatcher watcher("Worker");
40  LogDebug("ESRawToRecHit|Worker")<<"is going to work on index: "<<index ;
41 // <<watcher.lap();
42 
43  int fedIndex = EcalRegionCabling::esFedIndex(index);
44 
45 
46  const FEDRawData & fedData = rawdata.FEDData(fedIndex);
47 
48  //###### get the digi #######
49  ESRawDataCollection productDCC;
50  ESLocalRawDataCollection productKCHIP;
51  ESDigiCollection productdigis;
52 
53  ESUnpacker_->interpretRawData(fedIndex, fedData, productDCC, productKCHIP, productdigis);
54 
55  LogDebug("ESRawToRecHit|Worker")<<"unpacked "<<productdigis.size()<<" digis" ;
56 // <<watcher.lap();
57 
58 
59  //then make rechits
60  ESDigiCollection::const_iterator beginDigiES = productdigis.begin();
61  ESDigiCollection::const_iterator endDigiES = productdigis.end();
62 
63  std::auto_ptr< EcalRecHitCollection > ecalrechits( new EcalRecHitCollection );
64 
65  ecalrechits->reserve(productdigis.size());
66 
67  ESDigiCollection::const_iterator esIt=beginDigiES;
68  for (;esIt!=endDigiES;++esIt){
69  RHWorker_->run( esIt, *ecalrechits );
70  }
71 
72  LogDebug("ESRawToRecHit|Worker")<<" made : "<<ecalrechits->size()<<" es rechits" ;
73 // <<watcher.lap();
74 
75  return ecalrechits;
76 }
77 
78 
#define LogDebug(id)
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
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
const_iterator end() const
static int esFedIndex(const uint32_t index)
dictionary rawdata
Definition: lumiPlot.py:393
virtual bool run(const ESDigiCollection::const_iterator &digi, ESRecHitCollection &result)=0
ESRecHitWorkerBaseClass * RHWorker_
void set(const edm::EventSetup &es) const
T get(const Candidate &c)
Definition: component.h:56