BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
readTree.cxx
Go to the documentation of this file.
1void readTree() {
2 int rBin, phiBin, zBin;
3 const int nR = 43;
4 const int nPhi = 6;
5 const int nZ = 6;
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++ )
24 {
25 t->GetEntry( i );
26 r = rBin;
27 phi = phiBin;
28 z = zBin;
29 efficiency[r][phi][z] = eff;
30 for ( Int_t j = 0; j < 400; j++ )
31 {
32 propTime[r][phi][z][j] = x[j];
33 prob[r][phi][z][j] = y[j];
34 // cout << "\n" << propTime[r][phi][z][j] << " " << prob[r][phi][z][j] << endl;
35 }
36 }
37 // TH1F *h1 = new TH1F("h1","propTime",400,0,20);
38 int r0 = 41;
39 int phi0 = 2;
40 int z0 = 0;
41 Float_t x0[400], y0[400];
42
43 char file[200];
44 int rPos = 400 + r0 * 10;
45 float x1[400], y1[400];
46 float t1;
47 sprintf( file, "/ihepbatch/besd12/liuy/EndcapTof/OpInETof2/results/%d/timeSta_%d_%d_%d.root",
48 rPos, rPos, phi0, z0 );
49 cout << file << endl;
50 TH1F* h1 = new TH1F( "h1", "time distr.(ns)", 400, 0, 20 );
51 TFile* f1 = TFile::Open( file );
52 TNtuple* n1 = (TNtuple*)f1->Get( "timeTuple" );
53 n1->SetBranchAddress( "inTimePre", &t1 );
54 int nEntries = (Int_t)n1->GetEntries();
55 cout << "nEntries:" << nEntries << "\n" << endl;
56
57 for ( int m = 0; m < nEntries; m++ )
58 {
59 n1->GetEntry( m );
60 h1->Fill( t1 );
61 }
62 double norm = h1->Integral();
63 eff = norm / 2000000.; // 200 events per run ; 10k photons per event
64 if ( norm != 0 ) h1->Scale( 1. / norm );
65 else
66 {
67 cout << "The eff is null!" << endl;
68 continue;
69 }
70 TAxis* xaxis = h1->GetXaxis();
71 for ( int m = 0; m < 400; m++ )
72 {
73 x1[m] = xaxis->GetBinCenter( m );
74 y1[m] = h1->GetBinContent( m );
75 }
76 f1->Close();
77
78 for ( Int_t i = 0; i < 400; i++ )
79 {
80 x0[i] = propTime[r0][phi0][z0][i] - x1[i];
81 y0[i] = prob[r0][phi0][z0][i] - y1[i];
82 }
83
84 TGraph* g = new TGraph( 400, x0, y0 );
85 g->Draw( "APL" );
86
87 f->Close();
88}
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")
char * file
Definition DQA_TO_DB.cxx:16
TFile * f1
int n1
Definition SD0Tag.cxx:58
void readTree()
Definition readTree.cxx:1
int t()
Definition t.c:1