Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

BfldCache Class Reference

#include <BfldCache.h>

List of all members.

Public Member Functions

 BfldCache ()
 BfldCache (const VldContext &vldc)
virtual ~BfldCache ()
VldRange GetVldRange () const
const BfldDbiPlaneMapFindPlaneMap (TVector3 &position, Bool_t isUVZ=false)
Bool_t FindWasInSteel (Bool_t lie=true) const
 the next three methods should only be called after FindPlaneMap()
TVector3 GetPositionInSteel () const
UgliSteelPlnHandle GetCurrentSteelPlnHandle () const
Ugli::SMRegion_t InSMRegion (const TVector3 &pos, Bool_t isUVZ)
Ugli::XYRegion_t InXYRegion (const TVector3 &pos, Bool_t isUVZ)
Int_t GetDoLocalTransform () const
Int_t GetRequireInZTest () const
Double_t GetZTolerance () const
void SetDoLocalTransform (Int_t flg)
void SetRequireInZTest (Int_t ival)
void SetZTolerance (Double_t zeps)
virtual void Print (Option_t *option="") const
void IncrementRef ()
void DecrementRef ()
Int_t CountRef ()

Static Public Member Functions

Int_t GetDefaultMapVariant (const VldContext &vldc)
Double_t GetDefaultScale (const VldContext &vldc)

Protected Member Functions

void InitFlags ()
void SetSteelAndPlaneMapCache (TVector3 &position, Bool_t isUVZ=false)
void SetSteelLimits ()
void SetPlaneMapCache (PlexPlaneId steelid)
void InvalidateCaches ()
void FillSMZLimits ()

Private Attributes

Detector::Detector_t fDetector
VldRange fVldRange
Int_t fRef
UgliGeomHandle fUgliGeomHandle
 outstanding references
UgliSteelPlnHandle fSteelCache
 reference geometry
Double_t fSteelZmin
 last steel used
Double_t fSteelZmax
 zmin last steel
Int_t fDoLocalTransform
 zmax last steel
Int_t fInZTest
Double_t fZTolerance
DbiResultPtr< BfldDbiPlaneMapfPlaneMaps
 dz tolerance
Int_t fDbiMapEntries
 specifics about each plane
const BfldDbiPlaneMapfPlaneMapCache
 avoid GetNumRows
Bool_t fFindWasInSteel
 last planemap used
TVector3 fPosInSteel
 last position in steel?
Double_t fSMZLimits [4]
 last position in steel
Int_t fWasHigh
Int_t fWasLow
Double_t fSumHigh
Double_t fSumLow


Constructor & Destructor Documentation

BfldCache::BfldCache  ) 
 

Definition at line 55 of file BfldCache.cxx.

References InitFlags(), and MSG.

00056   : fRef(0), fSteelCache(), fSteelZmin(+9999.), fSteelZmax(-9999.),
00057     fDbiMapEntries(0), fPlaneMapCache(0)
00058 {
00059    MSG("Bfld",Msg::kDebug) << "BfldCache - default ctor" << endl;
00060    InitFlags();
00061 }

BfldCache::BfldCache const VldContext vldc  ) 
 

Definition at line 64 of file BfldCache.cxx.

References fDetector, FillSMZLimits(), fPlaneMaps, fUgliGeomHandle, fVldRange, VldContext::GetSimFlag(), DbiResultPtr< T >::GetValidityRec(), DbiValidityRec::GetVldRange(), UgliGeomHandle::GetVldRange(), InitFlags(), MSG, and VldRange::TrimTo().

