Skip to content

Commit 57e9ddb

Browse files
committed
merge main
2 parents 52020d9 + 0ce697b commit 57e9ddb

37 files changed

Lines changed: 418 additions & 131 deletions
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* @license
3+
* Copyright CERN and copyright holders of ALICE O2. This software is
4+
* distributed under the terms of the GNU General Public License v3 (GPL
5+
* Version 3), copied verbatim in the file "COPYING".
6+
*
7+
* See http://alice-o2.web.cern.ch/license for full licensing information.
8+
*
9+
* In applying this license CERN does not waive the privileges and immunities
10+
* granted to it by virtue of its status as an Intergovernmental Organization
11+
* or submit itself to any jurisdiction.
12+
*/
13+
14+
'use strict';
15+
16+
const { Sequelize } = require('sequelize');
17+
const { DETECTOR_TYPES, DetectorType } = require('../../../domain/enums/DetectorTypes.js');
18+
19+
/** @type {import('sequelize-cli').Migration} */
20+
module.exports = {
21+
up: async (queryInterface) => queryInterface.sequelize.transaction(async () => {
22+
await queryInterface.changeColumn(
23+
'detectors',
24+
'type',
25+
{ type: Sequelize.ENUM(...DETECTOR_TYPES), allowNull: false },
26+
);
27+
}),
28+
29+
down: async (queryInterface) => queryInterface.sequelize.transaction(async () => {
30+
await queryInterface.changeColumn(
31+
'detectors',
32+
'type',
33+
{
34+
type: Sequelize.ENUM([
35+
DetectorType.PHYSICAL,
36+
DetectorType.QC_ONLY,
37+
DetectorType.VIRTUAL,
38+
DetectorType.OTHER,
39+
]),
40+
allowNull: false,
41+
},
42+
);
43+
}),
44+
};

lib/database/seeders/20200713103855-runs.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,6 +2777,50 @@ module.exports = {
27772777
updated_at: '2019-08-09 14:00:00',
27782778
created_at: '2019-08-09 14:00:00',
27792779
},
2780+
2781+
{
2782+
id: 109,
2783+
run_number: 109,
2784+
time_o2_start: '2020-08-08 13:00:00',
2785+
first_tf_timestamp: '2020-08-08 13:00:00',
2786+
time_trg_start: '2020-08-08 13:00:00',
2787+
time_trg_end: '2020-08-09 14:00:00',
2788+
time_o2_end: '2020-08-09 14:00:00',
2789+
run_type_id: 12,
2790+
run_quality: 'good',
2791+
n_detectors: 15,
2792+
n_flps: 12,
2793+
n_epns: 12,
2794+
n_subtimeframes: 12,
2795+
bytes_read_out: 64,
2796+
dd_flp: true,
2797+
dcs: false,
2798+
epn: true,
2799+
fill_number: null,
2800+
epn_topology: 'quite a long topology, which will for sure require a balloon to be displayed properly',
2801+
concatenated_detectors: 'CPV',
2802+
lhc_period_id: 3,
2803+
lhc_beam_mode: 'STABLE BEAMS',
2804+
odc_topology_full_name: 'hash',
2805+
pdp_workflow_parameters: 'QC,GPU,CTF,EVENT_DISPLAY',
2806+
pdp_beam_type: 'OO',
2807+
readout_cfg_uri: 'Repository hash',
2808+
start_of_data_transfer: '2022-03-21 13:00:00',
2809+
end_of_data_transfer: '2022-03-21 13:30:00',
2810+
ctf_file_count: 500,
2811+
ctf_file_size: '214920239535280',
2812+
tf_file_count: 30,
2813+
tf_file_size: '214920239535280',
2814+
other_file_count: 50,
2815+
other_file_size: '214920239535280',
2816+
definition: RunDefinition.PHYSICS,
2817+
trigger_efficiency: 1,
2818+
trigger_acceptance: 0.7569974555,
2819+
cross_section: 78600,
2820+
2821+
updated_at: '2020-08-09 14:00:00',
2822+
created_at: '2020-08-09 14:00:00',
2823+
},
27802824
], { transaction }),
27812825
])),
27822826

lib/database/seeders/20221005120315-detector.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,23 @@ module.exports = {
123123
name: 'GLO',
124124
type: DetectorType.QC_ONLY,
125125
},
126+
127+
{
128+
id: 22,
129+
name: 'VTX',
130+
type: DetectorType.AOT_GLO,
131+
},
132+
{
133+
id: 23,
134+
name: 'EVS',
135+
type: DetectorType.AOT_EVENT,
136+
},
137+
{
138+
id: 24,
139+
name: 'MUD',
140+
type: DetectorType.MUON_GLO,
141+
},
142+
126143
], { transaction });
127144
}),
128145
down: async (queryInterface) =>

lib/database/seeders/20221006084006-run-detectors.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,12 @@ module.exports = {
699699
detector_id: 16,
700700
quality: 'good',
701701
},
702+
703+
{
704+
run_number: 109,
705+
detector_id: 1,
706+
quality: 'good',
707+
},
702708
],
703709
{ transaction },
704710
),

