CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalHistogramRawToDigi.cc
Go to the documentation of this file.
1 using namespace std;
9 #include <iostream>
10 
11 
13  unpacker_(conf.getUntrackedParameter<int>("HcalFirstFED",FEDNumbering::MINHCALFEDID)),
14  fedUnpackList_(conf.getUntrackedParameter<std::vector<int> >("FEDs")),
15  firstFED_(conf.getUntrackedParameter<int>("HcalFirstFED",FEDNumbering::MINHCALFEDID))
16 {
17  std::ostringstream ss;
18  for (unsigned int i=0; i<fedUnpackList_.size(); i++)
19  ss << fedUnpackList_[i] << " ";
20  edm::LogInfo("HCAL") << "HcalHistogramRawToDigi will unpack FEDs ( " << ss.str() << ")";
21 
22 
23  tok_data_ = consumes<FEDRawDataCollection>(conf.getParameter<edm::InputTag>("InputLabel"));
24 
25  // products produced...
26  produces<HcalHistogramDigiCollection>();
27 }
28 
29 // Virtual destructor needed.
31 
32 // Functions that gets called by framework every event
34 {
35  // Step A: Get Inputs
37  e.getByToken(tok_data_,rawraw);
38  // get the mapping
40  es.get<HcalDbRecord>().get( pSetup );
41  const HcalElectronicsMap* readoutMap=pSetup->getHcalMapping();
42 
43  // Step B: Create empty output
44  std::auto_ptr<HcalHistogramDigiCollection> prod(new HcalHistogramDigiCollection());
45  std::vector<HcalHistogramDigi> digis;
46 
47  // Step C: unpack all requested FEDs
48  for (std::vector<int>::const_iterator i=fedUnpackList_.begin(); i!=fedUnpackList_.end(); i++) {
49  const FEDRawData& fed = rawraw->FEDData(*i);
50 
51  unpacker_.unpack(fed,*readoutMap,digis);
52  }
53 
54  // Step B2: encapsulate vectors in actual collections
55  prod->swap_contents(digis);
56 
57  // Step D: Put outputs into event
58  prod->sort();
59  e.put(prod);
60 }
61 
62 
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< FEDRawDataCollection > tok_data_
std::vector< int > fedUnpackList_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
virtual void produce(edm::Event &e, const edm::EventSetup &c)
HcalHistogramRawToDigi(const edm::ParameterSet &ps)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
tuple conf
Definition: dbtoconf.py:185
void unpack(const FEDRawData &raw, const HcalElectronicsMap &emap, std::vector< HcalHistogramDigi > &histoDigis)
edm::SortedCollection< HcalHistogramDigi > HcalHistogramDigiCollection
const T & get() const
Definition: EventSetup.h:55
string fed
Definition: rpc-layouts.py:7