Subversion Repositories f9daq

Rev

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

Blockly.Blocks['particle_combiner'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("Combine 2 particles");
    this.appendValueInput("list1")
        .setCheck("particle list")
        .setAlign(Blockly.ALIGN_RIGHT)
        .appendField("1. Particle");
    this.appendValueInput("list2")
        .setCheck("particle list")
        .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("Set identity to")
        .appendField(new Blockly.FieldDropdown([["electron", "ELECTRON"], ["muon", "MUON"], ["pion", "PION"], ["kaon", "KAON"], ["proton", "PROTON"], ["photon", "PHOTON"], ["Phi", "PHI"], ["D", "D"], ["D*", "DSTAR"], ["J/Psi", "JPSI"]]), "simplepid");
    this.appendDummyInput()
        .setAlign(Blockly.ALIGN_RIGHT)
        .appendField("Min mass [GeV/c2] :")
        .appendField(new Blockly.FieldNumber(0, 0, Infinity, 0.0001), "mass0");
    this.appendDummyInput()
        .setAlign(Blockly.ALIGN_RIGHT)
        .appendField("Max mass  [GeV/c2] :")
        .appendField(new Blockly.FieldNumber(0, 0, Infinity, 0.0001), "mass1");
    this.appendValueInput("histogram")
        .setCheck("histogram")
        .appendField("Histogram");
    this.setInputsInline(false);
    this.setOutput(true, "particle list");
    this.setColour(120);
    this.setTooltip('Combine two particles in the new particle by making combinations between particles in two input lists');
    this.setHelpUrl('http://www.example.com/');
  }
};

Blockly.Blocks['particle_selector'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("Select Particles");
    this.appendValueInput("list1")
        .setCheck("particle list")
        .appendField("Particles");
    this.appendDummyInput()
        .appendField("Charge")
        .appendField(new Blockly.FieldDropdown([["-1", "-1"], ["0", "0"], ["1", "1"], ["Any", "2"]]), "chargelist");
    this.appendDummyInput()
        .appendField("Type")
        .appendField(new Blockly.FieldDropdown([["electron", "ELECTRON"], ["muon", "MUON"], ["pion", "PION"], ["kaon", "KAON"], ["proton", "PROTON"], ["photon", "PHOTON"], ["D", "D"], ["D*", "DSTAR"], ["Phi", "PHI"],["J/Psi", "JPSI"], ["B", "B"], ["all particles", "ALL"]]), "simplepid");
    this.appendValueInput("histogram")
        .setCheck("histogram")
        .appendField("Histogram");
    this.setInputsInline(false);
    this.setOutput(true, "particle list");
    this.setColour(65);
    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/');
  }
};

Blockly.Blocks['histogram_creator'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("Histogram");
    this.appendDummyInput()
        .setAlign(Blockly.ALIGN_RIGHT)
        .appendField("Title")
        .appendField(new Blockly.FieldTextInput("Reconstructed Mass"), "name");
    this.appendDummyInput()
        .setAlign(Blockly.ALIGN_RIGHT)
        .appendField("Number of bins")
        .appendField(new Blockly.FieldNumber(40, 0), "nbins");
    this.appendDummyInput()
        .setAlign(Blockly.ALIGN_RIGHT)
        .appendField("Min:")
        .appendField(new Blockly.FieldNumber(0, -Infinity, Infinity, 0.0001), "min");
    this.appendDummyInput()
        .setAlign(Blockly.ALIGN_RIGHT)
        .appendField("Max:")
        .appendField(new Blockly.FieldNumber(0, -Infinity, Infinity, 0.0001), "max");
    this.appendDummyInput()
        .appendField("Variable")
        .appendField(new Blockly.FieldDropdown([["mass", "GetMass"], ["momentum", "GetMomentum"], ["energy", "GetEnergy"],["charge", "GetCharge"], ["identity", "GetPid"],["polar angle", "GetTheta"],["cos(polar ang.)", "GetCosTheta"],["px", "GetXMomentum"],["py", "GetYMomentum"],["pz", "GetZMomentum"],["pT", "GetTransverseMomentum"]]), "varname");
    this.setInputsInline(true);
    this.setOutput(true, "histogram");
    this.setColour(20);
    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/');
  }
};

Blockly.Blocks['simple_analysis'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("Belle II Masterclass");
    this.appendDummyInput()
        .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('Run the analysis, specify data source, number of events, first event and a list of particles to process.');
    this.setHelpUrl('http://www.example.com/');
  }
};

Blockly.Blocks['particle_mass_fix'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("Particle mass fix");
    this.appendValueInput("list")
        .setCheck("particle list")
        .appendField("Particle List");
    this.setOutput(true, "particle list");
    this.setColour(150);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};

Blockly.Blocks['primary_list'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("Stored Particles:");
    this.appendValueInput("histogram")
        .setCheck("histogram")
        .appendField("Histogram:");
    this.setInputsInline(true);
    this.setOutput(true, "particle list");
    this.setColour(180);
    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/');
  }
};