13 #include <Riostream.h>
24 #include <TDatabasePDG.h>
37 #include <TLorentzVector.h>
39 #include <TMatrixTBase.h>
41 #include "TPaveText.h"
42 #include <TGraphErrors.h>
56 Double_t ind_ray(
double Ex,
double Ey,
double Ez,
double Dx,
double Dy,
double Dz,
double cx,
double cy,
double cz,
double vx,
double vy,
double vz);
58 void acq(
string input_filename,
int ind,
int pix_lab,
int part);
65 void read(
string input_filename);
69 Double_t
eic_bnl_rich::ind_ray(
double Ex,
double Ey,
double Ez,
double Dx,
double Dy,
double Dz,
double cx,
double cy,
double cz,
double vx,
double vy,
double vz){
77 LongDouble_t cex,cey,cez;
78 LongDouble_t cdx,cdy,cdz;
87 LongDouble_t
eps = 0.00000000001;
88 LongDouble_t
R = 195.;
108 a = TMath::Sqrt(cex*cex+cey*cey+cez*cez);
109 d = TMath::Sqrt(cdx*cdx+cdy*cdy+cdz*cdz);
110 th = TMath::ACos((cdx*cex+cdy*cey+cdz*cez)/a/d);
117 y = R*(a*sin(x)-d*sin(th-x))+a*d*sin(th-2*x);
118 y1 = R*(a*cos(x)+d*cos(th-x))-2*a*d*cos(th-2*x);
123 while(TMath::Abs(dx)>eps && i<100){
126 y = R*(a*sin(x)-d*sin(th-x))+a*d*sin(th-2*x);
127 y1 = R*(a*cos(x)+d*cos(th-x))-2*a*d*cos(th-2*x);
137 sx = cx + (R*cos(x)/a-R*sin(x)/tan(th)/
a)*cex + (R*sin(x)/d/sin(th))*cdx;
138 sy = cy + (R*cos(x)/a-R*sin(x)/tan(th)/
a)*cey + (R*sin(x)/d/sin(th))*cdy;
139 sz = cz + (R*cos(x)/a-R*sin(x)/tan(th)/
a)*cez + (R*sin(x)/d/sin(th))*cdz;
149 es = sqrt(esx*esx+esy*esy+esz*esz);
155 theta_c = TMath::ACos((esx*vx+esy*vy+esz*vz));
165 qe = 12.5*(energy-6.2);
166 if(energy>10.3) qe = 0.;
178 Double_t rtd = 180./TMath::Pi();
180 TFile *
file=
new TFile(input_filename.c_str());
181 if (file->IsZombie()) {
182 cout <<
"Error opening file" << input_filename << endl;
187 TTree *eic_rich = (TTree*) file->Get(
"eval_rich");
189 Int_t eic_rich_event=0,eic_rich_bankid=0,eic_rich_volumeid=0,eic_rich_hitid=0,*eic_rich_pid=0,eic_rich_mpid=0,eic_rich_trackid=0,eic_rich_mtrackid=0,eic_rich_otrackid=0;
190 Double_t eic_rich_hit_x=0,eic_rich_hit_y=0,eic_rich_hit_z=0, eic_rich_emi_x=0, eic_rich_emi_y=0, eic_rich_emi_z=0,eic_rich_px=0,eic_rich_py=0,eic_rich_pz=0,eic_rich_mpx=0,eic_rich_mpy=0,eic_rich_mpz=0,eic_rich_e=0,eic_rich_me=0,eic_rich_edep=0;
192 eic_rich->SetBranchAddress(
"event",&eic_rich_event);
193 eic_rich->SetBranchAddress(
"hit_x",&eic_rich_hit_x);
194 eic_rich->SetBranchAddress(
"hit_y",&eic_rich_hit_y);
195 eic_rich->SetBranchAddress(
"hit_z",&eic_rich_hit_z);
196 eic_rich->SetBranchAddress(
"emi_x",&eic_rich_emi_x);
197 eic_rich->SetBranchAddress(
"emi_y",&eic_rich_emi_y);
198 eic_rich->SetBranchAddress(
"emi_z",&eic_rich_emi_z);
199 eic_rich->SetBranchAddress(
"px",&eic_rich_px);
200 eic_rich->SetBranchAddress(
"py",&eic_rich_py);
201 eic_rich->SetBranchAddress(
"pz",&eic_rich_pz);
202 eic_rich->SetBranchAddress(
"mpx",&eic_rich_mpx);
203 eic_rich->SetBranchAddress(
"mpy",&eic_rich_mpy);
204 eic_rich->SetBranchAddress(
"mpz",&eic_rich_mpz);
205 eic_rich->SetBranchAddress(
"e",&eic_rich_e);
206 eic_rich->SetBranchAddress(
"me",&eic_rich_me);
207 eic_rich->SetBranchAddress(
"edep",&eic_rich_edep);
208 eic_rich->SetBranchAddress(
"bankid",&eic_rich_bankid);
209 eic_rich->SetBranchAddress(
"volumeid",&eic_rich_volumeid);
210 eic_rich->SetBranchAddress(
"hitid",&eic_rich_hitid);
211 eic_rich->SetBranchAddress(
"pid",&eic_rich_pid);
212 eic_rich->SetBranchAddress(
"mpid",&eic_rich_mpid);
213 eic_rich->SetBranchAddress(
"trackid",&eic_rich_trackid);
214 eic_rich->SetBranchAddress(
"mtrackid",&eic_rich_mtrackid);
215 eic_rich->SetBranchAddress(
"otrackid",&eic_rich_otrackid);
220 for(Int_t
i=0;
i<61;
i++) ev_count[
i]=0;
222 Int_t ph_ch_count = 0;
224 TH2F *ph_det =
new TH2F(
"ph_det",
"", 1666, -250., 250., 1666, -250., 250.);
225 TH2F *ph_det1 =
new TH2F(
"ph_det1",
"", 1666, -250., 250., 1666, -250., 250.);
226 Double_t momvv_x[10000];
227 Double_t momvv_y[10000];
228 Double_t momvv_z[10000];
230 TH1F *
h =
new TH1F(
"",
"",1000,-70,70);
231 TH1F *spectrum_ev =
new TH1F(
"",
"",1000,4.,12.);
232 TH1F *spectrum_nm =
new TH1F(
"",
"",1000,100.,300.);
233 TH1F *ch_ang =
new TH1F(
"",
"",1000,0.,0.3);
234 Double_t ang_cut = 0.;
235 Double_t momv[3] = {0.,0.,0.};
237 Double_t m_emi[3] = {0.,0.,0.};
238 Double_t d_hit[3] = {0.,0.,0.};
243 Double_t rr[3] = {0.,0.,0.};
244 Double_t theta_cc = 0.;
245 Double_t
m[4]={0.000511, 0.13957018, 0.493677, 0.938272};
246 Double_t em[3][10000];
249 Double_t mom_check = 999.;
250 Int_t event_check = 1.;
251 Int_t event_check1 = 1.;
259 ch_pi_h=
new TH1F*[61];
260 for(Int_t
i=0;
i<61;
i++){
261 ch_pi_h[
i] =
new TH1F(Form(
"ch_pi_h%d",
i),
"",10000,0,0.3);
263 TH1F *h_mom =
new TH1F(
"",
"",100,0.,100.);
266 for(Int_t
i=0;(
i<eic_rich->GetEntries());
i++){
268 eic_rich->GetEntry(
i);
270 if(eic_rich_event<=ind){
274 em[0][ph_count-1] = eic_rich_emi_x;
275 em[1][ph_count-1] = eic_rich_emi_y;
276 em[2][ph_count-1] = eic_rich_emi_z;
280 vv = sqrt((em[0][11]-em[0][0])*(em[0][11]-em[0][0])+(em[1][11]-em[1][0])*(em[1][11]-em[1][0])+(em[2][11]-em[2][0])*(em[2][11]-em[2][0]));
283 momvv_x[eic_rich_event-1]=(em[0][11]-em[0][0])/vv;
284 momvv_y[eic_rich_event-1]=(em[1][11]-em[1][0])/vv;
285 momvv_z[eic_rich_event-1]=(em[2][11]-em[2][0])/vv;
287 if(eic_rich_event!=event_check){
289 event_check = eic_rich_event;
295 for(Int_t
i=0;(
i<eic_rich->GetEntries());
i++){
297 eic_rich->GetEntry(
i);
302 ang_cut = TMath::ACos(eic_rich_mpz/sqrt(eic_rich_mpx*eic_rich_mpx+eic_rich_mpy*eic_rich_mpy+eic_rich_mpz*eic_rich_mpz))*rtd;
307 if(eic_rich_event<=ind){
309 momentum = sqrt(eic_rich_mpx*eic_rich_mpx+eic_rich_mpy*eic_rich_mpy+eic_rich_mpz*eic_rich_mpz);
313 theta_cc = acos(sqrt(imom*imom+m[part]*m[part])/imom/1.00054);
315 momv[0] = momvv_x[eic_rich_event-1];
316 momv[1] = momvv_y[eic_rich_event-1];
317 momv[2] = momvv_z[eic_rich_event-1];
331 theta = TMath::ACos(momv[2]);
332 phi = TMath::ATan2(momv[1],momv[0]);
339 m_emi[0] = ((220.)/momv[2])*momv[0];
340 m_emi[1] = ((220.)/momv[2])*momv[1];
341 m_emi[2] = ((220.)/momv[2])*momv[2];
347 d_hit[0] = eic_rich_hit_x;
348 d_hit[1] = eic_rich_hit_y;
349 d_hit[2] = eic_rich_hit_z;
351 xbin = ph_det->GetXaxis()->FindBin(eic_rich_hit_x);
352 ybin = ph_det->GetYaxis()->FindBin(eic_rich_hit_y);
354 if(pix_lab!=0)d_hit[0] = ph_det->GetXaxis()->GetBinCenter(xbin);
355 if(pix_lab!=0)d_hit[1] = ph_det->GetYaxis()->GetBinCenter(ybin);
357 ph_det->Fill(d_hit[0],d_hit[1]);
365 rr[0] = -18.5*TMath::Sin(eic_rich_volumeid*TMath::Pi()/4.);
366 rr[1] = 18.5*TMath::Cos(eic_rich_volumeid*TMath::Pi()/4.);
368 sec = eic_rich_volumeid;
372 ch = ind_ray(m_emi[0], m_emi[1], m_emi[2], d_hit[0], d_hit[1], d_hit[2], rr[0], rr[1], rr[2], momv[0], momv[1], momv[2]);
380 if(ch<(theta_cc+0.008) && ch>(theta_cc-0.008) && theta*rtd>15. && theta*rtd<16.){
382 ch_pi_h[imom]->Fill(ch);
383 spectrum_nm->Fill(1240./(eic_rich_edep*1000000000.));
385 ph_det1->Fill(d_hit[0],d_hit[1]);
399 if(eic_rich_event!=event_check1){
403 event_check1 = eic_rich_event;
421 streambuf *coutbuf = cout.rdbuf();
422 cout.rdbuf(out.rdbuf());
424 for(Int_t
i=0;
i<61;
i++){
425 if(ch_pi_h[
i]->GetEntries()!=0)cout<<ch_pi_h[
i]->GetMean()<<
" "<<ch_pi_h[
i]->GetRMS()<<
" "<<(int)(ch_pi_h[
i]->GetEntries()/ev_count[
i])<<
" "<<
i<<
" "<<part<<endl;
426 else if(
i<60)cout<<ch_pi_h[
i]->GetMean()<<
" "<<ch_pi_h[
i]->GetRMS()<<
" "<<0<<
" "<<
i<<
" "<<part<<endl;
427 summm = summm + ev_count[
i];
432 ph_det1->Draw(
"colz");
445 inputFile.open(input_filename);
447 cerr <<
"Error in opening the file";
451 Double_t theta_ch, sigma_theta, nph,
momentum, ptype;
452 Double_t ch_e_v[60],rms_e_v[60],nph_e_v[60],mom_e_v[60];
453 Double_t ch_pi_v[60],rms_pi_v[60],nph_pi_v[60],mom_pi_v[60];
454 Double_t ch_k_v[60],rms_k_v[60],nph_k_v[60],mom_k_v[60];
455 Double_t ch_p_v[60],rms_p_v[60],nph_p_v[60],mom_p_v[60];
456 Double_t n_sig_e_pi[60],n_sig_pi_k[60],n_sig_k_p[60],mm_e_pi[60],mm_pi_k[60],mm_k_p[60];
457 Int_t
idx[4] = {0,0,0,0};
459 while (inputFile>>theta_ch>>sigma_theta>>nph>>momentum>>ptype){
462 ch_e_v[idx[0]]=theta_ch;
463 rms_e_v[idx[0]]=sigma_theta;
464 nph_e_v[idx[0]]=nph*0.6;
465 if(theta_ch==0) nph_e_v[idx[0]]=0;
470 ch_pi_v[idx[1]]=theta_ch;
471 rms_pi_v[idx[1]]=sigma_theta;
472 nph_pi_v[idx[1]]=nph*0.6;
473 if(theta_ch==0) nph_pi_v[idx[1]]=0;
478 ch_k_v[idx[2]]=theta_ch;
479 rms_k_v[idx[2]]=sigma_theta;
480 nph_k_v[idx[2]]=nph*0.6;
481 if(theta_ch==0) nph_k_v[idx[2]]=0;
486 ch_p_v[idx[3]]=theta_ch;
487 rms_p_v[idx[3]]=sigma_theta;
488 nph_p_v[idx[3]]=nph*0.6;
489 if(theta_ch==0) nph_p_v[idx[3]]=0;
501 for(Int_t
i=0;
i<idx[0];
i++){
503 if(ch_e_v[
i]!=0 && ch_pi_v[
i]!=0 &&
i>2){
504 n_sig_e_pi[ii] = (ch_e_v[
i]-ch_pi_v[
i])*sqrt((nph_e_v[
i]+nph_pi_v[
i])*0.5)/((rms_e_v[
i]+rms_pi_v[
i])*0.5);
505 mm_e_pi[ii] = mom_e_v[
i]+0.5;
509 if(ch_pi_v[
i]!=0 && ch_k_v[
i]!=0 &&
i>16){
510 n_sig_pi_k[iii] = (ch_pi_v[
i]-ch_k_v[
i])*sqrt((nph_pi_v[
i]+nph_k_v[
i])*0.5)/((rms_pi_v[
i]+rms_k_v[
i])*0.5);
511 mm_pi_k[iii] = mom_pi_v[
i]+0.5;
516 if(ch_k_v[
i]!=0 && ch_p_v[
i]!=0 &&
i>30){
517 n_sig_k_p[iiii] = (ch_k_v[
i]-ch_p_v[
i])*sqrt((nph_k_v[
i]+nph_p_v[
i])*0.5)/((rms_k_v[
i]+rms_p_v[
i])*0.5);
518 mm_k_p[iiii] = mom_k_v[
i]+0.5;
527 TGraph *sig_pi =
new TGraph(idx[1],mom_pi_v,rms_pi_v);
528 TGraph *nph_pi =
new TGraph(idx[1],mom_pi_v,nph_pi_v);
530 TGraph *gr_e_pi =
new TGraph(ii,mm_e_pi,n_sig_e_pi);
531 TGraph *gr_pi_k =
new TGraph(iii,mm_pi_k,n_sig_pi_k);
532 TGraph *gr_k_p =
new TGraph(iiii,mm_k_p,n_sig_k_p);
534 TCanvas *c1 =
new TCanvas(
"c1",
"",1000,600);
537 gr_e_pi->SetLineStyle(2);
538 gr_e_pi->SetLineWidth(2);
539 gr_e_pi->SetLineColor(kGreen);
540 gr_e_pi->SetMarkerColor(kGreen);
541 gr_e_pi->SetTitle(
"");
542 gr_e_pi->GetXaxis()->SetTitle(
"Momentum [Gev/c]");
543 gr_e_pi->GetYaxis()->SetTitle(
"N_{#sigma}^{Ring}");
544 gr_e_pi->Draw(
"AC*");
545 gr_pi_k->SetLineStyle(3);
546 gr_pi_k->SetLineWidth(2);
547 gr_pi_k->SetLineColor(kRed);
548 gr_pi_k->SetMarkerColor(kRed);
549 gr_pi_k->SetTitle(
"");
551 gr_k_p->SetLineStyle(4);
552 gr_k_p->SetLineWidth(2);
553 gr_pi_k->SetLineColor(kBlue);
554 gr_pi_k->SetMarkerColor(kBlue);
555 gr_k_p->SetTitle(
"");
557 c1->Print(
"test1.pdf",
"pdf");
559 for(Int_t
j=0;
j<iiii;
j++) cout<<n_sig_k_p[
j]<<
" "<<mm_k_p[
j]<<endl;
561 TCanvas *
c2 =
new TCanvas(
"c2",
"",1000,600);
564 sig_pi->SetTitle(
"");
565 sig_pi->GetXaxis()->SetTitle(
"Momentum [Gev/c]");
566 sig_pi->GetYaxis()->SetTitle(
"#sigma_{#theta_{C}}");
568 c2->Print(
"test2.pdf",
"pdf");
570 TCanvas *c3 =
new TCanvas(
"c3",
"",1000,600);
573 nph_pi->SetTitle(
"");
574 nph_pi->GetXaxis()->SetTitle(
"Momentum [Gev/c]");
575 nph_pi->GetYaxis()->SetTitle(
"N_{p.e.}");
577 c3->Print(
"test3.pdf",
"pdf");