Index: trunk/SophyaPI/PIext/nomhistadapter.cc
===================================================================
--- trunk/SophyaPI/PIext/nomhistadapter.cc	(revision 1054)
+++ trunk/SophyaPI/PIext/nomhistadapter.cc	(revision 1057)
@@ -39,6 +39,9 @@
 {
 HProf * hp = dynamic_cast<HProf *>(mHis);
-if (hp == NULL)   return( new Histo(*mHis) );
-else return( new HProf(*hp) );
+if (hp == NULL) return( new Histo(*mHis) );
+// C'est un HProf, il faut l'updater si on le copie
+//   car seule la partie "Histo" est copiee!
+if( !(hp->IsOk()) ) hp->UpdateHisto();
+return( new HProf(*hp) );
 }
 
Index: trunk/SophyaPI/PIext/pawexecut.cc
===================================================================
--- trunk/SophyaPI/PIext/pawexecut.cc	(revision 1054)
+++ trunk/SophyaPI/PIext/pawexecut.cc	(revision 1057)
@@ -58,23 +58,23 @@
 
 kw = "h/integ";
-usage = "Integrate a 1D histogram or profile";
+usage = "Integrate a 1D histogram";
 usage += "\n h/integ nameh1d [norm]";
-usage += "\n  Related commands: h/deriv";  
+usage += "\n  Related commands: h/deriv";
 piac->RegisterCommand(kw,usage,this,hgrp);
 
 kw = "h/deriv";
-usage = "Derivate a 1D histogram or profile";
+usage = "Derivate a 1D histogram";
 usage += "\n h/deriv nameh1d";
-usage += "\n  Related commands: h/integ";  
+usage += "\n  Related commands: h/integ";
 piac->RegisterCommand(kw,usage,this,hgrp);
 
 kw = "h/rebin";
 usage = "Rebin a 1D histogram or profile";
-usage += "\n h/rebin nbin";
+usage += "\n h/rebin nameh1d nbin";
 piac->RegisterCommand(kw,usage,this,hgrp);
 
 kw = "h/cadd";
 usage = "Add a constant to an histogram";
-usage += "\n h/cadd val";
+usage += "\n h/cadd namehisto val";
 usage += "\n  Related commands: h/cmult h/oper";  
 piac->RegisterCommand(kw,usage,this,hgrp);
@@ -82,5 +82,5 @@
 kw = "h/cmult";
 usage = "Multiply an histogram by a constant";
-usage += "\n h/cmult val";
+usage += "\n h/cmult namehisto val";
 usage += "\n  Related commands: h/cadd h/oper";  
 piac->RegisterCommand(kw,usage,this,hgrp);
@@ -285,10 +285,11 @@
 double norm = 1.;
 if(tokens.size()>=2) norm = atof(tokens[1].c_str());
+// attention: dynamic_cast<Histo*>(HProf)=Vrai!
 Histo* h1 = dynamic_cast<Histo*>(mobj);
-// Le HProf se fait tout seul avec Histo: dynamic_cast<Histo*>(HProf)=Vrai!
-//HProf* hp = dynamic_cast<HProf*>(mobj);
-if(h1)      h1->HInteg(norm);
-//else if(hp) hp->HInteg(norm);
-else cout<<"PAWExecutor::h_integ Error: "<<tokens[0]<<" not an Histo/HProf"<<endl;
+HProf* hp = dynamic_cast<HProf*>(mobj);
+if(hp || !h1)
+  {cout<<"PAWExecutor::h_integ Error: "<<tokens[0]<<" not an Histo"<<endl;
+  return;}
+h1->HInteg(norm);
 }
 
@@ -304,9 +305,11 @@
   {cout<<"PAWExecutor::h_deriv Error: unknow object"<<tokens[0]<<endl;
   return;}
+// attention: dynamic_cast<Histo*>(HProf)=Vrai!
 Histo* h1 = dynamic_cast<Histo*>(mobj);
-//HProf* hp = dynamic_cast<HProf*>(mobj);
-if(h1)      h1->HDeriv();
-//else if(hp) hp->HDeriv();
-else cout<<"PAWExecutor::h_deriv Error: "<<tokens[0]<<" not an Histo/HProf"<<endl;
+HProf* hp = dynamic_cast<HProf*>(mobj);
+if(hp || !h1)
+  {cout<<"PAWExecutor::h_deriv Error: "<<tokens[0]<<" not an Histo"<<endl;
+  return;}
+h1->HDeriv();
 }
 
@@ -324,8 +327,9 @@
 int nbin = atoi(tokens[1].c_str());
 Histo* h1 = dynamic_cast<Histo*>(mobj);
