lhcb-ntuple-wizard-test 1.3.3 → 2.0.1

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.
Files changed (167) hide show
  1. package/README.md +1 -2
  2. package/dist/App.d.ts +12 -0
  3. package/dist/App.js +22 -0
  4. package/dist/components/ConfigFilesUploadingAlert.d.ts +1 -0
  5. package/dist/components/ConfigFilesUploadingAlert.js +5 -0
  6. package/dist/components/DatasetEventTypeBadge.d.ts +5 -0
  7. package/dist/components/DatasetEventTypeBadge.js +23 -0
  8. package/dist/components/DatasetInfo.d.ts +5 -0
  9. package/dist/components/DatasetInfo.js +21 -0
  10. package/dist/components/DecayLatex.d.ts +7 -0
  11. package/dist/components/DecayLatex.js +103 -0
  12. package/dist/components/DecayList.d.ts +8 -0
  13. package/dist/components/DecayList.js +37 -0
  14. package/dist/components/DecayListItem.d.ts +11 -0
  15. package/dist/components/DecayListItem.js +23 -0
  16. package/dist/components/DecayTagBadge.d.ts +5 -0
  17. package/dist/components/DecayTagBadge.js +21 -0
  18. package/dist/components/DecayTreeCard.d.ts +7 -0
  19. package/dist/components/DecayTreeCard.js +43 -0
  20. package/dist/components/DecayTreeCardHeader.d.ts +7 -0
  21. package/dist/components/DecayTreeCardHeader.js +5 -0
  22. package/dist/components/DecayTreeGraph.d.ts +9 -0
  23. package/dist/components/DecayTreeGraph.js +89 -0
  24. package/dist/components/DeleteButton.d.ts +9 -0
  25. package/dist/components/DeleteButton.js +16 -53
  26. package/dist/components/DttNameInput.d.ts +9 -0
  27. package/dist/components/DttNameInput.js +73 -0
  28. package/dist/components/LineTableRow.d.ts +9 -0
  29. package/dist/components/LineTableRow.js +123 -0
  30. package/dist/components/LoadingIndicator.d.ts +6 -0
  31. package/dist/components/LoadingIndicator.js +5 -0
  32. package/dist/components/NtupleWizard.d.ts +26 -0
  33. package/dist/components/NtupleWizard.js +28 -137
  34. package/dist/components/NumStrippingLinesBadge.d.ts +8 -0
  35. package/dist/components/NumStrippingLinesBadge.js +10 -0
  36. package/dist/components/ParticleDropdown.d.ts +8 -0
  37. package/dist/components/ParticleDropdown.js +33 -0
  38. package/dist/components/ParticleTagBadge.d.ts +9 -0
  39. package/dist/components/ParticleTagBadge.js +22 -0
  40. package/dist/components/ParticleTagFilters.d.ts +6 -0
  41. package/dist/components/ParticleTagFilters.js +51 -0
  42. package/dist/components/PolarityBadge.d.ts +5 -0
  43. package/dist/components/PolarityBadge.js +13 -33
  44. package/dist/components/StrippingLineBadge.d.ts +7 -0
  45. package/dist/components/StrippingLineBadge.js +29 -0
  46. package/dist/components/StrippingLineInfo.d.ts +8 -0
  47. package/dist/components/StrippingLineInfo.js +17 -0
  48. package/dist/components/SubmitRequestButton.d.ts +11 -0
  49. package/dist/components/SubmitRequestButton.js +39 -0
  50. package/dist/components/TagDropdown.d.ts +12 -0
  51. package/dist/components/TagDropdown.js +31 -0
  52. package/dist/components/TupleToolDocsAccordion.d.ts +5 -0
  53. package/dist/components/TupleToolDocsAccordion.js +14 -0
  54. package/dist/components/TupleToolDropdown.d.ts +21 -0
  55. package/dist/components/TupleToolDropdown.js +29 -0
  56. package/dist/components/TupleToolGroup.d.ts +6 -0
  57. package/dist/components/TupleToolGroup.js +22 -0
  58. package/dist/components/TupleToolLabel.d.ts +6 -0
  59. package/dist/components/TupleToolLabel.js +20 -0
  60. package/dist/components/TupleToolList.d.ts +7 -0
  61. package/dist/components/TupleToolList.js +38 -0
  62. package/dist/components/YearBadge.d.ts +5 -0
  63. package/dist/components/YearBadge.js +13 -33
  64. package/dist/components/modals/AddTupleToolModal.d.ts +7 -0
  65. package/dist/components/modals/AddTupleToolModal.js +32 -0
  66. package/dist/components/modals/ConfigureTupleToolModal.d.ts +8 -0
  67. package/dist/components/modals/ConfigureTupleToolModal.js +43 -0
  68. package/dist/components/modals/ReasonForRequestModal.d.ts +8 -0
  69. package/dist/components/modals/ReasonForRequestModal.js +49 -0
  70. package/dist/components/modals/UploadDttConfigModal.d.ts +7 -0
  71. package/dist/components/modals/UploadDttConfigModal.js +35 -0
  72. package/dist/components/modals/UploadProdConfigModal.d.ts +5 -0
  73. package/dist/components/modals/UploadProdConfigModal.js +27 -0
  74. package/dist/components/tupleToolParams/BoolParamInput.d.ts +16 -0
  75. package/dist/components/tupleToolParams/BoolParamInput.js +15 -0
  76. package/dist/components/tupleToolParams/DictParamInput.d.ts +14 -0
  77. package/dist/components/tupleToolParams/DictParamInput.js +31 -0
  78. package/dist/components/tupleToolParams/ListParamInput.d.ts +14 -0
  79. package/dist/components/tupleToolParams/ListParamInput.js +46 -0
  80. package/dist/components/tupleToolParams/NumParamInput.d.ts +18 -0
  81. package/dist/components/tupleToolParams/NumParamInput.js +25 -0
  82. package/dist/components/tupleToolParams/StrParamInput.d.ts +19 -0
  83. package/dist/components/tupleToolParams/StrParamInput.js +22 -0
  84. package/dist/config.d.ts +78 -0
  85. package/dist/config.js +72 -0
  86. package/dist/{style/DecaysList.css → index.d.ts} +2 -6
  87. package/dist/index.js +2 -11
  88. package/dist/models/bkPath.d.ts +11 -0
  89. package/dist/models/bkPath.js +40 -0
  90. package/dist/models/blobFile.d.ts +12 -0
  91. package/dist/models/blobFile.js +1 -0
  92. package/dist/models/decayData.d.ts +15 -0
  93. package/dist/models/decayData.js +1 -0
  94. package/dist/models/dropdownOption.d.ts +5 -0
  95. package/dist/models/dropdownOption.js +1 -0
  96. package/dist/models/dtt.d.ts +108 -0
  97. package/dist/models/dtt.js +149 -0
  98. package/dist/models/jobConfig.d.ts +7 -0
  99. package/dist/models/jobConfig.js +1 -0
  100. package/dist/models/particle.d.ts +12 -0
  101. package/dist/models/particle.js +1 -0
  102. package/dist/models/particleTag.d.ts +4 -0
  103. package/dist/models/particleTag.js +1 -0
  104. package/dist/models/rowData.d.ts +15 -0
  105. package/dist/models/rowData.js +1 -0
  106. package/dist/models/strippingLine.d.ts +5 -0
  107. package/dist/models/strippingLine.js +1 -0
  108. package/dist/models/strippingLineOption.d.ts +6 -0
  109. package/dist/models/strippingLineOption.js +1 -0
  110. package/dist/models/tupleTool.d.ts +8 -0
  111. package/dist/models/tupleTool.js +18 -0
  112. package/dist/models/tupleTreeGraphData.d.ts +20 -0
  113. package/dist/models/tupleTreeGraphData.js +1 -0
  114. package/dist/models/yamlFile.d.ts +11 -0
  115. package/dist/models/yamlFile.js +78 -0
  116. package/dist/pages/DecaySearchPage.d.ts +5 -0
  117. package/dist/pages/DecaySearchPage.js +197 -0
  118. package/dist/pages/DecayTreeConfigPage.d.ts +5 -0
  119. package/dist/pages/DecayTreeConfigPage.js +63 -0
  120. package/dist/pages/LinesTablePage.d.ts +14 -0
  121. package/dist/pages/LinesTablePage.js +120 -0
  122. package/dist/providers/DttProvider.d.ts +24 -0
  123. package/dist/providers/DttProvider.js +77 -0
  124. package/dist/providers/MetadataProvider.d.ts +87 -0
  125. package/dist/providers/MetadataProvider.js +50 -0
  126. package/dist/providers/ProductionConfigProvider.d.ts +14 -0
  127. package/dist/providers/ProductionConfigProvider.js +76 -0
  128. package/dist/providers/RequestProvider.d.ts +15 -0
  129. package/dist/providers/RequestProvider.js +35 -0
  130. package/dist/providers/RowsProvider.d.ts +14 -0
  131. package/dist/providers/RowsProvider.js +31 -0
  132. package/dist/utils/mathjaxUtils.d.ts +12 -0
  133. package/dist/utils/mathjaxUtils.js +24 -0
  134. package/dist/utils/utils.d.ts +31 -0
  135. package/dist/utils/utils.js +80 -0
  136. package/package.json +43 -21
  137. package/dist/components/App.js +0 -99
  138. package/dist/components/ConfigDict.js +0 -103
  139. package/dist/components/ConfigList.js +0 -94
  140. package/dist/components/ConfigNode.js +0 -320
  141. package/dist/components/ConfigValue.js +0 -86
  142. package/dist/components/Dataset.js +0 -67
  143. package/dist/components/Decay.js +0 -50
  144. package/dist/components/DecayItem.js +0 -101
  145. package/dist/components/DecayTag.js +0 -52
  146. package/dist/components/DecayTree.js +0 -451
  147. package/dist/components/DecaysList.js +0 -107
  148. package/dist/components/DescriptorsSearch.js +0 -352
  149. package/dist/components/EventTypeBadge.js +0 -45
  150. package/dist/components/ItemSearch.js +0 -120
  151. package/dist/components/LinesTable.js +0 -1105
  152. package/dist/components/ParticleTag.js +0 -54
  153. package/dist/components/SearchItem.js +0 -99
  154. package/dist/components/SelectParticle.js +0 -61
  155. package/dist/components/SelectTag.js +0 -66
  156. package/dist/components/SelectTool.js +0 -59
  157. package/dist/components/SelectVariables.js +0 -106
  158. package/dist/components/StrippingBadge.js +0 -64
  159. package/dist/components/StrippingLine.js +0 -50
  160. package/dist/components/TupleTool.js +0 -46
  161. package/dist/components/VariablesSearch.js +0 -128
  162. package/dist/config.json +0 -72
  163. package/dist/contexts/MetadataContext.js +0 -135
  164. package/dist/lib/BKPath.js +0 -58
  165. package/dist/lib/DTTConfig.js +0 -178
  166. package/dist/lib/mathjax.js +0 -35
  167. package/dist/lib/utils.js +0 -191
