CMS 3D CMS Logo

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