File

src/loaders/lhcb-loader.ts

Description

PhoenixLoader for processing and loading an LHCb event.

Extends

PhoenixLoader

Index

Properties
Methods

Constructor

constructor()

Constructor for the LHCb loader.

Properties

Private data
Type : any

Event data to be processed.

Protected eventData
Type : any
Inherited from PhoenixLoader
Defined in PhoenixLoader:26

Event data processed by the loader.

Private graphicsLibrary
Type : ThreeManager
Inherited from PhoenixLoader
Defined in PhoenixLoader:22

ThreeService to perform three.js related functions.

Protected labelsObject
Type : literal type
Default value : {}
Inherited from PhoenixLoader
Defined in PhoenixLoader:32

Object containing event object labels.

Protected loadingManager
Type : LoadingManager
Inherited from PhoenixLoader
Defined in PhoenixLoader:28

Loading manager for loadable resources

Protected stateManager
Type : StateManager
Inherited from PhoenixLoader
Defined in PhoenixLoader:30

Loading manager for loadable resources

Private ui
Type : UIManager
Inherited from PhoenixLoader
Defined in PhoenixLoader:24

UIService to perform UI related functions.

Methods

Public getEventData
getEventData()

Process and get the event data.

Returns : any

The processed event data.

getEventMetadata
getEventMetadata()
Inherited from PhoenixLoader
Defined in PhoenixLoader:62

Get LHCb specific metadata associated to the event (experiment info, time, run, event...).

Returns : any[]

Metadata of the event.

Public process
process(data: any)

Set the event data for the loader.

Parameters :
Name Type Optional Description
data any No

Event data as JSON.

Returns : void
Private addCollection
addCollection(objectCollection: any, collectionName: string, getObject: (object: any) => void, objectGroup: Group, concatonateObjs: boolean)
Inherited from PhoenixLoader
Defined in PhoenixLoader:477

Adds to the event display all the objects inside a collection.

Parameters :
Name Type Optional Description
objectCollection any No

Contains the params for every object of the collection.

collectionName string No

Label to UNIQUELY identify the collection.

getObject function No

Handles reconstructing the objects of the collection.

objectGroup Group No

Group containing the collections of the same object type.

concatonateObjs boolean No

If true, don't process objects individually, but process as a group (e.g. for point hits).

Returns : void
Public addLabelToEventObject
addLabelToEventObject(label: string, collection: string, indexInCollection: number)
Inherited from PhoenixLoader
Defined in PhoenixLoader:663

Add label of event object to the labels object.

Parameters :
Name Type Optional Description
label string No

Label to be saved.

collection string No

Collection the event object is a part of.

indexInCollection number No

Event object's index in collection.

Returns : string

A unique label ID string.

Protected addObjectType
addObjectType(object: any, getObject: any, typeName: string, concatonateObjs: boolean, cuts?: Cut[], extendEventDataTypeUI?: (typeFolder?: GUI,typeFolderPM?: PhoenixMenuNode) => void)
Inherited from PhoenixLoader
Defined in PhoenixLoader:415

Adds to the event display all collections of a given object type.

Parameters :
Name Type Optional Default value Description
object any No

Contains all collections of a given type (Tracks, Jets, CaloClusters...).

getObject any No

Function that handles of reconstructing objects of the given type.

typeName string No

Label for naming the object type.

concatonateObjs boolean No false

If true, don't process objects individually, but process as a group (e.g. for point hits). Default is false.

cuts Cut[] Yes

Filters that can be applied to the objects.

extendEventDataTypeUI function Yes

A callback to add more options to event data type UI folder.

Returns : void
Public addScaleOptions
addScaleOptions(configKey: string, configLabel: string, scaleFunction: (value: number) => void)
Inherited from PhoenixLoader
Defined in PhoenixLoader:697

Get function to add options to scale event object type by.

Parameters :
Name Type Optional Description
configKey string No

Key of the scale configuration option (for dat.GUI menu).

configLabel string No

Label of the scale configuration option.

scaleFunction function No

Function to scale the objects by.

Function which adds scale options to Phoenix menu and dat.GUI menu.

Public buildEventData
buildEventData(eventData: any, graphicsLibrary: ThreeManager, ui: UIManager, infoLogger: InfoLogger)
Inherited from PhoenixLoader
Defined in PhoenixLoader:50

