BField Class Reference

#include <BField.h>

Inheritance diagram for BField:
ConstBField ConstBField OneOverRBField OneOverRBField

List of all members.

Public Member Functions

 BField ()
 BField (VldContext vldc, Int_t coarseness=-1, Int_t useEverywhere=0)
 BField (const BField &that)
BFieldoperator= (const BField &that)
virtual ~BField ()
virtual TVector3 GetBField (TVector3 &position, Bool_t isUVZ=false)
 primary user interface
virtual void ResetVldContext (const VldContext &vldc)
virtual void SetInterpMethod (BfldInterpMethod::InterpMethod_t method)
virtual void SetGridHandler (Detector::Detector_t detector, Int_t coarseness)
Int_t GetDoLocalTransform () const
Int_t GetRequireInZTest () const
Double_t GetZTolerance () const
void SetDoLocalTransform (Int_t iflg)
void SetRequireInZTest (Int_t ival)
void SetZTolerance (Double_t zeps)
void SetDoBHCorrection (Int_t ival)
void SetDoSlotCorrection (Int_t ival)
void SetDoInterPlaneField (Int_t ival)
void SetDoSMGapAndEndField (Int_t ival)
void SetUseDCSCoilDir (Int_t ival)
void SetUseDCSCurrent (Int_t ival)
Int_t GetDoBHCorrection () const
Int_t GetDoSlotCorrection () const
Int_t GetDoInterPlaneField () const
Int_t GetDoSMGapAndEndField () const
Int_t GetUseDCSCoilDir () const
Int_t GetUseDCSCurrent () const
void SetNoFieldBeyondZ (Double_t z)
Double_t GetNoFieldBeyondZ () const
void Print (Option_t *option="") const
VldContext GetVldContext () const
VldRange GetVldRange () const

Protected Member Functions

void Init ()
void InitFlagsFromLoanPool ()
void FindSteelFromZ (Float_t z) const
BfldMapSetupHandlerForMap (Int_t mapVariant)
void ApplySlotFactorCorr (TVector3 &b)
void ApplyBHFactorCorr (TVector3 &b)
void ApplyBHCurveCorr (TVector3 &b)
TVector3 BFromLineSource (TVector3 &posRelCoil, Double_t current)
TVector3 SMGapAndEndField (const TVector3 &pos, Ugli::SMRegion_t iregion)
TVector3 SMGapAndEndFieldNear (const TVector3 &pos, Ugli::SMRegion_t iregion)
TVector3 SMGapAndEndFieldFar (const TVector3 &pos, Ugli::SMRegion_t iregion)

Protected Attributes

Bool_t fNoField
VldContext fVldContext
VldRange fVldRange
BfldGrid::Grid_t fGrid
BfldLoanPoolfLoanPool
BfldHandlerfHandler
BfldCachefCache
Bool_t fPositionIsUVZ
Bool_t fPowerOff
Bool_t fDegaussed
Double_t fCoilCurrent
const BfldDbiPlaneMapfCurrentPlaneMap
BfldDbiPlaneMapfOwnedPlaneMap
Int_t fLastMapVariant
Int_t fDoBHCorrection
Int_t fDoSlotCorrection
Int_t fDoInterPlaneField
Int_t fDoSMGapAndEndField
Int_t fUseDCSCoilDir
Int_t fUseDCSCurrent
Int_t fGapLineSrc
Int_t fApplyBdotScale
Double_t fOverallScale
Int_t fUseEverywhere
Double_t fNoFieldBeyondZ

Detailed Description

Definition at line 34 of file BField.h.


Constructor & Destructor Documentation

BField::BField (  ) 

Definition at line 48 of file BField.cxx.

References fNoField, Init(), and InitFlagsFromLoanPool().

00049   : fLoanPool(0), fHandler(0), fCache(0), 
00050     fCurrentPlaneMap(0), fOwnedPlaneMap(0)
00051 
00052 { 
00053    // Default constructor -- needed if classes are to inherit this interface
00054    Init(); 
00055    InitFlagsFromLoanPool();
00056    fNoField        = true;
00057 }

BField::BField ( VldContext  vldc,
Int_t  coarseness = -1,
Int_t  useEverywhere = 0 
)

Definition at line 60 of file BField.cxx.

References VldContext::AsString(), fLoanPool, fNoField, fOwnedPlaneMap, fUseEverywhere, fVldContext, fVldRange, VldTimeStamp::GetBOT(), BfldCache::GetDefaultMapVariant(), VldContext::GetDetector(), VldTimeStamp::GetEOT(), BfldLoanPool::GetForceUseEverywhere(), BfldLoanPool::GetIgnoreUseEverywhere(), VldContext::GetSimFlag(), Init(), InitFlagsFromLoanPool(), Detector::kCalDet, Msg::kInfo, MAXMSG, ResetVldContext(), SetGridHandler(), BfldDbiPlaneMap::SetMapVariant(), and BfldDbiPlaneMap::SetScale().

00061   : fNoField(false), fVldContext(vldc), fLoanPool(0), fHandler(0), fCache(0),
00062     fPowerOff(false), fDegaussed(false), fCoilCurrent(0),
00063     fCurrentPlaneMap(0), fOwnedPlaneMap(0)
00064 {
00065    // constructor
00066    //
00067    // "useEverywhere" is a temporary ruse for bypassing the need
00068    // for geometry during development, it assumes that a old 2d rectangular
00069    // grid is relevant *everywhere* and this is the ID.
00070    //
00071    // coarseness should be set to -1 to use a rectangular grid, in which
00072    // case useEverywhere should specify which of the old IDs to use.
00073 
00074    Init();
00075    InitFlagsFromLoanPool();
00076    fUseEverywhere = useEverywhere;
00077 
00078    // set VldRange
00079    VldTimeStamp start = VldTimeStamp::GetBOT();
00080    VldTimeStamp end   = VldTimeStamp::GetEOT();
00081    fVldRange = VldRange(vldc.GetDetector(),
00082                         vldc.GetSimFlag(),
00083                         start,
00084                         end,
00085                         "fake");
00086 
00087    if (vldc.GetDetector() == Detector::kCalDet) {
00088      fNoField = true;
00089      return;
00090    }
00091 
00092    // set the grid and attach appropriate handler
00093    // do this before we decide about UseEverywhere
00094    // (which might screw up the VldContext)
00095    SetGridHandler(vldc.GetDetector(),coarseness);   
00096 
00097    // have we been told by the package config to always
00098    // use a particular map?
00099    int forceEverywhere = fLoanPool->GetForceUseEverywhere();
00100    if (forceEverywhere) {
00101      if ( forceEverywhere == 1 ) {
00102        // special case 1 is not a particular map but to use
00103        // the code's choice of "best for this VldContext".
00104        forceEverywhere = BfldCache::GetDefaultMapVariant(fVldContext);
00105        MAXMSG("Bfld",Msg::kInfo,5)
00106          << "Bfield::ctor BfldLoanPool forceUseEverywhere=1"
00107          << " yields map " << forceEverywhere << " for "
00108          << endl << "    " << vldc.AsString("c") << "."
00109          << endl;
00110      }
00111      MAXMSG("Bfld",Msg::kInfo,5)
00112        << "BField::ctor useEverywhere was " << fUseEverywhere
00113        << ", forced by BfldLoanPool config to use "
00114        << forceEverywhere << "."
00115        << endl;
00116      fUseEverywhere = forceEverywhere;
00117    }
00118 
00119    // if we've been told to use a particular map (either from the
00120    // ctor args or from the package config), have we been
00121    // told by the package config to ignore this?
00122    if (fUseEverywhere) {
00123      int ignore = fLoanPool->GetIgnoreUseEverywhere();
00124      MAXMSG("Bfld",Msg::kInfo,5) 
00125        << "BField::ctor useEverywhere=" << fUseEverywhere
00126        << ((ignore)?" (now ignored)":" (active)") << "."
00127        << endl;
00128      if (ignore) fUseEverywhere = 0;
00129      else {
00130        // use fOwnedPlaneMap for keeping "everwhere" info
00131        fOwnedPlaneMap->SetMapVariant(0,fUseEverywhere);
00132        fOwnedPlaneMap->SetScale(0,1.0);
00133        fVldContext = VldContext();  // !NOTE! mucking up VldContext!
00134        MAXMSG("Bfld",Msg::kInfo,5) 
00135          << "BField::ctor setting fake VldContext to avoid "
00136          << "pulling geometry tables from DBI."
00137          << endl;
00138      }
00139    }
00140 
00141    // attach an appropriate cache we get from a loan pool
00142    // also look up coil current info
00143    ResetVldContext(vldc);
00144 
00145 }

