Message: Re: is it possible to generate an optical photon beam? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: is it possible to generate an optical photon beam? 

Forum: Processes Involving Optical Photons
Re: Question is it possible to generate an optical photon beam? (Antonio)
Date: 23 Feb, 2012
From: Gumplinger Peter <Gumplinger Peter>

Hi Antonio,

You are running into a problem everyone is facing who is assigning the particle type to the G4ParticleGun in the constructor of the PrimaryGeneratorAction:

optical = particleTable->FindParticle(particleName="OpticalPhoton");

particleGun->SetParticleDefinition(optical);

You are not testing whether or not the pointer 'optical' is not NULL. It is NULL, either because you do not instantiate the G4OpticalPhoton in your ConstructParticles() or because at the moment your PrimaryGeneratorAction object is instantiated, the particle objects, not just G4OpticalPhoton but any particle (G4Proton, G4Electron, etc) have not yet been instantiated during the 'flow' of the program.

This happens when you have:

runManager->SetUserAction(gen_action);

before

runManager-> SetUserInitialization(physics);

in your main.

For this reason, you must assign SetParticleDefinition in GeneratePrimaries method or change the above order in main.cc

Peter

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

1 Ok: Re: is it possible to generate an optical photon beam?   (Antonio - 23 Feb, 2012)
 Add Message Add Message
to: "Re: is it possible to generate an optical photon beam?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews