Result on ICool - G4 comparison on the (1-1) and (1-2) Cooling 
lattice, Dec 30 2000. 

	Summary: After installation of the "Icool-Phase3" rf tuning in G4,  and
after re-adjustment of the LH2 density to match energy losses, the particle on
momentum, "in time", and at zero transverse amplitude tracks with the same
momentum in ICool and G4, within a fraction of an MeV/c.  However, significant
differences remain on the  transverse plane, leading to a remaining ~ 12%
relative difference for the Yield  in the 15 mm. acceptance after 44 m. of
cooling.  A detailed analysis of a  particle (#31) bumping to a G4 IRis, and
surviving in ICool, as well as other particles reveals a remaining difference
in the transverse field of up to ~ 500 - 1kG at high radius (10 to 15 cm.),
leading to such transverse discrepancies.   Other tests on G4 tracing accuracy
have been done, leading to no signficant change on the G4 side.  However, if
the G4 field map gets distorted,  (thereby violating the Poisson equation),
better agreement between G4 and ICool can be obtained, keeping for instance the
part 31 in the aperture.  No change in G4 seems to be warranted at this point. 
Multiple Scattering  sensitivity and tolerances studies are progressing.   

	In detail:
	
	a. Phase 3: This was easier to install, I already had on order list of 
r.f. cells centers, the added method the the global e.m. field is :

void AGlobalEMField::SetPhasesModel3(double beta)
{
   cout << " Setting Rf Phase Model 3 assuming beta = " << beta << endl;
  for (CLinac cs = myCells.begin(); cs != myCells.end(); ++cs) {
     ALinacCellPhaseInfo *c = *cs;
     double tt = (c->zNominalf())/(c_light * beta);
     c->SetTheDelay(tt);
  }   
}

	The reference particle moves at a constant velocity (beta = 0.88470251
in our case, correspong to a kinetic energy of 121 MeV).  Each cell is 
clocked, which is the basis for the phase. 

	The kinematics of the "Phase3" ref. particle is shown on plots  
	
CmpTraceRefPhase3*.eps

	Where, in the "*", you'll find 
	
	"E" : Kinetic Energy in ICool and G4, surimposed.  In order to obtain 
good agreement, the density of LH2 had to be raised in G4 from 0.0708 gr/cm^3
to 0.076504457 ( ~ 8.1 % increase!) The G4 value for dE/dx in LH2, at this 
kinetic energy is very close to 4.2 MeV/(gr cm2), which agrees with PDG value.

	As shown on "EWindowDetail", the differences in the window thickness 
is not the (only) cause of this unexpected discrepancy.  May be I am
mis-interpreting the PDG value.  Note that this bring the cooling rate ~8 %
higher in ICool with respect to G4. We have to decide at which LH2 density 
we ought to run.. 

	Anyway, as shown on "EDetail", the energy loss has been adjusted to 
a fraction of an MeV, and the relative phases between G4 and ICOOL have a 
negligeable effect on the synchrotron motion ("EzEnd" vs "EzStart"). This
reference particle has a synchrotron amplitude of ~ 7.5 MeV, relatively small 
compare to the energy spread of the beam (but not completely negligeable either,
that ought to have a detrimental effect .?..) 

	Having a common G4-ICOOL reference trajectory, we can now compare 
the trajectory for a typical particle (#5) and two large amplitude particle
which G4 kicked out of the channel and ICOOL kept (particle 23 and 31). 
Since decay, straggling and multiple scattering are turned off, remaining
differences in phase space locations between the two code must be due to 
difference in fields or in the numerical integration of the equation of motion.

The labeling of the plots "CmpTracePart*Phase3*.eps" is straightforward:

	- Phase refers to the above tune.
	- 5, 23 ,31 refers to the particle number
	- Bx : x component of the field
	- X : X position
	- R : radial position
	- E : Energy 
	
	Results:
	 
	a. All three particles follow the same longitudinal trajectory, within 
a fraction of an MeV (at most, ~ 1 MeV). 
	b. Not so transversversely: although part 23 is now accepted, the radial
excursions are still bigger in G4 than ICOOL.  Particle 31 is still lost at 
R = 21 cm. 
	c. The transverse field differ early, after a few meter, by up to 
1 kG!, 10, 20 % relative. (see *= 31, BxAbsorberDetail), while the trajectory
are still very close to each others. ==> the field map disagree!

	In any event, I ran the complete sample with this "Phase3" and high 
LH2 density. After 44 m. of cooling, I got a muon/Proton ratio of 0.168 in  the
large emittance cut (15 mm) (see MuOverProtonPhase3HighLH2.eps), with a  total
transmission of the 32.6 % . With the low LH2 density and "phase 4" r.f. model
(shown  on MuOverProtonPhase4LowLH2.eps), I got a  muon/Proton ratio of 0.148
in 15 mm and  a total transmission of 32.2 %, at Z = 44m.  I believe that the
improvement comes from  the higher LH2 density rather than the phase model.
These muonOverProton ratio were computed using the ecalc9 program.

	  
	The corresponding  ICool number 0.188, still in disagreement. Let us go
back to the  transverse motion. The fact the Bx differs in the upstream part of
the  trajectory, in the absorber regions is still unresolved. The following 
tests were made in G4: 

	a. Tracking accuracy: Although it obviously would not explain the 
difference in the fields, we want to make sure that the Runge-Kutta (RK)
integration is done correctly.  The relative accuracy in the RK algorythm 
(Method  SetAccuraciesWithDeltaOneStep in the G4FieldPropagator)  has been
relaxed by one, that two and three order of magnetidue.  One order of magnitude
bring changes less than or the order of 1 mm. No improvement in the muon/Proton
ratio were observed. 

	b. Check of the field map: 
	
	b1: Numerical estimation of the Gradient of B (Poisson law), should  be
identical to 0. While the dBz/dz can be as high as 0.018 T/mm
(dBzdzNominalMap.eps), the  Grad B is less than 10-4 T/mm. The spikes at
maximum variation of the main  component are a bit
troubling..(gradBNominalMap.eps)  

	b2 : Change of the number of nodes in each three maps, (one for each 
coil types in the channel),  along the radial direction, from 100 nodes down 
to 50, or up to 200.  The map extends to 55 cm, so that step size ranges from 
~1 cm down to 2.5 mm. Since the interpolation is done linearly along the radial
direction, this is the most sensitive test (Earlier tests along the Z direction
were done as well, showing that 1,000 nodes over ~8 m., along with 
cubic pline interpolation,  was more than adequate ).  No difference in 
performance was found, within 2 tens of 1 percent in the muon/proton in 15 mm. 


	c. Does the difference in Bx shown in 
CmpTracePart31Phase3BxAbsorberDetail.eps matter?  The answer is definitely yes!
To see this, I have rescaled the transverse components of the field by 1.5 %, 
everywhere.  Doing so, I can get much better agreement for particle 31 :
(see CmpTracePart31Phase3Brp1p5*.eps) Sincve the original discrepancy in the 
transverse field seems to more pronounced in the absorber region, this 
"tweaked agreement" is not perfect.  Note that, in G4, the field map is 
smooth over the transition from the drift between Linac and absorber, because 
G4 does not recognize "regions" while returning the field values at any given
point.   This tweak leads to larger deviation from the Poisson law, as shown
on fig. gradBBTransX1p015.eps, as expected.

	Although this tweak is clearly unphysical, it gives slightly
 better performance: muon/proton increased to 17.1 % from 16.8 % (
( Since there are no stochastic processes and the sample are identical, such
small differences are symptomatic. ) .  Running with 1.5% decrease in the 
transverse componenets leads to a decrease in performance. (16.2 %). 

	I have not pursed this avenue with unphysical fields any
 further. However, yes, such tweaks can occasionally lead to better performance!
 
 
 	Why did we spend time on getting on resolving these differences? 
	
	a. We still have not reached agreements within 10%, (leaving alone 
differences in multiple scattering!).  Although we are close : 18.8% (ICOOL) - 
16.8 % (G4))/17. = 12 % 

	b. As the remaining difference seems to be correlated with field map
inaccuracies, the upcoming tolerance study is in fact hostage of this issue: 
The G4-ICOOL differences in the transverse field are of the order a few hundred
Gauss, of the same order of magnitude of the transverse field produced by a 
~ mRad. tilt angle. 

	Having said that, I see no reason to modify the G4 code: 
	
	- There are no reason for the approximate "Phase3" r.f. tune to be 
better than the "Phase 4". (exact momentum vs Z, less synch. motion for the 
cold particle) 
	- LH2 density should be set by the operating temperature and pression.
(O.K., may be I'll change that for final estimation, Dan, do you know what the 
exact average de/dx and LH2 density? Do we have better tables than PDG?).
	- Field map accuracy: ICOOL relies on the global grid, while G4 
keeps a set of grids and sum the fields. The former is evidently faster, but 
the grid has be to coarser than small, local grids. ==> we expect G4 to be 
more accurate..