Index: /trunk/SophyaLib/HiStats/basedtable.cc
===================================================================
--- /trunk/SophyaLib/HiStats/basedtable.cc	(revision 2826)
+++ /trunk/SophyaLib/HiStats/basedtable.cc	(revision 2827)
@@ -44,6 +44,6 @@
     break;
   case DateField :
-    if (fgl) rs = "Date";
-    else rs = "Date";
+    if (fgl) rs = "DateTime";
+    else rs = "T";
     break;
   default:
@@ -156,4 +156,8 @@
   for(sa_size_t k=0; k<mDColsP.size(); k++) 
     mDColsP[k]->GetSegment(bid)[off] = data[mDColIdx[k]];
+  for(sa_size_t k=0; k<mYColsP.size(); k++) 
+    mYColsP[k]->GetSegment(bid)[off] = complex<r_4>(data[mYColIdx[k]],0.);
+  for(sa_size_t k=0; k<mZColsP.size(); k++) 
+    mZColsP[k]->GetSegment(bid)[off] = complex<r_8>(data[mZColIdx[k]],0.);
   for(sa_size_t k=0; k<mSColsP.size(); k++) 
     mSColsP[k]->GetSegment(bid)[off] = (string)MuTyV(data[mSColIdx[k]]);
@@ -190,4 +194,10 @@
   for(sa_size_t k=0; k<mDColsP.size(); k++) 
     mDColsP[k]->GetSegment(bid)[off] = (r_8)data[mDColIdx[k]];
+  for(sa_size_t k=0; k<mYColsP.size(); k++) 
+    mYColsP[k]->GetSegment(bid)[off] = 
+      complex<r_4>(data[mYColIdx[k]].GetRealPart(), data[mYColIdx[k]].GetImagPart());
+  for(sa_size_t k=0; k<mZColsP.size(); k++) 
+    mZColsP[k]->GetSegment(bid)[off] = 
+      complex<r_8>(data[mZColIdx[k]].GetRealPart(), data[mZColIdx[k]].GetImagPart());
 
   mNEnt++;
@@ -205,4 +215,8 @@
   for(sa_size_t k=0; k<mDColsP.size(); k++)     
     mDColsP[k]->Extend();
+  for(sa_size_t k=0; k<mYColsP.size(); k++) 
+    mYColsP[k]->Extend();
+  for(sa_size_t k=0; k<mZColsP.size(); k++) 
+    mZColsP[k]->Extend();
   for(sa_size_t k=0; k<mSColsP.size(); k++) 
     mSColsP[k]->Extend();
@@ -228,4 +242,8 @@
   for(sa_size_t k=0; k<mDColsP.size(); k++) 
     mVarMTV[mDColIdx[k]] = mDColsP[k]->GetCstSegment(bid)[off];
+  for(sa_size_t k=0; k<mYColsP.size(); k++) 
+    mVarMTV[mYColIdx[k]] = mYColsP[k]->GetCstSegment(bid)[off];
+  for(sa_size_t k=0; k<mZColsP.size(); k++) 
+    mVarMTV[mZColIdx[k]] = mZColsP[k]->GetCstSegment(bid)[off];
   for(sa_size_t k=0; k<mSColsP.size(); k++) 
     mVarMTV[mSColIdx[k]] = atof(mSColsP[k]->GetCstSegment(bid)[off].c_str());
@@ -336,4 +354,8 @@
   for(sa_size_t k=0; k<mDColsP.size(); k++) 
     mVarD[mDColIdx[k]] = mDColsP[k]->GetCstSegment(bid)[off];
+  for(sa_size_t k=0; k<mYColsP.size(); k++) 
+    mVarD[mYColIdx[k]] = mYColsP[k]->GetCstSegment(bid)[off].real();
+  for(sa_size_t k=0; k<mZColsP.size(); k++) 
+    mVarD[mZColIdx[k]] = mZColsP[k]->GetCstSegment(bid)[off].real();
   for(sa_size_t k=0; k<mSColsP.size(); k++) 
     mVarD[mSColIdx[k]] = atof(mSColsP[k]->GetCstSegment(bid)[off].c_str());
@@ -366,5 +388,12 @@
     break;
   case DoubleField :
-    rv = mDColsP[sk]->GetCstSegment(bid)[off];
+  case DateField :
+   rv = mDColsP[sk]->GetCstSegment(bid)[off];
+    break;
+  case ComplexField :
+    rv = mYColsP[sk]->GetCstSegment(bid)[off].real();
+    break;
+  case DoubleComplexField :
+    rv = mZColsP[sk]->GetCstSegment(bid)[off].real();
     break;
   case StringField :
@@ -407,4 +436,10 @@
     rv = mDColsP[sk]->GetCstSegment(bid)[off];
     break;
