Subject: Muon Propagation
Date: Thu, 30 Nov 2000 23:56:13 +0100

muon montecarlo code written in java version 0.01

The code:

    1. compiles
    2. runs
    3. contains all foreseen cross sections

The main purpose of the code is to calculate final energy of the muon
with the given initial energy after some known distance, or to say where
exactly it disappeared if it didn't reach the final point located at a
given distance form the initial point.

Running of this code is *not* for the weak of heart. Please do not start
it unless you have a couple of hours to spare (at least on my machine).

As it is given, it will propagate a total of 2 (two) muons with energy
10^5 Mev to a distance of 10^4 cm. Each muon will be subject to decay,
ionization , bremsstrahlung, pair production and photonuclear losses as
well as knock-on stochastic energy transfers to electrons and photons
arising in the above mentioned processes.

Although i have sorted out most of the notational and purport questions,
i still have a couple, including the following:

    1. what is M in formula (8) of the cross sections' paper?
    2. do we take it seriously?
    3. If yes, do we take into account the binding energy of the
nucleons in the nucleus?

    4. Almost in every cross section the energy lost is the energy
gained by the main knocked particle (electron, photon, epair, or
nucleus). this most likely leads to systematic error - energy lost being
smaller than it really is. Is there a reference that calculates
distribution of energy between main particle and those of secondary
importance?

    5. Where do i take delta (density correction) in the ionization
formula from?
    6. maybe something else.

Now there is the following work still to be performed:

    1. Answer the above questions and implement their recommendations.
    2. plot all cross sections and compare them with values from papers.

    3. look at the plots and think of the possible variable changes in
the integrals to accelerate calculation
    4. choose and implement parametrization scheme for each of the
integrals (except the tracking) that would allow the use of the program
for the peaceful purposes.


Subject: Muon Propagation
Date: Fri, 01 Dec 2000 00:06:33 +0100

>     5. Where do i take delta (density correction) in the ionization
> formula from?

