From 7e1de340062f23520a5a84531d1cf53660e67030 Mon Sep 17 00:00:00 2001
From: nadolski <nadolski@9a6e40ed-f3a0-4838-9b4a-bf418f78e88d>
Date: Sun, 30 Jun 2013 07:26:15 +0000
Subject: [PATCH] Typo and flat file with .out extension

---
 tracy/tools/soltracy.cc        | 26 ++++++-------
 tracy/tracy/inc/read_script.h  | 54 +++++++++++++-------------
 tracy/tracy/src/read_script.cc | 71 ++++++++++++++++------------------
 tracy/tracy/src/t2cell.cc      |  2 +-
 tracy/tracy/src/t2elem.cc      | 33 +++++++---------
 5 files changed, 86 insertions(+), 100 deletions(-)

diff --git a/tracy/tools/soltracy.cc b/tracy/tools/soltracy.cc
index df7585d..94fb13a 100644
--- a/tracy/tools/soltracy.cc
+++ b/tracy/tools/soltracy.cc
@@ -109,7 +109,7 @@ int main(int argc, char *argv[]) {
    *************************************************************************/
   
   //print flat file with all the design values of the lattice,
-  prtmfile("flat_file.dat");
+  prtmfile("flat_file.out");
   // print location, twiss parameters and close orbit at all elements position to a file
   getcod(dP, lastpos);
   prt_cod("cod.out", globval.bpm, true);
@@ -121,10 +121,6 @@ int main(int argc, char *argv[]) {
   //dnu_dA(10e-3, 5e-3, 0.002);
   //get_ksi2(0.0); // this gets the chromas and writes them into chrom2.out
   
-    
-  
-   
-  
 /********************************************************************* 
                             Flag factory 
 *********************************************************************/
@@ -201,7 +197,7 @@ int main(int argc, char *argv[]) {
     fprintf(stdout,"        %s\n",multipole_file);
     ReadFieldErr(multipole_file);
     //first print the full lattice with error as a flat file
-    prtmfile("flat_file_errmultipole.dat"); // writes flat file with all element errors  /* very important file for debug*/
+    prtmfile("flat_file_errmultipole.out"); // writes flat file with all element errors  /* very important file for debug*/
     Ring_GetTwiss(chroma = true, 0.0); /* Compute and get Twiss parameters */
     printglob();
   }
@@ -212,7 +208,7 @@ int main(int argc, char *argv[]) {
     
     ReadVirtualSkewQuad(virtualskewquad_file);
     //first print the full lattice with sources of coupling as a flat file
-    prtmfile("flat_file_skewquad.dat");  /* very important file for debug*/
+    prtmfile("flat_file_skewquad.out");  /* very important file for debug*/
     //get the coupling
     Coupling_Edwards_Teng(); 
   }
@@ -386,9 +382,9 @@ int main(int argc, char *argv[]) {
   // add coupling by random rotating of the full quadrupole magnets
   //if (ErrorCouplingFlag == true) {
   else if(strcmp(CommandStr,"ErrorCouplingFlag") == 0) {
-    prtmfile("flat_file.dat"); //print the elements without rotation errors
+    prtmfile("flat_file.out"); //print the elements without rotation errors
     SetErr(UserCommandFlag[i].err_seed, UserCommandFlag[i].err_rms);
-    prtmfile("flat_file_errcoupling_full.dat"); //print the elements with rotation errors
+    prtmfile("flat_file_errcoupling_full.out"); //print the elements with rotation errors
     Ring_GetTwiss(chroma = true, 0.0); /* Compute and get Twiss parameters */
     printlatt("linlat_errcoupling.out"); /* dump linear lattice functions into "linlat.dat" */
     Coupling_Edwards_Teng();
@@ -400,9 +396,9 @@ int main(int argc, char *argv[]) {
   
 //  add coupling by random rotating of the half quadrupole magnets, delicated for soleil
   else if(strcmp(CommandStr,"ErrorCoupling2Flag") == 0) {
-    prtmfile("flat_file.dat"); //print the elements without rotation errors
+    prtmfile("flat_file.out"); //print the elements without rotation errors
     SetErr2(UserCommandFlag[i].err_seed, UserCommandFlag[i].err_rms);
-    prtmfile("flat_file_errcoupling_half.dat"); //print the elements with rotation errors
+    prtmfile("flat_file_errcoupling_half.out"); //print the elements with rotation errors
     Ring_GetTwiss(chroma = true, 0.0); /* Compute and get Twiss parameters */
     printlatt("linlat_errcoupling2.out"); /* dump linear lattice functions into "linlat.dat" */
     Coupling_Edwards_Teng();
@@ -507,7 +503,7 @@ int main(int argc, char *argv[]) {
 					exit_(1);
 				}
 				// concatanation of the results,  add current j-file to the master file
-				while(fgets(buffer, 80, fp) != NULL){
+				while(fgets(buffer, max_str, fp) != NULL){
 					fputs(buffer, outf);
 					buffer[0]='\0';
 				}
@@ -522,7 +518,7 @@ int main(int argc, char *argv[]) {
 						exit_(1);
 					}
 					// concatanation of the results,  add current j-file to the master file
-					while(fgets(buffer, 80, fp_loss) != NULL){
+					while(fgets(buffer, max_str, fp_loss) != NULL){
 						fputs(buffer, outf_loss);
 						buffer[0]='\0';
 					}
@@ -616,7 +612,7 @@ int main(int argc, char *argv[]) {
 				} 
 
 				// concatanation of the results,  add current j-file to the master file
-				while(fgets(buffer, 80, fp) != NULL){
+				while(fgets(buffer, max_str, fp) != NULL){
 					fputs(buffer, outf);
 					buffer[0]='\0';
 				}
@@ -631,7 +627,7 @@ int main(int argc, char *argv[]) {
 						exit_(1);
 					}
 					// concatanation of the results,  add current j-file to the master file
-					while(fgets(buffer, 80, fp_loss) != NULL){
+					while(fgets(buffer, max_str, fp_loss) != NULL){
 						fputs(buffer, outf_loss);
 						buffer[0]='\0';
 					}
diff --git a/tracy/tracy/inc/read_script.h b/tracy/tracy/inc/read_script.h
index 90c0496..e2765c1 100644
--- a/tracy/tracy/inc/read_script.h
+++ b/tracy/tracy/inc/read_script.h
@@ -2,7 +2,7 @@
  class UserCommand
  {
    public:
-   char  CommandStr[max_str];   // bool flag name
+   char CommandStr[max_str];   // bool flag name
    
  /***** parameters *******/
   
@@ -13,24 +13,24 @@
    char chamber_file[max_str];
    
     // misalignment error file
-   char    ae_file[max_str];
+   char ae_file[max_str];
    
    // field error file
-   char    fe_file[max_str]; 
+   char fe_file[max_str]; 
    
     // FitTuneFlag ; 
    char qf[max_str],qd[max_str]; 
    double targetnux, targetnuz;
    // FitTune4Flag  ; 
-    char qf1[max_str],qf2[max_str],qd1[max_str],qd2[max_str]; 
- // FitChromFlag ; 
+	 char qf1[max_str],qf2[max_str],qd1[max_str],qd2[max_str]; 
+   // FitChromFlag ; 
    char sxm1[max_str],sxm2[max_str]; 
    double targetksix, targetksiz ;
-  //add coupling error to full/half quadrupoles
+   //add coupling error to full/half quadrupoles
    long err_seed; 
    double err_rms;
    
-    //start track particle coordinates; PrintTrackFlag
+	//start track particle coordinates; PrintTrackFlag
    char _PrintTrack_track_file[max_str];
    double _PrintTrack_x, _PrintTrack_px, _PrintTrack_y, 
           _PrintTrack_py, _PrintTrack_delta, _PrintTrack_ctau;
@@ -42,42 +42,42 @@
    char _PrintCOD_cod_file[max_str];
   
   //AmplitudeTuneShiftFlag;
-   char _AmplitudeTuneShift_nudx_file[max_str];
-   char _AmplitudeTuneShift_nudz_file[max_str];
-   long _AmplitudeTuneShift_nxpoint, _AmplitudeTuneShift_nypoint;
-   long _AmplitudeTuneShift_nturn;
+   char   _AmplitudeTuneShift_nudx_file[max_str];
+   char   _AmplitudeTuneShift_nudz_file[max_str];
+   long   _AmplitudeTuneShift_nxpoint, _AmplitudeTuneShift_nypoint;
+   long   _AmplitudeTuneShift_nturn;
    double _AmplitudeTuneShift_xmax, _AmplitudeTuneShift_ymax, _AmplitudeTuneShift_delta;
  
  //EnergyTuneShiftFlag;
-   char _EnergyTuneShift_nudp_file[max_str];
-   long _EnergyTuneShift_npoint, _EnergyTuneShift_nturn;
+   char   _EnergyTuneShift_nudp_file[max_str];
+   long   _EnergyTuneShift_npoint, _EnergyTuneShift_nturn;
    double _EnergyTuneShift_deltamax;
  
  //extern bool FmapFlag;
-   char _FmapFlag_fmap_file[max_str];
-   long _FmapFlag_nxpoint, _FmapFlag_nypoint, _FmapFlag_nturn;
+   char   _FmapFlag_fmap_file[max_str];
+   long   _FmapFlag_nxpoint, _FmapFlag_nypoint, _FmapFlag_nturn;
    double _FmapFlag_xmax, _FmapFlag_ymax, _FmapFlag_delta;
-   bool _FmapFlag_diffusion;
-   bool _FmapFlag_printloss;
+   bool   _FmapFlag_diffusion;
+   bool   _FmapFlag_printloss;
    
  
  //extern bool FmapdpFlag;
-   char _FmapdpFlag_fmapdp_file[max_str];
-   long _FmapdpFlag_nxpoint, _FmapdpFlag_nepoint, _FmapdpFlag_nturn;
+   char   _FmapdpFlag_fmapdp_file[max_str];
+   long   _FmapdpFlag_nxpoint, _FmapdpFlag_nepoint, _FmapdpFlag_nturn;
    double _FmapdpFlag_xmax, _FmapdpFlag_emax, _FmapdpFlag_z;
-   bool _FmapdpFlag_diffusion;
-   bool _FmapdpFlag_printloss;
+   bool   _FmapdpFlag_diffusion;
+   bool   _FmapdpFlag_printloss;
 
    
   //MomentumAccFlag;
-   char _MomentumAccFlag_momacc_file[max_str];  //  file to save tracked momentum accpetance
-   char _MomentumAccFlag_TrackDim[3];
-   long  _MomentumAccFlag_istart, _MomentumAccFlag_istop,
-         _MomentumAccFlag_nstepn, _MomentumAccFlag_nstepp,
-         _MomentumAccFlag_nturn;
+   char   _MomentumAccFlag_momacc_file[max_str];  //  file to save tracked momentum accpetance
+   char   _MomentumAccFlag_TrackDim[3];
+   long   _MomentumAccFlag_istart, _MomentumAccFlag_istop,
+          _MomentumAccFlag_nstepn, _MomentumAccFlag_nstepp,
+          _MomentumAccFlag_nturn;
    double _MomentumAccFlag_deltaminn, _MomentumAccFlag_deltamaxn;
    double _MomentumAccFlag_deltaminp, _MomentumAccFlag_deltamaxp;
-   double  _MomentumAccFlag_zmax;
+   double _MomentumAccFlag_zmax;
    
   // /* Phase space */
    //char *_Phase_phase_file;
diff --git a/tracy/tracy/src/read_script.cc b/tracy/tracy/src/read_script.cc
index dc50e7b..50e31eb 100644
--- a/tracy/tracy/src/read_script.cc
+++ b/tracy/tracy/src/read_script.cc
@@ -299,81 +299,76 @@ void read_script(const char *param_file_name, bool rd_lat, long& CommNo, UserCom
       // FMA dp
       else if (strcmp("FmapdpFlag", name) == 0){         
     	  strcpy(dummy, "");
-	  strcpy(dummy2,"");
-	  sscanf(line, "%*s %s",nextpara);
+				strcpy(dummy2,"");
+				sscanf(line, "%*s %s",nextpara);
 	  
-	  if(strcmp(nextpara,"voidpara")!=0)
+				if(strcmp(nextpara,"voidpara")!=0)
             sscanf(line, "%*s %s %ld %ld %ld %lf %lf %lf %s %s", 
           		UserCommandFlag[CommNo]._FmapdpFlag_fmapdp_file,
-			&(UserCommandFlag[CommNo]._FmapdpFlag_nxpoint),
-			&(UserCommandFlag[CommNo]._FmapdpFlag_nepoint),
+							&(UserCommandFlag[CommNo]._FmapdpFlag_nxpoint),
+							&(UserCommandFlag[CommNo]._FmapdpFlag_nepoint),
           		&(UserCommandFlag[CommNo]._FmapdpFlag_nturn), 
-			&(UserCommandFlag[CommNo]._FmapdpFlag_xmax), 
-			&(UserCommandFlag[CommNo]._FmapdpFlag_emax),
+							&(UserCommandFlag[CommNo]._FmapdpFlag_xmax), 
+							&(UserCommandFlag[CommNo]._FmapdpFlag_emax),
           		&(UserCommandFlag[CommNo]._FmapdpFlag_z), 
-			dummy,dummy2);
+							dummy,dummy2);
 	 
         if(strcmp(dummy, "true") == 0)
           UserCommandFlag[CommNo]._FmapdpFlag_diffusion = true;
         else if(strcmp(dummy, "false") == 0)
           UserCommandFlag[CommNo]._FmapdpFlag_diffusion = false;
 
-	if(strcmp(dummy2, "true") == 0)
+				if(strcmp(dummy2, "true") == 0)
           UserCommandFlag[CommNo]._FmapdpFlag_printloss = true;
         else if(strcmp(dummy2, "false") == 0)
           UserCommandFlag[CommNo]._FmapdpFlag_printloss = false;
-	else
-	  UserCommandFlag[CommNo]._FmapdpFlag_printloss = false;
-	
+				else
+					UserCommandFlag[CommNo]._FmapdpFlag_printloss = false;
 	
-	cout << "debug:      " << line << endl;
-	cout << "dummy2 =  " << dummy2 << "     lossflag =  " << UserCommandFlag[CommNo]._FmapdpFlag_printloss << endl;
+				cout << "debug:      " << line << endl;
+				cout << "dummy2 =  " << dummy2 << "     lossflag =  " << UserCommandFlag[CommNo]._FmapdpFlag_printloss << endl;
 	
 	  //  FmapdpFlag = true;
          strcpy(UserCommandFlag[CommNo].CommandStr,name);
-      }
+      } // FMAP dp
       else if (strcmp("AmplitudeTuneShiftFlag", name) == 0){
         sscanf(line, "%*s %s",nextpara);
 	 
-	if(strcmp(nextpara,"voidpara")!=0)   
+				if(strcmp(nextpara,"voidpara")!=0)   
           sscanf(line, "%*s %s %s %ld %ld %ld %lf %lf %lf", 
 	          UserCommandFlag[CommNo]._AmplitudeTuneShift_nudx_file,
-		  UserCommandFlag[CommNo]._AmplitudeTuneShift_nudz_file,
+						UserCommandFlag[CommNo]._AmplitudeTuneShift_nudz_file,
 	         &(UserCommandFlag[CommNo]._AmplitudeTuneShift_nxpoint),
 	         &(UserCommandFlag[CommNo]._AmplitudeTuneShift_nypoint), 
 	         &(UserCommandFlag[CommNo]._AmplitudeTuneShift_nturn),
-                 &(UserCommandFlag[CommNo]._AmplitudeTuneShift_xmax),
+					 &(UserCommandFlag[CommNo]._AmplitudeTuneShift_xmax),
 	         &(UserCommandFlag[CommNo]._AmplitudeTuneShift_ymax),
-                 &(UserCommandFlag[CommNo]._AmplitudeTuneShift_delta));
+           &(UserCommandFlag[CommNo]._AmplitudeTuneShift_delta));
        
-       strcpy(UserCommandFlag[CommNo].CommandStr,name);    
+				strcpy(UserCommandFlag[CommNo].CommandStr,name);    
       }
       else if (strcmp("EnergyTuneShiftFlag", name) == 0){
         sscanf(line, "%*s %s",nextpara);
 	 
-	 if(strcmp(nextpara,"voidpara")!=0)
-	   sscanf(line, "%*s %s %ld %ld %lf",  
+				if(strcmp(nextpara,"voidpara")!=0)
+					sscanf(line, "%*s %s %ld %ld %lf",  
 	          UserCommandFlag[CommNo]._EnergyTuneShift_nudp_file,
 	         &(UserCommandFlag[CommNo]._EnergyTuneShift_npoint),
 					 &(UserCommandFlag[CommNo]._EnergyTuneShift_nturn), 
 	         &(UserCommandFlag[CommNo]._EnergyTuneShift_deltamax));
         
-	strcpy(UserCommandFlag[CommNo].CommandStr,name);
-	    
+					strcpy(UserCommandFlag[CommNo].CommandStr,name);
       }
       else if (strcmp("ErrorCouplingFlag", name) == 0){
         sscanf(line, "%*s  %ld %lf",&(UserCommandFlag[CommNo].err_seed),&(UserCommandFlag[CommNo].err_rms));
-        strcpy(UserCommandFlag[CommNo].CommandStr,name);
-      
+        strcpy(UserCommandFlag[CommNo].CommandStr,name);      
       }
         else if (strcmp("ErrorCoupling2Flag", name) == 0){
         sscanf(line, "%*s  %ld %lf",&(UserCommandFlag[CommNo].err_seed),&(UserCommandFlag[CommNo].err_rms));
         strcpy(UserCommandFlag[CommNo].CommandStr,name);
-        
       }
       else if (strcmp("CouplingFlag", name) == 0){
         strcpy(UserCommandFlag[CommNo].CommandStr,name);
-        
       }//momentum compact factor
        else if (strcmp("MomentumAccFlag", name) == 0){
          sscanf(line, "%*s %s",nextpara);
@@ -399,13 +394,13 @@ void read_script(const char *param_file_name, bool rd_lat, long& CommNo, UserCom
 //       generic one, fit for 1 family of quadrupoles
       else if (strcmp("FitTuneFlag", name) == 0){
         sscanf(line, "%*s %s %s %lf %lf",UserCommandFlag[CommNo].qf,UserCommandFlag[CommNo].qd,
-	&(UserCommandFlag[CommNo].targetnux),&(UserCommandFlag[CommNo].targetnuz));
+								&(UserCommandFlag[CommNo].targetnux),&(UserCommandFlag[CommNo].targetnuz));
        strcpy(UserCommandFlag[CommNo].CommandStr,name);
       }
       // fit for 2 families,specific for the soleil lattice in which the quadrupole is cut into 2 parts
        else if (strcmp("FitTune4Flag", name) == 0){
          sscanf(line, "%*s %s %s %s %s %lf %lf",UserCommandFlag[CommNo].qf1,UserCommandFlag[CommNo].qf2,
-				 UserCommandFlag[CommNo].qd1,UserCommandFlag[CommNo].qd2,
+					UserCommandFlag[CommNo].qd1,UserCommandFlag[CommNo].qd2,
 	       &(UserCommandFlag[CommNo].targetnux),&(UserCommandFlag[CommNo].targetnuz));
          strcpy(UserCommandFlag[CommNo].CommandStr,name);
       }
@@ -447,14 +442,14 @@ void read_script(const char *param_file_name, bool rd_lat, long& CommNo, UserCom
 	   sscanf(line, "%*s %s %s %lf %lf %lf %lf %lf %lf %ld %s", 
 	               UserCommandFlag[CommNo]._Phase_phase_file,
 	               UserCommandFlag[CommNo]._Phase_Dim,
-                       &(UserCommandFlag[CommNo]._Phase_X), 
-		       &(UserCommandFlag[CommNo]._Phase_Px), 
-		       &(UserCommandFlag[CommNo]._Phase_Y), 
-		       &(UserCommandFlag[CommNo]._Phase_Py), 
-		       &(UserCommandFlag[CommNo]._Phase_delta),
-                       &(UserCommandFlag[CommNo]._Phase_ctau), 
-		       &(UserCommandFlag[CommNo]._Phase_nturn), 
-		       str);
+								 &(UserCommandFlag[CommNo]._Phase_X), 
+								 &(UserCommandFlag[CommNo]._Phase_Px), 
+								 &(UserCommandFlag[CommNo]._Phase_Y), 
+								 &(UserCommandFlag[CommNo]._Phase_Py), 
+								 &(UserCommandFlag[CommNo]._Phase_delta),
+                 &(UserCommandFlag[CommNo]._Phase_ctau), 
+								 &(UserCommandFlag[CommNo]._Phase_nturn), 
+								 str);
 	 }
 	 //radiation damping
           if (strcmp(str, "true") == 0)
diff --git a/tracy/tracy/src/t2cell.cc b/tracy/tracy/src/t2cell.cc
index 1f0be8e..925dc44 100644
--- a/tracy/tracy/src/t2cell.cc
+++ b/tracy/tracy/src/t2cell.cc
@@ -865,7 +865,7 @@ bool Cell_getCOD(long imax, double eps, double dP, long &lastpos)
       else{
         prt_beampos("beampos.dat");
         prt_cod("cod.out", globval.bpm, true);
-        prtmfile("flat_file_dbg.dat");
+        prtmfile("flat_file_dbg.out");
 //      prt_trace();
         dxabs = 1e30; 
 	break;
diff --git a/tracy/tracy/src/t2elem.cc b/tracy/tracy/src/t2elem.cc
index 49495d7..95a6935 100644
--- a/tracy/tracy/src/t2elem.cc
+++ b/tracy/tracy/src/t2elem.cc
@@ -122,8 +122,8 @@ inline T get_p_s(ss_vect<T> &x)
  If H_exact = false, using approximation Hamiltonian:
 
                                    px^2+py^2
-        H(x,y,l,px,py,delta) = -------------
-                                 2(1+delta)     
+        H(x,y,l,px,py,delta) =    -----------
+                                   2(1+delta)     
        
 
  Otherwise, using exact Hamiltonian
@@ -1757,14 +1757,8 @@ void Insertion_Pass(CellType &Cell, ss_vect<T> &X) {
     LN = elemp->PL / Nslice;
    
  
-		if ((elemp->ID->firstorder && elemp->ID->scaling1 == 0.0) & 
-			 (elemp->ID->secondorder || elemp->ID->scaling2 == 0.0)){
-			 Drift(elemp->PL, X); // only a drift if kick is zero
-			 if (trace) fprintf(stdout, "Insertion_Pass: used a drift since scaling factors are zeros for elem %s\n",
-			 elemp->PName);
-    }
-		else{ // Integrator scheme
     switch (elemp->ID->Pmethod) {
+
       case Meth_Second:
         for (i = 1; i <= Nslice; i++) {
           Drift(LN/2.0, X);
@@ -1772,7 +1766,7 @@ void Insertion_Pass(CellType &Cell, ss_vect<T> &X) {
           //elemp->PL, Nslice, LN, elemp->ID->scaling1, elemp->ID->scaling1);
 
           // First order kick map
-          if (elemp->ID->firstorder && elemp->ID->scaling1 != 0.0) {
+          if (elemp->ID->firstorder) {
               if (!elemp->ID->linear) {
                   //cout << "InsertionPass: Spline\n";
                   SplineInterpolation2(X[x_], X[y_], tx1, tz1, Cell, outoftable,
@@ -1792,7 +1786,7 @@ void Insertion_Pass(CellType &Cell, ss_vect<T> &X) {
           }
 
           // Second order kick map
-          if (elemp->ID->secondorder && elemp->ID->scaling2 != 0.0) {
+          if (elemp->ID->secondorder) {
               if (!elemp->ID->linear) {
                   //cout << "InsertionPass: Spline\n";
                   SplineInterpolation2(X[x_], X[y_], tx2, tz2, Cell, outoftable, 2);
@@ -1813,7 +1807,7 @@ void Insertion_Pass(CellType &Cell, ss_vect<T> &X) {
             Drift(LN, X);
           else
             Drift(LN/2.0, X);
-        } // for 
+        } // for  
         break;
       case Meth_Fourth: /* 4-th order integrator */
         L1 = c_1 * LN;
@@ -1823,9 +1817,10 @@ void Insertion_Pass(CellType &Cell, ss_vect<T> &X) {
 
 //        Drift(L1, X);
         for (i = 1; i <= Nslice; i++) {
+
           Drift(L1, X);
           // First order kick map
-          if (elemp->ID->firstorder && elemp->ID->scaling1 != 0.0) {
+          if (elemp->ID->firstorder) {
             if (!elemp->ID->linear) {
                 //cout << "InsertionPass: Spline\n";
                 SplineInterpolation2(X[x_], X[y_], tx1, tz1, Cell, outoftable,
@@ -1843,8 +1838,9 @@ void Insertion_Pass(CellType &Cell, ss_vect<T> &X) {
             X[px_] += K1*d * tx1;
             X[py_] += K1*d * tz1;
         }
+
           // Second order kick map
-          if (elemp->ID->secondorder && elemp->ID->scaling2 != 0.0) {
+          if (elemp->ID->secondorder) {
             if (!elemp->ID->linear) {
                 //cout << "InsertionPass: Spline\n";
                 SplineInterpolation2(X[x_], X[y_], tx2, tz2, Cell, outoftable,
@@ -1866,7 +1862,7 @@ void Insertion_Pass(CellType &Cell, ss_vect<T> &X) {
           Drift(L2, X);
 
           // First order kick map
-          if (elemp->ID->firstorder && elemp->ID->scaling1 != 0.0) {
+          if (elemp->ID->firstorder) {
             if (!elemp->ID->linear) {
                 //cout << "InsertionPass: Spline\n";
                 SplineInterpolation2(X[x_], X[y_], tx1, tz1, Cell, outoftable,
@@ -1886,7 +1882,7 @@ void Insertion_Pass(CellType &Cell, ss_vect<T> &X) {
         }
 
           // Second order kick map
-          if (elemp->ID->secondorder && elemp->ID->scaling2 != 0.0) {
+          if (elemp->ID->secondorder) {
             if (!elemp->ID->linear) {
                 //cout << "InsertionPass: Spline\n";
                 SplineInterpolation2(X[x_], X[y_], tx2, tz2, Cell, outoftable,
@@ -1908,7 +1904,7 @@ void Insertion_Pass(CellType &Cell, ss_vect<T> &X) {
           Drift(L2, X);
 
           // First order kick map
-          if (elemp->ID->firstorder && elemp->ID->scaling1 != 0.0) {
+          if (elemp->ID->firstorder) {
             if (!elemp->ID->linear) {
                 //cout << "InsertionPass: Spline\n";
                 SplineInterpolation2(X[x_], X[y_], tx1, tz1, Cell, outoftable,
@@ -1928,7 +1924,7 @@ void Insertion_Pass(CellType &Cell, ss_vect<T> &X) {
         }
 
           // Second order kick map
-          if (elemp->ID->secondorder && elemp->ID->scaling2 != 0.0){
+          if (elemp->ID->secondorder) {
             if (!elemp->ID->linear) {
                 //cout << "InsertionPass: Spline\n";
                 SplineInterpolation2(X[x_], X[y_], tx2, tz2, Cell, outoftable,
@@ -1955,7 +1951,6 @@ void Insertion_Pass(CellType &Cell, ss_vect<T> &X) {
         } // for
 
     } // switch
-		} // if
   //CopyVec(6L, X, Cell->BeamPos);
 
   /* Local -> Global */
-- 
GitLab