Message: Adding a Get...() and Set...() function to G4Track Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Sad Adding a Get...() and Set...() function to G4Track 

Forum: Event and Track Management
Date: 22 Oct, 2010
From: Cristian Bungau <Cristian Bungau>

Hello All,

I am trying to add two new Get / Set functions for an integer variable which I want to acces in my SteppingAction class.

So in G4Track.hh I have:

// Get/Set functions (declared as public)
  inline G4int GetIsoZ() const;
  inline void SetIsoZ(const G4int aValue);

and in G4Track.icc:

   inline G4int G4Track::GetIsoZ() const
   { 
G4cout << "Geting Z from track : " << fIsoZ << G4endl;
return fIsoZ; 
}
   inline void G4Track::SetIsoZ(const G4int aValue)
   { 
fIsoZ = aValue; 
G4cout << "Setting Z for track to : " << aValue << G4endl;
}

and finally in G4Track.cc

G4Track & G4Track::operator=(const G4Track &right) //////////////////

{

......

   fIsoZ= right.fIsoZ;

......

}

Now, it appears from the cout message that the Set function is setting the correct integer value, however the Get function is always returning zero. The Set function is invoked from another class, where G4Track was declared as a friend class.

I would be very grateful if you could please suggest a correct implementation of the Get function, so it returns the value which was set by the Set function.

Thank you very much,

Best regards,

Cristian

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

1 None: Re: Adding a Get...() and Set...() function to G4Track   (Neoh - 22 Oct, 2010)
1 Question: Re: Adding a Get...() and Set...() function to G4Track   (Cristian Bungau - 22 Oct, 2010)
2 Disagree: Re: Adding a Get...() and Set...() function to G4Track   (Gumplinger Peter - 22 Oct, 2010)
1 Sad: Re: Adding a Get...() and Set...() function to G4Track   (Cristian Bungau - 23 Oct, 2010)
... 8 Message(s)
 Add Message Add Message
to: "Adding a Get...() and Set...() function to G4Track"

 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 ]