00065   : fDetector(vldc.GetDetector()), fRef(0), fUgliGeomHandle(vldc),
00066     fSteelCache(), fSteelZmin(+9999.), fSteelZmax(-9999.), 
00067     fDoLocalTransform(0), fInZTest(0), fZTolerance(0),
00068     fPlaneMaps(vldc,0,Dbi::kDisabled),
00069     fDbiMapEntries(fPlaneMaps.GetNumRows()),
00070     fPlaneMapCache(0), 
00071     fFindWasInSteel(false), fPosInSteel(-999.,-999.,-9999.),
00072     fWasHigh(0), fWasLow(0), fSumHigh(0), fSumLow(0)
00073 {
00074    InitFlags();
00075    fVldRange = fUgliGeomHandle.GetVldRange();
00076    MSG("Bfld",Msg::kDebug) << " BfldCache vldc " << vldc 
00077                            << "  geometry " << fVldRange << endl;
00078    const DbiValidityRec* dbivrec = fPlaneMaps.GetValidityRec();
00079    if (dbivrec) {
00080      fVldRange.TrimTo(dbivrec->GetVldRange());
00081      MSG("Bfld",Msg::kDebug) << "BfldCache range trimed to " 
00082                              << fVldRange << endl;
00083    }
00084 
00085    if ( Detector::kUnknown == fDetector ) {
00086      // this happens for the case of UseEverywhere
00087      VldTimeStamp start = VldTimeStamp(1970, 1, 1, 0, 0, 0);
00088      VldTimeStamp end   = VldTimeStamp(2038, 1,18,19,14, 6);
00089      fVldRange = VldRange(fDetector,
00090                           vldc.GetSimFlag(),
00091                           start,
00092                           end,
00093                           "fake");
00094      MSG("Bfld",Msg::kDebug) << "BfldCache ctor with no detector "  << endl;
00095    }
00096    
00097    FillSMZLimits(); 
00098 }

BfldCache::~BfldCache  )  [virtual]
 

Definition at line 120 of file BfldCache.cxx.

References fRef, fSumHigh, fSumLow, fUgliGeomHandle, fWasHigh, fWasLow, UgliGeomHandle::GetVldRange(), and MSG.

00121 {
00122   if (fRef) {
00123     MSG("Bfld",Msg::kInfo) << "~BfldCache with " << fRef 
00124                            << " outstanding references." << endl
00125                            << "     using geometry" 
00126                            << fUgliGeomHandle.GetVldRange() << endl;
00127 
00128   }
00129   MSG("Bfld",Msg::kDebug) << "~BfldCache geometry" 
00130                           << fUgliGeomHandle.GetVldRange() << endl;
00131 
00132   Double_t avgHigh = 0;
00133   if (fWasHigh) avgHigh = fSumHigh/fWasHigh;
00134   Double_t avgLow = 0;
00135   if (fWasLow) avgLow = fSumLow/fWasLow;
00136 
00137   MSG("Bfld",Msg::kInfo) << "~BfldCache " 
00138                          << " z outside steel " 
00139                          << fWasHigh << " high avg=" << avgHigh << ", " 
00140                          << fWasLow << " low avg=" << avgLow << endl;
00141 
00142 
00143 }


Member Function Documentation

Int_t BfldCache::CountRef  )  [inline]
 

Definition at line 64 of file BfldCache.h.

Referenced by BfldLoanPool::GetCache().

00064 { return fRef; }

void BfldCache::DecrementRef  )  [inline]
 

Definition at line 63 of file BfldCache.h.

References fRef.

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

00063 { fRef--; }

void BfldCache::FillSMZLimits  )  [protected]
 

Definition at line 304 of file BfldCache.cxx.

References fDetector, fSMZLimits, fUgliGeomHandle, UgliSteelPlnHandle::GetHalfThickness(), UgliGeomHandle::GetSteelPlnHandle(), UgliSteelPlnHandle::GetZ0(), UgliSteelPlnHandle::IsValid(), PlexPlaneId::LastPlaneFarSM0(), PlexPlaneId::LastPlaneFarSM1(), and PlexPlaneId::LastPlaneNearSpect().

Referenced by BfldCache().

