TrackingTools
Producers
src
SmartPropagatorESProducer.cc
Go to the documentation of this file.
1
7
#include "
FWCore/Framework/interface/ESProducer.h
"
8
9
#include "
TrackingTools/GeomPropagators/interface/SmartPropagator.h
"
10
#include "
DataFormats/TrajectorySeed/interface/PropagationDirection.h
"
11
12
#include "
FWCore/Framework/interface/EventSetup.h
"
13
#include "
FWCore/Framework/interface/ESHandle.h
"
14
#include "
DataFormats/Common/interface/Handle.h
"
15
#include "
FWCore/Framework/interface/ModuleFactory.h
"
16
#include "
FWCore/Utilities/interface/Exception.h
"
17
18
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
19
#include "
TrackingTools/Records/interface/TrackingComponentsRecord.h
"
20
21
#include "
MagneticField/Engine/interface/MagneticField.h
"
22
#include "
MagneticField/Records/interface/IdealMagneticFieldRecord.h
"
23
24
#include <memory>
25
26
class
SmartPropagatorESProducer
:
public
edm::ESProducer
{
27
public
:
29
SmartPropagatorESProducer
(
const
edm::ParameterSet
&);
30
32
~SmartPropagatorESProducer
()
override
;
33
34
// Operations
35
std::unique_ptr<Propagator>
produce
(
const
TrackingComponentsRecord
&);
36
37
private
:
38
PropagationDirection
thePropagationDirection
;
39
double
theEpsilon
;
40
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord>
magToken_
;
41
edm::ESGetToken<Propagator, TrackingComponentsRecord>
trackerToken_
;
42
edm::ESGetToken<Propagator, TrackingComponentsRecord>
muonToken_
;
43
};
44
45
using namespace
edm
;
46
using namespace
std
;
47
48
SmartPropagatorESProducer::SmartPropagatorESProducer
(
const
ParameterSet
&
parameterSet
) {
49
string
myname =
parameterSet
.
getParameter
<
string
>(
"ComponentName"
);
50
51
string
propDir =
parameterSet
.
getParameter
<
string
>(
"PropagationDirection"
);
52
53
if
(propDir ==
"oppositeToMomentum"
)
54
thePropagationDirection =
oppositeToMomentum
;
55
else
if
(propDir ==
"alongMomentum"
)
56
thePropagationDirection =
alongMomentum
;
57
else
if
(propDir ==
"anyDirection"
)
58
thePropagationDirection =
anyDirection
;
59
else
60
throw
cms::Exception
(
"SmartPropagatorESProducer"
) <<
"Wrong fit direction chosen in SmartPropagatorESProducer"
;
61
62
theEpsilon =
parameterSet
.
getParameter
<
double
>(
"Epsilon"
);
63
64
auto
cc
= setWhatProduced(
this
, myname);
65
magToken_ =
cc
.consumes();
66
trackerToken_ =
cc
.consumes(
edm::ESInputTag
(
""
,
parameterSet
.
getParameter
<
string
>(
"TrackerPropagator"
)));
67
muonToken_ =
cc
.consumes(
edm::ESInputTag
(
""
,
parameterSet
.
getParameter
<
string
>(
"MuonPropagator"
)));
68
}
69
70
SmartPropagatorESProducer::~SmartPropagatorESProducer
() {}
71
72
std::unique_ptr<Propagator>
SmartPropagatorESProducer::produce
(
const
TrackingComponentsRecord
& iRecord) {
73
return
std::make_unique<SmartPropagator>(
74
iRecord.
get
(trackerToken_), iRecord.
get
(muonToken_), &iRecord.
get
(magToken_), thePropagationDirection, theEpsilon);
75
}
76
77
DEFINE_FWK_EVENTSETUP_MODULE
(
SmartPropagatorESProducer
);
Handle.h
anyDirection
Definition:
PropagationDirection.h:4
edm::ESInputTag
Definition:
ESInputTag.h:87
ESHandle.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
SmartPropagatorESProducer::theEpsilon
double theEpsilon
Definition:
SmartPropagatorESProducer.cc:39
ESProducer.h
oppositeToMomentum
Definition:
PropagationDirection.h:4
SmartPropagatorESProducer::magToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magToken_
Definition:
SmartPropagatorESProducer.cc:40
cc
edm::parameterSet
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition:
Provenance.cc:11
SmartPropagatorESProducer::trackerToken_
edm::ESGetToken< Propagator, TrackingComponentsRecord > trackerToken_
Definition:
SmartPropagatorESProducer.cc:41
SmartPropagatorESProducer::~SmartPropagatorESProducer
~SmartPropagatorESProducer() override
Destructor.
Definition:
SmartPropagatorESProducer.cc:70
IdealMagneticFieldRecord.h
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition:
DependentRecordImplementation.h:109
SmartPropagatorESProducer::muonToken_
edm::ESGetToken< Propagator, TrackingComponentsRecord > muonToken_
Definition:
SmartPropagatorESProducer.cc:42
edm::ParameterSet
Definition:
ParameterSet.h:47
MagneticField.h
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord >
SmartPropagator.h
PropagationDirection.h
ModuleFactory.h
std
Definition:
JetResolutionObject.h:76
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition:
ModuleFactory.h:60
TrackingComponentsRecord.h
Exception
Definition:
hltDiff.cc:245
PropagationDirection
PropagationDirection
Definition:
PropagationDirection.h:4
EventSetup.h
SmartPropagatorESProducer::produce
std::unique_ptr< Propagator > produce(const TrackingComponentsRecord &)
Definition:
SmartPropagatorESProducer.cc:72
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
Exception.h
edm::ESProducer
Definition:
ESProducer.h:104
SmartPropagatorESProducer::SmartPropagatorESProducer
SmartPropagatorESProducer(const edm::ParameterSet &)
Constructor.
Definition:
SmartPropagatorESProducer.cc:48
ParameterSet.h
SmartPropagatorESProducer
Definition:
SmartPropagatorESProducer.cc:26
alongMomentum
Definition:
PropagationDirection.h:4
SmartPropagatorESProducer::thePropagationDirection
PropagationDirection thePropagationDirection
Definition:
SmartPropagatorESProducer.cc:38
TrackingComponentsRecord
Definition:
TrackingComponentsRecord.h:12
Generated for CMSSW Reference Manual by
1.8.16