# Creating a beam spectrum from sampling a file

**URL:** <https://fluka-forum.web.cern.ch/t/creating-a-beam-spectrum-from-sampling-a-file/6236>\
**Category:** Source Definition\
**Created:** [12 July 2024 19:06 UTC](https://fluka-forum.web.cern.ch/t/creating-a-beam-spectrum-from-sampling-a-file/6236 "2024-07-12T19:06:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![itamar.Cohen](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/i/5f9b8f/32.png) [@itamar.Cohen](https://fluka-forum.web.cern.ch/u/itamar.Cohen)\
**Post date:** [12 July 2024 19:06 UTC](https://fluka-forum.web.cern.ch/t/creating-a-beam-spectrum-from-sampling-a-file/6236/1 "2024-07-12T19:06:08Z")

</div>

Dear FLUKA experts,

I am new to Flair and FLUKA and I am trying to setup an electron source whose energy distribution is sampled from spectrum given in an external text file.

I think I need to setup a Source.f file but I not sure where to start.  
If anyone has a good guide or example file they can share I would greatly appreciate it.

Thank you,  
Itamar Cohen

---

<div class="post-metadata">

**Author:** ![vorodin](https://fluka-forum.web.cern.ch/letter_avatar_proxy/v4/letter/v/848f3c/32.png) [@vorodin](https://fluka-forum.web.cern.ch/u/vorodin)\
**Post date:** [13 July 2024 18:34 UTC](https://fluka-forum.web.cern.ch/t/creating-a-beam-spectrum-from-sampling-a-file/6236/2 "2024-07-13T18:34:55Z")

</div>

Dear Itamar,

My suggestion is to utilise source\_newgen.f  
Usage is described here:

> **[12\_Source\_routine\_2023\_NEA.pdf](https://indico.cern.ch/event/1296149/contributions/5448357/attachments/2748180/4782623/12_Source_routine_2023_NEA.pdf)**

> **[Ex\_source\_routine\_2023\_NEA.pdf](https://indico.cern.ch/event/1296149/contributions/5448338/attachments/2748185/4782631/Ex_source_routine_2023_NEA.pdf)**

An example with spectrum sampling can be found here [2023-fluka-beginner-course](https://indico.cern.ch/event/1296149/contributions/5448338/)

Best wishes,  
Volodymyr

---

<div class="post-metadata">

**Author:** ![horvathd](https://fluka-forum.web.cern.ch/user_avatar/fluka-forum.web.cern.ch/horvathd/32/10584_2.png) [@horvathd](https://fluka-forum.web.cern.ch/u/horvathd)\
**Post date:** [26 July 2024 06:38 UTC](https://fluka-forum.web.cern.ch/t/creating-a-beam-spectrum-from-sampling-a-file/6236/3 "2024-07-26T06:38:43Z")

</div>

Closed on 26 July 2024 06:38 UTC


