15int main(
int argc,
char* argv[]){
18 cout <<
"please append txt file name" << endl;
19 cout <<
"usage: txt2root.exe filename [subratio]" << endl;
20 cout <<
"ex: txt2root.exe jpsi09_radBB.txt 5" << endl;
24 ratio = atoi(argv[2]);
27 TString str_txt_file(argv[1]);
28 TString str_root_file(str_txt_file);
29 str_root_file.ReplaceAll(
".txt",
".root");
30 TFile
f(str_root_file,
"recreate");
31 TTree *tree =
new TTree(
"track",
"track");
32 int run(0), event(0), index(0);
33 tree->Branch(
"run", &run,
"run/I");
34 tree->Branch(
"event", &event,
"event/I");
35 tree->Branch(
"index", &index,
"index/I");
37 ifstream in(str_txt_file);
39 cout <<
"cannot open " << str_txt_file << endl;
47 sscanf(str ,
"%d %d %d", &run, &event, &index);
48 if(
count%ratio != 0)
continue;
55 cout <<
"total events: " <<
count <<
" subratio: " << ratio << endl;
DOUBLE_PRECISION count[3]
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")