lib/database/seeders/20240112102011-data-passes.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ module.exports = {
7777
created_at: '2024-02-11 10:00:00',
7878
updated_at: '2024-02-11 10:00:00',
7979
},
80+
81+
/** LHC23f */
82+
{
83+
id: 9,
84+
name: 'LHC23f_cpass0',
85+
lhc_period_id: 3,
86+
created_at: '2024-02-11 10:00:00',
87+
updated_at: '2024-02-11 10:00:00',
88+
},
8089
], { transaction });
8190

8291
await queryInterface.bulkInsert('data_pass_versions', [
@@ -144,7 +153,15 @@ module.exports = {
144153
updated_at: '2024-02-15 12:00:00',
145154
},
146155

147-
], { transaction }),
156+
{
157+
id: 9,
158+
description: 'cpass0',
159+
data_pass_id: 9,
160+
created_at: '2024-02-15 12:00:00',
161+
updated_at: '2024-02-15 12:00:00',
162+
},
163+
164+
], { transaction });
148165

149166
await queryInterface.bulkInsert('data_pass_version_status_history', [
150167

@@ -248,7 +265,15 @@ module.exports = {
248265
created_at: '2024-02-15 12:30:00',
249266
updated_at: '2024-02-15 12:30:00',
250267
},
251-
], { transaction }),
268+
269+
{
270+
id: 14,
271+
data_pass_version_id: 9,
272+
status: DataPassVersionStatus.RUNNING,
273+
created_at: '2024-02-15 12:00:00',
274+
updated_at: '2024-02-15 12:00:00',
275+
},
276+
], { transaction });
252277

253278
await queryInterface.bulkInsert('data_passes_runs', [
254279
{ data_pass_id: 1, run_number: 106, ready_for_skimming: true },
@@ -274,6 +299,9 @@ module.exports = {
274299
{ data_pass_id: 5, run_number: 54 },
275300
{ data_pass_id: 5, run_number: 56 },
276301
{ data_pass_id: 5, run_number: 105 },
302+
303+
{ data_pass_id: 9, run_number: 109 },
304+
277305
], { transaction });
278306
}),
279307

lib/domain/enums/DetectorTypes.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
const DetectorType = Object.freeze({
1515
PHYSICAL: 'PHYSICAL',
1616
QC_ONLY: 'QC',
17+
AOT_GLO: 'AOT-GLO',
18+
AOT_EVENT: 'AOT-EVENT',
19+
MUON_GLO: 'MUON-GLO',
1720
VIRTUAL: 'VIRTUAL',
1821
OTHER: 'OTHER',
1922
});
@@ -25,8 +28,11 @@ const DETECTOR_TYPES = Object.values(DetectorType);
2528
*/
2629
const DATA_TAKING_DETECTOR_TYPES = [DetectorType.PHYSICAL, DetectorType.VIRTUAL];
2730

31+
const QC_DETECTOR_TYPES = [DetectorType.PHYSICAL, DetectorType.QC_ONLY, DetectorType.AOT_EVENT, DetectorType.AOT_GLO, DetectorType.MUON_GLO];
32+
2833
module.exports = {
2934
DetectorType,
3035
DETECTOR_TYPES,
3136
DATA_TAKING_DETECTOR_TYPES,
37+
QC_DETECTOR_TYPES,
3238
};

