#include <G4tgbPlaceParamLinear.hh>
Inheritance diagram for G4tgbPlaceParamLinear:
Public Member Functions | |
G4tgbPlaceParamLinear (G4tgrPlaceParameterisation *) | |
~G4tgbPlaceParamLinear () | |
void | ComputeTransformation (const G4int copyNo, G4VPhysicalVolume *physVol) const |
Definition at line 51 of file G4tgbPlaceParamLinear.hh.
G4tgbPlaceParamLinear::G4tgbPlaceParamLinear | ( | G4tgrPlaceParameterisation * | ) |
Definition at line 50 of file G4tgbPlaceParamLinear.cc.
References G4tgbPlaceParameterisation::CheckNExtraData(), FatalException, G4cout, G4endl, G4Exception(), G4tgrPlaceParameterisation::GetExtraData(), G4tgrPlaceParameterisation::GetParamType(), G4tgrMessenger::GetVerboseLevel(), kXAxis, kYAxis, kZAxis, G4tgbPlaceParameterisation::theAxis, G4tgbPlaceParameterisation::theNCopies, G4tgbPlaceParameterisation::theTranslation, and WLSIZE_EQ.
00051 : G4tgbPlaceParameterisation(tgrParam) 00052 { 00053 //---- Get translation and rotation 00054 if( tgrParam->GetParamType() == "LINEAR" ) 00055 { 00056 CheckNExtraData( tgrParam, 6, WLSIZE_EQ, "G4tgbPlaceParamLinear:"); 00057 theDirection = G4ThreeVector( tgrParam->GetExtraData()[3], 00058 tgrParam->GetExtraData()[4], 00059 tgrParam->GetExtraData()[5] ); 00060 theAxis = kZAxis; 00061 } 00062 else 00063 { 00064 CheckNExtraData( tgrParam, 3, WLSIZE_EQ, "G4tgbPlaceParamLinear:"); 00065 if( tgrParam->GetParamType() == "LINEAR_X" ) { 00066 theDirection = G4ThreeVector(1.,0.,0.); 00067 theAxis = kXAxis; 00068 } else if( tgrParam->GetParamType() == "LINEAR_Y" ) { 00069 theDirection = G4ThreeVector(0.,1.,0.); 00070 theAxis = kYAxis; 00071 } else if( tgrParam->GetParamType() == "LINEAR_Z" ) { 00072 theDirection = G4ThreeVector(0.,0.,1.); 00073 theAxis = kZAxis; 00074 } 00075 } 00076 00077 if( theDirection.mag() == 0. ) 00078 { 00079 G4Exception("G4tgbPlaceParamLinear::G4tgbPlaceParamLinear()", 00080 "InvalidSetup", FatalException, "Direction is zero !"); 00081 } 00082 else 00083 { 00084 theDirection /= theDirection.mag(); 00085 } 00086 00087 theNCopies = G4int(tgrParam->GetExtraData()[0]); 00088 theStep = tgrParam->GetExtraData()[1]; 00089 theOffset = tgrParam->GetExtraData()[2]; 00090 00091 theTranslation = G4ThreeVector(0.,0.,0.)+theOffset*theDirection; 00092 00093 #ifdef G4VERBOSE 00094 if( G4tgrMessenger::GetVerboseLevel() >= 2 ) 00095 { 00096 G4cout << " G4tgbPlaceParamLinear::G4tgbPlaceParamLinear(): " 00097 << " param type " << tgrParam->GetParamType() << G4endl 00098 << " N copies " << theNCopies << G4endl 00099 << " step " << theStep << G4endl 00100 << " offset " << theOffset << G4endl 00101 << " translation " << theTranslation << G4endl 00102 << " direction " << theDirection << G4endl 00103 << " axis " << theAxis << G4endl; 00104 } 00105 #endif 00106 }
G4tgbPlaceParamLinear::~G4tgbPlaceParamLinear | ( | ) |
void G4tgbPlaceParamLinear::ComputeTransformation | ( | const G4int | copyNo, | |
G4VPhysicalVolume * | physVol | |||
) | const [virtual] |
Reimplemented from G4tgbPlaceParameterisation.
Definition at line 111 of file G4tgbPlaceParamLinear.cc.
References G4cout, G4endl, G4VPhysicalVolume::GetName(), G4tgrMessenger::GetVerboseLevel(), G4VPhysicalVolume::SetCopyNo(), G4VPhysicalVolume::SetRotation(), G4VPhysicalVolume::SetTranslation(), G4tgbPlaceParameterisation::theRotationMatrix, and G4tgbPlaceParameterisation::theTranslation.
00112 { 00113 G4ThreeVector origin = theTranslation + copyNo*theStep*theDirection; 00114 00115 #ifdef G4VERBOSE 00116 if( G4tgrMessenger::GetVerboseLevel() >= 3 ) 00117 { 00118 G4cout << " G4tgbPlaceParamLinear::ComputeTransformation() -" 00119 << physVol->GetName() << G4endl 00120 << " copyNo " << copyNo << " pos " << origin << G4endl; 00121 } 00122 #endif 00123 //----- Set traslation and rotation 00124 physVol->SetTranslation(origin); 00125 physVol->SetCopyNo( copyNo ); 00126 physVol->SetRotation( theRotationMatrix ); 00127 }