Skip to content

Commit 733f474

Browse files
committed
add other typeS
1 parent 119e19b commit 733f474

5 files changed

Lines changed: 36 additions & 19 deletions

File tree

lib/database/migrations/v1/20250901153000-add-aot-and-muons-qc-detectors.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,31 @@
1313

1414
'use strict';
1515

16-
const { Op } = require('sequelize');
17-
const { DetectorType } = require('../../../domain/enums/DetectorTypes.js');
16+
const { Op, Sequelize } = require('sequelize');
17+
const { DetectorType, DETECTOR_TYPES } = require('../../../domain/enums/DetectorTypes.js');
1818

1919
const NEW_QC_DETECTORS = [
20-
'VTX',
21-
'MTE',
22-
'AOT-GLO',
23-
'EVS',
24-
'CEN',
25-
'EVP',
26-
'AOT-Event',
27-
'MUD',
28-
'GMU',
29-
'MUON-GLO',
20+
['VTX', DetectorType.AOT_GLO],
21+
['MTE', DetectorType.AOT_GLO],
22+
23+
['EVS', DetectorType.AOT_EVENT],
24+
['CEN', DetectorType.AOT_EVENT],
25+
['EVP', DetectorType.AOT_EVENT],
26+
27+
['MUD', DetectorType.MUON_GLO],
28+
['GMU', DetectorType.MUON_GLO],
3029
];
3130

3231
/** @type {import('sequelize-cli').Migration} */
3332
module.exports = {
34-
up: async (queryInterface) => queryInterface.sequelize.transaction(async () => {
35-
await queryInterface.bulkInsert('detectors', NEW_QC_DETECTORS.map((name) => ({ name, type: DetectorType.QC_ONLY })));
33+
up: async (queryInterface) => queryInterface.sequelize.transaction(async (transaction) => {
34+
await queryInterface.changeColumn(
35+
'detectors',
36+
'type',
37+
{ type: Sequelize.ENUM(...DETECTOR_TYPES), allowNull: false },
38+
{ transaction },
39+
);
40+
await queryInterface.bulkInsert('detectors', NEW_QC_DETECTORS.map(([name, type]) => ({ name, type })), { transaction });
3641
}),
3742

3843
down: async (queryInterface) => queryInterface.sequelize.transaction(async () => {

lib/domain/enums/DetectorTypes.js

Lines changed: 3 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: 'MOUN-GLO',
1720
VIRTUAL: 'VIRTUAL',
1821
OTHER: 'OTHER',
1922
});

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: 'MOUN-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: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import { switchCase } from '/js/src/index.js';
1515
import { getRemoteData } from '../../utilities/fetch/getRemoteData.js';
1616
import { ObservableData } from '../../utilities/ObservableData.js';
17-
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';
1818

1919
import { NonPhysicalDetector } from '../../domain/enums/detectorsNames.mjs';
2020

@@ -36,7 +36,7 @@ const getPhysicalDetectorsFromAllDetectors = (allDetectors) => allDetectors.filt
3636
* @return {Detector[]} QC detectors
3737
*/
3838
const getQcDetectorsFromAllDetectors = (allDetectors) => allDetectors
39-
.filter(({ type, name }) => [DetectorType.PHYSICAL, DetectorType.QC_ONLY].includes(type) && !DETECTORS_EXCLUDED_FROM_QC.includes(name));
39+
.filter(({ type, name }) => QC_DETECTORS.includes(type) && !DETECTORS_EXCLUDED_FROM_QC.includes(name));
4040

4141
/**
4242
* Service class to fetch detectors from the backend
@@ -78,7 +78,10 @@ export class DetectorsProvider extends RemoteDataProvider {
7878
[DetectorType.OTHER]: 0,
7979
[DetectorType.VIRTUAL]: 1,
8080
[DetectorType.PHYSICAL]: 2,
81-
[DetectorType.QC_ONLY]: 3,
81+
[DetectorType.AOT_GLO]: 3,
82+
[DetectorType.AOT_EVENT]: 4,
83+
[DetectorType.MUON_GLO]: 5,
84+
[DetectorType.QC_ONLY]: 6,
8285
});
8386
data.sort(({ name: name1, type: type1 }, { name: name2, type: type2 }) =>
8487
-(typeToOrderingKey(type1) - typeToOrderingKey(type2)) * 10 + name1.localeCompare(name2));

lib/public/views/Runs/ActiveColumns/runDetectorsAsyncQcActiveColumns.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import errorAlert from '../../../components/common/errorAlert.js';
2222
import spinner from '../../../components/common/spinner.js';
2323
import { numericalComparisonFilter } from '../../../components/Filters/common/filters/numericalComparisonFilter.js';
2424
import { filtersSection } from '../../../components/Filters/common/filtersPanelPopover.js';
25+
import { DetectorType } from '../../../domain/enums/DetectorTypes.js';
2526

2627
/**
2728
* Render QC summary for given run and detector
@@ -77,7 +78,7 @@ export const createRunDetectorsAsyncQcActiveColumns = (
7778
throw new Error('`dataPass` and `simulationPass` are exclusive options');
7879
}
7980

80-
let activeColumnEntries = dplDetectors?.map(({ name: detectorName, id: dplDetectorId }) => [
81+
let activeColumnEntries = dplDetectors?.map(({ name: detectorName, id: dplDetectorId, type: dplDetectorType }) => [
8182
detectorName,
8283
{
8384
name: detectorName.toUpperCase(),
@@ -87,7 +88,7 @@ export const createRunDetectorsAsyncQcActiveColumns = (
8788
Failure: (errors) => errorAlert(errors),
8889
Success: (detectorUserHasAccessTo) => {
8990
const detectorWasActiveDuringRun = Boolean(run.detectorsQualities.find(({ name }) => name === detectorName));
90-
if (!detectorWasActiveDuringRun) {
91+
if (dplDetectorType == DetectorType.PHYSICAL && !detectorWasActiveDuringRun) {
9192
return null;
9293
}
9394

0 commit comments

Comments
 (0)