lhcb-ntuple-wizard-test 1.0.6 → 1.0.8
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 +117 -120
- 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 +147 -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 +9 -9
- package/dist/lib/utils.js +1 -1
- package/package.json +1 -1
|
@@ -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
|
};
|
|
@@ -20,10 +20,8 @@ var _config = _interopRequireDefault(require("../config.json"));
|
|
|
20
20
|
var _DTTConfig = _interopRequireDefault(require("../lib/DTTConfig"));
|
|
21
21
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
22
22
|
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); } /*****************************************************************************\
|
|
23
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
|
+
/*****************************************************************************\
|
|
27
25
|
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
28
26
|
* *
|
|
29
27
|
* This software is distributed under the terms of the GNU General Public *
|
|
@@ -33,6 +31,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
33
31
|
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
34
32
|
* or submit itself to any jurisdiction. *
|
|
35
33
|
\*****************************************************************************/
|
|
34
|
+
|
|
36
35
|
function htmlTitle(text) {
|
|
37
36
|
const container = document.createElement("span");
|
|
38
37
|
container.innerText = text;
|
|
@@ -41,7 +40,7 @@ function htmlTitle(text) {
|
|
|
41
40
|
function makeSVG(text) {
|
|
42
41
|
let colour = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "black";
|
|
43
42
|
const pipes = "\\phantom{{}^{|-}_{|-}}"; // looks weird but helps ensure uniform text scaling
|
|
44
|
-
const texSVG = (0, _mathjax.default)(
|
|
43
|
+
const texSVG = (0, _mathjax.default)(`${pipes}${text}${pipes}`).innerHTML.replaceAll("currentColor", colour);
|
|
45
44
|
return "data:image/svg+xml;charset=utf-8," + encodeURIComponent(texSVG);
|
|
46
45
|
}
|
|
47
46
|
function buildDecayGraph(decay, metadata) {
|
|
@@ -90,149 +89,162 @@ function buildDecayGraph(decay, metadata) {
|
|
|
90
89
|
return graph;
|
|
91
90
|
}
|
|
92
91
|
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
|
-
|
|
92
|
+
static contextType = (() => _MetadataContext.default)();
|
|
93
|
+
static options = {
|
|
94
|
+
..._config.default.dttGraphOptions,
|
|
95
|
+
nodes: {
|
|
96
|
+
// need to add a lambda to set the label hover-style
|
|
97
|
+
..._config.default.dttGraphOptions.nodes,
|
|
98
|
+
chosen: {
|
|
99
|
+
label: (values, id, selected, _hovering) => {
|
|
100
|
+
if (selected) {
|
|
101
|
+
values.mod = "bold";
|
|
102
|
+
values.color = "#0d6efd";
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
state = (() => ({
|
|
109
|
+
graph: buildDecayGraph(this.props.decay.descriptors.mapped_list, this.context.metadata.particleProperties),
|
|
110
|
+
dtt: new _DTTConfig.default(_lodash.default.cloneDeep(this.props.dttConfig), this.context.metadata.tupleTools.tupleTools),
|
|
111
|
+
lastSave: _lodash.default.cloneDeep(this.props.dttConfig),
|
|
112
|
+
selectedParticleId: [],
|
|
113
|
+
updated: false,
|
|
114
|
+
lockGraphZoom: !_config.default.dttGraphOptions.interaction.zoomView,
|
|
115
|
+
showNodeModal: false
|
|
116
|
+
}))();
|
|
117
|
+
network = null;
|
|
118
|
+
selectAllByTag = tag => () => {
|
|
119
|
+
const allBranches = this.state.dtt.config.branches;
|
|
120
|
+
const matchingParticles = Object.keys(allBranches).filter(branch => {
|
|
121
|
+
const particle = allBranches[branch].particle;
|
|
122
|
+
const allTags = this.context.metadata.particleProperties[particle].tags;
|
|
123
|
+
return allTags.includes(tag);
|
|
124
|
+
}).sort();
|
|
125
|
+
this.setState({
|
|
126
|
+
selectedParticleId: matchingParticles
|
|
116
127
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
128
|
+
this.network.selectNodes(matchingParticles);
|
|
129
|
+
};
|
|
130
|
+
selectGroup = group => () => {
|
|
131
|
+
const selection = group.split(",");
|
|
132
|
+
this.setState({
|
|
133
|
+
selectedParticleId: selection
|
|
123
134
|
});
|
|
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"]
|
|
135
|
+
this.network.selectNodes(selection);
|
|
136
|
+
};
|
|
137
|
+
countGroupTools = group => {
|
|
138
|
+
const toolList = this.state.dtt.listTools(group);
|
|
139
|
+
const nTools = toolList.length;
|
|
140
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
|
|
141
|
+
overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover, {
|
|
142
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup, {
|
|
143
|
+
children: toolList.map(tool => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
|
|
144
|
+
children: tool
|
|
145
|
+
}, tool))
|
|
137
146
|
})
|
|
138
|
-
})
|
|
147
|
+
}),
|
|
148
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
149
|
+
children: [nTools, " TupleTool", nTools === 1 ? "" : "s"]
|
|
150
|
+
})
|
|
139
151
|
});
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
152
|
+
};
|
|
153
|
+
callbackCloseNodeConf = () => {
|
|
154
|
+
this.setState({
|
|
155
|
+
showNodeModal: false
|
|
144
156
|
});
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
157
|
+
};
|
|
158
|
+
callbackSignalUpdated = () => {
|
|
159
|
+
this.setState({
|
|
160
|
+
updated: true
|
|
149
161
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
this.props.parentCallback(dttConfig);
|
|
162
|
+
};
|
|
163
|
+
sendData = () => {
|
|
164
|
+
const dttConfig = _lodash.default.cloneDeep(this.state.dtt.config);
|
|
165
|
+
this.setState({
|
|
166
|
+
updated: false,
|
|
167
|
+
lastSave: dttConfig
|
|
157
168
|
});
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
169
|
+
this.props.parentCallback(dttConfig);
|
|
170
|
+
};
|
|
171
|
+
revertDTT = () => {
|
|
172
|
+
let dtt = this.state.dtt;
|
|
173
|
+
dtt.config = _lodash.default.cloneDeep(this.state.lastSave);
|
|
174
|
+
this.setState({
|
|
175
|
+
dtt: dtt,
|
|
176
|
+
updated: false
|
|
165
177
|
});
|
|
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]);
|
|
178
|
+
};
|
|
179
|
+
displaySelectionDescriptor = decaySelector => {
|
|
180
|
+
// split into an array for easier looping
|
|
181
|
+
// XXX: we could probably use descriptors.list in conjunction with descriptors.mapped_list here...
|
|
182
|
+
const lokiArray = decaySelector.replace(/^\[/, "").replace(/^\^\[/, "^").replace(/\]CC$/, "").split(" ");
|
|
183
|
+
const texArray = lokiArray.map(particle => {
|
|
184
|
+
if (particle === "->") {
|
|
185
|
+
return "\\to";
|
|
186
|
+
} else {
|
|
187
|
+
let name = particle.replace(/^\^/, ""); // name will be used to look up the particle in metadata
|
|
188
|
+
// detect and handle sub-decays (marked with round braces)
|
|
189
|
+
// A -> (B -> C D) E
|
|
190
|
+
// A -> (B -> C (D -> E F)) G
|
|
191
|
+
let braces = ["", ""];
|
|
192
|
+
const numBraces = [/\(/g, /\)/g].map(pattern => (name.match(pattern) || []).length);
|
|
193
|
+
if (name.startsWith("(")) {
|
|
194
|
+
name = name.replace(/^\(/, "");
|
|
195
|
+
braces[0] = "(";
|
|
196
|
+
} else if (name.endsWith(")") && numBraces[1] > numBraces[0]) {
|
|
197
|
+
name = name.replace(/\)+$/, "");
|
|
198
|
+
braces[1] = ")".repeat(numBraces[1] - numBraces[0]);
|
|
200
199
|
}
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
// spit edge-cases to the console and handle them somewhat gracefully
|
|
201
|
+
if (!Object.keys(this.context.metadata.particleProperties).includes(name)) {
|
|
202
|
+
console.error(`${name} not found in particle property metadata!`);
|
|
203
|
+
return `\\text{${particle}}`;
|
|
204
|
+
}
|
|
205
|
+
let latex = this.context.metadata.particleProperties[name].latex;
|
|
206
|
+
// mark particles by underlining them
|
|
207
|
+
// TODO: if we can figure out colour with mathjax-react, turn them blue instead
|
|
208
|
+
if (particle.startsWith("^")) {
|
|
209
|
+
latex = `\\underline{${latex}}`;
|
|
210
|
+
}
|
|
211
|
+
// remember to put the braces back
|
|
212
|
+
return `${braces[0]}${latex}${braces[1]}`;
|
|
213
|
+
}
|
|
203
214
|
});
|
|
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
|
|
215
|
+
return texArray.join(" ");
|
|
216
|
+
};
|
|
217
|
+
displaySelection = selection => {
|
|
218
|
+
const decaySelector = this.props.decay.descriptors.template.replace(/\${(\w+)}/g, (_, v) => selection.includes(v) ? "^" : "");
|
|
219
|
+
const latex = this.displaySelectionDescriptor(decaySelector);
|
|
220
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
|
|
221
|
+
overlay: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Popover, {
|
|
222
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Header, {
|
|
223
|
+
children: "LoKi selector"
|
|
224
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Body, {
|
|
225
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
|
226
|
+
children: decaySelector
|
|
221
227
|
})
|
|
228
|
+
})]
|
|
229
|
+
}),
|
|
230
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
231
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_mathjaxReact.MathComponent, {
|
|
232
|
+
tex: `${latex}`,
|
|
233
|
+
display: false
|
|
222
234
|
})
|
|
223
|
-
})
|
|
235
|
+
})
|
|
224
236
|
});
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
this.setState({
|
|
232
|
-
lockGraphZoom: !this.state.lockGraphZoom
|
|
233
|
-
});
|
|
237
|
+
};
|
|
238
|
+
toggleZoomLock = () => {
|
|
239
|
+
this.network.setOptions({
|
|
240
|
+
interaction: {
|
|
241
|
+
zoomView: this.state.lockGraphZoom
|
|
242
|
+
}
|
|
234
243
|
});
|
|
235
|
-
|
|
244
|
+
this.setState({
|
|
245
|
+
lockGraphZoom: !this.state.lockGraphZoom
|
|
246
|
+
});
|
|
247
|
+
};
|
|
236
248
|
render() {
|
|
237
249
|
this.state.dtt.pruneGroups(); // Make sure no empty groups
|
|
238
250
|
const selection = this.state.selectedParticleId;
|
|
@@ -296,7 +308,7 @@ class DecayTree extends _react.default.Component {
|
|
|
296
308
|
overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover, {
|
|
297
309
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Popover.Body, {
|
|
298
310
|
children: ["The ROOT TTree will be found under ", /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
|
299
|
-
children:
|
|
311
|
+
children: `DecayTreeTuple/${dttName}`
|
|
300
312
|
}), "."]
|
|
301
313
|
})
|
|
302
314
|
}),
|
|
@@ -428,22 +440,6 @@ class DecayTree extends _react.default.Component {
|
|
|
428
440
|
});
|
|
429
441
|
}
|
|
430
442
|
}
|
|
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
443
|
DecayTree.propTypes = {
|
|
448
444
|
decay: _propTypes.default.object,
|
|
449
445
|
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
|
* *
|