SwimGeo Class Reference

#include <SwimGeo.h>

List of all members.

Public Types

enum  ESwimMaterials {
  kAir = 0, kScint = 1, kIron = 2, kSteel = 2,
  kAluminum = 3, kCopper = 4, kWater = 5, kH20 = 5,
  kHydrogen = 6, kOxygen = 7, kCarbon = 8, kNitrogen = 9,
  kCoil_far = 10, kCoil_near = 11, kError = -1
}
typedef enum
SwimGeo::ESwimMaterials 
SwimMaterial_t

Public Member Functions

virtual ~SwimGeo ()
SwimPlaneInterfaceGetSteel (Double_t z, Int_t idir) const
SwimPlaneInterfaceGetScint (Double_t z, Int_t idir) const
SwimPlaneInterfaceGetInterface (Double_t z, Int_t idir, SwimGeo::SwimMaterial_t mat) const
SwimGeo::SwimMaterial_t GetSwimMaterial (const TVector3 xyz, bool zDir)
SwimGeo::SwimMaterial_t GetSwimMaterial (const TVector3 xyz, bool zDir, SwimStepData &stepdata)
Bool_t SetNextPlaneZ (const TVector3 xyz, bool zDir, SwimStepData &stepdata)
double DistToNextPlane (const TVector3 xyz, const TVector3 dxyz)
std::vector< std::pair
< Double_t, Double_t > > 
InitNearCoil ()
std::vector< std::pair
< Double_t, Double_t > > 
InitNearOuterCollar ()
std::vector< std::pair
< Double_t, Double_t > > 
InitNearInnerCollar ()
Bool_t IsInsideCoil (TVector3 xyz, Detector::Detector_t dt)
Bool_t IsInsideOuterCollar (TVector3 xyz, Detector::Detector_t dt)
Bool_t IsInsideInnerCollar (TVector3 xyz, Detector::Detector_t dt)
Bool_t IsInside (Double_t xp, Double_t yp, const std::vector< std::pair< Double_t, Double_t > > &v) const
const TObjArray & GetInterfaces () const
void Print (Option_t *option="") const

Static Public Member Functions

static SwimGeoInstance (const VldContext &vldc)
static double GetSwimMaterialDensity (SwimGeo::SwimMaterial_t mat)
static const char * AsString (SwimGeo::SwimMaterial_t mat)

Protected Member Functions

 SwimGeo (const VldContext &vldc)

Private Attributes

TObjArray fInterface
SwimPlaneInterfacefInterfaceList [5000]
int fNInterfaces
double fNextPlaneZ
VldRange fVldRange
VldContext fVld
Double_t fFarCoilRadius
Double_t fFarInnerCollarRadius
Double_t fFarOuterCollarRadius
Double_t fFarEndSM1Z
Double_t fFarBegSM2Z
Double_t fNearCoilLength
Double_t fNearOuterCollarLength
Double_t fNearInnerCollarLength
std::vector< std::pair
< Double_t, Double_t > > 
fNearCoil
std::vector< std::pair
< Double_t, Double_t > > 
fNearOuterCollar
std::vector< std::pair
< Double_t, Double_t > > 
fNearInnerCollar

Static Private Attributes

static SwimGeofInstance = 0

Detailed Description

Definition at line 28 of file SwimGeo.h.


Member Typedef Documentation


Member Enumeration Documentation

Enumerator:
kAir 
kScint 
kIron 
kSteel 
kAluminum 
kCopper 
kWater 
kH20 
kHydrogen 
kOxygen 
kCarbon 
kNitrogen 
kCoil_far 
kCoil_near 
kError 

Definition at line 33 of file SwimGeo.h.

00033                               {
00034     kAir   =     0,
00035     kScint =     1,
00036     kIron  =     2,
00037     kSteel =     2,
00038     kAluminum =  3,
00039     kCopper =    4,
00040     kWater =     5,
00041     kH20 =       5,
00042     kHydrogen =  6,
00043     kOxygen =    7,
00044     kCarbon =    8,
00045     kNitrogen =  9,
00046     kCoil_far  = 10,
00047     kCoil_near = 11,
00048     kError = -1
00049   } SwimMaterial_t;


Constructor & Destructor Documentation

virtual SwimGeo::~SwimGeo (  )  [inline, virtual]

Definition at line 51 of file SwimGeo.h.

00051 {;}

SwimGeo::SwimGeo ( const VldContext vldc  )  [protected]

Definition at line 76 of file SwimGeo.cxx.

