Index: tags/asap-4.1.0/src/STMath.cpp
===================================================================
--- tags/asap-4.1.0/src/STMath.cpp	(revision 2654)
+++ tags/asap-4.1.0/src/STMath.cpp	(revision 2662)
@@ -388,7 +388,5 @@
       cycColOut.put(i, uInt(0));
     } else {
-      ostringstream oss;
-      oss << "For output row="<<i<<", all input rows of data are flagged. no averaging" << endl;
-      pushLog(String(oss));
+      os << "For output row="<<i<<", all input rows of data are flagged. no averaging" << LogIO::POST;
     }
     acc.reset();
@@ -1252,4 +1250,5 @@
                                           casa::Float tau )
 {
+  LogIO os( casa::LogOrigin( "STMath", "dosigref()"));
 if ( ! ref->conformant(*sig) ) {
     throw(AipsError("'sig' and 'ref' scantables are not conformant."));
@@ -1263,6 +1262,6 @@
     smref = smooth(ref, inkernel, fsmoothref );
     ostringstream oss;
-    oss<<"Applied smoothing of "<<fsmoothref<<" on the reference."<<endl;
-    pushLog(String(oss));
+    os <<"Applied smoothing of "<<fsmoothref<<" on the reference."
+       << LogIO::POST;
   }
   else {
@@ -1309,5 +1308,5 @@
         Float elev;
         refelevCol.get(i, elev);
-        oss << "user specified Tsys = " << tsysv;
+        os << "user specified Tsys = " << tsysv;
         // do recalc elevation if EL = 0
         if ( elev == 0 ) {
@@ -1320,6 +1319,5 @@
           }
         }
-        oss << ", corrected (for El) tsys= "<<tsysrefscalar;
-        pushLog(String(oss));
+        os << ", corrected (for El) tsys= "<<tsysrefscalar;
       }
       else {
@@ -1357,4 +1355,5 @@
 {
   setInsitu(false);
+  LogIO os( casa::LogOrigin( "STMath", "donod()"));
   STSelector sel;
   std::vector<int> scan1, scan2, beams, types;
@@ -1444,7 +1443,5 @@
 
   msg=String("Processing dototalpower for subset of the data");
-  ostringstream oss1;
-  oss1 << msg  << endl;
-  pushLog(String(oss1));
+  os << msg << LogIO::POST;
   // Debug for IRC CS data
   //float tcal1=7.0;
@@ -1459,7 +1456,5 @@
   // dosigref calibration
   msg=String("Processing dosigref for subset of the data");
-  ostringstream oss2;
-  oss2 << msg  << endl;
-  pushLog(String(oss2));
+  os << msg  << endl;
   calb1=dosigref(sig1,ref2,smoothref,tsysv,tau);
   calb2=dosigref(sig2,ref1,smoothref,tsysv,tau);
@@ -2161,4 +2156,5 @@
                                                const std::string& method)
 {
+  LogIO os( LogOrigin( "STMath", "gainElevation", WHERE ) ) ;
   // Get elevation data from Scantable and convert to degrees
   CountedPtr< Scantable > out = getScantable(in, false);
@@ -2203,8 +2199,6 @@
       throw(AipsError("There is no known gain-elevation polynomial known for this instrument"));
     }
-    ostringstream oss;
-    oss << "Making polynomial correction with " << msg << " coefficients:" << endl;
-    oss << "   " <<  coeff;
-    pushLog(String(oss));
+    os << "Making polynomial correction with " << msg << " coefficients:" << endl;
+    os << "   " <<  coeff << LogIO::POST;
     const uInt nrow = tab.nrow();
     Vector<Float> factor(nrow);
@@ -2217,5 +2211,5 @@
   } else {
     // Read and correct
-    pushLog("Making correction from ascii Table");
+    os << "Making correction from ascii Table" << LogIO::POST;
     scaleFromAsciiTable(tab, filename, method, x, true);
   }
@@ -2288,4 +2282,6 @@
                                              float jyperk )
 {
+  LogIO os( LogOrigin( "STMath", "convertFlux", WHERE ) ) ;
+
   CountedPtr< Scantable > out = getScantable(in, false);
   Table& tab = in->table();
@@ -2299,5 +2295,5 @@
 
   if ( fluxUnit == JY ) {
-    pushLog("Converting to K");
+    os << "Converting to K" << LogIO::POST;
     Quantum<Double> t(1.0,fluxUnit);
     Quantum<Double> t2 = t.get(JY);
@@ -2307,5 +2303,5 @@
     out->setFluxUnit("K");
   } else if ( fluxUnit == K ) {
-    pushLog("Converting to Jy");
+    os << "Converting to Jy" << LogIO::POST;
     Quantum<Double> t(1.0,fluxUnit);
     Quantum<Double> t2 = t.get(K);
@@ -2324,7 +2320,5 @@
     factor *= jyperk;
     if ( tokelvin ) factor = 1.0 / jyperk;
-    ostringstream oss;
-    oss << "Jy/K = " << jyperk;
-    pushLog(String(oss));
+    os << "Jy/K = " << jyperk << LogIO::POST;
     Vector<Float> factors(outtab.nrow(), factor);
     scaleByVector(outtab,factors, false);
@@ -2338,7 +2332,5 @@
     }
     jyperk = STAttr::findJyPerK(etaap, d);
-    ostringstream oss;
-    oss << "Jy/K = " << jyperk;
-    pushLog(String(oss));
+    os << "Jy/K = " << jyperk << LogIO::POST;
     factor *= jyperk;
     if ( tokelvin ) {
@@ -2354,5 +2346,5 @@
     // change per integration.
 
-    pushLog("Looking up conversion factors");
+    os <<"Looking up conversion factors" << LogIO::POST;
     convertBrightnessUnits(out, tokelvin, cfac);
   }
@@ -2547,5 +2539,4 @@
     if ( ! (*it)->conformant(*out) ) {
       // non conformant.
-      //pushLog(String("Warning: Can't merge scantables as header info differs."));
       LogIO os( LogOrigin( "STMath", "merge()", WHERE ) ) ;
       os << LogIO::SEVERE << "Can't merge scantables as header informations (any one of AntennaName, Equinox, and FluxUnit) differ." << LogIO::EXCEPTION ;
@@ -2746,4 +2737,5 @@
                                 const std::string & method)
 {
+  LogIO os( casa::LogOrigin("STMath", "frequencyAlign()", WHERE));
   // clone as this is not working insitu
   bool insitu = insitu_;
@@ -2784,8 +2776,6 @@
   MVTime mvt(refEpoch.getValue());
   String epochout = mvt.string(MVTime::YMD) + String(" (") + refEpoch.getRefString() + String(")");
-  ostringstream oss;
-  oss << "Aligned at reference Epoch " << epochout
-      << " in frame " << MFrequency::showType(system);
-  pushLog(String(oss));
+  os << "Aligned at reference Epoch " << epochout
+     << " in frame " << MFrequency::showType(system) << LogIO::POST;
   // set up the iterator
   Block<String> cols(4);
