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,
10  float zMax,
11  const MagneticField* param,
12  bool isParamFieldOwned)
13  : field(new MagGeometry(geomVersion, theBLayers, theESectors, theBVolumes, theEVolumes)),
14  maxRsq(rMax * rMax),
15  maxZ(zMax),
16  paramField(param),
17  magGeomOwned(true),
18  paramFieldOwned(isParamFieldOwned) {
20 }
21 
24  field(vbf.field),
25  maxRsq(vbf.maxRsq),
26  maxZ(vbf.maxZ),
27  paramField(vbf.paramField),
28  magGeomOwned(false),
29  paramFieldOwned(false) {
30  // std::cout << "VolumeBasedMagneticField::clone() (shallow copy)" << std::endl;
32 }
33 
35 
37  if (magGeomOwned)
38  delete field;
39  if (paramFieldOwned)
40  delete paramField;
41 }
42 
44  // 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))
50  return GlobalVector();
51 
52  return field->fieldInTesla(gp);
53 }
54 
56  //same as above, but do not check range
59  return field->fieldInTesla(gp);
60 }
61 
63 
65  return (fabs(gp.z()) < maxZ && gp.perp2() < maxRsq);
66 }
GlobalVector fieldInTesla(const GlobalPoint &gp) const
Return field vector at the specified global point.
Definition: MagGeometry.cc:123
virtual bool isDefined(const GlobalPoint &) const
True if the point is within the region where the concrete field.
Definition: MagneticField.h:40
GlobalVector inTesla(const GlobalPoint &g) const override
Field value ad specified global point, in Tesla.
GlobalVector inTeslaUnchecked(const GlobalPoint &g) const override
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=nullptr, bool isParamFieldOwned=false)
virtual GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const
Definition: MagneticField.h:44
MagneticField * clone() const override
Returns a shallow copy.
MagVolume const * findVolume(const GlobalPoint &gp, double tolerance=0.) const
Find a volume.
Definition: MagGeometry.cc:184
bool isDefined(const GlobalPoint &gp) const override
True if the point is within the region where the concrete field.
const MagneticField * paramField
void setNominalValue()
Global3DVector GlobalVector
Definition: GlobalVector.h:10