CMS 3D CMS Logo

HcalDigiToRaw.cc
Go to the documentation of this file.
7 #include <iostream>
8 
10 
11 using namespace std;
12 
14  : hbheTag_(conf.getUntrackedParameter("HBHE", edm::InputTag())),
15  hoTag_(conf.getUntrackedParameter("HO", edm::InputTag())),
16  hfTag_(conf.getUntrackedParameter("HF", edm::InputTag())),
17  zdcTag_(conf.getUntrackedParameter("ZDC", edm::InputTag())),
18  calibTag_(conf.getUntrackedParameter("CALIB", edm::InputTag())),
19  trigTag_(conf.getUntrackedParameter("TRIG", edm::InputTag())),
20  // register for data access
21  tok_hbhe_(consumes<HBHEDigiCollection>(hbheTag_)),
22  tok_ho_(consumes<HODigiCollection>(hoTag_)),
23  tok_hf_(consumes<HFDigiCollection>(hfTag_)),
24  tok_calib_(consumes<HcalCalibDigiCollection>(calibTag_)),
25  tok_zdc_(consumes<ZDCDigiCollection>(zdcTag_)),
26  tok_htp_(consumes<HcalTrigPrimDigiCollection>(trigTag_)) {
27  produces<FEDRawDataCollection>();
28 }
29 
30 // Virtual destructor needed.
32 
33 // Functions that gets called by framework every event
36 
37  // Step A: Get Inputs
39  if (!hbheTag_.label().empty()) {
40  e.getByToken(tok_hbhe_, hbhe);
41  colls.hbhe = hbhe.product();
42  }
44  if (!hoTag_.label().empty()) {
45  e.getByToken(tok_ho_, ho);
46  colls.hoCont = ho.product();
47  }
49  if (!hfTag_.label().empty()) {
50  e.getByToken(tok_hf_, hf);
51  colls.hfCont = hf.product();
52  }
54  if (!calibTag_.label().empty()) {
55  e.getByToken(tok_calib_, Calib);
56  colls.calibCont = Calib.product();
57  }
59  if (!zdcTag_.label().empty()) {
60  e.getByToken(tok_zdc_, zdc);
61  colls.zdcCont = zdc.product();
62  }
64  if (!trigTag_.label().empty()) {
65  e.getByToken(tok_htp_, htp);
66  if (htp.isValid())
67  colls.tpCont = htp.product();
68  }
69  // get the mapping
71  es.get<HcalDbRecord>().get(pSetup);
72  const HcalElectronicsMap* readoutMap = pSetup->getHcalMapping();
73  // Step B: Create empty output
74  auto raw = std::make_unique<FEDRawDataCollection>();
75 
76  const int ifed_first = FEDNumbering::MINHCALFEDID;
77  const int ifed_last = FEDNumbering::MAXHCALFEDID;
78 
79  int orbitN = e.id().event();
80  int bcnN = 2000;
81 
82  // Step C: pack all requested FEDs
83  for (int ifed = ifed_first; ifed <= ifed_last; ++ifed) {
84  FEDRawData& fed = raw->FEDData(ifed);
85  try {
86  packer_.pack(ifed, ifed - ifed_first, e.id().event(), orbitN, bcnN, colls, *readoutMap, fed);
87  } catch (cms::Exception& e) {
88  edm::LogWarning("Unpacking error") << e.what();
89  } catch (...) {
90  edm::LogWarning("Unpacking exception");
91  }
92  }
93 
94  e.put(std::move(raw));
95 }
FEDNumbering.h
edm::StreamID
Definition: StreamID.h:30
HcalDigiToRaw::HcalDigiToRaw
HcalDigiToRaw(const edm::ParameterSet &ps)
Definition: HcalDigiToRaw.cc:13
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
HcalDigiToRaw::tok_hbhe_
const edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
Definition: HcalDigiToRaw.h:36
ESHandle.h
HcalDigiToRaw::tok_ho_
const edm::EDGetTokenT< HODigiCollection > tok_ho_
Definition: HcalDigiToRaw.h:37
edm
HLT enums.
Definition: AlignableModifier.h:19
HcalPacker::pack
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::tok_zdc_
const edm::EDGetTokenT< ZDCDigiCollection > tok_zdc_
Definition: HcalDigiToRaw.h:40
edm::SortedCollection
Definition: SortedCollection.h:49
HcalDigiToRaw::hfTag_
const edm::InputTag hfTag_
Definition: HcalDigiToRaw.h:35
HcalPacker::Collections::calibCont
const HcalCalibDigiCollection * calibCont
Definition: HcalPacker.h:19
edm::Handle
Definition: AssociativeIterator.h:50
HcalPacker::Collections::zdcCont
const ZDCDigiCollection * zdcCont
Definition: HcalPacker.h:20
HcalDbService::getHcalMapping
const HcalElectronicsMap * getHcalMapping() const
Definition: HcalDbService.cc:343
HcalDigiToRaw::packer_
HcalPacker packer_
Definition: HcalDigiToRaw.h:34
FEDRawData
Definition: FEDRawData.h:19
HcalDigiToRaw::calibTag_
const edm::InputTag calibTag_
Definition: HcalDigiToRaw.h:35
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
HcalDigiToRaw::tok_hf_
const edm::EDGetTokenT< HFDigiCollection > tok_hf_
Definition: HcalDigiToRaw.h:38
photonIsolationHIProducer_cfi.hf
hf
Definition: photonIsolationHIProducer_cfi.py:9
HcalPacker::Collections
Definition: HcalPacker.h:14
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
edm::ESHandle< HcalDbService >
HcalDigiToRaw::zdcTag_
const edm::InputTag zdcTag_
Definition: HcalDigiToRaw.h:35
HcalDbRecord.h
edm::LogWarning
Definition: MessageLogger.h:141
HcalDigiToRaw::hoTag_
const edm::InputTag hoTag_
Definition: HcalDigiToRaw.h:35
HcalPacker::Collections::hbhe
const HBHEDigiCollection * hbhe
Definition: HcalPacker.h:16
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
FEDRawDataCollection.h
photonIsolationHIProducer_cfi.ho
ho
Definition: photonIsolationHIProducer_cfi.py:10
HcalPacker::Collections::tpCont
const HcalTrigPrimDigiCollection * tpCont
Definition: HcalPacker.h:21
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
HcalPacker::Collections::hoCont
const HODigiCollection * hoCont
Definition: HcalPacker.h:17
HcalElectronicsMap
Definition: HcalElectronicsMap.h:31
photonIsolationHIProducer_cfi.hbhe
hbhe
Definition: photonIsolationHIProducer_cfi.py:8
HcalDigiToRaw.h
hcalSimParameters_cfi.zdc
zdc
Definition: hcalSimParameters_cfi.py:92
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
HcalDigiToRaw::~HcalDigiToRaw
~HcalDigiToRaw() override
Definition: HcalDigiToRaw.cc:31
FEDNumbering::MINHCALFEDID
Definition: FEDNumbering.h:47
HcalDigiToRaw::produce
void produce(edm::StreamID id, edm::Event &e, const edm::EventSetup &c) const override
Definition: HcalDigiToRaw.cc:34
HcalDigiToRaw::trigTag_
const edm::InputTag trigTag_
Definition: HcalDigiToRaw.h:35
HcalDbService.h
HcalDigiToRaw::tok_calib_
const edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
Definition: HcalDigiToRaw.h:39
cms::Exception
Definition: Exception.h:70
HcalDbRecord
Definition: HcalDbRecord.h:30
FEDNumbering::MAXHCALFEDID
Definition: FEDNumbering.h:48
HcalDigiToRaw::hbheTag_
const edm::InputTag hbheTag_
Definition: HcalDigiToRaw.h:35
HcalDigiToRaw::tok_htp_
const edm::EDGetTokenT< HcalTrigPrimDigiCollection > tok_htp_
Definition: HcalDigiToRaw.h:41
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
HcalPacker::Collections::hfCont
const HFDigiCollection * hfCont
Definition: HcalPacker.h:18
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37