BField::BField ( const BField that  ) 

Definition at line 148 of file BField.cxx.

00149   : TObject(that)
00150 {
00151   // (deep) copy ctor accounts for keeping ref counts straight
00152   *this = that; 
00153 }

BField::~BField (  )  [virtual]

Definition at line 339 of file BField.cxx.

References BfldCache::DecrementRef(), fCache, fHandler, and fOwnedPlaneMap.

00340 {
00341    // destructor
00342 
00343    if (fHandler)       { delete fHandler;        fHandler = 0; }
00344    // fCache is not owned, can't delete it just change ref count
00345    if (fCache)         { fCache->DecrementRef(); fCache = 0; } 
00346    if (fOwnedPlaneMap) { delete fOwnedPlaneMap;  fOwnedPlaneMap = 0; }
00347 
00348 }


Member Function Documentation

void BField::ApplyBHCurveCorr ( TVector3 &  b  )  [protected]

Definition at line 732 of file BField.cxx.

References Msg::kWarning, and MAXMSG.

Referenced by GetBField().

00733 {
00734   // Use B-H curve correction
00735   MAXMSG("Bfld",Msg::kWarning,20)
00736     << "BField::ApplyBHCurveCorr not yet implemented!"
00737     << endl;
00738   // do nothing!
00739 }

void BField::ApplyBHFactorCorr ( TVector3 &  b  )  [protected]

Definition at line 686 of file BField.cxx.

References fCurrentPlaneMap, BfldDbiPlaneMap::GetBHCutoff(), BfldDbiPlaneMap::GetBHFactor(), Msg::kInfo, and MAXMSG.

Referenced by GetBField().

00687 {
00688   // 
00689   // Steel chemistry correction (BH)
00690   //
00691   //           Bo                     for Bo > Bcut
00692   //   B'  =   Bo [ 1 + G*(1-Bo/C) ]  for Bcut/3 < Bo < Bcut
00693   //           Bo [ 1 + 2/3*G*Bo/C ]  for Bo < Bcut/3
00694   //
00695 
00696 #ifdef DEBUG
00697   MAXMSG("Bfld",Msg::kInfo,20) 
00698     << "ApplyBHFactorCorr " 
00699     << " BHFactor " << fCurrentPlaneMap->GetBHFactor()
00700     << " BHCutoff " << fCurrentPlaneMap->GetBHCutoff()
00701     << " mag " << b.Mag()
00702     << endl;
00703 #endif
00704 
00705   Double_t bhfactor = fCurrentPlaneMap->GetBHFactor();
00706   if ( bhfactor == 0 ) return;
00707 
00708   Double_t bhcutoff = fCurrentPlaneMap->GetBHCutoff();
00709   if ( bhcutoff == 0 ) return;
00710 
00711   Double_t magbfld  = b.Mag();
00712   if ( magbfld > bhcutoff) return;
00713 
00714   Double_t bhscale = 1.0;
00715   if ( magbfld > bhcutoff/3.0 ) {
00716     bhscale = 1.0 + bhfactor * ( 1.0 - magbfld/bhcutoff );
00717   }
00718   else {
00719     bhscale = 1.0 + (2.0/3.0)*bhfactor*magbfld/bhcutoff;
00720   }
00721 
00722 #ifdef DEBUG
00723   MAXMSG("Bfld",Msg::kInfo,20) 
00724     << "ApplyBhFactorCorr " << bhscale << endl;
00725 #endif 
00726 
00727   // apply correction
00728   b *= bhscale;
00729 }

void BField::ApplySlotFactorCorr ( TVector3 &  b  )  [protected]

Definition at line 645 of file BField.cxx.

References fCurrentPlaneMap, BfldDbiPlaneMap::GetSlotCutoff(), BfldDbiPlaneMap::GetSlotFactor(), Msg::kInfo, and MAXMSG.

Referenced by GetBField().

00646 {
00647   //
00648   // Slot (gap) correction formula:
00649   //
00650   //
00651   //   B'  =   Bo                                 for Bo > Bcut
00652   //           Bo [ 1 - D * ( 1 - Bo/Bcut )^2 ]   
00653   //
00654 
00655 #ifdef DEBUG
00656   MAXMSG("Bfld",Msg::kInfo,20) 
00657     << "ApplySlotFactorCorr " 
00658     << " SlotFactor " << fCurrentPlaneMap->GetSlotFactor()
00659     << " SlotCutoff " << fCurrentPlaneMap->GetSlotCutoff()
00660     << " mag " << b.Mag()
00661     << endl;
00662 #endif
00663 
00664   Double_t slotfactor = fCurrentPlaneMap->GetSlotFactor();
00665   if ( slotfactor == 0 ) return;
00666   
00667   Double_t slotcutoff = fCurrentPlaneMap->GetSlotCutoff();
00668   if ( slotcutoff == 0 ) return;
00669      
00670   Double_t magbfld    = b.Mag();
00671   if ( magbfld > slotcutoff ) return;
00672      
00673   Double_t inner = 1.0 - magbfld/slotcutoff;
00674   Double_t slotscale = 1.0 - slotfactor * inner*inner;
00675 
00676 #ifdef DEBUG
00677   MAXMSG("Bfld",Msg::kInfo,20) 
00678     << "ApplySlotFactorCorr " << magbfld << " " << slotscale << endl;
00679 #endif  
00680 
00681   // apply correction
00682   b *= slotscale;
00683 }

