CMS 3D CMS Logo

EcalSeverityLevelESProducer.cc
Go to the documentation of this file.
1 #include <memory>
11 
12 /*
13  Provide a hook to retrieve the EcalSeverityLevelAlgo
14  through the EventSetup
15 
16  Appartently there is no smarter way to do it in CMSSW
17 
18  Author: Stefano Argiro
19  */
20 
22 
23 public:
25 
26  typedef std::shared_ptr<EcalSeverityLevelAlgo> ReturnType;
27 
28  ReturnType produce(const EcalSeverityLevelAlgoRcd& iRecord);
29 
30 private:
31 
34 
37 
40 };
41 
43  pset_(iConfig) {
44 
45  //the following line is needed to tell the framework what
46  // data is being produced
47  setWhatProduced(this);
48 }
49 
52 
53  auto host = holder_.makeOrGet([this]() {
54  return new HostType(pset_);
55  });
56 
57  host->ifRecordChanges<EcalChannelStatusRcd>(iRecord,
58  [this,h=host.get()](auto const& rec) {
59  setupChannelStatus(rec, h);
60  });
61 
62  return host;
63 }
64 
65 void
69  chs.get (h);
70  algo->setChannelStatus(*h.product());
71 }
72 
73 //define this as a plug-in
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:116
host
Definition: query.py:115
edm::ESProductHost< EcalSeverityLevelAlgo, EcalChannelStatusRcd > HostType
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
edm::ReusableObjectHolder< HostType > holder_
void setChannelStatus(const EcalChannelStatus &chs)
Set the ChannelStatus record.
void setupChannelStatus(const EcalChannelStatusRcd &, EcalSeverityLevelAlgo *)
std::shared_ptr< EcalSeverityLevelAlgo > ReturnType
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
EcalSeverityLevelESProducer(const edm::ParameterSet &iConfig)
T const * product() const
Definition: ESHandle.h:84
bool get(HolderT &iHolder) const
ReturnType produce(const EcalSeverityLevelAlgoRcd &iRecord)