RecoVertex
BeamSpotProducer
plugins
OfflineToTransientBeamSpotESProducer.cc
Go to the documentation of this file.
1
#include "
CondFormats/DataRecord/interface/BeamSpotObjectsRcd.h
"
2
#include "
CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h
"
3
#include "
CondFormats/DataRecord/interface/BeamSpotTransientObjectsRcd.h
"
4
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
5
#include "
FWCore/Framework/interface/ESProductHost.h
"
6
#include "
FWCore/Utilities/interface/ReusableObjectHolder.h
"
7
#include "
FWCore/Framework/interface/ESProducer.h
"
8
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
9
10
#include "
FWCore/Framework/interface/EventSetup.h
"
11
#include "
FWCore/Framework/interface/ESHandle.h
"
12
#include "
FWCore/Framework/interface/ModuleFactory.h
"
13
#include "
FWCore/Framework/interface/ESProducer.h
"
14
#include "
FWCore/Utilities/interface/do_nothing_deleter.h
"
15
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
16
17
#include <iostream>
18
#include <memory>
19
#include <string>
20
21
using namespace
edm
;
22
class
OfflineToTransientBeamSpotESProducer
:
public
edm::ESProducer
{
23
public
:
24
OfflineToTransientBeamSpotESProducer
(
const
edm::ParameterSet
&
p
);
25
std::shared_ptr<const BeamSpotObjects> produce(
const
BeamSpotTransientObjectsRcd
&);
26
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
&
desc
);
27
28
private
:
29
const
BeamSpotObjects
dummyBS_
;
30
edm::ESGetToken<BeamSpotObjects, BeamSpotTransientObjectsRcd>
const
bsToken_
;
31
edm::ESGetToken<BeamSpotObjects, BeamSpotObjectsRcd>
bsOfflineToken_
;
32
};
33
34
OfflineToTransientBeamSpotESProducer::OfflineToTransientBeamSpotESProducer
(
const
edm::ParameterSet
&
p
) {
35
auto
cc
= setWhatProduced(
this
);
36
37
bsOfflineToken_ =
cc
.consumesFrom<
BeamSpotObjects
,
BeamSpotObjectsRcd
>();
38
}
39
40
void
OfflineToTransientBeamSpotESProducer::fillDescriptions
(
edm::ConfigurationDescriptions
&
desc
) {
41
edm::ParameterSetDescription
dsc;
42
desc
.addWithDefaultLabel(dsc);
43
}
44
std::shared_ptr<const BeamSpotObjects>
OfflineToTransientBeamSpotESProducer::produce
(
45
const
BeamSpotTransientObjectsRcd
& iRecord) {
46
auto
optionalRec = iRecord.
tryToGetRecord
<
BeamSpotObjectsRcd
>();
47
if
(not optionalRec) {
48
return
std::shared_ptr<const BeamSpotObjects>(&dummyBS_,
edm::do_nothing_deleter
());
49
}
50
return
std::shared_ptr<const BeamSpotObjects>(&optionalRec->get(bsOfflineToken_),
edm::do_nothing_deleter
());
51
};
52
53
DEFINE_FWK_EVENTSETUP_MODULE
(
OfflineToTransientBeamSpotESProducer
);
ConfigurationDescriptions.h
ESHandle.h
BeamSpotTransientObjectsRcd
Definition:
BeamSpotTransientObjectsRcd.h:27
OfflineToTransientBeamSpotESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &desc)
Definition:
OfflineToTransientBeamSpotESProducer.cc:40
edm
HLT enums.
Definition:
AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
edm::do_nothing_deleter
Definition:
do_nothing_deleter.h:34
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
ESProducer.h
OfflineToTransientBeamSpotESProducer::bsToken_
const edm::ESGetToken< BeamSpotObjects, BeamSpotTransientObjectsRcd > bsToken_
Definition:
OfflineToTransientBeamSpotESProducer.cc:30
OfflineToTransientBeamSpotESProducer::produce
std::shared_ptr< const BeamSpotObjects > produce(const BeamSpotTransientObjectsRcd &)
Definition:
OfflineToTransientBeamSpotESProducer.cc:44
cc
BeamSpotObjects.h
OfflineToTransientBeamSpotESProducer
Definition:
OfflineToTransientBeamSpotESProducer.cc:22
ReusableObjectHolder.h
BeamSpotObjectsRcd.h
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
OfflineToTransientBeamSpotESProducer::OfflineToTransientBeamSpotESProducer
OfflineToTransientBeamSpotESProducer(const edm::ParameterSet &p)
Definition:
OfflineToTransientBeamSpotESProducer.cc:34
edm::ParameterSet
Definition:
ParameterSet.h:47
OfflineToTransientBeamSpotESProducer::dummyBS_
const BeamSpotObjects dummyBS_
Definition:
OfflineToTransientBeamSpotESProducer.cc:29
OfflineToTransientBeamSpotESProducer::bsOfflineToken_
edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > bsOfflineToken_
Definition:
OfflineToTransientBeamSpotESProducer.cc:31
BeamSpotTransientObjectsRcd.h
BeamSpotObjectsRcd
Definition:
BeamSpotObjectsRcd.h:24
BeamSpotObjects
Definition:
BeamSpotObjects.h:20
edm::ESGetToken< BeamSpotObjects, BeamSpotTransientObjectsRcd >
ModuleFactory.h
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
edm::eventsetup::DependentRecordImplementation::tryToGetRecord
std::optional< DepRecordT > tryToGetRecord() const
Definition:
DependentRecordImplementation.h:68
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition:
ModuleFactory.h:60
EventSetup.h
edm::ESProducer
Definition:
ESProducer.h:104
ESProductHost.h
ParameterSet.h
do_nothing_deleter.h
Generated for CMSSW Reference Manual by
1.8.16