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

Enumerator
kUnset 
kSetting 
kSet 

Definition at line 70 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:66
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:66
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 28 of file MagneticField.h.

References runTauDisplay::gp, and inTesla().

Referenced by magneticfield::AutoMagneticFieldESProducer::produce().

28  {
29  return nullptr;
30  }
int MagneticField::computeNominalValue ( ) const
privatevirtual

Definition at line 22 of file MagneticField.cc.

References f, createfilelist::int, inTesla(), kSet, kSetting, kUnset, nominalValueCompiuted, std::swap(), theNominalValue, tmp, and 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 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::atomic< char > nominalValueCompiuted
Definition: MagneticField.h:66
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
double f[11][100]
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
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 36 of file MagneticField.h.

References inTesla().

Referenced by CSCDriftSim::getWireHit().

36  {
37  return inTesla(gp) * 10.F;
38  }
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 VolumeBasedMagneticField, OAEParametrizedMagneticField, PolyFit2DParametrizedMagneticField, ParabolicParametrizedMagneticField, UniformMagneticField, and LocalMagneticField.

Referenced by cms::SiPixelDigitizer::accumulatePixelHits(), cms::Phase2TrackerDigitizer::accumulatePixelHits(), SiStripDigitizer::accumulateStripHits(), SiStripCalibLorentzAngle::algoBeginJob(), TkAlCaRecoMonitor::analyze(), DisplayGeom::analyze(), IsoTrig::analyze(), TrackerDpgAnalysis::analyze(), AntiElectronIDMVA6::beginEvent(), reco::tau::PFRecoTauChargedHadronFromPFCandidatePlugin::beginEvent(), reco::tau::PFRecoTauChargedHadronFromGenericTrackPlugin< TrackClass >::beginEvent(), PFDisplacedTrackerVertexProducer::beginRun(), PFNuclearProducer::beginRun(), LightPFTrackProducer::beginRun(), PFConversionProducer::beginRun(), PFV0Producer::beginRun(), PFTrackProducer::beginRun(), SiStripLAProfileBooker::beginRun(), ConvBremSeedProducer::beginRun(), PFElecTkProducer::beginRun(), GoodSeedProducer::beginRun(), TwoTrackMinimumDistanceLineLine::calculate(), ClosestApproachInRPhi::calculate(), TwoTrackMinimumDistance::calculate(), ConvertedPhotonProducer::calculateMinApproachDistance(), RPCSeedPattern::checkSimplePattern(), TangentApproachInRPhi::circleParameters(), clone(), computeNominalValue(), GsfElectronAlgo::createElectron(), OutInConversionSeedFinder::createSeedFTS(), fastsim::SimplifiedGeometryFactory::createSimplifiedGeometry(), SiStripLorentzAngleCalibration::derivatives(), SiPixelLorentzAngleCalibration::derivatives(), SiStripBackplaneCalibration::derivatives(), shallow::drift(), StripCPE::driftDirection(), Phase2StripCPE::driftDirection(), egammaTools::ecalPhi(), MFProducer::evaluate(), TrackTimeValueMapProducer::extractTrackVertexTime(), RPCSeedPattern::extropolateStep(), PixelRecoUtilities::FieldAt0::FieldAt0(), PixelCPEBase::fillDetParams(), ZeeCandidateFilter::filter(), HSCPTreeBuilder::filter(), PhotonConversionTrajectorySeedProducerFromSingleLegAlgo::find(), FTSFromVertexToPointFactory::get(), sim::Field::GetFieldValue(), fastsim::Geometry::getMagneticFieldZ(), SteppingHelixPropagator::getNextState(), GlobalTrajectoryParameters::GlobalTrajectoryParameters(), ConversionFastHelix::helixStateAtVertex(), inInverseGeV(), inKGauss(), MagneticFieldMap::inTesla(), inTeslaUnchecked(), MagneticFieldMap::inTeslaZ(), SteppingHelixPropagator::loadState(), GlobalTrajectoryParameters::magneticFieldInInverseGeV(), SteppingHelixPropagator::makeAtomStep(), OutInConversionSeedFinder::makeTrackState(), PixelCPEClusterRepair::PixelCPEClusterRepair(), SimpleCosmicBONSeeder::pqFromHelixFit(), ShallowTrackClustersProducer::produce(), SiPixelGenErrorDBObjectESProducer::produce(), SiPixel2DTemplateDBObjectESProducer::produce(), SiPixelTemplateDBObjectESProducer::produce(), cms::MuonMETValueMapProducer::produce(), SimpleCosmicBONSeeder::produce(), DTDigitizer::produce(), CtfSpecialSeedGenerator::produce(), SiStripElectronAlgo::projectPhiBand(), LowPtGsfElectronSeedProducer::propagateTrackToCalo(), RPCSeedPattern::SegmentAlgorithmSpecial(), GlobalTrajectoryParameters::setCache(), DTParametrizedDriftAlgo::setES(), SeedFromNuclearInteraction::stateWithError(), DualTrajectoryFactory::trajectories(), ReferenceTrajectoryFactory::trajectories(), SeedForPhotonConversionFromQuadruplets::trajectorySeed(), SimpleCosmicBONSeeder::triplets(), MonopoleSteppingAction::update(), GeometryProducer::updateMagneticField(), 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 VolumeBasedMagneticField, OAEParametrizedMagneticField, PolyFit2DParametrizedMagneticField, ParabolicParametrizedMagneticField, and UniformMagneticField.

Definition at line 53 of file MagneticField.h.

References inTesla().

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

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

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

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

Definition at line 47 of file MagneticField.h.

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

47  {
48  return true;
49  }
int MagneticField::nominalValue ( ) const
inline

The nominal field value for this map in kGauss.

Definition at line 58 of file MagneticField.h.

References computeNominalValue(), kSet, nominalValueCompiuted, and theNominalValue.

Referenced by SiStripElectronSeedGenerator::altCheckHitsAndTSOS(), TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), SiStripElectronSeedGenerator::checkHitsAndTSOS(), SingleTrackVertexConstraint::constrain(), ReferenceTrajectory::construct(), SiStripElectronSeedGenerator::findSeedsFromCluster(), SeedFromConsecutiveHitsCreator::init(), MultiHitGeneratorFromChi2::initES(), SeedForPhotonConversion1Leg::initialKinematic(), SeedForPhotonConversionFromQuadruplets::initialKinematic(), SimpleCosmicBONSeeder::pqFromHelixFit(), ElectronSeedGenerator::prepareElTrackSeed(), SteppingHelixPropagatorESProducer::produce(), Onia2MuMuPAT::produce(), ConvBremSeedProducer::produce(), FreeTrajectoryState::rescaleError(), BasicTrajectoryState::rescaleError(), SeedFromGenericPairOrTriplet::seedFromTriplet(), SeedGeneratorForCosmics::seeds(), DTLinearDriftFromDBAlgo::setES(), and SeedForPhotonConversionFromQuadruplets::trajectorySeed().

58  {
59  if(kSet==nominalValueCompiuted.load()) return theNominalValue;
60  return computeNominalValue();
61  }
std::atomic< char > nominalValueCompiuted
Definition: MagneticField.h:66
virtual int computeNominalValue() const

Member Data Documentation

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

Definition at line 66 of file MagneticField.h.

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

int MagneticField::theNominalValue
mutableprivate

Definition at line 69 of file MagneticField.h.

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