Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:44

0001 #include "RKLocalFieldProvider.h"
0002 #include "MagneticField/Engine/interface/MagneticField.h"
0003 #include "MagneticField/VolumeGeometry/interface/MagVolume.h"
0004 #include "FWCore/Utilities/interface/Likely.h"
0005 
0006 RKLocalFieldProvider::RKLocalFieldProvider(const MagVolume& vol) : theVolume(vol), theFrame(vol), transform_(false) {}
0007 
0008 RKLocalFieldProvider::RKLocalFieldProvider(const MagVolume& vol, const Frame& frame)
0009     : theVolume(vol), theFrame(frame), transform_(true) {}
0010 
0011 RKLocalFieldProvider::Vector RKLocalFieldProvider::inTesla(const LocalPoint& lp) const {
0012   if UNLIKELY (transform_) {
0013     LocalPoint vlp(theVolume.toLocal(theFrame.toGlobal(lp)));
0014     return theFrame.toLocal(theVolume.toGlobal(theVolume.fieldInTesla(vlp))).basicVector();
0015   }
0016   return theVolume.fieldInTesla(lp).basicVector();
0017 }