A small correction: from the formula given in the paper, but what is `m' in this
formula?


Subject: Muon Propagation
Date: Fri, 01 Dec 2000 05:48:57 +0100

version 0.01.01 of the muon propagation montecarlo code written in Java (MPMCWJ)

The update fixes handling of an unusual condition in class Integral as well as
bug in the integrational limits in the photonuclear cross
section. This, btw. could be considered as the bug in the cross sectional paper:
3rd formula from the top of the page 255 gives negative values for low enough
energies (lower than 512.68 MeV). Probably the formula is not applicable at
energies that low, but then we need to know exactly the cutoff energy, or if the
contribution of this formula from energies lower than cutoff is negligible, just
do nothing.

Another correction:

>     6. maybe something else.

    6. what exactly is the expression for the dzi in Z*(Z+dzi) in the pair
production formula?

    7. maybe something else.

in the todo list:

    5. compare energies of some small set of muons with the results of a+bE
formula.


Subject: Muon Propagation
Date: Tue, 05 Dec 2000 04:34:29 +0100

I am thrilled to announce version 0.01.02 of the mmc. It was possible to compare
this version of the program with the tables from the yellow book (1985). All energy
losses are comparable to those in the book. Agreement is within the first 2 digits
in most cases. I have noticed, however, that bremsstrahlung for the Hydrogen
differs more, and the more, the smaller the energy. E.g.

Energy, GeV   book       mine
1             17.41e-8   8.235856436249125E-8
10            3.173e-6   1.9318150603531618E-6
100           4.589e-5   3.664803882069739E-5
1000          5.786e-4   5.380685468381188E-4
10000         0.008635   0.008775320747892678

Is it known of works reporting similar deviations? Or is it more likely to be due
to the programming error?

This version is half the speed, twice the bugs. Or rather, half the bugs, but one
tenth of the speed of the previous version. Part of this (or all) is due to more
realistic settings. For the ongoing calculation in the Symphony framework i set
the energy of muons to 1TeV, and they are propagated through 1.5 km of ice.

Next step would be to improve the speed. By a lot. Really. A factor of thousand in
speed (i mean faster) would probably advance version to 0.02.


Subject: Muon Propagation
Date: Tue, 05 Dec 2000 22:57:04 +0100

Version 0.01.03 is out.

I was able to find the formula for the electron correction to the pair production
cross section in the "cross section" paper: at the bottom of page 255. From now on i
will not dare say something is missing in there or incorrect. So, this is implemented.

Another change is implementation of frejus rock. It is created by calling
Medium("Frejus Rock"); of the class Medium. Regular "rock" is now called "Standard
Rock".


Subject: Muon Propagation
Date: Wed, 06 Dec 2000 18:30:00 +0100

Version 0.01.04 of the mmc program is ready.

The main change was clearing up the code containing random number generations, and
putting comments describing the decision steps performed by the propagateTo function in
form of the debug messages. Medium class now contains the string, describing the employed
medium.

The next release will include parametrizations.


Subject: Muon Propagation
Date: Wed, 08 Dec 2000 20:50:00 +0100

0.01.05

And yet another update before v 0.02.

Structure of the program has changed significantly: there is now 3 subclasses for each
cross section. This should help the code's modularity and maintainability.

Interpolate routine in the class Integral is updated with the new step algorithm. A new
class Interpolate was written and included in the alpha of version 0.02. The Propagate
code with the routines from this class is, however, not yet reliable, so not yet released.

vCut (in Medium) is now a function. This allows for both constant vCut or eCut=vCut*E
settings.


Subject: Muon Propagation
Date: Tue, 12 Dec 2000 02:35:23 +0100

Na ... endlich. For your exclusive entertainment the new v 0.02 of the Muon Propagation Monte
Carlo Written in Java is brought out into the world. This version features:

1. Greatly improved performance:
    Time of calculating 1 (one) event with all parametrizations enabled is 0.25 seconds.
    The same with only epair intermediate integral parametrized is 20 seconds.
    The same with no parametrizations at all is 360 seconds.

    The times given above increase for the eCut=const option enabled. All calculations were
made on my P3 892 MHz computer with JDK 1.3.

2. New not yet completely explored bugs:
    Some cross sections give negative values outside there scope of applicability.
    Parametrizations sometimes lead to very wrong results: one of the 2 included
parametrization schemes (which is supposed to be more precise) almost always fails to
propagate even one particle due to unsmooth behavior on the boundaries of the approximation.
Some routine checking for the boundary conditions could repair this.

3. There are now only 2 more integrals which have not yet been parametrized: these are those
that take the calculated cross sections and evaluate the path length to the next interaction
and energy at that point. These one-dimensional integrals should be parametrized too.


Subject: Muon Propagation
Date: Wed, 13 Dec 2000 03:58:04 +0100

You are invited to enjoy v 0.03 of the Muon Monte Carlo!

New things:

    1. Root finding in the parametrized cross sections was stabilized by implementing a brand new
substitution of the lost energy. Now results are much closer to what non-parametrized version
gives. To compare simply remove reference to p.interpolate() in the New class.

    2. This substitution solves a large number of problems that i've been hunting down for the
last 10 hours. The program now really gives results in real time that are believable. Please find
attached a plot that shows the energy distribution of 10000 muons propagated through 300 cm of
iron with initial energy 1e6 MeV. You may compare this plot to the plot contained in the PDB
p.138 (1996, figure 22.13). It took 30 minutes to generate the muon set. Fractional energy cutoff
was chosen at 1.e-4. The plot with vCut=1.e-3 looks somewhat different. It also took only 15
minutes to generate.


Subject: Muon Propagation
Date: Wed, 13 Dec 2000 14:12:58 +0100

This is an update to version 0.03.1.

A very serious bug was repaired in the Interpolate class that was severely hindering the precision of
the root finding interpolation. Now the precision of that part is raised by many orders of magnitude
without the help of the FindRoot class.


Subject: Muon Propagation
Date: Thu, 14 Dec 2000 04:00:17 +0100

In this new 0.04 version of the MMC i have improved the following things:

    1. Energy track and distance integrals have been fully parametrized.

    1a. It turned out that one dimensional parametrization of these integrals had awful precision,
so i made it 2-dimensional. In the code implemented 100x10 array provides orders of magnitude better
accuracy than 1000 element array that i left out.

    2. This has improved speed, but only by a factor of 10-20. Now if we could find out how to
estimate time that the program spends per routine, we could try to optimize it more. Do we know
people specializing in Java who could explain how to do that? I have some ideas of how to optimize
the code. For example, the parametrization routine that finds roots calculates N=100 functions, each
evaluation being a superposition of another 5-10. However, only Ln_2 N + 5 = 6 + 5 = 11 function
values are used. It would be nice to know if the program spends a significant part of its time on
this routine. If so, it could be optimized another 100/11~10 times!

    3. Fixed various bugs that were handicapping the calculation at small energies. All unusual
conditions that resulted in NaNs and too big to believe energy losses have been fixed (at least in
my test run).

    4. Test run was made for Frejus Rock, 1.e5 particles with energy 100 TeV were generated and
propagated through 300 m. According to your formula a+bE the average final energy of the particles
is 74820 GeV. The average from the plot is 71000 GeV. The calculation took 17 minutes. Files a and b
differ in binning: a has 100 bins and b has 500. Are the effects that we see at closer resolution
normal?

    5. I do not see why not try a sample of Frank's data today. I only need to include file i/o
option in the code. Rather, the code is complete, but the programs that calls functions from this
code needs some i/o software implementation.


Subject: Muon Propagation
Date: Thu, 14 Dec 2000 15:09:39 +0100

In this new version 0.05 i have optimized the interpolate root finding routine as discussed in the
previous memo. It turned out that it was an important optimization: the test run that took 17 minutes
now runs in 5 (plus 45-50 seconds for creating parametrization profiles in each case). Now i am out of
ideas for optimizations. If necessary, one would have to hunt for the next major culprits that eat too
much time, and optimize those, if possible. I do not remember any possible candidates, however.

This version should be considered as pre-release, with only minor things still being tweaked, unless
something major (a bug or bugs) comes crashing everything down.


Subject: Muon Propagation
Date: Mon, 18 Dec 2000 00:49:05 +0100

On the way to (and from) London i have thought of the few things that could be improved. Some of them i
have just implemented. So here is v 0.05.1:

    1. Interpolate is faster: the test run now takes only 3.5 minutes. This was still achieved without
sacrificing the clarity of the code.

    2. Comments are added to all uncommented functions (i don't claim these comments are useful).

    3. it is now possible to enable only some of the parametrizations by passing a string variable to
p.parametrize(w) that contains the names of things to parametrize. w="all" will parametrize everything,
just as before.


Subject: Muon Propagation
Date: Mon, 18 Dec 2000 14:53:07 +0100

v 0.05.2:

    1. Photon-nucleon cross section parametrization based on the table of values now uses class
Interpolate, that means more precise interpolation. It can be enabled by setting p.s.n.measured=true.

    2. Precision of photonuclear cross section parametrization was raised to the same level as precision
of the other cross sections.


Subject: Muon Propagation
Date: Wed, 20 Dec 2000 01:34:59 +0100

Please find a new v 0.06 of mmc. How do you like this name, btw? The changes are:

    1. This version is faster than the previous: the test run takes now only 1 minute 50 seconds (plus 1
minute for initialization). I have to move to a bigger test run now, since this one finishes too fast. The
improvement in speed occured when i removed some string functions that were preparing the string to be
output on the screen, even though the output itself was disabled. Apparently, java string functions are not
too efficient.

    2. New class "Output" was created. Now it's possible to choose between F2000 and default outputs. As
follows from point 1., enabling any of these outputs (to see the history of particle propagation) will slow
the program down 2-3 times.

    3. Particle and Propagate classes were reworked. Now it is angle-dependence-ready. All calculations are
done carefully in 3 dimensions. Adding an angle distribution (when the formula is known) should be a snap.

    4. All vital classes were moved into a package called "mmc".


The new test with 1 mil. particles took only 18 minutes.


Subject: Muon Propagation
Date: Sun, 24 Dec 2000 05:38:31 +0100

Introducing v 0.07!

New features:

    1. Amount of static variables is reduced to a minimum, which allows
several instances of class Propagate to coexist simultaneously.

    2. Added classes Frejus and Amanda. First simplifies handling of the
data tables for comparison with Frejus data. Second implements a simple
solution for the f2000 format handling and is designed to replace dedx
in the AMANDA software chain.

    3. A little debugging of Propagate and Particle allowed for more
reasonable 3d model.


Subject: Muon Propagation
Date: Mon, 25 Dec 2000 03:39:06 +0100

This Christmas brought to you by Dima co. R (Copyright Wuppertal, 2000):

mmc v 0.08!

    1. Once again, a rewrite of the Cross section classes, with the aim of
improving the class structure (readability and maintainability). Now the
only static variables are in the Output class, where they belong.

    2. A brand new feature: table save and restore. Simply put the proposed
filename (best try "") as the second parameter of the interpolate function,
and the second time you run the program, parametrization time will be
reduced by a lot (20 times in my test run, but depends on how large the
tables and precision of the parametrization are).

This should likely conclude the introduction of brand new features with
every new version stepping. One thing that should still be done is a more
precise consideration of 3 regions in the Amanda class. At the moment only
a crude model is used, where the regions are separated by top and bottom of
the detector.

In the yesterday's version (0.07) the file routine in the Frejus class was
improved, and now processing of the Frank's Frejus data file takes only 2
hours - just what he mentioned for the MUM code. One should take into
consideration, however, that MUM code was run on a 533 MHz Alpha processor,
while mmc was run on a potentially faster (and possibly by a lot) Celeron
892 MHz.

Run Frejus as follows:
time cat dedx_out.txt | java Frejus | sed '1,/---/d' > dedx_out.out

