00001
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
00010
00011
00012
00013
00014
00015
00016
00017
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 }