00305 {
00306    // Determine z range of SM
00307 
00308    fSMZLimits[0] = fSMZLimits[2] = -1.0e6;
00309    fSMZLimits[1] = fSMZLimits[3] = +1.0e6;
00310 
00311    int ipln[4] = { 0, 0, 0, 0};
00312 
00313    switch (fDetector) {
00314    case Detector::kFar: 
00315      {
00316        ipln[0] = 0;
00317        ipln[1] = PlexPlaneId::LastPlaneFarSM0();
00318        ipln[2] = PlexPlaneId::LastPlaneFarSM0()+1;
00319        ipln[3] = PlexPlaneId::LastPlaneFarSM1();
00320        break;
00321      }
00322    case Detector::kNear:
00323      {
00324        ipln[0] = 0;
00325        ipln[1] = PlexPlaneId::LastPlaneNearSpect();
00326        ipln[2] = PlexPlaneId::LastPlaneNearSpect();
00327        ipln[3] = PlexPlaneId::LastPlaneNearSpect();
00328        break;
00329      }
00330    default:
00331      {
00332        return; // ! no SM at all, use defaults
00333      }
00334    }
00335 
00336    for (int indx = 0; indx < 4; ++indx) {
00337      PlexPlaneId steelid(fDetector,ipln[indx],true);
00338      UgliSteelPlnHandle uph = fUgliGeomHandle.GetSteelPlnHandle(steelid);
00339      if ( ! uph.IsValid() ) continue; // in case of no geometry
00340      Double_t dz = uph.GetHalfThickness();
00341      if ( 0 == indx || 2 == indx ) dz = -dz;
00342      fSMZLimits[indx] = uph.GetZ0() + dz;
00343    }
00344 
00345 }

const BfldDbiPlaneMap * BfldCache::FindPlaneMap TVector3 &  position,
Bool_t  isUVZ = false
 

Definition at line 146 of file BfldCache.cxx.

References SetSteelAndPlaneMapCache().

Referenced by BField::GetBField().

00148 {
00149    SetSteelAndPlaneMapCache(position,isUVZ);
00150    return fPlaneMapCache;
00151 }

Bool_t BfldCache::FindWasInSteel Bool_t  lie = true  )  const [inline]
 

the next three methods should only be called after FindPlaneMap()

Definition at line 107 of file BfldCache.h.

References fInZTest.

Referenced by BField::GetBField().

00108 { 
00109   if ( lie && fInZTest < 2 ) return true;
00110   return fFindWasInSteel; 
00111 }

UgliSteelPlnHandle BfldCache::GetCurrentSteelPlnHandle  )  const [inline]
 

Definition at line 41 of file BfldCache.h.

Referenced by BField::GetBField().

00041                                                             { return fSteelCache; 
00042 }

Int_t BfldCache::GetDefaultMapVariant const VldContext vldc  )  [static]
 

Definition at line 444 of file BfldCache.cxx.

References VldContext::GetDetector(), and VldContext::GetSimFlag().

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

00445 {
00446    // Return default map (for context)
00447 
00448   // no real data ...
00449   Int_t indx = 0;
00450   Int_t variant;
00451   switch (vldc.GetDetector()) {
00452   case (Detector::kNear):
00453     {
00454       switch (vldc.GetSimFlag()) {
00455       case (SimFlag::kMC):
00456       case (SimFlag::kReroot):
00457         variant = (indx==0) ? 160 : 0; break;
00458       default:
00459         variant = (indx==0) ? 160 : 0; break;
00460       }
00461       break;
00462     }
00463   case (Detector::kFar):
00464     {
00465       switch (vldc.GetSimFlag()) {
00466       case (SimFlag::kMC):
00467       case (SimFlag::kReroot):
00468         variant = (indx==0) ? 208 : 0; break;
00469       default:
00470         variant = (indx==0) ? 208 : 0; break;
00471       }
00472       break;
00473     }
00474   default:                      variant =    0; break;
00475   } 
00476 
00477   return variant;
00478 }

Double_t BfldCache::GetDefaultScale const VldContext vldc  )  [static]
 

Definition at line 481 of file BfldCache.cxx.

References VldContext::GetDetector().

Referenced by BField::GetBField().

00482 {
00483    // Lookup scale factor for this plane
00484 
00485   // no real data ...
00486   Double_t scale;
00487   switch (vldc.GetDetector()) {
00488   case (Detector::kNear):   scale =  1.0; break;
00489   case (Detector::kFar):    scale =  1.0; break;
00490   default:                      scale =    0; break;
00491   } 
00492 
00493   return scale;
00494 }

