#include "utils.h"
#include "TestBoxConfig.h"
#include "TTMSummaryChain.h"
#include "TTMOptions.h"
#include <TROOT.h>
#include <TApplication.h>
#include <iostream.h>

static char const rcsid[] = "$Id: trendplots.C,v 1.3 2003/05/16 13:57:42 ttraffic Exp $";
static char const *rcsid_p = rcsid;   // Prevent g++ from optimizing out rcsid


#define NUMINTERVALS 4	 
char *progname;
int verbose = 0;

int main (int argc, char** argv) {

// get options

	TTMOptions options(argc, argv, "6vp:s:t:o:m:z:f:");

// Initialize ROOT system

	TROOT simple ("TTM", "Summaries");
	gROOT->SetBatch();                   // no graphics windows

	TApplication("delayStats", NULL, NULL, NULL, 0);

// now we can start ...

	TestBoxConfig config(options);

	int nent = config.GetNumEntries()    ; 
        uint max = config.GetMaxBoxId()     ;
        TestBox **tblist = config.GetTBList(); 
	int ntargets;
	TestBox **targets = tblist[0]->GetTargets(ntargets);

	if (options.Verbose()) {
	cout << nent << " boxes in config, MaxId = " << max <<
		" , first box: id " << tblist[0]->GetId() << " name: " <<
		tblist[0]->GetName() << " " << ntargets <<
		" targets, first target: id " << targets[0]->GetId() <<
		" name: " << targets[0]->GetName() << endl;
	}

	TTMSummaryChain summary;

	summary.SetConfig(options, config, NUMINTERVALS);
	summary.Chain();
	summary.PlotAll();

	return(0);
}
