Message: Volume current position Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Volume current position 

Forum: Geometry
Date: 04 Nov, 2012
From: C Mos <C Mos>

Hi

I have constructed my universe and then certain volumes (my gamma detectors and their respective shieldings) undergo rotation and translation. The code in the constructor looks like this:

    //GAMMA detector(s) Gdet
    pSolidGdet =new G4Tubs("SolidGdet",0.,radiusGdet,heightGdet, 0.,360.*deg);   

    G4LogicalVolume* pLogGdet =new G4LogicalVolume( pSolidGdet,materialGdet, "LogGdet", 0, 0, 0);

    //Shielding S1
    G4VSolid* pSolidS1      = new G4Box("SolidS1",depthS1,widthS1,heightS1);
    G4LogicalVolume* pLogS1 = new G4LogicalVolume( pSolidS1,materialS1, "LogS1", 0, 0, 0);

    G4String detName="PhysGdet_0";
    G4String S1name="PhysS1_0";
    for(G4int i=0;i<nGammaDetectors;i++){
      G4double phi,x,y,z;
      phi=360.*deg/nGammaDetectors*i;
      x=posGdetx*std::cos(phi);
      y=posGdetx*std::sin(phi);
      z=posGdetz;
      G4RotationMatrix rm;
      rm.rotateZ(phi);
      detName[detName.size()-1]+=1;  //increase label counter
      pPhysGdet =new G4PVPlacement( G4Transform3D(rm,G4ThreeVector(x, y, z)),
				    pLogGdet, detName, pLogAPIsys, 0, i);

      x=posS1x*std::cos(phi);
      y=posS1x*std::sin(phi);
      z=posS1z;
      S1name[S1name.size()-1]+=1; //increase label counter
      G4VPhysicalVolume* pPhysS1 =new G4PVPlacement( G4Transform3D(rm,G4ThreeVector(x, y, z)),
						     pLogS1, S1name, pLogAPIsys, 0, i);
    }

As you see, I have labeled my physical volumes as PhysGdet_i, where i is a counter based on the number of detectors. Is it possible to retrieve a specific detector's center position, for example by searching the physical volume by name and then retrieving their translation coordinates?

If I retrieve the object's center coordinate directly by accessing the physical volume, 1) I would get the coordinates in the world volume and 2) the return value would also take care of any other translation and rotation the object went through?

Thank you, Chris

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 More: Re: Volume current position   (C Mos - 08 Nov, 2012)
(_ Feedback: Re: Volume current position   (Michael H. Kelsey - 08 Nov, 2012)
 Add Message Add Message
to: "Volume current position"

 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 ]