Message: 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

Question is it possible to generate an optical photon beam? 

Forum: Processes Involving Optical Photons
Date: 23 Feb, 2012
From: Antonio <Antonio>

Hello, I would like to simulate an optical photon beam. I am using G4ParticleGun and there are no problem in compilation. But when running G4 crashes
-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : Event0101
      issued by : G4ParticleGun::SetParticleDefinition()
Null pointer is given.
*** Fatal Exception *** core dump ***
-------- EEEE -------- G4Exception-END --------- EEEE -------
*** G4Exception: Aborting execution *** Abort trap: 6

Could someone provide some help?

Many thanks

Cheers, Antonio

p.s: mi generatoraction is here:

#include "PrimaryGeneratorAction.hh"
#include "PrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
  momentum = ((1239.84/450)*1E-9)*GeV; //for optical photons
  G4int n_particle = 1;
  particleGun  = new G4ParticleGun(n_particle);
  //create a messenger for this class
  gunMessenger = new PrimaryGeneratorMessenger(this);
  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
  G4String particleName;
  optical = particleTable->FindParticle(particleName="OpticalPhoton");
  // default particle kinematics

  delete particleGun;
  delete gunMessenger;
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
  G4ParticleDefinition* particle;
  particle = particleGun->GetParticleDefinition();
  G4double pp = momentum;
  G4double mass = particle->GetPDGMass();
  G4double Ekin = std::sqrt(pp*pp+mass*mass)-mass;
  G4double xxx = -5.;
  G4double yyy = 0.; 
  G4double zzz = 0.;

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

1 Feedback: Re: is it possible to generate an optical photon beam?   (Gumplinger Peter - 23 Feb, 2012)
1 Ok: Re: is it possible to generate an optical photon beam?   (Antonio - 23 Feb, 2012)
2 None: Re: is it possible to generate an optical photon beam?   (michel maire - 25 Feb, 2012)
 Add Message Add Message
to: "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