1 {
2 int rBin,phiBin,zBin;
6 float eff,
x[400],
y[400];
7
8 TFile *
f =
new TFile(
"effTree.root",
"read");
9 TTree *
t = (TTree*)
f->Get(
"effTree");
10
11 t->SetBranchAddress(
"rBin", &rBin);
12 t->SetBranchAddress(
"phiBin", &phiBin);
13 t->SetBranchAddress(
"zBin", &zBin);
14 t->SetBranchAddress(
"eff", &eff);
15 t->SetBranchAddress(
"x", x);
16 t->SetBranchAddress(
"y",
y);
17
18 int r,phi,z;
19 float efficiency[43][6][6];
20 float propTime[43][6][6][400];
21 float prob[43][6][6][400];
22
23 for (Int_t i = 0; i <
nR*
nPhi*
nZ; i++){
25 r = rBin;
26 phi = phiBin;
27 z = zBin;
28 efficiency[r][phi][z] = eff;
29 for (Int_t j = 0; j < 400; j++){
30 propTime[r][phi][z][j] =
x[j];
31 prob[r][phi][z][j] =
y[j];
32
33 }
34 }
35
36 int r0 = 41;
37 int phi0 = 2;
38 int z0 = 0;
39 Float_t x0[400], y0[400];
40
42 int rPos = 400+r0*10;
43 float x1[400],y1[400];
44 float t1;
45 sprintf(
file,
"/ihepbatch/besd12/liuy/EndcapTof/OpInETof2/results/%d/timeSta_%d_%d_%d.root",rPos,rPos,phi0,z0);
47 TH1F* h1 = new TH1F("h1","time distr.(ns)",400,0,20);
48 TFile* f1 = TFile::Open(
file);
49 TNtuple*
n1 = (TNtuple*)f1 -> Get(
"timeTuple");
50 n1->SetBranchAddress(
"inTimePre",&t1);
51 int nEntries = (Int_t)
n1->GetEntries();
52 cout << "nEntries:" << nEntries << "\n" << endl;
53
54 for(int m=0;m<nEntries;m++)
55 {
57 h1->Fill(t1);
58 }
59 double norm = h1->Integral();
60 eff = norm/2000000.;
61 if(norm!=0)
62 h1->Scale(1./norm);
63 else
64 {
65 cout << "The eff is null!" << endl;
66 continue;
67 }
68 TAxis* xaxis = h1->GetXaxis();
69 for(int m=0;m<400;m++)
70 {
71 x1[m] = xaxis->GetBinCenter(m);
72 y1[m] = h1->GetBinContent(m);
73 }
74 f1->Close();
75
76 for(Int_t i=0;i<400;i++)
77 {
78 x0[i] = propTime[r0][phi0][z0][i] - x1[i];
79 y0[i] = prob[r0][phi0][z0][i] - y1[i];
80 }
81
82 TGraph *g = new TGraph( 400, x0, y0);
83 g->Draw("APL");
84
86}
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)
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")