TVector3 BField::BFromLineSource ( TVector3 &  posRelCoil,
Double_t  current 
) [protected]

Definition at line 742 of file BField.cxx.

References Munits::cm.

Referenced by GetBField().

00743 {
00744   // Field in air from a line source along z axis
00745 
00746   // B = u0*I/2pi*r = 0.003/r
00747   const Double_t u0by2pi = 12.566370614e-7 / (2.0 * TMath::Pi());
00748   
00749   Double_t r = posRelCoil.Perp();
00750   // protect against divide by zero
00751   r = TMath::Max(r,Munits::cm);  // no line src smaller than 1 cm
00752   Double_t brbyr = ( u0by2pi * current / r )/r;
00753   Double_t bx    =  posRelCoil.Y() * brbyr;
00754   Double_t by    = -posRelCoil.X() * brbyr;
00755   return TVector3(bx,by,0.0);
00756 
00757 }

void BField::FindSteelFromZ ( Float_t  z  )  const [protected]
TVector3 BField::GetBField ( TVector3 &  position,
Bool_t  isUVZ = false 
) [virtual]

primary user interface

Definition at line 383 of file BField.cxx.

References ApplyBHCurveCorr(), ApplyBHFactorCorr(), ApplySlotFactorCorr(), bfld::AsString(), BFromLineSource(), fApplyBdotScale, fCache, fCoilCurrent, fCurrentPlaneMap, fDegaussed, fDoBHCorrection, fDoInterPlaneField, fDoSlotCorrection, fDoSMGapAndEndField, fGapLineSrc, fHandler, BfldCache::FindPlaneMap(), BfldCache::FindWasInSteel(), fNoField, fNoFieldBeyondZ, fOverallScale, fOwnedPlaneMap, fPositionIsUVZ, fPowerOff, fUseDCSCoilDir, fUseEverywhere, fVldContext, BfldDbiPlaneMap::GetBdotScale(), BfldHandler::GetBField(), BfldCache::GetCurrentSteelPlnHandle(), BfldCache::GetDefaultMapVariant(), BfldCache::GetDefaultScale(), VldContext::GetDetector(), BfldCache::GetDoLocalTransform(), BfldMap::GetGeneratedCoilCurrent(), BfldDbiPlaneMap::GetMapVariant(), BfldDbiPlaneMap::GetPlaneId(), BfldCache::GetPositionInSteel(), BfldDbiPlaneMap::GetScale(), BfldCache::InSMRegion(), BfldDbiPlaneMap::IsInDetail(), BfldDbiPlaneMap::IsNull(), BfldDbiPlaneMap::IsPairNull(), BfldDbiPlaneMap::kDetailGapA, BfldDbiPlaneMap::kDetailSteelA, Detector::kFar, BfldDbiPlaneMap::kFullGapA, BfldDbiPlaneMap::kFullSteelA, Msg::kInfo, Ugli::kInSM1, Ugli::kInSM2, Detector::kNear, BfldDbiPlaneMap::kPowerOffA, Msg::kWarning, UgliSteelPlnHandle::LocalToGlobalVect(), MAXMSG, BfldDbiPlaneMap::SetMapVariant(), BfldDbiPlaneMap::SetScale(), SetupHandlerForMap(), SMGapAndEndField(), and zeroBfld().

Referenced by AccTest(), AlgFitTrackSR::CalculateNoise(), BfldValidate::DrawMap(), BfldCanvas::Fill(), BFieldSR::GetBField(), BFieldMS::GetBField(), AlgFitTrackCam::GetNoiseMatrix(), main(), SwimDefStepper::DerivFunc::operator()(), RectPerformanceTest(), AlgFitTrackAtNu::RunAlg(), StoreDataPoint(), AlgFitTrackCam::Swim(), BfldValidate::TestInterpMethods(), BfldValidate::TestLoanPool(), and VorPerformanceTest().

