Skip to content

Commit

Permalink
[O2B-1406] Add n TF orbits (#1822)
Browse files Browse the repository at this point in the history
* [O2B-1406] Add n TF orbits

* Add display
  • Loading branch information
martinboulais authored Dec 18, 2024
1 parent 012d42d commit 241b3c4
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/database/adapters/RunAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class RunAdapter {
tfFileSize,
otherFileCount,
otherFileSize,
nTfOrbits,
lhcFill,
flpRoles,
logs,
Expand Down Expand Up @@ -214,6 +215,7 @@ class RunAdapter {
tfFileSize: tfFileSize !== null ? String(tfFileSize) : null,
otherFileCount,
otherFileSize: otherFileSize !== null ? String(otherFileSize) : null,
nTfOrbits: nTfOrbits !== null ? String(nTfOrbits) : null,
lhcFill,
crossSection,
triggerEfficiency,
Expand Down Expand Up @@ -322,6 +324,7 @@ class RunAdapter {
tfFileSize: entityObject.tfFileSize,
otherFileCount: entityObject.otherFileCount,
otherFileSize: entityObject.otherFileSize,
nTfOrbits: entityObject.nTfOrbits,
concatenatedDetectors: entityObject.detectors,
definition: entityObject.definition,
calibrationStatus: entityObject.calibrationStatus,
Expand Down
17 changes: 17 additions & 0 deletions lib/database/migrations/20241218095948-add-n-tf-orbits.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
up: async (queryInterface, Sequelize) => await queryInterface.addColumn(
'runs',
'n_tf_orbits',
{
type: Sequelize.DataTypes.BIGINT,
allowNull: true,
default: null,
after: 'other_file_size',
},
),

down: async (queryInterface) => await queryInterface.removeColumn('runs', 'n_tf_orbits'),
};
4 changes: 4 additions & 0 deletions lib/database/models/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ module.exports = (sequelize) => {
type: Sequelize.BIGINT,
default: null,
},
nTfOrbits: {
type: Sequelize.BIGINT,
default: null,
},
definition: {
type: Sequelize.ENUM(...RUN_DEFINITIONS),
},
Expand Down
1 change: 1 addition & 0 deletions lib/database/models/typedefs/SequelizeRun.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
* @property {string|number|null} tfFileSize
* @property {string|null} otherFileCount
* @property {string|number|null} otherFileSize
* @property {string|number|null} nTfOrbits
* @property {number|null} inelasticInteractionRateAvg
* @property {number|null} inelasticInteractionRateAtStart
* @property {number|null} inelasticInteractionRateAtMid
Expand Down
1 change: 1 addition & 0 deletions lib/database/seeders/20200713103855-runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module.exports = {
tf_file_size: '214920239535280',
other_file_count: 50,
other_file_size: '9999999999999999',
n_tf_orbits: '9999999999999999',
definition: RunDefinition.PHYSICS,
cross_section: 1.23,
trigger_efficiency: 2.34,
Expand Down
1 change: 1 addition & 0 deletions lib/domain/dtos/UpdateRunByRunNumberDto.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const BodyDto = Joi.object({
tfFileSize: Joi.string().optional(),
otherFileCount: Joi.number().optional(),
otherFileSize: Joi.string().optional(),
nTfOrbits: Joi.string().optional(),
crossSection: Joi.number().optional(),
triggerEfficiency: Joi.number().optional(),
triggerAcceptance: Joi.number().optional(),
Expand Down
1 change: 1 addition & 0 deletions lib/domain/entities/Run.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
* @property {string|null} tfFileSize
* @property {string|null} otherFileCount
* @property {string|null} otherFileSize
* @property {string|null} nTfOrbits
* @property {number|null} muInelasticInteractionRate
* @property {number|null} inelasticInteractionRateAvg
* @property {number|null} inelasticInteractionRateAtStart
Expand Down
4 changes: 4 additions & 0 deletions lib/public/views/Runs/Details/runDetailsComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ export const runDetailsComponent = (runDetailsModel, router) => runDetailsModel.
h('strong', 'TF Files size'),
formatFileSize(run.tfFileSize),
]),
h('.flex-column.items-center.flex-grow', [
h('strong', 'TF Orbits count'),
formatItemsCount(run.nTfOrbits),
]),
h('strong', '|'),
h('.flex-column.items-center.flex-grow', [
h('strong', 'Other Files count'),
Expand Down
2 changes: 2 additions & 0 deletions test/api/runs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,7 @@ module.exports = () => {
tfFileSize: BIG_INT_NUMBER,
otherFileCount: 123156132,
otherFileSize: BIG_INT_NUMBER,
nTfOrbits: BIG_INT_NUMBER,
crossSection: 0.1,
triggerEfficiency: 0.2,
triggerAcceptance: 0.3,
Expand Down Expand Up @@ -1235,6 +1236,7 @@ module.exports = () => {
expect(data.tfFileSize).to.equal(BIG_INT_NUMBER);
expect(data.otherFileCount).to.equal(123156132);
expect(data.otherFileSize).to.equal(BIG_INT_NUMBER);
expect(data.nTfOrbits).to.equal(BIG_INT_NUMBER);
expect(data.triggerEfficiency).to.equal(0.2);
expect(data.triggerAcceptance).to.equal(0.3);
expect(data.phaseShiftAtStartBeam1).to.equal(0.4);
Expand Down
2 changes: 2 additions & 0 deletions test/lib/usecases/run/UpdateRunUseCase.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ module.exports = () => {
tfFileSize: BIG_INT_NUMBER,
otherFileCount: 123156132,
otherFileSize: BIG_INT_NUMBER,
nTfOrbits: BIG_INT_NUMBER,
crossSection: 0.1,
triggerEfficiency: 0.2,
triggerAcceptance: 0.3,
Expand Down Expand Up @@ -324,6 +325,7 @@ module.exports = () => {
expect(result.tfFileSize).to.equal(BIG_INT_NUMBER);
expect(result.otherFileCount).to.equal(123156132);
expect(result.otherFileSize).to.equal(BIG_INT_NUMBER);
expect(result.nTfOrbits).to.equal(BIG_INT_NUMBER);
expect(result.crossSection).to.equal(0.1);
expect(result.triggerEfficiency).to.equal(0.2);
expect(result.triggerAcceptance).to.equal(0.3);
Expand Down

0 comments on commit 241b3c4

Please sign in to comment.