Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
9inpachi committed Aug 23, 2023
1 parent 60a5d64 commit 194df5e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ export class PhoenixObjects {

for (let i = 0; i < positions.length; i++) {
points.push(
new Vector3(positions[i][0], positions[i][1], positions[i][2])
new Vector3(positions[i][0], positions[i][1], positions[i][2]),
);
const radius = Math.sqrt(
positions[i][0] * positions[i][0] +
positions[i][1] * positions[i][1] +
positions[i][2] * positions[i][2]
positions[i][2] * positions[i][2],
);
const thetaFromPos = Math.acos(positions[i][2] / radius);
// const deltaTheta = Math.abs(trackParams.dparams[3]-thetaFromPos);
Expand Down Expand Up @@ -213,7 +213,7 @@ export class PhoenixObjects {
const translation = new Vector3(
0.5 * length * cphi * stheta,
0.5 * length * sphi * stheta,
0.5 * length * ctheta
0.5 * length * ctheta,
);

const width = jetParams.coneR
Expand Down Expand Up @@ -312,25 +312,25 @@ export class PhoenixObjects {
return PhoenixObjects.hitsToPoints(
pointPos,
hitsParams,
hitsParamsClone
hitsParamsClone,
);
case 'CircularPoint':
return PhoenixObjects.hitsToCircularPoints(
pointPos,
hitsParams,
hitsParamsClone
hitsParamsClone,
);
case 'Line':
return PhoenixObjects.hitsToLines(
pointPos,
hitsParams,
hitsParamsClone
hitsParamsClone,
);
case 'Box':
return PhoenixObjects.hitsToBoxes(
pointPos,
hitsParams,
hitsParamsClone
hitsParamsClone,
);
default:
console.log('ERROR: Unknown hit type!');
Expand All @@ -348,7 +348,7 @@ export class PhoenixObjects {
private static hitsToPoints(
pointPos: any,
hitsParams: any,
_hitParamsClone: any
_hitParamsClone: any,
): Object3D {
const geometry = new BufferGeometry();
geometry.setAttribute('position', new BufferAttribute(pointPos, 3));
Expand Down Expand Up @@ -380,7 +380,7 @@ export class PhoenixObjects {
private static hitsToCircularPoints(
pointPos: any,
hitsParams: any,
_hitParamsClone: any
_hitParamsClone: any,
): Object3D {
const geometry = new BufferGeometry();
geometry.setAttribute('position', new BufferAttribute(pointPos, 3));
Expand Down Expand Up @@ -426,7 +426,7 @@ export class PhoenixObjects {
private static hitsToLines(
pointPos: any,
hitsParams: any,
_hitParamsClone: any
_hitParamsClone: any,
): Object3D {
// geometry
const geometry = new BufferGeometry();
Expand Down Expand Up @@ -459,15 +459,15 @@ export class PhoenixObjects {
private static hitsToBoxes(
pointPos: any,
hitsParams: any,
_hitParamsClone: any
_hitParamsClone: any,
): Object3D {
// geometry
const geometries = [];
for (let i = 0; i < pointPos.length; i += 6) {
const boxGeometry = new BoxGeometry(
pointPos[i + 3],
pointPos[i + 4],
pointPos[i + 5]
pointPos[i + 5],
);
boxGeometry.translate(pointPos[i], pointPos[i + 1], pointPos[i + 2]);
geometries.push(boxGeometry);
Expand Down Expand Up @@ -514,7 +514,7 @@ export class PhoenixObjects {
},
defaultRadius: number = 1800,
defaultZ: number = 3600,
energyScaling: number = 0.03
energyScaling: number = 0.03,
): Object3D {
const clusterLength = clusterParams.energy * energyScaling;
const clusterWidth = clusterParams.side ?? 40;
Expand All @@ -523,12 +523,12 @@ export class PhoenixObjects {
const cube = PhoenixObjects.getCaloCube(
clusterParams,
clusterWidth,
clusterLength
clusterLength,
);
const position = PhoenixObjects.getCaloPosition(
clusterParams,
defaultRadius,
defaultZ
defaultZ,
);

cube.position.copy(position);
Expand Down Expand Up @@ -560,7 +560,7 @@ export class PhoenixObjects {
},
defaultRadius: number = 1800,
defaultZ: number = 3600,
cylindrical: boolean = true
cylindrical: boolean = true,
) {
const theta =
clusterParams.theta ?? CoordinateHelper.etaToTheta(clusterParams.eta);
Expand All @@ -573,26 +573,26 @@ export class PhoenixObjects {
const position = CoordinateHelper.sphericalToCartesian(
radius,
theta,
clusterParams.phi
clusterParams.phi,
);

if (clusterParams.z) {
position.setLength(
(position.length() * clusterParams.z) / Math.abs(position.z)
(position.length() * clusterParams.z) / Math.abs(position.z),
);
}

if (!clusterParams.radius && !clusterParams.z) {
if (Math.abs(position.z) > defaultZ) {
position.setLength(
(position.length() * defaultZ) / Math.abs(position.z)
(position.length() * defaultZ) / Math.abs(position.z),
);
}
const cylRadius2 = position.x * position.x + position.y * position.y;
const maxR2 = defaultRadius * defaultRadius;
if (cylRadius2 > maxR2) {
position.setLength(
(position.length() * Math.sqrt(maxR2)) / Math.sqrt(cylRadius2)
(position.length() * Math.sqrt(maxR2)) / Math.sqrt(cylRadius2),
);
}
}
Expand All @@ -614,7 +614,7 @@ export class PhoenixObjects {
color?: string;
},
defaultCellWidth: number = 30,
defaultCellLength: number = 30
defaultCellLength: number = 30,
) {
const cellWidth = clusterParams.side ?? defaultCellWidth;
let cellLength = clusterParams.length ?? defaultCellLength;
Expand Down Expand Up @@ -661,12 +661,12 @@ export class PhoenixObjects {
const cube = PhoenixObjects.getCaloCube(
caloCellParams,
defaultSide,
defaultLength
defaultLength,
);
const position = PhoenixObjects.getCaloPosition(
caloCellParams,
defaultRadius,
defaultZ
defaultZ,
);
cube.position.copy(position);

Expand Down Expand Up @@ -710,7 +710,7 @@ export class PhoenixObjects {
const qrot = new Quaternion();
qrot.setFromUnitVectors(
new Vector3(0, 0, 1),
new Vector3(...plane.slice(0, 3))
new Vector3(...plane.slice(0, 3)),
);
geometry.applyQuaternion(qrot);
geoms.push(geometry);
Expand All @@ -722,7 +722,7 @@ export class PhoenixObjects {

const outerBox = new Mesh(
BufferGeometryUtils.mergeGeometries(geoms),
material
material,
);

outerBox.userData = Object.assign({}, caloCells[0]);
Expand Down Expand Up @@ -768,7 +768,7 @@ export class PhoenixObjects {
// creating the box in the z direction, and moving it by d, along the z
const boxPosition = new Vector3(
...position.slice(0, 2),
plane[3] + length / 2
plane[3] + length / 2,
);

box.position.copy(boxPosition);
Expand All @@ -777,7 +777,7 @@ export class PhoenixObjects {
const qrot = new Quaternion();
qrot.setFromUnitVectors(
new Vector3(0, 0, 1),
new Vector3(...plane.slice(0, 3))
new Vector3(...plane.slice(0, 3)),
);

outerBox.quaternion.copy(qrot);
Expand Down Expand Up @@ -870,7 +870,7 @@ export class PhoenixObjects {
const verticesOfCube = [];
for (let i = 0; i < 24; i += 3) {
verticesOfCube.push(
new Vector3(irrCells.vtx[i], irrCells.vtx[i + 1], irrCells.vtx[i + 2])
new Vector3(irrCells.vtx[i], irrCells.vtx[i + 1], irrCells.vtx[i + 2]),
);
}
const geometry = new ConvexGeometry(verticesOfCube);
Expand All @@ -881,7 +881,7 @@ export class PhoenixObjects {
irrCells.color[1].toString() +
',' +
irrCells.color[2].toString() +
')'
')',
);

// material
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('IoOptionsDialogComponent', () => {

it('should handle JiveXML event data input', async () => {
await fetch(
'https://raw.githubusercontent.com/HSF/phoenix/main/packages/phoenix-ng/projects/phoenix-app/src/assets/files/JiveXML/JiveXML_336567_2327102923.xml'
'https://raw.githubusercontent.com/HSF/phoenix/main/packages/phoenix-ng/projects/phoenix-app/src/assets/files/JiveXML/JiveXML_336567_2327102923.xml',
)
.then((res) => res.text())
.then((res) => {
Expand Down Expand Up @@ -159,7 +159,7 @@ describe('IoOptionsDialogComponent', () => {
const zip = new JSZip();
zip.file('test_data.json', '{ "event": null }');
const jivexmlData = await fetch(
'https://raw.githubusercontent.com/HSF/phoenix/main/packages/phoenix-ng/projects/phoenix-app/src/assets/files/JiveXML/JiveXML_336567_2327102923.xml'
'https://raw.githubusercontent.com/HSF/phoenix/main/packages/phoenix-ng/projects/phoenix-app/src/assets/files/JiveXML/JiveXML_336567_2327102923.xml',
);
zip.file('test_data.xml', jivexmlData.text());
const zipBlob = await zip.generateAsync({ type: 'blob' });
Expand Down

0 comments on commit 194df5e

Please sign in to comment.