-//HProf* hp = dynamic_cast<HProf*>(mobj);
-if(h1)      h1->HRebin(nbin);
-//else if(hp) hp->HRebin(nbin);
-else cout<<"PAWExecutor::h_rebin Error: "<<tokens[0]<<" not an Histo/HProf"<<endl;
+HProf* hp = dynamic_cast<HProf*>(mobj);
+if(hp || !h1)
+  {cout<<"PAWExecutor::h_rebin Error: "<<tokens[0]<<" not an Histo"<<endl;
+  return;}
+h1->HRebin(nbin);
 }
 
@@ -343,8 +347,9 @@
 double val = atof(tokens[1].c_str());
 Histo*   h1 = dynamic_cast<Histo*>(mobj);
+HProf*   hp = dynamic_cast<HProf*>(mobj);
 Histo2D* h2 = dynamic_cast<Histo2D*>(mobj);
-if(h1)      *h1 += val;
-else if(h2) *h2 += val;
-else cout<<"PAWExecutor::h_cadd Error: "<<tokens[0]<<" not an Histo/HProf/Histo2D"<<endl;
+if(h1 && !hp) *h1 += val;
+else if(h2)   *h2 += val;
+else cout<<"PAWExecutor::h_cadd Error: "<<tokens[0]<<" not an Histo/Histo2D"<<endl;
 }
 
@@ -362,9 +367,10 @@
 double val = atof(tokens[1].c_str());
 Histo*   h1 = dynamic_cast<Histo*>(mobj);
+HProf*   hp = dynamic_cast<HProf*>(mobj);
 Histo2D* h2 = dynamic_cast<Histo2D*>(mobj);
-if(h1)      *h1 *= val;
-else if(h2) *h2 *= val;
+if(h1 && !hp) *h1 *= val;
+else if(h2)   *h2 *= val;
 else cout<<"PAWExecutor::h_cmult Error: "<<tokens[0]
-         <<" not an Histo/HProf/Histo2D"<<endl;
+         <<" not an Histo/Histo2D"<<endl;
 }
 