Int_t BfldCache::GetDoLocalTransform  )  const [inline]
 

Definition at line 53 of file BfldCache.h.

Referenced by BField::GetBField(), and BField::GetDoLocalTransform().

00053 { return fDoLocalTransform; }

TVector3 BfldCache::GetPositionInSteel  )  const [inline]
 

Definition at line 40 of file BfldCache.h.

Referenced by BField::GetBField().

00040 { return fPosInSteel; }

Int_t BfldCache::GetRequireInZTest  )  const [inline]
 

Definition at line 54 of file BfldCache.h.

Referenced by BField::GetRequireInZTest().

00054 { return fInZTest; }

VldRange BfldCache::GetVldRange  )  const [inline]
 

Definition at line 35 of file BfldCache.h.

Referenced by BfldLoanPool::GetCache(), and BField::ResetVldContext().

00035 { return fVldRange; }

Double_t BfldCache::GetZTolerance  )  const [inline]
 

Definition at line 55 of file BfldCache.h.

Referenced by BField::GetZTolerance().

00055 { return fZTolerance; }

void BfldCache::IncrementRef  )  [inline]
 

Definition at line 62 of file BfldCache.h.

References fRef.

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

00062 { fRef++; }

void BfldCache::InitFlags  )  [protected]
 

Definition at line 101 of file BfldCache.cxx.

References fDoLocalTransform, fInZTest, fZTolerance, BfldLoanPool::GetDefaultDoLocalTransform(), BfldLoanPool::GetDefaultRequireInZTest(), BfldLoanPool::GetDefaultZTolerance(), BfldLoanPool::Instance(), and MSG.

Referenced by BfldCache().

00102 {
00103    // Initialize configuration flags from BfldLoanPool
00104 
00105    // get access to the BfldLoanPool
00106    BfldLoanPool *loanpool = BfldLoanPool::Instance();
00107 
00108    fDoLocalTransform = loanpool->GetDefaultDoLocalTransform();
00109    fInZTest          = loanpool->GetDefaultRequireInZTest();
00110    fZTolerance       = loanpool->GetDefaultZTolerance();
00111    MSG("Bfld",Msg::kSynopsis)
00112      << "BfldCache DoLocalTransform=" << fDoLocalTransform 
00113      << " InZTest=" << fInZTest
00114      << " ZTolerance=" << (fZTolerance/Munits::mm) << "mm"
00115      << endl;
00116 
00117 }

Ugli::SMRegion_t BfldCache::InSMRegion const TVector3 &  pos,
Bool_t  isUVZ
 

Definition at line 348 of file BfldCache.cxx.

References fSMZLimits, and InXYRegion().

Referenced by BField::GetBField().

00349 {
00350    // Determine if the this position is within the SuperModules
00351    // If in XY region of "flange" then consider it part of SM if
00352    // within dz of SM.
00353    // Return:
00354    //      -1 = upstream
00355    //       1 = in SM1
00356    //       0 = in gap
00357    //       2 = in SM2
00358    //      -2 = downstream
00359 
00360    Double_t dz = 3.4 * Munits::cm;  // extra z in the area of the collar
00361 
00362    Double_t z = pos.Z();
00363 
00364    // definitely in a SM
00365    if ( z >= fSMZLimits[0] && z <= fSMZLimits[1] ) return Ugli::kInSM1; // 1
00366    if ( z >= fSMZLimits[2] && z <= fSMZLimits[3] ) return Ugli::kInSM2; // 2
00367 
00368    // definitely not in a SM
00369    if ( z < fSMZLimits[0]-dz ) return Ugli::kUpstream;   // -1
00370    if ( z > fSMZLimits[1]+dz && z < fSMZLimits[2]-dz ) return Ugli::kSMGap; // 0
00371    if ( z > fSMZLimits[3]+dz ) return Ugli::kDownstream; // -2
00372 
00373    // in region where flange might be part of SM
00374    bool inFlange = ( InXYRegion(pos,isUVZ) <= Ugli::kFlange );
00375    if ( z < fSMZLimits[0] ) {
00376      if ( inFlange ) return Ugli::kInSM1;      //  1
00377      else            return Ugli::kUpstream  ; // -1;
00378    }
00379    if ( Detector::kNear == fDetector ) {
00380      if ( inFlange ) return Ugli::kInSM1;      //  1
00381      else            return Ugli::kDownstream; // -2;
00382    } else { // far
00383      if ( z > fSMZLimits[3] ) {
00384        if ( inFlange ) return Ugli::kInSM2;      //  2;
00385        else            return Ugli::kDownstream; // -2;
00386      }
00387      // FarDet gap
00388      if ( ! inFlange ) return Ugli::kSMGap; // 0;
00389      if ( z < 0.5*(fSMZLimits[1]+fSMZLimits[2]) ) return Ugli::kInSM1; // 1
00390      else                                         return Ugli::kInSM2; // 2
00391    }
00392    return Ugli::kSMGap; // 0
00393 }

