17{
18
19 gROOT->Reset();
20
21
22 TFile *
f1 =
new TFile(
"YYYY/m_root_dir/LumTau_XXXX.root");
24
26 {
27
28 TCanvas *myCanvas = new TCanvas();
29 myCanvas->Divide(1,1);
30 TPad *c1_1 = new TPad("c1_1", "c1_1",0.01,0.01,0.99,0.99);
31 c1_1->Draw();
32 c1_1->cd();
33 c1_1->Range(0.425458,-114.842,0.674993,802.951);
34 c1_1->SetBorderSize(2);
35 c1_1->SetBottomMargin(0.125129);
36 c1_1->SetFrameFillColor(0);
37 }
38
39
40 Int_t run = 0;
43
44 data->SetBranchAddress(
"run",&run);
45 data->SetBranchAddress(
"time",&
time);
49 data->SetBranchAddress(
"e1",&
e1);
50 data->SetBranchAddress(
"e2",&
e2);
51 data->SetBranchAddress(
"etot",&
etot);
52 data->SetBranchAddress(
"phi1",&
phi1);
53 data->SetBranchAddress(
"phi2",&
phi2);
54
56 Int_t runno = run;
58 cout << "E_cms = " << E_cms << endl;
59
61
68
69 Double_t dlt = 0.0,mean = 0.0,width = 0.0;
70 Double_t luminitial = 0.;
71 Double_t tau = 5000.;
72
74 cout << "\nRuntime less than 300 " << endl;
75 else
76 {
77
78 TH1F *dltphi1 = new TH1F("dltphi1","dltphi",150,-30,30);
80 {
82 bool cut = (
e1/E_cms)>0.417&&(
e1/E_cms)<0.491&&(
e2/E_cms)>0.417&&(
e2/E_cms)<0.491
86 {
88 }
89 }
90
91
92 TF1* h1=new TF1("h1","gaus",-6,4);
93 dltphi1->Fit(h1,"R+");
94 dlt = h1->GetParameter(1);
95
96
97 TF1* h2=new TF1("h2","gaus",4,30);
98 dltphi1->Fit(h2,"R+");
99 mean = h2->GetParameter(1);
100 Double_t sigma = h2->GetParameter(2);
101 width = 3*sigma;
102
103 if (dlt<-6||dlt>4||mean<4||mean>30||(mean-dlt)-0.5*width<0)
104 cout << "\nSomething wrong with cut Bhabha entries. " << endl;
105 else
106 {
107
109 for(Int_t i=0;i<11;i++)
110 {
112 }
113
114
115
117 for(Int_t i=0;i<10;i++)
118 {
119 hdltphi[i] =
new TH1D(
"",
"dltphi distribution",50,-50.,50.);
120 }
121 TH1 *
htime =
new TH1D(
"htime",
"time", 80, -10., 10.);
122
123 for(Int_t i=0;i<10;i++)
124 {
126 {
128 bool lumcut = (
e1/E_cms)>0.417&&(
e2/E_cms)>0.417&&fabs(
costht1)<0.8&&
130 fabs(
dltphi-dlt)<(mean-dlt)+width&&
etot<E_cms+0.5;
132 {
134 }
135 }
136 }
137
138
141 for(Int_t i=0;i<10;i++)
142 {
146 }
147
148
149 TCanvas *c2 = new TCanvas("c2"," ",700,500);
150 c2->SetFillColor(kWhite);
151 c2->SetGrid();
152
153 Int_t imin;
154 for(Int_t i=0;
lum[i]<
lum[i+1];i++)
155 {
156 imin = i+1;
157 }
158 Double_t lummax =
lum[imin];
159 Double_t xmin =
x[imin];
160 Double_t lumsum;
161 for(Int_t i=imin;i<10;i++)
162 {
164 }
165 Double_t lumsum2 = lumsum*lumsum;
166
168 TF1 *
g1 =
new TF1(
"g1",
"[0]*exp(-x/[1])",xmin,10000.);
169 g1->SetParameters(lummax,1e+4.);
171 TGraph*
gr =
new TGraph(
n,x,
lum);
174 gr->SetMarkerColor(4);
175 gr->SetMarkerStyle(21);
176 gr->SetTitle(
"BbLum");
177 gr->GetXaxis()->SetTitle(
"Time");
178 gr->GetYaxis()->SetTitle(
"Luminosity");
181
182
183 luminitial =
g1->GetParameter(0);
184 tau =
g1->GetParameter(1);
185 }
186 }
187
188
189 if (tau>99999.)
190 {
191 cout << "\nThe result of fit is terrible. " << endl << endl;
192 cout << "set the tau value = 99999" << endl;
193 tau = 99999;
194 }
195
197 {
198 cout << "\nThe runtime is minus." << endl << endl;
200 }
201
202
204 m_outputFile.open(
"YYYY/m_txt_dir/LumTau_XXXX.txt", ios_base::app);
207
209 {
210
211 TString result = Form("tau = %6.2f",tau);
212 TText* text01 = new TText(0.7,0.8,result);
213 text01->SetNDC();
214 text01->Draw("same");
215 c2->Update();
216 c2->GetFrame()->SetFillColor(kWhite);
217 c2->GetFrame()->SetBorderSize(1);
218 c2->Modified();
219 c2->Print("lum_0000XXXX.ps");
220 }
221
223 {
224
225 cout << "E_cms = " << E_cms << endl;
226 cout <<
"\nruntime = " <<
difft << endl;
227 cout << "\ndlt = " << dlt << endl;
228 cout << "mean = " << mean << endl;
229 cout << "width = " << width << endl;
230 cout << "\ntau = " << tau << endl << endl;
231 }
232}
std::ofstream m_outputFile
EvtComplex exp(const EvtComplex &c)
Double_t BeamEnergyOnline(Int_t)