BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
DataBase/tau_mode.c
Go to the documentation of this file.
1{
2 gROOT->Reset();
3
4 TFile* f1 = new TFile( "YYYY/m_root_dir/LumTau_XXXX.root" );
5 TTree* data = event;
6
7 Double_t time = 0.0, dltphi = 0.0, costht1 = 0.0, costht2 = 0.0, e1 = 0.0, e2 = 0.0,
8 etot = 0.0, phi1 = 0.0, phi2 = 0.0;
9 Int_t nentries = 0;
10
11 data->SetBranchAddress( "time", &time );
12 data->SetBranchAddress( "dltphi", &dltphi );
13 data->SetBranchAddress( "costht1", &costht1 );
14 data->SetBranchAddress( "costht2", &costht2 );
15 data->SetBranchAddress( "e1", &e1 );
16 data->SetBranchAddress( "e2", &e2 );
17 data->SetBranchAddress( "etot", &etot );
18 data->SetBranchAddress( "phi1", &phi1 );
19 data->SetBranchAddress( "phi2", &phi2 );
20 TH1D* hdltphi[10];
21
22 for ( Int_t i = 0; i < 10; i++ )
23 { hdltphi[i] = new TH1D( " ", "dltphi distribution", 50, -50., 50. ); }
24
25 TH1* htime = new TH1D( "htime", "time", 80, -10., 10. );
26 Double_t timemin = 0.0, timemax = 0.0;
27 nentries = (Int_t)data->GetEntries();
28
29 data->GetEntry( 0 );
30 timemin = time;
31 data->GetEntry( ( nentries - 1 ) );
32 timemax = time;
33
34 Double_t difft = timemax - timemin;
35 Double_t xtime[11], lum[10];
36 for ( Int_t i = 0; i < 11; i++ ) { xtime[i] = timemin + ( difft / 10. ) * i; }
37 for ( Int_t i = 0; i < 10; i++ )
38 {
39 for ( Int_t j = 0; j < nentries; j++ )
40 {
41 data->GetEntry( j );
42 bool lumcut = e1 > 1.2 && e2 > 0.8 && fabs( costht1 ) < 0.8 && fabs( costht2 ) < 0.8 &&
43 fabs( dltphi + 1.055 ) > 2. && fabs( dltphi + 1.055 ) < 25. && etot < 4.0;
44 if ( lumcut && time > xtime[i] && time < xtime[i + 1] ) { hdltphi[i]->Fill( dltphi ); }
45 }
46 }
47
48 Int_t nevt[10];
49 Double_t x[10];
50 for ( Int_t i = 0; i < 10; i++ )
51 {
52 nevt[i] = hdltphi[i]->GetEntries();
53 x[i] = xtime[i + 1] - xtime[0];
54 lum[i] = nevt[i] / ( 0.2 * 2514 );
55 }
56
57 const Int_t n = 10;
58 TF1* g1 = new TF1( "g1", "[0]*exp(-x/[1])", 0, 10000. );
59 g1->SetParameters( lum[0], 1e+4. );
60 g1->SetLineColor( 2 );
61 TGraph* gr = new TGraph( n, x, lum );
62 gr->SetLineColor( 2 );
63 gr->SetLineWidth( 2 );
64 gr->SetMarkerColor( 4 );
65 gr->SetMarkerStyle( 21 );
66 gr->SetTitle( "BbLum_000XXXX" );
67 gr->GetXaxis()->SetTitle( "Time" );
68 gr->GetYaxis()->SetTitle( "Luminosity" );
69 gr->Fit( "g1", "R" );
70 // gr->Draw("ap");
71
72 std::ofstream m_outputFile;
73 m_outputFile.open( "YYYY/m_txt_dir/LumTau_XXXX.txt", ios_base::app );
74 m_outputFile << XXXX << " " << difft << " " << g1->GetParameter( 0 )
75 << " "
76 << ( g1->GetParameter( 0 ) * exp( -1.0 * difft / ( g1->GetParameter( 1 ) ) ) )
77 << " " << g1->GetParameter( 1 ) << endl;
78 m_outputFile.close();
79
80 gROOT->ProcessLine( ".q" );
81}
Double_t timemax
const Int_t n
std::ofstream m_outputFile
Double_t phi2
TTree * data
Double_t lum[10]
TFile * f1
Double_t costht2
Double_t etot
TH1D * hdltphi[10]
TF1 * g1
Double_t dltphi
Double_t phi1
Double_t timemin
TH1 * htime
Double_t costht1
Int_t nevt[10]
TGraph * gr
Double_t time
Double_t e1
Double_t xtime[11]
Int_t nentries
Double_t difft
Double_t e2
EvtComplex exp(const EvtComplex &c)