void BfldCache::InvalidateCaches  )  [protected]
 

Definition at line 202 of file BfldCache.cxx.

References fPlaneMapCache, fSteelCache, fSteelZmax, and fSteelZmin.

00203 {
00204    // Invalidate fSteelCache, fSteelZmin/max, fPlaneMapCache
00205    fSteelCache    = UgliSteelPlnHandle();
00206    fSteelZmin     = +9999.;
00207    fSteelZmax     = -9999.;
00208    fPlaneMapCache = 0;
00209 
00210 }

Ugli::XYRegion_t BfldCache::InXYRegion const TVector3 &  pos,
Bool_t  isUVZ
 

Definition at line 396 of file BfldCache.cxx.

References fDetector, and Ugli::xy2uv().

Referenced by InSMRegion().

00397 {
00398   // Determine if x-y is outside flange area ...
00399   // NearDet is square in UV, diamond in XY
00400   // FarDet is round
00401 
00402   // this should really be part of UgliGeom
00403 
00404   // inside "coil" return 0... not implemented yet
00405   const Double_t rCoil    = 0.0;  // inside this return 0
00406   const Double_t rThroat  = 13.0 * Munits::cm; // inside this return 1
00407   const Double_t rNeck    = 14.0 * Munits::cm; // inside this return 2
00408   const Double_t rHole    = 15.0 * Munits::cm; // inside this return 3
00409   const Double_t rFlange  = 17.0 * Munits::cm; // inside this return 4
00410   // outside return 5
00411 
00412   Double_t rlimit[5] = { rCoil, rThroat, rNeck, rHole, rFlange };
00413   int indx;
00414 
00415   switch (fDetector) {
00416   case Detector::kNear:
00417     {
00418       Double_t u, v;
00419       if (isUVZ) {
00420         u = pos.X();
00421         v = pos.Y();
00422       } else {
00423         Ugli::xy2uv(fDetector,pos.X(),pos.Y(),u,v);
00424       }
00425       for ( indx = Ugli::kCoil; indx <= Ugli::kFlange; ++indx ) {
00426         if ( TMath::Abs(u) < rlimit[indx] &&
00427              TMath::Abs(v) < rlimit[indx]     ) return (Ugli::XYRegion_t)indx;
00428       }
00429       break;
00430     }
00431   case Detector::kFar:
00432     {
00433       Double_t r = pos.Perp();
00434       for ( indx = Ugli::kCoil; indx <= Ugli::kFlange; ++indx ) {
00435         if ( r < rlimit[indx] ) return (Ugli::XYRegion_t)indx;
00436       }
00437     }
00438   default:
00439     return Ugli::kSteel;
00440   }
00441   return Ugli::kSteel;
00442 }

void BfldCache::Print Option_t *  option = ""  )  const [virtual]
 

Definition at line 497 of file BfldCache.cxx.

References fDoLocalTransform, fInZTest, fRef, fVldRange, fZTolerance, and MSG.

Referenced by BfldLoanPool::Print(), and BField::Print().

