A typical autogain sort for phase 2...
*FORMATS ge[1:35] (e20,e4,ft,co,bgoe,bgot,hitpat) clovers1[81:104] (bgop, A1, A2tag:3,A2dat:13, A3) clovers2[111:134] (bgop, A1, A2tag:3,A2dat:13, A3, B1, B2tag:3,B2dat:13, B3) *DATA !! gain coefficients calculated !! from Eu152 source spectra for v/c=0.0105 GAINARRAY gphase1 !! phase1 detectors 1 (3.054180 0.985850 0.000000) 2 (4.106800 1.053940 0.000001) 3 (3.101520 0.888870 0.000000) ... GAINARRAY segA !! segment A 81 (-5.956440 0.968458 0.000000) 82 (-2.043540 0.912272 0.000000) 83 (1.866570 1.023430 0.000000) ... GAINARRAY segB !! segment B 81 (-4.002160 0.922770 0.000000) 82 (-4.108340 0.908958 0.000000) 83 (-3.820860 1.028980 0.000000) ... GAINARRAY segC !! segment C 81 (-0.804466 0.927298 0.000000) 82 (-2.431520 0.922218 0.000000) 83 (-1.492300 1.027120 0.000000) ... GAINARRAY segD !! segment D 81 (-8.195100 0.950084 0.000000) 82 (0.832342 0.884106 0.000000) 83 (-1.531620 1.039610 0.000001) ... GAINARRAY segAmod GAINARRAY segBmod GAINARRAY segCmod GAINARRAY segDmod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! EUROGAM PHASE2 ARRAY CLOVER ANGLES !! USED BY AUTOGAIN ROUTINE TO CORRECT GAIN COEFFICIENTS TO ADDBACK !! CLOVER DATA !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! VALUEARRAY eurogam[81:104] !! clover midpoint angles 104.5 75.5 104.5 75.5 104.5 75.5 104.5 75.5 104.5 75.5 104.5 75.5 75.5 104.5 75.5 104.5 75.5 104.5 75.5 104.5 75.5 104.5 75.5 104.5 VALUEARRAY deltAB[81:104] !! delta angles for segments A and B 4.5 -4.5 4.5 -4.5 4.5 -4.5 4.5 -4.5 4.5 -4.5 4.5 -4.5 -4.5 4.5 -4.5 4.5 -4.5 4.5 -4.5 4.5 -4.5 4.5 -4.5 4.5 VALUEARRAY deltCD[81:104] !! delta angles for segments C and D -4.5 4.5 -4.5 4.5 -4.5 4.5 -4.5 4.5 -4.5 4.5 -4.5 4.5 4.5 -4.5 4.5 -4.5 4.5 -4.5 4.5 -4.5 4.5 -4.5 4.5 -4.5 *SPECTRA !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! DECLARE SPECTRA FOR USE IN *AUTOGAIN SECTION !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! xautog[1:35] 4096 32 xautoa[81:104] 4096 32 xautob[81:104] 4096 32 xautoc[81:104] 4096 32 xautod[81:104] 4096 32 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! DECLARE SPECTRA FOR USE IN *COMMANDS SECTION !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! gamtot1 4096 32 gamtot2 4096 32 cl2ab 4096 32 cl2ac 4096 32 cl2ad 4096 32 cl2bc 4096 32 cl2bd 4096 32 cl2cd 4096 32 *AUTOGAIN !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! NUMBER OF BLOCKS AFTER WHICH TO CALCULATE GAINS OR CHECK DRIFTS !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! sample 15000 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! CHANGE PEAK VALUES TO CORRESPOND TO 2 PEAK POSITIONS IN YOUR DATA !! ...FOR 4MeV GAIN COEFFICIENTS !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! init gphase1 from xautog centroids 393.0 8.0 735 10.0 init segA from xautoa centroids 393.0 8.0 735 10.0 init segB from xautob centroids 393.0 8.0 735 10.0 init segC from xautoc centroids 393.0 8.0 735 10.0 init segD from xautod centroids 393.0 8.0 735 10.0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! VOVERC FOR EXPERIMENT (0 < voverc < 1.0) !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! voverc 0.0105 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! CORRECT GAINS TO USE FOR ADDBACK WHENEVER AUTOGAINED COEFFICIENTS !! ARE SHIFTED !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! copygain from segA[81:104] to segAmod[81:104] angles eurogam deltas deltAB copygain from segB[81:104] to segBmod[81:104] angles eurogam deltas deltAB copygain from segC[81:104] to segCmod[81:104] angles eurogam deltas deltCD copygain from segD[81:104] to segDmod[81:104] angles eurogam deltas deltCD createlist gelist from ge inc xautog($auto=gelist.e4) indexed $auto createlist clist1 from clovers1 loopif $c1=clist1.a2dat valid { select ($c1.a2tag) (1) { !! segment A inc xautoa($c1.a2dat) indexed $c1 } (2) { !! segment B inc xautob($c1.a2dat) indexed $c1 } (3) { !! segment C inc xautoc($c1.a2dat) indexed $c1 } (4) { !! segment D inc xautod($c1.a2dat) indexed $c1 } } !!------------------------------------------------------------------- !! !! THESE COMMANDS ARE EXECUTED FOR EVERY EVENT !! !!------------------------------------------------------------------- *COMMANDS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! GAIN MATCH PHASE 1 DETECTORS !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! gain gelist.e4 gphase1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! GAIN MATCH CLOVER DETECTORS WITH SINGLE HITS !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! loopif $c1=clist1.a2dat gt 0 { groupno = group($c1) select ($c1.a2tag) (1) { !! segment A gain $c1.a2dat segA indexed $c1 } (2) { !! segment B gain $c1.a2dat segB indexed $c1 } (3) { !! segment C gain $c1.a2dat segC indexed $c1 } (4) { !! segment D gain $c1.a2dat segD indexed $c1 } } loopif $c1=clist1.a2dat gt 0 newlistx=clist1a { inc gamtot1($c1.a2dat) } !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! GAIN MATCH CLOVER DETECTORS WITH DOUBLE HITS !! !! simple coeffs : A-B, C-D !! corrected coeffs : A-C, A-D, B-C, B-D !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! createlist clist2 from clovers2 loopif $c2=clist2.a2dat gt 0 { if ($c2.b2dat) gt 0 { gaingrp = group($c2) - 30 sum = 0 select ($c2.a2tag,$c2.b2tag) (1,2) { !! A-B gain $c2.a2dat segA indexed gaingrp gain $c2.b2dat segB indexed gaingrp sum = $c2.a2dat + $c2.b2dat inc cl2ab(sum) } (1,3) { !! A-C gain $c2.a2dat segAmod indexed gaingrp gain $c2.b2dat segCmod indexed gaingrp sum = $c2.a2dat + $c2.b2dat inc cl2ac(sum) } (1,4) { !! A-D gain $c2.a2dat segAmod indexed gaingrp gain $c2.b2dat segDmod indexed gaingrp sum = $c2.a2dat + $c2.b2dat inc cl2ad(sum) } (2,3) { !! B-C gain $c2.a2dat segBmod indexed gaingrp gain $c2.b2dat segCmod indexed gaingrp sum = $c2.a2dat + $c2.b2dat inc cl2bc(sum) } (2,4) { !! B-D gain $c2.a2dat segBmod indexed gaingrp gain $c2.b2dat segDmod indexed gaingrp sum = $c2.a2dat + $c2.b2dat inc cl2bd(sum) } (3,4) { !! C-D gain $c2.a2dat segC indexed gaingrp gain $c2.b2dat segD indexed gaingrp sum = $c2.a2dat + $c2.b2dat inc cl2cd(sum) } inc gamtot2(sum) } } ...