### ATTENTION #### # This database was used in LCLS-I Mission Readiness program. In that case, the # firmware was configured to use the first 28 words of the waveform signal to # give useful information to the software. This words need to be stripped from # the waveform in order to show only the signal to the user. For LCLS-II, this # feature was not activated. Even though, we are still removing these 28 words # because all other databases rely on this assumption. # The first part of the stream contains the header (index 0 to 27). # The last part of the stream contains the raw waveform (index 28 to 2047). # The "beam full" bit is the 83th from the dmod words in the header. As we # are working with 16-bit words, that corresponds to the 4th bit of the 6th # word AA[5,5]. So, we AND this word with 0b1000 to check if the beam is full. # The AVAL record field is updated only when this bit is set. record (acalcout, "$(P):R_WF_CLC") { field(DESC, "Beam updated when beam full") #field(INAA, "$(P):HR_WF CP") field(INAA, "$(P):Stream0_16 CP") # Original calculation in Mission Readiness #field(CALC, "AA[5,5] & 8? AA[28,2047]:BB") field(CALC, "AA[28,2047]") # Saves the last value of AA in field BB. # LAA parameter is not working as last AA. It raises "invalid # CALC expression". field(OUT, "$(P):R_WF_CLC.BB") field(DOPT, "Use CALC") field(NELM, "2048") } # Transform an acalcout AVAL info into an waveform VAL, just to maintain # compatibility with previous systems. record (waveform, "$(P):R_WF") { field(DESC, "Waveform with beam present") field(INP, "$(P):R_WF_CLC.AVAL CP") field(NELM, "2020") field(FTVL, "SHORT") }