BOSS
7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
realnewrun.cxx
Go to the documentation of this file.
1
#include <iostream>
2
#include <fstream>
3
#include <iomanip>
4
#include <cstring>
5
#include <string>
6
#include <vector>
7
#include <TFile.h>
8
#include <TTree.h>
9
#include <TString.h>
10
#include <TBranch.h>
11
#include <TLeaf.h>
12
#include <TH1F.h>
13
#include <cstdio>
14
15
using namespace
std
;
16
17
int
main
(
int
argc,
char
*argv[]){
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
25
TFile
f1
(argv[1]);
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
52
f1
.Close();
53
f2.Close();
54
f3.cd();
55
t3->Write();
56
f3.Close();
57
return
0;
58
}
sprintf
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)
f1
TFile * f1
Definition
DataBase/tau_mode.c:4
std
Definition
RootEventData/RootEventData_rootcint.cxx:38
main
int main()
Definition
test_IFile.cxx:11
7.1.2
Mdc
DedxCalibAlg
DedxCalibAlg-00-02-01
share
shell
genRawScript
realnewrun.cxx
Generated by
1.12.0