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 }
FEDNumbering.h
edm::StreamID
Definition: StreamID.h:30
HcalDigiToRaw::HcalDigiToRaw
HcalDigiToRaw(const edm::ParameterSet &ps)
Definition: HcalDigiToRaw.cc:11
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:39
ESHandle.h
HcalDigiToRaw::tok_ho_
const edm::EDGetTokenT< HODigiCollection > tok_ho_
Definition: HcalDigiToRaw.h:40
HcalDigiToRaw::tok_dbService_
const edm::ESGetToken< HcalDbService, HcalDbRecord > tok_dbService_
Definition: HcalDigiToRaw.h:45
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
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
HcalDigiToRaw::tok_zdc_
const edm::EDGetTokenT< ZDCDigiCollection > tok_zdc_
Definition: HcalDigiToRaw.h:43
edm::SortedCollection
Definition: SortedCollection.h:49
HcalDigiToRaw::hfTag_
const edm::InputTag hfTag_
Definition: HcalDigiToRaw.h:38
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
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
HcalDbService::getHcalMapping
const HcalElectronicsMap * getHcalMapping() const
Definition: HcalDbService.cc:343
HcalDigiToRaw::packer_
HcalPacker packer_
Definition: HcalDigiToRaw.h:37
FEDRawData
Definition: FEDRawData.h:19
HcalDigiToRaw::calibTag_
const edm::InputTag calibTag_
Definition: HcalDigiToRaw.h:38
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
HcalDigiToRaw::tok_hf_
const edm::EDGetTokenT< HFDigiCollection > tok_hf_
Definition: HcalDigiToRaw.h:41
photonIsolationHIProducer_cfi.hf
hf
Definition: photonIsolationHIProducer_cfi.py:9
HcalPacker::Collections
Definition: HcalPacker.h:14
edm::ESHandle< HcalDbService >
HcalDigiToRaw::zdcTag_
const edm::InputTag zdcTag_
Definition: HcalDigiToRaw.h:38
HcalDigiToRaw::hoTag_
const edm::InputTag hoTag_
Definition: HcalDigiToRaw.h:38
HcalPacker::Collections::hbhe
const HBHEDigiCollection * hbhe
Definition: HcalPacker.h:16
edm::ParameterSet
Definition: ParameterSet.h:47
FEDRawDataCollection.h
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
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
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:97
HcalDbService
Definition: HcalDbService.h:26
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
HcalDigiToRaw::~HcalDigiToRaw
~HcalDigiToRaw() override
Definition: HcalDigiToRaw.cc:30
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:33
HcalDigiToRaw::trigTag_
const edm::InputTag trigTag_
Definition: HcalDigiToRaw.h:38
HcalDigiToRaw::tok_calib_
const edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
Definition: HcalDigiToRaw.h:42
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:38
HcalDigiToRaw::tok_htp_
const edm::EDGetTokenT< HcalTrigPrimDigiCollection > tok_htp_
Definition: HcalDigiToRaw.h:44
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