Index: trunk/SophyaPI/PIext/servnobjm.cc
===================================================================
--- trunk/SophyaPI/PIext/servnobjm.cc	(revision 2322)
+++ trunk/SophyaPI/PIext/servnobjm.cc	(revision 2419)
@@ -909,20 +909,20 @@
 mImgapp->RedirectStdOutErr(false);
 
-int k1,k2,dk;
+int_8 k1,k2,dk;
 k1 = 0;  k2 = objnt->NbLines();  dk = 1;
 DecodeLoopParameters(loop, k1, k2, dk);
 if (k1 < 0) k1 = 0;
 if (k2 < 0) k2 = objnt->NbLines();
-if (k2 > (int_4)objnt->NbLines()) k2 = objnt->NbLines();
+if (k2 > (int_8)objnt->NbLines()) k2 = objnt->NbLines();
 if (dk <= 0) dk = 1;
 
 try  {
   double* xn;
-  int kmax = k2;
-  for(k=k1; k<kmax; k+=dk)    {
+  int_8 kstart = k1, kend = k2;
+  for(k=kstart; k<kend; k+=dk)    {
     xn = objnt->GetLineD(k);
-    if (f(xn, xnt, xnt+1, xnt+2, xnt+3, k, kmax) != 0) {
+    if (f((int_8_exprf)k, xn, xnt, xnt+1, xnt+2, xnt+3, (int_8_exprf)kstart,(int_8_exprf) kend) != 0) {
       if (nt) { 
-         for(i=0; i<4; i++) fxnt[i] = xnt[i]; 
+         for(int i=0; i<4; i++) fxnt[i] = xnt[i]; 
          nt->Fill(fxnt);
          }
@@ -989,7 +989,7 @@
 
 fputs("/* ------ Compare bits on double --------- */ \n", fip);
-fputs("typedef long long int_8;\n", fip);
-fputs("int_8 BitCmp64(double v,int_8 flg)\n", fip);
-fputs("{return ((int_8)((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip);
+fputs("typedef long long int_8_exprf;\n", fip);
+fputs("int_8_exprf BitCmp64(double v,int_8_exprf flg)\n", fip);
+fputs("{return ((int_8_exprf)((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip);
 fputs("/* ------ Some random number generators --------- */ \n", fip);
 fputs("#if defined(__ppc__) && defined(__MACH__) \n",fip);
@@ -1011,9 +1011,10 @@
 fputs("#define gaurand() NorRand() \n\n", fip);
 
-fputs("/* NTupleInterface Variable declaration - Generated by piapp  \n", fip);
-fputs("      -- Services2NObjMgr::PrepareNTExpressionCFile()  --     */ \n\n", fip);
-fprintf(fip,"int %s(double* _xnti_, double* _rx_, double* _ry_, double* _rz_, \n", 
+fputs("/* NTupleInterface Variable declaration - Generated by piapp    */\n", fip);
+fputs("/*    -- Services2NObjMgr::PrepareNTExpressionCFile()  --       */ \n", fip);
+fputs("/* _nl line number or sequential index : _nstart <= _nl < _nend */ \n\n", fip);
+fprintf(fip,"int %s(int_8_exprf _nl, double* _xnti_, double* _rx_, double* _ry_, double* _rz_, \n", 
         funcname.c_str());
-fprintf(fip,"       double* _rt_, int _n_, int _nmax_) \n");
+fprintf(fip,"       double* _rt_, int_8_exprf _nstart, int_8_exprf _nend) \n");
 fprintf(fip, "{ \n %s \n", vardec.c_str());
 fputs("  if (!1) { /* Cut Expression failed */ \n", fip);
@@ -1178,12 +1179,12 @@
 float  fxnt[10];
 
-int i,k;
-for(i=0; i<10; i++) xnt[i] = 0.;
-int k1,k2,dk;
+int_8 k;
+for(k=0; k<10; k++) xnt[k] = 0.;
+int_8 k1,k2,dk;
 k1 = 0;  k2 = objnt->NbLines();  dk = 1;
 DecodeLoopParameters(loop, k1, k2, dk);
 if (k1 < 0) k1 = 0;
 if (k2 < 0) k2 = objnt->NbLines();
-if (k2 > (int_4)objnt->NbLines()) k2 = objnt->NbLines();
+if (k2 > (int_8)objnt->NbLines()) k2 = objnt->NbLines();
 if (dk <= 0) dk = 1;
 
@@ -1192,7 +1193,7 @@
   for(k=k1; k<k2; k += dk)    {
     xn = objnt->GetLineD(k);
-    if (f(xn, xnt, xnt+1, xnt+2, xnt+3) != 0) {
+    if (f((int_8_exprf)k,xn, xnt, xnt+1, xnt+2, xnt+3) != 0) {
       if (nt) { 
-         for(i=0; i<4; i++) fxnt[i] = xnt[i]; 
+         for(int i=0; i<4; i++) fxnt[i] = xnt[i]; 
          nt->Fill(fxnt);
          }
@@ -1251,7 +1252,7 @@
 
 fputs("/* ------ Compare bits on double --------- */ \n", fip);
-fputs("typedef long long int_8;\n", fip);
-fputs("int_8 BitCmp64(double v,int_8 flg)\n", fip);
-fputs("{return ((int_8)((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip);
+fputs("typedef long long int_8_exprf;\n", fip);
+fputs("int_8_exprf BitCmp64(double v,int_8_exprf flg)\n", fip);
+fputs("{return ((int_8_exprf)((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip);
 fputs("/* ------ Some random number generators --------- */ \n", fip);
 fputs("#if defined(__ppc__) && defined(__MACH__) \n",fip);
@@ -1273,5 +1274,5 @@
 fputs("#define gaurand() NorRand() \n\n", fip);
 
-fputs("int expf_pia_dl_func(double* _zz6qi_, double* _rx_6q_, double* _ry_6q_, double* _rz_6q_, double* _rt_6q_) \n{\n", fip);
+fputs("int expf_pia_dl_func(int_8_exprf _nl, double* _zz6qi_, double* _rx_6q_, double* _ry_6q_, double* _rz_6q_, double* _rt_6q_) \n{\n", fip);
 fprintf(fip,"%s \n", vardec.c_str());
 fprintf(fip, "if (!(%s)) { *_rx_6q_ = *_ry_6q_ = *_rz_6q_ = *_rt_6q_ = 0.;  return(0); } \n", cut.c_str());
@@ -1323,5 +1324,5 @@
 // Fonction static
 /* --Methode-- */
-void Services2NObjMgr::DecodeLoopParameters(string& loop, int& i1, int& i2, int& di)
+void Services2NObjMgr::DecodeLoopParameters(string& loop, int_8& i1, int_8& i2, int_8& di)
 {
 // Decode des paramatres de boucle for(int i=i1; i<i2; i+=di) specifies 
@@ -1331,13 +1332,13 @@
 if (l < 1) return;
 size_t p = loop.find(':');
-if (p >= l) { i1 = atoi(loop.c_str()); return; }
-i1 = atoi(loop.substr(0, p).c_str());
+if (p >= l) { i1 = atol(loop.c_str()); return; }
+i1 = atol(loop.substr(0, p).c_str());
 string aa = loop.substr(p+1);
 p = aa.find(':');
 if (p < aa.length() ) { 
-  i2 = atoi(aa.substr(0,p).c_str());
-  di = atoi(aa.substr(p+1).c_str());
-  }
-else i2 = atoi(aa.c_str());
+  i2 = atol(aa.substr(0,p).c_str());
+  di = atol(aa.substr(p+1).c_str());
+  }
+else i2 = atol(aa.c_str());
 // cout << "-> I1= " << i1 << " I2= " << i2 << " DI= " << di << endl; 
 return;
