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

geo::PlaneGeo Class Reference

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

#include <PlaneGeo.h>

List of all members.

Public Member Functions

 PlaneGeo (std::vector< const TGeoNode * > &n, unsigned int depth)
 Construct a representation of a single plane of the detector.
unsigned int Ncells () const
 Number of cells in this plane.
const CellGeoCell (int icell) const
View_t View () const
 Which coordinate does this plane measure.
void LocalToWorld (const double *plane, double *world) const
 Transform point from local plane frame to world frame.
void LocalToWorldVect (const double *plane, double *world) const
 Transform direction vector from local to world.
void WorldToLocal (const double *world, double *plane) const
 Transform point from world frame to local plane frame.
void WorldToLocalVect (const double *world, double *plane) const
 Transform direction vector from world to local.

Private Member Functions

void FindCells (std::vector< const TGeoNode * > &n, unsigned int depth)
void MakeCell (std::vector< const TGeoNode * > &n, unsigned int depth)

Private Attributes

TGeoHMatrix * fGeoMatrix
 Plane to world transform.
Readout_t fReadout
 Which end is the readout on?
View_t fView
 Does this plane measure X or Y?
std::vector< CellGeo * > fCell
 List of cells in this plane.


Detailed Description

Geometry information for a single readout plane.

Definition at line 34 of file PlaneGeo.h.


Constructor & Destructor Documentation

PlaneGeo::PlaneGeo std::vector< const TGeoNode * > &  n,
unsigned int  depth
 

Construct a representation of a single plane of the detector.

Definition at line 29 of file PlaneGeo.cxx.

References fCell, fGeoMatrix, FindCells(), fReadout, and fView.

00030 {
00031   // build a matrix to take us from the local to the world coordinates
00032   // in one step
00033   fGeoMatrix = new TGeoHMatrix(*n[0]->GetMatrix());
00034   for (unsigned int i=1; i<=depth; ++i) {
00035     fGeoMatrix->Multiply(n[i]->GetMatrix());
00036   }
00037   
00038   // Determine read-out orientation for the plane.  By convention, the
00039   // planes, cells, and fibers are constructed such that the z-axis
00040   // goes along the long direction with z increasing as one moves
00041   // toward the read out end. So, a good way to find the read out end
00042   // is to take a small step in the +z direction which moves you
00043   // toward the read out side of the detector.
00044   static const double step = 10.0;     // size of step in cm
00045   static const double tol  = 0.1*step; // testing tolerance
00046   static const double a0[3] = {0,0,0};
00047   static const double a1[3] = {0,0,step};
00048   double b0[3], b1[3];
00049   fGeoMatrix->LocalToMaster(a0,b0);
00050   fGeoMatrix->LocalToMaster(a1,b1);
00051   b1[0] -= b0[0]; b1[1] -= b0[1]; b1[2] -= b0[2];
00052   if (fabs(b1[0]-0.0)<tol && fabs(b1[1]-step)<tol) {
00053     fView    = kX;
00054     fReadout = kTop;
00055   }
00056   else if (fabs(b1[0]-step)<tol && fabs(b1[1]-0.)<tol) {
00057     fView    = kY;
00058     fReadout = kWest;
00059   }
00060   else if (fabs(b1[0]+step)<tol && fabs(b1[1]-0.)<tol) {
00061     fView    = kY;
00062     fReadout = kEast;
00063   }
00064   else throw geo::Exception(__FILE__, __LINE__,
00065                             Exception::BAD_PLANE_VIEW,
00066                             "Could not determine view for plane");
00067   this->FindCells(n, depth);
00068 
00069   // Make sure horizontals are sorted top to bottom and verticals are
00070   // sorted east to west
00071   if (fView == kX) {
00072     sort(fCell.begin(), fCell.end(), sort_vert); 
00073   }
00074   else if (fView == kY) {
00075     sort(fCell.begin(), fCell.end(), sort_hori); 
00076   }
00077   else abort();
00078 }


Member Function Documentation

const CellGeo& geo::PlaneGeo::Cell int  icell  )  const [inline]
 

Return the icell'th cell in the plane. Should start from bottom and count up in case of horizontals. Should count from west to east in case of verticals

Definition at line 45 of file PlaneGeo.h.

Referenced by subshower::RecoSubShower::BestHough(), clusterss::MakeClusterSS::BestHough(), vali::Validator::BookPT(), geo::Geometry::BuildMaps(), subshower::RecoSubShower::CalculateEnergyVertexAngle(), geo::Geometry::CellInfo(), clusterss::MakeClusterSS::ClusterWindows(), clusterss::MakeClusterSS::FindAllTransverseWindows(), calib::Calibrator::GetXYZD(), subshower::RecoSubShower::HoughTransCluster(), clusterss::MakeClusterSS::HoughTransCluster(), geo::Geometry::IdToCell(), plane_sort(), vali::Validator::PlotCell(), vali::Validator::PlotPT(), evd::RawDataDrawer::RawDigit2D(), rpr::TrackReco::Reco(), rpr::FindTrackSeg::Reco(), geo::Geometry::SetDetectorSize(), clusterss::MakeClusterSS::StupidHoughNoWork(), testCellPos(), and subshower::RecoSubShower::TransCluster().