References PlexPlaneId::AsString(), AsString(), Munits::cm, fFarBegSM2Z, fFarCoilRadius, fFarEndSM1Z, fFarInnerCollarRadius, fFarOuterCollarRadius, fInterface, fInterfaceList, fNearCoil, fNearCoilLength, fNearInnerCollar, fNearInnerCollarLength, fNearOuterCollar, fNearOuterCollarLength, fNInterfaces, fVld, fVldRange, UgliPlnHandle::GetHalfThickness(), PlexPlaneId::GetPlaneView(), UgliPlnHandle::GetPlexPlaneId(), UgliGeomHandle::GetPlnHandleVector(), UgliGeomHandle::GetVldRange(), UgliPlnHandle::GetZ0(), InitNearCoil(), InitNearInnerCollar(), InitNearOuterCollar(), MsgService::Instance(), PlexPlaneId::IsSteel(), PlaneView::kA, kAir, PlaneView::kB, Msg::kDebug, Msg::kFatal, kScint, kSteel, PlaneView::kUnknown, Munits::m, MSG, and Print().

Referenced by Instance().

00076                                        :
00077   fNInterfaces(0),
00078   fNextPlaneZ(0.0*Munits::m)
00079 {
00080   // Determine z positions of front/back of steel and scint planes.
00081   // Ignore planes not in U/V orientation ie. CalDet cosmic counters
00082   // and FarDet veto shield. But be careful that uninstrumented (bare) 
00083   // steel planes don't have a view and in general we want those.
00084 
00085   MSG("Swim",Msg::kDebug) << "SwimGeo created for " << vldc << endl;
00086   fVld=vldc;
00087   SwimPlaneInterface *spi=0;
00088   UgliGeomHandle ugh(vldc);
00089   fVldRange = ugh.GetVldRange();
00090 
00091   std::vector<UgliPlnHandle> uph_vec = ugh.GetPlnHandleVector();
00092 
00093   for (unsigned int i=0; i < uph_vec.size(); ++i) {
00094     UgliPlnHandle uph = uph_vec[i];
00095     PlexPlaneId plnid = uph.GetPlexPlaneId();
00096     PlaneView::PlaneView_t view = plnid.GetPlaneView();
00097     if (PlaneView::kA == view && PlaneView::kB == view) continue; // cosmics
00098     if (view > PlaneView::kUnknown) continue;  // veto shield, but not uninstrumented
00099     SwimGeo::SwimMaterial_t plnmat = 
00100       (plnid.IsSteel()) ? SwimGeo::kSteel : SwimGeo::kScint;
00101     Double_t z0 = uph.GetZ0();
00102     Double_t dz = uph.GetHalfThickness();
00103     spi = new SwimPlaneInterface(z0-dz,SwimGeo::kAir,plnmat);
00104     fInterface.Add(spi);
00105     spi = new SwimPlaneInterface(z0+dz,plnmat,SwimGeo::kAir);
00106     fInterface.Add(spi);
00107                
00108     MSG("Swim",Msg::kDebug) 
00109       << " add " << plnid.AsString("c") << " " << AsString(plnmat) 
00110       << " z [" << z0-dz << "," << z0+dz << "]" << endl;
00111   }
00112 
00113   fInterface.Sort();
00114   fNInterfaces=fInterface.GetLast()+1;
00115   if(fNInterfaces>5000)                
00116     MSG("Swim",Msg::kFatal) << " Interface list not long enough in SwimGeo.h " << endl;
00117   for(Int_t i=0;i<fNInterfaces;i++){
00118     fInterfaceList[i]= dynamic_cast<SwimPlaneInterface *>(fInterface.At(i));
00119   }
00120   /*
00121   // Print material and z position
00122   double prevz = 0.0;
00123   double inc;
00124   for (Int_t i=0; i<=fInterface.GetLast(); ++i) {
00125     SwimPlaneInterface *spi = 
00126       dynamic_cast<SwimPlaneInterface*>(fInterface.At(i));
00127     for (int j = 0; j < 10; ++j)
00128     {
00129         inc = (spi->fz - prevz)/10;
00130         cout << (prevz + inc*j) << " " <<  spi->imatbef << endl;
00131     }
00132     cout << spi->fz << " " << spi->imatbef << endl;
00133     prevz = spi->fz;
00134   }
00135   */
00136 
00137   // Initialize coil & collar information //
00138 
00139   //far detector
00140   fFarCoilRadius = 12*Munits::cm;
00141   fFarOuterCollarRadius = 17*Munits::cm;
00142   fFarInnerCollarRadius = 13*Munits::cm;
00143   fFarEndSM1Z = 14.5*Munits::m;
00144   fFarBegSM2Z = 16*Munits::m; 
00145   
00146   // near detector information
00147   fNearCoilLength = 24*Munits::cm;
00148   fNearOuterCollarLength = 34*Munits::cm;
00149   fNearInnerCollarLength = 26*Munits::cm;
00150   fNearCoil = InitNearCoil();
00151   fNearInnerCollar = InitNearInnerCollar();
00152   fNearOuterCollar = InitNearOuterCollar();
00153 
00154   MSG("Swim",Msg::kDebug)<<"Far Coil Radius = "<<fFarCoilRadius<<endl;
00155   MSG("Swim",Msg::kDebug)<<"Far Inner Coil Radius = "<<fFarInnerCollarRadius<<endl;
00156   MSG("Swim",Msg::kDebug)<<"Far Outer Collar Radius = "<<fFarOuterCollarRadius<<endl;
00157   
00158   if (MsgService::Instance()->IsActive("Swim",Msg::kDebug)) Print();
00159 }


