Skip to content

Commit

Permalink
fix pdg toggle for mcparticle tree view
Browse files Browse the repository at this point in the history
  • Loading branch information
brauliorivas committed Jul 1, 2024
1 parent 16288eb commit 0dc5988
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
1 change: 1 addition & 0 deletions js/filter/mcparticle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
start,
getWidthFilterContent,
} from "../menu/filter/filter.js";
import { drawAll } from "../draw.js";

const filter = document.getElementById("filter");
const filters = document.getElementById("filters");
Expand Down
23 changes: 8 additions & 15 deletions js/menu/show-pdg.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
import { Toggle } from "./toggle.js";
import { selectedObjectTypes } from "../main.js";

export class PdgToggle extends Toggle {
constructor(id) {
super(id);
}

toggle(currentObjects, redraw) {
const validObjects = selectedObjectTypes.types;

const collection =
currentObjects.datatypes["edm4hep::MCParticle"].collection;
if (this.isSliderActive) {
for (const objectType of validObjects) {
const collection = currentObjects[objectType].collection;
if (collection[0].PDG === undefined) return;
for (const object of collection) {
object.updateTexImg(`${object.PDG}`);
}
if (collection[0].PDG === undefined) return;
for (const object of collection) {
object.updateTexImg(`${object.PDG}`);
}
} else {
for (const objectType of validObjects) {
const collection = currentObjects[objectType].collection;
if (collection[0].PDG === undefined) return;
for (const object of collection) {
object.updateTexImg(`${object.name}`);
}
if (collection[0].PDG === undefined) return;
for (const object of collection) {
object.updateTexImg(`${object.name}`);
}
}

Expand Down

0 comments on commit 0dc5988

Please sign in to comment.