BfldHandler Class Reference

#include <BfldHandler.h>

Inheritance diagram for BfldHandler:
BfldHandlerRect2d BfldHandlerVoronoi

List of all members.

Public Member Functions

 BfldHandler ()
virtual ~BfldHandler ()
TVector3 GetBField (const TVector3 &position, Bool_t isUVZ)
virtual TVector3 GetBFieldMeshCoord (const TVector3 &position)=0
BfldMapGetMap () const
void SetCache (BfldCache *cache)
void SetLastPolygAsSeed ()
virtual void SetInterpMethod (const BfldInterpMethod::InterpMethod_t method)
virtual void SetMap (BfldMap *map)
virtual void SetMesh (BfldMesh *mesh)

Protected Attributes

BfldInterpMethod::InterpMethod_t fInterpMethod
Bool_t fUseLastAsSeed
BfldCachefCache
BfldMapfMap
BfldMeshfMesh

Detailed Description

Definition at line 24 of file BfldHandler.h.


Constructor & Destructor Documentation

BfldHandler::BfldHandler (  ) 

Definition at line 26 of file BfldHandler.cxx.

00027    : fInterpMethod(BfldInterpMethod::kDefault), fUseLastAsSeed(kTRUE),
00028      fCache(0), fMap(0), fMesh(0)
00029 {
00030    // base handler ctor
00031    // clear basic components
00032 }

BfldHandler::~BfldHandler (  )  [virtual]

Definition at line 35 of file BfldHandler.cxx.

References BfldRefCnt::DecrementRef(), fMap, and fMesh.

00036 {
00037    // tell the held map and mesh that this handler no longer 
00038    // has need of them
00039    if (fMap)  fMap->DecrementRef();
00040    if (fMesh) fMesh->DecrementRef();
00041 }


Member Function Documentation

TVector3 BfldHandler::GetBField ( const TVector3 &  position,
Bool_t  isUVZ 
)

Definition at line 44 of file BfldHandler.cxx.

References fMesh, GetBFieldMeshCoord(), BfldMesh::GetIsUVZ(), kInvSqrt2, Msg::kVerbose, and MAXMSG.

Referenced by BfldCanvas::Fill(), and BField::GetBField().

00045 {
00046    // Return the field for the requested position.
00047    // Translate (if necessary) the position before passing it
00048    // to the workhorse routine, translate back if necessary.
00049 
00050    //MAXMSG("Bfld",Msg::kVerbose,5)
00051    //  << "GetBField pos=(" << position.x() << "," << position.y() << ")" << endl;
00052    if ( isUVZ == fMesh->GetIsUVZ() ) return GetBFieldMeshCoord(position);
00053 
00054    // mismatch ... do some work
00055    // we don't need to know the detector since only both NearDet & FarDet
00056    // use the same rotation .
00057    // (only CalDet doesn't and it has UVZ=XYZ, but it never has a field)
00058 
00059    MAXMSG("Bfld",Msg::kVerbose,5)
00060      << "BfldHandler::GetBField passed isUVZ= "
00061      << (isUVZ?"yes":"no")
00062      << " which didn't match Mesh."
00063      << endl;
00064 
00065    static const double kInvSqrt2 = TMath::Sqrt(0.5);
00066    if ( isUVZ ) {
00067      // position is UVZ, so mesh must be XYZ, but return B_uvz
00068      Double_t  u = position[0];
00069      Double_t  v = position[1];
00070      Double_t  z = position[2];
00071      TVector3  xyz(kInvSqrt2*(u-v),kInvSqrt2*(u+v),z);
00072      TVector3 bxyz = GetBFieldMeshCoord(xyz);
00073      Double_t bx = bxyz[0];
00074      Double_t by = bxyz[1];
00075      Double_t bz = bxyz[2];
00076      return TVector3(kInvSqrt2*(by+bx),kInvSqrt2*(by-bx),bz);
00077    }
00078    else {
00079      // position is XYZ, so mesh must be UVZ, but return B_xyz
00080      Double_t  x = position[0];
00081      Double_t  y = position[1];
00082      Double_t  z = position[2];
00083      TVector3  uvz(kInvSqrt2*(x+y),kInvSqrt2*(y-x),z);
00084      TVector3 buvz = GetBFieldMeshCoord(uvz);
00085      Double_t bu = buvz[0];
00086      Double_t bv = buvz[1];
00087      Double_t bz = buvz[2];
00088      return TVector3(kInvSqrt2*(bu-bv),kInvSqrt2*(bu+bv),bz);
00089    }
00090 }

