CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SteppingHelixPropagatorESProducer.cc
Go to the documentation of this file.
5 
10 
12 
13 #include <string>
14 #include <memory>
15 
16 using namespace edm;
17 
19 {
20  std::string myname = p.getParameter<std::string>("ComponentName");
21  pset_ = p;
22  setWhatProduced(this,myname);
23 }
24 
26 
27 boost::shared_ptr<Propagator>
29 // if (_propagator){
30 // delete _propagator;
31 // _propagator = 0;
32 // }
34  iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield );
35 
36  std::string pdir = pset_.getParameter<std::string>("PropagationDirection");
37 
39 
40  if (pdir == "oppositeToMomentum") dir = oppositeToMomentum;
41  if (pdir == "alongMomentum") dir = alongMomentum;
42  if (pdir == "anyDirection") dir = anyDirection;
43 
44  SteppingHelixPropagator* shProp = new SteppingHelixPropagator(&(*magfield), dir);
45 
46  bool useInTeslaFromMagField = pset_.getParameter<bool>("useInTeslaFromMagField");
47  bool setVBFPointer = pset_.getParameter<bool>("SetVBFPointer");
48  bool useMagVolumes = pset_.getParameter<bool>("useMagVolumes");
49 
50  // if useMagVolumes == true and an alternate VBF field is not specified with setVBFPointer,
51  // Force "useInTeslaFromMagField=true" for a B=0 VBF map.
52  if (useMagVolumes==true && !useInTeslaFromMagField && !setVBFPointer && magfield->nominalValue() == 0) {
53  const VolumeBasedMagneticField* vbfCPtr = dynamic_cast<const VolumeBasedMagneticField*>(&(*magfield));
54  if (vbfCPtr ==0 ){
55  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;
56  } else {
57  edm::LogInfo("SteppingHelixPropagator") << "Config specifies useMagVolumes==true and VBF field available: Forcing useInTeslaFromMagField = True." <<std::endl;
58  useInTeslaFromMagField = true;
59  }
60  }
61 
62  if (setVBFPointer){
63  std::string vbfName = pset_.getParameter<std::string>("VBFName");
64  ESHandle<MagneticField> vbfField;
65  iRecord.getRecord<IdealMagneticFieldRecord>().get(vbfName, vbfField );
66  const VolumeBasedMagneticField* vbfCPtr = dynamic_cast<const VolumeBasedMagneticField*>(&(*vbfField));
67  if (vbfField.isValid()) shProp->setVBFPointer(vbfCPtr);
68  }
69 
70  shProp->setUseInTeslaFromMagField(useInTeslaFromMagField);
71 
72  bool haveX0Corr = pset_.getParameter<bool>("ApplyRadX0Correction");
73  shProp->applyRadX0Correction(haveX0Corr);
74 
75  bool assumeNoMaterial = pset_.getParameter<bool>("AssumeNoMaterial");
76  shProp->setMaterialMode(assumeNoMaterial);
77 
78  bool noErrorPropagation = pset_.getParameter<bool>("NoErrorPropagation");
79  shProp->setNoErrorPropagation(noErrorPropagation);
80 
81  bool debugMode = pset_.getParameter<bool>("debug");
82  shProp->setDebug(debugMode);
83 
84  shProp->setUseMagVolumes(useMagVolumes);
85 
86  bool useMatVolumes = pset_.getParameter<bool>("useMatVolumes");
87  shProp->setUseMatVolumes(useMatVolumes);
88 
89  bool useIsYokeFlag = pset_.getParameter<bool>("useIsYokeFlag");
90  shProp->setUseIsYokeFlag(useIsYokeFlag);
91 
92  bool returnTangentPlane = pset_.getParameter<bool>("returnTangentPlane");
93  shProp->setReturnTangentPlane(returnTangentPlane);
94 
95  bool sendLogWarning = pset_.getParameter<bool>("sendLogWarning");
96  shProp->setSendLogWarning(sendLogWarning);
97 
98  bool useTuningForL2Speed = pset_.getParameter<bool>("useTuningForL2Speed");
99  shProp->setUseTuningForL2Speed(useTuningForL2Speed);
100 
101 
102  bool useECoffsets = pset_.getParameter<bool>("useEndcapShiftsInZ");
103  if (useECoffsets){
104  double valPos = pset_.getParameter<double>("endcapShiftInZPos");
105  double valNeg = pset_.getParameter<double>("endcapShiftInZNeg");
106  shProp->setEndcapShiftsInZPosNeg(valPos, valNeg);
107  }
108 
109  _propagator = boost::shared_ptr<Propagator>(shProp);
110  return _propagator;
111 }
T getParameter(std::string const &) const
void setDebug(bool debug)
Switch debug printouts (to cout) .. very verbose.
void setVBFPointer(const VolumeBasedMagneticField *val)
tuple magfield
Definition: HLT_ES_cff.py:2311
boost::shared_ptr< Propagator > produce(const TrackingComponentsRecord &)
PropagationDirection
void setUseMagVolumes(bool val)
Switch to using MagneticField Volumes .. as in VolumeBasedMagneticField.
void applyRadX0Correction(bool applyRadX0Correction)
SteppingHelixPropagatorESProducer(const edm::ParameterSet &p)
void setUseMatVolumes(bool val)
Switch to using Material Volumes .. internally defined for now.
void setReturnTangentPlane(bool val)
flag to return tangent plane for non-plane input
void setSendLogWarning(bool val)
flag to send LogWarning on failures
void setUseInTeslaFromMagField(bool val)
force getting field value from MagneticField, not the geometric one
dbl *** dir
Definition: mlp_gen.cc:35
void setEndcapShiftsInZPosNeg(double valPos, double valNeg)
set shifts in Z for endcap pieces (includes EE, HE, ME, YE)
void setMaterialMode(bool noMaterial)
Switch for material effects mode: no material effects if true.
void setNoErrorPropagation(bool noErrorPropagation)
Force no error propagation.