Message: GetCopyNo(depth=1) fails Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question GetCopyNo(depth=1) fails 

Forum: Event and Track Management
Date: 09 Sep, 2013
From: Ryan Braid <Ryan Braid>

Hello everyone,

I am trying to get the copy number of the mother volume of one of my detectors. I can't understand why it is failing, since virtually all of my new code is copy/pasted from examples online. Why does this:

    G4StepPoint* preStepPoint = step->GetPreStepPoint();
    G4TouchableHistory* theTouchable = (G4TouchableHistory*)(preStepPoint->GetTouchable());

    G4VPhysicalVolume* thePhysical = theTouchable->GetVolume();
    G4int copyNo = thePhysical->GetCopyNo();
    G4int momcopyNo = thePhysical->GetCopyNo(depth=1);
    std::cout<<momcopyNo<<" "<<copyNo<<std::endl;

Give this:

src/SiliconSD.cc: In member function ‘virtual G4bool SiliconSD::ProcessHits(G4Step*,G4TouchableHistory*)’: src/SiliconSD.cc:51:43: error: ‘depth’ was not declared in this scope

As a compilation error? I have:

#include "SiliconSD.hh"
#include "SiliconHit.hh"
#include "G4Step.hh"
#include "G4HCofThisEvent.hh"
#include "G4TouchableHistory.hh"

Among other things. I am very confused since I am assuming the (depth=1) option is included functionality, and the code works fine if I comment out G4int momcopyNo = thePhysical->GetCopyNo(depth=1);

I am trying all of this based on the information from http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/FAQ/html/ch01s04.html

    To get its mother volume:

          G4VPhysicalVolume* mother = touch1->GetVolume(depth=1);
          grandMother: depth=2 ...etc...

The only thing I can think of is I am running Geant 4.9.4.p02, and this isn't included yet. Thank you in advance for the help!

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

1 None: Re: GetCopyNo(depth=1) fails   (michel maire - 09 Sep, 2013)
(_ Question: Re: GetCopyNo(depth=1) fails   (Ryan Braid - 09 Sep, 2013)
1 None: Re: GetCopyNo(depth=1) fails   (michel maire - 10 Sep, 2013)
2 None: Re: GetCopyNo(depth=1) fails   (Marc Verderi - 10 Sep, 2013)
1 Ok: Re: GetCopyNo(depth=1) fails   (Ryan Braid - 11 Sep, 2013)
 Add Message Add Message
to: "GetCopyNo(depth=1) fails"

 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 ]