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
EcalSeverityLevelESProducer::HostType
edm::ESProductHost< EcalSeverityLevelAlgo, EcalChannelStatusRcd > HostType
Definition: EcalSeverityLevelESProducer.cc:32
EcalSeverityLevelAlgo
Definition: EcalSeverityLevelAlgo.h:33
EcalSeverityLevelESProducer::channelToken_
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > channelToken_
Definition: EcalSeverityLevelESProducer.cc:36
ESHandle.h
EcalSeverityLevelAlgoRcd.h
EcalSeverityLevelESProducer::ReturnType
std::shared_ptr< EcalSeverityLevelAlgo > ReturnType
Definition: EcalSeverityLevelESProducer.cc:25
ESProducer.h
EcalCondObjectContainer< EcalChannelStatusCode >
query.host
host
Definition: query.py:115
edm::ReusableObjectHolder< HostType >
edm::ReusableObjectHolder::makeOrGet
std::shared_ptr< T > makeOrGet(F iFunc)
If there isn't an object already available, creates a new one using iFunc.
Definition: ReusableObjectHolder.h:126
cmsdt::algo
algo
Definition: constants.h:164
ReusableObjectHolder.h
EcalSeverityLevelESProducer::holder_
edm::ReusableObjectHolder< HostType > holder_
Definition: EcalSeverityLevelESProducer.cc:34
EcalSeverityLevelESProducer::pset_
const edm::ParameterSet pset_
Definition: EcalSeverityLevelESProducer.cc:35
EcalSeverityLevelAlgoRcd
Definition: EcalSeverityLevelAlgoRcd.h:12
h
EcalSeverityLevelAlgo.h
EcalSeverityLevelESProducer::setupChannelStatus
void setupChannelStatus(const EcalChannelStatusRcd &, EcalSeverityLevelAlgo *)
Definition: EcalSeverityLevelESProducer.cc:51
edm::ParameterSet
Definition: ParameterSet.h:36
EcalChannelStatusRcd
Definition: EcalChannelStatusRcd.h:5
EcalSeverityLevelESProducer
Definition: EcalSeverityLevelESProducer.cc:21
edm::ESGetToken
Definition: EventSetup.h:48
EcalSeverityLevelESProducer::produce
ReturnType produce(const EcalSeverityLevelAlgoRcd &iRecord)
Definition: EcalSeverityLevelESProducer.cc:42
ModuleFactory.h
edm::ESProductHost
Definition: ESProductHost.h:93
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
EcalSeverityLevelESProducer::EcalSeverityLevelESProducer
EcalSeverityLevelESProducer(const edm::ParameterSet &iConfig)
Definition: EcalSeverityLevelESProducer.cc:39
edm::ESProducer
Definition: ESProducer.h:101
ESProductHost.h
edm::eventsetup::EventSetupRecordImplementation::get
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
Definition: EventSetupRecordImplementation.h:74
ParameterSet.h
EcalChannelStatusRcd.h