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

SwimGeo Class Reference

#include <SwimGeo.h>

List of all members.

Public Types

typedef enum SwimGeo::ESwimMaterials SwimMaterial_t
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
}

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

SwimGeoInstance (const VldContext &vldc)
double GetSwimMaterialDensity (SwimGeo::SwimMaterial_t mat)
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

SwimGeofInstance = 0


Member Typedef Documentation

typedef enum SwimGeo::ESwimMaterials SwimGeo::SwimMaterial_t
 

Referenced by GetSwimMaterial(), and SwimGeo().


Member Enumeration Documentation

enum SwimGeo::ESwimMaterials
 

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

Definition at line 32 of file SwimGeo.h.

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


Constructor & Destructor Documentation

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

Definition at line 50 of file SwimGeo.h.

00050 {;}

SwimGeo::SwimGeo const VldContext vldc  )  [protected]
 

Definition at line 55 of file SwimGeo.cxx.

References AsString(), PlexPlaneId::AsString(), 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(), MsgService::IsActive(), PlexPlaneId::IsSteel(), kAir, kSteel, MSG, Print(), and SwimMaterial_t.

Referenced by Instance().

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


Member Function Documentation

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

Definition at line 80 of file SwimGeo.h.

Referenced by GetInterface(), SwimPrintStepAction::Perform(), SwimPlaneInterface::Print(), and SwimGeo().

00081   {
00082     switch (mat) {
00083     case (SwimGeo::kAir):   return "Air";
00084     case (SwimGeo::kScint): return "Scint";
00085     case (SwimGeo::kSteel): return "Steel";
00086     case (SwimGeo::kAluminum): return "Aluminum";
00087     case (SwimGeo::kCopper): return "Copper";
00088     case (SwimGeo::kHydrogen): return "Hydrogen";
00089     case (SwimGeo::kOxygen): return "Oxygen";
00090     case (SwimGeo::kWater): return "Water";  
00091     case (SwimGeo::kCarbon):  return "Carbon";
00092     case (SwimGeo::kNitrogen):  return "Nitrogen";
00093     case (SwimGeo::kCoil_near):  return "Coil_near";
00094     case (SwimGeo::kCoil_far):  return "Coil_far";
00095     case (SwimGeo::kError): return "Error";
00096     default:                return "Unknown";
00097     };
00098   }

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

Definition at line 389 of file SwimGeo.cxx.

References fNextPlaneZ.

Referenced by SwimSwimmer::Swim().

00390 {
00391 // GetMaterial has to be called prior this function to set fNextPlaneZ
00392 //
00393 // Return the distance to the next interface traveling from position xyz
00394 // along direction dxyz
00395 //
00396 // Inputs:
00397 //  xyz - position vector in X,Y,Z coordinates
00398 //  dxyz - normalized direction vector
00399 //
00400 // Returns:
00401 //  distance to next interface
00402 
00403   return TMath::Abs((fNextPlaneZ-xyz.Z())/dxyz.Z());
00404 
00405 }

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

Definition at line 160 of file SwimGeo.cxx.

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

Referenced by GetScint(), and GetSteel().

00162 {
00163   Int_t iLow=0;
00164   Int_t iHi=fNInterfaces;
00165   Int_t iMid=0;
00166   while( (iHi-iLow)>1){
00167     iMid=(iLow+iHi) >> 1;
00168     SwimPlaneInterface *spi = fInterfaceList[iMid];
00169 
00170     if(z>=spi->GetZ())
00171       iLow=iMid;
00172     else
00173       iHi=iMid;
00174   }
00175   Int_t ibeg=0;
00176   Int_t iend=0;
00177   Int_t idirection=0;
00178   if (idir==0) {
00179     ibeg = iHi;
00180     iend = fNInterfaces;
00181     idirection = 1;
00182   }
00183   else {
00184     ibeg = iLow;
00185     iend = -1;
00186     idirection = -1;
00187   }
00188   for (Int_t i=ibeg; i!=iend; i+=idirection) {
00189     SwimPlaneInterface *spi = fInterfaceList[i];
00190     Double_t spiZ=spi->GetZ();
00191     if (spi->GetMaterialBefore() == material || 
00192         spi->GetMaterialAfter()  == material    ) {
00193       if (idir==0  && spiZ > z ) {
00194         return spi;
00195       }
00196       else if(idir==1 && spiZ < z){
00197         return spi;
00198       }
00199     }
00200   }
00201   MSG("SwimGeo",Msg::kFatal) 
00202     << "Could not find " << AsString(material) << " interface " 
00203     << z << " " << idir << " " << ibeg 
00204     << " " << iend << endl;
00205   
00206   return 0;
00207 }

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

