Subversion Repositories f9daq

Rev

Rev 319 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

Blockly.JavaScript['particle_combiner'] = function(block) {
  var value_list1 = Blockly.JavaScript.valueToCode(block, 'list1', Blockly.JavaScript.ORDER_ATOMIC);
  if (value_list1.length==0) value_list1='""';
  var value_list2 = Blockly.JavaScript.valueToCode(block, 'list2', Blockly.JavaScript.ORDER_ATOMIC);
  if (value_list2.length==0) value_list2='""';
  var dropdown_simplepid = block.getFieldValue('simplepid');
  var number_mass0 = block.getFieldValue('mass0');
  var number_mass1 = block.getFieldValue('mass1');
  var value_histogram = Blockly.JavaScript.valueToCode(block, 'histogram', Blockly.JavaScript.ORDER_ATOMIC);
  if (value_histogram.length==0) value_histogram='""';
  // TODO: Assemble JavaScript into code variable.
  var code = '{"combiner":{"list1":' + value_list1 + ',"list2":' +  value_list2 + ',"pid":"' + dropdown_simplepid +  '","m0":"' + number_mass0 +  '","m1":"' + number_mass1 + '","histogram":' + value_histogram + '}}\n';
  // TODO: Change ORDER_NONE to the correct strength.
  return [code, Blockly.JavaScript.ORDER_NONE];
};

Blockly.JavaScript['particle_selector'] = function(block) {
  var value_list1 = Blockly.JavaScript.valueToCode(block, 'list1', Blockly.JavaScript.ORDER_ATOMIC);
  if (value_list1.length==0) value_list1='""';
  var dropdown_chargelist = block.getFieldValue('chargelist');
  var dropdown_simplepid = block.getFieldValue('simplepid');
  var value_histogram = Blockly.JavaScript.valueToCode(block, 'histogram', Blockly.JavaScript.ORDER_ATOMIC);
  if (value_histogram.length==0) value_histogram='""';
  // TODO: Assemble JavaScript into code variable.
  var code = '{"selector":{"list1":' + value_list1 + ',"charge":"' +  dropdown_chargelist + '","pid":"' + dropdown_simplepid +  '","histogram":' + value_histogram + '}}\n';
  // TODO: Change ORDER_NONE to the correct strength.
  return [code, Blockly.JavaScript.ORDER_NONE];
};

Blockly.JavaScript['histogram_creator'] = function(block) {
  var text_name = block.getFieldValue('name');
  var number_nbins = block.getFieldValue('nbins');
  var number_min = block.getFieldValue('min');
  var number_max = block.getFieldValue('max');
  var dropdown_varname = block.getFieldValue('varname');
  // TODO: Assemble JavaScript into code variable.

  var code = '{"h1d":{"varname":"'+ dropdown_varname + '","name":"' +  text_name + '","nbins":"' + number_nbins + '","min":"' + number_min +  '","max":"' + number_max + '"}}\n';
  // TODO: Change ORDER_NONE to the correct strength.
  return [code, Blockly.JavaScript.ORDER_NONE];
};

Blockly.JavaScript['simple_analysis'] = function(block) {
  var number_neve = block.getFieldValue('neve');
  var dropdown_datasource = block.getFieldValue('datasource');
  var value_list = Blockly.JavaScript.valueToCode(block, 'list', Blockly.JavaScript.ORDER_ATOMIC);
  if (value_list.length==0) value_list='""';
  // TODO: Assemble JavaScript into code variable.
  var code = '{"analysis":{"neve":"' + number_neve +  '","datasource":"' + dropdown_datasource + '","list":' + value_list + '}}\n';
  return code;
};

Blockly.JavaScript['particle_mass_fix'] = function(block) {
  var value_list = Blockly.JavaScript.valueToCode(block, 'list', Blockly.JavaScript.ORDER_ATOMIC);
  if (value_list.length==0) value_list='""';
  // TODO: Assemble JavaScript into code variable.
  var code = '{"fix_mass":{"list":' + value_list + '}}\n';
  // TODO: Change ORDER_NONE to the correct strength.
  return [code, Blockly.JavaScript.ORDER_NONE];
};

Blockly.JavaScript['primary_list'] = function(block) {
  var value_histogram = Blockly.JavaScript.valueToCode(block, 'histogram', Blockly.JavaScript.ORDER_ATOMIC);
   if (value_histogram.length==0) value_histogram='""';
  // TODO: Assemble JavaScript into code variable.
  var code = '{"primary":' +  '{"histogram":' + value_histogram + '}}\n';
  // TODO: Change ORDER_NONE to the correct strength.
  return [code, Blockly.JavaScript.ORDER_NONE];
};