CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalDigiToRaw.cc
Go to the documentation of this file.
8 #include <iostream>
9 
10 
12 
13 using namespace std;
14 
15 
17  hbheTag_(conf.getUntrackedParameter("HBHE",edm::InputTag())),
18  hoTag_(conf.getUntrackedParameter("HO",edm::InputTag())),
19  hfTag_(conf.getUntrackedParameter("HF",edm::InputTag())),
20  zdcTag_(conf.getUntrackedParameter("ZDC",edm::InputTag())),
21  calibTag_(conf.getUntrackedParameter("CALIB",edm::InputTag())),
22  trigTag_(conf.getUntrackedParameter("TRIG",edm::InputTag()))
23 {
24  produces<FEDRawDataCollection>();
25 }
26 
27 // Virtual destructor needed.
29 
30 // Functions that gets called by framework every event
32 {
34 
35 
36  // Step A: Get Inputs
38  if (!hbheTag_.label().empty()) {
39  e.getByLabel(hbheTag_,hbhe);
40  colls.hbhe=hbhe.product();
41  }
43  if (!hoTag_.label().empty()) {
44  e.getByLabel(hoTag_,ho);
45  colls.hoCont=ho.product();
46  }
48  if (!hfTag_.label().empty()) {
49  e.getByLabel(hfTag_,hf);
50  colls.hfCont=hf.product();
51  }
53  if (!calibTag_.label().empty()) {
54  e.getByLabel(calibTag_,Calib);
55  colls.calibCont=Calib.product();
56  }
58  if (!zdcTag_.label().empty()) {
59  e.getByLabel(zdcTag_,zdc);
60  colls.zdcCont=zdc.product();
61  }
63  if (!trigTag_.label().empty()) {
64  e.getByLabel(trigTag_,htp);
65  colls.tpCont=htp.product();
66  }
67  // get the mapping
69  es.get<HcalDbRecord>().get( pSetup );
70  const HcalElectronicsMap* readoutMap=pSetup->getHcalMapping();
71  // Step B: Create empty output
72  std::auto_ptr<FEDRawDataCollection> raw=std::auto_ptr<FEDRawDataCollection>(new FEDRawDataCollection());
73 
74  const int ifed_first=FEDNumbering::MINHCALFEDID;
75  const int ifed_last=FEDNumbering::MAXHCALFEDID;
76 
77  int orbitN=e.id().event();
78  int bcnN=2000;
79 
80  // Step C: pack all requested FEDs
81  for (int ifed=ifed_first; ifed<=ifed_last; ++ifed) {
82  FEDRawData& fed = raw->FEDData(ifed);
83  try {
84  packer_.pack(ifed,ifed-ifed_first, e.id().event(),
85  orbitN, bcnN, colls, *readoutMap, fed);
86  } catch (cms::Exception& e) {
87  edm::LogWarning("Unpacking error") << e.what();
88  } catch (...) {
89  edm::LogWarning("Unpacking exception");
90  }
91  }
92 
93 
94  e.put(raw);
95 }
96 
97 
virtual char const * what() const
Definition: Exception.cc:141
EventNumber_t event() const
Definition: EventID.h:44
void pack(int fedid, int dccnumber, int nl1a, int orbitn, int bcn, const Collections &inputs, const HcalElectronicsMap &emap, FEDRawData &output)
Definition: HcalPacker.cc:79
edm::InputTag hbheTag_
Definition: HcalDigiToRaw.h:34
HcalPacker packer_
Definition: HcalDigiToRaw.h:33
const HcalCalibDigiCollection * calibCont
Definition: HcalPacker.h:21
edm::InputTag hoTag_
Definition: HcalDigiToRaw.h:34
HcalDigiToRaw(const edm::ParameterSet &ps)
edm::InputTag zdcTag_
Definition: HcalDigiToRaw.h:34
edm::InputTag hfTag_
Definition: HcalDigiToRaw.h:34
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
const HcalTrigPrimDigiCollection * tpCont
Definition: HcalPacker.h:23
const ZDCDigiCollection * zdcCont
Definition: HcalPacker.h:22
const HBHEDigiCollection * hbhe
Definition: HcalPacker.h:18
edm::InputTag calibTag_
Definition: HcalDigiToRaw.h:34
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
tuple conf
Definition: dbtoconf.py:185
edm::InputTag trigTag_
Definition: HcalDigiToRaw.h:34
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: Handle.h:74
std::string const & label() const
Definition: InputTag.h:42
edm::EventID id() const
Definition: EventBase.h:56
const HODigiCollection * hoCont
Definition: HcalPacker.h:19
const HFDigiCollection * hfCont
Definition: HcalPacker.h:20
virtual void produce(edm::Event &e, const edm::EventSetup &c)
virtual ~HcalDigiToRaw()