Message: Occurence of precise nuclear reaction from proton beam Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Occurence of precise nuclear reaction from proton beam 

Forum: Event and Track Management
Date: 11 Feb, 2011
From: Jefferson <Jefferson>

--0016364ee23c3cad29049bff049c
Content-Type: text/plain; charset=ISO-8859-1

Dear Geant4 users,

I try to get the occurrence of particular nuclear reaction from a proton
beam in a box of water respect to the depth (i.e (p,2p'),...). Can you
confirm that all happens in UserSteppingAction class? And How to do that?
This is a extract of my code (UserSteppingAction.cc :

    int NbProtons = 0 ;
    int process1 = 1 ;
    int i = 0 ;

    G4SteppingManager* steppingManager =
G4EventManager::GetEventManager()->GetTrackingManager()->GetSteppingManager();
    G4TrackVector* fSecondary = steppingManager->GetfSecondary();

    if(aStep->GetTrack()->GetTrackID()!=1){
        if (aStep->GetTrack()->GetParentID() == 1){
            if (aStep->GetTrack()->GetDefinition()->GetParticleName() ==
"proton"){
                for (i = 0 ; i< (*fSecondary).size() ; i++){
                    G4String particleName =
(*fSecondary)[i]->GetDefinition()->GetParticleName();
                    if (particleName == "proton"){
                        NbProtons++;
                        //cout << particleName << ", nbprotons :" <<
NbProtons << endl;
                    }
                }
                if (NbProtons ==2){
                    G4double zposition =
aStep->GetTrack()->GetPosition().z();
                    //cout << "Position : "<< zposition << endl;
                    pOccur->Fill(zposition,process1);
                }
                NbProtons =0;
            }
        }
    }

It compiles.This code seems to be good for you? SteppingManager get the
secondaries at the current step?

--0016364ee23c3cad29049bff049c
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Dear Geant4 users,<br><br>I try to get the occurrence of particular nuclear=
 reaction from a proton beam in a box of water respect to the depth (i.e (p=
,2p&#39;),...). Can you confirm that all happens in UserSteppingAction clas=
s? And How to do that? This is a extract of my code (UserSteppingAction.cc =
:<br>

<br>=A0=A0=A0 int NbProtons =3D 0 ;<br>=A0=A0=A0 int process1 =3D 1 ;<br>=
=A0=A0=A0 int i =3D 0 ;<br><br>=A0=A0=A0 G4SteppingManager* steppingManager=
 =3D G4EventManager::GetEventManager()-&gt;GetTrackingManager()-&gt;GetStep=
pingManager();<br>=A0=A0=A0 G4TrackVector* fSecondary =3D steppingManager-&=
gt;GetfSecondary();<br>

<br>=A0=A0=A0 if(aStep-&gt;GetTrack()-&gt;GetTrackID()!=3D1){<br>=A0=A0=A0 =
=A0=A0=A0 if (aStep-&gt;GetTrack()-&gt;GetParentID() =3D=3D 1){<br>=A0=A0=
=A0 =A0=A0=A0 =A0=A0=A0 if (aStep-&gt;GetTrack()-&gt;GetDefinition()-&gt;Ge=
tParticleName() =3D=3D &quot;proton&quot;){<br>

=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 for (i =3D 0 ; i&lt; (*fSecondary).=
size() ; i++){<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 G4Strin=
g particleName =3D (*fSecondary)[i]-&gt;GetDefinition()-&gt;GetParticleName=
();<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 if (particleName =
=3D=3D &quot;proton&quot;){<br>

=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 NbProtons++;<br=
>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 //cout &lt;&lt=
; particleName &lt;&lt; &quot;, nbprotons :&quot; &lt;&lt; NbProtons &lt;&l=
t; endl;<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 }<br>=A0=A0=
=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 }<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=
=A0 if (NbProtons =3D=3D2){<br>

=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 G4double zposition =3D aS=
tep-&gt;GetTrack()-&gt;GetPosition().z();=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=
=A0=A0 <br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 //cout &lt;&lt=
; &quot;Position : &quot;&lt;&lt; zposition &lt;&lt; endl;<br>=A0=A0=A0 =A0=
=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 pOccur-&gt;Fill(zposition,process1);<b=
r>

=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 }=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=
=A0=A0 <br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 NbProtons =3D0;<br>=A0=
=A0=A0 =A0=A0=A0 =A0=A0=A0 }<br>=A0=A0=A0 =A0=A0=A0 }<br>=A0=A0=A0 }<br><br=
>It compiles.This code seems to be good for you? SteppingManager get the se=
condaries at the current step?<br>

<br><br>

--0016364ee23c3cad29049bff049c--

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

1 Feedback: Re: Occurence of precise nuclear reaction from proton beam   (Pedro Arce - 11 Feb, 2011)
(_ Question: Re: Occurence of precise nuclear reaction from proton beam   (Gumplinger Peter - 11 Feb, 2011)
 Add Message Add Message
to: "Occurence of precise nuclear reaction from proton beam"

 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 ]