Definition at line 76 of file SwimGeo.h.

Referenced by SwimObjSR::SwimTo(), and SwimObj3::SwimTo().

00076 { return fInterface; }

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

Definition at line 131 of file SwimGeo.h.

References GetInterface(), and kScint.

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

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

Definition at line 128 of file SwimGeo.h.

References GetInterface(), and kSteel.

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

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

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

Definition at line 278 of file SwimGeo.cxx.

References fInterfaceList, fVld, VldContext::GetDetector(), SwimPlaneInterface::GetMaterialAfter(), SwimPlaneInterface::GetMaterialBefore(), SwimStepData::GetSPI(), IsInsideCoil(), IsInsideInnerCollar(), IsInsideOuterCollar(), kAir, kScint, kSteel, SetNextPlaneZ(), and SwimMaterial_t.

00279 {
00280   
00281   
00282   if(SetNextPlaneZ(xyz,zDir,stepdata)) {
00283     
00284     // Check if we're inside the coil or collar
00285     if(IsInsideCoil( xyz , fVld.GetDetector()) &&  
00286        fVld.GetDetector()==Detector::kNear )return kCoil_near;
00287     if(IsInsideCoil( xyz ,fVld.GetDetector()) &&  
00288        fVld.GetDetector()==Detector::kFar )return kCoil_far;
00289     if(IsInsideOuterCollar( xyz ,fVld.GetDetector()) ) {
00290       if( IsInsideInnerCollar(xyz,fVld.GetDetector()))  return kAir;
00291       else return kSteel;
00292     }
00293   
00294     // Get the material for position xyz
00295     // If xyz lies on the boundary, get the material after the boundary,
00296     // which depends on dir
00297     SwimPlaneInterface *spi = fInterfaceList[stepdata.GetSPI()];
00298     if(zDir) {
00299       switch (spi->GetMaterialBefore()) {
00300       case kAir:   return kAir;
00301       case kScint: return kScint;
00302       case kSteel: return kSteel;
00303       default:     break;
00304       }
00305     }
00306     else if(!zDir) {
00307       switch (spi->GetMaterialAfter()) {
00308       case kAir:   return kAir;
00309       case kScint: return kScint;
00310       case kSteel: return kSteel;
00311       default:     break;
00312       }
00313     }
00314     return kError;
00315   }
00316   
00317   else return kError;
00318     
00319 }

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

Definition at line 211 of file SwimGeo.cxx.

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

Referenced by SwimSwimmer::Swim().

