Message: G4Track* track->SetCreatorProcess(G4VProcess*) Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None G4Track* track->SetCreatorProcess(G4VProcess*) 

Forum: Event and Track Management
Date: 08 Oct, 2008
From: Niklas <Niklas>

Hello,

I tried to compile the following:

---------------------------------------------

G4Track* pCurrentTrack;

[..]

G4DynamicParticle* particle=new G4DynamicParticle ( G4Gamma::GammaDefinition(),globalDir,m_nCurrentEnergy );

G4Track* secondary = new G4Track(particle,time, globalPos );

secondary->SetCreatorProcess(pCurrentTrack->GetCreatorProcess());

[..]

-----------------------------------------------

This does not compile because

G4Track::GetCreatorProcess returns a "const G4VProcess*"
   and
G4Track::SetCreatorProcess takes a "G4VProcess*"

I can avoid the compilation error by using a const_cast:

secondary->SetCreatorProcess(const_cast<G4VProcess*>(pCurrentTrack->GetCreatorProcess()));

Is this save?

I would like to clone a track exept for the position and momentum direction. Is it better/save to use

G4Track::CopyTrackInfo(const G4Track&)

and then set the position and momentum direction later?

Note:

Is there a reason for the non-constness of fpCreatorProcess in G4Track? G4Track does not seem to modify the creator process. Perhaps "fpCreatorProcess" could be defined "const G4VProcess*" and G4Track::SetCreatorProcess (const G4VProcess*) declared?

Thanks

Niklas

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

1 Agree: Re: G4Track* track->SetCreatorProcess(G4VProcess*)   (Hisaya Kurashige - 24 Oct, 2008)
 Add Message Add Message
to: "G4Track* track->SetCreatorProcess(G4VProcess*)"

 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 ]