Shape of beam source

How can I make a beam with a cylindrical shape?

A little unclear to me. Do you mean a circular parallel beam with beam directed towards one direction ?

@mksharma_iitk something like this

i use the example activation, but the shape of the source beam is square

What if you sample random points in the cylindrical volume and track each photon for the mean path length? Would that suffice? If yes, one option is to use GPS and define the volume shape and dimension in macro. Like this?

@mksharma_iitk I’m not sure about the random point sample, but I think it might work. What I want to do is shoot proton beams at three targets. Two are foil of Havar and one of water and from there graph the spectra that are produced (right now my proton beam has this square shape)

but now what I’m wondering is …
In that same macro I would put the histograms