Photon creation

Dear all,
I am new to Geant4 and I would like to ask for some help. I would like to know if it is possible to generate, in a certain volume, a certain amount of photons. By using the command gun for example? Or does the volume have to be made of a certain material that has a gamma decay property? Does one of the Geant4 examples match these requirements?
Thank you in advance for the help.

Thats what G4 is all about, right? So I would recommend to look on the examples provided with G4.
Basically what you would have to search for is the G4ParticleGun which provides you with every particle you need without real constrains (no material etc.).
What then later happens to your particle depends then on the world - but all this are basics steps which can be easy nicely understood following along an example.

Thank you for the reply. I have managed to do what I intended by modifying the example B1.

Hi, I am also doing a sort of related thing. I am trying to generate a specified number photons as primary particles at the center of the geometry(box). I have just started with Geant4.

However, when running /beamOn n (n > 1) only one photon is being generated as seen from the visualization window.

Can you please share your code obtained by modifying B1?

Thank You