602 |
eplane[view][plane] += mip; |
eplane[view][plane] += mip; |
603 |
}; |
}; |
604 |
// |
// |
605 |
// inclination factor (steal from Daniele's code) |
// inclination factor (stolen from Daniele's code) |
606 |
// |
// |
607 |
Float_t ytgx = 0; |
Float_t ytgx = 0; |
608 |
Float_t ytgy = 0; |
Float_t ytgy = 0; |
706 |
// th = new TH1F(thid,thid,int(NC*1.5),-0.2,xmax); |
// th = new TH1F(thid,thid,int(NC*1.5),-0.2,xmax); |
707 |
th = new TH1F(thid,thid,100,-0.2,xmax); |
th = new TH1F(thid,thid,100,-0.2,xmax); |
708 |
// |
// |
709 |
for (Int_t st=N;st<(N+NC);st++){ |
// AGH, BUG! |
710 |
|
// |
711 |
|
Int_t mmin = 0; |
712 |
|
Int_t mmax = 0; |
713 |
|
if ( cont ){ |
714 |
|
mmin = N; |
715 |
|
mmax = NC+N; |
716 |
|
} else { |
717 |
|
mmin = 0; |
718 |
|
mmax = NC; |
719 |
|
}; |
720 |
|
// |
721 |
|
Float_t qtotparz = 0.; |
722 |
|
for (Int_t st=mmin;st<mmax+1;st++){ |
723 |
enemip = 0.; |
enemip = 0.; |
724 |
xpos = (st - N) * X0pl; |
xpos = (st - mmin) * X0pl; |
725 |
if ( st > N && st < (N+NC-1) ){ |
if ( st > mmin && st < mmax ){ |
726 |
if ( no18x && ( st == 18+1 || st == mask18b+1 )){ |
if ( no18x && ( st == 18+1 || st == mask18b+1 )){ |
727 |
enemip = 2. * eplane[1][st]; |
enemip = 2. * eplane[1][st]; |
728 |
} else { |
} else { |
729 |
enemip = eplane[0][st-1] + eplane[1][st]; |
enemip = eplane[0][st-1] + eplane[1][st]; |
730 |
}; |
}; |
731 |
} else { |
} else { |
732 |
if ( st == N ) enemip = 2. * eplane[1][st]; |
if ( st == mmin ) enemip = 2. * eplane[1][st]; |
733 |
if ( st == (N+NC-1) ) enemip = 2. * eplane[0][st]; |
if ( st == mmax ) enemip = 2. * eplane[0][st-1]; |
734 |
}; |
}; |
735 |
// |
// |
736 |
|
qtotparz += enemip; |
737 |
if ( enemip > 0. ){ |
if ( enemip > 0. ){ |
738 |
th->Fill(xpos,enemip); |
th->Fill(xpos,enemip); |
739 |
if ( debug ) printf(" Filling: st %i xpos %f energy %f \n",st,xpos,enemip); |
if ( debug ) printf(" Filling: st %i xpos %f energy %f \n",st,xpos,enemip); |
764 |
}; |
}; |
765 |
// |
// |
766 |
TF1 *lfit = new TF1("lfit",ccurve,0.,xmax,3); |
TF1 *lfit = new TF1("lfit",ccurve,0.,xmax,3); |
767 |
E0 = L2->GetCaloLevel2()->qtot; |
if ( debug ) printf("qtot %f qtotparz %f \n",L2->GetCaloLevel2()->qtot,qtotparz); |
768 |
|
E0 = qtotparz; |
769 |
|
// E0 = L2->GetCaloLevel2()->qtot; |
770 |
a = 5.; |
a = 5.; |
771 |
b = 0.5; |
b = 0.5; |
772 |
if ( debug ) printf(" STARTING PARAMETERS: E0 %f a %f b %f \n",E0,a,b); |
if ( debug ) printf(" STARTING PARAMETERS: E0 %f a %f b %f \n",E0,a,b); |
835 |
if ( debug ) printf(" i10max == imax, asymm undefined\n"); |
if ( debug ) printf(" i10max == imax, asymm undefined\n"); |
836 |
asymm = -2.; |
asymm = -2.; |
837 |
}; |
}; |
838 |
|
if ( asymm != asymm ){ |
839 |
|
if ( debug ) printf(" asymm is nan \n"); |
840 |
|
asymm = -3.; |
841 |
|
}; |
842 |
//lfit->Integral(0.,tmax)/(lfit->Integral(0.,10.*tmax)-lfit->Integral(0.,tmax)); |
//lfit->Integral(0.,tmax)/(lfit->Integral(0.,10.*tmax)-lfit->Integral(0.,tmax)); |
843 |
if ( debug ) printf(" Asymmetry has been calculated \n"); |
if ( debug ) printf(" Asymmetry has been calculated \n"); |
844 |
}; |
}; |
845 |
// |
// |
846 |
|
if ( asymm < 0. || ndf <= 0. || chi2 < 0. || tmax < 0. ){ |
847 |
|
if ( debug ) printf(" Funny asymm||ndf||chi2||tmax values, fit failed \n"); |
848 |
|
fitresult = 100; |
849 |
|
}; |
850 |
|
// |
851 |
if ( draw ){ |
if ( draw ){ |
852 |
// |
// |
853 |
tc->cd(); |
tc->cd(); |
867 |
gStyle->SetLabelSize(0); |
gStyle->SetLabelSize(0); |
868 |
gStyle->SetNdivisions(1,"XY"); |
gStyle->SetNdivisions(1,"XY"); |
869 |
// |
// |
870 |
|
} else { |
871 |
|
if ( th ) th->Delete(); |
872 |
}; |
}; |
873 |
// |
// |
874 |
delete lfit; |
delete lfit; |