00384 {
00385    // Return the magnetic field for any point in space
00386    // for the currently configured detector
00387    // if isUVZ position is in 
00388 
00389    if (fNoField) return zeroBfld;
00390 
00391    if (posGlobal.Z() > fNoFieldBeyondZ ) return zeroBfld;
00392 
00393    // stash this way for special cases ( coil, SM gap, interplane )
00394    fPositionIsUVZ = isUVZ;
00395    
00396    bool isPosSteelUVZ = isUVZ;
00397    int doLocalTransform = 0;
00398 
00399    if ( fDegaussed && fCoilCurrent == 0 ) return zeroBfld;
00400 
00401    bool was_in_steel = true;
00402 
00403    // calculate which plate (if any) this "z" corresponds to
00404    if (fUseEverywhere) {
00405 
00406      MAXMSG("Bfld",Msg::kWarning,4) 
00407        << "BField::GetBField no coil region handling or " << endl
00408        << "map selection based on plane with useEverywhere=" 
00409        << fUseEverywhere << "."
00410        << endl;
00411      fCurrentPlaneMap = fOwnedPlaneMap;
00412 
00413    } else {
00414 
00415       // check for special cases of geometry (via cache)
00416       //  0 =: don't check, outside steel use either 
00417       //       none (no InterPlaneField) or interplane gap map
00418       // <0 =: check position, but use zero when up/down/gap
00419       // >0 =: check position, try best to model field
00420       if ( fDoSMGapAndEndField ) {
00421         Ugli::SMRegion_t ismregion = fCache->InSMRegion(posGlobal,isUVZ);
00422         if ( ismregion != Ugli::kInSM1 && ismregion != Ugli::kInSM2 ) {
00423           // in SM gap or beyond SM ends
00424           if ( fDoSMGapAndEndField < 0 ) return zeroBfld; // no attempt to model
00425           return SMGapAndEndField(posGlobal,ismregion);
00426         }
00427       }
00428 
00429       // use geometry (via cache) to determine plane
00430       fCurrentPlaneMap = fCache->FindPlaneMap(posGlobal);
00431       was_in_steel = fCache->FindWasInSteel(true);
00432       // check that there was data
00433 
00434       if ( ! fCurrentPlaneMap ) {
00435         // nope?  probably because lacking BfldDbiPlaneMap table
00436         // fake something up to mimic old behaviour
00437         Int_t    imap  = BfldCache::GetDefaultMapVariant(fVldContext);
00438         Double_t scale = BfldCache::GetDefaultScale(fVldContext);
00439         MAXMSG("Bfld",Msg::kWarning,5)
00440           << "GetDefault(MapVariant,Scale) returned (" 
00441           << imap << "," << scale << ")"
00442           << ", called because missing BfldDbiPlaneMap?"
00443           << endl;
00444         fOwnedPlaneMap->SetMapVariant(0,imap);
00445         fOwnedPlaneMap->SetScale(0,scale);   
00446         fCurrentPlaneMap = fOwnedPlaneMap;
00447       }
00448    }
00449 
00450    // by default use the full plane map pair
00451    Int_t indxpair = BfldDbiPlaneMap::kFullSteelA;
00452 
00453    TVector3 posSteel(posGlobal);
00454    doLocalTransform = fCache->GetDoLocalTransform();
00455    if (doLocalTransform > 0) {
00456      posSteel = fCache->GetPositionInSteel();
00457      //if (doLocalTransform > 1) isPosSteelUVZ = false;
00458    }
00459    bool indetail = fCurrentPlaneMap->IsInDetail(posSteel.x(),posSteel.y());
00460 
00461    if ( ! was_in_steel ) {
00462      //
00463      // what to do if not (considered) in the steel
00464      //
00465      // if asked to do nothing ... return zero field
00466      if ( 0 == fDoInterPlaneField ) return zeroBfld;
00467      indxpair = BfldDbiPlaneMap::kDetailGapA;  // default to gap detail map
00468      if ( ! indetail ) {
00469        // not in detail region?
00470        if ( 3 == fDoInterPlaneField ) return zeroBfld;
00471        indxpair = BfldDbiPlaneMap::kFullGapA;
00472        // fall back to line current if no full gap map exists
00473        if (fCurrentPlaneMap->IsPairNull(indxpair) || 
00474            2 == fDoInterPlaneField) {
00475          TVector3 blinesrc(0,0,0);
00476          if ( fGapLineSrc & 1 ) {
00477            TVector3 posCoil = posSteel; // for now!!
00478            blinesrc += BFromLineSource(posCoil,fCoilCurrent);
00479            static double lastcurrent1 = 9999;
00480            if (lastcurrent1 != fCoilCurrent) {
00481              MAXMSG("Bfld",Msg::kInfo,5)
00482                << "BFromLineSource current is " << fCoilCurrent
00483                << " for central leg at " << bfld::AsString(posCoil)
00484                << std::endl;
00485              lastcurrent1 = fCoilCurrent;
00486            }
00487          }
00488          if ( fGapLineSrc & 2 ) {
00489            TVector3 posRelRtnCoil = posGlobal;
00490            // account for position of return coil
00491            switch ( fVldContext.GetDetector() ) {
00492            case Detector::kNear:
00493              posRelRtnCoil -= TVector3(-1.9,-1.9,0);
00494              break;
00495            case Detector::kFar:
00496              posRelRtnCoil -= TVector3( 0.0,-4.8,0);
00497              break;
00498            default:
00499              posRelRtnCoil = TVector3(999.,999.,999.);
00500              break;
00501            }
00502            // note negative sign for fCoilCurrent for return leg
00503            blinesrc += BFromLineSource(posRelRtnCoil,-fCoilCurrent);
00504            static double lastcurrent2 = -9999;
00505            if (lastcurrent2 != -fCoilCurrent) {
00506              MAXMSG("Bfld",Msg::kInfo,5)
00507                << "BFromLineSource current is " << -fCoilCurrent
00508                << " for return leg at " << bfld::AsString(posRelRtnCoil)
00509                << std::endl;
00510              lastcurrent2 = -fCoilCurrent;
00511            }
00512          }
00513          return blinesrc;
00514        }
00515      }
00516    } else {
00517      //
00518      // what to do if (considered) in the steel
00519      // set the right map pair for the conditions and position
00520      //
00521      if ( fPowerOff ) indxpair = BfldDbiPlaneMap::kPowerOffA;
00522      else if ( indetail ) {
00523        indxpair = BfldDbiPlaneMap::kDetailSteelA;
00524        if (fCurrentPlaneMap->IsPairNull(indxpair)) 
00525          indxpair = BfldDbiPlaneMap::kFullSteelA; // no detail map, revert
00526      }
00527    }
00528 
00529    Bool_t isnull[2];  // check if scale or mapVariant is 0
00530    isnull[0] = fCurrentPlaneMap->IsNull(indxpair);
00531    isnull[1] = fCurrentPlaneMap->IsNull(indxpair+1);
00532 
00533    Double_t coilCurrMap[2] = { 0, 0 };
00534 
00535    if ( isnull[0] && isnull[1] ) return zeroBfld;  // I've got nut'n
00536 
00537    TVector3 bfieldSum(zeroBfld);  // start with zero field
00538 
00539    for (UInt_t iv = 0; iv<2; ++iv) {  // loop over 2 possible contributions
00540 
00541      if ( isnull[iv] ) continue; // no contribution
00542      
00543      // variant refers to (in part) the steel chemistry
00544      // end-plate info to get right "variant"
00545      Int_t mapVariant  = fCurrentPlaneMap->GetMapVariant(indxpair+iv);
00546      Double_t scaleMap = fCurrentPlaneMap->GetScale(indxpair+iv);
00547 
00548      // if using DCS for sign
00549      // then (generally) ignore sign associated with scale
00550      //if ( (fUseDCSCoilDir&1) ) scaleMap = TMath::Abs(scaleMap);
00551      if ( (fUseDCSCoilDir&1) == 1 ) scaleMap = TMath::Abs(scaleMap);
00552 
00553      // this should never happen
00554      if (mapVariant == 0) {
00555        MAXMSG("Bfld",Msg::kInfo,5)
00556          << "BField mapVariant=0 indxpair=" << indxpair << " iv=" << iv
00557          << " isnull=" << (isnull[iv]?"true":"false")
00558          << " scaleMap=" << scaleMap
00559          << endl;
00560        MAXMSG("Bfld",Msg::kInfo,5) << *fCurrentPlaneMap << endl;
00561        continue;
00562      }
00563 
00564      BfldMap* bmap = SetupHandlerForMap(mapVariant);
00565  
00566      coilCurrMap[iv] = bmap->GetGeneratedCoilCurrent();
00567      Double_t scaleCoil = fCoilCurrent/coilCurrMap[iv]; 
00568      // probably this effect isn't linear when field is saturated...
00569      Double_t scale = scaleCoil * scaleMap;
00570      //MAXMSG("Bfld",Msg::kDebug,5)
00571      //  << "Bfld scaleCoil " << scaleCoil << " CoilCurrent " << fCoilCurrent
00572      //  << " MapCurrent " << coilCurrMap[iv] << endl;
00573 
00574      // The handler is now configured ... interogate it for the field
00575      bfieldSum += (scale*fHandler->GetBField(posSteel,isPosSteelUVZ));
00576 
00577    } 
00578 
00579    if ( was_in_steel && doLocalTransform > 1 ) {
00580      // get the steel, to tranform B_local to B_global
00581      // note Ugli uses globalInXYZ, while BField uses isUVZ
00582      // always pass true here ... don't double rotate!
00583      UgliSteelPlnHandle usph = fCache->GetCurrentSteelPlnHandle();
00584      bfieldSum = usph.LocalToGlobalVect(bfieldSum,true);
00585    }
00586 
00587    // should these be done by the handler on the pre-(scaled&summed)
00588    // version before summing? i.e. which is more correct:
00589    //  (a)  bhcorr(slotcor(map0))*scale0 + bhcorr(slotcor(map1))*scale1
00590    //  (b)  bhcorr(slotcor(map0*scale0 + map1*scale1))
00591    // this choice is (b) otherwise we should move these to the 
00592    // BfldHandler and make it aware of the flags and initialize
00593    // it with the fCurrentPlaneMap so it can pick up the parameters
00594 
00595    if      ( fDoSlotCorrection   ) ApplySlotFactorCorr(bfieldSum);
00596    if      ( fDoBHCorrection < 0 ) ApplyBHFactorCorr(bfieldSum);
00597    else if ( fDoBHCorrection > 0 ) ApplyBHCurveCorr(bfieldSum);
00598 
00599    if ( fApplyBdotScale ) {
00600      // don't apply to the gap cases
00601      if ( indxpair < BfldDbiPlaneMap::kDetailGapA ) {
00602        Double_t bdot = fCurrentPlaneMap->GetBdotScale();
00603        // don't apply if for some reason bdot value is == 0 (bad DB value)
00604        if (bdot == 0.0) {
00605          MAXMSG("Bfld",Msg::kWarning,5)
00606            << " BdotScale was zero for plane " << fCurrentPlaneMap->GetPlaneId()
00607            << "." << endl;
00608        } else {
00609          bfieldSum *= bdot;
00610        }
00611      }
00612    }
00613 
00614    return bfieldSum * fOverallScale;
00615 }

