#  This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
#
#  MAUS is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  MAUS is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with MAUS.  If not, see <http://www.gnu.org/licenses/>.

# NOTE: please use lower_case_and_underscores for new configuration cards

import os


#output_root_file_name = "maus_output_3pi2_alt_0.root"


simulation_geometry_filename = "files/geometry/custom/Step_3pi2_alt_4.dat"

random_seed_beam = int( os.getenv( "MAUS_RANDOM_SEED", 5 ) )
random_seed_reference = 2 * random_seed_beam

z_start_pos = -4717.7

simulation_reference_particle = { # used for setting particle phase
    "position":{"x":0.0, "y":0.0, "z":z_start_pos},
    "momentum":{"x":0.0, "y":0.0, "z":1.0},
    "particle_id":-13, "energy":228.0, "time":0.0, "random_seed":random_seed_reference
}

# geant4 visualisation (not event display)
geant4_visualisation = False
accumulate_tracks = 0

# Change the verbosity
#verbose_level = 0
verbose_level = 1
#verbose_level = 2

spill_generator_number_of_spills = 10
# used by MapPyBeamMaker to generate input particle data
# This is a sample beam distribution based on guesses by Chris Rogers of what
# an optimised beam might look like

beam = {
#    "particle_generator":"binomial", # routine for generating empty primaries
#    "binomial_n":10, # number of coin tosses
#    "binomial_p":1.0, # probability of making a particle on each toss
    "particle_generator" : "counter",
    "random_seed":random_seed_beam,
    "definitions":[
    {
       "reference":simulation_reference_particle, # reference particle
       "random_seed_algorithm":"incrementing_random", # algorithm for seeding MC
       "n_particles_per_spill" : 10,
        "transverse":{
          "transverse_mode" : "penn", 
          "emittance_4d":6., 
          "beta_4d":339.0,
          "alpha_4d":0.,
          "normalised_angular_momentum":0.0,
          "bz":4.e-3
        },
        "longitudinal":{
          "longitudinal_mode" : "twiss",
          "momentum_variable" : "pz",
          "beta_l" : 11.2,
          "alpha_l" : -0.7,
          "emittance_l" : 0.020

#         "longitudinal_mode" : "gaussian",
#         "momentum_variable":"energy",
#         "sigma_energy":(2643.06853654*0.1)**0.5,
#         "sigma_t":(4.28350440358*0.1)**0.5,
#         "cov(t,energy)":12.2924168701 *0.1
         },
         "coupling":{
           "coupling_mode":"none"
         } # no dispersion
    }
  ]
}

