1 |
|
|
2 |
****************************************************************************** |
****************************************************************************** |
3 |
* |
* |
4 |
* 08-12-06 WM: adc_c-bug : The raw ADc value was multiplied with cos(theta) |
* 08-12-06 WM: adc_c-bug : The raw ADc value was multiplied with cos(theta) |
15 |
* jan-07 WM: flag for PMTs #10 and #35 added, TDC=819 due to bit-shift |
* jan-07 WM: flag for PMTs #10 and #35 added, TDC=819 due to bit-shift |
16 |
* jan-07 WM: bug removed: in some cases tdc_tw was calculated due to a |
* jan-07 WM: bug removed: in some cases tdc_tw was calculated due to a |
17 |
* leftover "xhelp" value |
* leftover "xhelp" value |
18 |
|
* apr-07 WM: attenuation fit curve is now a double exponential fit |
19 |
|
* conversion from raw ADC to pC using calibration function |
20 |
|
* variables xtr_tof and ytr_tof inserted (filled with default) |
21 |
****************************************************************************** |
****************************************************************************** |
22 |
|
|
23 |
INTEGER FUNCTION TOFL2COM() |
INTEGER FUNCTION TOFL2COM() |
47 |
INTEGER tof11_j,tof21_j,tof31_j |
INTEGER tof11_j,tof21_j,tof31_j |
48 |
INTEGER tof12_j,tof22_j,tof32_j |
INTEGER tof12_j,tof22_j,tof32_j |
49 |
|
|
|
|
|
50 |
REAL beta_mean |
REAL beta_mean |
51 |
|
|
52 |
|
|
72 |
INTEGER ihelp |
INTEGER ihelp |
73 |
REAL xkorr |
REAL xkorr |
74 |
|
|
75 |
|
real atten,pc_adc |
76 |
|
|
77 |
C--------------------------------------- |
C--------------------------------------- |
78 |
C |
C |
79 |
C Begin ! |
C Begin ! |
90 |
secure = 2. |
secure = 2. |
91 |
|
|
92 |
C ratio between helium and proton ca. 4 |
C ratio between helium and proton ca. 4 |
93 |
hepratio = 4.5 ! |
hepratio = 4. ! |
94 |
offset = 1 |
offset = 1 |
95 |
slope = 2 |
slope = 2 |
96 |
left = 1 |
left = 1 |
141 |
enddo |
enddo |
142 |
enddo |
enddo |
143 |
|
|
144 |
|
|
145 |
|
C--- Fill xtr_tof and ytr_tof: positions from tracker at ToF layers |
146 |
|
C--- since this is standalone ToF fill with default values |
147 |
|
do j=1,6 |
148 |
|
xtr_tof(j) = 101. |
149 |
|
ytr_tof(j) = 101. |
150 |
|
enddo |
151 |
|
|
152 |
c the calibration files are read in the main program from xxx_tofcalib.rz |
c the calibration files are read in the main program from xxx_tofcalib.rz |
153 |
|
|
154 |
|
|
155 |
c-------------------------get ToF data -------------------------------- |
c-------------------------get ToF data -------------------------------- |
156 |
|
|
157 |
c put the adc and tdc values from ntuple into tofxx(i,j,k) variables |
c put the adc and tdc values from ntuple into tofxx(i,j,k) variables |
158 |
|
c adc valueas are then pC |
159 |
|
|
160 |
do j=1,8 |
do j=1,8 |
161 |
tof11(1,j,2) = adc(ch11a(j),hb11a(j)) |
tof11(1,j,2) = pc_adc(adc(ch11a(j),hb11a(j))) |
162 |
tof11(2,j,2) = adc(ch11b(j),hb11b(j)) |
tof11(2,j,2) = pc_adc(adc(ch11b(j),hb11b(j))) |
163 |
tof11(1,j,1) = tdc(ch11a(j),hb11a(j)) |
tof11(1,j,1) = (tdc(ch11a(j),hb11a(j))) |
164 |
tof11(2,j,1) = tdc(ch11b(j),hb11b(j)) |
tof11(2,j,1) = (tdc(ch11b(j),hb11b(j))) |
165 |
enddo |
enddo |
166 |
|
|
167 |
|
|
168 |
do j=1,6 |
do j=1,6 |
169 |
tof12(1,j,2) = adc(ch12a(j),hb12a(j)) |
tof12(1,j,2) = pc_adc(adc(ch12a(j),hb12a(j))) |
170 |
tof12(2,j,2) = adc(ch12b(j),hb12b(j)) |
tof12(2,j,2) = pc_adc(adc(ch12b(j),hb12b(j))) |
171 |
tof12(1,j,1) = tdc(ch12a(j),hb12a(j)) |
tof12(1,j,1) = (tdc(ch12a(j),hb12a(j))) |
172 |
tof12(2,j,1) = tdc(ch12b(j),hb12b(j)) |
tof12(2,j,1) = (tdc(ch12b(j),hb12b(j))) |
173 |
enddo |
enddo |
174 |
|
|
175 |
do j=1,2 |
do j=1,2 |
176 |
tof21(1,j,2) = adc(ch21a(j),hb21a(j)) |
tof21(1,j,2) = pc_adc(adc(ch21a(j),hb21a(j))) |
177 |
tof21(2,j,2) = adc(ch21b(j),hb21b(j)) |
tof21(2,j,2) = pc_adc(adc(ch21b(j),hb21b(j))) |
178 |
tof21(1,j,1) = tdc(ch21a(j),hb21a(j)) |
tof21(1,j,1) = (tdc(ch21a(j),hb21a(j))) |
179 |
tof21(2,j,1) = tdc(ch21b(j),hb21b(j)) |
tof21(2,j,1) = (tdc(ch21b(j),hb21b(j))) |
180 |
enddo |
enddo |
181 |
|
|
182 |
do j=1,2 |
do j=1,2 |
183 |
tof22(1,j,2) = adc(ch22a(j),hb22a(j)) |
tof22(1,j,2) = pc_adc(adc(ch22a(j),hb22a(j))) |
184 |
tof22(2,j,2) = adc(ch22b(j),hb22b(j)) |
tof22(2,j,2) = pc_adc(adc(ch22b(j),hb22b(j))) |
185 |
tof22(1,j,1) = tdc(ch22a(j),hb22a(j)) |
tof22(1,j,1) = (tdc(ch22a(j),hb22a(j))) |
186 |
tof22(2,j,1) = tdc(ch22b(j),hb22b(j)) |
tof22(2,j,1) = (tdc(ch22b(j),hb22b(j))) |
187 |
enddo |
enddo |
188 |
|
|
189 |
do j=1,3 |
do j=1,3 |
190 |
tof31(1,j,2) = adc(ch31a(j),hb31a(j)) |
tof31(1,j,2) = pc_adc(adc(ch31a(j),hb31a(j))) |
191 |
tof31(2,j,2) = adc(ch31b(j),hb31b(j)) |
tof31(2,j,2) = pc_adc(adc(ch31b(j),hb31b(j))) |
192 |
tof31(1,j,1) = tdc(ch31a(j),hb31a(j)) |
tof31(1,j,1) = (tdc(ch31a(j),hb31a(j))) |
193 |
tof31(2,j,1) = tdc(ch31b(j),hb31b(j)) |
tof31(2,j,1) = (tdc(ch31b(j),hb31b(j))) |
194 |
enddo |
enddo |
195 |
|
|
196 |
do j=1,3 |
do j=1,3 |
197 |
tof32(1,j,2) = adc(ch32a(j),hb32a(j)) |
tof32(1,j,2) = pc_adc(adc(ch32a(j),hb32a(j))) |
198 |
tof32(2,j,2) = adc(ch32b(j),hb32b(j)) |
tof32(2,j,2) = pc_adc(adc(ch32b(j),hb32b(j))) |
199 |
tof32(1,j,1) = tdc(ch32a(j),hb32a(j)) |
tof32(1,j,1) = (tdc(ch32a(j),hb32a(j))) |
200 |
tof32(2,j,1) = tdc(ch32b(j),hb32b(j)) |
tof32(2,j,1) = (tdc(ch32b(j),hb32b(j))) |
201 |
enddo |
enddo |
202 |
|
|
203 |
C---------------------------------------------------------------------- |
C---------------------------------------------------------------------- |
302 |
tdcflagtof(ch22b(2),hb22b(2))=2 |
tdcflagtof(ch22b(2),hb22b(2))=2 |
303 |
endif |
endif |
304 |
|
|
|
|
|
305 |
C---------------------------------------------------------------- |
C---------------------------------------------------------------- |
306 |
C------------ Check Paddles for hits ----------------------- |
C------------ Check Paddles for hits ----------------------- |
307 |
C------ a "hit" means TDC values<4095 on both sides ------------ |
C------ a "hit" means TDC values<4095 on both sides ------------ |
638 |
|
|
639 |
IF (tof11_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
IF (tof11_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
640 |
i = tof11_i |
i = tof11_i |
641 |
if (tof11(left,i,iadc).eq.4095) then |
c if (tof11(left,i,iadc).eq.4095) then |
642 |
xkorr=adcx11(left,i,1)*exp(-yhelp/adcx11(left,i,2)) |
if (adc(ch11a(i),hb11a(i)).eq.4095) then |
643 |
|
xkorr = atten(left,11,i,yhelp) |
644 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
645 |
tof11(left,i,iadc)=xkorr/cos(theta13) |
tof11(left,i,iadc)=xkorr/cos(theta13) |
646 |
c write(*,*) 'tofl2 left ',i, tof11(left,i,iadc) |
c write(*,*) 'tofl2 left ',i, tof11(left,i,iadc) |
647 |
adcflagtof(ch11a(i),hb11a(i)) = 1 |
adcflagtof(ch11a(i),hb11a(i)) = 1 |
648 |
endif |
endif |
649 |
if (tof11(right,i,iadc).eq.4095) then |
c if (tof11(right,i,iadc).eq.4095) then |
650 |
xkorr=adcx11(right,i,1)*exp(yhelp/adcx11(right,i,2)) |
if (adc(ch11b(i),hb11b(i)).eq.4095) then |
651 |
|
xkorr = atten(right,11,i,yhelp) |
652 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
653 |
tof11(right,i,iadc)=xkorr/cos(theta13) |
tof11(right,i,iadc)=xkorr/cos(theta13) |
654 |
c write(*,*) 'tofl2 right ',i, tof11(right,i,iadc) |
c write(*,*) 'tofl2 right ',i, tof11(right,i,iadc) |
662 |
|
|
663 |
IF (tof12_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
IF (tof12_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
664 |
i = tof12_i |
i = tof12_i |
665 |
if (tof12(left,i,iadc).eq.4095) then |
c if (tof12(left,i,iadc).eq.4095) then |
666 |
xkorr=adcx12(left,i,1)*exp(-xhelp/adcx12(left,i,2)) |
if (adc(ch12a(i),hb12a(i)).eq.4095) then |
667 |
|
xkorr = atten(left,12,i,xhelp) |
668 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
669 |
tof12(left,i,iadc) = xkorr/cos(theta13) |
tof12(left,i,iadc) = xkorr/cos(theta13) |
670 |
adcflagtof(ch12a(i),hb12a(i)) = 1 |
adcflagtof(ch12a(i),hb12a(i)) = 1 |
671 |
endif |
endif |
672 |
if (tof12(right,i,iadc).eq.4095) then |
c if (tof12(right,i,iadc).eq.4095) then |
673 |
xkorr=adcx12(right,i,1)*exp(xhelp/adcx12(right,i,2)) |
if (adc(ch12b(i),hb12b(i)).eq.4095) then |
674 |
|
xkorr = atten(right,12,i,xhelp) |
675 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
676 |
tof12(right,i,iadc) = xkorr/cos(theta13) |
tof12(right,i,iadc) = xkorr/cos(theta13) |
677 |
adcflagtof(ch12b(i),hb12b(i)) = 1 |
adcflagtof(ch12b(i),hb12b(i)) = 1 |
686 |
|
|
687 |
IF (tof21_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
IF (tof21_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
688 |
i = tof21_i |
i = tof21_i |
689 |
if (tof21(left,i,iadc).eq.4095) then |
c if (tof21(left,i,iadc).eq.4095) then |
690 |
xkorr=adcx21(left,i,1)*exp(-xhelp/adcx21(left,i,2)) |
if (adc(ch21a(i),hb21a(i)).eq.4095) then |
691 |
|
xkorr = atten(left,21,i,xhelp) |
692 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
693 |
tof21(left,i,iadc) = xkorr/cos(theta13) |
tof21(left,i,iadc) = xkorr/cos(theta13) |
694 |
adcflagtof(ch21a(i),hb21a(i)) = 1 |
adcflagtof(ch21a(i),hb21a(i)) = 1 |
695 |
endif |
endif |
696 |
if (tof21(right,i,iadc).eq.4095) then |
c if (tof21(right,i,iadc).eq.4095) then |
697 |
xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
if (adc(ch21b(i),hb21b(i)).eq.4095) then |
698 |
|
xkorr = atten(right,21,i,xhelp) |
699 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
700 |
tof21(right,i,iadc) = xkorr/cos(theta13) |
tof21(right,i,iadc) = xkorr/cos(theta13) |
701 |
adcflagtof(ch21b(i),hb21b(i)) = 1 |
adcflagtof(ch21b(i),hb21b(i)) = 1 |
709 |
|
|
710 |
IF (tof22_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
IF (tof22_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
711 |
i = tof22_i |
i = tof22_i |
712 |
if (tof22(left,i,iadc).eq.4095) then |
c if (tof22(left,i,iadc).eq.4095) then |
713 |
xkorr=adcx22(left,i,1)*exp(-yhelp/adcx22(left,i,2)) |
if (adc(ch22a(i),hb22a(i)).eq.4095) then |
714 |
|
xkorr = atten(left,22,i,yhelp) |
715 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
716 |
tof22(left,i,iadc) = xkorr/cos(theta13) |
tof22(left,i,iadc) = xkorr/cos(theta13) |
717 |
adcflagtof(ch22a(i),hb22a(i)) = 1 |
adcflagtof(ch22a(i),hb22a(i)) = 1 |
718 |
endif |
endif |
719 |
if (tof22(right,i,iadc).eq.4095) then |
c if (tof22(right,i,iadc).eq.4095) then |
720 |
xkorr=adcx22(right,i,1)*exp(yhelp/adcx22(right,i,2)) |
if (adc(ch22b(i),hb22b(i)).eq.4095) then |
721 |
|
xkorr = atten(right,22,i,yhelp) |
722 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
723 |
tof22(right,i,iadc) = xkorr/cos(theta13) |
tof22(right,i,iadc) = xkorr/cos(theta13) |
724 |
adcflagtof(ch22b(i),hb22b(i)) = 1 |
adcflagtof(ch22b(i),hb22b(i)) = 1 |
733 |
|
|
734 |
IF (tof31_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
IF (tof31_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
735 |
i = tof31_i |
i = tof31_i |
736 |
if (tof31(left,i,iadc).eq.4095) then |
c if (tof31(left,i,iadc).eq.4095) then |
737 |
xkorr=adcx31(left,i,1)*exp(-yhelp/adcx31(left,i,2)) |
if (adc(ch31a(i),hb31a(i)).eq.4095) then |
738 |
|
xkorr = atten(left,31,i,yhelp) |
739 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
740 |
tof31(left,i,iadc) = xkorr/cos(theta13) |
tof31(left,i,iadc) = xkorr/cos(theta13) |
741 |
adcflagtof(ch31a(i),hb31a(i)) = 1 |
adcflagtof(ch31a(i),hb31a(i)) = 1 |
742 |
endif |
endif |
743 |
if (tof31(right,i,iadc).eq.4095) then |
c if (tof31(right,i,iadc).eq.4095) then |
744 |
xkorr=adcx31(right,i,1)*exp(yhelp/adcx31(right,i,2)) |
if (adc(ch31b(i),hb31b(i)).eq.4095) then |
745 |
|
xkorr = atten(right,31,i,yhelp) |
746 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
747 |
tof31(right,i,iadc) = xkorr/cos(theta13) |
tof31(right,i,iadc) = xkorr/cos(theta13) |
748 |
adcflagtof(ch31b(i),hb31b(i)) = 1 |
adcflagtof(ch31b(i),hb31b(i)) = 1 |
755 |
|
|
756 |
IF (tof32_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
IF (tof32_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
757 |
i = tof32_i |
i = tof32_i |
758 |
if (tof32(left,i,iadc).eq.4095) then |
c if (tof32(left,i,iadc).eq.4095) then |
759 |
xkorr=adcx32(left,i,1)*exp(-xhelp/adcx32(left,i,2)) |
if (adc(ch32a(i),hb32a(i)).eq.4095) then |
760 |
|
xkorr = atten(left,32,i,xhelp) |
761 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
762 |
tof32(left,i,iadc) = xkorr/cos(theta13) |
tof32(left,i,iadc) = xkorr/cos(theta13) |
763 |
adcflagtof(ch32a(i),hb32a(i)) = 1 |
adcflagtof(ch32a(i),hb32a(i)) = 1 |
764 |
endif |
endif |
765 |
if (tof32(right,i,iadc).eq.4095) then |
c if (tof32(right,i,iadc).eq.4095) then |
766 |
xkorr=adcx32(right,i,1)*exp(xhelp/adcx32(right,i,2)) |
if (adc(ch32b(i),hb32b(i)).eq.4095) then |
767 |
|
xkorr = atten(right,32,i,xhelp) |
768 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
769 |
tof32(right,i,iadc) = xkorr/cos(theta13) |
tof32(right,i,iadc) = xkorr/cos(theta13) |
770 |
adcflagtof(ch32b(i),hb32b(i)) = 1 |
adcflagtof(ch32b(i),hb32b(i)) = 1 |
780 |
xhelp= 0. |
xhelp= 0. |
781 |
xhelp_a = tof11(left,i,iadc) |
xhelp_a = tof11(left,i,iadc) |
782 |
xhelp_t = tof11(left,i,itdc) |
xhelp_t = tof11(left,i,itdc) |
783 |
if(xhelp_a<4095) xhelp = tw11(left,i)/sqrt(xhelp_a) |
c if (xhelp_a .eq.0) write (*,*) '11 ',i,xhelp_a |
784 |
|
if(xhelp_a<3786) xhelp = tw11(left,i)/sqrt(xhelp_a) |
785 |
tof11(left,i,itdc) = xhelp_t + xhelp |
tof11(left,i,itdc) = xhelp_t + xhelp |
786 |
tdc_c(ch11a(i),hb11a(i))=tof11(left,i,itdc) |
tdc_c(ch11a(i),hb11a(i))=tof11(left,i,itdc) |
787 |
xhelp_a = tof11(right,i,iadc) |
xhelp_a = tof11(right,i,iadc) |
788 |
xhelp_t = tof11(right,i,itdc) |
xhelp_t = tof11(right,i,itdc) |
789 |
if(xhelp_a<4095) xhelp = tw11(right,i)/sqrt(xhelp_a) |
if(xhelp_a<3786) xhelp = tw11(right,i)/sqrt(xhelp_a) |
790 |
tof11(right,i,itdc) = xhelp_t + xhelp |
tof11(right,i,itdc) = xhelp_t + xhelp |
791 |
tdc_c(ch11b(i),hb11b(i))=tof11(right,i,itdc) |
tdc_c(ch11b(i),hb11b(i))=tof11(right,i,itdc) |
792 |
ENDDO |
ENDDO |
795 |
xhelp= 0. |
xhelp= 0. |
796 |
xhelp_a = tof12(left,i,iadc) |
xhelp_a = tof12(left,i,iadc) |
797 |
xhelp_t = tof12(left,i,itdc) |
xhelp_t = tof12(left,i,itdc) |
798 |
if(xhelp_a<4095) xhelp = tw12(left,i)/sqrt(xhelp_a) |
c if (xhelp_a .eq.0) write (*,*) '12 ',i,xhelp_a |
799 |
|
if(xhelp_a<3786) xhelp = tw12(left,i)/sqrt(xhelp_a) |
800 |
tof12(left,i,itdc) = xhelp_t + xhelp |
tof12(left,i,itdc) = xhelp_t + xhelp |
801 |
tdc_c(ch12a(i),hb12a(i))=tof12(left,i,itdc) |
tdc_c(ch12a(i),hb12a(i))=tof12(left,i,itdc) |
802 |
xhelp_a = tof12(right,i,iadc) |
xhelp_a = tof12(right,i,iadc) |
803 |
xhelp_t = tof12(right,i,itdc) |
xhelp_t = tof12(right,i,itdc) |
804 |
if(xhelp_a<4095) xhelp = tw12(right,i)/sqrt(xhelp_a) |
if(xhelp_a<3786) xhelp = tw12(right,i)/sqrt(xhelp_a) |
805 |
tof12(right,i,itdc) = xhelp_t + xhelp |
tof12(right,i,itdc) = xhelp_t + xhelp |
806 |
tdc_c(ch12b(i),hb12b(i))=tof12(right,i,itdc) |
tdc_c(ch12b(i),hb12b(i))=tof12(right,i,itdc) |
807 |
ENDDO |
ENDDO |
810 |
xhelp= 0. |
xhelp= 0. |
811 |
xhelp_a = tof21(left,i,iadc) |
xhelp_a = tof21(left,i,iadc) |
812 |
xhelp_t = tof21(left,i,itdc) |
xhelp_t = tof21(left,i,itdc) |
813 |
if(xhelp_a<4095) xhelp = tw21(left,i)/sqrt(xhelp_a) |
c if (xhelp_a .eq.0) write (*,*) '21 ',i,xhelp_a |
814 |
|
if(xhelp_a<3786) xhelp = tw21(left,i)/sqrt(xhelp_a) |
815 |
tof21(left,i,itdc) = xhelp_t + xhelp |
tof21(left,i,itdc) = xhelp_t + xhelp |
816 |
tdc_c(ch21a(i),hb21a(i))=tof21(left,i,itdc) |
tdc_c(ch21a(i),hb21a(i))=tof21(left,i,itdc) |
817 |
xhelp_a = tof21(right,i,iadc) |
xhelp_a = tof21(right,i,iadc) |
818 |
xhelp_t = tof21(right,i,itdc) |
xhelp_t = tof21(right,i,itdc) |
819 |
if(xhelp_a<4095) xhelp = tw21(right,i)/sqrt(xhelp_a) |
if(xhelp_a<3786) xhelp = tw21(right,i)/sqrt(xhelp_a) |
820 |
tof21(right,i,itdc) = xhelp_t + xhelp |
tof21(right,i,itdc) = xhelp_t + xhelp |
821 |
tdc_c(ch21b(i),hb21b(i))=tof21(right,i,itdc) |
tdc_c(ch21b(i),hb21b(i))=tof21(right,i,itdc) |
822 |
ENDDO |
ENDDO |
825 |
xhelp= 0. |
xhelp= 0. |
826 |
xhelp_a = tof22(left,i,iadc) |
xhelp_a = tof22(left,i,iadc) |
827 |
xhelp_t = tof22(left,i,itdc) |
xhelp_t = tof22(left,i,itdc) |
828 |
if(xhelp_a<4095) xhelp = tw22(left,i)/sqrt(xhelp_a) |
c if (xhelp_a .eq.0) write (*,*) '22 ',i,xhelp_a |
829 |
|
|
830 |
|
if(xhelp_a<3786) xhelp = tw22(left,i)/sqrt(xhelp_a) |
831 |
tof22(left,i,itdc) = xhelp_t + xhelp |
tof22(left,i,itdc) = xhelp_t + xhelp |
832 |
tdc_c(ch22a(i),hb22a(i))=tof22(left,i,itdc) |
tdc_c(ch22a(i),hb22a(i))=tof22(left,i,itdc) |
833 |
xhelp_a = tof22(right,i,iadc) |
xhelp_a = tof22(right,i,iadc) |
834 |
xhelp_t = tof22(right,i,itdc) |
xhelp_t = tof22(right,i,itdc) |
835 |
if(xhelp_a<4095) xhelp = tw22(right,i)/sqrt(xhelp_a) |
if(xhelp_a<3786) xhelp = tw22(right,i)/sqrt(xhelp_a) |
836 |
tof22(right,i,itdc) = xhelp_t + xhelp |
tof22(right,i,itdc) = xhelp_t + xhelp |
837 |
tdc_c(ch22b(i),hb22b(i))=tof22(right,i,itdc) |
tdc_c(ch22b(i),hb22b(i))=tof22(right,i,itdc) |
838 |
ENDDO |
ENDDO |
842 |
xhelp= 0. |
xhelp= 0. |
843 |
xhelp_a = tof31(left,i,iadc) |
xhelp_a = tof31(left,i,iadc) |
844 |
xhelp_t = tof31(left,i,itdc) |
xhelp_t = tof31(left,i,itdc) |
845 |
if(xhelp_a<4095) xhelp = tw31(left,i)/sqrt(xhelp_a) |
c if (xhelp_a .eq.0) write (*,*) '31 ',i,xhelp_a |
846 |
|
|
847 |
|
if(xhelp_a<3786) xhelp = tw31(left,i)/sqrt(xhelp_a) |
848 |
tof31(left,i,itdc) = xhelp_t + xhelp |
tof31(left,i,itdc) = xhelp_t + xhelp |
849 |
tdc_c(ch31a(i),hb31a(i))=tof31(left,i,itdc) |
tdc_c(ch31a(i),hb31a(i))=tof31(left,i,itdc) |
850 |
xhelp_a = tof31(right,i,iadc) |
xhelp_a = tof31(right,i,iadc) |
851 |
xhelp_t = tof31(right,i,itdc) |
xhelp_t = tof31(right,i,itdc) |
852 |
if(xhelp_a<4095) xhelp = tw31(right,i)/sqrt(xhelp_a) |
if(xhelp_a<3786) xhelp = tw31(right,i)/sqrt(xhelp_a) |
853 |
tof31(right,i,itdc) = xhelp_t + xhelp |
tof31(right,i,itdc) = xhelp_t + xhelp |
854 |
tdc_c(ch31b(i),hb31b(i))=tof31(right,i,itdc) |
tdc_c(ch31b(i),hb31b(i))=tof31(right,i,itdc) |
855 |
ENDDO |
ENDDO |
858 |
xhelp= 0. |
xhelp= 0. |
859 |
xhelp_a = tof32(left,i,iadc) |
xhelp_a = tof32(left,i,iadc) |
860 |
xhelp_t = tof32(left,i,itdc) |
xhelp_t = tof32(left,i,itdc) |
861 |
if(xhelp_a<4095) xhelp = tw32(left,i)/sqrt(xhelp_a) |
c if (xhelp_a .eq.0) write (*,*) '32 ',i,xhelp_a |
862 |
|
|
863 |
|
if(xhelp_a<3786) xhelp = tw32(left,i)/sqrt(xhelp_a) |
864 |
tof32(left,i,itdc) = xhelp_t + xhelp |
tof32(left,i,itdc) = xhelp_t + xhelp |
865 |
tdc_c(ch32a(i),hb32a(i))=tof32(left,i,itdc) |
tdc_c(ch32a(i),hb32a(i))=tof32(left,i,itdc) |
866 |
xhelp_a = tof32(right,i,iadc) |
xhelp_a = tof32(right,i,iadc) |
867 |
xhelp_t = tof32(right,i,itdc) |
xhelp_t = tof32(right,i,itdc) |
868 |
if(xhelp_a<4095) xhelp = tw32(right,i)/sqrt(xhelp_a) |
if(xhelp_a<3786) xhelp = tw32(right,i)/sqrt(xhelp_a) |
869 |
tof32(right,i,itdc) = xhelp_t + xhelp |
tof32(right,i,itdc) = xhelp_t + xhelp |
870 |
tdc_c(ch32b(i),hb32b(i))=tof32(right,i,itdc) |
tdc_c(ch32b(i),hb32b(i))=tof32(right,i,itdc) |
871 |
ENDDO |
ENDDO |
889 |
IF (tof11_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
IF (tof11_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
890 |
|
|
891 |
i = tof11_i |
i = tof11_i |
892 |
if (tof11(left,i,iadc).lt.4095) then |
if (tof11(left,i,iadc).lt.3786) then |
893 |
|
c if (adc(ch11a(i),hb11a(i)).lt.4095) then |
894 |
tof11(left,i,iadc) = tof11(left,i,iadc)*cos(theta13) |
tof11(left,i,iadc) = tof11(left,i,iadc)*cos(theta13) |
895 |
xkorr=adcx11(left,i,1)*exp(-yhelp/adcx11(left,i,2)) |
xkorr = atten(left,11,i,yhelp) |
896 |
|
c write(40+i,*) yhelp,xkorr |
897 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
898 |
adctof_c(ch11a(i),hb11a(i))=tof11(left,i,iadc)/xkorr |
adctof_c(ch11a(i),hb11a(i))=tof11(left,i,iadc)/xkorr |
899 |
endif |
endif |
900 |
|
|
901 |
if (tof11(right,i,iadc).lt.4095) then |
if (tof11(right,i,iadc).lt.3786) then |
902 |
|
c if (adc(ch11b(i),hb11b(i)).lt.4095) then |
903 |
tof11(right,i,iadc) = tof11(right,i,iadc)*cos(theta13) |
tof11(right,i,iadc) = tof11(right,i,iadc)*cos(theta13) |
904 |
xkorr=adcx11(right,i,1)*exp(yhelp/adcx11(right,i,2)) |
xkorr = atten(right,11,i,yhelp) |
905 |
|
c write(40+i,*) yhelp,xkorr |
906 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
907 |
adctof_c(ch11b(i),hb11b(i))=tof11(right,i,iadc)/xkorr |
adctof_c(ch11b(i),hb11b(i))=tof11(right,i,iadc)/xkorr |
908 |
endif |
endif |
915 |
IF (tof12_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
IF (tof12_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
916 |
|
|
917 |
i = tof12_i |
i = tof12_i |
918 |
if (tof12(left,i,iadc).lt.4095) then |
if (tof12(left,i,iadc).lt.3786) then |
919 |
|
c if (adc(ch12a(i),hb12a(i)).lt.4095) then |
920 |
tof12(left,i,iadc) = tof12(left,i,iadc)*cos(theta13) |
tof12(left,i,iadc) = tof12(left,i,iadc)*cos(theta13) |
921 |
xkorr=adcx12(left,i,1)*exp(-xhelp/adcx12(left,i,2)) |
xkorr = atten(left,12,i,xhelp) |
922 |
|
c write(50+i,*) xhelp,xkorr |
923 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
924 |
adctof_c(ch12a(i),hb12a(i))=tof12(left,i,iadc)/xkorr |
adctof_c(ch12a(i),hb12a(i))=tof12(left,i,iadc)/xkorr |
925 |
endif |
endif |
926 |
|
|
927 |
if (tof12(right,i,iadc).lt.4095) then |
if (tof12(right,i,iadc).lt.3786) then |
928 |
|
c if (adc(ch12b(i),hb12b(i)).lt.4095) then |
929 |
tof12(right,i,iadc) = tof12(right,i,iadc)*cos(theta13) |
tof12(right,i,iadc) = tof12(right,i,iadc)*cos(theta13) |
930 |
xkorr=adcx12(right,i,1)*exp(xhelp/adcx12(right,i,2)) |
xkorr = atten(right,12,i,xhelp) |
931 |
|
c write(50+i,*) xhelp,xkorr |
932 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
933 |
adctof_c(ch12b(i),hb12b(i))=tof12(right,i,iadc)/xkorr |
adctof_c(ch12b(i),hb12b(i))=tof12(right,i,iadc)/xkorr |
934 |
endif |
endif |
943 |
IF (tof21_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
IF (tof21_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
944 |
|
|
945 |
i = tof21_i |
i = tof21_i |
946 |
if (tof21(left,i,iadc).lt.4095) then |
if (tof21(left,i,iadc).lt.3786) then |
947 |
|
c if (adc(ch21a(i),hb21a(i)).lt.4095) then |
948 |
tof21(left,i,iadc) = tof21(left,i,iadc)*cos(theta13) |
tof21(left,i,iadc) = tof21(left,i,iadc)*cos(theta13) |
949 |
xkorr=adcx21(left,i,1)*exp(-xhelp/adcx21(left,i,2)) |
xkorr = atten(left,21,i,xhelp) |
950 |
|
c write(60+i,*) xhelp,xkorr |
951 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
952 |
adctof_c(ch21a(i),hb21a(i))=tof21(left,i,iadc)/xkorr |
adctof_c(ch21a(i),hb21a(i))=tof21(left,i,iadc)/xkorr |
953 |
endif |
endif |
954 |
|
|
955 |
if (tof21(right,i,iadc).lt.4095) then |
if (tof21(right,i,iadc).lt.3786) then |
956 |
|
c if (adc(ch21b(i),hb21b(i)).lt.4095) then |
957 |
tof21(right,i,iadc) = tof21(right,i,iadc)*cos(theta13) |
tof21(right,i,iadc) = tof21(right,i,iadc)*cos(theta13) |
958 |
xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
xkorr=adcx21(right,i,1)*exp(xhelp/adcx21(right,i,2)) |
959 |
|
xkorr = atten(right,21,i,xhelp) |
960 |
|
c write(60+i,*) xhelp,xkorr |
961 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
962 |
adctof_c(ch21b(i),hb21b(i))=tof21(right,i,iadc)/xkorr |
adctof_c(ch21b(i),hb21b(i))=tof21(right,i,iadc)/xkorr |
963 |
endif |
endif |
971 |
IF (tof22_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
IF (tof22_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
972 |
|
|
973 |
i = tof22_i |
i = tof22_i |
974 |
if (tof22(left,i,iadc).lt.4095) then |
if (tof22(left,i,iadc).lt.3786) then |
975 |
|
c if (adc(ch22a(i),hb22a(i)).lt.4095) then |
976 |
tof22(left,i,iadc) = tof22(left,i,iadc)*cos(theta13) |
tof22(left,i,iadc) = tof22(left,i,iadc)*cos(theta13) |
977 |
xkorr=adcx22(left,i,1)*exp(-yhelp/adcx22(left,i,2)) |
xkorr = atten(left,22,i,yhelp) |
978 |
|
c write(70+i,*) yhelp,xkorr |
979 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
980 |
adctof_c(ch22a(i),hb22a(i))=tof22(left,i,iadc)/xkorr |
adctof_c(ch22a(i),hb22a(i))=tof22(left,i,iadc)/xkorr |
981 |
endif |
endif |
982 |
|
|
983 |
if (tof22(right,i,iadc).lt.4095) then |
if (tof22(right,i,iadc).lt.3786) then |
984 |
|
c if (adc(ch22b(i),hb22b(i)).lt.4095) then |
985 |
tof22(right,i,iadc) = tof22(right,i,iadc)*cos(theta13) |
tof22(right,i,iadc) = tof22(right,i,iadc)*cos(theta13) |
986 |
xkorr=adcx22(right,i,1)*exp(yhelp/adcx22(right,i,2)) |
xkorr = atten(right,22,i,yhelp) |
987 |
|
c write(70+i,*) yhelp,xkorr |
988 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
989 |
adctof_c(ch22b(i),hb22b(i))=tof22(right,i,iadc)/xkorr |
adctof_c(ch22b(i),hb22b(i))=tof22(right,i,iadc)/xkorr |
990 |
endif |
endif |
999 |
IF (tof31_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
IF (tof31_i.GT.none_find.AND.abs(yhelp).lt.100) THEN |
1000 |
|
|
1001 |
i = tof31_i |
i = tof31_i |
1002 |
if (tof31(left,i,iadc).lt.4095) then |
if (tof31(left,i,iadc).lt.3786) then |
1003 |
|
c if (adc(ch31a(i),hb31a(i)).lt.4095) then |
1004 |
tof31(left,i,iadc) = tof31(left,i,iadc)*cos(theta13) |
tof31(left,i,iadc) = tof31(left,i,iadc)*cos(theta13) |
1005 |
xkorr=adcx31(left,i,1)*exp(-yhelp/adcx31(left,i,2)) |
xkorr = atten(left,31,i,yhelp) |
1006 |
|
c write(80+i,*) yhelp,xkorr |
1007 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1008 |
adctof_c(ch31a(i),hb31a(i))=tof31(left,i,iadc)/xkorr |
adctof_c(ch31a(i),hb31a(i))=tof31(left,i,iadc)/xkorr |
1009 |
endif |
endif |
1010 |
|
|
1011 |
if (tof31(right,i,iadc).lt.4095) then |
if (tof31(right,i,iadc).lt.3786) then |
1012 |
|
c if (adc(ch31b(i),hb31b(i)).lt.4095) then |
1013 |
tof31(right,i,iadc) = tof31(right,i,iadc)*cos(theta13) |
tof31(right,i,iadc) = tof31(right,i,iadc)*cos(theta13) |
1014 |
xkorr=adcx31(right,i,1)*exp(yhelp/adcx31(right,i,2)) |
xkorr = atten(right,31,i,yhelp) |
1015 |
|
c write(80+i,*) yhelp,xkorr |
1016 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1017 |
adctof_c(ch31b(i),hb31b(i))=tof31(right,i,iadc)/xkorr |
adctof_c(ch31b(i),hb31b(i))=tof31(right,i,iadc)/xkorr |
1018 |
endif |
endif |
1025 |
IF (tof32_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
IF (tof32_i.GT.none_find.AND.abs(xhelp).lt.100) THEN |
1026 |
|
|
1027 |
i = tof32_i |
i = tof32_i |
1028 |
if (tof32(left,i,iadc).lt.4095) then |
if (tof32(left,i,iadc).lt.3786) then |
1029 |
|
c if (adc(ch32a(i),hb32a(i)).lt.4095) then |
1030 |
tof32(left,i,iadc) = tof32(left,i,iadc)*cos(theta13) |
tof32(left,i,iadc) = tof32(left,i,iadc)*cos(theta13) |
1031 |
xkorr=adcx32(left,i,1)*exp(-xhelp/adcx32(left,i,2)) |
xkorr = atten(left,32,i,xhelp) |
1032 |
|
c write(90+i,*) xhelp,xkorr |
1033 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1034 |
adctof_c(ch32a(i),hb32a(i))=tof32(left,i,iadc)/xkorr |
adctof_c(ch32a(i),hb32a(i))=tof32(left,i,iadc)/xkorr |
1035 |
endif |
endif |
1036 |
|
|
1037 |
if (tof32(right,i,iadc).lt.4095) then |
if (tof32(right,i,iadc).lt.3786) then |
1038 |
|
c if (adc(ch32b(i),hb32b(i)).lt.4095) then |
1039 |
tof32(right,i,iadc) = tof32(right,i,iadc)*cos(theta13) |
tof32(right,i,iadc) = tof32(right,i,iadc)*cos(theta13) |
1040 |
xkorr=adcx32(right,i,1)*exp(xhelp/adcx32(right,i,2)) |
xkorr = atten(right,32,i,xhelp) |
1041 |
|
c write(90+i,*) xhelp,xkorr |
1042 |
xkorr=xkorr/hepratio |
xkorr=xkorr/hepratio |
1043 |
adctof_c(ch32b(i),hb32b(i))=tof32(right,i,iadc)/xkorr |
adctof_c(ch32b(i),hb32b(i))=tof32(right,i,iadc)/xkorr |
1044 |
endif |
endif |
1415 |
|
|
1416 |
c write(*,*) xtofpos |
c write(*,*) xtofpos |
1417 |
c write(*,*) ytofpos |
c write(*,*) ytofpos |
1418 |
c write(*,*) betatof_a |
c write(*,*)'tofl2com beta', betatof_a |
1419 |
C write(*,*) adcflagtof |
C write(*,*) adcflagtof |
1420 |
|
c write(*,*) 'tofl2com' |
1421 |
|
c write(*,*) xtofpos |
1422 |
|
c write(*,*) ytofpos |
1423 |
|
c write(*,*) xtr_tof |
1424 |
|
c write(*,*) ytr_tof |
1425 |
|
|
1426 |
100 continue |
100 continue |
1427 |
|
|
1428 |
C |
C |
1429 |
RETURN |
RETURN |
1430 |
END |
END |
1431 |
|
|
1432 |
|
|
1433 |
|
C------------------------------------------------------------------ |
1434 |
|
C------------------------------------------------------------------ |
1435 |
|
|
1436 |
|
function atten(is,ilay,ipad,x) |
1437 |
|
include 'input_tof.txt' |
1438 |
|
real atten |
1439 |
|
real x |
1440 |
|
real xmin,xmax |
1441 |
|
integer ilay,ipad |
1442 |
|
|
1443 |
|
* S11 8 paddles 33.0 x 5.1 cm |
1444 |
|
* S12 6 paddles 40.8 x 5.5 cm |
1445 |
|
* S21 2 paddles 18.0 x 7.5 cm |
1446 |
|
* S22 2 paddles 15.0 x 9.0 cm |
1447 |
|
* S31 3 paddles 15.0 x 6.0 cm |
1448 |
|
* S32 3 paddles 18.0 x 5.0 cm |
1449 |
|
|
1450 |
|
|
1451 |
|
c if (ilay.eq.11) write(*,*) 'start ',ipad,is,adcx11(is,ipad,1), |
1452 |
|
c & adcx11(is,ipad,2),adcx11(is,ipad,3),adcx11(is,ipad,4) |
1453 |
|
c if (ilay.eq.12) write(*,*) 'start ',ipad,is,adcx12(is,ipad,1), |
1454 |
|
c & adcx12(is,ipad,2),adcx12(is,ipad,3),adcx12(is,ipad,4) |
1455 |
|
|
1456 |
|
|
1457 |
|
if (ilay.eq.11) xmin=-33.0/2. |
1458 |
|
if (ilay.eq.11) xmax= 33.0/2. |
1459 |
|
if (ilay.eq.12) xmin=-40.8/2. |
1460 |
|
if (ilay.eq.12) xmax= 40.8/2. |
1461 |
|
|
1462 |
|
if (ilay.eq.21) xmin=-18.0/2. |
1463 |
|
if (ilay.eq.21) xmax= 18.0/2. |
1464 |
|
if (ilay.eq.22) xmin=-15.0/2. |
1465 |
|
if (ilay.eq.22) xmax= 15.0/2. |
1466 |
|
|
1467 |
|
if (ilay.eq.31) xmin=-15.0/2. |
1468 |
|
if (ilay.eq.31) xmax= 15.0/2. |
1469 |
|
if (ilay.eq.32) xmin=-18.0/2. |
1470 |
|
if (ilay.eq.32) xmax= 18.0/2. |
1471 |
|
|
1472 |
|
if (x .lt. xmin) x=xmin |
1473 |
|
if (x .gt. xmax) x=xmax |
1474 |
|
|
1475 |
|
|
1476 |
|
if (ilay.eq.11) atten= |
1477 |
|
& adcx11(is,ipad,1)*exp(x*adcx11(is,ipad,2)) |
1478 |
|
& + adcx11(is,ipad,3)*exp(x*adcx11(is,ipad,4)) |
1479 |
|
|
1480 |
|
if (ilay.eq.12) atten= |
1481 |
|
& adcx12(is,ipad,1)*exp(x*adcx12(is,ipad,2)) |
1482 |
|
& + adcx12(is,ipad,3)*exp(x*adcx12(is,ipad,4)) |
1483 |
|
|
1484 |
|
if (ilay.eq.21) atten= |
1485 |
|
& adcx21(is,ipad,1)*exp(x*adcx21(is,ipad,2)) |
1486 |
|
& + adcx21(is,ipad,3)*exp(x*adcx21(is,ipad,4)) |
1487 |
|
|
1488 |
|
if (ilay.eq.22) atten= |
1489 |
|
& adcx22(is,ipad,1)*exp(x*adcx22(is,ipad,2)) |
1490 |
|
& + adcx22(is,ipad,3)*exp(x*adcx22(is,ipad,4)) |
1491 |
|
|
1492 |
|
if (ilay.eq.31) atten= |
1493 |
|
& adcx31(is,ipad,1)*exp(x*adcx31(is,ipad,2)) |
1494 |
|
& + adcx31(is,ipad,3)*exp(x*adcx31(is,ipad,4)) |
1495 |
|
|
1496 |
|
if (ilay.eq.32) atten= |
1497 |
|
& adcx32(is,ipad,1)*exp(x*adcx32(is,ipad,2)) |
1498 |
|
& + adcx32(is,ipad,3)*exp(x*adcx32(is,ipad,4)) |
1499 |
|
|
1500 |
|
if (atten.gt.10000) atten=10000. |
1501 |
|
|
1502 |
|
end |
1503 |
|
|
1504 |
|
C------------------------------------------------------------------ |
1505 |
|
C------------------------------------------------------------------ |
1506 |
|
|
1507 |
|
function pc_adc(ix) |
1508 |
|
include 'input_tof.txt' |
1509 |
|
real pc_adc |
1510 |
|
integer ix |
1511 |
|
|
1512 |
|
pc_adc=28.0407 + 0.628929*ix |
1513 |
|
& - 5.80901e-05*ix*ix + 3.14092e-08*ix*ix*ix |
1514 |
|
c write(*,*) ix,pc_adc |
1515 |
|
end |
1516 |
|
|
1517 |
|
C------------------------------------------------------------------ |
1518 |
|
|