CMS 3D CMS Logo

HGCalTriggerDigiFEReproducer.cc
Go to the documentation of this file.
3 
7 
11 
15 
16 #include <sstream>
17 #include <memory>
18 
20 {
21  public:
24 
25  virtual void beginRun(const edm::Run&, const edm::EventSetup&);
26  virtual void produce(edm::Event&, const edm::EventSetup&);
27 
28  private:
29  // inputs
32  // algorithm containers
33  std::unique_ptr<HGCalTriggerFECodecBase> codec_;
34  std::unique_ptr<HGCalTriggerBackendProcessor> backEndProcessor_;
35 };
36 
38 
39 
40 /*****************************************************************/
42  inputdigi_(consumes<l1t::HGCFETriggerDigiCollection>(conf.getParameter<edm::InputTag>("feDigis"))),
44 /*****************************************************************/
45 {
46  //setup FE codec
47  const edm::ParameterSet& feCodecConfig = conf.getParameterSet("FECodec");
48  const std::string& feCodecName = feCodecConfig.getParameter<std::string>("CodecName");
49  HGCalTriggerFECodecBase* codec = HGCalTriggerFECodecFactory::get()->create(feCodecName,feCodecConfig);
50  codec_.reset(codec);
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  {
83  fe_output->push_back(l1t::HGCFETriggerDigi());
84  l1t::HGCFETriggerDigi& digi_out = fe_output->back();
85  codec_->setDataPayload(digi_in);
86  codec_->encode(digi_out);
87  digi_out.setDetId( digi_in.getDetId<HGCalDetId>() );
88  codec_->print(digi_out,output);
89  edm::LogInfo("HGCalTriggerDigiFEReproducer")
90  << output.str();
91  codec_->unSetDataPayload();
92  output.str(std::string());
93  output.clear();
94  }
95 
96  // get the orphan handle and fe digi collection
97  auto fe_digis_handle = e.put(std::move(fe_output));
98  auto fe_digis_coll = *fe_digis_handle;
99 
100  //now we run the emulation of the back-end processor
101  backEndProcessor_->run(fe_digis_coll,es,e);
102  backEndProcessor_->putInEvent(e);
103  backEndProcessor_->reset();
104 }
T getParameter(std::string const &) const
virtual void produce(edm::Event &, const edm::EventSetup &)
std::unique_ptr< HGCalTriggerFECodecBase > codec_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
edm::ESHandle< HGCalTriggerGeometryBase > triggerGeometry_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
ParameterSet const & getParameterSet(ParameterSetID const &id)
edm::SortedCollection< HGCFETriggerDigi > HGCFETriggerDigiCollection
delete x;
Definition: CaloConfig.h:22
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::unique_ptr< HGCalTriggerBackendProcessor > backEndProcessor_
HGCalTriggerDigiFEReproducer(const edm::ParameterSet &)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void setDetId(const IDTYPE &id)
ParameterSet const & getParameterSet(std::string const &) const
const T & get() const
Definition: EventSetup.h:56
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
HLT enums.
size_type size() const
void reserve(size_type n)
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510
T get(const Candidate &c)
Definition: component.h:55
Definition: Run.h:42