CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VolumeBasedMagneticField.cc
Go to the documentation of this file.
4 
6  std::vector<MagBLayer *> theBLayers,
7  std::vector<MagESector *> theESectors,
8  std::vector<MagVolume6Faces*> theBVolumes,
9  std::vector<MagVolume6Faces*> theEVolumes,
10  float rMax, float zMax,
11  const MagneticField* param,
12  bool isParamFieldOwned) :
13  field(new MagGeometry(config,theBLayers,theESectors,theBVolumes,theEVolumes)),
14  maxR(rMax),
15  maxZ(zMax),
16  paramField(param),
17  magGeomOwned(true),
18  paramFieldOwned(isParamFieldOwned)
19 {}
20 
21 
23  field(vbf.field),
24  maxR(vbf.maxR),
25  maxZ(vbf.maxZ),
26  paramField(vbf.paramField),
27  magGeomOwned(false),
28  paramFieldOwned(false) {
29  // std::cout << "VolumeBasedMagneticField::clone() (shallow copy)" << std::endl;
30 }
31 
32 
34  return new VolumeBasedMagneticField(*this);
35 }
36 
37 
39  if(magGeomOwned) delete field;
40  if(paramFieldOwned) delete paramField;
41 }
42 
44 
45  // If parametrization of the inner region is available, use it.
47 
48  // If point is outside magfield map, return 0 field (not an error)
49  if (!isDefined(gp)) return GlobalVector();
50 
51  return field->fieldInTesla(gp);
52 }
53 
55  //same as above, but do not check range
57  return field->fieldInTesla(gp);
58 }
59 
60 
62 {
63  return field->findVolume(gp);
64 }
65 
66 
68  return (fabs(gp.z()) < maxZ && gp.perp() < maxR);
69 }
70 
71 
73  return field->isZSymmetric();
74 }
GlobalVector inTeslaUnchecked(const GlobalPoint &g) const
bool isZSymmetric() const
Definition: MagGeometry.h:47
virtual GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const
Definition: MagneticField.h:52
T perp() const
Definition: PV3DBase.h:71
virtual bool isDefined(const GlobalPoint &gp) const
True if the point is within the region where the concrete field.
Definition: MagneticField.h:46
const MagVolume * findVolume(const GlobalPoint &gp) const
virtual MagneticField * clone() const
Returns a shallow copy.
bool isDefined(const GlobalPoint &gp) const
True if the point is within the region where the concrete field.
T z() const
Definition: PV3DBase.h:63
GlobalVector inTesla(const GlobalPoint &g) const
Field value ad specified global point, in Tesla.
const MagneticField * paramField
GlobalVector fieldInTesla(const GlobalPoint &gp) const
Return field vector at the specified global point.
Definition: MagGeometry.cc:83
MagVolume * findVolume(const GlobalPoint &gp, double tolerance=0.) const
Find a volume.
Definition: MagGeometry.cc:142
VolumeBasedMagneticField(const edm::ParameterSet &config, std::vector< MagBLayer * > theBLayers, std::vector< MagESector * > theESectors, std::vector< MagVolume6Faces * > theBVolumes, std::vector< MagVolume6Faces * > theEVolumes, float rMax, float zMax, const MagneticField *param=0, bool isParamFieldOwned=false)
Global3DVector GlobalVector
Definition: GlobalVector.h:10