Member Function Documentation

const char * SwimGeo::AsString ( SwimGeo::SwimMaterial_t  mat  )  [static]

Definition at line 34 of file SwimGeo.cxx.

References kAir, kAluminum, kCarbon, kCoil_far, kCoil_near, kCopper, kError, kHydrogen, kNitrogen, kOxygen, kScint, kSteel, and kWater.

Referenced by GetInterface(), and SwimGeo().

00035 {
00036   switch (mat) {
00037   case (SwimGeo::kAir):        return "Air";
00038   case (SwimGeo::kScint):      return "Scint";
00039   case (SwimGeo::kSteel):      return "Steel";
00040   case (SwimGeo::kAluminum):   return "Aluminum";
00041   case (SwimGeo::kCopper):     return "Copper";
00042   case (SwimGeo::kHydrogen):   return "Hydrogen";
00043   case (SwimGeo::kOxygen):     return "Oxygen";
00044   case (SwimGeo::kWater):      return "Water";  
00045   case (SwimGeo::kCarbon):     return "Carbon";
00046   case (SwimGeo::kNitrogen):   return "Nitrogen";
00047   case (SwimGeo::kCoil_near):  return "Coil_near";
00048   case (SwimGeo::kCoil_far):   return "Coil_far";
00049   case (SwimGeo::kError):      return "Error";
00050   default:                     return "Unknown";
00051   };
00052 }

double SwimGeo::DistToNextPlane ( const TVector3  xyz,
const TVector3  dxyz 
)

Definition at line 410 of file SwimGeo.cxx.

References fNextPlaneZ.

Referenced by SwimSwimmer::Swim().

00411 {
00412 // GetMaterial has to be called prior this function to set fNextPlaneZ
00413 //
00414 // Return the distance to the next interface traveling from position xyz
00415 // along direction dxyz
00416 //
00417 // Inputs:
00418 //  xyz - position vector in X,Y,Z coordinates
00419 //  dxyz - normalized direction vector
00420 //
00421 // Returns:
00422 //  distance to next interface
00423 
00424   return TMath::Abs((fNextPlaneZ-xyz.Z())/dxyz.Z());
00425 
00426 }

SwimPlaneInterface * SwimGeo::GetInterface ( Double_t  z,
Int_t  idir,
SwimGeo::SwimMaterial_t  mat 
) const

Definition at line 181 of file SwimGeo.cxx.

References AsString(), fInterfaceList, fNInterfaces, SwimPlaneInterface::GetMaterialAfter(), SwimPlaneInterface::GetMaterialBefore(), SwimPlaneInterface::GetZ(), Msg::kFatal, and MSG.

Referenced by GetScint(), and GetSteel().

00183 {
00184   Int_t iLow=0;
00185   Int_t iHi=fNInterfaces;
00186   Int_t iMid=0;
00187   while( (iHi-iLow)>1){
00188     iMid=(iLow+iHi) >> 1;
00189     SwimPlaneInterface *spi = fInterfaceList[iMid];
00190 
00191     if(z>=spi->GetZ())
00192       iLow=iMid;
00193     else
00194       iHi=iMid;
00195   }
00196   Int_t ibeg=0;
00197   Int_t iend=0;
00198   Int_t idirection=0;
00199   if (idir==0) {
00200     ibeg = iHi;
00201     iend = fNInterfaces;
00202     idirection = 1;
00203   }
00204   else {
00205     ibeg = iLow;
00206     iend = -1;
00207     idirection = -1;
00208   }
00209   for (Int_t i=ibeg; i!=iend; i+=idirection) {
00210     SwimPlaneInterface *spi = fInterfaceList[i];
00211     Double_t spiZ=spi->GetZ();
00212     if (spi->GetMaterialBefore() == material || 
00213         spi->GetMaterialAfter()  == material    ) {
00214       if (idir==0  && spiZ > z ) {
00215         return spi;
00216       }
00217       else if(idir==1 && spiZ < z){
00218         return spi;
00219       }
00220     }
00221   }
00222   MSG("SwimGeo",Msg::kFatal) 
00223     << "Could not find " << AsString(material) << " interface " 
00224     << z << " " << idir << " " << ibeg 
00225     << " " << iend << endl;
00226   
00227   return 0;
00228 }

const TObjArray& SwimGeo::GetInterfaces (  )  const [inline]

Definition at line 77 of file SwimGeo.h.

References fInterface.

Referenced by SwimObjSR::SwimTo().

00077 { return fInterface; }