00045 { return *fCell[icell]; }

void PlaneGeo::FindCells std::vector< const TGeoNode * > &  n,
unsigned int  depth
[private]
 

Definition at line 82 of file PlaneGeo.cxx.

References MakeCell().

Referenced by PlaneGeo().

00084 {
00085   if (strncmp(n[depth]->GetName(),"vCell",5)==0) {
00086     this->MakeCell(n,depth);
00087     return;
00088   }
00089 
00090   // Explore the next layer down
00091   unsigned int deeper = depth+1;
00092   if (deeper>=n.size()) {
00093     throw Exception(__FILE__,__LINE__,Exception::BAD_NODE,
00094                     "Exceeded maximum depth");
00095   }
00096   const TGeoVolume* v = n[depth]->GetVolume();
00097   int nd = v->GetNdaughters();
00098   for (int i=0; i<nd; ++i) {
00099     n[deeper] = v->GetNode(i);
00100     this->FindCells(n, deeper);
00101   }
00102 }

void PlaneGeo::LocalToWorld const double *  plane,
double *  world
const
 

Transform point from local plane frame to world frame.

Definition at line 114 of file PlaneGeo.cxx.

References fGeoMatrix.

Referenced by rpr::TrackReco::Connection().

00115 {
00116   fGeoMatrix->LocalToMaster(plane, world);
00117 }

void PlaneGeo::LocalToWorldVect const double *  plane,
double *  world
const
 

Transform direction vector from local to world.

Definition at line 121 of file PlaneGeo.cxx.

References fGeoMatrix.

00122 {
00123   fGeoMatrix->LocalToMasterVect(plane, world);
00124 }

void PlaneGeo::MakeCell std::vector< const TGeoNode * > &  n,
unsigned int  depth
[private]
 

Definition at line 106 of file PlaneGeo.cxx.

References fCell.

Referenced by FindCells().

00108 {
00109   fCell.push_back(new CellGeo(n, depth));
00110 }

unsigned int geo::PlaneGeo::Ncells  )  const [inline]
 

Number of cells in this plane.

Definition at line 40 of file PlaneGeo.h.

Referenced by vali::Validator::BookPT(), geo::Geometry::BuildMaps(), geo::Geometry::CellInfo(), calib::Calibrator::GetXYZD(), and testCellPos().

00040 { return fCell.size(); }

View_t geo::PlaneGeo::View  )  const [inline]
 

Which coordinate does this plane measure.

Definition at line 48 of file PlaneGeo.h.

References geo::View_t.

Referenced by rpr::TrackReco::CalcChi2Ndof(), geo::Geometry::CellInfo(), vali::Validator::PlotCell(), vali::Validator::PlotPT(), raw_digit_sort(), evd::RawDataDrawer::RawDigit2D(), spider::SpiderWeb::Reco(), rpr::FindTrackSeg::Reco(), and testCellPos().

00048 { return fView; }

void PlaneGeo::WorldToLocal const double *  world,
double *  plane
const
 

Transform point from world frame to local plane frame.

Definition at line 128 of file PlaneGeo.cxx.

References fGeoMatrix.

00129 {
00130   fGeoMatrix->MasterToLocal(world, plane);
00131 }

void PlaneGeo::WorldToLocalVect const double *  world,
double *  plane
const
 

Transform direction vector from world to local.

Convert a vector from world frame to the local plane frame

Parameters:
world : 3-D array. Vector in world coordinates; input.
plane : 3-D array. Vector in plane coordinates; plane.

Definition at line 138 of file PlaneGeo.cxx.

References fGeoMatrix.

00139 {
00140   fGeoMatrix->MasterToLocalVect(world,plane);
00141 }


Member Data Documentation

std::vector<CellGeo*> geo::PlaneGeo::fCell [private]
 

List of cells in this plane.

Definition at line 70 of file PlaneGeo.h.

Referenced by MakeCell(), and PlaneGeo().

TGeoHMatrix* geo::PlaneGeo::fGeoMatrix [private]
 

Plane to world transform.

Definition at line 67 of file PlaneGeo.h.

Referenced by LocalToWorld(), LocalToWorldVect(), PlaneGeo(), WorldToLocal(), and WorldToLocalVect().

Readout_t geo::PlaneGeo::fReadout [private]
 

Which end is the readout on?

Definition at line 68 of file PlaneGeo.h.

Referenced by PlaneGeo().

View_t geo::PlaneGeo::fView [private]
 

Does this plane measure X or Y?

Definition at line 69 of file PlaneGeo.h.

Referenced by PlaneGeo().


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 04:45:32 2009 for NOvA Offline by  doxygen 1.3.9.1