@@ -1,128 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _utils = require("../utils");
9
- var _Tooltip = _interopRequireDefault(require("react-bootstrap/Tooltip"));
10
- var _OverlayTrigger = _interopRequireDefault(require("react-bootstrap/OverlayTrigger"));
11
- var _MetadataContext = _interopRequireDefault(require("../MetadataContext"));
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
15
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
16
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
17
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
18
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*****************************************************************************\
19
- * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
20
- * *
21
- * This software is distributed under the terms of the GNU General Public *
22
- * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
23
- * *
24
- * In applying this licence, CERN does not waive the privileges and immunities *
25
- * granted to it by virtue of its status as an Intergovernmental Organization *
26
- * or submit itself to any jurisdiction. *
27
- \*****************************************************************************/
28
- const {
29
- search
30
- } = window.location;
31
- const query = new URLSearchParams(search).get("s");
32
- //const [searchQuery, setSearchQuery] = useState(query || '')
33
-
34
- function compare(a, b) {
35
- return Object.keys(a)[0] > Object.keys(b)[0] ? 1 : Object.keys(a)[0] < Object.keys(b)[0] ? -1 : 0;
36
- }
37
- class VariablesSearch extends _react.default.Component {
38
- constructor() {
39
- super(...arguments);
40
- _defineProperty(this, "state", {
41
- variables: (0, _utils.parse_searchitem_descriptions)(this.context.metadata.lokiVariables),
42
- searchQuery: query || ""
43
- });
44
- }
45
- filterVariables(variables, query) {
46
- /*
47
- const nInclOptions = variables.filter(
48
- variable => !Object.keys(variable)[0].toLowerCase().includes(query.toLowerCase())
49
- );
50
- */
51
- const inclOptions = variables.filter(variable => Object.keys(variable)[0].toLowerCase().includes(query.toLowerCase()) && Object.keys(variable)[0].toLowerCase() !== query.toLowerCase());
52
- const matchedOptions = variables.filter(variable => Object.keys(variable)[0].toLowerCase() === query.toLowerCase());
53
- const orderedNewOptions = matchedOptions.sort(compare);
54
- //this.setState({
55
- return orderedNewOptions.concat(inclOptions);
56
- //});
57
- /* if (!query) {
58
- return variables;
59
- }
60
- return variables.filter((variable) => {
61
- const name = Object.keys(variable)[0].toLowerCase();
62
- return name.includes(query.toLowerCase());
63
- });*/
64
- }
65
- render() {
66
- //const {decay} = this.props
67
- const filteredVariables = this.filterVariables(this.state.variables, this.state.searchQuery);
68
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
69
- width: "20px",
70
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("form", {
71
- action: "/",
72
- method: "get",
73
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
74
- htmlFor: "header-search",
75
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
76
- className: "visually-hidden",
77
- children: "Search variables"
78
- })
79
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
80
- value: this.state.searchQuery,
81
- onInput: e => this.setState({
82
- searchQuery: e.target.value
83
- }),
84
- type: "text",
85
- id: "header-search",
86
- placeholder: "Search variables",
87
- name: "s"
88
- })]
89
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
90
- className: "scroll",
91
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
92
- children: filteredVariables.map((variable, index) =>
93
- /*#__PURE__*/
94
- // <li key={Object.keys(variable)[0]}>
95
- (0, _jsxRuntime.jsx)("div", {
96
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
97
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OverlayTrigger.default, {
98
- placement: "top",
99
- delay: {
100
- hide: 450,
101
- show: 300
102
- },
103
- overlay: props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, _objectSpread(_objectSpread({}, props), {}, {
104
- children: Object.values(variable)[0]
105
- })),
106
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
107
- children: Object.keys(variable)[0]
108
- })
109
- })
110
- })
111
- }, index)
112
-
113
- //</li>
114
- )
115
- })
116
- })]
117
- });
118
- }
119
- }
120
- _defineProperty(VariablesSearch, "contextType", _MetadataContext.default);
121
- var _default = exports.default = VariablesSearch;
122
- /* <div>
123
- <ul>
124
- {filteredVariables.map(variable => (
125
- <li key={Object.keys(variable)[0]}>{Object.keys(variable)[0]}</li>
126
- ))}
127
- </ul>
128
- </div> */
package/dist/config.json DELETED
@@ -1,72 +0,0 @@
1
- {
2
- "metadata_baseurl": "https://lbwizard-metadata.web.cern.ch/3.1.0/",
3
- "metadata_files": {
4
- "particleProperties": "particle_properties",
5
- "lokiVariables": "loki",
6
- "decays": "decays",
7
- "stripping": "stripping",
8
- "strippingHints": "stripping_hints",
9
- "userHints": "user_hints",
10
- "tupleTools": "tupletools",
11
- "dataset": "dataset",
12
- "kgdoc": "kgdoc",
13
- "embedding": "embedding"
14
- },
15
- "batch_size": 10,
16
- "particleTagGroupStyles": {
17
- "category": "dark",
18
- "charge": "primary",
19
- "flavour": "success",
20
- "spin": "danger",
21
- "lifetime": "secondary"
22
- },
23
- "dttGraphOptions": {
24
- "layout": {
25
- "hierarchical": {"sortMethod": "directed"}
26
- },
27
- "nodes": {
28
- "borderWidth": 0,
29
- "borderWidthSelected": 0,
30
- "imagePadding": 10,
31
- "font": {
32
- "strokeWidth": 20,
33
- "background": "white"
34
- },
35
- "color": {
36
- "background": "white",
37
- "highlight": {"background": "white"},
38
- "hover": {"background": "#eee"}
39
- },
40
- "scaling": {
41
- "min": 32,
42
- "max": 32
43
- },
44
- "value": 1,
45
- "shape": "image",
46
- "shapeProperties": {
47
- "useBorderWithImage": true,
48
- "useImageSize": false
49
- }
50
- },
51
- "edges": {
52
- "color": "black",
53
- "width": 1,
54
- "selectionWidth": 0,
55
- "hoverWidth": 0
56
- },
57
- "physics": {
58
- "enabled": false
59
- },
60
- "interaction": {
61
- "dragNodes": false,
62
- "multiselect": true,
63
- "selectConnectedEdges": false,
64
- "hoverConnectedEdges": false,
65
- "hover": true,
66
- "zoomView": false
67
- },
68
- "height": "500px",
69
- "autoResize": true,
70
- "width": "100%"
71
- }
72
- }
@@ -1,135 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.MetadataContext = void 0;
7
- exports.MetadataLoadWall = MetadataLoadWall;
8
- exports.MetadataProvider = MetadataProvider;
9
- exports.createMetadataLoadWall = createMetadataLoadWall;
10
- exports.createMetadataProvider = createMetadataProvider;
11
- exports.useMetadataContext = exports.default = void 0;
12
- var _propTypes = _interopRequireDefault(require("prop-types"));
13
- var _reactBootstrap = require("react-bootstrap");
14
- var _react = require("react");
15
- var _utils = require("../lib/utils");
16
- var _config2 = _interopRequireDefault(require("../config"));
17
- var _jsxRuntime = require("react/jsx-runtime");
18
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
22
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
23
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*****************************************************************************\
24
- * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
25
- * *
26
- * This software is distributed under the terms of the GNU General Public *
27
- * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
28
- * *
29
- * In applying this licence, CERN does not waive the privileges and immunities *
30
- * granted to it by virtue of its status as an Intergovernmental Organization *
31
- * or submit itself to any jurisdiction. *
32
- \*****************************************************************************/
33
- const MetadataContext = exports.MetadataContext = /*#__PURE__*/(0, _react.createContext)({});
34
- var _default = exports.default = MetadataContext;
35
- const useMetadataContext = _init => (0, _react.useContext)(MetadataContext);
36
- exports.useMetadataContext = useMetadataContext;
37
- function createMetadataProvider(_config, _ref) {
38
- let {
39
- children
40
- } = _ref;
41
- let metadataTemplate = {};
42
- Object.keys(_config.metadata_files).forEach((key, _index) => {
43
- metadataTemplate[key] = {};
44
- });
45
- const [metadata, setMetadata] = (0, _react.useState)(metadataTemplate);
46
- let loadedTemplate = {};
47
- Object.keys(_config.metadata_files).forEach((key, _index) => {
48
- loadedTemplate[key] = false;
49
- });
50
- const [loaded, setLoaded] = (0, _react.useState)(loadedTemplate);
51
- const [error, setError] = (0, _react.useState)(null);
52
- const getMetadata = async () => {
53
- Object.keys(_config.metadata_files).forEach((key, _index) => {
54
- (0, _utils.loadDict)(_config.metadata_files[key]).then(result => {
55
- setMetadata(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
56
- [key]: result
57
- }));
58
- setLoaded(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
59
- [key]: true
60
- }));
61
- }, e => {
62
- setError(e);
63
- });
64
- });
65
- };
66
- (0, _react.useEffect)(() => {
67
- getMetadata();
68
- }, []);
69
- if (error) {
70
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("h1", {
71
- children: ["Oops: ", "".concat(error)]
72
- });
73
- } else {
74
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(MetadataContext.Provider, {
75
- value: {
76
- loaded: loaded,
77
- metadata: metadata
78
- },
79
- children: children
80
- });
81
- }
82
- }
83
- function MetadataProvider(children) {
84
- return createMetadataProvider(_config2.default, children);
85
- }
86
- MetadataProvider.propTypes = {
87
- children: _propTypes.default.node
88
- };
89
- /* Wrap a component with <MetadataLoadWall> to show a loading screen until all metadata is fetched
90
- * This is the "lazy option". It's better UX to have a fine-grained response to individual keys in context.loaded
91
- * e.g. this.context.loaded.particleProperties? this.context.metadata.particleProperties[particle].html : particle;
92
- */
93
- function createMetadataLoadWall(_config, _ref2) {
94
- let {
95
- children
96
- } = _ref2;
97
- const context = useMetadataContext();
98
- if (Object.values(context.loaded).some(v => !v)) {
99
- const loadingSpinner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Spinner, {
100
- animation: "border",
101
- role: "status",
102
- size: "sm"
103
- });
104
- const doneBadge = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Badge, {
105
- bg: "success",
106
- children: "Done"
107
- });
108
- const message = Object.keys(context.loaded).map(x => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ListGroup.Item, {
109
- children: [x, " ", context.loaded[x] ? doneBadge : loadingSpinner]
110
- }, x));
111
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
112
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Alert, {
113
- variant: "warning",
114
- children: ["Fetching metadata from the", " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert.Link, {
115
- href: _config.metadata_baseurl,
116
- target: "_blank",
117
- children: "backend"
118
- }), ". This should take a few seconds."]
119
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup, {
120
- variant: "flush",
121
- children: message
122
- })]
123
- });
124
- } else {
125
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
126
- children: children
127
- });
128
- }
129
- }
130
- function MetadataLoadWall(children) {
131
- return createMetadataLoadWall(_config2.default, children);
132
- }
133
- MetadataLoadWall.propTypes = {
134
- children: _propTypes.default.node
135
- };
@@ -1,58 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*****************************************************************************\
8
- * (c) Copyright 2021 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
- class BKPath {
18
- constructor(path) {
19
- this.path = path;
20
- this.isMC = path.split("/")[1] === "MC";
21
- }
22
- getStrippingVersion() {
23
- return this.path.split("/")[this.isMC ? 7 : 6].replace("Stripping", "").replace("NoPrescalingFlagged", "");
24
- }
25
- getYear() {
26
- return this.path.split("/")[2].replace("Collision", "20");
27
- }
28
- getPolarity() {
29
- const matchingPolarities = ["MagUp", "MagDown"].filter(polarity => this.path.includes(polarity));
30
- if (matchingPolarities.length === 1) {
31
- return matchingPolarities;
32
- } else {
33
- return "?";
34
- }
35
- }
36
- getFilename() {
37
- return this.path.split("/")[this.isMC ? 9 : 8];
38
- }
39
- getEventType() {
40
- return this.path.split("/")[this.isMC ? 8 : 7];
41
- }
42
- isValid() {
43
- const bkArray = this.path.split("/");
44
- if (bkArray[0] !== "") {
45
- return false;
46
- }
47
- if (!this.path.toLowerCase().endsWith("dst")) {
48
- return false;
49
- }
50
- if (bkArray.length === 9 && bkArray[1] === "LHCb") {
51
- return true;
52
- } else if (bkArray.length === 10 && bkArray[1] === "MC") {
53
- return true;
54
- }
55
- return false;
56
- }
57
- }
58
- var _default = exports.default = BKPath;
@@ -1,178 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _lodash = _interopRequireDefault(require("lodash"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- /*****************************************************************************\
10
- * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
11
- * *
12
- * This software is distributed under the terms of the GNU General Public *
13
- * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
14
- * *
15
- * In applying this licence, CERN does not waive the privileges and immunities *
16
- * granted to it by virtue of its status as an Intergovernmental Organization *
17
- * or submit itself to any jurisdiction. *
18
- \*****************************************************************************/
19
-
20
- class DTTConfig {
21
- /* Class for customising the configuration of a DecayTreeTuple algorithm.
22
- * The output will be parsed by a custom parser in the AnalysisHelpers data-package.
23
- */
24
- constructor(config, toolMetadata) {
25
- this.metadata = toolMetadata;
26
- this.config = config;
27
- }
28
- static createDTT(descriptorTemplate, branchMap, inputs, name, toolMetadata) {
29
- let branchDict = {};
30
- branchMap.forEach(bmap => {
31
- const branch = bmap.branch;
32
- const particle = bmap.particle;
33
- branchDict[branch] = {
34
- particle: particle,
35
- tools: []
36
- };
37
- });
38
- /* Dict to store the DecayTreeTuple options.
39
- * This is what should be written to the output JSON file, with a bit of cleaning up.
40
- */
41
- const config = {
42
- inputs: inputs,
43
- descriptorTemplate: descriptorTemplate,
44
- tools: [],
45
- branches: branchDict,
46
- groups: {}
47
- };
48
- let dtt = new DTTConfig(config, toolMetadata);
49
- const defaultTools = [
50
- // default tool list in DaVinci v45r7
51
- // TODO: load this from a file generated on deployment
52
- "TupleToolKinematic", "TupleToolPid", "TupleToolANNPID", "TupleToolGeometry", "TupleToolEventInfo"];
53
- defaultTools.forEach(tool => {
54
- dtt.addTool("", tool);
55
- });
56
- dtt.setName(name);
57
- return dtt;
58
- }
59
-
60
- // Set the input location (TES location)
61
- setInputs(inputs) {
62
- this.config.inputs = inputs;
63
- }
64
- // Set the class+name combination
65
- setName(name) {
66
- const safeName = name.replace(/\W/g, "");
67
- this.config.name = "DecayTreeTuple/".concat(safeName);
68
- }
69
-
70
- // Return the name of the DecayTreeTuple algorithm
71
- getName() {
72
- return this.config.name.split("/")[1];
73
- }
74
-
75
- // Return the name of the DecayTreeTuple algorithm, or default value "" if empty
76
- getSafeName() {
77
- const name = this.getName();
78
- return name ? name : "";
79
- }
80
-
81
- // Delete all groups with an empty tool list
82
- pruneGroups() {
83
- const empty = Object.keys(this.config.groups).filter(group => this.config.groups[group].tools.length === 0);
84
- empty.forEach(key => delete this.config.groups[key]);
85
- }
86
-
87
- // Find the appropriate object which has a "tools" list
88
- getTarget(branch) {
89
- this.pruneGroups();
90
- if (branch.length === 0) {
91
- return this.config;
92
- } else if ("".concat(branch) in this.config.branches) {
93
- return this.config.branches[branch];
94
- } else {
95
- if (!("".concat(branch) in this.config.groups)) {
96
- this.config.groups["".concat(branch)] = {
97
- particles: branch.map(element => this.config.branches[element].particle),
98
- tools: []
99
- };
100
- }
101
- return this.config.groups["".concat(branch)];
102
- }
103
- }
104
-
105
- // Return the list index of a tool
106
- findTool(target, toolString) {
107
- const index = target.tools.findIndex(tool => toolString in tool);
108
- if (index < 0) {
109
- throw new Error("".concat(toolString, " not found in ").concat(target));
110
- }
111
- return index;
112
- }
113
-
114
- // Add a TupleTool. Return boolean denoting success
115
- addTool(branch, toolClass) {
116
- let toolName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
117
- let target = this.getTarget(branch);
118
- // The toolString identifies the tool in the target's tool list
119
- // If the tool is given a name (recommended), append it following a slash
120
- const toolString = toolName.length ? "".concat(toolClass, "/").concat(toolName) : toolClass;
121
- // Add the tool to the list if not already there
122
- try {
123
- this.findTool(target, toolString);
124
- } catch (e) {
125
- const toolConfig = {
126
- [toolString]: this.getDefaultConfig(toolClass)
127
- };
128
- target.tools.push(toolConfig);
129
- return true;
130
- }
131
- throw new Error("".concat(toolString, " already exists in ").concat(target));
132
- }
133
-
134
- // Return a dict containing the default configuration of a TupleTool
135
- getDefaultConfig(toolClass) {
136
- if (toolClass in this.metadata) {
137
- let params = {};
138
- this.metadata[toolClass].interface.forEach(parameter => {
139
- params[parameter.name] = _lodash.default.cloneDeep(parameter["default"]); // Deep copy
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
- }
145
- return params;
146
- } else {
147
- return {};
148
- }
149
- }
150
-
151
- // Configure a TupleTool by passing a dict (ideally a modified version of the one returned by getToolConfig)
152
- configureTool(branch, toolString, parameters) {
153
- let target = this.getTarget(branch);
154
- const index = this.findTool(target, toolString);
155
- target.tools[index][toolString] = parameters;
156
- }
157
-
158
- // Return the current config dict of a tool, so it can be modified by the user
159
- getToolConfig(branch, toolString) {
160
- const target = this.getTarget(branch);
161
- const index = this.findTool(target, toolString);
162
- return target.tools[index][toolString];
163
- }
164
-
165
- // Delete a tool
166
- removeTool(branch, toolString) {
167
- let target = this.getTarget(branch);
168
- const index = this.findTool(target, toolString);
169
- target.tools.splice(index, 1);
170
- }
171
-
172
- // Return a list of strings corresponding to the target's tool list
173
- listTools(branch) {
174
- const target = this.getTarget(branch);
175
- return target.tools.map(tool => Object.keys(tool)[0]).sort();
176
- }
177
- }
178
- var _default = exports.default = DTTConfig;
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- exports.tex2svg = tex2svg;
8
- var _mathjax = require("mathjax-full/js/mathjax");
9
- var _tex = require("mathjax-full/js/input/tex");
10
- var _svg = require("mathjax-full/js/output/svg");
11
- /*****************************************************************************\
12
- * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
13
- * *
14
- * This software is distributed under the terms of the GNU General Public *
15
- * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
16
- * *
17
- * In applying this licence, CERN does not waive the privileges and immunities *
18
- * granted to it by virtue of its status as an Intergovernmental Organization *
19
- * or submit itself to any jurisdiction. *
20
- \*****************************************************************************/
21
-
22
- function tex2svg(inputTeX) {
23
- const tex = new _tex.TeX({
24
- packages: ["base", "ams"]
25
- });
26
- const svg = new _svg.SVG({
27
- fontCache: "none"
28
- });
29
- const tex_html = _mathjax.mathjax.document("", {
30
- InputJax: tex,
31
- OutputJax: svg
32
- });
33
- return tex_html.convert(inputTeX);
34
- }
35
- var _default = exports.default = tex2svg;