Skip to content

Commit

Permalink
Introducing geometry URL change
Browse files Browse the repository at this point in the history
  • Loading branch information
DraTeots committed Jul 3, 2024
1 parent 8691ab2 commit a3f4025
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 59 deletions.
20 changes: 18 additions & 2 deletions firebird-ng/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions firebird-ng/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "firebird",
"version": "0.0.3",
"version": "0.0.4",
"scripts": {
"ng": "ng",
"start": "ng serve",
"serve": "ng serve",
"build": "ng build --configuration=production",
"build:ghpages": "ng build --configuration=production --base-href='/firebird/'",
"build:watch": "ng build",
Expand All @@ -14,15 +14,18 @@
"private": true,
"dependencies": {
"@angular/animations": "^17.3.0",
"@angular/cdk": "~17.3.7",
"@angular/common": "^17.3.0",
"@angular/compiler": "^17.3.0",
"@angular/core": "^17.3.0",
"@angular/forms": "^17.3.0",
"@angular/material": "~17.3.7",
"@angular/platform-browser": "^17.3.0",
"@angular/platform-browser-dynamic": "^17.3.0",
"@angular/router": "^17.3.0",
"@tweenjs/tween.js": "^23.1.2",
"@types/picomatch": "^2.3.3",
"angular-split": "^17.2.0",
"jsdom": "^24.0.0",
"jsrootdi": "^7.6.101",
"jszip": "^3.10.1",
Expand Down Expand Up @@ -59,4 +62,4 @@
"path": false,
"vm": false
}
}
}
82 changes: 47 additions & 35 deletions firebird-ng/src/app/input-config/input-config.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,30 @@ <h2>Configure geometry pipeline</h2>
<img src="assets/diagrams/geometry-pipeline.svg" alt="geometry-pipeline">

<form >






<div class="card mt-4">
<div class="card-body">
<h5 class="card-title">Geometry Source</h5>
<div class="form-group">
Geometry file sources are taken from <a href="https://eic.github.io/epic/">https://eic.github.io/epic/</a>
<select class="form-control" [formControl]="selectedGeometry">
<option value="epic-central-optimized">EIC ePIC Central Detector optimized</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_bhcal.root">epic_bhcal.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_calorimeters.root">epic_calorimeters.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_craterlake.root">epic_craterlake.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_10x100.root">epic_craterlake_10x100.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_10x275.root">epic_craterlake_10x275.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_18x110_Au.root">epic_craterlake_18x110_Au.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_18x275.root">epic_craterlake_18x275.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_5x41.root">epic_craterlake_5x41.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_material_map.root">epic_craterlake_material_map.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_no_bhcal.root">epic_craterlake_no_bhcal.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_tracking_only.root">epic_craterlake_tracking_only.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_dirc_only.root">epic_dirc_only.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_drich_only.root">epic_drich_only.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_forward_detectors.root">epic_forward_detectors.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_forward_detectors_with_inserts.root">epic_forward_detectors_with_inserts.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_full.root">epic_full.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_imaging_only.root">epic_imaging_only.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_inner_detector.root">epic_inner_detector.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_ip6.root">epic_ip6.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_ip6_extended.root">epic_ip6_extended.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_lfhcal_only.root">epic_lfhcal_only.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_lfhcal_with_insert.root">epic_lfhcal_with_insert.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_mrich_only.root">epic_mrich_only.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_pfrich_only.root">epic_pfrich_only.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_pid_only.root">epic_pid_only.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_tof_endcap_only.root">epic_tof_endcap_only.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_tof_only.root">epic_tof_only.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_vertex_only.root">epic_vertex_only.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_zdc_lyso_sipm.root">epic_zdc_lyso_sipm.root</option>
<option value="https://eic.github.io/epic/artifacts/tgeo/epic_zdc_sipm_on_tile_only.root">epic_zdc_sipm_on_tile_only.root</option>
</select>
Geometry file source:
<div class="mt-4">
<h6>API Host</h6>
This field sets the host address for the API server.
<mat-form-field class="full-width-field">
<mat-label>Geometry URL</mat-label>
<input type="text" matInput [formControl]="geometryUrl" [matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn">
<mat-option *ngFor="let option of filteredOptions | async" [value]="option" [matTooltip]="option.url">{{option.name}}</mat-option>
</mat-autocomplete>
</mat-form-field>

</div>

</div>

<h5 class="card-title">Events Source</h5>
Expand Down Expand Up @@ -103,7 +89,33 @@ <h6>Merge geometries if possible</h6>
</div>
</div>

<!-- <div class="card mt-4">-->
<!-- USE LOCAL API -->
<div class="card mt-4">
<div class="card-body">
<h5 class="card-title">Server API Configuration</h5>
<div class="form-check custom-control custom-switch mt-4">
<input class="custom-control-input" type="checkbox" id="serverUseApiCheckbox" [formControl]="serverUseApi">
<label class="custom-control-label" for="serverUseApiCheckbox">Use local backend</label>
</div>
<div class="form-row align-items-center">
<div class="col-auto">
<h6 class="mb-0">API Host:</h6>
</div>
<div class="col">
<input class="form-control" type="text" placeholder="Enter API host" [formControl]="serverApiHost" [disabled]="!serverUseApi.value">
</div>
<div class="col-auto">
<h6 class="mb-0">API Port:</h6>
</div>
<div class="col">
<input class="form-control" type="text" placeholder="Enter API port" [formControl]="serverApiPort" [disabled]="!serverUseApi.value">
</div>
</div>
</div>
</div>


<!-- <div class="card mt-4">-->
<!-- <div class="card-body">-->
<!-- <h5 class="card-title">Rendering</h5>-->
<!-- <div class="mt-4">-->
Expand Down
5 changes: 5 additions & 0 deletions firebird-ng/src/app/input-config/input-config.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
background-color: var(--phoenix-background-color-secondary); /* Using theme variables */
color: var(--phoenix-text-color);
}