+  case ComplexField :
+    rv = mYColsP[sk]->GetCstSegment(bid)[off];
+    break;
+  case DoubleComplexField :
+    rv = mZColsP[sk]->GetCstSegment(bid)[off];
+    break;
   case StringField :
     rv = mSColsP[sk]->GetCstSegment(bid)[off];
@@ -482,4 +517,26 @@
 	if (sp[n] > max) max = sp[n];
 	if (sp[n] < min) min = sp[n];
+	cnt++;
+      }
+    }
+    break;
+  case ComplexField :
+    for(size_t is=0; is<mYColsP[sk]->NbSegments(); is++) {
+      const complex<r_4> * sp = mYColsP[sk]->GetCstSegment(is);
+      for(size_t n=0; n<mYColsP[sk]->SegmentSize(); n++) {
+	if (cnt >= NEntry())  break;
+	if (sp[n].real() > max) max = sp[n].real();
+	if (sp[n].real() < min) min = sp[n].real();
+	cnt++;
+      }
+    }
+    break;
+  case DoubleComplexField :
+    for(size_t is=0; is<mZColsP[sk]->NbSegments(); is++) {
+      const complex<r_8> * sp = mZColsP[sk]->GetCstSegment(is);
+      for(size_t n=0; n<mZColsP[sk]->SegmentSize(); n++) {
+	if (cnt >= NEntry())  break;
+	if (sp[n].real() > max) max = sp[n].real();
+	if (sp[n].real() < min) min = sp[n].real();
 	cnt++;
       }
@@ -583,4 +640,10 @@
       rv = mDColsP[sk]->GetCstSegment(bid)[off];
       break;
+    case ComplexField :
+      rv = mYColsP[sk]->GetCstSegment(bid)[off];
+      break;
+    case DoubleComplexField :
+      rv = mZColsP[sk]->GetCstSegment(bid)[off];
+      break;
     case StringField :
       rv = mSColsP[sk]->GetCstSegment(bid)[off];
Index: /trunk/SophyaLib/HiStats/basedtable.h
===================================================================
--- /trunk/SophyaLib/HiStats/basedtable.h	(revision 2826)
+++ /trunk/SophyaLib/HiStats/basedtable.h	(revision 2827)
@@ -12,4 +12,6 @@
 #include <string>
 #include <vector>
+
+#include <complex>
 
 #include "ntupintf.h"
@@ -62,4 +64,16 @@
   inline sa_size_t  AddDoubleColumn(string const & cnom) 
   { return AddColumn(DoubleField, cnom); }
+  //! Adds a column holding single precision complex values (complex<r_4>), named \b cnom
+  inline sa_size_t  AddComplexColumn(const char * cnom) 
+  { return AddColumn(ComplexField, cnom); }
+  //! Adds a column holding single precision complex values (complex<r_4>), named \b cnom
+  inline sa_size_t  AddComplexColumn(string const & cnom) 
+  { return AddColumn(ComplexField, cnom); }
+  //! Adds a column holding double precision complex values (complex<r_8>), named \b cnom
+  inline sa_size_t  AddDoubleComplexColumn(const char * cnom) 
+  { return AddColumn(DoubleComplexField, cnom); }
+  //! Adds a column holding double precision complex values (complex<r_8>), named \b cnom
+  inline sa_size_t  AddDoubleComplexColumn(string const & cnom) 
+  { return AddColumn(DoubleComplexField, cnom); }
   //! Adds a column holding character strings, named \b cnom
   inline sa_size_t  AddStringColumn(const char * cnom) 
@@ -199,4 +213,8 @@
   std::vector< SegDBInterface<r_8> * > mDColsP; 
   std::vector< sa_size_t > mDColIdx;
+  std::vector< SegDBInterface< complex<r_4> > * > mYColsP;
+  std::vector< sa_size_t > mYColIdx; 
+  std::vector< SegDBInterface< complex<r_8> > * > mZColsP; 
+  std::vector< sa_size_t > mZColIdx;
   std::vector< SegDBInterface<string> * > mSColsP; 
   std::vector< sa_size_t > mSColIdx;
Index: /trunk/SophyaLib/HiStats/datatable.cc
===================================================================
--- /trunk/SophyaLib/HiStats/datatable.cc	(revision 2826)
+++ /trunk/SophyaLib/HiStats/datatable.cc	(revision 2827)
@@ -81,4 +81,10 @@
       mDCols[sk].Share(a.mDCols[ska]); 
       break;
+    case ComplexField :
+      mYCols[sk].Share(a.mYCols[ska]); 
+      break;
+    case DoubleComplexField :
+      mZCols[sk].Share(a.mZCols[ska]); 
+      break;
     case StringField :
       mSCols[sk].Share(a.mSCols[ska]); 
@@ -112,4 +118,10 @@
     case DoubleField :
       mDCols[sk].Clone(a.mDCols[ska], true); 
+      break;
+    case ComplexField :
+      mYCols[sk].Clone(a.mYCols[ska], true); 
+      break;
+    case DoubleComplexField :
+      mZCols[sk].Clone(a.mZCols[ska], true); 
       break;
     case StringField :
@@ -142,4 +154,6 @@
   mFColsP.clear();
   mDColsP.clear();
+  mYColsP.clear();
+  mZColsP.clear();
   mSColsP.clear();
 
@@ -148,4 +162,6 @@
   mFColIdx.clear();
   mDColIdx.clear();
+  mYColIdx.clear();
+  mZColIdx.clear();
   mSColIdx.clear();
 
@@ -154,4 +170,6 @@
   mFCols.clear();
   mDCols.clear();
+  mYCols.clear();
+  mZCols.clear();
   mSCols.clear();
 }
