diff --git a/tracy/tracy/src/physlib.cc b/tracy/tracy/src/physlib.cc index d3f392f4f8593a9812eabf967e4da2fbecba476c..863775cc231bbe5984eb951bad927d662e22e470 100644 --- a/tracy/tracy/src/physlib.cc +++ b/tracy/tracy/src/physlib.cc @@ -132,7 +132,7 @@ uint32_t stampstop(uint32_t start) struct tm *tm; uint32_t stop; const bool timedebug = false; - + bool prt = false; // get the time gettimeofday(&tv, &tz); tm = localtime(&tv.tv_sec); @@ -155,7 +155,8 @@ uint32_t stampstop(uint32_t start) minute = (delta-3600000*hour)/60000; second = (delta-3600000*hour-minute*60000)/1000; millisecond = delta-3600000*hour-minute*60000-second*1000; - + + if(prt) printf("ELAPSED\t %d h %d min %d s %d ms\n", hour, minute, second, millisecond); @@ -212,11 +213,11 @@ void printglob(void) printf(" Cavity_On = %s ", globval.Cavity_on ? "TRUE " : "FALSE"); printf(" Radiation_On = %s \n", globval.radiation ? "TRUE " : "FALSE"); - printf(" bpm = %3ld qt = %3ld ", - globval.bpm, globval.qt); + printf(" bpm = %3d qt = %3d ", + GetnKid(globval.bpm),GetnKid(globval.qt) ); printf(" Chambre_On = %s \n", status.chambre ? "TRUE " : "FALSE"); - printf(" hcorr = %3ld vcorr = %3ld\n\n", - globval.hcorr, globval.vcorr); + printf(" hcorr = %3d vcorr = %3d\n\n", + GetnKid(globval.hcorr), GetnKid(globval.vcorr)); printf(" alphac = %8.4e\n", globval.Alphac); printf(" nux = %13.6f nuz = %13.6f", globval.TotalTune[X_], globval.TotalTune[Y_]); @@ -484,7 +485,29 @@ void TraceABN(long i0, long i1, const Vector2 &alpha, const Vector2 &beta, } +/****************************************************************************/ +/* void FitTune(long qf, long qd, double nux, double nuy) + + Purpose: + Fit tunes to the target values using quadrupoles "qf" and "qd" + Input: + qf : tuned quadrupole + qd : tuned quadrupole + nux: target horizontal tune + nuy: target vertical tune + Output: + none + + Return: + none + + Global variables: + + specific functions: + + Comments: +****************************************************************************/ void FitTune(long qf, long qd, double nux, double nuy) { long i; @@ -508,6 +531,29 @@ void FitTune(long qf, long qd, double nux, double nuy) Ring_Fittune(nu, nueps, nq, qfbuf, qdbuf, nudkL, nuimax); } +/****************************************************************************/ +/* void FitChrom(long sf, long sd, double ksix, double ksiy) + + Purpose: + Fit chromaticities to the target values using sextupoles "sf" and "sd" + Input: + sf : tuned sextupole + sd : tuned sextupole + ksix: target horizontal chromaticity + ksiy: target vertical chromaticity + Output: + none + + Return: + none + + Global variables: + + specific functions: + + Comments: + +****************************************************************************/ void FitChrom(long sf, long sd, double ksix, double ksiy) { @@ -815,7 +861,7 @@ void Trac(double x, double px, double y, double py, double dp, double ctau, lostF = true; if(trace) fprintf(outf1, "\n"); - fprintf(outf1, "%6ld %+10.5e %+10.5e %+10.5e %+10.5e %+10.5e %+10.5e \n", lastn, + if(trace) fprintf(outf1, "%6ld %+10.5e %+10.5e %+10.5e %+10.5e %+10.5e %+10.5e \n", lastn, x1[0], x1[1], x1[2], x1[3], x1[4], x1[5]); @@ -828,7 +874,7 @@ void Trac(double x, double px, double y, double py, double dp, double ctau, (lastn)++; /* 3) continue tracking for nmax turns*/ Cell_Pass(0L,pos-1L, x1, lastpos); /* 1) check whether particle is stable at element from 0 to pos-1L*/ - if(!trace) + if(trace) fprintf(outf1, "%6ld %+10.5e %+10.5e %+10.5e %+10.5e %+10.5e %+10.5e \n", lastn, x1[0], x1[1], x1[2], x1[3], x1[4], x1[5]); @@ -2066,22 +2112,74 @@ void set_dbn_rel(const int type, const int n, const double dbn_rel) } } +/******************************************************************** +double GetKpar(int Fnum, int Knum, int Order) + Purpose: + Return the n-th order design field strength of the element + + Input: + Fnum family index + Knum kid index + Order design field strength + + Ouput: + None + + Return: + n-th order design field strength + +*********************************************************************/ double GetKpar(int Fnum, int Knum, int Order) { return (Cell[Elem_GetPos(Fnum, Knum)].Elem.M->PBpar[Order+HOMmax]); } +/******************************************************************** +double GetL(int Fnum, int Knum) + Purpose: + Return the length of the element with "Fnum" and "Knum" + + Input: + Fnum family index + Knum kid index + + + Ouput: + None + + Return: + + +*********************************************************************/ double GetL(int Fnum, int Knum) { return (Cell[Elem_GetPos(Fnum, Knum)].Elem.PL); } +/******************************************************************** +double GetKLpar(int Fnum, int Knum, int Order) + + Purpose: + Return the n-th order design integrated field strength of the element + + Input: + Fnum family index + Knum kid index + Order design field strength + + Ouput: + None + + Return: + n-th order design integrated field strength + +*********************************************************************/ double GetKLpar(int Fnum, int Knum, int Order) { - long int loc; + long int loc = 0L; loc = Elem_GetPos(Fnum, Knum); if (Cell[loc].Elem.PL != 0e0)