CMS 3D CMS Logo

SteppingHelixPropagatorESProducer.cc
Go to the documentation of this file.
5 
10 
12 
13 #include <string>
14 #include <memory>
15 
18 
20 public:
23  std::unique_ptr<Propagator> produce(const TrackingComponentsRecord&);
24 
25 private:
29  const bool setVBFPointer_;
30 };
31 
32 using namespace edm;
33 
35  : pset_{p}, setVBFPointer_{pset_.getParameter<bool>("SetVBFPointer")} {
36  std::string myname = p.getParameter<std::string>("ComponentName");
37  auto c = setWhatProduced(this, myname);
38  magToken_ = c.consumes();
39  if (setVBFPointer_) {
40  vbMagToken_ = c.consumes(edm::ESInputTag("", pset_.getParameter<std::string>("VBFName")));
41  }
42 }
43 
45 
46 std::unique_ptr<Propagator> SteppingHelixPropagatorESProducer::produce(const TrackingComponentsRecord& iRecord) {
47  // if (_propagator){
48  // delete _propagator;
49  // _propagator = 0;
50  // }
51  auto const& magfield = iRecord.get(magToken_);
52 
53  std::string pdir = pset_.getParameter<std::string>("PropagationDirection");
54 
56 
57  if (pdir == "oppositeToMomentum")
59  if (pdir == "alongMomentum")
61  if (pdir == "anyDirection")
62  dir = anyDirection;
63 
64  std::unique_ptr<SteppingHelixPropagator> shProp;
65  shProp = std::make_unique<SteppingHelixPropagator>(&magfield, dir);
66 
67  bool useInTeslaFromMagField = pset_.getParameter<bool>("useInTeslaFromMagField");
68  bool useMagVolumes = pset_.getParameter<bool>("useMagVolumes");
69 
70  // if useMagVolumes == true and an alternate VBF field is not specified with setVBFPointer_,
71  // Force "useInTeslaFromMagField=true" for a B=0 VBF map.
72  if (useMagVolumes == true && !useInTeslaFromMagField && !setVBFPointer_ && magfield.nominalValue() == 0) {
73  const VolumeBasedMagneticField* vbfCPtr = dynamic_cast<const VolumeBasedMagneticField*>(&magfield);
74  if (vbfCPtr == nullptr) {
75  edm::LogWarning("SteppingHelixPropagator")
76  << "Config specifies useMagVolumes==True but no VBF field available: SHP has no access to yoke material "
77  "properties. Use setVBFPointer=true and VBFName cards to set a VBF field, otherwise set "
78  "useMagVolumes==False."
79  << std::endl;
80  } else {
81  edm::LogInfo("SteppingHelixPropagator")
82  << "Config specifies useMagVolumes==true and VBF field available: Forcing useInTeslaFromMagField = True."
83  << std::endl;
85  }
86  }
87 
88  if (setVBFPointer_) {
89  auto const& vbfField = iRecord.get(vbMagToken_);
90  const VolumeBasedMagneticField* vbfCPtr = dynamic_cast<const VolumeBasedMagneticField*>(&vbfField);
91  shProp->setVBFPointer(vbfCPtr);
92  }
93 
94  shProp->setUseInTeslaFromMagField(useInTeslaFromMagField);
95 
96  bool haveX0Corr = pset_.getParameter<bool>("ApplyRadX0Correction");
97  shProp->applyRadX0Correction(haveX0Corr);
98 
99  bool assumeNoMaterial = pset_.getParameter<bool>("AssumeNoMaterial");
100  shProp->setMaterialMode(assumeNoMaterial);
101 
102  bool noErrorPropagation = pset_.getParameter<bool>("NoErrorPropagation");
103  shProp->setNoErrorPropagation(noErrorPropagation);
104 
105  bool debugMode = pset_.getParameter<bool>("debug");
106  shProp->setDebug(debugMode);
107 
108  shProp->setUseMagVolumes(useMagVolumes);
109 
110  bool useMatVolumes = pset_.getParameter<bool>("useMatVolumes");
111  shProp->setUseMatVolumes(useMatVolumes);
112 
113  bool useIsYokeFlag = pset_.getParameter<bool>("useIsYokeFlag");
114  shProp->setUseIsYokeFlag(useIsYokeFlag);
115 
116  bool returnTangentPlane = pset_.getParameter<bool>("returnTangentPlane");
117  shProp->setReturnTangentPlane(returnTangentPlane);
118 
119  bool sendLogWarning = pset_.getParameter<bool>("sendLogWarning");
120  shProp->setSendLogWarning(sendLogWarning);
121 
122  bool useTuningForL2Speed = pset_.getParameter<bool>("useTuningForL2Speed");
123  shProp->setUseTuningForL2Speed(useTuningForL2Speed);
124 
125  bool useECoffsets = pset_.getParameter<bool>("useEndcapShiftsInZ");
126  if (useECoffsets) {
127  double valPos = pset_.getParameter<double>("endcapShiftInZPos");
128  double valNeg = pset_.getParameter<double>("endcapShiftInZNeg");
129  shProp->setEndcapShiftsInZPosNeg(valPos, valNeg);
130  }
131 
132  return shProp;
133 }
134 
136 
anyDirection
Definition: PropagationDirection.h:4
edm::ESInputTag
Definition: ESInputTag.h:87
HLT_FULL_cff.useMagVolumes
useMagVolumes
Definition: HLT_FULL_cff.py:6576
MessageLogger.h
SteppingHelixPropagator.h
SteppingHelixPropagatorESProducer::produce
std::unique_ptr< Propagator > produce(const TrackingComponentsRecord &)
Definition: SteppingHelixPropagatorESProducer.cc:46
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
VolumeBasedMagneticField
Definition: VolumeBasedMagneticField.h:18
ESProducer.h
typelookup.h
oppositeToMomentum
Definition: PropagationDirection.h:4
SteppingHelixPropagatorESProducer::setVBFPointer_
const bool setVBFPointer_
Definition: SteppingHelixPropagatorESProducer.cc:29
HLT_FULL_cff.useMatVolumes
useMatVolumes
Definition: HLT_FULL_cff.py:6573
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
SteppingHelixPropagatorESProducer::magToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magToken_
Definition: SteppingHelixPropagatorESProducer.cc:27
SteppingHelixPropagatorESProducer::vbMagToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > vbMagToken_
Definition: SteppingHelixPropagatorESProducer.cc:28
VolumeBasedMagneticField.h
IdealMagneticFieldRecord.h
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:103
SteppingHelixPropagatorESProducer
Definition: SteppingHelixPropagatorESProducer.cc:19
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_FULL_cff.useIsYokeFlag
useIsYokeFlag
Definition: HLT_FULL_cff.py:6564
edm::ParameterSet
Definition: ParameterSet.h:47
SteppingHelixPropagatorESProducer::SteppingHelixPropagatorESProducer
SteppingHelixPropagatorESProducer(const edm::ParameterSet &p)
Definition: SteppingHelixPropagatorESProducer.cc:34
HLT_FULL_cff.useTuningForL2Speed
useTuningForL2Speed
Definition: HLT_FULL_cff.py:6563
MagneticField.h
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord >
HLT_FULL_cff.sendLogWarning
sendLogWarning
Definition: HLT_FULL_cff.py:6572
ModuleFactory.h
SteppingHelixPropagatorESProducer::~SteppingHelixPropagatorESProducer
~SteppingHelixPropagatorESProducer() override
Definition: SteppingHelixPropagatorESProducer.cc:44
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
HLT_FULL_cff.useInTeslaFromMagField
useInTeslaFromMagField
Definition: HLT_FULL_cff.py:6569
HLT_FULL_cff.returnTangentPlane
returnTangentPlane
Definition: HLT_FULL_cff.py:6568
TrackingComponentsRecord.h
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESProducer
Definition: ESProducer.h:104
SteppingHelixPropagatorESProducer::pset_
const edm::ParameterSet pset_
Definition: SteppingHelixPropagatorESProducer.cc:26
beampixel_dqm_sourceclient-live_cfg.debugMode
debugMode
Definition: beampixel_dqm_sourceclient-live_cfg.py:135
ParameterSet.h
volumeBasedMagneticField_160812_cfi.magfield
magfield
Definition: volumeBasedMagneticField_160812_cfi.py:11
alongMomentum
Definition: PropagationDirection.h:4
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
TrackingComponentsRecord
Definition: TrackingComponentsRecord.h:12