SwimPlaneInterface * SwimGeo::GetScint ( Double_t  z,
Int_t  idir 
) const [inline]

Definition at line 114 of file SwimGeo.h.

References GetInterface(), and kScint.

00115 { return GetInterface(z,idir,SwimGeo::kScint); }

SwimPlaneInterface * SwimGeo::GetSteel ( Double_t  z,
Int_t  idir 
) const [inline]

Definition at line 111 of file SwimGeo.h.

References GetInterface(), and kSteel.

Referenced by AlgFitTrackSR::CalculateNoise(), and AlgFitTrackCam::GetNoiseMatrix().

00112 { return GetInterface(z,idir,SwimGeo::kSteel); }

SwimGeo::SwimMaterial_t SwimGeo::GetSwimMaterial ( const TVector3  xyz,
bool  zDir,
SwimStepData stepdata 
)

Definition at line 299 of file SwimGeo.cxx.

References fInterfaceList, fVld, VldContext::GetDetector(), SwimPlaneInterface::GetMaterialAfter(), SwimPlaneInterface::GetMaterialBefore(), SwimStepData::GetSPI(), IsInsideCoil(), IsInsideInnerCollar(), IsInsideOuterCollar(), kAir, kCoil_far, kCoil_near, kError, Detector::kFar, Detector::kNear, kScint, kSteel, and SetNextPlaneZ().

00300 {
00301   
00302   
00303   if(SetNextPlaneZ(xyz,zDir,stepdata)) {
00304     
00305     // Check if we're inside the coil or collar
00306     if(IsInsideCoil( xyz , fVld.GetDetector()) &&  
00307        fVld.GetDetector()==Detector::kNear )return kCoil_near;
00308     if(IsInsideCoil( xyz ,fVld.GetDetector()) &&  
00309        fVld.GetDetector()==Detector::kFar )return kCoil_far;
00310     if(IsInsideOuterCollar( xyz ,fVld.GetDetector()) ) {
00311       if( IsInsideInnerCollar(xyz,fVld.GetDetector()))  return kAir;
00312       else return kSteel;
00313     }
00314   
00315     // Get the material for position xyz
00316     // If xyz lies on the boundary, get the material after the boundary,
00317     // which depends on dir
00318     SwimPlaneInterface *spi = fInterfaceList[stepdata.GetSPI()];
00319     if(zDir) {
00320       switch (spi->GetMaterialBefore()) {
00321       case kAir:   return kAir;
00322       case kScint: return kScint;
00323       case kSteel: return kSteel;
00324       default:     break;
00325       }
00326     }
00327     else if(!zDir) {
00328       switch (spi->GetMaterialAfter()) {
00329       case kAir:   return kAir;
00330       case kScint: return kScint;
00331       case kSteel: return kSteel;
00332       default:     break;
00333       }
00334     }
00335     return kError;
00336   }
00337   
00338   else return kError;
00339     
00340 }

SwimGeo::SwimMaterial_t SwimGeo::GetSwimMaterial ( const TVector3  xyz,
bool  zDir 
)

Definition at line 232 of file SwimGeo.cxx.

References fInterfaceList, fNextPlaneZ, fNInterfaces, SwimPlaneInterface::GetMaterialAfter(), SwimPlaneInterface::GetMaterialBefore(), SwimPlaneInterface::GetZ(), kAir, kError, kScint, and kSteel.

Referenced by SwimSwimmer::Swim().

00233 {
00234 
00235   // This function should not be used now that the coil model
00236   // has been included in the swimmer. Use the other one
00237 
00238   // Get the material for position xyz
00239   // If xyz lies on the boundary, get the material after the boundary,
00240   // which depends on dir
00241 
00242   Int_t iLow=0;
00243   Int_t iHi=fNInterfaces;
00244   Int_t iMid=0;
00245   Double_t xyzZ=xyz.Z();
00246   while( (iHi-iLow)>1){
00247     iMid=(iLow+iHi)>>1;
00248     SwimPlaneInterface *spi = fInterfaceList[iMid];
00249     if(xyzZ>=spi->GetZ())
00250       iLow=iMid;
00251     else
00252       iHi=iMid;
00253   }
00254 
00255   Int_t ibeg=0;
00256   Int_t iend=0;
00257   Int_t idirection=0;
00258   if (zDir==1) {
00259     ibeg = iHi;
00260     iend = fNInterfaces;
00261     idirection = 1;
00262   }
00263   else {
00264     ibeg = iLow;
00265     iend = -1;
00266     idirection = -1;
00267   }
00268  
00269 
00270   for (int i=ibeg; i!=iend; i+=idirection) {
00271     SwimPlaneInterface *spi = fInterfaceList[i];
00272     Double_t spiZ=spi->GetZ();
00273     if (zDir && spiZ > xyz.Z() ) {
00274       fNextPlaneZ = spi->GetZ();
00275       switch (spi->GetMaterialBefore() ) {
00276       case kAir:   return kAir;
00277       case kScint: return kScint;
00278       case kSteel: return kSteel;
00279       default: break;// do nothing
00280       }
00281     }
00282     else if (!zDir && spi->GetZ() < xyz.Z() ) {
00283       fNextPlaneZ = spi->GetZ();
00284       switch (spi->GetMaterialAfter() ) {
00285       case kAir:   return kAir;
00286       case kScint: return kScint;
00287       case kSteel: return kSteel;
00288       default: break; // do nothing
00289       }
00290     }
00291   }
00292   // Outside the detector
00293   fNextPlaneZ = 0.0;
00294   return kError;
00295 }

