Message: Re: Annihilation of primary particle Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Warning Re: Annihilation of primary particle 

Forum: Event and Track Management
Re: Question Annihilation of primary particle (Clara)
Date: 05 Aug, 2013
From: Michael H. Kelsey <Michael H. Kelsey>

On Thu, 01 Aug 2013 17:21:56 GMT, Clara wrote:
> [...]
>         if (particleName = "anti_proton"){

You have a typo in the statement above. The single equals sign, "=" is an _assignment_ operation: what you're doing above is changing the value of "particleName", so that it is always equal to "anti_proton" for the rest of that function.

What you want is the boolean _comparison_ operation, "==", thus:

       if (particleName == "anti_proton") {

etc. If you're not familiar with C++, this can be confusing.

  -- Michael Kelsey

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

1 Feedback: Re: Annihilation of primary particle   (Clara - 05 Aug, 2013)
 Add Message Add Message
to: "Re: Annihilation of primary particle"

 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 ]