CMS 3D CMS Logo

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