Subroutine MAMMA(jmode,Cut1,Cut2,janswer) c ========================================== c c jmode = 100*zone+rec*10+track c c zone =0 only FW c =1 F/B/R (in B/R only CTD-MIP) c c rec =0 do not call MFEAZE c =1 call MFEAZE to reconstruct hits c =2 call MFEAZE to reconstruct candidate tracks c =3 call MFEAZE to redo the full reconstruction c c track=0 only CTD-MIP c =1 CTD-MIP-FMU with mfrtz tracks c =2 CTD-MIP-FMU with mfcts candidate tracks c =3 CTD-MIP-FMU only with LT1 hits c c janswer = 0 no candidate(s) found c = 1 candidate(s) found c < 0 error c c Cut1,2 = Chi2Cut for track [1] and hit [2] matches c If negative, the default values are used. c It can be changed during the same job. c Implicit None c #include "partap.inc" #include "fmckin.inc" #include "fwtrk.inc" #include "fwmip.inc" #include "fwhmu.inc" #include "mfflg.inc" #include "mfmtch.inc" #include "vctvtx.inc" c Integer NMFOP Parameter(NMFOP=21) C C FMUO Option flags. Integer DIGITS,DEBUG(4),HISTO(6),RECON,ITCOR(4),IOPTKF, . TrkMeth,MinDCHit,Pinfl,IXTVT, . IHMON,IHSTA,IHSTR,IHTDC,IHTRI Common/MFOPT/Digits,Debug,Histo,Recon,Itcor,ioptkf,TrkMeth, . MinDCHit,Pinfl,IXTVT, . IHMON,IHSTA,IHSTR,IHTDC,IHTRI C C Defaults from control cards. Integer TrkMethDef,DigitsDef Common/MFOPD/TrkmethDef,DigitsDef c #include "mfraw.inc" #include "mfdig.inc" c #include "mfcuts.inc" c integer jmode,janswer logical first /.true./ save first logical ErrInit /.false./ save ErrInit c real Cut1,Cut2 c integer jzone,jrec,jtrack,ierr c real ve(3) Integer nn(3),nt,k,nct,nmt,i c c decode jzone=jmode/100 jrec=mod(jmode,100)/10 jtrack=mod(jmode,10) c if(first) then first=.false. Call MAMINI(jrec,ierr) if(ierr.gt.0) then print *,'MAMMA. Error from MAMINI, code= ',ierr print *,' Subsequent calls are disabled.' ErrInit=.true. janswer=-1 goto 9900 endif endif c nhma=0 janswer=-1 if(ErrInit) goto 9900 janswer=0 c c if(Cut1.ge.0.and.Cut1.ne.Chi2Cut(1)) Chi2Cut(1)=Cut1 if(Cut2.ge.0.and.Cut2.ne.Chi2Cut(2)) Chi2Cut(2)=Cut2 c c--> choose the data type. if(montecarlo.lt.0) then if(coutab(FMCKin).gt.0) then montecarlo=1 else montecarlo=0 endif endif c c event vertex if(coutab(vctvtx).gt.0) then call fettab(vctvtx,id,1) call ucopy(vctvtx_v,ve,3) else call vzero(ve,3) endif c if(jrec.gt.0) then if(jrec.eq.1) then RECON=0 elseif(jrec.eq.2) then RECON=1 elseif(jrec.eq.3) then RECON=4 endif Call MFEAZE(ierr) if(ierr.gt.0) then print *,'MAMMA. Error from MFEAZE, code=',ierr janswer=-2 goto 9900 endif endif c c-- fill the track arrays. ntmf=0 if(jtrack.eq.1) then c- track=mfrtz Call MFTRF elseif(jtrack.eq.2) then c- track=mfcts Call MFSPF endif c c get x-trapolated ctd tracks Call MFWTKS c c look for CalMips Call FWMIPS(ve) nct=nctd(1)+nctd(2)+nctd(3) nmt=nmip(1)+nmip(2)+nmip(3) if(nct+nmt.eq.0) goto 9900 c if(jtrack.eq.3) goto 1000 c nn(1)=0 nn(2)=0 nn(3)=0 c if(jzone.gt.0) then do i=2,3 if(nmip(i)*nctd(i).gt.0) Call MFTK123(i,4,nn(i)) enddo endif c if(jtrack.eq.0) then c - CTD-MIP only if(nmip(1)*nctd(1).gt.0) Call MFTK123(1,4,nn(1)) nt=nn(1)+nn(2)+nn(3) if(nt.gt.0) janswer=1 goto 9900 elseif(jtrack.gt.0) then if(ntmf.gt.0) then if(nmip(1)*nctd(1).gt.0) then Call MFTK123(1,1,nn(1)) if(nn(1).lt.1) then Call MFTK123(1,2,nn(1)) if(nn(1).lt.1) then Call MFTK123(1,3,nn(1)) endif endif elseif(nmip(1).gt.0) then Call MFTK123(1,2,nn(1)) elseif(nctd(1).gt.0) then Call MFTK123(1,3,nn(1)) endif endif nt=nn(1)+nn(2)+nn(3) if(nt.gt.0) janswer=1 endif c==================================================================== 1000 continue c c look for fmuon hits and fill commons c-- LT1 hits Call MFDIH1 Call MFWHMU1(ve) c c============================================================== c nt=0 if(nhmf.gt.0) then nhma=0 if(nmip(1)*nctd(1).gt.0) then Call MFH123(1,nt) if(nt.gt.0) then janswer=janswer+1 goto 9900 endif Call MFH123(2,nt) if(nt.gt.0) then janswer=janswer+1 goto 9900 endif Call MFH123(3,nt) if(nt.gt.0) then janswer=janswer+1 goto 9900 endif elseif(nmip(1).gt.0) then Call MFH123(2,nt) if(nt.gt.0) then janswer=janswer+1 goto 9900 endif elseif(nctd(1).gt.0) then Call MFH123(3,nt) if(nt.gt.0) then janswer=janswer+1 goto 9900 endif endif endif c if(janswer.eq.0) then if(nmip(1)*nctd(1).gt.0) Call MFTK123(1,4,nt) if(nt.gt.0) janswer=1 endif c 9900 Return End c c