Index: /trunk/FACT++/src/makeplots.cc
===================================================================
--- /trunk/FACT++/src/makeplots.cc	(revision 19425)
+++ /trunk/FACT++/src/makeplots.cc	(revision 19426)
@@ -53,4 +53,6 @@
         ("no-limits", po_switch(), "Switch off limits in plots")
         ("no-ToO", po_switch(), "Skip all sources marked as target-of-opportunity (ToO)")
+        ("where", var<string>(), "Define a where clause (it will be concatenate to the xisting ones with AND for source selection)")
+        ("print-query", po_switch(), "Print query for source selection")
         ;
 
@@ -129,7 +131,13 @@
 
     const string isToO = conf.Has("no-ToO") && conf.Get<bool>("no-ToO") ? " AND fIsToO=0" : "";
+    const string where = conf.Has("where") ? " AND ("+conf.Get<string>("where")+")" : "";
+
+    const string query = "SELECT fSourceName, fRightAscension, fDeclination FROM Source WHERE fSourceTypeKEY=1"+isToO+where;
+
+    if (conf.Get<bool>("print-query"))
+        cout << "\nQuery:\n" << query << "\n" << endl;
 
     const mysqlpp::StoreQueryResult res =
-        Database(fDatabase).query("SELECT fSourceName, fRightAscension, fDeclination FROM Source WHERE fSourceTypeKEY=1"+isToO).store();
+        Database(fDatabase).query(query).store();
 
     // ------------- Create canvases and frames ---------------------