Int_t BField::GetDoBHCorrection (  )  const [inline]

Definition at line 75 of file BField.h.

References fDoBHCorrection.

00075 { return fDoBHCorrection;     }

Int_t BField::GetDoInterPlaneField (  )  const [inline]

Definition at line 77 of file BField.h.

References fDoInterPlaneField.

00077 { return fDoInterPlaneField;  }

Int_t BField::GetDoLocalTransform (  )  const

Definition at line 812 of file BField.cxx.

References fCache, and BfldCache::GetDoLocalTransform().

00813 {  return fCache->GetDoLocalTransform(); }

Int_t BField::GetDoSlotCorrection (  )  const [inline]

Definition at line 76 of file BField.h.

References fDoSlotCorrection.

00076 { return fDoSlotCorrection;   }

Int_t BField::GetDoSMGapAndEndField (  )  const [inline]

Definition at line 78 of file BField.h.

References fDoSMGapAndEndField.

00078 { return fDoSMGapAndEndField; }

Double_t BField::GetNoFieldBeyondZ (  )  const [inline]

Definition at line 84 of file BField.h.

References fNoFieldBeyondZ.

00084 { return fNoFieldBeyondZ; }

Int_t BField::GetRequireInZTest (  )  const

Definition at line 815 of file BField.cxx.

References fCache, and BfldCache::GetRequireInZTest().

00816 {  return fCache->GetRequireInZTest(); }

Int_t BField::GetUseDCSCoilDir (  )  const [inline]

Definition at line 79 of file BField.h.

References fUseDCSCoilDir.

00079 { return fUseDCSCoilDir;      }

Int_t BField::GetUseDCSCurrent (  )  const [inline]

Definition at line 80 of file BField.h.

References fUseDCSCurrent.

00080 { return fUseDCSCurrent;      }

VldContext BField::GetVldContext (  )  const [inline]

Definition at line 87 of file BField.h.

References fVldContext.

00087 { return fVldContext; }

VldRange BField::GetVldRange (  )  const [inline]

Definition at line 88 of file BField.h.

References fVldRange.

00088 { return fVldRange; }

Double_t BField::GetZTolerance (  )  const

Definition at line 818 of file BField.cxx.

References fCache, and BfldCache::GetZTolerance().

00819 { return fCache->GetZTolerance(); }

void BField::Init ( void   )  [protected]

Definition at line 300 of file BField.cxx.

References fGrid, fLastMapVariant, fLoanPool, fNoField, fOwnedPlaneMap, fUseEverywhere, fVldRange, BfldLoanPool::Instance(), and BfldGrid::kUndefined.

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

00301 {
00302    // initialize member data
00303    fNoField        = false;
00304    fVldRange       = VldRange();
00305    fGrid           = BfldGrid::kUndefined;
00306    fLastMapVariant = kNoMapUsed;
00307    fUseEverywhere  = 0; 
00308 
00309    // get access to the BfldLoanPool
00310    if (!fLoanPool) fLoanPool = BfldLoanPool::Instance();
00311 
00312    if (fOwnedPlaneMap) { delete fOwnedPlaneMap;  fOwnedPlaneMap = 0; }
00313    fOwnedPlaneMap = new BfldDbiPlaneMap;
00314 }

void BField::InitFlagsFromLoanPool (  )  [protected]

Definition at line 317 of file BField.cxx.

References fApplyBdotScale, fDoBHCorrection, fDoInterPlaneField, fDoSlotCorrection, fDoSMGapAndEndField, fGapLineSrc, fLoanPool, fNoFieldBeyondZ, fOverallScale, fUseDCSCoilDir, fUseDCSCurrent, BfldLoanPool::GetDefaultApplyBdotScale(), BfldLoanPool::GetDefaultDoBHCorrection(), BfldLoanPool::GetDefaultDoInterPlaneField(), BfldLoanPool::GetDefaultDoSlotCorrection(), BfldLoanPool::GetDefaultDoSMGapAndEndField(), BfldLoanPool::GetDefaultGapLineSrc(), BfldLoanPool::GetDefaultNoFieldBeyondZ(), BfldLoanPool::GetDefaultOverallScale(), BfldLoanPool::GetDefaultUseDCSCoilDir(), BfldLoanPool::GetDefaultUseDCSCurrent(), and BfldLoanPool::Instance().

Referenced by BField().

BField & BField::operator= ( const BField that  ) 

Definition at line 156 of file BField.cxx.

References BfldCache::DecrementRef(), fApplyBdotScale, fCache, fDoBHCorrection, fDoInterPlaneField, fDoSlotCorrection, fDoSMGapAndEndField, fGapLineSrc, fGrid, fHandler, fLastMapVariant, fLoanPool, fNoField, fNoFieldBeyondZ, fOverallScale, fUseDCSCoilDir, fUseDCSCurrent, fUseEverywhere, fVldContext, fVldRange, BfldGrid::GetCoarseness(), VldContext::GetDetector(), BfldCache::IncrementRef(), Init(), BfldHandler::SetCache(), SetGridHandler(), and BfldHandler::SetLastPolygAsSeed().