double SwimGeo::GetSwimMaterialDensity ( SwimGeo::SwimMaterial_t  mat  )  [static]

Definition at line 604 of file SwimGeo.cxx.

References Munits::cm3, MinosMaterial::Density(), MinosMaterial::eIronMinos, MinosMaterial::ePolystyreneMinos, Munits::g, kAir, kAluminum, kCarbon, kCoil_far, kCoil_near, kCopper, kError, kHydrogen, kNitrogen, kOxygen, kScint, kSteel, and kWater.

Referenced by SwimdEdxTable::CaldEdx(), SwimStepOnceAction::Perform(), and SwimDefStepper::StepOnce().

00605 {
00606   switch (mat)  {
00607   case (SwimGeo::kAir):   return 0.001*Munits::g/(Munits::cm3);
00608   case (SwimGeo::kScint): return MinosMaterial::Density(MinosMaterial::ePolystyreneMinos)*Munits::g/(Munits::cm3);
00609   case (SwimGeo::kSteel): return MinosMaterial::Density(MinosMaterial::eIronMinos)*Munits::g/(Munits::cm3);
00610   case (SwimGeo::kAluminum): return 2.699*Munits::g/(Munits::cm3);
00611   case (SwimGeo::kCopper): return 8.96*Munits::g/(Munits::cm3);
00612   case (SwimGeo::kHydrogen): return 0.063*Munits::g/(Munits::cm3);
00613   case (SwimGeo::kOxygen): return 1.140*Munits::g/(Munits::cm3);
00614   case (SwimGeo::kWater): return  1.0*Munits::g/(Munits::cm3);
00615   case (SwimGeo::kCarbon): return  2.265*Munits::g/(Munits::cm3);
00616   case (SwimGeo::kNitrogen): return  0.808*Munits::g/(Munits::cm3);
00617   case (SwimGeo::kCoil_near):
00618     // This does not include a small fraction of
00619     // insulation or teflon, only Al and H20
00620     return 2.35731*Munits::g/(Munits::cm3);
00621     
00622   case (SwimGeo::kCoil_far): 
00623     // From Robert's GMINOS code in mix_farcoil.F 
00624     return 2.3488*Munits::g/(Munits::cm3);
00625   case (SwimGeo::kError): return 0.0*Munits::g/(Munits::cm3);
00626   default:                return 0.0*Munits::g/(Munits::cm3);
00627   };
00628 }  //

vector< pair< Double_t, Double_t > > SwimGeo::InitNearCoil (  ) 

Definition at line 430 of file SwimGeo.cxx.

References MuELoss::a, fNearCoilLength, fNearInnerCollarLength, Msg::kDebug, kInvSqrt2, and MSG.

Referenced by SwimGeo().

00430                                                        {
00431 
00432   // coil model for near detector
00433   vector< pair<Double_t,Double_t> > v;
00434   Double_t a=fNearInnerCollarLength;
00435   Double_t b=fNearCoilLength;
00436    
00437   // Add points from beam's eye view
00438   // Assume lower point of coil and inner collar are the same
00439   
00440   // Right point
00441   Double_t rx=-b*kInvSqrt2;
00442   Double_t ry=-(a-b)*kInvSqrt2;
00443   // Left point
00444   Double_t lx=b*kInvSqrt2;
00445   Double_t ly=-(a-b)*kInvSqrt2;
00446   // Upper point
00447   Double_t ux=0;
00448   Double_t uy=(2*b-a)*kInvSqrt2;
00449   // Lower point
00450   Double_t bx=0;
00451   Double_t by=-a*kInvSqrt2;
00452   
00453   v.push_back(pair<Double_t,Double_t>(lx,ly));
00454   v.push_back(pair<Double_t,Double_t>(ux,uy));   
00455   v.push_back(pair<Double_t,Double_t>(rx,ry));   
00456   v.push_back(pair<Double_t,Double_t>(bx,by));   
00457   v.push_back(pair<Double_t,Double_t>(lx,ly));
00458   
00459   MSG("Swim",Msg::kDebug)<<"In Beams Eye View "<<endl;
00460   MSG("Swim",Msg::kDebug)<<"Near Coil Top(X,Y) = "<<ux<<","<<uy<<endl;
00461   MSG("Swim",Msg::kDebug)<<"Near Coil Left(X,Y) = "<<lx<<","<<ly<<endl;
00462   MSG("Swim",Msg::kDebug)<<"Near Coil Bottom(X,Y) = "<<bx<<","<<by<<endl;
00463   MSG("Swim",Msg::kDebug)<<"Near Coil Right(X,Y) = "<<rx<<","<<ry<<endl;
00464   return v;
00465 }

