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

geo Namespace Reference

Detector geometry definition and interface. More...


Classes

class  CellGeo
 Encapsulate the cell geometry. More...

class  Exception
 Exceptions thrown by the geometry package. More...

class  Geometry
 The geometry of one entire detector (near, far, ipnd). More...

class  PlaneGeo
 Geometry information for a single readout plane. More...


Typedefs

typedef unsigned long long int CellUniqueId
typedef enum geo::_readout Readout_t
 Enumerate the possible locations of the cell readout.

typedef enum geo::_plane_proj View_t
 Enumerate the possible plane projections.


Enumerations

enum  _return_codes { kPLANE_NOT_FOUND = 999000 }
 Return codes which flag errors and the like. More...

enum  _readout { kTop, kWest, kEast, kAnySide }
 Enumerate the possible locations of the cell readout. More...

enum  _plane_proj { kX, kY, kXorY }
 Enumerate the possible plane projections. More...


Functions

CellUniqueId NodesToUniqueId (const std::vector< const TGeoNode * > &n, unsigned int depth)
CellUniqueId PathToUniqueId (const char *path)
CellUniqueId IdsToUniqueId (const std::vector< int > &ids)
void GetNodeNumbers (const char *nm, std::vector< int > &id)
void ProjectToBoxEdge (const double xyz[], const double dxyz[], double xlo, double xhi, double ylo, double yhi, double zlo, double zhi, double xyzout[])
double ClosestApproach (const double point[], const double intercept[], const double slopes[], double closest[])


Detailed Description

Detector geometry definition and interface.

Typedef Documentation

typedef unsigned long long int geo::CellUniqueId
 

Definition at line 15 of file CellUniqueId.h.

Referenced by geo::Geometry::CurrentCellId(), geo::CellGeo::Id(), IdsToUniqueId(), geo::Geometry::IdToCell(), NodesToUniqueId(), PathToUniqueId(), and testUniqueId().

typedef enum geo::_readout geo::Readout_t
 

Enumerate the possible locations of the cell readout.

typedef enum geo::_plane_proj geo::View_t
 

Enumerate the possible plane projections.

Referenced by rpr::TrackReco::CalcChi2Ndof(), rpr::TrackReco::Connection(), recobase::TrackBase::dT(), recobase::TrackBase::EndT(), subshower::RecoSubShower::FindMaxWindow(), spider::Filament::Geo(), spider::WebWalker::GetFilaments(), geo::Geometry::GetPlanesByView(), recobase::RecoPoint::SetPosT(), recobase::TrackBase::SetXY(), recobase::TrackBase::StartT(), recobase::TrackBase::T(), recobase::RecoPoint::T(), geo::PlaneGeo::View(), and recobase::TrackBase::XY().


Enumeration Type Documentation

enum geo::_plane_proj
 

Enumerate the possible plane projections.

Enumeration values:
kX  Vertical planes which measure X.
kY  Horizontal planes which measure Y.
kXorY  X or Y views.

Definition at line 25 of file PlaneGeo.h.

00025                            {
00026     kX,   
00027     kY,   
00028     kXorY 
00029   } View_t;

enum geo::_readout
 

Enumerate the possible locations of the cell readout.

Enumeration values:
kTop  Vertical modules readout on the top.
kWest  Horizontal modules readout on the west.
kEast  Horizontal modules readout on the east.
kAnySide  Don't care which side the read out is on.

Definition at line 18 of file PlaneGeo.h.

00018                         {
00019     kTop,    
00020     kWest,   
00021     kEast,   
00022     kAnySide 
00023   } Readout_t;

enum geo::_return_codes
 

Return codes which flag errors and the like.

Enumeration values:
kPLANE_NOT_FOUND 

Definition at line 24 of file Geometry.h.

00024                      {
00025     kPLANE_NOT_FOUND = 999000
00026   };


Function Documentation

double geo::ClosestApproach const double  point[],
const double  intercept[],
const double  slopes[],
double  closest[]
 

Find the distance of closest approach between point and line

Parameters:
point - xyz coordinates of point
intercept - xyz coodinated of point on line
slopes - unit vector direction (need not be normalized)
closest - on output, point on line that is closest
Returns:
distance from point to line

Definition at line 68 of file geo.cxx.

Referenced by mcchk::CosmicAna::Ana().

00072   {
00073     double s = 
00074       (slopes[0]*(point[0]-intercept[0]) + 
00075        slopes[1]*(point[1]-intercept[1]) +
00076        slopes[2]*(point[2]-intercept[2]));
00077     double sd = 
00078       (slopes[0]*slopes[0] + 
00079        slopes[1]*slopes[1] +
00080        slopes[2]*slopes[2]);
00081     if (sd>0.0) {
00082       s /= sd;
00083       closest[0] = intercept[0] + s*slopes[0];
00084       closest[1] = intercept[1] + s*slopes[1];
00085       closest[2] = intercept[2] + s*slopes[2];
00086     }
00087     else {
00088       // How to handle this zero gracefully? Assume that the intercept
00089       // is a particle vertex and "slopes" are momenta. In that case,
00090       // the particle goes nowhere and the closest approach is the
00091       // distance from the intercept to point
00092       closest[0] = intercept[0];
00093       closest[1] = intercept[1];
00094       closest[2] = intercept[2];
00095     }
00096     return sqrt(pow((point[0]-closest[0]),2)+
00097                 pow((point[1]-closest[1]),2)+
00098                 pow((point[2]-closest[2]),2));
00099   }