Takes an object that represents ONE event and takes care of adding the different objects to the graphics library and the UI controls.

Parameters :
Name Type Optional Description
eventData any No

Object representing the event.

graphicsLibrary ThreeManager No

Service containing functionality to draw the 3D objects.

ui UIManager No

Service for showing menus and controls to manipulate the geometries.

infoLogger InfoLogger No

Service for logging data to the information panel.

Returns : void
Public getCollection
getCollection(collectionName: string)
Inherited from PhoenixLoader
Defined in PhoenixLoader:126

Get the collection with the given collection name from the event data.

Parameters :
Name Type Optional Description
collectionName string No

Name of the collection to get.

Returns : any

An object containing the collection.

Public getCollections
getCollections()
Inherited from PhoenixLoader
Defined in PhoenixLoader:102

Get list of collections in the event data.

Returns : string[]

List of all collection names.

Protected getCompound
getCompound(params: any)
Inherited from PhoenixLoader
Defined in PhoenixLoader:529

Process the compound object (e.g. Muon, Electron, Photon) from the given parameters and get it as a group. FIXME. This is currently here and not in PhoenixObjects because we need to handle linked objects.

Parameters :
Name Type Optional Description
params any No

Parameters of the Muon.

Returns : Object3D

Muon group containing Clusters and Tracks.

Public getEventsList
getEventsList(eventsData: any)
Inherited from PhoenixLoader
Defined in PhoenixLoader:86

Get the list of event names from the event data.

Parameters :
Name Type Optional Description
eventsData any No

Object containing all event data.

Returns : string[]

List of event names.

Public getLabelsObject
getLabelsObject()
Inherited from PhoenixLoader
Defined in PhoenixLoader:686

Get the object containing labels.

Returns : literal type

The labels object.

Private getObjectTypeCollections
getObjectTypeCollections(object: any)
Inherited from PhoenixLoader
Defined in PhoenixLoader:511

Get collection names of a given object type.

Parameters :
Name Type Optional Description
object any No

Contains all collections of a given type (Tracks, Jets, CaloClusters etc.).

Returns : string[]

List of collection names of an object type (Tracks, Jets, CaloClusters etc.).

Protected loadObjectTypes
loadObjectTypes(eventData: any)
Inherited from PhoenixLoader
Defined in PhoenixLoader:147

Receives an object containing the data from an event and parses it to reconstruct the different collections of physics objects.

Parameters :
Name Type Optional Description
eventData any No

Representing ONE event (expressed in the Phoenix format).

Returns : void
import { PhoenixLoader } from './phoenix-loader';

/**
 * PhoenixLoader for processing and loading an LHCb event.
 */
export class LHCbLoader extends PhoenixLoader {
  /** Event data to be processed. */
  private data: any;

  /**
   * Constructor for the LHCb loader.
   */
  constructor() {
    super();
    this.data = {};
  }

  /**
   * Set the event data for the loader.
   * @param data Event data as JSON.
   */
  public process(data: any) {
    console.log('Processing event data');
    this.data = data;
  }

  /**
   * Process and get the event data.
   * @returns The processed event data.
   */
  public getEventData(): any {
    const eventData = {
      eventNumber: this.data.eventNumber,
      runNumber: this.data.runNumber,
      Hits: {},
      Tracks: {},
    };

    const part_list = [];
    const pdata_list = this.data.PARTICLES;
    if (pdata_list) {
      for (let j = 0; j < pdata_list.length; j++) {
        const pdata = pdata_list[j];
        const mom =
          Math.pow(pdata.px, 2) + Math.pow(pdata.py, 2) + Math.pow(pdata.pz, 2);
        const part = {
          particle_id: pdata.name,
          pos: pdata.track,
          mom,
        };
        part_list.push(part);
      }
    }
    eventData.Tracks = { Particles: part_list };
    return eventData;
  }

  /**
   * Get LHCb specific metadata associated to the event (experiment info, time, run, event...).
   * @returns Metadata of the event.
   */
  getEventMetadata(): any[] {
    const metadata = super.getEventMetadata();
    if (this.data['time']) {
      metadata.push({
        label: 'Data recorded',
        value: this.data['time'],
      });
    }
    return metadata;
  }
}

results matching ""

    No results matching ""