Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

79 changes: 79 additions & 0 deletions lib/public/components/Filters/RunsFilter/GaqFilterModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/**
* @license
* Copyright CERN and copyright holders of ALICE Trg. This software is
* distributed under the terms of the GNU General Public License v3 (GPL
* Version 3), copied verbatim in the file "COPYING".
*
* See http://alice-Trg.web.cern.ch/license for full licensing information.
*
* In applying this license CERN does not waive the privileges and immunities
* granted to it by virtue of its status as an Intergovernmental Organization
* or submit itself to any jurisdiction.
*/

import { FilterModel } from '../common/FilterModel.js';
import { NumericalComparisonFilterModel } from '../common/filters/NumericalComparisonFilterModel.js';

/**
* Time-range filter model
*/
export class GaqFilterModel extends FilterModel {
/**
* Constructor
* @param {ToggleFilterModel} mcReproducibleAsNotBad model that determines if a 'not bad' status was reproduceable for a Monte Carlo.
* This param is required as many other filters models need to make use of the same ToggleFilterModel instance
*/
constructor(mcReproducibleAsNotBad) {
super();

this._notBadFraction = new NumericalComparisonFilterModel({ scale: 0.01, integer: false });
this._addSubmodel(this._notBadFraction);
this._mcReproducibleAsNotBad = mcReproducibleAsNotBad;
this._addSubmodel(this._mcReproducibleAsNotBad);
}

/**
* @inheritDoc
*/
reset() {
this._notBadFraction.reset();
}

/**
* @inheritDoc
*/
get isEmpty() {
return this._notBadFraction.isEmpty;
}

/**
* @inheritDoc
*/
get normalized() {
const normalized = { notBadFraction: this._notBadFraction.normalized };

if (!this.isEmpty) {
normalized.mcReproducibleAsNotBad = this._mcReproducibleAsNotBad.isToggled();
}

return normalized;
}

/**
* Return the underlying notBadFraction model
*
* @return {NumericalComparisonFilterModel} the filter model
*/
get notBadFraction() {
return this._notBadFraction;
}

/**
* Return the underlying mcReproducibleAsNotBad model
*
* @return {ToggleFilterModel} the filter model
*/
get mcReproducibleAsNotBad() {
return this._mcReproducibleAsNotBad;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/**
* @license
* Copyright CERN and copyright holders of ALICE Trg. This software is
* distributed under the terms of the GNU General Public License v3 (GPL
* Version 3), copied verbatim in the file "COPYING".
*
* See http://alice-Trg.web.cern.ch/license for full licensing information.
*
* In applying this license CERN does not waive the privileges and immunities
* granted to it by virtue of its status as an Intergovernmental Organization
* or submit itself to any jurisdiction.
*/

import { FilterModel } from '../common/FilterModel.js';

/**
* Time-range filter model
*/
export class MultiCompositionFilterModel extends FilterModel {
/**
* Constructor
* @param {Object<string|number, FilterModel|SelectionModel>} filters the filters that will make up the composite filter
*/
constructor(filters = {}) {
super();

/**
* @type {Object<string|number, FilterModel|SelectionModel>}
*/
this._filters = {};

Object.entries(filters).forEach(([key, filter]) => this.putFilter(key, filter));
}

/**
* Return a subfilter by key
*
* @param {string} key the key of the subfilter
* @return {FilterModel} the subfilter
*/
putFilter(key, filterModel) {
if (key in this._filters) {
return;
}

this._filters[key] = filterModel;
this._addSubmodel(filterModel);
}

/**
* Add new subfilter
*
* @param {string} key key of the subfilter
* @param {FilterModel} filter the the subfilter
*/
getFilter(key) {
if (!(key in this._filters)) {
throw new Error(`No filter found with key ${key}`);
}

return this._filters[key];
}

/**
* @inheritDoc
*/
reset() {
Object.values(this._filters).forEach((filter) => filter.reset());
}

/**
* @inheritDoc
*/
get isEmpty() {
return Object.values(this._filters).every((filter) => filter.isEmpty);
}

/**
* @inheritDoc
*/
get normalized() {
const normalized = {};

for (const [id, detector] of Object.entries(this._filters)) {
if (!detector.isEmpty) {
normalized[id] = detector.normalized;
}
}

return normalized;
}
}
50 changes: 0 additions & 50 deletions lib/public/components/Filters/RunsFilter/dcs.js

This file was deleted.

Loading
Loading