CMS 3D CMS Logo

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