11 #include <TLorentzVector.h>
47 #include <TPostScript.h>
50 #include <TPaveLabel.h>
51 #include <TGraphErrors.h>
73 #include <JANA/JApplication.h>
74 #include <JANA/JFactory.h>
82 static double R0[5]={0., 65.089, 67.1464, 71.2612, 77.4334};
83 static double DD[5]={0., 2.0574, 4.1148, 6.1722, 8.23};
87 static double cvel = 29.9792458 ;
89 static unsigned short int aU[48][4][3][5000],
aD[48][4][3][5000],
tU[48][4][3][5000],
tD[48][4][3][5000];
90 static unsigned short int Z0[48][4][3][5000],
zH[48][4][3][5000],
RUD[48][4][3][5000];
91 static float Ene[48][4][3][5000];
94 static unsigned short int ipo[48][4][3];
96 static double Ze[2]={17.,407.};
140 static double dZs1[3]={-11., -9.5, -23.};
141 static double dZs2[3]={ 9.0, 10.5, 37.};
144 static Double_t
tzfunc (Double_t *
x, Double_t *par) {
145 Double_t x1=x[0]-212.;
146 Double_t
func = par[0]+par[1]*x1;
150 static Double_t
twfunc2 (Double_t *
x, Double_t *par) {
154 Double_t
func = par[1] + par[2]*pow(x1,par[3]) + par[4]*pow(x1,par[5]);
158 static Double_t
gfunc (Double_t *
x, Double_t *par) {
159 Double_t x1=x[0]-par[1];
163 func = par[0]*exp(-x1*x1/(2.*par[2]*par[2]));
247 static int goodFlag = 0;
248 static double ttU, ttD;
249 static int aaU,aaD, hend,hmodule,hsector,hlayer;
250 static double t0,x0,y0,z0, tt0;
251 static double Xs,Ys,Zs, Xh,Yh,Zh, Rh,rU,rD,zU,zD ;
252 static double x,
y,z,R, dPhi,dZ, E;
261 uint32_t trig_mask=0;
264 locEventLoop->GetSingle(trig_words);
276 vector<const DTrackTimeBased*> locTrackTimeBased;
277 locEventLoop->Get(locTrackTimeBased);
278 vector<const DChargedTrackHypothesis*> locTrackHypothesis;
279 locEventLoop->Get(locTrackHypothesis);
281 vector<const DBCALShower*> locBCALShowers;
282 locEventLoop->Get(locBCALShowers);
284 vector<const DBCALShower*> matchedShowers;
286 vector<const DBCALCluster*> locBCALClusters;
289 vector<const DBCALPoint*> matchedBCALPoints;
291 vector<const DBCALPoint*> locBCALPoints;
292 locEventLoop->Get(locBCALPoints);
294 vector<const DVertex*> kinfitVertex;
295 locEventLoop->Get(kinfitVertex);
297 vector<const DEventRFBunch*> RFbunch;
298 locEventLoop->Get(RFbunch);
301 for (
unsigned int ij=0; ij<RFbunch.size(); ij++) {
302 Nvotes = RFbunch[ij]->dNumParticleVotes;
305 vector<const DBCALUnifiedHit *> locBCALUnifiedHit;
306 locEventLoop->Get(locBCALUnifiedHit);
308 vector<const DBCALUnifiedHit *> matchedBCALUnifiedHit;
319 lock_guard<mutex> lck(
mtx);
321 for (
int ij=0; ij<1000; ij++)
busyShower[ij]=0;
323 for (
unsigned int i=0; i < locTrackTimeBased.size() ; ++i){
324 tt0 = locTrackHypothesis[i]->t0();
if (tt0<-10000.||tt0>10000.) goodFlag = 1;
325 for (
unsigned int j=0; j< locBCALShowers.size(); ++j){
327 x = locBCALShowers[j]->x;
328 y = locBCALShowers[j]->y;
329 z = locBCALShowers[j]->z;
333 locTrackTimeBased[i]->GetProjection(
SYS_BCAL, mypos);
335 dPhi = TMath::Abs(mypos.Phi()-pos_bcal.Phi());
336 dZ = TMath::Abs(mypos.Z() - z);
344 for (
unsigned int j=0; j< locBCALShowers.size(); ++j){
345 if (
busyShower[j]==0) matchedShowers.push_back(locBCALShowers[j]);
349 for (
unsigned int ij=0; ij<kinfitVertex.size(); ij++) {
350 t0= kinfitVertex[ij]->dSpacetimeVertex.T();
351 x0= kinfitVertex[ij]->dSpacetimeVertex.X();
352 y0= kinfitVertex[ij]->dSpacetimeVertex.Y();
353 z0= kinfitVertex[ij]->dSpacetimeVertex.Z();
357 for (
unsigned int ij=0; ij< matchedShowers.size(); ++ij){
363 matchedShowers[ij]->Get(matchedBCALPoints);
364 for (
unsigned int il=0; il<matchedBCALPoints.size(); il++) {
365 matchedBCALPoints[il]->Get(matchedBCALUnifiedHit);
366 for (
unsigned int ik=0; ik<matchedBCALUnifiedHit.size(); ik++) {
367 matchedBCALUnifiedHit[ik]->GetSingle(thisADCHit);
368 hlayer = thisADCHit->
layer;
372 if (hlayer==1)
E1[ij] += matchedBCALPoints[il]->E();
373 if (hlayer==3)
E3[ij] += matchedBCALPoints[il]->E();
385 for (
unsigned int ij=0; ij< matchedShowers.size(); ++ij){
387 Xs = matchedShowers[ij]->x;
388 Ys = matchedShowers[ij]->y;
389 Zs = matchedShowers[ij]->z;
392 matchedShowers[ij]->Get(matchedBCALPoints);
394 for (
unsigned int il=0; il<matchedBCALPoints.size(); il++) {
396 Rh = matchedBCALPoints[il]->r();
397 PHIp = matchedBCALPoints[il]->phi();
401 Zh = matchedBCALPoints[il]->z();
403 E = matchedBCALPoints[il]->E();
405 matchedBCALPoints[il]->Get(matchedBCALUnifiedHit);
414 for (
unsigned int ik=0; ik<matchedBCALUnifiedHit.size(); ik++) {
415 matchedBCALUnifiedHit[ik]->GetSingle(thisADCHit);
416 matchedBCALUnifiedHit[ik]->GetSingle(thisTDCHit);
418 hend = thisADCHit->
end;
419 hmodule = thisADCHit->
module;
420 hsector = thisADCHit->
sector;
421 hlayer = thisADCHit->
layer;
423 if (hend==0)
tADC_U = matchedBCALUnifiedHit[ik]->t_ADC;
424 if (hend==1)
tADC_D = matchedBCALUnifiedHit[ik]->t_ADC;
429 if (aaU>0) rU =
R0[hlayer]+
DD[hlayer]*2./aaU;
430 zU = z0 + (Zh+65.-z0) * rU/Rh;
433 r2U = (Xh-x0)*(Xh-x0)+(Yh-y0)*(Yh-y0);
439 if (aaD>0) rD =
R0[hlayer]+
DD[hlayer]*2./aaD;
440 zD = z0 + (Zh+65.-z0) * rD/Rh;
443 r2D = (Xh-x0)*(Xh-x0)+(Yh-y0)*(Yh-y0);
446 if (matchedBCALUnifiedHit[ik]->has_TDC_hit && Nvotes>=2) {
447 if (hend==0) ttU = thisTDCHit->
t;
448 if (hend==1) ttD = thisTDCHit->
t;
459 itU = 100.*(ttU - tt0);
460 itD = 100.*(ttD - tt0);
466 &&
itU>0. &&
itD>0. &&
itU<60000. && ttD<60000.
467 && aaU>5. && aaD>5. && aaU<60000. && aaD<60000.
468 && matchedBCALPoints.size()>2 && matchedBCALPoints.size()<30
469 && hlayer>0 && hlayer<4
473 &&
E13[ij]>0.1 &&
E13[ij]<10000.
520 static double f1p0,f1p1,f1p2,f1p3,f1p4,f1p5;
521 static double ff1p0,ff1p1,ff1p2,ff1p3,ff1p4,ff1p5;
523 static double f2p0,f2p1,f2p2,f2p3,f2p4,f2p5;
524 static double ff2p0,ff2p1,ff2p2,ff2p3,ff2p4,ff2p5;
526 static double f3p0,f3p1,f3p2,f3p3,f3p4,f3p5;
527 static double ff3p0,ff3p1,ff3p2,ff3p3,ff3p4,ff3p5;
529 static double f4p0,f4p1,f4p2,f4p3,f4p4,f4p5;
530 static double ff4p0,ff4p1,ff4p2,ff4p3,ff4p4,ff4p5;
532 static double xp10,xp11,xp12, xp20,xp21,xp22;
533 static double xp1,xp2,xp3,xp4,xp5, ytmp, ytmp2, Zh, pL;
534 static double veff2, zp0,zp1, veff22, zzp0,zzp1, vef3,vef33;
540 static double vef1 = 15.9;
541 static double vef2 = 16.9;
544 static double y1[5000],x1[5000],ey1[5000],ex1[5000],z1[5000],y10[5000],y20[5000];
545 static double yy1[5000],yy2[5000],xx1[5000],eyy1[5000],exx1[5000];
546 static double y2[5000],x2[5000],ey2[5000],ex2[5000];
549 static double xaU,xaD,xtU,xtD,xZ0,xZH,xRUD;
551 static double gme,gsi,egme,egsi, gme2,gsi2,egme2,egsi2, cont1,cont4;
553 static float itt1, itt2, itt3, itt4, xkoe;
556 static char *outcalname =
new char[90];
558 ofstream dat100(outcalname);
560 static char *outcalname2 =
new char[90];
561 sprintf(outcalname2,
"ccdb-BCAL_effective_velocities_regina-run%d.dat",
iRunNumber);
562 ofstream datveff(outcalname2);
564 static char *outcalname3 =
new char[90];
565 sprintf(outcalname3,
"ccdb-BCAL_timewalk_constants_regina-run%d.dat",
iRunNumber);
566 ofstream datwalk(outcalname3);
568 static char *outcalname4 =
new char[90];
570 ofstream datwarn(outcalname4);
576 static TCanvas *
c1 =
new TCanvas(
"c1",
" c1",0,0,699,499);
580 static char *pdfname =
new char[90];
581 static char *pdfname1 =
new char[90];
582 static char *pdfname2 =
new char[90];
592 c1->Update(); c1->Print(pdfname1);
600 h1 =
new TH1F(
"h1",
"Middle U",150,-50.,150.);
601 h2 =
new TH1F(
"h2",
"High U", 150,-50.,150.);
603 h3 =
new TH1F(
"h3",
"Middle D",150,-50.,150.);
604 h4 =
new TH1F(
"h4",
"High D", 150,-50.,150.);
612 his4 =
new TH1F(
"his4",
" ",200,-8.,12.);
613 his4->GetXaxis()->SetTitle(
"Corrected #DeltaTime (ns)");
614 his4->GetYaxis()->SetTitle(
"Counts");
617 his4->SetLineColor(1);
618 his4->SetLineWidth(1.9);
619 his4->SetFillStyle(1001);
620 his4->SetFillColor(kGreen-7);
623 his44 =
new TH1F(
"his44",
" ",200,-8.,12.);
624 his44->GetXaxis()->SetTitle(
"Corrected #DeltaTime (ns)");
625 his44->GetYaxis()->SetTitle(
"Counts");
628 his44->SetLineColor(1);
629 his44->SetLineWidth(1.9);
630 his44->SetFillStyle(1001);
631 his44->SetFillColor(kGreen-7);
638 { cout<<endl<<
"************ Imo="<<
imo<<
" Ise="<<
ise<<
" Ila="<<
ila<<
" *******************************"<<endl<<endl;
651 pL =(xZH-xZ0)*(xZH-xZ0);
652 pL =
sqrt(pL+xRUD*xRUD);
654 y1[ipo2]=xtU-pL/
cvel-abs(xZH-
Ze[0])/vef1;
655 y2[ipo2]=xtD-pL/
cvel-abs(xZH-
Ze[1])/vef2;
656 if (y1[ipo2]>-20.&&y1[ipo2]<30.&&y2[ipo2]>-20.&&y2[ipo2]<30.&&
Ene[
imo][
ise][
ila][
ip]>0.
657 &&xZH>
Ze[0]&&xZH<
Ze[1]) {
675 for (
int ip=0;
ip<ipo2;
ip++) {
676 if (x1[
ip]>10.&&x1[
ip]<20.)
h1->Fill(y1[
ip]);
677 if (x1[ip]>50.&&x1[ip]<100.)
h2->Fill(y1[ip]);
679 if (x2[ip]>10.&&x2[ip]<20.)
h3->Fill(y2[ip]);
680 if (x2[ip]>50.&&x2[ip]<100.)
h4->Fill(y2[ip]);
683 cout<<endl<<
"1st Iteration: "<<ipo2<<
" events in the plot."<<endl<<endl;
686 xp10 = (
h2->GetMean()) - 7.;
687 xp12 = log((
h2->GetMean()-xp10)/(
h1->GetMean()-xp10))/log(60./15.) -0.1;
688 xp11 = (
h2->GetMean()-xp10)/pow(60.,xp12);
690 cout<<endl<<
"xp10="<<xp10<<
" xp11="<<xp11<<
" xp12="<<xp12<<endl;
692 xp20 = (
h4->GetMean()) - 7.;
693 xp22 = log((
h4->GetMean()-xp20)/(
h3->GetMean()-xp20))/log(60./15.);
694 xp21 = (
h4->GetMean()-xp20)/pow(60.,xp22);
696 cout<<
"xp20="<<xp20<<
" xp21="<<xp21<<
" xp22="<<xp22<<endl;
703 fgg10->SetParameter(0,2.5);
704 fgg10->SetParLimits(0,0.,4.9);
707 fgg10->SetParameter(1,xp1);
708 fgg10->SetParLimits(1,xp1-4.,xp1+4.);
711 fgg10->SetParameter(2,xp2);
712 fgg10->SetParLimits(2,10.,50.);
715 fgg10->SetParameter(3,xp3);
716 fgg10->SetParLimits(3,-0.55,-0.2);
719 fgg10->SetParameter(4,xp4);
720 fgg10->SetParLimits(4,100.,1000000.);
723 fgg10->SetParameter(5,xp5);
724 fgg10->SetParLimits(5,-5.5,-2.5);
726 fgg10->SetLineColor(4);
727 fgg10->SetLineWidth(1.);
729 gr01 =
new TGraphErrors(ipo2,x1,y1,ex1,ey1);
730 gr01->Fit(
"fgg10",
"MER");
731 f1p0 =
fgg10->GetParameter(0);
732 f1p1 =
fgg10->GetParameter(1);
733 f1p2 =
fgg10->GetParameter(2);
734 f1p3 =
fgg10->GetParameter(3);
735 f1p4 =
fgg10->GetParameter(4);
736 f1p5 =
fgg10->GetParameter(5);
738 cout<<
"-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-"<<endl;
742 fgg20->SetParameter(0,2.5);
743 fgg20->SetParLimits(0,0.,4.9);
746 fgg20->SetParameter(1,xp1);
747 fgg20->SetParLimits(1,xp1-4.,xp1+4.);
750 fgg20->SetParameter(2,xp2);
751 fgg20->SetParLimits(2,10.,50.);
754 fgg20->SetParameter(3,xp3);
755 fgg20->SetParLimits(3,-0.55,-0.2);
758 fgg20->SetParameter(4,xp4);
759 fgg20->SetParLimits(4,100.,1000000.);
762 fgg20->SetParameter(5,xp5);
763 fgg20->SetParLimits(5,-5.5,-2.5);
765 fgg20->SetLineColor(4);
766 fgg20->SetLineWidth(1.);
768 gr11 =
new TGraphErrors(ipo2,x2,y2,ex2,ey2);
769 gr11->Fit(
"fgg20",
"MER");
770 ff1p0 =
fgg20->GetParameter(0);
771 ff1p1 =
fgg20->GetParameter(1);
772 ff1p2 =
fgg20->GetParameter(2);
773 ff1p3 =
fgg20->GetParameter(3);
774 ff1p4 =
fgg20->GetParameter(4);
775 ff1p5 =
fgg20->GetParameter(5);
781 for (
int ii=0; ii<ipo2; ii++) {
782 ytmp=y1[ii]-f1p1-f1p2*pow((x1[ii]-f1p0),f1p3)-f1p4*pow((x1[ii]-f1p0),f1p5);
783 ytmp2=y2[ii]-ff1p1-ff1p2*pow((x2[ii]-ff1p0),ff1p3)-ff1p4*pow((x2[ii]-ff1p0),ff1p5);
785 if (abs(ytmp)<3.&&abs(ytmp2)<3.) {
796 fz1->SetLineColor(2);
797 fz1->SetLineWidth(1.);
799 fz1->SetParameter(0,0.);
800 fz1->SetParLimits(0,-0.9,0.9);
801 fz1->SetParameter(1,0.0);
802 fz1->SetParLimits(1,-0.02,0.02);
804 gr02 =
new TGraphErrors(ipo3,x1,y1,ex1,ey1);
805 gr02->Fit(
"fz1",
"MER");
806 zp0 =
fz1->GetParameter(0);
807 zp1 =
fz1->GetParameter(1);
808 veff2 = vef1/(1+vef1*zp1);
813 fz2->SetLineColor(2);
814 fz2->SetLineWidth(1.);
816 fz2->SetParameter(0,0.);
817 fz2->SetParLimits(0,-0.9,0.9);
818 fz2->SetParameter(1,0.0);
819 fz2->SetParLimits(1,-0.02,0.02);
821 gr12 =
new TGraphErrors(ipo3,x1,y2,ex1,ey1);
822 gr12->Fit(
"fz2",
"MER");
823 zzp0 =
fz2->GetParameter(0);
824 zzp1 =
fz2->GetParameter(1);
825 veff22 = vef2/(1-vef2*zzp1);
838 if (veff2<15.7) veff2=16.2;
839 if (veff2>16.7) veff2=16.2;
840 if (veff22<16.2) veff22=16.8;
841 if (veff22>17.2) veff22=16.8;
843 cout<<endl<<
"1st veff2="<<veff2<<
" veff22="<<veff22<<endl<<endl;
864 ytmp = xtU-f1p1-f1p2*pow((xaU-f1p0),f1p3)-f1p4*pow((xaU-f1p0),f1p5);
865 ytmp2= xtD-ff1p1-ff1p2*pow((xaD-ff1p0),ff1p3)-ff1p4*pow((xaD-ff1p0),ff1p5);
867 Zh = ((ytmp-ytmp2)*veff2*veff22 +
Ze[0]*veff22 +
Ze[1]*veff2)/(veff2 + veff22);
868 pL = (Zh-xZ0)*(Zh-xZ0);
869 pL =
sqrt(pL + xRUD*xRUD);
871 ytmp = ytmp-pL/
cvel-abs(Zh-
Ze[0])/veff2;
872 ytmp2 = ytmp2-pL/
cvel-abs(Zh-
Ze[1])/veff22;
874 y1[ipo2]=xtU-pL/
cvel-abs(Zh-
Ze[0])/veff2;
875 y2[ipo2]=xtD-pL/
cvel-abs(Zh-
Ze[1])/veff22;
878 if (y1[ipo2]>-20.&&y1[ipo2]<30.&&y2[ipo2]>-20.&&y2[ipo2]<30.&&
Ene[
imo][
ise][
ila][
ip]>0.&&abs(ytmp)<8.*xkoe&&abs(ytmp2)<8.*xkoe
879 &&Zh>
Ze[0]&&Zh<
Ze[1]) {
896 if ((itt2/itt1)<0.9) {
911 cout<<
"Itt2 reset: xkoe = "<<xkoe<<endl;
914 cout<<endl<<
"2nd Iteration: "<<ipo2<<
" events in the plot."<<endl<<endl;
919 fgg10->SetParameter(0,2.5);
920 fgg10->SetParLimits(0,0.,4.9);
923 fgg10->SetParameter(1,xp1);
924 fgg10->SetParLimits(1,xp1-1.,xp1+1.);
927 fgg10->SetParameter(2,xp2);
928 fgg10->SetParLimits(2,0.8*xp2,1.2*xp2);
931 fgg10->SetParameter(3,xp3);
932 fgg10->SetParLimits(3,xp3-0.1,xp3+0.1);
935 fgg10->SetParameter(4,xp4);
936 fgg10->SetParLimits(4,0.8*xp4,1.2*xp4);
939 fgg10->SetParameter(5,xp5);
940 fgg10->SetParLimits(5,xp5-0.1,xp5+0.1);
942 fgg10->SetLineColor(4);
943 fgg10->SetLineWidth(1.);
945 gr01 =
new TGraphErrors(ipo2,x1,y1,ex1,ey1);
946 gr01->Fit(
"fgg10",
"MER");
947 f2p0 =
fgg10->GetParameter(0);
948 f2p1 =
fgg10->GetParameter(1);
949 f2p2 =
fgg10->GetParameter(2);
950 f2p3 =
fgg10->GetParameter(3);
951 f2p4 =
fgg10->GetParameter(4);
952 f2p5 =
fgg10->GetParameter(5);
954 cout<<
"-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-"<<endl;
958 fgg20->SetParameter(0,2.5);
959 fgg20->SetParLimits(0,0.,4.9);
962 fgg20->SetParameter(1,xp1);
963 fgg20->SetParLimits(1,xp1-1.,xp1+1.);
966 fgg20->SetParameter(2,xp2);
967 fgg20->SetParLimits(2,0.8*xp2,1.2*xp2);
970 fgg20->SetParameter(3,xp3);
971 fgg20->SetParLimits(3,xp3-0.1,xp3+0.1);
974 fgg20->SetParameter(4,xp4);
975 fgg20->SetParLimits(4,0.8*xp4,1.2*xp4);
978 fgg20->SetParameter(5,xp5);
979 fgg20->SetParLimits(5,xp5-0.1,xp5+0.1);
981 fgg20->SetLineColor(4);
982 fgg20->SetLineWidth(1.);
984 gr11 =
new TGraphErrors(ipo2,x2,y2,ex2,ey2);
985 gr11->Fit(
"fgg20",
"MER");
986 ff2p0 =
fgg20->GetParameter(0);
987 ff2p1 =
fgg20->GetParameter(1);
988 ff2p2 =
fgg20->GetParameter(2);
989 ff2p3 =
fgg20->GetParameter(3);
990 ff2p4 =
fgg20->GetParameter(4);
991 ff2p5 =
fgg20->GetParameter(5);
997 for (
int ii=0; ii<ipo2; ii++) {
998 ytmp=y1[ii]-f2p1-f2p2*pow((x1[ii]-f2p0),f2p3)-f2p4*pow((x1[ii]-f2p0),f2p5);
999 ytmp2=y2[ii]-ff2p1-ff2p2*pow((x2[ii]-ff2p0),ff2p3)-ff2p4*pow((x2[ii]-ff2p0),ff2p5);
1001 if (abs(ytmp)<3. && abs(ytmp2)<3.) {
1011 fz1 =
new TF1(
"fz1",
tzfunc, 10.,420.,2);
1012 fz1->SetLineColor(2);
1013 fz1->SetLineWidth(1.);
1015 fz1->SetParameter(0,0.);
1016 fz1->SetParLimits(0,-0.9,0.9);
1017 fz1->SetParameter(1,0.0);
1018 fz1->SetParLimits(1,-0.1,0.1);
1020 gr02 =
new TGraphErrors(ipo3,xx1,yy1,exx1,eyy1);
1021 gr02->Fit(
"fz1",
"MER");
1022 zp0 =
fz1->GetParameter(0);
1023 zp1 =
fz1->GetParameter(1);
1024 veff2 = veff2/(1+veff2*zp1);
1028 fz2 =
new TF1(
"fz2",
tzfunc, 10.,420.,2);
1029 fz2->SetLineColor(2);
1030 fz2->SetLineWidth(1.);
1032 fz2->SetParameter(0,0.);
1033 fz2->SetParLimits(0,-0.9,0.9);
1034 fz2->SetParameter(1,0.0);
1035 fz2->SetParLimits(1,-0.02,0.02);
1037 gr12 =
new TGraphErrors(ipo3,xx1,yy2,exx1,eyy1);
1038 gr12->Fit(
"fz2",
"MER");
1039 zzp0 =
fz2->GetParameter(0);
1040 zzp1 =
fz2->GetParameter(1);
1041 veff22 = veff22/(1-veff22*zzp1);
1054 if (veff2<15.7) veff2=16.2;
1055 if (veff2>16.7) veff2=16.2;
1056 if (veff22<16.2) veff22=16.8;
1057 if (veff22>17.2) veff22=16.8;
1059 cout<<endl<<
"2nd veff2="<<veff2<<
" veff22="<<veff22<<endl<<endl;
1081 ytmp = xtU-f2p1-f2p2*pow((xaU-f2p0),f2p3)-f2p4*pow((xaU-f2p0),f2p5);
1082 ytmp2= xtD-ff2p1-ff2p2*pow((xaD-ff2p0),ff2p3)-ff2p4*pow((xaD-ff2p0),ff2p5);
1084 Zh = ((ytmp-ytmp2)*veff2*veff22 +
Ze[0]*veff22 +
Ze[1]*veff2)/(veff2 + veff22);
1085 pL = (Zh-xZ0)*(Zh-xZ0);
1086 pL =
sqrt(pL + xRUD*xRUD);
1088 ytmp = ytmp-pL/
cvel-abs(Zh-
Ze[0])/veff2;
1089 ytmp2 = ytmp2-pL/
cvel-abs(Zh-
Ze[1])/veff22;
1091 y1[ipo2]=xtU-pL/
cvel-abs(Zh-
Ze[0])/veff2;
1092 y2[ipo2]=xtD-pL/
cvel-abs(Zh-
Ze[1])/veff22;
1095 if (y1[ipo2]>-20.&&y1[ipo2]<30.&&y2[ipo2]>-20.&&y2[ipo2]<30.&&
Ene[
imo][
ise][
ila][
ip]>0.&&abs(ytmp)<5.*xkoe&&abs(ytmp2)<5.*xkoe
1096 &&Zh>
Ze[0]&&Zh<
Ze[1]) {
1113 if ((itt3/itt2)<0.9) {
1127 cout<<
"Itt3 reset: xkoe = "<<xkoe<<endl;
1130 cout<<endl<<
"3rd Iteration: "<<ipo2<<
" events in the plot."<<endl<<endl;
1135 fgg10->SetParameter(0,f2p0);
1136 fgg10->SetParLimits(0,0.,4.9);
1139 fgg10->SetParameter(1,xp1);
1140 fgg10->SetParLimits(1,xp1-1.,xp1+1.);
1143 fgg10->SetParameter(2,xp2);
1144 fgg10->SetParLimits(2,0.9*xp2,1.1*xp2);
1147 fgg10->SetParameter(3,xp3);
1148 fgg10->SetParLimits(3,xp3-0.1,xp3+0.1);
1151 fgg10->SetParameter(4,xp4);
1152 fgg10->SetParLimits(4,0.9*xp4,1.1*xp4);
1155 fgg10->SetParameter(5,xp5);
1156 fgg10->SetParLimits(5,xp5-0.1,xp5+0.1);
1158 fgg10->SetLineColor(4);
1159 fgg10->SetLineWidth(1.);
1161 gr01 =
new TGraphErrors(ipo2,x1,y1,ex1,ey1);
1162 gr01->Fit(
"fgg10",
"MER");
1163 f3p0 =
fgg10->GetParameter(0);
1164 f3p1 =
fgg10->GetParameter(1);
1165 f3p2 =
fgg10->GetParameter(2);
1166 f3p3 =
fgg10->GetParameter(3);
1167 f3p4 =
fgg10->GetParameter(4);
1168 f3p5 =
fgg10->GetParameter(5);
1170 cout<<
"-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-"<<endl;
1174 fgg20->SetParameter(0,ff2p0);
1175 fgg20->SetParLimits(0,0.,4.9);
1178 fgg20->SetParameter(1,xp1);
1179 fgg20->SetParLimits(1,xp1-1.,xp1+1.);
1182 fgg20->SetParameter(2,xp2);
1183 fgg20->SetParLimits(2,0.9*xp2,1.1*xp2);
1186 fgg20->SetParameter(3,xp3);
1187 fgg20->SetParLimits(3,xp3-0.1,xp3+0.1);
1190 fgg20->SetParameter(4,xp4);
1191 fgg20->SetParLimits(4,0.9*xp4,1.1*xp4);
1194 fgg20->SetParameter(5,xp5);
1195 fgg20->SetParLimits(5,xp5-0.1,xp5+0.1);
1197 fgg20->SetLineColor(4);
1198 fgg20->SetLineWidth(1.);
1200 gr11 =
new TGraphErrors(ipo2,x2,y2,ex2,ey2);
1201 gr11->Fit(
"fgg20",
"MER");
1202 ff3p0 =
fgg20->GetParameter(0);
1203 ff3p1 =
fgg20->GetParameter(1);
1204 ff3p2 =
fgg20->GetParameter(2);
1205 ff3p3 =
fgg20->GetParameter(3);
1206 ff3p4 =
fgg20->GetParameter(4);
1207 ff3p5 =
fgg20->GetParameter(5);
1213 for (
int ii=0; ii<ipo2; ii++) {
1214 ytmp=y1[ii]-f3p1-f3p2*pow((x1[ii]-f3p0),f3p3)-f3p4*pow((x1[ii]-f3p0),f3p5);
1215 ytmp2=y2[ii]-ff3p1-ff3p2*pow((x2[ii]-ff3p0),ff3p3)-ff3p4*pow((x2[ii]-ff3p0),ff3p5);
1217 if (abs(ytmp)<2.5 && abs(ytmp2)<2.5) {
1227 fz1 =
new TF1(
"fz1",
tzfunc, 10.,420.,2);
1228 fz1->SetLineColor(2);
1229 fz1->SetLineWidth(1.);
1231 fz1->SetParameter(0,0.);
1232 fz1->SetParLimits(0,-0.9,0.9);
1233 fz1->SetParameter(1,0.0);
1234 fz1->SetParLimits(1,-0.1,0.1);
1236 gr02 =
new TGraphErrors(ipo3,xx1,yy1,exx1,eyy1);
1237 gr02->Fit(
"fz1",
"MER");
1238 zp0 =
fz1->GetParameter(0);
1239 zp1 =
fz1->GetParameter(1);
1240 veff2 = veff2/(1+veff2*zp1);
1244 fz2 =
new TF1(
"fz2",
tzfunc, 10.,420.,2);
1245 fz2->SetLineColor(2);
1246 fz2->SetLineWidth(1.);
1248 fz2->SetParameter(0,0.);
1249 fz2->SetParLimits(0,-0.9,0.9);
1250 fz2->SetParameter(1,0.0);
1251 fz2->SetParLimits(1,-0.02,0.02);
1253 gr12 =
new TGraphErrors(ipo3,xx1,yy2,exx1,eyy1);
1254 gr12->Fit(
"fz2",
"MER");
1255 zzp0 =
fz2->GetParameter(0);
1256 zzp1 =
fz2->GetParameter(1);
1257 veff22 = veff22/(1-veff22*zzp1);
1270 if (veff2<15.7) veff2=16.2;
1271 if (veff2>16.7) veff2=16.2;
1272 if (veff22<16.2) veff22=16.8;
1273 if (veff22>17.2) veff22=16.8;
1275 cout<<endl<<
"3rd veff2="<<veff2<<
" veff22="<<veff22<<endl<<endl;
1300 ytmp = xtU-f3p1-f3p2*pow((xaU-f3p0),f3p3)-f3p4*pow((xaU-f3p0),f3p5);
1301 ytmp2= xtD-ff3p1-ff3p2*pow((xaD-ff3p0),ff3p3)-ff3p4*pow((xaD-ff3p0),ff3p5);
1303 Zh = ((ytmp-ytmp2)*veff2*veff22 +
Ze[0]*veff22 +
Ze[1]*veff2)/(veff2 + veff22);
1304 pL = (Zh-xZ0)*(Zh-xZ0);
1305 pL =
sqrt(pL + xRUD*xRUD);
1307 ytmp = ytmp-pL/
cvel-abs(Zh-
Ze[0])/veff2;
1308 ytmp2 = ytmp2-pL/
cvel-abs(Zh-
Ze[1])/veff22;
1310 y1[ipo2]=xtU-pL/
cvel-abs(Zh-
Ze[0])/veff2;
1311 y2[ipo2]=xtD-pL/
cvel-abs(Zh-
Ze[1])/veff22;
1314 if (y1[ipo2]>-20.&&y1[ipo2]<30.&&y2[ipo2]>-20.&&y2[ipo2]<30.&&
Ene[
imo][
ise][
ila][
ip]>0.&&abs(ytmp)<5.*xkoe&&abs(ytmp2)<5.*xkoe
1315 &&Zh>
Ze[0]&&Zh<
Ze[1]) {
1332 if ((itt4/itt3)<0.9) {
1346 cout<<
"Itt4 reset: xkoe = "<<xkoe<<endl;
1349 cout<<endl<<
"4th Iteration: "<<ipo2<<
" events in the plot."<<endl<<endl;
1355 fgg10->SetParameter(0,f3p0);
1356 fgg10->SetParLimits(0,0.,4.9);
1359 fgg10->SetParameter(1,xp1);
1360 fgg10->SetParLimits(1,xp1-1.,xp1+1.);
1363 fgg10->SetParameter(2,xp2);
1364 fgg10->SetParLimits(2,0.9*xp2,1.1*xp2);
1367 fgg10->SetParameter(3,xp3);
1368 fgg10->SetParLimits(3,xp3-0.05,xp3+0.05);
1371 fgg10->SetParameter(4,xp4);
1372 fgg10->SetParLimits(4,0.9*xp4,1.1*xp4);
1375 fgg10->SetParameter(5,xp5);
1376 fgg10->SetParLimits(5,xp5-0.05,xp5+0.05);
1378 fgg10->SetLineColor(4);
1379 fgg10->SetLineWidth(1.);
1381 gr01 =
new TGraphErrors(ipo2,x1,y1,ex1,ey1);
1382 gr01->Fit(
"fgg10",
"MER");
1383 f4p0 =
fgg10->GetParameter(0);
1384 f4p1 =
fgg10->GetParameter(1);
1385 f4p2 =
fgg10->GetParameter(2);
1386 f4p3 =
fgg10->GetParameter(3);
1387 f4p4 =
fgg10->GetParameter(4);
1388 f4p5 =
fgg10->GetParameter(5);
1390 cout<<
"-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-"<<endl;
1394 fgg20->SetParameter(0,ff3p0);
1395 fgg20->SetParLimits(0,0.,4.9);
1398 fgg20->SetParameter(1,xp1);
1399 fgg20->SetParLimits(1,xp1-1.,xp1+1.);
1402 fgg20->SetParameter(2,xp2);
1403 fgg20->SetParLimits(2,0.9*xp2,1.1*xp2);
1406 fgg20->SetParameter(3,xp3);
1407 fgg20->SetParLimits(3,xp3-0.05,xp3+0.05);
1410 fgg20->SetParameter(4,xp4);
1411 fgg20->SetParLimits(4,0.9*xp4,1.1*xp4);
1414 fgg20->SetParameter(5,xp5);
1415 fgg20->SetParLimits(5,xp5-0.05,xp5+0.05);
1417 fgg20->SetLineColor(4);
1418 fgg20->SetLineWidth(1.);
1420 gr11 =
new TGraphErrors(ipo2,x2,y2,ex2,ey2);
1421 gr11->Fit(
"fgg20",
"MER");
1422 ff4p0 =
fgg20->GetParameter(0);
1423 ff4p1 =
fgg20->GetParameter(1);
1424 ff4p2 =
fgg20->GetParameter(2);
1425 ff4p3 =
fgg20->GetParameter(3);
1426 ff4p4 =
fgg20->GetParameter(4);
1427 ff4p5 =
fgg20->GetParameter(5);
1433 for (
int ii=0; ii<ipo2; ii++) {
1434 ytmp=y1[ii]-f4p1-f4p2*pow((x1[ii]-f4p0),f4p3)-f4p4*pow((x1[ii]-f4p0),f4p5);
1435 ytmp2=y2[ii]-ff4p1-ff4p2*pow((x2[ii]-ff4p0),ff4p3)-ff4p4*pow((x2[ii]-ff4p0),ff4p5);
1437 if (abs(ytmp)<2.5 && abs(ytmp2)<2.5) {
1447 fz1 =
new TF1(
"fz1",
tzfunc, 10.,420.,2);
1448 fz1->SetLineColor(2);
1449 fz1->SetLineWidth(1.);
1451 fz1->SetParameter(0,0.);
1452 fz1->SetParLimits(0,-0.9,0.9);
1453 fz1->SetParameter(1,0.0);
1454 fz1->SetParLimits(1,-0.1,0.1);
1456 gr02 =
new TGraphErrors(ipo3,xx1,yy1,exx1,eyy1);
1457 gr02->Fit(
"fz1",
"MER");
1458 zp0 =
fz1->GetParameter(0);
1459 zp1 =
fz1->GetParameter(1);
1460 veff2 = veff2/(1+veff2*zp1);
1464 fz2 =
new TF1(
"fz2",
tzfunc, 10.,420.,2);
1465 fz2->SetLineColor(2);
1466 fz2->SetLineWidth(1.);
1468 fz2->SetParameter(0,0.);
1469 fz2->SetParLimits(0,-0.9,0.9);
1470 fz2->SetParameter(1,0.0);
1471 fz2->SetParLimits(1,-0.02,0.02);
1473 gr12 =
new TGraphErrors(ipo3,xx1,yy2,exx1,eyy1);
1474 gr12->Fit(
"fz2",
"MER");
1475 zzp0 =
fz2->GetParameter(0);
1476 zzp1 =
fz2->GetParameter(1);
1477 veff22 = veff22/(1-veff22*zzp1);
1479 cout<<endl<<
"4th veff2="<<veff2<<
" veff22="<<veff22<<endl<<endl;
1483 for (
int ii=0; ii<ipo2; ii++) {
1485 y10[ii]=y1[ii]-f4p1-f4p2*pow((x1[ii]-f4p0),f4p3)-f4p4*pow((x1[ii]-f4p0),f4p5);
1486 his4->Fill(y10[ii]);
1487 y20[ii]=y2[ii]-ff4p1-ff4p2*pow((x2[ii]-ff4p0),ff4p3)-ff4p4*pow((x2[ii]-ff4p0),ff4p5);
1488 his44->Fill(y20[ii]);
1492 fgau =
new TF1(
"fgau",
gfunc,-0.55,0.85,3);
1494 fgau->SetParameter(1,0.);
1495 fgau->SetParameter(2,0.4);
1496 his4->Fit(
"fgau",
"",
"MERQ",-0.75,0.75);
1497 gme =
fgau->GetParameter(1);
1498 gsi =
fgau->GetParameter(2);
1499 egme =
fgau->GetParError(1);
1500 egsi =
fgau->GetParError(2);
1504 fgau2->SetParameter(1,0.);
1505 fgau2->SetParameter(2,0.4);
1506 his44->Fit(
"fgau2",
"",
"MERQ",-0.75,0.75);
1507 gme2 =
fgau2->GetParameter(1);
1508 gsi2 =
fgau2->GetParameter(2);
1509 egme2 =
fgau2->GetParError(1);
1510 egsi2 =
fgau2->GetParError(2);
1512 dat100<<
imo+1<<
" "<<
ise+1<<
" "<<
ila+1<<
" 0 "
1513 <<f4p0<<
" "<<f4p1<<
" "<<f4p2<<
" "<<f4p3<<
" "<<f4p4<<
" "<<f4p5<<
" "
1514 <<zp0<<
" "<<zp1<<
" "
1515 <<gme<<
" "<<egme<<
" "<<gsi<<
" "<<egsi<<
" "
1516 <<vef3<<
" "<<veff2<<endl;
1517 dat100<<
imo+1<<
" "<<
ise+1<<
" "<<
ila+1<<
" 1 "
1518 <<ff4p0<<
" "<<ff4p1<<
" "<<ff4p2<<
" "<<ff4p3<<
" "<<ff4p4<<
" "<<ff4p5<<
" "
1519 <<zzp0<<
" "<<zzp1<<
" "
1520 <<gme2<<
" "<<egme2<<
" "<<gsi2<<
" "<<egsi2<<
" "
1521 <<vef33<<
" "<<veff22<<endl;
1523 datveff<<
imo+1<<
" "<<
ila+1<<
" "<<
ise+1<<
" "<<veff2<<
" "<<veff22<<endl;
1525 datwalk<<
imo+1<<
" "<<
ise+1<<
" "<<
ila+1<<
" 0 "
1526 <<f4p0<<
" "<<f4p1+gme<<
" "<<f4p2<<
" "<<f4p3<<
" "<<f4p4<<
" "<<f4p5<<endl;
1527 datwalk<<
imo+1<<
" "<<
ise+1<<
" "<<
ila+1<<
" 1 "
1528 <<ff4p0<<
" "<<ff4p1+gme2<<
" "<<ff4p2<<
" "<<ff4p3<<
" "<<ff4p4<<
" "<<ff4p5<<endl;
1530 if (abs(gme)>0.250) datwarn<<
"Shifted Mean: M="<<
imo+1<<
" S="<<
ise+1<<
" L="<<
ila+1<<
" E=0 "<<endl;
1531 if (abs(gme2)>0.250) datwarn<<
"Shifted Mean: M="<<
imo+1<<
" S="<<
ise+1<<
" L="<<
ila+1<<
" E=1 "<<endl;
1533 if (abs(gsi)>0.60) datwarn<<
"Big Sigma: M="<<
imo+1<<
" S="<<
ise+1<<
" L="<<
ila+1<<
" E=0 "<<endl;
1534 if (abs(gsi2)>0.60) datwarn<<
"Big Sigma: M="<<
imo+1<<
" S="<<
ise+1<<
" L="<<
ila+1<<
" E=1 "<<endl;
1536 if (abs(gsi)<0.10) datwarn<<
"Small Sigma: M="<<
imo+1<<
" S="<<
ise+1<<
" L="<<
ila+1<<
" E=0 "<<endl;
1537 if (abs(gsi2)<0.10) datwarn<<
"Small Sigma: M="<<
imo+1<<
" S="<<
ise+1<<
" L="<<
ila+1<<
" E=1 "<<endl;
1539 if (cont4<0.5*cont1) datwarn<<
"Lost Statistics: M="<<
imo+1<<
" S="<<
ise+1<<
" L="<<
ila+1<<endl;
1544 gStyle->SetOptFit(1110);
1545 c1->Range(0.1875,-81.7688,3.3125,735.919);
1546 c1->SetBorderSize(2);
1547 c1->SetFrameFillColor(0);
1550 c1->SetTitle(
"Datafile: ");
1554 gStyle->SetCanvasBorderMode(0);
1555 gStyle->SetOptFit(220);
1556 gStyle->SetOptStat(2220);
1557 gStyle->SetPalette(1);
1562 gStyle->SetStatW(0.25);
1563 gStyle->SetStatH(0.12);
1564 gStyle->SetStatX(0.93);
1565 gStyle->SetStatY(0.92);
1567 gStyle->SetTitleW(0.9);
1568 gStyle->SetTitleH(0.08);
1582 gStyle->SetTitleSize(0.6,
"t");
1594 gPad->SetFillColor(0);
1596 gPad->SetTopMargin(0.13);
1597 gPad->SetBottomMargin(0.17);
1598 gPad->SetLeftMargin(0.1);
1599 gPad->SetRightMargin(0.1);
1602 gr1 =
new TGraph(ipo2,x1,y1);
1604 gr1->GetXaxis()->SetTitle(
"Pulse Peak");
1605 gr1->GetXaxis()->SetLimits(4.5,3000.0);
1606 gr1->SetMinimum(-15.0);
1607 gr1->SetMaximum(25.0);
1608 gr1->GetYaxis()->SetNdivisions(810);
1609 gr1->GetYaxis()->SetTitle(
"Uncorrected #DeltaTime (ns)");
1610 gr1->SetMarkerColor(2);
1612 gr1->SetMarkerStyle(20);
1613 gr1->SetMarkerSize(0.3);
1616 fgg10->Draw(
"Same");
1620 ftxt =
new char[90];
1621 sprintf(
ftxt,
"f(X) = %5.2f + %4.2f#upoint(X-%4.2f)^{%5.2f}",f4p1,f4p2,f4p0,f4p3);
1622 ftxt2 =
new char[90];
1623 sprintf(
ftxt2,
" + %4.2f#upoint(X-%4.2f)^{%5.2f}",f4p4,f4p0,f4p5);
1625 txt1->SetTextFont(52);
1626 txt1->SetTextColor(4);
1629 txt2->SetTextFont(52);
1630 txt2->SetTextColor(4);
1636 gPad->SetFillColor(0);
1638 gPad->SetTopMargin(0.13);
1639 gPad->SetBottomMargin(0.17);
1640 gPad->SetLeftMargin(0.1);
1641 gPad->SetRightMargin(0.1);
1644 gr3 =
new TGraph(ipo2,x1,y10);
1646 gr3->GetXaxis()->SetTitle(
"Pulse Peak");
1647 gr3->GetXaxis()->SetLimits(4.5,3000.);
1648 gr3->SetMinimum(-10.0);
1649 gr3->SetMaximum(14.0);
1650 gr3->GetYaxis()->SetNdivisions(810);
1651 gr3->GetYaxis()->SetTitle(
"Corrected #DeltaTime (ns)");
1652 gr3->SetMarkerColor(4);
1654 gr3->SetMarkerStyle(20);
1655 gr3->SetMarkerSize(0.3);
1658 lin1 =
new TLine(5.,0.,2000.,0.);
1659 lin1->SetLineColor(2);
1667 gPad->SetFillColor(0);
1669 gPad->SetTopMargin(0.13);
1670 gPad->SetBottomMargin(0.17);
1671 gPad->SetLeftMargin(0.1);
1672 gPad->SetRightMargin(0.1);
1675 gr2 =
new TGraph(ipo3,xx1,yy1);
1677 gr2->GetXaxis()->SetTitle(
"Z-Coordinate (cm)");
1679 gr2->SetMinimum(-5.0);
1680 gr2->SetMaximum(5.0);
1681 gr2->GetYaxis()->SetNdivisions(810);
1682 gr2->GetYaxis()->SetTitle(
"Corrected #DeltaTime (ns)");
1683 gr2->SetMarkerColor(4);
1685 gr2->SetMarkerStyle(20);
1686 gr2->SetMarkerSize(0.3);
1691 ftxt3 =
new char[90];
1694 txt3->SetTextFont(52);
1695 txt3->SetTextColor(2);
1698 ftxt4 =
new char[90];
1701 txt4->SetTextFont(52);
1702 txt4->SetTextColor(4);
1719 gPad->SetFillColor(0);
1721 gPad->SetTopMargin(0.13);
1722 gPad->SetBottomMargin(0.17);
1723 gPad->SetLeftMargin(0.1);
1724 gPad->SetRightMargin(0.1);
1727 gr1 =
new TGraph(ipo2,x2,y2);
1729 gr1->GetXaxis()->SetTitle(
"Pulse Peak");
1730 gr1->GetXaxis()->SetLimits(4.5,3000.0);
1731 gr1->SetMinimum(-15.0);
1732 gr1->SetMaximum(25.0);
1733 gr1->GetYaxis()->SetNdivisions(810);
1734 gr1->GetYaxis()->SetTitle(
"Uncorrected #DeltaTime (ns)");
1735 gr1->SetMarkerColor(2);
1737 gr1->SetMarkerStyle(20);
1738 gr1->SetMarkerSize(0.3);
1741 fgg20->Draw(
"Same");
1745 ftxt =
new char[90];
1746 sprintf(
ftxt,
"f(X) = %5.2f + %4.2f#upoint(X-%4.2f)^{%5.2f}",ff4p1,ff4p2,ff4p0,ff4p3);
1747 ftxt2 =
new char[90];
1748 sprintf(
ftxt2,
" + %4.2f#upoint(X-%4.2f)^{%5.2f}",ff4p4,ff4p0,ff4p5);
1750 txt1->SetTextFont(52);
1751 txt1->SetTextColor(4);
1754 txt2->SetTextFont(52);
1755 txt2->SetTextColor(4);
1761 gPad->SetFillColor(0);
1763 gPad->SetTopMargin(0.13);
1764 gPad->SetBottomMargin(0.17);
1765 gPad->SetLeftMargin(0.1);
1766 gPad->SetRightMargin(0.1);
1769 TGraph *
gr3 =
new TGraph(ipo2,x2,y20);
1771 gr3->GetXaxis()->SetTitle(
"Pulse Peak");
1772 gr3->GetXaxis()->SetLimits(4.5,3000.0);
1773 gr3->SetMinimum(-10.0);
1774 gr3->SetMaximum(14.0);
1775 gr3->GetYaxis()->SetNdivisions(810);
1776 gr3->GetYaxis()->SetTitle(
"Corrected #DeltaTime (ns)");
1777 gr3->SetMarkerColor(4);
1779 gr3->SetMarkerStyle(20);
1780 gr3->SetMarkerSize(0.3);
1783 lin1 =
new TLine(5.,0.,2000.,0.);
1784 lin1->SetLineColor(2);
1790 gPad->SetFillColor(0);
1792 gPad->SetTopMargin(0.13);
1793 gPad->SetBottomMargin(0.17);
1794 gPad->SetLeftMargin(0.1);
1795 gPad->SetRightMargin(0.1);
1798 gr2 =
new TGraph(ipo3,xx1,yy2);
1800 gr2->GetXaxis()->SetTitle(
"Z-Coordinate (cm)");
1802 gr2->SetMinimum(-5.0);
1803 gr2->SetMaximum(5.0);
1804 gr2->GetYaxis()->SetNdivisions(810);
1805 gr2->GetYaxis()->SetTitle(
"Corrected #DeltaTime (ns)");
1806 gr2->SetMarkerColor(4);
1808 gr2->SetMarkerStyle(20);
1809 gr2->SetMarkerSize(0.3);
1814 ftxt3 =
new char[90];
1815 sprintf(
ftxt3,
"Optimal v_{eff} = %5.2f cm/ns",veff22);
1817 txt3->SetTextFont(52);
1818 txt3->SetTextColor(2);
1821 ftxt4 =
new char[90];
1824 txt4->SetTextFont(52);
1825 txt4->SetTextColor(4);
1877 c1->Print(pdfname2);
static Double_t twfunc2(Double_t *x, Double_t *par)
static unsigned short int aD[48][4][3][5000]
static unsigned short int Z0[48][4][3][5000]
sprintf(text,"Post KinFit Cut")
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
static TGraphErrors * gr02
static TGraphErrors * gr12
static TGraphErrors * gr01
jerror_t init(void)
Called once at program start.
static Double_t tzfunc(Double_t *x, Double_t *par)
static unsigned short int aU[48][4][3][5000]
~JEventProcessor_BCAL_TimeCalibration()
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
static unsigned short int zH[48][4][3][5000]
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
static TGraphErrors * gr11
static int busyShower[1000]
static float Ene[48][4][3][5000]
jerror_t fini(void)
Called after last event of last event source has been processed.
double func(double *x, double *par)
static unsigned short int RUD[48][4][3][5000]
static unsigned short int tD[48][4][3][5000]
static unsigned short int ipo[48][4][3]
static Double_t gfunc(Double_t *x, Double_t *par)
static unsigned short int tU[48][4][3][5000]
JEventProcessor_BCAL_TimeCalibration()