00498 {
00499   MSG("Bfld",Msg::kInfo) 
00500     << " RefCnt=" << setw(2) << fRef
00501     << " " << fVldRange << endl
00502     << "       DoLocalTransform=" << fDoLocalTransform
00503     << "    InZTest=" << fInZTest
00504     << "    ZTolerance=" << (fZTolerance/Munits::mm) << "mm"
00505     << endl;
00506 }

void BfldCache::SetDoLocalTransform Int_t  flg  )  [inline]
 

Definition at line 56 of file BfldCache.h.

References fDoLocalTransform.

Referenced by BField::SetDoLocalTransform().

00056 { fDoLocalTransform = flg; }

void BfldCache::SetPlaneMapCache PlexPlaneId  steelid  )  [protected]
 

Definition at line 184 of file BfldCache.cxx.

References fDbiMapEntries, fPlaneMapCache, fPlaneMaps, PlexPlaneId::GetPlane(), BfldDbiPlaneMap::GetPlaneId(), and DbiResultPtr< T >::GetRowByIndex().

Referenced by SetSteelAndPlaneMapCache().

00185 {
00186    // Fill fPlaneMapCache entry for this steel
00187 
00188    // avoid DBI lookup if possible
00189    if ( fPlaneMapCache && fPlaneMapCache->GetPlaneId() == steelid) return;
00190 
00191    fPlaneMapCache = 0;
00192 
00193    if (fDbiMapEntries > 0) {
00194      const BfldDbiPlaneMap* planemap = 
00195        fPlaneMaps.GetRowByIndex(steelid.GetPlane());
00196     
00197      if (planemap) fPlaneMapCache = planemap;
00198    }
00199 }

void BfldCache::SetRequireInZTest Int_t  ival  )  [inline]
 

Definition at line 57 of file BfldCache.h.

References fInZTest.

Referenced by BField::SetRequireInZTest().

00057 { fInZTest = ival; }

void BfldCache::SetSteelAndPlaneMapCache TVector3 &  position,
Bool_t  isUVZ = false
[protected]
 

Definition at line 213 of file BfldCache.cxx.

References BFieldOutsideZ(), BFieldWithinZ(), fDoLocalTransform, fFindWasInSteel, fInZTest, fPosInSteel, fSteelCache, fSteelZmax, fSteelZmin, fSumHigh, fSumLow, fUgliGeomHandle, fWasHigh, fWasLow, UgliSteelPlnHandle::GetHalfThickness(), UgliGeomHandle::GetNearestSteelPlnHandle(), UgliPlnHandle::GetPlexPlaneId(), UgliSteelPlnHandle::GetZ0(), UgliSteelPlnHandle::GlobalToLocal(), UgliSteelPlnHandle::IsValid(), MAXMSG, MSG, SetPlaneMapCache(), and SetSteelLimits().

Referenced by FindPlaneMap().