@@ -376,6 +382,4 @@
 // hres = h1 @ h2    with @ = (+,-,*,/)
 {
-cout<<"*** WARNING *** Not Tested, Do Not Use (cmv) !"<<endl;
-cerr<<"*** WARNING *** Not Tested, Do Not Use (cmv) !"<<endl;
 if(tokens.size()<4)
   {cout<<"Usage: n/oper @ h1 h2 hres with @=(+,-,*,/)"<<endl;
@@ -406,5 +410,5 @@
           <<" not implemented for HProf"<<endl; return;}
   if( dynamic_cast<HProf*>(mobjh2) == NULL )
-    {cout<<"PAWExecutor::h_oper Error: type mismatch between h1 and h2 "
+    {cout<<"PAWExecutor::h_oper Error: type mismatch between h1 and h2\n"
          <<typeid(*mobjh1).name()<<" , "<<typeid(*mobjh2).name()<<endl;
     return;}
@@ -420,5 +424,5 @@
     h3 = dynamic_cast<HProf*>(mobjh3);
     if(h3 == NULL)  // ce n'est pas un HProf
-      {cout<<"PAWExecutor::h_oper Error: type mismatch between h1 and h3 "
+      {cout<<"PAWExecutor::h_oper Error: type mismatch between h1 and h3\n"
            <<typeid(*mobjh1).name()<<" , "<<typeid(*mobjh3).name()<<endl;
       return;}
@@ -426,5 +430,4 @@
       {cout<<"PAWExecutor::h_oper Error: size mismatch between h1, h3 "
            <<h1->NBins()<<" "<<h3->NBins()<<endl; return;}
-    h3->Zero();
     *h3 = *h1 + *h2;
     h3->UpdateHisto();
@@ -434,5 +437,5 @@
 } else if( dynamic_cast<Histo*>(mobjh1) != NULL ) {
   if( dynamic_cast<Histo*>(mobjh2) == NULL )
-    {cout<<"PAWExecutor::h_oper Error: type mismatch between h1 and h2 "
+    {cout<<"PAWExecutor::h_oper Error: type mismatch between h1 and h2\n"
          <<typeid(*mobjh1).name()<<" , "<<typeid(*mobjh2).name()<<endl;
     return;}
@@ -448,5 +451,5 @@
     h3 = dynamic_cast<Histo*>(mobjh3);
     if(h3 == NULL)  // ce n'est pas un Histo
-      {cout<<"PAWExecutor::h_oper Error: type mismatch between h1 and h3 "
+      {cout<<"PAWExecutor::h_oper Error: type mismatch between h1 and h3\n"
            <<typeid(*mobjh1).name()<<" , "<<typeid(*mobjh3).name()<<endl;
       return;}
@@ -454,5 +457,4 @@
       {cout<<"PAWExecutor::h_oper Error: size mismatch between h1, h3 "
            <<h1->NBins()<<" "<<h3->NBins()<<endl; return;}
-    h3->Zero();
     if( oper[0]=='+')      *h3 = *h1 + *h2;
     else if( oper[0]=='-') *h3 = *h1 - *h2;
@@ -464,5 +466,5 @@
 } else if( dynamic_cast<Histo2D*>(mobjh1) != NULL ) {
   if( dynamic_cast<Histo2D*>(mobjh2) == NULL )
-    {cout<<"PAWExecutor::h_oper Error: type mismatch between h1 and h2 "
+    {cout<<"PAWExecutor::h_oper Error: type mismatch between h1 and h2\n"
          <<typeid(*mobjh1).name()<<" , "<<typeid(*mobjh2).name()<<endl;
     return;}
@@ -479,5 +481,5 @@
     h3 = dynamic_cast<Histo2D*>(mobjh3);
     if(h3 == NULL)  // ce n'est pas un Histo2D
-      {cout<<"PAWExecutor::h_oper Error: type mismatch between h1 and h3 "
+      {cout<<"PAWExecutor::h_oper Error: type mismatch between h1 and h3\n"
            <<typeid(*mobjh1).name()<<" , "<<typeid(*mobjh3).name()<<endl;
       return;}
@@ -486,5 +488,4 @@
            <<h1->NBinX()<<","<<h1->NBinY()<<"   "
            <<h3->NBinX()<<","<<h3->NBinY()<<endl; return;}
-    h3->Zero();
     if( oper[0]=='+')      *h3 = *h1 + *h2;
     else if( oper[0]=='-') *h3 = *h1 - *h2;
@@ -495,5 +496,6 @@
 // Doesn't work for other objects
 } else {
-  cout<<"PAWExecutor::h_oper Error: not implemented for "<<typeid(*mobjh1).name()<<endl;
+  cout<<"PAWExecutor::h_oper Error: not implemented for "
+      <<typeid(*mobjh1).name()<<endl;
   return;
 }
Index: trunk/SophyaPI/PIext/pihisto.cc
===================================================================
--- trunk/SophyaPI/PIext/pihisto.cc	(revision 1054)
+++ trunk/SophyaPI/PIext/pihisto.cc	(revision 1057)
@@ -76,10 +76,12 @@
   if (!mHisto)  return;  
 
-  if (mMrk != PI_NotDefMarker ||  ( typeid(*mHisto) == typeid(HProf) ) )  {
-    // Marqeurs definis OU HBProf => marqueurs+Erreurs si il y en a
-    if (mLAtt == PI_NotDefLineAtt) g->SelLine(PI_ThinLine);
+  if(mMrk != PI_NotDefMarker ||  (typeid(*mHisto) == typeid(HProf)) ) {
+    // Marqeurs definis OU HProf => marqueurs+Erreurs si il y en a
+    if(typeid(*mHisto) == typeid(HProf))
+      { HProf* hp = (HProf*) mHisto; if(!(hp->IsOk())) hp->UpdateHisto();}
+    if(mLAtt == PI_NotDefLineAtt) g->SelLine(PI_ThinLine);
     double x1,y1, x2,y2;
     double bw = mHisto->BinWidth();
-    for (int i=0; i<mHisto->NBins(); i++) {
+    for(int i=0; i<mHisto->NBins(); i++) {
       if(mHisto->Error(i)>0.) {
         // barres d'erreur verticales
@@ -100,9 +102,9 @@
     oktrace = true;
   }
-  if (mLAtt != PI_NotDefLineAtt) {
+  if(mLAtt != PI_NotDefLineAtt) {
     double x1,y1, x2, y2;
     x1 = mHisto->BinLowEdge(0);
     y1 = 0;
-    for (int i=0; i<mHisto->NBins(); i++) {
+    for(int i=0; i<mHisto->NBins(); i++) {
       x2 = x1;
       y2 = (*mHisto)(i);
@@ -127,5 +129,5 @@
   }
   // A faire a la fin - DrawStats change l'attribut de ligne 
-  if (stats) DrawStats(g);
+  if(stats) DrawStats(g);
 }
 
Index: trunk/SophyaPI/PIext/servnobjm.cc
===================================================================
--- trunk/SophyaPI/PIext/servnobjm.cc	(revision 1054)
+++ trunk/SophyaPI/PIext/servnobjm.cc	(revision 1057)
@@ -591,5 +591,5 @@
   mOmg->AddObj(hprof, nomprof);
   }
-hprof->UpdateHisto();
+if(!(hprof->IsOk())) hprof->UpdateHisto();
 
 mOmg->DisplayObj(nomprof, dopt);
