CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Friends
VolumeBasedMagneticField Class Reference

#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 (const VolumeBasedMagneticField &vbf)
 Copy constructor implement a shallow copy (ie no ownership of actual engines) 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 () 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...
 
 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
 

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() [1/2]

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.

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) {}

Referenced by clone().

◆ ~VolumeBasedMagneticField()

VolumeBasedMagneticField::~VolumeBasedMagneticField ( )
override

Definition at line 33 of file VolumeBasedMagneticField.cc.

33  {
34  if (magGeomOwned)
35  delete field;
36  if (paramFieldOwned)
37  delete paramField;
38 }

References field, magGeomOwned, paramField, and paramFieldOwned.

◆ VolumeBasedMagneticField() [2/2]

VolumeBasedMagneticField::VolumeBasedMagneticField ( const VolumeBasedMagneticField vbf)

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

Definition at line 20 of file VolumeBasedMagneticField.cc.

22  field(vbf.field),
23  maxRsq(vbf.maxRsq),
24  maxZ(vbf.maxZ),
26  magGeomOwned(false),
27  paramFieldOwned(false) {
28  // std::cout << "VolumeBasedMagneticField::clone() (shallow copy)" << std::endl;
29 }

Member Function Documentation

◆ clone()

MagneticField * VolumeBasedMagneticField::clone ( void  ) const
overridevirtual

Returns a shallow copy.

Reimplemented from MagneticField.

Definition at line 31 of file VolumeBasedMagneticField.cc.

31 { return new VolumeBasedMagneticField(*this); }

References VolumeBasedMagneticField().

◆ findVolume()

const MagVolume * VolumeBasedMagneticField::findVolume ( const GlobalPoint gp) const

◆ inTesla()

GlobalVector VolumeBasedMagneticField::inTesla ( const GlobalPoint gp) const
overridevirtual

Field value ad specified global point, in Tesla.

Implements MagneticField.

Definition at line 40 of file VolumeBasedMagneticField.cc.

40  {
41  // If parametrization of the inner region is available, use it.
44 
45  // If point is outside magfield map, return 0 field (not an error)
46  if (!isDefined(gp))
47  return GlobalVector();
48 
49  return field->fieldInTesla(gp);
50 }

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

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

◆ inTeslaUnchecked()

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 52 of file VolumeBasedMagneticField.cc.

52  {
53  //same as above, but do not check range
56  return field->fieldInTesla(gp);
57 }

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

◆ isDefined()

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 61 of file VolumeBasedMagneticField.cc.

61  {
62  return (fabs(gp.z()) < maxZ && gp.perp2() < maxRsq);
63 }

References runTauDisplay::gp, maxRsq, and maxZ.

Referenced by inTesla().

Friends And Related Function Documentation

◆ testMagGeometryAnalyzer

friend class testMagGeometryAnalyzer
friend

Definition at line 21 of file VolumeBasedMagneticField.h.

◆ testMagneticField

friend class testMagneticField
friend

Definition at line 20 of file VolumeBasedMagneticField.h.

Member Data Documentation

◆ field

const MagGeometry* VolumeBasedMagneticField::field
private

◆ magGeomOwned

bool VolumeBasedMagneticField::magGeomOwned
private

Definition at line 55 of file VolumeBasedMagneticField.h.

Referenced by ~VolumeBasedMagneticField().

◆ maxRsq

float VolumeBasedMagneticField::maxRsq
private

Definition at line 52 of file VolumeBasedMagneticField.h.

Referenced by isDefined().

◆ maxZ

float VolumeBasedMagneticField::maxZ
private

Definition at line 53 of file VolumeBasedMagneticField.h.

Referenced by isDefined().

◆ paramField

const MagneticField* VolumeBasedMagneticField::paramField
private

Definition at line 54 of file VolumeBasedMagneticField.h.

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

◆ paramFieldOwned

bool VolumeBasedMagneticField::paramFieldOwned
private

Definition at line 56 of file VolumeBasedMagneticField.h.

Referenced by ~VolumeBasedMagneticField().

photonAnalyzer_cfi.rMax
rMax
Definition: photonAnalyzer_cfi.py:91
photonAnalyzer_cfi.zMax
zMax
Definition: photonAnalyzer_cfi.py:95
VolumeBasedMagneticField::maxRsq
float maxRsq
Definition: VolumeBasedMagneticField.h:52
MagneticField::isDefined
virtual bool isDefined(const GlobalPoint &) const
True if the point is within the region where the concrete field.
Definition: MagneticField.h:40
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
VolumeBasedMagneticField::maxZ
float maxZ
Definition: VolumeBasedMagneticField.h:53
VolumeBasedMagneticField::paramField
const MagneticField * paramField
Definition: VolumeBasedMagneticField.h:54
VolumeBasedMagneticField::isDefined
bool isDefined(const GlobalPoint &gp) const override
True if the point is within the region where the concrete field.
Definition: VolumeBasedMagneticField.cc:61
MagneticField::MagneticField
MagneticField()
Definition: MagneticField.cc:8
MagGeometry
Definition: MagGeometry.h:23
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
VolumeBasedMagneticField::field
const MagGeometry * field
Definition: VolumeBasedMagneticField.h:51
VolumeBasedMagneticField::magGeomOwned
bool magGeomOwned
Definition: VolumeBasedMagneticField.h:55
VolumeBasedMagneticField::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: VolumeBasedMagneticField.cc:4
VolumeBasedMagneticField::paramFieldOwned
bool paramFieldOwned
Definition: VolumeBasedMagneticField.h:56
MagGeometry::findVolume
MagVolume const * findVolume(const GlobalPoint &gp, double tolerance=0.) const
Find a volume.
Definition: MagGeometry.cc:184
MagGeometry::fieldInTesla
GlobalVector fieldInTesla(const GlobalPoint &gp) const
Return field vector at the specified global point.
Definition: MagGeometry.cc:123
MagneticField::inTeslaUnchecked
virtual GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const
Definition: MagneticField.h:44