Message: Re: Example 4.7 in Guide for Application Developers Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Example 4.7 in Guide for Application Developers 

Forum: Documentation and Examples
Re: Question Example 4.7 in Guide for Application Developers (Juan)
Date: 13 Feb, 2009
From: Paul Nicholas Colin Gloster <Paul Nicholas Colin Gloster>

On February 13th, 2009, Juan Cabrera submitted:

|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|"I'm trying to understand the G4AssemblyVolume class. I have wrote a code                                                                                          |
|based on example Example 4.7 from Guide for Application Developers. I                                                                                              |
|dont know if there is an error but when I write this :                                                                                                             |
|                                                                                                                                                                   |
|  Ta.setX( worldX/4. ); Ta.setY( worldX/4. ); Ta.setZ( 0. );                                                                                                       |
|  assemblyDetector->AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) );                                                                                              |
|                                                                                                                                                                   |
|It does not compile:                                                                                                                                               |
| error: no matching function for call to `G4AssemblyVolume::AddPlacedVolume(G4LogicalVolume*&, G4Transform3D)'                                                     |
|/usr/local/geant4/include/G4AssemblyVolume.hh:84: note: candidates are: void G4AssemblyVolume::AddPlacedVolume(G4LogicalVolume*, G4ThreeVector&, G4RotationMatrix*)|
|/usr/local/geant4/include/G4AssemblyVolume.hh:115: note:                 void G4AssemblyVolume::AddPlacedVolume(G4LogicalVolume*, G4Transform3D&)                  |
|make: *** [/home/cabrera/geant4/tmp/Linux-g++/template/GeometryConstruction.o] Error 1                                                                             |
|                                                                                                                                                                   |
|Defining a G4Transform3D variable with input parameters (Ra and Ta) inverted, it works:                                                                            |
|  Ta.setX(worldX/4.); Ta.setY(worldY/4.); Ta.setZ(0.);                                                                                                             |
|  G4Transform3D trans = G4Transform3D(Ra,Ta);                                                                                                                      |
|  assemblyDetector->AddPlacedVolume(plateLV,trans);                                                                                                                |
|                                                                                                                                                                   |
|Is there something wrong in my program or is it a typo in the                                                                                                      |
|Documentation?                                                                                                                                                     |
|                                                                                                                                                                   |
|Juan"                                                                                                                                                              |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|



Salutations Your Excellency,

Your workaround is correct. Another workaround is
assemblyDetector->AddPlacedVolume( plateLV, Ta, &Ra );
.

Example 4.7 on
HTTP://Geant4.web.CERN.CH/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04.html
contained
assemblyDetector->AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) );
which is wrong.

G4Transform3D.hh
contains:
"[..]

typedef HepGeom::Transform3D G4Transform3D;

[..]"
so in
$CLHEP_INCLUDE_DIR/CLHEP/Geometry/Transform3D.h
one can read
"[..]

namespace HepGeom {

[..]
//   Transform3D(m,v)         - transformation given by Rotation "m"
//                              and CLHEP::Hep3Vector "v";
[..]

    /**
     * Constructor: rotation and then translation. */
    inline Transform3D(const CLHEP::HepRotation & m, const CLHEP::Hep3Vector & v);

[..]".

With best regards,
Paul Collin Gloster

 Add Message Add Message
to: "Re: Example 4.7 in Guide for Application Developers"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]