CMS 3D CMS Logo

HGCalTriggerDigiFEReproducer.cc
Go to the documentation of this file.
3 
7 
11 
13 
17 
18 #include <sstream>
19 #include <memory>
20 
22 public:
25 
26  void beginRun(const edm::Run&, const edm::EventSetup&) override;
27  void produce(edm::Event&, const edm::EventSetup&) override;
28 
29 private:
30  // inputs
33  // algorithm containers
34  std::unique_ptr<HGCalTriggerFECodecBase> codec_;
35  std::unique_ptr<HGCalTriggerBackendProcessor> backEndProcessor_;
36 };
37 
39 
40 /*****************************************************************/
42  : inputdigi_(consumes<l1t::HGCFETriggerDigiCollection>(conf.getParameter<edm::InputTag>("feDigis"))),
43  backEndProcessor_(
44  std::make_unique<HGCalTriggerBackendProcessor>(conf.getParameterSet("BEConfiguration"), consumesCollector()))
45 /*****************************************************************/
46 {
47  //setup FE codec
48  const edm::ParameterSet& feCodecConfig = conf.getParameterSet("FECodec");
49  const std::string& feCodecName = feCodecConfig.getParameter<std::string>("CodecName");
50  codec_ = HGCalTriggerFECodecFactory::get()->create(feCodecName, feCodecConfig);
51  codec_->unSetDataPayload();
52 
53  produces<l1t::HGCFETriggerDigiCollection>();
54  // register backend processor products
55  backEndProcessor_->setProduces(*this);
56 }
57 
58 /*****************************************************************/
60 /*****************************************************************/
61 {
63  codec_->setGeometry(triggerGeometry_.product());
65 }
66 
67 /*****************************************************************/
69 /*****************************************************************/
70 {
71  std::unique_ptr<l1t::HGCFETriggerDigiCollection> fe_output(new l1t::HGCFETriggerDigiCollection);
72 
74 
75  e.getByToken(inputdigi_, digis_h);
76 
77  const l1t::HGCFETriggerDigiCollection& digis = *digis_h;
78 
79  fe_output->reserve(digis.size());
80  std::stringstream output;
81  for (const auto& digi_in : digis) {
82  fe_output->push_back(l1t::HGCFETriggerDigi());
83  l1t::HGCFETriggerDigi& digi_out = fe_output->back();
84  codec_->setDataPayload(digi_in);
85  codec_->encode(digi_out);
86  digi_out.setDetId(digi_in.getDetId<HGCalDetId>());
87  codec_->print(digi_out, output);
88  edm::LogInfo("HGCalTriggerDigiFEReproducer") << output.str();
89  codec_->unSetDataPayload();
90  output.str(std::string());
91  output.clear();
92  }
93 
94  // get the orphan handle and fe digi collection
95  auto fe_digis_handle = e.put(std::move(fe_output));
96  auto fe_digis_coll = *fe_digis_handle;
97 
98  //now we run the emulation of the back-end processor
99  backEndProcessor_->run(fe_digis_coll, es, e);
100  backEndProcessor_->putInEvent(e);
101  backEndProcessor_->reset();
102 }
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
l1t::HGCFETriggerDigi
Definition: HGCFETriggerDigi.h:64
HGCalTriggerDigiFEReproducer::HGCalTriggerDigiFEReproducer
HGCalTriggerDigiFEReproducer(const edm::ParameterSet &)
Definition: HGCalTriggerDigiFEReproducer.cc:41
HGCFETriggerDigiDefs.h
HGCalTriggerBackendProcessor
Definition: HGCalTriggerBackendProcessor.h:29
HGCalTriggerDigiFEReproducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: HGCalTriggerDigiFEReproducer.cc:68
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
edm::Run
Definition: Run.h:45
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
HGCalTriggerBackendProcessor.h
edm::LogInfo
Definition: MessageLogger.h:254
HGCalTriggerFECodecBase.h
EDProducer.h
edm::SortedCollection
Definition: SortedCollection.h:49
edm::SortedCollection::size
size_type size() const
Definition: SortedCollection.h:215
HGCalTriggerDigiFEReproducer::~HGCalTriggerDigiFEReproducer
~HGCalTriggerDigiFEReproducer() override
Definition: HGCalTriggerDigiFEReproducer.cc:24
edm::Handle
Definition: AssociativeIterator.h:50
HGCalTriggerDigiFEReproducer::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: HGCalTriggerDigiFEReproducer.cc:59
MakerMacros.h
HGCalTriggerDigiFEReproducer::inputdigi_
edm::EDGetToken inputdigi_
Definition: HGCalTriggerDigiFEReproducer.cc:31
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HGCalTriggerGeometryBase.h
HGCalTriggerDigiFEReproducer::codec_
std::unique_ptr< HGCalTriggerFECodecBase > codec_
Definition: HGCalTriggerDigiFEReproducer.cc:34
HGCFETriggerDigi.h
edm::ESHandle< HGCalTriggerGeometryBase >
l1t::HGCFETriggerDigi::setDetId
void setDetId(const IDTYPE &id)
Definition: HGCFETriggerDigi.h:79
CaloGeometryRecord.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
HGCalTriggerDigiFEReproducer::triggerGeometry_
edm::ESHandle< HGCalTriggerGeometryBase > triggerGeometry_
Definition: HGCalTriggerDigiFEReproducer.cc:32
Event.h
l1t
delete x;
Definition: CaloConfig.h:22
HGCalTriggerDigiFEReproducer
Definition: HGCalTriggerDigiFEReproducer.cc:21
HGCDigiCollections.h
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:57
edm::EDGetToken
Definition: EDGetToken.h:35
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HGCalDetId
Definition: HGCalDetId.h:8
edm::getParameterSet
ParameterSet const & getParameterSet(ParameterSetID const &id)
Definition: ParameterSet.cc:855
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
l1t::HGCFETriggerDigiCollection
edm::SortedCollection< HGCFETriggerDigi > HGCFETriggerDigiCollection
Definition: HGCFETriggerDigiDefs.h:15
Frameworkfwd.h
edm::SortedCollection::reserve
void reserve(size_type n)
Definition: SortedCollection.h:225
HGCalTriggerDigiFEReproducer::backEndProcessor_
std::unique_ptr< HGCalTriggerBackendProcessor > backEndProcessor_
Definition: HGCalTriggerDigiFEReproducer.cc:35
ConsumesCollector.h
edm::Event
Definition: Event.h:73
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2121
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37