Index: trunk/SophyaPI/PIext/pawexecut.cc
===================================================================
--- trunk/SophyaPI/PIext/pawexecut.cc	(revision 1911)
+++ trunk/SophyaPI/PIext/pawexecut.cc	(revision 1912)
@@ -78,5 +78,13 @@
 usage = "Integrate a 1D histogram";
 usage += "\n h/integ nameh1d [norm]";
-usage += "\n  Related commands: h/deriv";
+usage += "\n norm<=0 means no normalisation (def norm=1)";
+usage += "\n  Related commands: h/deriv v/integ v/deriv";
+piac->RegisterCommand(kw,usage,this,hgrp);
+
+kw = "v/integ";
+usage = "Integrate a TVector";
+usage += "\n v/integ namevec [norm]";
+usage += "\n norm<=0 means no normalisation (def norm=0)";
+usage += "\n  Related commands: h/integ h/deriv v/deriv";
 piac->RegisterCommand(kw,usage,this,hgrp);
 
@@ -84,5 +92,14 @@
 usage = "Derivate a 1D histogram";
 usage += "\n h/deriv nameh1d";
-usage += "\n  Related commands: h/integ";
+usage += "\n  Related commands: h/integ v/integ v/deriv";
+piac->RegisterCommand(kw,usage,this,hgrp);
+
+kw = "v/deriv";
+usage = "Derivate a TVector";
+usage += "\n v/deriv namevec [deriv_option]";
+usage += "\n deriv_option -1 replace v[i] with v[i]-v[i-1]";
+usage += "\n               0 replace v[i] with (v[i+1]-v[i-1])/2 (default)";
+usage += "\n              +1 replace v[i] with v[i+1]-v[i]";
+usage += "\n  Related commands: h/integ h/deriv v/integ";
 piac->RegisterCommand(kw,usage,this,hgrp);
 
@@ -214,6 +231,10 @@
 } else if(kw == "h/integ") {
   h_integ(tokens); return(0);
+} else if(kw == "v/integ") {
+  v_integ(tokens); return(0);
 } else if(kw == "h/deriv") {
   h_deriv(tokens); return(0);
+} else if(kw == "v/deriv") {
+  v_deriv(tokens); return(0);
 } else if(kw == "h/rebin") {
   h_rebin(tokens); return(0);
@@ -551,4 +572,33 @@
 
 /* methode */
+void PAWExecutor::v_integ(vector<string>& tokens)
+// Pour remplacer le contenu d'un TVector<r_8> par son integrale
+//   normalisee a norm:
+// Si norm <= 0 : pas de normalisation, integration seule
+{
+if(tokens.size()<1)
+  {cout<<"Usage: v/integ namevec [norm]"<<endl; return;}
+NamedObjMgr omg;
+AnyDataObj* mobj = omg.GetObj(tokens[0]);
+if(mobj==NULL)
+  {cout<<"PAWExecutor::v_integ Error: unknow object"<<tokens[0]<<endl;
+  return;}
+r_8 norm=-1.;
+if(tokens.size()>=2) norm = atof(tokens[1].c_str());
+TVector<r_8>* v = dynamic_cast<TVector<r_8>*>(mobj);
+if(!v)
+  {cout<<"PAWExecutor::v_integ Error: "<<tokens[0]<<" not a TVector"<<endl;
+  return;}
+uint_4 n = v->Size();
+if(n<=0)
+  {cout<<"PAWExecutor::v_integ Error: "<<tokens[0]<<" is an empty vector"<<endl;
+  return;}
+if(n>1) for(uint_4 i=1;i<n;i++) (*v)(i)+=(*v)(i-1);
+if(norm<=0. || (*v)(n-1)==0.) return;
+norm /= (*v)(n-1);
+for(int_4 i=0;i<n;i++) (*v)(i) *= norm;
+}
+
+/* methode */
 void PAWExecutor::h_deriv(vector<string>& tokens)
 // Pour remplacer le contenu d'un histo 1D par sa derivee
@@ -568,4 +618,43 @@
   return;}
 h1->HDeriv();
+}
+
+/* methode */
+void PAWExecutor::v_deriv(vector<string>& tokens)
+// Pour remplacer le contenu d'un TVector<r_8> par sa derivee
+// deriv_option = -1 replace v[i] with v[i]-v[i-1]
+//              =  0 replace v[i] with (v[i+1]-v[i-1])/2 (default)
+//              = +1 replace v[i] with v[i+1]-v[i]
+{
+if(tokens.size()<1)
+  {cout<<"Usage: v/deriv namevec [deriv_option(-1,0,+1)]"<<endl; return;}
+NamedObjMgr omg;
+AnyDataObj* mobj = omg.GetObj(tokens[0]);
+if(mobj==NULL)
+  {cout<<"PAWExecutor::v_deriv Error: unknow object"<<tokens[0]<<endl;
+  return;}
+int_4 deriv_option = 0;
+if(tokens.size()>=2) deriv_option = atoi(tokens[1].c_str());
+TVector<r_8>* v = dynamic_cast<TVector<r_8>*>(mobj);
+if(!v)
+  {cout<<"PAWExecutor::v_deriv Error: "<<tokens[0]<<" not a TVector"<<endl;
+  return;}
+uint_4 n = v->Size();
+if(n<=0)
+  {cout<<"PAWExecutor::v_deriv Error: "<<tokens[0]<<" is an empty vector"<<endl;
+  return;}
+if(n<=1) return;
+TVector<r_8> vsave(*v,false);
+if(deriv_option<0) {
+  for(uint_4 i=1;i<n;i++) (*v)(i) = vsave(i)-vsave(i-1);
+  (*v)(0) = (*v)(1);
+} else if(deriv_option>0) {
+  for(uint_4 i=0;i<n-1;i++) (*v)(i) = vsave(i+1)-vsave(i);
+  (*v)(n-1) = (*v)(n-2);
+} else {
+  for(uint_4 i=1;i<n-1;i++) (*v)(i) = (vsave(i+1)-vsave(i-1))/2.;
+  (*v)(0)   = vsave(1)-vsave(0);
+  (*v)(n-1) = vsave(n-1)-vsave(n-2);
+}
 }
 
Index: trunk/SophyaPI/PIext/pawexecut.h
===================================================================
--- trunk/SophyaPI/PIext/pawexecut.h	(revision 1911)
+++ trunk/SophyaPI/PIext/pawexecut.h	(revision 1912)
@@ -25,5 +25,7 @@
   void  n_scan(vector<string>& tokens);
   void  h_integ(vector<string>& tokens);
+  void  v_integ(vector<string>& tokens);
   void  h_deriv(vector<string>& tokens);
+  void  v_deriv(vector<string>& tokens);
   void  h_rebin(vector<string>& tokens);
   void  h_cadd(vector<string>& tokens);