vector< pair< Double_t, Double_t > > SwimGeo::InitNearInnerCollar (  ) 

Definition at line 490 of file SwimGeo.cxx.

References fNearInnerCollarLength, Msg::kDebug, kInvSqrt2, and MSG.

Referenced by SwimGeo().

00490                                                               {
00491   // inner collar model for near detector  
00492   vector< pair<Double_t,Double_t> > v;
00493   Double_t s=fNearInnerCollarLength*kInvSqrt2;
00494   
00495   // Add points from beam's eye view
00496   // Assume center of collar is center of coordinate system
00497   v.push_back(pair<Double_t,Double_t>(s,0)); // left
00498   v.push_back(pair<Double_t,Double_t>(0,s)); // upper   
00499   v.push_back(pair<Double_t,Double_t>(-s,0));// right  
00500   v.push_back(pair<Double_t,Double_t>(0,-s));// lower   
00501   v.push_back(pair<Double_t,Double_t>(s,0));
00502     
00503   MSG("Swim",Msg::kDebug)<<"Near Air Top(X,Y) = "<<0<<","<<s<<endl;
00504   MSG("Swim",Msg::kDebug)<<"Near Air Left(X,Y) = "<<s<<","<<0<<endl;
00505   MSG("Swim",Msg::kDebug)<<"Near Air Bottom(X,Y) = "<<0<<","<<-s<<endl;
00506   MSG("Swim",Msg::kDebug)<<"Near Air Right(X,Y) = "<<-s<<","<<0<<endl;
00507   
00508 return v;
00509 }

vector< pair< Double_t, Double_t > > SwimGeo::InitNearOuterCollar (  ) 

Definition at line 469 of file SwimGeo.cxx.

References fNearOuterCollarLength, Msg::kDebug, kInvSqrt2, and MSG.

Referenced by SwimGeo().

00469                                                               {
00470   // outer collar model for near detector
00471   vector< pair<Double_t,Double_t> > v;
00472   Double_t s=fNearOuterCollarLength*kInvSqrt2;
00473   
00474   // Add points from beam's eye view
00475   // Assume center of collar is center of coordinate system
00476   v.push_back(pair<Double_t,Double_t>(s,0)); // left
00477   v.push_back(pair<Double_t,Double_t>(0,s)); // upper   
00478   v.push_back(pair<Double_t,Double_t>(-s,0));// right  
00479   v.push_back(pair<Double_t,Double_t>(0,-s));// lower   
00480   v.push_back(pair<Double_t,Double_t>(s,0));
00481  
00482   MSG("Swim",Msg::kDebug)<<"Near Collar Top(X,Y) = "<<0<<","<<s<<endl;
00483   MSG("Swim",Msg::kDebug)<<"Near Collar Left(X,Y) = "<<s<<","<<0<<endl;
00484   MSG("Swim",Msg::kDebug)<<"Near Collar Bottom(X,Y) = "<<0<<","<<-s<<endl;
00485   MSG("Swim",Msg::kDebug)<<"Near Collar Right(X,Y) = "<<-s<<","<<0<<endl;
00486   
00487   return v;
00488 }

SwimGeo * SwimGeo::Instance ( const VldContext vldc  )  [static]

Definition at line 56 of file SwimGeo.cxx.

References fInstance, fVldRange, Msg::kDebug, MSG, and SwimGeo().

Referenced by AlgFitTrackSR::CalculateNoise(), AlgFitTrackCam::GetNoiseMatrix(), SwimSwimmer::SwimSwimmer(), and SwimObjSR::SwimTo().

00057 {
00058   // Return a compatible instance.
00059 
00060   // If there is an existing one and it is compatible use it
00061   if (fInstance && (fInstance->fVldRange).IsCompatible(vldc)) return fInstance;
00062 
00063   // What we have is unacceptable
00064   if (fInstance) {
00065     MSG("Swim",Msg::kDebug) 
00066       << "SwimGeo kill version for range " << fInstance->fVldRange << endl;
00067     delete fInstance;
00068   }
00069   fInstance = new SwimGeo(vldc);
00070 
00071   return fInstance;
00072 }

Bool_t SwimGeo::IsInside ( Double_t  xp,
Double_t  yp,
const std::vector< std::pair< Double_t, Double_t > > &  v 
) const
Bool_t SwimGeo::IsInsideCoil ( TVector3  xyz,
Detector::Detector_t  dt 
)

