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 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 68 of file MagneticField.h.

Constructor & Destructor Documentation

MagneticField::MagneticField ( )

Definition at line 8 of file MagneticField.cc.

9 {
10 }
std::atomic< char > nominalValueCompiuted
Definition: MagneticField.h:64
MagneticField::MagneticField ( const MagneticField orig)

Definition at line 12 of file MagneticField.cc.

References kSet, nominalValueCompiuted, and theNominalValue.

13 {
14  if(orig.nominalValueCompiuted.load() == kSet) {
17  }
18 }
std::atomic< char > nominalValueCompiuted
Definition: MagneticField.h:64
MagneticField::~MagneticField ( )
virtual

Definition at line 20 of file MagneticField.cc.

20 {}

Member Function Documentation

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

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

Reimplemented in VolumeBasedMagneticField.

Definition at line 26 of file MagneticField.h.

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

Definition at line 22 of file MagneticField.cc.

References f, inTesla(), kSet, kSetting, kUnset, nominalValueCompiuted, std::swap(), theNominalValue, tmp, and detailsBasic3DVector::z.

Referenced by nominalValue().

22  {
23  int tmp = int((inTesla(GlobalPoint(0.f,0.f,0.f))).z() * 10.f + 0.5f);
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
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 }
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
std::atomic< char > nominalValueCompiuted
Definition: MagneticField.h:64
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
double f[11][100]
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc: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

Field value ad specified global point, in Tesla.

Implemented in OAE85lParametrizedMagneticField, VolumeBasedMagneticField, OAEParametrizedMagneticField, PolyFit2DParametrizedMagneticField, ParabolicParametrizedMagneticField, LocalMagneticField, and UniformMagneticField.

Referenced by PhotonConversionTrajectorySeedProducerFromSingleLegAlgo::analyze(), SiStripLAProfileBooker::beginRun(), ConvBremSeedProducer::beginRun(), SiTrackerGaussianSmearingRecHitConverter::beginRun(), ClosestApproachInRPhi::calculate(), TwoTrackMinimumDistanceLineLine::calculate(), TwoTrackMinimumDistance::calculate(), TangentApproachInRPhi::circleParameters(), computeNominalValue(), shallow::drift(), StripCPE::driftDirection(), ECALPositionCalculator::ecalPhi(), PixelCPEBase::fillDetParams(), ZeeCandidateFilter::filter(), HSCPTreeBuilder::filter(), FTSFromVertexToPointFactory::get(), sim::Field::GetFieldValue(), SteppingHelixPropagator::getNextState(), GlobalTrajectoryParameters::GlobalTrajectoryParameters(), ConversionFastHelix::helixStateAtVertex(), inInverseGeV(), inKGauss(), MagneticFieldMap::inTesla(), inTeslaUnchecked(), MagneticFieldMap::inTeslaZ(), SteppingHelixPropagator::loadState(), StripCPEfromTemplate::localParameters(), GlobalTrajectoryParameters::magneticFieldInInverseGeV(), SteppingHelixPropagator::makeAtomStep(), SiStripElectronAlgo::projectPhiBand(), PixelFitterByHelixProjections::run(), SeedFromNuclearInteraction::stateWithError(), MonopoleSteppingAction::update(), and defaultRKPropagator::TrivialFieldProvider::valueInTesla().

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, 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

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

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

Definition at line 45 of file MagneticField.h.

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

45  {
46  return true;
47  }
int MagneticField::nominalValue ( ) const
inline

Member Data Documentation

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

Definition at line 64 of file MagneticField.h.

Referenced by computeNominalValue(), MagneticField(), and nominalValue().

int MagneticField::theNominalValue
mutableprivate

Definition at line 67 of file MagneticField.h.

Referenced by computeNominalValue(), MagneticField(), and nominalValue().