Skip to content

Commit 40cf1d4

Browse files
committed
Merge branch 'bugfix/fix-the-phi0-definition' into 'main'
Fix the phi0 definition by using Math.atan2 instead of Math.atan See merge request belle2/software/display!2
2 parents 1f9f09b + 010959e commit 40cf1d4

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

docs/source/developer/installation.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ Installation
55

66
For developers, to set up the local environment, please follow the steps below.
77

8-
1. **Install Node.js** on your system. You can download the latest version of Node.js from the `official website`_.
8+
1. **Install Node.js** on your system. You can download the latest version of Node.js from the
9+
`official website`_.
10+
11+
Note that the recommended version of Angular CLI (see below) requires a minimum Node.js version
12+
of v14.20, v16.30, v18.10 or v20.0.
913

1014
.. _official website: https://nodejs.org/en/download
1115

16+
1217
2. **Install Angular CLI** globally by running the following command:
1318

1419
.. code-block:: console
@@ -27,7 +32,7 @@ For developers, to set up the local environment, please follow the steps below.
2732
2833
$ cd display
2934
30-
5. Run ``npm install`` to install the necessary dependencies
35+
5. Run ``npm install`` to install the necessary dependencies.
3136

3237
6. Run ``npm start`` or ``ng serve`` to start the development server.
3338

src/app/event-display/event-loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class TEventSelector extends TSelector {
9898
let points: [number, number, number][] = [];
9999
const rho = Math.sqrt(px * px + py * py) / 0.0045; // approximation and only for charge != 0
100100
const tanLambda = pz / Math.sqrt(px * px + py * py);
101-
const phi0 = Math.atan(py / px);
101+
const phi0 = Math.atan2(py, px);
102102

103103
if (charge === 0) {
104104
if (

src/loaders/event-data-loader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ export class Belle2Loader extends PhoenixLoader {
260260
...(particle?.trackIndex > -1 && {
261261
Track: particle.trackIndex
262262
}),
263-
phi: Math.atan(
264-
particle?.momentum_x / particle?.momentum_y
263+
phi: Math.atan2(
264+
particle?.momentum_x, particle?.momentum_y
265265
).toPrecision(5),
266266
PDG: particle.PDG,
267267
color: this.getParticleColor(particle.PDG),

src/loaders/objects/klmCluster.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as THREE from 'three';
22

33
const getPhi = (vector: THREE.Vector3) => {
4-
return Math.atan(vector.y / vector.x);
4+
return Math.atan2(vector.y, vector.x);
55
};
66

77
const getR = (vector: THREE.Vector3) => {
@@ -11,8 +11,8 @@ const getR = (vector: THREE.Vector3) => {
1111
};
1212

1313
const getTheta = (vector: THREE.Vector3) => {
14-
return Math.atan(
15-
Math.sqrt(vector.x * vector.x + vector.y * vector.y) / vector.z
14+
return Math.atan2(
15+
Math.sqrt(vector.x * vector.x + vector.y * vector.y), vector.z
1616
);
1717
};
1818

0 commit comments

Comments
 (0)