lhcb-ntuple-wizard-test 1.0.5 → 1.0.7
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.
- package/dist/components/App.js +1 -1
- package/dist/components/ConfigDict.js +39 -40
- package/dist/components/ConfigList.js +27 -31
- package/dist/components/ConfigNode.js +122 -121
- package/dist/components/ConfigValue.js +18 -21
- package/dist/components/Dataset.js +4 -8
- package/dist/components/Decay.js +2 -2
- package/dist/components/DecayItem.js +46 -50
- package/dist/components/DecayTag.js +4 -5
- package/dist/components/DecayTree.js +151 -151
- package/dist/components/DecaysList.js +35 -39
- package/dist/components/DeleteButton.js +1 -1
- package/dist/components/DescriptorsSearch.js +188 -192
- package/dist/components/EventTypeBadge.js +1 -1
- package/dist/components/ItemSearch.js +8 -12
- package/dist/components/LinesTable.js +463 -459
- package/dist/components/NtupleWizard.js +28 -32
- package/dist/components/ParticleTag.js +4 -5
- package/dist/components/PolarityBadge.js +1 -1
- package/dist/components/SearchItem.js +29 -33
- package/dist/components/SelectParticle.js +6 -10
- package/dist/components/SelectTag.js +5 -6
- package/dist/components/SelectTool.js +5 -6
- package/dist/components/SelectVariables.js +23 -24
- package/dist/components/StrippingBadge.js +4 -5
- package/dist/components/StrippingLine.js +2 -2
- package/dist/components/TupleTool.js +4 -5
- package/dist/components/VariablesSearch.js +8 -12
- package/dist/components/YearBadge.js +1 -1
- package/dist/components/loki/LokiDict.js +180 -0
- package/dist/components/loki/LokiEditor.js +200 -0
- package/dist/components/loki/LokiForm.js +112 -0
- package/dist/components/semantic.js +97 -0
- package/dist/components/semform.js +182 -0
- package/dist/components/worker.js +196 -0
- package/dist/config.json +4 -2
- package/dist/contexts/MetadataContext.js +2 -2
- package/dist/index.js +2 -2
- package/dist/lib/DTTConfig.js +13 -9
- package/dist/lib/utils.js +1 -1
- package/package.json +25 -2
|
@@ -11,10 +11,8 @@ var _StrippingLine = _interopRequireDefault(require("./StrippingLine"));
|
|
|
11
11
|
var _Decay = _interopRequireDefault(require("./Decay"));
|
|
12
12
|
var _DecayTag = _interopRequireDefault(require("./DecayTag"));
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function _interopRequireDefault(
|
|
15
|
-
|
|
16
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
17
|
-
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); } /*****************************************************************************\
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
/*****************************************************************************\
|
|
18
16
|
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
19
17
|
* *
|
|
20
18
|
* This software is distributed under the terms of the GNU General Public *
|
|
@@ -24,55 +22,53 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
24
22
|
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
25
23
|
* or submit itself to any jurisdiction. *
|
|
26
24
|
\*****************************************************************************/
|
|
25
|
+
|
|
27
26
|
class DecayItem extends _react.default.Component {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
state = {
|
|
28
|
+
selected: this.props.selected,
|
|
29
|
+
decay: this.props.decay
|
|
30
|
+
};
|
|
31
|
+
sendData = () => {
|
|
32
|
+
this.props.parentCallback(this.state);
|
|
33
|
+
};
|
|
34
|
+
select = () => {
|
|
35
|
+
this.setState({
|
|
36
|
+
selected: this.state.selected ? false : true
|
|
36
37
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
this.sendData();
|
|
39
|
+
};
|
|
40
|
+
getExtraInfo = () => {
|
|
41
|
+
const nLines = Object.keys(this.props.decay.lines).length;
|
|
42
|
+
const nTags = this.props.decay.tags.length;
|
|
43
|
+
const tagInfo = this.props.decay.tags.map(tag => /*#__PURE__*/(0, _jsxRuntime.jsx)(_DecayTag.default, {
|
|
44
|
+
tag: tag
|
|
45
|
+
}, tag));
|
|
46
|
+
const strippingInfo = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
47
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
|
|
48
|
+
placement: "right",
|
|
49
|
+
overlay: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Popover, {
|
|
50
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Header, {
|
|
51
|
+
children: "Stripping lines"
|
|
52
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Body, {
|
|
53
|
+
children: Object.keys(this.props.decay.lines).map(line => {
|
|
54
|
+
const [stream, name] = line.split("/");
|
|
55
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StrippingLine.default, {
|
|
56
|
+
line: name,
|
|
57
|
+
stream: stream,
|
|
58
|
+
versions: this.props.decay.lines[line]
|
|
59
|
+
}, line);
|
|
60
|
+
})
|
|
61
|
+
})]
|
|
62
|
+
}),
|
|
63
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Badge, {
|
|
64
|
+
pill: true,
|
|
65
|
+
bg: this.state.selected ? "primary" : "secondary",
|
|
66
|
+
children: [nLines, " Stripping line", nLines === 1 ? "" : "s"]
|
|
67
|
+
})
|
|
68
|
+
}), nTags > 0 ? tagInfo : ""]
|
|
42
69
|
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const nTags = this.props.decay.tags.length;
|
|
46
|
-
const tagInfo = this.props.decay.tags.map(tag => /*#__PURE__*/(0, _jsxRuntime.jsx)(_DecayTag.default, {
|
|
47
|
-
tag: tag
|
|
48
|
-
}, tag));
|
|
49
|
-
const strippingInfo = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
50
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
|
|
51
|
-
placement: "right",
|
|
52
|
-
overlay: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Popover, {
|
|
53
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Header, {
|
|
54
|
-
children: "Stripping lines"
|
|
55
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Body, {
|
|
56
|
-
children: Object.keys(this.props.decay.lines).map(line => {
|
|
57
|
-
const [stream, name] = line.split("/");
|
|
58
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StrippingLine.default, {
|
|
59
|
-
line: name,
|
|
60
|
-
stream: stream,
|
|
61
|
-
versions: this.props.decay.lines[line]
|
|
62
|
-
}, line);
|
|
63
|
-
})
|
|
64
|
-
})]
|
|
65
|
-
}),
|
|
66
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Badge, {
|
|
67
|
-
pill: true,
|
|
68
|
-
bg: this.state.selected ? "primary" : "secondary",
|
|
69
|
-
children: [nLines, " Stripping line", nLines === 1 ? "" : "s"]
|
|
70
|
-
})
|
|
71
|
-
}), nTags > 0 ? tagInfo : ""]
|
|
72
|
-
});
|
|
73
|
-
return strippingInfo;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
70
|
+
return strippingInfo;
|
|
71
|
+
};
|
|
76
72
|
render() {
|
|
77
73
|
const extraInfo = this.getExtraInfo();
|
|
78
74
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
|
|
@@ -9,10 +9,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _reactBootstrap = require("react-bootstrap");
|
|
10
10
|
var _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(
|
|
13
|
-
|
|
14
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
15
|
-
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); } /*****************************************************************************\
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
/*****************************************************************************\
|
|
16
14
|
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
17
15
|
* *
|
|
18
16
|
* This software is distributed under the terms of the GNU General Public *
|
|
@@ -22,7 +20,9 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
22
20
|
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
23
21
|
* or submit itself to any jurisdiction. *
|
|
24
22
|
\*****************************************************************************/
|
|
23
|
+
|
|
25
24
|
class DecayTag extends _react.default.Component {
|
|
25
|
+
static contextType = (() => _MetadataContext.default)();
|
|
26
26
|
render() {
|
|
27
27
|
const background = this.context.loaded.userHints && this.context.metadata.userHints.decayTags[this.props.tag].warn ? "danger" : "warning";
|
|
28
28
|
const foreground = this.context.loaded.userHints && this.context.metadata.userHints.decayTags[this.props.tag].warn ? "light" : "dark";
|
|
@@ -43,7 +43,6 @@ class DecayTag extends _react.default.Component {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
_defineProperty(DecayTag, "contextType", _MetadataContext.default);
|
|
47
46
|
DecayTag.propTypes = {
|
|
48
47
|
tag: _propTypes.default.string
|
|
49
48
|
};
|
|
@@ -19,11 +19,10 @@ var _mathjax = _interopRequireDefault(require("../lib/mathjax"));
|
|
|
19
19
|
var _config = _interopRequireDefault(require("../config.json"));
|
|
20
20
|
var _DTTConfig = _interopRequireDefault(require("../lib/DTTConfig"));
|
|
21
21
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
22
|
+
var _semform = _interopRequireDefault(require("./semform"));
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
function _interopRequireDefault(
|
|
24
|
-
|
|
25
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
26
|
-
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
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
|
+
/*****************************************************************************\
|
|
27
26
|
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
28
27
|
* *
|
|
29
28
|
* This software is distributed under the terms of the GNU General Public *
|
|
@@ -33,6 +32,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
33
32
|
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
34
33
|
* or submit itself to any jurisdiction. *
|
|
35
34
|
\*****************************************************************************/
|
|
35
|
+
|
|
36
36
|
function htmlTitle(text) {
|
|
37
37
|
const container = document.createElement("span");
|
|
38
38
|
container.innerText = text;
|
|
@@ -41,7 +41,7 @@ function htmlTitle(text) {
|
|
|
41
41
|
function makeSVG(text) {
|
|
42
42
|
let colour = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "black";
|
|
43
43
|
const pipes = "\\phantom{{}^{|-}_{|-}}"; // looks weird but helps ensure uniform text scaling
|
|
44
|
-
const texSVG = (0, _mathjax.default)(
|
|
44
|
+
const texSVG = (0, _mathjax.default)(`${pipes}${text}${pipes}`).innerHTML.replaceAll("currentColor", colour);
|
|
45
45
|
return "data:image/svg+xml;charset=utf-8," + encodeURIComponent(texSVG);
|
|
46
46
|
}
|
|
47
47
|
function buildDecayGraph(decay, metadata) {
|
|
@@ -90,149 +90,162 @@ function buildDecayGraph(decay, metadata) {
|
|
|
90
90
|
return graph;
|
|
91
91
|
}
|
|
92
92
|
class DecayTree extends _react.default.Component {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
93
|
+
static contextType = (() => _MetadataContext.default)();
|
|
94
|
+
static options = {
|
|
95
|
+
..._config.default.dttGraphOptions,
|
|
96
|
+
nodes: {
|
|
97
|
+
// need to add a lambda to set the label hover-style
|
|
98
|
+
..._config.default.dttGraphOptions.nodes,
|
|
99
|
+
chosen: {
|
|
100
|
+
label: (values, id, selected, _hovering) => {
|
|
101
|
+
if (selected) {
|
|
102
|
+
values.mod = "bold";
|
|
103
|
+
values.color = "#0d6efd";
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
state = (() => ({
|
|
110
|
+
graph: buildDecayGraph(this.props.decay.descriptors.mapped_list, this.context.metadata.particleProperties),
|
|
111
|
+
dtt: new _DTTConfig.default(_lodash.default.cloneDeep(this.props.dttConfig), this.context.metadata.tupleTools.tupleTools),
|
|
112
|
+
lastSave: _lodash.default.cloneDeep(this.props.dttConfig),
|
|
113
|
+
selectedParticleId: [],
|
|
114
|
+
updated: false,
|
|
115
|
+
lockGraphZoom: !_config.default.dttGraphOptions.interaction.zoomView,
|
|
116
|
+
showNodeModal: false
|
|
117
|
+
}))();
|
|
118
|
+
network = null;
|
|
119
|
+
selectAllByTag = tag => () => {
|
|
120
|
+
const allBranches = this.state.dtt.config.branches;
|
|
121
|
+
const matchingParticles = Object.keys(allBranches).filter(branch => {
|
|
122
|
+
const particle = allBranches[branch].particle;
|
|
123
|
+
const allTags = this.context.metadata.particleProperties[particle].tags;
|
|
124
|
+
return allTags.includes(tag);
|
|
125
|
+
}).sort();
|
|
126
|
+
this.setState({
|
|
127
|
+
selectedParticleId: matchingParticles
|
|
116
128
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
129
|
+
this.network.selectNodes(matchingParticles);
|
|
130
|
+
};
|
|
131
|
+
selectGroup = group => () => {
|
|
132
|
+
const selection = group.split(",");
|
|
133
|
+
this.setState({
|
|
134
|
+
selectedParticleId: selection
|
|
123
135
|
});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
136
|
-
children: [nTools, " TupleTool", nTools === 1 ? "" : "s"]
|
|
136
|
+
this.network.selectNodes(selection);
|
|
137
|
+
};
|
|
138
|
+
countGroupTools = group => {
|
|
139
|
+
const toolList = this.state.dtt.listTools(group);
|
|
140
|
+
const nTools = toolList.length;
|
|
141
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
|
|
142
|
+
overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover, {
|
|
143
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup, {
|
|
144
|
+
children: toolList.map(tool => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
|
|
145
|
+
children: tool
|
|
146
|
+
}, tool))
|
|
137
147
|
})
|
|
138
|
-
})
|
|
148
|
+
}),
|
|
149
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
150
|
+
children: [nTools, " TupleTool", nTools === 1 ? "" : "s"]
|
|
151
|
+
})
|
|
139
152
|
});
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
153
|
+
};
|
|
154
|
+
callbackCloseNodeConf = () => {
|
|
155
|
+
this.setState({
|
|
156
|
+
showNodeModal: false
|
|
144
157
|
});
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
158
|
+
};
|
|
159
|
+
callbackSignalUpdated = () => {
|
|
160
|
+
this.setState({
|
|
161
|
+
updated: true
|
|
149
162
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
this.props.parentCallback(dttConfig);
|
|
163
|
+
};
|
|
164
|
+
sendData = () => {
|
|
165
|
+
const dttConfig = _lodash.default.cloneDeep(this.state.dtt.config);
|
|
166
|
+
this.setState({
|
|
167
|
+
updated: false,
|
|
168
|
+
lastSave: dttConfig
|
|
157
169
|
});
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
170
|
+
this.props.parentCallback(dttConfig);
|
|
171
|
+
};
|
|
172
|
+
revertDTT = () => {
|
|
173
|
+
let dtt = this.state.dtt;
|
|
174
|
+
dtt.config = _lodash.default.cloneDeep(this.state.lastSave);
|
|
175
|
+
this.setState({
|
|
176
|
+
dtt: dtt,
|
|
177
|
+
updated: false
|
|
165
178
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
// spit edge-cases to the console and handle them somewhat gracefully
|
|
188
|
-
if (!Object.keys(this.context.metadata.particleProperties).includes(name)) {
|
|
189
|
-
console.error("".concat(name, " not found in particle property metadata!"));
|
|
190
|
-
return "\\text{".concat(particle, "}");
|
|
191
|
-
}
|
|
192
|
-
let latex = this.context.metadata.particleProperties[name].latex;
|
|
193
|
-
// mark particles by underlining them
|
|
194
|
-
// TODO: if we can figure out colour with mathjax-react, turn them blue instead
|
|
195
|
-
if (particle.startsWith("^")) {
|
|
196
|
-
latex = "\\underline{".concat(latex, "}");
|
|
197
|
-
}
|
|
198
|
-
// remember to put the braces back
|
|
199
|
-
return "".concat(braces[0]).concat(latex).concat(braces[1]);
|
|
179
|
+
};
|
|
180
|
+
displaySelectionDescriptor = decaySelector => {
|
|
181
|
+
// split into an array for easier looping
|
|
182
|
+
// XXX: we could probably use descriptors.list in conjunction with descriptors.mapped_list here...
|
|
183
|
+
const lokiArray = decaySelector.replace(/^\[/, "").replace(/^\^\[/, "^").replace(/\]CC$/, "").split(" ");
|
|
184
|
+
const texArray = lokiArray.map(particle => {
|
|
185
|
+
if (particle === "->") {
|
|
186
|
+
return "\\to";
|
|
187
|
+
} else {
|
|
188
|
+
let name = particle.replace(/^\^/, ""); // name will be used to look up the particle in metadata
|
|
189
|
+
// detect and handle sub-decays (marked with round braces)
|
|
190
|
+
// A -> (B -> C D) E
|
|
191
|
+
// A -> (B -> C (D -> E F)) G
|
|
192
|
+
let braces = ["", ""];
|
|
193
|
+
const numBraces = [/\(/g, /\)/g].map(pattern => (name.match(pattern) || []).length);
|
|
194
|
+
if (name.startsWith("(")) {
|
|
195
|
+
name = name.replace(/^\(/, "");
|
|
196
|
+
braces[0] = "(";
|
|
197
|
+
} else if (name.endsWith(")") && numBraces[1] > numBraces[0]) {
|
|
198
|
+
name = name.replace(/\)+$/, "");
|
|
199
|
+
braces[1] = ")".repeat(numBraces[1] - numBraces[0]);
|
|
200
200
|
}
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
// spit edge-cases to the console and handle them somewhat gracefully
|
|
202
|
+
if (!Object.keys(this.context.metadata.particleProperties).includes(name)) {
|
|
203
|
+
console.error(`${name} not found in particle property metadata!`);
|
|
204
|
+
return `\\text{${particle}}`;
|
|
205
|
+
}
|
|
206
|
+
let latex = this.context.metadata.particleProperties[name].latex;
|
|
207
|
+
// mark particles by underlining them
|
|
208
|
+
// TODO: if we can figure out colour with mathjax-react, turn them blue instead
|
|
209
|
+
if (particle.startsWith("^")) {
|
|
210
|
+
latex = `\\underline{${latex}}`;
|
|
211
|
+
}
|
|
212
|
+
// remember to put the braces back
|
|
213
|
+
return `${braces[0]}${latex}${braces[1]}`;
|
|
214
|
+
}
|
|
203
215
|
});
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}),
|
|
217
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
218
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_mathjaxReact.MathComponent, {
|
|
219
|
-
tex: "".concat(latex),
|
|
220
|
-
display: false
|
|
216
|
+
return texArray.join(" ");
|
|
217
|
+
};
|
|
218
|
+
displaySelection = selection => {
|
|
219
|
+
const decaySelector = this.props.decay.descriptors.template.replace(/\${(\w+)}/g, (_, v) => selection.includes(v) ? "^" : "");
|
|
220
|
+
const latex = this.displaySelectionDescriptor(decaySelector);
|
|
221
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
|
|
222
|
+
overlay: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Popover, {
|
|
223
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Header, {
|
|
224
|
+
children: "LoKi selector"
|
|
225
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Body, {
|
|
226
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
|
227
|
+
children: decaySelector
|
|
221
228
|
})
|
|
229
|
+
})]
|
|
230
|
+
}),
|
|
231
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
232
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_mathjaxReact.MathComponent, {
|
|
233
|
+
tex: `${latex}`,
|
|
234
|
+
display: false
|
|
222
235
|
})
|
|
223
|
-
})
|
|
236
|
+
})
|
|
224
237
|
});
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
this.setState({
|
|
232
|
-
lockGraphZoom: !this.state.lockGraphZoom
|
|
233
|
-
});
|
|
238
|
+
};
|
|
239
|
+
toggleZoomLock = () => {
|
|
240
|
+
this.network.setOptions({
|
|
241
|
+
interaction: {
|
|
242
|
+
zoomView: this.state.lockGraphZoom
|
|
243
|
+
}
|
|
234
244
|
});
|
|
235
|
-
|
|
245
|
+
this.setState({
|
|
246
|
+
lockGraphZoom: !this.state.lockGraphZoom
|
|
247
|
+
});
|
|
248
|
+
};
|
|
236
249
|
render() {
|
|
237
250
|
this.state.dtt.pruneGroups(); // Make sure no empty groups
|
|
238
251
|
const selection = this.state.selectedParticleId;
|
|
@@ -296,7 +309,7 @@ class DecayTree extends _react.default.Component {
|
|
|
296
309
|
overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover, {
|
|
297
310
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Popover.Body, {
|
|
298
311
|
children: ["The ROOT TTree will be found under ", /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
|
299
|
-
children:
|
|
312
|
+
children: `DecayTreeTuple/${dttName}`
|
|
300
313
|
}), "."]
|
|
301
314
|
})
|
|
302
315
|
}),
|
|
@@ -379,6 +392,9 @@ class DecayTree extends _react.default.Component {
|
|
|
379
392
|
})
|
|
380
393
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Title, {
|
|
381
394
|
children: ["Current selection: ", selectedName]
|
|
395
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Card.Title, {
|
|
396
|
+
className: "d-flex justify-content-between align-items-center flex-column",
|
|
397
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_semform.default, {})
|
|
382
398
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConfigNode.default, {
|
|
383
399
|
dtt: this.state.dtt,
|
|
384
400
|
particleID: selection,
|
|
@@ -428,22 +444,6 @@ class DecayTree extends _react.default.Component {
|
|
|
428
444
|
});
|
|
429
445
|
}
|
|
430
446
|
}
|
|
431
|
-
_defineProperty(DecayTree, "contextType", _MetadataContext.default);
|
|
432
|
-
_defineProperty(DecayTree, "options", {
|
|
433
|
-
..._config.default.dttGraphOptions,
|
|
434
|
-
nodes: {
|
|
435
|
-
// need to add a lambda to set the label hover-style
|
|
436
|
-
..._config.default.dttGraphOptions.nodes,
|
|
437
|
-
chosen: {
|
|
438
|
-
label: (values, id, selected, _hovering) => {
|
|
439
|
-
if (selected) {
|
|
440
|
-
values.mod = "bold";
|
|
441
|
-
values.color = "#0d6efd";
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
447
|
DecayTree.propTypes = {
|
|
448
448
|
decay: _propTypes.default.object,
|
|
449
449
|
dttConfig: _propTypes.default.object,
|
|
@@ -12,12 +12,10 @@ var _DecayItem = _interopRequireDefault(require("./DecayItem"));
|
|
|
12
12
|
var _reactBootstrap = require("react-bootstrap");
|
|
13
13
|
var _config = _interopRequireDefault(require("../config"));
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
function _interopRequireDefault(
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
18
|
-
|
|
19
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
20
|
-
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); } /*****************************************************************************\
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
/*****************************************************************************\
|
|
21
19
|
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
22
20
|
* *
|
|
23
21
|
* This software is distributed under the terms of the GNU General Public *
|
|
@@ -27,42 +25,40 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
27
25
|
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
28
26
|
* or submit itself to any jurisdiction. *
|
|
29
27
|
\*****************************************************************************/
|
|
28
|
+
|
|
30
29
|
class DecaysList extends React.Component {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
if (index > -1) {
|
|
50
|
-
this.state.selectedDecays.splice(index, 1);
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
this.state.selectedDecays.push(childData.decay);
|
|
30
|
+
state = (() => ({
|
|
31
|
+
items: this.props.decays.length > _config.default.batch_size ? this.props.decays.slice(0, _config.default.batch_size) : this.props.decays,
|
|
32
|
+
index: this.props.decays.length > _config.default.batch_size ? _config.default.batch_size - 1 : this.props.decays.length,
|
|
33
|
+
selectedDecays: this.props.selectedDecays
|
|
34
|
+
}))();
|
|
35
|
+
fetchMoreData = () => {
|
|
36
|
+
setTimeout(() => {
|
|
37
|
+
this.setState({
|
|
38
|
+
items: this.state.items.concat(this.props.decays.slice(this.state.index + 1, this.state.index + 1 + _config.default.batch_size)),
|
|
39
|
+
index: this.state.index + _config.default.batch_size < this.props.decays.length ? this.state.index + _config.default.batch_size : this.props.decays.length
|
|
40
|
+
});
|
|
41
|
+
}, 1000);
|
|
42
|
+
};
|
|
43
|
+
callbackFunction = childData => {
|
|
44
|
+
if (childData.selected) {
|
|
45
|
+
const index = this.state.selectedDecays.indexOf(childData.decay);
|
|
46
|
+
if (index > -1) {
|
|
47
|
+
this.state.selectedDecays.splice(index, 1);
|
|
54
48
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
49
|
+
} else {
|
|
50
|
+
this.state.selectedDecays.push(childData.decay);
|
|
51
|
+
}
|
|
52
|
+
this.props.parentCallback(this.state.selectedDecays);
|
|
53
|
+
};
|
|
54
|
+
getDecayItem = () => {
|
|
55
|
+
const strippingDecayItem = this.state.items.map(decay => /*#__PURE__*/(0, _jsxRuntime.jsx)(_DecayItem.default, {
|
|
56
|
+
decay: decay,
|
|
57
|
+
selected: this.state.selectedDecays.some(selected => selected.descriptors.plain === decay.descriptors.plain),
|
|
58
|
+
parentCallback: this.callbackFunction
|
|
59
|
+
}, decay.descriptors.plain));
|
|
60
|
+
return strippingDecayItem;
|
|
61
|
+
};
|
|
66
62
|
render() {
|
|
67
63
|
const decayItem = this.getDecayItem();
|
|
68
64
|
const nShown = this.state.items.length;
|
|
@@ -9,7 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _reactBootstrap = require("react-bootstrap");
|
|
10
10
|
var _reactBootstrapIcons = require("react-bootstrap-icons");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
/*****************************************************************************\
|
|
14
14
|
* (c) Copyright 2021-2022 CERN for the benefit of the LHCb Collaboration *
|
|
15
15
|
* *
|