virtual TVector3 BfldHandler::GetBFieldMeshCoord ( const TVector3 &  position  )  [pure virtual]

Implemented in BfldHandlerRect2d, and BfldHandlerVoronoi.

Referenced by GetBField().

BfldMap* BfldHandler::GetMap (  )  const [inline]

Definition at line 38 of file BfldHandler.h.

References fMap.

Referenced by BField::SetupHandlerForMap().

00038 { return fMap; }

void BfldHandler::SetCache ( BfldCache cache  )  [inline]

Definition at line 40 of file BfldHandler.h.

References fCache.

Referenced by BField::operator=(), and BField::ResetVldContext().

00040 { fCache = cache; }

void BfldHandler::SetInterpMethod ( const BfldInterpMethod::InterpMethod_t  method  )  [virtual]

Reimplemented in BfldHandlerRect2d, and BfldHandlerVoronoi.

Definition at line 93 of file BfldHandler.cxx.

References fInterpMethod, BfldInterpMethod::kClosest, and BfldInterpMethod::kDefault.

Referenced by BField::SetInterpMethod().

00094 {
00095    // set the interpolation method for this handler
00096    // specialized handler versions should override the 
00097    // translation of "kDefault" to their optimal choice
00098    // and should also disallow illegal choices
00099 
00100    BfldInterpMethod::InterpMethod_t chosen = method;
00101 
00102    if (BfldInterpMethod::kDefault == chosen) {
00103       // pick a default method
00104       // for the generic case we'll choose "kClosest" because
00105       // all approaches should easily support this
00106       chosen = BfldInterpMethod::kClosest;
00107    }
00108 
00109    fInterpMethod = chosen;
00110 }

void BfldHandler::SetLastPolygAsSeed (  )  [inline]

Definition at line 41 of file BfldHandler.h.

References fUseLastAsSeed.

Referenced by BField::operator=(), and BField::ResetVldContext().

00041 { fUseLastAsSeed = kTRUE; }

void BfldHandler::SetMap ( BfldMap map  )  [virtual]

Reimplemented in BfldHandlerVoronoi.

Definition at line 113 of file BfldHandler.cxx.

References BfldRefCnt::DecrementRef(), fMap, and BfldRefCnt::IncrementRef().

Referenced by BfldCanvasRect2d::BfldCanvasRect2d(), and BField::SetupHandlerForMap().

00114 {
00115    // tell this handler about the map
00116 
00117    if (fMap) fMap->DecrementRef();
00118    fMap = bmap;
00119    fMap->IncrementRef();
00120 }

void BfldHandler::SetMesh ( BfldMesh mesh  )  [virtual]

Reimplemented in BfldHandlerVoronoi.

Definition at line 123 of file BfldHandler.cxx.

References BfldRefCnt::DecrementRef(), fMesh, and BfldRefCnt::IncrementRef().

Referenced by BfldCanvasRect2d::BfldCanvasRect2d(), and BField::SetupHandlerForMap().

00124 {
00125    // tell this handler about the map
00126 
00127    if (fMesh) fMesh->DecrementRef();
00128    fMesh = mesh;
00129    fMesh->IncrementRef();
00130 }


Member Data Documentation

Definition at line 56 of file BfldHandler.h.

Referenced by SetCache().

BfldMap* BfldHandler::fMap [protected]

Definition at line 57 of file BfldHandler.h.

Referenced by BfldHandlerRect2d::GetBFieldMeshCoord(), GetMap(), SetMap(), and ~BfldHandler().

Bool_t BfldHandler::fUseLastAsSeed [protected]

Definition at line 54 of file BfldHandler.h.

Referenced by SetLastPolygAsSeed().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1