lhcb-ntuple-wizard 1.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.
- package/COPYING +674 -0
- package/README.md +25 -0
- package/dist/components/App.js +136 -0
- package/dist/components/ConfigDict.js +117 -0
- package/dist/components/ConfigList.js +115 -0
- package/dist/components/ConfigNode.js +345 -0
- package/dist/components/ConfigValue.js +99 -0
- package/dist/components/Dataset.js +82 -0
- package/dist/components/Decay.js +64 -0
- package/dist/components/DecayItem.js +122 -0
- package/dist/components/DecayTag.js +65 -0
- package/dist/components/DecayTree.js +518 -0
- package/dist/components/DecaysList.js +121 -0
- package/dist/components/DeleteButton.js +69 -0
- package/dist/components/DescriptorsSearch.js +394 -0
- package/dist/components/EventTypeBadge.js +58 -0
- package/dist/components/ItemSearch.js +146 -0
- package/dist/components/LinesTable.js +810 -0
- package/dist/components/NtupleWizard.js +125 -0
- package/dist/components/ParticleTag.js +67 -0
- package/dist/components/PolarityBadge.js +48 -0
- package/dist/components/SearchItem.js +130 -0
- package/dist/components/SelectParticle.js +94 -0
- package/dist/components/SelectTag.js +88 -0
- package/dist/components/SelectTool.js +80 -0
- package/dist/components/SelectVariables.js +133 -0
- package/dist/components/StrippingBadge.js +76 -0
- package/dist/components/StrippingLine.js +66 -0
- package/dist/components/TupleTool.js +59 -0
- package/dist/components/VariablesSearch.js +154 -0
- package/dist/components/YearBadge.js +48 -0
- package/dist/config.json +83 -0
- package/dist/contexts/MetadataContext.js +154 -0
- package/dist/index.js +18 -0
- package/dist/lib/BKPath.js +83 -0
- package/dist/lib/DTTConfig.js +213 -0
- package/dist/lib/mathjax.js +36 -0
- package/dist/lib/utils.js +228 -0
- package/dist/style/DecaysList.css +15 -0
- package/package.json +65 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _reactBootstrap = require("react-bootstrap");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
15
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
17
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
18
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
19
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
20
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
21
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
22
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
23
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
24
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
|
+
var YearBadge = /*#__PURE__*/function (_React$Component) {
|
|
26
|
+
_inherits(YearBadge, _React$Component);
|
|
27
|
+
var _super = _createSuper(YearBadge);
|
|
28
|
+
function YearBadge() {
|
|
29
|
+
_classCallCheck(this, YearBadge);
|
|
30
|
+
return _super.apply(this, arguments);
|
|
31
|
+
}
|
|
32
|
+
_createClass(YearBadge, [{
|
|
33
|
+
key: "render",
|
|
34
|
+
value: function render() {
|
|
35
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Badge, {
|
|
36
|
+
pill: true,
|
|
37
|
+
bg: "success",
|
|
38
|
+
children: this.props.year
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}]);
|
|
42
|
+
return YearBadge;
|
|
43
|
+
}(_react.default.Component);
|
|
44
|
+
YearBadge.propTypes = {
|
|
45
|
+
year: _propTypes.default.string
|
|
46
|
+
};
|
|
47
|
+
var _default = YearBadge;
|
|
48
|
+
exports.default = _default;
|
package/dist/config.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata_baseurl": "https://lbwizard-metadata.web.cern.ch/1.0.1/",
|
|
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
|
+
},
|
|
13
|
+
"batch_size": 10,
|
|
14
|
+
"particleTagGroupStyles": {
|
|
15
|
+
"category": "dark",
|
|
16
|
+
"charge": "primary",
|
|
17
|
+
"flavour": "success",
|
|
18
|
+
"spin": "danger",
|
|
19
|
+
"lifetime": "secondary"
|
|
20
|
+
},
|
|
21
|
+
"dttGraphOptions": {
|
|
22
|
+
"layout": {
|
|
23
|
+
"hierarchical": {"sortMethod": "directed"}
|
|
24
|
+
},
|
|
25
|
+
"nodes": {
|
|
26
|
+
"borderWidth": 0,
|
|
27
|
+
"borderWidthSelected": 0,
|
|
28
|
+
"imagePadding": 10,
|
|
29
|
+
"font": {
|
|
30
|
+
"strokeWidth": 20,
|
|
31
|
+
"background": "white"
|
|
32
|
+
},
|
|
33
|
+
"color": {
|
|
34
|
+
"background": "white",
|
|
35
|
+
"highlight": {"background": "white"},
|
|
36
|
+
"hover": {"background": "#eee"}
|
|
37
|
+
},
|
|
38
|
+
"scaling": {
|
|
39
|
+
"min": 32,
|
|
40
|
+
"max": 32
|
|
41
|
+
},
|
|
42
|
+
"value": 1,
|
|
43
|
+
"shape": "image",
|
|
44
|
+
"shapeProperties": {
|
|
45
|
+
"useBorderWithImage": true,
|
|
46
|
+
"useImageSize": false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"edges": {
|
|
50
|
+
"color": "black",
|
|
51
|
+
"width": 1,
|
|
52
|
+
"selectionWidth": 0,
|
|
53
|
+
"hoverWidth": 0
|
|
54
|
+
},
|
|
55
|
+
"physics": {
|
|
56
|
+
"enabled": false
|
|
57
|
+
},
|
|
58
|
+
"interaction": {
|
|
59
|
+
"dragNodes": false,
|
|
60
|
+
"multiselect": true,
|
|
61
|
+
"selectConnectedEdges": false,
|
|
62
|
+
"hoverConnectedEdges": false,
|
|
63
|
+
"hover": true,
|
|
64
|
+
"zoomView": false
|
|
65
|
+
},
|
|
66
|
+
"height": "500px",
|
|
67
|
+
"autoResize": true,
|
|
68
|
+
"width": "100%"
|
|
69
|
+
},
|
|
70
|
+
"pyOptsTemplate": [
|
|
71
|
+
"# This file is generated by the NTuple Wizard <https://lbwizard.web.cern.ch>",
|
|
72
|
+
"",
|
|
73
|
+
"import os, yaml",
|
|
74
|
+
"from pathlib import Path",
|
|
75
|
+
"from Configurables import DaVinci",
|
|
76
|
+
"from AnalysisHelpers.decaytreetuple import configure_dtt",
|
|
77
|
+
"",
|
|
78
|
+
"config_file = Path(os.environ['ANALYSIS_PRODUCTIONS_BASE']) / '{subdirectory}' / '{filename}.yaml'",
|
|
79
|
+
"config = yaml.safe_load(open(config_file, 'rb'))",
|
|
80
|
+
"dtt = configure_dtt(config)",
|
|
81
|
+
"DaVinci().UserAlgorithms += [dtt]"
|
|
82
|
+
]
|
|
83
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.MetadataContext = void 0;
|
|
8
|
+
exports.MetadataLoadWall = MetadataLoadWall;
|
|
9
|
+
exports.MetadataProvider = MetadataProvider;
|
|
10
|
+
exports.useMetadataContext = exports.default = void 0;
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _reactBootstrap = require("react-bootstrap");
|
|
13
|
+
var _react = require("react");
|
|
14
|
+
var _utils = require("../lib/utils");
|
|
15
|
+
var _config = _interopRequireDefault(require("../config"));
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
19
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
23
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
24
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
25
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
28
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
29
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
30
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
31
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
+
var MetadataContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
33
|
+
exports.MetadataContext = MetadataContext;
|
|
34
|
+
var _default = MetadataContext;
|
|
35
|
+
exports.default = _default;
|
|
36
|
+
var useMetadataContext = function useMetadataContext(_init) {
|
|
37
|
+
return (0, _react.useContext)(MetadataContext);
|
|
38
|
+
};
|
|
39
|
+
exports.useMetadataContext = useMetadataContext;
|
|
40
|
+
function MetadataProvider(_ref) {
|
|
41
|
+
var children = _ref.children;
|
|
42
|
+
var metadataTemplate = {};
|
|
43
|
+
Object.keys(_config.default.metadata_files).forEach(function (key, _index) {
|
|
44
|
+
metadataTemplate[key] = {};
|
|
45
|
+
});
|
|
46
|
+
var _useState = (0, _react.useState)(metadataTemplate),
|
|
47
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
+
metadata = _useState2[0],
|
|
49
|
+
setMetadata = _useState2[1];
|
|
50
|
+
var loadedTemplate = {};
|
|
51
|
+
Object.keys(_config.default.metadata_files).forEach(function (key, _index) {
|
|
52
|
+
loadedTemplate[key] = false;
|
|
53
|
+
});
|
|
54
|
+
var _useState3 = (0, _react.useState)(loadedTemplate),
|
|
55
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
56
|
+
loaded = _useState4[0],
|
|
57
|
+
setLoaded = _useState4[1];
|
|
58
|
+
var _useState5 = (0, _react.useState)(null),
|
|
59
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
60
|
+
error = _useState6[0],
|
|
61
|
+
setError = _useState6[1];
|
|
62
|
+
var getMetadata = /*#__PURE__*/function () {
|
|
63
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
64
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
65
|
+
while (1) switch (_context.prev = _context.next) {
|
|
66
|
+
case 0:
|
|
67
|
+
Object.keys(_config.default.metadata_files).forEach(function (key, _index) {
|
|
68
|
+
(0, _utils.loadDict)(_config.default.metadata_files[key]).then(function (result) {
|
|
69
|
+
setMetadata(function (prevState) {
|
|
70
|
+
return _objectSpread(_objectSpread({}, prevState), {}, _defineProperty({}, key, result));
|
|
71
|
+
});
|
|
72
|
+
setLoaded(function (prevState) {
|
|
73
|
+
return _objectSpread(_objectSpread({}, prevState), {}, _defineProperty({}, key, true));
|
|
74
|
+
});
|
|
75
|
+
}, function (e) {
|
|
76
|
+
setError(e);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
case 1:
|
|
80
|
+
case "end":
|
|
81
|
+
return _context.stop();
|
|
82
|
+
}
|
|
83
|
+
}, _callee);
|
|
84
|
+
}));
|
|
85
|
+
return function getMetadata() {
|
|
86
|
+
return _ref2.apply(this, arguments);
|
|
87
|
+
};
|
|
88
|
+
}();
|
|
89
|
+
(0, _react.useEffect)(function () {
|
|
90
|
+
getMetadata();
|
|
91
|
+
}, []);
|
|
92
|
+
if (error) {
|
|
93
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("h1", {
|
|
94
|
+
children: ["Oops: ", "".concat(error)]
|
|
95
|
+
});
|
|
96
|
+
} else {
|
|
97
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MetadataContext.Provider, {
|
|
98
|
+
value: {
|
|
99
|
+
loaded: loaded,
|
|
100
|
+
metadata: metadata
|
|
101
|
+
},
|
|
102
|
+
children: children
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
MetadataProvider.propTypes = {
|
|
107
|
+
children: _propTypes.default.node
|
|
108
|
+
};
|
|
109
|
+
/* Wrap a component with <MetadataLoadWall> to show a loading screen until all metadata is fetched
|
|
110
|
+
* This is the "lazy option". It's better UX to have a fine-grained response to individual keys in context.loaded
|
|
111
|
+
* e.g. this.context.loaded.particleProperties? this.context.metadata.particleProperties[particle].html : particle;
|
|
112
|
+
*/
|
|
113
|
+
function MetadataLoadWall(_ref3) {
|
|
114
|
+
var children = _ref3.children;
|
|
115
|
+
var context = useMetadataContext();
|
|
116
|
+
if (Object.values(context.loaded).some(function (v) {
|
|
117
|
+
return !v;
|
|
118
|
+
})) {
|
|
119
|
+
var loadingSpinner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Spinner, {
|
|
120
|
+
animation: "border",
|
|
121
|
+
role: "status",
|
|
122
|
+
size: "sm"
|
|
123
|
+
});
|
|
124
|
+
var doneBadge = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Badge, {
|
|
125
|
+
bg: "success",
|
|
126
|
+
children: "Done"
|
|
127
|
+
});
|
|
128
|
+
var message = Object.keys(context.loaded).map(function (x) {
|
|
129
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ListGroup.Item, {
|
|
130
|
+
children: [x, " ", context.loaded[x] ? doneBadge : loadingSpinner]
|
|
131
|
+
}, x);
|
|
132
|
+
});
|
|
133
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
134
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Alert, {
|
|
135
|
+
variant: "warning",
|
|
136
|
+
children: ["Fetching metadata from the", " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert.Link, {
|
|
137
|
+
href: _config.default.metadata_baseurl,
|
|
138
|
+
target: "_blank",
|
|
139
|
+
children: "backend"
|
|
140
|
+
}), ". This should take a few seconds."]
|
|
141
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup, {
|
|
142
|
+
variant: "flush",
|
|
143
|
+
children: message
|
|
144
|
+
})]
|
|
145
|
+
});
|
|
146
|
+
} else {
|
|
147
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
148
|
+
children: children
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
MetadataLoadWall.propTypes = {
|
|
153
|
+
children: _propTypes.default.node
|
|
154
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
4
|
+
var _App = _interopRequireDefault(require("./components/App"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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
|
+
|
|
18
|
+
_reactDom.default.render( /*#__PURE__*/(0, _jsxRuntime.jsx)(_App.default, {}), document.getElementById("root"));
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
|
+
/*****************************************************************************\
|
|
14
|
+
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
15
|
+
* *
|
|
16
|
+
* This software is distributed under the terms of the GNU General Public *
|
|
17
|
+
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
|
|
18
|
+
* *
|
|
19
|
+
* In applying this licence, CERN does not waive the privileges and immunities *
|
|
20
|
+
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
21
|
+
* or submit itself to any jurisdiction. *
|
|
22
|
+
\*****************************************************************************/
|
|
23
|
+
var BKPath = /*#__PURE__*/function () {
|
|
24
|
+
function BKPath(path) {
|
|
25
|
+
_classCallCheck(this, BKPath);
|
|
26
|
+
this.path = path;
|
|
27
|
+
this.isMC = path.split("/")[1] === "MC";
|
|
28
|
+
}
|
|
29
|
+
_createClass(BKPath, [{
|
|
30
|
+
key: "getStrippingVersion",
|
|
31
|
+
value: function getStrippingVersion() {
|
|
32
|
+
return this.path.split("/")[this.isMC ? 7 : 6].replace("Stripping", "").replace("NoPrescalingFlagged", "");
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
key: "getYear",
|
|
36
|
+
value: function getYear() {
|
|
37
|
+
return this.path.split("/")[2].replace("Collision", "20");
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
key: "getPolarity",
|
|
41
|
+
value: function getPolarity() {
|
|
42
|
+
var _this = this;
|
|
43
|
+
var matchingPolarities = ["MagUp", "MagDown"].filter(function (polarity) {
|
|
44
|
+
return _this.path.includes(polarity);
|
|
45
|
+
});
|
|
46
|
+
if (matchingPolarities.length === 1) {
|
|
47
|
+
return matchingPolarities;
|
|
48
|
+
} else {
|
|
49
|
+
return "?";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "getFilename",
|
|
54
|
+
value: function getFilename() {
|
|
55
|
+
return this.path.split("/")[this.isMC ? 9 : 8];
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "getEventType",
|
|
59
|
+
value: function getEventType() {
|
|
60
|
+
return this.path.split("/")[this.isMC ? 8 : 7];
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
key: "isValid",
|
|
64
|
+
value: function isValid() {
|
|
65
|
+
var bkArray = this.path.split("/");
|
|
66
|
+
if (bkArray[0] !== "") {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
if (!this.path.toLowerCase().endsWith("dst")) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
if (bkArray.length === 9 && bkArray[1] === "LHCb") {
|
|
73
|
+
return true;
|
|
74
|
+
} else if (bkArray.length === 10 && bkArray[1] === "MC") {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}]);
|
|
80
|
+
return BKPath;
|
|
81
|
+
}();
|
|
82
|
+
var _default = BKPath;
|
|
83
|
+
exports.default = _default;
|
|
@@ -0,0 +1,213 @@
|
|
|
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(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
|
+
var DTTConfig = /*#__PURE__*/function () {
|
|
17
|
+
/* Class for customising the configuration of a DecayTreeTuple algorithm.
|
|
18
|
+
* The output will be parsed by a custom parser in the AnalysisHelpers data-package.
|
|
19
|
+
*/
|
|
20
|
+
function DTTConfig(config, toolMetadata) {
|
|
21
|
+
_classCallCheck(this, DTTConfig);
|
|
22
|
+
this.metadata = toolMetadata;
|
|
23
|
+
this.config = config;
|
|
24
|
+
}
|
|
25
|
+
_createClass(DTTConfig, [{
|
|
26
|
+
key: "setInputs",
|
|
27
|
+
value:
|
|
28
|
+
// Set the input location (TES location)
|
|
29
|
+
function setInputs(inputs) {
|
|
30
|
+
this.config.inputs = inputs;
|
|
31
|
+
}
|
|
32
|
+
// Set the class+name combination
|
|
33
|
+
}, {
|
|
34
|
+
key: "setName",
|
|
35
|
+
value: function setName(name) {
|
|
36
|
+
var safeName = name.replace(/\W/g, "");
|
|
37
|
+
this.config.name = "DecayTreeTuple/".concat(safeName);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Return the name of the DecayTreeTuple algorithm
|
|
41
|
+
}, {
|
|
42
|
+
key: "getName",
|
|
43
|
+
value: function getName() {
|
|
44
|
+
return this.config.name.split("/")[1];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Return the name of the DecayTreeTuple algorithm, or default value "DecayTree" if empty
|
|
48
|
+
}, {
|
|
49
|
+
key: "getSafeName",
|
|
50
|
+
value: function getSafeName() {
|
|
51
|
+
var name = this.getName();
|
|
52
|
+
return name ? name : "DecayTree";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Delete all groups with an empty tool list
|
|
56
|
+
}, {
|
|
57
|
+
key: "pruneGroups",
|
|
58
|
+
value: function pruneGroups() {
|
|
59
|
+
var _this = this;
|
|
60
|
+
var empty = Object.keys(this.config.groups).filter(function (group) {
|
|
61
|
+
return _this.config.groups[group].tools.length === 0;
|
|
62
|
+
});
|
|
63
|
+
empty.forEach(function (key) {
|
|
64
|
+
return delete _this.config.groups[key];
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Find the appropriate object which has a "tools" list
|
|
69
|
+
}, {
|
|
70
|
+
key: "getTarget",
|
|
71
|
+
value: function getTarget(branch) {
|
|
72
|
+
var _this2 = this;
|
|
73
|
+
this.pruneGroups();
|
|
74
|
+
if (branch.length === 0) {
|
|
75
|
+
return this.config;
|
|
76
|
+
} else if ("".concat(branch) in this.config.branches) {
|
|
77
|
+
return this.config.branches[branch];
|
|
78
|
+
} else {
|
|
79
|
+
if (!("".concat(branch) in this.config.groups)) {
|
|
80
|
+
this.config.groups["".concat(branch)] = {
|
|
81
|
+
particles: branch.map(function (element) {
|
|
82
|
+
return _this2.config.branches[element].particle;
|
|
83
|
+
}),
|
|
84
|
+
tools: []
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return this.config.groups["".concat(branch)];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Return the list index of a tool
|
|
92
|
+
}, {
|
|
93
|
+
key: "findTool",
|
|
94
|
+
value: function findTool(target, toolString) {
|
|
95
|
+
var index = target.tools.findIndex(function (tool) {
|
|
96
|
+
return toolString in tool;
|
|
97
|
+
});
|
|
98
|
+
if (index < 0) {
|
|
99
|
+
throw new Error("".concat(toolString, " not found in ").concat(target));
|
|
100
|
+
}
|
|
101
|
+
return index;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Add a TupleTool. Return boolean denoting success
|
|
105
|
+
}, {
|
|
106
|
+
key: "addTool",
|
|
107
|
+
value: function addTool(branch, toolClass) {
|
|
108
|
+
var toolName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
109
|
+
var target = this.getTarget(branch);
|
|
110
|
+
// The toolString identifies the tool in the target's tool list
|
|
111
|
+
// If the tool is given a name (recommended), append it following a slash
|
|
112
|
+
var toolString = toolName.length ? "".concat(toolClass, "/").concat(toolName) : toolClass;
|
|
113
|
+
// Add the tool to the list if not already there
|
|
114
|
+
try {
|
|
115
|
+
this.findTool(target, toolString);
|
|
116
|
+
} catch (e) {
|
|
117
|
+
var toolConfig = _defineProperty({}, toolString, this.getDefaultConfig(toolClass));
|
|
118
|
+
target.tools.push(toolConfig);
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
throw new Error("".concat(toolString, " already exists in ").concat(target));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Return a dict containing the default configuration of a TupleTool
|
|
125
|
+
}, {
|
|
126
|
+
key: "getDefaultConfig",
|
|
127
|
+
value: function getDefaultConfig(toolClass) {
|
|
128
|
+
if (toolClass in this.metadata) {
|
|
129
|
+
var params = {};
|
|
130
|
+
this.metadata[toolClass].interface.forEach(function (parameter) {
|
|
131
|
+
params[parameter.name] = _lodash.default.cloneDeep(parameter["default"]); // Deep copy
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
return params;
|
|
135
|
+
} else {
|
|
136
|
+
return {};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Configure a TupleTool by passing a dict (ideally a modified version of the one returned by getToolConfig)
|
|
141
|
+
}, {
|
|
142
|
+
key: "configureTool",
|
|
143
|
+
value: function configureTool(branch, toolString, parameters) {
|
|
144
|
+
var target = this.getTarget(branch);
|
|
145
|
+
var index = this.findTool(target, toolString);
|
|
146
|
+
target.tools[index][toolString] = parameters;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Return the current config dict of a tool, so it can be modified by the user
|
|
150
|
+
}, {
|
|
151
|
+
key: "getToolConfig",
|
|
152
|
+
value: function getToolConfig(branch, toolString) {
|
|
153
|
+
var target = this.getTarget(branch);
|
|
154
|
+
var index = this.findTool(target, toolString);
|
|
155
|
+
return target.tools[index][toolString];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Delete a tool
|
|
159
|
+
}, {
|
|
160
|
+
key: "removeTool",
|
|
161
|
+
value: function removeTool(branch, toolString) {
|
|
162
|
+
var target = this.getTarget(branch);
|
|
163
|
+
var index = this.findTool(target, toolString);
|
|
164
|
+
target.tools.splice(index, 1);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Return a list of strings corresponding to the target's tool list
|
|
168
|
+
}, {
|
|
169
|
+
key: "listTools",
|
|
170
|
+
value: function listTools(branch) {
|
|
171
|
+
var target = this.getTarget(branch);
|
|
172
|
+
return target.tools.map(function (tool) {
|
|
173
|
+
return Object.keys(tool)[0];
|
|
174
|
+
}).sort();
|
|
175
|
+
}
|
|
176
|
+
}], [{
|
|
177
|
+
key: "createDTT",
|
|
178
|
+
value: function createDTT(descriptorTemplate, branchMap, inputs, name, toolMetadata) {
|
|
179
|
+
var branchDict = {};
|
|
180
|
+
branchMap.forEach(function (bmap) {
|
|
181
|
+
var branch = bmap.branch;
|
|
182
|
+
var particle = bmap.particle;
|
|
183
|
+
branchDict[branch] = {
|
|
184
|
+
particle: particle,
|
|
185
|
+
tools: []
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
/* Dict to store the DecayTreeTuple options.
|
|
189
|
+
* This is what should be written to the output JSON file, with a bit of cleaning up.
|
|
190
|
+
*/
|
|
191
|
+
var config = {
|
|
192
|
+
inputs: inputs,
|
|
193
|
+
descriptorTemplate: descriptorTemplate,
|
|
194
|
+
tools: [],
|
|
195
|
+
branches: branchDict,
|
|
196
|
+
groups: {}
|
|
197
|
+
};
|
|
198
|
+
var dtt = new DTTConfig(config, toolMetadata);
|
|
199
|
+
var defaultTools = [
|
|
200
|
+
// default tool list in DaVinci v45r7
|
|
201
|
+
// TODO: load this from a file generated on deployment
|
|
202
|
+
"TupleToolKinematic", "TupleToolPid", "TupleToolANNPID", "TupleToolGeometry", "TupleToolEventInfo"];
|
|
203
|
+
defaultTools.forEach(function (tool) {
|
|
204
|
+
dtt.addTool("", tool);
|
|
205
|
+
});
|
|
206
|
+
dtt.setName(name);
|
|
207
|
+
return dtt;
|
|
208
|
+
}
|
|
209
|
+
}]);
|
|
210
|
+
return DTTConfig;
|
|
211
|
+
}();
|
|
212
|
+
var _default = DTTConfig;
|
|
213
|
+
exports.default = _default;
|