function select_e, plist, e0, e1, pha=pha, sis=sis, highgain=highgain if n_params(0) eq 0 then begin print,'Indices of plist for photons between e0 and e1' print,'If /pha then use pha rather than pi (sis only)' print,'sis = 0,1 if nec.' print,'Set /highgain if plist is a PSPC obs before Oct. 11, 1991 retall endif type = tag_names(plist,/struct) pha = keyword_set(pha) phaname = ['i','a'] highgain = keyword_set(highgain) if type eq 'FSEVENT' then begin if n_elements(sis) eq 0 then begin sis = 0 read,'SIS 0 or 1? ',sis0 endif sisn = ['s0c1','s1c3'] rmf = $ '/FTP/caldb/data/asca/sis/cpf/94nov9/' + sisn(sis) + $ 'g0234p40e1_512v0_8' + phaname(pha) + '.rmf' if pha then ph = to512(plist.pha) else ph = to512(plist.pi) endif ; Note that gis2v4_0.rmf and gis3v4_0.rmf are identical if type eq 'FGEVENT' then begin rmf = '/FTP/caldb/data/asca/gis/cpf/95mar06/gis2v4_0.rmf' ph = plist.pi endif if type eq 'PSPCEVE' then begin if highgain then rmf = $ '/FTP/caldb/data/rosat/pspc/cpf/matrices/pspcb_gain1_256.rsp' else begin rmf = '/FTP/caldb/data/rosat/pspc/cpf/matrices/pspcb_gain2_256.rsp' print, 'Please be sure observation was after Oct. 11, 1991' endelse ph = plist.pi endif print, 'Reading energies from '+rmf read_ebounds, rmf, elo, ehi chlo = min(where(elo gt e0)) chhi = max(where(ehi lt e1)) if chlo eq -1 then chlo = 1 if chhi eq -1 then chhi = n_elements(ehi) print,'Range in channels = '+strn(chlo)+' - '+strn(chhi) return, where(ph ge chlo and ph le chhi) end