GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » NUSTAR » NUSTAR PRESPEC » Invalid Events in Prespec Code
Re: Invalid Events in Prespec Code [message #19455 is a reply to message #19452] Fri, 19 August 2016 15:03 Go to previous messageGo to previous message
Michael Reese is currently offline  Michael Reese
Messages: 9
Registered: August 2016
occasional visitor
From: *gsi.de
Hi,

The valid flag of any value is set if the value was successfully computed. That happens when the
set_output(NAME_OF_VALUE, 42)

inside any processor is called. That means, if the value has no valid flag set, it was not successfully computed.
Usually, processors are written in a way that they check for the requirements of a computation
if (input_valid(NAME_OF_NECESSARY_INPUT_1) && input_valid(NAME_OF_NECESSARY_INPUT_2))
{
  double input1 = input_value(NAME_OF_NECESSARY_INPUT_1);
  double input2 = input_value(NAME_OF_NECESSARY_INPUT_2);
  double result = f(input1,input2);
  set_output(NAME_OF_RESULT, result);
}

This guarantees to have only meaningful information propagating along the graph. You can try to track down in which processor the information is missing. With that information I could give a more detailed answer.

In general you can try if it is possible to write a more sophisticated algorithm, such as this:
if (input_valid(NAME_OF_NECESSARY_INPUT_1) && input_valid(NAME_OF_NECESSARY_INPUT_2))
{
  double input1 = input_value(NAME_OF_NECESSARY_INPUT_1);
  double input2 = input_value(NAME_OF_NECESSARY_INPUT_2);
  double result = f(input1,input2); // f is an algorithm that calculates the result from the two given numbers
  set_output(NAME_OF_RESULT, result);
}
else if (input_valid(NAME_OF_NECESSARY_INPUT_1))
{
  double input1 = input_value(NAME_OF_NECESSARY_INPUT_1);
  // make a clever computation that needs only one of the values
  double result = f2(input1); // f2 is a sophisticated algorithm that calculates the result only with one number
  set_output(NAME_OF_RESULT, result);
}
else if (input_valid(NAME_OF_NECESSARY_INPUT_2))
{
  double input2 = input_value(NAME_OF_NECESSARY_INPUT_2);
  // make a clever computation that needs only the other value
  double result = f3(input2); // f3 is a sophisticated algorithm that calculates the result only with one number
  set_output(NAME_OF_RESULT, result);
}


Best regards,
Michael

[Updated on: Fri, 19 August 2016 15:04]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: LYCCA ToF scintillators
Next Topic: Scalers in prespec software
Goto Forum:
  


Current Time: Thu Dec 12 01:25:41 CET 2024

Total time taken to generate the page: 0.00793 seconds