;+
;Project
;          Hinode/EIS
;
; Name
;          eis_flare_control_initialize
;
; Purpose
;          To initialize eis_flare_control structure values
;
; Category
;          Timeline planning
;          Response Studies
;
; Written
;          John Rainnie 26-Jan-2010
;
; Version
;          v0.1 JAR 03-Dec-2014
;               Acquire response structure from Response DB, not tlc
;
;-
;______________________________________________________________________________
FUNCTION eis_flare_control_initialize , trigger ;, tlc

;temp    = tlc->get(POSITION = trigger.tlc_position)
;tl      = temp->get()
;IF (tl.time_component.read_all NE 1) THEN BEGIN
;   temp->get_all_info
;   tl = temp->get()
;ENDIF
;sc      = tl.science_component
;all_sra = sc.studyRasters[*]
;st      = tl.science_component.eis_flare_response
;
;; Which studyRaster?????
;; The first one with a line selected, I guess.
;list = WHERE(TOTAL(all_sra.eis_flare_props.flare_flag) GT 0 , count)
;IF (count LT 1) THEN RETURN , 0
;sra  = sc.studyRasters[list[0]].eis_flare_props
;
;; Now use existing routine
;struct = eis_eisf_props_to_control(st,sra,{eis_flare_control})
;
;RETURN , struct


; Read response entry from response DB
resp = db_read_response_entry(id = trigger.resp_id)
; This is CPT's eisf structure. Populate it with values from the
; response entry
eisf = {eis_flare_control}

; OK, let's get on with it.
eisf.response_identifier = resp.response_st_id		;2
eisf.raster_identifier   = resp.raster_identifier	;2
eisf.line_index          = resp.line_index
eisf.no_hunt_data        = resp.no_hunt_data		;0
eisf.ra1_xcen            = resp.ra1_xcen			;10.0
eisf.ra1_ycen            = resp.ra1_ycen			;20.0
eisf.ra1_mip             = resp.ra1_mip				;1160
eisf.ra1_yip             = resp.ra1_yip				;326
eisf.ra1_sc_x            = resp.ra1_sc_x			;0.0
eisf.ra1_sc_y            = resp.ra1_sc_y			;0.0
eisf.ra1_pointed         = resp.ra1_pointed			;0
;...miss some
eisf.adjust_x            = resp.adjust_x			;1
eisf.adjust_y            = resp.adjust_y			;1
eisf.locate_x            = resp.locate_x			;1
eisf.locate_y            = resp.locate_y			;1
eisf.x_threshold         = resp.x_threshold			;1
eisf.y_threshold         = resp.y_threshold  		;1
eisf.x_min_limit         = resp.x_min_limit			;1
eisf.y_min_limit         = resp.y_min_limit  		;1

RETURN , eisf

END
