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

CellGeo.cxx

Go to the documentation of this file.
00001 #include <iostream>
00002 #include "Geometry/CellGeo.h"
00003 #include "TGeoManager.h"
00004 #include "TGeoBBox.h"
00005 #include "TGeoMatrix.h"
00006 #include "TGeoNode.h"
00007 #include "Geometry/CellUniqueId.h"
00008 using namespace geo;
00009 
00011 CellGeo::CellGeo(std::vector<const TGeoNode*>& n, int depth)
00012 {
00013   fCellNode = n[depth];
00014   
00015   // Build the matrix that takes us to the top world frame
00016   fGeoMatrix = new TGeoHMatrix(*n[0]->GetMatrix());
00017   for (int i=1; i<=depth; ++i) {
00018     fGeoMatrix->Multiply(n[i]->GetMatrix());
00019   }
00020 
00021   // Construct the unique id for this cell
00022   fId = NodesToUniqueId(n, depth);
00023 }
00024 
00025 //......................................................................
00026 
00030 void CellGeo::LocalToWorld(const double* local, double* world) const
00031 {
00032   fGeoMatrix->LocalToMaster(local,world);
00033 }
00034 
00035 //......................................................................    
00036 
00040 void CellGeo::LocalToWorldVect(const double* local, double* world) const
00041 {
00042   fGeoMatrix->LocalToMasterVect(local,world);
00043 }
00044     
00045 //......................................................................
00046 
00050 void CellGeo::WorldToLocal(const double* local, double* world) const
00051 {
00052   fGeoMatrix->MasterToLocal(local,world);
00053 }
00054 
00055 //......................................................................
00056 
00060 void CellGeo::WorldToLocalVect(const double* local, double* world) const
00061 {
00062   fGeoMatrix->MasterToLocalVect(local,world);
00063 }
00064 
00065 //......................................................................
00066 
00071 void CellGeo::GetCenter(double* xyz, double localz) const
00072 {
00073   static double xyzLocal[3] = {0,0,0};
00074   xyzLocal[2] = localz;
00075   this->LocalToWorld(xyzLocal, xyz);
00076 }
00077 
00078 //......................................................................
00079 
00084 double CellGeo::DistToReadOut(double localz) const 
00085 {
00086   return this->HalfL()-localz;
00087 }
00088 
00089 //......................................................................
00090 
00091 double CellGeo::HalfW() const 
00092 {
00093   return ((TGeoBBox*)fCellNode->GetVolume()->GetShape())->GetDX();
00094 }
00095     
00096 //......................................................................
00097 
00098 double CellGeo::HalfL() const 
00099 {
00100   return ((TGeoBBox*)fCellNode->GetVolume()->GetShape())->GetDZ();
00101 }
00102 
00103 //......................................................................
00104 
00105 double CellGeo::HalfD() const 
00106 {
00107   return ((TGeoBBox*)fCellNode->GetVolume()->GetShape())->GetDY();
00108 }
00109 

Generated on Mon Nov 23 04:45:24 2009 for NOvA Offline by  doxygen 1.3.9.1