# Presentation: 170201

## Front End to MucGeant

**Standardize the input files for MucGeant:**
- The input should be in the ICOOL for003/4 format:
- This is followed by an indefinite number of incident particles, each with the following data.
- (1) IEVT		(I) event #(increase sequentially from 1)
- (2) IPNUM		(I) particle # for this event (set to 1)
- (3) IPTYP		(I) particle type code (see BMTYPE in sec. 2.4)
- (4) IPFLG		(I) particle status flag (set to 0)
- (5) TP			(R) time [s]
- (6) EVTWT		(R) event weight (set to 1.)
- (7) XP(i),i=1,3	(R) cartesian position [m] (set xp(3)=0.)
- (8) PP(i),i=1,3	(R) cartesian momentum [GeV/c]
- (9) POL(i),i=1,3	(R) cartesian spin vector
- This would permit, for example, to us to use a file with muons generated with ICOOL for the front end to be inserted into a ring.
- This would permit direct comparisons with ICOOL with the same input source.

## Issues associated with standardized ICOOL input file 

- ICOOL works in a local coordinate system around the reference orbit.  GEANT works in the global coordinate system.
- The approach that was adapted is that one would place a *virtual* volume at the point of insertion into GEANT.  Coordinates internal to this *virtual volume *would be in ICOOL local coordinates and the GEANT transformation methods would be used to get the proper global coordinates for GEANT to use.
- The virtual volume description is in data cards in the RCP date file.
- The position of this *virtual start volume *is not completely arbitrary since it must be consistent with the *TARGET_TIME *variable in the RCP file so as to coordinate the RF timing of the cavities.

## Issues (continued)

- We will modify a simple utility program to write this ICOOL for003 file with Gaussian distributions around x, Px, y, Py, E, t with the proper Pt, r, B, E correlations.
- This utility was used for the Tetra ring input.

## Output File for Analysis

- Since our main interest is emittance we would like to have an output format to facilitate that.  We have chosen to output analysis data in the ICOOL for009 format so that it can go into ECALC9.
- This would allow us to make exactly the same emittance calculation as used by ICOOL (right or wrong?)
- ICOOL for009 format:
- This is followed by particle information at requested positions.
- 1) IEVT		(I) event #
- 2) IPNUM		(I) particle # for this event
- 3) IPTYP		(I) particle type code (see BMTYPE in sec. 2.2)
- 4) IPFLG		(I) particle status flag
- 5) JSRG		(I) ICOOL region #
- 6) TP			(R) time [s]
- 7) XP(i),i=1,3		(R) position [m]
- 8) PP(i),i=1,3		(R) cartesian momentum [GeV/c]
- 9) BFLD(i),i=1,3	(R) total magnetic field [T]
- 10) EVTWT		(R) event weight
- 11) EFLD(i),i=1,3	(R) total electric field [V/m]
- 12) SARC		(R) total arclength [m]
- 13) POL(i),i=1,3	(R) spin
- For muons from pion decay POL(3) contains the helicity in the LAB frame when SPIN=true and SPINTRK=0.

## Output File Specifications (cont.)

- Also we would like the same formulism to be applicable to all of our GEANT ring simulations:
- TETRA
- RFOFO
- Garren-Kirk ring
- We would also like to have the liberty to calculate the emittance anywhere we want.
- Place a virtual volume named *CALC* to be placed anywhere one desires to make the emittance calculations.
- This would be done merely by placing this volume description in the RCP data file.
- The issues are the same as with the input files.  We must transform from the global coordinates to the local ICOOL reference system.

## More Output Specifications

- In order to facilitate the transformation to ICOOL reference system the user will have to supply functions for this reference system description since they are different for TETRA, RFOFO, etc.**  **Specifically,
- FUNCTION REFERENCE_LENGTH(real[3]) which gives the geometric reference arc path length from the global position of the CALC virtual volume for the first turn.
- The correct *RING_CIRCUMFERENCE* for the chosen ring should be in the RCP file.  This is necessary for the turn definition and the ICOOL *Z* definition.
**Current Status:**
- I am currently working on the output phase to write a file for ECALC9.