#include <G4tgbPlaceParamSquare.hh>
Inheritance diagram for G4tgbPlaceParamSquare:
Public Member Functions | |
G4tgbPlaceParamSquare (G4tgrPlaceParameterisation *) | |
~G4tgbPlaceParamSquare () | |
void | ComputeTransformation (const G4int copyNo, G4VPhysicalVolume *physVol) const |
Definition at line 49 of file G4tgbPlaceParamSquare.hh.
G4tgbPlaceParamSquare::G4tgbPlaceParamSquare | ( | G4tgrPlaceParameterisation * | ) |
Definition at line 50 of file G4tgbPlaceParamSquare.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() == "SQUARE" ) 00055 { 00056 CheckNExtraData( tgrParam, 12, WLSIZE_EQ, "G4tgbPlaceParamSquare:"); 00057 theDirection1 = G4ThreeVector( tgrParam->GetExtraData()[6], 00058 tgrParam->GetExtraData()[7], 00059 tgrParam->GetExtraData()[8] ); 00060 theDirection2 = G4ThreeVector( tgrParam->GetExtraData()[9], 00061 tgrParam->GetExtraData()[10], 00062 tgrParam->GetExtraData()[11] ); 00063 theAxis = kZAxis; 00064 } 00065 else 00066 { 00067 CheckNExtraData( tgrParam, 6, WLSIZE_EQ, "G4tgbPlaceParamSquare:"); 00068 if( tgrParam->GetParamType() == "SQUARE_XY" ) 00069 { 00070 theDirection1 = G4ThreeVector(1.,0.,0.); 00071 theDirection2 = G4ThreeVector(0.,1.,0.); 00072 theAxis = kZAxis; 00073 } 00074 else if( tgrParam->GetParamType() == "SQUARE_YZ" ) 00075 { 00076 theDirection1 = G4ThreeVector(0.,1.,0.); 00077 theDirection2 = G4ThreeVector(0.,0.,1.); 00078 theAxis = kXAxis; 00079 } 00080 else if( tgrParam->GetParamType() == "SQUARE_XZ" ) 00081 { 00082 theDirection1 = G4ThreeVector(1.,0.,0.); 00083 theDirection2 = G4ThreeVector(0.,0.,1.); 00084 theAxis = kYAxis; 00085 } 00086 } 00087 00088 if( theDirection1.mag() == 0. ) 00089 { 00090 G4Exception("G4tgbPlaceParamSquare::G4tgbPlaceParamSquare()", 00091 "InvalidSetup", FatalException, "Direction1 is zero !"); 00092 } 00093 else 00094 { 00095 theDirection1 /= theDirection1.mag(); 00096 } 00097 if( theDirection2.mag() == 0. ) 00098 { 00099 G4Exception("G4tgbPlaceParamSquare::G4tgbPlaceParamSquare()", 00100 "InvalidSetup", FatalException, "Direction2 is zero !"); 00101 } 00102 else 00103 { 00104 theDirection2 /= theDirection2.mag(); 00105 } 00106 00107 theNCopies1 = G4int(tgrParam->GetExtraData()[0]); 00108 theNCopies2 = G4int(tgrParam->GetExtraData()[1]); 00109 theStep1 = tgrParam->GetExtraData()[2]; 00110 theStep2 = tgrParam->GetExtraData()[3]; 00111 theOffset1 = tgrParam->GetExtraData()[4]; 00112 theOffset2 = tgrParam->GetExtraData()[5]; 00113 00114 theNCopies = theNCopies1 * theNCopies2; 00115 theTranslation = theOffset1*theDirection1 + theOffset2*theDirection2; 00116 00117 #ifdef G4VERBOSE 00118 if( G4tgrMessenger::GetVerboseLevel() >= 2 ) 00119 G4cout << "G4tgbPlaceParamSquare: no copies " 00120 << theNCopies << " = " << theNCopies1 00121 << " X " << theNCopies2 << G4endl 00122 << " offset1 " << theOffset1 << G4endl 00123 << " offset2 " << theOffset1 << G4endl 00124 << " step1 " << theStep1 << G4endl 00125 << " step2 " << theStep2 << G4endl 00126 << " direction1 " << theDirection1 << G4endl 00127 << " direction2 " << theDirection2 << G4endl 00128 << " translation " << theTranslation << G4endl; 00129 #endif 00130 }
G4tgbPlaceParamSquare::~G4tgbPlaceParamSquare | ( | ) |
void G4tgbPlaceParamSquare::ComputeTransformation | ( | const G4int | copyNo, | |
G4VPhysicalVolume * | physVol | |||
) | const [virtual] |
Reimplemented from G4tgbPlaceParameterisation.
Definition at line 135 of file G4tgbPlaceParamSquare.cc.
References G4cout, G4endl, G4VPhysicalVolume::GetName(), G4tgrMessenger::GetVerboseLevel(), G4VPhysicalVolume::SetCopyNo(), G4VPhysicalVolume::SetRotation(), G4VPhysicalVolume::SetTranslation(), G4tgbPlaceParameterisation::theAxis, G4tgbPlaceParameterisation::theNCopies, G4tgbPlaceParameterisation::theRotationMatrix, and G4tgbPlaceParameterisation::theTranslation.
00136 { 00137 #ifdef G4VERBOSE 00138 if( G4tgrMessenger::GetVerboseLevel() >= 3 ) 00139 { 00140 G4cout << " G4tgbPlaceParamSquare::ComputeTransformation():" 00141 << physVol->GetName() << G4endl 00142 << " no copies " << theNCopies << G4endl 00143 << " offset1 " << theOffset1 << G4endl 00144 << " offset2 " << theOffset2 << G4endl 00145 << " step1 " << theStep1 << G4endl 00146 << " step2 " << theStep2 << G4endl; 00147 } 00148 #endif 00149 00150 G4int copyNo1 = copyNo%theNCopies1; 00151 G4int copyNo2 = G4int(copyNo/theNCopies1); 00152 G4double posi1 = copyNo1*theStep1; 00153 G4double posi2 = copyNo2*theStep2; 00154 G4ThreeVector origin = posi1*theDirection1+ posi2*theDirection2; 00155 origin += theTranslation; 00156 00157 #ifdef G4VERBOSE 00158 if( G4tgrMessenger::GetVerboseLevel() >= 3 ) 00159 { 00160 G4cout << " G4tgbPlaceParamSquare::ComputeTransformation() - " 00161 << copyNo << " = " << copyNo1 << ", X " << copyNo2 << G4endl 00162 << " pos: " << origin << ", axis: " << theAxis << G4endl; 00163 } 00164 #endif 00165 //----- Set traslation and rotation 00166 physVol->SetTranslation(origin); 00167 physVol->SetCopyNo( copyNo ); 00168 physVol->SetRotation( theRotationMatrix ); 00169 }