00157 {
00158    // assignment operator (deep)
00159 
00160    if ( this == &that ) return *this;  // do nothing if asked to self-assign
00161    TObject::operator=(that);
00162 
00163    // delete owned handler, decrement cache reference
00164    fLoanPool = 0;
00165    if (fHandler) { delete fHandler;        fHandler = 0; }
00166    if (fCache)   { fCache->DecrementRef(); fCache = 0; } // not owned, can't delete it
00167 
00168    Init();
00169 
00170    // copy data
00171    fNoField             = that.fNoField;
00172    fVldContext          = that.fVldContext;
00173    fVldRange            = that.fVldRange;
00174    fLastMapVariant      = that.fLastMapVariant;
00175 
00176    fDoBHCorrection      = that.fDoBHCorrection;
00177    fDoSlotCorrection    = that.fDoSlotCorrection;
00178    fDoInterPlaneField   = that.fDoInterPlaneField;
00179    fDoSMGapAndEndField  = that.fDoSMGapAndEndField;
00180 
00181    fUseDCSCoilDir       = that.fUseDCSCoilDir;
00182    fUseDCSCurrent       = that.fUseDCSCurrent;
00183    fGapLineSrc          = that.fGapLineSrc;
00184    fApplyBdotScale      = that.fApplyBdotScale;
00185    fOverallScale        = that.fOverallScale;
00186 
00187    fUseEverywhere       = that.fUseEverywhere; 
00188    fNoFieldBeyondZ      = that.fNoFieldBeyondZ;
00189 
00190    // attach the same cache as the copy-ee
00191    if ( that.fCache ) {
00192      fCache = that.fCache;
00193      fCache->IncrementRef();
00194    }
00195    else {
00196      // hey! this shouldn't happen
00197      assert(0);
00198    } 
00199 
00200    // translate chosen grid back into coarseness
00201    Int_t coarseness = BfldGrid::GetCoarseness(that.fGrid);
00202 
00203    // set the grid and attach appropriate handler
00204    SetGridHandler(fVldContext.GetDetector(),coarseness);
00205 
00206    fHandler->SetCache(fCache);
00207    fHandler->SetLastPolygAsSeed();
00208 
00209    return *this;
00210 }

void BField::Print ( Option_t *  option = ""  )  const

Definition at line 844 of file BField.cxx.

References bfld::AsString(), fApplyBdotScale, fCache, fCoilCurrent, fDegaussed, fDoBHCorrection, fDoInterPlaneField, fDoSlotCorrection, fDoSMGapAndEndField, fGapLineSrc, fGrid, fHandler, fNoField, fOverallScale, fPositionIsUVZ, fPowerOff, fUseDCSCoilDir, fUseDCSCurrent, fVldContext, fVldRange, Msg::kInfo, MSG, and BfldCache::Print().

00845 {
00846    // output info about this BField object
00847 
00848    MSG("Bfld",Msg::kInfo) 
00849      << "BField: created from VldContext " << fVldContext
00850      << endl << " VldRange: " << fVldRange << endl;
00851    MSG("Bfld",Msg::kInfo)
00852      << " Co-ords: " << (fPositionIsUVZ?"UVZ":"XYZ")
00853      << ", NoField: " << (fNoField?"yes":"no")
00854      << endl
00855      << " Power: " << (fPowerOff?"off":"on")
00856      << ", Degaussed: " << (fDegaussed?"yes":"no")
00857      << ", Current: " << fCoilCurrent
00858      << endl
00859      << " UseDCSCoilDir: " << fUseDCSCoilDir
00860      << ", UseDCSCurrent: " << fUseDCSCurrent
00861      << ", GapLineSrc: " << fGapLineSrc
00862      << ", InterPlaneField: " << fDoInterPlaneField
00863      << ", SMGapAndEndField: " << fDoSMGapAndEndField
00864      << ", ApplyBdotScale: " << (fApplyBdotScale?"yes":"no")
00865      << ", OverallScale: " << fOverallScale
00866      << endl
00867      << " BHCorr: " << fDoBHCorrection
00868      << ", SlotCorr: " << fDoSlotCorrection
00869      << endl;
00870    if (fGrid) {
00871      MSG("Bfld",Msg::kInfo) 
00872        << " Grid: " << BfldGrid::AsString(fGrid) << endl;
00873    }
00874    if (fCache) {
00875      MSG("Bfld",Msg::kInfo) << " BfldCache: ";
00876      fCache->Print();
00877    }
00878    if (fHandler) {
00879      MSG("Bfld",Msg::kInfo) << " Handler: ";
00880      fHandler->Print();
00881    }
00882 }

void BField::ResetVldContext ( const VldContext vldc  )  [virtual]

allow user to reset VldContext but *only* for VldTimeStamp portion should be same Detector/SimFlag this allow refetching time dependent info (coil current, etc)

Definition at line 213 of file BField.cxx.

References CoilTools::CoilCurrent(), BfldCache::DecrementRef(), det, fCache, fCoilCurrent, fDegaussed, fHandler, fLoanPool, fNoField, fPowerOff, fUseDCSCoilDir, fUseDCSCurrent, fVldContext, fVldRange, VldTimeStamp::GetBOT(), BfldLoanPool::GetCache(), VldContext::GetDetector(), VldTimeStamp::GetEOT(), VldContext::GetSimFlag(), BfldCache::GetVldRange(), BfldCache::IncrementRef(), CoilTools::IsOK(), CoilTools::IsReverse(), Detector::kFar, Detector::kNear, BfldHandler::SetCache(), SetGridHandler(), BfldHandler::SetLastPolygAsSeed(), and VldRange::TrimTo().

Referenced by BField().

