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  private:
26 };
27 
28 
29 
30 using namespace edm;
31 
33 {
34  std::string myname = p.getParameter<std::string>("ComponentName");
35  pset_ = p;
36  setWhatProduced(this,myname);
37 }
38 
40 
41 std::unique_ptr<Propagator>
43 // if (_propagator){
44 // delete _propagator;
45 // _propagator = 0;
46 // }
47  ESHandle<MagneticField> magfield;
48  iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield );
49 
50  std::string pdir = pset_.getParameter<std::string>("PropagationDirection");
51 
53 
54  if (pdir == "oppositeToMomentum") dir = oppositeToMomentum;
55  if (pdir == "alongMomentum") dir = alongMomentum;
56  if (pdir == "anyDirection") dir = anyDirection;
57 
58  std::unique_ptr<SteppingHelixPropagator> shProp;
59  shProp.reset( new SteppingHelixPropagator(&(*magfield), dir));
60 
61  bool useInTeslaFromMagField = pset_.getParameter<bool>("useInTeslaFromMagField");
62  bool setVBFPointer = pset_.getParameter<bool>("SetVBFPointer");
63  bool useMagVolumes = pset_.getParameter<bool>("useMagVolumes");
64 
65  // if useMagVolumes == true and an alternate VBF field is not specified with setVBFPointer,
66  // Force "useInTeslaFromMagField=true" for a B=0 VBF map.
67  if (useMagVolumes==true && !useInTeslaFromMagField && !setVBFPointer && magfield->nominalValue() == 0) {
68  const VolumeBasedMagneticField* vbfCPtr = dynamic_cast<const VolumeBasedMagneticField*>(&(*magfield));
69  if (vbfCPtr ==nullptr ){
70  edm::LogWarning("SteppingHelixPropagator") << "Config specifies useMagVolumes==True but no VBF field available: SHP has no access to yoke material properties. Use setVBFPointer=true and VBFName cards to set a VBF field, otherwise set useMagVolumes==False." << std::endl;
71  } else {
72  edm::LogInfo("SteppingHelixPropagator") << "Config specifies useMagVolumes==true and VBF field available: Forcing useInTeslaFromMagField = True." <<std::endl;
73  useInTeslaFromMagField = true;
74  }
75  }
76 
77  if (setVBFPointer){
78  std::string vbfName = pset_.getParameter<std::string>("VBFName");
79  ESHandle<MagneticField> vbfField;
80  iRecord.getRecord<IdealMagneticFieldRecord>().get(vbfName, vbfField );
81  const VolumeBasedMagneticField* vbfCPtr = dynamic_cast<const VolumeBasedMagneticField*>(&(*vbfField));
82  if (vbfField.isValid()) shProp->setVBFPointer(vbfCPtr);
83  }
84 
85  shProp->setUseInTeslaFromMagField(useInTeslaFromMagField);
86 
87  bool haveX0Corr = pset_.getParameter<bool>("ApplyRadX0Correction");
88  shProp->applyRadX0Correction(haveX0Corr);
89 
90  bool assumeNoMaterial = pset_.getParameter<bool>("AssumeNoMaterial");
91  shProp->setMaterialMode(assumeNoMaterial);
92 
93  bool noErrorPropagation = pset_.getParameter<bool>("NoErrorPropagation");
94  shProp->setNoErrorPropagation(noErrorPropagation);
95 
96  bool debugMode = pset_.getParameter<bool>("debug");
97  shProp->setDebug(debugMode);
98 
99  shProp->setUseMagVolumes(useMagVolumes);
100 
101  bool useMatVolumes = pset_.getParameter<bool>("useMatVolumes");
102  shProp->setUseMatVolumes(useMatVolumes);
103 
104  bool useIsYokeFlag = pset_.getParameter<bool>("useIsYokeFlag");
105  shProp->setUseIsYokeFlag(useIsYokeFlag);
106 
107  bool returnTangentPlane = pset_.getParameter<bool>("returnTangentPlane");
108  shProp->setReturnTangentPlane(returnTangentPlane);
109 
110  bool sendLogWarning = pset_.getParameter<bool>("sendLogWarning");
111  shProp->setSendLogWarning(sendLogWarning);
112 
113  bool useTuningForL2Speed = pset_.getParameter<bool>("useTuningForL2Speed");
114  shProp->setUseTuningForL2Speed(useTuningForL2Speed);
115 
116 
117  bool useECoffsets = pset_.getParameter<bool>("useEndcapShiftsInZ");
118  if (useECoffsets){
119  double valPos = pset_.getParameter<double>("endcapShiftInZPos");
120  double valNeg = pset_.getParameter<double>("endcapShiftInZNeg");
121  shProp->setEndcapShiftsInZPosNeg(valPos, valNeg);
122  }
123 
124  return shProp;
125 }
126 
128 
130 
std::unique_ptr< Propagator > produce(const TrackingComponentsRecord &)
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:58
PropagationDirection
SteppingHelixPropagatorESProducer(const edm::ParameterSet &p)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
HLT enums.
dbl *** dir
Definition: mlp_gen.cc:35