From 5a7692c94a70725d776903ead8af79f9ba32000c Mon Sep 17 00:00:00 2001
From: deserevi <deserevi@nptool>
Date: Tue, 8 Mar 2011 15:21:40 +0000
Subject: [PATCH] * Fix performance problem    + itoa() function now uses
 sprintf instead of ostringstream

---
 NPLib/CATS/TCATSPhysics.cxx       |  9 +++------
 NPLib/MUST2/TMust2Physics.cxx     | 15 ++++++---------
 NPLib/Plastic/TPlasticPhysics.cxx | 15 ++++++---------
 NPLib/SSSD/TSSSDPhysics.cxx       |  9 +++------
 NPLib/W1/TW1Physics.cxx           |  8 +++-----
 5 files changed, 21 insertions(+), 35 deletions(-)

diff --git a/NPLib/CATS/TCATSPhysics.cxx b/NPLib/CATS/TCATSPhysics.cxx
index fcdf239d6..e5ab70bbe 100644
--- a/NPLib/CATS/TCATSPhysics.cxx
+++ b/NPLib/CATS/TCATSPhysics.cxx
@@ -1775,11 +1775,8 @@ namespace LOCAL_CATS
   //	tranform an integer to a string
   string itoa(int value)
   {
-    std::ostringstream o;
-    
-    if (!(o << value))
-      return ""	;
-    
-    return o.str();
+   char buffer [33];
+   sprintf(buffer,"%d",value);
+   return buffer;
   }
 }
diff --git a/NPLib/MUST2/TMust2Physics.cxx b/NPLib/MUST2/TMust2Physics.cxx
index a6b0ca16d..e844ad496 100644
--- a/NPLib/MUST2/TMust2Physics.cxx
+++ b/NPLib/MUST2/TMust2Physics.cxx
@@ -1402,15 +1402,12 @@ namespace MUST2_LOCAL
       
       //   tranform an integer to a string
       string itoa(int value)
-         {
-           std::ostringstream o;
-         
-           if (!(o << value))
-             return ""   ;
-             
-           return o.str();
-         }
-         
+      {
+         char buffer [33];
+         sprintf(buffer,"%d",value);
+         return buffer;
+      }
+
       //   DSSD
       //   X
       double fSi_X_E(const TMust2Data* m_EventData , const int i)
diff --git a/NPLib/Plastic/TPlasticPhysics.cxx b/NPLib/Plastic/TPlasticPhysics.cxx
index aea90e2ec..cfb5de961 100644
--- a/NPLib/Plastic/TPlasticPhysics.cxx
+++ b/NPLib/Plastic/TPlasticPhysics.cxx
@@ -37,15 +37,12 @@ using namespace std;
 #include "TChain.h"
 
 //   tranform an integer to a string
-      string itoa(int value)
-         {
-           std::ostringstream o;
-         
-           if (!(o << value))
-             return ""   ;
-             
-           return o.str();
-         }
+string itoa(int value)
+{
+   char buffer [33];
+   sprintf(buffer,"%d",value);
+   return buffer;
+}
 
 ClassImp(TPlasticPhysics)
 ///////////////////////////////////////////////////////////////////////////
diff --git a/NPLib/SSSD/TSSSDPhysics.cxx b/NPLib/SSSD/TSSSDPhysics.cxx
index af8b71ccb..2ff8e8ab5 100644
--- a/NPLib/SSSD/TSSSDPhysics.cxx
+++ b/NPLib/SSSD/TSSSDPhysics.cxx
@@ -38,12 +38,9 @@ using namespace SSSD_LOCAL;
 //  tranform an integer to a string
 string itoa(int value)
 {
-  std::ostringstream o;
-
-  if (!(o << value))
-    return ""  ;
-    
-  return o.str();
+   char buffer [33];
+   sprintf(buffer,"%d",value);
+   return buffer;
 }
 
 ClassImp(TSSSDPhysics)
diff --git a/NPLib/W1/TW1Physics.cxx b/NPLib/W1/TW1Physics.cxx
index 74df99781..e71b1d66b 100644
--- a/NPLib/W1/TW1Physics.cxx
+++ b/NPLib/W1/TW1Physics.cxx
@@ -40,11 +40,9 @@ using namespace LOCAL;
 //  tranform an integer to a string
 string itoa(int value)
 {
-   std::ostringstream o;
-      
-   if (!(o << value)) return "";
-
-   return o.str();
+   char buffer [33];
+   sprintf(buffer,"%d",value);
+   return buffer;
 }
 
 
-- 
GitLab