Message: Re: Generating Primary Events Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Generating Primary Events 

Forum: Event and Track Management
Re: None Generating Primary Events (suzanne)
Date: 17 Apr, 2007
From: Anton <Anton>

Hello suzanne,

try to use it:

void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
     G4int theta, phi, l, n;
     theta=phi=l=n=0;
     G4float r = 10.0; // in cm.

       n = anEvent->GetEventID() / 3;
       l = anEvent->GetEventID() % 3;

                 //G4cout << " an Event " << n << G4endl;
                theta=60*n;
                phi=120*l;

                G4int i = anEvent->GetEventID();
                  G4cout << " an Event " << i << G4endl;

                G4cout << " Theta  " << theta << " Phi " << phi << G4endl;

                particleGun->SetParticlePosition(G4ThreeVector(r*(sin(theta*deg)*cos(phi*deg))*cm,
                        (r*sin(theta*deg)*sin(phi*deg))*cm,(r*cos(theta*deg))*cm));   

                particleGun->SetParticleMomentumDirection(G4ThreeVector(-(sin(theta*deg)*cos(phi*deg)), 
                        -(sin(theta*deg)*sin(phi*deg)),-(cos(theta*deg))));  

                particleGun->GeneratePrimaryVertex(anEvent);    
 }

-- 
Best regards,
 Anton                            mailto:tosha_korneev@tut.by

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

 Add Message Add Message
to: "Re: Generating Primary Events"

 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 ]