17int main(
int argc,
char *argv[]){
19 cout <<
"please append two root files' names you want to compare " << endl;
20 cout <<
"realnewrun.exe new.root treename old.root treename [output.root]" << endl;
26 TTree *t1 = (TTree*)
f1.Get(argv[2]);
28 TTree *t2 = (TTree*)f2.Get(argv[4]);
29 TString str_output =
"output.root";
30 if(argc>5) str_output = argv[5];
31 TFile f3(str_output,
"recreate");
32 TTree *t3 =
new TTree(
"track",
"track");
34 t3->Branch(
"run", &newrun,
"run/I");
35 t3->Branch(
"event", &newevt,
"event/I");
38 t1->SetBranchAddress(
"run", &run);
39 t1->SetBranchAddress(
"event", &evt);
41 for(
int i=0; i<t1->GetEntries(); i++){
43 sprintf(str,
"run==%d && event==%d", run, evt);
44 if(t2->GetEntries(str)>0) cout <<
"str: " << str <<
" run: " << run <<
" event: " << evt << endl;