CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes | Friends
VolumeBasedMagneticField Class Referencefinal

#include <VolumeBasedMagneticField.h>

Inheritance diagram for VolumeBasedMagneticField:
MagneticField

Public Member Functions

MagneticFieldclone () const override
 Returns a shallow copy. More...
 
const MagVolumefindVolume (const GlobalPoint &gp) const
 
GlobalVector inTesla (const GlobalPoint &g) const override
 Field value ad specified global point, in Tesla. More...
 
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. More...
 
 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)
 
 VolumeBasedMagneticField (const VolumeBasedMagneticField &vbf)
 Copy constructor implement a shallow copy (ie no ownership of actual engines) More...
 
 ~VolumeBasedMagneticField () override
 
- Public Member Functions inherited from MagneticField
GlobalVector inInverseGeV (const GlobalPoint &gp) const
 Field value ad specified global point, in 1/Gev. More...
 
GlobalVector inKGauss (const GlobalPoint &gp) const
 Field value ad specified global point, in KGauss. More...
 
float inverseBzAtOriginInGeV () const
 The inverse of field z component for this map in GeV. More...
 
 MagneticField ()
 
 MagneticField (const MagneticField &orig)
 
int nominalValue () const
 The nominal field value for this map in kGauss. More...
 
virtual ~MagneticField ()
 

Private Attributes

const MagGeometryfield
 
bool magGeomOwned
 
float maxRsq
 
float maxZ
 
const MagneticFieldparamField
 
bool paramFieldOwned
 

Friends

class testMagGeometryAnalyzer
 
class testMagneticField
 

Additional Inherited Members

- Protected Member Functions inherited from MagneticField
void setNominalValue ()
 

Detailed Description

Field engine providing interpolation within the full CMS region.

Author
N. Amapane - CERN

Definition at line 18 of file VolumeBasedMagneticField.h.

Constructor & Destructor Documentation

VolumeBasedMagneticField::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 
)

Definition at line 4 of file VolumeBasedMagneticField.cc.

References MagneticField::setNominalValue().

Referenced by clone().

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 }
const MagneticField * paramField
void setNominalValue()
VolumeBasedMagneticField::~VolumeBasedMagneticField ( )
override

Definition at line 36 of file VolumeBasedMagneticField.cc.

References field, magGeomOwned, paramField, and paramFieldOwned.

36  {
37  if (magGeomOwned)
38  delete field;
39  if (paramFieldOwned)
40  delete paramField;
41 }
const MagneticField * paramField
VolumeBasedMagneticField::VolumeBasedMagneticField ( const VolumeBasedMagneticField vbf)

Copy constructor implement a shallow copy (ie no ownership of actual engines)

Definition at line 22 of file VolumeBasedMagneticField.cc.

References MagneticField::setNominalValue().

24  field(vbf.field),
25  maxRsq(vbf.maxRsq),
26  maxZ(vbf.maxZ),
28  magGeomOwned(false),
29  paramFieldOwned(false) {
30  // std::cout << "VolumeBasedMagneticField::clone() (shallow copy)" << std::endl;
32 }
const MagneticField * paramField
void setNominalValue()

Member Function Documentation

MagneticField * VolumeBasedMagneticField::clone ( void  ) const
overridevirtual

Returns a shallow copy.

Reimplemented from MagneticField.

Definition at line 34 of file VolumeBasedMagneticField.cc.

References VolumeBasedMagneticField().

34 { return new VolumeBasedMagneticField(*this); }
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)
const MagVolume * VolumeBasedMagneticField::findVolume ( const GlobalPoint gp) const

Definition at line 62 of file VolumeBasedMagneticField.cc.

References field, and MagGeometry::findVolume().

Referenced by SteppingHelixPropagator::getNextState(), and SteppingHelixPropagator::loadState().

62 { return field->findVolume(gp); }
MagVolume const * findVolume(const GlobalPoint &gp, double tolerance=0.) const
Find a volume.
Definition: MagGeometry.cc:184
GlobalVector VolumeBasedMagneticField::inTesla ( const GlobalPoint gp) const
overridevirtual

