Index: trunk/FACT++/src/calcsource.cc
===================================================================
--- trunk/FACT++/src/calcsource.cc	(revision 19191)
+++ trunk/FACT++/src/calcsource.cc	(revision 19193)
@@ -228,44 +228,56 @@
     }
 
-    if (!has_radec)
-    {
-        const string query =
-            "SELECT `"+tab_source+"`.fRightAscension, `"+tab_source+"`.fDeclination, `"+tab_source+"`.fSourceName"
-            " FROM `"+tab_runinfo+"`"+
-            " LEFT JOIN `"+tab_source+"`"+
-            " USING (fSourceKey)"
-            " WHERE fNight=20"+to_string(file/1000)+
-            " AND fRunID="+to_string(file%1000);
-
-        if (print_meta)
-            cout << query << endl;
-
-        try
-        {
-            const mysqlpp::StoreQueryResult res =
-                connection.query(query).store();
-
-            if (res.num_rows()!=1)
-            {
-                cerr << "No coordinates from " << tab_runinfo << " for " << file << endl;
-                return 2;
-            }
-
-            source_ra  = res[0][0];
-            source_dec = res[0][1];
-
-            if (verbose>0)
-                cout << "Using coordinates " << source_ra << "h / " << source_dec << " deg for '" << res[0][2] << "'" << endl;
-        }
-        catch (const exception &e)
-        {
-            cerr << query << "\n";
-            cerr << "SQL query failed:\n" << e.what() << endl;
-            return 3;
-        }
-    }
-    else
+    double point_ra  = 0;
+    double point_dec = 0;
+
+    const string query =
+        "SELECT "
+        " `"+tab_runinfo+"`.fRightAscension, `"+tab_runinfo+"`.fDeclination, "
+        " `"+tab_source+"`.fRightAscension, `"+tab_source+"`.fDeclination, "
+        " `"+tab_source+"`.fSourceName"
+        " FROM `"+tab_runinfo+"`"+
+        " LEFT JOIN `"+tab_source+"`"+
+        " USING (fSourceKey)"
+        " WHERE fNight=20"+to_string(file/1000)+
+        " AND fRunID="+to_string(file%1000);
+
+    if (print_meta)
+        cout << query << endl;
+
+    try
+    {
+        const mysqlpp::StoreQueryResult res =
+            connection.query(query).store();
+
+        if (res.num_rows()!=1)
+        {
+            cerr << "No coordinates from " << tab_runinfo << " for " << file << endl;
+            return 2;
+        }
+
+        point_ra  = res[0][0];
+        point_dec = res[0][1];
+
+        if (!has_radec)
+        {
+            source_ra  = res[0][2];
+            source_dec = res[0][3];
+        }
+
         if (verbose>0)
-            cout << "Using coordinates " << source_ra << "h / " << source_dec << " deg from resources." << endl;
+        {
+            cout << "Using coordinates " << source_ra << "h / " << source_dec << " deg ";
+            if (has_radec)
+                cout << "for '" << res[0][4] << "'" << endl;
+            else
+                cout << "from resources." << endl;
+        }
+    }
+    catch (const exception &e)
+    {
+        cerr << query << "\n";
+        cerr << "SQL query failed:\n" << e.what() << endl;
+        return 3;
+    }
 
 /*
@@ -297,26 +309,29 @@
     }
 
-    const string query =
-        "SELECT `Ra`, `Dec`, MJD, MilliSec, NanoSec, Zd, Az, EvtNumber"
+    const string query1 =
+        "SELECT EvtNumber, MJD, MilliSec"
         " FROM `"+tab_events+"`"
         " WHERE FileId="+to_string(file);
 
     if (print_meta)
-        cout << query << endl;
+        cout << query1 << endl;
 
     const mysqlpp::UseQueryResult res1 =
-        connection.query(query).use();
-
-    Nova::RaDecPosn source(source_ra, source_dec);
-
-    source_ra  *= M_PI/12;
-    source_dec *= M_PI/180;
-
-    auto obs = Nova::kORM;
-
-    obs.lng *= M_PI/180;
-    obs.lat *= M_PI/180;
-
-    //const double mm2deg = 1.17193246260285378e-02;
+        connection.query(query1).use();
+
+    const Nova::RaDecPosn source(source_ra, source_dec);
+
+    //source_ra  *= M_PI/12;
+    //source_dec *= M_PI/180;
+
+    const Nova::RaDecPosn point(point_ra, point_dec);
+
+    //point_ra  *= M_PI/12;
+    //point_dec *= M_PI/180;
+
+    //const auto obs = Nova::kORM;
+
+    //obs.lng *= M_PI/180;
+    //obs.lat *= M_PI/180;
 
     ostringstream ins;
@@ -328,17 +343,7 @@
         count++;
 
-        double   point_ra  = row[0];
-        double   point_dec = row[1];
-        uint32_t mjd       = row[2];
-        int64_t  millisec  = row[3];
-        //uint32_t nanosec   = row[4];
-        //double   zd        = row[5];
-        //double   az        = row[6];
-        uint32_t event     = row[7];
-
-        Nova::RaDecPosn point(point_ra, point_dec);
-
-        point_ra  *= M_PI/12;
-        point_dec *= M_PI/180;
+        const uint32_t event     = row[0];
+        const uint32_t mjd       = row[1];
+        const int64_t  millisec  = row[2];
 
         /*
