CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< int > fedUnpackList_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
HcalHistogramRawToDigi(const edm::ParameterSet &ps)
def move
Definition: eostools.py:511
Log< level::Info, false > LogInfo
void unpack(const FEDRawData &raw, const HcalElectronicsMap &emap, std::vector< HcalHistogramDigi > &histoDigis)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< HcalDbService, HcalDbRecord > tok_dbService_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
void produce(edm::Event &e, const edm::EventSetup &c) override