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 
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 
52  algo->setChannelStatus(chs.get(channelToken_));
53 }
54 
55 //define this as a plug-in
edm::ESProductHost< EcalSeverityLevelAlgo, EcalChannelStatusRcd > HostType
string host
Definition: query.py:115
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
edm::ReusableObjectHolder< HostType > holder_
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
std::shared_ptr< T > makeOrGet(FM &&iMakeFunc)
Takes an object from the queue if one is available, or creates one using iMakeFunc.
void setupChannelStatus(const EcalChannelStatusRcd &, EcalSeverityLevelAlgo *)
std::shared_ptr< EcalSeverityLevelAlgo > ReturnType
EcalSeverityLevelESProducer(const edm::ParameterSet &iConfig)
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > const channelToken_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
ReturnType produce(const EcalSeverityLevelAlgoRcd &iRecord)