G4tgbPlaceParamCircle Class Reference

#include <G4tgbPlaceParamCircle.hh>

Inheritance diagram for G4tgbPlaceParamCircle:

G4tgbPlaceParameterisation G4VPVParameterisation

Public Member Functions

 G4tgbPlaceParamCircle (G4tgrPlaceParameterisation *)
 ~G4tgbPlaceParamCircle ()
void ComputeTransformation (const G4int copyNo, G4VPhysicalVolume *physVol) const

Detailed Description

Definition at line 52 of file G4tgbPlaceParamCircle.hh.


Constructor & Destructor Documentation

G4tgbPlaceParamCircle::G4tgbPlaceParamCircle ( G4tgrPlaceParameterisation  ) 

Definition at line 52 of file G4tgbPlaceParamCircle.cc.

References G4tgbPlaceParameterisation::CheckNExtraData(), FatalException, G4cout, G4endl, G4Exception(), G4tgrPlaceParameterisation::GetExtraData(), G4tgrPlaceParameterisation::GetParamType(), G4tgrMessenger::GetVerboseLevel(), kXAxis, kYAxis, kZAxis, G4tgbPlaceParameterisation::theAxis, G4tgbPlaceParameterisation::theNCopies, and WLSIZE_EQ.

00053   : G4tgbPlaceParameterisation(tgrParam)
00054 {
00055   //---- Get translation and rotation 
00056   if( tgrParam->GetParamType() == "CIRCLE" )
00057   {
00058     CheckNExtraData( tgrParam, 7, WLSIZE_EQ, "G4tgbPlaceParamCircle:");
00059     theCircleAxis = G4ThreeVector( tgrParam->GetExtraData()[4],
00060                                    tgrParam->GetExtraData()[5],
00061                                    tgrParam->GetExtraData()[6] );
00062 
00063     G4ThreeVector zaxis(0.,0.,-1.);
00064     if( zaxis.cross(theCircleAxis).mag() > 1.E-6 )
00065     {
00066       theDirInPlane = zaxis.cross(theCircleAxis);
00067     }
00068     else
00069     { 
00070       theDirInPlane = theCircleAxis.cross(G4ThreeVector(0.,-1.,0.));
00071     }
00072     theAxis = kZAxis;
00073   }
00074   else
00075   {
00076     CheckNExtraData( tgrParam, 4, WLSIZE_EQ, "G4tgbPlaceParamCircle:");
00077     if( tgrParam->GetParamType() == "CIRCLE_XY" ) {
00078       theCircleAxis = G4ThreeVector(0.,0.,1.);
00079       theDirInPlane = G4ThreeVector(1.,0.,0.);
00080       theAxis = kZAxis;
00081     } else if( tgrParam->GetParamType() == "CIRCLE_XZ" ) {
00082       theCircleAxis = G4ThreeVector(0.,1.,0.);
00083       theDirInPlane = G4ThreeVector(1.,0.,0.);
00084       theAxis = kYAxis;
00085     } else if( tgrParam->GetParamType() == "CIRCLE_YZ" ) {
00086       theCircleAxis = G4ThreeVector(1.,0.,0.);
00087       theDirInPlane = G4ThreeVector(0.,1.,0.);
00088       theAxis = kXAxis;
00089     }
00090   }
00091 
00092   if( theCircleAxis.mag() == 0. )
00093   {
00094     G4Exception("G4tgbPlaceParamCircle::G4tgbPlaceParamCircle()",
00095                 "InvalidSetup", FatalException, "Circle axis is zero !");
00096   }
00097   theCircleAxis /= theCircleAxis.mag();
00098 
00099   theAxis = kZAxis;
00100 
00101   theNCopies = G4int(tgrParam->GetExtraData()[0]);
00102   theStep = tgrParam->GetExtraData()[1];
00103   theOffset = tgrParam->GetExtraData()[2];
00104   theRadius = tgrParam->GetExtraData()[3];
00105 
00106 #ifdef G4VERBOSE
00107   if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00108   {
00109     G4cout << " G4tgbPlaceParamCircle::G4tgbPlaceParamCircle():" << G4endl
00110            << " param type " << tgrParam->GetParamType() << G4endl
00111            << "   no copies - " << theNCopies << G4endl
00112            << "   step - " << theStep << G4endl
00113            << "   offset - " << theOffset << G4endl
00114            << "   radius - " << theRadius << G4endl
00115            << "   circle axis - " << theCircleAxis << G4endl
00116            << "   dir in plane - " << theDirInPlane << G4endl;
00117   }
00118 #endif
00119 }

G4tgbPlaceParamCircle::~G4tgbPlaceParamCircle (  ) 

Definition at line 45 of file G4tgbPlaceParamCircle.cc.

00046 {
00047 }


Member Function Documentation

void G4tgbPlaceParamCircle::ComputeTransformation ( const G4int  copyNo,
G4VPhysicalVolume physVol 
) const [virtual]

Reimplemented from G4tgbPlaceParameterisation.

Definition at line 124 of file G4tgbPlaceParamCircle.cc.

References G4cout, G4endl, G4VPhysicalVolume::GetName(), G4VPhysicalVolume::GetRotation(), G4tgrMessenger::GetVerboseLevel(), G4VPhysicalVolume::SetCopyNo(), G4VPhysicalVolume::SetRotation(), G4VPhysicalVolume::SetTranslation(), G4tgbPlaceParameterisation::theNCopies, and G4tgbPlaceParameterisation::theRotationMatrix.

00125 { 
00126   G4double posi = theOffset + copyNo*theStep;
00127   G4ThreeVector origin = theDirInPlane * theRadius;
00128   origin.rotate( posi, theCircleAxis );
00129 
00130   //----- Calculate rotation matrix (so that all volumes point to the centre)
00131   G4RotationMatrix rm;
00132   rm.rotate( -posi, theCircleAxis );
00133 
00134   //----- Set translation and rotation
00135   physVol->SetTranslation(origin);
00136   G4RotationMatrix* pvRm = physVol->GetRotation();
00137   if( pvRm == 0 )
00138   {
00139     pvRm = new G4RotationMatrix;
00140   }
00141   *pvRm  = *theRotationMatrix * rm;
00142   physVol->SetRotation(pvRm);
00143   physVol->SetCopyNo( copyNo );
00144 
00145 #ifdef G4VERBOSE
00146   if( G4tgrMessenger::GetVerboseLevel() >= 3 )
00147   {
00148     G4cout << " G4tgbPlaceParamCircle::ComputeTransformation():" 
00149            << physVol->GetName() << G4endl
00150            << "   no copies - " << theNCopies  << G4endl
00151            << "   centre - " << origin << G4endl
00152            << "   rotation-matrix - " << *pvRm << G4endl;
00153   }
00154 #endif
00155 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:29 2013 for Geant4 by  doxygen 1.4.7