| /belle2/masterclass/js/belle2_def.js |
|---|
| 11,6 → 11,9 |
| .setAlign(Blockly.ALIGN_RIGHT) |
| .appendField("2. Particle"); |
| this.appendDummyInput() |
| .appendField("Same particle lists?") |
| .appendField(new Blockly.FieldDropdown([["No", "0"], ["Yes", "1"]]), "sameparticles"); |
| this.appendDummyInput() |
| .appendField("New Particle") |
| .appendField(new Blockly.FieldDropdown([["electron", "ELECTRON"], ["muon", "MUON"], ["pion", "PION"], ["kaon", "KAON"], ["proton", "PROTON"], ["photon", "PHOTON"], ["Ks", "KS"], ["D", "D"], ["D*", "DSTAR"], ["J/Psi", "JPSI"]]), "simplepid"); |
| this.appendDummyInput() |
| 27,7 → 30,7 |
| this.setInputsInline(false); |
| this.setOutput(true, "particle list"); |
| this.setColour(120); |
| this.setTooltip(''); |
| this.setTooltip('Combine two particles in the new particle by making combinations between particles in two input lists'); |
| this.setHelpUrl('http://www.example.com/'); |
| } |
| }; |
| 51,7 → 54,7 |
| this.setInputsInline(false); |
| this.setOutput(true, "particle list"); |
| this.setColour(65); |
| this.setTooltip(''); |
| this.setTooltip('Create a new list of particles based on the original particle list or any input particle list'); |
| this.setHelpUrl('http://www.example.com/'); |
| } |
| }; |
| 82,7 → 85,7 |
| this.setInputsInline(true); |
| this.setOutput(true, "histogram"); |
| this.setColour(20); |
| this.setTooltip(''); |
| this.setTooltip('This block handles the histogram creation and filling. Define a number of bins, minimum and maximum of the range and assign a variable to plot'); |
| this.setHelpUrl('http://www.example.com/'); |
| } |
| }; |
| 95,13 → 98,19 |
| .appendField("Number of events: ") |
| .appendField(new Blockly.FieldNumber(5000, 0), "neve"); |
| this.appendDummyInput() |
| .appendField("First event: ") |
| .appendField(new Blockly.FieldNumber(0, 0), "first"); |
| this.appendDummyInput() |
| .appendField("Data Source") |
| .appendField(new Blockly.FieldDropdown([["hadron-1", "1"], ["hadron-2", "2"]]), "datasource"); |
| this.appendDummyInput() |
| .appendField("Print particle list?") |
| .appendField(new Blockly.FieldDropdown([["No", "0"], ["Yes", "1"]]), "print"); |
| this.appendValueInput("list") |
| .setCheck("particle list") |
| .appendField("Particle List"); |
| this.setColour(230); |
| this.setTooltip(''); |
| this.setTooltip('Run the analysis, specify data source, number of events, first event and a list of particles to process.'); |
| this.setHelpUrl('http://www.example.com/'); |
| } |
| }; |
| 130,7 → 139,7 |
| this.setInputsInline(true); |
| this.setOutput(true, "particle list"); |
| this.setColour(180); |
| this.setTooltip(''); |
| this.setTooltip('Create a list of primary particles, if not used, the primary particles are used in the empty particle list connectors'); |
| this.setHelpUrl('http://www.example.com/'); |
| } |
| }; |
| /belle2/masterclass/js/belle2_gen.js |
|---|
| 4,12 → 4,13 |
| 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 dropdown_sameparticles = block.getFieldValue('sameparticles'); |
| 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'; |
| var code = '{"combiner":{"list1":' + value_list1 + ',"list2":' + value_list2 + ',"sameparticles":"'+ dropdown_sameparticles +'","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]; |
| }; |
| 42,11 → 43,14 |
| Blockly.JavaScript['simple_analysis'] = function(block) { |
| var number_neve = block.getFieldValue('neve'); |
| var number_first= block.getFieldValue('first'); |
| var number_print= block.getFieldValue('print'); |
| 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'; |
| var code = '{"analysis":{"neve":"' + number_neve + '","first":"' + number_first + '","print":"' + number_print + '","datasource":"' + dropdown_datasource + '","list":' + value_list + '}}\n'; |
| return code; |
| }; |
| /belle2/masterclass/js/belle2_gen_mod.js |
|---|
| 52,10 → 52,11 |
| Blockly.JavaScript['simple_analysis'] = function(block) { |
| var number_neve = block.getFieldValue('neve'); |
| var number_first = block.getFieldValue('first'); |
| var dropdown_datasource = block.getFieldValue('datasource'); |
| var value_list = Blockly.JavaScript.valueToCode(block, 'list', Blockly.JavaScript.ORDER_ATOMIC); |
| // TODO: Assemble JavaScript into code variable. |
| var code = 'simple_analysis(' + ' neve ' + number_neve + ' datasource ' + dropdown_datasource + ' list ' + value_list + ')\n'; |
| var code = 'simple_analysis(' + ' neve ' + number_neve ' + ' first ' + number_first + ' datasource ' + dropdown_datasource + ' list ' + value_list + ')\n'; |
| //var code = '...'; |
| return code; |
| }; |