00212 {
00213 
00214   // This function should not be used now that the coil model
00215   // has been included in the swimmer. Use the other one
00216 
00217   // Get the material for position xyz
00218   // If xyz lies on the boundary, get the material after the boundary,
00219   // which depends on dir
00220 
00221   Int_t iLow=0;
00222   Int_t iHi=fNInterfaces;
00223   Int_t iMid=0;
00224   Double_t xyzZ=xyz.Z();
00225   while( (iHi-iLow)>1){
00226     iMid=(iLow+iHi)>>1;
00227     SwimPlaneInterface *spi = fInterfaceList[iMid];
00228     if(xyzZ>=spi->GetZ())
00229       iLow=iMid;
00230     else
00231       iHi=iMid;
00232   }
00233 
00234   Int_t ibeg=0;
00235   Int_t iend=0;
00236   Int_t idirection=0;
00237   if (zDir==1) {
00238     ibeg = iHi;
00239     iend = fNInterfaces;
00240     idirection = 1;
00241   }
00242   else {
00243     ibeg = iLow;
00244     iend = -1;
00245     idirection = -1;
00246   }
00247  
00248 
00249   for (int i=ibeg; i!=iend; i+=idirection) {
00250     SwimPlaneInterface *spi = fInterfaceList[i];
00251     Double_t spiZ=spi->GetZ();
00252     if (zDir && spiZ > xyz.Z() ) {
00253       fNextPlaneZ = spi->GetZ();
00254       switch (spi->GetMaterialBefore() ) {
00255       case kAir:   return kAir;
00256       case kScint: return kScint;
00257       case kSteel: return kSteel;
00258       default: break;// do nothing
00259       }
00260     }
00261     else if (!zDir && spi->GetZ() < xyz.Z() ) {
00262       fNextPlaneZ = spi->GetZ();
00263       switch (spi->GetMaterialAfter() ) {
00264       case kAir:   return kAir;
00265       case kScint: return kScint;
00266       case kSteel: return kSteel;
00267       default: break; // do nothing
00268       }
00269     }
00270   }
00271   // Outside the detector
00272   fNextPlaneZ = 0.0;
00273   return kError;
00274 }

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

Definition at line 583 of file SwimGeo.cxx.

References MinosMaterial::Density().

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

00584 {
00585   switch (mat)  {
00586   case (SwimGeo::kAir):   return 0.001*Munits::g/(Munits::cm3);
00587   case (SwimGeo::kScint): return MinosMaterial::Density(MinosMaterial::ePolystyreneMinos)*Munits::g/(Munits::cm3);
00588   case (SwimGeo::kSteel): return MinosMaterial::Density(MinosMaterial::eIronMinos)*Munits::g/(Munits::cm3);
00589   case (SwimGeo::kAluminum): return 2.699*Munits::g/(Munits::cm3);
00590   case (SwimGeo::kCopper): return 8.96*Munits::g/(Munits::cm3);
00591   case (SwimGeo::kHydrogen): return 0.063*Munits::g/(Munits::cm3);
00592   case (SwimGeo::kOxygen): return 1.140*Munits::g/(Munits::cm3);
00593   case (SwimGeo::kWater): return  1.0*Munits::g/(Munits::cm3);
00594   case (SwimGeo::kCarbon): return  2.265*Munits::g/(Munits::cm3);
00595   case (SwimGeo::kNitrogen): return  0.808*Munits::g/(Munits::cm3);
00596   case (SwimGeo::kCoil_near):
00597     // This does not include a small fraction of
00598     // insulation or teflon, only Al and H20
00599     return 2.35731*Munits::g/(Munits::cm3);
00600     
00601   case (SwimGeo::kCoil_far): 
00602     // From Robert's GMINOS code in mix_farcoil.F 
00603     return 2.3488*Munits::g/(Munits::cm3);
00604   case (SwimGeo::kError): return 0.0*Munits::g/(Munits::cm3);
00605   default:                return 0.0*Munits::g/(Munits::cm3);
00606   };
00607 }  //

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

Definition at line 409 of file SwimGeo.cxx.

References MSG.

Referenced by SwimGeo().

00409                                                        {
00410 
00411   // coil model for near detector
00412   vector< pair<Double_t,Double_t> > v;
00413   Double_t a=fNearInnerCollarLength;
00414   Double_t b=fNearCoilLength;
00415    
00416   // Add points from beam's eye view
00417   // Assume lower point of coil and inner collar are the same
00418   
00419   // Right point
00420   Double_t rx=-b*kInvSqrt2;
00421   Double_t ry=-(a-b)*kInvSqrt2;
00422   // Left point
00423   Double_t lx=b*kInvSqrt2;
00424   Double_t ly=-(a-b)*kInvSqrt2;
00425   // Upper point
00426   Double_t ux=0;
00427   Double_t uy=(2*b-a)*kInvSqrt2;
00428   // Lower point
00429   Double_t bx=0;
00430   Double_t by=-a*kInvSqrt2;
00431   
00432   v.push_back(pair<Double_t,Double_t>(lx,ly));
00433   v.push_back(pair<Double_t,Double_t>(ux,uy));   
00434   v.push_back(pair<Double_t,Double_t>(rx,ry));   
00435   v.push_back(pair<Double_t,Double_t>(bx,by));   
00436   v.push_back(pair<Double_t,Double_t>(lx,ly));
00437   
00438   MSG("Swim",Msg::kDebug)<<"In Beams Eye View "<<endl;
00439   MSG("Swim",Msg::kDebug)<<"Near Coil Top(X,Y) = "<<ux<<","<<uy<<endl;
00440   MSG("Swim",Msg::kDebug)<<"Near Coil Left(X,Y) = "<<lx<<","<<ly<<endl;
00441   MSG("Swim",Msg::kDebug)<<"Near Coil Bottom(X,Y) = "<<bx<<","<<by<<endl;
00442   MSG("Swim",Msg::kDebug)<<"Near Coil Right(X,Y) = "<<rx<<","<<ry<<endl;
00443   return v;
00444 }

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

