CMS 3D CMS Logo

VolumeBasedMagneticField.cc
Go to the documentation of this file.
3 
5  const std::vector<MagBLayer *>& theBLayers,
6  const std::vector<MagESector *>& theESectors,
7  const std::vector<MagVolume6Faces*>& theBVolumes,
8  const std::vector<MagVolume6Faces*>& theEVolumes,
9  float rMax, float zMax,
10  const MagneticField* param,
11  bool isParamFieldOwned) :
12  field(new MagGeometry(geomVersion,theBLayers,theESectors,theBVolumes,theEVolumes)),
13  maxR(rMax),
14  maxZ(zMax),
15  paramField(param),
16  magGeomOwned(true),
17  paramFieldOwned(isParamFieldOwned)
18 {}
19 
20 
22  field(vbf.field),
23  maxR(vbf.maxR),
24  maxZ(vbf.maxZ),
28  // std::cout << "VolumeBasedMagneticField::clone() (shallow copy)" << std::endl;
29 }
30 
31 
33  return new VolumeBasedMagneticField(*this);
34 }
35 
36 
38  if(magGeomOwned) delete field;
39  if(paramFieldOwned) delete paramField;
40 }
41 
43 
44  // If parametrization of the inner region is available, use it.
46 
47  // If point is outside magfield map, return 0 field (not an error)
48  if (!isDefined(gp)) return GlobalVector();
49 
50  return field->fieldInTesla(gp);
51 }
52 
54  //same as above, but do not check range
56  return field->fieldInTesla(gp);
57 }
58 
59 
61 {
62  return field->findVolume(gp);
63 }
64 
65 
67  return (fabs(gp.z()) < maxZ && gp.perp() < maxR);
68 }
69 
70 
72  return field->isZSymmetric();
73 }
bool isZSymmetric() const
Definition: MagGeometry.h:49
virtual GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const
Definition: MagneticField.h:53
T perp() const
Definition: PV3DBase.h:72
GlobalVector inTesla(const GlobalPoint &g) const override
Field value ad specified global point, in Tesla.
const MagVolume * findVolume(const GlobalPoint &gp) const
VolumeBasedMagneticField(int geomVersion, const std::vector< MagBLayer * > &theBLayers, const std::vector< MagESector * > &theESectors, const std::vector< MagVolume6Faces * > &theBVolumes, const std::vector< MagVolume6Faces * > &theEVolumes, float rMax, float zMax, const MagneticField *param=0, bool isParamFieldOwned=false)
MagVolume const * findVolume(const GlobalPoint &gp, double tolerance=0.) const
Find a volume.
Definition: MagGeometry.cc:137
T z() const
Definition: PV3DBase.h:64
virtual bool isDefined(const GlobalPoint &) const
True if the point is within the region where the concrete field.
Definition: MagneticField.h:47
GlobalVector inTeslaUnchecked(const GlobalPoint &g) const override
bool isDefined(const GlobalPoint &gp) const override
True if the point is within the region where the concrete field.
const MagneticField * paramField
MagneticField * clone() const override
Returns a shallow copy.
GlobalVector fieldInTesla(const GlobalPoint &gp) const
Return field vector at the specified global point.
Definition: MagGeometry.cc:78
Global3DVector GlobalVector
Definition: GlobalVector.h:10