macro tally message tally.kumac: package to sum tagged beam counts message Usage: message #scan: scan ntuples and extract run-dependent rate info message -assumes that piaf is connected and the ntuple containing message the /talign/ block is loaded message -run this once and store the resulting histograms in tally.hbook message #histos: form efficiency histograms for subsequent computation message #scalers: extract scaler information from scalers ntuple message -assumes that the ntuple containing the /scalers/ block is message already open on unit lun94 message #ratios: compute ratios from efficiency histograms message #write: save final tagger sums to output text files message return macro scan ntid=1 uwfunc [ntid] talign.inc put talign.inc 1dhist 10 'event count' 1400 7400 8800 n/pl [ntid].runno ! -10 1dhist 9 'dummy' 9 0 9 n/pl [ntid].tally.f77(100) ! -9 return macro histos h/del 0 sigma x=array(1400) do i=0,56 i1=[i]+100 i2=[i]+200 i3=[i]+300 bany [i1] 30 50 h/proj [i1] title=tagger channel [i] h/copy [i1].bany [i2] [title] h/del [i1] divide [i2] 10 [i3] $sigma(1/20e-3) enddo do i=0,18 i1=[i]+300 i2=[i]+338 i3=[i]+400 divide [i2] [i1] [i3] get/c [i3] x i4=[i]+500 1dhist [i4] '' 200 .1 1.1 hfill x [i4] h/fit [i4](.8:1.) g enddo do i=0,18 i1=[i]+319 i2=[i]+338 i3=[i]+419 divide [i2] [i1] [i3] get/c [i3] x i4=[i]+519 1dhist [i4] '' 200 .1 1.1 hfill x [i4] h/fit [i4](.8:1.) g enddo return macro scalers scid=80 do i=0,18 id=[i]+600 ii=[i]+1 title=left tagger channel [i] 1dhist [id] [title] 1400 7400 8800 n/pl //lun94/[scid].run time>0&&tagL[ii]*(L1live+1e-6)/(L1raw+1e-6) -[id] id=[i]+619 title=right tagger channel [i] 1dhist [id] [title] 1400 7400 8800 n/pl //lun94/[scid].run time>0&&tagR[ii]*(L1live+1e-6)/(L1raw+1e-6) -[id] enddo return macro ratios h/del 0 do i=0,37 id1=[i]+400 id2=[i]+600 id3=[i]+700 multiply [id1] [id2] [id3] h/del [id1] h/del [id2] enddo return macro write sigma runs=array(1400) get/abs 400 runs sigma runs=runs-0.5 do i=0,18 sigma tagl[i]=array(1400) sigma tagr[i]=array(1400) idl=600+[i] idr=619+[i] get/c [idl] tagl[i] get/c [idr] tagr[i] enddo call tallyw.f77 shell mv tagl.dat scalers_l.dat shell mv tagr.dat scalers_r.dat do i=0,18 sigma tagl[i]=array(1400) sigma tagr[i]=array(1400) idl=700+[i] idr=719+[i] get/c [idl] tagl[i] get/c [idr] tagr[i] enddo call tallyw.f77 shell mv tagl.dat tags1_l.dat shell mv tagr.dat tags1_r.dat return