lib/public/components/Filters/common/FilteringModel.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,14 @@ export class FilteringModel extends Observable {
108108
/**
109109
* Add new filter
110110
*
111+
* NOTE that the method has no effect if called more than once for the same key
112+
*
111113
* @param {string} key key of a new filter
112114
* @param {FilterModel} filter the new filter
113115
*/
114116
put(key, filter) {
115117
if (key in this._filters) {
116-
throw new Error(`Filter under key ${key} already exists`);
118+
return;
117119
}
118120

119121
this._filters[key] = filter;

lib/public/domain/enums/DetectorTypes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
export const DetectorType = Object.freeze({
1515
PHYSICAL: 'PHYSICAL',
1616
QC_ONLY: 'QC',
17+
AOT_GLO: 'AOT-GLO',
18+
AOT_EVENT: 'AOT-EVENT',
19+
MUON_GLO: 'MUON-GLO',
1720
VIRTUAL: 'VIRTUAL',
1821
OTHER: 'OTHER',
1922
});
@@ -24,3 +27,5 @@ export const DETECTOR_TYPES = Object.values(DetectorType);
2427
* Any detector that might be used in AliECS configuration
2528
*/
2629
export const DATA_TAKING_DETECTOR_TYPES = [DetectorType.PHYSICAL, DetectorType.VIRTUAL];
30+
31+
export const QC_DETECTORS = [DetectorType.PHYSICAL, DetectorType.QC_ONLY, DetectorType.AOT_GLO, DetectorType.AOT_EVENT, DetectorType.MUON_GLO];

lib/public/services/detectors/detectorsProvider.js

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
* or submit itself to any jurisdiction.
1212
*/
1313

14+
import { switchCase } from '/js/src/index.js';
1415
import { getRemoteData } from '../../utilities/fetch/getRemoteData.js';
1516
import { ObservableData } from '../../utilities/ObservableData.js';
16-
import { DetectorType, DATA_TAKING_DETECTOR_TYPES } from '../../domain/enums/DetectorTypes.js';
17+
import { DetectorType, DATA_TAKING_DETECTOR_TYPES, QC_DETECTORS } from '../../domain/enums/DetectorTypes.js';
1718

1819
import { NonPhysicalDetector } from '../../domain/enums/detectorsNames.mjs';
1920

@@ -32,10 +33,10 @@ const getPhysicalDetectorsFromAllDetectors = (allDetectors) => allDetectors.filt
3233
* Return the QC detectors from a list of detectors
3334
*
3435
* @param {Detector[]} allDetectors the list of all detectors
35-
* @return {Detector[]} physical detectors
36+
* @return {Detector[]} QC detectors
3637
*/
3738
const getQcDetectorsFromAllDetectors = (allDetectors) => allDetectors
38-
.filter(({ type, name }) => [DetectorType.PHYSICAL, DetectorType.QC].includes(type) && !DETECTORS_EXCLUDED_FROM_QC.includes(name));
39+
.filter(({ type, name }) => QC_DETECTORS.includes(type) && !DETECTORS_EXCLUDED_FROM_QC.includes(name));
3940

4041
/**
4142
* Service class to fetch detectors from the backend
@@ -72,9 +73,27 @@ export class DetectorsProvider extends RemoteDataProvider {
7273
* @inheritDoc
7374
*/
7475
async getRemoteData() {
75-
const { data } = await getRemoteData('/api/detectors');
76-
data.sort(({ name: name1 }, { name: name2 }) => name1.localeCompare(name2));
77-
return data;
76+
const { data: detectors } = await getRemoteData('/api/detectors');
77+
const typeToOrderingKey = (type) => switchCase(type, {
78+
[DetectorType.OTHER]: 0,
79+
[DetectorType.VIRTUAL]: 1,
80+
[DetectorType.PHYSICAL]: 2,
81+
[DetectorType.AOT_GLO]: 3,
82+
[DetectorType.AOT_EVENT]: 4,
83+
[DetectorType.MUON_GLO]: 5,
84+
[DetectorType.QC_ONLY]: 6,
85+
});
86+
87+
const orderingKey = (detector1, detector2) => {
88+
const specialPair = ['ZDC', 'TST'];
89+
if (specialPair.includes(detector1.name) && specialPair.includes(detector2.name)) {
90+
return detector1.name === 'ZDC' ? 1 : -1;
91+
}
92+
return -(typeToOrderingKey(detector1.type) - typeToOrderingKey(detector2.type)) * 10 + detector1.name.localeCompare(detector2.name);
93+
};
94+
95+
detectors.sort((detector1, detector2) => orderingKey(detector1, detector2));
96+
return detectors;
7897
}
7998

8099
/**

lib/public/utilities/ObservableData.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ class ObservableDataBuilder {
117117
}
118118

119119
/**
120-
* Any time the source data value change it will be reflected in the created observable data
120+
* Any time the source data value changes it will be reflected in the created observable data
121+
* NOTE that when this option is used, then first of optional processors must accept source.getCurrent()
121122
*
122123
* @param {ObservableData} source the source data
123124
* @return {this} the builder instance
@@ -127,6 +128,18 @@ class ObservableDataBuilder {
127128
return this;
128129
}
129130

131+
/**
132+
* Any time the one of sources' data value changes it will be reflected in the created observable data
133+
* NOTE that when this option is used, then first of optional processors must accept sources list mapped by #getCurrent() method
134+
*
135+
* @param {ObservableData[]} sources the list of source data
136+
* @return {this} the builder instance
137+
*/
138+
sources(sources) {
139+
this._sources = sources;
140+
return this;
141+
}
142+
130143
/**
131144
* Adds a processing function that will be applied to the observable data (map functions will be called in the same
132145
* order as they have been registered)
@@ -147,10 +160,19 @@ class ObservableDataBuilder {
147160
build() {
148161
const initialValue = this._initialValue ?? this._source?.getCurrent();
149162
const observableData = new ObservableDataWithProcessing(initialValue, this._processors);
163+
if (this._source && this._sources) {
164+
throw Error('Cannot use sources() and source() in te same builder');
165+
}
166+
if (this._sources) {
167+
const sources = this._sources;
168+
sources.forEach((source) => source.observe(() => observableData.setCurrent(sources.map((source) => source.getCurrent()))));
169+
}
170+
150171
if (this._source) {
151172
const source = this._source;
152173
source.observe(() => observableData.setCurrent(source.getCurrent()));
153174
}
175+
154176
this._processors = [];
155177
this._initialValue = null;
156178
this._source = null;

0 commit comments

Comments
 (0)