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;
10 #include <iostream>
11 
12 
14  dataTag_(conf.getParameter<edm::InputTag>("InputLabel")),
15  unpacker_(conf.getUntrackedParameter<int>("HcalFirstFED",FEDNumbering::MINHCALFEDID)),
16  fedUnpackList_(conf.getUntrackedParameter<std::vector<int> >("FEDs")),
17  firstFED_(conf.getUntrackedParameter<int>("HcalFirstFED",FEDNumbering::MINHCALFEDID))
18 {
19  std::ostringstream ss;
20  for (unsigned int i=0; i<fedUnpackList_.size(); i++)
21  ss << fedUnpackList_[i] << " ";
22  edm::LogInfo("HCAL") << "HcalHistogramRawToDigi will unpack FEDs ( " << ss.str() << ")";
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.getByLabel(dataTag_,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  std::auto_ptr<HcalHistogramDigiCollection> prod(new 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(prod);
59 }
60 
61 
int i
Definition: DBlmapReader.cc:9
std::vector< int > fedUnpackList_
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:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
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