Index: trunk/FACT++/src/rootifysql.cc
===================================================================
--- trunk/FACT++/src/rootifysql.cc	(revision 18928)
+++ trunk/FACT++/src/rootifysql.cc	(revision 18929)
@@ -1,3 +1,5 @@
 #include "Database.h"
+
+#include <regex>
 
 #include "Time.h"
@@ -26,6 +28,8 @@
         ("compression,c", var<uint16_t>(1),            "zlib compression level for the root file")
         ("tree,t",        var<string>("Result"),       "Name of the root tree")
+        ("ignore",        vars<string>(),              "Ignore the given columns")
         ("display,d",     po_switch(),                 "Displays contents on the screen (most usefull in combination with mysql statements as SHOW or EXPLAIN)")
-        ("null,n",        po_switch(),                 "Redirect the output file to /dev/null")
+        ("null,n",        po_switch(),                 "Redirect the output file to /dev/null (mainly for debugging purposes, e.g. performance studies)")
+        ("no-fill",       po_switch(),                 "Do not fill events into the root file (mainly for debugging purposes, e.g. performance studies)")
         ("delimiter",     var<string>(""),             "The delimiter used if contents are displayed with --display (default=\\t)")
         ("verbose,v",     var<uint16_t>(1),            "Verbosity (0: quiet, 1: default, 2: more, 3, ...)")
@@ -64,6 +68,9 @@
         "filename is specified by the --file option or a query is given with --query.\n"
         "\n"
+        "As a trick, the rootify.sql file can be made excutable (chmod u+x rootify.sql). "
+        "If the first line contains '#!rootifysql', the script can be executed directly.\n"
+        "\n"
         "Comments in the query-file can be placed according to the SQL standard inline "
-        "/*comment*/ or on individual lines introduces with # or --.\n"
+        "/*comment*/ or introduced with # (shell script style) or -- (SQL style).\n"
         "\n"
         "In case of succes, 0 is returned, a value>0 otherwise.\n"
@@ -94,11 +101,13 @@
     const string   tree        = conf.Get<string>("tree");
     const bool     force       = conf.Get<bool>("force");
-    const bool     ignore      = conf.Get<bool>("ignore-null");
+    const bool     ignorenull  = conf.Get<bool>("ignore-null");
     const bool     update      = conf.Get<bool>("update");
     const bool     display     = conf.Get<bool>("display");
     const bool     noout       = conf.Get<bool>("null");
+    const bool     nofill      = conf.Get<bool>("no-fill");
     const uint16_t verbose     = conf.Get<uint16_t>("verbose");
     const uint16_t compression = conf.Get<uint16_t>("compression");
     const string   delimiter   = conf.Get<string>("delimiter");
+    const vector<string> ignore = conf.Vec<string>("ignore");
     // -------------------------------------------------------------------------
 
@@ -202,10 +211,14 @@
 
     vector<double>  buf(l.size());
-    vector<uint8_t> typ(l.size(),'n');
+    vector<uint8_t> typ(l.size(),'n'); // n=number [double], d is used for DateTime
 
     UInt_t cols = 0;
+
 
     // -------------------- Configure branches of TTree ------------------------
     TTree *ttree = new TTree(tree.c_str(), query.c_str());
+
+    size_t skipat  = 0;
+    size_t skipreg = 0;
     for (size_t i=0; i<l.size(); i++)
     {
@@ -227,5 +240,23 @@
                             typ[i] = 'C';
 
-        const bool use = typ[i]!='V' && typ[i]!='C';
+        bool found = false;
+        for (const auto &pattern: ignore)
+        {
+            if (regex_match(l[i], regex(pattern)))
+            {
+                found = true;
+                typ[i] = '-';
+                skipreg++;
+                break;
+            }
+        }
+
+        if (l[i][0]=='@')
+        {
+            typ[i] = '@';
+            skipat++;
+        }
+
+        const bool use = l[i][0]!='@' && typ[i]!='V' && typ[i]!='C' && !found;
 
         if (verbose>1)
@@ -243,5 +274,11 @@
         cout << endl;
     if (verbose>0)
+    {
+        if (skipreg)
+            cout << skipreg << " branches skipped due to ignore list." << endl;
+        if (skipat)
+            cout << skipat  << " branches skipped due to name starting with @." << endl;
         cout << "Configured " << cols << " branches.\nFilling branches..." << endl;
+    }
 
     if (display)
@@ -273,5 +310,5 @@
             }
 
-            if (!ignore && col->is_null())
+            if (!ignorenull && col->is_null())
             {
                 skip++;
@@ -295,4 +332,6 @@
             case 'V':
             case 'C':
+            case '-':
+            case '@':
                 break;
 
@@ -304,5 +343,7 @@
         if (idx==row.size())
         {
-            ttree->Fill();
+            if (!nofill)
+                ttree->Fill();
+
             if (display)
                 cout << sout.str() << endl;
@@ -310,4 +351,5 @@
 
         row = res.fetch_row();
+
 
     } while (row);
