BfldHandlerVoronoi Class Reference

#include <BfldHandlerVoronoi.h>

Inheritance diagram for BfldHandlerVoronoi:
BfldHandler

List of all members.

Public Member Functions

 BfldHandlerVoronoi ()
virtual ~BfldHandlerVoronoi ()
virtual TVector3 GetBFieldMeshCoord (const TVector3 &xyz)
virtual void SetInterpMethod (const BfldInterpMethod::InterpMethod_t method)
virtual void SetMap (BfldMap *map)
virtual void SetMesh (BfldMesh *mesh)

Protected Member Functions

void SetCostasHandler (BfldGrid::Grid_t grid)
void SetCostasInterpMethod ()

Protected Attributes

BFLHandlerfCostasHandler

Detailed Description

Definition at line 22 of file BfldHandlerVoronoi.h.


Constructor & Destructor Documentation

BfldHandlerVoronoi::BfldHandlerVoronoi (  ) 

Definition at line 27 of file BfldHandlerVoronoi.cxx.

References Msg::kWarning, and MSG.

00028    : BfldHandler(), fCostasHandler(0)
00029 {
00030    MSG("Bfld",Msg::kWarning) 
00031       << "BfldHandlerVoronoi::ctor" << endl;
00032 }

BfldHandlerVoronoi::~BfldHandlerVoronoi (  )  [virtual]

Definition at line 35 of file BfldHandlerVoronoi.cxx.

References fCostasHandler.

00036 {
00037 
00038    if (fCostasHandler) delete fCostasHandler;
00039 }


Member Function Documentation

TVector3 BfldHandlerVoronoi::GetBFieldMeshCoord ( const TVector3 &  xyz  )  [virtual]

Implements BfldHandler.

Definition at line 141 of file BfldHandlerVoronoi.cxx.

References fCostasHandler, BFLHandler::GetBField(), Munits::mm, and Munits::tesla.

00142 {
00143    // search for the right location
00144    // and then interpolate
00145 
00146    // Costas expects position in mm ...
00147    // Costas currently returns in Tesla ... 
00148 
00149    // convert position to "mm"
00150    TVector3 xyz_mm = xyz * (1./Munits::mm);
00151    // return field in "Tesla"
00152    return fCostasHandler->GetBField(xyz_mm,kTRUE) * Munits::tesla;
00153 }

void BfldHandlerVoronoi::SetCostasHandler ( BfldGrid::Grid_t  grid  )  [protected]

Definition at line 97 of file BfldHandlerVoronoi.cxx.

References bfld::AsString(), fCostasHandler, Msg::kDebug, BfldGrid::kFarCoarseV, Msg::kFatal, BfldGrid::kNearCoarseV, MSG, and SetCostasInterpMethod().

Referenced by SetMap(), and SetMesh().

00098 {
00099 
00100   // this isn't really the right way to do this ...but a hack
00101   if ( ! fCostasHandler ) {
00102 
00103      MSG("Bfld",Msg::kDebug) 
00104         << "BfldHandlerVoronoi::SetCostasHandler create BFLHander" << endl;
00105 
00106     switch (grid) {
00107     case BfldGrid::kNearCoarseV: fCostasHandler = new BFLHandler(0);
00108       break;
00109     case BfldGrid::kFarCoarseV:  fCostasHandler = new BFLHandler(1);
00110       break;
00111     default:
00112       MSG("Bfld",Msg::kFatal) 
00113         << "BfldHandlerVoronoi::SetCostasHandler couldn't attach BFLHandler for " 
00114         << BfldGrid::AsString(grid) << " grid " << endl;
00115       break;
00116     }
00117     
00118     SetCostasInterpMethod();
00119 
00120     //fCostasHandler->SetLastPolygAsSeed();
00121 
00122     //  BFLHandler creates a BFLInterpolation which creates a BFLCache
00123     //  no need to explicitly do so -- it is a memory leak
00124     //BFLCache *mycached = new BFLCache;
00125     //fCostasHandler->SetCache(mycached);
00126     
00127   }
00128 
00129 }

void BfldHandlerVoronoi::SetCostasInterpMethod (  )  [protected]

Definition at line 132 of file BfldHandlerVoronoi.cxx.

References fCostasHandler, BfldHandler::fInterpMethod, and BFLHandler::SetInterpolant().

Referenced by SetCostasHandler(), and SetInterpMethod().

00133 {
00134    // inform fCostasHandler about the interpolation approach requested
00135 
00136 //   if (fCostasHandler) fCostasHandler->SetInterpolant((int)fInterpMethod);
00137    if (fCostasHandler) fCostasHandler->SetInterpolant(fInterpMethod);
00138 }

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

Reimplemented from BfldHandler.

Definition at line 42 of file BfldHandlerVoronoi.cxx.

References bfld::AsString(), BfldInterpMethod::kBilinear, BfldInterpMethod::kDefault, BfldInterpMethod::kNatural, BfldInterpMethod::kPlanar, BfldInterpMethod::kPlanarVec, Msg::kWarning, MSG, and SetCostasInterpMethod().

00043 {
00044    // set the interpolation method for this handler
00045    // the Voronoi specialization translates "kDefault" to "kNatural"
00046    // 
00047    // and should also disallow illegal choices
00048 
00049    static Int_t nwarn = 10;
00050 
00051    BfldInterpMethod::InterpMethod_t chosen = method;
00052 
00053    switch (chosen) {
00054    case BfldInterpMethod::kBilinear:  // not yet!
00055      break;
00056    case BfldInterpMethod::kPlanar:
00057    case BfldInterpMethod::kPlanarVec:
00058       // can't do these methods
00059       if (nwarn > 0) {
00060          nwarn--;
00061          MSG("Bfld",Msg::kWarning)
00062             << "BfldHandlerRect2d::SetInterpMethod '"
00063             << BfldInterpMethod::AsString(chosen) 
00064             << "' not supported"<< endl;
00065       }
00066       // fall through to our choice of default
00067    case BfldInterpMethod::kDefault:
00068       // pick a default method
00069       chosen = BfldInterpMethod::kNatural;
00070       break;
00071    default:
00072       // no need to adjust anything for most methods
00073       break;
00074    }
00075    
00076    BfldHandler::SetInterpMethod(chosen); // do the normal thing
00077 
00078    SetCostasInterpMethod();  // make sure Costas handler is notified
00079    
00080 }

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

Reimplemented from BfldHandler.

Definition at line 83 of file BfldHandlerVoronoi.cxx.

References BfldMap::GetGrid(), and SetCostasHandler().

00084 {
00085   BfldHandler::SetMap(bmap); // do the normal thing
00086   SetCostasHandler(bmap->GetGrid());  // make sure Costas handler is attached
00087 }

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

Reimplemented from BfldHandler.

Definition at line 90 of file BfldHandlerVoronoi.cxx.

References BfldMesh::GetGrid(), and SetCostasHandler().

00091 {
00092   BfldHandler::SetMesh(mesh); // do the normal thing
00093   SetCostasHandler(mesh->GetGrid());  // make sure Costas handler is attached
00094 }


Member Data Documentation


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1