Definition at line 469 of file SwimGeo.cxx.

References fNearInnerCollarLength, MSG, and s().

Referenced by SwimGeo().

00469                                                               {
00470   // inner collar model for near detector  
00471   vector< pair<Double_t,Double_t> > v;
00472   Double_t s=fNearInnerCollarLength*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 Air Top(X,Y) = "<<0<<","<<s<<endl;
00483   MSG("Swim",Msg::kDebug)<<"Near Air Left(X,Y) = "<<s<<","<<0<<endl;
00484   MSG("Swim",Msg::kDebug)<<"Near Air Bottom(X,Y) = "<<0<<","<<-s<<endl;
00485   MSG("Swim",Msg::kDebug)<<"Near Air Right(X,Y) = "<<-s<<","<<0<<endl;
00486   
00487 return v;
00488 }

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

Definition at line 448 of file SwimGeo.cxx.

References fNearOuterCollarLength, MSG, and s().

Referenced by SwimGeo().

00448                                                               {
00449   // outer collar model for near detector
00450   vector< pair<Double_t,Double_t> > v;
00451   Double_t s=fNearOuterCollarLength*kInvSqrt2;
00452   
00453   // Add points from beam's eye view
00454   // Assume center of collar is center of coordinate system
00455   v.push_back(pair<Double_t,Double_t>(s,0)); // left
00456   v.push_back(pair<Double_t,Double_t>(0,s)); // upper   
00457   v.push_back(pair<Double_t,Double_t>(-s,0));// right  
00458   v.push_back(pair<Double_t,Double_t>(0,-s));// lower   
00459   v.push_back(pair<Double_t,Double_t>(s,0));
00460  
00461   MSG("Swim",Msg::kDebug)<<"Near Collar Top(X,Y) = "<<0<<","<<s<<endl;
00462   MSG("Swim",Msg::kDebug)<<"Near Collar Left(X,Y) = "<<s<<","<<0<<endl;
00463   MSG("Swim",Msg::kDebug)<<"Near Collar Bottom(X,Y) = "<<0<<","<<-s<<endl;
00464   MSG("Swim",Msg::kDebug)<<"Near Collar Right(X,Y) = "<<-s<<","<<0<<endl;
00465   
00466   return v;
00467 }

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

Definition at line 35 of file SwimGeo.cxx.

References fInstance, fVldRange, MSG, and SwimGeo().

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

00036 {
00037   // Return a compatible instance.
00038 
00039   // If there is an existing one and it is compatible use it
00040   if (fInstance && (fInstance->fVldRange).IsCompatible(vldc)) return fInstance;
00041 
00042   // What we have is unacceptable
00043   if (fInstance) {
00044     MSG("Swim",Msg::kDebug) 
00045       << "SwimGeo kill version for range " << fInstance->fVldRange << endl;
00046     delete fInstance;
00047   }
00048   fInstance = new SwimGeo(vldc);
00049 
00050   return fInstance;
00051 }

bool SwimGeo::IsInside Double_t  xp,
Double_t  yp,
const std::vector< std::pair< Double_t, Double_t > > &  v
const
 

Definition at line 562 of file SwimGeo.cxx.

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