00214 {
00215    // for any given VldContext we *should* look up coil status + current
00216  
00217    fVldContext = vldc;
00218    Detector::Detector_t det = vldc.GetDetector();
00219 
00220    VldTimeStamp start = VldTimeStamp::GetBOT();
00221    VldTimeStamp end   = VldTimeStamp::GetEOT();
00222    fVldRange = VldRange(det,vldc.GetSimFlag(),start,end,"");
00223 
00224    if (!fHandler) SetGridHandler(vldc.GetDetector(),-1);
00225 
00226    if (fCache) fCache->DecrementRef(); // unreference previous cache, if any
00227    
00228    // attach a cache we get from a loan pool
00229    fCache = fLoanPool->GetCache(fVldContext);
00230    fCache->IncrementRef();  // let cache know we have a pointer to it
00231    fVldRange.TrimTo(fCache->GetVldRange());
00232 
00233    fHandler->SetCache(fCache);
00234    fHandler->SetLastPolygAsSeed();
00235 
00236    fNoField   = false;
00237    fPowerOff  = false;
00238    fDegaussed = false;
00239 
00240    // here we determine the coil current and whether the detector
00241    // is degaussed (if I=0).  Do it early as special cases 
00242    // (eg. collar/coil or interplane ) might need it.
00243 
00244    // rwh: for now we just say get ready to multiply by 1.0
00245    switch (fVldContext.GetDetector()) {
00246    // nominal values in Amp-turns
00247    case Detector::kNear: 
00248      fCoilCurrent = 40.0 * 1000.;  // nominal "on" value
00249      if ( fUseDCSCurrent ) {
00250        std::pair<Float_t,Float_t> currents = CoilTools::CoilCurrent(vldc);
00251        fCoilCurrent = 8.0 * TMath::Abs(currents.first); // 8 planks * ~ -4973A
00252      }
00253      break;
00254    case Detector::kFar:
00255      fCoilCurrent = 15.2 * 1000.;  // nominal "on" value
00256      if ( fUseDCSCurrent ) {
00257        std::pair<Float_t,Float_t> currents = CoilTools::CoilCurrent(vldc);
00258        Float_t avg_cur = 0.5 * (currents.first+currents.second);
00259        fCoilCurrent = 190 * TMath::Abs(avg_cur); // 190 turns * ~ 80A
00260      }
00261      break;
00262    default:
00263      fCoilCurrent = 0.0;
00264      fNoField = true;
00265    }
00266    // should scale fCoilCurrent by ratio of readback to nominal
00267    // from DCS readback for non-saturated part of field ...
00268 
00269    // UseDcsCoilDir
00270    //   0 = no   (use sign of map's scale factor, but not CoilTools)
00271    //   1 = yes  (ignore map's scale factor sign)
00272    //   2 = yes  (use sign of map's scale factor)
00273 
00274    //         coiltools   abs(mapfactor)   extra
00275    //   0 000    no          no            +1
00276    //   1 001    yes         yes           +1   = default
00277    //   2 010    yes         no            +1
00278    //   3 011    no          yes           +1
00279    //
00280    //   4 100    no          no            -1
00281    //   5 101    yes         yes           -1   = force reverse
00282    //   6 110    yes         no            -1
00283    //   7 111    no          yes           -1
00284    //      ignore mapfactor sign := ((UseDcsCoilDir&1)==1)
00285    // UseDcsCurrent
00286    //   0 = don't depend on read back current
00287    //   1 = scale by CoilTools::Current/map_current
00288    //       (but CoilTools::IsOK() required or B=0)
00289    //       assumes a linear dependence (ugh)
00290 
00291    if ( fUseDCSCoilDir == 1 || fUseDCSCoilDir == 2 || 
00292         fUseDCSCoilDir == 5 || fUseDCSCoilDir == 6     ) {
00293      if ( ! fUseDCSCurrent && ! CoilTools::IsOK(vldc)) fCoilCurrent = 0.0;
00294      else if (CoilTools::IsReverse(vldc)) fCoilCurrent = -fCoilCurrent;
00295    }
00296    if ( fUseDCSCoilDir >= 4 ) fCoilCurrent = -fCoilCurrent; 
00297 }

void BField::SetDoBHCorrection ( Int_t  ival  )  [inline]

Definition at line 68 of file BField.h.

References fDoBHCorrection.

00068 { fDoBHCorrection     = ival; }

void BField::SetDoInterPlaneField ( Int_t  ival  )  [inline]

Definition at line 70 of file BField.h.

References fDoInterPlaneField.

00070 { fDoInterPlaneField  = ival; }

void BField::SetDoLocalTransform ( Int_t  iflg  ) 

Definition at line 821 of file BField.cxx.

References fCache, and BfldCache::SetDoLocalTransform().

00822 { 
00823   // Just pass along the value
00824   // NOTE: this can affect other BField objects that share the same cache!
00825   fCache->SetDoLocalTransform(iflg); 
00826 } 

void BField::SetDoSlotCorrection ( Int_t  ival  )  [inline]

Definition at line 69 of file BField.h.

References fDoSlotCorrection.

00069 { fDoSlotCorrection   = ival; }

void BField::SetDoSMGapAndEndField ( Int_t  ival  )  [inline]

Definition at line 71 of file BField.h.

References fDoSMGapAndEndField.

00071 { fDoSMGapAndEndField = ival; }

void BField::SetGridHandler ( Detector::Detector_t  detector,
Int_t  coarseness 
) [virtual]

Definition at line 358 of file BField.cxx.

References fGrid, fHandler, fLastMapVariant, BfldGrid::GetGrid(), BfldInterpMethod::kDefault, BfldGrid::kRect2dGrid, and SetInterpMethod().

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

00359 {
00360    // translate Detector and "coarseness" into Grid enum
00361    fGrid = BfldGrid::GetGrid(detector,coarseness);
00362    
00363    // attach a BfldHandler (delete old if there is one)
00364    if (fHandler) { delete fHandler; fHandler = 0; }
00365 
00366    // check for special case of "rect2d" grid request
00367    if ( BfldGrid::kRect2dGrid == fGrid ) {
00368       // attach a special handler
00369       fHandler = new BfldHandlerRect2d;
00370    } else {
00371       fHandler = new BfldHandlerVoronoi;
00372    }
00373 
00374    // set the default interpolation method
00375    // BField's method simply passes on message to BFLHandler
00376    SetInterpMethod(BfldInterpMethod::kDefault);
00377 
00378    fLastMapVariant = kNoMapUsed;
00379 
00380 }

void BField::SetInterpMethod ( BfldInterpMethod::InterpMethod_t  method  )  [virtual]
void BField::SetNoFieldBeyondZ ( Double_t  z  )  [inline]

Definition at line 83 of file BField.h.

References fNoFieldBeyondZ.

00083 { fNoFieldBeyondZ = z; }

void BField::SetRequireInZTest ( Int_t  ival  ) 

Definition at line 828 of file BField.cxx.

References fCache, and BfldCache::SetRequireInZTest().

00829 { 
00830   // Just pass along the value
00831   // NOTE: this can affect other BField objects that share the same cache!
00832   fCache->SetRequireInZTest(ival); 
00833 } 

BfldMap * BField::SetupHandlerForMap ( Int_t  mapVariant  )  [protected]

Definition at line 618 of file BField.cxx.

References fGrid, fHandler, fLastMapVariant, fLoanPool, BfldLoanPool::GetMap(), BfldHandler::GetMap(), BfldLoanPool::GetMesh(), BfldHandler::SetMap(), and BfldHandler::SetMesh().

Referenced by GetBField().

00619 {
00620   // Ensure that the BfldHandler is properly configured
00621   // 
00622   if ( fLastMapVariant != mapVariant ) {
00623     //
00624     // map and/or grid has changed ... reinitialize handler
00625     //
00626 
00627     // Get the right base field map
00628     BfldMap  *bmap = fLoanPool->GetMap(fGrid,mapVariant);
00629     fHandler->SetMap(bmap);
00630     
00631     // Get the right Mesh diagram from the LoanPool
00632     // Give our BfldHandler a pointer to the v-diagram
00633     BfldMesh *mesh  = fLoanPool->GetMesh(fGrid,mapVariant);
00634     fHandler->SetMesh(mesh);
00635     
00636     
00637     fLastMapVariant = mapVariant;
00638     
00639   }  // map variant configured
00640   
00641   return fHandler->GetMap();
00642 }