Definition at line 513 of file SwimGeo.cxx.

References fFarBegSM2Z, fFarEndSM1Z, fNearCoil, IsInside(), Detector::kFar, and Detector::kNear.

Referenced by GetSwimMaterial().

00514 {
00515   // Check to see if point is inside coil region
00516   Double_t x = xyz.X();
00517   Double_t y = xyz.Y();
00518   Double_t z = xyz.Z();
00519   
00520   Double_t r=TMath::Sqrt(x*x+y*y);
00521   if ( dt == Detector::kNear ) {
00522  
00523     if( IsInside(x,y,fNearCoil) ) return true;
00524     
00525   }
00526   else if ( dt == Detector::kFar ) {
00527     
00528     if( r < fFarCoilRadius && z > fFarBegSM2Z && z < fFarEndSM1Z ) return true;
00529     
00530   }
00531   
00532   return false;
00533   
00534 }

Bool_t SwimGeo::IsInsideInnerCollar ( TVector3  xyz,
Detector::Detector_t  dt 
)

Definition at line 561 of file SwimGeo.cxx.

References fFarBegSM2Z, fFarEndSM1Z, fNearInnerCollar, IsInside(), Detector::kFar, and Detector::kNear.

Referenced by GetSwimMaterial().

00562 {
00563   Double_t x = xyz.X();
00564   Double_t y = xyz.Y();
00565   Double_t z = xyz.Z();
00566   
00567   Double_t r=TMath::Sqrt(x*x+y*y);
00568  
00569   if ( dt == Detector::kNear ) {
00570     
00571     if( IsInside(x,y,fNearInnerCollar) ) return true;
00572   }
00573   
00574   else if ( dt == Detector::kFar ) {
00575     
00576     if( r < fFarInnerCollarRadius && z > fFarBegSM2Z && z < fFarEndSM1Z ) return true;
00577   }
00578   return false;
00579 }

Bool_t SwimGeo::IsInsideOuterCollar ( TVector3  xyz,
Detector::Detector_t  dt 
)

Definition at line 538 of file SwimGeo.cxx.

References fFarBegSM2Z, fFarEndSM1Z, fNearOuterCollar, IsInside(), Detector::kFar, and Detector::kNear.

Referenced by GetSwimMaterial().

00539 {
00540   Double_t x = xyz.X();
00541   Double_t y = xyz.Y();
00542   Double_t z = xyz.Z();
00543   
00544   Double_t r=TMath::Sqrt(x*x+y*y);
00545   
00546   // Check to see if point is inside collar region
00547   if ( dt == Detector::kNear ) {
00548     
00549     if( IsInside(x,y,fNearOuterCollar) ) return true;
00550     
00551   }
00552   else if ( dt == Detector::kFar ) {
00553    
00554     if( r < fFarOuterCollarRadius && z > fFarBegSM2Z && z < fFarEndSM1Z ) return true;
00555     
00556   }
00557   
00558   return false;
00559 }

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

Definition at line 162 of file SwimGeo.cxx.

References fInterface, SwimPlaneInterface::GetZ(), Msg::kInfo, MSGSTREAM, and SwimPlaneInterface::Print().

Referenced by SwimGeo().

00163 {
00164 
00165   MsgStream& msg = MSGSTREAM("Swim",Msg::kInfo);
00166 
00167   double prevz = 0.0;
00168   for (int i=0; i <= fInterface.GetLast(); ++i) {
00169     SwimPlaneInterface *spi =
00170       dynamic_cast<SwimPlaneInterface*>(fInterface.At(i));
00171     if ( ! spi ) continue;
00172     spi->Print("0");
00173     double thisz = spi->GetZ();
00174     msg << " dz = " << thisz - prevz << endl;
00175     prevz = thisz;
00176   }
00177 }

Bool_t SwimGeo::SetNextPlaneZ ( const TVector3  xyz,
bool  zDir,
SwimStepData stepdata 
)

Definition at line 344 of file SwimGeo.cxx.

References fInterfaceList, fNextPlaneZ, fNInterfaces, SwimStepData::GetSPI(), SwimPlaneInterface::GetZ(), and SwimStepData::SetSPI().

Referenced by GetSwimMaterial().