Field value ad specified global point, in Tesla.

Implements MagneticField.

Definition at line 43 of file VolumeBasedMagneticField.cc.

References field, MagGeometry::fieldInTesla(), MagneticField::inTeslaUnchecked(), MagneticField::isDefined(), isDefined(), and paramField.

Referenced by IsolatedPixelTrackCandidateProducer::beginRun(), and IsolatedPixelTrackCandidateL1TProducer::beginRun().

43  {
44  // If parametrization of the inner region is available, use it.
45  if (paramField && paramField->isDefined(gp))
46  return paramField->inTeslaUnchecked(gp);
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 }
virtual GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const
Definition: MagneticField.h:44
virtual bool isDefined(const GlobalPoint &) const
True if the point is within the region where the concrete field.
Definition: MagneticField.h:40
bool isDefined(const GlobalPoint &gp) const override
True if the point is within the region where the concrete field.
const MagneticField * paramField
GlobalVector fieldInTesla(const GlobalPoint &gp) const
Return field vector at the specified global point.
Definition: MagGeometry.cc:123
Global3DVector GlobalVector
Definition: GlobalVector.h:10
GlobalVector VolumeBasedMagneticField::inTeslaUnchecked ( const GlobalPoint gp) const
overridevirtual

Optional implementation that derived classes can implement to provide faster query by skipping the check to isDefined.

Reimplemented from MagneticField.

Definition at line 55 of file VolumeBasedMagneticField.cc.

References field, MagGeometry::fieldInTesla(), MagneticField::inTeslaUnchecked(), MagneticField::isDefined(), and paramField.

55  {
56  //same as above, but do not check range
57  if (paramField && paramField->isDefined(gp))
58  return paramField->inTeslaUnchecked(gp);
59  return field->fieldInTesla(gp);
60 }
virtual GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const
Definition: MagneticField.h:44
virtual bool isDefined(const GlobalPoint &) const
True if the point is within the region where the concrete field.
Definition: MagneticField.h:40
const MagneticField * paramField
GlobalVector fieldInTesla(const GlobalPoint &gp) const
Return field vector at the specified global point.
Definition: MagGeometry.cc:123
bool VolumeBasedMagneticField::isDefined ( const GlobalPoint ) const
overridevirtual

True if the point is within the region where the concrete field.

Reimplemented from MagneticField.

Definition at line 64 of file VolumeBasedMagneticField.cc.

References maxRsq, maxZ, PV3DBase< T, PVType, FrameType >::perp2(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by inTesla().

64  {
65  return (fabs(gp.z()) < maxZ && gp.perp2() < maxRsq);
66 }

Friends And Related Function Documentation

friend class testMagGeometryAnalyzer
friend

Definition at line 21 of file VolumeBasedMagneticField.h.

friend class testMagneticField
friend

Definition at line 20 of file VolumeBasedMagneticField.h.

Member Data Documentation

const MagGeometry* VolumeBasedMagneticField::field
private
bool VolumeBasedMagneticField::magGeomOwned
private

Definition at line 55 of file VolumeBasedMagneticField.h.

Referenced by ~VolumeBasedMagneticField().

float VolumeBasedMagneticField::maxRsq
private

Definition at line 52 of file VolumeBasedMagneticField.h.

Referenced by isDefined().

float VolumeBasedMagneticField::maxZ
private

Definition at line 53 of file VolumeBasedMagneticField.h.

Referenced by isDefined().

const MagneticField* VolumeBasedMagneticField::paramField
private

Definition at line 54 of file VolumeBasedMagneticField.h.

Referenced by inTesla(), inTeslaUnchecked(), and ~VolumeBasedMagneticField().

bool VolumeBasedMagneticField::paramFieldOwned
private

Definition at line 56 of file VolumeBasedMagneticField.h.

Referenced by ~VolumeBasedMagneticField().