Message: Identify volume in GDML Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Identify volume in GDML 

Forum: Persistency
Date: 08 Sep, 2010
From: Anatoly Borodin <Anatoly Borodin>

At first, i was making hard-coded geometry in C++.

Then I've decided to use GDML. But it ends up with one problem:

For example: i have several sensitive detectors (the same shape and size, but different positions).

in c++ geometry i can identify current volume by its copyNum value. i create one G4Box and one LogicalVolume attached to it, then make this LogicalVolume to be as SensitiveDetector. In the end i use G4PVPlacement in loop with different copyNum in DetectorConstruction::Construct(). And in my SensitiveDetector class i just check copyNum (preStepPoint->GetTouchableHandle()->GetCopyNumber()) to identify current detector witch was hit by particle.

so I was thinking about the same way in GDML.

if i have, for example, 20 small detectors i'm expecting something like:

<!---- logical volume ---->
<volume name="Detector">
   <materialref ref="SomeMaterial"/>
   <solidref ref="DetectorSolid"/>
<loop for="di" to="20" step="1">
      <volumeref ref="Detector"/>
      <position unit="cm" x="DetPos[di,1]" y="DetPos[di,2]" z="DetPos[di,3]"/>
Where: di - just a variable,  DetPos - matrix of detectors positions.

But in program all detectors have the same names (for Logical and Physical volumes) and their copyNums don't change either.

So is there any way to identify them in SensetiveDetector class, like i did in hard-coded geometry, except the volume's name?

or the only way is to declare all detectors by hand (without using loops) with different volume names?

Thank you.

 Add Message Add Message
to: "Identify volume in GDML"

 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 ]