.full-width-field {
display: block;
width: 100%;
}
87 changes: 84 additions & 3 deletions firebird-ng/src/app/input-config/input-config.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,78 @@ import { UserConfigService } from "../user-config.service";
import { ReactiveFormsModule } from '@angular/forms';
import {RouterLink} from '@angular/router';
import {ConfigProperty} from "../utils/config-property";
import {MatCard, MatCardContent, MatCardTitle} from "@angular/material/card";
import {MatSlideToggle} from "@angular/material/slide-toggle";
import {MatFormField} from "@angular/material/form-field";
import {MatInput, MatLabel} from "@angular/material/input";
import {map, Observable, startWith} from "rxjs";
import {MatAutocomplete, MatAutocompleteTrigger, MatOption} from "@angular/material/autocomplete";
import {AsyncPipe, NgForOf} from "@angular/common";
import {MatTooltip} from "@angular/material/tooltip";

export interface User {
name: string;
url: string;
}

@Component({
selector: 'app-input-config',
standalone: true,
imports: [ReactiveFormsModule, RouterLink],
imports: [ReactiveFormsModule, RouterLink, MatCard, MatCardContent, MatCardTitle, MatSlideToggle, MatFormField, MatInput, MatLabel, MatAutocompleteTrigger, MatAutocomplete, MatOption, AsyncPipe, MatTooltip, NgForOf],
templateUrl: './input-config.component.html',
styleUrl: './input-config.component.scss'
})
export class InputConfigComponent implements OnInit {

selectedGeometry = new FormControl('');
geometrySelectValue = new FormControl('');
geometryUrl = new FormControl('');
selectedEventSource = new FormControl('');
onlyCentralDetector: FormControl<boolean | null> = new FormControl(true);
serverUseApi: FormControl<boolean | null> = new FormControl(false);
serverApiHost = new FormControl('localhost');
serverApiPort: FormControl<number | null> = new FormControl(5454);
filteredOptions: Observable<User[]> = new Observable<User[]>();


myControl = new FormControl<string | User>('');
options: User[] = [
{url: "builtin://epic-central-optimized", name: "EIC ePIC Central Detector optimized"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_bhcal.root", name: "epic_bhcal.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_calorimeters.root", name: "epic_calorimeters.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake.root", name: "epic_craterlake.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_10x100.root", name: "epic_craterlake_10x100.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_10x275.root", name: "epic_craterlake_10x275.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_18x110_Au.root", name: "epic_craterlake_18x110_Au.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_18x275.root", name: "epic_craterlake_18x275.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_5x41.root", name: "epic_craterlake_5x41.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_material_map.root", name: "epic_craterlake_material_map.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_no_bhcal.root", name: "epic_craterlake_no_bhcal.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_craterlake_tracking_only.root", name: "epic_craterlake_tracking_only.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_dirc_only.root", name: "epic_dirc_only.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_drich_only.root", name: "epic_drich_only.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_forward_detectors.root", name: "epic_forward_detectors.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_forward_detectors_with_inserts.root", name: "epic_forward_detectors_with_inserts.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_full.root", name: "epic_full.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_imaging_only.root", name: "epic_imaging_only.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_inner_detector.root", name: "epic_inner_detector.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_ip6.root", name: "epic_ip6.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_ip6_extended.root", name: "epic_ip6_extended.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_lfhcal_only.root", name: "epic_lfhcal_only.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_lfhcal_with_insert.root", name: "epic_lfhcal_with_insert.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_mrich_only.root", name: "epic_mrich_only.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_pfrich_only.root", name: "epic_pfrich_only.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_pid_only.root", name: "epic_pid_only.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_tof_endcap_only.root", name: "epic_tof_endcap_only.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_tof_only.root", name: "epic_tof_only.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_vertex_only.root", name: "epic_vertex_only.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_zdc_lyso_sipm.root", name: "epic_zdc_lyso_sipm.root"},
{url: "https://eic.github.io/epic/artifacts/tgeo/epic_zdc_sipm_on_tile_only.root", name: "epic_zdc_sipm_on_tile_only.root"}
];






constructor(private configService: UserConfigService) {
}
Expand All @@ -41,8 +100,30 @@ export class InputConfigComponent implements OnInit {

ngOnInit(): void {
//this.selectedGeometry.setValue(this.configService.selectedGeometry.value, { emitEvent: false })
this.bindConfigToControl(this.selectedGeometry, this.configService.selectedGeometry);
this.bindConfigToControl(this.geometryUrl, this.configService.selectedGeometry);
this.bindConfigToControl(this.selectedEventSource, this.configService.eventSource);
this.bindConfigToControl(this.onlyCentralDetector, this.configService.onlyCentralDetector);
this.bindConfigToControl(this.serverUseApi, this.configService.localServerUseApi);
this.bindConfigToControl(this.serverApiHost, this.configService.localServerHost);
this.bindConfigToControl(this.serverApiPort, this.configService.localServerPort);

// noinspection JSDeprecatedSymbols
this.filteredOptions = this.myControl.valueChanges.pipe(
startWith(''),
map(value => {
// Get string name
const name = typeof value === 'string' ? value : value?.name;
return name ? this._filter(name as string) : this.options.slice();
})
);
}

displayFn(user: User): string {
return user && user.name ? user.name : '';
}

private _filter(name: string): User[] {
const filterValue = name.toLowerCase();
return this.options.filter(option => option.name.toLowerCase().includes(filterValue));
}
}
7 changes: 7 additions & 0 deletions firebird-ng/src/app/user-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ export class UserConfigService {
public selectedGeometry: ConfigProperty<string>;
public onlyCentralDetector: ConfigProperty<boolean>;
public eventSource: ConfigProperty<string>;
public localServerUseApi: ConfigProperty<boolean>;
public localServerHost: ConfigProperty<string>;
public localServerPort: ConfigProperty<number>;

constructor() {
this.selectedGeometry = new ConfigProperty("geometry.selectedGeometry", "epic-central-optimized");
this.onlyCentralDetector = new ConfigProperty("geometry.onlyCentralDetector", true);
this.eventSource = new ConfigProperty("events.eventsSource", "recommended");
this.localServerUseApi = new ConfigProperty("server.useApi", false);
this.localServerHost = new ConfigProperty("server.host", "localhost");
this.localServerPort = new ConfigProperty("server.port", 5454);

}
}
13 changes: 10 additions & 3 deletions firebird-ng/src/app/utils/config-property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,24 @@ export class ConfigProperty<T> {
* @returns {T} The loaded or default value of the property.
*/
private loadValue(): T {
let storedValue: string|null = null;
let parsedValue: any = undefined;
try {
let storedValue = this.storage.getItem(this.key);
let parsedValue: any;
storedValue = this.storage.getItem(this.key);

if (storedValue !== null) {
parsedValue = (typeof this.defaultValue) !== 'string' ? JSON.parse(storedValue) : storedValue;
} else {
parsedValue = this.defaultValue;
}
return this.validator && !this.validator(parsedValue) ? this.defaultValue : parsedValue;
} catch (error) {
console.error('Error loading value:', error);
console.error(`Error at ConfigProperty.loadValue, key='${this.key}'`);
console.log(' storedValue', storedValue);
console.log(' parsedValue', parsedValue);
console.log(' Default value will be used: ', this.defaultValue);
console.log(error);

return this.defaultValue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion firebird-ng/src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/* You can add global styles to this file, and also import other style files */
@import 'phoenix-ui-components/theming';
// @import 'phoenix-ui-components/theming';
Loading

0 comments on commit a3f4025

Please sign in to comment.