Skip to content

Commit 06827f4

Browse files
authored
Merge pull request #709 from matiasmantinan/add-jet-origin
misc (event-display): Add jet origin
2 parents deb9e7f + b586871 commit 06827f4

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

guides/users.md

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ Jets are a list of Jet objects with the following attributes :
192192
* `energy`, `et` (opt) - energy of the Jets, used to set its length
193193
* `coneR` (opt) - the radius of the jet cone. If not given, radius is 10% of the length
194194
* `color` (opt) - Hexadecimal string representing the color to draw the jet.
195+
* `origin_X`, `origin_Y`, `origin_Z` (opt) - Origin of the jet
195196

196197
#### 'Hits'
197198
Hits can be defined in 2 ways. Either as an array of positions or as an array of Hit objects.

packages/phoenix-event-display/src/loaders/objects/phoenix-objects.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,23 @@ export class PhoenixObjects {
208208
// Jet energy parameter can either be 'energy' or 'et'
209209
const length = (jetParams.energy ? jetParams.energy : jetParams.et) * 0.2;
210210

211+
// Add displacement of the origin of the jet
212+
// If x is given else jet is at origin
213+
const origin_X = jetParams.origin_X ? jetParams.origin_X : 0;
214+
// If y is given else jet is at origin
215+
const origin_Y = jetParams.origin_Y ? jetParams.origin_Y : 0;
216+
// If z is given else jet is at origin
217+
const origin_Z = jetParams.origin_Z ? jetParams.origin_Z : 0;
218+
211219
const sphi = Math.sin(phi);
212220
const cphi = Math.cos(phi);
213221
const stheta = Math.sin(theta);
214222
const ctheta = Math.cos(theta);
215223
//
216224
const translation = new Vector3(
217-
0.5 * length * cphi * stheta,
218-
0.5 * length * sphi * stheta,
219-
0.5 * length * ctheta,
225+
0.5 * length * cphi * stheta + origin_X,
226+
0.5 * length * sphi * stheta + origin_Y,
227+
0.5 * length * ctheta + origin_Z,
220228
);
221229

222230
const width = jetParams.coneR

0 commit comments

Comments
 (0)