22 TFile *
f1 =
new TFile(
"YYYY/m_root_dir/LumTau_XXXX.root");
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);
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);
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);
58 cout <<
"E_cms = " << E_cms << endl;
69 Double_t dlt = 0.0,mean = 0.0,width = 0.0;
70 Double_t luminitial = 0.;
74 cout <<
"\nRuntime less than 300 " << endl;
78 TH1F *dltphi1 =
new TH1F(
"dltphi1",
"dltphi",150,-30,30);
82 bool cut = (
e1/E_cms)>0.417&&(
e1/E_cms)<0.491&&(
e2/E_cms)>0.417&&(
e2/E_cms)<0.491
92 TF1* h1=
new TF1(
"h1",
"gaus",-6,4);
93 dltphi1->Fit(h1,
"R+");
94 dlt = h1->GetParameter(1);
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);
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;
109 for(Int_t i=0;i<11;i++)
117 for(Int_t i=0;i<10;i++)
119 hdltphi[i] =
new TH1D(
"",
"dltphi distribution",50,-50.,50.);
121 TH1 *
htime =
new TH1D(
"htime",
"time", 80, -10., 10.);
123 for(Int_t i=0;i<10;i++)
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;
141 for(Int_t i=0;i<10;i++)
149 TCanvas *c2 =
new TCanvas(
"c2",
" ",700,500);
150 c2->SetFillColor(kWhite);
154 for(Int_t i=0;
lum[i]<
lum[i+1];i++)
158 Double_t lummax =
lum[imin];
159 Double_t xmin =
x[imin];
161 for(Int_t i=imin;i<10;i++)
165 Double_t lumsum2 = lumsum*lumsum;
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");
183 luminitial =
g1->GetParameter(0);
184 tau =
g1->GetParameter(1);
191 cout <<
"\nThe result of fit is terrible. " << endl << endl;
192 cout <<
"set the tau value = 99999" << endl;
198 cout <<
"\nThe runtime is minus." << endl << endl;
204 m_outputFile.open(
"YYYY/m_txt_dir/LumTau_XXXX.txt", ios_base::app);
211 TString result = Form(
"tau = %6.2f",tau);
212 TText* text01 =
new TText(0.7,0.8,result);
214 text01->Draw(
"same");
216 c2->GetFrame()->SetFillColor(kWhite);
217 c2->GetFrame()->SetBorderSize(1);
219 c2->Print(
"lum_0000XXXX.ps");
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;
241 TSQLServer *db = TSQLServer::Connect(
"mysql://bes3db2.ihep.ac.cn",
"guest",
"guestpass");
246 const char *ins =
"select BER_PRB from run.RunParams where run_number = %d";
249 TSQLResult *res = db->Query(sql);
250 if (res->GetRowCount() == 0) {
251 printf(
"Cannot find the beam energy of run %d from the database.\n", runno);
256 TSQLRow *row = res->Next();
257 TString sbe = row->GetField(0);
std::ofstream m_outputFile
EvtComplex exp(const EvtComplex &c)
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)
Double_t BeamEnergyOnline(Int_t)
void tau_mode(int flag=0)