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