@@ -203,4 +221,20 @@
       mDColsP[kk] = &(mDCols[kk]);
     break;
+  case ComplexField :
+    ser = mYCols.size();
+    mYCols.push_back(SegDataBlock< complex<r_4> >(mSegSz));
+    mYColIdx.push_back(idx);
+    mYColsP.push_back(NULL);
+    for(sa_size_t kk=0; kk<mYCols.size(); kk++)
+      mYColsP[kk] = &(mYCols[kk]);
+    break;
+  case DoubleComplexField :
+    ser = mZCols.size();
+    mZCols.push_back(SegDataBlock< complex<r_8> >(mSegSz));
+    mZColIdx.push_back(idx);
+    mZColsP.push_back(NULL);
+    for(sa_size_t kk=0; kk<mZCols.size(); kk++)
+      mZColsP[kk] = &(mZCols[kk]);
+    break;
   case StringField :
     ser = mDCols.size();
Index: /trunk/SophyaLib/HiStats/datatable.h
===================================================================
--- /trunk/SophyaLib/HiStats/datatable.h	(revision 2826)
+++ /trunk/SophyaLib/HiStats/datatable.h	(revision 2827)
@@ -47,4 +47,6 @@
   std::vector< SegDataBlock<r_4> > mFCols;
   std::vector< SegDataBlock<r_8> > mDCols; 
+  std::vector< SegDataBlock< complex<r_4> > > mYCols;
+  std::vector< SegDataBlock< complex<r_8> > > mZCols;
   std::vector< SegDataBlock<string> > mSCols;     
 }; 
Index: /trunk/SophyaLib/HiStats/fio_dtable.cc
===================================================================
--- /trunk/SophyaLib/HiStats/fio_dtable.cc	(revision 2826)
+++ /trunk/SophyaLib/HiStats/fio_dtable.cc	(revision 2827)
@@ -84,4 +84,10 @@
 	s << dt->mDCols[sk]; 
 	break;
+      case BaseDataTable::ComplexField :
+	s << dt->mYCols[sk]; 
+	break;
+      case BaseDataTable::DoubleComplexField :
+	s << dt->mZCols[sk]; 
+	break;
       case BaseDataTable::StringField :
 	s << dt->mSCols[sk]; 
@@ -109,4 +115,10 @@
       case BaseDataTable::DoubleField :
 	s.PutPosTagTable(swdt->mDCols[sk].GetSwapPosTagTable()); 
+	break;
+      case BaseDataTable::ComplexField :
+	s.PutPosTagTable(swdt->mYCols[sk].GetSwapPosTagTable()); 
+	break;
+      case BaseDataTable::DoubleComplexField :
+	s.PutPosTagTable(swdt->mZCols[sk].GetSwapPosTagTable()); 
 	break;
       case BaseDataTable::StringField :
@@ -206,4 +218,10 @@
 	s >> dt->mDCols[sk]; 
 	break;
+      case BaseDataTable::ComplexField :
+	s >> dt->mYCols[sk]; 
+	break;
+      case BaseDataTable::DoubleComplexField :
+	s >> dt->mZCols[sk]; 
+	break;
       case BaseDataTable::StringField :
 	s >> dt->mSCols[sk]; 
@@ -241,4 +259,14 @@
 	swdt->mDCols[sk] = SwSegDataBlock<r_8>(swdt->mDSwapper, swpos, swdt->SegmentSize());
 	break;
