Index: trunk/MagicSoft/Mars/datacenter/macros/createdataset.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/createdataset.C	(revision 7162)
+++ trunk/MagicSoft/Mars/datacenter/macros/createdataset.C	(revision 7164)
@@ -46,8 +46,10 @@
 
 int createdataset(Int_t dataset, TString source, TString wobble,
-                  TString startdate, TString stopdate,
+                  Bool_t cal=kFALSE,
+                  TString startdate="0000-00-00 00:00:00",
+                  TString stopdate="3000-00-00 00:00:00",
                   TString off="none",
-                  TString offstartdate="none",
-                  TString offstopdate="none")
+                  TString offstartdate="0000-00-00 00:00:00",
+                  TString offstopdate="3000-00-00 00:00:00")
 {
     TEnv env("sql.rc");
@@ -66,4 +68,5 @@
 
     TString fname(Form("/magic/datasets/%05d/dataset%08d.txt", dataset/1000, dataset));
+    TString fhtml="/home/operator/html";
     Bool_t exist=gSystem->AccessPathName(fname,kFileExists);
     if (exist==0)
@@ -72,13 +75,32 @@
         return 0;
     }
+
+    ofstream fouthtml(fhtml, ios::app);
+    fouthtml << "<tr><td>" << endl;
+    fouthtml << dataset << endl;
+    fouthtml << "</td><td>" << endl;
+    fouthtml << source << endl;
+    fouthtml << "</td><td>" << endl;
+    if (startdate=="0000-00-00 00:00:00")
+        fouthtml << "all" << endl;
+    else
+        fouthtml << "from " << startdate << " to " << stopdate << endl;
+    if (cal)
+        fouthtml << "only data processed to the imgpar is taken into account" << endl;
+    fouthtml << "</td></tr>" << endl;
+
     ofstream fout(fname, ios::app);
     cout << "writing to file " << fname << endl;
     fout << "AnalysisNumber: " << dataset << endl << endl;
 
-    TString query="Select fSequenceFirst from Sequences left join Source on ";
-    query +="Sequences.fSourceKEY=Source.fSourceKEY where fSourceName like '";
-    query +=Form("%s' and fRunStart between '%s' and '%s'",
+    TString query="Select Sequences.fSequenceFirst from Sequences left join Source on ";
+    query +="Sequences.fSourceKEY=Source.fSourceKEY ";
+    if (cal)
+        query +=" left join SequenceProcessStatus on Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst ";
+    query +=Form(" where fSourceName like '%s%%' and fRunStart between '%s' and '%s'",
                  source.Data(), startdate.Data(), stopdate.Data());
-    query +=" order by fSequenceFirst ";
+    if (cal)
+        query +=" and not IsNull(fStar) ";
+    query +=" order by Sequences.fSequenceFirst ";
 
     cout << "Q: " << query << endl;
@@ -112,9 +134,13 @@
 
     cout << "off: " << off << endl;
-    query  ="Select fSequenceFirst from Sequences left join Source on ";
-    query +=" Sequences.fSourceKEY=Source.fSourceKEY where fSourceName like '";
-    query +=Form("%s%%' and fRunStart between '%s' and '%s'",
-                 off.Data(), startdate.Data(), stopdate.Data());
-    query +=" order by fSequenceFirst ";
+    query  ="Select Sequences.fSequenceFirst from Sequences left join Source on ";
+    query +="Sequences.fSourceKEY=Source.fSourceKEY ";
+    if (cal)
+        query +=" left join SequenceProcessStatus on Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst ";
+    query +=Form("where fSourceName like '%s%%' and fRunStart between '%s' and '%s'",
+                 off.Data(), offstartdate.Data(), offstopdate.Data());
+    if (cal)
+        query +=" and not IsNull(fStar) ";
+    query +=" order by Sequences.fSequenceFirst ";
 
     cout << "Q: " << query << endl;