00345 {
00346   // This function sets fNextPlaneZ,it returns false if out of detector
00347   int ibeg;
00348   int iend;
00349   int idirection;
00350   int i;
00351   //  cout << " in get mat " << stepdata.GetSPI() << " " << fNInterfaces << " " << zDir << endl; 
00352   // if stepdata.fSPI has not been set (is -1), then set it
00353   if ( stepdata.GetSPI() == -1 ) {
00354     
00355     Int_t iLow=0;
00356     Int_t iHi=fNInterfaces;
00357     Int_t iMid=0;
00358     Double_t z = xyz.Z();
00359     while( (iHi-iLow)>1){
00360       iMid=(iLow+iHi) >> 1;
00361       SwimPlaneInterface *spi = fInterfaceList[iMid];
00362       if(z>=spi->GetZ())
00363         iLow=iMid;
00364       else
00365         iHi=iMid;
00366     }
00367     
00368     if (zDir) {
00369       stepdata.SetSPI(iHi);
00370     } else {
00371       stepdata.SetSPI(iLow);
00372     }
00373   }            
00374  
00375   ibeg = stepdata.GetSPI();  
00376   if (zDir) {
00377     iend = fNInterfaces;
00378     idirection = 1;
00379   }
00380   else {
00381     iend = -1;
00382     idirection = -1;
00383   }
00384   //  cout << " lookup " << ibeg  << " " << iend << " " << idirection << endl;
00385   for (i=ibeg; i!=iend; i+=idirection) {
00386     SwimPlaneInterface *spi = fInterfaceList[i];
00387     Double_t spiZ=spi->GetZ();
00388     Double_t xyzZ=xyz.Z();
00389     //  cout  << " z " << spiZ << " " << xyzZ << endl;
00390     if (zDir && spiZ > xyzZ ) {
00391       stepdata.SetSPI(i);
00392       fNextPlaneZ = spiZ;
00393       return true;
00394     }
00395     else if (!zDir && spiZ < xyzZ ) {
00396       stepdata.SetSPI(i);
00397       fNextPlaneZ = spiZ;
00398       return true;
00399     }
00400   }
00401   
00402   
00403   // Outside the detector
00404   fNextPlaneZ = 0.0;
00405   return false;
00406   }


Member Data Documentation

Double_t SwimGeo::fFarBegSM2Z [private]

Definition at line 100 of file SwimGeo.h.

Referenced by IsInsideCoil(), IsInsideInnerCollar(), IsInsideOuterCollar(), and SwimGeo().

Double_t SwimGeo::fFarCoilRadius [private]

Definition at line 96 of file SwimGeo.h.

Referenced by SwimGeo().

Double_t SwimGeo::fFarEndSM1Z [private]

Definition at line 99 of file SwimGeo.h.

Referenced by IsInsideCoil(), IsInsideInnerCollar(), IsInsideOuterCollar(), and SwimGeo().

Double_t SwimGeo::fFarInnerCollarRadius [private]

Definition at line 97 of file SwimGeo.h.

Referenced by SwimGeo().

Double_t SwimGeo::fFarOuterCollarRadius [private]

Definition at line 98 of file SwimGeo.h.

Referenced by SwimGeo().

SwimGeo * SwimGeo::fInstance = 0 [static, private]

Definition at line 87 of file SwimGeo.h.

Referenced by Instance().

TObjArray SwimGeo::fInterface [private]

Definition at line 89 of file SwimGeo.h.

Referenced by GetInterfaces(), Print(), and SwimGeo().

Definition at line 90 of file SwimGeo.h.

Referenced by GetInterface(), GetSwimMaterial(), SetNextPlaneZ(), and SwimGeo().

std::vector< std::pair<Double_t,Double_t> > SwimGeo::fNearCoil [private]

Definition at line 105 of file SwimGeo.h.

Referenced by IsInsideCoil(), and SwimGeo().

Double_t SwimGeo::fNearCoilLength [private]

Definition at line 101 of file SwimGeo.h.

Referenced by InitNearCoil(), and SwimGeo().

std::vector< std::pair<Double_t,Double_t> > SwimGeo::fNearInnerCollar [private]

Definition at line 107 of file SwimGeo.h.

Referenced by IsInsideInnerCollar(), and SwimGeo().

Double_t SwimGeo::fNearInnerCollarLength [private]

Definition at line 103 of file SwimGeo.h.

Referenced by InitNearCoil(), InitNearInnerCollar(), and SwimGeo().

std::vector< std::pair<Double_t,Double_t> > SwimGeo::fNearOuterCollar [private]

Definition at line 106 of file SwimGeo.h.

Referenced by IsInsideOuterCollar(), and SwimGeo().

Double_t SwimGeo::fNearOuterCollarLength [private]

Definition at line 102 of file SwimGeo.h.

Referenced by InitNearOuterCollar(), and SwimGeo().

double SwimGeo::fNextPlaneZ [private]

Definition at line 92 of file SwimGeo.h.

Referenced by DistToNextPlane(), GetSwimMaterial(), and SetNextPlaneZ().

int SwimGeo::fNInterfaces [private]

Definition at line 91 of file SwimGeo.h.

Referenced by GetInterface(), GetSwimMaterial(), SetNextPlaneZ(), and SwimGeo().

Definition at line 94 of file SwimGeo.h.

Referenced by GetSwimMaterial(), and SwimGeo().

Definition at line 93 of file SwimGeo.h.

Referenced by Instance(), and SwimGeo().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1