00214 {
00215    // Fill fSteelCache and PlaneMap entry for this position.
00216    // Assumes that B is only important within steel
00217    // Assumes that the plane is perpendicular to z direction
00218    // i.e. no rotation out of the x-y plane
00219 
00220    fFindWasInSteel = true;
00221    Double_t z = posGlobal.z();
00222 
00223    // Try the cache first
00224    if ( fSteelCache.IsValid() && BFieldWithinZ(z,fSteelZmin,fSteelZmax) ) {
00225      //MSG("Bfld",Msg::kVerbose) 
00226      //  << "SetSteelAndPlaneMapCacheFromZ hit cache!" << endl;
00227    }
00228    else {
00229      // Ask the geometry
00230      fSteelCache = fUgliGeomHandle.GetNearestSteelPlnHandle(z);
00231      SetSteelLimits();
00232      SetPlaneMapCache(fSteelCache.GetPlexPlaneId());
00233      MSG("Bfld",Msg::kDebug) << "Asked geometry for NearestSteelPln " << endl;
00234 
00235      if ( ! fSteelCache.IsValid() ) 
00236        MSG("Bfld",Msg::kError) 
00237          << "Asked geometry for NearestSteelPln for z= " << z 
00238          << ", got invalid UgliGeomSteelPln" 
00239          << endl;
00240    }
00241 
00242    //MSG("Bfld",Msg::kInfo)
00243    //    << " posGlobal " << posGlobal << " fPosInSteel " 
00244    //    << fPosInSteel << endl;
00245 
00246 
00247    // InZTest:
00248    //   0 = no test that z is within range of a plane
00249    //   1 = return (nearest) valid UgliSteelPlnHandle, but complain
00250    //  >1 = return (nearest) valid UgliSteelPlnHandle (quietly)
00251    //       in this case set fPositionInSteel = false
00252    if ( fInZTest == 0) return;
00253    // DoLocalTransform:
00254    //   0 = no Global <--> Local transform
00255    //   1 = do only for shifts (ie.  Global->Local position but not field)
00256    //   2 = do for shifts and rotations (ie. transform returned field)
00257    if ( fDoLocalTransform <= 0 ) {
00258      fPosInSteel = posGlobal;
00259      if ( ! BFieldOutsideZ(z,fSteelZmin,fSteelZmax) ) return;
00260    } else {
00261      // use the in-the-steel local coord to determine if we're in "z"
00262      // note Ugli uses globalInXYZ, while BField uses isUVZ
00263      fPosInSteel = fSteelCache.GlobalToLocal(posGlobal,!isUVZ);
00264      Double_t hdzlimit = fSteelCache.GetHalfThickness()+FLT_EPSILON+fZTolerance;
00265      if ( TMath::Abs(fPosInSteel.z()) <= hdzlimit )  return;
00266    }
00267 
00268    // currently this returns "nearest steel" when outside the steel
00269    // but for coil we should always return either upstream or downstream
00270    // steel depending on Near/Far (which is which ... think hard)
00271    // be careful of falling off the ends
00272    fFindWasInSteel = false;
00273    
00274    if ( fInZTest < 2 ) {
00275      
00276      Double_t z0 = fSteelCache.GetZ0();
00277      Double_t ht = fSteelCache.GetHalfThickness();
00278      //Double_t dz = (z>z0) ? z-(z0+ht) : (z0-ht)-z;
00279      Double_t dz = 0;
00280      const char* side;
00281      if ( z > z0 ) {
00282        side = "high";
00283        dz = z-(z0+ht);
00284        fWasHigh++;
00285        fSumHigh += dz;
00286      } else {
00287        side = "low";
00288        dz = (z0-ht)-z;
00289        fWasLow++;
00290        fSumLow += dz;
00291      }
00292      
00293      MAXMSG("Bfld",Msg::kWarning,10) 
00294        << "Geom returned plane " << fSteelCache.GetPlexPlaneId() << endl
00295        << " but z " << z << " is not within " << ht << " of " << z0
00296        << " (" << dz << " too " << side << ")" << endl;
00297      
00298    }
00299    //if (fInZTest>1) InvalidateCaches();
00300 
00301 }   

void BfldCache::SetSteelLimits  )  [protected]
 

Definition at line 168 of file BfldCache.cxx.

References fSteelCache, fSteelZmax, fSteelZmin, UgliSteelPlnHandle::GetHalfThickness(), UgliSteelPlnHandle::GetZ0(), and UgliSteelPlnHandle::IsValid().

Referenced by SetSteelAndPlaneMapCache().

00169 {
00170    // Fill fSteelZmin/fSteelZmax for given fSteelCache
00171    if (fSteelCache.IsValid()) {
00172      Double_t z0 = fSteelCache.GetZ0();
00173      Double_t dz = fSteelCache.GetHalfThickness() + FLT_EPSILON + fZTolerance;
00174      fSteelZmin = z0 - dz;
00175      fSteelZmax = z0 + dz;
00176    }
00177    else {
00178      fSteelZmin = +9999.;
00179      fSteelZmax = -9999.;
00180    }
00181 }

void BfldCache::SetZTolerance Double_t  zeps  )  [inline]
 

Definition at line 58 of file BfldCache.h.

References fZTolerance.

Referenced by BField::SetZTolerance().

00058 { fZTolerance = zeps; }


Member Data Documentation

Int_t BfldCache::fDbiMapEntries [private]
 

