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.
7 #include <iostream>
8 
9 
11 
12 using namespace std;
13 
14 
16  hbheTag_(conf.getUntrackedParameter("HBHE",edm::InputTag())),
17  hoTag_(conf.getUntrackedParameter("HO",edm::InputTag())),
18  hfTag_(conf.getUntrackedParameter("HF",edm::InputTag())),
19  zdcTag_(conf.getUntrackedParameter("ZDC",edm::InputTag())),
20  calibTag_(conf.getUntrackedParameter("CALIB",edm::InputTag())),
21  trigTag_(conf.getUntrackedParameter("TRIG",edm::InputTag()))
22 {
23  // register for data access
24  tok_hbhe_ = consumes<HBHEDigiCollection>(hbheTag_);
25  tok_ho_ = consumes<HODigiCollection>(hoTag_);
26  tok_hf_ = consumes<HFDigiCollection>(hfTag_);
27  tok_calib_ = consumes<HcalCalibDigiCollection>(calibTag_);
28  tok_zdc_ = consumes<ZDCDigiCollection>(zdcTag_);
29  tok_htp_ = consumes<HcalTrigPrimDigiCollection>(trigTag_);
30 
31  produces<FEDRawDataCollection>();
32 }
33 
34 // Virtual destructor needed.
36 
37 // Functions that gets called by framework every event
39 {
41 
42 
43  // Step A: Get Inputs
45  if (!hbheTag_.label().empty()) {
46  e.getByToken(tok_hbhe_,hbhe);
47  colls.hbhe=hbhe.product();
48  }
50  if (!hoTag_.label().empty()) {
51  e.getByToken(tok_ho_,ho);
52  colls.hoCont=ho.product();
53  }
55  if (!hfTag_.label().empty()) {
56  e.getByToken(tok_hf_,hf);
57  colls.hfCont=hf.product();
58  }
60  if (!calibTag_.label().empty()) {
61  e.getByToken(tok_calib_,Calib);
62  colls.calibCont=Calib.product();
63  }
65  if (!zdcTag_.label().empty()) {
66  e.getByToken(tok_zdc_,zdc);
67  colls.zdcCont=zdc.product();
68  }
70  if (!trigTag_.label().empty()) {
71  e.getByToken(tok_htp_,htp);
72  colls.tpCont=htp.product();
73  }
74  // get the mapping
76  es.get<HcalDbRecord>().get( pSetup );
77  const HcalElectronicsMap* readoutMap=pSetup->getHcalMapping();
78  // Step B: Create empty output
79  std::auto_ptr<FEDRawDataCollection> raw=std::auto_ptr<FEDRawDataCollection>(new FEDRawDataCollection());
80 
81  const int ifed_first=FEDNumbering::MINHCALFEDID;
82  const int ifed_last=FEDNumbering::MAXHCALFEDID;
83 
84  int orbitN=e.id().event();
85  int bcnN=2000;
86 
87  // Step C: pack all requested FEDs
88  for (int ifed=ifed_first; ifed<=ifed_last; ++ifed) {
89  FEDRawData& fed = raw->FEDData(ifed);
90  try {
91  packer_.pack(ifed,ifed-ifed_first, e.id().event(),
92  orbitN, bcnN, colls, *readoutMap, fed);
93  } catch (cms::Exception& e) {
94  edm::LogWarning("Unpacking error") << e.what();
95  } catch (...) {
96  edm::LogWarning("Unpacking exception");
97  }
98  }
99 
100 
101  e.put(raw);
102 }
103 
104 
edm::EDGetTokenT< HODigiCollection > tok_ho_
Definition: HcalDigiToRaw.h:37
virtual char const * what() const
Definition: Exception.cc:141
EventNumber_t event() const
Definition: EventID.h:41
void pack(int fedid, int dccnumber, int nl1a, int orbitn, int bcn, const Collections &inputs, const HcalElectronicsMap &emap, FEDRawData &output)
Definition: HcalPacker.cc:82
edm::EDGetTokenT< HFDigiCollection > tok_hf_
Definition: HcalDigiToRaw.h:38
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
edm::InputTag hbheTag_
Definition: HcalDigiToRaw.h:35
HcalPacker packer_
Definition: HcalDigiToRaw.h:34
const HcalCalibDigiCollection * calibCont
Definition: HcalPacker.h:19
edm::InputTag hoTag_
Definition: HcalDigiToRaw.h:35
HcalDigiToRaw(const edm::ParameterSet &ps)
edm::InputTag zdcTag_
Definition: HcalDigiToRaw.h:35
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
Definition: HcalDigiToRaw.h:39
edm::InputTag hfTag_
Definition: HcalDigiToRaw.h:35
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
const HcalTrigPrimDigiCollection * tpCont
Definition: HcalPacker.h:21
const ZDCDigiCollection * zdcCont
Definition: HcalPacker.h:20
const HBHEDigiCollection * hbhe
Definition: HcalPacker.h:16
edm::InputTag calibTag_
Definition: HcalDigiToRaw.h:35
tuple conf
Definition: dbtoconf.py:185
T const * product() const
Definition: Handle.h:81
edm::InputTag trigTag_
Definition: HcalDigiToRaw.h:35
const T & get() const
Definition: EventSetup.h:56
edm::EDGetTokenT< ZDCDigiCollection > tok_zdc_
Definition: HcalDigiToRaw.h:40
std::string const & label() const
Definition: InputTag.h:43
edm::EventID id() const
Definition: EventBase.h:60
const HODigiCollection * hoCont
Definition: HcalPacker.h:17
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
Definition: HcalDigiToRaw.h:36
const HFDigiCollection * hfCont
Definition: HcalPacker.h:18
virtual void produce(edm::Event &e, const edm::EventSetup &c)
edm::EDGetTokenT< HcalTrigPrimDigiCollection > tok_htp_
Definition: HcalDigiToRaw.h:41
virtual ~HcalDigiToRaw()