test
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  const std::vector<MagBLayer *>& theBLayers,
7  const std::vector<MagESector *>& theESectors,
8  const std::vector<MagVolume6Faces*>& theBVolumes,
9  const 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:50
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.
MagVolume const * findVolume(const GlobalPoint &gp, double tolerance=0.) const
Find a volume.
Definition: MagGeometry.cc:142
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
VolumeBasedMagneticField(const edm::ParameterSet &config, 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)
GlobalVector fieldInTesla(const GlobalPoint &gp) const
Return field vector at the specified global point.
Definition: MagGeometry.cc:83
volatile std::atomic< bool > shutdown_flag false
Global3DVector GlobalVector
Definition: GlobalVector.h:10