CMS 3D CMS Logo

VisG4ExampleParametrisation.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 
00003 #include "VisExamples/VisG4ExN02/src/VisG4ExampleParametrisation.h"
00004 #include <classlib/utils/DebugAids.h>
00005 #include <G4VPhysicalVolume.hh>
00006 #include <G4ThreeVector.hh>
00007 #include <G4Box.hh>
00008 
00009 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00010 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00011 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00012 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00013 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00014 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00015 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00016 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00017 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00018 
00019 VisG4ExampleParametrisation::VisG4ExampleParametrisation (int nchambers, double zstart,
00020                                                   double zspacing, double chamberWidth,
00021                                                   double initialLen, double finalLen)
00022     : m_nchambers (nchambers),
00023       m_zstart    (zstart),
00024       m_zspacing  (zspacing),
00025       m_halfWidth (chamberWidth/2),
00026       m_halfFirst (initialLen/2),
00027       m_halfIncr  (nchambers > 0 ? (finalLen - initialLen)/(nchambers*2) : 0)
00028 { ASSERT (m_zspacing >= chamberWidth); }
00029 
00030 void
00031 VisG4ExampleParametrisation::ComputeTransformation (G4int copy, G4VPhysicalVolume *pv) const
00032 {
00033     pv->SetTranslation (G4ThreeVector (0, 0, m_zstart + (copy+1) * m_zspacing));
00034     pv->SetRotation (0);
00035 }
00036 
00037 void
00038 VisG4ExampleParametrisation::ComputeDimensions (G4Box &chamber, G4int copy,
00039                                             const G4VPhysicalVolume *) const
00040 {
00041     double halfLength = m_halfFirst + copy * m_halfIncr;
00042     chamber.SetXHalfLength (halfLength);
00043     chamber.SetYHalfLength (halfLength);
00044     chamber.SetZHalfLength (m_halfWidth);
00045 }

Generated on Tue Jun 9 17:49:46 2009 for CMSSW by  doxygen 1.5.4