8 float efficiency0,
x[400],y[400];
9 TTree *
t =
new TTree(
"effTree",
"colEff");
12 TH1F* h1 =
new TH1F(
"h1",
"time distr.(ns)",400,0,20);
15 t->Branch(
"rBin", &rBin,
"rBin/I");
16 t->Branch(
"phiBin", &phiBin,
"phiBin/I");
17 t->Branch(
"zBin", &zBin,
"zBin/I");
18 t->Branch(
"efficiency0", &efficiency0,
"efficiency0/F");
19 t->Branch(
"x",
x,
"x[400]/F");
20 t->Branch(
"y", y,
"y[400]/F");
22 for (Int_t i = 0; i <
nR; i++){
24 for(Int_t j = 0; j<
nPhi;j++){
26 for(Int_t k=0;k<
nZ;k++){
28 sprintf(file,
"/ihepbatch/besd12/liuy/EndcapTof/OpInETof2/results/%d/timeSta_%d_%d_%d.root",rPos,rPos,j,k);
36 cout <<
"The file:" << file << endl;
37 TFile*
f1 = TFile::Open(file);
38 TNtuple*
n1 = (TNtuple*)
f1 -> Get(
"timeTuple");
39 n1->SetBranchAddress(
"inTimePre",&t1);
40 int nEntries = (Int_t)
n1->GetEntries();
41 cout <<
"nEntries:" << nEntries <<
"\n" << endl;
43 for(
int m=0;m<nEntries;m++)
48 double norm = h1->Integral();
49 efficiency0 = norm/2000000.;
55 cout <<
"The eff is null!" << endl;
58 TAxis* xaxis = h1->GetXaxis();
59 for(
int m=0;m<400;m++)
61 x[m] = xaxis->GetBinCenter(m);
62 y[m] = h1->GetBinContent(m);
73 TFile *f =
new TFile(
"effTree.root",
"recreate");
74 cout <<
"TTree write" <<endl;