00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "G4tgrPlaceDivRep.hh"
00037
00038 #include "G4SystemOfUnits.hh"
00039 #include "G4tgrUtils.hh"
00040 #include "G4tgrMessenger.hh"
00041 #include "G4tgrVolume.hh"
00042
00043
00044 G4tgrPlaceDivRep::G4tgrPlaceDivRep()
00045 : theNDiv(0), theWidth(0.), theAxis(kUndefined),
00046 theOffset(0.), theDivType(DivByNdivAndWidth)
00047 {
00048 }
00049
00050
00051
00052 G4tgrPlaceDivRep::~G4tgrPlaceDivRep()
00053 {
00054 }
00055
00056
00057 G4tgrPlaceDivRep::G4tgrPlaceDivRep( const std::vector<G4String>& wl )
00058 {
00059 theDivType = DivByNdivAndWidth;
00060
00061
00062 G4tgrUtils::CheckWLsize( wl, 6, WLSIZE_GE,
00063 "G4tgrPlaceDivRep::G4tgrPlaceDivRep" );
00064 G4tgrUtils::CheckWLsize( wl, 7, WLSIZE_LE,
00065 "G4tgrPlaceDivRep::G4tgrPlaceDivRep" );
00066
00067 theParentName = G4tgrUtils::GetString(wl[2]);
00068 theAxis = BuildAxis( G4tgrUtils::GetString(wl[3]) );
00069 theNDiv = G4tgrUtils::GetInt( wl[4] );
00070 theWidth = G4tgrUtils::GetDouble(wl[5])*mm;
00071 if( wl.size() == 7 )
00072 {
00073 theOffset = G4tgrUtils::GetDouble(wl[6])*mm;
00074 }
00075 else
00076 {
00077 theOffset = 0.;
00078 }
00079
00080 #ifdef G4VERBOSE
00081 if( G4tgrMessenger::GetVerboseLevel() >= 1 )
00082 {
00083 G4cout << " Created " << *this << G4endl;
00084 }
00085 #endif
00086
00087 }
00088
00089
00090
00091 EAxis G4tgrPlaceDivRep::BuildAxis( const G4String& axisName )
00092 {
00093 if( axisName == "X" ) {
00094 return kXAxis;
00095 } else if( axisName == "Y" ) {
00096 return kYAxis;
00097 } else if( axisName == "Z" ) {
00098 return kZAxis;
00099 } else if( axisName == "R" ) {
00100 return kRho;
00101 } else if( axisName == "PHI" ) {
00102 return kPhi;
00103 }
00104 else
00105 {
00106 G4String ErrMessage = "Axis type not found: " + axisName
00107 + ". Only valid axis are: X, Y, Z, R, PHI !";
00108 G4Exception("G4tgrVolumeDivision::GetReplicaAxis()",
00109 "InvalidAxis", FatalException, ErrMessage);
00110 }
00111 return kXAxis;
00112 }
00113
00114
00115
00116 std::ostream& operator<<(std::ostream& os, const G4tgrPlaceDivRep& obj)
00117 {
00118 os << "G4tgrPlaceDivRep= in " << obj.theParentName
00119 << " NDiv= " << obj.theNDiv << " Width= " << obj.theWidth
00120 << " Axis= " << obj.theAxis << " Offset= " << obj.theOffset
00121 << " DivType= " << obj.theDivType << G4endl;
00122
00123 return os;
00124 }