Skip to content

Shoram444/MPgenbb.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MPGenbb generator is a module used for generating custom .genbb files, which serve as an input for custom generated events into Falaise simulation module of SuperNEMO collaboration.


The following example shows how to use the module to simply generate a file with momenta of each particle generated using a $2\nu\beta\beta$ decay spectrum provided by R. Dvornicky rebinned using MPRebinSpectra module (MPRebinSpectra.jl)

The structure of .genbb files is as follows:
  • Each event is separated by #
  • Each event consists of:
    1. Header line which has fields: ID Time nP (where ID is event ID from 0 to N; Time is starting time; nP is the number of particles within the event)
    2. Particle line with fields: Type px py pz dt (where particle Type is 1- gamma, 2- positron, 3-electron; px py pz are momentum components; dt is time difference)

An example event - 2 positrons, starting at Time = 0, with dt = 0 and momenta px1 = py1 = pz1 = 1, px2 = py2 = pz2 = 1 - is generated as:
0 0 2
2 1 1 1 0
2 2 2 2 0
#

Docstrings for individual functions are found in /src. Or by using ? in julia REPL.

using MPGenbb, DataFrames, CSV
Base.displaysize() = (5, 100) # this line sets display of rows 5 and cols 100

The input spectrum must be rebinned with MPRebinSpectra module and saved as a DataFrame type.

inFile = string("spectrumG0_Rebinned_prec0001.csv")
"spectrumG0_Rebinned_prec0001.csv"
df = CSV.File(inFile) |> DataFrame

614,474 rows × 8 columns

E1minEmaxEminGmaxGabcdf
Float64Float64Float64Float64Float64Float64Float64Float64
10.000930.00.000930.00.402019432.2780.01.86939e-7
20.000930.000930.014930.4020190.4120430.7160060.4013535.88537e-6
30.000930.014930.026930.4120430.4213580.7763140.4004521.08858e-5
40.000930.026930.040930.4213580.4336150.8754750.3977821.68706e-5
50.000930.040930.058930.4336150.4504470.935130.395342.48272e-5

Setting up initial conditions .

const MASS        = 0.511 # particle mass in MeV/c²
const PART_TYPE   = 3     # particle type: 1- gamma, 2-positron, 3-electron
const OUTFILE     = "input_module.genbb" # name of the output file
const PROCESS     = "82Se 0νββ - Energy generated via SpectrumG0 - from R. Dvornicky";
NEVENTS          = 100  # how many events should be created
100

To save the file use a simple for loop, at each step generate electron energies T and momentum vectors p1 and p2 (where direction of p1 is random unifrom in sphere and direction of p2 is correlated to p1).

Then generate get_event_string. And save.

open(OUTFILE, "w") do file
    Threads.@threads for id in 0:NEVENTS-1
        T  = sample_energies(df)

        p1 = get_first_vector(T[1], MASS)
        p2 = get_second_vector(T[2], MASS, p1)

        if id%10_000 == 0 && id >1
            println("generated $id events!")
        end

        write(file, get_event_string(id, PART_TYPE , p1, p2))
    end
end

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages