G4ParameterisationTrdY Class Reference

#include <G4ParameterisationTrd.hh>

Inheritance diagram for G4ParameterisationTrdY:

G4VParameterisationTrd G4VDivisionParameterisation G4VPVParameterisation

Public Member Functions

 G4ParameterisationTrdY (EAxis axis, G4int nCopies, G4double width, G4double offset, G4VSolid *motherSolid, DivisionType divType)
 ~G4ParameterisationTrdY ()
void CheckParametersValidity ()
G4double GetMaxParameter () const
void ComputeTransformation (const G4int copyNo, G4VPhysicalVolume *physVol) const
void ComputeDimensions (G4Trd &trd, const G4int copyNo, const G4VPhysicalVolume *pv) const

Detailed Description

Definition at line 133 of file G4ParameterisationTrd.hh.


Constructor & Destructor Documentation

G4ParameterisationTrdY::G4ParameterisationTrdY ( EAxis  axis,
G4int  nCopies,
G4double  width,
G4double  offset,
G4VSolid motherSolid,
DivisionType  divType 
)

Definition at line 291 of file G4ParameterisationTrd.cc.

References G4VDivisionParameterisation::CalculateNDiv(), G4VDivisionParameterisation::CalculateWidth(), CheckParametersValidity(), DivNDIV, DivWIDTH, G4VDivisionParameterisation::fmotherSolid, G4VDivisionParameterisation::fnDiv, G4VDivisionParameterisation::foffset, G4VDivisionParameterisation::fwidth, G4cout, G4endl, G4Trd::GetYHalfLength1(), G4VDivisionParameterisation::SetType(), and G4VDivisionParameterisation::verbose.

00294   : G4VParameterisationTrd( axis, nDiv, width, offset, msolid, divType )
00295 {
00296   CheckParametersValidity();
00297   SetType( "DivisionTrdY" );
00298 
00299   G4Trd* msol = (G4Trd*)(fmotherSolid);
00300   if( divType == DivWIDTH )
00301   {
00302     fnDiv = CalculateNDiv( 2*msol->GetYHalfLength1(),
00303                            width, offset );
00304   }
00305   else if( divType == DivNDIV )
00306   {
00307     fwidth = CalculateWidth( 2*msol->GetYHalfLength1(),
00308                              nDiv, offset );
00309   }
00310 
00311 #ifdef G4DIVDEBUG
00312   if( verbose >= 1 )
00313   {
00314      G4cout << " G4ParameterisationTrdY no divisions " << fnDiv
00315             << " = " << nDiv << G4endl
00316             << " Offset " << foffset << " = " << offset << G4endl
00317             << " width " << fwidth << " = " << width << G4endl;
00318   }
00319 #endif
00320 }

G4ParameterisationTrdY::~G4ParameterisationTrdY (  ) 

Definition at line 323 of file G4ParameterisationTrd.cc.

00324 {
00325 }


Member Function Documentation

void G4ParameterisationTrdY::CheckParametersValidity (  )  [virtual]

Reimplemented from G4VDivisionParameterisation.

Definition at line 397 of file G4ParameterisationTrd.cc.

References G4VDivisionParameterisation::CheckParametersValidity(), FatalException, G4VDivisionParameterisation::fmotherSolid, G4endl, G4Exception(), G4Trd::GetYHalfLength1(), G4Trd::GetYHalfLength2(), and G4VDivisionParameterisation::kCarTolerance.

Referenced by G4ParameterisationTrdY().

00398 {
00399   G4VDivisionParameterisation::CheckParametersValidity();
00400 
00401   G4Trd* msol = (G4Trd*)(fmotherSolid);
00402 
00403   G4double mpDy1 = msol->GetYHalfLength1();
00404   G4double mpDy2 = msol->GetYHalfLength2();
00405 
00406   if( std::fabs(mpDy1 - mpDy2) > kCarTolerance )
00407   {
00408     std::ostringstream message;
00409     message << "Invalid solid specification. NOT supported." << G4endl
00410             << "Making a division of a TRD along axis Y while" << G4endl
00411             << "the Y half lengths are not equal is not (yet)" << G4endl
00412             << "supported. It will result in non-equal" << G4endl
00413             << "division solids.";
00414     G4Exception("G4ParameterisationTrdY::CheckParametersValidity()",
00415                 "GeomDiv0001", FatalException, message);
00416   }
00417 }

