17 {
18 if(argc<5){
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;
21 return 1;
22 }
23
24
26 TTree *t1 = (TTree*)
f1.Get(argv[2]);
27 TFile f2(argv[3]);
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");
33 int newrun, newevt;
34 t3->Branch("run", &newrun, "run/I");
35 t3->Branch("event", &newevt, "event/I");
36
37 int run, evt;
38 t1->SetBranchAddress("run", &run);
39 t1->SetBranchAddress("event", &evt);
40 char str[255];
41 for(int i=0; i<t1->GetEntries(); i++){
42 t1->GetEntry(i);
43 sprintf(str,
"run==%d && event==%d", run, evt);
44 if(t2->GetEntries(str)>0) cout << "str: " << str << " run: " << run << " event: " << evt << endl;
45 else{
46 newrun = run;
47 newevt = evt;
48 t3->Fill();
49 }
50 }
51
53 f2.Close();
54 f3.cd();
55 t3->Write();
56 f3.Close();
57 return 0;
58}
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)