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

LCDG4CalSDProj Class Reference

#include <LCDG4CalSDProj.hh>

Inheritance diagram for LCDG4CalSDProj:

Inheritance graph
[legend]
Collaboration diagram for LCDG4CalSDProj:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LCDG4CalSDProj (G4String name, const XERCES_CPP_NAMESPACE::DOM_Element &voldb)
 ~LCDG4CalSDProj ()
unsigned int findCell (const G4ThreeVector &position)
G4ThreeVector getCellCenter (unsigned int cellIndex)
unsigned int getIndex1 (unsigned int cellIndex) const
unsigned int getIndex2 (unsigned int cellIndex) const
unsigned int getIndex3 (unsigned int cellIndex) const

Private Attributes

G4int _phiseg
G4int _thetaseg

Constructor & Destructor Documentation

LCDG4CalSDProj::LCDG4CalSDProj G4String  name,
const XERCES_CPP_NAMESPACE::DOM_Element &  voldb
 

LCDG4CalSDProj::~LCDG4CalSDProj  ) 
 

Definition at line 39 of file LCDG4CalSDProj.cc.

00039                                 {
00040 }


Member Function Documentation

unsigned int LCDG4CalSDProj::findCell const G4ThreeVector &  position  )  [virtual]
 

Implements LCDG4CalSD.

Definition at line 43 of file LCDG4CalSDProj.cc.

References _phiseg, _thetaseg, and LCDG4CalSD::index.

00043                                                               {
00044 
00045   // theta,phi are spherical coords from geant hit
00046   G4double hittheta = pos.theta();
00047   G4double hitphi = pos.phi();
00048   if(hitphi < 0.0) hitphi += 360.0*degree;
00049 
00050   G4double dphi   = 360.0*degree/_phiseg;
00051   G4double dtheta = 180.0*degree/_thetaseg;
00052   // convenience aliases
00053   unsigned int& ilayer = index[1];
00054   unsigned int& iphi   = index[2];
00055   unsigned int& itheta = index[3];
00056   // set geometry-dependent indices: index[2] and index[3]
00057   iphi   = int(hitphi/dphi);
00058   itheta = int(hittheta/dtheta);
00059   unsigned int cellIndex = itheta + _thetaseg* (iphi + _phiseg*ilayer);
00060   return cellIndex;
00061 }

G4ThreeVector LCDG4CalSDProj::getCellCenter unsigned int  cellIndex  )  [virtual]
 

Implements LCDG4CalSD.

Definition at line 64 of file LCDG4CalSDProj.cc.

References _phiseg, _thetaseg, LCDG4CalSD::index, LCDG4CalSD::layer0CenterDepth, LCDG4CalSD::layerThickness, and LCDG4CalSD::north.

00064                                                                   {
00065   if(cellIndex) ; // make compiler happy
00066   // convenience aliases
00067   unsigned int& sysno  = index[0];
00068   unsigned int& ilayer = index[1];
00069   unsigned int& iphi   = index[2];
00070   unsigned int& itheta = index[3];
00071 
00072   double dtheta = 180.*degree / _thetaseg;
00073   double dphi = 360.*degree / _phiseg;
00074   double theta = (itheta+0.5)*dtheta/radian;  // +0.5 for center of cell
00075   double phi = (iphi+0.5)*dphi/radian;        // +0.5 for center of cell
00076 
00077   // rcyl is cyl radius for the center of active material in i-th layer
00078   // rsph is spherical rad for the center of active
00079   double rcyl=0, zc=0;
00080   if(sysno%2==0) {
00081     // ** BARREL **
00082     rcyl = layer0CenterDepth + ilayer*layerThickness;
00083     zc = rcyl/tan(theta);
00084   }
00085   else {
00086     // ** ENDCAP **
00087     zc = layer0CenterDepth + ilayer*layerThickness;
00088     // Check for north/south
00089     if(north) zc = -zc;
00090     rcyl = zc*tan(theta);
00091     assert(rcyl >= 0.0);
00092   }
00093 
00094 
00095   double xc = rcyl*cos(phi);
00096   double yc = rcyl*sin(phi);
00097   G4ThreeVector cellcenter(xc,yc,zc);
00098   return cellcenter;
00099 }

unsigned int LCDG4CalSDProj::getIndex1 unsigned int  cellIndex  )  const [virtual]
 

Implements LCDG4CalSD.

Definition at line 102 of file LCDG4CalSDProj.cc.

References _phiseg, and _thetaseg.

00102                                                                    {
00103   unsigned int iaux = cellIndex - (cellIndex%_thetaseg);
00104   assert( iaux%_thetaseg == 0 );
00105   unsigned int iphi = (iaux/_thetaseg) % _phiseg;
00106   return iphi;
00107 }

unsigned int LCDG4CalSDProj::getIndex2 unsigned int  cellIndex  )  const [virtual]
 

Implements LCDG4CalSD.

Definition at line 110 of file LCDG4CalSDProj.cc.

References _thetaseg.

00110                                                                    {
00111   return cellIndex % _thetaseg;
00112 }

unsigned int LCDG4CalSDProj::getIndex3 unsigned int  cellIndex  )  const [virtual]
 

Implements LCDG4CalSD.

Definition at line 115 of file LCDG4CalSDProj.cc.

References _phiseg, and _thetaseg.

00115                                                                    {
00116   unsigned int imult = _phiseg*_thetaseg;
00117   unsigned int iaux = cellIndex - (cellIndex % imult);
00118   unsigned int ilayer = iaux / imult;
00119   return ilayer;
00120 }


Member Data Documentation

G4int LCDG4CalSDProj::_phiseg [private]
 

Definition at line 44 of file LCDG4CalSDProj.hh.

Referenced by findCell(), getCellCenter(), getIndex1(), and getIndex3().

G4int LCDG4CalSDProj::_thetaseg [private]
 

Definition at line 46 of file LCDG4CalSDProj.hh.

Referenced by findCell(), getCellCenter(), getIndex1(), getIndex2(), and getIndex3().


The documentation for this class was generated from the following files:
Generated on Thu Oct 7 18:45:05 2004 for LCDG4 by doxygen 1.3.4