CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
MagneticField Class Referenceabstract

#include <MagneticField.h>

Inheritance diagram for MagneticField:
LocalMagneticField MagVolume OAE85lParametrizedMagneticField OAEParametrizedMagneticField ParabolicParametrizedMagneticField PolyFit2DParametrizedMagneticField PolyFit3DParametrizedMagneticField UniformMagneticField VolumeBasedMagneticField

Public Member Functions

virtual MagneticFieldclone () const
 
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...
 
virtual GlobalVector inTesla (const GlobalPoint &gp) const =0
 Field value ad specified global point, in Tesla. More...
 
virtual GlobalVector inTeslaUnchecked (const GlobalPoint &gp) const
 
virtual bool isDefined (const GlobalPoint &gp) const
 True if the point is within the region where the concrete field. More...
 
 MagneticField ()
 
 MagneticField (const MagneticField &orig)
 
int nominalValue () const
 The nominal field value for this map in kGauss. More...
 
virtual ~MagneticField ()
 

Private Types

enum  FooStates { kUnset, kSetting, kSet }
 

Private Member Functions

virtual int computeNominalValue () const
 

Private Attributes

std::atomic< char > nominalValueCompiuted
 
int theNominalValue
 

Detailed Description

Base class for the different implementation of magnetic field engines.

Author
N. Amapane - CERN

Definition at line 17 of file MagneticField.h.

Member Enumeration Documentation

Enumerator
kUnset 
kSetting 
kSet 

Definition at line 63 of file MagneticField.h.

Constructor & Destructor Documentation

MagneticField::MagneticField ( )

Definition at line 8 of file MagneticField.cc.

References kUnset, and nominalValueCompiuted.

8 { nominalValueCompiuted.store(kUnset, std::memory_order_release); }
std::atomic< char > nominalValueCompiuted
Definition: MagneticField.h:61
MagneticField::MagneticField ( const MagneticField orig)

Definition at line 10 of file MagneticField.cc.

References nominalValueCompiuted.

11 { nominalValueCompiuted.store(orig.nominalValueCompiuted.load(std::memory_order_acquire), std::memory_order_release); }
std::atomic< char > nominalValueCompiuted
Definition: MagneticField.h:61
MagneticField::~MagneticField ( )
virtual

Definition at line 13 of file MagneticField.cc.

13 {}

Member Function Documentation

virtual MagneticField* MagneticField::clone ( void  ) const
inlinevirtual

Derived classes can implement cloning without ownership of the underlying engines.

Reimplemented in GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, VolumeBasedMagneticField, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, GCC11_FINAL< T, TOPO >, and GCC11_FINAL< T, TOPO >.

Definition at line 26 of file MagneticField.h.

26  {
27  return 0;
28  }
int MagneticField::computeNominalValue ( ) const
privatevirtual

Definition at line 15 of file MagneticField.cc.

References f, inTesla(), and detailsBasic3DVector::z.

Referenced by nominalValue().

15  {
16  return int((inTesla(GlobalPoint(0.f,0.f,0.f))).z() * 10.f + 0.5f);
17 }
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
float float float z
double f[11][100]
GlobalVector MagneticField::inInverseGeV ( const GlobalPoint gp) const
inline
GlobalVector MagneticField::inKGauss ( const GlobalPoint gp) const
inline

Field value ad specified global point, in KGauss.

Definition at line 34 of file MagneticField.h.

References inTesla().

Referenced by CSCDriftSim::getWireHit().

34  {
35  return inTesla(gp) * 10.F;
36  }
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
virtual GlobalVector MagneticField::inTesla ( const GlobalPoint gp) const
pure virtual
virtual GlobalVector MagneticField::inTeslaUnchecked ( const GlobalPoint gp) const
inlinevirtual

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

Reimplemented in OAE85lParametrizedMagneticField, VolumeBasedMagneticField, OAEParametrizedMagneticField, PolyFit2DParametrizedMagneticField, PolyFit3DParametrizedMagneticField, ParabolicParametrizedMagneticField, and UniformMagneticField.

Definition at line 51 of file MagneticField.h.

References inTesla().

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

51  {
52  return inTesla(gp); // default dummy implementation
53  }
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
virtual bool MagneticField::isDefined ( const GlobalPoint gp) const
inlinevirtual
int MagneticField::nominalValue ( ) const

The nominal field value for this map in kGauss.

Definition at line 19 of file MagneticField.cc.

References computeNominalValue(), kSet, kSetting, kUnset, nominalValueCompiuted, std::swap(), theNominalValue, and tmp.

Referenced by TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), MultiHitGeneratorFromChi2::hitSets(), FreeTrajectoryState::rescaleError(), BasicTrajectoryState::rescaleError(), and SeedFromGenericPairOrTriplet::seedFromTriplet().

19  {
20  if(kSet==nominalValueCompiuted.load(std::memory_order_acquire)) return theNominalValue;
21 
22  //need to make one
23  int tmp = computeNominalValue();
24 
25  //Try to cache
26  char expected = kUnset;
27  if(nominalValueCompiuted.compare_exchange_strong(expected, kSetting) ) {
28  //it is our job to set the value
30 
31  //this must be after the swap
32  nominalValueCompiuted.store(kSet, std::memory_order_release);
33  return theNominalValue;
34  }
35  //another thread beat us to trying to set theNominalValue
36  // since we don't know when the other thread will finish
37  // we just return tmp
38  return tmp;
39 }
std::atomic< char > nominalValueCompiuted
Definition: MagneticField.h:61
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
virtual int computeNominalValue() const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100

Member Data Documentation

std::atomic<char> MagneticField::nominalValueCompiuted
mutableprivate

Definition at line 61 of file MagneticField.h.

Referenced by MagneticField(), and nominalValue().

int MagneticField::theNominalValue
mutableprivate

Definition at line 62 of file MagneticField.h.

Referenced by nominalValue().