void geo::GetNodeNumbers const char *  nm,
std::vector< int > &  id
 

Definition at line 65 of file CellUniqueId.cxx.

Referenced by NodesToUniqueId(), PathToUniqueId(), and testUniqueId().

00066   {
00067     char buff[8];
00068     const char* c;
00069     const char* start = nm;
00070     const char* end;
00071     int indx;
00072     while (1) {
00073       start = strchr(start, '_');
00074       if (start == NULL) break;
00075       ++start;
00076       end = strchr(start, '/');
00077       if (end==NULL) end = strchr(start, '\0');
00078       if (end==NULL) abort();
00079       
00080       for (indx=0, c=start; c<end; ++indx, ++c) buff[indx] = *c;
00081       buff[indx] = '\0';
00082       id.push_back(atoi(buff));
00083     }
00084   }

CellUniqueId geo::IdsToUniqueId const std::vector< int > &  ids  ) 
 

Definition at line 40 of file CellUniqueId.cxx.

References CellUniqueId.

Referenced by NodesToUniqueId(), and PathToUniqueId().

00041   {
00042     // Experience has shown that only depths below this "depth0"
00043     // contribute to a cell's 'uniqueness'.
00044     static const unsigned int depth0 = 3;
00045     
00046     // Now construct the id
00047     CellUniqueId id = 0ULL;
00048     for (unsigned int i=depth0; i<ids.size(); ++i) {
00049       // The following check is useful, although not really
00050       // required. The code in Geometry.cxx checks that the ID's are
00051       // unique which is all that really matters. Even if we happen to
00052       // overflow the storage limits of the CellUniqueId, the result
00053       // will always be the same for the same cell. So, as long as the
00054       // overflow is unique, all is OK. BTW, I've checked that as of
00055       // at least v1.6 2008/08/17 the CellUniqueID's do not overflow
00056       //
00057       // if (id>0 && ULLONG_MAX/id < 1000) abort();
00058       id = 1000*id + ids[i];
00059     }
00060     return id;
00061   }

CellUniqueId geo::NodesToUniqueId const std::vector< const TGeoNode * > &  n,
unsigned int  depth
 

Definition at line 17 of file CellUniqueId.cxx.

References CellUniqueId, GetNodeNumbers(), and IdsToUniqueId().

Referenced by geo::CellGeo::CellGeo().

00019   {
00020     static std::vector<int> ids;
00021     ids.clear();
00022     for (unsigned int i=0; i<=depth; ++i) {
00023       GetNodeNumbers(n[i]->GetName(), ids);
00024     }
00025     return IdsToUniqueId(ids);
00026   }

CellUniqueId geo::PathToUniqueId const char *  path  ) 
 

Definition at line 30 of file CellUniqueId.cxx.

References CellUniqueId, GetNodeNumbers(), and IdsToUniqueId().

Referenced by geo::Geometry::CurrentCellId(), novamc::MCApplication::Stepping(), and testUniqueId().

00031   {
00032     static std::vector<int> ids;
00033     ids.clear();
00034     GetNodeNumbers(path, ids);
00035     return IdsToUniqueId(ids);
00036   }

void geo::ProjectToBoxEdge const double  xyz[],
const double  dxyz[],
double  xlo,
double  xhi,
double  ylo,
double  yhi,
double  zlo,
double  zhi,
double  xyzout[]
 

Project along a direction from a particular starting point to the edge of a box

Parameters:
xyz - The starting x,y,z location. Must be inside box.
dxyz - Direction vector
xlo - Low edge of box in x
xhi - Low edge of box in x
ylo - Low edge of box in y
yhi - Low edge of box in y
zlo - Low edge of box in z
zhi - Low edge of box in z
xyzout - On output, the position at the box edge
Note: It should be safe to use the same array for input and output.

Definition at line 23 of file geo.cxx.

Referenced by evgen::CRYGen::Sample(), and testProject().

00029   {
00030     // Make sure we're inside the box!
00031     assert(xyz[0]>=xlo && xyz[0]<=xhi);
00032     assert(xyz[1]>=ylo && xyz[1]<=yhi);
00033     assert(xyz[2]>=zlo && xyz[2]<=zhi);
00034     
00035     // Compute the distances to the x/y/z walls
00036     double dx = 99.E99;
00037     double dy = 99.E99;
00038     double dz = 99.E99;
00039     if      (dxyz[0]>0.0) { dx = (xhi-xyz[0])/dxyz[0]; }
00040     else if (dxyz[0]<0.0) { dx = (xlo-xyz[0])/dxyz[0]; }
00041     if      (dxyz[1]>0.0) { dy = (yhi-xyz[1])/dxyz[1]; }
00042     else if (dxyz[1]<0.0) { dy = (ylo-xyz[1])/dxyz[1]; }
00043     if      (dxyz[2]>0.0) { dz = (zhi-xyz[2])/dxyz[2]; }
00044     else if (dxyz[2]<0.0) { dz = (zlo-xyz[2])/dxyz[2]; }
00045     
00046     // Choose the shortest distance
00047     double d = 0.0;
00048     if      (dx<dy && dx<dz) d = dx;
00049     else if (dy<dz && dy<dx) d = dy;
00050     else if (dz<dx && dz<dy) d = dz;
00051     
00052     // Make the step
00053     for (int i=0; i<3; ++i) {
00054       xyzout[i] = xyz[i] + dxyz[i]*d;
00055     }
00056   }


Generated on Thu Sep 4 02:05:34 2008 for NOvA Offline by doxygen 1.3.5