CMS 3D CMS Logo

HcalDigiToRaw.cc
Go to the documentation of this file.
5 #include <iostream>
6 
8 
9 using namespace std;
10 
12  : hbheTag_(conf.getUntrackedParameter("HBHE", edm::InputTag())),
13  hoTag_(conf.getUntrackedParameter("HO", edm::InputTag())),
14  hfTag_(conf.getUntrackedParameter("HF", edm::InputTag())),
15  zdcTag_(conf.getUntrackedParameter("ZDC", edm::InputTag())),
16  calibTag_(conf.getUntrackedParameter("CALIB", edm::InputTag())),
17  trigTag_(conf.getUntrackedParameter("TRIG", edm::InputTag())),
18  // register for data access
19  tok_hbhe_(consumes<HBHEDigiCollection>(hbheTag_)),
20  tok_ho_(consumes<HODigiCollection>(hoTag_)),
21  tok_hf_(consumes<HFDigiCollection>(hfTag_)),
22  tok_calib_(consumes<HcalCalibDigiCollection>(calibTag_)),
23  tok_zdc_(consumes<ZDCDigiCollection>(zdcTag_)),
24  tok_htp_(consumes<HcalTrigPrimDigiCollection>(trigTag_)),
25  tok_dbService_(esConsumes<HcalDbService, HcalDbRecord>()) {
26  produces<FEDRawDataCollection>();
27 }
28 
29 // Virtual destructor needed.
31 
32 // Functions that gets called by framework every event
35 
36  // Step A: Get Inputs
38  if (!hbheTag_.label().empty()) {
39  e.getByToken(tok_hbhe_, hbhe);
40  colls.hbhe = hbhe.product();
41  }
43  if (!hoTag_.label().empty()) {
44  e.getByToken(tok_ho_, ho);
45  colls.hoCont = ho.product();
46  }
48  if (!hfTag_.label().empty()) {
49  e.getByToken(tok_hf_, hf);
50  colls.hfCont = hf.product();
51  }
53  if (!calibTag_.label().empty()) {
54  e.getByToken(tok_calib_, Calib);
55  colls.calibCont = Calib.product();
56  }
58  if (!zdcTag_.label().empty()) {
59  e.getByToken(tok_zdc_, zdc);
60  colls.zdcCont = zdc.product();
61  }
63  if (!trigTag_.label().empty()) {
64  e.getByToken(tok_htp_, htp);
65  if (htp.isValid())
66  colls.tpCont = htp.product();
67  }
68  // get the mapping
70  const HcalElectronicsMap* readoutMap = pSetup->getHcalMapping();
71  // Step B: Create empty output
72  auto raw = std::make_unique<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(), orbitN, bcnN, colls, *readoutMap, fed);
85  } catch (cms::Exception& e) {
86  edm::LogWarning("Unpacking error") << e.what();
87  } catch (...) {
88  edm::LogWarning("Unpacking exception");
89  }
90  }
91 
92  e.put(std::move(raw));
93 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
const edm::EDGetTokenT< ZDCDigiCollection > tok_zdc_
Definition: HcalDigiToRaw.h:43
T const * product() const
Definition: Handle.h:70
const edm::EDGetTokenT< HODigiCollection > tok_ho_
Definition: HcalDigiToRaw.h:40
HcalPacker packer_
Definition: HcalDigiToRaw.h:37
const edm::InputTag calibTag_
Definition: HcalDigiToRaw.h:38
const HcalCalibDigiCollection * calibCont
Definition: HcalPacker.h:19
const HcalElectronicsMap * getHcalMapping() const
std::string const & label() const
Definition: InputTag.h:36
HcalDigiToRaw(const edm::ParameterSet &ps)
const edm::InputTag hoTag_
Definition: HcalDigiToRaw.h:38
const edm::EDGetTokenT< HFDigiCollection > tok_hf_
Definition: HcalDigiToRaw.h:41
const edm::InputTag hfTag_
Definition: HcalDigiToRaw.h:38
void pack(int fedid, int dccnumber, int nl1a, int orbitn, int bcn, const Collections &inputs, const HcalElectronicsMap &emap, FEDRawData &output) const
Definition: HcalPacker.cc:99
~HcalDigiToRaw() override
const HcalTrigPrimDigiCollection * tpCont
Definition: HcalPacker.h:21
const ZDCDigiCollection * zdcCont
Definition: HcalPacker.h:20
const edm::InputTag zdcTag_
Definition: HcalDigiToRaw.h:38
const HBHEDigiCollection * hbhe
Definition: HcalPacker.h:16
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
const edm::ESGetToken< HcalDbService, HcalDbRecord > tok_dbService_
Definition: HcalDigiToRaw.h:45
void produce(edm::StreamID id, edm::Event &e, const edm::EventSetup &c) const override
const edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
Definition: HcalDigiToRaw.h:42
bool isValid() const
Definition: HandleBase.h:70
const edm::InputTag hbheTag_
Definition: HcalDigiToRaw.h:38
HLT enums.
const edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
Definition: HcalDigiToRaw.h:39
const HODigiCollection * hoCont
Definition: HcalPacker.h:17
const edm::EDGetTokenT< HcalTrigPrimDigiCollection > tok_htp_
Definition: HcalDigiToRaw.h:44
const HFDigiCollection * hfCont
Definition: HcalPacker.h:18
Log< level::Warning, false > LogWarning
const edm::InputTag trigTag_
Definition: HcalDigiToRaw.h:38
def move(src, dest)
Definition: eostools.py:511