Auto-gained correlation sort

This example illustrates an offline angular correlation sort where the germaniums have been divided into separate groups dependent on the angle of the detector in the array. The germanium data is auto-gain matched.

*FORMATS
TRIGGER[255] (TYPE,MRAW,MSUP)
GERM158[1:5] (GE20,GE4,GET,GETBD)
GERM134[6,11,13,17,19,23,25,29,35,36] (GE20,GE4,GET,GETBD)
GERM108[8,10,14,16,20,22,26,28,32,34] (GE20,GE4,GET,GETBD)
GERM90[12,15,21,27,33,37,40,46,49,52] (GE20,GE4,GET,GETBD)    
GERM72[38,39,41,42,44,45,47,48,50,51] (GE20,GE4,GET,GETBD)

*DATA
GAINARRAY E4GAINS

*SPECTRA
GAINSP[1:54] 4096 32
GG158158 3000 2D
GG90158 3000 2D
GG134134 3000 2D
GG90134 3000 2D

*AUTOGAIN
SAMPLE 20000
PEAKAREA 50
DEVIATION 1.0
INIT E4GAINS FROM GAINSP CENTROIDS 331.4 3 891.0 4
PEAKS
1 654 10 1758 15
2 634 10  1723 15
3 532 10  1440 15
4 607 10  1637 15
   ...
48 596 10  1585 15
49 671 10  1811 15
50 605 10  1627 15
51 929 10  2257 15
52 654 10  1765 15
CREATELIST GE158 FROM GERM158
INC GAINSP($A=GE158.GE4) INDEXED $A
CREATELIST GE134 FROM GERM134
INC GAINSP($B=GE134.GE4) INDEXED $B
! ignore this angle
!CREATELIST GE108 FROM GERM108
!INC GAINSP($C=GE108.GE4) INDEXED $C
CREATELIST GE90 FROM GERM90
INC GAINSP($D=GE90.GE4) INDEXED $D
! ignore this angle
! CREATELIST GE72 FROM GERM72
! INC GAINSP($E=GE158.GE4) INDEXED $E

*COMMANDS
GAIN GE158.GE4 E4GAINS
GAIN GE134.GE4 E4GAINS
! GAIN GE108.GE4 E4GAINS
GAIN GE90.GE4  E4GAINS
! GAIN GE72.GE4  E4GAINS

LOOPEXTRACT GE90.GE4 INTO RIGHT
{
 LOOPEXTRACT GE158.GE4 INTO BACK
 {
  INC GG90158(BACK,RIGHT)
 }
}
LOOPEXTRACT GE158.GE4 INTO BACK1 BACK2
{
 INC GG158158(BACK1,BACK2)
 INC GG158158(BACK2,BACK1)      ! make symmetric 
 LOOPEXTRACT GE90.GE4 INTO RIGHT
 {
  INC GG90158(BACK1,RIGHT)
  INC GG90158(BACK2,RIGHT)
 }
}

LOOPEXTRACT GE90.GE4 INTO RIGHT 
{
 LOOPEXTRACT GE134.GE4 INTO BACK
  {
   INC GG90134(BACK,RIGHT)
  }
}
LOOPEXTRACT GE134.GE4 INTO BACK1 BACK2
{
 INC GG134134(BACK1,BACK2)
 INC GG134134(BACK2,BACK1)      ! make symmetric 
 LOOPEXTRACT GE90.GE4 INTO RIGHT
 {
  INC GG90134(BACK1,RIGHT)
  INC GG90134(BACK2,RIGHT)
 }
}

 
END

*RUNFILES
XE122 RUN1
XE122 RUN2
*FINISH