+      case BaseDataTable::ComplexField :
+	swpos.clear();
+	s.GetPosTagTable(swpos);
+	swdt->mYCols[sk] = SwSegDataBlock< complex<r_4> >(swdt->mYSwapper, swpos, swdt->SegmentSize());
+	break;
+      case BaseDataTable::DoubleComplexField :
+	swpos.clear();
+	s.GetPosTagTable(swpos);
+	swdt->mZCols[sk] = SwSegDataBlock< complex<r_8> >(swdt->mZSwapper, swpos, swdt->SegmentSize());
+	break;
       case BaseDataTable::StringField :
 	swpos.clear();
Index: /trunk/SophyaLib/HiStats/swppfdtable.cc
===================================================================
--- /trunk/SophyaLib/HiStats/swppfdtable.cc	(revision 2826)
+++ /trunk/SophyaLib/HiStats/swppfdtable.cc	(revision 2827)
@@ -74,5 +74,6 @@
   : BaseDataTable(segsz) ,
     mSwOut(&os), mSwIn(NULL),
-    mISwapper(os), mLSwapper(os), mFSwapper(os), mDSwapper(os), mSSwapper(os)
+    mISwapper(os), mLSwapper(os), mFSwapper(os), mDSwapper(os), 
+    mYSwapper(os), mZSwapper(os), mSSwapper(os)
 {
 }
@@ -89,4 +90,6 @@
   mFSwapper.SetInStream(*pis);
   mDSwapper.SetInStream(*pis);
+  mYSwapper.SetInStream(*pis);
+  mZSwapper.SetInStream(*pis);
   mDSwapper.SetInStream(*pis);
 }
@@ -119,4 +122,6 @@
   mFSwapper = a.mFSwapper;
   mDSwapper = a.mDSwapper;
+  mYSwapper = a.mYSwapper;
+  mZSwapper = a.mZSwapper;
   mSSwapper = a.mSSwapper;
   
@@ -160,4 +165,10 @@
       mDCols[sk] = a.mDCols[ska]; 
       break;
+    case ComplexField :
+      mYCols[sk] = a.mYCols[ska]; 
+      break;
+    case DoubleComplexField :
+      mZCols[sk] = a.mZCols[ska]; 
+      break;
     case StringField :
       mSCols[sk] = a.mSCols[ska]; 
@@ -186,4 +197,10 @@
     case DoubleField :
       mDCols[sk].SwapOutBuffer();
+      break;
+    case ComplexField :
+      mYCols[sk].SwapOutBuffer();
+      break;
+    case DoubleComplexField :
+      mZCols[sk].SwapOutBuffer();
       break;
     case StringField :
@@ -216,4 +233,6 @@
   mFColsP.clear();
   mDColsP.clear();
+  mYColsP.clear();
+  mZColsP.clear();
   mSColsP.clear();
 
@@ -222,4 +241,6 @@
   mFColIdx.clear();
   mDColIdx.clear();
+  mYColIdx.clear();
+  mZColIdx.clear();
   mSColIdx.clear();
 
@@ -228,4 +249,6 @@
   mFCols.clear();
   mDCols.clear();
+  mYCols.clear();
+  mZCols.clear();
   mSCols.clear();
 }
@@ -277,4 +300,20 @@
       mDColsP[kk] = &(mDCols[kk]);
     break;
+  case ComplexField :
+    ser = mYCols.size();
+    mYCols.push_back(SwSegDataBlock< complex<r_4> >(mYSwapper, mSegSz));
+    mYColIdx.push_back(idx);
+    mYColsP.push_back(NULL);
+    for(sa_size_t kk=0; kk<mYCols.size(); kk++)
+      mYColsP[kk] = &(mYCols[kk]);
+    break;
+  case DoubleComplexField :
+    ser = mZCols.size();
+    mZCols.push_back(SwSegDataBlock< complex<r_8> >(mZSwapper, mSegSz));
+    mZColIdx.push_back(idx);
+    mZColsP.push_back(NULL);
+    for(sa_size_t kk=0; kk<mZCols.size(); kk++)
+      mZColsP[kk] = &(mZCols[kk]);
+    break;
   case StringField :
     ser = mDCols.size();
Index: /trunk/SophyaLib/HiStats/swppfdtable.h
===================================================================
--- /trunk/SophyaLib/HiStats/swppfdtable.h	(revision 2826)
+++ /trunk/SophyaLib/HiStats/swppfdtable.h	(revision 2827)
@@ -56,4 +56,8 @@
   std::vector< SwSegDataBlock<r_8> > mDCols; 
   PPFDataSwapper<r_8> mDSwapper;
+  std::vector< SwSegDataBlock< complex<r_4> > > mYCols;
+  PPFDataSwapper< complex<r_4> > mYSwapper;
+  std::vector< SwSegDataBlock< complex<r_8> > > mZCols;
+  PPFDataSwapper< complex<r_8> > mZSwapper;
   std::vector< SwSegDataBlock<string> > mSCols;    
   PPFDataSwapper<string> mSSwapper;
