CMS 3D CMS Logo

HcalHistogramRawToDigi.cc
Go to the documentation of this file.
8 #include <iostream>
9 
11  : unpacker_(conf.getUntrackedParameter<int>("HcalFirstFED", FEDNumbering::MINHCALFEDID)),
12  fedUnpackList_(conf.getUntrackedParameter<std::vector<int> >("FEDs")),
13  firstFED_(conf.getUntrackedParameter<int>("HcalFirstFED", FEDNumbering::MINHCALFEDID)) {
14  std::ostringstream ss;
15  for (unsigned int i = 0; i < fedUnpackList_.size(); i++)
16  ss << fedUnpackList_[i] << " ";
17  edm::LogInfo("HCAL") << "HcalHistogramRawToDigi will unpack FEDs ( " << ss.str() << ")";
18 
19  tok_data_ = consumes<FEDRawDataCollection>(conf.getParameter<edm::InputTag>("InputLabel"));
20 
21  // products produced...
22  produces<HcalHistogramDigiCollection>();
23 }
24 
25 // Virtual destructor needed.
27 
28 // Functions that gets called by framework every event
30  // Step A: Get Inputs
32  e.getByToken(tok_data_, rawraw);
33  // get the mapping
35  es.get<HcalDbRecord>().get(pSetup);
36  const HcalElectronicsMap* readoutMap = pSetup->getHcalMapping();
37 
38  // Step B: Create empty output
39  auto prod = std::make_unique<HcalHistogramDigiCollection>();
40  std::vector<HcalHistogramDigi> digis;
41 
42  // Step C: unpack all requested FEDs
43  for (std::vector<int>::const_iterator i = fedUnpackList_.begin(); i != fedUnpackList_.end(); i++) {
44  const FEDRawData& fed = rawraw->FEDData(*i);
45 
46  unpacker_.unpack(fed, *readoutMap, digis);
47  }
48 
49  // Step B2: encapsulate vectors in actual collections
50  prod->swap_contents(digis);
51 
52  // Step D: Put outputs into event
53  prod->sort();
54  e.put(std::move(prod));
55 }
T getParameter(std::string const &) const
edm::EDGetTokenT< FEDRawDataCollection > tok_data_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
std::vector< int > fedUnpackList_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
HcalHistogramRawToDigi(const edm::ParameterSet &ps)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void unpack(const FEDRawData &raw, const HcalElectronicsMap &emap, std::vector< HcalHistogramDigi > &histoDigis)
T get() const
Definition: EventSetup.h:73
const HcalElectronicsMap * getHcalMapping() const
def move(src, dest)
Definition: eostools.py:511
void produce(edm::Event &e, const edm::EventSetup &c) override