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.
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),
25  paramField(vbf.paramField),
26  magGeomOwned(false),
27  paramFieldOwned(false) {
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 }
GlobalVector inTeslaUnchecked(const GlobalPoint &g) const
bool isZSymmetric() const
Definition: MagGeometry.h:49
virtual GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const
Definition: MagneticField.h:51
T perp() const
Definition: PV3DBase.h:72
virtual bool isDefined(const GlobalPoint &gp) const
True if the point is within the region where the concrete field.
Definition: MagneticField.h:45
const MagVolume * findVolume(const GlobalPoint &gp) const
virtual MagneticField * clone() const
Returns a shallow copy.
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
bool isDefined(const GlobalPoint &gp) const
True if the point is within the region where the concrete field.
T z() const
Definition: PV3DBase.h:64
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:78
volatile std::atomic< bool > shutdown_flag false
Global3DVector GlobalVector
Definition: GlobalVector.h:10