Alchemy - Hadronic Physics without the Grand Unification of the Electro-weak and Strong processes, in particular- can be a messy business. This page describes a cookbook on how to proceed in comparing the weighted neutrino flux FLUKA/Geant4. This work is based on earlier work done by Mary Bishai (BNL), Bob Zwaska (FNAL) and others. It is and will be "work in progress", as both the Geant4 and FLUKA modelling are expected to change.

The FlukaInterface subdirectory in our repository does not contain the FLUKA code, which can not be distributed by us. However, the code that produce the FLUKA output file that will be processed by g4lbne is our work, and as such can be made public. Consequently, installing and using our interface code is the business of an authorized FLUKA user. Hence, your first step, should you use this interface, is to got to the FLUKA home page. Read the license, than talk to your layer. (feel free to skip the later step. It is up to you.... ). Then, install FLUKA, in a directory of your choice, on a machine of your choice as well.

We have flexibility here, because our FLUKA/G4LBNE interface is based on the used of ASCII files: FLUKA generates such a file that is read in by g4lbne. This interface is unidirectional, and limited in scope, as described in the next paragraph. So the work is split into three related part: (i) define the ad hoc geometry in a standard FLUKA input file, run FLUKA with a "user routine" that generates that ASCII file, and (ii) Run g4lbne with the corresponding geometry, instruct g4lbne to read that ASCII file, and (iii) run g4lbne with that same G4 geometry, but use proton on target instead of that FLUKA output file.

At the onset of this project, we had indeed choices: Resurrect the "FLUG" effort, where the FLUKA code that generates a set of hadrons while interaction in a specified medium material was extracted from the FLUKA package, and inserted in our Geant4 application. Beside some legal matter, the logistics of this implementation is not easy, as the FLUKA authors do not release their source code (only the object code). A second strategy would be to implement the entire beam-line in FLUKA, and simply compared neutrino fluxes. This would require an extensive remodelling of the geometry, as FLUKA does not has the same "CGS" based set of volumes that GEANT4 has. This would be a time consuming process. A third strategy, used successfully in this project, leads us to a restricted solution, where both FLUKA and G4LBNE use a consistent geometry, FLUKA generates hadrons, up to a agreed upon physical interface, and GEANT4 propagates hadrons up to that point, decay pions, and write our usual Neutrino NTuple (Dk2nu, or old format).

In our case, the agreed upon target geometry is a simple graphite rod. This rod is implemented in FLUKA and GEANT4, same place in world coordinate of both packages. FLUKA hadrons emerging from this rod, with a momentum greater than 50 MeV/c, are written out. They are loaded, one by one, in the Geant4 Particle Gun, where the position and direction of the gun is set according to the FLUKA coordinates and direction. Consequently, in the limit where all the pions that will produce our neutrinos are all generated in that same graphite rod, the comparison FLUKA/GEANT4 is exact. Unfortunately, his is not quite the case, as pions can be absorbed in the horn's conductors, and/or generated in these conductors. As long as the difference in the cross-sections between the FLUKA and GEANT4 do not differ too much, corrections can be made, if these differences can be traced back to specific cross-section and A-dependence of these cross-sections. The Minerva collaboration is studying this type of correction in great detail. Meanwhile, as stated above, this is work in progress....

So In practice, after installing FLUKA in a directory of your choice, and familiarize your self with the package, consider using the following recipe:

Building the adhoc FLUKA executable.

Copy our G4LBNE interface file fluscw.f, found in your .../ g4lbneWorkDir /FLUKAInterface, to your .../ FlukaInstall /usermvax directory. The string italic refer to the directory name of your choice, the former being set by the git command you used to get this package, the later by the place where the FLUKA tar file was expanded.
There is a FORTRAN open statement in this code, it is based currently based on two distinct Unix environmental variables, CLUSTER and PROCESS. If you are familiar with the Fermigrid and FIFE software, this should sound familiar. If on the other hand, your are using a different batch environment, just set these two environmental variable in your setup scripts, or modify the fluscw.f FORTRAN code.

Rebuild the FLUKA executable, following the FLUKA method du-jour (currently, a simple GNU makefile).

Setting the FLUKA geometry.

Copy the CylTarget.inp found in your .../ g4lbneWorkDir /FLUKAInterface directory to your FLUKA directory, or, in fact any place you want. Feel free to change the geometry, but, if you do so, you also must change the G4lbne geometry for consistency.

Run FLUKA, produce the FLUKA/G4LBNE ASCII file.

This interface file is opened in the fluscw.f FORTRAN subroutine, and filled. Note that neutral pions and photons, and electrons/positron are not written out, as they are very unlikely to produce neutrinos. If you have not modified the code in fluscw.f the file name will be .../ FlukaInstall /OutProd_${CLUSTER}${PROCESS}.dat

Setting up the corresponding geometry in G4LBNE, and the file interface.

A simple target has been installed a few months ago, such that realistic target can be benchmarked against simple ones, or other Monte-Carlo packages. The G4UI command card are:

/LBNE/det/UseSimpleCylindricalTarget True
/LBNE/det/SimpleTargetRadius 6.999 mm
/LBNE/det/GraphiteTargetLength 950 mm
/LBNE/det/TargetLengthOutsideHorn 45. cm

The last card is of course negotiable, but this roughly (mm..) corresponds to the agreed upon so-called "1.2 MW, Nominal configuration. These cards can be found in .../ g4lbneWorkDir/macros/CylTargetFlukaProd.mac. Then, if one to use the previously written FLUKA output file, simply insert:

/LBNE/run/InputFlukaFileName theFlukaName

where the theFlukaName is the UNIX file name generated by your FLUKA executable, as stated above.


Do this twice, in fact, one using the FLUKA ouput file, and one not using it. In the later case, the G4 PrimaryActionGenerator with use the usual proton gun, aimed at the graphite rod. However, there is here a subtlety: The FLUKA beam is pencil like, so the following G4UI command cards have to be insterted, after the "run/intialize" command:

/LBNE/generator/beamSigmaX 0.00001 mm
/LBNE/generator/beamSigmaY 0.00001 mm

Analyse That.

Not a great movie, but probably more entertaining than the flux histograms that will come from the Dk2Nu (or old format) root files generated above...

We are not quite done yet.

No surprise here. Always more to study. It would be nice to be able to compare the hadron flux at the agreed upon boundary, FLUKA vs Geant4. A new data card,

/LBNE/run/ParticlefromTargetoutputASCII true

has been installed. If activated, the G4LBNE Steping Action will produce a simple Ntuple, ASCII format with the X, Y, Z, Px, Py, Pz and PDG particle ids emitted from the target, when G4LBNE runs Proton on target. Currently, the volume names are hard-wired to the simple rod target.