// =====================================================================
//  $Id: findfast.cc,v 1.3 2003/10/06 04:03:39 goiwai Exp $
//  $Name: CLDAQ-1-14-03 $
//  $Log: findfast.cc,v $
//  Revision 1.3  2003/10/06 04:03:39  goiwai
//  TArgumentを使用するように全てのプログラムを修整しました.
//
//  Revision 1.2  2003/07/30 16:21:38  goiwai
//  ファイルにコミットログをつけることにしました.
//
// =====================================================================
#include "TDataRecord.hh"
#include "TInputObjectFile.hh"
#include "TBenchmark.hh"
#include "TArgument.hh"

int main( int argc, char** argv, char** envv )
{
  TArgument arg( argc, argv );
  if ( arg.GetNumberOfElements() != 1 || !isexist( arg[ 0 ] ) ) {
    arg.ShowUsage();
  }
  const Tstring filename = arg[ 0 ];

  TInputObjectFile ifile( filename );

  TDataRecord record;

  TBenchmark bench;
  bench.Start();
  Tint nelements = 0;
  while ( ( ifile.Read( record ) ) != 0 ) {
    //fast access section 0, segment 0, element 1.
    Tcout << record[0][0][0] << Tendl;
    nelements ++;
  }
  Tcout << nelements << " element(s) have been found out from ";
  Tcout << filename << "." << Tendl;
  bench.Stop();
  Tcout << bench << Tendl;

  return 0;
}
