CMS 3D CMS Logo

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 OAEParametrizedMagneticField ParabolicParametrizedMagneticField PolyFit2DParametrizedMagneticField UniformMagneticField VolumeBasedMagneticField defaultRKPropagator::RKMagVolume MagCylinder MagVolume6Faces

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 &) 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 19 of file MagneticField.h.

Member Enumeration Documentation

◆ FooStates

Enumerator
kUnset 
kSetting 
kSet 

Definition at line 62 of file MagneticField.h.

62 { kUnset, kSetting, kSet };

Constructor & Destructor Documentation

◆ MagneticField() [1/2]

MagneticField::MagneticField ( )

Definition at line 8 of file MagneticField.cc.

◆ MagneticField() [2/2]

MagneticField::MagneticField ( const MagneticField orig)

Definition at line 10 of file MagneticField.cc.

11  if (orig.nominalValueCompiuted.load() == kSet) {
14  }
15 }

References kSet, nominalValueCompiuted, and theNominalValue.

◆ ~MagneticField()

MagneticField::~MagneticField ( )
virtual

Definition at line 17 of file MagneticField.cc.

17 {}

Member Function Documentation

◆ clone()

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

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

Reimplemented in VolumeBasedMagneticField.

Definition at line 27 of file MagneticField.h.

27 { return nullptr; }

◆ computeNominalValue()

int MagneticField::computeNominalValue ( ) const
privatevirtual

Definition at line 19 of file MagneticField.cc.

19  {
20  int tmp = int((inTesla(GlobalPoint(0.f, 0.f, 0.f))).z() * 10.f + 0.5f);
21 
22  //Try to cache
23  char expected = kUnset;
24  if (nominalValueCompiuted.compare_exchange_strong(expected, kSetting)) {
25  //it is our job to set the value
27 
28  //this must be after the swap
30  return theNominalValue;
31  }
32  //another thread beat us to trying to set theNominalValue
33  // since we don't know when the other thread will finish
34  // we just return tmp
35  return tmp;
36 }

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

Referenced by nominalValue().

◆ inInverseGeV()

GlobalVector MagneticField::inInverseGeV ( const GlobalPoint gp) const
inline

◆ inKGauss()

GlobalVector MagneticField::inKGauss ( const GlobalPoint gp) const
inline

Field value ad specified global point, in KGauss.

Definition at line 33 of file MagneticField.h.

33 { return inTesla(gp) * 10.F; }

References runTauDisplay::gp, and inTesla().

Referenced by CSCDriftSim::getWireHit().

◆ inTesla()

virtual GlobalVector MagneticField::inTesla ( const GlobalPoint gp) const
pure virtual

Field value ad specified global point, in Tesla.

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

Referenced by cms::SiPixelDigitizer::accumulatePixelHits(), cms::Phase2TrackerDigitizer::accumulatePixelHits(), SiStripDigitizer::accumulateStripHits(), DisplayGeom::analyze(), IsoTrig::analyze(), DMRChecker::analyze(), tmtt::TMTrackProducer::beginRun(), ConvBremSeedProducer::beginRun(), L1FPGATrackProducer::beginRun(), GeneralPurposeTrackAnalyzer::beginRun(), SeedingOTEDProducer::buildInitialTSOS(), TwoTrackMinimumDistanceLineLine::calculate(), ClosestApproachInRPhi::calculate(), TwoTrackMinimumDistance::calculate(), ConvertedPhotonProducer::calculateMinApproachDistance(), trackerDTC::Setup::checkMagneticField(), RPCSeedPattern::checkSimplePattern(), TangentApproachInRPhi::circleParameters(), computeNominalValue(), OutInConversionSeedFinder::createSeedFTS(), StripCPE::driftDirection(), Phase2StripCPE::driftDirection(), egammaTools::ecalPhi(), MFProducer::evaluate(), RPCSeedPattern::extropolateStep(), PixelRecoUtilities::FieldAt0::FieldAt0(), PixelCPEBase::fillDetParams(), ApeEstimator::fillHitVariables(), PhotonConversionTrajectorySeedProducerFromSingleLegAlgo::find(), trackingTools::ftsFromVertexToPoint(), ClusterShapeHitFilter::getDrift(), sim::Field::GetFieldValue(), SteppingHelixPropagator::getNextState(), GlobalTrajectoryParameters::GlobalTrajectoryParameters(), ConversionFastHelix::helixStateAtVertex(), inInverseGeV(), inKGauss(), MagneticFieldMap::inTesla(), inTeslaUnchecked(), MagneticFieldMap::inTeslaZ(), SteppingHelixPropagator::loadState(), GlobalTrajectoryParameters::magneticFieldInInverseGeV(), SteppingHelixPropagator::makeAtomStep(), OutInConversionSeedFinder::makeTrackState(), SimpleCosmicBONSeeder::pqFromHelixFit(), LowPtGsfElectronIDProducer::produce(), SimpleCosmicBONSeeder::produce(), CtfSpecialSeedGenerator::produce(), DTDigitizer::produce(), LowPtGsfElectronSeedProducer::propagateTrackToCalo(), RPCSeedPattern::SegmentAlgorithmSpecial(), GlobalTrajectoryParameters::setCache(), SiPixelGenErrorDBObjectESProducer::SiPixelGenErrorDBObjectESProducer(), SiPixelTemplateDBObjectESProducer::SiPixelTemplateDBObjectESProducer(), SeedForPhotonConversionFromQuadruplets::trajectorySeed(), SimpleCosmicBONSeeder::triplets(), GeometryProducer::updateMagneticField(), and defaultRKPropagator::TrivialFieldProvider::valueInTesla().

◆ inTeslaUnchecked()

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 OAEParametrizedMagneticField, PolyFit2DParametrizedMagneticField, ParabolicParametrizedMagneticField, UniformMagneticField, and VolumeBasedMagneticField.

Definition at line 44 of file MagneticField.h.

44  {
45  return inTesla(gp); // default dummy implementation
46  }

References runTauDisplay::gp, and inTesla().

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

◆ isDefined()

virtual bool MagneticField::isDefined ( const GlobalPoint ) const
inlinevirtual

◆ nominalValue()

int MagneticField::nominalValue ( ) const
inline

Member Data Documentation

◆ nominalValueCompiuted

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

Definition at line 58 of file MagneticField.h.

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

◆ theNominalValue

int MagneticField::theNominalValue
mutableprivate

Definition at line 61 of file MagneticField.h.

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

MagneticField::inTesla
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
MagneticField::computeNominalValue
virtual int computeNominalValue() const
Definition: MagneticField.cc:19
MagneticField::theNominalValue
int theNominalValue
Definition: MagneticField.h:61
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
DDAxes::z
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
createfilelist.int
int
Definition: createfilelist.py:10
MagneticField::nominalValueCompiuted
std::atomic< char > nominalValueCompiuted
Definition: MagneticField.h:58
MagneticField::kUnset
Definition: MagneticField.h:62
MagneticField::kSetting
Definition: MagneticField.h:62
MagneticField::kSet
Definition: MagneticField.h:62