*--------1---------2---------3---------4---------5---------6---------7-- * Pad trigger efficiency vs. R-Phi * (self-normalizing histogram !!!) * declare variables *---------------------------------- real function EFFECT(Energy) include './Include/common.inc' include './Include/padgeom.inc' real Energy external CTVDCA, CNXY real RIN(3), VTX(3), ROUT(5) real XH, YH, ZH, RH, PH, TH, RS, PS, PT, Pi real RO(4), PO(4), RE(4), PE(4) real LLIM, ULIM, HPAR integer NHITE(6), NHITO(6), Sec_Trk(12), NSEC integer NUM(12, 7), DEN(12, 7) real RES(12, 7) logical CAND, TRACK * initialize variables *---------------------------------- parameter (Pi = 3.14159265358979) CAND = .FALSE. TRACK = .FALSE. NSEC = 0 EFFECT = 1 do I = 1, 6 NHITE(I) = 0 NHITO(I) = 0 end do do I = 1, 12 Sec_Trk(I) = 0 end do * book histograms *---------------------------------- if (IDNEVT.eq.1) then call HBOOK2(1, 'Tcand occupancy', 12,0.,12.,7,17.5,35.,0) call HBOOK2(2, 'Track occupancy', 12,0.,12.,7,17.5,35.,0) call HBOOK2(3, '', 12,0.,12.,7,17.5,35.,0) do I = 1, 12 do J = 1, 7 NUM(I, J) = 0 DEN(I, J) = 0 RES(I, J) = 0. end do end do end if * strip track in the pad acceptance *---------------------------------- RIN(1) = INRAD(1) RIN(2) = PHBST(1) RIN(3) = THBST(1) VTX(1) = XVBST(1) VTX(2) = YVBST(1) VTX(3) = ZVBST(1) call CTVDCA(RIN, VTX, ROUT) do J = 1, 4 * validating even sector *---------------------------------- ZH = (-1.) * EvenZPos(J) / 10. call CNXY (ROUT, ZH, XH, YH) RH = 10. * sqrt(XH**2 + YH**2) PH = 180. * atan2(YH, XH) / Pi if (PH.lt.0.) PH = PH + 360. do K = 1, 6 do L = 1, 8 if ((RH.gt.RadDiv(L)).and.(RH.lt.RadDiv(L + 1)).and. + (PH.gt.EvenMinPhi(K)).and.(PH.lt.EvenMaxPhi(K))) + then NHITE(K) = NHITE(K) + 1 RE(J) = RH PE(J) = PH end if end do end do ZH = (-1.) * OddZPos(J) / 10. call CNXY (ROUT, ZH, XH, YH) RH = 10. * sqrt(XH**2 + YH**2) PH = 180. * atan2(YH, XH) / Pi if (PH.lt.0.) PH = PH + 360. * validating odd sector *---------------------------------- do K = 1, 6 do L = 1, 8 if ((RH.gt.RadDiv(L)).and.(RH.lt.RadDiv(L + 1)).and. + (PH.gt.OddMinPhi(K)).and.(PH.lt.OddMaxPhi(K))) + then NHITO(K) = NHITO(K) + 1 RO(J) = RH PO(J) = PH end if end do end do end do * track candidate *---------------------------------- do I = 1, 6 J = 2 * I - 1 K = 2 * I if (NHITE(I).eq.4) Sec_Trk(J) = 1 if (NHITO(I).eq.4) Sec_Trk(K) = 1 end do do I = 1, 12 if (Sec_Trk(I).eq.1) NSEC = NSEC + 1 end do if (NSEC.eq.1) CAND = .TRUE. * compare BST and SPACAL energies *---------------------------------- TH = atan2(RS, ZH) PT = 0.3 / 100. / INRAD(1) / sin(TH) if (NSEL.eq.0.or.ESEL(1).lt.Energy) CAND = .FALSE. * link BST tracks to SPACAL clusters *---------------------------------- ZH = (-1.) * SpacalPos / 10. call CNXY (ROUT, ZH, XH, YH) RH = sqrt(XH**2 + YH**2) PH = 180. * atan2(YH, XH) / Pi if (PH.lt.0.) PH = PH + 360. RS = sqrt(XSEL(1)**2 + YSEL(1)**2) PS = 180. * atan2(YSEL(1), XSEL(1)) / Pi if (PS.lt.0.) PS = PS + 360. HPAR = abs(RH-RS) call HF1(101, HPAR, 1.) if (abs(RH-RS).gt.4.or.abs(PH-PS).gt.22.) CAND = .FALSE. * frontend track signal *---------------------------------- do I = 1, 12 if (Top_Trg(I).eq.1) TRACK = .TRUE. end do * efficiency in the R-Phi plane *---------------------------------- if (CAND) then do I = 1, 12 ! loop over Phi do J = 1, 7 ! loop over R LLIM = 17.5 + real(J - 1) * (35. - 17.5) / 7. ULIM = 17.5 + real(J) * (35. - 17.5) / 7. Xind = real(I-1) Yind = RS if ((RS.gt.LLIM).and.(RS.le.ULIM)) then if (Sec_Trk(I).eq.1) then DEN(I, J) = DEN(I, J) + 1 call HF2(1, Xind, Yind, 1.) end if C if ((Sec_Trk(I).eq.1).and.(Top_Trg(I).eq.1)) then if ((Sec_Trk(I).eq.1).and.TRACK) then NUM(I, J) = NUM(I, J) + 1 call HF2(2, Xind, Yind, 1.) end if end if end do end do end if do I = 1, 12 do J = 1, 7 Xind = real(I-1) Yind = RS if (DEN(I, J).ne.0) then HPAR = 0. - RES(I, J) call HF2 (3, Xind, Yind, HPAR) RES(I, J) = 100. * real(NUM(I, J)) / real(DEN(I, J)) HPAR = 0. + RES(I, J) call HF2(3, Xind, Yind, HPAR) end if end do end do return end