4 #include <EyeEventHeader.hh>
5 #include <EyeEventFile.hh>
17 <<
" Specify: List of input files, also with \"*\" etc. as well as number of events in output files" << endl;
19 std::cout <<
"Usage: " << argv[0] <<
" <files> [n-events]" << std::endl << std::endl;
24 main (
int argc,
char *argv[])
31 const int nSplit = atoi(argv[argc-1]);
32 cout <<
"Your n-split is : " << nSplit << endl;
35 if (nSplit <= 0 || nSplit>1e7) {
40 ifstream filelist(argv[1]);
42 while (filelist.good()) {
45 getline(filelist, filename);
47 if (filename==
"" || filename[0] ==
'#')
51 const string nameOut = nameIn.substr(nameIn.rfind(
'/')+1, nameIn.length() - nameIn.rfind(
'/') - 6);
53 cout <<
"Reading file: " << nameIn <<
" writing to " << nameOut << endl;
57 TFile*
file = TFile::Open(nameIn.c_str());
58 TTree*
data = (TTree*) file->Get(
"EyeEventTree");
59 data->SetBranchAddress(
"EyeEvent", &event);
64 unsigned int iOut = 0;
65 unsigned int iOutFile = 0;
69 for (
int iEv=0; iEv<data->GetEntries(); ++iEv) {
73 TEyeEventHeader* header =
event->GetEventHeader();
75 cout <<
" Eye: " << header->GetEyeNo() <<
" ";
76 cout <<
" Event Id: " << header->GetEventNo() <<
" ";
77 cout <<
" sec: " << header->GetTimeStamp()->GetGPSSec();
80 if (((iOut++) % nSplit) == 0 || !out) {
86 name << nameOut <<
"_split" << (iOutFile++) <<
".root";
87 cout <<
"Opening new output file: " << name.str() << endl;
89 out = TFile::Open(name.str().c_str(),
"CREATE");
91 outTree =
new TTree(
"EyeEventTree",
"EventEvent tree");
92 outTree->SetDirectory(out);
93 outTree->Branch(
"EyeEvent", &event);
107 cout <<
" closing file " << endl;
vector< t2list > out
output of the algorithm: a list of clusters
int main(int argc, char *argv[])