1 void Example_tagDB(
const Char_t * selection = NULL)
21 gBenchmark =
new TBenchmark();
22 gBenchmark->Start(
"total");
24 TSQLServer *db = TSQLServer::
25 Connect(
"mysql://duvall.star.bnl.gov/fcMDC3",
"",
"");
29 TStringLong query=
"SELECT CONCAT(path,'/',fName)
31 WHERE fName LIKE '%tags.root'
38 res = db->Query(query.Data());
39 Int_t nFiles = res->GetRowCount();
41 cout<<
"Selected "<<nFiles<<
" files from the tagDB"<<endl;
42 if (nFiles==0)
return;
45 gROOT->ProcessLine(
".O4");
50 while ((row = res->Next())) {
51 fileName=row->GetField(0);
52 fileName.ReplaceAll(
"/home/starreco/reco",
"/star/rcf/GC/tags");
56 cout<<
"Chained "<<nF<<
" files, Total events = "
57 <<chain->GetEntries()<<endl;
60 chain.Add(fileName.Data());
62 cout<<
"chained "<<chain->GetEntries()<<
" events from the tagDB"<<endl;
67 TObjArray *files = chain.GetListOfFiles();
68 cout<<
"chained "<<files->GetEntriesFast()<<
" files from the tagDB"<<endl;
72 TObjArray *branches = chain.GetListOfBranches();
73 TObjArray *leaves = chain.GetListOfLeaves();
74 Int_t nleaves = leaves->GetEntriesFast();
82 for (l=0;l<nleaves;l++) {
83 leaf = (TLeaf*)leaves->UncheckedAt(l);
84 branch = leaf->GetBranch();
85 cout<<
"StructureName: "<<branch->GetName()
86 <<
", tagName: "<<leaf->GetName()<<endl;
94 gBenchmark->Start(
"loop");
96 for (Int_t k=0;k<chain->GetEntries();k++) {
102 if (k == *(chain.GetTreeOffset()+chain.GetTreeNumber())) {
103 file = (files->UncheckedAt(chain.GetTreeNumber()))->GetTitle();
104 cout<<
"chain event "<< k
105 <<
", start of file "<< chain.GetTreeNumber()+1 <<endl;
109 leaf = chain.GetLeaf(
"NLa");
110 cout<<leaf->
GetName()<<
" = "<<leaf->GetValue()<<endl;
125 gBenchmark->Stop(
"loop");
126 gBenchmark->Print(
"loop");
127 gBenchmark->Stop(
"total");
128 gBenchmark->Print(
"total");
virtual const char * GetName() const
special overload