BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
tau_mode.c
Go to the documentation of this file.
1{
2 gROOT->Reset();
3
4 TFile *f1 = new TFile("/bes3fs/groups/psip/psipgroup/temp/user/liuh/BbLum/psipp/BbEmc_00XXXX.root");
5 TTree *data =event;
6
7 TCanvas *myCanvas = new TCanvas();
8 myCanvas->Divide(1,1);
9 TPad *c1_1 = new TPad("c1_1", "c1_1",0.01,0.01,0.99,0.99);
10 c1_1->Draw();
11 c1_1->cd();
12 c1_1->Range(0.425458,-114.842,0.674993,802.951);
13 c1_1->SetBorderSize(2);
14 c1_1->SetBottomMargin(0.125129);
15 c1_1->SetFrameFillColor(0);
16
17 Double_t time = 0.0,dltphi = 0.0,costht1 = 0.0,costht2 = 0.0,e1 = 0.0,e2 = 0.0,etot = 0.0,phi1 = 0.0,phi2 = 0.0;
18 Int_t nentries = 0;
19
20 data->SetBranchAddress("time",&time);
21 data->SetBranchAddress("dltphi",&dltphi);
22 data->SetBranchAddress("costht1",&costht1);
23 data->SetBranchAddress("costht2",&costht2);
24 data->SetBranchAddress("e1",&e1);
25 data->SetBranchAddress("e2",&e2);
26 data->SetBranchAddress("etot",&etot);
27 data->SetBranchAddress("phi1",&phi1);
28 data->SetBranchAddress("phi2",&phi2);
29 TH1D *hdltphi[10];
30
31 for(Int_t i=0;i<10;i++)
32 {
33 hdltphi[i] = new TH1D(" ","dltphi distribution",50,-50.,50.);
34 }
35
36 TH1 *htime = new TH1D("htime","time", 80, -10., 10.);
37 Double_t timemin = 0.0,timemax = 0.0;
38 nentries = (Int_t)data->GetEntries();
39
40 data->GetEntry(0);
41 timemin = time;
42 data->GetEntry((nentries - 1));
43 timemax = time;
44
45 Double_t difft = timemax-timemin;
46 Double_t xtime[11],lum[10];
47 for(Int_t i=0;i<11;i++)
48 {
49 xtime[i]=timemin+(difft/10.)*i;
50 }
51 for(Int_t i=0;i<10;i++)
52 {
53 for(Int_t j=0;j<nentries;j++)
54 {
55 data->GetEntry(j);
56 bool lumcut = e1>1.2&&e2>0.8&&fabs(costht1)<0.8&&
57 fabs(costht2)<0.8&&fabs(dltphi+1.055)>2.&&
58 fabs(dltphi+1.055)<25.&&etot<4.0;
59 if(lumcut&&time>xtime[i]&&time<xtime[i+1])
60 {
61 hdltphi[i]->Fill(dltphi);
62 }
63 }
64 }
65
66 Int_t nevt[10];
67 Double_t x[10];
68 for(Int_t i=0;i<10;i++)
69 {
70 nevt[i] = hdltphi[i]->GetEntries();
71 x[i]=xtime[i+1]-xtime[0];
72 lum[i]=nevt[i]/(0.2*2514);
73 }
74
75 TCanvas *c1 = new TCanvas("c1"," ",700,500);
76 c1->SetFillColor(kWhite);
77 c1->SetGrid();
78
79 const Int_t n = 10;
80 TF1 *g1 = new TF1("g1","[0]*exp(-x/[1])",0,10000.);
81 g1->SetParameters(lum[0],1e+4.);
82 g1->SetLineColor(2);
83 TGraph* gr = new TGraph(n,x,lum);
84 gr->SetLineColor(2);
85 gr->SetLineWidth(2);
86 gr->SetMarkerColor(4);
87 gr->SetMarkerStyle(21);
88 gr->SetTitle("BbLum_000XXXX");
89 gr->GetXaxis()->SetTitle("Time");
90 gr->GetYaxis()->SetTitle("Luminosity");
91 gr->Fit("g1","R");
92 gr->Draw("ap");
93
94 std::ofstream m_outputFile;
95 m_outputFile.open("Lum_Tau.txt", ios_base::app);
96 m_outputFile<<XXXX<<" "<<difft<<" "<<g1->GetParameter(0)<<" "<<(g1->GetParameter(0) * exp(- 1.0 * difft / (g1->GetParameter(1))))<<" "<<g1->GetParameter(1)<<endl;
97 m_outputFile.close();
98
99 TString result = Form("tau = %6.2f",g1->GetParameter(1));
100 TText* text01 = new TText(0.7,0.8,result);
101 text01->SetNDC();
102 text01->Draw("same");
103 c1->Update();
104 c1->GetFrame()->SetFillColor(kWhite);
105 c1->GetFrame()->SetBorderSize(1);
106 c1->Modified();
107 c1->Print("lum_0000XXXX.ps");
108}
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:252
Double_t timemax
Definition: tau_mode.c:37
const Int_t n
Definition: tau_mode.c:79
std::ofstream m_outputFile
Definition: tau_mode.c:94
Double_t phi2
Definition: tau_mode.c:17
TTree * data
Definition: tau_mode.c:5
Double_t lum[10]
Definition: tau_mode.c:46
TFile * f1
Definition: tau_mode.c:4
Double_t costht2
Definition: tau_mode.c:17
Double_t etot
Definition: tau_mode.c:17
TCanvas * c1
Definition: tau_mode.c:75
TPad * c1_1
Definition: tau_mode.c:9
TH1D * hdltphi[10]
Definition: tau_mode.c:29
TCanvas * myCanvas
Definition: tau_mode.c:7
TF1 * g1
Definition: tau_mode.c:80
Double_t x[10]
Definition: tau_mode.c:67
Double_t dltphi
Definition: tau_mode.c:17
Double_t phi1
Definition: tau_mode.c:17
Double_t timemin
Definition: tau_mode.c:37
TH1 * htime
Definition: tau_mode.c:36
Double_t costht1
Definition: tau_mode.c:17
Int_t nevt[10]
Definition: tau_mode.c:66
TGraph * gr
Definition: tau_mode.c:83
Double_t time
Definition: tau_mode.c:17
Double_t e1
Definition: tau_mode.c:17
Double_t xtime[11]
Definition: tau_mode.c:46
Int_t nentries
Definition: tau_mode.c:18
Double_t difft
Definition: tau_mode.c:45
Double_t e2
Definition: tau_mode.c:17