00564 {
00565   // Is (xp,yp) inside the plane outline represented by v?
00566   // taken from TMath::IsInside and modified to use my data structure
00567   Double_t xint;
00568   Int_t inter = 0;
00569   Int_t np=v.size(); 
00570   for (Int_t i=0;i<np-1;i++) {
00571     if (v[i].second == v[i+1].second) continue;
00572     if (yp <= v[i].second && yp <= v[i+1].second) continue;
00573     if (v[i].second < yp && v[i+1].second < yp) continue;
00574     xint = v[i].first 
00575       + (yp-v[i].second)*(v[i+1].first-v[i].first)/(v[i+1].second-v[i].second);
00576     if (xp < xint) inter++;
00577   }
00578   if (inter%2) return true;
00579   return false;
00580 }

Bool_t SwimGeo::IsInsideCoil TVector3  xyz,
Detector::Detector_t  dt
 

Definition at line 492 of file SwimGeo.cxx.

References fFarBegSM2Z, fNearCoil, and IsInside().

Referenced by GetSwimMaterial().

00493 {
00494   // Check to see if point is inside coil region
00495   Double_t x = xyz.X();
00496   Double_t y = xyz.Y();
00497   Double_t z = xyz.Z();
00498   
00499   Double_t r=TMath::Sqrt(x*x+y*y);
00500   if ( dt == Detector::kNear ) {
00501  
00502     if( IsInside(x,y,fNearCoil) ) return true;
00503     
00504   }
00505   else if ( dt == Detector::kFar ) {
00506     
00507     if( r < fFarCoilRadius && z > fFarBegSM2Z && z < fFarEndSM1Z ) return true;
00508     
00509   }
00510   
00511   return false;
00512   
00513 }

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

Definition at line 540 of file SwimGeo.cxx.

References fFarBegSM2Z, fNearInnerCollar, and IsInside().

Referenced by GetSwimMaterial().

00541 {
00542   Double_t x = xyz.X();
00543   Double_t y = xyz.Y();
00544   Double_t z = xyz.Z();
00545   
00546   Double_t r=TMath::Sqrt(x*x+y*y);
00547  
00548   if ( dt == Detector::kNear ) {
00549     
00550     if( IsInside(x,y,fNearInnerCollar) ) return true;
00551   }
00552   
00553   else if ( dt == Detector::kFar ) {
00554     
00555     if( r < fFarInnerCollarRadius && z > fFarBegSM2Z && z < fFarEndSM1Z ) return true;
00556   }
00557   return false;
00558 }

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

Definition at line 517 of file SwimGeo.cxx.

References fFarBegSM2Z, fNearOuterCollar, and IsInside().

Referenced by GetSwimMaterial().

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

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

Definition at line 141 of file SwimGeo.cxx.

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

Referenced by SwimGeo().

00142 {
00143 
00144   MsgStream& msg = MSGSTREAM("Swim",Msg::kInfo);
00145 
00146   double prevz = 0.0;
00147   for (int i=0; i <= fInterface.GetLast(); ++i) {
00148     SwimPlaneInterface *spi =
00149       dynamic_cast<SwimPlaneInterface*>(fInterface.At(i));
00150     if ( ! spi ) continue;
00151     spi->Print("0");
00152     double thisz = spi->GetZ();
00153     msg << " dz = " << thisz - prevz << endl;
00154     prevz = thisz;
00155   }
00156 }

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

Definition at line 323 of file SwimGeo.cxx.

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

Referenced by GetSwimMaterial().