void G4ParameterisationTrdY::ComputeDimensions ( G4Trd trd,
const G4int  copyNo,
const G4VPhysicalVolume pv 
) const [virtual]

Reimplemented from G4VPVParameterisation.

Definition at line 374 of file G4ParameterisationTrd.cc.

References G4VSolid::DumpInfo(), G4VDivisionParameterisation::fhgap, G4VDivisionParameterisation::fmotherSolid, G4VDivisionParameterisation::fwidth, G4cout, G4endl, G4Trd::GetXHalfLength1(), G4Trd::GetXHalfLength2(), G4Trd::GetZHalfLength(), G4Trd::SetAllParameters(), and G4VDivisionParameterisation::verbose.

00375 {
00376   //---- The division along Y of a Trd will result a Trd, only 
00377   //--- if Y at -Z and +Z are equal, else use the G4Trap version
00378   G4Trd* msol = (G4Trd*)(fmotherSolid);
00379   
00380   G4double pDx1 = msol->GetXHalfLength1();
00381   G4double pDx2 = msol->GetXHalfLength2();
00382   G4double pDz = msol->GetZHalfLength();
00383   G4double pDy = fwidth/2. - fhgap;
00384  
00385   trd.SetAllParameters ( pDx1, pDx2, pDy, pDy, pDz );
00386 
00387 #ifdef G4DIVDEBUG
00388   if( verbose >= 2 )
00389   {
00390     G4cout << " G4ParameterisationTrdY::ComputeDimensions():" << G4endl;
00391     trd.DumpInfo();
00392   }
00393 #endif
00394 }

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

Implements G4VDivisionParameterisation.

Definition at line 337 of file G4ParameterisationTrd.cc.

References FatalException, G4VDivisionParameterisation::faxis, G4VDivisionParameterisation::fmotherSolid, G4VDivisionParameterisation::foffset, G4VDivisionParameterisation::fwidth, G4cout, G4endl, G4Exception(), G4Trd::GetYHalfLength1(), kYAxis, G4VPhysicalVolume::SetTranslation(), and G4VDivisionParameterisation::verbose.

00338 {
00339   G4Trd* msol = (G4Trd*)(fmotherSolid );
00340   G4double mdy = msol->GetYHalfLength1();
00341 
00342   //----- translation 
00343   G4ThreeVector origin(0.,0.,0.); 
00344   G4double posi = -mdy + foffset + (copyNo+0.5)*fwidth;
00345 
00346   if( faxis == kYAxis )
00347   {
00348     origin.setY( posi ); 
00349   }
00350   else
00351   { 
00352     std::ostringstream message;
00353     message << "Only axes along Y are allowed !  Axis: " << faxis;
00354     G4Exception("G4ParameterisationTrdY::ComputeTransformation()",
00355                 "GeomDiv0002", FatalException, message);
00356   }
00357 
00358 #ifdef G4DIVDEBUG
00359   if( verbose >= 2 )
00360   {
00361     G4cout << std::setprecision(8)
00362            << " G4ParameterisationTrdY::ComputeTransformation " << copyNo
00363            << " pos " << origin << " rot mat " << " axis " << faxis << G4endl;
00364   }
00365 #endif
00366 
00367    //----- set translation 
00368   physVol->SetTranslation( origin );
00369 }

G4double G4ParameterisationTrdY::GetMaxParameter (  )  const [virtual]

Implements G4VDivisionParameterisation.

Definition at line 328 of file G4ParameterisationTrd.cc.

References G4VDivisionParameterisation::fmotherSolid, and G4Trd::GetYHalfLength1().

00329 {
00330   G4Trd* msol = (G4Trd*)(fmotherSolid);
00331   return 2*msol->GetYHalfLength1();
00332 }


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