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 public:
24 
25  typedef std::shared_ptr<EcalSeverityLevelAlgo> ReturnType;
26 
27  ReturnType produce(const EcalSeverityLevelAlgoRcd& iRecord);
28 
29 private:
31 
33 
37 };
38 
40  : pset_(iConfig), channelToken_(setWhatProduced(this).consumesFrom<EcalChannelStatus, EcalChannelStatusRcd>()) {}
41 
43  auto host = holder_.makeOrGet([this]() { return new HostType(pset_); });
44 
45  host->ifRecordChanges<EcalChannelStatusRcd>(iRecord,
46  [this, h = host.get()](auto const& rec) { setupChannelStatus(rec, h); });
47 
48  return host;
49 }
50 
53 }
54 
55 //define this as a plug-in
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
host
Definition: query.py:115
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
edm::ESProductHost< EcalSeverityLevelAlgo, EcalChannelStatusRcd > HostType
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
edm::ReusableObjectHolder< HostType > holder_
std::shared_ptr< T > makeOrGet(F iFunc)
If there isn&#39;t an object already available, creates a new one using iFunc.
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)
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > const channelToken_
ReturnType produce(const EcalSeverityLevelAlgoRcd &iRecord)