lhcb-ntuple-wizard-test 0.0.1 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -57,7 +57,7 @@ class DecaysList extends React.Component {
57
57
  _defineProperty(this, "getDecayItem", () => {
58
58
  const strippingDecayItem = this.state.items.map(decay => /*#__PURE__*/(0, _jsxRuntime.jsx)(_DecayItem.default, {
59
59
  decay: decay,
60
- selected: this.state.selectedDecays.includes(decay),
60
+ selected: this.state.selectedDecays.some(selected => selected.descriptors.plain === decay.descriptors.plain),
61
61
  parentCallback: this.callbackFunction
62
62
  }, decay.descriptors.plain));
63
63
  return strippingDecayItem;
@@ -16,7 +16,6 @@ var _creatable = _interopRequireDefault(require("react-select/creatable"));
16
16
  var _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
17
17
  var _BKPath = _interopRequireDefault(require("../lib/BKPath"));
18
18
  var _DTTConfig = _interopRequireDefault(require("../lib/DTTConfig"));
19
- var _analysisHelpers = _interopRequireDefault(require("../lib/analysisHelpers"));
20
19
  var _utils = require("../lib/utils");
21
20
  var _Dataset = _interopRequireDefault(require("./Dataset"));
22
21
  var _Decay = _interopRequireDefault(require("./Decay"));
@@ -325,7 +324,7 @@ class LinesTable extends _react.default.Component {
325
324
  row.paths.forEach((path, _index) => {
326
325
  const jobID = uniquePathList.findIndex(otherPath => otherPath === path);
327
326
  const key = "job".concat(jobID);
328
- const dttFile = "".concat(row.dtt.getSafeName(), ".py");
327
+ const dttFile = row.dtt.getSafeName();
329
328
  if (key in info) {
330
329
  info[key].options.push(dttFile);
331
330
  } else {
@@ -497,11 +496,6 @@ class LinesTable extends _react.default.Component {
497
496
  });
498
497
  const allFiles = this.generateAllFiles();
499
498
  const formData = new FormData();
500
- _analysisHelpers.default.forEach(file => {
501
- formData.append("analysisHelpersFiles[]", new Blob([file.content], {
502
- type: "text/plain"
503
- }), file.name);
504
- });
505
499
  allFiles.forEach(file => {
506
500
  formData.append("generatedFiles[]", new Blob([file[1]], {
507
501
  type: "text/plain"
package/dist/config.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "metadata_baseurl": "https://lbwizard-metadata.web.cern.ch/2.0.1/",
2
+ "metadata_baseurl": "https://lbwizard-metadata.web.cern.ch/2.1.0/",
3
3
  "metadata_files": {
4
4
  "particleProperties": "particle_properties",
5
5
  "lokiVariables": "loki",
@@ -138,6 +138,10 @@ class DTTConfig {
138
138
  this.metadata[toolClass].interface.forEach(parameter => {
139
139
  params[parameter.name] = _lodash.default.cloneDeep(parameter["default"]); // Deep copy
140
140
  });
141
+ // Removing the option to configure the Preambulo for tools where it exists -- this is to prevent arbitrary Python code injection
142
+ if (Object.keys(params).includes("Preambulo")) {
143
+ delete params.Preambulo;
144
+ }
141
145
  return params;
142
146
  } else {
143
147
  return {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lhcb-ntuple-wizard-test",
3
- "version": "0.0.1",
3
+ "version": "1.0.6",
4
4
  "description": "An application to access large-scale open data from LHCb",
5
5
  "url": "https://gitlab.cern.ch/lhcb-dpa/wp6-analysis-preservation-and-open-data/lhcb-ntuple-wizard-frontend/issues",
6
6
  "private": false,
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*****************************************************************************\
8
- * (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration *
9
- * *
10
- * This software is distributed under the terms of the GNU General Public *
11
- * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
12
- * *
13
- * In applying this licence, CERN does not waive the privileges and immunities *
14
- * granted to it by virtue of its status as an Intergovernmental Organization *
15
- * or submit itself to any jurisdiction. *
16
- \*****************************************************************************/
17
- const analysisHelpers = [{
18
- name: "__init__.py",
19
- content: ""
20
- }, {
21
- name: "decaytreetuple.py",
22
- content: "from Configurables import DaVinci, DecayTreeTuple, MCDecayTreeTuple\nfrom DecayTreeTuple.Configuration import addTupleTool\n\ntry:\n from six import string_types\nexcept ImportError:\n string_types = (str, unicode)\n\ndef parse_tools(configurable, tools, verbose = False):\n configurable_name = configurable.name()\n for tool in tools:\n if isinstance(tool, string_types):\n configurable.ToolList += [tool]\n if verbose: print(\"Adding {tool} to {configurable_name}.ToolList\".format(**locals()))\n elif isinstance(tool, dict):\n assert(len(tool) == 1) # must have one key: the name\n name = [key for key in tool][0]\n if verbose: print(\"Adding {name} to {configurable_name}\".format(**locals()))\n tool_conf = configurable.addTupleTool(name)\n tool_conf_name = tool_conf.name()\n for option, value in tool[name].items():\n if verbose: print(\"\t{tool_conf_name}.{option} = {value}\".format(**locals()))\n tool_conf.setProp(option, value)\n\ndef configure_dtt(config, verbose = False):\n dtt_class, dtt_name = config[\"name\"].split(\"/\")\n if dtt_class == \"DecayTreeTuple\":\n dtt = DecayTreeTuple(dtt_name)\n elif dtt_class == \"MCDecayTreeTuple\":\n dtt = MCDecayTreeTuple(dtt_name)\n else:\n raise ValueError(\"Class \"+dtt_class+\" not recognised\")\n dtt.setDescriptorTemplate(config[\"descriptorTemplate\"])\n dtt.Inputs = config[\"inputs\"]\n if DaVinci().InputType == \"MDST\":\n dtt.Inputs = [i.removeprefix(DaVinci().RootInTES+\"/\") for i in dtt.Inputs]\n dtt.ToolList = [] # Usually constructed with a default ToolList, but we want to replace that\n if \"tools\" in config:\n parse_tools(dtt, config[\"tools\"], verbose)\n if \"branches\" in config:\n for particle in config[\"branches\"]:\n if \"tools\" in config[\"branches\"][particle]:\n parse_tools(getattr(dtt, particle), config[\"branches\"][particle][\"tools\"], verbose)\n if \"groups\" in config:\n for group in config[\"groups\"]:\n for particle in group.split(\",\"):\n if \"tools\" in config[\"groups\"][group]:\n parse_tools(getattr(dtt, particle), config[\"groups\"][group][\"tools\"], verbose)\n if verbose:\n print(dtt)\n for particle in config[\"branches\"]:\n print(getattr(dtt, particle))\n return dtt\n\ndef save_config(dtt, verbose = False):\n \"\"\"\n Need to capture all non-blank properties and those of all child configurables\n \"\"\"\n raise NotImplementedError()\n\n"
23
- }, {
24
- name: "dst_writer.py",
25
- content: "from DSTWriters.Configuration import SelDSTWriter, stripDSTStreamConf, stripDSTElements, stripMicroDSTStreamConf, stripMicroDSTElements\n\ndef write_dst(selection_sequences, enable_packing = True, selective_raw_event = False, microDST = False, is_mc = None, extra_items = None):\n # Configuration of SelDSTWriter\n if microDST:\n elements = {\"default\": stripMicroDSTElements(pack = enable_packing, isMC = is_mc)}\n config = {\"default\": stripMicroDSTStreamConf(pack = enable_packing, isMC = is_mc)}\n else:\n elements = {\"default\": stripDSTElements(pack = enable_packing)}\n config = {\"default\": stripDSTStreamConf(pack = enable_packing, selectiveRawEvent = selective_raw_event)}\n if extra_items:\n config[\"default\"].extraItems += extra_items\n dst_writer = SelDSTWriter(\"MyDSTWriter\", StreamConf = config, MicroDSTElements = elements, OutputFileSuffix = \"0\"*6, SelectionSequences = selection_sequences)\n return dst_writer.sequence()\n\n"
26
- }, {
27
- name: "stripping.py",
28
- content: "from Configurables import EventNodeKiller, GaudiSequencer, ProcStatusCheck, StrippingTCK\nfrom StrippingConf.Configuration import StrippingConf, StrippingStream\nfrom StrippingSettings.Utils import strippingConfiguration\nfrom StrippingArchive.Utils import buildStreams\nfrom StrippingArchive import strippingArchive\n\nimport re\n\ndef line_name_is(name):\n \"\"\"\n Match stripping lines by exact name\n \"\"\"\n return lambda l: l.name() == name\n\ndef line_name_contains(phrase):\n \"\"\"\n Match stripping lines whose name contains a specific string\n \"\"\"\n return lambda l: phrase in l.name()\n\ndef line_name_matches(expression):\n \"\"\"\n Match stripping lines whose name matches a regular expression\n \"\"\"\n p = re.compile(expression)\n return lambda l: p.match(l.name())\n\ndef line_name_in_list(name_list):\n \"\"\"\n Match stripping lines whose name appears in a list\n \"\"\"\n return lambda l: l.name() in name_list\n\ndef stripping_tck(version, tes_prefix = \"Strip\"):\n \"\"\"\n Form a stripping TCK from the stripping version.\n The pattern is VVVVSSSS where V are digits from the DaVinci version, and S are digits from the Stripping version.\n The DaVinci version is taken from the MC production step. NB: this may not match the version used to strip data, due to MC-specific patches.\n The major version numbers have 2 digits of space, so they are written like the decimal number.\n The p and r version numbers have only 1 digit, so numbers 10 to 15 are represented by letters A-F.\n \"\"\"\n tck = {\n \"21r1\" : 0x36152110,\n \"21r1p1\": 0x39112111,\n \"21r1p2\": 0x39162112,\n \"21\" : 0x36152100,\n \"21r0p1\": 0x39112101,\n \"21r0p2\": 0x39162102,\n \"24r2\" : 0x44A52420,\n \"28r2\" : 0x44A52820,\n \"29r2\" : 0x42732920,\n \"29r2p1\": 0x42922921,\n \"34\" : 0x44703400,\n \"34r0p1\": 0x44A23401,\n }[version]\n return StrippingTCK(HDRLocation = \"/Event/{}/Phys/DecReports\".format(tes_prefix), TCK = tck)\n\nstripping_dv_versions = {\n \"21r1\" : \"v36r1p5\",\n \"21r1p1\": \"v39r1p1\",\n \"21r1p2\": \"v39r1p6\",\n \"21\" : \"v36r1p5\",\n \"21r0p1\": \"v39r1p1\",\n \"21r0p2\": \"v39r1p6\",\n \"24r2\" : \"v44r10p5\",\n \"28r2\" : \"v44r10p5\",\n \"29r2\" : \"v42r7p3\",\n \"29r2p1\": \"v42r9p2\",\n \"34\" : \"v44r7\",\n \"34r0p1\": \"v44r10p2\",\n}\n\nevent_node_killer = EventNodeKiller(\"StripKiller\", Nodes = [\"/Event/AllStreams\", \"/Event/Strip\"])\n\ndef custom_stripping_stream(version, line_filter, stream_name):\n \"\"\"\n Build a custom stripping stream with the desired lines\n \"\"\"\n # Build streams\n stripping_name = \"stripping{}\".format(version)\n conf = strippingConfiguration(stripping_name)\n archive = strippingArchive(stripping_name)\n all_streams = buildStreams(conf, archive)\n custom_stream = StrippingStream(stream_name)\n # Extract the desired lines and add them to the new stream\n for stream in all_streams:\n matched_lines = filter(line_filter, stream.lines)\n custom_stream.appendLines(matched_lines)\n return custom_stream\n\ndef stripping_mc_filter(version, line_filter, stream_name = \"Filter\"):\n \"\"\"\n Build custom stripping sequence with standard options for filtered MC production.\n \"\"\"\n # Configure the stripping\n custom_stream = custom_stripping_stream(version, line_filter, stream_name)\n stripping_conf = StrippingConf(Streams = [custom_stream], MaxCandidates = 2000, TESPrefix = \"Strip\", AcceptBadEvents = False, BadEventSelection = ProcStatusCheck())\n custom_stream.sequence().IgnoreFilterPassed = False\n # Combine the sequences\n seq = GaudiSequencer(\"{}Sequence\".format(stream_name))\n seq.Members += [stripping_conf.sequence(), stripping_tck(version, tes_prefix)]\n\ndef restripping(version, line_filter = line_name_contains(\"Stripping\"), stream_name = \"AllStreams\", tes_prefix = \"Strip\", max_candidates = 2000, accept_bad_events = False, ignore_filter_passed = False):\n \"\"\"\n Build custom stripping sequence for running on an already-stripped sample.\n \"\"\"\n # Configure the stripping\n custom_stream = custom_stripping_stream(version, line_filter, stream_name)\n stripping_conf = StrippingConf(Streams = [custom_stream], MaxCandidates = max_candidates, TESPrefix = tes_prefix, AcceptBadEvents = accept_bad_events, BadEventSelection = ProcStatusCheck())\n custom_stream.sequence().IgnoreFilterPassed = ignore_filter_passed\n # Combine the sequences\n seq = GaudiSequencer(\"{}Sequence\".format(stream_name))\n seq.Members += [event_node_killer, stripping_conf.sequence()]\n return seq\n\n"
29
- }];
30
- var _default = exports.default = analysisHelpers;