00324 {
00325   // This function sets fNextPlaneZ,it returns false if out of detector
00326   int ibeg;
00327   int iend;
00328   int idirection;
00329   int i;
00330   //  cout << " in get mat " << stepdata.GetSPI() << " " << fNInterfaces << " " << zDir << endl; 
00331   // if stepdata.fSPI has not been set (is -1), then set it
00332   if ( stepdata.GetSPI() == -1 ) {
00333     
00334     Int_t iLow=0;
00335     Int_t iHi=fNInterfaces;
00336     Int_t iMid=0;
00337     Double_t z = xyz.Z();
00338     while( (iHi-iLow)>1){
00339       iMid=(iLow+iHi) >> 1;
00340       SwimPlaneInterface *spi = fInterfaceList[iMid];
00341       if(z>=spi->GetZ())
00342         iLow=iMid;
00343       else
00344         iHi=iMid;
00345     }
00346     
00347     if (zDir) {
00348       stepdata.SetSPI(iHi);
00349     } else {
00350       stepdata.SetSPI(iLow);
00351     }
00352   }            
00353  
00354   ibeg = stepdata.GetSPI();  
00355   if (zDir) {
00356     iend = fNInterfaces;
00357     idirection = 1;
00358   }
00359   else {
00360     iend = -1;
00361     idirection = -1;
00362   }
00363   //  cout << " lookup " << ibeg  << " " << iend << " " << idirection << endl;
00364   for (i=ibeg; i!=iend; i+=idirection) {
00365     SwimPlaneInterface *spi = fInterfaceList[i];
00366     Double_t spiZ=spi->GetZ();
00367     Double_t xyzZ=xyz.Z();
00368     //  cout  << " z " << spiZ << " " << xyzZ << endl;
00369     if (zDir && spiZ > xyzZ ) {
00370       stepdata.SetSPI(i);
00371       fNextPlaneZ = spiZ;
00372       return true;
00373     }
00374     else if (!zDir && spiZ < xyzZ ) {
00375       stepdata.SetSPI(i);
00376       fNextPlaneZ = spiZ;
00377       return true;
00378     }
00379   }
00380   
00381   
00382   // Outside the detector
00383   fNextPlaneZ = 0.0;
00384   return false;
00385   }


Member Data Documentation

Double_t SwimGeo::fFarBegSM2Z [private]
 

Definition at line 117 of file SwimGeo.h.

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

Double_t SwimGeo::fFarCoilRadius [private]
 

Definition at line 113 of file SwimGeo.h.

Referenced by SwimGeo().

Double_t SwimGeo::fFarEndSM1Z [private]
 

Definition at line 116 of file SwimGeo.h.

Referenced by SwimGeo().

Double_t SwimGeo::fFarInnerCollarRadius [private]
 

Definition at line 114 of file SwimGeo.h.

Referenced by SwimGeo().

Double_t SwimGeo::fFarOuterCollarRadius [private]
 

Definition at line 115 of file SwimGeo.h.

Referenced by SwimGeo().

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

Definition at line 31 of file SwimGeo.cxx.

Referenced by Instance().

TObjArray SwimGeo::fInterface [private]
 

Definition at line 106 of file SwimGeo.h.

Referenced by Print(), and SwimGeo().

SwimPlaneInterface* SwimGeo::fInterfaceList[5000] [private]
 

Definition at line 107 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 122 of file SwimGeo.h.

Referenced by IsInsideCoil(), and SwimGeo().

Double_t SwimGeo::fNearCoilLength [private]
 

Definition at line 118 of file SwimGeo.h.

Referenced by SwimGeo().

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

Definition at line 124 of file SwimGeo.h.

Referenced by IsInsideInnerCollar(), and SwimGeo().

Double_t SwimGeo::fNearInnerCollarLength [private]
 

Definition at line 120 of file SwimGeo.h.

Referenced by InitNearInnerCollar(), and SwimGeo().

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

Definition at line 123 of file SwimGeo.h.

Referenced by IsInsideOuterCollar(), and SwimGeo().

Double_t SwimGeo::fNearOuterCollarLength [private]
 

Definition at line 119 of file SwimGeo.h.

Referenced by InitNearOuterCollar(), and SwimGeo().

double SwimGeo::fNextPlaneZ [private]
 

Definition at line 109 of file SwimGeo.h.

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

int SwimGeo::fNInterfaces [private]
 

Definition at line 108 of file SwimGeo.h.

Referenced by SwimGeo().

VldContext SwimGeo::fVld [private]
 

Definition at line 111 of file SwimGeo.h.

Referenced by GetSwimMaterial(), and SwimGeo().

VldRange SwimGeo::fVldRange [private]
 

Definition at line 110 of file SwimGeo.h.

Referenced by Instance(), and SwimGeo().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:21 2010 for loon by  doxygen 1.3.9.1