specifics about each plane

Definition at line 91 of file BfldCache.h.

Referenced by SetPlaneMapCache().

Detector::Detector_t BfldCache::fDetector [private]
 

Definition at line 77 of file BfldCache.h.

Referenced by BfldCache(), FillSMZLimits(), and InXYRegion().

Int_t BfldCache::fDoLocalTransform [private]
 

zmax last steel

Definition at line 86 of file BfldCache.h.

Referenced by InitFlags(), Print(), SetDoLocalTransform(), and SetSteelAndPlaneMapCache().

Bool_t BfldCache::fFindWasInSteel [private]
 

last planemap used

Definition at line 94 of file BfldCache.h.

Referenced by SetSteelAndPlaneMapCache().

Int_t BfldCache::fInZTest [private]
 

Definition at line 87 of file BfldCache.h.

Referenced by FindWasInSteel(), InitFlags(), Print(), SetRequireInZTest(), and SetSteelAndPlaneMapCache().

const BfldDbiPlaneMap* BfldCache::fPlaneMapCache [private]
 

avoid GetNumRows

Definition at line 92 of file BfldCache.h.

Referenced by InvalidateCaches(), and SetPlaneMapCache().

DbiResultPtr<BfldDbiPlaneMap> BfldCache::fPlaneMaps [private]
 

dz tolerance

Definition at line 90 of file BfldCache.h.

Referenced by BfldCache(), and SetPlaneMapCache().

TVector3 BfldCache::fPosInSteel [private]
 

last position in steel?

Definition at line 95 of file BfldCache.h.

Referenced by SetSteelAndPlaneMapCache().

Int_t BfldCache::fRef [mutable, private]
 

Definition at line 79 of file BfldCache.h.

Referenced by DecrementRef(), IncrementRef(), Print(), and ~BfldCache().

Double_t BfldCache::fSMZLimits[4] [private]
 

last position in steel

Definition at line 97 of file BfldCache.h.

Referenced by FillSMZLimits(), and InSMRegion().

UgliSteelPlnHandle BfldCache::fSteelCache [private]
 

reference geometry

Definition at line 82 of file BfldCache.h.

Referenced by InvalidateCaches(), SetSteelAndPlaneMapCache(), and SetSteelLimits().

Double_t BfldCache::fSteelZmax [private]
 

zmin last steel

Definition at line 84 of file BfldCache.h.

Referenced by InvalidateCaches(), SetSteelAndPlaneMapCache(), and SetSteelLimits().

Double_t BfldCache::fSteelZmin [private]
 

last steel used

Definition at line 83 of file BfldCache.h.

Referenced by InvalidateCaches(), SetSteelAndPlaneMapCache(), and SetSteelLimits().

Double_t BfldCache::fSumHigh [private]
 

Definition at line 101 of file BfldCache.h.

Referenced by SetSteelAndPlaneMapCache(), and ~BfldCache().

Double_t BfldCache::fSumLow [private]
 

Definition at line 102 of file BfldCache.h.

Referenced by SetSteelAndPlaneMapCache(), and ~BfldCache().

UgliGeomHandle BfldCache::fUgliGeomHandle [private]
 

outstanding references

Definition at line 81 of file BfldCache.h.

Referenced by BfldCache(), FillSMZLimits(), SetSteelAndPlaneMapCache(), and ~BfldCache().

VldRange BfldCache::fVldRange [private]
 

Definition at line 78 of file BfldCache.h.

Referenced by BfldCache(), and Print().

Int_t BfldCache::fWasHigh [private]
 

Definition at line 99 of file BfldCache.h.

Referenced by SetSteelAndPlaneMapCache(), and ~BfldCache().

Int_t BfldCache::fWasLow [private]
 

Definition at line 100 of file BfldCache.h.

Referenced by SetSteelAndPlaneMapCache(), and ~BfldCache().

Double_t BfldCache::fZTolerance [private]
 

Definition at line 88 of file BfldCache.h.

Referenced by InitFlags(), Print(), and SetZTolerance().


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 05:30:27 2009 for loon by  doxygen 1.3.9.1