void BField::SetUseDCSCoilDir ( Int_t  ival  )  [inline]

Definition at line 72 of file BField.h.

References fUseDCSCoilDir.

00072 { fUseDCSCoilDir      = ival; }

void BField::SetUseDCSCurrent ( Int_t  ival  )  [inline]

Definition at line 73 of file BField.h.

References fUseDCSCurrent.

00073 { fUseDCSCurrent      = ival; }

void BField::SetZTolerance ( Double_t  zeps  ) 

Definition at line 835 of file BField.cxx.

References fCache, and BfldCache::SetZTolerance().

00836 {
00837   // Just pass along the value
00838   // NOTE: this can affect other BField objects that share the same cache!
00839   fCache->SetZTolerance(zeps);
00840 }

TVector3 BField::SMGapAndEndField ( const TVector3 &  pos,
Ugli::SMRegion_t  iregion 
) [inline, protected]

Definition at line 178 of file BField.h.

References det, fVldContext, VldContext::GetDetector(), Detector::kFar, Detector::kNear, SMGapAndEndFieldFar(), and SMGapAndEndFieldNear().

Referenced by GetBField().

00180 {
00181   Detector::Detector_t det = fVldContext.GetDetector();
00182   switch (det) {
00183   case Detector::kNear: return SMGapAndEndFieldNear(pos,iregion);
00184   case Detector::kFar:  return SMGapAndEndFieldFar(pos,iregion);
00185   default:              return TVector3(0,0,0);
00186   }
00187 }

TVector3 BField::SMGapAndEndFieldFar ( const TVector3 &  pos,
Ugli::SMRegion_t  iregion 
) [protected]

Definition at line 785 of file BField.cxx.

References bfld::AsString(), Msg::kWarning, MAXMSG, and zeroBfld().

Referenced by SMGapAndEndField().

00787 {
00788   // Return the field in the region up-/down- stream of detector
00789   // or in the gap between the supermodules
00790   // don't forget to check fIsUVZ
00791 
00792   //int w=9, p=4; // 1mm precision
00793   //int prec = cout.precision(); // hopefully this is the right output stream 
00794   MAXMSG("Bfld",Msg::kWarning,20)
00795     << "BField::SMGapAndEndFieldFar "
00796     << std::endl
00797     << "not yet implemented for SMRegion " << Ugli::AsString(iregion) << " @ "
00798     << bfld::AsString(position)
00799     //<< "[" << setw(w)   << setprecision(p) << position.x()
00800     //<< "," << setw(w)   << setprecision(p) << position.y()
00801     //<< "," << setw(w+1) << setprecision(p) << position.z()
00802     //<< "]"
00803     //<< resetiosflags(ios::floatfield)  // reset to "%g" format
00804     // << setprecision(prec)              // restore precision
00805     << std::endl;
00806   return zeroBfld;
00807 
00808 }

TVector3 BField::SMGapAndEndFieldNear ( const TVector3 &  pos,
Ugli::SMRegion_t  iregion 
) [protected]

Definition at line 760 of file BField.cxx.

References bfld::AsString(), Msg::kWarning, MAXMSG, and zeroBfld().

Referenced by SMGapAndEndField().

00762 {
00763   // Return the field in the region up-/down- stream of detector
00764   // don't forget to check fIsUVZ
00765 
00766   //int w=9, p=4; // 1mm precision
00767   //int prec = cout.precision(); // hopefully this is the right output stream 
00768   MAXMSG("Bfld",Msg::kWarning,20)
00769     << "BField::SMGapAndEndFieldNear "
00770     << endl
00771     << "not yet implemented for SMRegion " << Ugli::AsString(iregion) << " @ "
00772     << bfld::AsString(position)
00773     //<< "[" << setw(w)   << setprecision(p) << position.x()
00774     //<< "," << setw(w)   << setprecision(p) << position.y()
00775     //<< "," << setw(w+1) << setprecision(p) << position.z()
00776     //<< "]"
00777     //<< resetiosflags(ios::floatfield)  // reset to "%g" format
00778     //<< setprecision(prec)              // restore precision
00779     << std::endl;
00780   return zeroBfld;
00781 
00782 }


Member Data Documentation

Int_t BField::fApplyBdotScale [protected]

Definition at line 159 of file BField.h.

Referenced by GetBField(), InitFlagsFromLoanPool(), operator=(), and Print().

BfldCache* BField::fCache [protected]
Double_t BField::fCoilCurrent [protected]

Definition at line 123 of file BField.h.

Referenced by GetBField(), Print(), and ResetVldContext().

Definition at line 125 of file BField.h.

Referenced by ApplyBHFactorCorr(), ApplySlotFactorCorr(), and GetBField().

Bool_t BField::fDegaussed [protected]

Definition at line 122 of file BField.h.

Referenced by GetBField(), Print(), and ResetVldContext().

Int_t BField::fDoBHCorrection [protected]
Int_t BField::fDoInterPlaneField [protected]
Int_t BField::fDoSlotCorrection [protected]
Int_t BField::fDoSMGapAndEndField [protected]
Int_t BField::fGapLineSrc [protected]

Definition at line 156 of file BField.h.

Referenced by GetBField(), InitFlagsFromLoanPool(), operator=(), and Print().

Definition at line 111 of file BField.h.

Referenced by Init(), operator=(), Print(), SetGridHandler(), and SetupHandlerForMap().

Int_t BField::fLastMapVariant [protected]

Definition at line 127 of file BField.h.

Referenced by Init(), operator=(), SetGridHandler(), and SetupHandlerForMap().

Bool_t BField::fNoField [protected]

Definition at line 108 of file BField.h.

Referenced by BField(), GetBField(), Init(), operator=(), Print(), and ResetVldContext().

Double_t BField::fNoFieldBeyondZ [protected]
Double_t BField::fOverallScale [protected]

Definition at line 161 of file BField.h.

Referenced by GetBField(), InitFlagsFromLoanPool(), operator=(), and Print().

Definition at line 126 of file BField.h.

Referenced by BField(), GetBField(), Init(), and ~BField().

Bool_t BField::fPositionIsUVZ [protected]

Definition at line 120 of file BField.h.

Referenced by GetBField(), and Print().

Bool_t BField::fPowerOff [protected]

Definition at line 121 of file BField.h.

Referenced by GetBField(), Print(), and ResetVldContext().

Int_t BField::fUseDCSCoilDir [protected]
Int_t BField::fUseDCSCurrent [protected]
Int_t BField::fUseEverywhere [protected]

Definition at line 167 of file BField.h.

Referenced by BField(), GetBField(), Init(), and operator=().

Definition at line 110 of file BField.h.

Referenced by BField(), GetVldRange(), Init(), operator=(), Print(), and ResetVldContext().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1